($help) .dup .where (.pop .pop) (100 .dict .def) .ifelse .cvx .exec
(/def)
(3 .copy .exch .pop .def .pop $help 3 1 .roll .put) .cvx .def
(/xdef)
(3 .copy .exch .pop .cvx .def .pop $help 3 1 .roll .put) .cvx .def
(/def)
("/def" accepts three entries on the stack: a key, string, and value.
the string is stored under the key in the $help dictionary, and
the value is stored as a noun under the key in the current dictionary.)
(/def) .load /def
(/xdef)
("/xdef" accepts three entries on the stack: a key, string, and value.
the string is stored under the key in the $help dictionary, and
the value is stored as a verb under the key in the current dictionary.)
(/xdef) .load /xdef
(?)
("?"prints the explanation of the given key from the $help dictionary)
($help .exch .get =)/xdef
(??)
("??" prints the names of all the utility commands found in the $help
dictionary.)
($help /kdir)/xdef
(=)
("="prints the top of the stack on the default display)
(( ) .cvis .print (
).print)/xdef
(!tc!)
0 .def
(/pause)
(/pause is used to pause the execution of a program until the user types somthing.)
((
** type CR to continue)= .mystream .readitem .pop .pop)/xdef
(/stk)
("/stk"prints (without distroying) the contents of the operand stack.)
(.cntstk .dup 1 .add .copy (.dup .type .print
().print = ) .cvx .rept .pop)/xdef
(/pstk)
("/pstk"pretty prints (without distroying) the contents of the operand stack.)
(.cntstk .dup 1 .add .copy (==) .cvx .rept .pop)/xdef
(/clr)
("/clr"clears the operand stack (same as .clrstk))
(.clrstk) /xdef
(/dir)
("/dir"prints the contents of the dictionary on top of the operand stack.)
((.exch ( ) .cvis .print ().print .dup .type .print ().print =) .cvx .dictforall)/xdef
(/kdir)
("/kdir" prints the keys found in the dictionary on the top of the operand
stack.)
((.exch = .pop) .cvx .dictforall)/xdef
(/if)
("/if" is equivalent to ".cvx .if")
(.cvx .if)/xdef
(/ifelse)
("/ifelse" is equivalent to " .ifelse .cvx .exec")
(.ifelse .cvx .exec)/xdef
([)
("[" is a command that marks the operand stack for use by the command "]".
This pair of commands is use to create arrays. For example:
[ 1 2 (hello) ]
will create an array containing two integers (1 and 2) and the string
"hello".)
(.mark)/xdef
(])
("]" is a command that counts the elements after the mark on the stack and
puts these elements into an array which is left on the stack.
The pair of commands ( "[" and "]" ) is use to create arrays. For example:
[ 1 2 (hello) ]
will create an array containing two integers (1 and 2) and the string
"hello".)
(.cnttomrk .array .astore .exch .pop)/xdef
(/altfile)
(/altfile redefines the definition of .print so that printing is done on an alternate
file. /endalt exits this state.)
( (.print) .load $altfile .begin (/altprint) .exch .def
(Enter alternate file name:) /altprint .mystream .readline .pop .token (.cvlit 6 .bytestream (altfile) .exch .def .pop )((bad file name - ) /altprint /altprint .end)/ifelse)
/xdef
($altfile) .dup .where (.pop .pop) .cvx (10 .dict .def) .cvx .ifelse
(/altprint)(.print) .load
$altfile .begin
.def
(.prompt)((alt>) /altprint ).cvx .def
(.print)
(.dup /altprint altfile .exch .writebytes).cvx .def
(/endalt)(altfile .killstream .end) .cvx .def
.end
(==)
(== is used to print all types of objects in a manner which can easily be
read. The object to be printed is expected on the operand stack.
<x> == => -- )
((!tab!) -1 .def pprint )/xdef
(pprint)
(pprint supports == and does all the printing)
(.dup .type $ptypes .exch .get .exec)/xdef
($commands) .dup .where (.pop .pop) (.sysdict .maxlength .dict .def) /ifelse
$commands .begin
.sysdict (.dup .itype 7 .eq (.exch .def)(.pop .pop) /ifelse).cvx .dictforall
.end
($ptypes) .dup .where (.pop .pop) (15 .dict .def) /ifelse
$ptypes .begin
(.nulltype)((nulltype -- no value)=).cvx .def
(.integertype)((integertype -- value is: ) .print =).cvx .def
(.longintegertype)((longintegertype -- value is: ) .print =).cvx .def
(.realtype)((realtype -- value is: ) .print =).cvx .def
(.booleantype)((booleantype -- value is: ) .print =).cvx .def
(.stringtype)((stringtype -- value is: ) .print =).cvx .def
(.streamtype)((streamtype -- no value)=).cvx .def
(.commandtype)((commandtype -- value is: ) .print $commands .exch .get =).cvx .def
(.dicttype)((dicttype -- length is: ).print .dup .length ( ).cvis .print ( maxlength is: ).print .maxlength =).cvx .def
(.arraytype)(tabinc tabprint(array: )= (tabprint pprint).cvx .arrayforall tabdec).cvx .def
(.stacktype)((stacktype -- no value)=).cvx .def
(.frametype)((frametype -- no value)=).cvx .def
(.marktype)((marktype -- no value)=).cvx .def
(.usertype)((usertype -- no value)=).cvx .def
.end
(tabinc)((!tab!) .dup .load 1 .add .store).cvx .def
(tabprint)(!tab! (().print).cvx .rept).cvx .def
(tabdec)((!tab!) .dup .load 1 .sub .store).cvx .def