|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Hello there,
I am trying to create a "sirpinski-sponge" by using a macro in a recursion. The
macro "sirpinski" calls itself with different parameters. But I end up getting
screwed up pictures or an error message:
Parse Error: Too many nested symbol tables
0:00:00 Reclaiming memory
Memory leakage detected, see file 'Memory.Log' for list
What is a symbol table? What does this message mean? Is it possible to use
macros the way I try to?
Peter
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
peter <den### [at] webde> wrote:
> I am trying to create a "sirpinski-sponge" by using a macro in a recursion. The
> macro "sirpinski" calls itself with different parameters. But I end up getting
> screwed up pictures or an error message:
> Parse Error: Too many nested symbol tables
There's a limit how many times a macro can be called recursively. This
limit is relatively small.
Unfortunately the only solution to this is to try to create the object
iteratively (ie. with #while loops).
--
- Warp
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"peter" <den### [at] webde> wrote in message
news:web.48ebd8c3cab65715180445b0@news.povray.org...
> Hello there,
>
> I am trying to create a "sirpinski-sponge" by using a macro in a
> recursion. The
> macro "sirpinski" calls itself with different parameters. But I end up
> getting
> screwed up pictures or an error message:
>
> Parse Error: Too many nested symbol tables
>
> 0:00:00 Reclaiming memory
> Memory leakage detected, see file 'Memory.Log' for list
>
> What is a symbol table? What does this message mean? Is it possible to use
> macros the way I try to?
A symbol table is used to store identifiers. Each time a macro is called it
would need a new symbol table for the local variables (including parameter
values). I would think that these errors would result from failure to
establish a suitable exit criteria resulting in the macro repeatedly calling
itself until the limit is reached (the limit seems to be about 98).
One way to avoid this situation is to declare a global variable that keeps
count of the recursion depth and use it to prevent the macro from calling
itself once a defined limit has been reached. The macro can increment this
variable at the start and decrement it at the end.
#declare Depth = 0;
#macro Test ()
#declare Depth = Depth + 1;
#debug concat(str(Depth,3,0),"\n")
#if(Depth<98) Test() #end
#declare Depth = Depth - 1;
#end
Test()
The other way that I see Warp has already mentioned is to recode it using
#while loops thus avoiding self calling macros.
Regards,
Chris B.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Thank you Chris and Warp for your help. I solved the problem by using local
variables. But the scene took way to long to render so I recoded it using an
iteration with #while loops. It worked just fine.
It took me a while to answer, I thought I'd be notified when there is a reply to
my post, but I wasn't. I'll check if I can change that.
Peter
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |