tools wordset

description

-- The Optional Programming-Tools Word Set

Copyright (C) Tektronix, Inc. 1998 - 2001. All rights reserved.

description: The ANS Forth defines some "Programming Tools", words to inspect the stack (.S), memory (DUMP), compiled code (SEE) and what words are defined (WORDS).

There are also word that provide some precompiler support and explicit acces to the CS-STACK.

FORTH

.S ( -- )();
p4:"dot-s";

print the stack content in vertical nice format. tries to show cell-stack and float-stack side-by-side,

Depending on configuration, there are two parameter stacks: for integers and for floating point operations. If both stacks are empty, .S will display the message <code>&lt;stacks empty&gt;</code>.

If only the floating point stack is empty, .S displays the integer stack items in one column, one item per line, both in hex and in decimal like this (the first item is topmost):

 12345 HEX 67890 .S
    	424080 [00067890]
         12345 [00003039] ok

If both stacks ar not empty, .S displays both stacks, in two columns, one item per line

 HEX 123456.78E90 ok
 DECIMAL 123456.78E90 .S
    	   291 [00000123]          1.234568E+95
    1164414608 [45678E90] ok

Confusing example? Remember that floating point input only works when the BASE number is DECIMAL. The first number looks like a floating point but it is a goodhex double integer too - the number base is HEX. Thus it is accepted as a hex number. Second try with a decimal base will input the floating point number.

If only the integer stack is empty, .S shows two columns, but he first columns is called <tt>&lt;stack empty&gt;</tt>, and the second column is the floating point stack, topmost item first.

dpANS 15.6.1.0220 - standard forth word

FORTH

DUMP ( addr len -- )();
p4:"dump";

show a hex-dump of the given area, if it's more than a screenful it will ask using ?CR

You can easily cause a segmentation fault of something like that by accessing memory that does not belong to the pfe-process.

dpANS 15.6.1.1280 - standard forth word

FORTH

SEE ( .. )();
as:"see";

ordinary primitive SEE

an executable word (no special usage info)

or wrapper call around p4_see

dpANS 15.6.1.2194 - standard forth word

FORTH

WORDS ( -- )();
p4:"words";

uses CONTEXT and lists the words defined in that vocabulary. usually the vocabulary to list is named directly in before.

 example:
    FORTH WORDS  or  LOADED WORDS
 

dpANS 15.6.1.2465 - standard forth word

FORTH
AHEAD ( -- DP-mark ORIG-magic )compile-only(); 
 ;
 simulate:
   : AHEAD  MARK> (ORIG#) ;
 

dpANS 15.6.2.0702 - standard forth word

FORTH

BYE ( -- )no-return();
p4:"bye";

should quit the forth environment completly

dpANS 15.6.2.0830 - standard forth word

FORTH
CS-PICK ( 2a 2b 2c ... n -- 2a 2b 2c ... 2a )(); 
 ;

pick a value in the compilation-stack - note that the compilation stack _can_ be seperate in some forth-implemenations. In PFE the parameter-stack is used in a double-cell fashion, so CS-PICK would 2PICK a DP-mark and a COMP-magic, see PICK

dpANS 15.6.2.1015 - standard forth word

FORTH
CS-ROLL ( 2a 2b 2c ... n -- 2b 2c ... 2a )(); 
 ;

roll a value in the compilation-stack - note that the compilation stack _can_ be seperate in some forth-implemenations. In PFE the parameter-stack is used in a double-cell fashion, so CS-ROLL would 2ROLL a DP-mark and a COMP-magic, see ROLL

dpANS 15.6.2.1020 - standard forth word

FORTH

FORGET ( "word" -- )();
p4:"forget";

 simulate:
   : FORGET  [COMPILE] '  >NAME (FORGET) ; IMMEDIATE
 

dpANS 15.6.2.1580 - standard forth word

FORTH

[ELSE] ( -- )();
p4:"bracket-else";

eat up everything upto and including the next [THEN]. count nested [IF] ... [THEN] constructs. see [IF]

 this word provides a simple pre-compiler mechanism
 

dpANS 15.6.2.2531 - standard forth word

FORTH

[IF] ( flag -- )();
p4:"bracket-if";

check the condition in the CS-STACK. If true let the following text flow into INTERPRET , otherwise eat up everything upto and including the next [ELSE] or [THEN] . In case of skipping, count nested [IF] ... [THEN] constructs.

 this word provides a simple pre-compiler mechanism
 

dpANS 15.6.2.2532 - standard forth word

FORTH

[THEN] ( .. )();
as:"bracket-then";

immediate primitive [THEN]

an executable word (no special usage info)

or wrapper call around p4_noop

dpANS 15.6.2.2533 - standard forth word

FORTH

? ( addr -- )();
p4:"question";

Display the (integer) content of at address addr. This word is sensitive to BASE

 simulate:
   : ?  @ . ;
 

dpANS 15.6.1.0600 - standard forth word

ENVIRONMENT

TOOLS-EXT ( .. )();
as:"tools-minus-ext";

( 1994  )  constant TOOLS-EXT

an ordinary constant (no special usage info)