--- ray/src/util/ranimove.c 2011/10/05 17:20:55 3.15 +++ ray/src/util/ranimove.c 2025/04/23 02:35:26 3.22 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: ranimove.c,v 3.15 2011/10/05 17:20:55 greg Exp $"; +static const char RCSid[] = "$Id: ranimove.c,v 3.22 2025/04/23 02:35:26 greg Exp $"; #endif /* * Radiance object animation program @@ -12,7 +12,7 @@ static const char RCSid[] = "$Id: ranimove.c,v 3.15 20 #include "copyright.h" #include -#ifdef _WIN32 +#if defined(_WIN32) || defined(_WIN64) #include /* struct timeval. XXX find a replacement? */ #else #include @@ -20,8 +20,10 @@ static const char RCSid[] = "$Id: ranimove.c,v 3.15 20 #include #include +#include "platform.h" #include "paths.h" #include "ranimove.h" +#include "func.h" int NVARS = NV_INIT; /* total number of variables */ @@ -83,6 +85,8 @@ main( int i; progname = argv[0]; /* get arguments */ + /* initialize calcomp */ + initfunc(); gargc = argc; gargv = argv; for (i = 1; i < argc && argv[i][0] == '-'; i++) @@ -169,7 +173,7 @@ userr: void eputs( /* put string to stderr */ - register char *s + const char *s ) { static int midline = 0; @@ -189,11 +193,12 @@ eputs( /* put string to stderr */ void -quit(ec) /* make sure exit is called */ -int ec; +quit(int ec) /* make sure exit is called */ { if (ray_pnprocs > 0) /* close children if any */ - ray_pclose(0); + ray_pclose(0); + else if (ray_pnprocs < 0) + _exit(ec); /* avoid flush in child */ exit(ec); } @@ -349,7 +354,7 @@ setrendparams( /* set global rendering parameters */ av[ac=0] = NULL; /* load options from file, first */ if (optf != NULL && *optf) { - ac = wordfile(av, optf); + ac = wordfile(av, 1024, optf); if (ac < 0) { sprintf(errmsg, "cannot load options file \"%s\"", optf); @@ -358,7 +363,7 @@ setrendparams( /* set global rendering parameters */ } /* then from options string */ if (qval != NULL && qval[0] == '-') - ac += wordstring(av+ac, qval); + ac += wordstring(av+ac, 1024-ac, qval); /* restore default parameters */ ray_restore(NULL); @@ -391,8 +396,8 @@ getradfile( /* run rad and get needed variables */ { static short mvar[] = {OCONV,OCTREEF,RESOLUTION,EXPOSURE,-1}; char combuf[256]; - register int i; - register char *cp; + int i; + char *cp; char *pippt = NULL; /* create rad command */ strcpy(lorendoptf, "ranim0.opt"); @@ -468,7 +473,7 @@ animate(void) /* run through animation */ } -extern VIEW * +VIEW * getview( /* get view number n */ int n ) @@ -503,7 +508,7 @@ getview( /* get view number n */ viewnum = 0; } if (n < 0) { /* get next view */ - register int c = getc(viewfp); + int c = getc(viewfp); if (c == EOF) return(NULL); /* that's it */ ungetc(c, viewfp); @@ -532,16 +537,15 @@ countviews(void) /* count views in view file */ } -extern char * +char * getexp( /* get exposure for nth frame */ int n ) { - extern char *fskip(); static char expval[32]; static FILE *expfp = NULL; static int curfrm = 0; - register char *cp; + char *cp; if (n == 0) { /* signal to close file */ if (expfp != NULL) { @@ -591,7 +595,7 @@ formerr: } -extern double +double expspec_val( /* get exposure value from spec. */ char *s ) @@ -608,7 +612,7 @@ expspec_val( /* get exposure value from spec. */ } -extern char * +char * getoctspec( /* get octree for the given frame */ int n ) @@ -665,11 +669,11 @@ getoctspec( /* get octree for the given frame */ static char * getobjname( /* get fully qualified object name */ - register struct ObjMove *om + struct ObjMove *om ) { static char objName[512]; - register char *cp = objName; + char *cp = objName; strcpy(cp, om->name); while (om->parent >= 0) { @@ -684,7 +688,7 @@ getobjname( /* get fully qualified object name */ static char * getxf( /* get total transform for object */ - register struct ObjMove *om, + struct ObjMove *om, int n ) { @@ -697,7 +701,7 @@ getxf( /* get total transform for object */ char *av[64]; int ac; int i; - register char *cp; + char *cp; /* get parent transform, first */ if (om->parent >= 0) xfp = getxf(&obj_move[om->parent], n); @@ -805,7 +809,7 @@ getxf( /* get total transform for object */ } -extern int +int getmove( /* find matching move object */ OBJECT obj ) @@ -814,7 +818,7 @@ getmove( /* find matching move object */ static OBJECT lasto = OVOID; char *onm, *objnm; int len, len2; - register int i; + int i; if (obj == OVOID) return(-1); @@ -839,7 +843,7 @@ getmove( /* find matching move object */ } -extern double +double obj_prio( /* return priority for object */ OBJECT obj ) @@ -852,7 +856,7 @@ obj_prio( /* return priority for object */ } -#ifdef _WIN32 +#if defined(_WIN32) || defined(_WIN64) /* replacement function for Windoze */ static int gettimeofday(struct timeval *tp, void *dummy) @@ -890,7 +894,7 @@ gettimeofday(struct timeval *tp, void *dummy) #endif -extern double +double getTime(void) /* get current time (CPU or real) */ { struct timeval time_now;