Added fix for var void() func = blah;
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1257 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
acf77a47eb
commit
d98ae49588
|
@ -155,6 +155,33 @@ void QCC_PR_PrintNextLine (void)
|
||||||
printf ("\n");
|
printf ("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern char qccmsourcedir[];
|
||||||
|
//also meant to include it.
|
||||||
|
void QCC_FindBestInclude(char *newfile, char *currentfile, char *rootpath)
|
||||||
|
{
|
||||||
|
char fullname[10248];
|
||||||
|
char *stripfrom;
|
||||||
|
|
||||||
|
char *end = fullname;
|
||||||
|
|
||||||
|
if (!*newfile)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for(stripfrom = currentfile+strlen(currentfile)-1; stripfrom>currentfile; stripfrom--)
|
||||||
|
{
|
||||||
|
if (*stripfrom == '/' || *stripfrom == '\\')
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
strcpy(end, rootpath); end = end+strlen(end);
|
||||||
|
if (*fullname)
|
||||||
|
strcpy(end, "/"); end = end+strlen(end);
|
||||||
|
strncpy(end, currentfile, stripfrom - currentfile); end += stripfrom - currentfile; *end = '\0';
|
||||||
|
strcpy(end, newfile);
|
||||||
|
|
||||||
|
QCC_Include(fullname);
|
||||||
|
}
|
||||||
|
|
||||||
int ForcedCRC;
|
int ForcedCRC;
|
||||||
int QCC_PR_LexInteger (void);
|
int QCC_PR_LexInteger (void);
|
||||||
void QCC_AddFile (char *filename);
|
void QCC_AddFile (char *filename);
|
||||||
|
@ -502,8 +529,8 @@ pbool QCC_PR_Precompiler(void)
|
||||||
}
|
}
|
||||||
if (!strcmp(pr_token, "#endlist"))
|
if (!strcmp(pr_token, "#endlist"))
|
||||||
break;
|
break;
|
||||||
printf("Including: %s\n", pr_token);
|
|
||||||
QCC_Include(pr_token);
|
QCC_FindBestInclude(pr_token, compilingfile, qccmsourcedir);
|
||||||
|
|
||||||
if (*pr_file_p == '\r')
|
if (*pr_file_p == '\r')
|
||||||
pr_file_p++;
|
pr_file_p++;
|
||||||
|
@ -534,8 +561,7 @@ pbool QCC_PR_Precompiler(void)
|
||||||
while(*pr_file_p <= ' ')
|
while(*pr_file_p <= ' ')
|
||||||
pr_file_p++;
|
pr_file_p++;
|
||||||
|
|
||||||
strncpy(msg, compilingfile, sizeof(msg));
|
msg[0] = '\0';
|
||||||
msg[sizeof(msg)-1] = '\0';
|
|
||||||
if (*pr_file_p == '\"')
|
if (*pr_file_p == '\"')
|
||||||
sm = '\"';
|
sm = '\"';
|
||||||
else if (*pr_file_p == '<')
|
else if (*pr_file_p == '<')
|
||||||
|
@ -545,38 +571,21 @@ pbool QCC_PR_Precompiler(void)
|
||||||
QCC_PR_ParseError(0, "Not a string literal");
|
QCC_PR_ParseError(0, "Not a string literal");
|
||||||
sm = 0;
|
sm = 0;
|
||||||
}
|
}
|
||||||
|
pr_file_p++;
|
||||||
//msg already contains the current file name
|
a=0;
|
||||||
for (a = strlen(msg)-1; a > 0; a--)
|
while(*pr_file_p != sm)
|
||||||
{
|
{
|
||||||
if (msg[a] == '/' || msg[a] == '\\') //eeeevil windows.
|
if (*pr_file_p == '\n')
|
||||||
{
|
{
|
||||||
a++;
|
QCC_PR_ParseError(0, "#include continued over line boundy\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
msg[a++] = *pr_file_p;
|
||||||
|
pr_file_p++;
|
||||||
}
|
}
|
||||||
|
msg[a] = 0;
|
||||||
|
|
||||||
rellen = a;
|
QCC_FindBestInclude(msg, compilingfile, qccmsourcedir);
|
||||||
|
|
||||||
pr_file_p++;
|
|
||||||
for (;a<1023;a++)
|
|
||||||
{
|
|
||||||
if (*pr_file_p == sm || !*pr_file_p)
|
|
||||||
break;
|
|
||||||
msg[a] = *pr_file_p++;
|
|
||||||
}
|
|
||||||
msg[a] = '\0';
|
|
||||||
|
|
||||||
a = 0;
|
|
||||||
if (externs->FileSize(msg)<0)
|
|
||||||
{
|
|
||||||
if (externs->FileSize(msg+rellen)>=0)
|
|
||||||
a = rellen;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("Including: %s\n", msg+a);
|
|
||||||
QCC_Include(msg+a);
|
|
||||||
|
|
||||||
pr_file_p++;
|
pr_file_p++;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue