mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
Fix REFILL. It must throw RESTART instead of OUTOFTEXT so that
execution can take place at the point where it stopped after the input buffer has been refilled. Add ANS Forth CORE EXT and FILE word SOURCE-ID.
This commit is contained in:
parent
d742bdfc76
commit
70e1899762
1 changed files with 27 additions and 2 deletions
|
|
@ -4155,6 +4155,24 @@ static void compareString(FICL_VM *pVM)
|
|||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
s o u r c e - i d
|
||||
** CORE EXT, FILE ( -- 0 | -1 | fileid )
|
||||
** Identifies the input source as follows:
|
||||
**
|
||||
** SOURCE-ID Input source
|
||||
** --------- ------------
|
||||
** fileid Text file fileid
|
||||
** -1 String (via EVALUATE)
|
||||
** 0 User input device
|
||||
**************************************************************************/
|
||||
static void sourceid(FICL_VM *pVM)
|
||||
{
|
||||
stackPushINT(pVM->pStack, pVM->sourceID.i);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
r e f i l l
|
||||
** CORE EXT ( -- flag )
|
||||
|
|
@ -4170,10 +4188,16 @@ static void compareString(FICL_VM *pVM)
|
|||
**************************************************************************/
|
||||
static void refill(FICL_VM *pVM)
|
||||
{
|
||||
static int tries = 0;
|
||||
|
||||
FICL_INT ret = (pVM->sourceID.i == -1) ? FICL_FALSE : FICL_TRUE;
|
||||
if (ret && tries == 0) {
|
||||
tries = 1;
|
||||
vmThrow(pVM, VM_RESTART);
|
||||
}
|
||||
if (tries == 1)
|
||||
tries = 0;
|
||||
stackPushINT(pVM->pStack, ret);
|
||||
if (ret)
|
||||
vmThrow(pVM, VM_OUTOFTEXT);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -4775,6 +4799,7 @@ void ficlCompileCore(FICL_DICT *dp)
|
|||
dictAppendWord(dp, "pick", pick, FW_DEFAULT);
|
||||
dictAppendWord(dp, "roll", roll, FW_DEFAULT);
|
||||
dictAppendWord(dp, "refill", refill, FW_DEFAULT);
|
||||
dictAppendWord(dp, "source-id", sourceid, FW_DEFAULT);
|
||||
dictAppendWord(dp, "to", toValue, FW_IMMEDIATE);
|
||||
dictAppendWord(dp, "value", constant, FW_DEFAULT);
|
||||
dictAppendWord(dp, "\\", commentLine, FW_IMMEDIATE);
|
||||
|
|
|
|||
Loading…
Reference in a new issue