\ condcomp 05.09.12 NAB \ Conditional compilation words \ [IF] [ELSE] and [THEN] \ This version works in both memos, \ and Doc-format source files. needs condthens needs redefer redefer (find) module tools-ext variable ifdepth 0 ifdepth ! wordlist constant ifelsethen : restore-find [ action-of (find) ] literal is (find) ; defer disabled-find : disable-find ['] disabled-find is (find) ; : (if) 1 ifdepth +! ; immediate public: : [if] if exit then postpone (if) ifdepth @ 1 = if disable-find then ; immediate : [else] ifdepth @ 0= if 0 postpone [if] else ifdepth @ 1 = if restore-find 0 ifdepth ! then then ; immediate : [then] ifdepth @ 1 = if restore-find then ifdepth @ 0> if -1 ifdepth +! then ; immediate get-current ifelsethen set-current ' [if] alias [if] ' [else] alias [else] ' [then] alias [then] set-current :noname restore-find ifelsethen search-wordlist disable-find if cond dup ['] [if] = if [ parse-word (if) (find) ] 2literal else dup ['] [else] = if [ parse-word [else] (find) ] 2literal else dup ['] [then] = if [ parse-word [then] (find) ] 2literal thens rot drop else [ parse-word noop (find) ] 2literal then ; is disabled-find end-module