mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
[gamecode] Rename parm to param
That misspelling bothered me from the very beginning, I'd always have trouble getting the name right when trying to access one of those fields.
This commit is contained in:
parent
e9dff4ff9c
commit
59ee723201
11 changed files with 83 additions and 80 deletions
|
@ -1254,12 +1254,12 @@ typedef struct {
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
pr_int_t first_statement;
|
pr_int_t first_statement;
|
||||||
pr_int_t numparms;
|
pr_int_t numparams;
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
dparmsize_t parm_size[PR_MAX_PARAMS];
|
dparmsize_t param_size[PR_MAX_PARAMS];
|
||||||
dfunction_t *descriptor;
|
dfunction_t *descriptor;
|
||||||
pr_uint_t parm_start;
|
pr_uint_t params_start;
|
||||||
pr_uint_t locals;
|
pr_uint_t locals;
|
||||||
pr_uint_t profile;
|
pr_uint_t profile;
|
||||||
};
|
};
|
||||||
|
|
|
@ -513,16 +513,16 @@ typedef struct dparmsize_s {
|
||||||
|
|
||||||
typedef struct dfunction_s {
|
typedef struct dfunction_s {
|
||||||
pr_int_t first_statement; // negative numbers are builtins
|
pr_int_t first_statement; // negative numbers are builtins
|
||||||
pr_uint_t parm_start; // beginning of locals data space
|
pr_uint_t params_start; // beginning of locals data space
|
||||||
pr_uint_t locals; // total ints of parms + locals
|
pr_uint_t locals; // total ints of params + locals
|
||||||
|
|
||||||
pr_uint_t profile; // runtime
|
pr_uint_t profile; // runtime
|
||||||
|
|
||||||
pr_string_t name; // source function name
|
pr_string_t name; // source function name
|
||||||
pr_string_t file; // source file defined in
|
pr_string_t file; // source file defined in
|
||||||
|
|
||||||
pr_int_t numparms; // -ve is varargs (1s comp of real count)
|
pr_int_t numparams; // -ve is varargs (1s comp of real count)
|
||||||
dparmsize_t parm_size[PR_MAX_PARAMS];
|
dparmsize_t param_size[PR_MAX_PARAMS];
|
||||||
} dfunction_t;
|
} dfunction_t;
|
||||||
|
|
||||||
typedef union pr_type_u {
|
typedef union pr_type_u {
|
||||||
|
|
|
@ -196,10 +196,10 @@ PR_RelocateBuiltins (progs_t *pr)
|
||||||
func = pr->function_table + i;
|
func = pr->function_table + i;
|
||||||
|
|
||||||
func->first_statement = desc->first_statement;
|
func->first_statement = desc->first_statement;
|
||||||
func->parm_start = desc->parm_start;
|
func->params_start = desc->params_start;
|
||||||
func->locals = desc->locals;
|
func->locals = desc->locals;
|
||||||
func->numparms = desc->numparms;
|
func->numparams = desc->numparams;
|
||||||
memcpy (func->parm_size, desc->parm_size, sizeof (func->parm_size));
|
memcpy (func->param_size, desc->param_size, sizeof (func->param_size));
|
||||||
func->descriptor = desc;
|
func->descriptor = desc;
|
||||||
|
|
||||||
if (desc->first_statement > 0)
|
if (desc->first_statement > 0)
|
||||||
|
|
|
@ -914,7 +914,7 @@ PR_Get_Source_Line (progs_t *pr, pr_uint_t addr)
|
||||||
}
|
}
|
||||||
|
|
||||||
pr_def_t *
|
pr_def_t *
|
||||||
PR_Get_Param_Def (progs_t *pr, dfunction_t *func, unsigned parm)
|
PR_Get_Param_Def (progs_t *pr, dfunction_t *func, unsigned param)
|
||||||
{
|
{
|
||||||
prdeb_resources_t *res = pr->pr_debug_resources;
|
prdeb_resources_t *res = pr->pr_debug_resources;
|
||||||
pr_uint_t i;
|
pr_uint_t i;
|
||||||
|
@ -928,12 +928,12 @@ PR_Get_Param_Def (progs_t *pr, dfunction_t *func, unsigned parm)
|
||||||
if (!func)
|
if (!func)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
num_params = func->numparms;
|
num_params = func->numparams;
|
||||||
if (num_params < 0) {
|
if (num_params < 0) {
|
||||||
num_params = ~num_params; // one's compliment
|
num_params = ~num_params; // one's compliment
|
||||||
param_offs = 1; // skip over @args def
|
param_offs = 1; // skip over @args def
|
||||||
}
|
}
|
||||||
if (parm >= (unsigned) num_params)
|
if (param >= (unsigned) num_params)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
aux_func = res->auxfunction_map[func - pr->pr_functions];
|
aux_func = res->auxfunction_map[func - pr->pr_functions];
|
||||||
|
@ -942,7 +942,7 @@ PR_Get_Param_Def (progs_t *pr, dfunction_t *func, unsigned parm)
|
||||||
|
|
||||||
for (i = 0; i < aux_func->num_locals; i++) {
|
for (i = 0; i < aux_func->num_locals; i++) {
|
||||||
ddef = &res->local_defs[aux_func->local_defs + param_offs + i];
|
ddef = &res->local_defs[aux_func->local_defs + param_offs + i];
|
||||||
if (!parm--)
|
if (!param--)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return ddef;
|
return ddef;
|
||||||
|
@ -987,7 +987,7 @@ PR_Get_Local_Def (progs_t *pr, pr_ptr_t *offset)
|
||||||
aux_func = res->auxfunction_map[func - pr->pr_functions];
|
aux_func = res->auxfunction_map[func - pr->pr_functions];
|
||||||
if (!aux_func)
|
if (!aux_func)
|
||||||
return 0;
|
return 0;
|
||||||
offs -= func->parm_start;
|
offs -= func->params_start;
|
||||||
if (offs >= func->locals)
|
if (offs >= func->locals)
|
||||||
return 0;
|
return 0;
|
||||||
if ((def = PR_SearchDefs (res->local_defs + aux_func->local_defs,
|
if ((def = PR_SearchDefs (res->local_defs + aux_func->local_defs,
|
||||||
|
@ -1531,7 +1531,7 @@ PR_PrintStatement (progs_t *pr, dstatement_t *s, int contents)
|
||||||
const char *fmt;
|
const char *fmt;
|
||||||
const char *mnemonic;
|
const char *mnemonic;
|
||||||
dfunction_t *call_func = 0;
|
dfunction_t *call_func = 0;
|
||||||
pr_def_t *parm_def = 0;
|
pr_def_t *param_def = 0;
|
||||||
pr_auxfunction_t *aux_func = 0;
|
pr_auxfunction_t *aux_func = 0;
|
||||||
pr_debug_data_t data;
|
pr_debug_data_t data;
|
||||||
etype_t op_type[3];
|
etype_t op_type[3];
|
||||||
|
@ -1603,16 +1603,16 @@ PR_PrintStatement (progs_t *pr, dstatement_t *s, int contents)
|
||||||
} else {
|
} else {
|
||||||
const char *str;
|
const char *str;
|
||||||
char mode = fmt[1], opchar = fmt[2];
|
char mode = fmt[1], opchar = fmt[2];
|
||||||
unsigned parm_ind = 0;
|
unsigned param_ind = 0;
|
||||||
pr_uint_t opval;
|
pr_uint_t opval;
|
||||||
qfot_type_t *optype = &res->void_type;
|
qfot_type_t *optype = &res->void_type;
|
||||||
pr_func_t func;
|
pr_func_t func;
|
||||||
|
|
||||||
if (mode == 'P') {
|
if (mode == 'P') {
|
||||||
opchar = fmt[3];
|
opchar = fmt[3];
|
||||||
parm_ind = fmt[2] - '0';
|
param_ind = fmt[2] - '0';
|
||||||
fmt++; // P has one extra item
|
fmt++; // P has one extra item
|
||||||
if (parm_ind >= PR_MAX_PARAMS)
|
if (param_ind >= PR_MAX_PARAMS)
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1631,7 +1631,7 @@ PR_PrintStatement (progs_t *pr, dstatement_t *s, int contents)
|
||||||
break;
|
break;
|
||||||
case 'x':
|
case 'x':
|
||||||
if (mode == 'P') {
|
if (mode == 'P') {
|
||||||
opval = pr->pr_real_params[parm_ind]
|
opval = pr->pr_real_params[param_ind]
|
||||||
- pr->pr_globals;
|
- pr->pr_globals;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1657,10 +1657,10 @@ PR_PrintStatement (progs_t *pr, dstatement_t *s, int contents)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'P':
|
case 'P':
|
||||||
parm_def = PR_Get_Param_Def (pr, call_func, parm_ind);
|
param_def = PR_Get_Param_Def (pr, call_func, param_ind);
|
||||||
optype = &res->void_type;
|
optype = &res->void_type;
|
||||||
if (parm_def) {
|
if (param_def) {
|
||||||
optype = get_type (res, parm_def->type_encoding);
|
optype = get_type (res, param_def->type_encoding);
|
||||||
}
|
}
|
||||||
str = global_string (&data, opval, optype,
|
str = global_string (&data, opval, optype,
|
||||||
contents & 1);
|
contents & 1);
|
||||||
|
@ -1690,12 +1690,12 @@ PR_PrintStatement (progs_t *pr, dstatement_t *s, int contents)
|
||||||
{
|
{
|
||||||
edict_t *ed = 0;
|
edict_t *ed = 0;
|
||||||
opval = pr->pr_globals[s->a].entity_var;
|
opval = pr->pr_globals[s->a].entity_var;
|
||||||
parm_ind = pr->pr_globals[s->b].uint_var;
|
param_ind = pr->pr_globals[s->b].uint_var;
|
||||||
if (parm_ind < pr->progs->entityfields
|
if (param_ind < pr->progs->entityfields
|
||||||
&& opval > 0
|
&& opval > 0
|
||||||
&& opval < pr->pr_edict_area_size) {
|
&& opval < pr->pr_edict_area_size) {
|
||||||
ed = PROG_TO_EDICT (pr, opval);
|
ed = PROG_TO_EDICT (pr, opval);
|
||||||
opval = &E_fld(ed, parm_ind) - pr->pr_globals;
|
opval = &E_fld(ed, param_ind) - pr->pr_globals;
|
||||||
}
|
}
|
||||||
if (!ed) {
|
if (!ed) {
|
||||||
str = "bad entity.field";
|
str = "bad entity.field";
|
||||||
|
|
|
@ -193,9 +193,9 @@ PR_PopFrame (progs_t *pr)
|
||||||
}
|
}
|
||||||
|
|
||||||
static __attribute__((pure)) long
|
static __attribute__((pure)) long
|
||||||
align_offset (long offset, dparmsize_t parmsize)
|
align_offset (long offset, dparmsize_t paramsize)
|
||||||
{
|
{
|
||||||
int mask = (1 << parmsize.alignment) - 1;
|
int mask = (1 << paramsize.alignment) - 1;
|
||||||
return (offset + mask) & ~mask;
|
return (offset + mask) & ~mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -237,39 +237,39 @@ PR_EnterFunction (progs_t *pr, bfunction_t *f)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (f->numparms > 0) {
|
if (f->numparams > 0) {
|
||||||
paramofs = f->parm_start;
|
paramofs = f->params_start;
|
||||||
for (i = 0; i < f->numparms; i++) {
|
for (i = 0; i < f->numparams; i++) {
|
||||||
paramofs = align_offset (paramofs, f->parm_size[i]);
|
paramofs = align_offset (paramofs, f->param_size[i]);
|
||||||
dstParams[i] = pr->pr_globals + paramofs;
|
dstParams[i] = pr->pr_globals + paramofs;
|
||||||
paramofs += f->parm_size[i].size;
|
paramofs += f->param_size[i].size;
|
||||||
if (pr->pr_params[i] != pr->pr_real_params[i]) {
|
if (pr->pr_params[i] != pr->pr_real_params[i]) {
|
||||||
copy_param (pr->pr_real_params[i], pr->pr_params[i],
|
copy_param (pr->pr_real_params[i], pr->pr_params[i],
|
||||||
f->parm_size[i].size);
|
f->param_size[i].size);
|
||||||
pr->pr_params[i] = pr->pr_real_params[i];
|
pr->pr_params[i] = pr->pr_real_params[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (f->numparms < 0) {
|
} else if (f->numparams < 0) {
|
||||||
paramofs = f->parm_start + 2; // argc and argv
|
paramofs = f->params_start + 2; // argc and argv
|
||||||
for (i = 0; i < -f->numparms - 1; i++) {
|
for (i = 0; i < -f->numparams - 1; i++) {
|
||||||
paramofs = align_offset (paramofs, f->parm_size[i]);
|
paramofs = align_offset (paramofs, f->param_size[i]);
|
||||||
dstParams[i] = pr->pr_globals + paramofs;
|
dstParams[i] = pr->pr_globals + paramofs;
|
||||||
paramofs += f->parm_size[i].size;
|
paramofs += f->param_size[i].size;
|
||||||
if (pr->pr_params[i] != pr->pr_real_params[i]) {
|
if (pr->pr_params[i] != pr->pr_real_params[i]) {
|
||||||
copy_param (pr->pr_real_params[i], pr->pr_params[i],
|
copy_param (pr->pr_real_params[i], pr->pr_params[i],
|
||||||
f->parm_size[i].size);
|
f->param_size[i].size);
|
||||||
pr->pr_params[i] = pr->pr_real_params[i];
|
pr->pr_params[i] = pr->pr_real_params[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dparmsize_t parmsize = { pr->pr_param_size, pr->pr_param_alignment };
|
dparmsize_t paramsize = { pr->pr_param_size, pr->pr_param_alignment };
|
||||||
paramofs = align_offset (paramofs, parmsize );
|
paramofs = align_offset (paramofs, paramsize );
|
||||||
if (i < PR_MAX_PARAMS) {
|
if (i < PR_MAX_PARAMS) {
|
||||||
dstParams[i] = pr->pr_globals + paramofs;
|
dstParams[i] = pr->pr_globals + paramofs;
|
||||||
}
|
}
|
||||||
for (; i < pr->pr_argc; i++) {
|
for (; i < pr->pr_argc; i++) {
|
||||||
if (pr->pr_params[i] != pr->pr_real_params[i]) {
|
if (pr->pr_params[i] != pr->pr_real_params[i]) {
|
||||||
copy_param (pr->pr_real_params[i], pr->pr_params[i],
|
copy_param (pr->pr_real_params[i], pr->pr_params[i],
|
||||||
parmsize.size);
|
paramsize.size);
|
||||||
pr->pr_params[i] = pr->pr_real_params[i];
|
pr->pr_params[i] = pr->pr_real_params[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -280,27 +280,28 @@ PR_EnterFunction (progs_t *pr, bfunction_t *f)
|
||||||
PR_RunError (pr, "PR_EnterFunction: locals stack overflow");
|
PR_RunError (pr, "PR_EnterFunction: locals stack overflow");
|
||||||
|
|
||||||
memcpy (&pr->localstack[pr->localstack_used],
|
memcpy (&pr->localstack[pr->localstack_used],
|
||||||
&pr->pr_globals[f->parm_start],
|
&pr->pr_globals[f->params_start],
|
||||||
sizeof (pr_type_t) * f->locals);
|
sizeof (pr_type_t) * f->locals);
|
||||||
pr->localstack_used += f->locals;
|
pr->localstack_used += f->locals;
|
||||||
|
|
||||||
if (pr_deadbeef_locals->int_val) {
|
if (pr_deadbeef_locals->int_val) {
|
||||||
for (pr_uint_t i = f->parm_start; i < f->parm_start + f->locals; i++) {
|
for (pr_uint_t i = f->params_start;
|
||||||
|
i < f->params_start + f->locals; i++) {
|
||||||
pr->pr_globals[i].int_var = 0xdeadbeef;
|
pr->pr_globals[i].int_var = 0xdeadbeef;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy parameters
|
// copy parameters
|
||||||
if (f->numparms >= 0) {
|
if (f->numparams >= 0) {
|
||||||
for (i = 0; i < f->numparms; i++) {
|
for (i = 0; i < f->numparams; i++) {
|
||||||
copy_param (dstParams[i], pr->pr_params[i], f->parm_size[i].size);
|
copy_param (dstParams[i], pr->pr_params[i], f->param_size[i].size);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int copy_args;
|
int copy_args;
|
||||||
pr_type_t *argc = &pr->pr_globals[f->parm_start + 0];
|
pr_type_t *argc = &pr->pr_globals[f->params_start + 0];
|
||||||
pr_type_t *argv = &pr->pr_globals[f->parm_start + 1];
|
pr_type_t *argv = &pr->pr_globals[f->params_start + 1];
|
||||||
for (i = 0; i < -f->numparms - 1; i++) {
|
for (i = 0; i < -f->numparams - 1; i++) {
|
||||||
copy_param (dstParams[i], pr->pr_params[i], f->parm_size[i].size);
|
copy_param (dstParams[i], pr->pr_params[i], f->param_size[i].size);
|
||||||
}
|
}
|
||||||
copy_args = pr->pr_argc - i;
|
copy_args = pr->pr_argc - i;
|
||||||
argc->int_var = copy_args;
|
argc->int_var = copy_args;
|
||||||
|
@ -338,7 +339,7 @@ PR_LeaveFunction (progs_t *pr, int to_engine)
|
||||||
if (pr->localstack_used < 0)
|
if (pr->localstack_used < 0)
|
||||||
PR_RunError (pr, "PR_LeaveFunction: locals stack underflow");
|
PR_RunError (pr, "PR_LeaveFunction: locals stack underflow");
|
||||||
|
|
||||||
memcpy (&pr->pr_globals[f->parm_start],
|
memcpy (&pr->pr_globals[f->params_start],
|
||||||
&pr->localstack[pr->localstack_used],
|
&pr->localstack[pr->localstack_used],
|
||||||
sizeof (pr_type_t) * f->locals);
|
sizeof (pr_type_t) * f->locals);
|
||||||
}
|
}
|
||||||
|
|
|
@ -251,12 +251,12 @@ PR_LoadProgsFile (progs_t *pr, QFile *file, int size)
|
||||||
for (i = 0; i < pr->progs->functions.count; i++) {
|
for (i = 0; i < pr->progs->functions.count; i++) {
|
||||||
pr->pr_functions[i].first_statement =
|
pr->pr_functions[i].first_statement =
|
||||||
LittleLong (pr->pr_functions[i].first_statement);
|
LittleLong (pr->pr_functions[i].first_statement);
|
||||||
pr->pr_functions[i].parm_start =
|
pr->pr_functions[i].params_start =
|
||||||
LittleLong (pr->pr_functions[i].parm_start);
|
LittleLong (pr->pr_functions[i].params_start);
|
||||||
pr->pr_functions[i].name = LittleLong (pr->pr_functions[i].name);
|
pr->pr_functions[i].name = LittleLong (pr->pr_functions[i].name);
|
||||||
pr->pr_functions[i].file = LittleLong (pr->pr_functions[i].file);
|
pr->pr_functions[i].file = LittleLong (pr->pr_functions[i].file);
|
||||||
pr->pr_functions[i].numparms =
|
pr->pr_functions[i].numparams =
|
||||||
LittleLong (pr->pr_functions[i].numparms);
|
LittleLong (pr->pr_functions[i].numparams);
|
||||||
pr->pr_functions[i].locals = LittleLong (pr->pr_functions[i].locals);
|
pr->pr_functions[i].locals = LittleLong (pr->pr_functions[i].locals);
|
||||||
if (pr->pr_functions[i].name)
|
if (pr->pr_functions[i].name)
|
||||||
Hash_Add (pr->function_hash, &pr->pr_functions[i]);
|
Hash_Add (pr->function_hash, &pr->pr_functions[i]);
|
||||||
|
|
|
@ -522,12 +522,12 @@ return_function (progs_t *pr, dfunction_t *func)
|
||||||
__auto_type f
|
__auto_type f
|
||||||
= (qdb_function_t *) PR_Zone_Malloc (pr, sizeof (qdb_function_t));
|
= (qdb_function_t *) PR_Zone_Malloc (pr, sizeof (qdb_function_t));
|
||||||
f->staddr = func->first_statement;
|
f->staddr = func->first_statement;
|
||||||
f->local_data = func->parm_start;
|
f->local_data = func->params_start;
|
||||||
f->local_size = func->locals;
|
f->local_size = func->locals;
|
||||||
f->profile = func->profile;
|
f->profile = func->profile;
|
||||||
f->name = func->name;
|
f->name = func->name;
|
||||||
f->file = func->file;
|
f->file = func->file;
|
||||||
f->num_params = func->numparms;
|
f->num_params = func->numparams;
|
||||||
R_POINTER (pr) = PR_SetPointer (pr, f);
|
R_POINTER (pr) = PR_SetPointer (pr, f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,10 +70,11 @@ disassemble_progs (progs_t *pr)
|
||||||
bfunction_t func;
|
bfunction_t func;
|
||||||
|
|
||||||
func.first_statement = desc->first_statement;
|
func.first_statement = desc->first_statement;
|
||||||
func.parm_start = desc->parm_start;
|
func.params_start = desc->params_start;
|
||||||
func.locals = desc->locals;
|
func.locals = desc->locals;
|
||||||
func.numparms = desc->numparms;
|
func.numparams = desc->numparams;
|
||||||
memcpy (func.parm_size, desc->parm_size, sizeof (func.parm_size));
|
memcpy (func.param_size, desc->param_size,
|
||||||
|
sizeof (func.param_size));
|
||||||
func.descriptor = desc;
|
func.descriptor = desc;
|
||||||
|
|
||||||
Sys_Printf ("%s:\n", PR_GetString (pr, desc->name));
|
Sys_Printf ("%s:\n", PR_GetString (pr, desc->name));
|
||||||
|
|
|
@ -259,15 +259,15 @@ dump_functions (progs_t *pr)
|
||||||
else
|
else
|
||||||
comment = va (0, " = #%d", -start);
|
comment = va (0, " = #%d", -start);
|
||||||
|
|
||||||
printf ("%-5d %s%s: %d (", i, name, comment, func->numparms);
|
printf ("%-5d %s%s: %d (", i, name, comment, func->numparams);
|
||||||
if (func->numparms < 0)
|
if (func->numparams < 0)
|
||||||
count = -func->numparms - 1;
|
count = -func->numparams - 1;
|
||||||
else
|
else
|
||||||
count = func->numparms;
|
count = func->numparams;
|
||||||
for (j = 0; j < count; j++)
|
for (j = 0; j < count; j++)
|
||||||
printf (" %d:%d", func->parm_size[j].alignment,
|
printf (" %d:%d", func->param_size[j].alignment,
|
||||||
func->parm_size[j].size);
|
func->param_size[j].size);
|
||||||
printf (") %d @ %x", func->locals, func->parm_start);
|
printf (") %d @ %x", func->locals, func->params_start);
|
||||||
puts ("");
|
puts ("");
|
||||||
if (type_encodings) {
|
if (type_encodings) {
|
||||||
pr_auxfunction_t *aux = PR_Debug_MappedAuxFunction (pr, i);
|
pr_auxfunction_t *aux = PR_Debug_MappedAuxFunction (pr, i);
|
||||||
|
@ -476,7 +476,8 @@ qfo_functions (qfo_t *qfo)
|
||||||
printf (" @ %x", func->code);
|
printf (" @ %x", func->code);
|
||||||
else
|
else
|
||||||
printf (" = #%d", -func->code);
|
printf (" = #%d", -func->code);
|
||||||
printf (" loc: %d\n", func->locals_space);
|
printf (" loc: %d params: %d\n",
|
||||||
|
func->locals_space, func->params_start);
|
||||||
if (func->locals_space) {
|
if (func->locals_space) {
|
||||||
locals = &qfo->spaces[func->locals_space];
|
locals = &qfo->spaces[func->locals_space];
|
||||||
printf ("%*s%d %p %d %p %d %d\n", 16, "", locals->type,
|
printf ("%*s%d %p %d %p %d %d\n", 16, "", locals->type,
|
||||||
|
|
|
@ -791,13 +791,13 @@ get_type_alignment_log (qfo_t *qfo, pr_ptr_t type)
|
||||||
}
|
}
|
||||||
|
|
||||||
static __attribute__((pure)) dparmsize_t
|
static __attribute__((pure)) dparmsize_t
|
||||||
get_parmsize (qfo_t *qfo, pr_ptr_t type)
|
get_paramsize (qfo_t *qfo, pr_ptr_t type)
|
||||||
{
|
{
|
||||||
dparmsize_t parmsize = {
|
dparmsize_t paramsize = {
|
||||||
get_type_size (qfo, type),
|
get_type_size (qfo, type),
|
||||||
get_type_alignment_log (qfo, type),
|
get_type_alignment_log (qfo, type),
|
||||||
};
|
};
|
||||||
return parmsize;
|
return paramsize;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -816,11 +816,11 @@ function_params (qfo_t *qfo, qfo_func_t *func, dfunction_t *df)
|
||||||
}
|
}
|
||||||
if (type->meta != ty_basic || type->type != ev_func)
|
if (type->meta != ty_basic || type->type != ev_func)
|
||||||
return;
|
return;
|
||||||
df->numparms = num_params = type->func.num_params;
|
df->numparams = num_params = type->func.num_params;
|
||||||
if (num_params < 0)
|
if (num_params < 0)
|
||||||
num_params = ~num_params;
|
num_params = ~num_params;
|
||||||
for (i = 0; i < num_params; i++) {
|
for (i = 0; i < num_params; i++) {
|
||||||
df->parm_size[i] = get_parmsize (qfo, type->func.param_types[i]);
|
df->param_size[i] = get_paramsize (qfo, type->func.param_types[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1140,9 +1140,9 @@ qfo_to_progs (qfo_t *in_qfo, int *size)
|
||||||
qfo_mspace_t *space = qfo->spaces + qf->locals_space;
|
qfo_mspace_t *space = qfo->spaces + qf->locals_space;
|
||||||
|
|
||||||
df->first_statement = qf->code;
|
df->first_statement = qf->code;
|
||||||
if (options.code.progsversion < PROG_VERSION) {
|
|
||||||
df->parm_start = globals_info.locals_start;
|
|
||||||
df->locals = space->data_size;
|
df->locals = space->data_size;
|
||||||
|
if (options.code.progsversion < PROG_VERSION) {
|
||||||
|
df->params_start = globals_info.locals_start;
|
||||||
// finalize the offsets of the local defs
|
// finalize the offsets of the local defs
|
||||||
for (j = 0; j < space->num_defs; j++)
|
for (j = 0; j < space->num_defs; j++)
|
||||||
space->defs[j].offset += globals_info.locals_start;
|
space->defs[j].offset += globals_info.locals_start;
|
||||||
|
@ -1243,7 +1243,7 @@ qfo_to_progs (qfo_t *in_qfo, int *size)
|
||||||
if (qf->locals_space == globals_info.big_locals)
|
if (qf->locals_space == globals_info.big_locals)
|
||||||
big_func = i;
|
big_func = i;
|
||||||
for (j = 0; j < space->num_defs; j++)
|
for (j = 0; j < space->num_defs; j++)
|
||||||
space->defs[j].offset -= df->parm_start;
|
space->defs[j].offset -= df->params_start;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.verbosity >= 0) {
|
if (options.verbosity >= 0) {
|
||||||
|
|
|
@ -228,12 +228,12 @@ WriteProgs (dprograms_t *progs, int size)
|
||||||
for (i = 0; i < (unsigned) progs->functions.count; i++) {
|
for (i = 0; i < (unsigned) progs->functions.count; i++) {
|
||||||
dfunction_t *func = functions + i;
|
dfunction_t *func = functions + i;
|
||||||
func->first_statement = LittleLong (func->first_statement);
|
func->first_statement = LittleLong (func->first_statement);
|
||||||
func->parm_start = LittleLong (func->parm_start);
|
func->params_start = LittleLong (func->params_start);
|
||||||
func->locals = LittleLong (func->locals);
|
func->locals = LittleLong (func->locals);
|
||||||
func->profile = LittleLong (func->profile);
|
func->profile = LittleLong (func->profile);
|
||||||
func->name = LittleLong (func->name);
|
func->name = LittleLong (func->name);
|
||||||
func->file = LittleLong (func->file);
|
func->file = LittleLong (func->file);
|
||||||
func->numparms = LittleLong (func->numparms);
|
func->numparams = LittleLong (func->numparams);
|
||||||
}
|
}
|
||||||
for (i = 0; i < progs->globaldefs.count; i++) {
|
for (i = 0; i < progs->globaldefs.count; i++) {
|
||||||
globaldefs[i].type = LittleShort (globaldefs[i].type);
|
globaldefs[i].type = LittleShort (globaldefs[i].type);
|
||||||
|
|
Loading…
Reference in a new issue