POV-Ray : Newsgroups : povray.advanced-users : Macros in Macros? : Re: Macros in Macros? Server Time
29 Jul 2024 06:21:54 EDT (-0400)
  Re: Macros in Macros?  
From: Mike Williams
Date: 19 Oct 2002 12:00:59
Message: <I63pDAArEYs9EwvB@econym.demon.co.uk>
Wasn't it Tim Nikias who wrote:
>It obviously does work, but I've still got a question
>regarding this:
>
>I've fumbled around with my Particle-System. It formerly
>was just a simple #include-file, and after setting all
>parameters, you include it, and everything is
>done.
>Now, I've simply put a #macro-statement at the beginning
>of the file, and an #end at the very end. Thus, by calling
>PartixGen() its like including the file.
>
>Now this:
>I always thought that parameters and variables etc are
>just temporarily stored while in the macro, and that
>they are destroyed and the memory is set free after
>the macro "destructs". Now I've got a macro-declaration
>inside the include-file, which makes it possible to
>visualize the emitter. But since the macro is inside an
>already destruced macro, shouldn't it produce and error,
>telling me the macro doesn't exist?
>Is there something funky about macros and their declaration
>in macros themselves? Just curious, it works like I want it
>to, but its not what I actually expect.

#local variables only exist within the macro that uses them, or, if
declared in an include file outside a macro, exist until the end of that
file.
#declare variables are global in scope and permanent in duration.
(see Doc: 6.2.2.2)

All macro names are global in scope and permanent in duration. 
(see Doc: 6.2.8.1: )

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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