Until includes a built-in help facility. Simply type:
help any_wordto display the help entry for any_word. The help text is contained in the file HELP.APP. This file is a simple Ascii file. Each entry begins in column 1. Lines with leading spaces (tab characters too) are considered part of the entry. The first blank line is considered end of file. Sample help entries are shown below:
@ ( addr --- value) Fetch the contents of the integer at addr. ! ( n addr --- ) Store n at addr.These help entries set up entries for @ and !.
An alternative approach is compiling the help information into the executable image. This approach was not taken with Until for the following reasons:
The help system is designed to be easy to maintain entries. The data is contained in an Ascii file. It can be edited to match any application that contains Until. See Write Your Own Programming Language Using C++; it includes an entire chapter on HELP.
Several I/O words are vectored in Until by default, the C primitives READ_WA() and FREAD_WA(). The vectoring handles the switch from reading the keyboard to reading a file and back.
The following words may be vectored in Until:
The default Until configuration does not vector any of these words. Define the symbol VECTORED_IO and recompile Until to enable the vectored I/O words.
There is a slight performance penalty for using vectored I/O. The extra level of call indirection causes an extra C call each time any vectored word is called. This is the reason for defaulting to non-vectored I/O.
The I/O vectoring, as currently implemented, is at the C level. You cannot vector high level Forth words. The present scheme provides the hooks. You provide the C functions via primitive words for changing the contents of the vectors and the C functions to call via the vectors. The following steps describe the steps to add your own vector for spaces:
This scheme provides the user with a way to both set and restore the vector for spaces. Adding new vectors for any of the words identified in the word list above can be done using the same steps listed here for spaces().
Vectoring via high level words is not supported in Until in this release. The hooks are there now. Expect vectored execution capabilities to be increased in future releases.
Add discussion of low level C I/O vectoring.
The present floating point package is a minimal implementation. It provides a way to input floating point numbers, manipulate the floating point stack, and output floating point numbers. Any of the C floating point library functions can be easily built upon with the basic capabilities included.
The floating point package uses a separate floating point stack. Floating point numbers all reside on the floating point stack. Addresses and true/false flags all reside on the parameter stack.
f# 3.1417 pi f!moves 3.1417 into the floating point variable pi.
f# 123.45 float-foo f!
f# 2.0 f# 2.0 f* f. 4.00multiplies 2.0 by 2.0 and prints the result on the screen.
f# 1.0 f# 2.0 +The result, 3.0, is left on the top of the floating point stack.
f# 2 f# 1 f-The result, 1.0, is left on the stack.
4 2 /Leaves 2.0 on the top of the floating point stack. There is no remainder.
f# 9 f# 2 f/computes to 4.50.
f# 5 f# 6 f< ( RETURNS true ) f# 5 f# 5 f< ( RETURNS false ) f# 6 f# 5 f< ( RETURNS false )
f# 5 f# 6 f= ( returns false ) f# 5 f# 5 f= ( returns true ) f# 6 f# 5 f= ( returns false )
f# 5 f# 6 f> ( returns false ) f# 5 f# 5 f> ( returns false ) f# 6 f# 5 f> ( returns true )
1 >floatleaves 1.0 on the floating point stack.
ftrash f@retrieves the value stored at ftrash and places it on the top of the floating point stack.
f# 3.1416 fconstant piWhen pi is referenced, the floating point value 3.1416 is pushed onto the floating point stack:
pi ( --- 3.1416 )
f# 1.0 f# 1.0 fdupResults in two 1.0s on the floating point stack.
f# 123.456 float>leaves 123 on the parameter stack.
f# 1 f# 2 foverresults in ( 1.0 2.0 1.0 ).
f# 1 f# 2.0 f# 3.0 frotresults in (2.0 3.0 1.0).
f# 1.0 f# 2.0 fswapresults in the top stack entry being 2.0 and the second entry being 1.0.
fvariable ftrashThe compile time stack comment for variable is ( --- ). At run time, push the address of the floating point variable onto the stack:
ftrash ( --- addr.of.trash )
Table of Contents