bug fixes, name changes
This commit is contained in:
parent
4804ab14b8
commit
e04230a126
17 changed files with 85 additions and 82 deletions
|
@ -34,7 +34,6 @@
|
||||||
#include "density.h"
|
#include "density.h"
|
||||||
|
|
||||||
struct switch_hdr {
|
struct switch_hdr {
|
||||||
struct switch_hdr *next; /* in the free list */
|
|
||||||
label sh_break; /* label of statement after this one */
|
label sh_break; /* label of statement after this one */
|
||||||
label sh_default; /* label of ELSE part, or 0 */
|
label sh_default; /* label of ELSE part, or 0 */
|
||||||
int sh_nrofentries; /* number of cases */
|
int sh_nrofentries; /* number of cases */
|
||||||
|
@ -245,7 +244,7 @@ AddCases(sh, node, lbl)
|
||||||
|
|
||||||
AddOneCase(sh, node, lbl)
|
AddOneCase(sh, node, lbl)
|
||||||
register struct switch_hdr *sh;
|
register struct switch_hdr *sh;
|
||||||
register struct node *node;
|
struct node *node;
|
||||||
label lbl;
|
label lbl;
|
||||||
{
|
{
|
||||||
register struct case_entry *ce = new_case_entry();
|
register struct case_entry *ce = new_case_entry();
|
||||||
|
|
|
@ -537,7 +537,7 @@ ChkProcCall(expp)
|
||||||
|
|
||||||
/* Check parameter list
|
/* Check parameter list
|
||||||
*/
|
*/
|
||||||
for (param = ParamList(left->nd_type); param; param = param->next) {
|
for (param = ParamList(left->nd_type); param; param = param->par_next) {
|
||||||
if (!(left = getarg(&expp, 0, IsVarParam(param), edf))) {
|
if (!(left = getarg(&expp, 0, IsVarParam(param), edf))) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -348,8 +348,8 @@ CodeParameters(param, arg)
|
||||||
|
|
||||||
assert(param != 0 && arg != 0);
|
assert(param != 0 && arg != 0);
|
||||||
|
|
||||||
if (param->next) {
|
if (param->par_next) {
|
||||||
CodeParameters(param->next, arg->nd_right);
|
CodeParameters(param->par_next, arg->nd_right);
|
||||||
}
|
}
|
||||||
|
|
||||||
tp = TypeOfParam(param);
|
tp = TypeOfParam(param);
|
||||||
|
|
|
@ -218,11 +218,11 @@ IdentList(struct node **p;)
|
||||||
IDENT { *p = q = MkLeaf(Value, &dot); }
|
IDENT { *p = q = MkLeaf(Value, &dot); }
|
||||||
[ %persistent
|
[ %persistent
|
||||||
',' IDENT
|
',' IDENT
|
||||||
{ q->next = MkLeaf(Value, &dot);
|
{ q->nd_left = MkLeaf(Value, &dot);
|
||||||
q = q->next;
|
q = q->nd_left;
|
||||||
}
|
}
|
||||||
]*
|
]*
|
||||||
{ q->next = 0; }
|
{ q->nd_left = 0; }
|
||||||
;
|
;
|
||||||
|
|
||||||
SubrangeType(struct type **ptp;)
|
SubrangeType(struct type **ptp;)
|
||||||
|
@ -416,7 +416,7 @@ SetType(struct type **ptp;) :
|
||||||
PointerType(register struct type **ptp;) :
|
PointerType(register struct type **ptp;) :
|
||||||
POINTER TO
|
POINTER TO
|
||||||
[ %if (type_or_forward(ptp))
|
[ %if (type_or_forward(ptp))
|
||||||
type(&((*ptp)->next))
|
type(&((*ptp)->tp_next))
|
||||||
|
|
|
|
||||||
IDENT
|
IDENT
|
||||||
]
|
]
|
||||||
|
|
|
@ -76,7 +76,7 @@ struct forwtype {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct def { /* list of definitions for a name */
|
struct def { /* list of definitions for a name */
|
||||||
struct def *next; /* next definition in definitions chain */
|
struct def *df_next; /* next definition in definitions chain */
|
||||||
struct def *df_nextinscope;
|
struct def *df_nextinscope;
|
||||||
/* link all definitions in a scope */
|
/* link all definitions in a scope */
|
||||||
struct idf *df_idf; /* link back to the name */
|
struct idf *df_idf; /* link back to the name */
|
||||||
|
|
|
@ -74,7 +74,7 @@ MkDef(id, scope, kind)
|
||||||
df->df_idf = id;
|
df->df_idf = id;
|
||||||
df->df_scope = scope;
|
df->df_scope = scope;
|
||||||
df->df_kind = kind;
|
df->df_kind = kind;
|
||||||
df->next = id->id_def;
|
df->df_next = id->id_def;
|
||||||
id->id_def = df;
|
id->id_def = df;
|
||||||
|
|
||||||
/* enter the definition in the list of definitions in this scope
|
/* enter the definition in the list of definitions in this scope
|
||||||
|
@ -211,13 +211,13 @@ RemoveFromIdList(df)
|
||||||
register struct idf *id = df->df_idf;
|
register struct idf *id = df->df_idf;
|
||||||
register struct def *df1;
|
register struct def *df1;
|
||||||
|
|
||||||
if ((df1 = id->id_def) == df) id->id_def = df->next;
|
if ((df1 = id->id_def) == df) id->id_def = df->df_next;
|
||||||
else {
|
else {
|
||||||
while (df1->next != df) {
|
while (df1->df_next != df) {
|
||||||
assert(df1->next != 0);
|
assert(df1->df_next != 0);
|
||||||
df1 = df1->next;
|
df1 = df1->df_next;
|
||||||
}
|
}
|
||||||
df1->next = df->next;
|
df1->df_next = df->df_next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -131,7 +131,7 @@ GetDefinitionModule(id, incr)
|
||||||
n = MkLeaf(Name, &dot);
|
n = MkLeaf(Name, &dot);
|
||||||
n->nd_IDF = id;
|
n->nd_IDF = id;
|
||||||
n->nd_symb = IDENT;
|
n->nd_symb = IDENT;
|
||||||
if (nd_end) nd_end->next = n;
|
if (nd_end) nd_end->nd_left = n;
|
||||||
else Modules = n;
|
else Modules = n;
|
||||||
nd_end = n;
|
nd_end = n;
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,6 +107,7 @@ CodeValue(ds, tp)
|
||||||
/* Generate code to load the value of the designator described
|
/* Generate code to load the value of the designator described
|
||||||
in "ds"
|
in "ds"
|
||||||
*/
|
*/
|
||||||
|
arith sz;
|
||||||
|
|
||||||
switch(ds->dsg_kind) {
|
switch(ds->dsg_kind) {
|
||||||
case DSG_LOADED:
|
case DSG_LOADED:
|
||||||
|
@ -117,13 +118,14 @@ CodeValue(ds, tp)
|
||||||
/* Fall through */
|
/* Fall through */
|
||||||
case DSG_PLOADED:
|
case DSG_PLOADED:
|
||||||
case DSG_PFIXED:
|
case DSG_PFIXED:
|
||||||
|
sz = WA(tp->tp_size);
|
||||||
if (properly(ds, tp->tp_size, tp->tp_align)) {
|
if (properly(ds, tp->tp_size, tp->tp_align)) {
|
||||||
CodeAddress(ds);
|
CodeAddress(ds);
|
||||||
C_loi(tp->tp_size);
|
C_loi(tp->tp_size);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (ds->dsg_kind == DSG_PLOADED) {
|
if (ds->dsg_kind == DSG_PLOADED) {
|
||||||
arith sz = WA(tp->tp_size) - pointer_size;
|
sz -= pointer_size;
|
||||||
|
|
||||||
C_asp(-sz);
|
C_asp(-sz);
|
||||||
C_lor((arith) 1);
|
C_lor((arith) 1);
|
||||||
|
@ -131,9 +133,9 @@ CodeValue(ds, tp)
|
||||||
C_loi(pointer_size);
|
C_loi(pointer_size);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
C_asp(-WA(tp->tp_size));
|
C_asp(-sz);
|
||||||
CodeAddress(ds);
|
|
||||||
}
|
}
|
||||||
|
CodeAddress(ds);
|
||||||
C_loc(tp->tp_size);
|
C_loc(tp->tp_size);
|
||||||
C_cal("_load");
|
C_cal("_load");
|
||||||
C_asp(2 * word_size);
|
C_asp(2 * word_size);
|
||||||
|
|
|
@ -69,7 +69,7 @@ EnterEnumList(Idlist, type)
|
||||||
register struct node *idlist = Idlist;
|
register struct node *idlist = Idlist;
|
||||||
|
|
||||||
type->enm_ncst = 0;
|
type->enm_ncst = 0;
|
||||||
for (; idlist; idlist = idlist->next) {
|
for (; idlist; idlist = idlist->nd_left) {
|
||||||
df = define(idlist->nd_IDF, CurrentScope, D_ENUM);
|
df = define(idlist->nd_IDF, CurrentScope, D_ENUM);
|
||||||
df->df_type = type;
|
df->df_type = type;
|
||||||
df->enm_val = (type->enm_ncst)++;
|
df->enm_val = (type->enm_ncst)++;
|
||||||
|
@ -93,7 +93,7 @@ EnterFieldList(Idlist, type, scope, addr)
|
||||||
register struct def *df;
|
register struct def *df;
|
||||||
register struct node *idlist = Idlist;
|
register struct node *idlist = Idlist;
|
||||||
|
|
||||||
for (; idlist; idlist = idlist->next) {
|
for (; idlist; idlist = idlist->nd_left) {
|
||||||
df = define(idlist->nd_IDF, scope, D_FIELD);
|
df = define(idlist->nd_IDF, scope, D_FIELD);
|
||||||
df->df_type = type;
|
df->df_type = type;
|
||||||
df->df_flags |= D_QEXPORTED;
|
df->df_flags |= D_QEXPORTED;
|
||||||
|
@ -198,11 +198,11 @@ EnterParamList(ppr, Idlist, type, VARp, off)
|
||||||
/* Can only happen when a procedure type is defined */
|
/* Can only happen when a procedure type is defined */
|
||||||
dummy = Idlist = idlist = MkLeaf(Name, &dot);
|
dummy = Idlist = idlist = MkLeaf(Name, &dot);
|
||||||
}
|
}
|
||||||
for ( ; idlist; idlist = idlist->next) {
|
for ( ; idlist; idlist = idlist->nd_left) {
|
||||||
pr = new_paramlist();
|
pr = new_paramlist();
|
||||||
pr->next = 0;
|
pr->par_next = 0;
|
||||||
if (!*ppr) *ppr = pr;
|
if (!*ppr) *ppr = pr;
|
||||||
else last->next = pr;
|
else last->par_next = pr;
|
||||||
last = pr;
|
last = pr;
|
||||||
if (!DefinitionModule && idlist != dummy) {
|
if (!DefinitionModule && idlist != dummy) {
|
||||||
df = define(idlist->nd_IDF, CurrentScope, D_VARIABLE);
|
df = define(idlist->nd_IDF, CurrentScope, D_VARIABLE);
|
||||||
|
@ -322,7 +322,7 @@ EnterExportList(Idlist, qualified)
|
||||||
register struct node *idlist = Idlist;
|
register struct node *idlist = Idlist;
|
||||||
register struct def *df, *df1;
|
register struct def *df, *df1;
|
||||||
|
|
||||||
for (;idlist; idlist = idlist->next) {
|
for (;idlist; idlist = idlist->nd_left) {
|
||||||
df = lookup(idlist->nd_IDF, CurrentScope, 0);
|
df = lookup(idlist->nd_IDF, CurrentScope, 0);
|
||||||
|
|
||||||
if (!df) {
|
if (!df) {
|
||||||
|
@ -354,7 +354,7 @@ EnterExportList(Idlist, qualified)
|
||||||
df1->imp_def == CurrentScope->sc_definedby) {
|
df1->imp_def == CurrentScope->sc_definedby) {
|
||||||
DoImport(df, df1->df_scope);
|
DoImport(df, df1->df_scope);
|
||||||
}
|
}
|
||||||
df1 = df1->next;
|
df1 = df1->df_next;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Also handle the definition as if the enclosing
|
/* Also handle the definition as if the enclosing
|
||||||
|
@ -427,7 +427,7 @@ node_error(FromId,"identifier \"%s\" does not represent a module",module_name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (; idlist; idlist = idlist->next) {
|
for (; idlist; idlist = idlist->nd_left) {
|
||||||
if (forwflag) df = ForwDef(idlist, vis->sc_scope);
|
if (forwflag) df = ForwDef(idlist, vis->sc_scope);
|
||||||
else if (! (df = lookup(idlist->nd_IDF, vis->sc_scope, 1))) {
|
else if (! (df = lookup(idlist->nd_IDF, vis->sc_scope, 1))) {
|
||||||
if (! is_anon_idf(idlist->nd_IDF)) {
|
if (! is_anon_idf(idlist->nd_IDF)) {
|
||||||
|
@ -464,7 +464,7 @@ EnterImportList(Idlist, local)
|
||||||
struct scope *sc = enclosing(CurrVis)->sc_scope;
|
struct scope *sc = enclosing(CurrVis)->sc_scope;
|
||||||
extern struct def *GetDefinitionModule();
|
extern struct def *GetDefinitionModule();
|
||||||
|
|
||||||
for (; idlist; idlist = idlist->next) {
|
for (; idlist; idlist = idlist->nd_left) {
|
||||||
DoImport(local ?
|
DoImport(local ?
|
||||||
ForwDef(idlist, sc) :
|
ForwDef(idlist, sc) :
|
||||||
GetDefinitionModule(idlist->nd_IDF, 1) ,
|
GetDefinitionModule(idlist->nd_IDF, 1) ,
|
||||||
|
|
|
@ -40,7 +40,7 @@ lookup(id, scope, import)
|
||||||
*/
|
*/
|
||||||
for (df = id->id_def, df1 = 0;
|
for (df = id->id_def, df1 = 0;
|
||||||
df && df->df_scope != scope;
|
df && df->df_scope != scope;
|
||||||
df1 = df, df = df->next) { /* nothing */ }
|
df1 = df, df = df->df_next) { /* nothing */ }
|
||||||
|
|
||||||
if (df) {
|
if (df) {
|
||||||
/* Found it
|
/* Found it
|
||||||
|
@ -48,8 +48,8 @@ lookup(id, scope, import)
|
||||||
if (df1) {
|
if (df1) {
|
||||||
/* Put the definition in front
|
/* Put the definition in front
|
||||||
*/
|
*/
|
||||||
df1->next = df->next;
|
df1->df_next = df->df_next;
|
||||||
df->next = id->id_def;
|
df->df_next = id->id_def;
|
||||||
id->id_def = df;
|
id->id_def = df;
|
||||||
}
|
}
|
||||||
if (import && df->df_kind == D_IMPORT) {
|
if (import && df->df_kind == D_IMPORT) {
|
||||||
|
|
|
@ -10,8 +10,7 @@
|
||||||
/* $Header$ */
|
/* $Header$ */
|
||||||
|
|
||||||
struct node {
|
struct node {
|
||||||
struct node *next;
|
struct node *nd_left;
|
||||||
#define nd_left next
|
|
||||||
struct node *nd_right;
|
struct node *nd_right;
|
||||||
int nd_class; /* kind of node */
|
int nd_class; /* kind of node */
|
||||||
#define Value 0 /* constant */
|
#define Value 0 /* constant */
|
||||||
|
|
|
@ -47,9 +47,9 @@ open_scope(scopetype)
|
||||||
ls->sc_scope = sc;
|
ls->sc_scope = sc;
|
||||||
ls->sc_encl = CurrVis;
|
ls->sc_encl = CurrVis;
|
||||||
if (scopetype == OPENSCOPE) {
|
if (scopetype == OPENSCOPE) {
|
||||||
ls->next = ls->sc_encl;
|
ls->sc_next = ls->sc_encl;
|
||||||
}
|
}
|
||||||
else ls->next = PervVis;
|
else ls->sc_next = PervVis;
|
||||||
CurrVis = ls;
|
CurrVis = ls;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ InitScope()
|
||||||
sc->sc_def = 0;
|
sc->sc_def = 0;
|
||||||
sc->sc_level = proclevel;
|
sc->sc_level = proclevel;
|
||||||
PervasiveScope = sc;
|
PervasiveScope = sc;
|
||||||
ls->next = 0;
|
ls->sc_next = 0;
|
||||||
ls->sc_encl = 0;
|
ls->sc_encl = 0;
|
||||||
ls->sc_scope = PervasiveScope;
|
ls->sc_scope = PervasiveScope;
|
||||||
PervVis = ls;
|
PervVis = ls;
|
||||||
|
@ -126,7 +126,7 @@ chk_forw(pdf)
|
||||||
node_error(nd, "\"%s\" is not a type", df1->df_idf->id_text);
|
node_error(nd, "\"%s\" is not a type", df1->df_idf->id_text);
|
||||||
}
|
}
|
||||||
while (nd) {
|
while (nd) {
|
||||||
nd->nd_type->next = df->df_type;
|
nd->nd_type->tp_next = df->df_type;
|
||||||
nd = nd->nd_right;
|
nd = nd->nd_right;
|
||||||
}
|
}
|
||||||
FreeNode(df1->df_forw_node);
|
FreeNode(df1->df_forw_node);
|
||||||
|
@ -138,7 +138,7 @@ node_error(nd, "\"%s\" is not a type", df1->df_idf->id_text);
|
||||||
|
|
||||||
df->df_kind = D_TYPE;
|
df->df_kind = D_TYPE;
|
||||||
while (nd) {
|
while (nd) {
|
||||||
nd->nd_type->next = df->df_type;
|
nd->nd_type->tp_next = df->df_type;
|
||||||
nd = nd->nd_right;
|
nd = nd->nd_right;
|
||||||
}
|
}
|
||||||
FreeNode(df->df_forw_node);
|
FreeNode(df->df_forw_node);
|
||||||
|
@ -166,7 +166,7 @@ df->df_idf->id_text);
|
||||||
struct def *df1 = df->df_nextinscope;
|
struct def *df1 = df->df_nextinscope;
|
||||||
|
|
||||||
if (df->df_kind == D_FORWMODULE) {
|
if (df->df_kind == D_FORWMODULE) {
|
||||||
df->for_vis->next = ls;
|
df->for_vis->sc_next = ls;
|
||||||
}
|
}
|
||||||
df->df_nextinscope = ls->sc_scope->sc_def;
|
df->df_nextinscope = ls->sc_scope->sc_def;
|
||||||
ls->sc_scope->sc_def = df;
|
ls->sc_scope->sc_def = df;
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct scope {
|
struct scope {
|
||||||
struct scope *next;
|
/* struct scope *next; */
|
||||||
char *sc_name; /* name of this scope */
|
char *sc_name; /* name of this scope */
|
||||||
struct def *sc_def; /* list of definitions in this scope */
|
struct def *sc_def; /* list of definitions in this scope */
|
||||||
arith sc_off; /* offsets of variables in this scope */
|
arith sc_off; /* offsets of variables in this scope */
|
||||||
|
@ -33,7 +33,7 @@ struct scope {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct scopelist {
|
struct scopelist {
|
||||||
struct scopelist *next;
|
struct scopelist *sc_next;
|
||||||
struct scope *sc_scope;
|
struct scope *sc_scope;
|
||||||
struct scopelist *sc_encl;
|
struct scopelist *sc_encl;
|
||||||
};
|
};
|
||||||
|
@ -48,6 +48,6 @@ extern struct scopelist
|
||||||
#define GlobalScope (GlobalVis->sc_scope)
|
#define GlobalScope (GlobalVis->sc_scope)
|
||||||
#define enclosing(x) ((x)->sc_encl)
|
#define enclosing(x) ((x)->sc_encl)
|
||||||
#define scopeclosed(x) ((x)->sc_scopeclosed)
|
#define scopeclosed(x) ((x)->sc_scopeclosed)
|
||||||
#define nextvisible(x) ((x)->next) /* use with scopelists */
|
#define nextvisible(x) ((x)->sc_next) /* use with scopelists */
|
||||||
|
|
||||||
struct scope *open_and_close_scope();
|
struct scope *open_and_close_scope();
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
/* $Header$ */
|
/* $Header$ */
|
||||||
|
|
||||||
struct paramlist { /* structure for parameterlist of a PROCEDURE */
|
struct paramlist { /* structure for parameterlist of a PROCEDURE */
|
||||||
struct paramlist *next;
|
struct paramlist *par_next;
|
||||||
struct def *par_def; /* "df" of parameter */
|
struct def *par_def; /* "df" of parameter */
|
||||||
#define IsVarParam(xpar) ((int) ((xpar)->par_def->df_flags & D_VARPAR))
|
#define IsVarParam(xpar) ((int) ((xpar)->par_def->df_flags & D_VARPAR))
|
||||||
#define TypeOfParam(xpar) ((xpar)->par_def->df_type)
|
#define TypeOfParam(xpar) ((xpar)->par_def->df_type)
|
||||||
|
@ -27,6 +27,8 @@ struct enume {
|
||||||
#define enm_rck tp_value.tp_enum->en_rck
|
#define enm_rck tp_value.tp_enum->en_rck
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* ALLOCDEF "enume" 5 */
|
||||||
|
|
||||||
struct subrange {
|
struct subrange {
|
||||||
arith su_lb, su_ub; /* lower bound and upper bound */
|
arith su_lb, su_ub; /* lower bound and upper bound */
|
||||||
label su_rck; /* label of range check descriptor */
|
label su_rck; /* label of range check descriptor */
|
||||||
|
@ -35,6 +37,8 @@ struct subrange {
|
||||||
#define sub_rck tp_value.tp_subrange->su_rck
|
#define sub_rck tp_value.tp_subrange->su_rck
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* ALLOCDEF "subrange" 5 */
|
||||||
|
|
||||||
struct array {
|
struct array {
|
||||||
struct type *ar_elem; /* type of elements */
|
struct type *ar_elem; /* type of elements */
|
||||||
label ar_descr; /* label of array descriptor */
|
label ar_descr; /* label of array descriptor */
|
||||||
|
@ -44,6 +48,8 @@ struct array {
|
||||||
#define arr_elsize tp_value.tp_arr->ar_elsize
|
#define arr_elsize tp_value.tp_arr->ar_elsize
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* ALLOCDEF "array" 5 */
|
||||||
|
|
||||||
struct record {
|
struct record {
|
||||||
struct scope *rc_scope; /* scope of this record */
|
struct scope *rc_scope; /* scope of this record */
|
||||||
/* members are in the symbol table */
|
/* members are in the symbol table */
|
||||||
|
@ -58,7 +64,7 @@ struct proc {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct type {
|
struct type {
|
||||||
struct type *next; /* used with ARRAY, PROCEDURE, POINTER, SET,
|
struct type *tp_next; /* used with ARRAY, PROCEDURE, POINTER, SET,
|
||||||
SUBRANGE, EQUAL
|
SUBRANGE, EQUAL
|
||||||
*/
|
*/
|
||||||
int tp_fund; /* fundamental type or constructor */
|
int tp_fund; /* fundamental type or constructor */
|
||||||
|
@ -146,29 +152,29 @@ struct type
|
||||||
|
|
||||||
#define NULLTYPE ((struct type *) 0)
|
#define NULLTYPE ((struct type *) 0)
|
||||||
|
|
||||||
#define IsConformantArray(tpx) ((tpx)->tp_fund==T_ARRAY && (tpx)->next==0)
|
#define IsConformantArray(tpx) ((tpx)->tp_fund==T_ARRAY && (tpx)->tp_next==0)
|
||||||
#define bounded(tpx) ((tpx)->tp_fund & T_INDEX)
|
#define bounded(tpx) ((tpx)->tp_fund & T_INDEX)
|
||||||
#define complex(tpx) ((tpx)->tp_fund & (T_RECORD|T_ARRAY))
|
#define complex(tpx) ((tpx)->tp_fund & (T_RECORD|T_ARRAY))
|
||||||
#define WA(sz) (align(sz, (int) word_size))
|
#define WA(sz) (align(sz, (int) word_size))
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
#define ResultType(tpx) (assert((tpx)->tp_fund == T_PROCEDURE),\
|
#define ResultType(tpx) (assert((tpx)->tp_fund == T_PROCEDURE),\
|
||||||
(tpx)->next)
|
(tpx)->tp_next)
|
||||||
#define ParamList(tpx) (assert((tpx)->tp_fund == T_PROCEDURE),\
|
#define ParamList(tpx) (assert((tpx)->tp_fund == T_PROCEDURE),\
|
||||||
(tpx)->prc_params)
|
(tpx)->prc_params)
|
||||||
#define IndexType(tpx) (assert((tpx)->tp_fund == T_ARRAY),\
|
#define IndexType(tpx) (assert((tpx)->tp_fund == T_ARRAY),\
|
||||||
(tpx)->next)
|
(tpx)->tp_next)
|
||||||
#define ElementType(tpx) (assert((tpx)->tp_fund == T_SET),\
|
#define ElementType(tpx) (assert((tpx)->tp_fund == T_SET),\
|
||||||
(tpx)->next)
|
(tpx)->tp_next)
|
||||||
#define PointedtoType(tpx) (assert((tpx)->tp_fund == T_POINTER),\
|
#define PointedtoType(tpx) (assert((tpx)->tp_fund == T_POINTER),\
|
||||||
(tpx)->next)
|
(tpx)->tp_next)
|
||||||
#else DEBUG
|
#else DEBUG
|
||||||
#define ResultType(tpx) ((tpx)->next)
|
#define ResultType(tpx) ((tpx)->tp_next)
|
||||||
#define ParamList(tpx) ((tpx)->prc_params)
|
#define ParamList(tpx) ((tpx)->prc_params)
|
||||||
#define IndexType(tpx) ((tpx)->next)
|
#define IndexType(tpx) ((tpx)->tp_next)
|
||||||
#define ElementType(tpx) ((tpx)->next)
|
#define ElementType(tpx) ((tpx)->tp_next)
|
||||||
#define PointedtoType(tpx) ((tpx)->next)
|
#define PointedtoType(tpx) ((tpx)->tp_next)
|
||||||
#endif DEBUG
|
#endif DEBUG
|
||||||
#define BaseType(tpx) ((tpx)->tp_fund == T_SUBRANGE ? (tpx)->next : \
|
#define BaseType(tpx) ((tpx)->tp_fund == T_SUBRANGE ? (tpx)->tp_next : \
|
||||||
(tpx))
|
(tpx))
|
||||||
#define IsConstructed(tpx) ((tpx)->tp_fund & T_CONSTRUCTED)
|
#define IsConstructed(tpx) ((tpx)->tp_fund & T_CONSTRUCTED)
|
||||||
|
|
||||||
|
|
|
@ -91,15 +91,13 @@ construct_type(fund, tp)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_ARRAY:
|
case T_ARRAY:
|
||||||
dtp->tp_value.tp_arr =
|
dtp->tp_value.tp_arr = new_array();
|
||||||
(struct array *) Malloc(sizeof(struct array));
|
|
||||||
if (tp) dtp->tp_align = tp->tp_align;
|
if (tp) dtp->tp_align = tp->tp_align;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_SUBRANGE:
|
case T_SUBRANGE:
|
||||||
assert(tp != 0);
|
assert(tp != 0);
|
||||||
dtp->tp_value.tp_subrange =
|
dtp->tp_value.tp_subrange = new_subrange();
|
||||||
(struct subrange *) Malloc(sizeof(struct subrange));
|
|
||||||
dtp->tp_align = tp->tp_align;
|
dtp->tp_align = tp->tp_align;
|
||||||
dtp->tp_size = tp->tp_size;
|
dtp->tp_size = tp->tp_size;
|
||||||
break;
|
break;
|
||||||
|
@ -108,7 +106,7 @@ construct_type(fund, tp)
|
||||||
crash("funny type constructor");
|
crash("funny type constructor");
|
||||||
}
|
}
|
||||||
|
|
||||||
dtp->next = tp;
|
dtp->tp_next = tp;
|
||||||
return dtp;
|
return dtp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,8 +133,7 @@ standard_type(fund, align, size)
|
||||||
tp->tp_align = align;
|
tp->tp_align = align;
|
||||||
tp->tp_size = size;
|
tp->tp_size = size;
|
||||||
if (fund == T_ENUMERATION || fund == T_CHAR) {
|
if (fund == T_ENUMERATION || fund == T_CHAR) {
|
||||||
tp->tp_value.tp_enum =
|
tp->tp_value.tp_enum = new_enume();
|
||||||
(struct enume *) Malloc(sizeof(struct enume));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return tp;
|
return tp;
|
||||||
|
@ -293,26 +290,26 @@ chk_basesubrange(tp, base)
|
||||||
if (base->sub_lb > tp->sub_lb || base->sub_ub < tp->sub_ub) {
|
if (base->sub_lb > tp->sub_lb || base->sub_ub < tp->sub_ub) {
|
||||||
error("base type has insufficient range");
|
error("base type has insufficient range");
|
||||||
}
|
}
|
||||||
base = base->next;
|
base = base->tp_next;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (base->tp_fund & (T_ENUMERATION|T_CHAR)) {
|
if (base->tp_fund & (T_ENUMERATION|T_CHAR)) {
|
||||||
if (tp->next != base) {
|
if (tp->tp_next != base) {
|
||||||
error("specified base does not conform");
|
error("specified base does not conform");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (base != card_type && base != int_type) {
|
else if (base != card_type && base != int_type) {
|
||||||
error("illegal base for a subrange");
|
error("illegal base for a subrange");
|
||||||
}
|
}
|
||||||
else if (base == int_type && tp->next == card_type &&
|
else if (base == int_type && tp->tp_next == card_type &&
|
||||||
(tp->sub_ub > max_int || tp->sub_ub < 0)) {
|
(tp->sub_ub > max_int || tp->sub_ub < 0)) {
|
||||||
error("upperbound to large for type INTEGER");
|
error("upperbound to large for type INTEGER");
|
||||||
}
|
}
|
||||||
else if (base != tp->next && base != int_type) {
|
else if (base != tp->tp_next && base != int_type) {
|
||||||
error("specified base does not conform");
|
error("specified base does not conform");
|
||||||
}
|
}
|
||||||
|
|
||||||
tp->next = base;
|
tp->tp_next = base;
|
||||||
tp->tp_size = base->tp_size;
|
tp->tp_size = base->tp_size;
|
||||||
tp->tp_align = base->tp_align;
|
tp->tp_align = base->tp_align;
|
||||||
}
|
}
|
||||||
|
@ -533,7 +530,7 @@ FreeType(tp)
|
||||||
pr = ParamList(tp);
|
pr = ParamList(tp);
|
||||||
while (pr) {
|
while (pr) {
|
||||||
pr1 = pr;
|
pr1 = pr;
|
||||||
pr = pr->next;
|
pr = pr->par_next;
|
||||||
free_def(pr1->par_def);
|
free_def(pr1->par_def);
|
||||||
free_paramlist(pr1);
|
free_paramlist(pr1);
|
||||||
}
|
}
|
||||||
|
@ -559,10 +556,10 @@ DeclareType(nd, df, tp)
|
||||||
"opaque type \"%s\" is not a pointer type",
|
"opaque type \"%s\" is not a pointer type",
|
||||||
df->df_idf->id_text);
|
df->df_idf->id_text);
|
||||||
}
|
}
|
||||||
df->df_type->next = tp;
|
df->df_type->tp_next = tp;
|
||||||
df->df_type->tp_fund = T_EQUAL;
|
df->df_type->tp_fund = T_EQUAL;
|
||||||
while (tp != df->df_type && tp->tp_fund == T_EQUAL) {
|
while (tp != df->df_type && tp->tp_fund == T_EQUAL) {
|
||||||
tp = tp->next;
|
tp = tp->tp_next;
|
||||||
}
|
}
|
||||||
if (tp == df->df_type) {
|
if (tp == df->df_type) {
|
||||||
/* Circular definition! */
|
/* Circular definition! */
|
||||||
|
@ -579,7 +576,7 @@ RemoveEqual(tpx)
|
||||||
register struct type *tpx;
|
register struct type *tpx;
|
||||||
{
|
{
|
||||||
|
|
||||||
if (tpx) while (tpx->tp_fund == T_EQUAL) tpx = tpx->next;
|
if (tpx) while (tpx->tp_fund == T_EQUAL) tpx = tpx->tp_next;
|
||||||
return tpx;
|
return tpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -631,7 +628,7 @@ type_or_forward(ptp)
|
||||||
define(nd->nd_IDF, CurrentScope, D_FORWTYPE);
|
define(nd->nd_IDF, CurrentScope, D_FORWTYPE);
|
||||||
|
|
||||||
if (df->df_kind == D_TYPE) {
|
if (df->df_kind == D_TYPE) {
|
||||||
(*ptp)->next = df->df_type;
|
(*ptp)->tp_next = df->df_type;
|
||||||
free_node(nd);
|
free_node(nd);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -716,7 +713,7 @@ DumpType(tp)
|
||||||
while(par) {
|
while(par) {
|
||||||
if (IsVarParam(par)) print("VAR ");
|
if (IsVarParam(par)) print("VAR ");
|
||||||
DumpType(TypeOfParam(par));
|
DumpType(TypeOfParam(par));
|
||||||
par = par->next;
|
par = par->par_next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -726,7 +723,7 @@ DumpType(tp)
|
||||||
print("; element:");
|
print("; element:");
|
||||||
DumpType(tp->arr_elem);
|
DumpType(tp->arr_elem);
|
||||||
print("; index:");
|
print("; index:");
|
||||||
DumpType(tp->next);
|
DumpType(tp->tp_next);
|
||||||
print(";");
|
print(";");
|
||||||
return;
|
return;
|
||||||
case T_STRING:
|
case T_STRING:
|
||||||
|
@ -736,11 +733,11 @@ DumpType(tp)
|
||||||
default:
|
default:
|
||||||
crash("DumpType");
|
crash("DumpType");
|
||||||
}
|
}
|
||||||
if (tp->next && tp->tp_fund != T_POINTER) {
|
if (tp->tp_next && tp->tp_fund != T_POINTER) {
|
||||||
/* Avoid printing recursive types!
|
/* Avoid printing recursive types!
|
||||||
*/
|
*/
|
||||||
print(" next:(");
|
print(" next:(");
|
||||||
DumpType(tp->next);
|
DumpType(tp->tp_next);
|
||||||
print(")");
|
print(")");
|
||||||
}
|
}
|
||||||
print(";");
|
print(";");
|
||||||
|
|
|
@ -83,8 +83,8 @@ TstProcEquiv(tp1, tp2)
|
||||||
while (p1 && p2) {
|
while (p1 && p2) {
|
||||||
if (IsVarParam(p1) != IsVarParam(p2) ||
|
if (IsVarParam(p1) != IsVarParam(p2) ||
|
||||||
!TstParEquiv(TypeOfParam(p1), TypeOfParam(p2))) return 0;
|
!TstParEquiv(TypeOfParam(p1), TypeOfParam(p2))) return 0;
|
||||||
p1 = p1->next;
|
p1 = p1->par_next;
|
||||||
p2 = p2->next;
|
p2 = p2->par_next;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Here, at least one of the parameterlists is exhausted.
|
/* Here, at least one of the parameterlists is exhausted.
|
||||||
|
|
|
@ -136,7 +136,7 @@ WalkModule(module)
|
||||||
C_ine_dlb(data_label, (arith) 0);
|
C_ine_dlb(data_label, (arith) 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (; nd; nd = nd->next) {
|
for (; nd; nd = nd->nd_left) {
|
||||||
C_cal(nd->nd_IDF->id_text);
|
C_cal(nd->nd_IDF->id_text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -213,7 +213,7 @@ WalkProcedure(procedure)
|
||||||
*/
|
*/
|
||||||
for (param = ParamList(procedure->df_type);
|
for (param = ParamList(procedure->df_type);
|
||||||
param;
|
param;
|
||||||
param = param->next) {
|
param = param->par_next) {
|
||||||
if (! IsVarParam(param)) {
|
if (! IsVarParam(param)) {
|
||||||
register struct type *TpParam = TypeOfParam(param);
|
register struct type *TpParam = TypeOfParam(param);
|
||||||
|
|
||||||
|
@ -544,10 +544,10 @@ WalkStat(nd, exit_label)
|
||||||
/* the record is indirectly available */
|
/* the record is indirectly available */
|
||||||
wds.w_desig = ds;
|
wds.w_desig = ds;
|
||||||
link.sc_scope = wds.w_scope;
|
link.sc_scope = wds.w_scope;
|
||||||
link.next = CurrVis;
|
link.sc_next = CurrVis;
|
||||||
CurrVis = &link;
|
CurrVis = &link;
|
||||||
WalkNode(right, exit_label);
|
WalkNode(right, exit_label);
|
||||||
CurrVis = link.next;
|
CurrVis = link.sc_next;
|
||||||
WithDesigs = wds.w_next;
|
WithDesigs = wds.w_next;
|
||||||
FreePtr(ds.dsg_offset);
|
FreePtr(ds.dsg_offset);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Reference in a new issue