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

Comparing ray/src/rt/rpmain.c (file contents):
Revision 2.3 by schorsch, Thu Jun 5 19:29:34 2003 UTC vs.
Revision 2.9 by greg, Tue Jan 18 00:33:16 2005 UTC

# Line 11 | Line 11 | static const char      RCSid[] = "$Id$";
11   #include  <signal.h>
12  
13   #include  "platform.h"
14 + #include  "rtprocess.h" /* getpid() */
15   #include  "ray.h"
16   #include  "source.h"
17   #include  "ambient.h"
# Line 26 | Line 27 | static const char      RCSid[] = "$Id$";
27   #endif
28  
29   char  *progname;                        /* argv[0] */
29
30   char  *octname;                         /* octree name */
31
31   char  *sigerr[NSIG];                    /* signal error messages */
33
32   char  *shm_boundary = NULL;             /* boundary of shared memory */
35
33   char  *errfile = NULL;                  /* error output file */
34  
35   extern time_t  time();
# Line 52 | Line 49 | extern double  dstrpix;                        /* square pixel distribution
49  
50   extern double  mblur;                   /* motion blur parameter */
51  
52 < void    onsig();
56 < void    sigdie();
57 < void    printdefaults();
52 > extern double  dblur;                   /* depth-of-field blur parameter */
53  
54 + static void onsig(int signo);
55 + static void sigdie(int  signo, char  *msg);
56 + static void printdefaults(void);
57  
58 +
59   int
60 < main(argc, argv)
62 < int  argc;
63 < char  *argv[];
60 > main(int  argc, char  *argv[])
61   {
62   #define  check(ol,al)           if (argv[i][ol] || \
63                                  badarg(argc-i-1,argv+i+1,al)) \
# Line 157 | Line 154 | char  *argv[];
154                                  check(3,"f");
155                                  mblur = atof(argv[++i]);
156                                  break;
157 +                        case 'd':                               /* aperture */
158 +                                check(3,"f");
159 +                                dblur = atof(argv[++i]);
160 +                                break;
161                          default:
162                                  goto badopt;
163                          }
# Line 228 | Line 229 | char  *argv[];
229          initurand(2048);
230                                          /* set up signal handling */
231          sigdie(SIGINT, "Interrupt");
232 + #ifdef SIGHUP
233          sigdie(SIGHUP, "Hangup");
234 + #endif
235          sigdie(SIGTERM, "Terminate");
236 + #ifdef SIGPIPE
237          sigdie(SIGPIPE, "Broken pipe");
238 + #endif
239 + #ifdef SIGALRM
240          sigdie(SIGALRM, "Alarm clock");
241 + #endif
242   #ifdef  SIGXCPU
243          sigdie(SIGXCPU, "CPU limit exceeded");
244          sigdie(SIGXFSZ, "File size exceeded");
# Line 283 | Line 290 | char  *argv[];
290          if (loadflags & IO_INFO) {      /* print header */
291                  printargs(i, argv, stdout);
292                  printf("SOFTWARE= %s\n", VersionID);
286                fputnow(stdout);
293          }
294  
295          marksources();                  /* find and mark sources */
# Line 312 | Line 318 | char  *argv[];
318                  }
319          }
320   runagain:
321 <        if (persist)
321 >        if (persist) {
322                  if (outfile == NULL)                    /* if out to stdout */
323                          dupheader();                    /* send header */
324                  else                                    /* if out to file */
325                          duped1 = dup(fileno(stdout));   /* hang onto pipe */
326 +        }
327   #endif
328                                          /* batch render picture(s) */
329          rpict(seqstart, outfile, zfile, recover);
# Line 347 | Line 354 | runagain:
354   badopt:
355          sprintf(errmsg, "command line error at '%s'", argv[i]);
356          error(USER, errmsg);
357 +        return 1; /* pro forma return */
358  
359   #undef  check
360   #undef  bool
# Line 354 | Line 362 | badopt:
362  
363  
364   void
365 < wputs(s)                                /* warning output function */
366 < char    *s;
365 > wputs(                          /* warning output function */
366 >        char    *s
367 > )
368   {
369          int  lasterrno = errno;
370          eputs(s);
# Line 364 | Line 373 | char   *s;
373  
374  
375   void
376 < eputs(s)                                /* put string to stderr */
377 < register char  *s;
376 > eputs(                          /* put string to stderr */
377 >        register char  *s
378 > )
379   {
380          static int  midline = 0;
381  
# Line 383 | Line 393 | register char  *s;
393   }
394  
395  
396 < void
397 < onsig(signo)                            /* fatal signal */
398 < int  signo;
396 > static void
397 > onsig(                          /* fatal signal */
398 >        int  signo
399 > )
400   {
401          static int  gotsig = 0;
402  
403          if (gotsig++)                   /* two signals and we're gone! */
404                  _exit(signo);
405  
406 + #ifdef SIGALRM /* XXX how critical is this? */
407          alarm(15);                      /* allow 15 seconds to clean up */
408          signal(SIGALRM, SIG_DFL);       /* make certain we do die */
409 + #endif
410          eputs("signal - ");
411          eputs(sigerr[signo]);
412          eputs("\n");
# Line 401 | Line 414 | int  signo;
414   }
415  
416  
417 < void
418 < sigdie(signo, msg)                      /* set fatal signal */
419 < int  signo;
420 < char  *msg;
417 > static void
418 > sigdie(                 /* set fatal signal */
419 >        int  signo,
420 >        char  *msg
421 > )
422   {
423          if (signal(signo, onsig) == SIG_IGN)
424                  signal(signo, SIG_IGN);
# Line 412 | Line 426 | char  *msg;
426   }
427  
428  
429 < void
430 < printdefaults()                 /* print default values to stdout */
429 > static void
430 > printdefaults(void)                     /* print default values to stdout */
431   {
418        register char  *cp;
419
432          printf("-vt%c\t\t\t\t# view type %s\n", ourview.type,
433                          ourview.type==VT_PER ? "perspective" :
434                          ourview.type==VT_PAR ? "parallel" :
# Line 441 | Line 453 | printdefaults()                        /* print default values to stdout */
453          printf("-pa %f\t\t\t# pixel aspect ratio\n", pixaspect);
454          printf("-pj %f\t\t\t# pixel jitter\n", dstrpix);
455          printf("-pm %f\t\t\t# pixel motion\n", mblur);
456 +        printf("-pd %f\t\t\t# pixel depth-of-field\n", dblur);
457          printf("-ps %-9d\t\t\t# pixel sample\n", psample);
458          printf("-pt %f\t\t\t# pixel threshold\n", maxdiff);
459          printf("-t  %-9d\t\t\t# time between reports\n", ralrm);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines