From 20403759b0a2b2b62e5d792a8d34beb4627f3d68 Mon Sep 17 00:00:00 2001 From: Spoike Date: Sun, 5 Feb 2012 01:38:51 +0000 Subject: [PATCH] Stricter typedefs/typenames, so no more random types appearing which were not intended. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@3974 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/qclib/execloop.h | 16 ++++++++-------- engine/qclib/gui.h | 6 +++--- engine/qclib/qcc.h | 3 ++- engine/qclib/qcc_pr_comp.c | 21 +++++++++------------ engine/qclib/qcc_pr_lex.c | 38 ++++++++++++++++++++------------------ engine/qclib/qccgui.c | 28 ++++++++++++++-------------- engine/qclib/qccmain.c | 38 +++++++++++++++++++------------------- engine/qclib/qcdecomp.c | 24 ++++++++++++------------ 8 files changed, 87 insertions(+), 87 deletions(-) diff --git a/engine/qclib/execloop.h b/engine/qclib/execloop.h index b385b79ed..a49d76539 100644 --- a/engine/qclib/execloop.h +++ b/engine/qclib/execloop.h @@ -312,6 +312,7 @@ reeval: ptr->_int = (int)OPA->_float; break; case OP_STOREP_I: + case OP_GSTOREP_I: if ((unsigned int)OPB->_int >= addressableused) { pr_xstatement = st-pr_statements; @@ -321,10 +322,15 @@ reeval: ptr->_int = OPA->_int; break; case OP_STOREP_F: + case OP_GSTOREP_F: case OP_STOREP_ENT: + case OP_GSTOREP_ENT: case OP_STOREP_FLD: // integers + case OP_GSTOREP_FLD: case OP_STOREP_S: + case OP_GSTOREP_S: case OP_STOREP_FNC: // pointers + case OP_GSTOREP_FNC: if ((unsigned int)OPB->_int >= addressableused) { pr_xstatement = st-pr_statements; @@ -334,6 +340,7 @@ reeval: ptr->_int = OPA->_int; break; case OP_STOREP_V: + case OP_GSTOREP_V: if ((unsigned int)OPB->_int >= addressableused) { pr_xstatement = st-pr_statements; @@ -815,7 +822,7 @@ reeval: { i = (unsigned int)OPB->_float; ptr = (eval_t*)PR_StringToNative(progfuncs, OPA->_int); - if (i > strlen((char*)ptr)) + if ((size_t)i > strlen((char*)ptr)) { pr_xstatement = st-pr_statements; PR_RunError (progfuncs, "bad pointer read in %s (%i bytes into %s)", PR_StringToNative(progfuncs, pr_xfunction->s_name), i, ptr); @@ -1120,13 +1127,6 @@ reeval: OPC->_int = (OPA->_float != OPB->_int); break; - case OP_GSTOREP_I: - case OP_GSTOREP_F: - case OP_GSTOREP_ENT: - case OP_GSTOREP_FLD: // integers - case OP_GSTOREP_S: - case OP_GSTOREP_FNC: // pointers - case OP_GSTOREP_V: case OP_GADDRESS: case OP_GLOAD_I: case OP_GLOAD_F: diff --git a/engine/qclib/gui.h b/engine/qclib/gui.h index 66ad9c56c..341aedb40 100644 --- a/engine/qclib/gui.h +++ b/engine/qclib/gui.h @@ -4,9 +4,9 @@ void EditFile(char *name, int line); void GUI_SetDefaultOpts(void); int GUI_BuildParms(char *args, char **argv); -unsigned char *QCC_ReadFile (char *fname, void *buffer, int len); -int QCC_FileSize (char *fname); -pbool QCC_WriteFile (char *name, void *data, int len); +unsigned char *QCC_ReadFile (const char *fname, void *buffer, int len); +int QCC_FileSize (const char *fname); +pbool QCC_WriteFile (const char *name, void *data, int len); void GUI_DialogPrint(char *title, char *text); extern char parameters[16384]; diff --git a/engine/qclib/qcc.h b/engine/qclib/qcc.h index 81517b413..aaf6533fa 100644 --- a/engine/qclib/qcc.h +++ b/engine/qclib/qcc.h @@ -306,6 +306,7 @@ typedef struct QCC_type_s unsigned int ofs; //inside a structure. unsigned int size; unsigned int arraysize; + pbool typedefed; char *name; } QCC_type_t; int typecmp(QCC_type_t *a, QCC_type_t *b); @@ -536,7 +537,7 @@ void QCC_PR_PrintStatement (QCC_dstatement_t *s); void QCC_PR_Lex (void); // reads the next token into pr_token and classifies its type -QCC_type_t *QCC_PR_NewType (char *name, int basictype); +QCC_type_t *QCC_PR_NewType (char *name, int basictype, pbool typedefed); QCC_type_t *QCC_PointerTypeTo(QCC_type_t *type); QCC_type_t *QCC_PR_ParseType (int newtype, pbool silentfail); extern pbool type_inlinefunction; diff --git a/engine/qclib/qcc_pr_comp.c b/engine/qclib/qcc_pr_comp.c index 03ba3a8de..bc6ea4560 100644 --- a/engine/qclib/qcc_pr_comp.c +++ b/engine/qclib/qcc_pr_comp.c @@ -133,7 +133,6 @@ void *(*pHash_GetNext)(hashtable_t *table, const char *name, void *old); void *(*pHash_Add)(hashtable_t *table, const char *name, void *data, bucket_t *); QCC_def_t *QCC_PR_DummyDef(QCC_type_t *type, char *name, QCC_def_t *scope, int arraysize, unsigned int ofs, int referable, pbool saved); -QCC_type_t *QCC_PR_NewType (char *name, int basictype); QCC_type_t *QCC_PR_FindType (QCC_type_t *type); QCC_type_t *QCC_PR_PointerType (QCC_type_t *pointsto); QCC_type_t *QCC_PR_FieldType (QCC_type_t *pointsto); @@ -1393,10 +1392,8 @@ static void QCC_FreeTemps(void) while(t) { if (t->used && !pr_error_count) //don't print this after an error jump out. - { - QCC_PR_ParseWarning(WARN_DEBUGGING, "Temp was used in %s", pr_scope->name); - t->used = false; - } + QCC_PR_ParseWarning(WARN_DEBUGGING, "Internal: temp(ofs %i) was not released in %s. This implies miscompilation.", t->ofs, pr_scope->name); + t->used = false; t = t->next; } } @@ -2387,7 +2384,6 @@ QCC_def_t *QCC_PR_Statement (QCC_opcode_t *op, QCC_def_t *var_a, QCC_def_t *var_ else { /*it came from an OP_ADDRESS - st says the instruction*/ - var_c = QCC_GetTemp(*op->type_c); if (need_lock) QCC_LockTemp(var_c); /*that temp needs to be preserved over calls*/ @@ -3994,7 +3990,7 @@ QCC_def_t *QCC_MakeTranslateStringConst(char *value) QCC_type_t *QCC_PointerTypeTo(QCC_type_t *type) { QCC_type_t *newtype; - newtype = QCC_PR_NewType("ptr", ev_pointer); + newtype = QCC_PR_NewType("ptr", ev_pointer, false); newtype->aux_type = type; return newtype; } @@ -4089,8 +4085,8 @@ void QCC_PR_EmitFieldsForMembers(QCC_type_t *clas) continue; //we need the type in here so saved games can still work without saving ints as floats. (would be evil) - ft = QCC_PR_NewType(basictypenames[mt->type], ev_field); - ft->aux_type = QCC_PR_NewType(basictypenames[mt->type], mt->type); + ft = QCC_PR_NewType(basictypenames[mt->type], ev_field, false); + ft->aux_type = QCC_PR_NewType(basictypenames[mt->type], mt->type, false); ft->aux_type->aux_type = type_void; ft->size = ft->aux_type->size; ft = QCC_PR_FindType(ft); @@ -4452,7 +4448,7 @@ QCC_def_t *QCC_PR_ParseValue (QCC_type_t *assumeclass, pbool allowarrayassign) } d->type = t; } - else if (d->type->type == ev_string) + else if (d->type->type == ev_string && d->arraysize == 0) { d = QCC_PR_Statement(&pr_opcodes[OP_LOADP_C], d, QCC_SupplyConversion(idx, ev_float, true), NULL); } @@ -8329,7 +8325,7 @@ QCC_def_t *QCC_PR_DummyFieldDef(QCC_type_t *type, char *name, QCC_def_t *scope, sprintf(newname, "%s%s.%s", name, array, parttype->name); else sprintf(newname, "%s%s", parttype->name, array); - ftype = QCC_PR_NewType("FIELD TYPE", ev_field); + ftype = QCC_PR_NewType("FIELD TYPE", ev_field, false); ftype->aux_type = parttype; if (parttype->type == ev_vector) ftype->size = parttype->size; //vector fields create a _y and _z too, so we need this still. @@ -8350,7 +8346,7 @@ QCC_def_t *QCC_PR_DummyFieldDef(QCC_type_t *type, char *name, QCC_def_t *scope, sprintf(newname, "%s%s.%s", name, array, parttype->name); else sprintf(newname, "%s%s", parttype->name, array); - ftype = QCC_PR_NewType("FIELD TYPE", ev_field); + ftype = QCC_PR_NewType("FIELD TYPE", ev_field, false); ftype->aux_type = parttype; def = QCC_PR_GetDef(ftype, newname, scope, true, 0, saved); def->initialized = true; @@ -8850,6 +8846,7 @@ void QCC_PR_ParseDefs (char *classname) QCC_PR_ParseError(ERR_NOTANAME, "typedef found unexpected tokens"); } type->name = QCC_CopyString(pr_token)+strings; + type->typedefed = true; QCC_PR_Lex(); QCC_PR_Expect(";"); return; diff --git a/engine/qclib/qcc_pr_lex.c b/engine/qclib/qcc_pr_lex.c index a3b9d46b0..7a4319ba6 100644 --- a/engine/qclib/qcc_pr_lex.c +++ b/engine/qclib/qcc_pr_lex.c @@ -2925,7 +2925,6 @@ a new one and copies it out. */ //0 if same -QCC_type_t *QCC_PR_NewType (char *name, int basictype); int typecmp(QCC_type_t *a, QCC_type_t *b) { if (a == b) @@ -2972,7 +2971,7 @@ QCC_type_t *QCC_PR_DuplicateType(QCC_type_t *in) if (!in) return NULL; - out = QCC_PR_NewType(in->name, in->type); + out = QCC_PR_NewType(in->name, in->type, false); out->aux_type = QCC_PR_DuplicateType(in->aux_type); out->param = QCC_PR_DuplicateType(in->param); ip = in->param; @@ -3162,7 +3161,6 @@ char pr_parm_names[MAX_PARMS][MAX_NAME]; pbool recursivefunctiontype; -QCC_type_t *QCC_PR_NewType (char *name, int basictype); //expects a ( to have already been parsed. QCC_type_t *QCC_PR_ParseFunctionType (int newtype, QCC_type_t *returntype) { @@ -3174,7 +3172,7 @@ QCC_type_t *QCC_PR_ParseFunctionType (int newtype, QCC_type_t *returntype) recursivefunctiontype++; - ftype = QCC_PR_NewType(type_function->name, ev_function); + ftype = QCC_PR_NewType(type_function->name, ev_function, false); ftype->aux_type = returntype; // return type ftype->num_parms = 0; @@ -3255,7 +3253,7 @@ QCC_type_t *QCC_PR_ParseFunctionTypeReacc (int newtype, QCC_type_t *returntype) recursivefunctiontype++; - ftype = QCC_PR_NewType(type_function->name, ev_function); + ftype = QCC_PR_NewType(type_function->name, ev_function, false); ftype->aux_type = returntype; // return type ftype->num_parms = 0; @@ -3282,13 +3280,13 @@ QCC_type_t *QCC_PR_ParseFunctionTypeReacc (int newtype, QCC_type_t *returntype) { sprintf(argname, "arg%i", ftype->num_parms); name = argname; - nptype = QCC_PR_NewType("Variant", ev_variant); + nptype = QCC_PR_NewType("Variant", ev_variant, false); } else if (QCC_PR_CheckName("vect")) //this can only be of vector sizes, so... { sprintf(argname, "arg%i", ftype->num_parms); name = argname; - nptype = QCC_PR_NewType("Vector", ev_vector); + nptype = QCC_PR_NewType("Vector", ev_vector, false); } else { @@ -3326,7 +3324,7 @@ QCC_type_t *QCC_PR_ParseFunctionTypeReacc (int newtype, QCC_type_t *returntype) QCC_type_t *QCC_PR_PointerType (QCC_type_t *pointsto) { QCC_type_t *ptype, *e; - ptype = QCC_PR_NewType("ptr", ev_pointer); + ptype = QCC_PR_NewType("ptr", ev_pointer, false); ptype->aux_type = pointsto; e = QCC_PR_FindType (ptype); if (e == ptype) @@ -3342,7 +3340,7 @@ QCC_type_t *QCC_PR_FieldType (QCC_type_t *pointsto) QCC_type_t *ptype; char name[128]; sprintf(name, "FIELD TYPE(%s)", pointsto->name); - ptype = QCC_PR_NewType(name, ev_field); + ptype = QCC_PR_NewType(name, ev_field, false); ptype->aux_type = pointsto; ptype->size = ptype->aux_type->size; return QCC_PR_FindType (ptype); @@ -3366,14 +3364,14 @@ QCC_type_t *QCC_PR_ParseType (int newtype, pbool silentfail) if (QCC_PR_CheckToken ("..")) //so we don't end up with the user specifying '. .vector blah' (hexen2 added the .. token for array ranges) { - newt = QCC_PR_NewType("FIELD TYPE", ev_field); + newt = QCC_PR_NewType("FIELD TYPE", ev_field, false); newt->aux_type = QCC_PR_ParseType (false, false); newt->size = newt->aux_type->size; newt = QCC_PR_FindType (newt); - type = QCC_PR_NewType("FIELD TYPE", ev_field); + type = QCC_PR_NewType("FIELD TYPE", ev_field, false); type->aux_type = newt; type->size = type->aux_type->size; @@ -3384,7 +3382,7 @@ QCC_type_t *QCC_PR_ParseType (int newtype, pbool silentfail) } if (QCC_PR_CheckToken (".")) { - newt = QCC_PR_NewType("FIELD TYPE", ev_field); + newt = QCC_PR_NewType("FIELD TYPE", ev_field, false); newt->aux_type = QCC_PR_ParseType (false, false); newt->size = newt->aux_type->size; @@ -3412,6 +3410,8 @@ QCC_type_t *QCC_PR_ParseType (int newtype, pbool silentfail) /* Look to see if this type is already defined */ for(i=0;isize=type_entity->size; @@ -3480,7 +3480,7 @@ QCC_type_t *QCC_PR_ParseType (int newtype, pbool silentfail) newparm->name = QCC_CopyString("")+strings; sprintf(membername, "%s::"MEMBERFIELDNAME, classname, newparm->name); - fieldtype = QCC_PR_NewType(newparm->name, ev_field); + fieldtype = QCC_PR_NewType(newparm->name, ev_field, false); fieldtype->aux_type = newparm; fieldtype->size = newparm->size; QCC_PR_GetDef(fieldtype, membername, pr_scope, 2, 0, false); @@ -3503,7 +3503,7 @@ QCC_type_t *QCC_PR_ParseType (int newtype, pbool silentfail) } if (QCC_PR_CheckKeyword (keyword_struct, "struct")) { - newt = QCC_PR_NewType("struct", ev_struct); + newt = QCC_PR_NewType("struct", ev_struct, false); newt->size=0; QCC_PR_Expect("{"); @@ -3518,7 +3518,7 @@ QCC_type_t *QCC_PR_ParseType (int newtype, pbool silentfail) { if (!newparm) QCC_PR_ParseError(ERR_NOTANAME, "element missing type"); - newparm = QCC_PR_NewType(newparm->name, newparm->type); + newparm = QCC_PR_NewType(newparm->name, newparm->type, false); } else newparm = QCC_PR_ParseType(true, false); @@ -3550,7 +3550,7 @@ QCC_type_t *QCC_PR_ParseType (int newtype, pbool silentfail) } if (QCC_PR_CheckKeyword (keyword_union, "union")) { - newt = QCC_PR_NewType("union", ev_union); + newt = QCC_PR_NewType("union", ev_union, false); newt->size=0; QCC_PR_Expect("{"); @@ -3565,7 +3565,7 @@ QCC_type_t *QCC_PR_ParseType (int newtype, pbool silentfail) { if (!newparm) QCC_PR_ParseError(ERR_NOTANAME, "element missing type"); - newparm = QCC_PR_NewType(newparm->name, newparm->type); + newparm = QCC_PR_NewType(newparm->name, newparm->type, false); } else newparm = QCC_PR_ParseType(true, false); @@ -3601,6 +3601,8 @@ QCC_type_t *QCC_PR_ParseType (int newtype, pbool silentfail) type = NULL; for (i = 0; i < numtypeinfos; i++) { + if (!qcc_typeinfo[i].typedefed) + continue; if (!STRCMP(qcc_typeinfo[i].name, name)) { type = &qcc_typeinfo[i]; diff --git a/engine/qclib/qccgui.c b/engine/qclib/qccgui.c index fb45a4f21..9bcd90777 100644 --- a/engine/qclib/qccgui.c +++ b/engine/qclib/qccgui.c @@ -15,7 +15,7 @@ LoadFile ============== */ -unsigned char *QCC_ReadFile (char *fname, void *buffer, int len) +unsigned char *QCC_ReadFile (const char *fname, void *buffer, int len) { long length; FILE *f; @@ -30,7 +30,7 @@ unsigned char *QCC_ReadFile (char *fname, void *buffer, int len) return buffer; } -int QCC_FileSize (char *fname) +int QCC_FileSize (const char *fname) { long length; FILE *f; @@ -44,7 +44,7 @@ int QCC_FileSize (char *fname) return length; } -pbool QCC_WriteFile (char *name, void *data, int len) +pbool QCC_WriteFile (const char *name, void *data, int len) { long length; FILE *f; @@ -959,9 +959,9 @@ void EditFile(char *name, int line) menufile = CreateMenu(); menuhelp = CreateMenu(); menunavig = CreateMenu(); - AppendMenu(menu, MF_POPUP, (UINT)menufile, "&File"); - AppendMenu(menu, MF_POPUP, (UINT)menunavig, "&Navigation"); - AppendMenu(menu, MF_POPUP, (UINT)menuhelp, "&Help"); + AppendMenu(menu, MF_POPUP, (UINT_PTR)menufile, "&File"); + AppendMenu(menu, MF_POPUP, (UINT_PTR)menunavig, "&Navigation"); + AppendMenu(menu, MF_POPUP, (UINT_PTR)menuhelp, "&Help"); AppendMenu(menufile, 0, IDM_OPENNEW, "Open &new file "); AppendMenu(menufile, 0, IDM_SAVE, "&Save "); // AppendMenu(menufile, 0, IDM_FIND, "&Find"); @@ -1003,7 +1003,7 @@ void EditFile(char *name, int line) mcs.lParam = 0; neweditor->window = (HWND) SendMessage (mdibox, WM_MDICREATE, 0, - (LONG) (LPMDICREATESTRUCT) &mcs); + (LONG_PTR) (LPMDICREATESTRUCT) &mcs); } else { @@ -1069,7 +1069,7 @@ void EditorsRun(void) } -char *GUIReadFile(char *fname, void *buffer, int blen) +char *GUIReadFile(const char *fname, void *buffer, int blen) { editor_t *e; for (e = editors; e; e = e->next) @@ -1085,7 +1085,7 @@ char *GUIReadFile(char *fname, void *buffer, int blen) return QCC_ReadFile(fname, buffer, blen); } -int GUIFileSize(char *fname) +int GUIFileSize(const char *fname) { editor_t *e; for (e = editors; e; e = e->next) @@ -1600,20 +1600,20 @@ static LONG CALLBACK MainWndProc(HWND hWnd,UINT message, HMENU rootmenu, windowmenu, m; rootmenu = CreateMenu(); - AppendMenu(rootmenu, MF_POPUP, (UINT)(m = CreateMenu()), "&File"); + AppendMenu(rootmenu, MF_POPUP, (UINT_PTR)(m = CreateMenu()), "&File"); AppendMenu(m, 0, IDM_OPENNEW, "Open &new file "); AppendMenu(m, 0, IDM_SAVE, "&Save "); // AppendMenu(m, 0, IDM_FIND, "&Find"); AppendMenu(m, 0, IDM_UNDO, "&Undo Ctrl+Z"); AppendMenu(m, 0, IDM_REDO, "&Redo Ctrl+Y"); - AppendMenu(rootmenu, MF_POPUP, (UINT)(m = CreateMenu()), "&Navigation"); + AppendMenu(rootmenu, MF_POPUP, (UINT_PTR)(m = CreateMenu()), "&Navigation"); AppendMenu(m, 0, IDM_GOTODEF, "Go to definition"); AppendMenu(m, 0, IDM_OPENDOCU, "Open selected file"); - AppendMenu(rootmenu, MF_POPUP, (UINT)(m = windowmenu = CreateMenu()), "&Window"); + AppendMenu(rootmenu, MF_POPUP, (UINT_PTR)(m = windowmenu = CreateMenu()), "&Window"); AppendMenu(m, 0, IDM_CASCADE, "&Cascade"); AppendMenu(m, 0, IDM_TILE_HORIZ, "Tile &Horizontally"); AppendMenu(m, 0, IDM_TILE_VERT, "Tile &Vertically"); - AppendMenu(rootmenu, MF_POPUP, (UINT)(m = CreateMenu()), "&Help"); + AppendMenu(rootmenu, MF_POPUP, (UINT_PTR)(m = CreateMenu()), "&Help"); AppendMenu(m, 0, IDM_ABOUT, "About"); SetMenu(hWnd, rootmenu); @@ -2033,7 +2033,7 @@ void CreateOutputWindow(void) mcs.lParam = 0; outputwindow = (HWND) SendMessage (mdibox, WM_MDICREATE, 0, - (LONG) (LPMDICREATESTRUCT) &mcs); + (LONG_PTR) (LPMDICREATESTRUCT) &mcs); ShowWindow(outputwindow, SW_SHOW); } diff --git a/engine/qclib/qccmain.c b/engine/qclib/qccmain.c index 3cb170f7b..f6972a784 100644 --- a/engine/qclib/qccmain.c +++ b/engine/qclib/qccmain.c @@ -1603,7 +1603,7 @@ PR_PrintDefs QCC_PR_PrintOfs (d->ofs); }*/ -QCC_type_t *QCC_PR_NewType (char *name, int basictype) +QCC_type_t *QCC_PR_NewType (char *name, int basictype, pbool typedefed) { if (numtypeinfos>= maxtypeinfos) QCC_Error(ERR_TOOMANYTYPES, "Too many types"); @@ -1614,6 +1614,7 @@ QCC_type_t *QCC_PR_NewType (char *name, int basictype) qcc_typeinfo[numtypeinfos].param = NULL; qcc_typeinfo[numtypeinfos].size = type_size[basictype]; qcc_typeinfo[numtypeinfos].arraysize = 0; + qcc_typeinfo[numtypeinfos].typedefed = typedefed; numtypeinfos++; @@ -1649,34 +1650,33 @@ void QCC_PR_BeginCompilation (void *memory, int memsize) pr_global_defs[i] = &def_void; */ - type_void = QCC_PR_NewType("void", ev_void); - type_string = QCC_PR_NewType("string", ev_string); - type_float = QCC_PR_NewType("float", ev_float); - type_vector = QCC_PR_NewType("vector", ev_vector); - type_entity = QCC_PR_NewType("entity", ev_entity); - type_field = QCC_PR_NewType("__field", ev_field); - type_function = QCC_PR_NewType("__function", ev_function); - type_pointer = QCC_PR_NewType("__pointer", ev_pointer); - type_integer = QCC_PR_NewType("__integer", ev_integer); - type_variant = QCC_PR_NewType("__variant", ev_variant); + type_void = QCC_PR_NewType("void", ev_void, true); + type_string = QCC_PR_NewType("string", ev_string, true); + type_float = QCC_PR_NewType("float", ev_float, true); + type_vector = QCC_PR_NewType("vector", ev_vector, true); + type_entity = QCC_PR_NewType("entity", ev_entity, true); + type_field = QCC_PR_NewType("__field", ev_field, false); + type_function = QCC_PR_NewType("__function", ev_function, false); + type_pointer = QCC_PR_NewType("__pointer", ev_pointer, false); + type_integer = QCC_PR_NewType("__integer", ev_integer, true); + type_variant = QCC_PR_NewType("variant", ev_variant, true); + type_variant = QCC_PR_NewType("__variant", ev_variant, true); - type_floatfield = QCC_PR_NewType("fieldfloat", ev_field); + type_floatfield = QCC_PR_NewType("fieldfloat", ev_field, false); type_floatfield->aux_type = type_float; - type_pointer->aux_type = QCC_PR_NewType("pointeraux", ev_float); + type_pointer->aux_type = QCC_PR_NewType("pointeraux", ev_float, false); - type_intpointer = QCC_PR_NewType("__intpointer", ev_pointer); + type_intpointer = QCC_PR_NewType("__intpointer", ev_pointer, false); type_intpointer->aux_type = type_integer; - type_floatpointer = QCC_PR_NewType("__floatpointer", ev_pointer); + type_floatpointer = QCC_PR_NewType("__floatpointer", ev_pointer, false); type_floatpointer->aux_type = type_float; type_function->aux_type = type_void; //type_field->aux_type = type_float; - if (keyword_integer) - type_integer = QCC_PR_NewType("integer", ev_integer); - if (keyword_int) - type_integer = QCC_PR_NewType("int", ev_integer); + type_integer = QCC_PR_NewType("integer", ev_integer, keyword_integer?true:false); + type_integer = QCC_PR_NewType("int", ev_integer, keyword_integer?true:false); diff --git a/engine/qclib/qcdecomp.c b/engine/qclib/qcdecomp.c index e488a2fd7..8e0b27885 100644 --- a/engine/qclib/qcdecomp.c +++ b/engine/qclib/qcdecomp.c @@ -55,7 +55,7 @@ extern QCC_type_t *type_floatpointer; extern QCC_type_t *type_intpointer; extern QCC_type_t *type_floatfield;// = {ev_field/*, &def_field*/, NULL, &type_float}; -QCC_type_t *QCC_PR_NewType (char *name, int basictype); +QCC_type_t *QCC_PR_NewType (char *name, int basictype, pbool typedefed); jmp_buf decompilestatementfailure; @@ -765,21 +765,21 @@ void FigureOutTypes(progfuncs_t *progfuncs) memset(ofstype, 0, sizeof(*ofstype)*65535); memset(ofsflags, 0, sizeof(*ofsflags)*65535); - type_void = QCC_PR_NewType("void", ev_void); - type_string = QCC_PR_NewType("string", ev_string); - type_float = QCC_PR_NewType("float", ev_float); - type_vector = QCC_PR_NewType("vector", ev_vector); - type_entity = QCC_PR_NewType("entity", ev_entity); - type_field = QCC_PR_NewType("field", ev_field); - type_function = QCC_PR_NewType("function", ev_function); - type_pointer = QCC_PR_NewType("pointer", ev_pointer); - type_integer = QCC_PR_NewType("integer", ev_integer); + type_void = QCC_PR_NewType("void", ev_void, true); + type_string = QCC_PR_NewType("string", ev_string, true); + type_float = QCC_PR_NewType("float", ev_float, true); + type_vector = QCC_PR_NewType("vector", ev_vector, true); + type_entity = QCC_PR_NewType("entity", ev_entity, true); + type_field = QCC_PR_NewType("field", ev_field, false); + type_function = QCC_PR_NewType("function", ev_function, false); + type_pointer = QCC_PR_NewType("pointer", ev_pointer, false); + type_integer = QCC_PR_NewType("integer", ev_integer, true); // type_variant = QCC_PR_NewType("__variant", ev_variant); - type_floatfield = QCC_PR_NewType("fieldfloat", ev_field); + type_floatfield = QCC_PR_NewType("fieldfloat", ev_field, false); type_floatfield->aux_type = type_float; - type_pointer->aux_type = QCC_PR_NewType("pointeraux", ev_float); + type_pointer->aux_type = QCC_PR_NewType("pointeraux", ev_float, false); type_function->aux_type = type_void;