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

Comparing ray/src/util/ranimate.c (file contents):
Revision 2.19 by greg, Wed Jul 10 15:14:59 1996 UTC vs.
Revision 2.24 by gwlarson, Thu Feb 26 10:27:45 1998 UTC

# Line 93 | Line 93 | int    silent = 0;             /* silent mode? */
93   int     noaction = 0;           /* take no action? */
94  
95   char    *remsh;                 /* remote shell program/script */
96 < char    rendopt[2048] = "";     /* rendering options */
96 > char    rendopt[2048];          /* rendering options */
97   char    rresopt[32];            /* rendering resolution options */
98   char    fresopt[32];            /* filter resolution options */
99   int     pfiltalways;            /* always use pfilt? */
# Line 150 | Line 150 | char   *argv[];
150          cfname = argv[i];
151                                                  /* load variables */
152          loadvars(cfname);
153 +                                                /* check variables */
154 +        checkvalues();
155                                                  /* did we get DIRECTORY? */
156          checkdir();
157                                                  /* check status */
# Line 230 | Line 232 | getastat()                     /* check/set animation status */
232                  }
233                  /* assume it is dead */
234          }
235 <        if (strcmp(cfname, astat.cfname) && astat.tnext != 0) { /* other's */
235 >        if (strcmp(cfname, astat.cfname) && astat.pid != 0) {   /* other's */
236                  fprintf(stderr, "%s: unfinished job \"%s\"\n",
237                                  progname, astat.cfname);
238                  return(-1);
# Line 448 | Line 450 | char   *rfargs;
450          char    combuf[256];
451          register int    i;
452          register char   *cp;
453 +        char    *pippt;
454                                          /* create rad command */
455          sprintf(rendopt, " @%s/render.opt", vval(DIRECTORY));
456          sprintf(combuf,
457          "rad -v 0 -s -e -w %s OPTFILE=%s | egrep '^[ \t]*(NOMATCH",
458                          rfargs, rendopt+2);
459          cp = combuf;
460 <        while (*cp) cp++;               /* match unset variables */
460 >        while (*cp) {
461 >                if (*cp == '|') pippt = cp;
462 >                cp++;
463 >        }                               /* match unset variables */
464          for (i = 0; mvar[i] >= 0; i++)
465                  if (!vdef(mvar[i])) {
466                          *cp++ = '|';
467                          strcpy(cp, vnam(mvar[i]));
468                          while (*cp) cp++;
469 +                        pippt = NULL;
470                  }
471 <        sprintf(cp, ")[ \t]*=' > %s/radset.var", vval(DIRECTORY));
472 <        cp += 11;                       /* point to file name */
471 >        if (pippt != NULL)
472 >                strcpy(pippt, "> /dev/null");   /* nothing to match */
473 >        else {
474 >                sprintf(cp, ")[ \t]*=' > %s/radset.var", vval(DIRECTORY));
475 >                cp += 11;               /* point to file name */
476 >        }
477          if (system(combuf)) {
478                  fprintf(stderr, "%s: error executing rad command:\n\t%s\n",
479                                  progname, combuf);
480                  quit(1);
481          }
482 <        loadvars(cp);                   /* load variables and remove file */
483 <        unlink(cp);
482 >        if (pippt == NULL) {            /* load variables and remove file */
483 >                loadvars(cp);
484 >                unlink(cp);
485 >        }
486   }
487  
488  
# Line 901 | Line 914 | int    rvr;
914                  strcat(combuf, viewopt(vp));
915                  if (vbool(RTRACE))
916                          sprintf(combuf+strlen(combuf), " -ff -fr '%s -w0 %s'",
917 <                                        rendopt, vval(OCTREE));
917 >                                        rendopt+1, vval(OCTREE));
918                  if (vdef(PINTERP))
919                          sprintf(combuf+strlen(combuf), " %s", vval(PINTERP));
920                  if (usepfilt)
# Line 972 | Line 985 | int    n;
985                  }
986                  return(NULL);
987          }
988 <        if (viewfp == NULL) {           /* open file */
988 >        if (viewfp == NULL) {                   /* open file */
989                  if ((viewfp = fopen(vval(VIEWFILE), "r")) == NULL) {
990                          perror(vval(VIEWFILE));
991                          quit(1);
992                  }
993 <        } else if (n < viewnum) {       /* rewind file */
993 >        } else if (n > 0 && n < viewnum) {      /* rewind file */
994                  if (viewnum == 1 && feof(viewfp))
995                          return(&curview);               /* just one view */
996                  if (fseek(viewfp, 0L, 0) == EOF) {
# Line 987 | Line 1000 | int    n;
1000                  copystruct(&curview, &stdview);
1001                  viewnum = 0;
1002          }
1003 +        if (n < 0) {                            /* get next view */
1004 +                register int    c = getc(viewfp);
1005 +                if (c == EOF)
1006 +                        return((VIEW *)NULL);           /* that's it */
1007 +                ungetc(c, viewfp);
1008 +                n = viewnum + 1;
1009 +        }
1010          while (n > viewnum) {           /* scan to desired view */
1011                  if (fgets(linebuf, sizeof(linebuf), viewfp) == NULL)
1012                          return(viewnum==1 ? &curview : (VIEW *)NULL);
# Line 1000 | Line 1020 | int    n;
1020   int
1021   countviews()                    /* count views in view file */
1022   {
1023 <        register int    n = 0;
1023 >        int     n;
1024  
1025 <        while (getview(n+1) != NULL)
1025 >        if (getview(n=1) == NULL)
1026 >                return(0);
1027 >        while (getview(-1) != NULL)
1028                  n++;
1029          return(n);
1030   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines