rename def_t.initialized to def_t.constant

This commit is contained in:
Bill Currie 2001-10-18 17:15:05 +00:00
parent 78a5b3a381
commit 952f029e6d
5 changed files with 10 additions and 10 deletions

View file

@ -287,8 +287,8 @@ typedef struct def_s {
const char *name;
int num_locals;
gofs_t ofs;
int initialized;// 1 when a declaration included "= immediate"
statref_t *refs; // for relocations
int constant; // 1 when a declaration included "= immediate"
statref_t *refs; // for relocations
int used; // unused local detection
string_t file; // source file

View file

@ -176,13 +176,13 @@ emit_assign_expr (expr_t *e)
op = PR_Opcode_Find ("=", 5, def_b, def_a, &def_void);
emit_statement (e->line, op, def_b, def_a, 0);
} else {
if (def_a->initialized) {
if (def_a->constant) {
if (options.cow) {
int size = type_size [def_a->type->type];
int ofs = PR_NewLocation (def_a->type);
memcpy (pr_globals + ofs, pr_globals + def_a->ofs, size);
def_a->ofs = ofs;
def_a->initialized = 0;
def_a->constant = 0;
//warning (e1, "assignment to constant %s", def_a->name);
} else {
error (e1, "assignment to constant %s", def_a->name);

View file

@ -173,7 +173,7 @@ PR_ReuseConstant (expr_t *expr, def_t *def)
if (def) {
PR_FreeLocation (def);
def->ofs = cn->ofs;
def->initialized = 1;
def->constant = 1;
cn = def;
}
return cn;
@ -193,7 +193,7 @@ PR_ReuseConstant (expr_t *expr, def_t *def)
PR_NewDef (&type_float, ".imm", 0);
}
}
cn->initialized = 1;
cn->constant = 1;
// copy the immediate to the global area
if (e.type == ex_string)
e.e.integer_val = CopyString (r);

View file

@ -636,7 +636,7 @@ new_function (void)
void
build_function (function_t *f)
{
f->def->initialized = 1;
f->def->constant = 1;
G_FUNCTION (f->def->ofs) = numfunctions;
}

View file

@ -267,7 +267,7 @@ WriteData (int crc)
numglobaldefs++;
dd->type = def->type->type;
if (!def->initialized
if (!def->constant
&& def->type->type != ev_func
&& def->type->type != ev_field && def->scope == NULL)
dd->type |= DEF_SAVEGLOBAL;
@ -568,7 +568,7 @@ PR_GlobalString (gofs_t ofs)
if (!(def = pr_global_defs[ofs]))
return PR_GlobalStringNoContents (ofs);
if (def->initialized && def->type->type != ev_func) {
if (def->constant && def->type->type != ev_func) {
s = PR_ValueString (def->type->type, &pr_globals[ofs]);
sprintf (line, "%i(%s)", ofs, s);
} else {
@ -712,7 +712,7 @@ PR_FinishCompilation (void)
if (d->type->type == ev_func && !d->scope) { // function args ok
// f = G_FUNCTION(d->ofs);
// if (!f || (!f->code && !f->builtin))
if (!d->initialized) {
if (!d->constant) {
warning (0, "function %s was not defined\n", d->name);
}
}