Forp: fix bug when calling C->Forp

This commit is contained in:
Jeremy Penner 2019-02-04 20:59:52 -05:00
parent 0e36599524
commit 9821025def
4 changed files with 6 additions and 13 deletions

View file

@ -2,9 +2,6 @@
s" forp.log" open const LOGFILE
: log-emit LOGFILE fputc ;
stdout
' log-emit task-echo !
2 const cell
: cells cell * ;

16
forp.c
View file

@ -294,25 +294,23 @@ void f_cdef() { // func name --
DROP(1);
}
void f_docolon();
// C code must always call a colon word through f_execute()
void f_execute() {
cell oldW = W;
cell oldIP = IP;
cell *oldRstack;
cell retIP;
retIP.p = NULL;
RPUSH(retIP);
oldRstack = rstack;
if (W.p->f == f_docolon) {
RPUSH(retIP);
}
W = TOP();
DROP(1);
W.p->f();
if (oldRstack == rstack) {
RPOP();
}
W = oldW;
IP = oldIP;
}
void f_docolon();
void f_colonloop() {
while (IP.p) {
cell codeptr;
@ -425,9 +423,7 @@ void f_colon() {
void f_interpretword() { // codefield flags --
if (!STATE.i || (TOP().u & F_IMMEDIATE)) {
DROP(1);
W = TOP(); // w code
DROP(1);
W.p->f();
f_execute();
} else {
DROP(1);
f_comma();

BIN
game.exe

Binary file not shown.

BIN
game.prj

Binary file not shown.