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
This commit is contained in:
parent
a722205543
commit
20403759b0
8 changed files with 87 additions and 87 deletions
|
@ -312,6 +312,7 @@ reeval:
|
||||||
ptr->_int = (int)OPA->_float;
|
ptr->_int = (int)OPA->_float;
|
||||||
break;
|
break;
|
||||||
case OP_STOREP_I:
|
case OP_STOREP_I:
|
||||||
|
case OP_GSTOREP_I:
|
||||||
if ((unsigned int)OPB->_int >= addressableused)
|
if ((unsigned int)OPB->_int >= addressableused)
|
||||||
{
|
{
|
||||||
pr_xstatement = st-pr_statements;
|
pr_xstatement = st-pr_statements;
|
||||||
|
@ -321,10 +322,15 @@ reeval:
|
||||||
ptr->_int = OPA->_int;
|
ptr->_int = OPA->_int;
|
||||||
break;
|
break;
|
||||||
case OP_STOREP_F:
|
case OP_STOREP_F:
|
||||||
|
case OP_GSTOREP_F:
|
||||||
case OP_STOREP_ENT:
|
case OP_STOREP_ENT:
|
||||||
|
case OP_GSTOREP_ENT:
|
||||||
case OP_STOREP_FLD: // integers
|
case OP_STOREP_FLD: // integers
|
||||||
|
case OP_GSTOREP_FLD:
|
||||||
case OP_STOREP_S:
|
case OP_STOREP_S:
|
||||||
|
case OP_GSTOREP_S:
|
||||||
case OP_STOREP_FNC: // pointers
|
case OP_STOREP_FNC: // pointers
|
||||||
|
case OP_GSTOREP_FNC:
|
||||||
if ((unsigned int)OPB->_int >= addressableused)
|
if ((unsigned int)OPB->_int >= addressableused)
|
||||||
{
|
{
|
||||||
pr_xstatement = st-pr_statements;
|
pr_xstatement = st-pr_statements;
|
||||||
|
@ -334,6 +340,7 @@ reeval:
|
||||||
ptr->_int = OPA->_int;
|
ptr->_int = OPA->_int;
|
||||||
break;
|
break;
|
||||||
case OP_STOREP_V:
|
case OP_STOREP_V:
|
||||||
|
case OP_GSTOREP_V:
|
||||||
if ((unsigned int)OPB->_int >= addressableused)
|
if ((unsigned int)OPB->_int >= addressableused)
|
||||||
{
|
{
|
||||||
pr_xstatement = st-pr_statements;
|
pr_xstatement = st-pr_statements;
|
||||||
|
@ -815,7 +822,7 @@ reeval:
|
||||||
{
|
{
|
||||||
i = (unsigned int)OPB->_float;
|
i = (unsigned int)OPB->_float;
|
||||||
ptr = (eval_t*)PR_StringToNative(progfuncs, OPA->_int);
|
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_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);
|
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);
|
OPC->_int = (OPA->_float != OPB->_int);
|
||||||
break;
|
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_GADDRESS:
|
||||||
case OP_GLOAD_I:
|
case OP_GLOAD_I:
|
||||||
case OP_GLOAD_F:
|
case OP_GLOAD_F:
|
||||||
|
|
|
@ -4,9 +4,9 @@ void EditFile(char *name, int line);
|
||||||
void GUI_SetDefaultOpts(void);
|
void GUI_SetDefaultOpts(void);
|
||||||
int GUI_BuildParms(char *args, char **argv);
|
int GUI_BuildParms(char *args, char **argv);
|
||||||
|
|
||||||
unsigned char *QCC_ReadFile (char *fname, void *buffer, int len);
|
unsigned char *QCC_ReadFile (const char *fname, void *buffer, int len);
|
||||||
int QCC_FileSize (char *fname);
|
int QCC_FileSize (const char *fname);
|
||||||
pbool QCC_WriteFile (char *name, void *data, int len);
|
pbool QCC_WriteFile (const char *name, void *data, int len);
|
||||||
void GUI_DialogPrint(char *title, char *text);
|
void GUI_DialogPrint(char *title, char *text);
|
||||||
|
|
||||||
extern char parameters[16384];
|
extern char parameters[16384];
|
||||||
|
|
|
@ -306,6 +306,7 @@ typedef struct QCC_type_s
|
||||||
unsigned int ofs; //inside a structure.
|
unsigned int ofs; //inside a structure.
|
||||||
unsigned int size;
|
unsigned int size;
|
||||||
unsigned int arraysize;
|
unsigned int arraysize;
|
||||||
|
pbool typedefed;
|
||||||
char *name;
|
char *name;
|
||||||
} QCC_type_t;
|
} QCC_type_t;
|
||||||
int typecmp(QCC_type_t *a, QCC_type_t *b);
|
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);
|
void QCC_PR_Lex (void);
|
||||||
// reads the next token into pr_token and classifies its type
|
// 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_PointerTypeTo(QCC_type_t *type);
|
||||||
QCC_type_t *QCC_PR_ParseType (int newtype, pbool silentfail);
|
QCC_type_t *QCC_PR_ParseType (int newtype, pbool silentfail);
|
||||||
extern pbool type_inlinefunction;
|
extern pbool type_inlinefunction;
|
||||||
|
|
|
@ -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 *);
|
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_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_FindType (QCC_type_t *type);
|
||||||
QCC_type_t *QCC_PR_PointerType (QCC_type_t *pointsto);
|
QCC_type_t *QCC_PR_PointerType (QCC_type_t *pointsto);
|
||||||
QCC_type_t *QCC_PR_FieldType (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)
|
while(t)
|
||||||
{
|
{
|
||||||
if (t->used && !pr_error_count) //don't print this after an error jump out.
|
if (t->used && !pr_error_count) //don't print this after an error jump out.
|
||||||
{
|
QCC_PR_ParseWarning(WARN_DEBUGGING, "Internal: temp(ofs %i) was not released in %s. This implies miscompilation.", t->ofs, pr_scope->name);
|
||||||
QCC_PR_ParseWarning(WARN_DEBUGGING, "Temp was used in %s", pr_scope->name);
|
t->used = false;
|
||||||
t->used = false;
|
|
||||||
}
|
|
||||||
t = t->next;
|
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
|
else
|
||||||
{
|
{
|
||||||
/*it came from an OP_ADDRESS - st says the instruction*/
|
/*it came from an OP_ADDRESS - st says the instruction*/
|
||||||
var_c = QCC_GetTemp(*op->type_c);
|
|
||||||
if (need_lock)
|
if (need_lock)
|
||||||
QCC_LockTemp(var_c); /*that temp needs to be preserved over calls*/
|
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 *QCC_PointerTypeTo(QCC_type_t *type)
|
||||||
{
|
{
|
||||||
QCC_type_t *newtype;
|
QCC_type_t *newtype;
|
||||||
newtype = QCC_PR_NewType("ptr", ev_pointer);
|
newtype = QCC_PR_NewType("ptr", ev_pointer, false);
|
||||||
newtype->aux_type = type;
|
newtype->aux_type = type;
|
||||||
return newtype;
|
return newtype;
|
||||||
}
|
}
|
||||||
|
@ -4089,8 +4085,8 @@ void QCC_PR_EmitFieldsForMembers(QCC_type_t *clas)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
//we need the type in here so saved games can still work without saving ints as floats. (would be evil)
|
//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 = QCC_PR_NewType(basictypenames[mt->type], ev_field, false);
|
||||||
ft->aux_type = QCC_PR_NewType(basictypenames[mt->type], mt->type);
|
ft->aux_type = QCC_PR_NewType(basictypenames[mt->type], mt->type, false);
|
||||||
ft->aux_type->aux_type = type_void;
|
ft->aux_type->aux_type = type_void;
|
||||||
ft->size = ft->aux_type->size;
|
ft->size = ft->aux_type->size;
|
||||||
ft = QCC_PR_FindType(ft);
|
ft = QCC_PR_FindType(ft);
|
||||||
|
@ -4452,7 +4448,7 @@ QCC_def_t *QCC_PR_ParseValue (QCC_type_t *assumeclass, pbool allowarrayassign)
|
||||||
}
|
}
|
||||||
d->type = t;
|
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);
|
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);
|
sprintf(newname, "%s%s.%s", name, array, parttype->name);
|
||||||
else
|
else
|
||||||
sprintf(newname, "%s%s", parttype->name, array);
|
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;
|
ftype->aux_type = parttype;
|
||||||
if (parttype->type == ev_vector)
|
if (parttype->type == ev_vector)
|
||||||
ftype->size = parttype->size; //vector fields create a _y and _z too, so we need this still.
|
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);
|
sprintf(newname, "%s%s.%s", name, array, parttype->name);
|
||||||
else
|
else
|
||||||
sprintf(newname, "%s%s", parttype->name, array);
|
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;
|
ftype->aux_type = parttype;
|
||||||
def = QCC_PR_GetDef(ftype, newname, scope, true, 0, saved);
|
def = QCC_PR_GetDef(ftype, newname, scope, true, 0, saved);
|
||||||
def->initialized = true;
|
def->initialized = true;
|
||||||
|
@ -8850,6 +8846,7 @@ void QCC_PR_ParseDefs (char *classname)
|
||||||
QCC_PR_ParseError(ERR_NOTANAME, "typedef found unexpected tokens");
|
QCC_PR_ParseError(ERR_NOTANAME, "typedef found unexpected tokens");
|
||||||
}
|
}
|
||||||
type->name = QCC_CopyString(pr_token)+strings;
|
type->name = QCC_CopyString(pr_token)+strings;
|
||||||
|
type->typedefed = true;
|
||||||
QCC_PR_Lex();
|
QCC_PR_Lex();
|
||||||
QCC_PR_Expect(";");
|
QCC_PR_Expect(";");
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -2925,7 +2925,6 @@ a new one and copies it out.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//0 if same
|
//0 if same
|
||||||
QCC_type_t *QCC_PR_NewType (char *name, int basictype);
|
|
||||||
int typecmp(QCC_type_t *a, QCC_type_t *b)
|
int typecmp(QCC_type_t *a, QCC_type_t *b)
|
||||||
{
|
{
|
||||||
if (a == b)
|
if (a == b)
|
||||||
|
@ -2972,7 +2971,7 @@ QCC_type_t *QCC_PR_DuplicateType(QCC_type_t *in)
|
||||||
if (!in)
|
if (!in)
|
||||||
return NULL;
|
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->aux_type = QCC_PR_DuplicateType(in->aux_type);
|
||||||
out->param = QCC_PR_DuplicateType(in->param);
|
out->param = QCC_PR_DuplicateType(in->param);
|
||||||
ip = in->param;
|
ip = in->param;
|
||||||
|
@ -3162,7 +3161,6 @@ char pr_parm_names[MAX_PARMS][MAX_NAME];
|
||||||
|
|
||||||
pbool recursivefunctiontype;
|
pbool recursivefunctiontype;
|
||||||
|
|
||||||
QCC_type_t *QCC_PR_NewType (char *name, int basictype);
|
|
||||||
//expects a ( to have already been parsed.
|
//expects a ( to have already been parsed.
|
||||||
QCC_type_t *QCC_PR_ParseFunctionType (int newtype, QCC_type_t *returntype)
|
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++;
|
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->aux_type = returntype; // return type
|
||||||
ftype->num_parms = 0;
|
ftype->num_parms = 0;
|
||||||
|
@ -3255,7 +3253,7 @@ QCC_type_t *QCC_PR_ParseFunctionTypeReacc (int newtype, QCC_type_t *returntype)
|
||||||
|
|
||||||
recursivefunctiontype++;
|
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->aux_type = returntype; // return type
|
||||||
ftype->num_parms = 0;
|
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);
|
sprintf(argname, "arg%i", ftype->num_parms);
|
||||||
name = argname;
|
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...
|
else if (QCC_PR_CheckName("vect")) //this can only be of vector sizes, so...
|
||||||
{
|
{
|
||||||
sprintf(argname, "arg%i", ftype->num_parms);
|
sprintf(argname, "arg%i", ftype->num_parms);
|
||||||
name = argname;
|
name = argname;
|
||||||
nptype = QCC_PR_NewType("Vector", ev_vector);
|
nptype = QCC_PR_NewType("Vector", ev_vector, false);
|
||||||
}
|
}
|
||||||
else
|
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 *QCC_PR_PointerType (QCC_type_t *pointsto)
|
||||||
{
|
{
|
||||||
QCC_type_t *ptype, *e;
|
QCC_type_t *ptype, *e;
|
||||||
ptype = QCC_PR_NewType("ptr", ev_pointer);
|
ptype = QCC_PR_NewType("ptr", ev_pointer, false);
|
||||||
ptype->aux_type = pointsto;
|
ptype->aux_type = pointsto;
|
||||||
e = QCC_PR_FindType (ptype);
|
e = QCC_PR_FindType (ptype);
|
||||||
if (e == ptype)
|
if (e == ptype)
|
||||||
|
@ -3342,7 +3340,7 @@ QCC_type_t *QCC_PR_FieldType (QCC_type_t *pointsto)
|
||||||
QCC_type_t *ptype;
|
QCC_type_t *ptype;
|
||||||
char name[128];
|
char name[128];
|
||||||
sprintf(name, "FIELD TYPE(%s)", pointsto->name);
|
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->aux_type = pointsto;
|
||||||
ptype->size = ptype->aux_type->size;
|
ptype->size = ptype->aux_type->size;
|
||||||
return QCC_PR_FindType (ptype);
|
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)
|
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->aux_type = QCC_PR_ParseType (false, false);
|
||||||
|
|
||||||
newt->size = newt->aux_type->size;
|
newt->size = newt->aux_type->size;
|
||||||
|
|
||||||
newt = QCC_PR_FindType (newt);
|
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->aux_type = newt;
|
||||||
|
|
||||||
type->size = type->aux_type->size;
|
type->size = type->aux_type->size;
|
||||||
|
@ -3384,7 +3382,7 @@ QCC_type_t *QCC_PR_ParseType (int newtype, pbool silentfail)
|
||||||
}
|
}
|
||||||
if (QCC_PR_CheckToken ("."))
|
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->aux_type = QCC_PR_ParseType (false, false);
|
||||||
|
|
||||||
newt->size = newt->aux_type->size;
|
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 */
|
/* Look to see if this type is already defined */
|
||||||
for(i=0;i<numtypeinfos;i++)
|
for(i=0;i<numtypeinfos;i++)
|
||||||
{
|
{
|
||||||
|
if (!qcc_typeinfo[i].typedefed)
|
||||||
|
continue;
|
||||||
if (STRCMP(qcc_typeinfo[i].name, classname) == 0)
|
if (STRCMP(qcc_typeinfo[i].name, classname) == 0)
|
||||||
{
|
{
|
||||||
newt = &qcc_typeinfo[i];
|
newt = &qcc_typeinfo[i];
|
||||||
|
@ -3426,7 +3426,7 @@ QCC_type_t *QCC_PR_ParseType (int newtype, pbool silentfail)
|
||||||
QCC_PR_ParseError(ERR_REDECLARATION, "Redeclaration of class %s", classname);
|
QCC_PR_ParseError(ERR_REDECLARATION, "Redeclaration of class %s", classname);
|
||||||
|
|
||||||
if (!newt)
|
if (!newt)
|
||||||
newt = QCC_PR_NewType(classname, ev_entity);
|
newt = QCC_PR_NewType(classname, ev_entity, true);
|
||||||
|
|
||||||
newt->size=type_entity->size;
|
newt->size=type_entity->size;
|
||||||
|
|
||||||
|
@ -3480,7 +3480,7 @@ QCC_type_t *QCC_PR_ParseType (int newtype, pbool silentfail)
|
||||||
newparm->name = QCC_CopyString("")+strings;
|
newparm->name = QCC_CopyString("")+strings;
|
||||||
|
|
||||||
sprintf(membername, "%s::"MEMBERFIELDNAME, classname, newparm->name);
|
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->aux_type = newparm;
|
||||||
fieldtype->size = newparm->size;
|
fieldtype->size = newparm->size;
|
||||||
QCC_PR_GetDef(fieldtype, membername, pr_scope, 2, 0, false);
|
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"))
|
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;
|
newt->size=0;
|
||||||
QCC_PR_Expect("{");
|
QCC_PR_Expect("{");
|
||||||
|
|
||||||
|
@ -3518,7 +3518,7 @@ QCC_type_t *QCC_PR_ParseType (int newtype, pbool silentfail)
|
||||||
{
|
{
|
||||||
if (!newparm)
|
if (!newparm)
|
||||||
QCC_PR_ParseError(ERR_NOTANAME, "element missing type");
|
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
|
else
|
||||||
newparm = QCC_PR_ParseType(true, false);
|
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"))
|
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;
|
newt->size=0;
|
||||||
QCC_PR_Expect("{");
|
QCC_PR_Expect("{");
|
||||||
|
|
||||||
|
@ -3565,7 +3565,7 @@ QCC_type_t *QCC_PR_ParseType (int newtype, pbool silentfail)
|
||||||
{
|
{
|
||||||
if (!newparm)
|
if (!newparm)
|
||||||
QCC_PR_ParseError(ERR_NOTANAME, "element missing type");
|
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
|
else
|
||||||
newparm = QCC_PR_ParseType(true, false);
|
newparm = QCC_PR_ParseType(true, false);
|
||||||
|
@ -3601,6 +3601,8 @@ QCC_type_t *QCC_PR_ParseType (int newtype, pbool silentfail)
|
||||||
type = NULL;
|
type = NULL;
|
||||||
for (i = 0; i < numtypeinfos; i++)
|
for (i = 0; i < numtypeinfos; i++)
|
||||||
{
|
{
|
||||||
|
if (!qcc_typeinfo[i].typedefed)
|
||||||
|
continue;
|
||||||
if (!STRCMP(qcc_typeinfo[i].name, name))
|
if (!STRCMP(qcc_typeinfo[i].name, name))
|
||||||
{
|
{
|
||||||
type = &qcc_typeinfo[i];
|
type = &qcc_typeinfo[i];
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
LoadFile
|
LoadFile
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
unsigned char *QCC_ReadFile (char *fname, void *buffer, int len)
|
unsigned char *QCC_ReadFile (const char *fname, void *buffer, int len)
|
||||||
{
|
{
|
||||||
long length;
|
long length;
|
||||||
FILE *f;
|
FILE *f;
|
||||||
|
@ -30,7 +30,7 @@ unsigned char *QCC_ReadFile (char *fname, void *buffer, int len)
|
||||||
|
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
int QCC_FileSize (char *fname)
|
int QCC_FileSize (const char *fname)
|
||||||
{
|
{
|
||||||
long length;
|
long length;
|
||||||
FILE *f;
|
FILE *f;
|
||||||
|
@ -44,7 +44,7 @@ int QCC_FileSize (char *fname)
|
||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
|
||||||
pbool QCC_WriteFile (char *name, void *data, int len)
|
pbool QCC_WriteFile (const char *name, void *data, int len)
|
||||||
{
|
{
|
||||||
long length;
|
long length;
|
||||||
FILE *f;
|
FILE *f;
|
||||||
|
@ -959,9 +959,9 @@ void EditFile(char *name, int line)
|
||||||
menufile = CreateMenu();
|
menufile = CreateMenu();
|
||||||
menuhelp = CreateMenu();
|
menuhelp = CreateMenu();
|
||||||
menunavig = CreateMenu();
|
menunavig = CreateMenu();
|
||||||
AppendMenu(menu, MF_POPUP, (UINT)menufile, "&File");
|
AppendMenu(menu, MF_POPUP, (UINT_PTR)menufile, "&File");
|
||||||
AppendMenu(menu, MF_POPUP, (UINT)menunavig, "&Navigation");
|
AppendMenu(menu, MF_POPUP, (UINT_PTR)menunavig, "&Navigation");
|
||||||
AppendMenu(menu, MF_POPUP, (UINT)menuhelp, "&Help");
|
AppendMenu(menu, MF_POPUP, (UINT_PTR)menuhelp, "&Help");
|
||||||
AppendMenu(menufile, 0, IDM_OPENNEW, "Open &new file ");
|
AppendMenu(menufile, 0, IDM_OPENNEW, "Open &new file ");
|
||||||
AppendMenu(menufile, 0, IDM_SAVE, "&Save ");
|
AppendMenu(menufile, 0, IDM_SAVE, "&Save ");
|
||||||
// AppendMenu(menufile, 0, IDM_FIND, "&Find");
|
// AppendMenu(menufile, 0, IDM_FIND, "&Find");
|
||||||
|
@ -1003,7 +1003,7 @@ void EditFile(char *name, int line)
|
||||||
mcs.lParam = 0;
|
mcs.lParam = 0;
|
||||||
|
|
||||||
neweditor->window = (HWND) SendMessage (mdibox, WM_MDICREATE, 0,
|
neweditor->window = (HWND) SendMessage (mdibox, WM_MDICREATE, 0,
|
||||||
(LONG) (LPMDICREATESTRUCT) &mcs);
|
(LONG_PTR) (LPMDICREATESTRUCT) &mcs);
|
||||||
}
|
}
|
||||||
else
|
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;
|
editor_t *e;
|
||||||
for (e = editors; e; e = e->next)
|
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);
|
return QCC_ReadFile(fname, buffer, blen);
|
||||||
}
|
}
|
||||||
|
|
||||||
int GUIFileSize(char *fname)
|
int GUIFileSize(const char *fname)
|
||||||
{
|
{
|
||||||
editor_t *e;
|
editor_t *e;
|
||||||
for (e = editors; e; e = e->next)
|
for (e = editors; e; e = e->next)
|
||||||
|
@ -1600,20 +1600,20 @@ static LONG CALLBACK MainWndProc(HWND hWnd,UINT message,
|
||||||
HMENU rootmenu, windowmenu, m;
|
HMENU rootmenu, windowmenu, m;
|
||||||
rootmenu = CreateMenu();
|
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_OPENNEW, "Open &new file ");
|
||||||
AppendMenu(m, 0, IDM_SAVE, "&Save ");
|
AppendMenu(m, 0, IDM_SAVE, "&Save ");
|
||||||
// AppendMenu(m, 0, IDM_FIND, "&Find");
|
// AppendMenu(m, 0, IDM_FIND, "&Find");
|
||||||
AppendMenu(m, 0, IDM_UNDO, "&Undo Ctrl+Z");
|
AppendMenu(m, 0, IDM_UNDO, "&Undo Ctrl+Z");
|
||||||
AppendMenu(m, 0, IDM_REDO, "&Redo Ctrl+Y");
|
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_GOTODEF, "Go to definition");
|
||||||
AppendMenu(m, 0, IDM_OPENDOCU, "Open selected file");
|
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_CASCADE, "&Cascade");
|
||||||
AppendMenu(m, 0, IDM_TILE_HORIZ, "Tile &Horizontally");
|
AppendMenu(m, 0, IDM_TILE_HORIZ, "Tile &Horizontally");
|
||||||
AppendMenu(m, 0, IDM_TILE_VERT, "Tile &Vertically");
|
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");
|
AppendMenu(m, 0, IDM_ABOUT, "About");
|
||||||
|
|
||||||
SetMenu(hWnd, rootmenu);
|
SetMenu(hWnd, rootmenu);
|
||||||
|
@ -2033,7 +2033,7 @@ void CreateOutputWindow(void)
|
||||||
mcs.lParam = 0;
|
mcs.lParam = 0;
|
||||||
|
|
||||||
outputwindow = (HWND) SendMessage (mdibox, WM_MDICREATE, 0,
|
outputwindow = (HWND) SendMessage (mdibox, WM_MDICREATE, 0,
|
||||||
(LONG) (LPMDICREATESTRUCT) &mcs);
|
(LONG_PTR) (LPMDICREATESTRUCT) &mcs);
|
||||||
|
|
||||||
ShowWindow(outputwindow, SW_SHOW);
|
ShowWindow(outputwindow, SW_SHOW);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1603,7 +1603,7 @@ PR_PrintDefs
|
||||||
QCC_PR_PrintOfs (d->ofs);
|
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)
|
if (numtypeinfos>= maxtypeinfos)
|
||||||
QCC_Error(ERR_TOOMANYTYPES, "Too many types");
|
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].param = NULL;
|
||||||
qcc_typeinfo[numtypeinfos].size = type_size[basictype];
|
qcc_typeinfo[numtypeinfos].size = type_size[basictype];
|
||||||
qcc_typeinfo[numtypeinfos].arraysize = 0;
|
qcc_typeinfo[numtypeinfos].arraysize = 0;
|
||||||
|
qcc_typeinfo[numtypeinfos].typedefed = typedefed;
|
||||||
|
|
||||||
|
|
||||||
numtypeinfos++;
|
numtypeinfos++;
|
||||||
|
@ -1649,34 +1650,33 @@ void QCC_PR_BeginCompilation (void *memory, int memsize)
|
||||||
pr_global_defs[i] = &def_void;
|
pr_global_defs[i] = &def_void;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
type_void = QCC_PR_NewType("void", ev_void);
|
type_void = QCC_PR_NewType("void", ev_void, true);
|
||||||
type_string = QCC_PR_NewType("string", ev_string);
|
type_string = QCC_PR_NewType("string", ev_string, true);
|
||||||
type_float = QCC_PR_NewType("float", ev_float);
|
type_float = QCC_PR_NewType("float", ev_float, true);
|
||||||
type_vector = QCC_PR_NewType("vector", ev_vector);
|
type_vector = QCC_PR_NewType("vector", ev_vector, true);
|
||||||
type_entity = QCC_PR_NewType("entity", ev_entity);
|
type_entity = QCC_PR_NewType("entity", ev_entity, true);
|
||||||
type_field = QCC_PR_NewType("__field", ev_field);
|
type_field = QCC_PR_NewType("__field", ev_field, false);
|
||||||
type_function = QCC_PR_NewType("__function", ev_function);
|
type_function = QCC_PR_NewType("__function", ev_function, false);
|
||||||
type_pointer = QCC_PR_NewType("__pointer", ev_pointer);
|
type_pointer = QCC_PR_NewType("__pointer", ev_pointer, false);
|
||||||
type_integer = QCC_PR_NewType("__integer", ev_integer);
|
type_integer = QCC_PR_NewType("__integer", ev_integer, true);
|
||||||
type_variant = QCC_PR_NewType("__variant", ev_variant);
|
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_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_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_floatpointer->aux_type = type_float;
|
||||||
|
|
||||||
type_function->aux_type = type_void;
|
type_function->aux_type = type_void;
|
||||||
|
|
||||||
//type_field->aux_type = type_float;
|
//type_field->aux_type = type_float;
|
||||||
|
|
||||||
if (keyword_integer)
|
type_integer = QCC_PR_NewType("integer", ev_integer, keyword_integer?true:false);
|
||||||
type_integer = QCC_PR_NewType("integer", ev_integer);
|
type_integer = QCC_PR_NewType("int", ev_integer, keyword_integer?true:false);
|
||||||
if (keyword_int)
|
|
||||||
type_integer = QCC_PR_NewType("int", ev_integer);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ extern QCC_type_t *type_floatpointer;
|
||||||
extern QCC_type_t *type_intpointer;
|
extern QCC_type_t *type_intpointer;
|
||||||
|
|
||||||
extern QCC_type_t *type_floatfield;// = {ev_field/*, &def_field*/, NULL, &type_float};
|
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;
|
jmp_buf decompilestatementfailure;
|
||||||
|
@ -765,21 +765,21 @@ void FigureOutTypes(progfuncs_t *progfuncs)
|
||||||
memset(ofstype, 0, sizeof(*ofstype)*65535);
|
memset(ofstype, 0, sizeof(*ofstype)*65535);
|
||||||
memset(ofsflags, 0, sizeof(*ofsflags)*65535);
|
memset(ofsflags, 0, sizeof(*ofsflags)*65535);
|
||||||
|
|
||||||
type_void = QCC_PR_NewType("void", ev_void);
|
type_void = QCC_PR_NewType("void", ev_void, true);
|
||||||
type_string = QCC_PR_NewType("string", ev_string);
|
type_string = QCC_PR_NewType("string", ev_string, true);
|
||||||
type_float = QCC_PR_NewType("float", ev_float);
|
type_float = QCC_PR_NewType("float", ev_float, true);
|
||||||
type_vector = QCC_PR_NewType("vector", ev_vector);
|
type_vector = QCC_PR_NewType("vector", ev_vector, true);
|
||||||
type_entity = QCC_PR_NewType("entity", ev_entity);
|
type_entity = QCC_PR_NewType("entity", ev_entity, true);
|
||||||
type_field = QCC_PR_NewType("field", ev_field);
|
type_field = QCC_PR_NewType("field", ev_field, false);
|
||||||
type_function = QCC_PR_NewType("function", ev_function);
|
type_function = QCC_PR_NewType("function", ev_function, false);
|
||||||
type_pointer = QCC_PR_NewType("pointer", ev_pointer);
|
type_pointer = QCC_PR_NewType("pointer", ev_pointer, false);
|
||||||
type_integer = QCC_PR_NewType("integer", ev_integer);
|
type_integer = QCC_PR_NewType("integer", ev_integer, true);
|
||||||
|
|
||||||
// type_variant = QCC_PR_NewType("__variant", ev_variant);
|
// 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_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;
|
type_function->aux_type = type_void;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue