BSD 4 development
authorBill Joy <wnj@ucbvax.Berkeley.EDU>
Fri, 19 Oct 1979 11:09:31 +0000 (03:09 -0800)
committerBill Joy <wnj@ucbvax.Berkeley.EDU>
Fri, 19 Oct 1979 11:09:31 +0000 (03:09 -0800)
Work on file usr/src/cmd/pxp/tree.h
Work on file usr/src/cmd/pxp/treen.s
Work on file usr/src/cmd/pxp/type.c
Work on file usr/src/cmd/pxp/var.c
Work on file usr/src/cmd/pxp/y.tab.h

Synthesized-from: CSRG//cd1/4.0

usr/src/cmd/pxp/tree.h [new file with mode: 0755]
usr/src/cmd/pxp/treen.s [new file with mode: 0755]
usr/src/cmd/pxp/type.c [new file with mode: 0755]
usr/src/cmd/pxp/var.c [new file with mode: 0755]
usr/src/cmd/pxp/y.tab.h [new file with mode: 0755]

diff --git a/usr/src/cmd/pxp/tree.h b/usr/src/cmd/pxp/tree.h
new file mode 100755 (executable)
index 0000000..0221a38
--- /dev/null
@@ -0,0 +1,82 @@
+/* Copyright (c) 1979 Regents of the University of California */
+#define T_MINUS 1
+#define T_MOD 2
+#define T_DIV 3
+#define T_DIVD 4
+#define T_MULT 5
+#define T_ADD 6
+#define T_SUB 7
+#define T_EQ 8
+#define T_NE 9
+#define T_LT 10
+#define T_GT 11
+#define T_LE 12
+#define T_GE 13
+#define T_NOT 14
+#define T_AND 15
+#define T_OR 16
+#define T_ASGN 17
+#define T_PLUS 18
+#define T_IN 19
+#define T_LISTPP 20
+#define T_PDEC 21
+#define T_FDEC 22
+#define T_PVAL 23
+#define T_PVAR 24
+#define T_PFUNC 25
+#define T_PPROC 26
+#define T_NIL 27
+#define T_STRNG 28
+#define T_CSTRNG 29
+#define T_PLUSC 30
+#define T_MINUSC 31
+#define T_ID 32
+#define T_INT 33
+#define T_FINT 34
+#define T_CINT 35
+#define T_CFINT 36
+#define T_TYPTR 37
+#define T_TYPACK 38
+#define T_TYSCAL 39
+#define T_TYRANG 40
+#define T_TYARY 41
+#define T_TYFILE 42
+#define T_TYSET 43
+#define T_TYREC 44
+#define T_TYFIELD 45
+#define T_TYVARPT 46
+#define T_TYVARNT 47
+#define T_CSTAT 48
+#define T_BLOCK 49
+#define T_BSTL 50
+#define T_LABEL 51
+#define T_PCALL 52
+#define T_FCALL 53
+#define T_CASE 54
+#define T_WITH 55
+#define T_WHILE 56
+#define T_REPEAT 57
+#define T_FORU 58
+#define T_FORD 59
+#define T_GOTO 60
+#define T_IF 61
+#define T_ASRT 62
+#define T_CSET 63
+#define T_RANG 64
+#define T_VAR 65
+#define T_ARGL 66
+#define T_ARY 67
+#define T_FIELD 68
+#define T_PTR 69
+#define T_WEXP 70
+#define T_PROG 71
+#define T_BINT 72
+#define T_CBINT 73
+#define T_IFEL 74
+#define T_IFX 75
+#define T_TYID 76
+#define T_COPSTR 77
+#define T_BOTTLE 78
+#define T_RFIELD 79
+#define T_FLDLST 80
+#define T_LAST 81
diff --git a/usr/src/cmd/pxp/treen.s b/usr/src/cmd/pxp/treen.s
new file mode 100755 (executable)
index 0000000..3929b8d
--- /dev/null
@@ -0,0 +1,33 @@
+.text
+/
+/ Routines to save space on tree calls
+/
+.globl _tree, _tree1, _tree2, _tree3, _tree4, _tree5
+/
+_tree1:
+       mov     (sp),trret
+       mov     $1,(sp)
+       br      1f
+_tree2:
+       mov     (sp),trret
+       mov     $2,(sp)
+       br      1f
+_tree3:
+       mov     (sp),trret
+       mov     $3,(sp)
+       br      1f
+_tree4:
+       mov     (sp),trret
+       mov     $4,(sp)
+       br      1f
+_tree5:
+       mov     (sp),trret
+       mov     $5,(sp)
+1:
+       mov     $1f,-(sp)
+       jmp     _tree
+1:
+       tst     (sp)+
+       jmp     *trret
+.bss
+trret: . = .+2
diff --git a/usr/src/cmd/pxp/type.c b/usr/src/cmd/pxp/type.c
new file mode 100755 (executable)
index 0000000..182daff
--- /dev/null
@@ -0,0 +1,203 @@
+/* Copyright (c) 1979 Regents of the University of California */
+#
+/*
+ * pxp - Pascal execution profiler
+ *
+ * Bill Joy UCB
+ * Version 1.2 January 1979
+ */
+
+#include "0.h"
+#include "tree.h"
+
+STATIC int typecnt -1;
+/*
+ * Type declaration part
+ */
+typebeg(l, tline)
+       int l, tline;
+{
+
+       line = l;
+       if (nodecl)
+               printoff();
+       puthedr();
+       putcm();
+       ppnl();
+       indent();
+       ppkw("type");
+       ppgoin(DECL);
+       typecnt = 0;
+       setline(tline);
+}
+
+type(tline, tid, tdecl)
+       int tline;
+       char *tid;
+       int *tdecl;
+{
+
+       if (typecnt)
+               putcm();
+       setline(tline);
+       ppitem();
+       ppid(tid);
+       ppsep(" =");
+       gtype(tdecl);
+       ppsep(";");
+       setinfo(tline);
+       putcml();
+       typecnt++;
+}
+
+typeend()
+{
+
+       if (typecnt == -1)
+               return;
+       if (typecnt == 0)
+               ppid("{type decls}");
+       ppgoout(DECL);
+       typecnt = -1;
+}
+
+/*
+ * A single type declaration
+ */
+gtype(r)
+       register int *r;
+{
+
+       if (r == NIL) {
+               ppid("{type}");
+               return;
+       }
+       if (r[0] != T_ID && r[0] != T_TYPACK)
+               setline(r[1]);
+       switch (r[0]) {
+               default:
+                       panic("type");
+               case T_ID:
+                       ppspac();
+                       ppid(r[1]);
+                       return;
+               case T_TYID:
+                       ppspac();
+                       ppid(r[2]);
+                       break;
+               case T_TYSCAL:
+                       ppspac();
+                       tyscal(r);
+                       break;
+               case T_TYRANG:
+                       ppspac();
+                       tyrang(r);
+                       break;
+               case T_TYPTR:
+                       ppspac();
+                       ppop("^");
+                       gtype(r[2]);
+                       break;
+               case T_TYPACK:
+                       ppspac();
+                       ppkw("packed");
+                       gtype(r[2]);
+                       break;
+               case T_TYARY:
+                       ppspac();
+                       tyary(r);
+                       break;
+               case T_TYREC:
+                       ppspac();
+                       tyrec(r[2], NIL);
+                       break;
+               case T_TYFILE:
+                       ppspac();
+                       ppkw("file");
+                       ppspac();
+                       ppkw("of");
+                       gtype(r[2]);
+                       break;
+               case T_TYSET:
+                       ppspac();
+                       ppkw("set");
+                       ppspac();
+                       ppkw("of");
+                       gtype(r[2]);
+                       break;
+       }
+       setline(r[1]);
+       putcml();
+}
+
+/*
+ * Scalar type declaration
+ */
+tyscal(r)
+       register int *r;
+{
+       register int i;
+
+       ppsep("(");
+       r = r[2];
+       if (r != NIL) {
+               i = 0;
+               ppgoin(DECL);
+               for (;;) {
+                       ppid(r[1]);
+                       r = r[2];
+                       if (r == NIL)
+                               break;
+                       ppsep(", ");
+                       i++;
+                       if (i == 7) {
+                               ppitem();
+                               i = 0;
+                       }
+               }
+               ppgoout(DECL);
+       } else
+               ppid("{constant list}");
+       ppsep(")");
+}
+
+/*
+ * Subrange type declaration
+ */
+tyrang(r)
+       register int *r;
+{
+
+       gconst(r[2]);
+       ppsep("..");
+       gconst(r[3]);
+}
+
+/*
+ * Array type declaration
+ */
+tyary(r)
+       register int *r;
+{
+       register int *tl;
+
+       ppkw("array");
+       ppspac();
+       ppsep("[");
+       tl = r[2];
+       if (tl != NIL) {
+               ppunspac();
+               for (;;) {
+                       gtype(tl[1]);
+                       tl = tl[2];
+                       if (tl == NIL)
+                               break;
+                       ppsep(",");
+               }
+       } else
+               ppid("{subscr list}");
+       ppsep("]");
+       ppspac();
+       ppkw("of");
+       gtype(r[3]);
+}
diff --git a/usr/src/cmd/pxp/var.c b/usr/src/cmd/pxp/var.c
new file mode 100755 (executable)
index 0000000..5048ea8
--- /dev/null
@@ -0,0 +1,71 @@
+/* Copyright (c) 1979 Regents of the University of California */
+#
+/*
+ * pxp - Pascal execution profiler
+ *
+ * Bill Joy UCB
+ * Version 1.2 January 1979
+ */
+
+#include "0.h"
+#include "tree.h"
+
+STATIC int varcnt -1;
+/*
+ * Var declaration part
+ */
+varbeg(l, vline)
+       int l, vline;
+{
+
+       line = l;
+       if (nodecl)
+               printoff();
+       puthedr();
+       putcm();
+       ppnl();
+       indent();
+       ppkw("var");
+       ppgoin(DECL);
+       varcnt = 0;
+       setline(vline);
+}
+
+var(vline, vidl, vtype)
+       int vline;
+       register int *vidl;
+       int *vtype;
+{
+
+       if (varcnt)
+               putcm();
+       setline(vline);
+       ppitem();
+       if (vidl != NIL)
+               for (;;) {
+                       ppid(vidl[1]);
+                       vidl = vidl[2];
+                       if (vidl == NIL)
+                               break;
+                       ppsep(", ");
+               }
+       else
+               ppid("{identifier list}");
+       ppsep(":");
+       gtype(vtype);
+       ppsep(";");
+       setinfo(vline);
+       putcml();
+       varcnt++;
+}
+
+varend()
+{
+
+       if (varcnt == -1)
+               return;
+       if (varcnt == 0)
+               ppid("{variable decls}");
+       ppgoout(DECL);
+       varcnt = -1;
+}
diff --git a/usr/src/cmd/pxp/y.tab.h b/usr/src/cmd/pxp/y.tab.h
new file mode 100755 (executable)
index 0000000..d5049f9
--- /dev/null
@@ -0,0 +1,61 @@
+/* Copyright (c) 1979 Regents of the University of California */
+#
+# define YAND 257
+# define YARRAY 258
+# define YBEGIN 259
+# define YCASE 260
+# define YCONST 261
+# define YDIV 262
+# define YDO 263
+# define YDOTDOT 264
+# define YTO 265
+# define YELSE 266
+# define YEND 267
+# define YFILE 268
+# define YFOR 269
+# define YFORWARD 270
+# define YFUNCTION 271
+# define YGOTO 272
+# define YID 273
+# define YIF 274
+# define YIN 275
+# define YINT 276
+# define YLABEL 277
+# define YMOD 278
+# define YNOT 279
+# define YNUMB 280
+# define YOF 281
+# define YOR 282
+# define YPACKED 283
+# define YNIL 284
+# define YPROCEDURE 285
+# define YPROG 286
+# define YRECORD 287
+# define YREPEAT 288
+# define YSET 289
+# define YSTRING 290
+# define YTHEN 291
+# define YDOWNTO 292
+# define YTYPE 293
+# define YUNTIL 294
+# define YVAR 295
+# define YWHILE 296
+# define YWITH 297
+# define YBINT 298
+# define YOCT 299
+# define YHEX 300
+# define YASSERT 301
+# define YCASELAB 302
+# define YILLCH 303
+# define YLAST 304
+# define UNARYSIGN 305
+
+/*
+ * GLOBALS FOR ACTIONS
+ */
+
+/*
+ * The following line marks the end of the yacc
+ * Constant definitions which are removed from
+ * y.tab.c and placed in the file y.tab.h.
+ */