How do I make a macro call itself with out getting an error message such
as "too many nested symbols"?
-paul
--
--------------------------------------------------}
Paul Daniel Jones
The Pennslyvania State University
pdj### [at] psuedu
http://research.chem.psu.edu/glassgrp/paul
C The way is near, but men
// \ seek it afar. It is in the
N N easy things, but men seek it
| || in the difficult things.
C C -Menicius
\\ /
C
--------------------------------------------------}
In article <38FDC62F.D85DBD1B@psu.edu> , Paul Jones <pdj### [at] psuedu> wrote:
> How do I make a macro call itself with out getting an error message such> as "too many nested symbols"?
You need to add a parameter you pass on to make sure you do not enter an
infinite recursion (or use another method ending the recursion depending on
your algorithm). There is an example scene using recursive macro calls in
the 'macros' directory (in the 'scenes' directory) called 'pyramid.pov'.
Thorsten
Paul Jones wrote:
> > How do I make a macro call itself with out getting an error message such> as "too many nested symbols"?>
You need some parameter to control recursion depth.
The following macro does nothing but call itself recursively R times:
#macro Recurse(R)
#if(R>0)
Recurse(R-1)
#end
#end
Once the counter has hit zero, the parser falls out of all the nested instances.
You may of course add conditions that reset the counter in some instance, and
thus make the macro go into another recursive 'branch'
--
Margus Ramst
Personal e-mail: mar### [at] peakeduee
TAG (Team Assistance Group) e-mail: mar### [at] tagpovrayorg