POV-Ray : Newsgroups : povray.unofficial.patches : Macros, includes and memory management : Re: Macros, includes and memory management Server Time
1 Sep 2024 18:15:35 EDT (-0400)
  Re: Macros, includes and memory management  
From: Chris Huff
Date: 19 Dec 2000 12:22:21
Message: <chrishuff-42C027.12232719122000@news.povray.org>
In article <3a3f78dd@news.povray.org>, Geoff Wedig 
<wed### [at] darwinepbicwruedu> wrote:

> That's probably what I'll have to do.  It's not very extensible though.  
> If someone wants to use their own parameterization, that isn't 
> provided in the base code, they have to not only write the new macro, 
> but give it an identifier and add it to the multiplexer macro.

Just let one of the macros be a "user macro", with a specific, 
documented name. That way, the user can write their own macro with this 
name, which your code already knows to call if the control variable has 
a certain value.


> Hmm, can a macro be defined in terms of itself?  Ie, can you have 
> something like:
> 
> #macro test_macro()
>   test_macro()
>   other stuff
> #end

That depends on what you mean by "defined in terms of itself". What you 
wrote there is an infinitely recursive macro...once you call it, it will 
call itself, call itself, call itself...ad infinitum. You need to use an 
#if() block and a counter variable to tell it when to stop calling 
itself. Then it will return through all the "other stuff" once for every 
call.

-- 
Christopher James Huff
Personal: chr### [at] maccom, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tagpovrayorg, http://tag.povray.org/

<><


Post a reply to this message

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