From: ceriel Date: Tue, 5 Jul 1988 19:06:40 +0000 (+0000) Subject: made to fit on PDP-11 ... X-Git-Tag: release-5-5~3092 X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=afc4d5211bbc7a8f7f7c11d154a81cbdd5fe81ba;p=ack.git made to fit on PDP-11 ... --- diff --git a/lang/m2/comp/SmallPars b/lang/m2/comp/SmallPars index 62c23b0d4..f879fe651 100644 --- a/lang/m2/comp/SmallPars +++ b/lang/m2/comp/SmallPars @@ -71,7 +71,7 @@ !File: nostrict.h -#undef NOSTRICT 1 /* define when STRICT warnings disabled +#define NOSTRICT 1 /* define when STRICT warnings disabled (yet another squeezing method) */ diff --git a/lang/m2/comp/chk_expr.c b/lang/m2/comp/chk_expr.c index bb540544b..a5c891659 100644 --- a/lang/m2/comp/chk_expr.c +++ b/lang/m2/comp/chk_expr.c @@ -178,7 +178,7 @@ ChkArr(expp, flags) register t_type *tpl; assert(expp->nd_class == Arrsel); - assert(expp->nd_symb == '['); + assert(expp->nd_symb == '[' || expp->nd_symb == ','); expp->nd_type = error_type; diff --git a/lang/m2/comp/desig.c b/lang/m2/comp/desig.c index 7fb14bdb5..78748ed18 100644 --- a/lang/m2/comp/desig.c +++ b/lang/m2/comp/desig.c @@ -642,7 +642,7 @@ CodeDesig(nd, ds) break; case Arrsel: - assert(nd->nd_symb == '['); + assert(nd->nd_symb == '[' || nd->nd_symb == ','); CodeDesig(nd->nd_left, ds); CodeAddress(ds); diff --git a/lang/m2/comp/enter.c b/lang/m2/comp/enter.c index 506c7a124..cca0e24ac 100644 --- a/lang/m2/comp/enter.c +++ b/lang/m2/comp/enter.c @@ -236,7 +236,7 @@ EnterParamList(ppr, Idlist, type, VARp, off) STATIC t_def *DoImport(); ImportEffects(idef, scope, flag) - t_def *idef; + register t_def *idef; t_scope *scope; { /* Handle side effects of an import: @@ -256,6 +256,7 @@ ImportEffects(idef, scope, flag) /* Also import all enumeration literals */ for (df = tp->enm_enums; df; df = df->enm_next) { + df->df_flags |= D_QEXPORTED; if (! DoImport(df, scope, flag|D_USED)) assert(0); /* don't complain when not used ... */ } @@ -292,7 +293,7 @@ DoImport(df, scope, flag) { /* Definition "df" is imported to scope "scope". */ - t_def *idef = define(df->df_idf, scope, D_IMPORT); + register t_def *idef = define(df->df_idf, scope, D_IMPORT); idef->imp_def = df; idef->df_flags |= flag; @@ -310,7 +311,7 @@ ForwModule(df, nd) We could also end up here for not found DEFINITION MODULES. Create a declaration and a scope for this module. */ - t_scopelist *vis; + register t_scopelist *vis; if (df->df_scope != GlobalScope) { df->df_scope = enclosing(CurrVis)->sc_scope; @@ -456,7 +457,7 @@ EnterFromImportList(idlist, FromDef, FromId) { /* Import the list Idlist from the module indicated by Fromdef. */ - register t_scope *sc; + t_scope *sc; register t_def *df; char *module_name = FromDef->df_idf->id_text; diff --git a/lang/m2/comp/expression.g b/lang/m2/comp/expression.g index 8730e8af3..02f7f1b2d 100644 --- a/lang/m2/comp/expression.g +++ b/lang/m2/comp/expression.g @@ -51,7 +51,7 @@ qualident(t_node **p;) ]* ; -selector(t_node **pnd;): +selector(register t_node **pnd;): '.' { *pnd = dot2node(Link,*pnd,NULLNODE); } IDENT { (*pnd)->nd_IDF = dot.TOK_IDF; } ; @@ -94,7 +94,7 @@ ConstExpression(t_node **pnd;) } ; -expression(t_node **pnd;) +expression(register t_node **pnd;) { } : SimpleExpression(pnd) @@ -113,7 +113,7 @@ relation: ; */ -SimpleExpression(t_node **pnd;) +SimpleExpression(register t_node **pnd;) { register t_node *nd = 0; } : @@ -168,7 +168,8 @@ MulOperator: factor(register t_node **p;) { - t_node *nd; + register t_node *nd; + t_node *nd1; } : qualident(p) [ @@ -179,8 +180,8 @@ factor(register t_node **p;) | ] | - bare_set(&nd) - { nd->nd_left = *p; *p = nd; } + bare_set(&nd1) + { nd = nd1; nd->nd_left = *p; *p = nd; } ] | bare_set(p) @@ -241,18 +242,15 @@ ActualParameters(t_node **pnd;): '(' ExpList(pnd)? ')' ; -element(register t_node *nd;) -{ - t_node *nd1; -} : - expression(&nd1) +element(register t_node *nd;) : + expression(&(nd->nd_right)) [ UPTO - { nd1 = dot2node(Link, nd1, NULLNODE);} - expression(&(nd1->nd_right)) + { nd->nd_right = dot2node(Link, nd->nd_right, NULLNODE);} + expression(&(nd->nd_right->nd_right)) | ] - { nd->nd_right = dot2node(Link, nd1, NULLNODE); + { nd->nd_right = dot2node(Link, nd, NULLNODE); nd->nd_right->nd_symb = ','; } ; @@ -263,7 +261,7 @@ designator(t_node **pnd;) designator_tail(pnd) ; -designator_tail(t_node **pnd;): +designator_tail(register t_node **pnd;): visible_designator_tail(pnd) [ %persistent %default @@ -278,19 +276,16 @@ visible_designator_tail(t_node **pnd;) { register t_node *nd = *pnd; }: -[ '[' { nd = dot2node(Arrsel, nd, NULLNODE); } expression(&(nd->nd_right)) [ ',' { nd = dot2node(Arrsel, nd, NULLNODE); - nd->nd_symb = '['; } expression(&(nd->nd_right)) ]* ']' -| - '^' { nd = dot2node(Arrow, NULLNODE, nd); } -] { *pnd = nd; } +| + '^' { *pnd = dot2node(Arrow, NULLNODE, nd); } ; diff --git a/lang/m2/comp/main.c b/lang/m2/comp/main.c index 2a4014cde..a26733e98 100644 --- a/lang/m2/comp/main.c +++ b/lang/m2/comp/main.c @@ -38,8 +38,8 @@ char options[128]; int DefinitionModule; char *ProgName; char **DEFPATH; -int nDEF, mDEF; -int pass_1; +int nDEF = 1, mDEF = 10; +int pass_1 = 1; t_def *Defined; extern int err_occurred; extern int fp_used; /* set if floating point used */ @@ -53,10 +53,7 @@ main(argc, argv) register char **Nargv = &argv[0]; ProgName = *argv++; - warning_classes = W_INITIAL; - DEFPATH = (char **) Malloc(10 * sizeof(char *)); - mDEF = 10; - nDEF = 1; + DEFPATH = (char **) Malloc(mDEF * sizeof(char *)); while (--argc > 0) { if (**argv == '-') @@ -105,7 +102,6 @@ Compile(src, dst) C_magic(); C_ms_emx(word_size, pointer_size); CheckForLineDirective(); - pass_1 = 1; CompUnit(); C_ms_src((int)LineNumber - 1, FileName); if (!err_occurred) { @@ -225,9 +221,7 @@ AddStandards() df = Enter("TRUE", D_ENUM, bool_type, 0); df->enm_val = 1; df->enm_next = Enter("FALSE", D_ENUM, bool_type, 0); - df = df->enm_next; - df->enm_val = 0; - df->enm_next = 0; + assert(df->enm_next->enm_val == 0 && df->enm_next->enm_next == 0); } do_SYSTEM() diff --git a/lang/m2/comp/options.c b/lang/m2/comp/options.c index 685ce9043..eb7dc0838 100644 --- a/lang/m2/comp/options.c +++ b/lang/m2/comp/options.c @@ -33,7 +33,7 @@ recognize some keywords! extern int idfsize; static int ndirs = 1; -int warning_classes; +int warning_classes = W_INITIAL; DoOption(text) register char *text;