[qfcc] Take optional space param for emit_structure

If the space param is null, the far data space is used.
This commit is contained in:
Bill Currie 2020-04-03 14:16:16 +09:00
parent f8d9b720de
commit 4b34bf3d95
4 changed files with 12 additions and 8 deletions

View file

@ -59,6 +59,7 @@ struct symbol_s *make_structure (const char *name, int su, struct_def_t *defs,
struct type_s *type); struct type_s *type);
struct def_s * emit_structure (const char *name, int su, struct_def_t *defs, struct def_s * emit_structure (const char *name, int su, struct_def_t *defs,
struct type_s *type, void *data, struct type_s *type, void *data,
struct defspace_s *space,
enum storage_class_e storage); enum storage_class_e storage);
#endif//__struct_h #endif//__struct_h

View file

@ -260,7 +260,7 @@ emit_static_instances (const char *classname)
data.num_instances + 1); data.num_instances + 1);
instances_def = emit_structure (va ("_OBJ_STATIC_INSTANCES_%s", classname), instances_def = emit_structure (va ("_OBJ_STATIC_INSTANCES_%s", classname),
's', instances_struct, 0, &data, 's', instances_struct, 0, &data,
sc_static); 0, sc_static);
free (data.instances); free (data.instances);
return instances_def; return instances_def;
} }
@ -787,7 +787,7 @@ emit_ivars (symtab_t *ivars, const char *name)
ivar_list_struct[1].type = array_type (&type_ivar, ivar_data.count); ivar_list_struct[1].type = array_type (&type_ivar, ivar_data.count);
def = emit_structure (va ("_OBJ_INSTANCE_VARIABLES_%s", name), 's', def = emit_structure (va ("_OBJ_INSTANCE_VARIABLES_%s", name), 's',
ivar_list_struct, 0, &ivar_data, sc_static); ivar_list_struct, 0, &ivar_data, 0, sc_static);
dstring_delete (ivar_data.encoding); dstring_delete (ivar_data.encoding);
return def; return def;
@ -1528,7 +1528,7 @@ class_finish_module (void)
+ data.cat_def_cnt + data.cat_def_cnt
+ 1); + 1);
symtab_def = emit_structure ("_OBJ_SYMTAB", 's', symtab_struct, 0, &data, symtab_def = emit_structure ("_OBJ_SYMTAB", 's', symtab_struct, 0, &data,
sc_static); 0, sc_static);
free (data.classes); free (data.classes);
free (data.categories); free (data.categories);
@ -1787,7 +1787,7 @@ emit_protocol_list (protocollist_t *protocols, const char *name)
return 0; return 0;
proto_list_struct[2].type = array_type (&type_pointer, protocols->count); proto_list_struct[2].type = array_type (&type_pointer, protocols->count);
return emit_structure (va ("_OBJ_PROTOCOLS_%s", name), 's', return emit_structure (va ("_OBJ_PROTOCOLS_%s", name), 's',
proto_list_struct, 0, protocols, sc_static); proto_list_struct, 0, protocols, 0, sc_static);
} }
void void

View file

@ -606,7 +606,7 @@ emit_methods (methodlist_t *methods, const char *name, int instance)
methods_struct[2].type = array_type (&type_method, count); methods_struct[2].type = array_type (&type_method, count);
return emit_structure (va ("_OBJ_%s_METHODS_%s", type, name), 's', return emit_structure (va ("_OBJ_%s_METHODS_%s", type, name), 's',
methods_struct, 0, methods, sc_static); methods_struct, 0, methods, 0, sc_static);
} }
static void static void
@ -674,7 +674,7 @@ emit_method_descriptions (methodlist_t *methods, const char *name,
method_list_struct[1].type = array_type (&type_method_description, count); method_list_struct[1].type = array_type (&type_method_description, count);
return emit_structure (va ("_OBJ_%s_METHODS_%s", type, name), 's', return emit_structure (va ("_OBJ_%s_METHODS_%s", type, name), 's',
method_list_struct, 0, methods, sc_static); method_list_struct, 0, methods, 0, sc_static);
} }
void void

View file

@ -306,7 +306,7 @@ make_structure (const char *name, int su, struct_def_t *defs, type_t *type)
def_t * def_t *
emit_structure (const char *name, int su, struct_def_t *defs, type_t *type, emit_structure (const char *name, int su, struct_def_t *defs, type_t *type,
void *data, storage_class_t storage) void *data, defspace_t *space, storage_class_t storage)
{ {
int i, j; int i, j;
int saw_null = 0; int saw_null = 0;
@ -341,7 +341,10 @@ emit_structure (const char *name, int su, struct_def_t *defs, type_t *type,
if (storage != sc_global && storage != sc_static) if (storage != sc_global && storage != sc_static)
internal_error (0, "structure %s must be global or static", name); internal_error (0, "structure %s must be global or static", name);
struct_sym = make_symbol (name, type, pr.far_data, storage); if (!space) {
space = pr.far_data;
}
struct_sym = make_symbol (name, type, space, storage);
struct_def = struct_sym->s.def; struct_def = struct_sym->s.def;
if (struct_def->initialized) if (struct_def->initialized)