diff --git a/tools/qfcc/source/idstuff.c b/tools/qfcc/source/idstuff.c index f9d12dac8..ac7caff00 100644 --- a/tools/qfcc/source/idstuff.c +++ b/tools/qfcc/source/idstuff.c @@ -53,6 +53,7 @@ static __attribute__ ((used)) const char rcsid[] = #include "idstuff.h" #include "options.h" #include "strpool.h" +#include "symtab.h" #include "type.h" #define MAX_SOUNDS 1024 @@ -194,7 +195,7 @@ WriteFiles (const char *sourcedir) int WriteProgdefs (const char *filename) { -// def_t *d; + def_t *d; FILE *f; unsigned short crc; int c; @@ -207,11 +208,11 @@ WriteProgdefs (const char *filename) fprintf (f, "\n/* file generated by qcc, do not modify */" "\n\ntypedef struct\n{\tint\tpad[%i];\n", RESERVED_OFS); -#if 0 //FIXME - for (d = pr.scope->head; d; d = d->def_next) { + + for (d = pr.near_data->defs; d; d = d->next) { if (d->name && !strcmp (d->name, "end_sys_globals")) break; - if (!d->ofs) + if (!d->offset) continue; if (!d->name || *d->name == '.' || !*d->name) continue; @@ -222,7 +223,6 @@ WriteProgdefs (const char *filename) break; case ev_vector: fprintf (f, "\tvec3_t\t%s;\n", d->name); - d = d->def_next->def_next->def_next; // skip the elements break; case ev_quat: fprintf (f, "\tquat_t\t%s;\n", d->name); @@ -245,11 +245,11 @@ WriteProgdefs (const char *filename) // print all fields fprintf (f, "typedef struct\n{\n"); - for (d = pr.scope->head; d; d = d->def_next) { + for (d = pr.near_data->defs; d; d = d->next) { if (d->name && !strcmp (d->name, "end_sys_fields")) break; - if (!d->name || !d->ofs || d->type->type != ev_field) + if (!d->name || !d->offset || d->type->type != ev_field) continue; switch (d->type->t.fldptr.type->type) { @@ -258,7 +258,6 @@ WriteProgdefs (const char *filename) break; case ev_vector: fprintf (f, "\tvec3_t\t%s;\n", d->name); - d = d->def_next->def_next->def_next; // skip the elements break; case ev_string: fprintf (f, "\tstring_t\t%s;\n", d->name); @@ -275,7 +274,7 @@ WriteProgdefs (const char *filename) } } fprintf (f, "} entvars_t;\n\n"); -#endif + fclose (f); // do a crc of the file diff --git a/tools/qfcc/source/type.c b/tools/qfcc/source/type.c index b4282fd5a..0b9185334 100644 --- a/tools/qfcc/source/type.c +++ b/tools/qfcc/source/type.c @@ -450,16 +450,10 @@ print_type_str (dstring_t *str, type_t *type) dasprintf (str, " enum %s", type->name); break; case ty_struct: + dasprintf (str, " struct %s", type->name); + break; case ty_union: - { - const char *tag = "struct"; - - if (type->t.symtab) {//FIXME - if (type->t.symtab->type == stab_union) - tag = "union"; - } - dasprintf (str, " %s %s", tag, type->name); - } + dasprintf (str, " union %s", type->name); break; case ty_array: print_type_str (str, type->t.array.type);