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

Comparing ray/src/rt/rtmain.c (file contents):
Revision 2.7 by schorsch, Mon Jul 14 20:02:30 2003 UTC vs.
Revision 2.16 by greg, Fri Apr 18 18:06:29 2008 UTC

# Line 7 | Line 7 | static const char      RCSid[] = "$Id$";
7  
8   #include "copyright.h"
9  
10 #include  <sys/types.h>
10   #include  <signal.h>
11  
12   #include  "platform.h"
13   #include  "rtprocess.h" /* getpid() */
14 + #include  "resolu.h"
15   #include  "ray.h"
16   #include  "source.h"
17   #include  "ambient.h"
# Line 26 | Line 26 | static const char      RCSid[] = "$Id$";
26   #endif
27  
28   char  *progname;                        /* argv[0] */
29
29   char  *octname;                         /* octree name */
31
30   char  *sigerr[NSIG];                    /* signal error messages */
33
31   char  *shm_boundary = NULL;             /* boundary of shared memory */
35
32   char  *errfile = NULL;                  /* error output file */
33  
34   extern char  *formstr();                /* string from format */
# Line 49 | Line 45 | extern int  lim_dist;                  /* limit distance? */
45   extern char  *tralist[];                /* list of modifers to trace (or no) */
46   extern int  traincl;                    /* include == 1, exclude == 0 */
47  
48 < void    onsig();
53 < void    sigdie();
54 < void    printdefaults();
48 > static int  loadflags = ~IO_FILES;      /* what to load from octree */
49  
50 + static void onsig(int  signo);
51 + static void sigdie(int  signo, char  *msg);
52 + static void printdefaults(void);
53  
54 +
55   int
56 < main(argc, argv)
59 < int  argc;
60 < char  *argv[];
56 > main(int  argc, char  *argv[])
57   {
58   #define  check(ol,al)           if (argv[i][ol] || \
59                                  badarg(argc-i-1,argv+i+1,al)) \
# Line 69 | Line 65 | char  *argv[];
65                                  case 'n': case 'N': case 'f': case 'F': \
66                                  case '-': case '0': var = 0; break; \
67                                  default: goto badopt; }
72        int  loadflags = ~IO_FILES;
68          int  persist = 0;
69          char  **tralp;
70          int  duped1;
# Line 232 | Line 227 | char  *argv[];
227                                          /* initialize object types */
228          initotypes();
229                                          /* initialize urand */
230 <        initurand(2048);
230 >        if (rand_samp) {
231 >                srandom((long)time(0));
232 >                initurand(0);
233 >        } else {
234 >                srandom(0L);
235 >                initurand(2048);
236 >        }
237                                          /* set up signal handling */
238          sigdie(SIGINT, "Interrupt");
239   #ifdef SIGHUP
# Line 278 | Line 279 | char  *argv[];
279                  openheader();
280          }
281   #endif
281 #ifdef  _WIN32
282          if (outform != 'a')
283                  SET_FILE_BINARY(stdout);
284        if (octname == NULL)
285                SET_FILE_BINARY(stdin);
286 #endif
284          readoct(octname, loadflags, &thescene, NULL);
285          nsceneobjs = nobjects;
286  
# Line 312 | Line 309 | char  *argv[];
309                          while ((rval=fork()) == 0) {    /* keep on forkin' */
310                                  pflock(1);
311                                  pfhold();
312 +                                ambsync();              /* load new values */
313                          }
314                          if (rval < 0)
315                                  error(SYSTEM, "cannot fork child for persist function");
316 <                        pfdetach();             /* parent exits */
316 >                        pfdetach();             /* parent will run then exit */
317                  }
318          }
319   runagain:
# Line 349 | Line 347 | runagain:
347   badopt:
348          sprintf(errmsg, "command line error at '%s'", argv[i]);
349          error(USER, errmsg);
350 +        return 1; /* pro forma return */
351  
352   #undef  check
353   #undef  bool
# Line 356 | Line 355 | badopt:
355  
356  
357   void
358 < wputs(s)                                /* warning output function */
359 < char    *s;
358 > wputs(                          /* warning output function */
359 >        char    *s
360 > )
361   {
362          int  lasterrno = errno;
363          eputs(s);
# Line 366 | Line 366 | char   *s;
366  
367  
368   void
369 < eputs(s)                                /* put string to stderr */
370 < register char  *s;
369 > eputs(                          /* put string to stderr */
370 >        register char  *s
371 > )
372   {
373          static int  midline = 0;
374  
# Line 385 | Line 386 | register char  *s;
386   }
387  
388  
389 < void
390 < onsig(signo)                            /* fatal signal */
391 < int  signo;
389 > static void
390 > onsig(                          /* fatal signal */
391 >        int  signo
392 > )
393   {
394          static int  gotsig = 0;
395  
# Line 405 | Line 407 | int  signo;
407   }
408  
409  
410 < void
411 < sigdie(signo, msg)                      /* set fatal signal */
412 < int  signo;
413 < char  *msg;
410 > static void
411 > sigdie(                 /* set fatal signal */
412 >        int  signo,
413 >        char  *msg
414 > )
415   {
416          if (signal(signo, onsig) == SIG_IGN)
417                  signal(signo, SIG_IGN);
# Line 416 | Line 419 | char  *msg;
419   }
420  
421  
422 < void
423 < printdefaults()                 /* print default values to stdout */
422 > static void
423 > printdefaults(void)                     /* print default values to stdout */
424   {
425          register char  *cp;
426  
427          if (imm_irrad)
428                  printf("-I+\t\t\t\t# immediate irradiance on\n");
429 <        printf("-x  %-9d\t\t\t# x resolution\n", hresolu);
430 <        printf("-y  %-9d\t\t\t# y resolution\n", vresolu);
429 >        printf("-x %-9d\t\t\t# x resolution (flush interval)\n", hresolu);
430 >        printf("-y %-9d\t\t\t# y resolution\n", vresolu);
431          printf(lim_dist ? "-ld+\t\t\t\t# limit distance on\n" :
432                          "-ld-\t\t\t\t# limit distance off\n");
433 +        printf("-h%c\t\t\t\t# %s header\n", loadflags & IO_INFO ? '+' : '-',
434 +                        loadflags & IO_INFO ? "output" : "no");
435          printf("-f%c%c\t\t\t\t# format input/output = %s/%s\n",
436                          inform, outform, formstr(inform), formstr(outform));
437 <        printf("-o%s\t\t\t\t# output", outvals);
437 >        printf("-o%-9s\t\t\t# output", outvals);
438          for (cp = outvals; *cp; cp++)
439                  switch (*cp) {
440 <                case 't': printf(" trace"); break;
440 >                case 't': case 'T': printf(" trace"); break;
441                  case 'o': printf(" origin"); break;
442                  case 'd': printf(" direction"); break;
443                  case 'v': printf(" value"); break;
444 +                case 'V': printf(" contribution"); break;
445                  case 'l': printf(" length"); break;
446                  case 'L': printf(" first_length"); break;
447                  case 'p': printf(" point"); break;
# Line 443 | Line 449 | printdefaults()                        /* print default values to stdout */
449                  case 'N': printf(" unperturbed_normal"); break;
450                  case 's': printf(" surface"); break;
451                  case 'w': printf(" weight"); break;
452 +                case 'W': printf(" coefficient"); break;
453                  case 'm': printf(" modifier"); break;
454 +                case 'M': printf(" material"); break;
455 +                case '-': printf(" stroke"); break;
456                  }
457          putchar('\n');
458          printf(erract[WARNING].pf != NULL ?

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines