take size last to be compatable with bzero/bcopy
SCCS-vsn: usr.bin/pascal/px/interp.c 1.25
/* Copyright (c) 1979 Regents of the University of California */
/* Copyright (c) 1979 Regents of the University of California */
-static char sccsid[] = "@(#)interp.c 1.24 %G%";
+static char sccsid[] = "@(#)interp.c 1.25 %G%";
#include <math.h>
#include "whoami.h"
#include <math.h>
#include "whoami.h"
stp->file = curfile; /* save active file */
tcp = pushsp(tl1); /* tcp = new top of stack */
if (_runtst) /* zero stack frame */
stp->file = curfile; /* save active file */
tcp = pushsp(tl1); /* tcp = new top of stack */
if (_runtst) /* zero stack frame */
tcp += (int)tl1; /* offsets of locals are neg */
_dp->locvars = tcp; /* set new display pointer */
_dp->stp = stp;
tcp += (int)tl1; /* offsets of locals are neg */
_dp->locvars = tcp; /* set new display pointer */
_dp->stp = stp;
stp->dp = _dp;
pc.cp = tfp->fentryaddr;/* calc new entry point */
_dp = &_display.frame[tfp->fbn];/* new display ptr */
stp->dp = _dp;
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], tcp);
- blkcpy(tfp->fbn * sizeof(struct disp),
- &tfp->fdisp[0], &_display.frame[1]);
+ blkcpy(&_display.frame[1], tcp,
+ tfp->fbn * sizeof(struct disp));
+ blkcpy(&tfp->fdisp[0], &_display.frame[1],
+ tfp->fbn * sizeof(struct disp));
continue;
case O_FRTN:
tl = *pc.cp++; /* tl = size of return obj */
continue;
case O_FRTN:
tl = *pc.cp++; /* tl = size of return obj */
tcp1 = *(char **)
(tcp + tl + sizeof(struct formalrtn *));
if (tl != 0) {
tcp1 = *(char **)
(tcp + tl + sizeof(struct formalrtn *));
if (tl != 0) {
- blkcpy(tl, tcp, tcp + sizeof(struct formalrtn *)
- + sizeof(char *));
+ blkcpy(tcp, tcp + sizeof(struct formalrtn *)
+ + sizeof(char *), tl);
}
popsp((long)
(sizeof(struct formalrtn *) + sizeof (char *)));
}
popsp((long)
(sizeof(struct formalrtn *) + sizeof (char *)));
- blkcpy(tfp->fbn * sizeof(struct disp),
- tcp1, &_display.frame[1]);
+ blkcpy(tcp1, &_display.frame[1],
+ tfp->fbn * sizeof(struct disp));
continue;
case O_FSAV:
tfp = (struct formalrtn *)popaddr();
continue;
case O_FSAV:
tfp = (struct formalrtn *)popaddr();
tcp = base + *pc.lp++; /* calc new entry point */
tcp += sizeof(short);
tfp->fentryaddr = base + *(long *)tcp;
tcp = base + *pc.lp++; /* calc new entry point */
tcp += sizeof(short);
tfp->fentryaddr = base + *(long *)tcp;
- blkcpy(tfp->fbn * sizeof(struct disp),
- &_display.frame[1], &tfp->fdisp[0]);
+ blkcpy(&_display.frame[1], &tfp->fdisp[0],
+ tfp->fbn * sizeof(struct disp));
pushaddr(tfp);
continue;
case O_SDUP2:
pushaddr(tfp);
continue;
case O_SDUP2:
tl = (-tl + 1) & ~1;
tcp = pushsp(tl);
if (_runtst)
tl = (-tl + 1) & ~1;
tcp = pushsp(tl);
if (_runtst)
continue;
case O_IF:
pc.cp++;
continue;
case O_IF:
pc.cp++;
tl = *pc.usp++;
tl1 = (tl + 1) & ~1;
tcp = pushsp((long)(0));
tl = *pc.usp++;
tl1 = (tl + 1) & ~1;
tcp = pushsp((long)(0));
- blkcpy(tl, tcp, *(char **)(tcp + tl1));
+ blkcpy(tcp, *(char **)(tcp + tl1), tl);
popsp(tl1 + sizeof(char *));
continue;
case O_INX2P2:
popsp(tl1 + sizeof(char *));
continue;
case O_INX2P2:
tcp += *pc.sp++;
tl = *pc.usp++;
tcp1 = pushsp((tl + 1) & ~1);
tcp += *pc.sp++;
tl = *pc.usp++;
tcp1 = pushsp((tl + 1) & ~1);
continue;
case O_LV:
tcp = _display.raw[*pc.ucp++];
continue;
case O_LV:
tcp = _display.raw[*pc.ucp++];
tcp += (int)*pc.lp++;
tl = *pc.usp++;
tcp1 = pushsp((tl + 1) & ~1);
tcp += (int)*pc.lp++;
tl = *pc.usp++;
tcp1 = pushsp((tl + 1) & ~1);
continue;
case O_LLV:
tcp = _display.raw[*pc.ucp++];
continue;
case O_LLV:
tcp = _display.raw[*pc.ucp++];
tl = *pc.usp++;
tcp = popaddr();
tcp1 = pushsp((tl + 1) & ~1);
tl = *pc.usp++;
tcp = popaddr();
tcp1 = pushsp((tl + 1) & ~1);
continue;
case O_CON1:
push2((short)(*pc.cp++));
continue;
case O_CON1:
push2((short)(*pc.cp++));
tl = *pc.usp++;
tl = (tl + 1) & ~1;
tcp = pushsp(tl);
tl = *pc.usp++;
tl = (tl + 1) & ~1;
tcp = pushsp(tl);
- blkcpy(tl, pc.cp, tcp);
+ blkcpy(pc.cp, tcp, tl);
pc.cp += (int)tl;
continue;
case O_CONG:
pc.cp += (int)tl;
continue;
case O_CONG:
tl = *pc.usp++;
tl1 = (tl + 1) & ~1;
tcp = pushsp(tl1);
tl = *pc.usp++;
tl1 = (tl + 1) & ~1;
tcp = pushsp(tl1);
- blkcpy(tl1, pc.cp, tcp);
+ blkcpy(pc.cp, tcp, tl1);
pc.cp += (int)((tl + 2) & ~1);
continue;
case O_LVCON:
pc.cp += (int)((tl + 2) & ~1);
continue;
case O_LVCON:
pc.cp++;
_cntrs = *pc.lp++;
_rtns = *pc.lp++;
pc.cp++;
_cntrs = *pc.lp++;
_rtns = *pc.lp++;
- NEWZ(&_pcpcount, (_cntrs + 1) * sizeof(long));
+ NEW(&_pcpcount, (_cntrs + 1) * sizeof(long));
+ blkclr(_pcpcount, (_cntrs + 1) * sizeof(long));
continue;
case O_COUNT:
pc.cp++;
continue;
case O_COUNT:
pc.cp++;
continue;
case O_ASRT:
pc.cp++;
continue;
case O_ASRT:
pc.cp++;
popsp((long)(sizeof(long)+sizeof(char *)));
continue;
case O_FOR1U:
popsp((long)(sizeof(long)+sizeof(char *)));
continue;
case O_FOR1U:
if (tl == 0)
tl = *pc.usp++;
tcp = popaddr(); /* ptr to ptr being new'ed */
if (tl == 0)
tl = *pc.usp++;
tcp = popaddr(); /* ptr to ptr being new'ed */
- NEWZ(tcp, tl);
- continue;
continue;
case O_DISPOSE:
tl = *pc.cp++; /* tl = size being disposed */
continue;
case O_DISPOSE:
tl = *pc.cp++; /* tl = size being disposed */