wls@astrovax.UUCP (William L. Sebok) (07/13/84)
Part 4 of 8 file with parts before and after "Cut here" lines removed:
size = 64414 bytes Checksum = 5392989
-----------cut here and extract with sh not csh -----------
mkdir ./doc
/bin/echo 'Extracting ./doc/forth3'
sed 's/^X//' <<'//go.sysin dd *' >./doc/forth3
F0< fl_f --- flag floating
Returns 1 if floating point number `fl_f' is less than or equal to zero,
otherwise it returns 0.
F0= fl_f --- flag floating
Returns 1 if floating point number `fl_f' is equal to zero, otherwise it
returns 0.
F0> fl_f --- flag floating
Returns 1 if floating point number `fl_f' is greater than or equal to
zero, otherwise it returns 0.
F2* x_f --- 2*x_f floating
Multiply floating point number `x_f' by 2. Operation on floating point
zero leaves floating point zero. "f-two-times"
F2/ x_f --- x_f/2 floating
Leave floating point number `x_f' divided by two. Operation on floating
point zero leaves floating point zero. "f-two-divide"
F2^N* x_f n --- y_f floating
Multiply floating point number `x_f' by 2 to the `n'th power.
F< a_f b_f --- flag floating
Returns 1 if floating point number `a_f' is less than floating point
number `b_f', otherwise it returns 0.
F= a_f b_f --- flag floating
Returns 1 if floating point number `a_f' is equal to floating point
number `b_f', otherwise it returns 0.
F> a_f b_f --- flag floating
Returns 1 if floating point number `a_f' is greater than floating point
number `b_f', otherwise it returns 0.
F>R fl_f --- floating
Transfer `fl_f' to the return stack. Every F>R must be balanced by
a FR> in the same "DO-LOOP" nesting level of a colon definition.
F@ addr --- fl_f floating
Leave on the floating point stack the floating point number contained
at addr. "f fetch"
FA --- fa floating
Leaves on the parameter stack the number of bytes in a floating point
number.
FA1+ a1 --- a2 Local
Increment address `a1' by the size in bytes of a single precision
floating point.
FA1- a1 --- a2 Local
Decrement address `a1' by the size in bytes of a single precision
floating point number.
FA+ addr1 n --- addr2 floating
Multiply `n' by the floating point cell size and add to address `addr1'.
(i.e. construct the address of the `n'th floating point cell beyond
`addr1').
FA++ a1 --- a2 Local,obsolete
Increment address `a1' by the size in bytes of a single precision
floating point number. (Synonym for FA1+ ).
FA-- a1 --- a2 Local,obsolete
Decrement address `a1' by the size in bytes of a single precision
floating point number. (Synonym for FA1- ).
FABS fl_f --- |fl_f| floating
Return the absolute value of `fl_f' on the floating point stack.
FARRAY n --- floating
Used in definitions of the form:
n FARRAY name
To define an area of memory with space reserved for `n' floating point
numbers.
The contents of this memory is filled with floating
point zeroes.
The child is defined as a word of the form
indx --- addr
which takes a floating point index number `indx' and return the address
of that floating point number in the array ( `indx' = 0 corresponds to
the first element in the array).
FASK --- num_f flag local
A number is read from the input stream up to the next trailing blank
or tab and is returned on the floating point stack as floating point
`num_f'. `flag' is false (0) if the number was valid and true (1) if
the number was invalid.
FCONSTANT n --- floating
A defining word used in the form:
x_f FCONSTANT <name>
to create a dictionary entry for <name>, leaving floating point number
`x_f' in its parameter field. When <name> is later executed, `x_f'
will be left on the floating point stack.
FCREATE --- unix-interface
Used in statements of the form:
size FCREATE filename
Create a file named `filename' containing `size' 1024 byte forth
screens. Each screen contains one initial null byte and 1023 blank
bytes.
An abort occurs if there are errors in the creation or writing of the
file.
FDEPTH --- n floating
Return on the parameter stack a count of the number of floating point
numbers on the floating point stack.
FDEPTH --- n floating
Returns on the parameter stack the number of floating point numbers on
the floating point stack.
FDIR --- fdir_s local
Place on the string stack the name of the Forth home directory.
FDROP fl_f --- floating
Drop the top floating point number from the floating point stack.
FDUP fl_f --- fl_f fl_f floating
Leave a copy on the floating point stack of the top number on the
floating point stack.
FF local
Transmit a Carriage return and Form Feed character to the current
output device.
FILL addr n byte --- 234
Fill memory beginning at address addr with a sequence of `n' copies of
`byte'. If the quantity `n' is less than or equatl to zero, take no
action.
FIND --- addr 203
Leave the compilation address of the next word name, which is accepted
from the input stream. If that word cannot be found in the dictionary
after a search of CONTEXT and FORTH leave zero.
FIX fl_f --- d_2 floating
Convert the floating point number `fl_f' to an integer by truncation
toward zero, returning the result as the double integer `d_2'.
FLITERAL num_f --- I,local
If compiling, then compile the floating point number `num_f' as a
floating point literal, which, when later executed, will leave `num_f'
on the floating point stack.
FLOAD --- unix-interface
Load the contents of a file. Used in a command of the form:
FLOAD name
The forth interpreter will start to interpret the contents of file
`name'. This file can either be a regular text file (i.e. lines
separated by newlines), or a forth screen-format file (constant width
lines of 64 characters). LOAD's, FLOAD's, and LOADF's can nest to
any level (or at least until return stack overflow).
Note: words that grab a string from the input stream cannot be
guaranteed to work if the word and its string are separated by the end
of a line.
It will first try to find the file in the current directory. If that
fails it will try the FORTH library directory (i.e. the directory
defined by the string SDIR). If the file name begins with a '<' (i.e.
a less-than symbol) the '<' character is stripped off and only the
FORTH library directory is searched. If everything fails an abort is
taken.
NOTE: need to implement a search path.
Implementation note: FLOAD is implemented using the CHANBOT mechanism
of BLOCK. The current byte offset within the file is kept in user
variable >LOC. Making FLOAD's able to nest was a real pain.
FLOAT d_2 --- fl_f floating
Convert double integer `d_2' to a floating point number.
FLUSH
Write all block buffers to mass-storage that have been flagged as
UPDATEd. An error condition results if mass-storage writing is not
completed.
FNEGATE a_f --- -a_f floating
Leaves the negative of `a_f' on the floating point stack.
FORGET 186
Execute in the form:
FORGET <name>
Delete from the dictionary the word <name> (which is in the current
vocabulary) and all words added to dictionary after <name>, regardless
of their vocabulary. Failure to find <name> in CURRENT or FORTH is an
error condition.
CONTEXT is set equal to CURRENT.
An attempt to FORGET below the FENCE of a vocabulary is an error
condition.
FORTH I,187
The name of the primary vocabulary. Execution makes FORTH the
CONTEXT vocabulary.
New definitions become a part of FORTH until a different CURRENT
vocabulary is established.
User vocabularies conclude by "chaining" to FORTH, so it should
be considered that FORTH is "contained" within each user's vocabulary.
FOVER fl1_f fl2_f --- fl1_f fl2_f fl1_f floating
Leave on the floating point stack a copy of the second number on the
floating point.
FPICK n --- fl_f floating
Return the contents of the nth floating point stack value (`n' is
passed on top of parameter stack). n = 1 for top of stack. An error
condition results when n < 1.
FR> --- fl_f floating
Transfer `fl_f' from the return stack to the floating point stack.
FROLL n --- floating
Extract the n-th stack value to the top of the stack, moving the
remaining values into the vacated positions. `n' is passed on the
parameter stack. An error condition results when `n' is less than 1.
{ 1 .. n }
3 FROLL = FROT
2 FROLL = FSWAP
1 FROLL = null operation
FROT fl1_f fl2_f fl3_f --- fl2_f fl3_f fl1_f floating
Rotate the top three numbers on the floating point stack, bringing the
deepest to the top. "f rote"
FSBOT --- addr U,local
Returns the address of a variable which contains the address of the
bottom of the floating point stack.
FSTACK --- local
Print out the contents of the floating point stack in exponential
format. Top of stack is to the right.
FSWAP fl1_f fl2_f --- fl2_f fl1_f floating
Exchange the top two floating point stack values.
FVARIABLE --- floating
A defining word executed in the form:
FVARIABLE <name>
to create a dictionary entry for <name> and allot space for storage
of a floating point number in the parameter field. The application
must initialize the stored value. When <name> is later executed, it
will place the storage address on the stack.
GETENV key_s --- result_s 1 unix-interface
or key_s --- 0
Provides access to the the Unix "environment" strings passed to the
current invocation of the Forth compiler. A search in the environment
is made for the existence of the string `key_s'. If the search is
successful 0 is returned on the parameter stack. If the search is
unsuccessful 1 is returned on the parameter stack and the rest of the
environment string after the `=' character is returned on the string
stack.
H! n_1 addr --- local
Take the low order 2 bytes of the 1 stack cell size number `n_1' and
store it as a 2-byte integer at address `addr'.
H!++ addr1 n_1 --- addr2 local
Take the low order 2 bytes of the 1 stack cell size number `n_1' and
store it as a 2-byte integer at address `addr'. The address is
incremented by two bytes and returned as `addr2'.
H, n_1 --- local
Take the low order 2 bytes of the 1 stack cell size number `n_1' and
compile it into the next two bytes of the dictionary.
H@ addr --- n_1 local
Access the signed 2-byte integer pointed to by the address `addr',
placing it on the parameter stack in an entry occupying one stack cell
size.
H@++ addr1 --- addr2 n_1 local
Access the signed 2-byte integer pointed to by the address `addr2',
placing it on the parameter stack in an entry occupying one stack cell
size. The address is incremented by two bytes and returned as `addr2'.
HEAD --- head U,local
Returns a variable containing a pointer to the header field of the
last dictionary entry created. The header field contains the name
of the dictionary entry and flags.
HERE --- addr 188
Return the address of the next available dictionary location.
HEX 162,reference.
Set the input-output numeric conversion base to sixteen.
HOLD char --- 175
Insert `char' into a pictured numeric output string. May only be used
between <# and #> .
HUP --- Unix-interface
Enable the catching of some of the Unix signals. Currently signals
SIGINT, SIGILL SIGFPE, SIGBUS, SIGSEGV, SIGSYS, SIGPIPE, and SIGTSTP
are caught. All but the last will cause a message to be printed and an
abort back to the outer interpreter.
BUGS: this name choice for this word is poor as SIGHUP itself is not
touched.
I --- n C,136
Copy the loop index onto the parameter stack. May be only used in
the form:
DO . . . I . . . LOOP or DO . . . I . . . +LOOP
IASK --- num flag local
A number is read from the input stream up to the next trailing blank
or tab and is returned on the stack as `num'. `flag' is false (0) if
the number was valid and true (1) if the number was invalid.
ICODE VAX
A defining word used in the form:
ICODE <name> ... END-CODE
to create a dictionary entry for <name> to be defined by a following
sequence of assembly language words. ASSEMBLER becomes the context
vocabulary. When <name> is compiled, all of the machine instructions
compiled between ICODE and END-CODE are bodily inserted into the
dictionary.
ICON n --- VAX
A defining word used in the form:
n ICON <name>
to create a dictionary entry form <name>. When <name> is compiled
an in-line reference to n will be created in the dictionary which when
executed will leave n on the stack. n cannot be accessed through its
parameter field. <name> can also be directly executed, also leaving n
on the stack.
IF flag --- I,C,210
Used in a colon-definition in the forms:
flag IF . . . ELSE . . . THEN or
flag IF . . . THEN
If flag is true, the words following IF are executed and the words
following ELSE are skipped. The ELSE part is optional.
If flag is false, words between IF and ELSE, or between IF and THEN
(when no ELSE is used), are skipped. IF-ELSE-THEN conditionals may
be nested.
IMMEDIATE 103
Mark the most recently made dictionary entry as a word which will be
executed when encountered during compilation rather than compiled.
INSTALL blockno --- Unix-interface
Install file at specified block number.
Used in statements of the form:
blockno INSTALL name
The file with path name `name' is opened read/write and installed in
the block mapping table, mapping a range of forth blocks starting at
`blockno' and equal in extent to the size of the file. If the file has
no write permission, the file will be open read-only.
It will first try the current directory. If that fails it will try
the FORTH library directory (i.e. the directory defined by the string
SDIR). If the file name begins with a '<' (i.e. a less-than symbol)
the '<' character is stripped off and only the FORTH library directory
is searched. If everything fails an abort is taken.
NOTE: need to implement a search path.
ISGN n --- sgn local
Returns 1 if n>0, 0 if n=0, and -1 if n<0.
IUPPER --- n local
Return the upper bound of a DO loop (if the loop is incrementing
upward, one greater than the last loop value executed, if the
loop is incrementing downward, equal to the last loop value executed).
J --- n C,225
Return the index of the next outer loop, May be used only within a
nested DO-LOOP in the form:
DO . . . DO . . . J . . . LOOP . . . LOOP
JCODE local
A defining word used in the form:
JCODE <name> ... END-CODE
<name> when executed will return the address of the following code
immediately following the JCODE definition. ASSEMBLER becomes the
context vocabulary.
K --- n C,extension
Within three nested DO-LOOP's return the index of the second outer
loop.
KEY --- char 100
Leave the ASCII value of the next available character from the current
input device. This character is not echoed.
KEY> Local
Reset the terminal back into Forth's standard operating mode.
L! n_l addr --- local
Take as many stack cells as needed to hold a 4-byte number (2 on a
16-bit machine, 1 on a 32-bit machine), and store it as a 4-byte
integer at the address `addr'.
L!++ addr1 n_l --- addr2 local
Take `n_l', which contains many stack cells as needed to hold a 4-byte
number (2 on a 16-bit machine, 1 on a 32-bit machine), and store it as
a 4-byte integer at the address `addr'. The address is incremented by
four bytes and returned as `addr2'.
L+ n_l m_l --- sum_l local
Add together the two L-type (32-bit) values on the stack. An l-type
value occupies 2 stack cells on a 16-bit machine, 1 stack cell on
a 32 bit machine.
L, n_l --- local
Take as many stack cells as needed to hold a 4-byte number (2 on a
16-bit machine, 1 on a 32-bit machine), and compile it into the next
4 bytes of the dictionary.
L->2 n_l --- m_2 local
Convert an L-type (32 bit) number to a double integer, doing
sign-extension if necessary. An L-type number occupies the least
number of stack cell elements that contain at least 32 bits.
L->N n_l --- m local
Convert an L-type (32 bit) number to a single integer.
L.BLKTAB --- n Local
Constant which return the number of potential entries in the
block mapping table.
L1+ n_l --- m_l Local
Increment the L-type number on the stack by one.
L2OVER n_l m_2 --- n_l m_2 n_l local
Leave a copy of the L-type number (32-bit) `n_l' (below the double
integer `m_2') on top of the stack.
L2SWAP n_l m_2 --- m_2 n_l local
Exchange the top two stack values with initially
an L-type number (32 bit) below and a double integer above.
L>R --- n_l local
Pop the L-type (32-bit) number `n_l' from the return stack and push
it onto the parameter stack. An L-type number occupies 2 stack cells on
a 16 bit machine and 1 stack cell on a 32 bit machine.
L>R n_l --- local
Pop the L-type (32-bit) number `n_l' from the parameter stack and push
it onto the return stack. An L-type number occupies 2 stack cells on
a 16 bit machine and 1 stack cell on a 32 bit machine.
L@ addr --- n_l local
Access the 4-byte integer pointed to by the address `addr', placing it
on the parameter stack in an entry occupying as many stack cells as
needed to hold a 4-byte number (2 on a 16-bit machine, 1 on a 32-bit
machine).
L@++ addr1 --- addr2 n_l local
Access the 4-byte integer pointed to by the address `addr', placing it
on the parameter stack in an entry occupying as many stack cells as
needed to hold a 4-byte number (2 on a 16-bit machine, 1 on a 32-bit
machine). The address is incremented by four bytes and returned as
`addr2'.
LA+ addr1 n --- addr2 local
Multiply `n' by the size of a 32 bit integer in bytes (4 on most
machines) and add to address `addr1' (i.e. construct the address of
the `n'th 32-bit integer beyond `addr1').
LA1+ a1 --- a2 Local
Increment address `a1' by the size of a 32-bit integer in bytes. This
is 4 on most machines.
LA1- a1 --- a2 Local
Decrement address `a1' by the size of a 32-bit integer in bytes. This
is 4 on most machines.
LEAVE C,213
Force termination of a DO-LOOP at the next LOOP or +LOOP by setting
the loop limit equal to the current value of the index. The index
itself remains unchanged, and execution proceeds normally until the
loop terminating word is encountered.
LETTER --- addr standard input/output
Places the address of the normal output handler on the stack.
The LETTER routine is called with the parameters
bufaddr count struct ---
Where `bufaddr' is the address from which input/output is to occur
`count' is the number of characters to read/write and struct points
to the structure pointed to by the user variable TYPER.
LINE n --- line_s
Line number `n' (with the line count starting at 0) from the forth
screen whose number is contained in user variable SCR is placed on
the string stack as a string of length 64.
LIST n --- 109
List the ASCII symbolic contents of screen `n' on the current output
device, setting SCR to contain `n'. `n' is unsigned.
LITERAL n --- I,215
If compiling, then compile the stack value `n' as a word-length literal,
which when later executed, will leave `n' on the stack.
LN2 n --- log2n local
Returns the logarithm base 2 of `n'. Result undefined for n <= 0.
LNMV --- local
Moves individual lines from one forth screen to another. LNMV prompts
for block and line number of the source screen the block and line
number of the destination screen and the number of lines to copy. Enter
each number followed by a carriage return.
LNSWAP n_l m --- m n_l local
Exchange the top two stack values with initially an L-type number (32
bit) below and a single integer above.
LOAD n --- 202
Begin interpretation of screen n by making it the input stream;
preserve the locators of the present input stream (from >IN , BLK and
>LOC ). If interpretation is not terminated explicitly it will be
terminated when the input stream is exhausted. Control then returns
to the location in the input stream containing LOAD, determined by the
input stream locators >IN , BLK , and >LOC .
LOADF --- unix-interface
Load a screen-format file. Used in a command of the form:
LOADF name
The file `name' is first opened read/only and installed at an
automatically range of block numbers (using -INSTALL ). Then the
file is LOADed (using LOAD ). Finally the file is REMOVEed from the
block allocation table (using REMOVE ).
It will first try to find the file in the current directory. If that
fails it will try the FORTH library directory (i.e. the directory
defined by the string SDIR). If the file name begins with a '<' (i.e.
a less-than symbol) the '<' character is stripped off and only the
FORTH library directory is searched. If everything fails an abort is
taken.
NOTE: need to implement a search path.
LOCK Local
Place a mark in the most recently accessed buffer which declares
that this buffer is locked in place and not available for further use.
LOOP I,C,124
Increment the DO-LOOP index by one, terminating the loop if the new
index is equal to or greater than the limit. The limit and index are
signed word-length integers of the range at least (-32768...32767).
LOVER n_l m_l --- n_l m_l n_l local
Leave a copy of the L-type (32-bit) number `n_l' (below the L-type
number `m_l') on top of the stack.
LSWAP n_2 m_l --- m_l n_2 local
Exchange top two L-type (32-bit) stack values. An L-type value occupies
2 stack cells on a 16 bit machine and 1 stack cell on a 32 bit machine.
M* n1 n2 --- prod_2 local
Multiply two single precision integers to yield the double integer
`prod_2'.
M*/ n1_2 mult divs --- result_2
Multiply double integer `n1_2' by single integer mult, creating a
transitory triple integer product, and divide this by single integer
`divs', leaving a double integer result.
M+ n1_2 n2 --- n3_2 local
Single integer `n2' is added to double integer `n1_2' and the result
left as a double integer `n3_2'.
M+! n addr --- local
Add single integer n to the double integer pointed to by `addr'.
M/ divd_2 divs --- quot local
Divide the double integer `divd_2' by the single integer `divs', leaving
a single integer quotient.
M/MOD divd_2 divs --- quot_2 rem local
Divide double integer `divd_2' by `divs' leaving a double integer
quotient `quot_2' and remainder `rem'.
MACH --- mach_s local
Place on string stack the type of machine (i.e. `vax' or `pdp11', etc.).
MAX n1 n2 --- n3 218
Leave the greater of two numbers. "max"
MESSAGE n ---
Type out message number `n'. Message is mostly used for error messages.
In this implementation messages are kept in a temporary disk file
pointed to by MSGFIL .
MIN n1 n2 --- n3 127
Leave the lesser of two numbers. "min"
MOD n1 n2 --- n3 104
Divide `n1' by `n2', leaving the remainder `n3', with the same sign
as `n1'. "mod".
MOVE addr1 addr2 n --- 113
Move the specified quantity `n' of word length memory cells beginning at
addr1 into memory at addr2. If n is zero or negative nothing is moved.
Local modification: If addr1 > addr2 then the first word of addr1 is
moved first, otherwise the last word (`n'th) of addr1 is moved first.
Thus, moves between overlapping fields are properly handled.
MSG addr --- local
Used in definitions of the form:
addr MSG <name>
`addr' points to a null terminated character string which is stored in
the parameter field of <name>. When <name> is executed the character
string is typed.
MSGBUF --- addr U,local
Leave the address on the stack of a variable which contains the address
of the input message buffer. The message buffer is an area of memory
82 bytes long used to buffer keyboard input. It is possible to
temporarily change the message buffer by changing the contents of
MSGBUF.
MSGBUF0 --- addr U,local
Leave the address on the stack of a variable. This variable contains
the address of the default input message buffer. A system ABORT will
reset MSGBUF to the contents of MSGBUF0. Allows the changing of the
contents of MSGBUF by keeping FORTH from getting into a strange state
if an error abort occurs while MSGBUF does not point to the normal
input buffer.
MSGFIL --- descr local
Return the file descriptor number of a file which contains the
forth error messages and longer forth character string constants.
MYSELF --- local,C
Causes the recursive execution of the colon definition inside which
the reference to MYSELF appears. Used in recursive constructs. The
existence of MYSELF is necessary for recursive invocation of a word
because merely repeating the name of word inside its definition
results in a redefinition of that word, rather than a recursion.
N->L n --- m_l local
Convert a single integer to an L-type (32 bit) number, sign extending
if necessary. On the Vax this is a No-op.
N.BLKTAB --- addr Local
Variable which contains the number of current entries in the
block mapping table.
N2OVER n m_2 --- n m_2 n local
Leave a copy of the single stack cell width number `n' (below the double
integer `m_2') on top of the stack.
N2SWAP n m_2 --- m_2 n local
Exchange the top two stack values with initially a single integer
below and a double integer above.
NEGATE n --- -n 177
Leave the two's complement of a number, i.e., the difference of 0
less `n'.
NLOVER n m_l --- n m_l n local
Leave a copy of the single stack cell width number `n' (below the
L-type (32-bit) number `m_l') on top of the stack.
NLOVER n m_l --- n m_l n local
Leave a copy of the single stack cell width number `n' (below the
L-type (32-bit) number `m_l') on top of the stack.
NLSWAP n m_l --- m_l n local
Exchange the top two stack values with initially a single integer
below and an L-type number (32 bit) above.
NOHUP --- Unix-interface
Cause SIGINT to be ignored.
BUGS: the name choice for this word is very poor.
NOT flag1 --- flag2 165
reverse the boolean value of flag1. This is identical to 0= .
OCTAL reference
Set the number conversion base to 8.
OPERATOR --- co-processes
When co-process handing is enabled this returns the address of the
user area of the coprocess currently in control.
OR n1 n2 --- n3
Leave the bitwise inclusive-or of two numbers.
OR! n addr --- local
Or's the value `n' with the word-length contents of `addr', storing
the result in `addr'.
OVER n1 n2 --- n1 n2 n1 170
Leave a copy of the second number on the stack.
OWNER --- owner co-processing
Returns address of a variable which contains the address of the
currently active user area. The user area (or process control block)
contains important forth system variables for which different copies
need to be kept for different co-processes. Variables in the user area
are generally indexed with respect to register U.
P.D num_2 dig --- addr len local
Convert double integer `num_2' to a character string with a decimal
point embedded `dig' digits from the right. The character string starts
at address `addr' and contains `len' characters.
PACKIT addr --- high low thread (PDP11) or
addr --- item thread (Vax) Local
Takes the character string pointed to by `addr' (first byte is string
length) and converts the characters in it to the packed format used in
dictionary headers. See the description of the dictionary headers for
more information.
PAD --- addr addr
The address of a scratch area used to hold character strings for
intermediate processing. The minimum capacity of PAD is 64 characters
(addr through addr+63)
In this implementation PAD = HERE+30. The size of PAD is (256-30) = 226
bytes.
PF. x_f n --- y_2 n floating
Prepare a floating point number for printing. Floating point number
`x_f' is multiplied by BASE raised to the `n'th power and converted
(with rounding) to a double integer y_2. `n' is passed through on top
of the parameter stack.
PFORK --- pid 1 {for child} unix-interface
--- out pid 0 {for parent}
The current process is duplicated. Two processes will return from
PFORK. The top-of-stack of the parent will be zero, that of the child
will be 1. Normally, PFORK will be followed immediately by an IF
statement. The pid of the parent will be returned to the child, the
pid of the child will be returned to the parent. A pipe will be opened
to connect the two processes. The child will have as its standard input
(file descriptor 0) the input end of the pipe. The file descriptor of
the output end of the pipe is passed to the parent in `out'.
An abort occurs on error.
PICK n1 --- n2 240
Return the contents of the n1-th stack value, not counting n1 itself
(n1 = 1 for top of stack). An error condition results for n < 1.
PRINT --- printer interface
Causes output which has been spooled to the printer to be actually
printed.
PRINTER --- printer interface
Causes standard output to be diverted to the printer.
QUERY 235
Accept input of up to 80 characters (or until a 'return') from the
user's terminal, into the terminal input buffer. WORD may be used to
accept text from this buffer as the input stream, by setting >IN and
BLK to zero.
QUESTION n ---
Type message `n' (with n as in MESSAGE) and execute ABORT. If n>0
the name the the current word being executed from the input stream is
printed. If n<0 just message number |n| is printed. If n=0 no
message is printed.
QUIT 211
Clear the return stack, setting execution mode, and return control
to the terminal. No message is given.
R> --- n C,110
Transfer `n' from the return stack to the parameter stack.
R@ --- n C,228
Copy the number on the top of the return stack to the data stack.
"r-fetch"
RBOT --- rbot U,local
Returns pointer to bottom of return stack. When the return stack
pointer points to this address the return stack is empty.
RDROP n --- local
Drop the top `n' items from the return stack.
READER --- reader U,local
Returns a variable containing a pointer to a structure which controls
the disposition of Forth's standard input. At the address of this
structure minus one default integer size is a pointer to the code
that is executed when handling the standard input. The contents of the
rest of the structure depends on the input handler. Ordinarily
negative offsets only are used by the input handler, positive offsets
being used for the output handler.
The address of the standard input handler for terminal output is
returned by the word STROKE .
READER0 --- reader0 U,local
Returns a variable containing the default value of a pointer to a
structure which controls the disposition of Forth's standard input.
Actual control of Forth's standard output is handled is handled by the
user variable READER. On abort the contents of READER is replaced with
the contents of READER0 (see READER).
REMOVE blk --- local
Remove the file beginning with block `blk' from the block mapping
table. The file is closed. If `blk' does not actually correspond
to a file in the mapping table the message "Bad Block Number!!!" is
typed.
REPEAT I,C,120
Used in a colon-definition in the form:
BEGIN . . . WHILE . . . REPEAT
At run-time, REPEAT returns to just after the corresponding BEGIN.
RINSTALL blockno --- Unix-interface
Install file read/only at specified block number.
Used in statements of the form:
blockno INSTALL name
The file with path name `name' is opened read only and installed in
the block mapping table, mapping a range of forth blocks starting at
`blockno' and equal in extent to the size of the file.
It will first try the current directory. If that fails it will try
the FORTH library directory (i.e. the directory defined by the string
SDIR). If the file name begins with a '<' (i.e. a less-than symbol)
the '<' character is stripped off and only the FORTH library directory
is searched. If everything fails an abort is taken.
If an abort occurs while LOADing the file, the file will remain in
the block mapping table until removed by hand. Consider this a feature
which can be used to aid debugging.
NOTE: need to implement a search path.
RND fl_f --- d_2 floating
Convert the floating point number `fl_f' to an integer by rounding,
returning the result as the double integer `d_2'.
ROLL n --- 236
Extract the n-th stack value to the top of the stack, not counting
n itself, moving the remaining values into the vacated positions.
An error condition results for n less than 1. { 1 .. n }
3 ROLL = ROT
2 ROLL = SWAP
1 ROLL = null operation
ROT n1 n2 n3 --- n2 n3 n1 212
Rotate the top three values, bringing the deepest to the top. "rote"
RWOPEN fil_s iomode --- fildes unix_interface
Open the file named `fil_s' with iomode = 0 input, iomode = 1 output,
or iomode = 2 input/output. If successful a new file descriptor is
returned on the parameter stack and user area variable ERRNO is
cleared. If unsuccessful, -1 is returned on the parameter stack and
the unix error number is returned in user area variable ERRNO. If
iomode = 2 (read/write) and the open is unsuccessful an attempt is
made to open it read only. The status returned refers to the last
open attempt.
S! str_s addr len --- strings
Pop string from top of string stack and store in memory location of
length `len' starting at address `addr'. If `len' is smaller than
the length of the string, the string is truncated on the right. If
`len' is larger than the string, it is padded on the right with blanks.
S!R str_s addr len --- strings
Pop string from top of string stack and store in memory location of
length `len' starting at address `addr'. If `len' is smaller than the
length of the string, it is truncated on the right. If `len' is larger
than the string, it is padded on the left with blanks.
S!V str_s addr len --- strings
The string on the top of the string stack is stored in address `addr',
popping it from the string stack. The 1st byte of the stored string is
its length. If this length would be greater than the size of the
storage area as defined by length `len', the string is truncated on the
left. The length byte is adjusted to note the truncation.
S+LOADF blk fil_s --- unix-interface
The file `fil_s' is first opened read/only and installed at an
automatically range of block numbers (using -INSTALL ). Then the
file is LOADed (using LOAD ) starting at block number `blk' of file
(with the first block corresponding to `blk' = 0). Finally the file
is REMOVEed from the block allocation table (using REMOVE ).
It will first try to find the file in the current directory. If that
fails it will try the FORTH library directory (i.e. the directory
defined by the string SDIR). If the file name begins with a '<' (i.e.
a less-than symbol) the '<' character is stripped off and only the
FORTH library directory is searched. If everything fails an abort is
taken.
If an abort occurs while LOADing the file, the file will remain in
the block mapping table until removed by hand. Consider this a feature
which can be used to aid debugging.
NOTE: need to implement a search path.
S, str_s --- strings
compile string from top of string stack into dictionary, popping it.
An extra byte is compiled if necessary to keep the dictionary pointer
even.
S-#DROP sn_s sn-1_s ... s2_s s1_s n --- sn-1_s ... s2_s s1_s
strings
remove the `n'th-deep string from the string stack. The numbering of
`n' starts at 1 for the topmost string and increased downward into the
stack. However for S-#DROP `n' must be > 1 .
S-DROP s1_s s2_s --- s2_s strings
Eliminate the string stack element one below the top of the string
stack.
S. str_s --- strings
Type out string from the top of the string stack, popping it.
S2DROP s2_s s1_s --- strings
Drop top two strings on string stack.
S< s1_s s2_s --- flag strings
Compares and pops the top 2 strings on the string stack. Returns 1
if string below < string above, 0 otherwise.
S= s1_s s2_s --- flag strings
Compares and pops the top 2 strings on the string stack. Returns 1
if string below = string above, 0 otherwise.
S> s1_s s2_s --- flag strings
Compares and pops the top 2 strings on the string stack. Returns 1
if string below > string above, 0 otherwise.
S? s1_s s2_s --- flag strings
Compares and pops the top 2 strings on the string stack. The result
of the comparison is returned on the parameter stack.
If the string below is < than the string above ... -1 is returned.
If the string below is = to the string above ... 0 is returned.
If the string below is > than the string above ... +1 is returned.
The shorter string is extended to the right with blanks to bring it
to the same length as the longer string.
S@ addr len --- str_s strings
push `len' characters beginning at address `addr' onto string stack.
S@V addr len --- str_s strings
Push string at address `addr' (whose 1st byte is the length of the
string) onto the string stack. `len' is ignored but present for
consistency with the form of S@ . SPUSH accomplishes the same thing
without needing a dummy `len'.
SANY s1_s s2_s --- s1_s flag strings
Searches for the 1st occurrence in string `s1_s' of any of the
characters contained in string `s2_s'. The character number in string
`s1_s' of the position of the match is returned on the parameter stack.
A zero is returned if none of the characters in `s2_s' are contained
in `s1_s'. String `s2_s' (but not `s1_s') is popped from the string
stack. SANY is used to search for a delimiter in a string.
SASK --- str_s strings
Read the input stream and return the contents of the next line (i.e.
up to the next carriage return or line feed) on the string stack.
The trailing delimiter is not included.
SAVE-BUFFERS 221
Write all block buffers to mass-storage that have been flagged as
UPDATEd. An error condition results if mass-storage writing is not
completed.
SBOT --- sbot U,local
Returns pointer to bottom of parameter stack. When the parameter stack
pointer points to this address the parameter stack is empty.
SCAN> ---
End an input diversion started by <SCAN, resuming input from the normal
standard input. The file from which the diversion was taken is closed.
<SCAN ... SCAN> pairs can be nested.
SCR --- addr U,217
Leave the address of a variable containing the number of the screen
most recently listed. "s-c-r" unsigned number.
SCREATE size filnam_s --- unix-interface
Create a file named `filename_s' containing `size' 1024 byte forth
screens. Each screen contains one initial null byte and 1023 blank
bytes.
An abort occurs if there are errors in the creation or writing of the
file.
SDEPTH --- n strings
Leave on the parameter stack the number of the words contained on the
string stack.
SDOWN addr1 --- addr2 strings
`addr1' is assumed to point to a valid string on the string stack.
`addr2' is returned which points to the string beneath the string
pointed to by addr1. `addr1' beneath or at the string stack bottom or
`addr2' beneath the string stack bottom constitutes constitutes an
error condition, which will cause an abort. If `addr1' is at the string
stack bottom the message says "String Stack Empty!". Otherwise the
message says "Bad String on String Stack!"
SDROP str_s --- strings
Drop top string from string stack.
SDUP str_s --- str_s str_s strings
Duplicate string on top of string stack.
SEXEC s_word --- strings
Execute word whose name is found in the uppermost string on the string
stack. This string is popped.
SFIND s_word --- addr strings
Look up in dictionary the word whose name is found on the top of the
string stack (and pop the string stack). The dictionary address of that
word (or a zero if the word cannot be found) is returned on the
parameter stack.
SFLOAD file_s --- unix-interface
The forth interpreter will start to interpret the contents of file
with name `name_s'. This file can either be a regular text file (i.e.
lines separated by newlines), or a forth screen-format file (constant
width lines of 64 characters). LOAD's, FLOAD's, and LOADF's can nest
to any level (or at least until return stack overflow).
Note: words that grab a string from the input stream cannot be
guaranteed to work if the word and its string are separated by the end
of a line.
It will first try to find the file in the current directory. If that
fails it will try the FORTH library directory (i.e. the directory
defined by the string SDIR). If the file name begins with a '<' (i.e.
a less-than symbol) the '<' character is stripped off and only the
FORTH library directory is searched. If everything fails an abort is
taken.
NOTE: need to implement a search path.
Implementation note: FLOAD is implemented using the CHANBOT mechanism
of BLOCK. The current byte offset within the file is kept in user
variable >LOC. Making FLOAD's able to nest was a real pain.
SFORGET s_word --- strings
Forget word whose name is found in the uppermost string on the string
stack. This string is popped.
SGN x_f --- sgn_f abs_f floating
Test the sign of floating point number `x_f'. `abs_f' is the absolute
value of `x_f'. `sgn_f' is -1e0 if `x_f' < 0, 1e0 otherwise.
SH --- unix-interface
Shell escape. The Bourne shell is invoked as a subprocess. The forth
process sleeps until the exit of this shell. Terminal modes are reset
to the system default and interrupts and quits are set to ignored
before invoking the shell.
SHIFT n1 n --- n2 local
Do a arithmetic shift on integer `n1'. If n>0 do a left shift. If
n<0 do a right shift. n2 = n1 * 2**n (rounding towards the
least positive, most negative result).
SH[ --- unix-interface
Usage:
SH[ .... command ....]
Invoke the Bourne shell as a subprocess to execute a single command.
The characters between the space following the SH[ command up to but
not including the trailing right square bracket delimiter are passed
to an subprocess running the Bourne shell.
SIGN n --- C,140
If `n' is negative, insert the ASCII character "-" (minus sign) into
the pictured numeric output string.
SIGNAL --- addr local
Return the address of a variable in which is stored the address of
the the handler for the end-of-line, QUIT, or ABORT condition
(see !SIGNAL). This mechanism is soon to be replaced with a stack of
handlers.
SINDEX s1_s s2_s --- s1_s index strings
Searches for the 1st occurence of string `s2' in string `s1'. The
character number in string `s1' of the 1st character of the match is
returned on the parameter stack. If no match was found a zero is
returned on the parameter stack. String `s2' (but not `s1') is popped
from the string stack.
SLEN --- len strings
Return length of top string on string stack.
SLITERAL str_s --- I,strings
Compile the string on the string stack, which when later executed will
be left on the string stack. (Implementation note: at present, strings
longer than 5 characters are kept in a temporary file on disk.)
SLOADF fil_s --- unix-interface
The file `fil_s' is first opened read/only and installed at an
automatically range of block numbers (using -INSTALL ). Then the
file is LOADed (using LOAD ). Finally the file is REMOVEed from the
block allocation table (using REMOVE ).
It will first try to find the file in the current directory. If that
fails it will try the FORTH library directory (i.e. the directory
defined by the string SDIR). If the file name begins with a '<' (i.e.
a less-than symbol) the '<' character is stripped off and only the
FORTH library directory is searched. If everything fails an abort is
taken.
If an abort occurs while LOADing the file, the file will remain in
the block mapping table until removed by hand. Consider this a feature
which can be used to aid debugging.
NOTE: need to implement a search path.
SLOC --- addr strings
Return address of the characters in the top string on the string stack.
SN@ addr --- str_s strings
`addr' points to a null-terminated string. This string (minus the
trailing null), is pushed onto the string stack. This word is intended
to ease access to C and Unix generated null-terminated strings.
SNONE s1_s s2_s --- s1_s flag strings
Searches for the 1st character in string `s1_s' which is not contained
in string `s2_s'. The character number in string `s1_s' of the
position of the first non-matching character is returned on the
parameter stack. A zero is returned if `s1_s' consists only of
characters from `s2_s'. String `s2_s' (but not `s1_s') is popped from
the string stack. SNONE is used to skip over leading delimiters in a
string.
SOVER s2_s s1_s --- s2_s s1_s s2_s strings
Push second string down on string stack onto top of string stack.
SP n --- local
Print `n' spaces on the standard output. SP is a synonym for SPACES.
SPACE 232
Transmit an ASCII blank to the current output device.
SPACES n --- 231
Transmit `n' spaces to the current output device. Take no action for
`n' of zero or less.
SPICK sn_s sn-1_s ... s2_s s1_s n --- sn_s sn-1_s ... s2_s s1_s sn_s
strings
Copy the `n'th string on the string stack onto the top of the string
stack. `n' starts at 1 for the topmost string and increases downward
on the string stack.
SPUSH addr --- str_s strings
Push string at address `addr' (whose 1st byte is the length of the
string) onto the string stack. This string stack is checked for
overflow. Overflow causes an abort with a message.
SREPLACE s1_s s2_s len beg --- result_s strings
Replace a substring embedded in string `s1' with string `s2_s'. The
substring has a length of `len' characters and starts on position
`beg' in string `s1_s' (the character numbering starts at 1 for the
first character). String `s2_s' is popped and string `s1_s' is replaced
by the result. The length of the result is adjusted by the difference
between the length of the removed and inserted strings.
SROLL sn_s sn-1_s ... s2_s s1_s n --- sn-1_s ... s2_s s1_s sn_s
strings
Bring the `n'th string on the string stack to the top of the string
stack (removing it from its original location). The numbering of `n'
starts at 1 for the topmost string and increases downward into the
string stack. `n' must be > 1. 2 SROLL is equivalent to SSWAP and
3 SROLL is equivalent to SROT .
SROT s3_s s2_s s1_s --- s2_s s1_s s3_s strings
Rotate top three strings on string stack, bringing the 3rd string
down up to the top.
SSBOT --- addr U,local
Returns the address of a variable which contains the address of the
bottom of the string stack.
SSKIP str_s sdelim_s --- rest_s strings
SSKIP removes leading delimiters from the beginning of a string.
String `str_s' is scanned for the first occurence of any character not
contained in string `sdelim_s'. `str_s' and `sdelim_s' are popped and
replaced by the substring of `str_s' whose first character is the first
character in `str_s' that was not contained in `sdelim_s'.
SSPACES n --- sp_s strings
Push a string of `n' spaces onto the string stack.
SSTACK --- local
Print out the contents of the string stack. Top of stack is to the
right.
SSWAP s2_s s1_s --- s1_s s2-s strings
Exchange top two strings on string stack.
STACK --- local
Print out the contents of the parameter stack. Top of stack is to the
right.
STATE --- addr U,164
Leave the address of tha variable containing the compilation state. A
non-zero contents indicates compilation is occurring, but the value
itself may be installation dependent.
In the vax implementation STATE = 1 indicates compilation.
STRING-SPACE maxlen --- strings
Allots space in dictionary for strings whose maximum size is maxlen
characters.
STRING-VAR maxlen --- strings
Use:
maxlen STRING-VAR name
Defines a string-variable whose name is `name'. Space for a string
of length `max_len' is allocated. When executed, `name' places the
address of the string (below) and its maximum length (above) on the
parameter stack.
STROKE --- addr standard input/output
Places the address of the normal keyboard input handler on the stack.
The STROKE routine is called with the parameters
bufaddr count struct ---
Where `bufaddr' is the address from which input/output is to occur
`count' is the number of characters to read/write and struct points
to the structure pointed to by the user variable TYPER.
SUBSTR str_s len begcharno --- sub_s strings
The string on the top of the string stack is replaced by a piece of
this string of length `len'. The 1st character of the new string is
taken from the `begcharno'th character of the original string
( begcharno = 1 corresponds to the 1st character) .
SWABYT addr n --- local
Swaps the bytes of the `n' 16-bit words beginning at address `addr'.
SWAP n1 n2 --- n2 n1 230
Exchange the top two stack values.
SWORD str_s sdelim_s --- rest_s wrd_s strings
SWORD scans a string for the first occurence of one or more of of set
of delimiters and splits the string into two pieces right before the
located delimiter. String `str_s' is scanned from beginning to end
for the first occurence of any of the characters contained in string
`sdelim_s'. The substring of `str_s' up to but not including the
delimiter is left on the top of the string stack as the string
`wrd_s', the rest of `str_s' (from the found delimiter itself) left
below on the string stack as the string `rest_s'. If no delimiter was
found then all of `str_s' is left below and a null string is left on
the top of the string stack.
TASK ---
A standard null marker whose presence typically indicates the beginning
of an application. Thus the application can be deleted with
FORGET TASK
TEN --- ten_f floating
The floating point value 10e0 is placed on the floating point stack.
TERM --- input/output control
used in definitions of the form:
TERM <name>
Defines a structure to be used for forth standard input/output using
the standard routines LETTER and STROKE. When "name" is executed the
address of this structure is placed in the the user variable TYPER,
thereby causing forth standard output to be controlled by this
structure.
The file descriptor for standard output is placed one integer cell
beyond the address of the structure (at structure + 4 on the VAX).
The file descriptor for standard input is placed two integer cells
before the address of the structure (at structure - 8 on the VAX).
TERMINAL --- input/output control
Reset the Forth standard output to the default. That is the user
variable TYPER is set to the contents of user variable TYPER0.
TFLOAT n_2 --- x_f local
The double integer on the stack (returned from a recent CONVERT) and
the content of DPL (decimal point location and flags) are used to
construct a floating point number x_f.
THEN I,C,161
Used in a colon-definition, in the form:
IF . . . ELSE . . . THEN or
IF . . . THEN
THEN is the point where execution resumes after ELSE or IF (when no
ELSE is present).
TOP --- addr local
Returns the address of the top of memory when the program originally
was invoked. Ordinarily this is the value of the return (system)
stack pointer at program invocation. Invoking forth with the -top
flag will change this to some other value.
TRESET Local
Reset terminal to operating system standard modes in preparation for
an exit to the operating system or a shell exec.
TRPADD --- addr local
Returns the address of a variable which after a Unix signal is
caught will contain the address of the program counter when the
signal occured.
TYPE addr n --- 222
Transmit `n' characters beginning at `addr' to the current output
device. No action takes place for `n' less than or equal to zero.
(Local implementation note: The device used is that whose control block
is pointed to by the user variable TYPER. See the section on terminal
output for a description of this control block).
TYPER --- typer U,local
Returns a variable containing a pointer to a structure which controls
the disposition of Forth's standard output. At the address of this
structure is a pointer to the code that is executed when handling the
standard output (thus `typer' contains a one level indirect pointer to
the code to be executed). The contents of the rest of the structure
depends on the output handler.
The address of the standard output handler for terminal output is
returned by the word LETTER .
TYPER0 --- typer0 U,local
Returns a variable containing the default value of a pointer to a
structure which controls the disposition of Forth's standard output,
and which controls Forth error output. Actual control of Forth's
standard output is handled by the user variable TYPER. On abort the
contents of TYPER is replaced with the contents of TYPER0 (see TYPER).
U* n1_u n2_u --- n3_u2 242
Perform an unsigned multiplication of `n1_u' by `n2_u'. leaving the
double integer unsigned product `n3_u2'. All values are unsigned.
"u-times"
U. num_u --- 106
Display unsigned integer `num_u' converted according to BASE as an
unsigned number, in a free-field format, with one trailing blank.
"u-dot"
U.R n_u len reference
Print unsigned integer `n_u' right-aligned in a field `len' characters
wide, according to number base BASE. If `len' is less than the
characters required for `n_u', no leading blanks are supplied.
"u-dot-r"
U/MOD n1_u2 n2_u --- n3_u n4_u 243
Perform the unsigned division of double integer `n1_u2' by `u_n2,'
leaving the remainder `n3_u', and quotient `n4_u'. All values are
unsigned. "u-divide-mod"
Sorry, but at the moment this is just too hard for the amount of use
this word gets on the vax (with double integers being quad-words). In
the current vax implementation all of the above numbers are signed.
U< n1_u n2_u --- flag 150
True if `n1_u' < n2_u where `n1_u' and `n2_u' are treated as unsigned
integers. "u-less-than"
U> n1_2 n2_u --- flag Local
True if `u_1' is greater than `u_2' (unsigned integer compare).
UCASE in_s --- out_s strings
Convert lower case characters to uppercase in string on top of string
stack.
UERR --- n unix-interface
Returns the offset which is added to the error codes returned by Unix
system calls to access forth message numbers for these errors (i.e.
the base of block of forth message numbers allocated to Unix system
calls).
UNLOCK buf --- Local
Releases the buffer whose address is `buf' for further use. Also
flushes buffer back to the system, starting an asyncronous write
on the buffer if it is marked for UPDATE and if asynchronous output
is available in the operating system (not currently available in Unix).
In any case UNLOCK allows disk output to be forced for an individual
buffer.
UNTIL flag --- I,C,237
Within a colon-definition, mark the end of a BEGIN-UNTIL loop, which
will terminate based on a flag. If `flag' is true, the loop is
terminated. If `flag' is false, execution returns to the first word
after BEGIN. BEGIN-UNTIL structures may be nested.
UPDATE --- 229
Mark the most recently referenced block as modified. The block will
subsequently be automatically transferred to mass storage should its
memory buffer be needed for storage of a different block, or upon
execution of SAVE-BUFFERS (or the synonym FLUSH).
USIZE --- siz local
Returns the size (in bytes) of the user area.
VAR n --- Local
A defining word like VARIABLE but allowing initialization. It is
executed in the form:
n VAR <name>
to create a dictionary entry for <name> and allot a word for storage
in the parameter field initialized with `n' . When <name> is later
executed, it will place the storage address on the stack.
VARIABLE 208
A defining word executed in the form:
VARIABLE <name>
to create a dictionary entry for <name> and allot a word for storage
in the parameter field. The application must initialize the stored
value. When <name> is later executed, it will place the storage
address on the stack.
VAX --- mach_s local,VAX
(only on the Vax) Place on the string stack the string " vax". The
existence of this word can be tested for by conditionals. Example:
#ifdef VAX . . . #then
VECT n --- strings
Used in definitions of the form
n VECT xxx
To define an area of memory `n' memory cells in length. When `xxx' is
executed it will place its address on the parameter stack. The
contents of this memory is filled with blanks. Two extra cells are
reserved before this address. At the cell at address - 2*wordsize is
placed the actual size (in bytes) of this array. At the cell at
address - 1*wordsize is placed the current size (initially zero) of
this array. Varying size arrays can be stored in a VECT with the word
?VECT . VECT and ?VECT can safely be used in commands used by naive
users as ?VECT will check that the address on the stack indeed does
belong to a VECT and that there is sufficient space for the desired
array.
VLIST --- reserve
List the word names of the CONTEXT vocabulary starting with the most
recent definition.
VOCABULARY 208
A defining word executed in the form:
VOCABULARY <name>
to create (in the CURRENT vocabulary) a dictionary entry for <name>,
which specifies a new ordered list of word definitions. Subsequent
execution of <name> will make it the CONTEXT vocabulary. When <name>
becomes the CURRENT vocabulary (see DEFINITIONS), new definitions will
be created in that list.
In lieu of any further specification, new vocabularies 'chain' to FORTH.
That is, when a dictionary search through a vocabulary is exhausted,
FORTH will be searched.
W! n addr --- local
Store the low precision 16 bits of `n' into address `addr'.
W!++ addr n --- addr local
Store the low precision 16 bits of `n' into addres `addr'. Return
`addr' incremented by the size of a two byte integer.
W, n --- local
Take the low precision 16 bit part of `n' and compile it into the
dictionary, incrementing the dictionary pointer by two bytes.
W@ addr --- n local
Fetch a 16-bit integer from address `addr'. If the stack width
is wider than 16 bits, the integer is left on the stack with the
high-order bits set to 0 (see <W@ ).
W@++ addr --- addr2 n local
Fetch a 16-bit integer from address `addr'. If the stack width is
wider than 16 bits, the integer is eft on the stack with the high-order
bits set to 0. The address is incremented by two bytes and left
beneath as `addr2'.
WA+ addr1 n --- addr2 local
Multiply `n' by the size of a 16 bit integer in bytes (2 on most
machines) and add to address `addr1' (i.e. construct the address of
the `n'th 16-bit integer beyond `addr1').
WA1+ a1 --- a2 Local
Increment address `a1' by the size of a 16 bit integer in bytes. This
is 2 on most machines.
WA1- a1 --- a2 Local
Decrement address `a1' by the size of a 16 bit integer in bytes. This
is 2 on most machines.
WAIT pid --- unix-interface
Wait for the death of a specified process. Return takes place if
either the death of process with process id `pid' is detected of if
there are no more processes on which to wait. If the INTERRUPT was
disabled it is reenabled after the return.
WHILE flag --- I,C,149
used in a colon-definition in the form:
BEGIN . . . flag WHILE . . . REPEAT
Select conditional execution based on the flag. On a true flag,
continue execution through to REPEAT, which then returns back to just
after BEGIN. On a false flag, skip execution to just after REPEAT,
exiting the structure.
WORD char --- addr 181
Receive characters from the input stream until the non-zero delimiting
character is encountered or the input stream is exhausted, ignoring
leading delimiters. The characters are stored as a packed string with
the character count in the first character position. The actual delim-
iter encountered (char or null) is stored at the end of the text but
not included in the count. If the input stream was exhausted as WORD
is called, then a zero length will result. The address of the begin-
ning of this packed string is left on the stack.
Local Implementation notes:
1) The location of the packed string is always HERE, the
the beginning of free memory.
2) When the delimiter is a space, a tab is also accepted in
in the input stream as an alternate delimiter.
3) A new-line (octal 012), in addition to a null (octal 0)
is also always treated as a delimiter. If a new-line
is noted, and the input stream is a regular unix text file
(using the mechanism where pseudo-block number = file
descriptor+CHANBOT) then if >IN is at least 3/4 through the
1024 byte buffer the file pointer >LOC is updated to point
to the character after the newly acquired string, >IN is
reset to zero, and buffers are flushed to force a fresh
1024 bytes to be read from the file.
WRD n1 --- n2 Local
Convert a byte offset to a word offset, i.e., divide by the word
length in bytes.
XX**N x_f n --- y_f floating
Raise floating point number `x_f' to the `n'th power. `n' can be
positive, negative, or zero.
XXOR n1 n2 --- n3 174
Leave the bitwise exclusive-or of two numbers. "x-or"
Y/N --- t/f local
Used for simple yes/no queries from the keyboard. Waits for a
single key to be depressed on current input device. This key is
echoed. Returns 1 if y or Y is depressed, 0 for anything else.
If Control C is depressed an abort will occur.
[ I,125
End the compilation mode. The text from the input stream is
Subsequently executed. See ] "left-bracket"
[COMPILE] I,C,179
Used in a colon-definition in the form:
[COMPILE] <name>
Force compilation of the following word. This allows compilation of an
IMMEDIATE word when it would otherwise be executed. "bracket-compile"
[[ --- string_s strings
Used in definitions of the form:
[[ string...]
The characters between but not including the necessary leading space
and the trailing delimiter ( "]", right square bracket), are pushed as a
string onto the string stack. (The leading space is needed as a
delimiter for the forth outer interpreter). See the definition for `"'
(The double-quote operator), which has identical behavior but a
different trailing delimiter.
] 126
Set the compilation mode. The text from the input stream is
subsequently compiled. See [ "right-bracket"
]1 --- n local
sys --- (compiling)
Set the compilation mode. The text from the input stream is
subsequently compiled. An integer is consumed from the compile time
stack and reappears on the execution time stack.
]2 --- n_2 local
sys_2 --- (compiling)
Set the compilation mode. The text from the input stream is
subsequently compiled. A double integer is consumed from the compile
time stack and reappears on the execution time stack.
~&! n addr --- local
Clear bits in contents of `addr'. And's the one's complement of
the value of `n' with the word-length contents of `addr', storing
the result in `addr'.
//go.sysin dd *
made=TRUE
if [ $made = TRUE ]; then
/bin/chmod 644 ./doc/forth3
/bin/echo -n ' '; /bin/ls -ld ./doc/forth3
fi
exit
----Cut here. If this line isn't here something is missing-----------
--
Bill Sebok Princeton University, Astrophysics
{allegra,akgua,burl,cbosgd,decvax,ihnp4,noao,princeton,vax135}!astrovax!wls