put display save area back into formal routine structure
[unix-history] / usr / src / usr.bin / pascal / px / interp.c
index e50ceda..b12ff75 100644 (file)
@@ -1,6 +1,6 @@
 /* Copyright (c) 1979 Regents of the University of California */
 
 /* Copyright (c) 1979 Regents of the University of California */
 
-static char sccsid[] = "@(#)interp.c 1.11 %G%";
+static char sccsid[] = "@(#)interp.c 1.13 %G%";
 
 #include <math.h>
 #include "whoami.h"
 
 #include <math.h>
 #include "whoami.h"
@@ -224,12 +224,12 @@ interpreter(base)
                        stp->lino = _lino;      /* save lino, pc, dp */
                        stp->pc.cp = pc.cp;
                        stp->dp = _dp;
                        stp->lino = _lino;      /* save lino, pc, dp */
                        stp->pc.cp = pc.cp;
                        stp->dp = _dp;
-                       pc.cp = tfp->entryaddr; /* calc new entry point */
-                       _dp = &_display.frame[tfp->cbn];/* new display ptr */
-                       blkcpy(tfp->cbn * sizeof(struct disp),
-                               &_display.frame[1], &tfp->disp[tfp->cbn]);
-                       blkcpy(tfp->cbn * sizeof(struct disp),
-                               &tfp->disp[0], &_display.frame[1]);
+                       pc.cp = tfp->fentryaddr;/* calc new entry point */
+                       _dp = &_display.frame[tfp->fbn];/* new display ptr */
+                       blkcpy(tfp->fbn * sizeof(struct disp),
+                               &_display.frame[1], &tfp->fdisp[tfp->fbn]);
+                       blkcpy(tfp->fbn * sizeof(struct disp),
+                               &tfp->fdisp[0], &_display.frame[1]);
                        continue;
                case O_FRTN:
                        tl = *pc.cp++;          /* tl = size of return obj */
                        continue;
                case O_FRTN:
                        tl = *pc.cp++;          /* tl = size of return obj */
@@ -237,19 +237,22 @@ interpreter(base)
                                tl = *pc.usp++;
                        tcp = pushsp((long)(0));
                        tfp = *(struct formalrtn **)(tcp + tl);
                                tl = *pc.usp++;
                        tcp = pushsp((long)(0));
                        tfp = *(struct formalrtn **)(tcp + tl);
-                       blkcpy(tl, tcp, tcp + sizeof(struct formalrtn *));
+                       if (tl != 0) {
+                               blkcpy(tl, tcp,
+                                   tcp + sizeof(struct formalrtn *));
+                       }
                        popsp((long)(sizeof(struct formalrtn *)));
                        popsp((long)(sizeof(struct formalrtn *)));
-                       blkcpy(tfp->cbn * sizeof(struct disp),
-                               &tfp->disp[tfp->cbn], &_display.frame[1]);
+                       blkcpy(tfp->fbn * sizeof(struct disp),
+                           &tfp->fdisp[tfp->fbn], &_display.frame[1]);
                        continue;
                case O_FSAV:
                        tfp = (struct formalrtn *)popaddr();
                        continue;
                case O_FSAV:
                        tfp = (struct formalrtn *)popaddr();
-                       tfp->cbn = *pc.cp++;    /* blk number of routine */
-                       tcp = base + *pc.lp++;/* calc new entry point */
+                       tfp->fbn = *pc.cp++;    /* blk number of routine */
+                       tcp = base + *pc.lp++;  /* calc new entry point */
                        tcp += sizeof(short);
                        tcp += sizeof(short);
-                       tfp->entryaddr = base + *(long *)tcp;
-                       blkcpy(tfp->cbn * sizeof(struct disp),
-                               &_display.frame[1], &tfp->disp[0]);
+                       tfp->fentryaddr = base + *(long *)tcp;
+                       blkcpy(tfp->fbn * sizeof(struct disp),
+                               &_display.frame[1], &tfp->fdisp[0]);
                        pushaddr(tfp);
                        continue;
                case O_SDUP2:
                        pushaddr(tfp);
                        continue;
                case O_SDUP2: