Rename new_defspace() and defspace_new_loc().

This commit is contained in:
Bill Currie 2011-02-24 13:07:36 +09:00
parent 88cd37a3e2
commit c10a551c84
9 changed files with 22 additions and 23 deletions

View file

@ -47,8 +47,8 @@ typedef struct defspace_s {
int qfo_space;
} defspace_t;
defspace_t *new_defspace (void);
int defspace_new_loc (defspace_t *space, int size);
defspace_t *defspace_new (void);
int defspace_alloc_loc (defspace_t *space, int size);
void defspace_free_loc (defspace_t *space, int ofs, int size);
int defspace_add_data (defspace_t *space, pr_type_t *data, int size);

View file

@ -130,7 +130,7 @@ new_def (const char *name, type_t *type, defspace_t *space,
error (0, "%s has incomplete type", name);
size = 1;
}
def->offset = defspace_new_loc (space, size);
def->offset = defspace_alloc_loc (space, size);
}
return def;

View file

@ -78,7 +78,7 @@ grow_space (defspace_t *space)
}
defspace_t *
new_defspace (void)
defspace_new (void)
{
defspace_t *space;
@ -89,7 +89,7 @@ new_defspace (void)
}
int
defspace_new_loc (defspace_t *space, int size)
defspace_alloc_loc (defspace_t *space, int size)
{
int ofs;
locref_t *loc;
@ -180,7 +180,7 @@ defspace_add_data (defspace_t *space, pr_type_t *data, int size)
{
int loc;
loc = defspace_new_loc (space, size);
loc = defspace_alloc_loc (space, size);
if (data)
memcpy (space->data + loc, data, size * sizeof (pr_type_t));
return loc;

View file

@ -450,7 +450,7 @@ build_scope (symbol_t *fsym, symtab_t *parent)
symtab = new_symtab (parent, stab_local);
fsym->s.func->symtab = symtab;
symtab->space = new_defspace ();
symtab->space = defspace_new ();
current_symtab = symtab;
if (fsym->type->t.func.num_params < 0) {

View file

@ -253,7 +253,7 @@ emit_value (ex_value_t *value, def_t *def)
}
} else {
cn = new_def (".imm", type, pr.near_data, st_static);
cn->offset = defspace_new_loc (pr.near_data, type_size (type));
cn->offset = defspace_alloc_loc (pr.near_data, type_size (type));
}
cn->initialized = cn->constant = 1;
cn->nosave = 1;

View file

@ -267,10 +267,10 @@ linker_begin (void)
// the actual space data
work_strings = strpool_new ();
work_code = codespace_new ();
work_near_data = new_defspace();
work_far_data = new_defspace();
work_entity_data = new_defspace();
work_type_data = new_defspace();
work_near_data = defspace_new ();
work_far_data = defspace_new ();
work_entity_data = defspace_new ();
work_type_data = defspace_new ();
}
static void

View file

@ -86,7 +86,7 @@ qfo_new_encoding (type_t *type, int size)
size /= sizeof (pr_type_t);
def = new_def (type->encoding, 0, pr.type_data, st_static);
def->offset = defspace_new_loc (pr.type_data, size);
def->offset = defspace_alloc_loc (pr.type_data, size);
enc = D_POINTER (qfot_type_t, def);
enc->ty = type->ty;

View file

@ -136,22 +136,22 @@ InitData (void)
pr.strings = strpool_new ();
pr.num_functions = 1;
pr.data = new_defspace ();
pr.data = defspace_new ();
pr.far_data = new_defspace ();
pr.far_data = defspace_new ();
pr.near_data = new_defspace ();
pr.near_data = defspace_new ();
pr.near_data->data = calloc (65536, sizeof (pr_type_t));
pr.near_data->max_size = 65536;
pr.near_data->grow = 0;
pr.type_data = new_defspace ();
defspace_new_loc (pr.type_data, 4); // reserve space for a null descriptor
pr.type_data = defspace_new ();
defspace_alloc_loc (pr.type_data, 4);// reserve space for a null descriptor
pr.symtab = new_symtab (0, stab_global);
pr.symtab->space = pr.near_data;
pr.entity_data = new_defspace ();
pr.entity_data = defspace_new ();
numglobaldefs = 1;
numfielddefs = 1;
@ -434,7 +434,7 @@ finish_compilation (void)
}
df->parm_start = pr.near_data->size;
} else {
df->parm_start = defspace_new_loc (pr.near_data,
df->parm_start = defspace_alloc_loc (pr.near_data,
f->symtab->space->size);
num_localdefs += f->symtab->space->size;
}
@ -445,7 +445,7 @@ finish_compilation (void)
}
}
if (options.code.local_merging)
defspace_new_loc (pr.near_data, num_localdefs);
defspace_alloc_loc (pr.near_data, num_localdefs);
if (options.code.progsversion != PROG_ID_VERSION) {
//FIXME better init code

View file

@ -21,7 +21,6 @@ options_t options;
int num_linenos;
pr_lineno_t *linenos;
pr_info_t pr;
defspace_t *new_defspace (void) {return 0;}
string_t ReuseString (const char *str) {return 0;}
void encode_type (struct dstring_s *str, type_t *type) {}
codespace_t *codespace_new (void) {return 0;}