ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/util/ranimove.c
(Generate patch)

Comparing ray/src/util/ranimove.c (file contents):
Revision 3.6 by schorsch, Mon Jul 21 22:30:19 2003 UTC vs.
Revision 3.12 by greg, Tue Sep 28 17:54:19 2004 UTC

# Line 1 | Line 1
1   #ifndef lint
2 < static const char RCSid[] = "$Id";
2 > static const char RCSid[] = "$Id$";
3   #endif
4   /*
5   *  Radiance object animation program
# Line 12 | Line 12 | static const char RCSid[] = "$Id";
12   #include "copyright.h"
13  
14   #include <time.h>
15 < #ifndef _WIN32
15 > #ifdef _WIN32
16 >  #include <winsock.h> /* struct timeval. XXX find a replacement? */
17 > #else
18    #include <sys/time.h>
19   #endif
20   #include <ctype.h>
# Line 60 | Line 62 | int            haveprio = 0;   /* high-level saliency specified */
62   int             gargc;          /* global argc for printargs */
63   char            **gargv;        /* global argv for printargs */
64  
65 + static void setdefaults(void);
66 + static void setmove(struct ObjMove      *om, char       *ms);
67 + static void setrendparams(char          *optf, char             *qval);
68 + static void getradfile(char     *rfargs);
69 + static void animate(void);
70 + static int countviews(void); /* XXX duplicated function */
71 + static char * getobjname(struct ObjMove *om);
72 + static char * getxf(struct ObjMove      *om, int        n);
73  
74 +
75   int
76 < main(argc, argv)
77 < int     argc;
78 < char    *argv[];
76 > main(
77 >        int     argc,
78 >        char    *argv[]
79 > )
80   {
81          int     explicate = 0;
82          char    *cfname;
# Line 97 | Line 109 | char   *argv[];
109                  case 'f':                       /* frame range */
110                          switch (sscanf(argv[++i], "%d,%d", &fbeg, &fend)) {
111                          case 2:
112 <                                if ((fbeg <= 0 | fend < fbeg))
112 >                                if ((fbeg <= 0) | (fend < fbeg))
113                                          goto userr;
114                                  break;
115                          case 1:
# Line 141 | Line 153 | char   *argv[];
153                                                  /* all done */
154          if (lorendoptf[0])
155                  unlink(lorendoptf);
156 <        if (hirendoptf[0])
156 >        if (hirendoptf[0] && strcmp(hirendoptf, lorendoptf))
157                  unlink(hirendoptf);
158          if (objtmpf[0])
159                  unlink(objtmpf);
# Line 151 | Line 163 | userr:
163   "Usage: %s [-n nprocs][-f beg,end][-t sec][-d jnd][-s][-w][-e] anim_file\n",
164                          progname);
165          quit(1);
166 +        return 1; /* pro forma return */
167   }
168  
169  
170   void
171 < eputs(s)                                /* put string to stderr */
172 < register char  *s;
171 > eputs(                          /* put string to stderr */
172 >        register char  *s
173 > )
174   {
175          static int  midline = 0;
176  
# Line 174 | Line 188 | register char  *s;
188   }
189  
190  
191 < void
192 < setdefaults()                   /* set default values */
191 > static void
192 > setdefaults(void)                       /* set default values */
193   {
194          int     nviews;
195          int     decades;
# Line 251 | Line 265 | setdefaults()                  /* set default values */
265   }
266  
267  
268 < void
269 < setmove(om, ms)                 /* assign a move object from spec. */
270 < struct ObjMove  *om;
271 < char    *ms;
268 > static void
269 > setmove(                        /* assign a move object from spec. */
270 >        struct ObjMove  *om,
271 >        char    *ms
272 > )
273   {
274          char    parname[128];
275          char    *cp;
# Line 299 | Line 314 | char   *ms;
314                  if (isflt(om->prio_file)) {
315                          om->prio = atof(om->prio_file);
316                          om->prio_file[0] = '\0';
317 <                        haveprio |= (om->prio < 0.95 | om->prio > 1.05);
317 >                        haveprio |= ((om->prio < 0.95) | (om->prio > 1.05));
318                  } else
319                          haveprio = 1;
320          } else
# Line 311 | Line 326 | badspec:
326   }
327  
328  
329 < void
330 < setrendparams(optf, qval)       /* set global rendering parameters */
331 < char            *optf;
332 < char            *qval;
329 > static void
330 > setrendparams(  /* set global rendering parameters */
331 >        char            *optf,
332 >        char            *qval
333 > )
334   {
335          char    *argv[1024];
336          char    **av = argv;
# Line 334 | Line 350 | char           *qval;
350          if (qval != NULL && qval[0] == '-')
351                  ac += wordstring(av+ac, qval);
352  
353 <                                /* start with default parameters */
354 <        ray_defaults(NULL);
353 >                                /* restore default parameters */
354 >        ray_restore(NULL);
355                                  /* set what we have */
356          for (i = 0; i < ac; i++) {
357                  while ((rval = expandarg(&ac, &av, i)) > 0)
# Line 349 | Line 365 | char           *qval;
365                          continue;
366                  }
367                  rval = getrenderopt(ac-i, av+i);
368 <                if (rval >= 0) {
369 <                        i += rval;
370 <                        continue;
368 >                if (rval < 0) {
369 >                        sprintf(errmsg, "bad render option at '%s'", av[i]);
370 >                        error(USER, errmsg);
371                  }
372 <                sprintf(errmsg, "bad render option at '%s'", av[i]);
357 <                error(USER, errmsg);
372 >                i += rval;
373          }
374   }
375  
376  
377 < void
378 < getradfile(rfargs)              /* run rad and get needed variables */
379 < char    *rfargs;
377 > static void
378 > getradfile(             /* run rad and get needed variables */
379 >        char    *rfargs
380 > )
381   {
382          static short    mvar[] = {OCONV,OCTREEF,RESOLUTION,EXPOSURE,-1};
383          char    combuf[256];
384          register int    i;
385          register char   *cp;
386 <        char    *pippt;
386 >        char    *pippt = NULL;
387                                          /* create rad command */
388          strcpy(lorendoptf, "ranim0.opt");
389          sprintf(combuf,
# Line 410 | Line 426 | char   *rfargs;
426   }
427  
428  
429 < void
430 < animate()                       /* run through animation */
429 > static void
430 > animate(void)                   /* run through animation */
431   {
432          int     rpass;
433  
# Line 442 | Line 458 | animate()                      /* run through animation */
458   }
459  
460  
461 < VIEW *
462 < getview(n)                      /* get view number n */
463 < int     n;
461 > extern VIEW *
462 > getview(                        /* get view number n */
463 >        int     n
464 > )
465   {
466          static FILE     *viewfp = NULL;         /* view file pointer */
467          static int      viewnum = 0;            /* current view number */
# Line 492 | Line 509 | int    n;
509   }
510  
511  
512 < int
513 < countviews()                    /* count views in view file */
512 > static int
513 > countviews(void)                        /* count views in view file */
514   {
515          int     n;
516  
# Line 505 | Line 522 | countviews()                   /* count views in view file */
522   }
523  
524  
525 < char *
526 < getexp(n)                       /* get exposure for nth frame */
527 < int     n;
525 > extern char *
526 > getexp(                 /* get exposure for nth frame */
527 >        int     n
528 > )
529   {
530          extern char     *fskip();
531          static char     expval[32];
# Line 559 | Line 577 | formerr:
577          sprintf(errmsg, "%s: exposure format error on line %d",
578                          vval(EXPOSURE), curfrm);
579          error(USER, errmsg);
580 +        return NULL; /* pro forma return */
581   }
582  
583  
584 < double
585 < expspec_val(s)                  /* get exposure value from spec. */
586 < char    *s;
584 > extern double
585 > expspec_val(                    /* get exposure value from spec. */
586 >        char    *s
587 > )
588   {
589          double  expval;
590  
# Line 572 | Line 592 | char   *s;
592                  return(1.0);
593  
594          expval = atof(s);
595 <        if ((s[0] == '+' | s[0] == '-'))
595 >        if ((s[0] == '+') | (s[0] == '-'))
596                  return(pow(2.0, expval));
597          return(expval);
598   }
599  
600  
601 < char *
602 < getoctspec(n)                   /* get octree for the given frame */
603 < int     n;
601 > extern char *
602 > getoctspec(                     /* get octree for the given frame */
603 >        int     n
604 > )
605   {
606          static char     combuf[1024];
607          int             cfm = 0;
# Line 632 | Line 653 | int    n;
653   }
654  
655  
656 < char *
657 < getobjname(om)                  /* get fully qualified object name */
658 < register struct ObjMove *om;
656 > static char *
657 > getobjname(                     /* get fully qualified object name */
658 >        register struct ObjMove *om
659 > )
660   {
661          static char     objName[512];
662          register char   *cp = objName;
# Line 650 | Line 672 | register struct ObjMove        *om;
672   }
673  
674  
675 < char *
676 < getxf(om, n)                    /* get total transform for object */
677 < register struct ObjMove *om;
678 < int     n;
675 > static char *
676 > getxf(                  /* get total transform for object */
677 >        register struct ObjMove *om,
678 >        int     n
679 > )
680   {
681          static char     xfsbuf[4096];
682          char            *xfp;
# Line 772 | Line 795 | int    n;
795   }
796  
797  
798 < int
799 < getmove(obj)                            /* find matching move object */
800 < OBJECT  obj;
798 > extern int
799 > getmove(                                /* find matching move object */
800 >        OBJECT  obj
801 > )
802   {
803          static int      lasti;
804          static OBJECT   lasto = OVOID;
# Line 792 | Line 816 | OBJECT obj;
816                  objnm = obj_move[i].name;
817                  len = strlen(objnm);
818                  if (!strncmp(onm, objnm, len)) {
819 <                        if ((obj_move[i].parent < 0 & onm[len] == '.'))
819 >                        if ((obj_move[i].parent < 0) & (onm[len] == '.'))
820                                  break;
821                          objnm = getobjname(&obj_move[i]) + len;
822                          len2 = strlen(objnm);
# Line 805 | Line 829 | OBJECT obj;
829   }
830  
831  
832 < double
833 < obj_prio(obj)                   /* return priority for object */
834 < OBJECT  obj;
832 > extern double
833 > obj_prio(                       /* return priority for object */
834 >        OBJECT  obj
835 > )
836   {
837          int     moi;
838          
# Line 817 | Line 842 | OBJECT obj;
842   }
843  
844  
845 < double
846 < getTime()                       /* get current time (CPU or real) */
845 > extern double
846 > getTime(void)                   /* get current time (CPU or real) */
847   {
848          struct timeval  time_now;
849                                          /* return CPU time if one process */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines