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@web.de Signed-off-by: Segher Boessenkool segher@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