|
|
The following page contains reserved words. These are not part of the ANS Forth Standard. They are just proposed by various people and published here at FORTH.SF.NET for public review. |
:NON:
|
TOC |
R.15.6.1.0001 CSP
( -- var-addr )
Return the address of the system variable used by !CSP and ?CSP.
a possible implementation of a CS-Stack may use the parameter-stack. All CS-related words may be characterized invalid if no !CSP has been made where !CSP will be setting the base of the CS-Stack to the current top-address of the parameter-stack. Other implementations might choose a different memory area for the CS-Stack.
Note that there are might be different implementation variants for !CSP and ?CSP and the actual interpreation of CSP is strictly related to their actual implementation. A forth system can characterize itself to follow traditional CSP handling including the ability to clean out the CS-stack through unframing by setting SP! to the value.
A non-traditional variant must assert that a value of CSP being null represents that no CS-stack is available. For an implementation with a seperate CS-stack, the CSP is similar to the SP! stack-pointer ranging between a bottom and top of the CS-stack - forth systems with such an implementation do often allow words like IF ELSE THEN to be used in interpret-state.
See:
R.15.6.1.0002 !CSP
R.15.6.1.0003 ?CSP.
6.1.1310 ELSE
R.15.6.1.0002 !CSP
( -- )
a possible implementation of a CS-Stack may use the parameter-stack. All CS-related words may be characterized invalid if no !CSP has been made where !CSP will be setting the base of the CS-Stack to the current top-address of the parameter-stack. Other implementations might choose a different memory area for the CS-Stack.
This words is usually executed by the CORE word : (colon) along with ] (right-bracket) when entering the compilation state. It commonly uses the CSP variable. When the CS-Stack is put atop of the parameter stack, a simple definition is:
: !CSP CSP @ IF -22 THROW THEN SP@ CSP ! ;
See:
6.1.0450 :
6.1.2540 ]
R.15.6.1.0003 ?CSP.
R.15.6.1.0001 CSP
R.15.6.1.0003 ?CSP
( -- )
a possible implementation of a CS-Stack may use the parameter-stack. All CS-related words may be characterized invalid if no !CSP has been made where !CSP will be setting the base of the CS-Stack to the current top-address of the parameter-stack, and the ?CSP will do the inverse operation. If not possible, the ?CSP may THROW an "control structure mismatch" exception.
This words is usually executed by the CORE word ; (semicolon) [ (left-bracket) when leaving the compilation state. It commonly uses the CSP variable. When the CS-Stack is put atop of the parameter stack, a simple definition is:
: ?CSP SP@ CSP @ <> IF -22 THROW THEN 0 CSP ! ; \ or : ?CSP SP@ CSP @ < IF -22 THROW ELSE .. THEN CSP @ SP! 0 CSP ! ;
See:
6.1.0460 ;
6.1.2500 [
R.15.6.1.0002 !CSP.
R.15.6.1.0001 CSP
R.15.6.2.1015 CS-DROP
Interpretation: Interpretation semantics for this word are undefined.
Execution: ( C: orig0|dest0 -- )
Drop the CS-item at the top of the control-flow stack. An ambigous
condition exists if there are no CS-items on the control-flow stack
before CS-DROP is executed.
: CS-DROP CS-ITEM-SIZE NDROP ;
See:
15.6.2.1015 CS-PICK
15.6.2.1020 CS-ROLL
R.15.6.2.1020 CS-SWAP.
R.15.6.2.1020 CS-SWAP
Interpretation: Interpretation semantics for this word are undefined.
Execution: ( C: orig1|dest1 orig0|dest0 -- orig0|dest0 orig1|dest1 )
Swap the two topmost CS-items of the control-flow stack. An ambigous
condition exists if there are no two CS-items on the control-flow stack
before CS-DROP is executed.
: CS-SWAP 1 CS-ROLL ;
See:
15.6.2.1020 CS-ROLL
15.6.2.1015 CS-PICK
R.15.6.2.1015 CS-DROP.
Table of Contents
Next Section