from John Gilmore for gcc
authorKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Tue, 10 Jan 1989 09:25:05 +0000 (01:25 -0800)
committerKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Tue, 10 Jan 1989 09:25:05 +0000 (01:25 -0800)
SCCS-vsn: usr.bin/pascal/pdx/Makefile 1.20
SCCS-vsn: usr.bin/pascal/pdx/runtime/callproc.c 5.3
SCCS-vsn: usr.bin/pascal/src/savenl.c 5.2
SCCS-vsn: usr.bin/pascal/src/put.c 5.3
SCCS-vsn: usr.bin/pascal/px/Makefile 5.6
SCCS-vsn: usr.bin/pascal/px/int.c 5.2
SCCS-vsn: usr.bin/pascal/px/vars.h 5.3
SCCS-vsn: usr.bin/pascal/px/interp.c 5.6
SCCS-vsn: usr.bin/pascal/px/machdep.h 5.3
SCCS-vsn: usr.bin/pascal/pdx/process/pxinfo.h 5.3
SCCS-vsn: usr.bin/pascal/pdx/process/start.c 5.3
SCCS-vsn: usr.bin/pascal/pdx/process/resume.c 5.3
SCCS-vsn: usr.bin/pascal/pdx/process/pxinfo.h 5.3

12 files changed:
usr/src/usr.bin/pascal/pdx/Makefile
usr/src/usr.bin/pascal/pdx/process/pxinfo.h
usr/src/usr.bin/pascal/pdx/process/resume.c
usr/src/usr.bin/pascal/pdx/process/start.c
usr/src/usr.bin/pascal/pdx/runtime/callproc.c
usr/src/usr.bin/pascal/px/Makefile
usr/src/usr.bin/pascal/px/int.c
usr/src/usr.bin/pascal/px/interp.c
usr/src/usr.bin/pascal/px/machdep.h
usr/src/usr.bin/pascal/px/vars.h
usr/src/usr.bin/pascal/src/put.c
usr/src/usr.bin/pascal/src/savenl.c

index da51d18..ad3687c 100644 (file)
@@ -2,7 +2,7 @@
 # All rights reserved.  The Berkeley software License Agreement
 # specifies the terms and conditions for redistribution.
 #
 # All rights reserved.  The Berkeley software License Agreement
 # specifies the terms and conditions for redistribution.
 #
-#      @(#)Makefile    1.19 (Berkeley) %G%
+#      @(#)Makefile    1.20 (Berkeley) %G%
 #
 # make file for pdx
 #
 #
 # make file for pdx
 #
@@ -145,13 +145,15 @@ OBJS =\
        ${PROCOBJ}\
        ${MACHOBJ}
 
        ${PROCOBJ}\
        ${MACHOBJ}
 
+all: a.out
+
 a.out: ${OBJS} ${LIB}
        @echo "linking"
 a.out: ${OBJS} ${LIB}
        @echo "linking"
-       @cc ${LDFLAGS} ${OBJS} ${LIB}
+       @$(CC) ${LDFLAGS} ${OBJS} ${LIB}
 
 profile: ${OBJS}
        @echo "linking with -p"
 
 profile: ${OBJS}
        @echo "linking with -p"
-       @cc ${LDFLAGS} -p ${OBJS} ${LIB}
+       @$(CC) ${LDFLAGS} -p ${OBJS} ${LIB}
 
 lint:
        @cd ${COMMAND}; yacc -d grammar.yacc; lex token.lex
 
 lint:
        @cd ${COMMAND}; yacc -d grammar.yacc; lex token.lex
@@ -160,14 +162,14 @@ lint:
 
 cerror.o:
        @echo "assembling `machine`/$*.s"
 
 cerror.o:
        @echo "assembling `machine`/$*.s"
-       @cc -c `machine`/$*.s
+       @$(CC) -c `machine`/$*.s
 
 ${COMMAND}y.tab.o: ${COMMAND}grammar.yacc
 
 ${COMMAND}y.tab.o: ${COMMAND}grammar.yacc
-       cd ${COMMAND}; yacc -d grammar.yacc; cc -c ${CFLAGS} y.tab.c
+       cd ${COMMAND}; yacc -d grammar.yacc; $(CC) -c ${CFLAGS} y.tab.c
        ${RM} ${COMMAND}y.tab.c
 
 ${COMMAND}lex.yy.o: ${COMMAND}token.lex ${COMMAND}y.tab.h
        ${RM} ${COMMAND}y.tab.c
 
 ${COMMAND}lex.yy.o: ${COMMAND}token.lex ${COMMAND}y.tab.h
-       cd ${COMMAND}; lex token.lex; cc -c ${CFLAGS} lex.yy.c
+       cd ${COMMAND}; lex token.lex; $(CC) -c ${CFLAGS} lex.yy.c
        ${RM} ${COMMAND}lex.yy.c
 
 ${BPOBJ}:      ${BREAKPOINT}bp.rep
        ${RM} ${COMMAND}lex.yy.c
 
 ${BPOBJ}:      ${BREAKPOINT}bp.rep
index 130d33a..000108f 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)pxinfo.h    5.2 (Berkeley) %G%
+ *     @(#)pxinfo.h    5.3 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
  *     address of the display pointer
  *     address of the beginning of the object code
  *
  *     address of the display pointer
  *     address of the beginning of the object code
  *
- *     the address of a variable containing the address of the first local
- *             variable in the interpreter procedure
- *             (this is used to find the frame where the pc is)
- *     the address of the main interpreter loop
+ *     the address of the program counter used in the interpreter procedure
+ *             (px actually keeps the pc in a register if it can, but stores
+ *              it in this location each time around the interpreter loop.)
+ *     the address of the main interpreter loop (past the store of pc)
  */
 
 #ifdef tahoe
  */
 
 #ifdef tahoe
@@ -29,7 +29,7 @@ typedef struct {
        ADDRESS *disp;
        ADDRESS *dp;
        ADDRESS objstart;
        ADDRESS *disp;
        ADDRESS *dp;
        ADDRESS objstart;
-       ADDRESS pcaddrp;
+       ADDRESS pcaddr;
        ADDRESS loopaddr;
 } TRAPARGS;
 #else
        ADDRESS loopaddr;
 } TRAPARGS;
 #else
@@ -38,7 +38,7 @@ typedef struct {
        ADDRESS *disp;
        ADDRESS *dp;
        ADDRESS objstart;
        ADDRESS *disp;
        ADDRESS *dp;
        ADDRESS objstart;
-       ADDRESS pcaddrp;
+       ADDRESS pcaddr;
        ADDRESS loopaddr;
 } TRAPARGS;
 #endif
        ADDRESS loopaddr;
 } TRAPARGS;
 #endif
