BSD 4_1_snap release
[unix-history] / usr / src / cmd / pi / gen.c
index 957d5e9..3e0153e 100644 (file)
@@ -1,16 +1,16 @@
 /* Copyright (c) 1979 Regents of the University of California */
 /* Copyright (c) 1979 Regents of the University of California */
-#
-/*
- * pi - Pascal interpreter code translator
- *
- * Charles Haley, Bill Joy UCB
- * Version 1.2 November 1978
- */
 
 
-#include "whoami"
+static char sccsid[] = "@(#)gen.c 1.2 3/8/81";
+
+#include "whoami.h"
+#ifdef OBJ
+    /*
+     * and the rest of the file
+     */
 #include "0.h"
 #include "tree.h"
 #include "opcode.h"
 #include "0.h"
 #include "tree.h"
 #include "opcode.h"
+#include "objfmt.h"
 
 /*
  * This array tells the type
 
 /*
  * This array tells the type
@@ -189,26 +189,28 @@ gen(p, o, w1, w2)
                        i <<= 2;
                        i |= j;
                        if (p == O_AS2) {
                        i <<= 2;
                        i |= j;
                        if (p == O_AS2) {
-                               put1(O_AS2 + asgntab[i]);
+                               put(1, O_AS2 + asgntab[i]);
                                return (NIL);
                        }
                        op = arop[o];
                        if (op == O_REL2) {
                                return (NIL);
                        }
                        op = arop[o];
                        if (op == O_REL2) {
-                               put1((op + reltab[i]) | (o - T_EQ) << 9);
+                               put(1, (op + reltab[i]) | (o - T_EQ) << 8+INDX);
                                return (nl+TBOOL);
                        }
                                return (nl+TBOOL);
                        }
-                       put1(i == 15 ? ar8op[o-T_DIVD] : op | artab[i]);
+                       put(1, i == 15 ? ar8op[o-T_DIVD] : op | artab[i]);
                        return (op == O_DVD2 && !divchk ? nl+TDOUBLE : nl+arret[i]);
                        return (op == O_DVD2 && !divchk ? nl+TDOUBLE : nl+arret[i]);
+               case TREC:
                case TSTR:
                case TSTR:
-                       put2(O_RELG | (o - T_EQ) << 9, w1);
+                       put(2, O_RELG | (o - T_EQ) << 8+INDX, w1);
                        return (nl+TBOOL);
                case TSET:
                        op = setop[o-T_MULT];
                        if (op == O_RELT)
                        return (nl+TBOOL);
                case TSET:
                        op = setop[o-T_MULT];
                        if (op == O_RELT)
-                               op |= (o - T_EQ)<<9;
-                       put2(op, w1);
+                               op |= (o - T_EQ)<<8+INDX;
+                       put(2, op, w1);
                        return (o >= T_EQ ? nl+TBOOL : nl+TSET);
                default:
                        panic("gen");
        }
 }
                        return (o >= T_EQ ? nl+TBOOL : nl+TSET);
                default:
                        panic("gen");
        }
 }
+#endif OBJ