Additional Control Commands

Table 4-32 contains descriptions of additional program execution control commands.

Table 4-32 Program Execution Control Commands

Command

Stack Diagram

Description

abort

( -- )

Abort current execution and interpret keyboard commands.

abort" ccc"

( abort? -- )

If abort? is true, abort and display message.

eval

( addr len -- )

Interpret Forth source from addr len.

execute

( xt -- )

Execute the word whose execution token is on the stack.

exit

( -- )

Return from the current word. (Cannot be used in counted loops.)

quit

( -- )

Same as abort, but leave stack intact.

abort causes immediate termination and returns control to the keyboard. abort" is similar to abort but is different in two respects. abort" removes a flag from the stack and only aborts if the flag is true. Also, abort" prints any desired message when the abort takes place.

eval takes a string from the stack (specified as an address and a length). The characters in that string are then interpreted as if they were entered from the keyboard. If a Forth text file has been loaded into memory (see Chapter 5, Loading and Executing Programs), then eval can be used to compile the definitions contained in the file.