15 |
|
|
16 |
|
#include "copyright.h" |
17 |
|
|
18 |
+ |
#include <stdio.h> |
19 |
|
#include <ctype.h> |
20 |
|
#include <sys/stat.h> |
21 |
+ |
#include <time.h> |
22 |
|
|
23 |
< |
#include "standard.h" |
23 |
> |
/*#include "standard.h"*/ |
24 |
> |
#include "platform.h" |
25 |
|
#include "paths.h" |
26 |
+ |
#include "rtio.h" |
27 |
+ |
#include "rterror.h" |
28 |
|
#include "view.h" |
29 |
|
#include "vars.h" |
30 |
|
#include "netproc.h" |
122 |
|
int npslots; /* number of process slots */ |
123 |
|
|
124 |
|
#define phostname(ps) ((ps)->hostname[0] ? (ps)->hostname : astat.host) |
120 |
– |
|
121 |
– |
struct pslot *findpslot(); |
122 |
– |
|
125 |
|
PSERVER *lastpserver; /* last process server with error */ |
126 |
|
|
127 |
< |
VIEW *getview(); |
128 |
< |
char *getexp(), *dirfile(); |
129 |
< |
int getblur(); |
127 |
> |
static struct pslot * findpslot(int pid); |
128 |
> |
static void checkdir(void); |
129 |
> |
static VIEW * getview(int n); |
130 |
|
|
131 |
< |
extern time_t time(); |
131 |
> |
static char * dirfile(char *df, register char *path); |
132 |
> |
static char * getexp(int n); |
133 |
> |
static int getblur(double *bf); |
134 |
> |
static int getastat(void); |
135 |
> |
static void getradfile(char *rfargs); |
136 |
> |
static void badvalue(int vc); |
137 |
> |
static int rmfile(char *fn); |
138 |
> |
static int runcom(char *cs); |
139 |
> |
static int pruncom(char *com, char *ppins, int maxcopies); |
140 |
> |
static void bwait(int ncoms); |
141 |
> |
static int bruncom(char *com, int fout, int (*rf)()); |
142 |
> |
static int serverdown(void); |
143 |
> |
static int donecom(PSERVER *ps, int pn, int status); |
144 |
> |
static int countviews(void); |
145 |
> |
static int dofilt(int frame, int rvr); |
146 |
> |
static void archive(void); |
147 |
> |
static int frecover(int frame); |
148 |
> |
static int recover(int frame); |
149 |
> |
static void sethosts(void); |
150 |
> |
static void walkwait(int first, int last, char *vfn); |
151 |
> |
static void animrend(int frame, VIEW *vp); |
152 |
> |
static void transferframes(void); |
153 |
> |
static void filterframes(void); |
154 |
> |
static void renderframes(int nframes); |
155 |
> |
static void animate(void); |
156 |
> |
static void setdefaults(void); |
157 |
> |
static void putastat(void); |
158 |
|
|
159 |
|
|
160 |
|
main(argc, argv) |
228 |
|
} |
229 |
|
|
230 |
|
|
231 |
< |
getastat() /* check/set animation status */ |
231 |
> |
static int |
232 |
> |
getastat(void) /* check/set animation status */ |
233 |
|
{ |
234 |
|
char sfname[256]; |
235 |
|
FILE *fp; |
293 |
|
} |
294 |
|
|
295 |
|
|
296 |
< |
putastat() /* put out current status */ |
296 |
> |
static void |
297 |
> |
putastat(void) /* put out current status */ |
298 |
|
{ |
299 |
|
char buf[256]; |
300 |
|
FILE *fp; |
316 |
|
} |
317 |
|
|
318 |
|
|
319 |
< |
checkdir() /* make sure we have our directory */ |
319 |
> |
static void |
320 |
> |
checkdir(void) /* make sure we have our directory */ |
321 |
|
{ |
322 |
|
struct stat stb; |
323 |
|
|
339 |
|
} |
340 |
|
|
341 |
|
|
342 |
< |
setdefaults() /* set default values */ |
342 |
> |
static void |
343 |
> |
setdefaults(void) /* set default values */ |
344 |
|
{ |
345 |
|
extern char *atos(); |
346 |
|
int decades; |
428 |
|
} |
429 |
|
|
430 |
|
|
431 |
< |
sethosts() /* set up process servers */ |
431 |
> |
static void |
432 |
> |
sethosts(void) /* set up process servers */ |
433 |
|
{ |
434 |
|
extern char *iskip(); |
435 |
|
char buf[256], *dir, *uname; |
484 |
|
} |
485 |
|
} |
486 |
|
|
487 |
< |
|
488 |
< |
getradfile(rfargs) /* run rad and get needed variables */ |
456 |
< |
char *rfargs; |
487 |
> |
static void |
488 |
> |
getradfile(char *rfargs) /* run rad and get needed variables */ |
489 |
|
{ |
490 |
|
static short mvar[] = {OCTREE,PFILT,RESOLUTION,EXPOSURE,-1}; |
491 |
|
char combuf[256]; |
523 |
|
} |
524 |
|
|
525 |
|
|
526 |
< |
animate() /* run animation */ |
526 |
> |
static void |
527 |
> |
animate(void) /* run animation */ |
528 |
|
{ |
529 |
|
int xres, yres; |
530 |
|
float pa, mult; |
595 |
|
} |
596 |
|
|
597 |
|
|
598 |
< |
renderframes(nframes) /* render next nframes frames */ |
599 |
< |
int nframes; |
598 |
> |
static void |
599 |
> |
renderframes(int nframes) /* render next nframes frames */ |
600 |
|
{ |
601 |
|
static char vendbuf[16]; |
602 |
|
VIEW *vp; |
652 |
|
} |
653 |
|
|
654 |
|
|
655 |
< |
filterframes() /* catch up with filtering */ |
655 |
> |
static void |
656 |
> |
filterframes(void) /* catch up with filtering */ |
657 |
|
{ |
658 |
|
VIEW *vp; |
659 |
|
register int i; |
671 |
|
} |
672 |
|
|
673 |
|
|
674 |
< |
transferframes() /* catch up with picture transfers */ |
674 |
> |
static void |
675 |
> |
transferframes(void) /* catch up with picture transfers */ |
676 |
|
{ |
677 |
|
char combuf[10240], *fbase; |
678 |
|
register char *cp; |
712 |
|
} |
713 |
|
|
714 |
|
|
715 |
< |
animrend(frame, vp) /* start animation frame */ |
716 |
< |
int frame; |
717 |
< |
VIEW *vp; |
715 |
> |
static void |
716 |
> |
animrend( /* start animation frame */ |
717 |
> |
int frame, |
718 |
> |
VIEW *vp |
719 |
> |
) |
720 |
|
{ |
721 |
|
extern int recover(); |
722 |
|
char combuf[2048]; |
732 |
|
} |
733 |
|
|
734 |
|
|
735 |
< |
walkwait(first, last, vfn) /* walk-through frames */ |
736 |
< |
int first, last; |
737 |
< |
char *vfn; |
735 |
> |
static void |
736 |
> |
walkwait( /* walk-through frames */ |
737 |
> |
int first, |
738 |
> |
int last, |
739 |
> |
char *vfn |
740 |
> |
) |
741 |
|
{ |
742 |
|
double blurf; |
743 |
|
int nblur = getblur(&blurf); |
787 |
|
} |
788 |
|
|
789 |
|
|
790 |
< |
int |
791 |
< |
recover(frame) /* recover the specified frame */ |
752 |
< |
int frame; |
790 |
> |
static int |
791 |
> |
recover(int frame) /* recover the specified frame */ |
792 |
|
{ |
793 |
|
static int *rfrm; /* list of recovered frames */ |
794 |
|
static int nrfrms = 0; |
841 |
|
} |
842 |
|
|
843 |
|
|
844 |
< |
int |
845 |
< |
frecover(frame) /* recover filtered frame */ |
807 |
< |
int frame; |
844 |
> |
static int |
845 |
> |
frecover(int frame) /* recover filtered frame */ |
846 |
|
{ |
847 |
|
if (dofilt(frame, 2) && dofilt(frame, 1)) |
848 |
|
return(1); |
850 |
|
} |
851 |
|
|
852 |
|
|
853 |
< |
archive() /* archive and remove renderings */ |
853 |
> |
static void |
854 |
> |
archive(void) /* archive and remove renderings */ |
855 |
|
{ |
856 |
|
#define RMCOML (sizeof(rmcom)-1) |
857 |
|
static char rmcom[] = "rm -f"; |
894 |
|
} |
895 |
|
|
896 |
|
|
897 |
< |
int |
898 |
< |
dofilt(frame, rvr) /* filter frame */ |
899 |
< |
int frame; |
900 |
< |
int rvr; |
897 |
> |
static int |
898 |
> |
dofilt( /* filter frame */ |
899 |
> |
int frame, |
900 |
> |
int rvr |
901 |
> |
) |
902 |
|
{ |
903 |
|
extern int frecover(); |
904 |
|
static int iter = 0; |
1057 |
|
} |
1058 |
|
|
1059 |
|
|
1060 |
< |
VIEW * |
1061 |
< |
getview(n) /* get view number n */ |
1022 |
< |
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 */ |
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 */ |
1085 |
< |
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 */ |
1156 |
< |
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; |
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 _WIN32 |
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; |
1447 |
|
} |
1448 |
|
|
1449 |
|
|
1450 |
< |
int |
1450 |
> |
static int |
1451 |
|
getblur(double *bf) /* get # blur samples (and fraction) */ |
1452 |
|
{ |
1453 |
|
double blurf; |