POV-Ray : Newsgroups : povray.programming : UNIX POVRay does not exit with failure on error : Re: UNIX POVRay does not exit with failure on error Server Time
30 Jun 2024 12:46:24 EDT (-0400)
  Re: UNIX POVRay does not exit with failure on error  
From: Wolfgang Wieser
Date: 11 Aug 2004 17:58:40
Message: <411a968f@news.povray.org>
Nicolas Calimet wrote:

>> But I'm sure, Nicolas will come up with something better. :)
> 
> Honestly, I'm not sure of that, since I have myself a hard
> time with those cooperate stuffs and I'm still surprised it somehow
> works currently  ;-)  {well it works because Thorsten wrote the
> main() and cooperate-related functions, not me}
> 
After thinking about it: What about completely sending all that 
longjmp stuff to hell (grin...) and simply use: 

-----------------------------------------------------------------------------
struct ExitPovrayException
{
    int code;
    ExitPovrayException(int _c) : code(_c) {}
};

/*
 * POVMS stuff.
 */
#define POVRAY_BEGIN_COOPERATE  try {
#define POVRAY_END_COOPERATE    } catch(ExitPovrayException ex) \
                                  {  throw(ex.code);  }
#define EXIT_POVRAY(n)          throw ExitPovrayException(n);
-----------------------------------------------------------------------------

Maybe one could even get along without the ExitPovrayException and use 
the "throw (int)" construct directly: 

-----------------------------------------------------------------------------
/*
 * POVMS stuff.
 */
#define POVRAY_BEGIN_COOPERATE  /*empty*/
#define POVRAY_END_COOPERATE    /*empty*/
#define EXIT_POVRAY(n)          throw int(n);
-----------------------------------------------------------------------------

I don't have a full overview over the use of exceptions in POVRay, so 
I was trying to be careful with the first variant here. In this case one 
should probably add a further catch(ExitPovrayException ex) in main(). 
However, the second variant at least works for my simple tests. 

> BTW I saw some time ago on your pages that you already had
> problems with the exit code, but I simply didn't get an idea of how
> to cleanly solve that.  And I don't like much the way you do it,
> though I'm unable to propose anything better at the moment...
> 
I don't know exactly what you're referring to but the POVRay exit code 
issue for versions 3.1g an 3.5.. already cost me some sleepness nights 
while trying to make RendView know what to do with the output file 
(was it failure or complete? can we resume the render? etc.)...

> Another BTW, there's a little glitch on the povray.org
> download page, since the current UNIX version is 3.6.1 and the
> corresponding sources are there:
> 
Yes, actually, I noticed and upgraded just some minutes after having 
sent the initial posting. All the patches on my website are already 
against 3.6.1 :)

> ftp://ftp.povray.org/pub/povray/Official/Unix/povray-3.6.1.tar.gz
> ftp://ftp.povray.org/pub/povray/Official/Unix/povray-3.6.1.tar.bz2
> 
> I can also provide with diffs from 3.6 to 3.6.1, on a per
> request basis.
> 
Thanks for the offer. I made the diff myself using my university account. 
This reduced the download size for my slow home connection to about 12% 
of the initial size. 

Wolfgang


Post a reply to this message

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