Win32Forth


Interpretive conditionals in Win32Forth


Win32Forth supports the ANSI interpretive from the tools extension wordset, with some W32F specific extensions as well as an alternative set based on the 'C' style words #if #else #then etc.

Glossary

: [else]        ( -- )           \ ANSI             TOOLS EXT

Compilation: Perform the execution semantics given below.
Execution: ( "<spaces>name" ... -- ) Skipping leading spaces, parse and discard space-delimited words from the parse area, including nested occurrences of [IF] ... [THEN] and [IF] ... [ELSE] ... [THEN], until the word [THEN] has been parsed and discarded. If the parse area becomes exhausted, it is refilled as with REFILL. [ELSE] is an immediate word.

: [if]          ( flag -- )       \ ANSI            TOOLS EXT

Compilation: Perform the execution semantics given below.
Execution: ( flag | flag "<spaces>name" ... -- ) If flag is true, do nothing. Otherwise, skipping leading spaces, parse and discard space-delimited words from the parse area, including nested occurrences of [IF] ... [THEN], [IF] ... [ELSE] ... [THEN], [IF] ... [ENDIF] and [IF] ... [ELSE] ... [ENDIF], until either the word [ELSE], the word [THEN] or the word [ENDIF] has been parsed and discarded. If the parse area becomes exhausted, it is refilled as with REFILL. [IF] is an immediate word. An ambiguous condition exists if [IF] is POSTPONEd. If the end of the input buffer is reached and cannot be refilled before the terminating [ELSE], [THEN] or [ENDIF] is parsed then error -58 is thrown.

: [then]        ( -- )            \ ANSI            TOOLS EXT

Compilation: Perform the execution semantics given below.
Execution: ( -- ) Does nothing. [THEN] is an immediate word.

: [endif]       ( -- )            \ W32F            TOOLS EXTRA

Compilation: Perform the execution semantics given below.
Execution: ( -- ) Does nothing. [ENDIF] is an immediate word.

: #else         ( -- )            \ W32F            TOOLS EXTRA

Compilation: Perform the execution semantics given below.
Execution: ( "<spaces>name" ... -- ) Skipping leading spaces, parse and discard space-delimited words from the parse area, including nested occurrences of #IF ... #THEN and #IF ... #ELSE ... #THEN, until the word #THEN has been parsed and discarded. If the parse area becomes exhausted, it is refilled as with REFILL. #ELSE is an immediate word.

: #if           ( flag -- )       \ W32F            TOOLS EXTRA

Compilation: Perform the execution semantics given below.
Execution: ( flag | flag "<spaces>name" ... -- ) If flag is true, do nothing. Otherwise, skipping leading spaces, parse and discard space-delimited words from the parse area, including nested occurrences of #IF ... #THEN, #IF ... #ELSE ... #THEN, #IF ... #ENDIF and #IF ... #ELSE ... #ENDIF, until either the word #ELSE, the word #THEN or the word #ENDIF has been parsed and discarded. If the parse area becomes exhausted, it is refilled as with REFILL. #IF is an immediate word. An ambiguous condition exists if #IF is POSTPONEd. If the end of the input buffer is reached and cannot be refilled before the terminating #ELSE, #THEN or #ENDIF is parsed then error -58 is thrown.

: #then         ( -- )            \ W32F            TOOLS EXTRA

Compilation: Perform the execution semantics given below.
Execution: ( -- ) Does nothing. #THEN is an immediate word.

: #endif        ( -- )            \ W32F            TOOLS EXTRA

Compilation: Perform the execution semantics given below.
Execution: ( -- ) Does nothing. #ENDIF is an immediate word.

: #ifdef        ( "aword" -- )    \ W32F            TOOLS EXTRA

Compilation: Perform the execution semantics given below.
Execution: ( "aword" | "aword<spaces>name" ... -- ) If "aword" is found in the search order, do nothing. Otherwise, skipping leading spaces, parse and discard space-delimited words from the parse area, including nested occurrences of #IF ... #THEN, #IF ... #ELSE ... #THEN, #IF ... #ENDIF and #IF ... #ELSE ... #ENDIF, until either the word #ELSE, the word #THEN or the word #ENDIF has been parsed and discarded. If the parse area becomes exhausted, it is refilled as with REFILL. #IF is an immediate word. An ambiguous condition exists if #IF is POSTPONEd. If the end of the input buffer is reached and cannot be refilled before the terminating #ELSE, #THEN or #ENDIF is parsed then error -58 is thrown. This word is designed to ignore object.ivar type words.

: #ifndef       ( "aword" -- )    \ W32F            TOOLS EXTRA

Compilation: Perform the execution semantics given below.
Execution: ( "aword" | "aword<spaces>name" ... -- ) If "aword" is not found in the search order, do nothing. Otherwise, skipping leading spaces, parse and discard space-delimited words from the parse area, including nested occurrences of #IF ... #THEN, #IF ... #ELSE ... #THEN, #IF ... #ENDIF and #IF ... #ELSE ... #ENDIF, until either the word #ELSE, the word #THEN or the word #ENDIF has been parsed and discarded. If the parse area becomes exhausted, it is refilled as with REFILL. #IF is an immediate word. An ambiguous condition exists if #IF is POSTPONEd. If the end of the input buffer is reached and cannot be refilled before the terminating #ELSE, #THEN or #ENDIF is parsed then error -58 is thrown. This word is designed to ignore object.ivar type words.

: [DEFINED]     ( "aword" -- f1 ) \ W32F            TOOLS EXTRA

Compilation: Perform the execution semantics given below.
Execution: Return true if "aword" is found in a search of the search order. This word is designed to ignore object.ivar type words.

: [UNDEFINED]   ( "aword" -- f1 ) \ W32F            TOOLS EXTRA

Compilation: Perform the execution semantics given below.
Execution: Return false if "aword" is found in a search of the search order. This word is designed to ignore object.ivar type words.


Document $Id: p-interpif.htm,v 1.2 2007/05/26 10:24:11 dbu_de Exp $