Google

PFE-MISC Compatibility + miscellaneous

Compatiblity with former standards, miscellaneous useful words.



ok  

just print OK, also fine for copy-and-paste in terminal

reference: p4_ok in ../src/misc.c:1280, export CO ok

0  
constant
quick constants - implemented as code

reference: 0 in ../src/misc.c:1282, export OC 0

1  
constant
quick constants - implemented as code

reference: 1 in ../src/misc.c:1283, export OC 1

2  
constant
quick constants - implemented as code

reference: 2 in ../src/misc.c:1284, export OC 2

3  
constant
quick constants - implemented as code

reference: 3 in ../src/misc.c:1285, export OC 3

CSP  
dict-variable
see !CSP and ?CSP

reference: csp in ../src/misc.c:1287, export DV CSP

!CSP ( -- )  

put SP into CSP
used in control-words

reference: p4_store_csp in ../src/misc.c:0073, export CO !CSP

?CSP ( -- )  

check that SP == CSP otherwise THROW
used in control-words

reference: p4_Q_csp in ../src/misc.c:0083, export CO ?CSP

COLD ( -- )  

   cold abort - reinitialize everything and go to => QUIT routine

reference: p4_cold in ../src/misc.c:0045, export CO COLD

((LIT)) ( -- value )  

execution compiled by LITERAL

reference: p4_literal_execution in ../src/core.c:1384, export CO LIT

.LINE ( line# block# -- )  

reference: p4_dot_line in ../src/misc.c:0062, export CO .LINE

?COMP ( -- )  

check that the current STATE is compiling otherwise THROW
often used in control-words

reference: p4_Q_comp in ../src/misc.c:0094, export CO ?COMP

?EXEC ( -- )  

check that the current STATE is executing otherwise THROW
often used in control-words

reference: p4_Q_exec in ../src/misc.c:0105, export CO ?EXEC

?FILE ( file-id -- )  

check the file-id otherwise (fixme)

reference: p4_Q_file in ../src/misc.c:0114, export CO ?FILE

?LOADING ( -- )  

check that the currently interpreted text is from a file/block, otherwise THROW

reference: p4_Q_loading in ../src/misc.c:0126, export CO ?LOADING

?PAIRS ( a b -- )  

if compiling, check that the two magics on the CS-STACK are identical, otherwise throw
used in control-words

reference: p4_Q_pairs in ../src/misc.c:0137, export CO ?PAIRS

?STACK ( -- )  

check all stacks for underflow and overflow conditions, and if such an error condition is detected THROW

reference: p4_Q_stack in ../src/misc.c:0147, export CO ?STACK

TOGGLE ( c-addr charmask -- )  

toggle the bits given in charmask, see also SMUDGE and = UNSMUDGE
 example: the fig-style SMUDGE had been defined such
   : FIG-SMUDGE LATEST >FFA (SMUDGE#) TOGGLE ;

reference: p4_toggle in ../src/misc.c:0165, export CO TOGGLE

LATEST ( -- nfa )  

return the NFA of the lateset definition in the CURRENT vocabulary

reference: p4_latest in ../src/misc.c:0175, export CO LATEST

SMUDGE (modified from FIG definition)  

FIG definition toggles the bit!

reference: p4_smudge in ../src/misc.c:0183, export CO SMUDGE

UNSMUDGE (turn smudge-bit off)  

neccessary because SMUDGE modified

reference: p4_unsmudge in ../src/misc.c:0194, export CO UNSMUDGE

OUT  
dict-variable
basic system variables ( OUT DP HLD R0 S0 )

reference: out in ../src/misc.c:1305, export DV OUT

DP  
dict-variable
basic system variables ( OUT DP HLD R0 S0 )

reference: dp in ../src/misc.c:1306, export DV DP

HLD  
dict-variable
basic system variables ( OUT DP HLD R0 S0 )

reference: hld in ../src/misc.c:1307, export DV HLD

R0  
dict-variable
basic system variables ( OUT DP HLD R0 S0 )

reference: r0 in ../src/misc.c:1308, export DV R0

S0  
dict-variable
basic system variables ( OUT DP HLD R0 S0 )

reference: s0 in ../src/misc.c:1309, export DV S0

UD.R ( 2val r -- )  

reference: p4_u_d_dot_r in ../src/misc.c:0208, export CO UD.R

UD. ( 2val -- )  

see also UD.R

reference: p4_u_d_dot in ../src/misc.c:0222, export CO UD.

.NAME ( nfa -- )  

print the name-field which is effectivly a bstring - in some forth implementations the name-field is identical with the flag-field, so the nfa's count has to be masked the, e.g.
 : .NAME COUNT 32 AND TYPE ;
if the name-field and flag-field are different, then this word does effectivly
 : .NAME COUNT TYPE ;

reference: p4_dot_name in ../src/misc.c:0239, export CO .NAME

-ROLL ( xn ... x2 x1 n -- x1 xn ... x2 )  

the inverse of ROLL

reference: p4_dash_roll in ../src/misc.c:0247, export CO -ROLL

R>DROP ( -- )  

shortcut (e.g. in CSI-Forth)
note that
 : R>DROP R> DROP ; 
would be wrong - for a non-direct-threaded forth it would be
 : R>DROP R> R> NIP >R ;

reference: p4_r_from_drop in ../src/misc.c:0265, export CO R>DROP

DUP>R ( val -- val )  

shortcut, see R>DROP
note again that the following will fail:
 : DUP>R DUP >R ;

reference: p4_dup_to_r in ../src/misc.c:0275, export CO DUP>R

RANDOM ( n1 -- n2 )  

returns random number with 0 <= n2 < n1)

reference: p4_random in ../src/misc.c:0292, export CO RANDOM

SRAND ( n -- )  

reference: p4_srand in ../src/misc.c:0304, export CO SRAND

UNDER+

no forth documentation available   (p4_under_plus)

reference: p4_under_plus in ../src/misc.c:0316, export CO UNDER+

+TO name ( val -- )  
smart-word
add the val to the named VALUE or LOCALS| value

reference: p4_plus_to in ../src/misc.c:0346, export CS +TO

BUILD-ARRAY ( n1 n2 ... nX X --- n )  

writes X, n1, ... nX into the dictionary - returns product n1 * n2 * ... * nX

reference: p4_build_array in ../src/misc.c:0387, export CO BUILD-ARRAY

ACCESS-ARRAY

no forth documentation available   (p4_access_array)

reference: p4_access_array in ../src/misc.c:0403, export CO ACCESS-ARRAY

0<= ( a -- flag )  

 simulate    : 0<= 0> 0= ;

reference: p4_zero_less_equal in ../src/misc.c:0428, export CO 0<=

0>=

no forth documentation available   (p4_zero_greater_equal)

reference: p4_zero_greater_equal in ../src/misc.c:0436, export CO 0>=

<= ( a b -- flag )  

 simulate    : <= > 0= ;

reference: p4_less_equal in ../src/misc.c:0444, export CO <=

>= ( a b -- flag )  

 simulate    : >= < 0= ;

reference: p4_greater_equal in ../src/misc.c:0453, export CO >=

U<= ( a b -- flag )  

 simulate    : U<= U> 0= ;

reference: p4_u_less_equal in ../src/misc.c:0462, export CO U<=

U>= ( a b -- flag )  

 simulate    : U>= U< 0= ;

reference: p4_u_greater_equal in ../src/misc.c:0471, export CO U>=

UMIN ( a b -- min )  

see MIN , MAX and UMAX

reference: p4_u_min in ../src/misc.c:0490, export CO UMIN

UMAX ( a b -- max )  

see MAX

reference: p4_u_max in ../src/misc.c:0480, export CO UMAX

EXCEPTION_MAGIC  
constant
implementation specific magic - used by control words

reference: EXCEPTION_MAGIC in ../src/misc.c:1339, export OC EXCEPTION_MAGIC

INPUT_MAGIC  
constant
implementation specific magic - used by control words

reference: INPUT_MAGIC in ../src/misc.c:1340, export OC INPUT_MAGIC

DEST_MAGIC  
constant
implementation specific magic - used by control words

reference: DEST_MAGIC in ../src/misc.c:1341, export OC DEST_MAGIC

ORIG_MAGIC  
constant
implementation specific magic - used by control words

reference: ORIG_MAGIC in ../src/misc.c:1342, export OC ORIG_MAGIC

LOOP_MAGIC  
constant
implementation specific magic - used by control words

reference: LOOP_MAGIC in ../src/misc.c:1343, export OC LOOP_MAGIC

CASE_MAGIC  
constant
implementation specific magic - used by control words

reference: CASE_MAGIC in ../src/misc.c:1344, export OC CASE_MAGIC

OF_MAGIC  
constant
implementation specific magic - used by control words

reference: OF_MAGIC in ../src/misc.c:1345, export OC OF_MAGIC

FLIT  

floating point system - requires seperate float-stack

reference: p4_f_literal_execution in ../src/floating.c:0384, export CO FLIT

F0  
dict-variable
floating point system - requires seperate float-stack

reference: f0 in ../src/misc.c:1349, export DV F0

FLOAT-INPUT  
dict-variable
floating point system - requires seperate float-stack

reference: float_input in ../src/misc.c:1350, export DV FLOAT-INPUT

FP@ ( -- addr )  

returns the floating point stack pointer

reference: p4_f_p_fetch in ../src/misc.c:0505, export CO FP@

FP! ( addr -- )  

sets the floating point stack pointer - this is the inverse of FP@

reference: p4_f_p_store in ../src/misc.c:0514, export CO FP!

SHOW-STATUS ( -- )  

display internal variables

reference: p4_show_status in ../src/misc.c:0772, export CO SHOW-STATUS

LOWER-CASE  
dict-variable
variable to enable lower-case symbols as input, LOWER-CASE and LOWER-CASE-FN

reference: wordl_flag in ../src/misc.c:1356, export DV LOWER-CASE

LOWER-CASE-FN  
dict-variable
variable to enable lower-case symbols as input, LOWER-CASE and LOWER-CASE-FN

reference: lower_case_fn in ../src/misc.c:1357, export DV LOWER-CASE-FN

REDEFINED-MSG  
dict-variable
variable to enable warnings if creating symbols being in the ORDER

reference: redefined_msg in ../src/misc.c:1359, export DV REDEFINED-MSG

APPLICATION  
dict-variable
the application to be called, options like ARGC ARGV

reference: application in ../src/misc.c:1361, export DV APPLICATION

SOURCE-LINE ( -- n )  

if SOURCE is from EVALUATE (or QUERY ) then the result is 0 else the line-numbers start from 1

reference: p4_source_line in ../src/misc.c:0525, export CO SOURCE-LINE

POCKET ( n -- addr u )  

returns the specified pocket as a S" string reference

reference: p4_pocket in ../src/misc.c:0544, export CO POCKET

W@ ( addr -- w-val )  

fetch a 2byte-val from address

reference: p4_w_fetch in ../src/misc.c:0630, export CO W@

W! ( w-val addr -- )  

store a 2byte-val at addressed 2byte-value

reference: p4_w_store in ../src/misc.c:0638, export CO W!

W+! ( w-val addr -- )  

add a 2byte-val to addressed 2byte-value

reference: p4_w_plus_store in ../src/misc.c:0647, export CO W+!

WL-HASH ( c-addr n1 -- n2 )  

calc hash-code for selection of thread in a threaded-vocabulary

reference: p4_wl_hash in ../src/misc.c:0557, export CO WL-HASH

TOPMOST ( wid -- a-addr )  

that last valid word in the specified vocabulary

reference: p4_topmost in ../src/misc.c:0566, export CO TOPMOST

LAST  
dict-variable
the variable accessed with LATEST

reference: last in ../src/misc.c:1372, export DV LAST

LS.WORDS ( -- )  

see WORDS

reference: p4_ls_words in ../src/misc.c:0588, export CO LS.WORDS

LS.PRIMITIVES ( -- )  

see WORDS

reference: p4_ls_primitives in ../src/misc.c:0593, export CO LS.PRIMITIVES

LS.COLON-DEFS ( -- )  

see WORDS

reference: p4_ls_cdefs in ../src/misc.c:0598, export CO LS.COLON-DEFS

LS.DOES-DEFS ( -- )  

see WORDS

reference: p4_ls_ddefs in ../src/misc.c:0603, export CO LS.DOES-DEFS

LS.CONSTANTS ( -- )  

see WORDS

reference: p4_ls_constants in ../src/misc.c:0608, export CO LS.CONSTANTS

LS.VARIABLES ( -- )  

see WORDS

reference: p4_ls_variables in ../src/misc.c:0613, export CO LS.VARIABLES

LS.VOCABULARIES ( -- )  

see WORDS

reference: p4_ls_vocabularies in ../src/misc.c:0618, export CO LS.VOCABULARIES

LS.MARKERS ( -- )  

see WORDS

reference: p4_ls_markers in ../src/misc.c:0623, export CO LS.MARKERS

(FORGET) ( addr -- )  

forget everything above addr - used by FORGET

reference: p4_paren_forget in ../src/misc.c:0657, export CO (FORGET)

TAB ( n -- )  

jump to next column divisible by n

reference: p4_tab in ../src/misc.c:0665, export CO TAB

BACKSPACE ( -- )  

reverse of SPACE

reference: p4_backspace in ../src/misc.c:0673, export CO BACKSPACE

?STOP ( -- flag )  

check for 'q' pressed - see ?CR

reference: p4_Q_stop in ../src/misc.c:0682, export CO ?STOP

START?CR ( -- )  

initialized for more-like effect - see ?CR

reference: p4_start_Q_cr in ../src/misc.c:0691, export CO START?CR

?CR ( -- flag )  

like CR , stop 25 lines past START?CR

reference: p4_Q_cr in ../src/misc.c:0700, export CO ?CR

CLOSE-ALL-FILES ( -- )  

reference: p4_close_all_files in ../src/misc.c:0707, export CO CLOSE-ALL-FILES

.MEMORY ( -- )  

reference: p4_dot_memory in ../src/misc.c:0726, export CO .MEMORY

.VERSION ( -- )  

reference: p4_dot_version in ../src/misc.c:0742, export CO .VERSION

.PFE-DATE ( -- )  

reference: p4_dot_date in ../src/misc.c:0749, export CO .PFE-DATE

LICENSE ( -- )  

reference: p4_license in ../src/misc.c:0757, export CO LICENSE

WARRANTY ( -- )  

reference: p4_warranty in ../src/misc.c:0764, export CO WARRANTY

*EMIT*  
dict-variable
vectorized i/o variables, see STANDARD-I/O

reference: emit in ../src/misc.c:1397, export DV *EMIT*

*EXPECT*  
dict-variable
vectorized i/o variables, see STANDARD-I/O

reference: expect in ../src/misc.c:1398, export DV *EXPECT*

*KEY*  
dict-variable
vectorized i/o variables, see STANDARD-I/O

reference: key in ../src/misc.c:1399, export DV *KEY*

*TYPE*  
dict-variable
vectorized i/o variables, see STANDARD-I/O

reference: type in ../src/misc.c:1400, export DV *TYPE*

(EMIT) ( val -- )  

like EMIT and always to screen - the routine to be put into *EMIT*

reference: p4_paren_emit in ../src/misc.c:0814, export CO (EMIT)

(EXPECT) ( . -- . )  

like EXPECT and always from screen - the routine to be put into *EXPECT*

reference: p4_paren_expect in ../src/misc.c:0823, export CO (EXPECT)

(KEY) ( -- ... )  

like KEY and always from screen - the routine to be put into *KEY*

reference: p4_paren_key in ../src/misc.c:0833, export CO (KEY)

(TYPE) ( val -- )  

like TYPE and always to screen - the routine to be put into *TYPE*

reference: p4_paren_type in ../src/misc.c:0847, export CO (TYPE)

STANDARD-I/O ( -- )  

initialize *TYPE* , *EMIT* , *EXPECT* and *KEY* to point directly to the screen I/O routines,
namely (TYPE) , (EMIT) , (EXPECT) , (KEY)

reference: p4_standard_io in ../src/misc.c:0858, export CO STANDARD-I/O

HELP ( -- )  

reference: p4_help in ../src/misc.c:0926, export CO HELP

COPY-FILE ( src-str src-strlen dst-str dst-strlen -- errno|0 )  

like RENAME-FILE, copies the file from src-name to dst-name and returns an error-code or null

reference: p4_copy_file in ../src/misc.c:0948, export CO COPY-FILE

MOVE-FILE ( src-str src-strlen dst-str dst-strlen -- errno|0 )  

like RENAME-FILE, but also across-volumes
moves the file from src-name to dst-name and returns an error-code or null

reference: p4_move_file in ../src/misc.c:0963, export CO MOVE-FILE

FILE-R/W ( addr blk f fid -- )  

like FIG-Forth R/W

reference: p4_file_rw in ../src/misc.c:0976, export CO FILE-R/W

BLOCK-FILE  
dict-constant
the FILE-operations can can also be USING blocks from a file

reference: input.block_file in ../src/misc.c:1415, export DC BLOCK-FILE

FILE-BLOCK ( a file-id -- c )  

reference: p4_file_block in ../src/misc.c:0987, export CO FILE-BLOCK

FILE-BUFFER ( a file-id -- c )  

reference: p4_file_buffer in ../src/misc.c:0996, export CO FILE-BUFFER

FILE-EMPTY-BUFFERS ( file-id -- )  

reference: p4_file_empty_buffers in ../src/misc.c:1006, export CO FILE-EMPTY-BUFFERS

FILE-FLUSH ( file-id -- )  

 simulate      : FILE-FLUSH DUP FILE-SAVE-BUFFERS FILE-EMTPY-BUFFERS ;

reference: p4_file_flush in ../src/misc.c:1014, export CO FILE-FLUSH

FILE-LIST ( x file-id -- )  

reference: p4_file_list in ../src/misc.c:1024, export CO FILE-LIST

FILE-LOAD ( x file-id -- )  

reference: p4_file_load in ../src/misc.c:1033, export CO FILE-LOAD

FILE-SAVE-BUFFERS ( file-id -- )  

reference: p4_file_save_buffers in ../src/misc.c:1042, export CO FILE-SAVE-BUFFERS

FILE-THRU ( lo hi file-id -- )  

see THRU

reference: p4_file_thru in ../src/misc.c:1052, export CO FILE-THRU

FILE-UPDATE ( file-id -- )  

reference: p4_file_update in ../src/misc.c:1063, export CO FILE-UPDATE

ARGC ( -- n )  

reference: p4_argc in ../src/misc.c:1074, export CO ARGC

ARGV ( n -- addr u )  

reference: p4_argv in ../src/misc.c:1081, export CO ARGV

EXITCODE  
dict-variable
task system hooks

reference: exitcode in ../src/misc.c:1429, export DV EXITCODE

STDIN  
dict-constant
( -- fid ) - the standard file-handles of the task

reference: stdIn in ../src/misc.c:1431, export DC STDIN

STDOUT  
dict-constant
( -- fid ) - the standard file-handles of the task

reference: stdOut in ../src/misc.c:1432, export DC STDOUT

STDERR  
dict-constant
( -- fid ) - the standard file-handles of the task

reference: stdErr in ../src/misc.c:1433, export DC STDERR

EXPAND-FN ( addr1 u1 addr2 -- addr2 cnt2 )  

reference: p4_expand_fn in ../src/misc.c:1093, export CO EXPAND-FN

USING filename ( -- )  

use filename as a block file

reference: p4_using in ../src/misc.c:1110, export CO USING

USING-NEW filename ( -- )  

like USING but can create the file

reference: p4_using_new in ../src/misc.c:1126, export CO USING-NEW

LOAD" filename" ( -- ?  
smart-word
load the specified file - this word can be compiled into a word-definition

reference: p4_load_quote in ../src/misc.c:1164, export CS LOAD"

SYSTEM ( addr u -- ret-val )  

run a shell command
(embedded systems have no shell)

reference: p4_system in ../src/misc.c:1199, export CO SYSTEM

SYSTEM" commandline" ( -- ret-val )  
smart-word
run a shell command
(embedded systems have no shell)

reference: p4_system_quote in ../src/misc.c:1220, export CS SYSTEM"

INCLUDE filename ( -- ? )  

load the specified file, see also LOAD" filename"

reference: p4_include in ../src/misc.c:1187, export CO INCLUDE

RAISE ( n -- )  

send a SIGNAL to self

reference: p4_raise in ../src/misc.c:1243, export CO RAISE

SIGNAL ( xt1 n -- xt2 )  

install signal handler - return old signal handler

reference: p4_signal in ../src/misc.c:1252, export CO SIGNAL

EXECUTES word ( n -- )  

stores the execution token of following word into the callback pointer for the specified function-key

reference: p4_executes in ../src/misc.c:0902, export CO EXECUTES

HEADER ( bstring -- )  

CREATE a new header in the dictionary from the given string, the runtime is the same as with CREATE
 usage: : CREATE  BL WORD HERE HEADER ;

reference: p4_header in ../src/misc.c:1268, export CO HEADER