Put class and category reference/name symbols in the symbol table.

This fixes the undefined defs in qwaq.
This commit is contained in:
Bill Currie 2011-02-11 15:42:37 +09:00
parent 179c1f7058
commit 5f3c1872b9

View file

@ -569,69 +569,93 @@ class_begin (class_type_t *class_type)
void void
emit_class_ref (const char *class_name) emit_class_ref (const char *class_name)
{ {
def_t *def; symbol_t *ref_sym;
def_t *ref; symbol_t *name_sym;
def_t *ref_def;
def_t *name_def;
def = make_symbol (va (".obj_class_ref_%s", class_name), &type_pointer, ref_sym = make_symbol (va (".obj_class_ref_%s", class_name), &type_pointer,
pr.far_data, st_static)->s.def; pr.far_data, st_static);
if (def->initialized) if (!ref_sym->table)
symtab_addsymbol (pr.symtab, ref_sym);
ref_def = ref_sym->s.def;
if (ref_def->initialized)
return; return;
def->initialized = def->constant = def->nosave = 1; ref_def->initialized = ref_def->constant = ref_def->nosave = 1;
ref = make_symbol (va (".obj_class_name_%s", class_name), &type_pointer, name_sym = make_symbol (va (".obj_class_name_%s", class_name),
pr.far_data, st_extern)->s.def; &type_pointer, pr.far_data, st_extern);
if (!ref->external) if (!name_sym->table)
D_INT (def) = ref->offset; symtab_addsymbol (pr.symtab, name_sym);
reloc_def_def (ref, def->offset); name_def = name_sym->s.def;
if (!name_def->external)
D_INT (ref_def) = name_def->offset;
reloc_def_def (name_def, ref_def->offset);
} }
static void static void
emit_class_name (const char *class_name) emit_class_name (const char *class_name)
{ {
def_t *def; symbol_t *name_sym;
def_t *name_def;
def = make_symbol (va (".obj_class_name_%s", class_name), &type_pointer, name_sym = make_symbol (va (".obj_class_name_%s", class_name),
pr.far_data, st_global)->s.def; &type_pointer, pr.far_data, st_global);
if (def->initialized) if (!name_sym->table)
symtab_addsymbol (pr.symtab, name_sym);
name_def = name_sym->s.def;
if (name_def->initialized)
return; return;
def->initialized = def->constant = 1; name_def->initialized = name_def->constant = 1;
def->nosave = 1; name_def->nosave = 1;
D_INT (def) = 0; D_INT (name_def) = 0;
} }
void void
emit_category_ref (const char *class_name, const char *category_name) emit_category_ref (const char *class_name, const char *category_name)
{ {
def_t *def; symbol_t *ref_sym;
def_t *ref; symbol_t *name_sym;
def_t *ref_def;
def_t *name_def;
def = make_symbol (va (".obj_category_ref_%s_%s", ref_sym = make_symbol (va (".obj_category_ref_%s_%s",
class_name, category_name), class_name, category_name),
&type_pointer, pr.far_data, st_static)->s.def; &type_pointer, pr.far_data, st_static);
if (def->initialized) if (!ref_sym->table)
symtab_addsymbol (pr.symtab, ref_sym);
ref_def = ref_sym->s.def;
if (ref_def->initialized)
return; return;
def->initialized = def->constant = 1; ref_def->initialized = ref_def->constant = 1;
def->nosave = 1; ref_def->nosave = 1;
ref = make_symbol (va (".obj_category_name_%s_%s", name_sym = make_symbol (va (".obj_category_name_%s_%s",
class_name, category_name), class_name, category_name),
&type_pointer, pr.far_data, st_extern)->s.def; &type_pointer, pr.far_data, st_extern);
if (!ref->external) if (!name_sym->table)
D_INT (def) = ref->offset; symtab_addsymbol (pr.symtab, name_sym);
reloc_def_def (ref, def->offset); name_def = name_sym->s.def;
if (!name_def->external)
D_INT (ref_def) = name_def->offset;
reloc_def_def (name_def, ref_def->offset);
} }
static void static void
emit_category_name (const char *class_name, const char *category_name) emit_category_name (const char *class_name, const char *category_name)
{ {
def_t *def; symbol_t *name_sym;
def_t *name_def;
def = make_symbol (va (".obj_category_name_%s_%s", name_sym = make_symbol (va (".obj_category_name_%s_%s",
class_name, category_name), class_name, category_name),
&type_pointer, pr.far_data, st_global)->s.def; &type_pointer, pr.far_data, st_global);
if (def->initialized) if (!name_sym->table)
symtab_addsymbol (pr.symtab, name_sym);
name_def = name_sym->s.def;
if (name_def->initialized)
return; return;
def->initialized = def->constant = 1; name_def->initialized = name_def->constant = 1;
def->nosave = 1; name_def->nosave = 1;
D_INT (def) = 0; D_INT (name_def) = 0;
} }
static void static void