BlackHC's patch to add support for \ (backslash) in macros

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2879 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Lance 2008-01-26 18:32:41 +00:00
parent 3d44f91d3a
commit 8c6dccbb70
2 changed files with 23 additions and 11 deletions

View File

@ -8673,10 +8673,14 @@ pbool QCC_PR_CompileFile (char *string, char *filename)
pr_file_p = string;
pr_source_line = 0;
QCC_PR_NewLine (false);
QCC_PR_Lex (); // read first token
if( setjmp( pr_parse_abort ) ) {
// dont count it as error
} else {
QCC_PR_NewLine (false);
QCC_PR_Lex (); // read first token
}
memcpy(&oldjb, &pr_parse_abort, sizeof(oldjb));
while (pr_token_type != tt_eof)

View File

@ -1924,16 +1924,22 @@ void QCC_PR_ConditionCompilation(void)
s++;
while(1)
{
if (*s == '\r' || *s == '\n' || *s == '\0')
if( *s == '\\' )
{
if (s[-1] == '\\')
// read over a newline if necessary
if( s[1] == '\n' || s[1] == '\r' )
{
s++;
*d++ = *s++;
if( s[-1] == '\r' && s[0] == '\n' )
{
*d++ = *s++;
}
}
else if (s[-2] == '\\' && s[-1] == '\r' && s[0] == '\n')
{
}
else
break;
}
else if(*s == '\r' || *s == '\n' || *s == '\0')
{
break;
}
if (!quote && s[0]=='/'&&(s[1]=='/'||s[1]=='*'))
@ -1960,6 +1966,8 @@ void QCC_PR_ConditionCompilation(void)
else
QCC_PR_ParseWarning(WARN_IDENTICALPRECOMPILER, "Identical precompiler definition of %s", pr_token);
}
pr_file_p = s;
}
int QCC_PR_CheakCompConst(void)
@ -2107,7 +2115,7 @@ int QCC_PR_CheakCompConst(void)
{
strcat(buffer, "#");
strcat(buffer, qcc_token);
QCC_PR_ParseWarning(0, "Stingification ignored");
QCC_PR_ParseWarning(0, "Stringification ignored");
}
continue; //already did this one
}