| 12 |
|
#include "copyright.h" |
| 13 |
|
|
| 14 |
|
#include <time.h> |
| 15 |
< |
#ifdef _WIN32 |
| 15 |
> |
#if defined(_WIN32) || defined(_WIN64) |
| 16 |
|
#include <winsock.h> /* struct timeval. XXX find a replacement? */ |
| 17 |
|
#else |
| 18 |
|
#include <sys/time.h> |
| 20 |
|
#include <ctype.h> |
| 21 |
|
#include <string.h> |
| 22 |
|
|
| 23 |
+ |
#include "platform.h" |
| 24 |
|
#include "paths.h" |
| 25 |
|
#include "ranimove.h" |
| 26 |
+ |
#include "func.h" |
| 27 |
|
|
| 28 |
|
int NVARS = NV_INIT; /* total number of variables */ |
| 29 |
|
|
| 85 |
|
int i; |
| 86 |
|
|
| 87 |
|
progname = argv[0]; /* get arguments */ |
| 88 |
+ |
/* initialize calcomp */ |
| 89 |
+ |
initfunc(); |
| 90 |
|
gargc = argc; |
| 91 |
|
gargv = argv; |
| 92 |
|
for (i = 1; i < argc && argv[i][0] == '-'; i++) |
| 173 |
|
|
| 174 |
|
void |
| 175 |
|
eputs( /* put string to stderr */ |
| 176 |
< |
register char *s |
| 176 |
> |
const char *s |
| 177 |
|
) |
| 178 |
|
{ |
| 179 |
|
static int midline = 0; |
| 193 |
|
|
| 194 |
|
|
| 195 |
|
void |
| 196 |
< |
quit(ec) /* make sure exit is called */ |
| 193 |
< |
int ec; |
| 196 |
> |
quit(int ec) /* make sure exit is called */ |
| 197 |
|
{ |
| 198 |
|
if (ray_pnprocs > 0) /* close children if any */ |
| 199 |
< |
ray_pclose(0); |
| 199 |
> |
ray_pclose(0); |
| 200 |
> |
else if (ray_pnprocs < 0) |
| 201 |
> |
_exit(ec); /* avoid flush in child */ |
| 202 |
|
exit(ec); |
| 203 |
|
} |
| 204 |
|
|
| 354 |
|
av[ac=0] = NULL; |
| 355 |
|
/* load options from file, first */ |
| 356 |
|
if (optf != NULL && *optf) { |
| 357 |
< |
ac = wordfile(av, optf); |
| 357 |
> |
ac = wordfile(av, 1024, optf); |
| 358 |
|
if (ac < 0) { |
| 359 |
|
sprintf(errmsg, "cannot load options file \"%s\"", |
| 360 |
|
optf); |
| 363 |
|
} |
| 364 |
|
/* then from options string */ |
| 365 |
|
if (qval != NULL && qval[0] == '-') |
| 366 |
< |
ac += wordstring(av+ac, qval); |
| 366 |
> |
ac += wordstring(av+ac, 1024-ac, qval); |
| 367 |
|
|
| 368 |
|
/* restore default parameters */ |
| 369 |
|
ray_restore(NULL); |
| 396 |
|
{ |
| 397 |
|
static short mvar[] = {OCONV,OCTREEF,RESOLUTION,EXPOSURE,-1}; |
| 398 |
|
char combuf[256]; |
| 399 |
< |
register int i; |
| 400 |
< |
register char *cp; |
| 399 |
> |
int i; |
| 400 |
> |
char *cp; |
| 401 |
|
char *pippt = NULL; |
| 402 |
|
/* create rad command */ |
| 403 |
|
strcpy(lorendoptf, "ranim0.opt"); |
| 473 |
|
} |
| 474 |
|
|
| 475 |
|
|
| 476 |
< |
extern VIEW * |
| 476 |
> |
VIEW * |
| 477 |
|
getview( /* get view number n */ |
| 478 |
|
int n |
| 479 |
|
) |
| 508 |
|
viewnum = 0; |
| 509 |
|
} |
| 510 |
|
if (n < 0) { /* get next view */ |
| 511 |
< |
register int c = getc(viewfp); |
| 511 |
> |
int c = getc(viewfp); |
| 512 |
|
if (c == EOF) |
| 513 |
|
return(NULL); /* that's it */ |
| 514 |
|
ungetc(c, viewfp); |
| 537 |
|
} |
| 538 |
|
|
| 539 |
|
|
| 540 |
< |
extern char * |
| 540 |
> |
char * |
| 541 |
|
getexp( /* get exposure for nth frame */ |
| 542 |
|
int n |
| 543 |
|
) |
| 544 |
|
{ |
| 540 |
– |
extern char *fskip(); |
| 545 |
|
static char expval[32]; |
| 546 |
|
static FILE *expfp = NULL; |
| 547 |
|
static int curfrm = 0; |
| 548 |
< |
register char *cp; |
| 548 |
> |
char *cp; |
| 549 |
|
|
| 550 |
|
if (n == 0) { /* signal to close file */ |
| 551 |
|
if (expfp != NULL) { |
| 595 |
|
} |
| 596 |
|
|
| 597 |
|
|
| 598 |
< |
extern double |
| 598 |
> |
double |
| 599 |
|
expspec_val( /* get exposure value from spec. */ |
| 600 |
|
char *s |
| 601 |
|
) |
| 612 |
|
} |
| 613 |
|
|
| 614 |
|
|
| 615 |
< |
extern char * |
| 615 |
> |
char * |
| 616 |
|
getoctspec( /* get octree for the given frame */ |
| 617 |
|
int n |
| 618 |
|
) |
| 669 |
|
|
| 670 |
|
static char * |
| 671 |
|
getobjname( /* get fully qualified object name */ |
| 672 |
< |
register struct ObjMove *om |
| 672 |
> |
struct ObjMove *om |
| 673 |
|
) |
| 674 |
|
{ |
| 675 |
|
static char objName[512]; |
| 676 |
< |
register char *cp = objName; |
| 676 |
> |
char *cp = objName; |
| 677 |
|
|
| 678 |
|
strcpy(cp, om->name); |
| 679 |
|
while (om->parent >= 0) { |
| 688 |
|
|
| 689 |
|
static char * |
| 690 |
|
getxf( /* get total transform for object */ |
| 691 |
< |
register struct ObjMove *om, |
| 691 |
> |
struct ObjMove *om, |
| 692 |
|
int n |
| 693 |
|
) |
| 694 |
|
{ |
| 701 |
|
char *av[64]; |
| 702 |
|
int ac; |
| 703 |
|
int i; |
| 704 |
< |
register char *cp; |
| 704 |
> |
char *cp; |
| 705 |
|
/* get parent transform, first */ |
| 706 |
|
if (om->parent >= 0) |
| 707 |
|
xfp = getxf(&obj_move[om->parent], n); |
| 809 |
|
} |
| 810 |
|
|
| 811 |
|
|
| 812 |
< |
extern int |
| 812 |
> |
int |
| 813 |
|
getmove( /* find matching move object */ |
| 814 |
|
OBJECT obj |
| 815 |
|
) |
| 818 |
|
static OBJECT lasto = OVOID; |
| 819 |
|
char *onm, *objnm; |
| 820 |
|
int len, len2; |
| 821 |
< |
register int i; |
| 821 |
> |
int i; |
| 822 |
|
|
| 823 |
|
if (obj == OVOID) |
| 824 |
|
return(-1); |
| 843 |
|
} |
| 844 |
|
|
| 845 |
|
|
| 846 |
< |
extern double |
| 846 |
> |
double |
| 847 |
|
obj_prio( /* return priority for object */ |
| 848 |
|
OBJECT obj |
| 849 |
|
) |
| 856 |
|
} |
| 857 |
|
|
| 858 |
|
|
| 859 |
< |
#ifdef _WIN32 |
| 859 |
> |
#if defined(_WIN32) || defined(_WIN64) |
| 860 |
|
/* replacement function for Windoze */ |
| 861 |
|
static int |
| 862 |
|
gettimeofday(struct timeval *tp, void *dummy) |
| 894 |
|
|
| 895 |
|
#endif |
| 896 |
|
|
| 897 |
< |
extern double |
| 897 |
> |
double |
| 898 |
|
getTime(void) /* get current time (CPU or real) */ |
| 899 |
|
{ |
| 900 |
|
struct timeval time_now; |