Core and Core Extension
legend: word implementation state for jsforth
- implemented and working
- implemented but not thoroughly tested
- (partly) implemented or broken
- non-compliant implementation
- delayed/postponed: problem to solve
- not started, thought about or not cared for yet
-
CORE
- !
- #
- #>
- #S
- '
- (
- *
- */
- */MOD
- +
- +!
- +LOOP
- ,
- -
- .
- ."
- /
- /MOD
- 0<
- 0=
- 1+
- 1-
- 2!
- 2*
- 2/
- 2@
- 2DROP
- 2DUP
- 2OVER
- 2SWAP
- :
- ;
- <
- <#
- =
- >
- >BODY
- >IN
- >NUMBER
- >R
- ?DUP
- @
- ABORT
- ABORT"
- ABS
- ACCEPT
- ALIGN
- ALIGNED
- ALLOT
- AND
- BASE
- BEGIN
- BL
- C!
- C,
- C@
- CELL+
- CELLS
- CHAR
- CHAR+
- CHARS
- CONSTANT
- COUNT
- CR
- CREATE
- DECIMAL
- DEPTH
- DO
- DOES>
- DROP
- DUP
- ELSE
- EMIT
- ENVIRONMENT?
- EVALUATE
- EXECUTE
- EXIT
- FILL
- FIND
- FM/MOD
- HERE
- HOLD
- I
- IF
- IMMEDIATE
- INVERT
- J
- KEY
- LEAVE
- LITERAL
- LOOP
- LSHIFT
- MAX
- MIN
- MOD
- MOVE
- NEGATE
- OR
- OVER
- POSTPONE
- QUIT
- R>
- R@
- RECURSE
- REPEAT
- ROT
- RSHIFT
- S"
- S>D
- SIGN
- SM/REM
- SOURCE
- SPACE
- SPACES
- STATE
- SWAP
- THEN
- TYPE
- U.
- U<
- UM/MOD
- UNLOOP
- UNTIL
- VARIABLE
- WHILE
- WORD
- XOR
- ![
- [']
- [CHAR]
- ]
CORE EXT
- #TIB
- .(
- .R
- 0<>
- 0>
- 2>R
- 2R>
- 2R@
- :NONAME
- <>
- ?DO
- AGAIN
- C"
- CASE
- COMPILE,
- CONVERT
- ENDCASE
- ENDOF
- ERASE
- EXPECT
- FALSE
- HEX
- MARKER
- NIP
- OF
- PAD
- PARSE
- PICK
- QUERY
- REFILL
- RESTORE-INPUT
- ROLL
- SAVE-INPUT
- SOURCE-ID
- SPAN
- TIB
- TO
- TRUE
- TUCK
- U.R
- U>
- UNUSED
- VALUE
- WITHIN
- [COMPILE]
- \
DOUBLE/MIXED MATH
- M*
- UM*
- D.
- D.R
- D+
- D=
- D<
- DABS
- DNEGATE
VOCABULARY / WORDLIST EXTENSIONS
- VOCABULARY
- DEFINITIONS
- ORDER
- ONLY
- ALSO
- PREVIOUS
- FORTH
- VOCS
- displays all vocabulary names
The vocabulary implementation in jsforth is not wordlist based, but simulates the Ragsdale/ONLY vocabulary contruct accurately, using the standards selector. There is a restriction associated with it: A maximum of about 20 additional - next to the predefined
ONLY, FORTH and HIDDEN - can be defined.
STRING EXTENSIONS
MEMORY EXTENSIONS
- ALLOCATE
- Both first-fit and best-fit chunk search methods are provided.
- FREE
- RESIZE
- FIT ( – a )
- a variable to control ALLOCATE chunk search:
- FIT OFF - first fit
- FIT ON - best fit
EXCEPTIONS EXTENSIONS
- CATCH
- THROW
BLOCKS FILESYSTEM EXTENSIONS
- BUFFER ( u – a )
- BLOCK ( u – a )
- LIST ( u – )
- SAVE-BUFFERS ( – )
- EMPTY-BUFFERS ( – )
- UPDATE ( – )
- LOAD ( u – )
- THRU ( u1 u2 – )
- +LOAD ( u – )
- +THRU ( u1 u2 – )
- CAPACITY ( – u )
- returns the number of blocks available
- block are mapped on cookies, RAM and web server. server blocks are read/only.
More words from the blocks wordset can be loaded. Among those are:
- CLEAR ( u – )
- COPY ( u1 u2 – )
- LS ( – ) display index of all blocks
- –> ( – )
FLOATING POINT MATH ESTIMATING
- >FLOAT
- D>F
- DF!
- DF@
- DFALIGN
- DFALIGNED
- DFLOAT+
- DFLOATS
- F!
- F*
- F**
- F+
- F-
- F.
- F/
- F0<
- F0=
- F<
- F>D
- F@
- FABS
- FACOS
- FACOSH
- FALIGN
- FALIGNED
- FALOG
- FASIN
- FASINH
- FATAN
- FATAN2
- FATANH
- FCONSTANT
- FCOS
- FCOSH
- FDEPTH
- FDROP
- FDUP
- FE.
- FEXP
- FEXPM1
- FLITERAL
- FLN
- FLNP1
- FLOAT+
- FLOATS
- FLOG
- FLOOR
- FMAX
- FMIN
- FNEGATE
- FOVER
- FROT
- FROUND
- FS.
- FSIN
- FSINCOS
- FSINH
- FSQRT
- FSWAP
- FTAN
- FTANH
- FVARIABLE
- F~
- PRECISION
- REPRESENT
- SET-PRECISION
- SF!
- SF@
- SFALIGN
- SFALIGNED
- SFLOAT+
- SFLOATS
additionally
- 1/F
- F0>
- F>
- F<>
- F.S ( – )
- print contents of floating point stack
COMMON EXTENSIONS
- FOR
- NEXT
- "n FOR ... NEXT" is a countdown loop:
- goes from N down to 1.
- I, J, LEAVE, ?LEAVE, UNLOOP all work with both FOR ... NEXT and DO ... LOOP
- ENDIF
- SKIP ( a1 u1 c – a2 u2 )
- truncate string by skipping all leading occurances of c
- SCAN ( a1 u1 c – a2 u2 )
- truncate string by searching for first occurance of c
- COLD
- perform a cold start:
- sets up stacks
- forgets all added words
- restores dp (here)
- sets number base to 10
- enter interpretation mode
- outputs initial greeting
- WARM
- perform a warm start:
- sets up stacks
- enter interpretation mode
- ,"
- ?EXEC
- ?COMP
- ESC
- the ASCII escape character
- .NAME
- prints word name when given an xt
- NAME
- returns word name as string when given an xt
- BODY>
- given a body (as from >BODY) get back the xt
- HIDE
- REVEAL
- WORDS
- <<
- >>
- aliases for LSHIFT, RSHIFT
- .S
- PROMPT
- PAGE
- CLS
- ON
- OFF
- "variable ON/OFF" sets it to true or false
- EXCHANGE
- ( n addr – m ) dup @ -rot ! ;
- SKIM
- ( addr – addr+ n ) dup cell+ swap @ ;
- or (often more efficient): cell+ dup cell- @
- sometimes known as @+
- -ROT
- RDROP
- drops top return stack element
- CASESENSITIVE
- a variable to turn on/off case sensitivity for vocabulary searches
- ?LEAVE
- equivalent to IF LEAVE THEN
- KEY? ( – f )
- returns true flag if a key is waiting to be picked up with KEY, false otherwise.
- MS ( u – )
- pauses execution for u milliseconds
JSFORTH SPECIFIC
- DU* ( ud1 u – ud2 )
- DEBUGGER ( – a )
- a variable, turn ON for additional diagnostic output
- ALERT ( a n – )
- pops up an alert box with string a n as text.
- CONFIRM ( a n – f )
- pops up a yes/no confirm box with string a n as text. choice is returned as flag
- URL ( a n – )
- opens url in new browser window. gets prepended to url if necessary.
- LOADURL ( a n – )
- opens url in help window.
- HELP
- S(
- put a string on the stack (addr len) in interpret mode. addr len are pointing into the parse buffer, therefore will entering a new line after carriage return overwrite the string.
- POPUPS
- a variable, to turn on of off popup errors alerts. POPUPS OFF routes errors to console.
- NEWERROR ( a n1 n2 – )
- installs string a n1 as error message for uncaught n2 THROW
- example: s( CUSTOM ERROR ) 50 newerror
- empty string s( ) 50 newerror removes that error text again. both negative and positive error numbers are accepted. negative error numbers overwrite system errors texts.
- EPOCHE ( u – )
- returns number of seconds since jan1,1970
- READLINE ( a n1 – n2 )
- reads screen line n1, writes to address a. n2 characters were read.
- WRITELINE ( a n1 n2 – )
- write n1 chars at a to screen line n2
- INFO ( a n – )
- write n chars at address a to info screen.
- SLOW ( – )
- sets variable OUTFILE to use slow output routines
- FAST ( – )
- sets variable OUTFILE to use fast output routines, which cause line breaks during output to not update the screen. KEY, KEY?, MS (i.e. whenever JS-Forth waits for an event), PAGE, CLS, error output, still do.
- STARTCLOCK ( – )
- ELAPSED ( – u )
- calculate elapsed milliseconds since last STARTCLOCK
- RANDOM ( u1 – u2 )
- return a random number between 0 and u1.
MULTIPLE STANDARDS AND DIALECT SUPPORT
- COMPLIANCE ( – a )
- a variable, to select forth standard jsforth should comply to.
- any other value than 0 filters words found by FIND and WORDS, according the selected standard.
- ANS ( – )
- request DPANS94-compliance by writing to variable COMPLIANCE
- F83 ( – )
- request F83-compliance by writing to variable COMPLIANCE
- F79 ( – )
- request F79-compliance by writing to variable COMPLIANCE
- FIG ( – )
- request fig-compliance by writing to variable COMPLIANCE
- JSF ( – )
- makes DPANS words and JSFORTH extensions available.
Whenever a standard is masked, the above words can not be found anymore, as they comply with no standard. To return to a dictionary, which provides those words not strictly belonging to a standard, use JSF (even though JSF is not a word of any standard, it has been made visible through all standards, to make changing standards possible while one has been selected.
- Standards are encoded as bit masks, and thus can be combined.
- Not all words have been correctly categorized according the standards which require them. Not all alternative implementations of those words which changed throughout standards have been supplied yet. The information used for masking words is the same you get with HELP <word> (which is only available in the JSF vocabulary).
- jsforth starts in JSF mode.
- Words with different semantics through standards are implemented by redefinition. one word is filtered by one, another by another standard.
- example: NOT is only available in fig/f79 mode. ' has different implementations for ANS/F83 vs. FIG/F79, as has LEAVE
Different standards have not be consequently set yet, and need to be checked against their corresponding documents.