1
0
Fork 0
forked from fte/fteqw

Print out a warning count, added an entnum intrinsic.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1718 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2005-12-16 17:15:43 +00:00
parent db19960aaf
commit 0371d2cab6
4 changed files with 31 additions and 2 deletions

View file

@ -752,7 +752,7 @@ void *QCC_PR_Malloc (int size);
extern QCC_def_t *pr_scope;
extern int pr_error_count;
extern int pr_error_count, pr_warning_count;
void QCC_PR_NewLine (pbool incomment);
QCC_def_t *QCC_PR_GetDef (QCC_type_t *type, char *name, QCC_def_t *scope, pbool allocate, int arraysize);

View file

@ -2471,6 +2471,26 @@ QCC_def_t *QCC_PR_ParseFunctionCall (QCC_def_t *func) //warning, the func could
def_ret.type = rettype;
return &def_ret;
}
else if (!strcmp(func->name, "entnum") && !QCC_PR_CheckToken(")"))
{
//t = (a/%1) / (nextent(world)/%1)
//a/%1 does a (int)entity to float conversion type thing
e = QCC_PR_Expression(TOP_PRIORITY);
QCC_PR_Expect(")");
e = QCC_PR_Statement(&pr_opcodes[OP_DIV_F], e, QCC_MakeIntDef(1), (QCC_dstatement_t **)0xffffffff);
d = QCC_PR_GetDef(NULL, "nextent", NULL, false, 0);
if (!d)
QCC_PR_ParseError(0, "the nextent builtin is not defined");
QCC_FreeTemp(QCC_PR_Statement(&pr_opcodes[OP_STORE_F], e, &def_parms[0], (QCC_dstatement_t **)0xffffffff));
d = QCC_PR_Statement(&pr_opcodes[OP_CALL0], d, NULL, NULL);
d = QCC_PR_Statement(&pr_opcodes[OP_DIV_F], d, QCC_MakeIntDef(1), (QCC_dstatement_t **)0xffffffff);
e = QCC_PR_Statement(&pr_opcodes[OP_DIV_F], e, d, (QCC_dstatement_t **)0xffffffff);
return e;
}
} //so it's not an intrinsic.
if (opt_precache_file) //should we strip out all precache_file calls?
@ -3276,7 +3296,8 @@ QCC_def_t *QCC_PR_ParseValue (QCC_type_t *assumeclass)
if (!d)
{
if ( (!strcmp(name, "random" )) ||
(!strcmp(name, "randomv")) ) //intrinsics, any old function with no args will do.
(!strcmp(name, "randomv")) ||
(!strcmp(name, "entnum")) ) //intrinsics, any old function with no args will do.
od = d = QCC_PR_GetDef (type_function, name, NULL, true, 1);
else if (keyword_class && !strcmp(name, "this"))
{

View file

@ -34,6 +34,7 @@ QCC_eval_t pr_immediate;
char pr_immediate_string[8192];
int pr_error_count;
int pr_warning_count;
CompilerConstant_t *CompilerConstant;
@ -2396,7 +2397,10 @@ void VARGS QCC_PR_ParseWarning (int type, char *error, ...)
pr_error_count++;
}
else
{
printf ("%s:%i: warning: %s\n", strings + s_file, pr_source_line, string);
pr_warning_count++;
}
}
void VARGS QCC_PR_Warning (int type, char *file, int line, char *error, ...)
@ -2415,6 +2419,7 @@ void VARGS QCC_PR_Warning (int type, char *file, int line, char *error, ...)
printf ("%s:%i: warning: %s\n", file, line, string);
else
printf ("warning: %s\n", string);
pr_warning_count++;
}

View file

@ -1477,6 +1477,7 @@ void QCC_PR_BeginCompilation (void *memory, int memsize)
pr.types = NULL;
// type_function->next = NULL;
pr_error_count = 0;
pr_warning_count = 0;
recursivefunctiontype = 0;
freeofs = NULL;
@ -3112,6 +3113,8 @@ void QCC_FinishCompile(void)
printf("numtemps %i\n", numtemps);
printf("%i warnings\n", pr_warning_count);
qcc_compileactive = false;
}