9 |
|
|
10 |
|
#include <sys/types.h> |
11 |
|
#include <signal.h> |
12 |
– |
#ifdef _WIN32 |
13 |
– |
#include <process.h> /* getpid */ |
14 |
– |
#endif |
12 |
|
|
13 |
|
#include "platform.h" |
14 |
+ |
#include "rtprocess.h" /* getpid() */ |
15 |
|
#include "ray.h" |
16 |
|
#include "source.h" |
17 |
|
#include "ambient.h" |
27 |
|
#endif |
28 |
|
|
29 |
|
char *progname; /* argv[0] */ |
32 |
– |
|
30 |
|
char *octname; /* octree name */ |
34 |
– |
|
31 |
|
char *sigerr[NSIG]; /* signal error messages */ |
36 |
– |
|
32 |
|
char *shm_boundary = NULL; /* boundary of shared memory */ |
38 |
– |
|
33 |
|
char *errfile = NULL; /* error output file */ |
34 |
|
|
35 |
|
extern time_t time(); |
49 |
|
|
50 |
|
extern double mblur; /* motion blur parameter */ |
51 |
|
|
52 |
< |
void onsig(); |
59 |
< |
void sigdie(); |
60 |
< |
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) |
65 |
< |
int argc; |
66 |
< |
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)) \ |
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 |
|
} |
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); |
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 |
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); |
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 |
|
|
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 |
|
|
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); |
426 |
|
} |
427 |
|
|
428 |
|
|
429 |
< |
void |
430 |
< |
printdefaults() /* print default values to stdout */ |
429 |
> |
static void |
430 |
> |
printdefaults(void) /* print default values to stdout */ |
431 |
|
{ |
428 |
– |
register char *cp; |
429 |
– |
|
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" : |
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); |