Improve checking and documentation for %ifctx

This commit is contained in:
Victor van den Elzen 2008-07-23 13:21:29 +02:00
parent bb266eaa4b
commit 0e857f1fe5
3 changed files with 12 additions and 10 deletions

View file

@ -2206,9 +2206,9 @@ or a numeric value) to a single-line macro.
\S{strcat} \i{Concatenating Strings}: \i\c{%strcat}
The \{%strcat} operator concatenates quoted strings and assign them to
The \c{%strcat} operator concatenates quoted strings and assign them to
a single-line macro. In doing so, it may change the type of quotes
and possibly use \c{\}-escapes inside \c{`}-quoted strings in order to
and possibly use \c{\\}-escapes inside \c{`}-quoted strings in order to
make sure the string is still a valid quoted string.
For example:
@ -2222,7 +2222,7 @@ Similarly:
... would assign the value \c{`"'`} to \c{beta}.
The use of commas to separate strings are permitted but optional.
The use of commas to separate strings is permitted but optional.
\S{strlen} \i{String Length}: \i\c{%strlen}
@ -2773,10 +2773,10 @@ of \c{%ifmacro}. Additional tests can be performed in \c{%elif} blocks by using
\S{ifctx} \i\c{%ifctx}: Testing the Context Stack\I{testing, context
stack}
The conditional-assembly construct \c{%ifctx ctxname} will cause the
The conditional-assembly construct \c{%ifctx} will cause the
subsequent code to be assembled if and only if the top context on
the preprocessor's context stack has the name \c{ctxname}. As with
\c{%ifdef}, the inverse and \c{%elif} forms \i\c{%ifnctx},
the preprocessor's context stack has the same name as one of the arguments.
As with \c{%ifdef}, the inverse and \c{%elif} forms \i\c{%ifnctx},
\i\c{%elifctx} and \i\c{%elifnctx} are also supported.
For more details of the context stack, see \k{ctxstack}. For a

View file

@ -1486,15 +1486,17 @@ static bool if_condition(Token * tline, enum preproc_token ct)
switch (i) {
case PPC_IFCTX:
j = false; /* have we matched yet? */
while (cstk && tline) {
while (true) {
skip_white_(tline);
if (!tline || tline->type != TOK_ID) {
if (!tline)
break;
if (tline->type != TOK_ID) {
error(ERR_NONFATAL,
"`%s' expects context identifiers", pp_directives[ct]);
free_tlist(origline);
return -1;
}
if (cstk->name && !nasm_stricmp(tline->text, cstk->name))
if (cstk && cstk->name && !nasm_stricmp(tline->text, cstk->name))
j = true;
tline = tline->next;
}

View file

@ -1,2 +1,2 @@
;Testname=version; Arguments=-v; Files=.stdout .stderr
;Testname=version; Arguments=-v; Files=.stdout
;Dummy test to record version numbers