-Added parenthises counter to the QCC_PR_CheakCompConst, so you can now

compile e.g. myMacro( strcat( "A", "B" ) ) correctly.
 (I hope I didnt break anything though)


git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@691 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Andreas Kirsch 2004-12-27 18:47:32 +00:00
parent f0f7fa4bf0
commit c3886a301b

View file

@ -1839,13 +1839,16 @@ int QCC_PR_CheakCompConst(void)
char buffer[1024]; char buffer[1024];
char *paramoffset[MAXCONSTANTPARAMS+1]; char *paramoffset[MAXCONSTANTPARAMS+1];
int param=0; int param=0;
int plevel=0;
pr_file_p++; pr_file_p++;
QCC_PR_LexWhitespace(); QCC_PR_LexWhitespace();
start = pr_file_p; start = pr_file_p;
while(1) while(1)
{ {
if (*pr_file_p == ',' || *pr_file_p == ')') if (*pr_file_p == '(')
plevel++;
else if (!plevel && (*pr_file_p == ',' || *pr_file_p == ')'))
{ {
paramoffset[param++] = start; paramoffset[param++] = start;
start = pr_file_p+1; start = pr_file_p+1;
@ -1860,7 +1863,9 @@ int QCC_PR_CheakCompConst(void)
QCC_PR_LexWhitespace(); QCC_PR_LexWhitespace();
if (param == MAXCONSTANTPARAMS) if (param == MAXCONSTANTPARAMS)
QCC_PR_ParseError(ERR_TOOMANYPARAMS, "Too many parameters in macro call"); QCC_PR_ParseError(ERR_TOOMANYPARAMS, "Too many parameters in macro call");
} } else if (*pr_file_p == ')' )
plevel--;
if (!*pr_file_p) if (!*pr_file_p)
QCC_PR_ParseError(ERR_EOF, "EOF on macro call"); QCC_PR_ParseError(ERR_EOF, "EOF on macro call");
pr_file_p++; pr_file_p++;