[OpenBIOS] Nested [IFDEF]s not working?

Mark Cave-Ayland mark.cave-ayland at siriusit.co.uk
Thu Dec 2 12:25:41 CET 2010


Andreas Färber wrote:
> Hello,
> 
> A construct like:
> 
> [IFDEF] CONFIG_PPC
>   [IFDEF] CONFIG_PPC64
>     5
>   [ELSE]
>     4
>   [THEN]
> [ELSE]
>   [IFDEF] CONFIG_SPARC64
>     6
>   [ELSE]
>     3
>   [THEN]
> [THEN]
> 
> has been seen to return, e.g., 4 3 according to the debug word.
> 
> Is this nesting forbidden in Forth? Easily fixable? A better way to do 
> this? I do want a final catch-all since returning no value would have 
> unexpected results, and we currently do not have a define CONFIG_PPC32 
> so that a concatenation of independent [IFDEF]...[THEN]s wouldn't work.

IIRC [IFDEF] [ELSE] and [THEN] are simply Forth words that swallow the 
input unless the condition is met.

I suspect it will be similar to the bbranch & friends Fcode instructions 
whereby at compile time the current nested state is held on the dstack.


HTH,

Mark.

-- 
Mark Cave-Ayland - Senior Technical Architect
PostgreSQL - PostGIS
Sirius Corporation plc - control through freedom
http://www.siriusit.co.uk
t: +44 870 608 0063

Sirius Labs: http://www.siriusit.co.uk/labs



More information about the OpenBIOS mailing list