Fix STRASG issue (might need further attention), fix float and string literals
authorNick Downing <downing.nick@gmail.com>
Fri, 10 Feb 2017 13:36:08 +0000 (00:36 +1100)
committerNick Downing <downing.nick@gmail.com>
Fri, 10 Feb 2017 13:36:08 +0000 (00:36 +1100)
20 files changed:
.gitignore
Makefile
c0.h
c00.c
c01.c
c04.c
c05.c
c1.h
c10.c
c11.c
c12.c
ccom.h
test/hello.i [new file with mode: 0644]
test/str0.c [new file with mode: 0644]
test/str0.dump [new file with mode: 0644]
test/str0.s [new file with mode: 0644]
test/str1.c [new file with mode: 0644]
test/str1.dump [new file with mode: 0644]
test/str1.s [new file with mode: 0644]
unify01.sed

index 0af40eb..9858a09 100644 (file)
@@ -2,3 +2,4 @@
 *.o
 ccom
 cvopt
+table.c
index 4a23ab3..6292026 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -26,11 +26,12 @@ c00.o c01.o c02.o c03.o c04.o c05.o: c0.h ccom.h
 c10.o c11.o c12.o c13.o: c1.h ccom.h
 
 table.o: optable cvopt
-       ./cvopt < optable > junk.c
-       ${CC} -S junk.c
-       sed 's/\.data/\.text/' < junk.s > junk.i
-       ${AS} -o table.o junk.i
-       rm -f junk.i junk.c junk.s
+       ./cvopt < optable > table.c
+       ${CC} -S table.c
+       sed 's/\.data/\.text/' < table.s > table.i
+       ${AS} -o table.o table.i
+#      rm -f table.i table.c table.s
+       rm -f table.i table.s
 
 cvopt: cvopt.c
        ${HOSTCC} -o cvopt cvopt.c
diff --git a/c0.h b/c0.h
index bd90c26..ab8d50a 100644 (file)
--- a/c0.h
+++ b/c0.h
@@ -58,49 +58,6 @@ int  STAUTO;
 #define        SZLONG  4
 #define        SZDOUB  8
 
-/*
- * Structure of namelist
- */
-struct nmlist {
-       char    hclass;         /* storage class */
-       char    hflag;          /* various flags */
-       int     htype;          /* type */
-       int     *hsubsp;        /* subscript list */
-       union   str *hstrp;     /* structure description */
-       int     hoffset;        /* post-allocation location */
-       struct  nmlist *nextnm; /* next name in chain */
-       union   str *sparent;   /* Structure of which this is member */
-       char    hblklev;        /* Block level of definition */
-       char    *name;          /* ASCII name */
-};
-
-/*
- * format of a structure description
- *  Same gadget is also used for fields,
- *  which can't be structures also.
- * Finally, it is used for parameter collection.
- */
-union str {
-       struct SS {
-               int     ssize;                  /* structure size */
-               struct nmlist **memlist;        /* member list */
-       } S;
-       struct FS {
-               int     flen;                   /* field width in bits */
-               int     bitoffs;                /* shift count */
-       } F;
-       struct nmlist P;
-};
-
-/*
- * Place used to keep dimensions
- * during declarations
- */
-struct tdim {
-       int     rank;
-       int     dimens[5];
-};
-
 extern char cvtab[4][4];
 extern char filename[MAXPATHLEN]; /* Nick */
 extern int opdope0[];
@@ -133,6 +90,7 @@ extern int proflg;
 extern struct nmlist *csym;
 extern int cval;
 extern _LONG lcval;
+extern _DOUBLE fcval;
 extern int nchstr;
 extern int nerror;
 extern struct nmlist *paraml;
diff --git a/c00.c b/c00.c
index 1a57c8b..20f0ea2 100644 (file)
--- a/c00.c
+++ b/c00.c
@@ -8,10 +8,12 @@
  * strings are put on temp2, which c1 reads after temp1.
  */
 
+#include <math.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
 #include "c0.h"
+#include "c1.h" /* for isn1 since want to keep float labels the same */
 
 int    isn0    = 1;
 int    peeksym = -1;
@@ -414,7 +416,12 @@ int getnum() {
                error0(nsyn);
        if (sym==FCON) {
                np[-1] = 0;
-               cval = np-numbuf;
+ /*            cval = np-numbuf;*/
+#ifdef pdp11
+ fcval = atof(numbuf);
+#else
+ fcval = fp_atof(numbuf);
+#endif
                return(FCON);
        }
        if (sym==CON && (lcval<0 || lcval>MAXINT&&base==10 || (lcval>>1)>MAXINT)) {
@@ -460,12 +467,19 @@ void putstr(lab, max) int lab; register int max; {
                        nchstr++;
                        if (nchstr%15 == 0)
  /*                            outcode("0B", BDATA);*/
-  fprintf(temp_fp[temp_fi], "\n.byte ");
- else if (flag)
+ {
+  fputc('\n', temp_fp[temp_fi]);
+  goto more;
+ }
+ if (flag == 0) {
+  flag = 1;
+ more:
+  fprintf(temp_fp[temp_fi], ".byte ");
+ }
+ else
   fputc(',', temp_fp[temp_fi]);
  /*                    outcode("1N", c & 0377);*/
  fprintf(temp_fp[temp_fi], "%o", c & 0377);
- flag = 1;
                }
        }
        if (nchstr < max) {
@@ -654,7 +668,13 @@ advanc:
                goto tand;
 
        case FCON:
-               *cp0++ = fblock(DOUBLE, copnum(cval));
+ /*            *cp0++ = fblock(DOUBLE, copnum(cval));*/
+ *cp0 = (union tree *)Tblock(sizeof(struct ftconst));
+ (*cp0)->f.op = FCON;
+ (*cp0)->f.type = DOUBLE;
+ (*cp0)->f.value = isn1++;
+ (*cp0)->f.fvalue = fcval;
+ cp0++;
                goto tand;
 
        case LCON:
@@ -929,10 +949,10 @@ union tree *xprtype0() {
           absname.hstrp, TNULL, TNULL));
 }
 
-char *copnum(len) int len; {
+/*char *copnum(len) int len; {
        register char *s1;
 
        s1 = Tblock((len+LNCPW-1) & ~(LNCPW-1));
        strcpy(s1, numbuf);
        return(s1);
-}
+}*/
diff --git a/c01.c b/c01.c
index b2c602a..1e1059f 100644 (file)
--- a/c01.c
+++ b/c01.c
@@ -630,7 +630,9 @@ union tree *nblock(ds) register struct nmlist *ds; {
        if (ds->hclass == EXTERN) {
                tp = (union tree *)Tblock(sizeof(struct xtname));
  /*fprintf(stderr, "nblock xtname %p\n", tp);*/
-               tp->x.name = ds->name;
+               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));
@@ -667,10 +669,9 @@ union tree *cblock(v) int v; {
 /*
  * A block for a float constant
  */
-union tree *fblock(t, string) int t; char *string; {
+/*union tree *fblock(t, string) int t; char *string; {
        register union tree *p;
 
- /*fprintf(stderr, "fblock(%d, \"%s\")\n", t, string);*/
        p = (union tree *)Tblock(sizeof(struct ftconst));
        p->f.op = FCON;
        p->f.type = t;
@@ -678,7 +679,7 @@ union tree *fblock(t, string) int t; char *string; {
        p->f.strp = NULL;
        p->f.cstr = string;
        return(p);
-}
+}*/
 
 /*
  * Assign a block for use in the
diff --git a/c04.c b/c04.c
index 00632a2..50959b6 100644 (file)
--- a/c04.c
+++ b/c04.c
@@ -41,7 +41,6 @@ void cbranch0(t, lbl, cond) union tree *t; int lbl; int cond; {
 #if 1 /* one-pass version */
        long outloc;
 
- /* note: we need to put STRASG crap in */
        regpanic = 0;
        if (setjmp(jmpbuf)) {
                regpanic = 10;
@@ -79,7 +78,6 @@ void rcexpr0(tp) register union tree *tp; {
                }
        }
 #if 1 /* one-pass version */
- /* note: we need to put STRASG crap in */
        regpanic = 0;
        if (setjmp(jmpbuf)) {
                regpanic = 10;
diff --git a/c05.c b/c05.c
index 752ce7b..0aa8dcb 100644 (file)
--- a/c05.c
+++ b/c05.c
@@ -229,6 +229,7 @@ int proflg;
 struct nmlist  *csym;
 int    cval;
 _LONG  lcval;
+_DOUBLE        fcval;
 int    nchstr;
 int    nerror;
 struct nmlist *paraml;
diff --git a/c1.h b/c1.h
index 060406e..5f0a526 100644 (file)
--- a/c1.h
+++ b/c1.h
@@ -221,29 +221,4 @@ union tree *isconstant __P((register union tree *t));
 union tree *hardlongs __P((register union tree *t));
 int uns __P((union tree *tp));
 
-#ifndef pdp11
-/* fp.c */
-int fp_tst __P((_DOUBLE val));
-_DOUBLE fp_abs __P((_DOUBLE val));
-_DOUBLE fp_neg __P((_DOUBLE val));
-int fp_le __P((_DOUBLE val0, _DOUBLE val1));
-int fp_ge __P((_DOUBLE val0, _DOUBLE val1));
-int fp_gt __P((_DOUBLE val0, _DOUBLE val1));
-int fp_lt __P((_DOUBLE val0, _DOUBLE val1));
-_INT fp_double_to_int __P((_DOUBLE val));
-_LONG fp_double_to_long __P((_DOUBLE val));
-_FLOAT fp_double_to_float __P((_DOUBLE val));
-_DOUBLE fp_int_to_double __P((_INT val));
-_DOUBLE fp_long_to_double __P((_LONG val));
-_DOUBLE fp_float_to_double __P((_FLOAT val));
-_DOUBLE fp_add __P((_DOUBLE val0, _DOUBLE val1));
-_DOUBLE fp_sub __P((_DOUBLE val0, _DOUBLE val1));
-_DOUBLE fp_mul __P((_DOUBLE val0, _DOUBLE val1));
-_DOUBLE fp_div __P((_DOUBLE val0, _DOUBLE val1));
-_DOUBLE fp_ldexp __P((_DOUBLE val, _INT exp));
-
-/* fp_atof.c */
-_DOUBLE fp_atof __P((register char *p));
-#endif
-
 #endif
diff --git a/c10.c b/c10.c
index 35beb6f..23ab392 100644 (file)
--- a/c10.c
+++ b/c10.c
@@ -225,7 +225,10 @@ again:
        /*
         * Structure assignments
         */
-       case STRASG:
+ /*    case STRASG:*/
+ case ASSIGN:
+  if (tree1->t.type != STRUCT)
+   break;
                strasg(tree1);
                return(0);
 
@@ -242,6 +245,10 @@ again:
         * for a switch or a return
         */
        case RFORCE:
+ if (tree1->t.type == STRUCT) {
+  strasg(tree1);
+  return(0);
+ }
                tree1 = tree1->t.tr1;
                if((r=rcexpr1(tree1, regtab, reg)) != 0)
                        movreg(r, 0, tree1);
@@ -1174,9 +1181,10 @@ int comarg(tree1, flagp) register union tree *tree1; int *flagp; {
        int i;
        int size;
 
-       if (tree1->t.op==STRASG) {
-               size = tree1->F.mask;
-               tree1 = tree1->t.tr1;
+       if (/*tree1->t.op==STRASG*/tree1->t.type==STRUCT) {
+ /*            size = tree1->F.mask;
+               tree1 = tree1->t.tr1;*/
+ size = tree1->t.strp->S.ssize;
                tree1 = strfunc(tree1);
                if (size <= sizeof(_INT)) {
                        paint(tree1, INT);
diff --git a/c11.c b/c11.c
index c12c243..45685ec 100644 (file)
--- a/c11.c
+++ b/c11.c
@@ -1151,31 +1151,33 @@ void strasg(atp) union tree *atp; {
        register union tree *tp;
        register int nwords, i;
 
-       nwords = atp->F.mask/sizeof(_INT);
-       tp = atp->t.tr1;
-       while (tp->t.op == SEQNC) {
+ /*    nwords = atp->F.mask/sizeof(_INT);*/
+ nwords = atp->t.strp->S.ssize/sizeof(_INT);
+       tp = atp/*->t.tr1*/;
+ /*    while (tp->t.op == SEQNC) {
                rcexpr1(tp->t.tr1, efftab, 0);
                tp = tp->t.tr2;
        }
-       if (tp->t.op != ASSIGN) {
+       if (tp->t.op != ASSIGN) {*/
                if (tp->t.op==RFORCE) { /* function return */
                        if (sfuncr.nloc==0) {
                                sfuncr.nloc = isn1++;
                                fprintf(temp_fp[temp_fi], /*printf(*/".bss\nL%d:.=.+%o\n.text\n", sfuncr.nloc,
                                        UNS(nwords*sizeof(_INT)));
                        }
-                       atp->t.tr1 = tnode1(ASSIGN, STRUCT, (union tree *)&sfuncr, tp->t.tr1);
+                       atp/*->t.tr1*/ = tnode1(ASSIGN, STRUCT, (union tree *)&sfuncr, tp->t.tr1);
+ atp->t.strp = tp->t.strp;
                        strasg(atp);
                        fprintf(temp_fp[temp_fi], /*printf(*/"mov       $L%d,r0\n", sfuncr.nloc);
                        return;
                }
              if (tp->t.op==CALL) {
/*            if (tp->t.op==CALL) {
                        rcexpr1(tp, efftab, 0);
                        return;
                }
                error1("Illegal structure operation");
                return;
-       }
+       }*/
        tp->t.tr2 = strfunc(tp->t.tr2);
        if (nwords==1)
                paint(tp, INT);
diff --git a/c12.c b/c12.c
index c6761c5..199f11e 100644 (file)
--- a/c12.c
+++ b/c12.c
@@ -1133,9 +1133,12 @@ union tree *tnode1(op, type, tr1, tr2) int op; int type; union tree *tr1; union
        p = getblk(sizeof(struct tnode));
        p->t.op = op;
        p->t.type = type;
-       p->t.degree = 0;
+ /*    p->t.degree = 0;*/
+ p->t.subsp = 0;
+ p->t.strp = 0;
        p->t.tr1 = tr1;
        p->t.tr2 = tr2;
+ p->t.degree = 0;
        return(p);
 }
 
diff --git a/ccom.h b/ccom.h
index d4d42a1..0446172 100644 (file)
--- a/ccom.h
+++ b/ccom.h
@@ -25,6 +25,49 @@ typedef struct { uint32_t l; uint32_t h; } _DOUBLE;
 #endif
 #define        TNULL   (union tree *)NULL
 
+/*
+ * Structure of namelist
+ */
+struct nmlist {
+       char    hclass;         /* storage class */
+       char    hflag;          /* various flags */
+       int     htype;          /* type */
+       int     *hsubsp;        /* subscript list */
+       union   str *hstrp;     /* structure description */
+       int     hoffset;        /* post-allocation location */
+       struct  nmlist *nextnm; /* next name in chain */
+       union   str *sparent;   /* Structure of which this is member */
+       char    hblklev;        /* Block level of definition */
+       char    *name;          /* ASCII name */
+};
+
+/*
+ * format of a structure description
+ *  Same gadget is also used for fields,
+ *  which can't be structures also.
+ * Finally, it is used for parameter collection.
+ */
+union str {
+       struct SS {
+               int     ssize;                  /* structure size */
+               struct nmlist **memlist;        /* member list */
+       } S;
+       struct FS {
+               int     flen;                   /* field width in bits */
+               int     bitoffs;                /* shift count */
+       } F;
+       struct nmlist P;
+};
+
+/*
+ * Place used to keep dimensions
+ * during declarations
+ */
+struct tdim {
+       int     rank;
+       int     dimens[5];
+};
+
 /*
  *  Tree node for unary and binary
  */
@@ -98,9 +141,8 @@ struct       ftconst {
        int     type;
        int     *subsp;         /* subscript list for arrays; pass 0 only */
        union   str *strp;      /* structure descr for structs; pass 0 only */
-       char    *cstr;          /* pass 0 only */
-       int     value;          /* pass 1 only */
-       _DOUBLE fvalue;         /* pass 1 only */
+       int     value;
+       _DOUBLE fvalue;
 };
 
 /*
@@ -376,4 +418,37 @@ struct swtab {
 extern int temp_fi;
 extern FILE *temp_fp[2];
 
+#ifndef pdp11
+#ifndef __P
+#ifdef __STDC__
+#define __P(args) args
+#else
+#define __P(args) ()
+#endif
+#endif
+
+/* fp.c */
+int fp_tst __P((_DOUBLE val));
+_DOUBLE fp_abs __P((_DOUBLE val));
+_DOUBLE fp_neg __P((_DOUBLE val));
+int fp_le __P((_DOUBLE val0, _DOUBLE val1));
+int fp_ge __P((_DOUBLE val0, _DOUBLE val1));
+int fp_gt __P((_DOUBLE val0, _DOUBLE val1));
+int fp_lt __P((_DOUBLE val0, _DOUBLE val1));
+_INT fp_double_to_int __P((_DOUBLE val));
+_LONG fp_double_to_long __P((_DOUBLE val));
+_FLOAT fp_double_to_float __P((_DOUBLE val));
+_DOUBLE fp_int_to_double __P((_INT val));
+_DOUBLE fp_long_to_double __P((_LONG val));
+_DOUBLE fp_float_to_double __P((_FLOAT val));
+_DOUBLE fp_add __P((_DOUBLE val0, _DOUBLE val1));
+_DOUBLE fp_sub __P((_DOUBLE val0, _DOUBLE val1));
+_DOUBLE fp_mul __P((_DOUBLE val0, _DOUBLE val1));
+_DOUBLE fp_div __P((_DOUBLE val0, _DOUBLE val1));
+_DOUBLE fp_ldexp __P((_DOUBLE val, _INT exp));
+
+/* fp_atof.c */
+_DOUBLE fp_atof __P((register char *p));
+#endif
+
 #endif
diff --git a/test/hello.i b/test/hello.i
new file mode 100644 (file)
index 0000000..b33c8d7
--- /dev/null
@@ -0,0 +1,427 @@
+# 1 "hello.c"
+
+# 1 "../stage1/lib/../usr/include/errno.h"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+       
+
+
+
+
+
+
+
+
+
+
+
+
+
+       
+
+
+
+
+
+
+
+
+
+
+
+
+
+       
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+extern int errno;
+
+
+
+
+# 111 "../stage1/lib/../usr/include/errno.h"
+
+
+
+
+
+
+int perror  ();
+
+
+
+# 2 "hello.c"
+
+# 1 "../stage1/lib/../usr/include/stdio.h"
+
+
+
+
+# 1 "../stage1/lib/../usr/include/sys/types.h"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+typedef        unsigned char   u_char;
+typedef        unsigned short  u_short;
+typedef        unsigned int    u_int;
+typedef        unsigned long   u_long;
+typedef        unsigned short  ushort;         
+
+
+typedef        struct  _physadr { int r[1]; } *physadr;
+typedef        struct  label_t {
+       int     val[14];
+} label_t;
+
+typedef        struct  _quad { long val[2]; } quad;
+typedef        long    daddr_t;
+typedef        void *  caddr_t;
+typedef        u_long  ino_t;
+typedef        long    swblk_t;
+typedef        long    size_t;
+typedef        long    time_t;
+typedef        short   dev_t;
+typedef        long    off_t;
+typedef        u_short uid_t;
+typedef        u_short gid_t;
+
+
+               
+
+
+
+
+
+
+
+
+
+
+
+
+       
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 5 "../stage1/lib/../usr/include/stdio.h"
+# 7 "../stage1/lib/../usr/include/stdio.h"
+
+
+
+
+
+
+
+
+
+
+
+
+extern struct  _iobuf {
+       int     _cnt;
+       char    *_ptr;          
+       char    *_base;         
+       int     _bufsiz;
+       short   _flag;
+       char    _file;          
+} _iob[];
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 72 "../stage1/lib/../usr/include/stdio.h"
+
+
+
+# 81 "../stage1/lib/../usr/include/stdio.h"
+
+
+
+# 86 "../stage1/lib/../usr/include/stdio.h"
+
+
+
+
+
+
+
+
+
+int _doprnt  ();
+
+
+int _doscan  ();
+
+
+int exit  () ;
+
+
+struct _iobuf *fdopen  ();
+
+
+int fgetc  ();
+
+
+char *fgets  ();
+
+
+int _filbuf  ();
+
+
+struct _iobuf *_findiop  ();
+int _f_morefiles  ();
+void f_prealloc  ();
+void _fwalk  ();
+void _cleanup  ();
+
+
+int _flsbuf  ();
+int fflush  ();
+int fclose  ();
+
+
+struct _iobuf *fopen  ();
+
+
+int fprintf  ();
+
+
+int fputc  ();
+
+
+int fputs  ();
+
+
+int fread  ();
+
+
+struct _iobuf *freopen  ();
+
+
+int fseek  ();
+
+
+long ftell  ();
+
+
+int fwrite  ();
+
+
+
+
+
+char *gets  ();
+
+
+int getw  ();
+
+
+struct _iobuf *popen  ();
+int pclose  ();
+
+
+int printf  ();
+
+
+
+
+
+int puts  ();
+
+
+int putw  ();
+
+
+int rewind  ();
+
+
+int scanf  ();
+int fscanf  ();
+int sscanf  ();
+
+
+int setbuf  ();
+
+
+int setbuffer  ();
+int setlinebuf  ();
+
+
+int sprintf  ();
+
+
+int _strout  ();
+
+
+int ungetc  ();
+
+
+int vfprintf  ();
+
+
+int vprintf  ();
+
+
+int vsprintf  ();
+
+
+# 3 "hello.c"
+
+int main() {
+       struct _iobuf *fp;
+
+       printf("hello, %s %.*s %5.2f\n", "world", 2, "fun", 3.14159);
+       fp = fopen("hello.txt", "w");
+       if (fp == 0) {
+               perror("hello.txt");
+               exit(1);
+       }
+       fprintf(fp, "hello, world\n");
+       fclose(fp);
+       return 0;
+}
diff --git a/test/str0.c b/test/str0.c
new file mode 100644 (file)
index 0000000..20c9f0e
--- /dev/null
@@ -0,0 +1,8 @@
+struct silly {
+  int i;
+  int j;
+};
+void main() {
+  struct silly a, b;
+  a = b;
+}
diff --git a/test/str0.dump b/test/str0.dump
new file mode 100644 (file)
index 0000000..1e05418
--- /dev/null
@@ -0,0 +1,21 @@
+SYMDEF main
+PROG
+RLABEL main
+SAVE
+SETREG 5
+BRANCH 1
+LABEL 2
+ANAME a -12
+ANAME b -16
+NAME AUTO STRUCT -12
+NAME AUTO STRUCT -16
+ASSIGN STRUCT
+STRASG 4 4
+EXPR 7
+LABEL 3
+RETRN
+LABEL 1
+SETSTK 8
+BRANCH 2
+EOFC
+*EOFC
diff --git a/test/str0.s b/test/str0.s
new file mode 100644 (file)
index 0000000..d5a2607
--- /dev/null
@@ -0,0 +1,15 @@
+.globl _main
+.text
+_main:
+~~main:
+jsr    r5,csv
+jbr    L1
+L2:~a=177764
+~b=177760
+mov    -20(r5),-14(r5)
+mov    -16(r5),-12(r5)
+L3:jmp cret
+L1:sub $10,sp
+jbr    L2
+.globl
+.data
diff --git a/test/str1.c b/test/str1.c
new file mode 100644 (file)
index 0000000..e6aeb2e
--- /dev/null
@@ -0,0 +1,18 @@
+struct silly {
+  int i;
+  int j;
+};
+void func(x) struct silly x; {
+  x.i = x.j;
+}
+struct silly func2() {
+  struct silly y;
+  return y;
+}
+void main() {
+  struct silly a, b;
+  a = b;
+  func(a);
+  func2();
+  a = func2();
+}
diff --git a/test/str1.dump b/test/str1.dump
new file mode 100644 (file)
index 0000000..7ba6b4b
--- /dev/null
@@ -0,0 +1,81 @@
+SYMDEF func
+PROG
+RLABEL func
+SAVE
+ANAME x 4
+SETREG 5
+BRANCH 1
+LABEL 2
+NAME AUTO INT 4
+AMPER PTR,INT
+CON INT 0
+PLUS PTR,INT
+STAR INT
+NAME AUTO INT 4
+AMPER PTR,INT
+CON INT 2
+PLUS PTR,INT
+STAR INT
+ASSIGN INT
+EXPR 6
+LABEL 3
+RETRN
+LABEL 1
+SETSTK 0
+BRANCH 2
+SYMDEF func2
+PROG
+RLABEL func2
+SAVE
+SETREG 5
+BRANCH 4
+LABEL 5
+ANAME y -12
+NAME AUTO STRUCT -12
+RFORCE STRUCT
+STRASG 4 4
+EXPR 10
+BRANCH 6
+LABEL 6
+RETRN
+LABEL 4
+SETSTK 4
+BRANCH 5
+SYMDEF main
+PROG
+RLABEL main
+SAVE
+SETREG 5
+BRANCH 7
+LABEL 8
+ANAME a -12
+ANAME b -16
+NAME AUTO STRUCT -12
+NAME AUTO STRUCT -16
+ASSIGN STRUCT
+STRASG 4 4
+EXPR 14
+NAME EXTERN FUNC,VOID func
+NAME AUTO STRUCT -12
+STRASG 4 4
+CALL VOID
+EXPR 15
+NAME EXTERN FUNC,STRUCT func2
+XNULLOP
+CALL STRUCT
+STRASG 4 4
+EXPR 16
+NAME AUTO STRUCT -12
+NAME EXTERN FUNC,STRUCT func2
+XNULLOP
+CALL STRUCT
+ASSIGN STRUCT
+STRASG 4 4
+EXPR 17
+LABEL 9
+RETRN
+LABEL 7
+SETSTK 8
+BRANCH 8
+EOFC
+*EOFC
diff --git a/test/str1.s b/test/str1.s
new file mode 100644 (file)
index 0000000..519883a
--- /dev/null
@@ -0,0 +1,50 @@
+.globl _func
+.text
+_func:
+~~func:
+jsr    r5,csv
+~x=4
+jbr    L1
+L2:mov 6(r5),4(r5)
+L3:jmp cret
+L1:jbr L2
+.globl _func2
+.text
+_func2:
+~~func2:
+jsr    r5,csv
+jbr    L4
+L5:~y=177764
+.bss
+L10000:.=.+4
+.text
+mov    -14(r5),L10000
+mov    -12(r5),2+L10000
+mov    $L10000,r0
+jbr    L6
+L6:jmp cret
+L4:sub $4,sp
+jbr    L5
+.globl _main
+.text
+_main:
+~~main:
+jsr    r5,csv
+jbr    L7
+L8:~a=177764
+~b=177760
+mov    -20(r5),-14(r5)
+mov    -16(r5),-12(r5)
+mov    -12(r5),-(sp)
+mov    -14(r5),-(sp)
+jsr    pc,_func
+cmp    (sp)+,(sp)+
+jsr    pc,_func2
+jsr    pc,_func2
+mov    (r0),-14(r5)
+mov    +2(r0),-12(r5)
+L9:jmp cret
+L7:sub $10,sp
+jbr    L8
+.globl
+.data
index 038c1c5..c736fe6 100644 (file)
@@ -9,6 +9,7 @@ s/@\(struct@[    ]*@tnode\)[01]@/@\1@/g
 s/@\(struct@[   ]*@tconst\)[01]@/@\1@/g
 s/@\(struct@[   ]*@lconst\)[01]@/@\1@/g
 s/@\(struct@[   ]*@ftconst\)[01]@/@\1@/g
+#s/@\(isn\)[01]*/@\1@/g
 
 s/@//g
 s/ATSIGN/@/g