[gamecode] Remove the wart from def and function names

I never liked the leading s_ (though I guess it means one is supposed to
interpret the int as a string pointer, but meh).
This commit is contained in:
Bill Currie 2021-12-31 15:02:31 +09:00
parent 6990bd5752
commit be474d9937
16 changed files with 57 additions and 57 deletions

View file

@ -95,7 +95,7 @@ bi_no_function (progs_t *pr)
// descriptor with a bad builtin number
dstatement_t *st = pr->pr_statements + pr->pr_xstatement;
dfunction_t *desc = pr->pr_functions + G_FUNCTION (pr, st->a);
const char *bi_name = PR_GetString (pr, desc->s_name);
const char *bi_name = PR_GetString (pr, desc->name);
int ind = -desc->first_statement;
PR_RunError (pr, "Bad builtin called: %s = #%d", bi_name, ind);
@ -201,7 +201,7 @@ PR_RelocateBuiltins (progs_t *pr)
if (desc->first_statement > 0)
continue;
bi_name = PR_GetString (pr, desc->s_name);
bi_name = PR_GetString (pr, desc->name);
if (!desc->first_statement) {
bi = PR_FindBuiltin (pr, bi_name);
@ -225,8 +225,8 @@ PR_RelocateBuiltins (progs_t *pr)
bi_name, -desc->first_statement);
proc = bi_no_function;
}
if (!desc->s_name && bi) {
desc->s_name = PR_SetString (pr, bi->name);
if (!desc->name && bi) {
desc->name = PR_SetString (pr, bi->name);
Hash_Add (pr->function_hash, &pr->pr_functions[i]);
}
func->first_statement = desc->first_statement;

View file

@ -496,8 +496,8 @@ func_compare_sort (const void *_fa, const void *_fb, void *_res)
progs_t *pr = res->pr;
func_t fa = *(const func_t *)_fa;
func_t fb = *(const func_t *)_fb;
const char *fa_file = PR_GetString (pr, pr->pr_functions[fa].s_file);
const char *fb_file = PR_GetString (pr, pr->pr_functions[fb].s_file);
const char *fa_file = PR_GetString (pr, pr->pr_functions[fa].file);
const char *fb_file = PR_GetString (pr, pr->pr_functions[fb].file);
int cmp = strcmp (fa_file, fb_file);
if (cmp) {
return cmp;
@ -516,7 +516,7 @@ func_compare_search (const void *_key, const void *_f, void *_res)
progs_t *pr = res->pr;
const func_key_t *key = _key;
func_t f = *(const func_t *)_f;
const char *f_file = PR_GetString (pr, pr->pr_functions[f].s_file);
const char *f_file = PR_GetString (pr, pr->pr_functions[f].file);
int cmp = strcmp (key->file, f_file);
if (cmp) {
return cmp;
@ -837,7 +837,7 @@ PR_FindSourceLineAddr (progs_t *pr, const char *file, pr_uint_t line)
}
dfunction_t *func = &pr->pr_functions[*f];
if (func->first_statement <= 0
|| strcmp (file, PR_GetString (pr, func->s_file)) != 0) {
|| strcmp (file, PR_GetString (pr, func->file)) != 0) {
return 0;
}
pr_auxfunction_t *aux = res->auxfunction_map[*f];
@ -869,7 +869,7 @@ PR_Get_Source_File (progs_t *pr, pr_lineno_t *lineno)
f = PR_Get_Lineno_Func (pr, lineno);
if (f->function >= (unsigned) pr->progs->numfunctions)
return 0;
return PR_GetString(pr, pr->pr_functions[f->function].s_file);
return PR_GetString(pr, pr->pr_functions[f->function].file);
}
const char *
@ -1292,7 +1292,7 @@ pr_debug_func_view (qfot_type_t *type, pr_type_t *value, void *_data)
dstring_appendstr (dstr, "NULL");
} else {
dfunction_t *f = pr->pr_functions + value->func_var;
dasprintf (dstr, "%s()", PR_GetString (pr, f->s_name));
dasprintf (dstr, "%s()", PR_GetString (pr, f->name));
}
}
@ -1673,20 +1673,20 @@ dump_frame (progs_t *pr, prstack_t *frame)
line += func->source_line;
if (addr == frame->staddr) {
Sys_Printf ("%12s:%u : %s: %x\n",
PR_GetString (pr, f->s_file),
PR_GetString (pr, f->file),
line,
PR_GetString (pr, f->s_name),
PR_GetString (pr, f->name),
frame->staddr);
} else {
Sys_Printf ("%12s:%u+%d : %s: %x\n",
PR_GetString (pr, f->s_file),
PR_GetString (pr, f->file),
line, frame->staddr - addr,
PR_GetString (pr, f->s_name),
PR_GetString (pr, f->name),
frame->staddr);
}
} else {
Sys_Printf ("%12s : %s: %x\n", PR_GetString (pr, f->s_file),
PR_GetString (pr, f->s_name), frame->staddr);
Sys_Printf ("%12s : %s: %x\n", PR_GetString (pr, f->file),
PR_GetString (pr, f->name), frame->staddr);
}
}
@ -1730,7 +1730,7 @@ PR_Profile (progs_t * pr)
if (num < 10) {
f = pr->pr_functions + (best - pr->function_table);
Sys_Printf ("%7i %s\n", best->profile,
PR_GetString (pr, f->s_name));
PR_GetString (pr, f->name));
}
num++;
best->profile = 0;

View file

