mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 23:32:09 +00:00
qfcc.c:
add -P,--progs-src so you can specify the name of the progs.src file rest: add/use print_type
This commit is contained in:
parent
55bb282b24
commit
7227ab4363
4 changed files with 50 additions and 2 deletions
|
@ -33,5 +33,6 @@
|
|||
#define __type_h
|
||||
|
||||
struct type_s *pointer_type (struct type_s *aux);
|
||||
void print_type (struct type_s *type);
|
||||
|
||||
#endif//__type_h
|
||||
|
|
|
@ -1431,9 +1431,12 @@ function_expr (expr_t *e1, expr_t *e2)
|
|||
t = ftype->parm_types[i - 1];
|
||||
e->type = expr_types[t->type];
|
||||
}
|
||||
if (t != ftype->parm_types[i - 1])
|
||||
if (t != ftype->parm_types[i - 1]) {
|
||||
print_type (ftype->parm_types[i - 1]); puts("");
|
||||
print_type (t); puts("");
|
||||
err = error (e, "type mismatch for parameter %d of %s",
|
||||
i, e1->e.def->name);
|
||||
}
|
||||
} else {
|
||||
if (e->type == ex_integer && options.warnings.vararg_integer)
|
||||
warning (e, "passing integer consant into ... function");
|
||||
|
|
|
@ -66,10 +66,12 @@ static const char rcsid[] =
|
|||
options_t options;
|
||||
|
||||
char *sourcedir;
|
||||
char *progs_src;
|
||||
const char *this_program;
|
||||
|
||||
static struct option const long_options[] = {
|
||||
{"source", required_argument, 0, 's'},
|
||||
{"progs-src", required_argument, 0, 'P'},
|
||||
{"save-temps", no_argument, 0, 'S'},
|
||||
{"quiet", no_argument, 0, 'q'},
|
||||
{"verbose", no_argument, 0, 'v'},
|
||||
|
@ -730,8 +732,10 @@ DecodeArgs (int argc, char **argv)
|
|||
options.verbosity = 0;
|
||||
|
||||
sourcedir = ".";
|
||||
progs_src = "progs.src";
|
||||
|
||||
while ((c = getopt_long (argc, argv, "s:" // source dir
|
||||
"P:" // progs.src name
|
||||
"q" // quiet
|
||||
"v" // verbose
|
||||
"g" // debug
|
||||
|
@ -757,6 +761,9 @@ DecodeArgs (int argc, char **argv)
|
|||
case 's': // src dir
|
||||
sourcedir = strdup (optarg);
|
||||
break;
|
||||
case 'P': // progs-src
|
||||
progs_src = strdup (optarg);
|
||||
break;
|
||||
case 'q': // quiet
|
||||
options.verbosity -= 1;
|
||||
break;
|
||||
|
@ -921,12 +928,15 @@ main (int argc, char **argv)
|
|||
if (strcmp (sourcedir, ".")) {
|
||||
printf ("Source directory: %s\n", sourcedir);
|
||||
}
|
||||
if (strcmp (progs_src, "progs.src")) {
|
||||
printf ("progs.src: %s\n", progs_src);
|
||||
}
|
||||
|
||||
PR_Opcode_Init_Tables ();
|
||||
|
||||
InitData ();
|
||||
|
||||
snprintf (filename, sizeof (filename), "%s/progs.src", sourcedir);
|
||||
snprintf (filename, sizeof (filename), "%s/%s", sourcedir, progs_src);
|
||||
LoadFile (filename, (void *) &src);
|
||||
|
||||
if (!(src = Parse (src)))
|
||||
|
|
|
@ -45,3 +45,37 @@ pointer_type (type_t *aux)
|
|||
new.aux_type = aux;
|
||||
return PR_FindType (&new);
|
||||
}
|
||||
|
||||
void
|
||||
print_type (type_t *type)
|
||||
{
|
||||
if (!type)
|
||||
printf (" (null)");
|
||||
switch (type->type) {
|
||||
case ev_func:
|
||||
print_type (type->aux_type);
|
||||
if (type->num_parms < 0) {
|
||||
printf ("(...)");
|
||||
} else {
|
||||
int i;
|
||||
printf ("(");
|
||||
for (i = 0; i < type->num_parms; i++) {
|
||||
if (i)
|
||||
printf (", ");
|
||||
print_type (type->parm_types[i]);
|
||||
}
|
||||
printf (")");
|
||||
}
|
||||
break;
|
||||
case ev_pointer:
|
||||
print_type (type->aux_type);
|
||||
if (type->num_parms)
|
||||
printf ("[%d]", type->num_parms);
|
||||
else
|
||||
printf ("[]");
|
||||
break;
|
||||
default:
|
||||
printf(" %s", pr_type_name[type->type]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue