Blub\0's latest patch. This one fixes up for arguments.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@3027 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2008-07-27 02:48:59 +00:00
parent 7c6f37c4ae
commit 8af647d7d4
1 changed files with 20 additions and 2 deletions

View File

@ -2070,7 +2070,10 @@ int QCC_PR_CheakCompConst(void)
*pr_file_p = '\0';
pr_file_p++;
while(*pr_file_p == ' ' || *pr_file_p == '\t')
{
pr_file_p++;
start++;
}
// move back by one char because we move forward by one at the end of the loop
pr_file_p--;
if (param == MAXCONSTANTPARAMS)
@ -2078,9 +2081,10 @@ int QCC_PR_CheakCompConst(void)
} else if (*pr_file_p == ')' )
plevel--;
// see that *pr_file_p = '\0' up there? Must ++ BEFORE checking for !*pr_file_p
pr_file_p++;
if (!*pr_file_p)
QCC_PR_ParseError(ERR_EOF, "EOF on macro call");
pr_file_p++;
}
if (param < c->numparams)
QCC_PR_ParseError(ERR_TOOFEWPARAMS, "Not enough macro parameters");
@ -2101,7 +2105,19 @@ int QCC_PR_CheakCompConst(void)
}
buffer[p] = 0;
if (*pr_file_p == '#') //if you ask for #a##b you will be shot. use #a #b instead, or chain macros.
if(*pr_file_p == '\"')
{
do
{
buffer[p++] = *pr_file_p;
++pr_file_p;
} while( (pr_file_p[-1] == '\\' || pr_file_p[0] != '\"') && *pr_file_p && *pr_file_p != '\n' );
buffer[p++] = *pr_file_p; // copy the end-quote too
buffer[p] = 0;
++pr_file_p; // and skip it
continue;
}
else if (*pr_file_p == '#') //if you ask for #a##b you will be shot. use #a #b instead, or chain macros.
{
if (pr_file_p[1] == '#')
{ //concatinate (srip out whitespace)
@ -3312,3 +3328,5 @@ QCC_type_t *QCC_PR_ParseType (int newtype)
#endif