@@ -46,9 +46,8 @@ typedef struct {
 ADDRESS *DISPLAY;
 ADDRESS *DP;
 ADDRESS ENDOFF;
 ADDRESS *DISPLAY;
 ADDRESS *DP;
 ADDRESS ENDOFF;
-ADDRESS PCADDRP;
+ADDRESS PCADDR;
 ADDRESS LOOPADDR;
 ADDRESS LOOPADDR;
-ADDRESS *pcframe;
 #ifdef tahoe
 ADDRESS RETLOC;
 ADDRESS INTFP;
 #ifdef tahoe
 ADDRESS RETLOC;
 ADDRESS INTFP;
index 944cc9a..fe0c9f3 100644 (file)
@@ -5,7 +5,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)resume.c   5.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)resume.c   5.3 (Berkeley) %G%";
 #endif not lint
 
 /*
 #endif not lint
 
 /*
@@ -23,20 +23,6 @@ static char sccsid[] = "@(#)resume.c 5.2 (Berkeley) %G%";
 #include "machine/pxerrors.h"
 #include "pxinfo.h"
 
 #include "machine/pxerrors.h"
 #include "pxinfo.h"
 
-#if defined(vax) || defined(tahoe)
-    LOCAL ADDRESS fetchpc();
-#endif
-#ifdef vax
-#define        PCREG   11      /* where px holds virtual pc (see interp.sed) */
-#endif
-#ifdef tahoe
-#define        PCREG   12      /* where px holds virtual pc (see interp.sed) */
-#endif
-
-#ifdef sun
-LOCAL ADDRESS *pcaddr;
-#endif
-
 /*
  * Resume execution, set (get) pcode location counter before (after) resuming.
  */
 /*
  * Resume execution, set (get) pcode location counter before (after) resuming.
  */
@@ -52,27 +38,7 @@ resume()
            fflush(stdout);
        }
        pcont(p);
            fflush(stdout);
        }
        pcont(p);
-#       ifdef sun
-           if (pcaddr == 0) {
-               dread(&pcaddr, PCADDRP, sizeof(pcaddr));
-           }
-           dread(&pc, pcaddr, sizeof(pc));
-#       else vax || tahoe
-           if (p->status == STOPPED) {
-               if (isbperr()) {
-                   pc = p->reg[PCREG];
-               } else {
-                   dread(&pcframe, PCADDRP, sizeof(pcframe));
-#ifdef tahoe
-                   pcframe += 14;
-#else
-                   pcframe++;
-#endif
-                   pc = fetchpc(pcframe);
-               }
-               pc -= (sizeof(char) + ENDOFF);
-           }
-#       endif
+       dread(&pc, PCADDR, sizeof(pc));         /* Get pcode pc */
        if (option('e')) {
            printf("execution stops at pc 0x%x, lc %d on sig %d\n",
                process->pc, pc, p->signo);
        if (option('e')) {
            printf("execution stops at pc 0x%x, lc %d on sig %d\n",
                process->pc, pc, p->signo);
@@ -95,85 +61,6 @@ resume()
      */
 }
 
      */
 }
 
-#if defined(vax) || defined(tahoe)
-
-/*
- * Find the location in the Pascal object where execution was suspended.
- *
- * We basically walk back through the frames looking for saved
- * register PCREG's.  Each time we find one, we remember it.  When we reach
- * the frame associated with the interpreter procedure, the most recently
- * saved register PCREG is the one we want.
- */
-
-typedef struct {
-#ifdef vax
-    int fr_handler;
-    unsigned int fr_psw : 16;   /* saved psw */
-    unsigned int fr_mask : 12;  /* register save mask */
-    unsigned int fr_unused : 1;
-    unsigned int fr_s : 1;      /* call was a calls, not callg */
-    unsigned int fr_spa : 2;    /* stack pointer alignment */
-    unsigned int fr_savap;      /* saved arg pointer */
-    unsigned int fr_savfp;      /* saved frame pointer */
-    int fr_savpc;           /* saved program counter */
-#endif
-#ifdef tahoe
-    int fr_savpc;           /* saved program counter */
-    unsigned short fr_mask;     /* register save mask */
-    unsigned short fr_removed;  /* (nargs+1)*4 */
-    unsigned int fr_savfp;      /* saved frame pointer */
-#endif
-} Stkframe;
-
-#define regsaved(frame, n) ((frame.fr_mask&(1 << n)) != 0)
-
-LOCAL ADDRESS fetchpc(framep)
-ADDRESS *framep;
-{
-    register PROCESS *p;
-    Stkframe sframe;
-#ifdef tahoe
-#define        PCREGLOC        (-1)
-#else
-#define        PCREGLOC        (sizeof sframe/sizeof(ADDRESS))
-#endif
-    ADDRESS *savfp;
-    ADDRESS r;
-
-    p = process;
-    r = p->reg[PCREG];
-    if (p->fp == (ADDRESS) framep) {
-       return r;
-    }
-    savfp = (ADDRESS *) p->fp;
-#ifdef tahoe
-    savfp -= 2;
-#endif
-    dread(&sframe, savfp, sizeof(sframe));
-    while (sframe.fr_savfp != (int) framep && sframe.fr_savfp != 0) {
-       if (regsaved(sframe, PCREG)) {
-           dread(&r, savfp + PCREGLOC, sizeof(r));
-           r -= sizeof(char);
-       }
-       savfp = (ADDRESS *) sframe.fr_savfp;
-#ifdef tahoe
-       savfp -= 2;
-#endif
-       dread(&sframe, savfp, sizeof(sframe));
-    }
-    if (sframe.fr_savfp == 0) {
-       panic("resume: can't find interpreter frame 0x%x", framep);
-    }
-    if (regsaved(sframe, PCREG)) {
-       dread(&r, savfp + PCREGLOC, sizeof(r));
-       r -= sizeof(char);
-    }
-    return(r);
-}
-
-#endif
-
 /*
  * Under the -r option, we offer the opportunity to just get
  * the px traceback and not actually enter the debugger.
 /*
  * Under the -r option, we offer the opportunity to just get
  * the px traceback and not actually enter the debugger.
index 2685966..18097d2 100644 (file)
@@ -5,7 +5,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)start.c    5.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)start.c    5.3 (Berkeley) %G%";
 #endif not lint
 
 /*
 #endif not lint
 
 /*
@@ -41,7 +41,7 @@ char *infile, *outfile;
     char *cmd;
 
     setsigtrace();
     char *cmd;
 
     setsigtrace();
-    cmd = "/usr/ucb/px";
+    cmd = "px";
     pstart(process, cmd, argv, infile, outfile);
     if (process->status == STOPPED) {
        TRAPARGS *ap, t;
     pstart(process, cmd, argv, infile, outfile);
     if (process->status == STOPPED) {
        TRAPARGS *ap, t;
@@ -83,7 +83,7 @@ char *infile, *outfile;
        DISPLAY = t.disp;
        DP = t.dp;
        ENDOFF = t.objstart;
        DISPLAY = t.disp;
        DP = t.dp;
        ENDOFF = t.objstart;
-       PCADDRP = t.pcaddrp;
+       PCADDR = t.pcaddr;
        LOOPADDR = t.loopaddr;
        pc = 0;
        curfunc = program;
        LOOPADDR = t.loopaddr;
        pc = 0;
        curfunc = program;
index b59a7db..0db8796 100644 (file)
@@ -5,13 +5,37 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)callproc.c 5.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)callproc.c 5.3 (Berkeley) %G%";
 #endif not lint
 
 /*
  * Evaluate a call to a procedure.
  *
  * This file is a botch as far as modularity is concerned.
 #endif not lint
 
 /*
  * Evaluate a call to a procedure.
  *
  * This file is a botch as far as modularity is concerned.
+ *
+ * In fact, FIXME, it does not work on either the Vax or Tahoe
+ * at this point (Sep 22, 1988).  It possibly doesn't work because
+ * the ptrace interface never sets "pc" back into the interpreter's
+ * program counter location.
+ *
+ * Due to portability changes
+ * in px for ANSI C, it is now even further broken, since the operand
+ * stack is no longer the system stack and since the interpreter's
+ * "pc" that we see is never read by the interpreter.  We could fix
+ * this, and increase the modularity, by:
+ *
+ *    * changing this whole module to build a string of bytecodes
+ *     that would: push a series of constant parameters, then call a
+ *     procedure, then take a breakpoint.
+ *    * Having px allocate a place for us to do this, and pass us the
+ *     address of this (otherwise unused) variable.
+ *    * Creating an entry point into the px interpreter which would
+ *     pick up the pc value from "*addrpc" and then enter the main loop.
+ *     Currently we never pick up *addrpc for speed.
+ *    * Fix the code below to use the new entry point rather than "loopaddr".
+ *
+ * But I suspect this code is dead enough that nobody will ever get
+ * around to it.               -- gnu@toad.com, 22Sep88
  */
 
 #include "defs.h"
  */
 
 #include "defs.h"
index 217137a..9cecffb 100644 (file)
@@ -3,9 +3,9 @@
 # All rights reserved.  The Berkeley software License Agreement
 # specifies the terms and conditions for redistribution.
 #
 # All rights reserved.  The Berkeley software License Agreement
 # specifies the terms and conditions for redistribution.
 #
-#      @(#)Makefile    5.5 (Berkeley) %G%
+#      @(#)Makefile    5.6 (Berkeley) %G%
 #
 #
-SCCSID = "@(#)Makefile 5.5 %G%"
+SCCSID = "@(#)Makefile 5.6 %G%"
 
 DESTDIR =
 BINDIR = /usr/ucb
 
 DESTDIR =
 BINDIR = /usr/ucb
@@ -13,9 +13,9 @@ LIBDIR = /usr/lib
 SRCDIR = ../src
 LIBPCDIR = ../../../usr.lib/libpc
 CC = cc
 SRCDIR = ../src
 LIBPCDIR = ../../../usr.lib/libpc
 CC = cc
-CFLAGS = -O -I${SRCDIR} -I${LIBPCDIR}
-OPT = /lib/c2
-AS = as
+CFLAGS = -O ${INCLUDES}
+INCLUDES = -I${SRCDIR} -I${LIBPCDIR}
+LINTFLAGS = -hbxc
 RM = rm -f
 
 PSHDR =        opc.c pic.c
 RM = rm -f
 
 PSHDR =        opc.c pic.c
@@ -26,24 +26,22 @@ PXSRC =     int.c interp.c utilities.c
 
 PXOBJ =        int.o interp.o utilities.o
 
 
 PXOBJ =        int.o interp.o utilities.o
 
-PXUTL =        ${MACHINE}.sed clean.sed version.c
+PXUTL =        version.c
 
 .c.o:
        ${CC} ${CFLAGS} -c $*.c
 
 px: Version.c ${PXOBJ}
        ${CC} ${CFLAGS} -o px Version.c ${PXOBJ} -lpc -lm
 
 .c.o:
        ${CC} ${CFLAGS} -c $*.c
 
 px: Version.c ${PXOBJ}
        ${CC} ${CFLAGS} -o px Version.c ${PXOBJ} -lpc -lm
+
+lint: Version.c ${PXSRC}
+       lint ${LINTFLAGS} ${INCLUDES} Version.c ${PXSRC} -lpc -lm
+
 Version.c: version.c
        ${CC} ${CFLAGS} -o version version.c
        ./version >Version.c
        ${RM}  version
 Version.c: version.c
        ${CC} ${CFLAGS} -o version version.c
        ./version >Version.c
        ${RM}  version
-interp.o interp.s: interp.c ${MACHINE}.sed
-       ${CC} -S -I${SRCDIR} -I${LIBPCDIR} interp.c
-       sed -f ${MACHINE}.sed <interp.s >tmp
-       ${OPT} tmp interp.s
-       /usr/lib/pc2 <interp.s >tmp
-       mv tmp interp.s
-       as -o interp.o interp.s
+
 h02opcs.h: ${SRCDIR}/OPnames.h opc.c
        ${CC} ${CFLAGS} opc.c -o opc
        ./opc >h02opcs.h
 h02opcs.h: ${SRCDIR}/OPnames.h opc.c
        ${CC} ${CFLAGS} opc.c -o opc
        ./opc >h02opcs.h
@@ -60,11 +58,8 @@ clean:
        ${RM} *.o *.s px version opc* pic*
        ${RM} h02opcs.h errs lpr core tmp
 
        ${RM} *.o *.s px version opc* pic*
        ${RM} h02opcs.h errs lpr core tmp
 
-prt: interp.s
-       sed -f clean.sed <interp.s
-
 grind: sources
 grind: sources
