ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/rvmain.c
(Generate patch)

Comparing ray/src/rt/rvmain.c (file contents):
Revision 2.9 by greg, Thu Aug 21 07:05:59 2008 UTC vs.
Revision 2.16 by schorsch, Sat Mar 19 12:51:36 2016 UTC

# Line 18 | Line 18 | static const char      RCSid[] = "$Id$";
18   #include  "random.h"
19   #include  "paths.h"
20   #include  "view.h"
21 + #include  "pmapray.h"
22  
23   extern char  *progname;                 /* global argv[0] */
24  
# Line 54 | Line 55 | static void onsig(int  signo);
55   static void sigdie(int  signo, char  *msg);
56   static void printdefaults(void);
57  
57
58 int
58   main(int argc, char *argv[])
59   {
60   #define  check(ol,al)           if (argv[i][ol] || \
61                                  badarg(argc-i-1,argv+i+1,al)) \
62                                  goto badopt
63 < #define  bool(olen,var)         switch (argv[i][olen]) { \
63 > #define  check_bool(olen,var)           switch (argv[i][olen]) { \
64                                  case '\0': var = !var; break; \
65                                  case 'y': case 'Y': case 't': case 'T': \
66                                  case '+': case '1': var = 1; break; \
# Line 147 | Line 146 | main(int argc, char *argv[])
146                          }
147                          break;
148                  case 'b':                               /* grayscale */
149 <                        bool(2,greyscale);
149 >                        check_bool(2,greyscale);
150                          break;
151                  case 'p':                               /* pixel */
152                          switch (argv[i][2]) {
# Line 171 | Line 170 | main(int argc, char *argv[])
170                          break;
171                  case 'w':                               /* warnings */
172                          rval = erract[WARNING].pf != NULL;
173 <                        bool(2,rval);
173 >                        check_bool(2,rval);
174                          if (rval) erract[WARNING].pf = wputs;
175                          else erract[WARNING].pf = NULL;
176                          break;
# Line 196 | Line 195 | main(int argc, char *argv[])
195                  error(USER, err);
196                                                  /* set up signal handling */
197          sigdie(SIGINT, "Interrupt");
199        sigdie(SIGHUP, "Hangup");
198          sigdie(SIGTERM, "Terminate");
199 + #if !defined(_WIN32) && !defined(_WIN64)
200 +        sigdie(SIGHUP, "Hangup");
201          sigdie(SIGPIPE, "Broken pipe");
202          sigdie(SIGALRM, "Alarm clock");
203 + #endif
204                                          /* open error file */
205          if (errfile != NULL) {
206                  if (freopen(errfile, "a", stderr) == NULL)
# Line 225 | Line 226 | main(int argc, char *argv[])
226                                          /* set up output & start process(es) */
227          SET_FILE_BINARY(stdout);
228          
229 <        ray_pinit(octnm, 0);
230 <
229 >        ray_init(octnm);                /* also calls ray_init_pmap() */
230 >        
231 > /* temporary shortcut, until winrview is refactored into a "device" */
232 > #ifndef WIN_RVIEW
233          rview();                        /* run interactive viewer */
234  
235 +
236          devclose();                     /* close output device */
237 + #endif
238  
239 +        /* PMAP: free photon maps */
240 +        ray_done_pmap();
241 +        
242 + #ifdef WIN_RVIEW
243 +        return 1;
244 + #endif
245          quit(0);
246  
247   badopt:
# Line 239 | Line 250 | badopt:
250          return 1; /* pro forma return */
251  
252   #undef  check
253 < #undef  bool
253 > #undef  check_bool
254   }
255  
256  
# Line 285 | Line 296 | onsig(                         /* fatal signal */
296          if (gotsig++)                   /* two signals and we're gone! */
297                  _exit(signo);
298  
299 + #if !defined(_WIN32) && !defined(_WIN64)
300          alarm(15);                      /* allow 15 seconds to clean up */
301          signal(SIGALRM, SIG_DFL);       /* make certain we do die */
302 + #endif
303          eputs("signal - ");
304          eputs(sigerr[signo]);
305          eputs("\n");

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines