BSD 4_3 development
authorCSRG <csrg@ucbvax.Berkeley.EDU>
Thu, 11 Aug 1983 14:08:16 +0000 (06:08 -0800)
committerCSRG <csrg@ucbvax.Berkeley.EDU>
Thu, 11 Aug 1983 14:08:16 +0000 (06:08 -0800)
Work on file usr/src/usr.bin/struct/1.defs.h
Work on file usr/src/usr.bin/struct/1.incl.h
Work on file usr/src/usr.bin/struct/2.def.h
Work on file usr/src/usr.bin/struct/3.def.h
Work on file usr/src/usr.bin/struct/4.def.h
Work on file usr/src/usr.bin/struct/b.h
Work on file usr/src/usr.bin/struct/def.h

Synthesized-from: CSRG/cd1/4.3

usr/src/usr.bin/struct/1.defs.h [new file with mode: 0644]
usr/src/usr.bin/struct/1.incl.h [new file with mode: 0644]
usr/src/usr.bin/struct/2.def.h [new file with mode: 0644]
usr/src/usr.bin/struct/3.def.h [new file with mode: 0644]
usr/src/usr.bin/struct/4.def.h [new file with mode: 0644]
usr/src/usr.bin/struct/b.h [new file with mode: 0644]
usr/src/usr.bin/struct/def.h [new file with mode: 0644]

diff --git a/usr/src/usr.bin/struct/1.defs.h b/usr/src/usr.bin/struct/1.defs.h
new file mode 100644 (file)
index 0000000..d32929a
--- /dev/null
@@ -0,0 +1,154 @@
+/*     1.defs.h        4.2     83/08/11        */
+
+#define snum   145
+#define _s0    0
+#define _s1    1
+#define _s2    2
+#define _s3    3
+#define _s4    4
+#define _start 5
+#define _g     6
+#define _go    7
+#define _got   8
+#define _goto  9
+#define _ugo   10
+#define _ago   11
+#define _agoc  12
+#define _agol  13
+#define _agor  14
+#define _cgo   15
+#define _cgold 16
+#define _cgor  17
+#define _cgoc  18
+#define _i     19
+#define _if    20
+#define _if1   21
+#define _if2   22
+#define _pard  23
+#define _arif  24
+#define _c     25
+#define _co    26
+#define _con   27
+#define _cont  28
+#define _conti 29
+#define _contin        30
+#define _con_u 31
+#define _con_ue        32
+#define _d     33
+#define _do    34
+#define _dol   35
+#define _dov   36
+#define _doveq 37
+#define _a     38
+#define _as    39
+#define _ass   40
+#define _assi  41
+#define _assig 42
+#define _assign        43
+#define _assd  44
+#define _ast   45
+#define _asto  46
+#define _fr    47
+#define _fre   48
+#define _frea  49
+#define _1func 50
+#define _1f    51
+#define _fu    52
+#define _fun   53
+#define _func  54
+#define _funct 55
+#define _fncti 56
+#define _fncto 57
+#define _fin   58
+#define _fint  59
+#define _finte 60
+#define _fintg 61
+#define _finge 62
+#define _fc    63
+#define _fco   64
+#define _fcom  65
+#define _fcomp 66
+#define _fcmpl 67
+#define _fcple 68
+#define _fdou  69
+#define _fdoub 70
+#define _fdobl 71
+#define _fdble 72
+#define _fp    73
+#define _fpr   74
+#define _fpre  75
+#define _fprec 76
+#define _fprci 77
+#define _fpris 78
+#define _fprsi 79
+#define _fprco 80
+#define _fl    81
+#define _flo   82
+#define _flog  83
+#define _flogi 84
+#define _flgic 85
+#define _flgca 86
+#define _s     87
+#define _st    88
+#define _sto   89
+#define _su    90
+#define _sub   91
+#define _subr  92
+#define _subro 93
+#define _subrt 94
+#define _subri 95
+#define _subrn 96
+#define _r     97
+#define _re    98
+#define _ret   99
+#define _retu  100
+#define _retr  101
+#define _e     102
+#define _en    103
+#define _end   104
+#define _ent   105
+#define _entr  106
+#define _fo    107
+#define _for   108
+#define _form  109
+#define _fma   110
+#define _fmt   111
+#define _w     112
+#define _wr    113
+#define _wri   114
+#define _writ  115
+#define _write 116
+#define _read  117
+#define _rdig  118
+#define _rwp   119
+#define _rwlab 120
+#define _rwe   121
+#define _rwen  122
+#define _rwend 123
+#define _endeq 124
+#define _rwer  125
+#define _rwerr 126
+#define _p     127
+#define _pr    128
+#define _pri   129
+#define _prin  130
+#define _pu    131
+#define _pun   132
+#define _punc  133
+#define _bd    134
+#define _bl    135
+#define _blo   136
+#define _blc   137
+#define _blk   138
+#define _bld   139
+#define _blda  140
+#define _bldt  141
+#define ABORT  142
+#define endrt  143
+#define nulls  144
+#define _other 1
+#define _digit 2
+#define _letter        3
+#define _diglet        4
+#define _arith 5
+#define _nl    6
diff --git a/usr/src/usr.bin/struct/1.incl.h b/usr/src/usr.bin/struct/1.incl.h
new file mode 100644 (file)
index 0000000..985e108
--- /dev/null
@@ -0,0 +1,41 @@
+/*     1.incl.h        4.2     83/08/11        */
+
+#define maxlsw         10      /* max number of switches and labels per statement */
+#define implicit 0L            /* "label" of following line so all flow can be treated as jump to label */
+struct lablist {long labelt;  struct lablist *nxtlab; };
+extern struct lablist *endlab, *errlab, *reflab, *linelabs, *newlab;
+extern long label();
+
+extern int routbeg;                    /* line number of first line of routine */
+extern int nameline;                   /* line number of function/subroutine st., if any */
+extern int stflag;             /* determines whether at beginning or middle of block of straight line code */
+
+
+
+extern char buffer[];
+extern int endbuf;
+
+extern int   nlabs, lswnum, swptr, flag,
+        counter, p1, p3, begline, endline, r1,r2, endcom;
+extern long begchar, endchar, comchar;
+
+
+/* statement types not associated with actual node types */
+#define contst         -1
+#define ungo           -2
+#define arithif                -3
+#define readst         -8
+#define writest                -9
+#define entry  -10
+
+
+extern char *pred, *inc, *prerw, *postrw, *exp, *stcode;
+
+#define maxdo  20      /* max nesting of do loops */
+extern long dostack[maxdo];            /* labels of do nodes */
+extern int doloc[maxdo];               /* loc of do node */
+extern int doptr;
+
+
+extern struct list *FMTLST;            /* list of FMTVX's generated */
+extern struct list *ENTLST;            /* list of STLNVX nodes corresponding to entry statements */
diff --git a/usr/src/usr.bin/struct/2.def.h b/usr/src/usr.bin/struct/2.def.h
new file mode 100644 (file)
index 0000000..22c5d50
--- /dev/null
@@ -0,0 +1,6 @@
+/*     2.def.h 4.2     83/08/11        */
+
+extern int accessnum;          /* number of nodes accessible from START */
+extern VERT *after;            /* node numbers associated with after numbers of depth first search */
+extern int *ntobef;            /* before numbers associated with nodes */
+extern int *ntoaft;            /* after numbers associated with nodes */
diff --git a/usr/src/usr.bin/struct/3.def.h b/usr/src/usr.bin/struct/3.def.h
new file mode 100644 (file)
index 0000000..bef181d
--- /dev/null
@@ -0,0 +1,8 @@
+/*     3.def.h 4.2     83/08/11        */
+
+#define RECURSE(p,v,r) { for (r = 0; r < CHILDNUM(v); ++r) if (DEFINED(LCHILD(v,r))) p(LCHILD(v,r)); if (DEFINED(RSIB(v))) p(RSIB(v)); }
+
+#define IFTHEN(v)              ( NTYPE(v) == IFVX && !DEFINED(LCHILD(v,ELSE)))
+
+#define BRK(v) FATH(v)         /* lexical successor of v, for ITERVX only */
+#define LABEL(v)       REACH(v)
diff --git a/usr/src/usr.bin/struct/4.def.h b/usr/src/usr.bin/struct/4.def.h
new file mode 100644 (file)
index 0000000..5463f85
--- /dev/null
@@ -0,0 +1,13 @@
+/*     4.def.h 4.2     83/08/11        */
+
+#define YESTAB TRUE
+#define NOTAB  FALSE
+#define TABOVER(n)     tabover(n,outfd)
+#define OUTSTR(x)              fprintf(outfd,"%s",x)
+#define OUTNUM(x)              fprintf(outfd,"%d",x)
+
+
+extern LOGICAL *brace;
+#define YESBRACE(v,i)  { if (DEFINED(LCHILD(v,i))) brace[LCHILD(v,i)] = TRUE; }
+#define NOBRACE(v,i)   { if (DEFINED(LCHILD(v,i))) brace[LCHILD(v,i)] = FALSE; }
+#define HASBRACE(v,i)   ((DEFINED(LCHILD(v,i))) ? brace[LCHILD(v,i)] : TRUE)
diff --git a/usr/src/usr.bin/struct/b.h b/usr/src/usr.bin/struct/b.h
new file mode 100644 (file)
index 0000000..5fd2754
--- /dev/null
@@ -0,0 +1,12 @@
+/*     b.h     4.2     83/08/11        */
+
+extern int xxindent, xxval, newflag, xxmaxchars, xxbpertab;
+extern int xxlineno;           /* # of lines already output */
+#define xxtop  100             /* max size of xxstack */
+extern int xxstind, xxstack[xxtop], xxlablast, xxt;
+struct node
+       {int op;
+       char *lit;
+       struct node *left;
+       struct node *right;
+       };
diff --git a/usr/src/usr.bin/struct/def.h b/usr/src/usr.bin/struct/def.h
new file mode 100644 (file)
index 0000000..aa775aa
--- /dev/null
@@ -0,0 +1,120 @@
+/*     def.h   4.2     83/08/11        */
+
+#define ASSERT(P,R)    {if (!(P)) {fprintf(stderr,"failed assertion in routine R: P\n"); abort();}}
+
+extern int routnum, routerr;
+extern long rtnbeg;            /* number of chars up to beginnine of curernt routing */
+extern int **graph, nodenum;
+extern int stopflg;            /* turns off generation of stop statements */
+
+#define TRUE 1
+#define FALSE 0
+#define LOGICAL int
+#define VERT int
+#define DEFINED(v)     (v >= 0)
+#define UNDEFINED      -1
+
+/* node types */
+#define STLNVX         0
+#define IFVX           1
+#define DOVX           2
+#define IOVX           3
+#define FMTVX          4
+#define COMPVX         5
+#define ASVX           6
+#define ASGOVX         7
+#define LOOPVX         8
+#define WHIVX          9
+#define UNTVX          10
+#define ITERVX         11
+#define THENVX         12
+#define STOPVX         13
+#define RETVX          14
+#define DUMVX          15
+#define GOVX           16
+#define BRKVX          17
+#define NXTVX          18
+#define SWCHVX         19
+#define ACASVX         20
+#define ICASVX         21
+
+#define TYPENUM        22
+
+
+extern int hascom[TYPENUM];            /* FALSE for types with no comments, 2 otherwise */
+extern int nonarcs[TYPENUM];           /* number of wds per node other than arcs */
+extern VERT *arc(), *lchild();
+extern int *vxpart(), *negpart(), *predic(), *expres(), *level(), *stlfmt();
+/* node parts */
+#define FIXED 4                /* number of wds needed in every node */
+#define NTYPE(v)       graph[v][0]
+#define BEGCOM(v)      graph[v][1]
+#define RSIB(v)        graph[v][2]
+#define REACH(v)       graph[v][3]
+#define LCHILD(v,i)    *lchild(v,i)
+#define CHILDNUM(v)    childper[NTYPE(v)]
+#define ARC(v,i)       *arc(v,i)
+#define ARCNUM(v)      *((arcsper[NTYPE(v)] >= 0) ? &arcsper[NTYPE(v)]: &graph[v][-arcsper[NTYPE(v)]])
+
+/* STLNVX, FMTVX parts */
+#define BEGCODE(v)     *stlfmt(v,0)            /* 1st char of line on disk or address of string */
+#define ONDISK(v)      *stlfmt(v,1)            /* FALSE if in core,# of lines on disk otherwise */
+#define CODELINES(v)           *vxpart(v,STLNVX,2)             /* # of statements stored in node */
+
+/* IOVX parts */
+#define FMTREF(v)      *vxpart(v,IOVX,0)       /* FMTVX associated with i/o statememt */
+#define PRERW(v)       *vxpart(v,IOVX,1)       /* string occurring in i/o statement before parts with labels */
+#define POSTRW(v)      *vxpart(v,IOVX,2)       /* string occurring in i/o statement after parts wih labels */
+#define ENDEQ  1               /* arc number associated with endeq */
+#define ERREQ  2               /* arc number associated wth erreq */
+
+/* ITERVX parts */
+#define NXT(v) *vxpart(v,ITERVX,0)             /* THENVX containing condition for iteration for WHILE or UNTIL */
+#define FATH(v) *vxpart(v,ITERVX,1)            /* father of v */
+#define LPRED(v) *vxpart(v,ITERVX,2)           /* loop predicate for WHILE, UNTIL */
+
+/*DOVX parts */
+#define INC(v) *vxpart(v,DOVX,0)               /* string for iteration condition of DO */
+
+/* IFVX,THENVX parts */
+#define PRED(v)                *predic(v)      /* string containing predicate */
+#define NEG(v)                 *negpart(v)             /* TRUE if predicate negated */
+#define THEN   0               /* arc number of true branch */
+#define ELSE 1         /* arc number of false branch */
+
+/* miscellaneous parts */
+#define EXP(v) *expres(v)              /* expression - ASVX, COMPVX, ASGOVX, SWCHVX, ICASVX */
+#define LABREF(v)      *vxpart(v,ASVX,1)               /* node referred to by label in ASSIGN statement */
+
+
+/* BRKVX, NXTVX parts */
+#define LEVEL(v)       *level(v)
+
+/* also COMPVX, ASGOVX, SWCHVX, and DUMVX contain wd for number of arcs */
+/* location of this wd specified by negative entry in arcsper */
+extern int arcsper[TYPENUM];
+
+/* also nodes contain wds for children as specified by childper */
+extern childper[TYPENUM];
+
+
+/* switches */
+extern int intcase, arbcase, whiloop, invelse, exitsize, maxnode,
+       maxhash, progress, labinit, labinc, inputform, debug,levbrk,levnxt,mkunt;
+
+/* arrays */
+extern int *after;
+extern char *typename[];
+
+struct list {
+       VERT elt;
+       struct list *nxtlist;
+       };
+struct list *append(), *consl();
+extern VERT retvert, stopvert; /* specifies unique return and stop vertices */
+extern VERT START;
+extern int progtype;           /* type of program - main or sub or blockdata */
+#define sub    1
+#define blockdata      2
+
+extern FILE *infd, *debfd, *outfd;