1 \ ** ficl/softwords/ifbrack.fr
2 \ ** ANS conditional compile directives [if] [else] [then]
3 \ ** Requires ficl 2.0 or greater...
7 : ?[if] ( c-addr u -- c-addr u flag )
8 2dup s" [if]" compare-insensitive 0=
11 : ?[else] ( c-addr u -- c-addr u flag )
12 2dup s" [else]" compare-insensitive 0=
15 : ?[then] ( c-addr u -- c-addr u flag )
16 2dup s" [then]" compare-insensitive 0= >r
17 2dup s" [endif]" compare-insensitive 0= r>
27 parse-word dup while \ ( level addr len )
28 ?[if] if \ ( level addr len )
30 else \ ( level addr len )
31 ?[else] if \ ( level addr len )
32 2drop 1- dup if 1+ endif
34 ?[then] if 2drop 1- else 2drop endif
36 endif ?dup 0= if exit endif \ level
38 refill 0= until \ level
43 0= if postpone [else] then ; immediate
45 : [then] ( -- ) ; immediate
46 : [endif] ( -- ) ; immediate