Google

CORE-EXT Core words + extensions

The Core Wordset contains the most of the essential words for ANS Forth.



! ( val addr -- )  
ansi .6.1.0010

reference: p4_store in ../src/core.c:0116, export CO !

# ( n.n -- n.n' )  
ansi .6.1.0030
see also HOLD for old-style forth-formatting words and PRINTF of the C-style formatting - this word divides the argument by BASE and add it to the picture space - it should be used inside of <# and #>

reference: p4_sh in ../src/core.c:0129, export CO #

#> ( n.n -- str-addr str-len )  
ansi .6.1.0040
see also HOLD for old-style forth-formatting words and PRINTF of the C-style formatting - this word drops the argument and returns the picture space buffer

reference: p4_sh_greater in ../src/core.c:0140, export CO #>

#S ( n.n -- n.n )   f
ansi .6.1.0050
see also HOLD for old-style forth-formatting words and PRINTF of the C-style formatting - this word does repeat the word # for a number of times, until the argument becomes zero. Hence the result is always null - it should be used inside of <# and #>

reference: p4_sh_s in ../src/core.c:0153, export CO #S

' name ( -- xt )  
ansi .6.1.0070
return the execution token of the following name. This word is _not_ immediate and may not do what you expect in compile-mode. See ['] and '> - note that in FIG-forth the word of the same name had returned the PFA (not the CFA) and was immediate/smart, so beware when porting forth-code from FIG-forth to ANSI-forth.

reference: p4_tick in ../src/core.c:0168, export CO '

( comment) ( -- )  
immediate ansi 11.6.1.0080
eat everything up to the next closing paren - treat it as a comment.

reference: p4_paren in ../src/core.c:0177, export CI (

* ( a b -- a*b )  
ansi .6.1.0090
return the multiply of the two args

reference: p4_star in ../src/core.c:0197, export CO *

*\/ ( a b c -- a*b/c )  
ansi .6.1.0100
regard the b/c as element Q - this word has an advantage over the sequence of * and / by using an intermediate double-cell value

reference: p4_star_slash in ../src/core.c:0209, export CO */

*\/MOD ( a b c -- m n )  
ansi .6.1.0110
has an adavantage over the sequence of * and /MOD by using an intermediate double-cell value.

reference: p4_star_slash_mod in ../src/core.c:0222, export CO */MOD

+ ( a b -- a+b )  
ansi .6.1.0120
return the sum of the two args

reference: p4_plus in ../src/core.c:0231, export CO +

+! ( val addr -- )  
ansi .6.1.0130
add val to the value found in addr
 simulate:
   : +! TUCK @ + SWAP ! ;

reference: p4_plus_store in ../src/core.c:0242, export CO +!

+LOOP ( increment -- )  
smart-word ansi .6.1.0140
compile ((+LOOP)) which will use the increment as the loop-offset instead of just 1. See the DO and LOOP construct.

reference: p4_plus_loop in ../src/core.c:0268, export CS +LOOP

, ( val -- )  
ansi .6.1.0150
store the value in the dictionary
 simulate:
   : , DP  1 CELLS DP +!  ! ;

reference: p4_comma in ../src/core.c:0282, export CO ,

- ( a b -- a-b )  
ansi .6.1.0160
return the difference of the two arguments

reference: p4_minus in ../src/core.c:0290, export CO -

. ( val -- )  
ansi .6.1.0180
print the numerical value to stdout - uses BASE

reference: p4_dot in ../src/core.c:0299, export CO .

." string" ( -- )  
smart-word ansi .6.1.0190
print the string to stdout

reference: p4_dot_quote in ../src/core.c:0319, export CS ."

/ ( a b -- a/b )  
ansi .6.1.0230
return the quotient of the two arguments

reference: p4_slash in ../src/core.c:0337, export CO /

/MOD ( a b -- m n )  
ansi .6.1.0240
divide a and b and return both quotient n and remainder m

reference: p4_slash_mod in ../src/core.c:0348, export CO /MOD

0< ( val -- cond )  
ansi .6.1.0250
return a flag that is true if val is lower than zero
 simulate:
  : 0< 0 < ;

reference: p4_zero_less in ../src/core.c:0358, export CO 0<

0= ( val -- cond )  
ansi .6.1.0270
return a flag that is true if val is just zero
 simulate:
  : 0= 0 = ;

reference: p4_zero_equal in ../src/core.c:0368, export CO 0=

1+ ( val -- val+1 )  
ansi .6.1.0290
return the value incremented by one
 simulate:
  : 1+ 1 + ;

reference: p4_one_plus in ../src/core.c:0378, export CO 1+

1- ( val -- val-1 )  
ansi .6.1.0300
return the value decremented by one
 simulate:
   : 1- 1 - ;

reference: p4_one_minus in ../src/core.c:0388, export CO 1-

2! ( a,a addr -- )  
ansi .6.1.0310
double-cell store

reference: p4_two_store in ../src/core.c:0396, export CO 2!

2* ( a -- a*2 )  
ansi .6.1.0320
multiplies the value with two - but it does actually use a shift1 to be faster
 simulate:
  : 2* 2 * ; ( canonic) : 2* 1 LSHIFT ; ( usual)

reference: p4_two_star in ../src/core.c:0408, export CO 2*

2/ ( a -- a/2 )  
ansi .6.1.0330
divides the value by two - but it does actually use a shift1 to be faster
 simulate:
  : 2/ 2 / ; ( canonic) : 2/ 1 RSHIFT ; ( usual)

reference: p4_two_slash in ../src/core.c:0419, export CO 2/

2@ ( addr -- a,a )  
ansi .6.1.0350
double-cell fetch

reference: p4_two_fetch in ../src/core.c:0427, export CO 2@

2DROP ( a b -- )  
ansi .6.1.0370
double-cell drop, also used to drop two items

reference: p4_two_drop in ../src/core.c:0437, export CO 2DROP

2DUP ( a,a -- a,a a,a )  
ansi .6.1.0380
double-cell duplication, also used to duplicate two items
 simulate:
   : 2DUP OVER OVER ; ( wrong would be : 2DUP DUP DUP ; !!) 

reference: p4_two_dup in ../src/core.c:0448, export CO 2DUP

2OVER ( a,a b,b -- a,a b,b a,a )  
ansi .6.1.0400
double-cell over, see OVER and 2DUP
 simulate:
   : 2OVER SP@ 2 CELLS + 2@ ;

reference: p4_two_over in ../src/core.c:0460, export CO 2OVER

2SWAP ( a,a b,b -- b,b a,a )  
ansi .6.1.0430
double-cell swap, see SWAP and 2DUP
 simulate:
   : 2SWAP LOCALS| B1 B2 A1 A2 | B2 B1 A2 A1 ;

reference: p4_two_swap in ../src/core.c:0472, export CO 2SWAP

: name ( -- )  
ansi .6.1.0450
create a header for a nesting word and go to compiling mode then. This word is usually ended with ; but the execution of the resulting colon-word can also return with EXIT

reference: p4_colon in ../src/core.c:0499, export CO :

; ( -- )  
smart-word ansi .6.1.0460
compiles ((;)) which does EXIT the current colon-definition. It does then end compile-mode and returns to execute-mode. See : and :NONAME

reference: p4_semicolon in ../src/core.c:0523, export CS ;

< ( a b -- cond )  
ansi .6.1.0480
return a flag telling if a is lower than b

reference: p4_less_than in ../src/core.c:0543, export CO <

<# ( -- )  
ansi .6.1.0490
see also HOLD for old-style forth-formatting words and PRINTF of the C-style formatting - this word does initialize the pictured numeric output space.

reference: p4_less_sh in ../src/core.c:0554, export CO <#

= ( a b -- cond )  
ansi .6.1.0530
return a flag telling if a is equal to b

reference: p4_equals in ../src/core.c:0562, export CO =

> ( a b -- cond )  
ansi .6.1.0540
return a flag telling if a is greater than b

reference: p4_greater_than in ../src/core.c:0571, export CO >

>BODY ( addr -- addr' )  
ansi .6.1.0550
adjust the execution-token (ie. the CFA) to point to the parameter field (ie. the PFA) of a word. this is implementation dependent and is usually either "1 CELLS +" or "2 CELLS +"

reference: p4_to_body in ../src/core.c:0583, export CO >BODY

>IN
dict-variable ansi .6.1.0560

no documentation available   (input.to_in)

  • see the ANSI Documentation of this word : ansi .6.1.0560

reference: input.to_in in ../src/core.c:2622, export DV >IN

>NUMBER ( a,a str-adr str-len -- a,a' str-adr' str-len)  
ansi .6.1.0570
try to convert a string into a number, and place that number at a,a respeciting BASE

reference: p4_to_number in ../src/core.c:0592, export CO >NUMBER

>R ( value -- )  
ansi .6.1.0580
save the value onto the return stack. The return stack must be returned back to clean state before an exit and you should note that the return-stack is also touched by the DO ... WHILE loop. Use R> to clean the stack and R@ to get the last value put by >R

reference: p4_to_r in ../src/core.c:0610, export CO >R

?DUP ( value -- value|[nothing] )  
ansi .6.1.0630
one of the rare words whose stack-change is condition-dependet. This word will duplicate the value only if it is not zero. The usual place to use it is directly before a control-word that can go to different places where we can spare an extra DROP on the is-null-part. This makes the code faster and often a little easier to read.
 example:
   : XX BEGIN ?DUP WHILE DUP . 2/ REPEAT ; instead of
   : XX BEGIN DUP WHILE DUP . 2/ REPEAT DROP ;

reference: p4_Q_dup in ../src/core.c:0628, export CO ?DUP

@ ( addr -- value )  
ansi .6.1.0650
fetch the value from the variables address

reference: p4_fetch in ../src/core.c:0637, export CO @

ABORT ( -- )   no-return
ansi 9.6.2.0670
throw - will lead back to the QUIT routine

reference: p4_abort in ../src/core.c:0645, export CO ABORT

ABORT" what" ( -- )   no-return
smart-word ansi 9.6.2.0680
throw like ABORT but print an additional error-message to stdout telling what has happened.

reference: p4_abort_quote in ../src/core.c:0666, export CS ABORT"

ABS ( value -- value' )  
ansi .6.1.0690
return the absolute value

reference: p4_abs in ../src/core.c:0677, export CO ABS

ACCEPT ( a n -- n' )  
ansi .6.1.0695
get a string from terminal into the named input buffer, returns the number of bytes being stored in the buffer. May provide line-editing functions.

reference: p4_accept in ../src/core.c:0688, export CO ACCEPT

ALIGN ( -- )  
ansi .6.1.0705
will make the dictionary aligned, usually to a cell-boundary, see ALIGNED

reference: p4_align in ../src/core.c:0698, export CO ALIGN

ALIGNED ( addr -- addr' )  
ansi .6.1.0706
uses the value (being usually a dictionary-address) and increment it to the required alignment for the dictionary which is usually in CELLS - see also ALIGN

reference: p4_aligned in ../src/core.c:0710, export CO ALIGNED

ALLOT ( count -- )  
ansi .6.1.0710
make room in the dictionary - usually called after a CREATE word like VARIABLE or VALUE to make for an array of variables. Does not initialize the space allocated from the dictionary-heap. The count is in bytes - use CELLS ALLOT to allocate a field of cells.

reference: p4_allot in ../src/core.c:0723, export CO ALLOT

AND ( val mask -- val' )  
ansi .6.1.0720
mask with a bitwise and - be careful when applying it to logical values.

reference: p4_and in ../src/core.c:0732, export CO AND

BASE
dict-variable ansi .6.1.0750

no documentation available   (base)

  • see the ANSI Documentation of this word : ansi .6.1.0750

reference: base in ../src/core.c:2635, export DV BASE

BEGIN ( -- ) compie-time: ( -- cs-marker )  
smart-word ansi .6.1.0760
start a control-loop, see WHILE and REPEAT

reference: p4_begin in ../src/core.c:0741, export CS BEGIN

C! ( value address -- )  
ansi .6.1.0850
store the byte-value at address, see !

reference: p4_c_store in ../src/core.c:0752, export CO C!

C, ( value -- )  
ansi .6.1.0860
store a new byte-value in the dictionary, implicit 1 ALLOT, see ,

reference: p4_c_comma in ../src/core.c:0762, export CO C,

C@ ( addr -- value )  
ansi .6.1.0870
fetch a byte-value from the address, see @

reference: p4_c_fetch in ../src/core.c:0770, export CO C@

CELL+ ( value -- value' )  
ansi .6.1.0880
adjust the value by adding a single Cell's width - the value is often an address or offset, see CELLS

reference: p4_cell_plus in ../src/core.c:0779, export CO CELL+

CELLS ( value -- value' )  
ansi .6.1.0890
scale the value by the sizeof a Cell the value is then often applied to an address or fed into ALLOT

reference: p4_cells in ../src/core.c:0789, export CO CELLS

CHAR a ( -- value )  
ansi .6.1.0895
return the (ascii-)value of the following word's first character.

reference: p4_char in ../src/core.c:0798, export CO CHAR

CHAR+ ( value -- value' )  
ansi .6.1.0897
increment the value by the sizeof one char - the value is often a pointer or an offset, see CHARS

reference: p4_char_plus in ../src/core.c:0815, export CO CHAR+

CHARS ( value -- value' )  
ansi .6.1.0898
scale the value by the sizeof a char - the value is then often applied to an address or fed into ALLOT (did you expect that sizeof(p4char) may actually yield 2 bytes?)

reference: p4_chars in ../src/core.c:0826, export CO CHARS

CONSTANT name ( value -- )  
ansi .6.1.0950
CREATE a new word with runtime ((CONSTANT)) so that the value placed here is returned everytime the constant's name is used in code. See VALUE for constant-like names that are expected to change during execution of the program. In a ROM-able forth the CONSTANT-value may get into a shared ROM-area and is never copied to a RAM-address.

reference: p4_constant in ../src/core.c:0847, export CO CONSTANT

COUNT ( counted-string -- string-pointer string-length )  
ansi .6.1.0980
usually before calling TYPE

reference: p4_count in ../src/core.c:0856, export CO COUNT

CR ( -- )  
ansi .6.1.0990
print a carriage-return/new-line on stdout

reference: p4_cr in ../src/core.c:0870, export CO CR

CREATE name ( -- )  
ansi .6.1.1000
create a name with runtime ((VAR)) so that everywhere the name is used the pfa of the name's body is returned. This word is not immediate and is usually used in the first part of a DOES> defining word.

reference: p4_create in ../src/core.c:0894, export CO CREATE

DECIMAL ( -- )  
ansi .6.1.1170
set the BASE to 10
 simulate:
   : DECIMAL 10 BASE ! ;

reference: p4_decimal in ../src/core.c:0904, export CO DECIMAL

DEPTH ( -- value )  
ansi .6.1.1200
return the depth of the parameter stack before the call, see SP@ - the return-value is in CELLS

reference: p4_depth in ../src/core.c:0913, export CO DEPTH

DO .. LOOP ( end start -- )  
smart-word ansi .6.1.1240
pushes $end and $start onto the return-stack ( >R ) and starts a control-loop that ends with LOOP or +LOOP and may get a break-out with LEAVE . The loop-variable can be accessed with I

reference: p4_do in ../src/core.c:0940, export CS DO

DOES> ( -- pfa )  
smart-word ansi .6.1.1250
does twist the last CREATE word to carry the (DOES>) runtime. That way, using the word will execute the code-piece following DOES> where the pfa of the word is already on stack.

reference: p4_does in ../src/core.c:0981, export CS DOES>

DROP ( a -- )  
ansi .6.1.1260
just drop the word on the top of stack, see DUP

reference: p4_drop in ../src/core.c:0993, export CO DROP

DUP ( a -- a a )  
ansi .6.1.1290
duplicate the cell on top of the stack - so the two topmost cells have the same value (they are equal w.r.t = ) , see DROP for the inverse

reference: p4_dup in ../src/core.c:1003, export CO DUP

ELSE ( -- )  
smart-word ansi .6.1.1310
will compile an ((ELSE)) BRANCH that performs an unconditional jump to the next THEN - and it resolves an IF for the non-true case

reference: p4_else in ../src/core.c:1023, export CS ELSE

EMIT ( char -- )  
ansi .6.1.1320
print the char-value on stack to stdout

reference: p4_emit in ../src/core.c:1037, export CO EMIT

ENVIRONMENT? ( string[str/len] -- false | prop true )  
ansi .6.1.1345
check the environment for a property, usually a condition like questioning the existance of specified wordset, but it can also return some implementation properties like "WORDLISTS" (the length of the search-order) or "#LOCALS" (the maximum number of locals) - this is an ANSI-requirement although I have never seen someone actually using it but some portable forth-code may find it useful...

reference: p4_environment_query in ../src/core.c:1111, export CO ENVIRONMENT?

EVALUATE ( str-ptr str-len -- )  
ansi 7.6.1.1360
INTERPRET the given string, SOURCE id is -1 during that time.

reference: p4_evaluate in ../src/core.c:1200, export CO EVALUATE

EXECUTE ( xt -- )  
ansi .6.1.1370
run the execution-token on stack - this will usually trap if it was null for some reason, see >EXECUTE
 simulate:
  : EXECUTE >R EXIT ;

reference: p4_execute in ../src/core.c:1215, export CO EXECUTE

EXIT ( -- )  
smart-word ansi .6.1.1380
will unnest the current colon-word so it will actually return the word calling it. This can be found in the middle of a colon-sequence between : and ;

reference: p4_exit in ../src/core.c:1225, export CS EXIT

FILL ( mem-addr mem-length char -- )  
ansi .6.1.1540
fill a memory area with the given char, does now simply call memset()

reference: p4_fill in ../src/core.c:1239, export CO FILL

FIND ( bstring -- cfa|bstring -1|0|1 )  
ansi 16.6.1.1550
looks into the current search-order and tries to find the name string as the name of a word. Returns its execution-token or the original-bstring if not found, along with a flag-like value that is zero if nothing could be found. Otherwise it will be 1 if the word had been immediate, -1 otherwise.

reference: p4_find in ../src/core.c:1253, export CO FIND

FM/MOD ( n1.n1 n2 -- m n )  
ansi .6.1.1561
divide the double-cell value n1 by n2 and return both (floored) quotient n and remainder m

reference: p4_f_m_slash_mod in ../src/core.c:1271, export CO FM/MOD

HERE ( -- dp-value )  
ansi .6.1.1650
used with WORD and many compiling words
 simulate:   : HERE DP @ ;

reference: p4_here in ../src/core.c:1282, export CO HERE

HOLD ( char -- )  
ansi .6.1.1670
the old-style forth-formatting system -- this word adds a char to the picutred output string.

reference: p4_hold in ../src/core.c:1291, export CO HOLD

I ( -- value )  
ansi .6.1.1680
returns the index-value of the innermost DO .. LOOP

reference: p4_i in ../src/core.c:1299, export CO I

IF .. THEN ( value -- )  
smart-word ansi .6.1.1700
checks the value on the stack (at run-time, not compile-time) and if true executes the code-piece between IF and the next ELSE or THEN . Otherwise it has compiled a branch over to be executed if the value on stack had been null at run-time.

reference: p4_if in ../src/core.c:1321, export CS IF

IMMEDIATE ( -- )  
ansi .6.1.1710
make the LATEST word immediate, see also CREATE

reference: p4_immediate in ../src/core.c:1332, export CO IMMEDIATE

INVERT ( value -- value' )  
ansi .6.1.1720
make a bitwise negation of the value on stack. see also NEGATE

reference: p4_invert in ../src/core.c:1344, export CO INVERT

J ( -- value )  
ansi .6.1.1730
get the current DO ... LOOP index-value being the not-innnermost. (the second-innermost...) see also for the other loop-index-values at I and K

reference: p4_j in ../src/core.c:1355, export CO J

KEY ( -- char )  
ansi .6.1.1750
return a single character from the keyboard - the key is not echoed.

reference: p4_key in ../src/core.c:1364, export CO KEY

LEAVE ( -- )  
ansi .6.1.1760
quit the innermost DO .. LOOP - it does even clean the return-stack and branches to the place directly after the next LOOP

reference: p4_leave in ../src/core.c:1374, export CO LEAVE

LITERAL ( value -- )  
smart-word ansi .6.1.1780
if compiling this will take the value from the compiling-stack and puts in dictionary so that it will pop up again at the run-time of the word currently in creation. This word is used in compiling words but may also be useful in making a hard-constant value in some code-piece like this:
 : DCELLS [ 2 CELLS ] LITERAL * ; ( will save a multiplication at runtime)

reference: p4_literal in ../src/core.c:1397, export CS LITERAL

LOOP ( -- )  
smart-word ansi .6.1.1800
resolves a previous DO thereby compiling ((LOOP)) which does increment/decrement the index-value and branch back if the end-value of the loop has not been reached.

reference: p4_loop in ../src/core.c:1424, export CS LOOP

LSHIFT ( value shift-val -- value' )  
ansi .6.1.1805
does a bitwise left-shift on value

reference: p4_l_shift in ../src/core.c:1436, export CO LSHIFT

M* ( a b -- m,m )  
ansi .6.1.1810
multiply and return a double-cell result

reference: p4_m_star in ../src/core.c:1445, export CO M*

MAX ( a b -- c )  
ansi .6.1.1870
return the maximum of a and b

reference: p4_max in ../src/core.c:1453, export CO MAX

MIN ( a b -- c )  
ansi .6.1.1880
return the minimum of a and b

reference: p4_min in ../src/core.c:1463, export CO MIN

MOD ( a b -- c )  
ansi .6.1.1890
return the module of "a mod b"

reference: p4_mod in ../src/core.c:1473, export CO MOD

MOVE ( from to length -- )  
ansi .6.1.1900
memcpy an area

reference: p4_move in ../src/core.c:1483, export CO MOVE

NEGATE ( value -- value' )  
ansi .6.1.1910
return the arithmetic negative of the (signed) cell
 simulate:   : NEGATE -1 * ;

reference: p4_negate in ../src/core.c:1493, export CO NEGATE

OR ( a b -- ab )  
ansi .6.1.1980
return the bitwise OR of a and b - unlike AND this is usually safe to use on logical values

reference: p4_or in ../src/core.c:1502, export CO OR

OVER ( a b -- a b a )  
ansi .6.1.1990
get the value from under the top of stack. The inverse operation would be TUCK

reference: p4_over in ../src/core.c:1512, export CO OVER

POSTPONE word ( -- )  
smart-word ansi .6.1.2033
will compile the following word at the run-time of the current-word which is a compiling-word. The point is that POSTPONE takes care of the fact that word may be an IMMEDIATE-word that flags for a compiling word, so it must be executed (and not pushed directly) to compile sth. later. Choose this word in favour of COMPILE (for non-immediate words) and [COMPILE] (for immediate words)

reference: p4_postpone in ../src/core.c:1536, export CS POSTPONE

QUIT ( -- )   no-return
ansi .6.1.2050
this will throw and lead back to the outer-interpreter. traditionally, the outer-interpreter is called QUIT in forth itself where the first part of the QUIT-word had been to clean the stacks (and some other variables) and then turn to an endless loop containing QUERY and EVALUATE (otherwise known as INTERPRET ) - in pfe the primary cleanup is done through a longjmp due to the implicit THROW .

reference: p4_quit in ../src/core.c:1558, export CO QUIT

R> ( -- value )  
ansi .6.1.2060
get back a value from the return-stack that had been saved there using >R . This is the traditional form of a local var space that could be accessed with R@ later. If you need more local variables you should have a look at LOCALS| which does grab some space from the return-stack too, but names them the way you like.

reference: p4_r_from in ../src/core.c:1571, export CO R>

R@ ( -- value )  
ansi .6.1.2070
fetch the (upper-most) value from the return-stack that had been saved there using >R - This is the traditional form of a local var space. If you need more local variables you should have a look at LOCALS| , see also >R and R> .

reference: p4_r_fetch in ../src/core.c:1582, export CO R@

RECURSE ( ? -- ? )  
immediate ansi .6.1.2120
when creating a colon word the name of the currently-created word is smudged, so that you can redefine a previous word of the same name simply by using its name. Sometimes however one wants to recurse into the current definition instead of calling the older defintion. The RECURSE word does it exactly this.
   traditionally the following code had been in use:
   : GREAT-WORD [ UNSMUDGE ] DUP . 1- ?DUP IF GREAT-WORD THEN ;
   now use
   : GREAT-WORD DUP . 1- ?DUP IF RECURSE THEN ;

reference: p4_recurse in ../src/core.c:1599, export CI RECURSE

REPEAT ( -- )  
smart-word ansi .6.1.2140
ends an unconditional loop, see BEGIN

reference: p4_repeat in ../src/core.c:1611, export CS REPEAT

ROT ( a b c -- b c a )  
ansi .6.1.2160
rotates the three uppermost values on the stack, the other direction would be with -ROT - please have a look at LOCALS| and VAR that can avoid its use.

reference: p4_rot in ../src/core.c:1628, export CO ROT

RSHIFT ( value shift-val -- value' )  
ansi .6.1.2162
does a bitwise logical right-shift on value (ie. the value is considered to be unsigned)

reference: p4_r_shift in ../src/core.c:1641, export CO RSHIFT

S" string" ( -- string-address string-length)  
smart-word ansi 11.6.1.2165
if compiling then place the string into the currently compiled word and on execution the string pops up again as a double-cell value yielding the string's address and length. To be most portable this is the word to be best being used. Compare with C" and non-portable "

reference: p4_s_quote in ../src/core.c:1667, export CS S"

S>D ( a -- a,a' )  
ansi .6.1.2170
signed extension of a single-cell value to a double-cell value

reference: p4_s_to_d in ../src/core.c:1699, export CO S>D

SIGN ( a -- )  
ansi .6.1.2210
put the sign of the value into the hold-space, this is the forth-style output formatting, see HOLD

reference: p4_sign in ../src/core.c:1709, export CO SIGN

SM/REM ( a.a b -- c d )  
ansi .6.1.2214
see /MOD or FM/MOD or UM/MOD or SM/REM

reference: p4_s_m_slash_rem in ../src/core.c:1718, export CO SM/REM

SOURCE ( -- buffer IN-offset )  
ansi .6.1.2216
the current point of interpret can be gotten through SOURCE. The buffer may flag out TIB or BLK or a FILE and IN gives you the offset therein. Traditionally, if the current SOURCE buffer is used up, REFILL is called that asks for another input-line or input-block. This scheme would have made it impossible to stretch an [IF] ... [THEN] over different blocks, unless [IF] does call REFILL

reference: p4_source in ../src/core.c:1734, export CO SOURCE

SPACE ( -- )  
ansi .6.1.2220
print a single space to stdout, see SPACES
 simulate:    : SPACE  BL EMIT ;

reference: p4_space in ../src/core.c:1749, export CO SPACE

SPACES ( n -- )  
ansi .6.1.2230
print n space to stdout, actually a loop over n calling SPACE , but the implemenation may take advantage of printing chunks of spaces to speed up the operation.

reference: p4_spaces in ../src/core.c:1759, export CO SPACES

STATE
dict-variable ansi 15.6.2.2250

no documentation available   (state)

  • see the ANSI Documentation of this word : ansi 15.6.2.2250

reference: state in ../src/core.c:2700, export DV STATE

SWAP ( a b -- b a )  
ansi .6.1.2260
exchanges the value on top of the stack with the value beneath it

reference: p4_swap in ../src/core.c:1767, export CO SWAP

THEN ( -- )  
smart-word ansi .6.1.2270
does resolve a branch coming from either IF or ELSE

reference: p4_then in ../src/core.c:1778, export CS THEN

TYPE ( string-pointer string-length -- )  
ansi .6.1.2310
prints the string-buffer to stdout, see COUNT and EMIT

reference: p4_type in ../src/core.c:1789, export CO TYPE

U. ( value )  
ansi .6.1.2320
print unsigned number to stdout

reference: p4_u_dot in ../src/core.c:1797, export CO U.

U< ( a b -- cond )  
ansi .6.1.2340
unsigned comparison, see <

reference: p4_u_less_than in ../src/core.c:1806, export CO U<

UM* ( a b -- c,c )  
ansi .6.1.2360
unsigned multiply returning double-cell value

reference: p4_u_m_star in ../src/core.c:1815, export CO UM*

UM/MOD ( a b -- c,c )  
ansi .6.1.2370
see /MOD and SM/REM

reference: p4_u_m_slash_mod in ../src/core.c:1823, export CO UM/MOD

UNLOOP ( -- )  
ansi .6.1.2380
drop the DO .. LOOP runtime variables from the return-stack, usually used just in before an EXIT call. Using this multiple times can unnest multiple nested loops.

reference: p4_unloop in ../src/core.c:1835, export CO UNLOOP

UNTIL ( cond -- )  
smart-word ansi .6.1.2390
ends an control-loop, see BEGIN and compare with WHILE

reference: p4_until in ../src/core.c:1843, export CS UNTIL

VARIABLE name ( -- )  
ansi .6.1.2410
CREATE a new variable, so that everytime the variable is name, the address is returned for using with @ and ! - be aware that in FIG-forth VARIABLE did take an argument being the initial value. ANSI-forth does different here.

reference: p4_variable in ../src/core.c:1858, export CO VARIABLE

WHILE ( cond -- )  
smart-word ansi .6.1.2430
middle part of a BEGIN .. WHILE .. REPEAT control-loop - if cond is true the code-piece up to REPEAT is executed which will then jump back to BEGIN - and if the cond is null then WHILE will branch to right after the REPEAT (compare with UNTIL that forms a BEGIN .. UNTIL loop)

reference: p4_while in ../src/core.c:1872, export CS WHILE

WORD ( delimiter-char -- )  
ansi .6.1.2450
read the next SOURCE section (thereby moving >IN ) up to the point reaching $delimiter-char - the text is placed at HERE - where you will find a counted string. You may want to use PARSE instead.

reference: p4_word in ../src/core.c:1889, export CO WORD

XOR ( a b -- ab )  
ansi .6.1.2490
return the bitwise-or of the two arguments - it may be unsafe use it on logical values. beware.

reference: p4_xor in ../src/core.c:1898, export CO XOR

[ ( -- )  
immediate ansi .6.1.2500
leave compiling mode - often used inside of a colon-definition to make fetch some very constant value and place it into the currently compiled colon-defintion with , or LITERAL - the corresponding unleave word is ]

reference: p4_left_bracket in ../src/core.c:1910, export CI [

['] name ( -- )   immediate
smart-word ansi .6.1.2510
will place the execution token of the following word into the dictionary. Does often not do what you expect in non-compiling mode. See ' and '> and may be POSTPONE

reference: p4_bracket_tick in ../src/core.c:1921, export CS [']

[CHAR] charword ( -- char )  
smart-word ansi .6.1.2520
in compile-mode, get the (ascii-)value of the first charachter in the following word and compile it as a literal so that it will pop up on execution again. See CHAR and ASCII

reference: p4_bracket_char in ../src/core.c:1935, export CS [CHAR]

] ( -- )  
ansi .6.1.2540
enter compiling mode - often used inside of a colon-definition to end a previous [ - you may find a , or LITERAL nearby in example texts.

reference: p4_right_bracket in ../src/core.c:1949, export CO ]

#TIB
dict-variable ansi .6.2.0060

no documentation available   (input.number_tib)

  • see the ANSI Documentation of this word : ansi .6.2.0060

reference: input.number_tib in ../src/core.c:2719, export DV #TIB

.( message) ( -- )  
immediate ansi .6.2.0200
print the message to the screen while reading a file. This works too while compiling, so you can whatch the interpretation/compilation to go on. Some Forth-implementations won't even accept a ." message" outside compile-mode while the (current) pfe does.

reference: p4_dot_paren in ../src/core.c:1964, export CI .(

.R ( val prec -- )  
ansi .6.2.0210
print with precision - that is to fill a field of the give prec-with with right-aligned number from the converted value

reference: p4_dot_r in ../src/core.c:1993, export CO .R

0<> ( value -- cond )  
ansi .6.2.0260
returns a logical-value saying if the value was not-zero. This is most useful in turning a numerical value into a boolean value that can be fed into bitwise words like AND and XOR - a simple IF or WHILE doesn't need it actually.

reference: p4_zero_not_equals in ../src/core.c:2008, export CO 0<>

0> ( value -- cond )  
ansi .6.2.0280
return value greater than zero
 simulate:    : 0> 0 > ;

reference: p4_zero_greater in ../src/core.c:2017, export CO 0>

2>R ( a,a -- )  
ansi .6.2.0340
save a double-cell value onto the return-stack, see >R

reference: p4_two_to_r in ../src/core.c:2025, export CO 2>R

2R> ( -- a,a )  
ansi .6.2.0410
pop back a double-cell value from the return-stack, see R> and the earlier used 2>R

reference: p4_two_r_from in ../src/core.c:2036, export CO 2R>

2R@ ( -- a,a )  
ansi .6.2.0415
fetch a double-cell value from the return-stack, that had been previously been put there with 2>R - see R@

reference: p4_two_r_fetch in ../src/core.c:2047, export CO 2R@

:NONAME ( -- cs.value )  
ansi .6.2.0455
start a colon nested-word but do not use CREATE - so no name is given to the colon-definition that follows. When the definition is finished at the corresponding ; the start-address (ie. the execution token) can be found on the outer cs.stack that may be stored used elsewhere then.

reference: p4_colon_noname in ../src/core.c:2061, export CO :NONAME

<>
ansi .6.2.0500

no forth documentation available   (p4_not_equals)

  • see the ANSI Documentation of this word : ansi .6.2.0500

reference: p4_not_equals in ../src/core.c:2074, export CO <>

?DO .. LOOP ( end start -- )  
smart-word ansi .6.2.0620
start a control-loop just like DO - but don't execute atleast once. Instead jump over the code-piece if the loop's variables are not in a range to allow any loop.

reference: p4_Q_do in ../src/core.c:2096, export CS ?DO

AGAIN ( -- )  
smart-word ansi .6.2.0700
ends an infinite loop, see BEGIN and compare with WHILE

reference: p4_again in ../src/core.c:2109, export CS AGAIN

C" string" ( -- bstring )  
smart-word ansi .6.2.0855
in compiling mode place the following string in the current word and return the address of the counted string on execution. (in exec-mode use a POCKET and leave the bstring-address of it), see S" string" and the non-portable " string"

reference: p4_c_quote in ../src/core.c:2133, export CS C"

CASE ( comp-value -- comp-value )  
smart-word ansi .6.2.0873
start a CASE construct that ends at ENDCASE and compares the value on stack at each OF place

reference: p4_case in ../src/core.c:2158, export CS CASE

COMPILE, ( xt -- )  
ansi .6.2.0945
place the execution-token on stack into the dictionary - in traditional forth this is not even the least different than a simple , but in call-threaded code there's a big difference - so COMPILE, is the portable one. Unlike COMPILE , [COMPILE] and POSTPONE this word does not need the xt to have actually a name, see :NONAME

reference: p4_compile_comma in ../src/core.c:2175, export CO COMPILE,

CONVERT ( a b -- a b )  
ansi .6.2.0970
digit conversion, obsolete, superseded by >NUMBER

reference: p4_convert in ../src/core.c:2183, export CO CONVERT

ENDCASE ( comp-value -- )  
smart-word ansi .6.2.1342
ends a CASE construct that may surround multiple sections of OF ... ENDOF code-portions. The ENDCASE has to resolve the branches that are necessary at each ENDOF to point to right after ENDCASE

reference: p4_endcase in ../src/core.c:2196, export CS ENDCASE

ENDOF ( -- )  
smart-word ansi .6.2.1343
resolve the branch need at the previous OF to mark a code-piece and leave with an unconditional branch at the next ENDCASE (opened by CASE )

reference: p4_endof in ../src/core.c:2212, export CS ENDOF

ERASE
ansi .6.2.1350

no forth documentation available   (p4_erase)

  • see the ANSI Documentation of this word : ansi .6.2.1350

reference: p4_erase in ../src/core.c:2224, export CO ERASE

EXPECT ( str-adr str-len -- )  
ansi .6.2.1390
input handling, see WORD and PARSE and QUERY the input string is placed at str-adr and its length
 in => SPAN - this word is superceded by => ACCEPT

reference: p4_expect in ../src/core.c:2235, export CO EXPECT

FALSE
constant ansi .6.2.1485

no documentation available   (P4_FALSE)

  • see the ANSI Documentation of this word : ansi .6.2.1485

reference: P4_FALSE in ../src/core.c:2739, export OC FALSE

HEX ( -- )  
ansi .6.2.1660
set the input/output BASE to hexadecimal
 simulate:        : HEX 16 BASE ! ;

reference: p4_hex in ../src/core.c:2244, export CO HEX

MARKER name  
ansi .6.2.1850
create a named marker that you can use for FORGET the ANSI-standard does even require to reset the search-order which is not done in pfe (FIXME:)

reference: p4_marker in ../src/core.c:2262, export CO MARKER

NIP ( a b -- b )  
ansi .6.2.1930
drop the value under the top of stack, inverse of TUCK
 simulate:        : NIP SWAP DROP ;

reference: p4_nip in ../src/core.c:2271, export CO NIP

OF .. ENDOF ( comp-value case-value -- comp-value )  
smart-word ansi .6.2.1950
compare the case-value placed lately with the comp-value being available since CASE - if they are equal run the following code-portion up to ENDOF after which the case-construct ends at the next ENDCASE

reference: p4_of in ../src/core.c:2294, export CS OF

PAD ( -- addr )  
ansi .6.2.2000
transient buffer region

reference: p4_pad in ../src/core.c:2307, export CO PAD

PARSE ( buffer-start buffer-count delim-char -- )  
ansi .6.2.2008
parse a piece of input (not much unlike WORD) and place it into the given buffer. The difference with word is also that WORD would first skip any delim-char while PARSE does not and thus may yield that one.

reference: p4_parse in ../src/core.c:2318, export CO PARSE

PICK ( n -- value )  
ansi .6.2.2030
pick the nth value from under the top of stack and push it note that
   0 PICK -> DUP         1 PICK -> OVER

reference: p4_pick in ../src/core.c:2346, export CO PICK

QUERY
ansi .6.2.2040

no documentation available   (p4_query)

  • see the ANSI Documentation of this word : ansi .6.2.2040

reference: p4_query in ../src/core.c:2747, export CO QUERY

REFILL ( -- flag )  
ansi 11.6.2.2125
try to get a new input line from the SOURCE and set >IN accordingly. Return a flag if sucessful, which is always true if the current input comes from a terminal and which is always false if the current input comes from EVALUATE - and may be either if the input comes from a file

reference: p4_refill in ../src/core.c:2359, export CO REFILL

RESTORE-INPUT ( xn ... x1 -- )  
ansi .6.2.2148
inverse of SAVE-INPUT

reference: p4_restore_input in ../src/core.c:2367, export CO RESTORE-INPUT

ROLL ( xn xm ... x1 n -- xm ... x1 xn )  
ansi .6.2.2150
the extended form of ROT
    2 ROLL -> ROT

reference: p4_roll in ../src/core.c:2380, export CO ROLL

SAVE-INPUT ( -- xn .. x1 )  
ansi .6.2.2182
fetch the current state of the input-channel which may be restored with RESTORE-INPUT later

reference: p4_save_input in ../src/core.c:2394, export CO SAVE-INPUT

SOURCE-ID
dict-constant ansi 11.6.1.2218

no documentation available   (input.source_id)

  • see the ANSI Documentation of this word : ansi 11.6.1.2218

reference: input.source_id in ../src/core.c:2752, export DC SOURCE-ID

SPAN
dict-variable ansi .6.2.2240

no documentation available   (span)

  • see the ANSI Documentation of this word : ansi .6.2.2240

reference: span in ../src/core.c:2753, export DV SPAN

TIB
dict-constant ansi .6.2.2290

no documentation available   (input.tib)

  • see the ANSI Documentation of this word : ansi .6.2.2290

reference: input.tib in ../src/core.c:2754, export DC TIB

TO name ( value -- )  
smart-word ansi 13.6.1.2295
set the parameter field of name to the value, this is used to change the value of a VALUE and it can be also used to change the value of LOCALS|

reference: p4_to in ../src/core.c:2413, export CS TO

TRUE
constant ansi .6.2.2298

no documentation available   (P4_TRUE)

  • see the ANSI Documentation of this word : ansi .6.2.2298

reference: P4_TRUE in ../src/core.c:2756, export OC TRUE

TUCK ( a b -- b a b )  
ansi .6.2.2300
shove the top-value under the value beneath. See OVER and NIP
 simulate:    : TUCK  SWAP OVER ;

reference: p4_tuck in ../src/core.c:2450, export CO TUCK

U.R ( value prec -- )  
ansi .6.2.2330
print right-aligned in a prec-field, treat value to be unsigned as opposed to .R

reference: p4_u_dot_r in ../src/core.c:2462, export CO U.R

U> ( a b -- ab )  
ansi .6.2.2350
unsigned comparison of a and b, see >

reference: p4_u_greater_than in ../src/core.c:2472, export CO U>

UNUSED ( -- val )  
ansi .6.2.2395
return the number of cells that are left to be used above HERE

reference: p4_unused in ../src/core.c:2482, export CO UNUSED

VALUE name ( value -- )  
ansi .6.2.2405
CREATE a word and initialize it with value. Using it later will push the value back onto the stack. Compare with VARIABLE and CONSTANT - look also for LOCALS| and VAR

reference: p4_value in ../src/core.c:2501, export CO VALUE

WITHIN ( a b c -- cond )  
ansi .6.2.2440
a widely used word, returns ( b <= a && a < c ) so that is very useful to check an index a of an array to be within range b to c

reference: p4_within in ../src/core.c:2512, export CO WITHIN

[COMPILE] word ( -- )  
immediate ansi .6.2.2530
while compiling the next word will be place in the currently defined word no matter if that word is immediate (like IF ) - compare with COMPILE and POSTPONE

reference: p4_bracket_compile in ../src/core.c:2524, export CI [COMPILE]

\ comment ( -- )  
immediate
eat everything up to the next end-of-line so that it is getting ignored by the interpreter.

reference: p4_backslash in ../src/core.c:2535, export CI \\

ENVIRONMENT?? ( -- )  

show the current list of wordsets NOTE, this is superfluous in PFE due to the LOADED dictionary that lists them too

reference: p4_environment_dump in ../src/core.c:1047, export CO ENVIRONMENT??

" string" ( -- bstring ) or sometimes ( -- string-ptr string-count )  
smart-word
This is the non-portable word which is why the ANSI-committee on forth has created two other word, namely S" and C" , since each implementation (and in pfe configurable) uses another result. FIG-forth did return bstring.

reference: p4_quote in ../src/core.c:2559, export CS "