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

Comparing ray/src/util/rtcontrib.c (file contents):
Revision 1.4 by greg, Thu May 26 17:53:28 2005 UTC vs.
Revision 1.9 by greg, Wed Jun 1 16:11:01 2005 UTC

# Line 7 | Line 7 | static const char RCSid[] = "$Id$";
7  
8   #include  "standard.h"
9   #include  <ctype.h>
10 + #include  <signal.h>
11   #include  "platform.h"
12   #include  "rtprocess.h"
13   #include  "selcall.h"
# Line 63 | Line 64 | struct rtproc {
64          int             bsiz;           /* ray tree buffer length */
65          char            *buf;           /* ray tree buffer */
66          int             nbr;            /* number of bytes from rtrace */
67 < };                              /* rtrace process */
67 > };                              /* rtrace process buffer */
68  
69                                          /* rtrace command and defaults */
70 < char            *rtargv[256] = { "rtrace", "-dt", "0", "-dj", ".5", "-dr", "3",
71 <                                "-ab", "1", "-ad", "128", };
70 > char            *rtargv[256] = { "rtrace", "-dj", ".5", "-dr", "3",
71 >                                "-ab", "1", "-ad", "128", "-lr", "-10", };
72   int  rtargc = 11;
73                                          /* overriding rtrace options */
74 < char            *myrtopts[] = { "-o~~TmWdp", "-h-",
75 <                                "-x", "1", "-y", "0",
75 <                                "-as", "0", "-aa", "0", NULL };
74 > char            *myrtopts[] = { "-o~~TmWdp", "-h-", "-x", "1", "-y", "0",
75 >                                "-dt", "0", "-as", "0", "-aa", "0", NULL };
76  
77   struct rtproc   rt0;                    /* head of rtrace process list */
78  
79   struct rtproc   *rt_unproc = NULL;      /* unprocessed ray trees */
80  
81   char    persistfn[] = "pfXXXXXX";       /* persist file name */
82 char    fmt[8];                         /* rtrace i/o format */
82  
83   int             gargc;                  /* global argc */
84   char            **gargv;                /* global argv */
# Line 107 | Line 106 | int            nmods = 0;              /* number of modifiers */
106  
107   MODCONT *addmodifier(char *modn, char *outf, char *binv);
108  
110 int done_rprocs(struct rtproc *rtp);
109   void init(int np);
110 < void tracecontribs(FILE *fp);
110 > int done_rprocs(struct rtproc *rtp);
111 > void trace_contribs(FILE *fp);
112   struct rtproc *wait_rproc(void);
113   struct rtproc *get_rproc(void);
114   void queue_raytree(struct rtproc *rtp);
# Line 159 | Line 158 | main(int argc, char *argv[])
158          int     nprocs = 1;
159          char    *curout = NULL;
160          char    *binval = NULL;
161 +        char    fmt[8];
162          int     i, j;
163                                  /* global program name */
164          gargv = argv;
# Line 202 | Line 202 | main(int argc, char *argv[])
202                                  break;
203                          case 'f':               /* file or i/o format */
204                                  if (!argv[i][2]) {
205 +                                        char    *fpath;
206                                          if (i >= argc-1) break;
207 <                                        fcompile(argv[++i]);
207 >                                        fpath = getpath(argv[++i],
208 >                                                        getrlibpath(), R_OK);
209 >                                        if (fpath == NULL) {
210 >                                                sprintf(errmsg,
211 >                                                        "cannot find file '%s'",
212 >                                                                argv[i]);
213 >                                                error(USER, errmsg);
214 >                                        }
215 >                                        fcompile(fpath);
216                                          continue;
217                                  }
218                                  setformat(argv[i]+2);
# Line 269 | Line 278 | main(int argc, char *argv[])
278                  execv(rtpath, rtargv);
279                  perror(rtpath); /* execv() should not return */
280                  exit(1);
281 <        } else if (nprocs > 1) {        /* add persist file if parallel */
281 >        }
282 >        if (nprocs > 1) {       /* add persist file if parallel */
283                  rtargv[rtargc++] = "-PP";
284                  rtargv[rtargc++] = mktemp(persistfn);
285          }
# Line 283 | Line 293 | main(int argc, char *argv[])
293          rtargv[rtargc] = NULL;
294                                  /* start rtrace & compute contributions */
295          init(nprocs);
296 <        tracecontribs(stdin);
296 >        trace_contribs(stdin);
297          quit(0);
298   }
299  
# Line 335 | Line 345 | quit(int status)
345          exit(status);                   /* flushes all output streams */
346   }
347  
348 < /* start rtrace and initialize buffers */
348 > /* start rtrace processes and initialize */
349   void
350   init(int np)
351   {
# Line 842 | Line 852 | get_rproc(void)
852  
853   /* trace ray contributions (main loop) */
854   void
855 < tracecontribs(FILE *fin)
855 > trace_contribs(FILE *fin)
856   {
857          char            inpbuf[128];
858          int             iblen;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines