#include "density.h"
struct switch_hdr {
- struct switch_hdr *next; /* in the free list */
label sh_break; /* label of statement after this one */
label sh_default; /* label of ELSE part, or 0 */
int sh_nrofentries; /* number of cases */
AddOneCase(sh, node, lbl)
register struct switch_hdr *sh;
- register struct node *node;
+ struct node *node;
label lbl;
{
register struct case_entry *ce = new_case_entry();
/* 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))) {
return 0;
}
assert(param != 0 && arg != 0);
- if (param->next) {
- CodeParameters(param->next, arg->nd_right);
+ if (param->par_next) {
+ CodeParameters(param->par_next, arg->nd_right);
}
tp = TypeOfParam(param);
IDENT { *p = q = MkLeaf(Value, &dot); }
[ %persistent
',' IDENT
- { q->next = MkLeaf(Value, &dot);
- q = q->next;
+ { q->nd_left = MkLeaf(Value, &dot);
+ q = q->nd_left;
}
]*
- { q->next = 0; }
+ { q->nd_left = 0; }
;
SubrangeType(struct type **ptp;)
PointerType(register struct type **ptp;) :
POINTER TO
[ %if (type_or_forward(ptp))
- type(&((*ptp)->next))
+ type(&((*ptp)->tp_next))
|
IDENT
]
};
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;
/* link all definitions in a scope */
struct idf *df_idf; /* link back to the name */
df->df_idf = id;
df->df_scope = scope;
df->df_kind = kind;
- df->next = id->id_def;
+ df->df_next = id->id_def;
id->id_def = df;
/* enter the definition in the list of definitions in this scope
register struct idf *id = df->df_idf;
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 {
- while (df1->next != df) {
- assert(df1->next != 0);
- df1 = df1->next;
+ while (df1->df_next != df) {
+ assert(df1->df_next != 0);
+ df1 = df1->df_next;
}
- df1->next = df->next;
+ df1->df_next = df->df_next;
}
}
n = MkLeaf(Name, &dot);
n->nd_IDF = id;
n->nd_symb = IDENT;
- if (nd_end) nd_end->next = n;
+ if (nd_end) nd_end->nd_left = n;
else Modules = n;
nd_end = n;
}
/* Generate code to load the value of the designator described
in "ds"
*/
+ arith sz;
switch(ds->dsg_kind) {
case DSG_LOADED:
/* Fall through */
case DSG_PLOADED:
case DSG_PFIXED:
+ sz = WA(tp->tp_size);
if (properly(ds, tp->tp_size, tp->tp_align)) {
CodeAddress(ds);
C_loi(tp->tp_size);
break;
}
if (ds->dsg_kind == DSG_PLOADED) {
- arith sz = WA(tp->tp_size) - pointer_size;
+ sz -= pointer_size;
C_asp(-sz);
C_lor((arith) 1);
C_loi(pointer_size);
}
else {
- C_asp(-WA(tp->tp_size));
- CodeAddress(ds);
+ C_asp(-sz);
}
+ CodeAddress(ds);
C_loc(tp->tp_size);
C_cal("_load");
C_asp(2 * word_size);
register struct node *idlist = Idlist;
type->enm_ncst = 0;
- for (; idlist; idlist = idlist->next) {
+ for (; idlist; idlist = idlist->nd_left) {
df = define(idlist->nd_IDF, CurrentScope, D_ENUM);
df->df_type = type;
df->enm_val = (type->enm_ncst)++;
register struct def *df;
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->df_type = type;
df->df_flags |= D_QEXPORTED;
/* Can only happen when a procedure type is defined */
dummy = Idlist = idlist = MkLeaf(Name, &dot);
}
- for ( ; idlist; idlist = idlist->next) {
+ for ( ; idlist; idlist = idlist->nd_left) {
pr = new_paramlist();
- pr->next = 0;
+ pr->par_next = 0;
if (!*ppr) *ppr = pr;
- else last->next = pr;
+ else last->par_next = pr;
last = pr;
if (!DefinitionModule && idlist != dummy) {
df = define(idlist->nd_IDF, CurrentScope, D_VARIABLE);
register struct node *idlist = Idlist;
register struct def *df, *df1;
- for (;idlist; idlist = idlist->next) {
+ for (;idlist; idlist = idlist->nd_left) {
df = lookup(idlist->nd_IDF, CurrentScope, 0);
if (!df) {
df1->imp_def == CurrentScope->sc_definedby) {
DoImport(df, df1->df_scope);
}
- df1 = df1->next;
+ df1 = df1->df_next;
}
/* Also handle the definition as if the enclosing
return;
}
- for (; idlist; idlist = idlist->next) {
+ for (; idlist; idlist = idlist->nd_left) {
if (forwflag) df = ForwDef(idlist, vis->sc_scope);
else if (! (df = lookup(idlist->nd_IDF, vis->sc_scope, 1))) {
if (! is_anon_idf(idlist->nd_IDF)) {
struct scope *sc = enclosing(CurrVis)->sc_scope;
extern struct def *GetDefinitionModule();
- for (; idlist; idlist = idlist->next) {
+ for (; idlist; idlist = idlist->nd_left) {
DoImport(local ?
ForwDef(idlist, sc) :
GetDefinitionModule(idlist->nd_IDF, 1) ,
*/
for (df = id->id_def, df1 = 0;
df && df->df_scope != scope;
- df1 = df, df = df->next) { /* nothing */ }
+ df1 = df, df = df->df_next) { /* nothing */ }
if (df) {
/* Found it
if (df1) {
/* Put the definition in front
*/
- df1->next = df->next;
- df->next = id->id_def;
+ df1->df_next = df->df_next;
+ df->df_next = id->id_def;
id->id_def = df;
}
if (import && df->df_kind == D_IMPORT) {
/* $Header$ */
struct node {
- struct node *next;
-#define nd_left next
+ struct node *nd_left;
struct node *nd_right;
int nd_class; /* kind of node */
#define Value 0 /* constant */
ls->sc_scope = sc;
ls->sc_encl = CurrVis;
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;
}
sc->sc_def = 0;
sc->sc_level = proclevel;
PervasiveScope = sc;
- ls->next = 0;
+ ls->sc_next = 0;
ls->sc_encl = 0;
ls->sc_scope = PervasiveScope;
PervVis = ls;
node_error(nd, "\"%s\" is not a type", df1->df_idf->id_text);
}
while (nd) {
- nd->nd_type->next = df->df_type;
+ nd->nd_type->tp_next = df->df_type;
nd = nd->nd_right;
}
FreeNode(df1->df_forw_node);
df->df_kind = D_TYPE;
while (nd) {
- nd->nd_type->next = df->df_type;
+ nd->nd_type->tp_next = df->df_type;
nd = nd->nd_right;
}
FreeNode(df->df_forw_node);
struct def *df1 = df->df_nextinscope;
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;
ls->sc_scope->sc_def = df;
*/
struct scope {
- struct scope *next;
+ /* struct scope *next; */
char *sc_name; /* name of this scope */
struct def *sc_def; /* list of definitions in this scope */
arith sc_off; /* offsets of variables in this scope */
};
struct scopelist {
- struct scopelist *next;
+ struct scopelist *sc_next;
struct scope *sc_scope;
struct scopelist *sc_encl;
};
#define GlobalScope (GlobalVis->sc_scope)
#define enclosing(x) ((x)->sc_encl)
#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();
/* $Header$ */
struct paramlist { /* structure for parameterlist of a PROCEDURE */
- struct paramlist *next;
+ struct paramlist *par_next;
struct def *par_def; /* "df" of parameter */
#define IsVarParam(xpar) ((int) ((xpar)->par_def->df_flags & D_VARPAR))
#define TypeOfParam(xpar) ((xpar)->par_def->df_type)
#define enm_rck tp_value.tp_enum->en_rck
};
+/* ALLOCDEF "enume" 5 */
+
struct subrange {
arith su_lb, su_ub; /* lower bound and upper bound */
label su_rck; /* label of range check descriptor */
#define sub_rck tp_value.tp_subrange->su_rck
};
+/* ALLOCDEF "subrange" 5 */
+
struct array {
struct type *ar_elem; /* type of elements */
label ar_descr; /* label of array descriptor */
#define arr_elsize tp_value.tp_arr->ar_elsize
};
+/* ALLOCDEF "array" 5 */
+
struct record {
struct scope *rc_scope; /* scope of this record */
/* members are in the symbol table */
};
struct type {
- struct type *next; /* used with ARRAY, PROCEDURE, POINTER, SET,
+ struct type *tp_next; /* used with ARRAY, PROCEDURE, POINTER, SET,
SUBRANGE, EQUAL
*/
int tp_fund; /* fundamental type or constructor */
#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 complex(tpx) ((tpx)->tp_fund & (T_RECORD|T_ARRAY))
#define WA(sz) (align(sz, (int) word_size))
#ifdef DEBUG
#define ResultType(tpx) (assert((tpx)->tp_fund == T_PROCEDURE),\
- (tpx)->next)
+ (tpx)->tp_next)
#define ParamList(tpx) (assert((tpx)->tp_fund == T_PROCEDURE),\
(tpx)->prc_params)
#define IndexType(tpx) (assert((tpx)->tp_fund == T_ARRAY),\
- (tpx)->next)
+ (tpx)->tp_next)
#define ElementType(tpx) (assert((tpx)->tp_fund == T_SET),\
- (tpx)->next)
+ (tpx)->tp_next)
#define PointedtoType(tpx) (assert((tpx)->tp_fund == T_POINTER),\
- (tpx)->next)
+ (tpx)->tp_next)
#else DEBUG
-#define ResultType(tpx) ((tpx)->next)
+#define ResultType(tpx) ((tpx)->tp_next)
#define ParamList(tpx) ((tpx)->prc_params)
-#define IndexType(tpx) ((tpx)->next)
-#define ElementType(tpx) ((tpx)->next)
-#define PointedtoType(tpx) ((tpx)->next)
+#define IndexType(tpx) ((tpx)->tp_next)
+#define ElementType(tpx) ((tpx)->tp_next)
+#define PointedtoType(tpx) ((tpx)->tp_next)
#endif DEBUG
-#define BaseType(tpx) ((tpx)->tp_fund == T_SUBRANGE ? (tpx)->next : \
+#define BaseType(tpx) ((tpx)->tp_fund == T_SUBRANGE ? (tpx)->tp_next : \
(tpx))
#define IsConstructed(tpx) ((tpx)->tp_fund & T_CONSTRUCTED)
break;
case T_ARRAY:
- dtp->tp_value.tp_arr =
- (struct array *) Malloc(sizeof(struct array));
+ dtp->tp_value.tp_arr = new_array();
if (tp) dtp->tp_align = tp->tp_align;
break;
case T_SUBRANGE:
assert(tp != 0);
- dtp->tp_value.tp_subrange =
- (struct subrange *) Malloc(sizeof(struct subrange));
+ dtp->tp_value.tp_subrange = new_subrange();
dtp->tp_align = tp->tp_align;
dtp->tp_size = tp->tp_size;
break;
crash("funny type constructor");
}
- dtp->next = tp;
+ dtp->tp_next = tp;
return dtp;
}
tp->tp_align = align;
tp->tp_size = size;
if (fund == T_ENUMERATION || fund == T_CHAR) {
- tp->tp_value.tp_enum =
- (struct enume *) Malloc(sizeof(struct enume));
+ tp->tp_value.tp_enum = new_enume();
}
return tp;
if (base->sub_lb > tp->sub_lb || base->sub_ub < tp->sub_ub) {
error("base type has insufficient range");
}
- base = base->next;
+ base = base->tp_next;
}
if (base->tp_fund & (T_ENUMERATION|T_CHAR)) {
- if (tp->next != base) {
+ if (tp->tp_next != base) {
error("specified base does not conform");
}
}
else if (base != card_type && base != int_type) {
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)) {
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");
}
- tp->next = base;
+ tp->tp_next = base;
tp->tp_size = base->tp_size;
tp->tp_align = base->tp_align;
}
pr = ParamList(tp);
while (pr) {
pr1 = pr;
- pr = pr->next;
+ pr = pr->par_next;
free_def(pr1->par_def);
free_paramlist(pr1);
}
"opaque type \"%s\" is not a pointer type",
df->df_idf->id_text);
}
- df->df_type->next = tp;
+ df->df_type->tp_next = tp;
df->df_type->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) {
/* Circular definition! */
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;
}
define(nd->nd_IDF, CurrentScope, D_FORWTYPE);
if (df->df_kind == D_TYPE) {
- (*ptp)->next = df->df_type;
+ (*ptp)->tp_next = df->df_type;
free_node(nd);
}
else {
while(par) {
if (IsVarParam(par)) print("VAR ");
DumpType(TypeOfParam(par));
- par = par->next;
+ par = par->par_next;
}
}
break;
print("; element:");
DumpType(tp->arr_elem);
print("; index:");
- DumpType(tp->next);
+ DumpType(tp->tp_next);
print(";");
return;
case T_STRING:
default:
crash("DumpType");
}
- if (tp->next && tp->tp_fund != T_POINTER) {
+ if (tp->tp_next && tp->tp_fund != T_POINTER) {
/* Avoid printing recursive types!
*/
print(" next:(");
- DumpType(tp->next);
+ DumpType(tp->tp_next);
print(")");
}
print(";");
while (p1 && p2) {
if (IsVarParam(p1) != IsVarParam(p2) ||
!TstParEquiv(TypeOfParam(p1), TypeOfParam(p2))) return 0;
- p1 = p1->next;
- p2 = p2->next;
+ p1 = p1->par_next;
+ p2 = p2->par_next;
}
/* Here, at least one of the parameterlists is exhausted.
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);
}
}
*/
for (param = ParamList(procedure->df_type);
param;
- param = param->next) {
+ param = param->par_next) {
if (! IsVarParam(param)) {
register struct type *TpParam = TypeOfParam(param);
/* the record is indirectly available */
wds.w_desig = ds;
link.sc_scope = wds.w_scope;
- link.next = CurrVis;
+ link.sc_next = CurrVis;
CurrVis = &link;
WalkNode(right, exit_label);
- CurrVis = link.next;
+ CurrVis = link.sc_next;
WithDesigs = wds.w_next;
FreePtr(ds.dsg_offset);
break;