POV-Ray : Newsgroups : povray.unofficial.patches : MegaPOV quirks and questions.. : Re: MegaPOV quirks and questions.. Server Time
2 Sep 2024 06:17:36 EDT (-0400)
  Re: MegaPOV quirks and questions..  
From: Ron Parker
Date: 25 Jul 2000 12:14:51
Message: <slrn8nrfu3.hio.ron.parker@fwi.com>
On Tue, 25 Jul 2000 17:41:38 +0300, Margus Ramst wrote:
>Alex Vandiver wrote:
>> 
>> No -- you're missing the point.  The version I wrote leaves a macro, b(),
>> defined after a(foo) closes, which is dependant on what foo was at the time
>> a(foo) was called.
>
>Then how about this:
>
>#macro a(foo)
>   #if (foo)
>     #declare Switch=1;
>   #else
>     #declare Switch=0;
>   #end
>#end
>
>#if(Switch)
>   #macro b()
>      // do one thing
>   #end
>#else
>   #macro b()
>      // do another thing
>   #end
>#end

Still not the same.  Something like this would be, though:

#macro a(foo)
  #declare Switch=foo;
#end

#macro b()
  #if (Switch)
    // do one thing
  #else
    // do another thing
  #end
#end

but, perversely, I find the nested macro solution somehow more elegant.
For one thing, it uses one less entry in the global symbol table.  For
another, it parses more quickly, particularly if you'll be calling b a
lot.

-- 
Ron Parker   http://www2.fwi.com/~parkerr/traces.html
My opinions.  Mine.  Not anyone else's.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.