-       ${BINDIR}/ctags -v *.h *.c *.s | sort -f >index
+       ${BINDIR}/ctags -v *.h *.c | sort -f >index
        ${BINDIR}/vgrind -t -x index >lpr
        ${CC} ${CFLAGS} -o pic pic.c
        ${BINDIR}/vgrind -t -n READ_ME Makefile lst >>lpr
        ${BINDIR}/vgrind -t -x index >lpr
        ${CC} ${CFLAGS} -o pic pic.c
        ${BINDIR}/vgrind -t -n READ_ME Makefile lst >>lpr
@@ -98,6 +93,7 @@ depend:       sources
 Version.o: Version.c
 int.o: int.c
 interp.o: interp.c
 Version.o: Version.c
 int.o: int.c
 interp.o: interp.c
+opc.o: opc.c
 utilities.o: utilities.c
 version.o: version.c
 int.o: whoami.h
 utilities.o: utilities.c
 version.o: version.c
 int.o: whoami.h
@@ -110,6 +106,7 @@ interp.o: ../src/objfmt.h
 interp.o: h02opcs.h
 interp.o: machdep.h
 interp.o: ../../../usr.lib/libpc/libpc.h
 interp.o: h02opcs.h
 interp.o: machdep.h
 interp.o: ../../../usr.lib/libpc/libpc.h
+opc.o: ../src/OPnames.h
 utilities.o: whoami.h
 utilities.o: vars.h
 utilities.o: ../src/objfmt.h
 utilities.o: whoami.h
 utilities.o: vars.h
 utilities.o: ../src/objfmt.h
index ecb7bc2..bce1219 100644 (file)
@@ -11,7 +11,7 @@ char copyright[] =
 #endif not lint
 
 #ifndef lint
 #endif not lint
 
 #ifndef lint
-static char sccsid[] = "@(#)int.c      5.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)int.c      5.2 (Berkeley) %G%";
 #endif not lint
 
 /*
 #endif not lint
 
 /*
@@ -36,7 +36,8 @@ static char sccsid[] = "@(#)int.c     5.1 (Berkeley) %G%";
 
 extern char *end;
 extern loopaddr();
 
 extern char *end;
 extern loopaddr();
-union progcntr *pcaddrp;       /* address of interpreter frame address */
+extern union progcntr pdx_pc;  /* address of interpreter program cntr */
+static void inittrap();
 
 main(ac,av)
 
 
 main(ac,av)
 
