Change c1 nomenclature, struct tname|xtname|tconst|lconst|ftconst, to simpler and...
authorNick Downing <downing.nick@gmail.com>
Sat, 11 Feb 2017 02:15:43 +0000 (13:15 +1100)
committerNick Downing <downing.nick@gmail.com>
Sat, 11 Feb 2017 02:15:43 +0000 (13:15 +1100)
c00.c
c01.c
c1.h
c10.c
c11.c
c12.c
ccom.h

diff --git a/c00.c b/c00.c
index 8f4e0f0..6e8a66e 100644 (file)
--- a/c00.c
+++ b/c00.c
@@ -634,7 +634,7 @@ union tree *tree(/*eflag*/) /*int eflag;*/ {
        register struct nmlist *cs;
        int p, ps, os, xo = 0, *xop;
        /*char *svtree;*/
-       static struct tconst garbage = { CON, INT, (int *)NULL, (union str *)NULL, 0 };
+       static struct cnode garbage = { CON, INT, (int *)NULL, (union str *)NULL, 0 };
 
        /*svtree = starttree();*/
        op = opst;
@@ -669,7 +669,7 @@ advanc:
 
        case FCON:
  /*            *cp++ = fblock(DOUBLE, copnum(cval));*/
- *cp = (union tree *)Tblock(sizeof(struct ftconst));
+ *cp = (union tree *)Tblock(sizeof(struct fnode));
  (*cp)->f.op = FCON;
  (*cp)->f.type = DOUBLE;
  (*cp)->f.value = isn1++;
@@ -678,7 +678,7 @@ advanc:
                goto tand;
 
        case LCON:
-               *cp = (union tree *)Tblock(sizeof(struct lconst));
+               *cp = (union tree *)Tblock(sizeof(struct lnode));
                (*cp)->l.op = LCON;
                (*cp)->l.type = LONG;
                (*cp)->l.lvalue = lcval;
@@ -723,7 +723,7 @@ advanc:
                cs->hoffset = cval;
 #if 1 /* one-pass version */
  /* really should change this to use nblock and fill in nmlist above better */
-               *cp = (union tree *)Tblock(sizeof(struct tname));
+               *cp = (union tree *)Tblock(sizeof(struct nnode));
                (*cp)->n.op = NAME;
                (*cp)->n.type = unscflg? ARRAY+UNCHAR:ARRAY+CHAR;
                (*cp)->n.subsp = &nchstr;
diff --git a/c01.c b/c01.c
index 829be84..85b4946 100644 (file)
--- a/c01.c
+++ b/c01.c
@@ -612,13 +612,13 @@ union tree *nblock(ds) register struct nmlist *ds; {
  /* this would then be decoded by c1 as follows: */
  /*   t = geti(); */
  /*   if (t==EXTERN) { */
- /*     tp = getblk(sizeof(struct xtname)); */
+ /*     tp = getblk(sizeof(struct xnode)); */
  /*     tp->t.type = geti(); */
  /*     outname(s); */
  /*     tp->x.name = (char *)getblk(strlen(s) + 1); */
  /*     strcpy(tp->x.name, s); */
  /*   } else { */
- /*     tp = getblk(sizeof(struct tname)); */
+ /*     tp = getblk(sizeof(struct nnode)); */
  /*     tp->t.type = geti(); */
  /*     tp->n.nloc = geti(); */
  /*   } */
@@ -628,14 +628,14 @@ union tree *nblock(ds) register struct nmlist *ds; {
  /*   tp->n.offset = 0; */
        union tree *tp;
        if (ds->hclass == EXTERN) {
-               tp = (union tree *)Tblock(sizeof(struct xtname));
+               tp = (union tree *)Tblock(sizeof(struct xnode));
  /*fprintf(stderr, "nblock xtname %p\n", tp);*/
                tp->x.name = Tblock((strlen(ds->name)+2+LNCPW-1) & ~(LNCPW-1));
                tp->x.name[0] = '_';
                strcpy(tp->x.name + 1, ds->name);
        }
        else {
-               tp = (union tree *)Tblock(sizeof(struct tname));
+               tp = (union tree *)Tblock(sizeof(struct nnode));
  /*fprintf(stderr, "nblock tname %p\n", tp);*/
                tp->n.nloc = ds->hoffset;
        }
@@ -657,7 +657,7 @@ union tree *cblock(v) int v; {
        register union tree *p;
 
  /*fprintf(stderr, "cblock(0%06o)\n", v & 0177777);*/
-       p = (union tree *)Tblock(sizeof(struct tconst));
+       p = (union tree *)Tblock(sizeof(struct cnode));
        p->c.op = CON;
        p->c.type = INT;
        p->c.subsp = NULL;
@@ -672,7 +672,7 @@ union tree *cblock(v) int v; {
 /*union tree *fblock(t, string) int t; char *string; {
        register union tree *p;
 
-       p = (union tree *)Tblock(sizeof(struct ftconst));
+       p = (union tree *)Tblock(sizeof(struct fnode));
        p->f.op = FCON;
        p->f.type = t;
        p->f.subsp = NULL;
diff --git a/c1.h b/c1.h
index df49204..c9ad894 100644 (file)
--- a/c1.h
+++ b/c1.h
@@ -101,11 +101,11 @@ extern int opdope1[];
 extern char *opntab[];
 extern int nstack;
 extern int nfloat;
-extern struct tname sfuncr;
+extern struct nnode sfuncr;
 extern char *funcbase;
 extern char *curbase;
 extern char *coremax;
-extern struct tconst czero, cone;
+extern struct cnode czero, cone;
 extern long totspace;
 extern int regpanic;           /* set when SU register alg. fails */
 extern int panicposs;          /* set when there might be need for regpanic */
diff --git a/c10.c b/c10.c
index a00f8cc..d86173f 100644 (file)
--- a/c10.c
+++ b/c10.c
@@ -27,10 +27,10 @@ char        notrel[] = {    NEQUAL, EQUAL, GREAT, GREATEQ, LESS,
                        LESSEQ, GREATP, GREATQP, LESSP, LESSEQP
 };
 
-struct tconst czero = { CON, INT, 0/*subsp*/, 0/*strp*/, 0};
-struct tconst cone  = { CON, INT, 0/*subsp*/, 0/*strp*/, 1};
+struct cnode czero = { CON, INT, 0/*subsp*/, 0/*strp*/, 0};
+struct cnode cone  = { CON, INT, 0/*subsp*/, 0/*strp*/, 1};
 
-struct tname sfuncr = { NAME, STRUCT, 0/*subsp*/, 0/*strp*/, 0/*tr1*/, STATIC, 0, 0, 0 }; 
+struct nnode sfuncr = { NAME, STRUCT, 0/*subsp*/, 0/*strp*/, 0/*tr1*/, STATIC, 0, 0, 0 }; 
 struct table   *cregtab;
 
 int    nreg    = 3;
@@ -1136,7 +1136,7 @@ union tree *paint(tp, type) register union tree *tp; register int type; {
 union tree *ncopy(p) register union tree *p; {
        register union tree *q;
 
-       q = getblk(sizeof(struct xtname));
+       q = getblk(sizeof(struct xnode));
        q->n.op = p->n.op;
        q->n.type = p->n.type;
        q->n.class = p->n.class;
diff --git a/c11.c b/c11.c
index fbb8a94..4ca0075 100644 (file)
--- a/c11.c
+++ b/c11.c
@@ -995,13 +995,13 @@ void outcode(fmt, va_alist) char *fmt; va_dcl
        case NAME:
                t = va_arg(argp, int) /*geti()*/;
                if (t==EXTERN) {
-                       tp = getblk(sizeof(struct xtname));
+                       tp = getblk(sizeof(struct xnode));
                        tp->t.type = va_arg(argp, int) /*geti()*/;
                        outname(s/*)*/, va_arg(argp, char *));
                        tp->x.name = (char *)getblk(strlen(s) + 1);
                        strcpy(tp->x.name, s);
                } else {
-                       tp = getblk(sizeof(struct tname));
+                       tp = getblk(sizeof(struct nnode));
                        tp->t.type = va_arg(argp, int) /*geti()*/;
                        tp->n.nloc = va_arg(argp, int) /*geti()*/;
                }
@@ -1025,7 +1025,7 @@ void outcode(fmt, va_alist) char *fmt; va_dcl
                        *sp++ = tnode1(ITOL, LONG, tconst(op, INT), TNULL);
                        break;
                }
-               tp = getblk(sizeof(struct lconst));
+               tp = getblk(sizeof(struct lnode));
                tp->t.op = LCON;
                tp->t.type = LONG;
                tp->l.lvalue = ((_LONG)t<<16) + UNS(op); /* nonportable */
@@ -1035,7 +1035,7 @@ void outcode(fmt, va_alist) char *fmt; va_dcl
        case FCON:
                t = va_arg(argp, int) /*geti()*/;
                outname(s/*)*/, va_arg(argp, char *));
-               tp = getblk(sizeof(struct ftconst));
+               tp = getblk(sizeof(struct fnode));
                tp->t.op = FCON;
                tp->t.type = t;
                tp->f.value = isn1++;
diff --git a/c12.c b/c12.c
index c62889c..cec6e50 100644 (file)
--- a/c12.c
+++ b/c12.c
@@ -344,7 +344,7 @@ union tree *unoptim(tree) register union tree *tree; {
 
        case ITOL:
                if (subtre->t.op==CON && subtre->t.type==INT && subtre->c.value<0) {
-                       subtre = getblk(sizeof(struct lconst));
+                       subtre = getblk(sizeof(struct lnode));
                        subtre->t.op = LCON;
                        subtre->t.type = LONG;
                        subtre->l.lvalue = tree->t.tr1->c.value;
@@ -362,7 +362,7 @@ union tree *unoptim(tree) register union tree *tree; {
 
        case LTOF:
                if (subtre->t.op==LCON) {
-                       tree = getblk(sizeof(struct ftconst));
+                       tree = getblk(sizeof(struct fnode));
                        tree->t.op = FCON;
                        tree->t.type = DOUBLE;
                        tree->f/*c*/.value = isn1++;
@@ -379,7 +379,7 @@ union tree *unoptim(tree) register union tree *tree; {
 
        case ITOF:
                if (subtre->t.op==CON) {
-                       tree = getblk(sizeof(struct ftconst));
+                       tree = getblk(sizeof(struct fnode));
                        tree->t.op = FCON;
                        tree->t.type = DOUBLE;
                        tree->f.value = isn1++;
@@ -569,7 +569,7 @@ union tree *unoptim(tree) register union tree *tree; {
                }
                if (subtre->t.op==ITOL) {
                        if (subtre->t.tr1->t.op==CON) {
-                               tree = getblk(sizeof(struct lconst));
+                               tree = getblk(sizeof(struct lnode));
                                tree->t.op = LCON;
                                tree->t.type = LONG;
                                if (uns(subtre->t.tr1))
@@ -603,7 +603,7 @@ union tree *unoptim(tree) register union tree *tree; {
                        return(subtre);
                }
                if (subtre->t.op==ITOL && subtre->t.tr1->t.op==CON) {
-                       tree = getblk(sizeof(struct lconst));
+                       tree = getblk(sizeof(struct lnode));
                        tree->t.op = LCON;
                        tree->t.type = LONG;
                        if (uns(subtre->t.tr1))
@@ -1103,7 +1103,7 @@ union tree *lconst(op, lp, rp) int op; register union tree *lp; register union t
                lp->l.lvalue = l;
                return(lp);
        }
-       lp = getblk(sizeof(struct lconst));
+       lp = getblk(sizeof(struct lnode));
        lp->t.op = LCON;
        lp->t.type = LONG;
        lp->l.lvalue = l;
@@ -1172,7 +1172,7 @@ union tree *tnode1(op, type, tr1, tr2) int op; int type; union tree *tr1; union
 union tree *tconst(val, type) int val; int type; {
        register union tree *p;
 
-       p = getblk(sizeof(struct tconst));
+       p = getblk(sizeof(struct cnode));
        p->t.op = CON;
        p->t.type = type;
        p->c.value = val;
diff --git a/ccom.h b/ccom.h
index 0446172..a4fc6ee 100644 (file)
--- a/ccom.h
+++ b/ccom.h
@@ -84,7 +84,7 @@ struct        tnode {
 /*
  * tree names for locals
  */
-struct tname {
+struct nnode {
        int     op;
        int     type;
        int     *subsp;         /* subscript list for arrays; pass 0 only */
@@ -99,7 +99,7 @@ struct        tname {
 /*
  * tree names for externals
  */
-struct xtname {
+struct xnode {
        int     op;
        int     type;
        int     *subsp;         /* subscript list for arrays; pass 0 only */
@@ -114,7 +114,7 @@ struct      xtname {
 /*
  * short constants
  */
-struct tconst {
+struct cnode {
        int     op;
        int     type;
        int     *subsp;         /* subscript list for arrays; pass 0 only */
@@ -125,7 +125,7 @@ struct      tconst {
 /*
  * long constants
  */
-struct lconst {
+struct lnode {
        int     op;
        int     type;
        int     *subsp;         /* subscript list for arrays; pass 0 only */
@@ -136,7 +136,7 @@ struct      lconst {
 /*
  * Floating constants
  */
-struct ftconst {
+struct fnode {
        int     op;
        int     type;
        int     *subsp;         /* subscript list for arrays; pass 0 only */
@@ -161,11 +161,11 @@ struct    fasgn {
 
 union  tree {
        struct  tnode t;
-       struct  tname n;                /* pass 1 only */
-       struct  xtname x;               /* pass 1 only */
-       struct  tconst c;
-       struct  lconst l;
-       struct  ftconst f;
+       struct  nnode n;                /* pass 1 only */
+       struct  xnode x;                /* pass 1 only */
+       struct  cnode c;
+       struct  lnode l;
+       struct  fnode f;
        struct  fasgn F;                /* pass 1 only */
 };