From: ceriel Date: Thu, 16 Jul 1987 19:51:40 +0000 (+0000) Subject: bug fixes, name changes X-Git-Tag: release-5-5~4003 X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=e04230a1260c79aea4eaa8d3e9e3fc7a4a7d923f;p=ack.git bug fixes, name changes --- diff --git a/lang/m2/comp/casestat.C b/lang/m2/comp/casestat.C index 37583965b..4d49b75b4 100644 --- a/lang/m2/comp/casestat.C +++ b/lang/m2/comp/casestat.C @@ -34,7 +34,6 @@ #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 */ @@ -245,7 +244,7 @@ AddCases(sh, node, lbl) 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(); diff --git a/lang/m2/comp/chk_expr.c b/lang/m2/comp/chk_expr.c index 2e6349a4f..31818f391 100644 --- a/lang/m2/comp/chk_expr.c +++ b/lang/m2/comp/chk_expr.c @@ -537,7 +537,7 @@ ChkProcCall(expp) /* 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; } diff --git a/lang/m2/comp/code.c b/lang/m2/comp/code.c index 59d2012bd..a2ca1bb98 100644 --- a/lang/m2/comp/code.c +++ b/lang/m2/comp/code.c @@ -348,8 +348,8 @@ CodeParameters(param, arg) 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); diff --git a/lang/m2/comp/declar.g b/lang/m2/comp/declar.g index ef3e75fc6..51c5b2e68 100644 --- a/lang/m2/comp/declar.g +++ b/lang/m2/comp/declar.g @@ -218,11 +218,11 @@ IdentList(struct node **p;) 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;) @@ -416,7 +416,7 @@ SetType(struct type **ptp;) : PointerType(register struct type **ptp;) : POINTER TO [ %if (type_or_forward(ptp)) - type(&((*ptp)->next)) + type(&((*ptp)->tp_next)) | IDENT ] diff --git a/lang/m2/comp/def.H b/lang/m2/comp/def.H index b51188402..44df7b87b 100644 --- a/lang/m2/comp/def.H +++ b/lang/m2/comp/def.H @@ -76,7 +76,7 @@ struct forwtype { }; 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 */ diff --git a/lang/m2/comp/def.c b/lang/m2/comp/def.c index 0f15dfdb1..5151b448d 100644 --- a/lang/m2/comp/def.c +++ b/lang/m2/comp/def.c @@ -74,7 +74,7 @@ MkDef(id, scope, kind) 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 @@ -211,13 +211,13 @@ RemoveFromIdList(df) 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; } } diff --git a/lang/m2/comp/defmodule.c b/lang/m2/comp/defmodule.c index 83621456c..bff2bb090 100644 --- a/lang/m2/comp/defmodule.c +++ b/lang/m2/comp/defmodule.c @@ -131,7 +131,7 @@ GetDefinitionModule(id, incr) 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; } diff --git a/lang/m2/comp/desig.c b/lang/m2/comp/desig.c index 8d845cd3c..cb2ee3333 100644 --- a/lang/m2/comp/desig.c +++ b/lang/m2/comp/desig.c @@ -107,6 +107,7 @@ CodeValue(ds, tp) /* Generate code to load the value of the designator described in "ds" */ + arith sz; switch(ds->dsg_kind) { case DSG_LOADED: @@ -117,13 +118,14 @@ CodeValue(ds, tp) /* 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); @@ -131,9 +133,9 @@ CodeValue(ds, tp) 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); diff --git a/lang/m2/comp/enter.c b/lang/m2/comp/enter.c index c6c4b22c3..d8d7f4693 100644 --- a/lang/m2/comp/enter.c +++ b/lang/m2/comp/enter.c @@ -69,7 +69,7 @@ EnterEnumList(Idlist, type) 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)++; @@ -93,7 +93,7 @@ EnterFieldList(Idlist, type, scope, addr) 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; @@ -198,11 +198,11 @@ EnterParamList(ppr, Idlist, type, VARp, off) /* 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); @@ -322,7 +322,7 @@ EnterExportList(Idlist, qualified) 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) { @@ -354,7 +354,7 @@ EnterExportList(Idlist, qualified) 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 @@ -427,7 +427,7 @@ node_error(FromId,"identifier \"%s\" does not represent a module",module_name); 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)) { @@ -464,7 +464,7 @@ EnterImportList(Idlist, local) 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) , diff --git a/lang/m2/comp/lookup.c b/lang/m2/comp/lookup.c index 8966441f9..31b7e0a45 100644 --- a/lang/m2/comp/lookup.c +++ b/lang/m2/comp/lookup.c @@ -40,7 +40,7 @@ lookup(id, scope, import) */ 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 @@ -48,8 +48,8 @@ lookup(id, scope, import) 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) { diff --git a/lang/m2/comp/node.H b/lang/m2/comp/node.H index 0a6f37667..70929c1d9 100644 --- a/lang/m2/comp/node.H +++ b/lang/m2/comp/node.H @@ -10,8 +10,7 @@ /* $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 */ diff --git a/lang/m2/comp/scope.C b/lang/m2/comp/scope.C index 38d6dc1a9..b4978dec2 100644 --- a/lang/m2/comp/scope.C +++ b/lang/m2/comp/scope.C @@ -47,9 +47,9 @@ open_scope(scopetype) 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; } @@ -73,7 +73,7 @@ InitScope() 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; @@ -126,7 +126,7 @@ chk_forw(pdf) 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); @@ -138,7 +138,7 @@ node_error(nd, "\"%s\" is not a type", df1->df_idf->id_text); 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); @@ -166,7 +166,7 @@ df->df_idf->id_text); 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; diff --git a/lang/m2/comp/scope.h b/lang/m2/comp/scope.h index e1491cbd3..1ccda9374 100644 --- a/lang/m2/comp/scope.h +++ b/lang/m2/comp/scope.h @@ -23,7 +23,7 @@ */ 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 */ @@ -33,7 +33,7 @@ struct scope { }; struct scopelist { - struct scopelist *next; + struct scopelist *sc_next; struct scope *sc_scope; struct scopelist *sc_encl; }; @@ -48,6 +48,6 @@ extern struct scopelist #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(); diff --git a/lang/m2/comp/type.H b/lang/m2/comp/type.H index bf55b40e3..767d7fab3 100644 --- a/lang/m2/comp/type.H +++ b/lang/m2/comp/type.H @@ -10,7 +10,7 @@ /* $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) @@ -27,6 +27,8 @@ struct enume { #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 */ @@ -35,6 +37,8 @@ struct subrange { #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 */ @@ -44,6 +48,8 @@ struct array { #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 */ @@ -58,7 +64,7 @@ struct proc { }; 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 */ @@ -146,29 +152,29 @@ struct type #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) diff --git a/lang/m2/comp/type.c b/lang/m2/comp/type.c index b4dd3ecd3..69b92fc4f 100644 --- a/lang/m2/comp/type.c +++ b/lang/m2/comp/type.c @@ -91,15 +91,13 @@ construct_type(fund, tp) 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; @@ -108,7 +106,7 @@ construct_type(fund, tp) crash("funny type constructor"); } - dtp->next = tp; + dtp->tp_next = tp; return dtp; } @@ -135,8 +133,7 @@ standard_type(fund, align, size) 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; @@ -293,26 +290,26 @@ chk_basesubrange(tp, base) 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; } @@ -533,7 +530,7 @@ FreeType(tp) pr = ParamList(tp); while (pr) { pr1 = pr; - pr = pr->next; + pr = pr->par_next; free_def(pr1->par_def); free_paramlist(pr1); } @@ -559,10 +556,10 @@ DeclareType(nd, df, tp) "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! */ @@ -579,7 +576,7 @@ RemoveEqual(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; } @@ -631,7 +628,7 @@ type_or_forward(ptp) 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 { @@ -716,7 +713,7 @@ DumpType(tp) while(par) { if (IsVarParam(par)) print("VAR "); DumpType(TypeOfParam(par)); - par = par->next; + par = par->par_next; } } break; @@ -726,7 +723,7 @@ DumpType(tp) print("; element:"); DumpType(tp->arr_elem); print("; index:"); - DumpType(tp->next); + DumpType(tp->tp_next); print(";"); return; case T_STRING: @@ -736,11 +733,11 @@ DumpType(tp) 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(";"); diff --git a/lang/m2/comp/typequiv.c b/lang/m2/comp/typequiv.c index 0452b1fc8..4976ee894 100644 --- a/lang/m2/comp/typequiv.c +++ b/lang/m2/comp/typequiv.c @@ -83,8 +83,8 @@ TstProcEquiv(tp1, tp2) 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. diff --git a/lang/m2/comp/walk.c b/lang/m2/comp/walk.c index de08abab2..edf1846c5 100644 --- a/lang/m2/comp/walk.c +++ b/lang/m2/comp/walk.c @@ -136,7 +136,7 @@ WalkModule(module) 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); } } @@ -213,7 +213,7 @@ WalkProcedure(procedure) */ for (param = ParamList(procedure->df_type); param; - param = param->next) { + param = param->par_next) { if (! IsVarParam(param)) { register struct type *TpParam = TypeOfParam(param); @@ -544,10 +544,10 @@ WalkStat(nd, exit_label) /* 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;