s/type_size/pr_type_size/

remove the redundant type_size from qfcc
This commit is contained in:
Bill Currie 2001-11-12 23:56:46 +00:00
parent eb7d41b95c
commit d27cd9cc21
10 changed files with 22 additions and 22 deletions

View file

@ -42,6 +42,8 @@ typedef enum {
ev_type_count // not a type, gives number of types
} etype_t;
extern int pr_type_size[ev_type_count];
#define OFS_NULL 0
#define OFS_RETURN 1

View file

@ -139,8 +139,6 @@ int NUM_FOR_BAD_EDICT(progs_t *pr, edict_t *e);
#define E_VECTOR(e,o) E_var (e, o, vector)
#define E_STRING(p,e,o) (PR_GetString (p, E_var (e, o, string)))
extern int type_size[8];
typedef void (*builtin_proc) (progs_t *pr);
typedef struct {
const char *name;

View file

@ -56,15 +56,18 @@ cvar_t *pr_boundscheck;
cvar_t *pr_deadbeef_ents;
cvar_t *pr_deadbeef_locals;
int type_size[8] = {
int pr_type_size[ev_type_count] = {
1,
1,
sizeof (string_t) / 4,
1,
3,
1,
1,
sizeof (func_t) / 4,
sizeof (void *) / 4
1,
1,
4,
1,
1,
};
const char *type_name[ev_type_count] = {
@ -622,10 +625,10 @@ ED_Write (progs_t * pr, VFile *f, edict_t *ed)
// if the value is still all 0, skip the field
type = d->type & ~DEF_SAVEGLOBAL;
for (j = 0; j < type_size[type]; j++)
for (j = 0; j < pr_type_size[type]; j++)
if (v[j].integer_var)
break;
if (j == type_size[type])
if (j == pr_type_size[type])
continue;
Qprintf (f, "\"%s\" ", name);

View file

@ -329,7 +329,6 @@ typedef union eval_s
union eval_s *ptr;
} eval_t;
extern int type_size[ev_type_count];
extern def_t *def_for_type[8];
extern type_t type_void;

View file

@ -171,7 +171,7 @@ emit_assign_expr (expr_t *e)
} else {
if (def_a->constant) {
if (options.code.cow) {
int size = type_size [def_a->type->type];
int size = pr_type_size [def_a->type->type];
int ofs = PR_NewLocation (def_a->type);
memcpy (pr_globals + ofs, pr_globals + def_a->ofs, size);

View file

@ -111,7 +111,7 @@ PR_GetDef (type_t *type, const char *name, def_t *scope, int *allocate)
d->used = 1;
d->parent = def;
} else {
*allocate += type_size[type->type];
*allocate += pr_type_size[type->type];
}
if (type->type == ev_field) {
@ -135,7 +135,7 @@ PR_GetDef (type_t *type, const char *name, def_t *scope, int *allocate)
d->used = 1; // always `used'
d->parent = def;
} else {
pr.size_fields += type_size[type->aux_type->type];
pr.size_fields += pr_type_size[type->aux_type->type];
}
}
@ -173,7 +173,7 @@ PR_NewDef (type_t *type, const char *name, def_t *scope)
int
PR_NewLocation (type_t *type)
{
int size = type_size[type->type];
int size = pr_type_size[type->type];
locref_t *loc;
if (free_locs[size]) {
@ -192,7 +192,7 @@ PR_NewLocation (type_t *type)
void
PR_FreeLocation (def_t *def)
{
int size = type_size[def->type->type];
int size = pr_type_size[def->type->type];
locref_t *loc;
if (!free_free_locs) {
@ -213,7 +213,7 @@ PR_FreeLocation (def_t *def)
def_t *
PR_GetTempDef (type_t *type, def_t *scope)
{
int size = type_size[type->type];
int size = pr_type_size[type->type];
def_t *def;
if (free_temps[size]) {
def = free_temps[size];
@ -222,7 +222,7 @@ PR_GetTempDef (type_t *type, def_t *scope)
} else {
def = PR_NewDef (type, 0, scope);
def->ofs = *scope->alloc;
*scope->alloc += type_size[size];
*scope->alloc += pr_type_size[size];
}
def->users = 0;
def->next = temp_scope.next;
@ -244,7 +244,7 @@ PR_FreeTempDefs (void)
if (d->users < 0)
printf ("%s:%d: warning: %3d %3d\n", strings + d->file, d->line, d->ofs, d->users);
size = type_size[d->type->type];
size = pr_type_size[d->type->type];
if (d->expr)
d->expr->e.temp.def = 0;

View file

@ -198,7 +198,7 @@ PR_ReuseConstant (expr_t *expr, def_t *def)
if (e.type == ex_string)
e.e.integer_val = CopyString (r);
memcpy (pr_globals + cn->ofs, &e.e, 4 * type_size[type->type]);
memcpy (pr_globals + cn->ofs, &e.e, 4 * pr_type_size[type->type]);
Hash_Add (tab, cn);

View file

@ -68,8 +68,6 @@ type_t type_integer = { ev_integer, &def_integer };
type_t type_floatfield = { ev_field, &def_field, NULL, &type_float };
int type_size[ev_type_count] = { 1, 1, 1, 3, 1, 1, 1, 1, 4, 1 };
def_t def_void = { &type_void, "temp" };
def_t def_string = { &type_string, "temp" };
def_t def_float = { &type_float, "temp" };

View file

@ -810,7 +810,7 @@ finish_function (function_t *f)
df->locals = f->def->locals;
df->parm_start = 0;
for (i = 0; i < df->numparms; i++)
df->parm_size[i] = type_size[f->def->type->parm_types[i]->type];
df->parm_size[i] = pr_type_size[f->def->type->parm_types[i]->type];
if (f->aux) {
def_t *def;

View file

@ -920,7 +920,7 @@ PR_PrintFunction (def_t *def)
for (d = def->scope_next; d; d = d->scope_next) {
printf ("%s: %d %d %d\n",
d->name ? d->name : "<temp>",
d->ofs, d->type->type, type_size[d->type->type]);
d->ofs, d->type->type, pr_type_size[d->type->type]);
for (r = d->refs; r; r = r->next)
printf (" %d", r->statement - statements);
printf ("\n");