Forp: fix bug when calling C->Forp
This commit is contained in:
parent
0e36599524
commit
9821025def
3
defs.frp
3
defs.frp
|
@ -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
16
forp.c
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue