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" |
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 */ |
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); |
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; |
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); |
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 |
|
} |
293 |
|
rtargv[rtargc] = NULL; |
294 |
|
/* start rtrace & compute contributions */ |
295 |
|
init(nprocs); |
296 |
< |
tracecontribs(stdin); |
296 |
> |
trace_contribs(stdin); |
297 |
|
quit(0); |
298 |
|
} |
299 |
|
|
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 |
|
{ |
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; |