longer tokens for later processing. This can be useful if there are
several similar macros that perform similar functions.
+Please note that a space is required after \c{%+}, in order to
+disambiguate it from the syntax \c{%+1} used in multiline macros.
+
As an example, consider the following:
\c %define BDASTART 400h ; Start of BIOS data area
SMacro *next;
char *name;
int casesense;
- int nparam;
+ unsigned int nparam;
int in_progress;
Token *expansion;
};
MMacro *rep_nest; /* used for nesting %rep */
Token **params; /* actual parameters */
Token *iline; /* invocation line */
- int nparam, rotate, *paramlen;
+ unsigned int nparam, rotate;
+ int *paramlen;
uint32_t unique;
int lineno; /* Current line number on expansion */
};
error(ERR_NONFATAL,
"`%%rotate' invoked within macro without parameters");
} else {
- mmac->rotate = mmac->rotate + reloc_value(evalresult);
+ int rotate = mmac->rotate + reloc_value(evalresult);
- if (mmac->rotate < 0)
- mmac->rotate =
- mmac->nparam - (-mmac->rotate) % mmac->nparam;
- mmac->rotate %= mmac->nparam;
+ rotate %= (int)mmac->nparam;
+ if (rotate < 0)
+ rotate += mmac->nparam;
+
+ mmac->rotate = rotate;
}
return DIRECTIVE_FOUND;
Token *tt;
int i, j, k, m;
+ if (!t)
+ return -1; /* Probably a %+ without a space */
+
skip_white_(t);
if (t->type != TOK_ID)
return -1;
char *text = NULL;
int type = 0, cc; /* type = 0 to placate optimisers */
char tmpbuf[30];
- int n, i;
+ unsigned int n;
+ int i;
MMacro *mac;
t = tline;
SMacro *head = NULL, *m;
Token **params;
int *paramsize;
- int nparam, sparam, brackets, rescan;
+ unsigned int nparam, sparam;
+ int brackets, rescan;
Token *org_tline = tline;
Context *ctx;
char *mname;