Copyright 2007, 2024 Anthony Howe. All rights reserved.
(C: quotation-sys
colon-sys
-- )(S: -- xt
) immediate
Ends the current nested definition started by [:
, leaving xt
on the data stack, and resumes compilation of the previous enclosing definition.
: foo 123 [: ." wave " ;] execute . ;
( -- )
Dump the data stack.
( aaddr
-- )
Display the cell value stored at aaddr
.
( -- ) immediate
Jump ahead over a block of code. A building block for several flow control words.
AHEAD
\ not executed
THEN
\ continue
( -- )
Terminate and return to the host OS with exit code zero (0), if any.
( xu
xu-1
... x1
x0
u
-- xu
xu-1
... x1
x0
xu
)
Remove u
. Copy the xu
to the top of the control-stack. 0 CS-PICK
equivalent to DUP
, 1 CS-PICK
equivalent to OVER
.
( xu
xu-1
... x0
u
-- xu-1
... x0
xu
)
Left rotate the control-stack u
cells.
( addr
u
-- )
Display the contents of u
consecutive addresses starting at addr
.
( caddr
u
-- nt
| 0 )
Find the definition identified by the string caddr
u
in the current search order. Return its name token nt
if found, otherwise zero (0).
( caddr
u
wid
-- nt
| 0 )
Find the definition identified by the string caddr
u
in the wordlist wid
. Return its name token nt
if found, otherwise zero (0).
( i*x
u
-- ) (R: -- i*x
u
)
Move u+1
items from the data stack to the return stack for later retrieval using NR>
. Note the data will not be overwritten by a subsequent invocation of N>R
and a program may not access data placed on the return stack before the invocation of N>R
.
( -- i*x
u
) (R: i*x
u
-- )
Move u+1
items, previously stored with N>R
, from the return stack to the data stack. The behaviour is undefined if NR>
is used with data not stored by N>R
.
( nt
-- xt
xt-compile
)
Given a name token nt
(aka xt
in Post4) return the word's xt
and the action xt-compile
to perform when compiling.
( nt
-- xt
| 0 )
Given a name token nt
(aka xt
in Post4) return the word's xt
for the interpretation semantics. Otherwise if there are no interpretation semantics, return 0.
( nt
-- caddr
u
)
Given a name token nt
(aka xt
in Post4) return the word's read-only name string.
( <spaces>name
-- )
Create name
in the dictionary, which when executed will remove all the words down to and including name
, restoring the dictionary to the state it had just prior to the name
being added. See WORDS
.
ok INCLUDE ../examples/wumpus.p4
... instructions ...
ok WORDS
... list of words ...
ok PLAY
ok rm_wumpus
ok PLAY
"PLAY" -13 thrown: undefined word
ok
( <spaces>name
-- )
Display an implementation-defined human-readable representation of the word name
.
( i*x
xt
wid
-- j*x
)
Execute xt
, which has stack effect ( k*x nt -- l*x bool )
, once for every word in the word list wid
passing the name token nt
of the word to xt
, until the word list is exhausted or until xt
returns false.
( -- )
List defined words
(C: -- quotation-sys
colon-sys
) immediate
Suspends compilation of the current (enclosing) definition, continues compilation with this nested definition until terminated by ;]
that leaves xt
on the data stack for the enclosing definition.
: foo 123 [: ." wave " ;] execute . ;
( <spaces>name
-- bool
) immediate
Return TRUE
if name
is word that can be found in the dictionary; otherwise FALSE
.
( <spaces>name ...
-- ) immediate
Discard space delimited words, including nested [IF]...[THEN]
and [IF]...[ELSE]...[THEN]
, until the matching (same level) [THEN]
is found.
( bool
| bool
<spaces>name ...
-- ) immediate
If bool
is false then discard space delimited words, including nested [IF]...[THEN]
and [IF]...[ELSE]...[THEN]
, until the matching (same level) [ELSE]
or [THEN]
is found.
( -- ) immediate
End conditional source block.
( <spaces>name
-- bool
) immediate
Return FALSE
if name
is word that can be found in the dictionary; otherwise TRUE
.
( -- )
Dump the float stack.
( -- )
Dump the return stack.
( xt
<spaces>name
-- )
Create an alias word for xt
.
( exit_code
-- )
Terminate and return to the host OS an exit code; zero (0) for normal/success, non-zero an error occurred.
( caddr
-- )
Display the character value stored at caddr
.
( stk
-- u
)
Return the current stack length (depth).
( u
<spaces>name
-- )
Create a stack of u
cells with name
. Invoking name
will puts stk
address on the stack.
( stk
-- x
)
Pop the top of the stack stk
returning x
.
( x
stk
-- )
Push x
onto the stack stk
. Currently no overflow checking.
( u
-- stk
)
Allocate a stack of u
cells returning stk
. Use FREE
to discard.
( -- aaddr
)
Return the address aaddr
of the trace variable; set true for tracing, otherwise false to disable. See also option -T
.
( wid
-- )
List the words from word-list wid
.
( -- )
Breakpoint. Display current source buffer position. Intended as convenient function, with no side effects, to set a breakpoint while debugging.
( xt
-- )
Display an implementation-defined human-readable representation referenced by xt
.
( -- | ⊥ )
Perform an explicit stack check and throw on error.
( aaddr
u
-- )
Utility word used to define .S
and .rs
.