POV-Ray : Newsgroups : povray.beta-test : Stack crash! Server Time
29 Jul 2024 12:27:58 EDT (-0400)
  Stack crash! (Message 1 to 3 of 3)  
From: David Wallace
Subject: Stack crash!
Date: 30 Apr 2002 03:26:47
Message: <3cce4737@news.povray.org>
POV-RC3, Duron 800. 512 MB DDR, Win98SE

Enter this code:

#declare sp0 = spline {
 cubic_spline
 -1, <0, -50, -20>
 0.0, <0, 0, 0>
 0.5, <20, 50, 0>
 1.0, <0, 100, 20>
 1.5, <-20, 150, 0>
}
#declare rb = array[2] { 15, 5 }
#declare nseg = 20;

#macro MakeSegs(Level, spl, fName)
 #local i = 0;
 #while ( i<nseg )
  #local pst = spl(i/nseg);
  #local pen = spl((i+1)/nseg);
   #write (pFile, concat("  cylinder {
<",vstr(3,pst,",",0,6),">,<",vstr(3,pen,",",0,6),">,",str(rb[Level],0,5),",
1 }\n")
   #write (pFile, concat("  sphere {
<",vstr(3,pen,",",0,6),">,",str(rb[Level],0,5),", -1 }\n")
   #local i = i + 1;
  #end
#end

#fopen pFile "sktext.inc" write
#write (pFile, "blob {\n  threshold 0\n")
#local i = 0;
#while (i<2000)
 MakeSegs(1,sp0,"rew")
 #local i = i + 1;
#end
#fclose pFile

POV screams: Stack overflow


Post a reply to this message

From: Gleb
Subject: Re: Stack crash!
Date: 30 Apr 2002 04:50:22
Message: <3cce5ace$1@news.povray.org>
"David Wallace" <dar### [at] earthlinknet> wrote in message
news:3cce4737@news.povray.org...
> POV-RC3, Duron 800. 512 MB DDR, Win98SE
>
> Enter this code:
>.....
> #macro MakeSegs(Level, spl, fName)
>  #local i = 0;
>  #while ( i<nseg )
>   #local pst = spl(i/nseg);
>   #local pen = spl((i+1)/nseg);
>    #write (pFile, concat("  cylinder {
>
<",vstr(3,pst,",",0,6),">,<",vstr(3,pen,",",0,6),">,",str(rb[Level],0,5),",
> 1 }\n")
         ^
>    #write (pFile, concat("  sphere {
> <",vstr(3,pen,",",0,6),">,",str(rb[Level],0,5),", -1 }\n")
                                                            ^
>    #local i = i + 1;
>   #end
> #end
>......
> POV screams: Stack overflow

Parentheses in both #write statements inside the #macro are not closed.


Post a reply to this message

From: David Wallace
Subject: Re: Stack crash!
Date: 30 Apr 2002 21:27:36
Message: <3ccf4488@news.povray.org>
"Gleb" <gk1### [at] sotonacuk> wrote in message news:3cce5ace$1@news.povray.org...
>
> "David Wallace" <dar### [at] earthlinknet> wrote in message
> news:3cce4737@news.povray.org...
> > POV-RC3, Duron 800. 512 MB DDR, Win98SE
> >
> > Enter this code:
> >.....
> > #macro MakeSegs(Level, spl, fName)
> >  #local i = 0;
> >  #while ( i<nseg )
> >   #local pst = spl(i/nseg);
> >   #local pen = spl((i+1)/nseg);
> >    #write (pFile, concat("  cylinder {
> >
>
<",vstr(3,pst,",",0,6),">,<",vstr(3,pen,",",0,6),">,",str(rb[Level],0,5),",
> > 1 }\n")
>          ^
> >    #write (pFile, concat("  sphere {
> > <",vstr(3,pen,",",0,6),">,",str(rb[Level],0,5),", -1 }\n")
>                                                             ^
> >    #local i = i + 1;
> >   #end
> > #end
> >......
> > POV screams: Stack overflow
>
> Parentheses in both #write statements inside the #macro are not closed.
>
>
>
>
Then why don't I get a"'')' expected, ??? found instead " error?
Actually I was looking for exactly this kind of problem--in all the wrong
places.  POV-Ray's parser isn't as strict as it could be about what may or
may not be a particular code block, or more lost braces and parentheses
would be found more readily.

I actually learned something about POV-Ray's stack from this.   Shortly
after making this test file, I inserted a debug statement in the outer
#while loop (not shown here) to output the i variable.  It stopped at 93,
indicating a stack size of about 3680-3720.


Post a reply to this message

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