@ -195,7 +195,7 @@ PR_EnterFunction (progs_t *pr, bfunction_t *f)
if (pr->pr_trace && !pr->debug_handler) {
Sys_Printf ("Entering function %s\n",
PR_GetString (pr, f->descriptor->s_name));
PR_GetString (pr, f->descriptor->name));
}
PR_PushFrame (pr);
@ -238,7 +238,7 @@ PR_EnterFunction (progs_t *pr, bfunction_t *f)
}
}
//Sys_Printf("%s:\n", PR_GetString(pr,f->s_name));
//Sys_Printf("%s:\n", PR_GetString(pr,f->name));
pr->pr_xfunction = f;
pr->pr_xstatement = f->first_statement - 1; // offset the st++
@ -286,14 +286,14 @@ PR_LeaveFunction (progs_t *pr, int to_engine)
if (pr->pr_trace && !pr->debug_handler) {
Sys_Printf ("Leaving function %s\n",
PR_GetString (pr, f->descriptor->s_name));
PR_GetString (pr, f->descriptor->name));
if (to_engine) {
Sys_Printf ("Returning to engine\n");
} else {
bfunction_t *rf = pr->pr_xfunction;
if (rf) {
Sys_Printf ("Returning to function %s\n",
PR_GetString (pr, rf->descriptor->s_name));
PR_GetString (pr, rf->descriptor->name));
}
}
}
@ -407,7 +407,7 @@ PR_CallFunction (progs_t *pr, func_t fnum)
// negative statements are built in functions
if (pr->pr_trace && !pr->debug_handler) {
Sys_Printf ("Calling builtin %s @ %p\n",
PR_GetString (pr, f->descriptor->s_name), f->func);
PR_GetString (pr, f->descriptor->name), f->func);
}
f->func (pr);
return 0;

View file

@ -58,7 +58,7 @@ function_get_key (const void *f, void *_pr)
{
progs_t *pr = (progs_t*)_pr;
dfunction_t *func = (dfunction_t*)f;
return PR_GetString (pr, func->s_name);
return PR_GetString (pr, func->name);
}
static const char *
@ -247,12 +247,12 @@ PR_LoadProgsFile (progs_t *pr, QFile *file, int size)
LittleLong (pr->pr_functions[i].first_statement);
pr->pr_functions[i].parm_start =
LittleLong (pr->pr_functions[i].parm_start);
pr->pr_functions[i].s_name = LittleLong (pr->pr_functions[i].s_name);
pr->pr_functions[i].s_file = LittleLong (pr->pr_functions[i].s_file);
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].numparms =
LittleLong (pr->pr_functions[i].numparms);
pr->pr_functions[i].locals = LittleLong (pr->pr_functions[i].locals);
if (pr->pr_functions[i].s_name)
if (pr->pr_functions[i].name)
Hash_Add (pr->function_hash, &pr->pr_functions[i]);
}
@ -265,12 +265,12 @@ PR_LoadProgsFile (progs_t *pr, QFile *file, int size)
pr_ushort_t safe_type = global_ddefs[i].type & ~DEF_SAVEGLOBAL;
global_ddefs[i].type = LittleShort (global_ddefs[i].type);
global_ddefs[i].ofs = LittleShort (global_ddefs[i].ofs);
global_ddefs[i].s_name = LittleLong (global_ddefs[i].s_name);
global_ddefs[i].name = LittleLong (global_ddefs[i].name);
pr->pr_globaldefs[i].type = global_ddefs[i].type;
pr->pr_globaldefs[i].size = pr_type_size[safe_type];
pr->pr_globaldefs[i].ofs = global_ddefs[i].ofs;
pr->pr_globaldefs[i].name = global_ddefs[i].s_name;
pr->pr_globaldefs[i].name = global_ddefs[i].name;
Hash_Add (pr->global_hash, &pr->pr_globaldefs[i]);
}
@ -283,11 +283,11 @@ PR_LoadProgsFile (progs_t *pr, QFile *file, int size)
if (field_ddefs[i].type & DEF_SAVEGLOBAL)
PR_Error (pr, "PR_LoadProgs: DEF_SAVEGLOBAL on field def %zd", i);
field_ddefs[i].ofs = LittleShort (field_ddefs[i].ofs);
field_ddefs[i].s_name = LittleLong (field_ddefs[i].s_name);
field_ddefs[i].name = LittleLong (field_ddefs[i].name);
pr->pr_fielddefs[i].type = field_ddefs[i].type;
pr->pr_fielddefs[i].ofs = field_ddefs[i].ofs;
pr->pr_fielddefs[i].name = field_ddefs[i].s_name;
pr->pr_fielddefs[i].name = field_ddefs[i].name;
Hash_Add (pr->field_hash, &pr->pr_fielddefs[i]);
}
@ -365,7 +365,7 @@ pr_run_ctors (progs_t *pr)
for (fnum = 0; fnum < pr->progs->numfunctions; fnum++) {
func = pr->pr_functions + fnum;
if (strequal (PR_GetString (pr, func->s_name), ".ctor"))
if (strequal (PR_GetString (pr, func->name), ".ctor"))
PR_ExecuteProgram (pr, fnum);
}
return 1;

View file

@ -76,7 +76,7 @@ PR_UglyValueString (progs_t *pr, etype_t type, pr_type_t *val, dstring_t *line)
break;
case ev_func:
f = pr->pr_functions + val->func_var;
dsprintf (line, "%s", PR_GetString (pr, f->s_name));
dsprintf (line, "%s", PR_GetString (pr, f->name));
break;
case ev_field:
def = PR_FieldAtOfs (pr, val->integer_var);