summaryrefslogtreecommitdiffstats
path: root/sys/boot/ficl/vm.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/boot/ficl/vm.c')
-rw-r--r--sys/boot/ficl/vm.c48
1 files changed, 45 insertions, 3 deletions
diff --git a/sys/boot/ficl/vm.c b/sys/boot/ficl/vm.c
index bb6b1f8..0676cdb 100644
--- a/sys/boot/ficl/vm.c
+++ b/sys/boot/ficl/vm.c
@@ -118,6 +118,7 @@ void vmInnerLoop(FICL_VM *pVM)
}
#endif
+
/**************************************************************************
v m G e t S t r i n g
** Parses a string out of the VM input buffer and copies up to the first
@@ -128,7 +129,7 @@ void vmInnerLoop(FICL_VM *pVM)
**************************************************************************/
char *vmGetString(FICL_VM *pVM, FICL_STRING *spDest, char delimiter)
{
- STRINGINFO si = vmParseString(pVM, delimiter);
+ STRINGINFO si = vmParseStringEx(pVM, delimiter, 0);
if (SI_COUNT(si) > FICL_STRING_MAX)
{
@@ -229,14 +230,22 @@ int vmGetWordToPad(FICL_VM *pVM)
** trailing delimiter.
**************************************************************************/
STRINGINFO vmParseString(FICL_VM *pVM, char delim)
+{
+ return vmParseStringEx(pVM, delim, 1);
+}
+
+STRINGINFO vmParseStringEx(FICL_VM *pVM, char delim, char fSkipLeading)
{
STRINGINFO si;
char *pSrc = vmGetInBuf(pVM);
char *pEnd = vmGetInBufEnd(pVM);
char ch;
- while ((pSrc != pEnd) && (*pSrc == delim)) /* skip lead delimiters */
- pSrc++;
+ if (fSkipLeading)
+ { /* skip lead delimiters */
+ while ((pSrc != pEnd) && (*pSrc == delim))
+ pSrc++;
+ }
SI_SETPTR(si, pSrc); /* mark start of text */
@@ -260,6 +269,27 @@ STRINGINFO vmParseString(FICL_VM *pVM, char delim)
/**************************************************************************
+ v m P o p
+**
+**************************************************************************/
+CELL vmPop(FICL_VM *pVM)
+{
+ return stackPop(pVM->pStack);
+}
+
+
+/**************************************************************************
+ v m P u s h
+**
+**************************************************************************/
+void vmPush(FICL_VM *pVM, CELL c)
+{
+ stackPush(pVM->pStack, c);
+ return;
+}
+
+
+/**************************************************************************
v m P o p I P
**
**************************************************************************/
@@ -364,6 +394,18 @@ void vmSetTextOut(FICL_VM *pVM, OUTFUNC textOut)
/**************************************************************************
+ v m S t e p
+** Single step the vm - equivalent to "step into" - used for debugging
+**************************************************************************/
+#if FICL_WANT_DEBUGGER
+void vmStep(FICL_VM *pVM)
+{
+ M_VM_STEP(pVM);
+}
+#endif
+
+
+/**************************************************************************
v m T e x t O u t
** Feeds text to the vm's output callback
**************************************************************************/
OpenPOWER on IntegriCloud