POV-Ray : Newsgroups : povray.general : Unhandled Exception vs. Parse error : Re: Unhandled Exception vs. Parse error Server Time
31 Jul 2024 00:33:29 EDT (-0400)
  Re: Unhandled Exception vs. Parse error  
From: Patrick Elliott
Date: 5 Mar 2008 23:11:42
Message: <MPG.22391cba2d19882898a117@news.povray.org>
In article <47cf0413$1@news.povray.org>, tim### [at] comcastnet says...
> >I know that trying to call a variable before you declare it is not 
> >generally
> > considered very bright, but I'm attempting to understand what's going o
n 
> > in the
> > code below:
> >
> > ----------------------------------------
> > (test.pov)
> > #declare RdmA = seed(574647);
> > #include "rand2.inc"
> > #declare X = RRand(-5,5,RdmA);
> > #if (Y = 0) #end
> > ----------------------------------------
> >
> > ----------------------------------------
> > (rand2.inc)
> > #macro RRand(Min, Max, RS) (rand(RS)*(Max-Min) + Min) #end
> > ----------------------------------------
> >
> > "rand2.inc" consists of a macro copied from the original "rand.inc" fil
e. 
> > If I
> > run "test.pov" above, POV-Ray throws an unhandled exception and I'm for
ced 
> > to
> > close the program.
> >
> > If, however, I change "test.pov" to be:
> >
> > ----------------------------------------
> > (test2.pov)
> > #declare RdmA = seed(574647);
> > #macro RRand(Min, Max, RS) (rand(RS)*(Max-Min) + Min) #end
> > #declare X = RRand(-5,5,RdmA);
> > #if (Y = 0) #end
> > ----------------------------------------
> >
> > ......that is, I replace the '#include' call with the macro from 
> > "rand2.inc",
> > then POV produces a simple parse error, as expected.
> >
> > So, what's the difference between using this macro in an include file a
nd
> > placing it directly in my .pov code?
> >
> > OS: WinXP
> > POV: 3.6.1c
> >
> As far as the SDL is concerned this "should" be the same result,
> but the first one involves file access, so it's probably a bug in POV,
> or possibly in the OS. There may be a "slew time" involved with
> including a file, moving the location of the include to the beginning
> of the calling file may help (other commands would be processed
> before using the macro, giving the files a little time to close). The
> same sort of crash can happen if you include the same files from
> an included file as in the calling file. For example if you have some
> file "scene.pov" and it includes "rand.inc" and "mymacro.inc",
> then if you include "rand.inc" inside "mymacro.inc" it could
> cause a problem.
> 
Hmm. Sounds like the parser needs to flag cases like this and, at 
minimum, ignore requests to include files of the same name and location. 
You "may" have cases where you have the same name, but different 
contents, in a different directory though, so you do need to account for 
and allow that, but that means more complex checking, like seeing if the 
files are identical via a "diff" type parse. Just storing the name and 
directory, then refusing to load it, wouldn't cause as much of a problem 
though. Though, why it doesn't just replace one set of definitions with 
the new ones (or fail with an error), and not crash....

-- 
void main () {

    if version = "Vista" {
      call slow_by_half();
      call DRM_everything();
    }
    call functional_code();
  }
  else
    call crash_windows();
}

<A HREF='http://www.daz3d.com/index.php?refid=16130551'>Get 3D Models,
 
3D Content, and 3D Software at DAZ3D!</A>


Post a reply to this message

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