The ANS Forth defines some "Programming Tools", words to
inspect the stack (.S
DUMP
SEE
WORDS
There are also word that provide some precompiler support
and explicit acces to the CS-STACK
.S ( -- )
DUMP ( addr len -- )
SEE word ( -- )
WORDS ( -- )
AHEAD ( -- DP-mark ORIG-magic )
compile-only
BYE ( -- )
no-return
CS-PICK ( 2a 2b 2c ... n -- 2a 2b 2c ... 2a )
CS-ROLL ( 2a 2b 2c ... n -- 2b 2c ... 2a )
FORGET word ( -- )
[ELSE] ( -- )
[IF] ( flag -- )
NOOP ( -- )
? ( addr -- )
VLIST ( -- )
.S ( -- )
Depending on configuration,
there are two parameter stacks: for integers and for
floating point operations. If both stacks are empty, .S
<stacks empty>
.
If only the floating point stack is empty, .S
12345 HEX 67890 .S 424080 [00067890] 12345 [00003039] okIf both stacks ar not empty,
.S
HEX 123456.78E90 ok DECIMAL 123456.78E90 .S 291 [00000123] 1.234568E+95 1164414608 [45678E90] okConfusing example? Remember that floating point input only works when the
BASE
DECIMAL
HEX
If only the integer stack is empty, .S
reference: p4_dot_s in ../src/toolkit.c:0084, export CO .S
DUMP ( addr len -- )
?CR
You can easily cause a segmentation fault of something like that by accessing memory that does not belong to the pfe-process.
reference: p4_dump in ../src/toolkit.c:0159, export CO DUMP
SEE word ( -- )
(SEE)
simulate: : SEE [COMPILE] ' (SEE) ;
reference: p4_see in ../src/toolkit.c:0196, export CO SEE
WORDS ( -- )
example: FORTH WORDS or LOADED WORDS
reference: p4_words in ../src/toolkit.c:0211, export CO WORDS
AHEAD ( -- DP-mark ORIG-magic )
compile-onlysimulate: : AHEAD MARK> (ORIG#) ;
reference: p4_ahead in ../src/toolkit.c:0254, export CI AHEAD
BYE ( -- )
no-returnreference: p4_bye in ../src/toolkit.c:0263, export CO BYE
CS-PICK ( 2a 2b 2c ... n -- 2a 2b 2c ... 2a )
PICK
reference: p4_cs_pick in ../src/toolkit.c:0283, export CO CS-PICK
CS-ROLL ( 2a 2b 2c ... n -- 2b 2c ... 2a )
ROLL
reference: p4_cs_roll in ../src/toolkit.c:0296, export CO CS-ROLL
FORGET word ( -- )
simulate: : FORGET [COMPILE] ' >NAME (FORGET) ; IMMEDIATE
reference: p4_forget in ../src/toolkit.c:0309, export CO FORGET
[ELSE] ( -- )
[IF]
this word provides a simple pre-compiler mechanism
reference: p4_bracket_else in ../src/toolkit.c:0321, export CI [ELSE]
[IF] ( flag -- )
INTERPRET
[ELSE]
[THEN]
this word provides a simple pre-compiler mechanism
reference: p4_bracket_if in ../src/toolkit.c:0354, export CI [IF]
NOOP ( -- )
reference: p4_noop in ../src/lpf83.c:0074, export CI [THEN]
? ( addr -- )
BASE
simulate: : ? @ . ;
reference: p4_question in ../src/toolkit.c:0146, export CO ?
VLIST ( -- )
WORDS
?CR
reference: p4_vlist in ../src/toolkit.c:0225, export CO VLIST