SCCS-vsn: usr.bin/pascal/px/interp.c 1.30
/* Copyright (c) 1979 Regents of the University of California */
/* Copyright (c) 1979 Regents of the University of California */
-static char sccsid[] = "@(#)interp.c 1.29 %G%";
+static char sccsid[] = "@(#)interp.c 1.30 %G%";
#include <math.h>
#include <signal.h>
#include <math.h>
#include <signal.h>
register struct formalrtn *tfp;
union progcntr tpc;
struct iorec **ip;
register struct formalrtn *tfp;
union progcntr tpc;
struct iorec **ip;
/*
* Setup sets up any hardware specific parameters before
/*
* Setup sets up any hardware specific parameters before
switch (*pc.ucp++) {
case O_BPT: /* breakpoint trap */
PFLUSH();
switch (*pc.ucp++) {
case O_BPT: /* breakpoint trap */
PFLUSH();
- kill(getpid(), SIGILL);
pc.ucp--;
continue;
case O_NODUMP:
pc.ucp--;
continue;
case O_NODUMP:
popsp((long)(sizeof(long)+sizeof(char *)));
continue;
case O_FOR1U:
popsp((long)(sizeof(long)+sizeof(char *)));
continue;
case O_FOR1U:
- tl1 = *pc.cp++; /* tl1 index lower bound */
+ tl1 = *pc.cp++; /* tl1 loop branch */
if (tl1 == 0)
tl1 = *pc.sp++;
tcp = popaddr(); /* tcp = ptr to index var */
if (tl1 == 0)
tl1 = *pc.sp++;
tcp = popaddr(); /* tcp = ptr to index var */
- tl = pop4();
- if (*tcp < tl) { /* still going up */
- tl = *tcp + 1; /* inc index var */
- tl2 = *pc.sp++; /* index upper bound */
- if (_runtst)
- RANG4(tl, tl1, tl2);
- *tcp = tl; /* update index var */
- pc.cp += *pc.sp;/* return to top of loop */
+ tl = pop4(); /* tl upper bound */
+ if (*tcp == tl) /* loop is done, fall through */
- }
- pc.sp += 2; /* else fall through */
+ *tcp += 1; /* inc index var */
+ pc.cp += tl1; /* return to top of loop */
- tl1 = *pc.cp++; /* tl1 index lower bound */
+ tl1 = *pc.cp++; /* tl1 loop branch */
if (tl1 == 0)
tl1 = *pc.sp++;
tsp = (short *)popaddr(); /* tsp = ptr to index var */
if (tl1 == 0)
tl1 = *pc.sp++;
tsp = (short *)popaddr(); /* tsp = ptr to index var */
- tl = pop4();
- if (*tsp < tl) { /* still going up */
- tl = *tsp + 1; /* inc index var */
- tl2 = *pc.sp++; /* index upper bound */
- if (_runtst)
- RANG4(tl, tl1, tl2);
- *tsp = tl; /* update index var */
- pc.cp += *pc.sp;/* return to top of loop */
+ tl = pop4(); /* tl upper bound */
+ if (*tsp == tl) /* loop is done, fall through */
- }
- pc.sp += 2; /* else fall through */
+ *tsp += 1; /* inc index var */
+ pc.cp += tl1; /* return to top of loop */
- tl1 = *pc.cp++; /* tl1 index lower bound */
+ tl1 = *pc.cp++; /* tl1 loop branch */
tlp = (long *)popaddr(); /* tlp = ptr to index var */
tlp = (long *)popaddr(); /* tlp = ptr to index var */
- tl = pop4();
- if (*tlp < tl) { /* still going up */
- tl = *tlp + 1; /* inc index var */
- tl2 = *pc.lp++; /* index upper bound */
- if (_runtst)
- RANG4(tl, tl1, tl2);
- *tlp = tl; /* update index var */
- pc.cp += *pc.sp;/* return to top of loop */
+ tl = pop4(); /* tl upper bound */
+ if (*tlp == tl) /* loop is done, fall through */
- }
- pc.sp += 3; /* else fall through */
+ *tlp += 1; /* inc index var */
+ pc.cp += tl1; /* return to top of loop */
- tl1 = *pc.cp++; /* tl1 index lower bound */
+ tl1 = *pc.cp++; /* tl1 loop branch */
if (tl1 == 0)
tl1 = *pc.sp++;
tcp = popaddr(); /* tcp = ptr to index var */
if (tl1 == 0)
tl1 = *pc.sp++;
tcp = popaddr(); /* tcp = ptr to index var */
- tl = pop4();
- if (*tcp > tl) { /* still going down */
- tl = *tcp - 1; /* inc index var */
- tl2 = *pc.sp++; /* index upper bound */
- if (_runtst)
- RANG4(tl, tl1, tl2);
- *tcp = tl; /* update index var */
- pc.cp += *pc.sp;/* return to top of loop */
+ tl = pop4(); /* tl upper bound */
+ if (*tcp == tl) /* loop is done, fall through */
- }
- pc.sp += 2; /* else fall through */
+ *tcp -= 1; /* dec index var */
+ pc.cp += tl1; /* return to top of loop */
- tl1 = *pc.cp++; /* tl1 index lower bound */
+ tl1 = *pc.cp++; /* tl1 loop branch */
if (tl1 == 0)
tl1 = *pc.sp++;
tsp = (short *)popaddr(); /* tsp = ptr to index var */
if (tl1 == 0)
tl1 = *pc.sp++;
tsp = (short *)popaddr(); /* tsp = ptr to index var */
- tl = pop4();
- if (*tsp > tl) { /* still going down */
- tl = *tsp - 1; /* inc index var */
- tl2 = *pc.sp++; /* index upper bound */
- if (_runtst)
- RANG4(tl, tl1, tl2);
- *tsp = tl; /* update index var */
- pc.cp += *pc.sp;/* return to top of loop */
+ tl = pop4(); /* tl upper bound */
+ if (*tsp == tl) /* loop is done, fall through */
- }
- pc.sp += 2; /* else fall through */
+ *tsp -= 1; /* dec index var */
+ pc.cp += tl1; /* return to top of loop */
- tl1 = *pc.cp++; /* tl1 index lower bound */
+ tl1 = *pc.cp++; /* tl1 loop branch */
tlp = (long *)popaddr(); /* tlp = ptr to index var */
tlp = (long *)popaddr(); /* tlp = ptr to index var */
- tl = pop4();
- if (*tlp > tl) { /* still going down */
- tl = *tlp - 1; /* inc index var */
- tl2 = *pc.lp++; /* index upper bound */
- if (_runtst)
- RANG4(tl, tl1, tl2);
- *tlp = tl; /* update index var */
- pc.cp += *pc.sp;/* return to top of loop */
+ tl = pop4(); /* tl upper bound */
+ if (*tlp == tl) /* loop is done, fall through */
- }
- pc.sp += 3; /* else fall through */
+ *tlp -= 1; /* dec index var */
+ pc.cp += tl1; /* return to top of loop */
continue;
case O_READE:
pc.cp++;
continue;
case O_READE:
pc.cp++;