1999-09-29 04:43:16 +00:00
|
|
|
\ ** ficl/softwords/ifbrack.fr
|
|
|
|
\ ** ANS conditional compile directives [if] [else] [then]
|
|
|
|
\ ** Requires ficl 2.0 or greater...
|
2002-04-09 17:45:28 +00:00
|
|
|
\
|
1999-09-29 04:43:16 +00:00
|
|
|
\ $FreeBSD$
|
|
|
|
|
2001-04-29 02:36:36 +00:00
|
|
|
hide
|
1999-09-29 04:43:16 +00:00
|
|
|
|
|
|
|
: ?[if] ( c-addr u -- c-addr u flag )
|
2002-04-09 17:45:28 +00:00
|
|
|
2dup s" [if]" compare-insensitive 0=
|
1999-09-29 04:43:16 +00:00
|
|
|
;
|
|
|
|
|
|
|
|
: ?[else] ( c-addr u -- c-addr u flag )
|
2002-04-09 17:45:28 +00:00
|
|
|
2dup s" [else]" compare-insensitive 0=
|
1999-09-29 04:43:16 +00:00
|
|
|
;
|
|
|
|
|
|
|
|
: ?[then] ( c-addr u -- c-addr u flag )
|
2002-04-09 17:45:28 +00:00
|
|
|
2dup s" [then]" compare-insensitive 0= >r
|
|
|
|
2dup s" [endif]" compare-insensitive 0= r>
|
1999-09-29 04:43:16 +00:00
|
|
|
or
|
|
|
|
;
|
|
|
|
|
|
|
|
set-current
|
|
|
|
|
|
|
|
: [else] ( -- )
|
|
|
|
1 \ ( level )
|
|
|
|
begin
|
|
|
|
begin
|
|
|
|
parse-word dup while \ ( level addr len )
|
|
|
|
?[if] if \ ( level addr len )
|
|
|
|
2drop 1+ \ ( level )
|
|
|
|
else \ ( level addr len )
|
|
|
|
?[else] if \ ( level addr len )
|
|
|
|
2drop 1- dup if 1+ endif
|
|
|
|
else
|
|
|
|
?[then] if 2drop 1- else 2drop endif
|
|
|
|
endif
|
|
|
|
endif ?dup 0= if exit endif \ level
|
|
|
|
repeat 2drop \ level
|
|
|
|
refill 0= until \ level
|
|
|
|
drop
|
|
|
|
; immediate
|
|
|
|
|
|
|
|
: [if] ( flag -- )
|
|
|
|
0= if postpone [else] then ; immediate
|
|
|
|
|
|
|
|
: [then] ( -- ) ; immediate
|
2002-04-09 17:45:28 +00:00
|
|
|
: [endif] ( -- ) ; immediate
|
1999-09-29 04:43:16 +00:00
|
|
|
|
|
|
|
previous
|