[OpenBIOS] [commit] r979 - trunk/openbios-devel/forth/lib

repository service svn at openbios.org
Sun Dec 5 02:15:57 CET 2010


Author: afaerber
Date: Sun Dec  5 02:15:57 2010
New Revision: 979
URL: http://tracker.coreboot.org/trac/openbios/changeset/979

Log:
forth: Fix ([IF]) to handle nested [IFDEF] as well

Depending on the condition, either the [IFDEF] FOO or the [ELSE]
would get compiled as an [IF], eating words until [ELSE] or [THEN]
respectively. While doing so, [IFDEF] does not get compiled to [IF],
so we need to handle nested [IFDEF] to account for its [ELSE] or [THEN].

This fixes [IFDEF] not disabling the full section of code.

Thanks to Segher for pointing me in the right direction.

Signed-off-by: Andreas Färber <andreas.faerber at web.de>
Signed-off-by: Segher Boessenkool <segher at kernel.crashing.org>

Modified:
   trunk/openbios-devel/forth/lib/preprocessor.fs

Modified: trunk/openbios-devel/forth/lib/preprocessor.fs
==============================================================================
--- trunk/openbios-devel/forth/lib/preprocessor.fs	Sun Nov 28 21:03:46 2010	(r978)
+++ trunk/openbios-devel/forth/lib/preprocessor.fs	Sun Dec  5 02:15:57 2010	(r979)
@@ -19,6 +19,7 @@
     repeat
 
     2dup " [IF]" strcmp 0= if 1 throw then
+    2dup " [IFDEF]" strcmp 0= if 1 throw then
     2dup " [ELSE]" strcmp 0= if 2 throw then
     2dup " [THEN]" strcmp 0= if 3 throw then
     " \\" strcmp 0= if linefeed parse 2drop then



More information about the OpenBIOS mailing list