@@ -156,7 +157,7 @@ main(ac,av)
         * See if we're being watched by the debugger, if so set a trap.
         */
        if (_mode == PDX || (_mode == PIX && pxhd.symtabsize > 0)) {
         * See if we're being watched by the debugger, if so set a trap.
         */
        if (_mode == PDX || (_mode == PIX && pxhd.symtabsize > 0)) {
-               inittrap(&_display, &_dp, objprog, &pcaddrp, loopaddr);
+               inittrap(&_display, &_dp, objprog, &pdx_pc, loopaddr);
        }
 
        /*
        }
 
        /*
@@ -183,11 +184,12 @@ main(ac,av)
  * not the procedure.
  */
 
  * not the procedure.
  */
 
-static inittrap(dispaddr, dpaddr, endaddr, pcaddrp, loopaddrp)
+static void
+inittrap(dispaddr, dpaddr, endaddr, pcaddr, loopaddrp)
 union disply *dispaddr;
 struct disp *dpaddr;
 char *endaddr;
 union disply *dispaddr;
 struct disp *dpaddr;
 char *endaddr;
-union progcntr **pcaddrp;
+union progcntr *pcaddr;
 char **loopaddrp;
 {
        kill(getpid(), SIGIOT);
 char **loopaddrp;
 {
        kill(getpid(), SIGIOT);
index cf67ff1..3635b11 100644 (file)
@@ -5,7 +5,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)interp.c   5.5 (Berkeley) %G%";
+static char sccsid[] = "@(#)interp.c   5.6 (Berkeley) %G%";
 #endif not lint
 
 #include <math.h>
 #endif not lint
 
 #include <math.h>
@@ -98,11 +98,15 @@ struct iorec        *_actfile[MAXFILES] = {
 };
 
 /*
 };
 
 /*
- * stuff for pdx
+ * stuff for pdx to watch what the interpreter is doing.
+ * The .globl is #ifndef DBX since it breaks DBX to have a global
+ * asm label in the middle of a function (see _loopaddr: below).
  */
 
  */
 
-union progcntr *pcaddrp;
+union progcntr pdx_pc;
+#ifndef DBX
 asm(".globl _loopaddr");
 asm(".globl _loopaddr");
+#endif DBX
 
 /*
  * Px profile array
 
 /*
  * Px profile array
@@ -119,11 +123,11 @@ char opc[10];
 long opcptr = 9;
 #endif PXDEBUG
 \f
 long opcptr = 9;
 #endif PXDEBUG
 \f
+void
 interpreter(base)
        char *base;
 {
 interpreter(base)
        char *base;
 {
-       union progcntr pc;              /* interpreted program cntr */
-       register char *vpc;             /* register used for "pc" */
+       /* register */ union progcntr pc;       /* interpreted program cntr */
        struct iorec *curfile;          /* active file */
        register struct blockmark *stp; /* active stack frame ptr */
        /*
        struct iorec *curfile;          /* active file */
        register struct blockmark *stp; /* active stack frame ptr */
        /*
@@ -132,6 +136,8 @@ interpreter(base)
        register char *tcp;
        register short *tsp;
        register long tl, tl1, tl2, tl3;
        register char *tcp;
        register short *tsp;
        register long tl, tl1, tl2, tl3;
+       char *tcp2;
+       long tl4;
        double td, td1;
        struct sze8 t8;
        register short *tsp1;
        double td, td1;
        struct sze8 t8;
        register short *tsp1;
@@ -140,19 +146,21 @@ interpreter(base)
        bool tb;
        struct blockmark *tstp;
        register struct formalrtn *tfp;
        bool tb;
        struct blockmark *tstp;
        register struct formalrtn *tfp;
-       union progcntr tpc;
        struct iorec **ip;
        int mypid;
        struct iorec **ip;
        int mypid;
+       int ti, ti2;
+       short ts;
+       FILE *tf;
+       /* register */ union progcntr stack;    /* Interpreted stack */
 
 
-       pcaddrp = &pc;
        mypid = getpid();
 
        /*
         * Setup sets up any hardware specific parameters before
        mypid = getpid();
 
        /*
         * Setup sets up any hardware specific parameters before
-        * starting the interpreter. Typically this is inline replaced
-        * by interp.sed to utilize specific machine instructions.
+        * starting the interpreter. Typically this is macro- or inline-
+        * replaced by "machdep.h" or interp.sed.
         */
         */
-        setup();
+       setup();
        /*
         * necessary only on systems which do not initialize
         * memory to zero
        /*
         * necessary only on systems which do not initialize
         * memory to zero
@@ -172,7 +180,6 @@ interpreter(base)
        _dp = &_display.frame[0];
        pc.cp = base;
 
        _dp = &_display.frame[0];
        pc.cp = base;
 
-       asm("_loopaddr:");
        for(;;) {
 #              ifdef PXDEBUG
                if (++opcptr == 10)
        for(;;) {
 #              ifdef PXDEBUG
                if (++opcptr == 10)
@@ -182,6 +189,24 @@ interpreter(base)
 #              ifdef PROFILE
                _profcnts[*pc.ucp]++;
 #              endif PROFILE
 #              ifdef PROFILE
                _profcnts[*pc.ucp]++;
 #              endif PROFILE
+
+               /*
+                * Save away the program counter to a fixed location for pdx.
+                */
+               pdx_pc = pc;
+
+               /*
+                * Having the label below makes dbx not work
+                * to debug this interpreter,
+                * since it thinks a new function called loopaddr()
+                * has started here, and it won't display the local
+                * variables of interpreter().  You have to compile
+                * -DDBX to avoid this problem...
+                */
+#              ifndef DBX
+       ;asm("_loopaddr:");
+#              endif DBX
+
                switch (*pc.ucp++) {
                case O_BPT:                     /* breakpoint trap */
                        PFLUSH();
                switch (*pc.ucp++) {
                case O_BPT:                     /* breakpoint trap */
                        PFLUSH();
@@ -836,15 +861,18 @@ interpreter(base)
                        continue;
                case O_NEG2:
                        pc.cp++;
                        continue;
                case O_NEG2:
                        pc.cp++;
-                       push4((long)(-pop2()));
+                       ts = -pop2();
+                       push4((long)ts);
                        continue;
                case O_NEG4:
                        pc.cp++;
                        continue;
                case O_NEG4:
                        pc.cp++;
-                       push4(-pop4());
+                       tl = -pop4();
+                       push4(tl);
                        continue;
                case O_NEG8:
                        pc.cp++;
                        continue;
                case O_NEG8:
                        pc.cp++;
-                       push8(-pop8());
+                       td = -pop8();
+                       push8(td);
                        continue;
                case O_DIV2:
                        pc.cp++;
                        continue;
                case O_DIV2:
                        pc.cp++;
@@ -920,7 +948,8 @@ interpreter(base)
                        continue;
                case O_STOI:
                        pc.cp++;
                        continue;
                case O_STOI:
                        pc.cp++;
-                       push4((long)(pop2()));
+                       ts = pop2();
+                       push4((long)ts);
                        continue;
                case O_STOD:
                        pc.cp++;
                        continue;
                case O_STOD:
                        pc.cp++;
@@ -934,7 +963,8 @@ interpreter(base)
                        continue;
                case O_ITOS:
                        pc.cp++;
                        continue;
                case O_ITOS:
                        pc.cp++;
-                       push2((short)(pop4()));
+                       tl = pop4();
+                       push2((short)tl);
                        continue;
                case O_DVD2:
                        pc.cp++;
                        continue;
                case O_DVD2:
                        pc.cp++;
@@ -1066,27 +1096,33 @@ interpreter(base)
                        continue;
                case O_IND1:
                        pc.cp++;
                        continue;
                case O_IND1:
                        pc.cp++;
-                       push2((short)(*popaddr()));
+                       ts = *popaddr();
+                       push2(ts);
                        continue;
                case O_IND14:
                        pc.cp++;
                        continue;
                case O_IND14:
                        pc.cp++;
-                       push4((long)(*popaddr()));
+                       ti = *popaddr();
+                       push4((long)ti);
                        continue;
                case O_IND2:
                        pc.cp++;
                        continue;
                case O_IND2:
                        pc.cp++;
-                       push2(*(short *)(popaddr()));
+                       ts = *(short *)(popaddr());
+                       push2(ts);
                        continue;
                case O_IND24:
                        pc.cp++;
                        continue;
                case O_IND24:
                        pc.cp++;
-                       push4((long)(*(short *)(popaddr())));
+                       ts = *(short *)(popaddr());
+                       push4((long)ts);
                        continue;
                case O_IND4:
                        pc.cp++;
                        continue;
                case O_IND4:
                        pc.cp++;
-                       push4(*(long *)(popaddr()));
+                       tl = *(long *)(popaddr());
+                       push4(tl);
                        continue;
                case O_IND8:
                        pc.cp++;
                        continue;
                case O_IND8:
                        pc.cp++;
-                       pushsze8(*(struct sze8 *)(popaddr()));
+                       t8 = *(struct sze8 *)(popaddr());
+                       pushsze8(t8);
                        continue;
                case O_IND:
                        tl = *pc.cp++;
                        continue;
                case O_IND:
                        tl = *pc.cp++;
@@ -1208,13 +1244,14 @@ interpreter(base)
                        continue;
                case O_STLIM:
                        pc.cp++;
                        continue;
                case O_STLIM:
                        pc.cp++;
-                       STLIM();
-                       popsp((long)(sizeof(long)));
+                       tl = pop4();
+                       STLIM(tl);
                        continue;
                case O_LLIMIT:
                        pc.cp++;
                        continue;
                case O_LLIMIT:
                        pc.cp++;
-                       LLIMIT();
-                       popsp((long)(sizeof(char *)+sizeof(long)));
+                       tcp = popaddr();
+                       tl = pop4();
+                       LLIMIT(tcp, tl);
                        continue;
                case O_BUFF:
                        BUFF((long)(*pc.cp++));
                        continue;
                case O_BUFF:
                        BUFF((long)(*pc.cp++));
@@ -1320,10 +1357,15 @@ interpreter(base)
                        tl = *pc.cp++;          /* tl has number of args */
                        if (tl == 0)
                                tl = *pc.usp++;
                        tl = *pc.cp++;          /* tl has number of args */
                        if (tl == 0)
                                tl = *pc.usp++;
-                       tl1 = tl * sizeof(long);
+                       tl1 = tl * sizeof(long);        /* Size of all args */
                        tcp = pushsp((long)(0)) + tl1; /* tcp pts to result */
                        tcp = pushsp((long)(0)) + tl1; /* tcp pts to result */
-                       CTTOT(tcp);
-                       popsp(tl*sizeof(long));
+                       tl1 = pop4();           /* Pop the 4 fixed args */
+                       tl2 = pop4();
+                       tl3 = pop4();
+                       tl4 = pop4();
+                       tcp2 = pushsp((long)0); /* tcp2 -> data values */
+                       CTTOTA(tcp, tl1, tl2, tl3, tl4, tcp2);
+                       popsp(tl*sizeof(long) - 4*sizeof(long)); /* Pop data */
                        continue;
                case O_CARD:
                        tl = *pc.cp++;          /* tl has comparison length */
                        continue;
                case O_CARD:
                        tl = *pc.cp++;          /* tl has comparison length */
@@ -1440,50 +1482,47 @@ interpreter(base)
                        continue;
                case O_EOF:
                        pc.cp++;
                        continue;
                case O_EOF:
                        pc.cp++;
-                       push2((short)(TEOF(popaddr())));
+                       tcp = popaddr();
+                       push2((short)(TEOF(tcp)));
                        continue;
                case O_EOLN:
                        pc.cp++;
                        continue;
                case O_EOLN:
                        pc.cp++;
-                       push2((short)(TEOLN(popaddr())));
+                       tcp = popaddr();
+                       push2((short)(TEOLN(tcp)));
                        continue;
                case O_WRITEC:
                        continue;
                case O_WRITEC:
+                       pc.cp++;
+                       ti = popint();
+                       tf = popfile();
                        if (_runtst) {
                        if (_runtst) {
-                               WRITEC(curfile);
-                               popsp((long)(*pc.cp++));
+                               WRITEC(curfile, ti, tf);
                                continue;
                        }
                                continue;
                        }
-                       tl = *pc.cp++;
-                       switch (tl - sizeof(FILE *)) {
-                       case 2:
-                               tl1 = pop2();
-                               break;
-                       case 4:
-                               tl1 = pop4();
-                               break;
-                       default:
-                               ERROR("Panic: bad size to O_WRITEC");
-                               /* NOT REACHED */
-                       }
-                       tcp = popaddr();
-                       fputc(tl1, tcp);
+                       fputc(ti, tf);
                        continue;
                case O_WRITES:
                        continue;
                case O_WRITES:
+                       pc.cp++;                /* Skip arg size */
+                       tf = popfile();
+                       ti = popint();
+                       ti2 = popint();
+                       tcp2 = popaddr();
                        if (_runtst) {
                        if (_runtst) {
-                               WRITES(curfile);
-                               popsp((long)(*pc.cp++));
+                               WRITES(curfile, tf, ti, ti2, tcp2);
                                continue;
                        }
                                continue;
                        }
-                       fwrite();
-                       popsp((long)(*pc.cp++));
+                       fwrite(tf, ti, ti2, tcp2);
                        continue;
                case O_WRITEF:
                        continue;
                case O_WRITEF:
+                       tf = popfile();
+                       tcp = popaddr();
+                       tcp2 = pushsp((long)0); /* Addr of printf's args */
                        if (_runtst) {
                        if (_runtst) {
-                               WRITEF(curfile);
-                               popsp((long)(*pc.cp++));
-                               continue;
+                               VWRITEF(curfile, tf, tcp, tcp2);
+                       } else {
+                               vfprintf(tf, tcp, tcp2);
                        }
                        }
-                       fprintf();
-                       popsp((long)(*pc.cp++));
+                       popsp((long)
+                           (*pc.cp++) - (sizeof (FILE *)) - sizeof (char *));
                        continue;
                case O_WRITLN:
                        pc.cp++;
                        continue;
                case O_WRITLN:
                        pc.cp++;
@@ -1554,22 +1593,32 @@ interpreter(base)
                        continue;
                case O_FNIL:
                        pc.cp++;
                        continue;
                case O_FNIL:
                        pc.cp++;
-                       pushaddr(FNIL(popaddr()));
+                       tcp = popaddr();
+                       pushaddr(FNIL(tcp));
                        continue;
                case O_DEFNAME:
                        pc.cp++;
                        continue;
                case O_DEFNAME:
                        pc.cp++;
-                       DEFNAME();
-                       popsp((long)(2*sizeof(char *)+2*sizeof(long)));
+                       tcp2 = popaddr();
+                       tcp = popaddr();
+                       tl = pop4();
+                       tl2 = pop4();
+                       DEFNAME((struct iorec *)tcp2, tcp, tl, tl2);
                        continue;
                case O_RESET:
                        pc.cp++;
                        continue;
                case O_RESET:
                        pc.cp++;
-                       RESET();
-                       popsp((long)(2*sizeof(char *)+2*sizeof(long)));
+                       tcp2 = popaddr();
+                       tcp = popaddr();
+                       tl = pop4();
+                       tl2 = pop4();
+                       RESET((struct iorec *)tcp2, tcp, tl, tl2);
                        continue;
                case O_REWRITE:
                        pc.cp++;
                        continue;
                case O_REWRITE:
                        pc.cp++;
-                       REWRITE();
-                       popsp((long)(2*sizeof(char *)+2*sizeof(long)));
+                       tcp2 = popaddr();
+                       tcp = popaddr();
+                       tl = pop4();
+                       tl2 = pop4();
+                       REWRITE((struct iorec *)tcp2, tcp, tl, tl2);
                        continue;
                case O_FILE:
                        pc.cp++;
                        continue;
                case O_FILE:
                        pc.cp++;
@@ -1577,23 +1626,36 @@ interpreter(base)
                        continue;
                case O_REMOVE:
                        pc.cp++;
                        continue;
                case O_REMOVE:
                        pc.cp++;
-                       REMOVE();
-                       popsp((long)(sizeof(char *)+sizeof(long)));
+                       tcp = popaddr();
+                       tl = pop4();
+                       REMOVE(tcp, tl);
                        continue;
                case O_FLUSH:
                        pc.cp++;
                        continue;
                case O_FLUSH:
                        pc.cp++;
-                       FLUSH();
-                       popsp((long)(sizeof(char *)));
+                       tcp = popaddr();
+                       FLUSH((struct iorec *)tcp);
                        continue;
                case O_PACK:
                        pc.cp++;
                        continue;
                case O_PACK:
                        pc.cp++;
-                       PACK();
-                       popsp((long)(5*sizeof(long)+2*sizeof(char*)));
+                       tl = pop4();
+                       tcp = popaddr();
+                       tcp2 = popaddr();
+                       tl1 = pop4();
+                       tl2 = pop4();
+                       tl3 = pop4();
+                       tl4 = pop4();
+                       PACK(tl, tcp, tcp2, tl1, tl2, tl3, tl4);
                        continue;
                case O_UNPACK:
                        pc.cp++;
                        continue;
                case O_UNPACK:
                        pc.cp++;
-                       UNPACK();
-                       popsp((long)(5*sizeof(long)+2*sizeof(char*)));
+                       tl = pop4();
+                       tcp = popaddr();
+                       tcp2 = popaddr();
+                       tl1 = pop4();
+                       tl2 = pop4();
+                       tl3 = pop4();
+                       tl4 = pop4();
+                       UNPACK(tl, tcp, tcp2, tl1, tl2, tl3, tl4);
                        continue;
                case O_ARGC:
                        pc.cp++;
                        continue;
                case O_ARGC:
                        pc.cp++;
@@ -1660,60 +1722,67 @@ interpreter(base)
                        continue;
                case O_ATAN:
                        pc.cp++;
                        continue;
                case O_ATAN:
                        pc.cp++;
+                       td = pop8();
                        if (_runtst) {
                        if (_runtst) {
-                               push8(ATAN(pop8()));
+                               push8(ATAN(td));
                                continue;
                        }
                                continue;
                        }
-                       push8(atan(pop8()));
+                       push8(atan(td));
                        continue;
                case O_COS:
                        pc.cp++;
                        continue;
                case O_COS:
                        pc.cp++;
+                       td = pop8();
                        if (_runtst) {
                        if (_runtst) {
-                               push8(COS(pop8()));
+                               push8(COS(td));
                                continue;
                        }
                                continue;
                        }
-                       push8(cos(pop8()));
+                       push8(cos(td));
                        continue;
                case O_EXP:
                        pc.cp++;
                        continue;
                case O_EXP:
                        pc.cp++;
+                       td = pop8();
                        if (_runtst) {
                        if (_runtst) {
-                               push8(EXP(pop8()));
+                               push8(EXP(td));
                                continue;
                        }
                                continue;
                        }
-                       push8(exp(pop8()));
+                       push8(exp(td));
                        continue;
                case O_LN:
                        pc.cp++;
                        continue;
                case O_LN:
                        pc.cp++;
+                       td = pop8();
                        if (_runtst) {
                        if (_runtst) {
-                               push8(LN(pop8()));
+                               push8(LN(td));
                                continue;
                        }
                                continue;
                        }
-                       push8(log(pop8()));
+                       push8(log(td));
                        continue;
                case O_SIN:
                        pc.cp++;
                        continue;
                case O_SIN:
                        pc.cp++;
+                       td = pop8();
                        if (_runtst) {
                        if (_runtst) {
-                               push8(SIN(pop8()));
+                               push8(SIN(td));
                                continue;
                        }
                                continue;
                        }
-                       push8(sin(pop8()));
+                       push8(sin(td));
                        continue;
                case O_SQRT:
                        pc.cp++;
                        continue;
                case O_SQRT:
                        pc.cp++;
+                       td = pop8();
                        if (_runtst) {
                        if (_runtst) {
-                               push8(SQRT(pop8()));
+                               push8(SQRT(td));
                                continue;
                        }
                                continue;
                        }
-                       push8(sqrt(pop8()));
+                       push8(sqrt(td));
                        continue;
                case O_CHR2:
                case O_CHR4:
                        pc.cp++;
                        continue;
                case O_CHR2:
                case O_CHR4:
                        pc.cp++;
+                       tl = pop4();
                        if (_runtst) {
                        if (_runtst) {
-                               push2((short)(CHR(pop4())));
+                               push2((short)(CHR(tl)));
                                continue;
                        }
                                continue;
                        }
-                       push2((short)(pop4()));
+                       push2((short)tl);
                        continue;
                case O_ODD2:
                case O_ODD4:
                        continue;
                case O_ODD2:
                case O_ODD4:
@@ -1797,15 +1866,18 @@ interpreter(base)
                        continue;
                case O_SEED:
                        pc.cp++;
                        continue;
                case O_SEED:
                        pc.cp++;
-                       push4(SEED(pop4()));
+                       tl = pop4();
+                       push4(SEED(tl));
                        continue;
                case O_RANDOM:
                        pc.cp++;
                        continue;
                case O_RANDOM:
                        pc.cp++;
-                       push8(RANDOM(pop8()));
+                       td = pop8();            /* Argument is ignored */
+                       push8(RANDOM());
                        continue;
                case O_EXPO:
                        pc.cp++;
                        continue;
                case O_EXPO:
                        pc.cp++;
-                       push4(EXPO(pop8()));
+                       td = pop8();
+                       push4(EXPO(td));
                        continue;
                case O_SQR2:
                case O_SQR4:
                        continue;
                case O_SQR2:
                case O_SQR4:
@@ -1820,11 +1892,13 @@ interpreter(base)
                        continue;
                case O_ROUND:
                        pc.cp++;
                        continue;
                case O_ROUND:
                        pc.cp++;
-                       push4(ROUND(pop8()));
+                       td = pop8();
+                       push4(ROUND(td));
                        continue;
                case O_TRUNC:
                        pc.cp++;
                        continue;
                case O_TRUNC:
                        pc.cp++;
-                       push4(TRUNC(pop8()));
+                       td = pop8();
+                       push4(TRUNC(td));
                        continue;
                default:
                        ERROR("Panic: bad op code\n");
                        continue;
                default:
                        ERROR("Panic: bad op code\n");
index b99dd94..a4addd8 100644 (file)
@@ -3,18 +3,28 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)machdep.h   5.2 (Berkeley) %G%
+ *     @(#)machdep.h   5.3 (Berkeley) %G%
  */
 
 #ifdef ADDR32
  */
 
 #ifdef ADDR32
-#define pushaddr push4
-#define popaddr (char *)pop4
+#define pushaddr(x)    push4((long)(x))
+#define popaddr()      (char *)pop4()
 #endif ADDR32
 #ifdef ADDR16
 #endif ADDR32
 #ifdef ADDR16
-#define pushaddr push2
-#define popaddr (char *)pop2
+#define pushaddr(x)    push2((short)(x))
+#define popaddr()      (char *)pop2()
 #endif ADDR16
 
 #endif ADDR16
 
+#define popfile()      (FILE *)(popaddr())
+
+#if defined(pdp11)
+#define        popint  pop2
+#define        pushint push2
+#else
+#define popint pop4
+#define pushint        push4
+#endif
+
 /*
  * Machine specific macros for reading quantities from the
  * interpreter instruction stream. Operands in the instruction
 /*
  * Machine specific macros for reading quantities from the
  * interpreter instruction stream. Operands in the instruction
        target = *tsp++ << 16, target += *(unsigned short *)tsp
 #define STACKALIGN(target, value) target = ((value) + 3) &~ 3
 #endif tahoe
        target = *tsp++ << 16, target += *(unsigned short *)tsp
 #define STACKALIGN(target, value) target = ((value) + 3) &~ 3
 #endif tahoe
+
+/*
+ * The following macros implement all accesses to the interpreter stack.
+ *
+ * They used to be hard-coded assembler stuff massaged into the compiler
+ * output by sed scripts, but things are cleaner now.
+ *
+ * The STACKSIZE is an arbitrary value.  I picked 100K since it was unlikely
+ * that anybody's program would run out of stack.  Automatic allocation
+ * would be nice, maybe procedure call should check for enough space + slop
+ * and expand it if necessary.  Expanding the stack will require
+ * pointer relocation if it moves, though.  Probably better would be a
+ * command line option to set the stack size.
+ */
+#define        STACKSIZE       100000
+#define        setup()         { \
+       extern char *malloc(); \
+       stack.cp = STACKSIZE + malloc((unsigned)STACKSIZE); \
+       }
+#ifndef tahoe
+#define        push2(x)        (*--stack.sp) = (x)
+#else
+#define        push2(x)        (*--stack.lp) = (x) << 16
+#endif
+#define push4(x)       (*--stack.lp)  = (x)
+#define push8(x)       (*--stack.dbp) = (x)
+#define pushsze8(x)    (*--stack.s8p) = (x)
+#define pushsp(x)      (stack.cp -= (x))
+#ifndef tahoe
+#define pop2()         (*stack.sp++)
+#else
+#define pop2()         (*stack.lp++) >> 16
+#endif
+#define pop4()         (*stack.lp++)
+#define pop8()         (*stack.dbp++)
+#define popsze8()      (*stack.s8p++)
+#define popsp(x)       (void)(stack.cp += (x))
+#define        enableovrflo()  /*nop*/
+#define        disableovrflo() /*nop*/
index 08c64a3..68e90a4 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)vars.h      5.2 (Berkeley) %G%
+ *     @(#)vars.h      5.3 (Berkeley) %G%
  */
 
 #include <stdio.h>
  */
 
 #include <stdio.h>
@@ -92,11 +92,6 @@ extern liberr();
 struct sze8 {
        char element[8];
 };
 struct sze8 {
        char element[8];
 };
-extern short pop2();
-extern long pop4();
-extern double pop8();
-extern struct sze8 popsze8();
-extern char *pushsp();
 
 /*
  * emulated pc types
 
 /*
  * emulated pc types
@@ -109,6 +104,7 @@ union progcntr {
        long *lp;
        double *dbp;
        struct hdr *hdrp;
        long *lp;
        double *dbp;
        struct hdr *hdrp;
+       struct sze8 *s8p;
 };
 \f
 /*
 };
 \f
 /*
index 1580841..3cdf0f7 100644 (file)
@@ -5,7 +5,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)put.c      5.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)put.c      5.3 (Berkeley) %G%";
 #endif not lint
 
 #include "whoami.h"
 #endif not lint
 
 #include "whoami.h"
@@ -27,11 +27,15 @@ static char sccsid[] = "@(#)put.c   5.2 (Berkeley) %G%";
 #include "OPnames.h"
 #endif
 
 #include "OPnames.h"
 #endif
 
+char showit[] = "'x'";
+
 #ifdef OBJ
 /*
  * Put is responsible for the interpreter equivalent of code
  * generation.  Since the interpreter is specifically designed
  * for Pascal, little work is required here.
 #ifdef OBJ
 /*
  * Put is responsible for the interpreter equivalent of code
  * generation.  Since the interpreter is specifically designed
  * for Pascal, little work is required here.
+ *
+ * FIXME, this should be converted to use <varargs.h> or <stdarg.h>.
  */
 /*VARARGS*/
 put(a)
  */
 /*VARARGS*/
 put(a)
@@ -214,7 +218,7 @@ put(a)
                        break;
                case O_CONC:
 #ifdef DEBUG
                        break;
                case O_CONC:
 #ifdef DEBUG
-                       (string = "'x'")[1] = p[1];
+                       (string = showit)[1] = p[1];
 #endif
                        suboppr = 0;
                        op = O_CON1;
 #endif
                        suboppr = 0;
                        op = O_CON1;
@@ -225,7 +229,7 @@ put(a)
                        goto around;
                case O_CONC4:
 #ifdef DEBUG
                        goto around;
                case O_CONC4:
 #ifdef DEBUG
-                       (string = "'x'")[1] = p[1];
+                       (string = showit)[1] = p[1];
 #endif
                        suboppr = 0;
                        op = O_CON14;
 #endif
                        suboppr = 0;
                        op = O_CON14;
index f16c35a..4ef68f0 100644 (file)
@@ -5,7 +5,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)savenl.c   5.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)savenl.c   5.2 (Berkeley) %G%";
 #endif not lint
 
 /*
 #endif not lint
 
 /*
@@ -56,10 +56,10 @@ static char sccsid[] = "@(#)savenl.c        5.1 (Berkeley) %G%";
 #include "../pdx/mappings.h"
 #include "../pdx/mappings/filetab.h"
 
 #include "../pdx/mappings.h"
 #include "../pdx/mappings/filetab.h"
 
-LOCAL char *symname = "/tmp/obj.symXXXX";
-LOCAL char *strname = "/tmp/obj.strXXXX";
-LOCAL char *filesname = "/tmp/obj.filesXXXX";
-LOCAL char *linesname = "/tmp/obj.linesXXXX";
+LOCAL char symname[] = "/tmp/obj.symXXXXXX";
+LOCAL char strname[] = "/tmp/obj.strXXXXXX";
+LOCAL char filesname[] = "/tmp/obj.filesXXXXXX";
+LOCAL char linesname[] = "/tmp/obj.linesXXXXXX";
 
 LOCAL FILE *symfp;
 LOCAL FILE *strfp;
 
 LOCAL FILE *symfp;
 LOCAL FILE *strfp;
@@ -70,6 +70,9 @@ LOCAL long nlsize;
 
 extern FILE *fopen();
 
 
 extern FILE *fopen();
 
+LOCAL putblock();
+LOCAL putstring();
+
 /*
  * create temporary files for the namelist info
  */
 /*
  * create temporary files for the namelist info
  */