From 1e57351be17988a15c48555e68bee95bb3858bc9 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 9 Jun 2002 04:30:02 +0000 Subject: [PATCH] there, no more PR_* functions or pr_* files :) --- tools/qfcc/include/def.h | 20 +++++++------- tools/qfcc/source/Makefile.am | 6 ++--- tools/qfcc/source/class.c | 22 ++++++++-------- tools/qfcc/source/{pr_def.c => def.c} | 38 +++++++++++++-------------- tools/qfcc/source/emit.c | 28 ++++++++++---------- tools/qfcc/source/expr.c | 14 +++++----- tools/qfcc/source/function.c | 18 ++++++------- tools/qfcc/source/idstuff.c | 2 +- tools/qfcc/source/immediate.c | 22 ++++++++-------- tools/qfcc/source/method.c | 10 +++---- tools/qfcc/source/qc-parse.y | 10 +++---- tools/qfcc/source/qfcc.c | 2 +- tools/qfcc/source/struct.c | 6 ++--- tools/qfcc/source/switch.c | 2 +- 14 files changed, 100 insertions(+), 100 deletions(-) rename tools/qfcc/source/{pr_def.c => def.c} (90%) diff --git a/tools/qfcc/include/def.h b/tools/qfcc/include/def.h index 61c00d092..7f748e0bd 100644 --- a/tools/qfcc/include/def.h +++ b/tools/qfcc/include/def.h @@ -88,16 +88,16 @@ extern def_t def_function; scope_t *new_scope (defspace_t *space, scope_t *parent); defspace_t *new_defspace (void); -def_t *PR_GetDef (struct type_s *type, const char *name, scope_t *scope, - int allocate); -def_t *PR_NewDef (struct type_s *type, const char *name, scope_t *scope); -int PR_NewLocation (struct type_s *type, defspace_t *space); -void PR_FreeLocation (def_t *def); -def_t *PR_GetTempDef (struct type_s *type, scope_t *scope); -void PR_FreeTempDefs (); -void PR_ResetTempDefs (); -void PR_FlushScope (scope_t *scope, int force_used); -void PR_DefInitialized (def_t *d); +def_t *get_def (struct type_s *type, const char *name, scope_t *scope, + int allocate); +def_t *new_def (struct type_s *type, const char *name, scope_t *scope); +int new_location (struct type_s *type, defspace_t *space); +void free_location (def_t *def); +def_t *get_tempdef (struct type_s *type, scope_t *scope); +void free_tempdefs (); +void reset_tempdefs (); +void flush_scope (scope_t *scope, int force_used); +void def_initialized (def_t *d); #endif//__def_h diff --git a/tools/qfcc/source/Makefile.am b/tools/qfcc/source/Makefile.am index 0c64b6708..7fd851dac 100644 --- a/tools/qfcc/source/Makefile.am +++ b/tools/qfcc/source/Makefile.am @@ -38,9 +38,9 @@ YFLAGS = -d bin_PROGRAMS= qfcc qfcc_SOURCES= \ - class.c cmdlib.c cpp.c debug.c emit.c expr.c function.c idstuff.c \ - immediate.c method.c opcodes.c options.c pr_def.c qc-lex.l qc-parse.y \ - qfcc.c reloc.c struct.c switch.c type.c + class.c cmdlib.c cpp.c debug.c def.c emit.c expr.c function.c idstuff.c \ + immediate.c method.c opcodes.c options.c qc-lex.l qc-parse.y qfcc.c \ + reloc.c struct.c switch.c type.c qfcc_LDADD= $(QFCC_LIBS) qfcc_DEPENDENCIES= $(QFCC_DEPS) diff --git a/tools/qfcc/source/class.c b/tools/qfcc/source/class.c index 08514c9a4..8235f212e 100644 --- a/tools/qfcc/source/class.c +++ b/tools/qfcc/source/class.c @@ -155,7 +155,7 @@ class_begin (class_t *class) if (class->class_name && class->category_name) { pr_category_t *category; - class->def = PR_GetDef (type_category, + class->def = get_def (type_category, va ("_OBJ_CATEGORY_%s_%s", class->class_name, class->category_name), @@ -173,7 +173,7 @@ class_begin (class_t *class) pr_class_t *meta; pr_class_t *cls; - meta_def = PR_GetDef (type_Class.aux_type, + meta_def = get_def (type_Class.aux_type, va ("_OBJ_METACLASS_%s", class->class_name), pr.scope, 1); meta_def->initialized = meta_def->constant = 1; @@ -188,7 +188,7 @@ class_begin (class_t *class) meta->protocols = emit_protocol_list (class->protocols, class->class_name); - class->def = PR_GetDef (type_Class.aux_type, + class->def = get_def (type_Class.aux_type, va ("_OBJ_CLASS_%s", class->class_name), pr.scope, 1); class->def->initialized = class->def->constant = 1; @@ -396,7 +396,7 @@ class_def (class_t *class) { def_t *def; - def = PR_GetDef (class->type, + def = get_def (class->type, va ("_OBJ_CLASS_POINTER_%s", class->class_name), pr.scope, 1); if (def->initialized) @@ -451,7 +451,7 @@ class_finish_module (void) new_struct_field (symtab_type, &type_integer, "cat_def_cnt", vis_public); for (i = 0; i < num_classes + num_categories; i++) new_struct_field (symtab_type, &type_pointer, 0, vis_public); - symtab_def = PR_GetDef (symtab_type, "_OBJ_SYMTAB", pr.scope, 1); + symtab_def = get_def (symtab_type, "_OBJ_SYMTAB", pr.scope, 1); symtab_def->initialized = symtab_def->constant = 1; symtab = &G_STRUCT (pr_symtab_t, symtab_def->ofs); symtab->cls_def_cnt = num_classes; @@ -464,14 +464,14 @@ class_finish_module (void) if ((*t)->def) *def_ptr++ = (*t)->def->ofs; - module_def = PR_GetDef (type_module, "_OBJ_MODULE", pr.scope, 1); + module_def = get_def (type_module, "_OBJ_MODULE", pr.scope, 1); module_def->initialized = module_def->constant = 1; module = &G_STRUCT (pr_module_t, module_def->ofs); module->size = type_size (type_module); module->name = ReuseString (destfile); module->symtab = symtab_def->ofs; - exec_class_def = PR_GetDef (&type_obj_exec_class, "__obj_exec_class", + exec_class_def = get_def (&type_obj_exec_class, "__obj_exec_class", pr.scope, 1); exec_class_func = new_function (); exec_class_func->builtin = 0; @@ -479,7 +479,7 @@ class_finish_module (void) build_function (exec_class_func); finish_function (exec_class_func); - init_def = PR_GetDef (&type_function, ".ctor", pr.scope, 1); + init_def = get_def (&type_function, ".ctor", pr.scope, 1); init_func = new_function (); init_func->def = init_def; init_func->code = pr.num_statements; @@ -544,7 +544,7 @@ protocol_add_protocol_methods (protocol_t *protocol, expr_t *protocols) def_t * protocol_def (protocol_t *protocol) { - return PR_GetDef (&type_Protocol, protocol->name, pr.scope, 1); + return get_def (&type_Protocol, protocol->name, pr.scope, 1); } protocollist_t * @@ -572,7 +572,7 @@ emit_protocol (protocol_t *protocol) def_t *proto_def; pr_protocol_t *proto; - proto_def = PR_GetDef (type_Protocol.aux_type, + proto_def = get_def (type_Protocol.aux_type, va ("_OBJ_PROTOCOL_%s", protocol->name), pr.scope, 1); proto_def->initialized = proto_def->constant = 1; @@ -603,7 +603,7 @@ emit_protocol_list (protocollist_t *protocols, const char *name) new_struct_field (protocol_list, &type_integer, "count", vis_public); for (i = 0; i < protocols->count; i++) new_struct_field (protocol_list, &type_pointer, 0, vis_public); - proto_list_def = PR_GetDef (type_Protocol.aux_type, + proto_list_def = get_def (type_Protocol.aux_type, va ("_OBJ_PROTOCOLS_%s", name), pr.scope, 1); proto_list_def->initialized = proto_list_def->constant = 1; diff --git a/tools/qfcc/source/pr_def.c b/tools/qfcc/source/def.c similarity index 90% rename from tools/qfcc/source/pr_def.c rename to tools/qfcc/source/def.c index 8c8a51325..9526b1a24 100644 --- a/tools/qfcc/source/pr_def.c +++ b/tools/qfcc/source/def.c @@ -128,13 +128,13 @@ new_scope (defspace_t *space, scope_t *parent) } /* - PR_GetDef + get_def If type is NULL, it will match any type If allocate is true, a new def will be allocated if it can't be found */ def_t * -PR_GetDef (type_t *type, const char *name, scope_t *scope, int allocate) +get_def (type_t *type, const char *name, scope_t *scope, int allocate) { def_t *def = check_for_name (type, name, scope, allocate); int size; @@ -143,7 +143,7 @@ PR_GetDef (type_t *type, const char *name, scope_t *scope, int allocate) return def; // allocate a new def - def = PR_NewDef (type, name, scope); + def = new_def (type, name, scope); if (name) Hash_Add (defs_by_name, def); @@ -157,15 +157,15 @@ PR_GetDef (type_t *type, const char *name, scope_t *scope, int allocate) if (type->type == ev_vector && name) { def_t *d; - d = PR_GetDef (&type_float, va ("%s_x", name), scope, allocate); + d = get_def (&type_float, va ("%s_x", name), scope, allocate); d->used = 1; d->parent = def; - d = PR_GetDef (&type_float, va ("%s_y", name), scope, allocate); + d = get_def (&type_float, va ("%s_y", name), scope, allocate); d->used = 1; d->parent = def; - d = PR_GetDef (&type_float, va ("%s_z", name), scope, allocate); + d = get_def (&type_float, va ("%s_z", name), scope, allocate); d->used = 1; d->parent = def; } else { @@ -178,17 +178,17 @@ PR_GetDef (type_t *type, const char *name, scope_t *scope, int allocate) if (type->aux_type->type == ev_vector) { def_t *d; - d = PR_GetDef (&type_floatfield, + d = get_def (&type_floatfield, va ("%s_x", name), scope, allocate); d->used = 1; // always `used' d->parent = def; - d = PR_GetDef (&type_floatfield, + d = get_def (&type_floatfield, va ("%s_y", name), scope, allocate); d->used = 1; // always `used' d->parent = def; - d = PR_GetDef (&type_floatfield, + d = get_def (&type_floatfield, va ("%s_z", name), scope, allocate); d->used = 1; // always `used' d->parent = def; @@ -214,7 +214,7 @@ PR_GetDef (type_t *type, const char *name, scope_t *scope, int allocate) e1->e.def = def; e2->type = ex_def; - e2->e.def = PR_NewDef (type->aux_type, 0, scope); + e2->e.def = new_def (type->aux_type, 0, scope); e2->e.def->ofs = ofs; append_expr (local_expr, @@ -230,7 +230,7 @@ PR_GetDef (type_t *type, const char *name, scope_t *scope, int allocate) } def_t * -PR_NewDef (type_t *type, const char *name, scope_t *scope) +new_def (type_t *type, const char *name, scope_t *scope) { def_t *def; @@ -254,7 +254,7 @@ PR_NewDef (type_t *type, const char *name, scope_t *scope) } int -PR_NewLocation (type_t *type, defspace_t *space) +new_location (type_t *type, defspace_t *space) { int size = type_size (type); locref_t *loc; @@ -273,7 +273,7 @@ PR_NewLocation (type_t *type, defspace_t *space) } void -PR_FreeLocation (def_t *def) +free_location (def_t *def) { int size = type_size (def->type); locref_t *loc; @@ -285,7 +285,7 @@ PR_FreeLocation (def_t *def) } def_t * -PR_GetTempDef (type_t *type, scope_t *scope) +get_tempdef (type_t *type, scope_t *scope) { int size = type_size (type); def_t *def; @@ -295,7 +295,7 @@ PR_GetTempDef (type_t *type, scope_t *scope) free_temps[size] = def->next; def->type = type; } else { - def = PR_NewDef (type, 0, scope); + def = new_def (type, 0, scope); def->ofs = scope->space->size; scope->space->size += size; } @@ -306,7 +306,7 @@ PR_GetTempDef (type_t *type, scope_t *scope) } void -PR_FreeTempDefs (void) +free_tempdefs (void) { def_t **def, *d; int size; @@ -337,7 +337,7 @@ PR_FreeTempDefs (void) } void -PR_ResetTempDefs (void) +reset_tempdefs (void) { int i; def_t *d; @@ -353,7 +353,7 @@ PR_ResetTempDefs (void) } void -PR_FlushScope (scope_t *scope, int force_used) +flush_scope (scope_t *scope, int force_used) { def_t *def; @@ -375,7 +375,7 @@ PR_FlushScope (scope_t *scope, int force_used) } void -PR_DefInitialized (def_t *d) +def_initialized (def_t *d) { d->initialized = 1; if (d->type == &type_vector diff --git a/tools/qfcc/source/emit.c b/tools/qfcc/source/emit.c index 886ac2c1f..e94f775a0 100644 --- a/tools/qfcc/source/emit.c +++ b/tools/qfcc/source/emit.c @@ -120,7 +120,7 @@ emit_statement (int sline, opcode_t *op, def_t *var_a, def_t *var_b, ret = var_a; } else { // allocate result space if (!var_c) { - var_c = PR_GetTempDef (types[op->type_c], current_scope); + var_c = get_tempdef (types[op->type_c], current_scope); var_c->users += 2; } statement->c = var_c->ofs; @@ -221,7 +221,7 @@ emit_assign_expr (int oper, expr_t *e) if (def_a->constant) { if (options.code.cow) { int size = type_size (def_a->type); - int ofs = PR_NewLocation (def_a->type, pr.globals); + int ofs = new_location (def_a->type, pr.globals); memcpy (pr.globals->data + ofs, pr.globals->data + def_a->ofs, size); @@ -274,7 +274,7 @@ emit_bind_expr (expr_t *e1, expr_t *e2) } def = emit_sub_expr (e1, e2->e.temp.def); if (t1 != t2) { - def_t *tmp = PR_NewDef (t2, 0, def->scope); + def_t *tmp = new_def (t2, 0, def->scope); tmp->ofs = def->ofs; tmp->users = e2->e.temp.users; @@ -329,7 +329,7 @@ emit_sub_expr (expr_t *e, def_t *dest) } operator = get_op_string (e->e.expr.op); if (!dest) { - dest = PR_GetTempDef (e->e.expr.type, current_scope); + dest = get_tempdef (e->e.expr.type, current_scope); dest->users += 2; } op = opcode_find (operator, def_a, def_b, dest); @@ -354,7 +354,7 @@ emit_sub_expr (expr_t *e, def_t *dest) def_a = ReuseConstant (&zero, 0); def_b = emit_sub_expr (e->e.expr.e1, 0); if (!dest) { - dest = PR_GetTempDef (e->e.expr.type, current_scope); + dest = get_tempdef (e->e.expr.type, current_scope); dest->users += 2; } break; @@ -364,7 +364,7 @@ emit_sub_expr (expr_t *e, def_t *dest) operator = "&"; if (e->e.expr.e1->type == ex_expr && e->e.expr.e1->e.expr.op == '.') { - tmp = PR_GetTempDef (e->e.expr.type, current_scope); + tmp = get_tempdef (e->e.expr.type, current_scope); tmp->users += 2; def_b = emit_sub_expr (&zero, 0); } else { @@ -372,7 +372,7 @@ emit_sub_expr (expr_t *e, def_t *dest) } def_a = emit_sub_expr (e->e.expr.e1, tmp); if (!dest) { - dest = PR_GetTempDef (e->e.expr.type, current_scope); + dest = get_tempdef (e->e.expr.type, current_scope); dest->users += 2; } break; @@ -381,7 +381,7 @@ emit_sub_expr (expr_t *e, def_t *dest) && (e->e.expr.e1->type != ex_pointer || !(e->e.expr.e1->e.pointer.val > 0 && e->e.expr.e1->e.pointer.val < 65536))) { - dest = PR_GetTempDef (e->e.expr.type, current_scope); + dest = get_tempdef (e->e.expr.type, current_scope); dest->users += 2; } if (e->e.expr.e1->type == ex_expr @@ -399,7 +399,7 @@ emit_sub_expr (expr_t *e, def_t *dest) } def_b = &def_void; if (!dest) { - dest = PR_GetTempDef (e->e.expr.type, current_scope); + dest = get_tempdef (e->e.expr.type, current_scope); dest->users = 2; } operator = "="; @@ -418,7 +418,7 @@ emit_sub_expr (expr_t *e, def_t *dest) if (dest) e->e.temp.def = dest; else - e->e.temp.def = PR_GetTempDef (e->e.temp.type, current_scope); + e->e.temp.def = get_tempdef (e->e.temp.type, current_scope); e->e.temp.def->users = e->e.temp.users; e->e.temp.def->expr = e; e->e.temp.def->managed = 1; @@ -428,7 +428,7 @@ emit_sub_expr (expr_t *e, def_t *dest) case ex_pointer: if (e->e.pointer.val > 0 && e->e.pointer.val < 65536 && e->e.pointer.type->type != ev_struct) { - d = PR_NewDef (e->e.pointer.type, 0, current_scope); + d = new_def (e->e.pointer.type, 0, current_scope); d->ofs = e->e.short_val; d->absolute = e->e.pointer.abs; d->users = 1; @@ -447,13 +447,13 @@ emit_sub_expr (expr_t *e, def_t *dest) d = ReuseConstant (e, 0); break; case ex_short: - d = PR_NewDef (&type_short, 0, current_scope); + d = new_def (&type_short, 0, current_scope); d->ofs = e->e.short_val; d->absolute = 1; d->users = 1; break; } - PR_FreeTempDefs (); + free_tempdefs (); return d; } @@ -559,5 +559,5 @@ emit_expr (expr_t *e) warning (e, "Ignoring useless expression"); break; } - PR_FreeTempDefs (); + free_tempdefs (); } diff --git a/tools/qfcc/source/expr.c b/tools/qfcc/source/expr.c index 746181f7b..bbb2097ed 100644 --- a/tools/qfcc/source/expr.c +++ b/tools/qfcc/source/expr.c @@ -139,7 +139,7 @@ convert_name (expr_t *e) e->e.def = class_def (class); return; } - d = PR_GetDef (NULL, name, current_scope, 0); + d = get_def (NULL, name, current_scope, 0); if (d) { if (!d->scope) { new = class_ivar_expr (current_class, name); @@ -476,9 +476,9 @@ new_def_expr (def_t *def) expr_t * new_self_expr (void) { - def_t *def = PR_GetDef (&type_entity, ".self", pr.scope, 1); + def_t *def = get_def (&type_entity, ".self", pr.scope, 1); - PR_DefInitialized (def); + def_initialized (def); return new_def_expr (def); } @@ -486,9 +486,9 @@ expr_t * new_this_expr (void) { type_t *type = field_type (&type_id); - def_t *def = PR_GetDef (type, ".this", pr.scope, 1); + def_t *def = get_def (type, ".this", pr.scope, 1); - PR_DefInitialized (def); + def_initialized (def); return new_def_expr (def); } @@ -1629,7 +1629,7 @@ function_expr (expr_t *e1, expr_t *e2) expr_t *ret = new_expr (); ret->type = ex_def; - ret->e.def = PR_NewDef (ftype->aux_type, 0, pr.scope); + ret->e.def = new_def (ftype->aux_type, 0, pr.scope); ret->e.def->ofs = def_ret.ofs; call->e.block.result = ret; @@ -1870,7 +1870,7 @@ assign_expr (expr_t *e1, expr_t *e2) return e2; if (e1->type == ex_def) - PR_DefInitialized (e1->e.def); + def_initialized (e1->e.def); //XXX func = func ??? check_initialized (e2); t1 = get_type (e1); diff --git a/tools/qfcc/source/function.c b/tools/qfcc/source/function.c index b7eb729ca..e9825084b 100644 --- a/tools/qfcc/source/function.c +++ b/tools/qfcc/source/function.c @@ -126,12 +126,12 @@ build_scope (function_t *f, def_t *func, param_t *params) f->scope = new_scope (new_defspace (), pr.scope); if (func->type->num_parms < 0) { - def = PR_GetDef (&type_integer, ".argc", f->scope, 1); + def = get_def (&type_integer, ".argc", f->scope, 1); def->used = 1; - PR_DefInitialized (def); - argv = PR_GetDef (&type_pointer, ".argv", f->scope, 1); + def_initialized (def); + argv = get_def (&type_pointer, ".argv", f->scope, 1); argv->used = 1; - PR_DefInitialized (argv); + def_initialized (argv); } for (p = params, i = 0; p; p = p->next) { @@ -139,7 +139,7 @@ build_scope (function_t *f, def_t *func, param_t *params) continue; // ellipsis marker if (!p->type) continue; // non-param selector - def = PR_GetDef (p->type, p->name, f->scope, 1); + def = get_def (p->type, p->name, f->scope, 1); f->parm_ofs[i] = def->ofs; if (i > 0 && f->parm_ofs[i] < f->parm_ofs[i - 1]) { error (0, "bad parm order"); @@ -147,13 +147,13 @@ build_scope (function_t *f, def_t *func, param_t *params) } //printf ("%s%s %d\n", p == params ? "" : " ", p->name, def->ofs); def->used = 1; // don't warn for unused params - PR_DefInitialized (def); // params are assumed to be initialized + def_initialized (def); // params are assumed to be initialized i++; } if (argv) { while (i < MAX_PARMS) { - def = PR_GetDef (&type_vector, 0, f->scope, 1); + def = get_def (&type_vector, 0, f->scope, 1); def->used = 1; if (argv->type == &type_pointer) argv->type = array_type (&type_vector, MAX_PARMS - i); @@ -266,9 +266,9 @@ emit_function (function_t *f, expr_t *e) e = e->next; } emit_statement (pr_source_line, op_done, 0, 0, 0); - PR_FlushScope (current_scope, 0); + flush_scope (current_scope, 0); current_scope = pr.scope; - PR_ResetTempDefs (); + reset_tempdefs (); //puts (""); } diff --git a/tools/qfcc/source/idstuff.c b/tools/qfcc/source/idstuff.c index abc61d3f0..74088375b 100644 --- a/tools/qfcc/source/idstuff.c +++ b/tools/qfcc/source/idstuff.c @@ -184,7 +184,7 @@ WriteFiles (const char *sourcedir) } /* - PR_WriteProgdefs + WriteProgdefs Writes the global and entity structures out. Returns a crc of the header, to be stored in the progs file for comparison diff --git a/tools/qfcc/source/immediate.c b/tools/qfcc/source/immediate.c index c54e7bf22..57701590a 100644 --- a/tools/qfcc/source/immediate.c +++ b/tools/qfcc/source/immediate.c @@ -167,19 +167,19 @@ ReuseConstant (expr_t *expr, def_t *def) Hash_NewTable (16381, quaternion_imm_get_key, 0, 0); integer_imm_defs = Hash_NewTable (16381, int_imm_get_key, 0, "integer"); - Hash_Add (string_imm_defs, cn = PR_NewDef (&type_string, ".imm", + Hash_Add (string_imm_defs, cn = new_def (&type_string, ".imm", pr.scope)); cn->initialized = cn->constant = 1; - Hash_Add (float_imm_defs, cn = PR_NewDef (&type_float, ".imm", + Hash_Add (float_imm_defs, cn = new_def (&type_float, ".imm", pr.scope)); cn->initialized = cn->constant = 1; - Hash_Add (entity_imm_defs, cn = PR_NewDef (&type_entity, ".imm", + Hash_Add (entity_imm_defs, cn = new_def (&type_entity, ".imm", pr.scope)); cn->initialized = cn->constant = 1; - Hash_Add (pointer_imm_defs, cn = PR_NewDef (&type_pointer, ".imm", + Hash_Add (pointer_imm_defs, cn = new_def (&type_pointer, ".imm", pr.scope)); cn->initialized = cn->constant = 1; - Hash_Add (integer_imm_defs, cn = PR_NewDef (&type_integer, ".imm", + Hash_Add (integer_imm_defs, cn = new_def (&type_integer, ".imm", pr.scope)); cn->initialized = cn->constant = 1; } @@ -252,13 +252,13 @@ ReuseConstant (expr_t *expr, def_t *def) cn = (def_t *) Hash_Find (tab, rep->str); if (cn) { if (def) { - PR_FreeLocation (def); + free_location (def); def->ofs = cn->ofs; def->initialized = def->constant = 1; cn = def; } else { if (cn->type != type) { - def = PR_NewDef (type, ".imm", pr.scope); + def = new_def (type, ".imm", pr.scope); def->ofs = cn->ofs; cn = def; } @@ -269,19 +269,19 @@ ReuseConstant (expr_t *expr, def_t *def) // always share immediates if (def) { if (def->type != type) { - cn = PR_NewDef (type, ".imm", pr.scope); + cn = new_def (type, ".imm", pr.scope); cn->ofs = def->ofs; } else { cn = def; } } else { - cn = PR_NewDef (type, ".imm", pr.scope); - cn->ofs = PR_NewLocation (type, pr.globals); + cn = new_def (type, ".imm", pr.scope); + cn->ofs = new_location (type, pr.globals); if (type == &type_vector || type == &type_quaternion) { int i; for (i = 0; i < 3 + (type == &type_quaternion); i++) - PR_NewDef (&type_float, ".imm", pr.scope); + new_def (&type_float, ".imm", pr.scope); } } cn->initialized = cn->constant = 1; diff --git a/tools/qfcc/source/method.c b/tools/qfcc/source/method.c index bb55bad46..35fe0b9b6 100644 --- a/tools/qfcc/source/method.c +++ b/tools/qfcc/source/method.c @@ -121,7 +121,7 @@ method_def (class_t *class, method_t *method) *s = '_'; //printf ("%s %s %s %ld\n", method->name, method->types, str->str, str->size); // FIXME need a file scope - def = PR_GetDef (method->type, str->str, pr.scope, 1); + def = get_def (method->type, str->str, pr.scope, 1); dstring_delete (str); return def; } @@ -174,7 +174,7 @@ make_message_def (const char *name, def_t **def) expr_t *zero = new_expr (); zero->type = ex_integer; - *def = PR_GetDef (&type_IMP, name, pr.scope, 1); + *def = get_def (&type_IMP, name, pr.scope, 1); build_builtin_function (*def, zero); } @@ -261,9 +261,9 @@ selector_def (const char *_sel_id, const char *_sel_types) sel_def = malloc (sizeof (sel_def_t)); sel_def->sel_id = sel_id; sel_def->sel_types = sel_types; - sel_def->def = PR_NewDef (type_SEL.aux_type, ".imm", pr.scope); + sel_def->def = new_def (type_SEL.aux_type, ".imm", pr.scope); sel_def->def->initialized = sel_def->def->constant = 1; - sel_def->def->ofs = PR_NewLocation (type_SEL.aux_type, pr.globals); + sel_def->def->ofs = new_location (type_SEL.aux_type, pr.globals); G_INT (sel_def->def->ofs) = sel_id; G_INT (sel_def->def->ofs + 1) = sel_types; Hash_AddElement (sel_def_hash, sel_def); @@ -296,7 +296,7 @@ emit_methods (methodlist_t *_methods, const char *name, int instance) new_struct_field (method_list, &type_integer, "method_count", vis_public); for (i = 0; i < count; i++) new_struct_field (method_list, type_Method.aux_type, 0, vis_public); - methods_def = PR_GetDef (method_list, va ("_OBJ_%s_METHODS_%s", type, name), + methods_def = get_def (method_list, va ("_OBJ_%s_METHODS_%s", type, name), pr.scope, 1); methods_def->initialized = methods_def->constant = 1; methods = &G_STRUCT (pr_method_list_t, methods_def->ofs); diff --git a/tools/qfcc/source/qc-parse.y b/tools/qfcc/source/qc-parse.y index d6ba1be3d..02344823c 100644 --- a/tools/qfcc/source/qc-parse.y +++ b/tools/qfcc/source/qc-parse.y @@ -341,7 +341,7 @@ def_item { $$ = $1; if ($$ && !$$->scope->parent && $$->type->type != ev_func) - PR_DefInitialized ($$); + def_initialized ($$); } ; @@ -351,7 +351,7 @@ def_name if (current_scope->parent) { scope_t *scope = current_scope->parent; if (!scope->parent && scope->parent->parent) { - def_t *def = PR_GetDef (0, $1, scope, 0); + def_t *def = get_def (0, $1, scope, 0); if (def) { scope = def->scope; if (scope->parent && !scope->parent->parent) { @@ -361,7 +361,7 @@ def_name } } } - $$ = PR_GetDef (current_type, $1, current_scope, 1); + $$ = get_def (current_type, $1, current_scope, 1); current_def = $$; } ; @@ -378,7 +378,7 @@ var_initializer if (current_scope->parent) { append_expr (local_expr, assign_expr (new_def_expr (current_def), $2)); - PR_DefInitialized (current_def); + def_initialized (current_def); } else { if ($2->type >= ex_string) { current_def = ReuseConstant ($2, current_def); @@ -512,7 +512,7 @@ statement_block { def_t *defs = current_scope->head; - PR_FlushScope (current_scope, 1); + flush_scope (current_scope, 1); current_scope = current_scope->parent; *current_scope->tail = defs; diff --git a/tools/qfcc/source/qfcc.c b/tools/qfcc/source/qfcc.c index a542d57bd..71a6eba00 100644 --- a/tools/qfcc/source/qfcc.c +++ b/tools/qfcc/source/qfcc.c @@ -338,7 +338,7 @@ finish_compilation (void) if (options.code.debug) { e.type = ex_string; e.e.string_val = debugfile; - ReuseConstant (&e, PR_GetDef (&type_string, ".debug_file", pr.scope, 1)); + ReuseConstant (&e, get_def (&type_string, ".debug_file", pr.scope, 1)); } for (def = pr.scope->head; def; def = def->def_next) { diff --git a/tools/qfcc/source/struct.c b/tools/qfcc/source/struct.c index b362fc61e..a0d4d4533 100644 --- a/tools/qfcc/source/struct.c +++ b/tools/qfcc/source/struct.c @@ -202,10 +202,10 @@ emit_struct(type_t *strct, const char *name) for (i = 0; i < count; i++) new_struct_field (ivar_list, type_ivar, 0, vis_public); dsprintf (ivars_name, "_OBJ_INSTANCE_VARIABLES_%s", name); - ivars_def = PR_GetDef (ivar_list, ivars_name->str, pr.scope, 0); + ivars_def = get_def (ivar_list, ivars_name->str, pr.scope, 0); if (ivars_def) goto done; - ivars_def = PR_GetDef (ivar_list, ivars_name->str, pr.scope, 1); + ivars_def = get_def (ivar_list, ivars_name->str, pr.scope, 1); ivars_def->initialized = ivars_def->constant = 1; ivars = &G_STRUCT (pr_ivar_list_t, ivars_def->ofs); ivars->ivar_count = count; @@ -252,7 +252,7 @@ process_enum (expr_t *enm) } if ((structs && find_struct (name->e.string_val)) || get_enum (name->e.string_val) - || PR_GetDef (NULL, name->e.string_val, pr.scope, 0)) { + || get_def (NULL, name->e.string_val, pr.scope, 0)) { error (name, "%s redeclared", name->e.string_val); continue; } diff --git a/tools/qfcc/source/switch.c b/tools/qfcc/source/switch.c index 2ba5d383b..7dfce2585 100644 --- a/tools/qfcc/source/switch.c +++ b/tools/qfcc/source/switch.c @@ -298,7 +298,7 @@ build_switch (expr_t *sw, case_node_t *tree, int op, expr_t *sw_val, range->type = ex_uinteger; - def = PR_GetDef (array_type (&type_uinteger, high - low + 1), name, pr.scope, 1); + def = get_def (array_type (&type_uinteger, high - low + 1), name, pr.scope, 1); table = new_def_expr (def); if (tree->left) {