15 |
|
|
16 |
|
#include "copyright.h" |
17 |
|
|
18 |
< |
#include "standard.h" |
18 |
> |
#include <stdio.h> |
19 |
|
#include <ctype.h> |
20 |
|
#include <sys/stat.h> |
21 |
+ |
#include <time.h> |
22 |
+ |
#include <signal.h> |
23 |
+ |
|
24 |
+ |
#include "platform.h" |
25 |
+ |
#include "paths.h" |
26 |
+ |
#include "standard.h" |
27 |
|
#include "view.h" |
28 |
|
#include "vars.h" |
29 |
|
#include "netproc.h" |
32 |
|
#define DEF_NBLUR 5 |
33 |
|
#endif |
34 |
|
/* default remote shell */ |
29 |
– |
#ifdef _AUX_SOURCE |
30 |
– |
#define REMSH "remsh" |
31 |
– |
#else |
35 |
|
#define REMSH "rsh" |
33 |
– |
#endif |
36 |
|
/* input variables (alphabetical by name) */ |
37 |
|
#define ANIMATE 0 /* animation command */ |
38 |
|
#define ARCHIVE 1 /* archiving command */ |
39 |
|
#define BASENAME 2 /* output image base name */ |
40 |
< |
#define DIRECTORY 3 /* working (sub)directory */ |
41 |
< |
#define DISKSPACE 4 /* how much disk space to use */ |
42 |
< |
#define END 5 /* ending frame number */ |
43 |
< |
#define EXPOSURE 6 /* how to compute exposure */ |
44 |
< |
#define HOST 7 /* rendering host machine */ |
45 |
< |
#define INTERP 8 /* # frames to interpolate */ |
46 |
< |
#define MBLUR 9 /* motion blur parameters */ |
47 |
< |
#define NEXTANIM 10 /* next animation file */ |
48 |
< |
#define OCTREE 11 /* octree file name */ |
49 |
< |
#define OVERSAMP 12 /* # times to oversample image */ |
50 |
< |
#define PFILT 13 /* pfilt options */ |
51 |
< |
#define PINTERP 14 /* pinterp options */ |
52 |
< |
#define RENDER 15 /* rendering options */ |
53 |
< |
#define RESOLUTION 16 /* desired final resolution */ |
54 |
< |
#define RIF 17 /* rad input file */ |
55 |
< |
#define RSH 18 /* remote shell script or program */ |
56 |
< |
#define RTRACE 19 /* use rtrace with pinterp? */ |
57 |
< |
#define START 20 /* starting frame number */ |
58 |
< |
#define TRANSFER 21 /* frame transfer command */ |
59 |
< |
#define VIEWFILE 22 /* animation frame views */ |
40 |
> |
#define DBLUR 3 /* depth of field blur */ |
41 |
> |
#define DIRECTORY 4 /* working (sub)directory */ |
42 |
> |
#define DISKSPACE 5 /* how much disk space to use */ |
43 |
> |
#define END 6 /* ending frame number */ |
44 |
> |
#define EXPOSURE 7 /* how to compute exposure */ |
45 |
> |
#define HOST 8 /* rendering host machine */ |
46 |
> |
#define INTERP 9 /* # frames to interpolate */ |
47 |
> |
#define MBLUR 10 /* motion blur parameters */ |
48 |
> |
#define NEXTANIM 11 /* next animation file */ |
49 |
> |
#define OCTREE 12 /* octree file name */ |
50 |
> |
#define OVERSAMP 13 /* # times to oversample image */ |
51 |
> |
#define PFILT 14 /* pfilt options */ |
52 |
> |
#define PINTERP 15 /* pinterp options */ |
53 |
> |
#define RENDER 16 /* rendering options */ |
54 |
> |
#define RESOLUTION 17 /* desired final resolution */ |
55 |
> |
#define RIF 18 /* rad input file */ |
56 |
> |
#define RSH 19 /* remote shell script or program */ |
57 |
> |
#define RTRACE 20 /* use rtrace with pinterp? */ |
58 |
> |
#define START 21 /* starting frame number */ |
59 |
> |
#define TRANSFER 22 /* frame transfer command */ |
60 |
> |
#define VIEWFILE 23 /* animation frame views */ |
61 |
|
|
62 |
< |
int NVARS = 23; /* total number of variables */ |
62 |
> |
int NVARS = 24; /* total number of variables */ |
63 |
|
|
64 |
|
VARIABLE vv[] = { /* variable-value pairs */ |
65 |
|
{"ANIMATE", 2, 0, NULL, onevalue}, |
66 |
|
{"ARCHIVE", 2, 0, NULL, onevalue}, |
67 |
|
{"BASENAME", 3, 0, NULL, onevalue}, |
68 |
+ |
{"DBLUR", 2, 0, NULL, onevalue}, |
69 |
|
{"DIRECTORY", 3, 0, NULL, onevalue}, |
70 |
|
{"DISKSPACE", 3, 0, NULL, fltvalue}, |
71 |
|
{"END", 2, 0, NULL, intvalue}, |
123 |
|
int npslots; /* number of process slots */ |
124 |
|
|
125 |
|
#define phostname(ps) ((ps)->hostname[0] ? (ps)->hostname : astat.host) |
122 |
– |
|
123 |
– |
struct pslot *findpslot(); |
124 |
– |
|
126 |
|
PSERVER *lastpserver; /* last process server with error */ |
127 |
|
|
128 |
< |
VIEW *getview(); |
129 |
< |
char *getexp(), *dirfile(); |
130 |
< |
int getblur(); |
128 |
> |
static struct pslot * findpslot(int pid); |
129 |
> |
static void checkdir(void); |
130 |
> |
static VIEW * getview(int n); |
131 |
|
|
132 |
< |
extern time_t time(); |
132 |
> |
static char * dirfile(char *df, register char *path); |
133 |
> |
static char * getexp(int n); |
134 |
> |
static int getblur(double *mbf, double *dbf); |
135 |
> |
static int getastat(void); |
136 |
> |
static void getradfile(char *rfargs); |
137 |
> |
static void badvalue(int vc); |
138 |
> |
static int rmfile(char *fn); |
139 |
> |
static int runcom(char *cs); |
140 |
> |
static int pruncom(char *com, char *ppins, int maxcopies); |
141 |
> |
static void bwait(int ncoms); |
142 |
> |
static int bruncom(char *com, int fout, int (*rf)()); |
143 |
> |
static int serverdown(void); |
144 |
> |
static pscompfunc donecom; |
145 |
> |
static int countviews(void); |
146 |
> |
static int dofilt(int frame, int rvr); |
147 |
> |
static void archive(void); |
148 |
> |
static int frecover(int frame); |
149 |
> |
static int recover(int frame); |
150 |
> |
static void sethosts(void); |
151 |
> |
static void walkwait(int first, int last, char *vfn); |
152 |
> |
static void animrend(int frame, VIEW *vp); |
153 |
> |
static void transferframes(void); |
154 |
> |
static void filterframes(void); |
155 |
> |
static void renderframes(int nframes); |
156 |
> |
static void animate(void); |
157 |
> |
static void setdefaults(void); |
158 |
> |
static void putastat(void); |
159 |
|
|
160 |
|
|
161 |
< |
main(argc, argv) |
162 |
< |
int argc; |
163 |
< |
char *argv[]; |
161 |
> |
int |
162 |
> |
main( |
163 |
> |
int argc, |
164 |
> |
char *argv[] |
165 |
> |
) |
166 |
|
{ |
167 |
|
int explicate = 0; |
168 |
|
int i; |
225 |
|
quit(1); |
226 |
|
} |
227 |
|
quit(0); |
228 |
+ |
return 0; /* pro forma return */ |
229 |
|
userr: |
230 |
|
fprintf(stderr, "Usage: %s [-s][-n][-w][-e] anim_file\n", progname); |
231 |
|
quit(1); |
232 |
+ |
return 1; /* pro forma return */ |
233 |
|
} |
234 |
|
|
235 |
|
|
236 |
< |
getastat() /* check/set animation status */ |
236 |
> |
static int |
237 |
> |
getastat(void) /* check/set animation status */ |
238 |
|
{ |
239 |
|
char sfname[256]; |
240 |
|
FILE *fp; |
298 |
|
} |
299 |
|
|
300 |
|
|
301 |
< |
putastat() /* put out current status */ |
301 |
> |
static void |
302 |
> |
putastat(void) /* put out current status */ |
303 |
|
{ |
304 |
|
char buf[256]; |
305 |
|
FILE *fp; |
321 |
|
} |
322 |
|
|
323 |
|
|
324 |
< |
checkdir() /* make sure we have our directory */ |
324 |
> |
static void |
325 |
> |
checkdir(void) /* make sure we have our directory */ |
326 |
|
{ |
327 |
|
struct stat stb; |
328 |
|
|
344 |
|
} |
345 |
|
|
346 |
|
|
347 |
< |
setdefaults() /* set default values */ |
347 |
> |
static void |
348 |
> |
setdefaults(void) /* set default values */ |
349 |
|
{ |
350 |
|
extern char *atos(); |
351 |
|
int decades; |
433 |
|
} |
434 |
|
|
435 |
|
|
436 |
< |
sethosts() /* set up process servers */ |
436 |
> |
static void |
437 |
> |
sethosts(void) /* set up process servers */ |
438 |
|
{ |
439 |
|
extern char *iskip(); |
440 |
|
char buf[256], *dir, *uname; |
489 |
|
} |
490 |
|
} |
491 |
|
|
492 |
< |
|
493 |
< |
getradfile(rfargs) /* run rad and get needed variables */ |
458 |
< |
char *rfargs; |
492 |
> |
static void |
493 |
> |
getradfile(char *rfargs) /* run rad and get needed variables */ |
494 |
|
{ |
495 |
|
static short mvar[] = {OCTREE,PFILT,RESOLUTION,EXPOSURE,-1}; |
496 |
|
char combuf[256]; |
497 |
|
register int i; |
498 |
|
register char *cp; |
499 |
< |
char *pippt; |
499 |
> |
char *pippt = NULL; |
500 |
|
/* create rad command */ |
501 |
|
sprintf(rendopt, " @%s/render.opt", vval(DIRECTORY)); |
502 |
|
sprintf(combuf, |
515 |
|
pippt = NULL; |
516 |
|
} |
517 |
|
if (pippt != NULL) |
518 |
< |
strcpy(pippt, "> /dev/null"); /* nothing to match */ |
518 |
> |
strcpy(pippt, "> " NULL_DEVICE); /* nothing to match */ |
519 |
|
else { |
520 |
|
sprintf(cp, ")[ \t]*=' > %s/radset.var", vval(DIRECTORY)); |
521 |
|
cp += 11; /* point to file name */ |
528 |
|
} |
529 |
|
|
530 |
|
|
531 |
< |
animate() /* run animation */ |
531 |
> |
static void |
532 |
> |
animate(void) /* run animation */ |
533 |
|
{ |
534 |
|
int xres, yres; |
535 |
|
float pa, mult; |
569 |
|
} |
570 |
|
/* figure # frames per batch */ |
571 |
|
d1 = mult*xres*mult*yres*4; /* space for orig. picture */ |
572 |
< |
if ((i=vint(INTERP)) || getblur(NULL) > 1) |
572 |
> |
if ((i=vint(INTERP)) || getblur(NULL, NULL) > 1) |
573 |
|
d1 += mult*xres*mult*yres*sizeof(float); /* Z-buffer */ |
574 |
|
d2 = xres*yres*4; /* space for final picture */ |
575 |
|
frames_batch = (i+1)*(vflt(DISKSPACE)*1048576.-d1)/(d1+i*d2); |
600 |
|
} |
601 |
|
|
602 |
|
|
603 |
< |
renderframes(nframes) /* render next nframes frames */ |
604 |
< |
int nframes; |
603 |
> |
static void |
604 |
> |
renderframes(int nframes) /* render next nframes frames */ |
605 |
|
{ |
606 |
|
static char vendbuf[16]; |
607 |
|
VIEW *vp; |
657 |
|
} |
658 |
|
|
659 |
|
|
660 |
< |
filterframes() /* catch up with filtering */ |
660 |
> |
static void |
661 |
> |
filterframes(void) /* catch up with filtering */ |
662 |
|
{ |
626 |
– |
VIEW *vp; |
663 |
|
register int i; |
664 |
|
|
665 |
|
if (astat.tnext < astat.fnext) /* other work to do first */ |
666 |
|
return; |
667 |
|
/* filter each view */ |
668 |
< |
for (i = astat.fnext; i < astat.rnext; i++) { |
669 |
< |
if ((vp = getview(i)) == NULL) { /* get view i */ |
670 |
< |
fprintf(stderr, |
635 |
< |
"%s: unexpected error reading view for frame %d\n", |
636 |
< |
progname, i); |
637 |
< |
quit(1); |
638 |
< |
} |
639 |
< |
dofilt(i, vp, getexp(i), 0); /* filter frame */ |
640 |
< |
} |
668 |
> |
for (i = astat.fnext; i < astat.rnext; i++) |
669 |
> |
dofilt(i, 0); |
670 |
> |
|
671 |
|
bwait(0); /* wait for filter processes */ |
672 |
|
archive(); /* archive originals */ |
673 |
|
astat.fnext = i; /* update status */ |
675 |
|
} |
676 |
|
|
677 |
|
|
678 |
< |
transferframes() /* catch up with picture transfers */ |
678 |
> |
static void |
679 |
> |
transferframes(void) /* catch up with picture transfers */ |
680 |
|
{ |
681 |
|
char combuf[10240], *fbase; |
682 |
|
register char *cp; |
716 |
|
} |
717 |
|
|
718 |
|
|
719 |
< |
animrend(frame, vp) /* start animation frame */ |
720 |
< |
int frame; |
721 |
< |
VIEW *vp; |
719 |
> |
static void |
720 |
> |
animrend( /* start animation frame */ |
721 |
> |
int frame, |
722 |
> |
VIEW *vp |
723 |
> |
) |
724 |
|
{ |
692 |
– |
extern int recover(); |
725 |
|
char combuf[2048]; |
726 |
|
char fname[128]; |
727 |
|
|
735 |
|
} |
736 |
|
|
737 |
|
|
738 |
< |
walkwait(first, last, vfn) /* walk-through frames */ |
739 |
< |
int first, last; |
740 |
< |
char *vfn; |
738 |
> |
static void |
739 |
> |
walkwait( /* walk-through frames */ |
740 |
> |
int first, |
741 |
> |
int last, |
742 |
> |
char *vfn |
743 |
> |
) |
744 |
|
{ |
745 |
< |
double blurf; |
746 |
< |
int nblur = getblur(&blurf); |
745 |
> |
double mblurf, dblurf; |
746 |
> |
int nblur = getblur(&mblurf, &dblurf); |
747 |
|
char combuf[2048]; |
748 |
|
register char *inspoint; |
749 |
|
register int i; |
761 |
|
inspoint = combuf; |
762 |
|
while (*inspoint) inspoint++; |
763 |
|
if (nblur) { |
764 |
< |
sprintf(inspoint, " -pm %.3f", blurf/nblur); |
764 |
> |
sprintf(inspoint, " -pm %.3f", mblurf/nblur); |
765 |
|
while (*inspoint) inspoint++; |
766 |
+ |
sprintf(inspoint, " -pd %.3f", dblurf/nblur); |
767 |
+ |
while (*inspoint) inspoint++; |
768 |
|
} |
769 |
|
if (nblur > 1 || vint(INTERP)) { |
770 |
|
sprintf(inspoint, " -z %s.zbf", vval(BASENAME)); |
792 |
|
} |
793 |
|
|
794 |
|
|
795 |
< |
int |
796 |
< |
recover(frame) /* recover the specified frame */ |
760 |
< |
int frame; |
795 |
> |
static int |
796 |
> |
recover(int frame) /* recover the specified frame */ |
797 |
|
{ |
798 |
|
static int *rfrm; /* list of recovered frames */ |
799 |
|
static int nrfrms = 0; |
800 |
< |
double blurf; |
801 |
< |
int nblur = getblur(&blurf); |
800 |
> |
double mblurf, dblurf; |
801 |
> |
int nblur = getblur(&mblurf, &dblurf); |
802 |
|
char combuf[2048]; |
803 |
|
char fname[128]; |
804 |
|
register char *cp; |
817 |
|
cp = combuf; |
818 |
|
while (*cp) cp++; |
819 |
|
if (nblur) { |
820 |
< |
sprintf(cp, " -pm %.3f", blurf/nblur); |
820 |
> |
sprintf(cp, " -pm %.3f", mblurf/nblur); |
821 |
|
while (*cp) cp++; |
822 |
+ |
sprintf(cp, " -pd %.3f", dblurf/nblur); |
823 |
+ |
while (*cp) cp++; |
824 |
|
} |
825 |
|
if (nblur > 1 || vint(INTERP)) { |
826 |
|
sprintf(cp, " -z %s.zbf", fname); |
848 |
|
} |
849 |
|
|
850 |
|
|
851 |
< |
int |
852 |
< |
frecover(frame) /* recover filtered frame */ |
815 |
< |
int frame; |
851 |
> |
static int |
852 |
> |
frecover(int frame) /* recover filtered frame */ |
853 |
|
{ |
854 |
< |
VIEW *vp; |
818 |
< |
char *ex; |
819 |
< |
|
820 |
< |
vp = getview(frame); |
821 |
< |
ex = getexp(frame); |
822 |
< |
if (dofilt(frame, vp, ex, 2) && dofilt(frame, vp, ex, 1)) |
854 |
> |
if (dofilt(frame, 2) && dofilt(frame, 1)) |
855 |
|
return(1); |
856 |
|
return(0); |
857 |
|
} |
858 |
|
|
859 |
|
|
860 |
< |
archive() /* archive and remove renderings */ |
860 |
> |
static void |
861 |
> |
archive(void) /* archive and remove renderings */ |
862 |
|
{ |
863 |
|
#define RMCOML (sizeof(rmcom)-1) |
864 |
|
static char rmcom[] = "rm -f"; |
901 |
|
} |
902 |
|
|
903 |
|
|
904 |
< |
int |
905 |
< |
dofilt(frame, vp, ep, rvr) /* filter frame */ |
906 |
< |
int frame; |
907 |
< |
VIEW *vp; |
908 |
< |
char *ep; |
876 |
< |
int rvr; |
904 |
> |
static int |
905 |
> |
dofilt( /* filter frame */ |
906 |
> |
int frame, |
907 |
> |
int rvr |
908 |
> |
) |
909 |
|
{ |
878 |
– |
extern int frecover(); |
910 |
|
static int iter = 0; |
911 |
< |
double blurf; |
912 |
< |
int nblur = getblur(&blurf); |
911 |
> |
double mblurf, dblurf; |
912 |
> |
int nblur = getblur(&mblurf, &dblurf); |
913 |
> |
VIEW *vp = getview(frame); |
914 |
> |
char *ep = getexp(frame); |
915 |
|
char fnbefore[128], fnafter[128], *fbase; |
916 |
|
char combuf[1024], fname0[128], fname1[128]; |
917 |
|
int usepinterp, usepfilt, nora_rgbe; |
918 |
|
int frseq[2]; |
919 |
|
/* check what is needed */ |
920 |
+ |
if (vp == NULL) { |
921 |
+ |
fprintf(stderr, |
922 |
+ |
"%s: unexpected error reading view for frame %d\n", |
923 |
+ |
progname, frame); |
924 |
+ |
quit(1); |
925 |
+ |
} |
926 |
|
usepinterp = (nblur > 1); |
927 |
< |
usepfilt = pfiltalways | ep==NULL; |
927 |
> |
usepfilt = pfiltalways | (ep==NULL); |
928 |
|
if (ep != NULL && !strcmp(ep, "1")) |
929 |
|
ep = "+0"; |
930 |
|
nora_rgbe = strcmp(vval(OVERSAMP),"1") || ep==NULL || |
968 |
|
if (usepinterp) { /* using pinterp */ |
969 |
|
if (rvr == 2 && recover(frseq[1])) /* recover after? */ |
970 |
|
return(1); |
971 |
< |
if (nblur > 1) { /* with pmblur */ |
971 |
> |
if (nblur > 1) { /* with pdmblur */ |
972 |
|
sprintf(fname0, "%s/vw0%c", vval(DIRECTORY), |
973 |
|
'a'+(iter%26)); |
974 |
|
sprintf(fname1, "%s/vw1%c", vval(DIRECTORY), |
995 |
|
putc('\n', fp); fclose(fp); |
996 |
|
} |
997 |
|
sprintf(combuf, |
998 |
< |
"(pmblur %.3f %d %s %s; rm -f %s %s) | pinterp -B -a", |
999 |
< |
blurf, nblur, |
998 |
> |
"(pmdblur %.3f %.3f %d %s %s; rm -f %s %s) | pinterp -B -a", |
999 |
> |
mblurf, dblurf, nblur, |
1000 |
|
fname0, fname1, fname0, fname1); |
1001 |
|
iter++; |
1002 |
|
} else /* no blurring */ |
1010 |
|
if (usepfilt) |
1011 |
|
sprintf(combuf+strlen(combuf), " %s", rresopt); |
1012 |
|
else |
1013 |
< |
sprintf(combuf+strlen(combuf), "-a %s -e %s", |
1013 |
> |
sprintf(combuf+strlen(combuf), " -a %s -e %s", |
1014 |
|
fresopt, ep); |
1015 |
|
sprintf(combuf+strlen(combuf), " %s.unf %s.zbf", |
1016 |
|
fnbefore, fnbefore); |
1057 |
|
} |
1058 |
|
|
1059 |
|
|
1060 |
< |
VIEW * |
1061 |
< |
getview(n) /* get view number n */ |
1023 |
< |
int n; |
1060 |
> |
static VIEW * |
1061 |
> |
getview(int n) /* get view number n */ |
1062 |
|
{ |
1063 |
|
static FILE *viewfp = NULL; /* view file pointer */ |
1064 |
|
static int viewnum = 0; /* current view number */ |
1070 |
|
fclose(viewfp); |
1071 |
|
viewfp = NULL; |
1072 |
|
viewnum = 0; |
1073 |
< |
copystruct(&curview, &stdview); |
1073 |
> |
curview = stdview; |
1074 |
|
} |
1075 |
|
return(NULL); |
1076 |
|
} |
1086 |
|
perror(vval(VIEWFILE)); |
1087 |
|
quit(1); |
1088 |
|
} |
1089 |
< |
copystruct(&curview, &stdview); |
1089 |
> |
curview = stdview; |
1090 |
|
viewnum = 0; |
1091 |
|
} |
1092 |
|
if (n < 0) { /* get next view */ |
1106 |
|
} |
1107 |
|
|
1108 |
|
|
1109 |
< |
int |
1110 |
< |
countviews() /* count views in view file */ |
1109 |
> |
static int |
1110 |
> |
countviews(void) /* count views in view file */ |
1111 |
|
{ |
1112 |
|
int n; |
1113 |
|
|
1119 |
|
} |
1120 |
|
|
1121 |
|
|
1122 |
< |
char * |
1123 |
< |
getexp(n) /* get exposure for nth frame */ |
1086 |
< |
int n; |
1122 |
> |
static char * |
1123 |
> |
getexp(int n) /* get exposure for nth frame */ |
1124 |
|
{ |
1125 |
|
extern char *fskip(); |
1126 |
|
static char expval[32]; |
1189 |
|
} |
1190 |
|
|
1191 |
|
|
1192 |
< |
struct pslot * |
1193 |
< |
findpslot(pid) /* find or allocate a process slot */ |
1157 |
< |
int pid; |
1192 |
> |
static struct pslot * |
1193 |
> |
findpslot(int pid) /* find or allocate a process slot */ |
1194 |
|
{ |
1195 |
|
register struct pslot *psempty = NULL; |
1196 |
|
register int i; |
1205 |
|
} |
1206 |
|
|
1207 |
|
|
1208 |
< |
int |
1209 |
< |
donecom(ps, pn, status) /* clean up after finished process */ |
1210 |
< |
PSERVER *ps; |
1211 |
< |
int pn; |
1212 |
< |
int status; |
1208 |
> |
static int |
1209 |
> |
donecom( /* clean up after finished process */ |
1210 |
> |
PSERVER *ps, |
1211 |
> |
int pn, |
1212 |
> |
int status |
1213 |
> |
) |
1214 |
|
{ |
1215 |
< |
register PROC *pp; |
1215 |
> |
register NETPROC *pp; |
1216 |
|
register struct pslot *psl; |
1217 |
|
|
1218 |
|
pp = ps->proc + pn; |
1247 |
|
} |
1248 |
|
|
1249 |
|
|
1250 |
< |
int |
1251 |
< |
serverdown() /* check status of last process server */ |
1250 |
> |
static int |
1251 |
> |
serverdown(void) /* check status of last process server */ |
1252 |
|
{ |
1253 |
|
if (lastpserver == NULL || !lastpserver->hostname[0]) |
1254 |
|
return(0); |
1264 |
|
} |
1265 |
|
|
1266 |
|
|
1267 |
< |
int |
1268 |
< |
bruncom(com, fout, rf) /* run a command in the background */ |
1269 |
< |
char *com; |
1270 |
< |
int fout; |
1271 |
< |
int (*rf)(); |
1267 |
> |
static int |
1268 |
> |
bruncom( /* run a command in the background */ |
1269 |
> |
char *com, |
1270 |
> |
int fout, |
1271 |
> |
int (*rf)() |
1272 |
> |
) |
1273 |
|
{ |
1274 |
|
int pid; |
1275 |
|
register struct pslot *psl; |
1298 |
|
} |
1299 |
|
|
1300 |
|
|
1301 |
< |
bwait(ncoms) /* wait for batch job(s) to finish */ |
1302 |
< |
int ncoms; |
1301 |
> |
static void |
1302 |
> |
bwait(int ncoms) /* wait for batch job(s) to finish */ |
1303 |
|
{ |
1304 |
|
int status; |
1305 |
|
|
1313 |
|
} |
1314 |
|
|
1315 |
|
|
1316 |
< |
int |
1317 |
< |
pruncom(com, ppins, maxcopies) /* run a command in parallel over network */ |
1318 |
< |
char *com, *ppins; |
1319 |
< |
int maxcopies; |
1316 |
> |
static int |
1317 |
> |
pruncom( /* run a command in parallel over network */ |
1318 |
> |
char *com, |
1319 |
> |
char *ppins, |
1320 |
> |
int maxcopies |
1321 |
> |
) |
1322 |
|
{ |
1323 |
|
int retstatus = 0; |
1324 |
|
int hostcopies; |
1340 |
|
strcpy(com1=buf, com); /* build -PP command */ |
1341 |
|
sprintf(com1+(ppins-com), " -PP %s/%s.persist", |
1342 |
|
vval(DIRECTORY), phostname(ps)); |
1343 |
+ |
unlink(com1+(ppins-com)+5); |
1344 |
|
strcat(com1, ppins); |
1345 |
|
} else |
1346 |
|
com1 = com; |
1385 |
|
} |
1386 |
|
|
1387 |
|
|
1388 |
< |
runcom(cs) /* run a command locally and wait for it */ |
1389 |
< |
char *cs; |
1388 |
> |
static int |
1389 |
> |
runcom(char *cs) /* run a command locally and wait for it */ |
1390 |
|
{ |
1391 |
|
if (!silent) /* echo it */ |
1392 |
|
printf("\t%s\n", cs); |
1397 |
|
} |
1398 |
|
|
1399 |
|
|
1400 |
< |
rmfile(fn) /* remove a file */ |
1401 |
< |
char *fn; |
1400 |
> |
static int |
1401 |
> |
rmfile(char *fn) /* remove a file */ |
1402 |
|
{ |
1403 |
|
if (!silent) |
1404 |
< |
#ifdef MSDOS |
1404 |
> |
#ifdef _WIN32 |
1405 |
|
printf("\tdel %s\n", fn); |
1406 |
|
#else |
1407 |
|
printf("\trm -f %s\n", fn); |
1412 |
|
} |
1413 |
|
|
1414 |
|
|
1415 |
< |
badvalue(vc) /* report bad variable value and exit */ |
1416 |
< |
int vc; |
1415 |
> |
static void |
1416 |
> |
badvalue(int vc) /* report bad variable value and exit */ |
1417 |
|
{ |
1418 |
|
fprintf(stderr, "%s: bad value for variable '%s'\n", |
1419 |
|
progname, vnam(vc)); |
1421 |
|
} |
1422 |
|
|
1423 |
|
|
1424 |
< |
char * |
1425 |
< |
dirfile(df, path) /* separate path into directory and file */ |
1426 |
< |
char *df; |
1427 |
< |
register char *path; |
1424 |
> |
static char * |
1425 |
> |
dirfile( /* separate path into directory and file */ |
1426 |
> |
char *df, |
1427 |
> |
register char *path |
1428 |
> |
) |
1429 |
|
{ |
1430 |
|
register int i; |
1431 |
|
int psep; |
1433 |
|
for (i = 0, psep = -1; path[i]; i++) |
1434 |
|
if (path[i] == '/') |
1435 |
|
psep = i; |
1436 |
< |
if (df != NULL) |
1436 |
> |
if (df != NULL) { |
1437 |
|
if (psep == 0) { |
1438 |
|
df[0] = '/'; |
1439 |
|
df[1] = '\0'; |
1442 |
|
df[psep] = '\0'; |
1443 |
|
} else |
1444 |
|
df[0] = '\0'; |
1445 |
+ |
} |
1446 |
|
return(path+psep+1); |
1447 |
|
} |
1448 |
|
|
1449 |
|
|
1450 |
< |
int |
1451 |
< |
getblur(double *bf) /* get # blur samples (and fraction) */ |
1450 |
> |
static int |
1451 |
> |
getblur(double *mbf, double *dbf) /* get # blur samples (and fraction) */ |
1452 |
|
{ |
1453 |
< |
double blurf; |
1454 |
< |
int nblur; |
1453 |
> |
double mblurf, dblurf; |
1454 |
> |
int nmblur, ndblur; |
1455 |
|
char *s; |
1456 |
< |
|
1457 |
< |
if (!vdef(MBLUR)) { |
1458 |
< |
if (bf != NULL) |
1459 |
< |
*bf = 0.0; |
1460 |
< |
return(0); |
1461 |
< |
} |
1462 |
< |
blurf = atof(vval(MBLUR)); |
1463 |
< |
if (blurf < 0.0) |
1464 |
< |
blurf = 0.0; |
1465 |
< |
if (bf != NULL) |
1466 |
< |
*bf = blurf; |
1467 |
< |
if (blurf <= FTINY) |
1468 |
< |
return(0); |
1469 |
< |
s = sskip(vval(MBLUR)); |
1470 |
< |
if (!*s) |
1471 |
< |
return(DEF_NBLUR); |
1472 |
< |
nblur = atoi(s); |
1473 |
< |
if (nblur <= 0) |
1456 |
> |
/* get motion blur */ |
1457 |
> |
if (!vdef(MBLUR) || (mblurf = atof(vval(MBLUR))) < 0.0) |
1458 |
> |
mblurf = 0.0; |
1459 |
> |
if (mbf != NULL) |
1460 |
> |
*mbf = mblurf; |
1461 |
> |
if (mblurf <= FTINY) |
1462 |
> |
nmblur = 0; |
1463 |
> |
else if (!*(s = sskip(vval(MBLUR)))) |
1464 |
> |
nmblur = DEF_NBLUR; |
1465 |
> |
else if ((nmblur = atoi(s)) <= 0) |
1466 |
> |
nmblur = 1; |
1467 |
> |
/* get depth-of-field blur */ |
1468 |
> |
if (!vdef(DBLUR) || (dblurf = atof(vval(DBLUR))) < 0.0) |
1469 |
> |
dblurf = 0.0; |
1470 |
> |
if (dbf != NULL) |
1471 |
> |
*dbf = dblurf; |
1472 |
> |
if (dblurf <= FTINY) |
1473 |
> |
ndblur = 0; |
1474 |
> |
else if (!*(s = sskip(vval(DBLUR)))) |
1475 |
> |
ndblur = DEF_NBLUR; |
1476 |
> |
else if ((ndblur = atoi(s)) <= 0) |
1477 |
> |
ndblur = 1; |
1478 |
> |
if ((nmblur == 1) & (ndblur == 1)) |
1479 |
|
return(1); |
1480 |
< |
return(nblur); |
1480 |
> |
/* return combined samples */ |
1481 |
> |
return(nmblur + ndblur); |
1482 |
|
} |