From dcs@newsguy.com  Sun Jan 24 04:49:20 1999
Received: from peach.ocn.ne.jp (peach.ocn.ne.jp [210.145.254.87])
          by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id EAA00327
          for <FreeBSD-gnats-submit@freebsd.org>; Sun, 24 Jan 1999 04:49:19 -0800 (PST)
          (envelope-from dcs@newsguy.com)
Received: from daniel.sobral by peach.ocn.ne.jp (8.9.1a/OCN) id VAA29174; Sun, 24 Jan 1999 21:48:58 +0900 (JST)
Received: (from root@localhost)
	by daniel.sobral (8.9.1/8.9.2) id VAA00511;
	Sun, 24 Jan 1999 21:48:30 +0900 (JST)
	(envelope-from root)
Message-Id: <199901241248.VAA00511@daniel.sobral>
Date: Sun, 24 Jan 1999 21:48:30 +0900 (JST)
From: dcs@newsguy.com
Reply-To: dcs@newsguy.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: Conditional compilation for ficl
X-Send-Pr-Version: 3.2

>Number:         9662
>Category:       bin
>Synopsis:       FICL has no builtin facility for conditional compilation
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jan 24 04:50:01 PST 1999
>Closed-Date:    Sun Jan 24 10:13:08 PST 1999
>Last-Modified:  Sun Jan 24 10:13:24 PST 1999
>Originator:     Daniel C. Sobral
>Release:        FreeBSD 4.0-CURRENT i386
>Organization:
>Environment:

	Current as of Jan 23

>Description:

	There is no builtin facility in ficl for conditional compilation.
This is actually just a minor problem, since one can be easily written
by standard programs. Indeed, the one implemented here has come straight
out of ANS Forth draft proposal, plus minor case correction.

>How-To-Repeat:

	UTSL.

>Fix:
	
	Apply the following fix:


--- src/sys/boot/ficl/softwords/softcore.fr	1999/01/09 22:35:43	1.2
+++ src/sys/boot/ficl/softwords/softcore.fr	1999/01/24 12:23:52
@@ -78,6 +78,38 @@
     loop drop
 ;
 
+\ ** Some TOOLS EXT words, straight from the standard
+: [else]  ( -- )
+    1 begin                               \ level
+      begin
+        bl word count  dup  while         \ level adr len
+        2dup  s" [IF]"  compare 0= >r
+	2dup  s" [if]"  compare 0= r> or
+        if                                \ level adr len
+          2drop 1+                        \ level'
+        else                              \ level adr len
+          2dup  s" [ELSE]" compare 0= >r
+	  2dup  s" [else]" compare 0= r> or
+	  if				  \ level adr len
+             2drop 1- dup if 1+ then      \ level'
+          else                            \ level adr len
+	    2dup
+            s" [THEN]"  compare 0= >r	  \ level adr len
+	    s" [then]"  compare 0= r> or
+	    if				  \ level
+              1-                          \ level'
+            then
+          then
+        then ?dup 0=  if exit then        \ level'
+      repeat  2drop                       \ level
+    refill 0= until                       \ level
+    drop
+;  immediate
+
+: [if]  ( flag -- )
+0= if postpone [else] then ;  immediate
+
+: [then]  ( -- )  ;  immediate
 \ ** SEARCH+EXT words and ficl helpers
 \ 
 : wordlist   ( -- )  
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: msmith 
State-Changed-When: Sun Jan 24 10:13:08 PST 1999 
State-Changed-Why:  
Code added, thanks. 
>Unformatted:
