SCCS-vsn: usr.bin/pascal/px/int.c 1.7
SCCS-vsn: usr.bin/pascal/px/utilities.c 1.5
SCCS-vsn: usr.bin/pascal/px/Makefile 1.10
SCCS-vsn: usr.bin/pascal/px/vars.h 1.9
SCCS-vsn: usr.bin/pascal/px/interp.c 1.19
-SCCSID = "@(#)Makefile 1.9 %G%"
+SCCSID = "@(#)Makefile 1.10 %G%"
-PXSRC = int.c interp.c except.c utilities.c
+PXSRC = int.c interp.c utilities.c
-PXOBJ = int.o interp.o except.o utilities.o
+PXOBJ = int.o interp.o utilities.o
-PXUTL = make.ed1 panics interp.sed clean.sed version.c
+PXUTL = interp.sed clean.sed version.c
sources: ${PXHDR} ${PXSRC} ${PXUTL}
${PSHDR}:
sources: ${PXHDR} ${PXSRC} ${PXUTL}
${PSHDR}:
/usr/lib/pc2 <interp.s >tmp
mv tmp interp.s
as -o interp.o interp.s
/usr/lib/pc2 <interp.s >tmp
mv tmp interp.s
as -o interp.o interp.s
-panics.h: panics make.ed1
- ex - <make.ed1
h02opcs.h: OPnames.h opc.c
${CC} ${CFLAGS} opc.c -o opc
./opc >h02opcs.h
h02opcs.h: OPnames.h opc.c
${CC} ${CFLAGS} opc.c -o opc
./opc >h02opcs.h
clean:
${RM} *.o *.s px version opc* pic* OPnames.h objfmt.h libpc.h\
clean:
${RM} *.o *.s px version opc* pic* OPnames.h objfmt.h libpc.h\
- panics.h h02opcs.h errs lpr core tmp
+ h02opcs.h errs lpr core tmp
prt: interp.s
sed -f clean.sed <interp.s
prt: interp.s
sed -f clean.sed <interp.s
${SRCDIR}/vgrind -t -x index >lpr
${CC} ${CFLAGS} -o pic pic.c
${SRCDIR}/vgrind -t -n READ_ME makefile lst >>lpr
${SRCDIR}/vgrind -t -x index >lpr
${CC} ${CFLAGS} -o pic pic.c
${SRCDIR}/vgrind -t -n READ_ME makefile lst >>lpr
- ${SRCDIR}/vgrind -t ${PCHDR} ${PXHDR} objfmt.h panics.h whoami.h >>lpr
+ ${SRCDIR}/vgrind -t ${PCHDR} ${PXHDR} objfmt.h whoami.h >>lpr
${SRCDIR}/vgrind -t ${PXSRC} >>lpr
./pic >lst
${SRCDIR}/vpr lst
${SRCDIR}/vgrind -t ${PXSRC} >>lpr
./pic >lst
${SRCDIR}/vpr lst
# DO NOT DELETE THIS LINE -- make depend uses it
# DEPENDENCIES MUST END AT END OF FILE
# DO NOT DELETE THIS LINE -- make depend uses it
# DEPENDENCIES MUST END AT END OF FILE
-except.o: whoami.h
-except.o: panics.h
-except.o: vars.h
int.o: whoami.h
int.o: vars.h
int.o: objfmt.h
interp.o: whoami.h
interp.o: objfmt.h
interp.o: vars.h
int.o: whoami.h
int.o: vars.h
int.o: objfmt.h
interp.o: whoami.h
interp.o: objfmt.h
interp.o: vars.h
interp.o: h02opcs.h
interp.o: machdep.h
interp.o: libpc.h
interp.o: h02opcs.h
interp.o: machdep.h
interp.o: libpc.h
pic.o: OPnames.h
utilities.o: whoami.h
utilities.o: vars.h
pic.o: OPnames.h
utilities.o: whoami.h
utilities.o: vars.h
utilities.o: h02opcs.h
# DEPENDENCIES MUST END AT END OF FILE
# IF YOU PUT STUFF HERE IT WILL GO AWAY
utilities.o: h02opcs.h
# DEPENDENCIES MUST END AT END OF FILE
# IF YOU PUT STUFF HERE IT WILL GO AWAY
/* Copyright (c) 1979 Regents of the University of California */
/* Copyright (c) 1979 Regents of the University of California */
-static char sccsid[] = "@(#)int.c 1.6 %G%";
+static char sccsid[] = "@(#)int.c 1.7 %G%";
/*
* px - interpreter for Berkeley Pascal
/*
* px - interpreter for Berkeley Pascal
#include <signal.h>
#include "whoami.h"
#include "vars.h"
#include <signal.h>
#include "whoami.h"
#include "vars.h"
if (signal(SIGINT,SIG_IGN) != SIG_IGN)
signal(SIGINT,intr);
signal(SIGSEGV,memsize);
if (signal(SIGINT,SIG_IGN) != SIG_IGN)
signal(SIGINT,intr);
signal(SIGSEGV,memsize);
signal(SIGTRAP,liberr);
/*
signal(SIGTRAP,liberr);
/*
signal(SIGBUS,SIG_DFL);
signal(SIGSYS,SIG_DFL);
PFLUSH();
signal(SIGBUS,SIG_DFL);
signal(SIGSYS,SIG_DFL);
PFLUSH();
/* Copyright (c) 1979 Regents of the University of California */
/* Copyright (c) 1979 Regents of the University of California */
-static char sccsid[] = "@(#)interp.c 1.18 %G%";
+static char sccsid[] = "@(#)interp.c 1.19 %G%";
#include <math.h>
#include "whoami.h"
#include "objfmt.h"
#include "vars.h"
#include <math.h>
#include "whoami.h"
#include "objfmt.h"
#include "vars.h"
#include "h02opcs.h"
#include "machdep.h"
#include "libpc.h"
#include "h02opcs.h"
#include "machdep.h"
#include "libpc.h"
continue;
case O_LINO:
if (_dp->stp->tos != pushsp((long)(0)))
continue;
case O_LINO:
if (_dp->stp->tos != pushsp((long)(0)))
+ ERROR("Panic: stack not empty between statements\n");
_lino = *pc.cp++; /* set line number */
if (_lino == 0)
_lino = *pc.sp++;
_lino = *pc.cp++; /* set line number */
if (_lino == 0)
_lino = *pc.sp++;
tl = pop4();
tl1 = pop4();
cmplong:
tl = pop4();
tl1 = pop4();
cmplong:
- tl2 = *pc.cp++;
- switch (tl2) {
case releq:
push2(tl1 == tl);
continue;
case releq:
push2(tl1 == tl);
continue;
push2(tl1 >= tl);
continue;
default:
push2(tl1 >= tl);
continue;
default:
+ ERROR("Panic: bad relation %d to REL4*\n",
+ *(pc.cp - 1));
tb = RELSGE(tl, tcp + tl1, tcp);
break;
default:
tb = RELSGE(tl, tcp + tl1, tcp);
break;
default:
+ ERROR("Panic: bad relation %d to RELG*\n", tl2);
break;
}
popsp(tl1 << 1);
break;
}
popsp(tl1 << 1);
tb = RELTGE(tl1, tcp + tl1, tcp);
break;
default:
tb = RELTGE(tl1, tcp + tl1, tcp);
break;
default:
+ ERROR("Panic: bad relation %d to RELT*\n", tl2);
break;
}
popsp(tl1 << 1);
break;
}
popsp(tl1 << 1);
push2(td1 >= td);
continue;
default:
push2(td1 >= td);
continue;
default:
+ ERROR("Panic: bad relation %d to REL8*\n",
+ *(pc.cp - 1));
continue;
case O_HALT:
pc.cp++;
continue;
case O_HALT:
pc.cp++;
+ if (_nodump == TRUE)
+ psexit(0);
+ fputs("\nCall to procedure halt\n", stderr);
+ backtrace("Halted");
+ psexit(0);
continue;
case O_PXPBUF:
pc.cp++;
continue;
case O_PXPBUF:
pc.cp++;
push4(TRUNC(pop8()));
continue;
default:
push4(TRUNC(pop8()));
continue;
default:
+ ERROR("Panic: bad op code\n");
/* Copyright (c) 1979 Regents of the University of California */
/* Copyright (c) 1979 Regents of the University of California */
-static char sccsid[] = "@(#)utilities.c 1.4 %G%";
+static char sccsid[] = "@(#)utilities.c 1.5 %G%";
#include "whoami.h"
#include "vars.h"
#include "whoami.h"
#include "vars.h"
#include "h02opcs.h"
stats()
#include "h02opcs.h"
stats()
-backtrace(errnum)
- int errnum;
+backtrace(type)
+ char *type;
{
register struct disp *mydp;
register struct stack *ap;
{
register struct disp *mydp;
register struct stack *ap;
return;
}
disp = _display;
return;
}
disp = _display;
- if (errnum == PINTR)
- fputs("\n\tInterrupted in \"",stderr);
- else if (errnum == PHALT)
- fputs("\n\tHalted in \"",stderr);
- else
- fputs("\n\tError in \"",stderr);
+ fprintf(stderr, "\n\t%s in \"", type);
mydp = _dp;
linum = _lino;
for (;;) {
mydp = _dp;
linum = _lino;
for (;;) {
*mydp = (ap)->odisp;
if (mydp <= &_display.frame[1]){
_display = disp;
*mydp = (ap)->odisp;
if (mydp <= &_display.frame[1]){
_display = disp;
}
mydp = (ap)->dp;
linum = (ap)->lino;
}
mydp = (ap)->dp;
linum = (ap)->lino;
+
+/*
+ * Routines to field various types of signals
+ *
+ * catch a library error and generate a backtrace
+ */
+liberr()
+{
+ backtrace("Error");
+ psexit(2);
+}
+
+/*
+ * catch an interrupt and generate a backtrace
+ */
+intr()
+{
+ signal(SIGINT, intr);
+ backtrace("Interrupted");
+ psexit(1);
+}
+
+/*
+ * catch memory faults
+ */
+memsize()
+{
+ signal(SIGSEGV, memsize);
+ ERROR("Run time stack overflow\n");
+}
+
+/*
+ * catch random system faults
+ */
+syserr(signum)
+ int signum;
+{
+ signal(signum, syserr);
+ ERROR("Panic: Computational error in interpreter\n");
+}
/* Copyright (c) 1979 Regents of the University of California */
/* Copyright (c) 1979 Regents of the University of California */
-/* static char sccsid[] = "@(#)vars.h 1.8 %G%"; */
+/* static char sccsid[] = "@(#)vars.h 1.9 %G%"; */
* interp.c Driver including main interpreter loop and
* the interpreter instructions grouped by their
* positions in the interpreter table.
* interp.c Driver including main interpreter loop and
* the interpreter instructions grouped by their
* positions in the interpreter table.
- * except.c Handlers for interpreter specific errors not
- * included in libpc.
* utilities.c Interpreter exit, backtrace, and runtime statistics.
*
* In addition there are several headers defining mappings for panic
* utilities.c Interpreter exit, backtrace, and runtime statistics.
*
* In addition there are several headers defining mappings for panic
extern long time();
extern intr();
extern memsize();
extern long time();
extern intr();
extern memsize();
extern syserr();
extern liberr();
extern syserr();
extern liberr();