pfe-misc-ext ? Compatibility Miscellaneous words
ok ?=>? ( | ); | ? |
"FORTH";COLD ( -- ) ?=>? ( | ); | ? |
"FORTH";LIT ?=>? ( | ); | ? |
"FORTH";.LINE ( line# block# -- ) ?=>? ( | ); | ? |
"FORTH";UD.R ( x,x# r# -- ) ?=>? ( | ); | ? |
"FORTH";UD. ( x,x# -- ) ?=>? ( | ); | ? |
"FORTH";ID. ( some-nfa* -- ) ?=>? ( | ); | ? |
"FORTH";-ROLL ( x...[n-1] y n# -- y x...[n-1] | num# -- ) ?=>? ( | ); | ? |
"FORTH";RANDOM ( n# -- random# ) ?=>? ( | ); | ? |
"FORTH";SRAND ( seed# -- ) ?=>? ( | ); | ? |
"FORTH";(UNDER+) ( n1 n2 -- n1+n2 n2 ) ?=>? ( | ); | ? |
"FORTH";+TO ( val [name] -- ) ?=>? ( | ); | ? |
"FORTH";BUILD-ARRAY ( x#...[dim] dim# -- memsize# ) ?=>? ( | ); | ? |
"FORTH";ACCESS-ARRAY ( x#...[dim#] array* --- array* value# ) ?=>? ( | ); | ? |
"FORTH";.STATUS ( -- ) ?=>? ( | ); | ? |
"FORTH";SOURCE-LINE ( -- source-line# ) ?=>? ( | ); | ? |
"FORTH";SOURCE-NAME ( -- source-name-ptr source-name-len ) ?=>? ( | ); | ? |
"FORTH";TH'POCKET ( pocket# -- pocket-ptr pocket-len ) ?=>? ( | ); | ? |
"FORTH";POCKET-PAD ( -- pocket-ptr ) ?=>? ( | ); | ? |
"FORTH";W@ ( some-wchar* -- some-wchar# | some* -- some# [?] ) ?=>? ( | ); | ? |
"FORTH";W! ( value# some-wchar* -- | value# wchar* -- [?] ) ?=>? ( | ); | ? |
"FORTH";W+! ( value# some-wchar* -- | value# wchar* -- [?] ) ?=>? ( | ); | ? |
"FORTH";WL-HASH ( buf-ptr buf-len -- buf-hash# ) ?=>? ( | ); | ? |
"FORTH";TOPMOST ( some-wordlist* -- some-topmost-nfa* ) ?=>? ( | ); | ? |
"FORTH";LS.WORDS ( -- ) ?=>? ( | ); | ? |
"FORTH";LS.PRIMITIVES ( -- ) ?=>? ( | ); | ? |
"FORTH";LS.COLON-DEFS ( -- ) ?=>? ( | ); | ? |
"FORTH";LS.DOES-DEFS ( -- ) ?=>? ( | ); | ? |
"FORTH";LS.CONSTANTS ( -- ) ?=>? ( | ); | ? |
"FORTH";LS.VARIABLES ( -- ) ?=>? ( | ); | ? |
"FORTH";LS.VOCABULARIES ( -- ) ?=>? ( | ); | ? |
"FORTH";LS.MARKERS ( -- ) ?=>? ( | ); | ? |
"FORTH";TAB ( tab-n# -- ) ?=>? ( | ); | ? |
"FORTH";BACKSPACE ( -- ) ?=>? ( | ); | ? |
"FORTH";?STOP ( -- stop-flag ) ?=>? ( | ); | ? |
"FORTH";START?CR ( -- ) ?=>? ( | ); | ? |
"FORTH";?CR ( -- cr-flag ) ?=>? ( | ); | ? |
"FORTH";CLOSE-ALL-FILES ( -- ) ?=>? ( | ); | ? |
"FORTH";.MEMORY ( -- ) ?=>? ( | ); | ? |
"FORTH";(EMIT) ?=>? ( | ); | ? |
"FORTH";(EXPECT) ?=>? ( | ); | ? |
"FORTH";(KEY) ?=>? ( | ); | ? |
"FORTH";(TYPE) ?=>? ( | ); | ? |
"FORTH";STANDARD-I/O ( -- ) ?=>? ( | ); | ? |
"FORTH";HELP ( "name" -- ) ?=>? ( | ); | ? |
"FORTH";EDIT-BLOCKFILE ( "name" -- ) ?=>? ( | ); | ? |
"FORTH";ARGC ( -- arg-count ) ?=>? ( | ); | ? |
"FORTH";ARGV ( arg-n# -- arg-ptr arg-len ) ?=>? ( | ); | ? |
"FORTH";EXPAND-FN ( name-ptr name-len buf-ptr -- buf-ptr buf-len ) ?=>? ( | ); | ? |
"FORTH";LOAD" ( [filename<">] -- ??? ) ?=>? ( | ); | ? |
"FORTH";SYSTEM ( command-ptr command-len -- command-exitcode# ) ?=>? ( | ); | ? |
"FORTH";SYSTEM" ( [command-line<">] -- command-exitcode# ) ?=>? ( | ); | ? |
"FORTH";CREATE: ( "name" -- ) ?=>? ( | ); | ? |
"FORTH";BUFFER: ( size# "name" -- ) ?=>? ( | ); | ? |
"FORTH";R'@ ( R: a b -- a R: a b ) ?=>? ( | ); | ? |
"FORTH";R'! ( x R: a b -- R: x b ) ?=>? ( | ); | ? |
"FORTH";R"@ ( R: a b c -- a R: a b c ) ?=>? ( | ); | ? |
"FORTH";R"! ( x R: a b c -- R: x b c ) ?=>? ( | ); | ? |
"FORTH";R! ( x R: a -- R: x ) ?=>? ( | ); | ? |
"FORTH";2R! ( x y R: a b -- R: x y ) ?=>? ( | ); | ? |
"FORTH";DUP>R ( val -- val R: val ) ?=>? ( | ); | ? |
"FORTH";R>DROP ( R: val -- R: ) ?=>? ( | ); | ? |
"FORTH";2R>2DROP ( R: a b -- R: ) ?=>? ( | ); | ? |
"FORTH";CLEARSTACK ( -- ) ?=>? ( | ); | ? |
"FORTH";+UNDER ( n1 x n2 -- n1+n2 x ) ?=>? ( | ); | ? |
"FORTH";EXECUTES ( fkey# [word] -- ) ?=>? ( | ); | ? |
"FORTH";RAND_MAX ( -- rand-max ) [ENVIRONMENT] * maximum value for => RANDOM
ok - no description, sorry
COLD ( -- ) [FTH] => "FORTH"
cold abort - reinitialize everything and go to QUIT routine
... this routine is implemented as a warm-boot in pfe.
: COLD [ ALSO ENVIRONMENT ] EMPTY SCRIPT-FILE INCLUDED QUIT ;
LIT - no description, sorry
.LINE ( line# block# -- ) [FTH] => "FORTH"
UD.R ( x,x# r# -- ) [FTH] => "FORTH"
UD. ( x,x# -- ) [FTH] => "FORTH"
see also UD.R
ID. ( some-nfa* -- ) [FTH] => "FORTH"
print the name-field pointed to by the nfa-argument. a synonym for .NAME - but this word is more portable due its heritage from fig-forth.
in fig-forth the name-field is effectivly a bstring with some flags, so the nfa's count has to be masked out, e.g.
: .NAME COUNT 32 AND TYPE ;
in other pfe configurations, the name might not contain the flags it it just a counted string - and there may be even more possibilities.
: .NAME COUNT TYPE ;
you should more and more convert your code to use the sequence
NAME>STRING TYPE which is widely regarded as the better
variant.
-ROLL ( x...[n-1] y n# -- y x...[n-1] | num# -- ) [FTH] => "FORTH"
the inverse of ROLL
RANDOM ( n# -- random# ) [FTH] => "FORTH"
returns random number with 0 <= n2 < n1)
: RANDOM ?DUP IF _random SWAP MOD ELSE _random THEN ;
SRAND ( seed# -- ) [FTH] => "FORTH"
(UNDER+) ( n1 n2 -- n1+n2 n2 ) [FTH] => "FORTH"
quicker than
: (UNDER+) TUCK + SWAP ; or : (UNDER+) DUP UNDER+ ;
+TO ( val [name] -- ) [FTH] => "FORTH"
add the val to the named VALUE or LOCALS| value
BUILD-ARRAY ( x#...[dim] dim# -- memsize# ) [FTH] => "FORTH"
writes X, n1, ... nX into the dictionary - returns product n1 * n2 * ... * nX
ACCESS-ARRAY ( x#...[dim#] array* --- array* value# ) [FTH] => "FORTH"
see BUILD-ARRAY
.STATUS ( -- ) [FTH] => "FORTH"
display internal variables
: .STATUS .VERSION .CVERSION .MEMORY .SEARCHPATHS .DICTVARS .REGSUSED ;
SOURCE-LINE ( -- source-line# ) [FTH] => "FORTH"
if SOURCE is from EVALUATE (or QUERY ) then
the result is 0 else the line-numbers start from 1
SOURCE-NAME ( -- source-name-ptr source-name-len ) [FTH] => "FORTH"
if SOURCE is from INCLUDE then the result is the filename,
otherwise a generic name for the SOURCE-ID is given.
TH'POCKET ( pocket# -- pocket-ptr pocket-len ) [FTH] => "FORTH"
returns the specified pocket as a S" string reference
POCKET-PAD ( -- pocket-ptr ) [FTH] => "FORTH"
This function Returns the next pocket.
A pocket has usually the size of a maxstring, see ENVIRONMENT /STRING
(but can be configured to be different, mostly when MAXPATH > /STRING )
Note that a pocket is a temporary and forth internal functions do
sometimes call POCKET-PAD too, especially when building filenames
and getting a literal (but temporary) string from the keyboard.
Functions are not expected to hold references to this transient
area any longer than building a name and calling another word with it.
Usage of a pocket pad is a good way to make local temporary buffers superfluous that are only used to construct a temporary string that usually gets swallowed by another function.
depracated code:
create temp-buffer 255 allot
: make-temp ( str buf )
temp-buffer place " .tmp" count temp-buffer append
temp-buffer count make-file ;
replace with this:
: make-temp ( str buf )
pocket-pad >r
r place " .tmp" count r append
r> count make-file
;
W@ ( some-wchar* -- some-wchar# | some* -- some# [?] ) [FTH] => "FORTH"
fetch a 2byte-val from address
W! ( value# some-wchar* -- | value# wchar* -- [?] ) [FTH] => "FORTH"
store a 2byte-val at addressed 2byte-value
W+! ( value# some-wchar* -- | value# wchar* -- [?] ) [FTH] => "FORTH"
add a 2byte-val to addressed 2byte-value
WL-HASH ( buf-ptr buf-len -- buf-hash# ) [FTH] => "FORTH"
calc hash-code for selection of thread in a threaded-vocabulary
TOPMOST ( some-wordlist* -- some-topmost-nfa* ) [FTH] => "FORTH"
that last valid word in the specified vocabulary
LS.WORDS ( -- ) [FTH] => "FORTH"
see WORDS
LS.PRIMITIVES ( -- ) [FTH] => "FORTH"
see WORDS
LS.COLON-DEFS ( -- ) [FTH] => "FORTH"
see WORDS
LS.DOES-DEFS ( -- ) [FTH] => "FORTH"
see WORDS
LS.CONSTANTS ( -- ) [FTH] => "FORTH"
see WORDS
LS.VARIABLES ( -- ) [FTH] => "FORTH"
see WORDS
LS.VOCABULARIES ( -- ) [FTH] => "FORTH"
see WORDS
LS.MARKERS ( -- ) [FTH] => "FORTH"
see WORDS
TAB ( tab-n# -- ) [FTH] => "FORTH"
jump to next column divisible by n
BACKSPACE ( -- ) [FTH] => "FORTH"
reverse of SPACE
?STOP ( -- stop-flag ) [FTH] => "FORTH"
check for 'q' pressed - see => ?CR
START?CR ( -- ) [FTH] => "FORTH"
initialized for more-like effect - see => ?CR
?CR ( -- cr-flag ) [FTH] => "FORTH"
like CR , stop 25 lines past START?CR
CLOSE-ALL-FILES ( -- ) [FTH] => "FORTH"
.MEMORY ( -- ) [FTH] => "FORTH"
(EMIT) - no description, sorry
(EXPECT) - no description, sorry
(KEY) - no description, sorry
(TYPE) - no description, sorry
STANDARD-I/O ( -- ) [FTH] => "FORTH"
initialize *TYPE* , *EMIT* , *EXPECT* and *KEY*
to point directly to the screen I/O routines,
namely (TYPE) , (EMIT) , (EXPECT) , (KEY)
HELP ( "name" -- ) [FTH] [EXEC] => "FORTH"
will load the help module in the background and hand over the
parsed name to (HELP) to be resolved. If no (HELP) word
can be loaded, nothing will happen.
EDIT-BLOCKFILE ( "name" -- ) [FTH] [EXEC] => "FORTH"
will load the edit module in the background and look for a word
called EDIT-BLOCK that could be used to edit the blockfile.
If no EDIT-BLOCKFILE word can be loaded, nothing will happen.
Otherwise, OPEN-BLOCKFILE is called followed by 0 EDIT-BLOCK
to start editing the file at the first block.
ARGC ( -- arg-count ) [FTH] => "FORTH"
ARGV ( arg-n# -- arg-ptr arg-len ) [FTH] => "FORTH"
EXPAND-FN ( name-ptr name-len buf-ptr -- buf-ptr buf-len ) [FTH] => "FORTH"
: e.g. s" includefile" POCKET-PAD EXPAND-FN ;
LOAD" ( [filename<">] -- ??? ) [FTH] [OLD] => "FORTH"
load the specified file - this word can be compiled into a word-definition
obsolete! use OPEN-BLOCKFILE name LOAD
SYSTEM ( command-ptr command-len -- command-exitcode# ) [FTH] => "FORTH"
run a shell command (note: embedded systems have no shell)
SYSTEM" ( [command-line<">] -- command-exitcode# ) [FTH] [OLD] => "FORTH"
run a shell command (note:embedded systems have no shell)
obsolete! use S" string" SYSTEM
CREATE: ( "name" -- ) [FTH] => "FORTH"
this creates a name with the VARIABLE runtime.
Note that this is the FIG-implemenation of CREATE whereas in
ANS-Forth mode we have a CREATE identical to FIG-style <BUILDS
: CREATE: BL WORD $HEADER DOVAR A, ;
BUFFER: ( size# "name" -- ) [FTH] => "FORTH"
this creates a name with the VARIABLE runtime and ALLOTs memory
: BUFFER: BL WORD $HEADER DOVAR A, ALLOT ;
R'@ ( R: a b -- a R: a b ) [FTH] => "FORTH"
fetch the next-under value from the returnstack.
used to interpret the returnstack to hold two LOCALS| values.
( R@ / 2R@ / R>DROP / R"@)
R'! ( x R: a b -- R: x b ) [FTH] => "FORTH"
store the value into the next-under value in the returnstack.
used to interpret the returnstack to hold two LOCALS| values.
see R'@ for inverse operation
R"@ ( R: a b c -- a R: a b c ) [FTH] => "FORTH"
fetch the second-under value from the returnstack.
used to interpret the returnstack to hold three LOCALS| values.
see R"! for inverse operation ( R'@ R@ / 2R@ / R>DROP )
R"! ( x R: a b c -- R: x b c ) [FTH] => "FORTH"
store the value into the second-under value in the returnstack.
used to interpret the returnstack to hold three LOCALS| values.
see R"@ for inverse operation
R! ( x R: a -- R: x ) [FTH] => "FORTH"
store the value as the topmost value in the returnstack.
see R@ for inverse operation ( R'@ / R"@ / 2R@ / 2R!)
2R! ( x y R: a b -- R: x y ) [FTH] => "FORTH"
store the value as the topmost value in the returnstack.
see 2R@ for inverse operation ( R'@ / R"@ / 2R@ / 2R!)
DUP>R ( val -- val R: val ) [FTH] => "FORTH"
shortcut, see R>DROP
note again that the following will fail:
: DUP>R DUP >R ;
R>DROP ( R: val -- R: ) [FTH] => "FORTH"
shortcut (e.g. in CSI-Forth)
note that the access to R is configuration dependent - only in
a traditional fig-forth each NEST will be one cell wide - in case that
there are no LOCALS| of course. And remember, the word above reads
like the sequence R> and DROP but that is not quite true.
: R>DROP R> DROP ; ( is bad - correct might be ) : R>DROP R> R> DROP >R ;
2R>2DROP ( R: a b -- R: ) [FTH] => "FORTH"
this is two times R>DROP but a bit quicker.
it is however really quick compared to the sequence 2R> and 2DROP
CLEARSTACK ( -- ) [FTH] => "FORTH"
reset the parameter stack to be empty
: CLEARSTACK S0 SP! ;
+UNDER ( n1 x n2 -- n1+n2 x ) [EXT] => "FORTH"
quicker than
: UNDER+ ROT + SWAP ;
Note: the old pfe version of UNDER+ is obsolete as it is in conflict
with a comus word of the same name. The behavior of this word will
continue to exist under the name of (UNDER+). Users are encouraged
to use the comus behavior of UNDER+ which does already exist under
the name of +UNDER. In the future pfe will be changed to pick up
the comus behavior making UNDER+ and +UNDER to be synonyms. In the
current version there will be load-time warning on usages of "UNDER+".
EXECUTES ( fkey# [word] -- ) [EXT] => "FORTH"
stores the execution token of following word into the callback pointer for the specified function-key