summaryrefslogtreecommitdiff
path: root/Help.c
diff options
context:
space:
mode:
authorAsh Wolf <ninji@wuffs.org>2022-10-19 21:16:13 +0100
committerAsh Wolf <ninji@wuffs.org>2022-10-19 21:16:13 +0100
commitd1f153d34b023d81768f6087f67dbfff714bafc9 (patch)
treea694d470a60655d0cda15a70791fbdb90a2398cf /Help.c
parent775b6861666af36d317fb577cf489e2c6377f878 (diff)
downloadMWCC-d1f153d34b023d81768f6087f67dbfff714bafc9.tar.gz
MWCC-d1f153d34b023d81768f6087f67dbfff714bafc9.zip
let's commit all this before my VM blows up and nukes my work
Diffstat (limited to '')
-rw-r--r--unsorted/Help.c (renamed from Help.c)31
1 files changed, 16 insertions, 15 deletions
diff --git a/Help.c b/unsorted/Help.c
index aaa4e9f..ceeb278 100644
--- a/Help.c
+++ b/unsorted/Help.c
@@ -1,4 +1,5 @@
-#include "includes/mwcc_decomp.h"
+#include "parser.h"
+
typedef struct _Side {
short offset;
short width;
@@ -8,12 +9,12 @@ typedef struct _Side {
short indent;
short vrow;
short vcol;
- unsigned char atEOL;
- unsigned char impInd;
+ Boolean atEOL;
+ Boolean impInd;
} Side;
short helpExtras;
-unsigned char showedHelp;
+Boolean showedHelp;
Side left;
Side right;
Side all;
@@ -217,7 +218,7 @@ int Help_Option(struct OptionList *lst, struct Option *opt, int subprint, const
if (!(parseopts.helpFlags & HELPFLAGS_NORMAL) && !(opt->avail & OTF_ALL_HIDDEN_BY_DEFAULT))
return 0;
- if (opt->help || (opt->avail & OTF8000)) {
+ if (opt->help || (opt->avail & OTF_HAS_SUB_OPTIONS)) {
allNoArgs = 1;
lastparam = 0;
if (parseopts.helpFlags & HELPFLAGS_SPACES)
@@ -239,7 +240,7 @@ int Help_Option(struct OptionList *lst, struct Option *opt, int subprint, const
slflags = slflags | SLFLAGS_20;
break;
}
- if (opt->avail & OTF2)
+ if (opt->avail & OTF_STICKY)
slflags = slflags | SLFLAGS_40;
Utils_SpellList(opt->names[0] ? opt->names : "...", pfbuf, slflags);
@@ -323,7 +324,7 @@ int Help_Option(struct OptionList *lst, struct Option *opt, int subprint, const
Side_Print(&left, "[%s", (scan != firstparam) ? "," : subprint ? "=" : SEPOPTSTR);
}
} else {
- Side_Print(&left, (scan != firstparam) ? "," : subprint ? "=" : ((opt->avail & OTF2) && !strchr(opt->names, '|')) ? "" : SEPOPTSTR);
+ Side_Print(&left, (scan != firstparam) ? "," : subprint ? "=" : ((opt->avail & OTF_STICKY) && !strchr(opt->names, '|')) ? "" : SEPOPTSTR);
}
Side_Print(&left, "%s", desc);
if (((scan->flags & PARAMFLAGS_3) == PARAMFLAGS_2) && scan->which != PARAMWHICH_Setting && scan->which != PARAMWHICH_IfArg) {
@@ -335,7 +336,7 @@ int Help_Option(struct OptionList *lst, struct Option *opt, int subprint, const
else
Side_Print(&right, "; if parameter specified, %s", help);
}
- if (defaul && !(opt->avail & OTF2000)) {
+ if (defaul && !(opt->avail & OTF_HIDE_DEFAULT)) {
if (firstparam == scan)
Side_Print(&right, "; default is %s", defaul);
else
@@ -347,7 +348,7 @@ int Help_Option(struct OptionList *lst, struct Option *opt, int subprint, const
scan = scan->next;
}
- if (allNoArgs && !(opt->avail & OTF2000)) {
+ if (allNoArgs && !(opt->avail & OTF_HIDE_DEFAULT)) {
PARAM_T *scan = opt->param;
Boolean isdefault = scan ? 1 : 0;
while (scan && isdefault) {
@@ -363,15 +364,15 @@ int Help_Option(struct OptionList *lst, struct Option *opt, int subprint, const
if (opt->avail & OTF_MEANINGLESS)
Side_Print(&right, "; meaningless for this target");
- if ((opt->avail & OTF8000) && opt->sub) {
+ if ((opt->avail & OTF_HAS_SUB_OPTIONS) && opt->sub) {
if (!allNoArgs) {
Side_Print(
&left,
"%s",
- (opt->avail & OTF10000) ? ((lastparam->flags & PARAMFLAGS_8) ? "[=" : "[,") : ((lastparam->flags & PARAMFLAGS_8) ? "," : "=")
+ (opt->avail & OTF_SUB_OPTIONS_OPTIONAL) ? ((lastparam->flags & PARAMFLAGS_8) ? "[=" : "[,") : ((lastparam->flags & PARAMFLAGS_8) ? "," : "=")
);
- } else if (!(opt->avail & OTF2)) {
- if (opt->avail & OTF10000) {
+ } else if (!(opt->avail & OTF_STICKY)) {
+ if (opt->avail & OTF_SUB_OPTIONS_OPTIONAL) {
if (SEPOPTSTR[0] == ' ')
Side_Print(&left, subprint ? "[=" : " [");
else
@@ -380,7 +381,7 @@ int Help_Option(struct OptionList *lst, struct Option *opt, int subprint, const
Side_Print(&left, "%c", subprint ? '=' : SEPOPTSTR[0]);
}
} else {
- if (opt->avail & OTF10000) {
+ if (opt->avail & OTF_SUB_OPTIONS_OPTIONAL) {
Side_Print(&left, subprint ? "[" : (SEPOPTSTR[0] == ' ') ? " [" : "[");
}
}
@@ -390,7 +391,7 @@ int Help_Option(struct OptionList *lst, struct Option *opt, int subprint, const
"%s%s%s",
opt->sub->help ? opt->sub->help : "keyword",
(opt->sub->flags & PARAMFLAGS_1) ? "" : "[,...]",
- (opt->avail & OTF10000) ? "]" : ""
+ (opt->avail & OTF_SUB_OPTIONS_OPTIONAL) ? "]" : ""
);
Side_Print(&left, "\t");