15 |
|
|
16 |
|
#include "copyright.h" |
17 |
|
|
18 |
+ |
#include <stdio.h> |
19 |
|
#include <ctype.h> |
20 |
|
#include <sys/stat.h> |
21 |
+ |
#include <time.h> |
22 |
+ |
#include <signal.h> |
23 |
|
|
24 |
< |
#include "standard.h" |
24 |
> |
#include "platform.h" |
25 |
|
#include "paths.h" |
26 |
+ |
#include "rtio.h" |
27 |
+ |
#include "rterror.h" |
28 |
+ |
#include "rtmisc.h" |
29 |
|
#include "view.h" |
30 |
|
#include "vars.h" |
31 |
|
#include "netproc.h" |
123 |
|
int npslots; /* number of process slots */ |
124 |
|
|
125 |
|
#define phostname(ps) ((ps)->hostname[0] ? (ps)->hostname : astat.host) |
120 |
– |
|
121 |
– |
struct pslot *findpslot(); |
122 |
– |
|
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 *bf); |
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 */ |
456 |
< |
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, |
528 |
|
} |
529 |
|
|
530 |
|
|
531 |
< |
animate() /* run animation */ |
531 |
> |
static void |
532 |
> |
animate(void) /* run animation */ |
533 |
|
{ |
534 |
|
int xres, yres; |
535 |
|
float pa, mult; |
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 |
|
{ |
624 |
– |
VIEW *vp; |
663 |
|
register int i; |
664 |
|
|
665 |
|
if (astat.tnext < astat.fnext) /* other work to do first */ |
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 |
|
{ |
684 |
– |
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); |
790 |
|
} |
791 |
|
|
792 |
|
|
793 |
< |
int |
794 |
< |
recover(frame) /* recover the specified frame */ |
752 |
< |
int frame; |
793 |
> |
static int |
794 |
> |
recover(int frame) /* recover the specified frame */ |
795 |
|
{ |
796 |
|
static int *rfrm; /* list of recovered frames */ |
797 |
|
static int nrfrms = 0; |
844 |
|
} |
845 |
|
|
846 |
|
|
847 |
< |
int |
848 |
< |
frecover(frame) /* recover filtered frame */ |
807 |
< |
int frame; |
847 |
> |
static int |
848 |
> |
frecover(int frame) /* recover filtered frame */ |
849 |
|
{ |
850 |
|
if (dofilt(frame, 2) && dofilt(frame, 1)) |
851 |
|
return(1); |
853 |
|
} |
854 |
|
|
855 |
|
|
856 |
< |
archive() /* archive and remove renderings */ |
856 |
> |
static void |
857 |
> |
archive(void) /* archive and remove renderings */ |
858 |
|
{ |
859 |
|
#define RMCOML (sizeof(rmcom)-1) |
860 |
|
static char rmcom[] = "rm -f"; |
897 |
|
} |
898 |
|
|
899 |
|
|
900 |
< |
int |
901 |
< |
dofilt(frame, rvr) /* filter frame */ |
902 |
< |
int frame; |
903 |
< |
int rvr; |
900 |
> |
static int |
901 |
> |
dofilt( /* filter frame */ |
902 |
> |
int frame, |
903 |
> |
int rvr |
904 |
> |
) |
905 |
|
{ |
863 |
– |
extern int frecover(); |
906 |
|
static int iter = 0; |
907 |
|
double blurf; |
908 |
|
int nblur = getblur(&blurf); |
919 |
|
progname, frame); |
920 |
|
quit(1); |
921 |
|
} |
880 |
– |
if (ep == NULL) { |
881 |
– |
fprintf(stderr, |
882 |
– |
"%s: unexpected error reading exposure for frame %d\n", |
883 |
– |
progname, frame); |
884 |
– |
quit(1); |
885 |
– |
} |
922 |
|
usepinterp = (nblur > 1); |
923 |
|
usepfilt = pfiltalways | (ep==NULL); |
924 |
|
if (ep != NULL && !strcmp(ep, "1")) |
1053 |
|
} |
1054 |
|
|
1055 |
|
|
1056 |
< |
VIEW * |
1057 |
< |
getview(n) /* get view number n */ |
1022 |
< |
int n; |
1056 |
> |
static VIEW * |
1057 |
> |
getview(int n) /* get view number n */ |
1058 |
|
{ |
1059 |
|
static FILE *viewfp = NULL; /* view file pointer */ |
1060 |
|
static int viewnum = 0; /* current view number */ |
1102 |
|
} |
1103 |
|
|
1104 |
|
|
1105 |
< |
int |
1106 |
< |
countviews() /* count views in view file */ |
1105 |
> |
static int |
1106 |
> |
countviews(void) /* count views in view file */ |
1107 |
|
{ |
1108 |
|
int n; |
1109 |
|
|
1115 |
|
} |
1116 |
|
|
1117 |
|
|
1118 |
< |
char * |
1119 |
< |
getexp(n) /* get exposure for nth frame */ |
1085 |
< |
int n; |
1118 |
> |
static char * |
1119 |
> |
getexp(int n) /* get exposure for nth frame */ |
1120 |
|
{ |
1121 |
|
extern char *fskip(); |
1122 |
|
static char expval[32]; |
1185 |
|
} |
1186 |
|
|
1187 |
|
|
1188 |
< |
struct pslot * |
1189 |
< |
findpslot(pid) /* find or allocate a process slot */ |
1156 |
< |
int pid; |
1188 |
> |
static struct pslot * |
1189 |
> |
findpslot(int pid) /* find or allocate a process slot */ |
1190 |
|
{ |
1191 |
|
register struct pslot *psempty = NULL; |
1192 |
|
register int i; |
1201 |
|
} |
1202 |
|
|
1203 |
|
|
1204 |
< |
int |
1205 |
< |
donecom(ps, pn, status) /* clean up after finished process */ |
1206 |
< |
PSERVER *ps; |
1207 |
< |
int pn; |
1208 |
< |
int status; |
1204 |
> |
static int |
1205 |
> |
donecom( /* clean up after finished process */ |
1206 |
> |
PSERVER *ps, |
1207 |
> |
int pn, |
1208 |
> |
int status |
1209 |
> |
) |
1210 |
|
{ |
1211 |
< |
register PROC *pp; |
1211 |
> |
register NETPROC *pp; |
1212 |
|
register struct pslot *psl; |
1213 |
|
|
1214 |
|
pp = ps->proc + pn; |
1243 |
|
} |
1244 |
|
|
1245 |
|
|
1246 |
< |
int |
1247 |
< |
serverdown() /* check status of last process server */ |
1246 |
> |
static int |
1247 |
> |
serverdown(void) /* check status of last process server */ |
1248 |
|
{ |
1249 |
|
if (lastpserver == NULL || !lastpserver->hostname[0]) |
1250 |
|
return(0); |
1260 |
|
} |
1261 |
|
|
1262 |
|
|
1263 |
< |
int |
1264 |
< |
bruncom(com, fout, rf) /* run a command in the background */ |
1265 |
< |
char *com; |
1266 |
< |
int fout; |
1267 |
< |
int (*rf)(); |
1263 |
> |
static int |
1264 |
> |
bruncom( /* run a command in the background */ |
1265 |
> |
char *com, |
1266 |
> |
int fout, |
1267 |
> |
int (*rf)() |
1268 |
> |
) |
1269 |
|
{ |
1270 |
|
int pid; |
1271 |
|
register struct pslot *psl; |
1294 |
|
} |
1295 |
|
|
1296 |
|
|
1297 |
< |
bwait(ncoms) /* wait for batch job(s) to finish */ |
1298 |
< |
int ncoms; |
1297 |
> |
static void |
1298 |
> |
bwait(int ncoms) /* wait for batch job(s) to finish */ |
1299 |
|
{ |
1300 |
|
int status; |
1301 |
|
|
1309 |
|
} |
1310 |
|
|
1311 |
|
|
1312 |
< |
int |
1313 |
< |
pruncom(com, ppins, maxcopies) /* run a command in parallel over network */ |
1314 |
< |
char *com, *ppins; |
1315 |
< |
int maxcopies; |
1312 |
> |
static int |
1313 |
> |
pruncom( /* run a command in parallel over network */ |
1314 |
> |
char *com, |
1315 |
> |
char *ppins, |
1316 |
> |
int maxcopies |
1317 |
> |
) |
1318 |
|
{ |
1319 |
|
int retstatus = 0; |
1320 |
|
int hostcopies; |
1381 |
|
} |
1382 |
|
|
1383 |
|
|
1384 |
< |
runcom(cs) /* run a command locally and wait for it */ |
1385 |
< |
char *cs; |
1384 |
> |
static int |
1385 |
> |
runcom(char *cs) /* run a command locally and wait for it */ |
1386 |
|
{ |
1387 |
|
if (!silent) /* echo it */ |
1388 |
|
printf("\t%s\n", cs); |
1393 |
|
} |
1394 |
|
|
1395 |
|
|
1396 |
< |
rmfile(fn) /* remove a file */ |
1397 |
< |
char *fn; |
1396 |
> |
static int |
1397 |
> |
rmfile(char *fn) /* remove a file */ |
1398 |
|
{ |
1399 |
|
if (!silent) |
1400 |
|
#ifdef _WIN32 |
1408 |
|
} |
1409 |
|
|
1410 |
|
|
1411 |
< |
badvalue(vc) /* report bad variable value and exit */ |
1412 |
< |
int vc; |
1411 |
> |
static void |
1412 |
> |
badvalue(int vc) /* report bad variable value and exit */ |
1413 |
|
{ |
1414 |
|
fprintf(stderr, "%s: bad value for variable '%s'\n", |
1415 |
|
progname, vnam(vc)); |
1417 |
|
} |
1418 |
|
|
1419 |
|
|
1420 |
< |
char * |
1421 |
< |
dirfile(df, path) /* separate path into directory and file */ |
1422 |
< |
char *df; |
1423 |
< |
register char *path; |
1420 |
> |
static char * |
1421 |
> |
dirfile( /* separate path into directory and file */ |
1422 |
> |
char *df, |
1423 |
> |
register char *path |
1424 |
> |
) |
1425 |
|
{ |
1426 |
|
register int i; |
1427 |
|
int psep; |
1443 |
|
} |
1444 |
|
|
1445 |
|
|
1446 |
< |
int |
1446 |
> |
static int |
1447 |
|
getblur(double *bf) /* get # blur samples (and fraction) */ |
1448 |
|
{ |
1449 |
|
double blurf; |