title: [DEFINED] name description: precompiler-like test if a word is defined. The result is tested with => [IF] discussion: [DEFINED] is part of the => ../../wordset/FPH also in FPH is [UNDEFINED] [DEFINED] and [UNDEFINED] are also in the OTA standard. There are quite a few words that do something similar but are named differently. > Guido Draheim wrote: > gforth: [IFDEF] and [IFUNDEF] in base system, > does the nesting with a dynamic parser vector ; > has neither [DEFINED] nor [NOT], but > has immediate DEFINED ( "name" -- 0|1 ) > old pfe: none in base system, strictly ansi > new pfe: [DEFINED] and [NOT] in base system, > has also an independent C-like syntax that can not > mix with [IF] [ELSE] (#IFDEF .. #ELSE .. #ENDIF) > win32for: DEFINED and HAVE in base system, actually > DEFINED ( "name" -- str 0 | cfa flag ) non-immediate > HAVE ( "name" -- 0|flag ) non-immediate > bigforth: [IFDEF] and [IFUNDEF] in base system, > implemented just like gforth does ; > neither [DEFINED] nor [NOT] ; > has a non-immediate DEFINED? possible-implementations: : [DEFINED] ( IN: word -- CS: flag ) BL WORD FIND NIP \ incompatible with OTA ; IMMEDIATE : [DEFINED] ( IN: word -- CS: flag ) BL WORD FIND NIP 0<> \ as in OTA ; IMMEDIATE : [UNDEFINED] ( IN: word -- CS: flag ) BL WORD FIND NIP 0= ; IMMEDIATE ( The difference between the two definitions of [DEFINED] is in the value returned for IMMEDIATE words, 1 or -1. --- $Id: index-v.txt,v 1.3 2002/05/21 19:17:54 mlg Exp $