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.24 by gwlarson, Thu Feb 26 10:27:45 1998 UTC vs.
Revision 2.42 by schorsch, Tue Oct 21 19:19:29 2003 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1996 Regents of the University of California */
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ LBL";
2 > static const char RCSid[] = "$Id$";
3   #endif
6
4   /*
5   * Radiance animation control program
6 + *
7 + * The main difference between this program and ranimove is that
8 + * we have many optimizations here for camera motion in static
9 + * environments, calling rpict and pinterp on multiple processors,
10 + * where ranimove puts its emphasis on object motion, and does
11 + * not use any external programs for image generation.
12 + *
13 + * See the ranimate(1) man page for further details.
14   */
15  
16 < #include "standard.h"
16 > #include "copyright.h"
17 >
18   #include <ctype.h>
13 #include <sys/types.h>
19   #include <sys/stat.h>
20 +
21 + #include "standard.h"
22 + #include "paths.h"
23   #include "view.h"
24   #include "vars.h"
25   #include "netproc.h"
26 +                                /* default blur samples */
27 + #ifndef DEF_NBLUR
28 + #define DEF_NBLUR       5
29 + #endif
30                                  /* default remote shell */
19 #ifdef _AUX_SOURCE
20 #define REMSH           "remsh"
21 #else
31   #define REMSH           "rsh"
32 < #endif
33 <                                /* input variables */
34 < #define HOST            0               /* rendering host machine */
35 < #define RENDER          1               /* rendering options */
36 < #define PFILT           2               /* pfilt options */
37 < #define PINTERP         3               /* pinterp options */
38 < #define OCTREE          4               /* octree file name */
39 < #define DIRECTORY       5               /* working (sub)directory */
40 < #define BASENAME        6               /* output image base name */
41 < #define VIEWFILE        7               /* animation frame views */
42 < #define START           8               /* starting frame number */
43 < #define END             9               /* ending frame number */
44 < #define RIF             10              /* rad input file */
45 < #define NEXTANIM        11              /* next animation file */
46 < #define ANIMATE         12              /* animation command */
47 < #define TRANSFER        13              /* frame transfer command */
48 < #define ARCHIVE         14              /* archiving command */
49 < #define INTERP          15              /* # frames to interpolate */
50 < #define OVERSAMP        16              /* # times to oversample image */
51 < #define MBLUR           17              /* samples for motion blur */
52 < #define RTRACE          18              /* use rtrace with pinterp? */
53 < #define DISKSPACE       19              /* how much disk space to use */
54 < #define RESOLUTION      20              /* desired final resolution */
55 < #define EXPOSURE        21              /* how to compute exposure */
47 < #define RSH             22              /* remote shell script or program */
32 >                                /* input variables (alphabetical by name) */
33 > #define ANIMATE         0               /* animation command */
34 > #define ARCHIVE         1               /* archiving command */
35 > #define BASENAME        2               /* output image base name */
36 > #define DIRECTORY       3               /* working (sub)directory */
37 > #define DISKSPACE       4               /* how much disk space to use */
38 > #define END             5               /* ending frame number */
39 > #define EXPOSURE        6               /* how to compute exposure */
40 > #define HOST            7               /* rendering host machine */
41 > #define INTERP          8               /* # frames to interpolate */
42 > #define MBLUR           9               /* motion blur parameters */
43 > #define NEXTANIM        10              /* next animation file */
44 > #define OCTREE          11              /* octree file name */
45 > #define OVERSAMP        12              /* # times to oversample image */
46 > #define PFILT           13              /* pfilt options */
47 > #define PINTERP         14              /* pinterp options */
48 > #define RENDER          15              /* rendering options */
49 > #define RESOLUTION      16              /* desired final resolution */
50 > #define RIF             17              /* rad input file */
51 > #define RSH             18              /* remote shell script or program */
52 > #define RTRACE          19              /* use rtrace with pinterp? */
53 > #define START           20              /* starting frame number */
54 > #define TRANSFER        21              /* frame transfer command */
55 > #define VIEWFILE        22              /* animation frame views */
56  
57   int     NVARS = 23;             /* total number of variables */
58  
59   VARIABLE        vv[] = {                /* variable-value pairs */
52        {"host",        4,      0,      NULL,   NULL},
53        {"render",      3,      0,      NULL,   catvalues},
54        {"pfilt",       2,      0,      NULL,   catvalues},
55        {"pinterp",     2,      0,      NULL,   catvalues},
56        {"OCTREE",      3,      0,      NULL,   onevalue},
57        {"DIRECTORY",   3,      0,      NULL,   onevalue},
58        {"BASENAME",    3,      0,      NULL,   onevalue},
59        {"VIEWFILE",    2,      0,      NULL,   onevalue},
60        {"START",       2,      0,      NULL,   intvalue},
61        {"END",         2,      0,      NULL,   intvalue},
62        {"RIF",         3,      0,      NULL,   onevalue},
63        {"NEXTANIM",    3,      0,      NULL,   onevalue},
60          {"ANIMATE",     2,      0,      NULL,   onevalue},
65        {"TRANSFER",    2,      0,      NULL,   onevalue},
61          {"ARCHIVE",     2,      0,      NULL,   onevalue},
62 +        {"BASENAME",    3,      0,      NULL,   onevalue},
63 +        {"DIRECTORY",   3,      0,      NULL,   onevalue},
64 +        {"DISKSPACE",   3,      0,      NULL,   fltvalue},
65 +        {"END",         2,      0,      NULL,   intvalue},
66 +        {"EXPOSURE",    3,      0,      NULL,   onevalue},
67 +        {"host",        4,      0,      NULL,   NULL},
68          {"INTERPOLATE", 3,      0,      NULL,   intvalue},
68        {"OVERSAMPLE",  2,      0,      NULL,   fltvalue},
69          {"MBLUR",       2,      0,      NULL,   onevalue},
70 <        {"RTRACE",      2,      0,      NULL,   boolvalue},
71 <        {"DISKSPACE",   3,      0,      NULL,   fltvalue},
70 >        {"NEXTANIM",    3,      0,      NULL,   onevalue},
71 >        {"OCTREE",      3,      0,      NULL,   onevalue},
72 >        {"OVERSAMPLE",  2,      0,      NULL,   fltvalue},
73 >        {"pfilt",       2,      0,      NULL,   catvalues},
74 >        {"pinterp",     2,      0,      NULL,   catvalues},
75 >        {"render",      3,      0,      NULL,   catvalues},
76          {"RESOLUTION",  3,      0,      NULL,   onevalue},
77 <        {"EXPOSURE",    3,      0,      NULL,   onevalue},
77 >        {"RIF",         3,      0,      NULL,   onevalue},
78          {"RSH",         3,      0,      NULL,   onevalue},
79 +        {"RTRACE",      2,      0,      NULL,   boolvalue},
80 +        {"START",       2,      0,      NULL,   intvalue},
81 +        {"TRANSFER",    2,      0,      NULL,   onevalue},
82 +        {"VIEWFILE",    2,      0,      NULL,   onevalue},
83   };
84  
85   #define SFNAME  "STATUS"                /* status file name */
# Line 115 | Line 123 | struct pslot   *findpslot();
123   PSERVER *lastpserver;           /* last process server with error */
124  
125   VIEW    *getview();
126 < char    *getexp();
126 > char    *getexp(), *dirfile();
127 > int     getblur();
128  
129 < extern time_t   fdate(), time();
129 > extern time_t   time();
130  
131  
132   main(argc, argv)
# Line 469 | Line 478 | char   *rfargs;
478                          pippt = NULL;
479                  }
480          if (pippt != NULL)
481 <                strcpy(pippt, "> /dev/null");   /* nothing to match */
481 >                strcpy(pippt, "> " NULL_DEVICE);        /* nothing to match */
482          else {
483                  sprintf(cp, ")[ \t]*=' > %s/radset.var", vval(DIRECTORY));
484                  cp += 11;               /* point to file name */
485          }
486 <        if (system(combuf)) {
478 <                fprintf(stderr, "%s: error executing rad command:\n\t%s\n",
479 <                                progname, combuf);
480 <                quit(1);
481 <        }
486 >        system(combuf);                 /* ignore exit code */
487          if (pippt == NULL) {            /* load variables and remove file */
488                  loadvars(cp);
489                  unlink(cp);
# Line 516 | Line 521 | animate()                      /* run animation */
521                                                  progname, vnam(INTERP));
522                          vval(INTERP) = "0";
523                  }
524 <                if (atoi(vval(MBLUR))) {        /* can't handle this yet */
524 >                if (strcmp(vval(MBLUR),"0")) {  /* can't handle this */
525                          if (!nowarn)
526                                  fprintf(stderr,
527                                          "%s: resetting %s=0 for animation\n",
# Line 526 | Line 531 | animate()                      /* run animation */
531          }
532                                          /* figure # frames per batch */
533          d1 = mult*xres*mult*yres*4;             /* space for orig. picture */
534 <        if ((i=vint(INTERP)) || atoi(vval(MBLUR)))
534 >        if ((i=vint(INTERP)) || getblur(NULL) > 1)
535                  d1 += mult*xres*mult*yres*sizeof(float);        /* Z-buffer */
536          d2 = xres*yres*4;                       /* space for final picture */
537          frames_batch = (i+1)*(vflt(DISKSPACE)*1048576.-d1)/(d1+i*d2);
# Line 536 | Line 541 | animate()                      /* run animation */
541                  quit(1);
542          }
543                                          /* initialize archive argument list */
544 <        i = 16;
540 <        if (vdef(ARCHIVE) && strlen(vval(ARCHIVE)) > i)
541 <                i = strlen(vval(ARCHIVE));
544 >        i = vdef(ARCHIVE) ? strlen(vval(ARCHIVE))+132 : 132;
545          arcnext = arcfirst = arcargs + i;
546                                          /* initialize status file */
547          if (astat.rnext == 0)
# Line 624 | Line 627 | filterframes()                         /* catch up with filtering */
627          if (astat.tnext < astat.fnext)  /* other work to do first */
628                  return;
629                                          /* filter each view */
630 <        for (i = astat.fnext; i < astat.rnext; i++) {
631 <                if ((vp = getview(i)) == NULL) {        /* get view i */
632 <                        fprintf(stderr,
630 <                        "%s: unexpected error reading view for frame %d\n",
631 <                                        progname, i);
632 <                        quit(1);
633 <                }
634 <                dofilt(i, vp, getexp(i), 0);            /* filter frame */
635 <        }
630 >        for (i = astat.fnext; i < astat.rnext; i++)
631 >                dofilt(i, 0);
632 >
633          bwait(0);                       /* wait for filter processes */
634          archive();                      /* archive originals */
635          astat.fnext = i;                /* update status */
# Line 642 | Line 639 | filterframes()                         /* catch up with filtering */
639  
640   transferframes()                        /* catch up with picture transfers */
641   {
642 <        char    combuf[10240];
642 >        char    combuf[10240], *fbase;
643          register char   *cp;
644          register int    i;
645  
# Line 653 | Line 650 | transferframes()                       /* catch up with picture transfers
650                  putastat();             /* update status */
651                  return;
652          }
653 <        strcpy(combuf, vval(TRANSFER)); /* start transfer command */
654 <        cp = combuf + strlen(combuf);
653 >        strcpy(combuf, "cd ");          /* start transfer command */
654 >        fbase = dirfile(cp = combuf+3, vval(BASENAME));
655 >        if (*cp) {
656 >                while (*++cp) ;
657 >                *cp++ = ';'; *cp++ = ' ';
658 >        } else
659 >                cp = combuf;
660 >        strcpy(cp, vval(TRANSFER));
661 >        while (*cp) cp++;
662                                          /* make argument list */
663          for (i = astat.tnext; i < astat.fnext; i++) {
664                  *cp++ = ' ';
665 <                sprintf(cp, vval(BASENAME), i);
665 >                sprintf(cp, fbase, i);
666                  while (*cp) cp++;
667                  strcpy(cp, ".pic");
668                  cp += 4;
# Line 695 | Line 699 | walkwait(first, last, vfn)             /* walk-through frames */
699   int     first, last;
700   char    *vfn;
701   {
702 +        double  blurf;
703 +        int     nblur = getblur(&blurf);
704          char    combuf[2048];
705 <        char    *inspoint;
705 >        register char   *inspoint;
706          register int    i;
707  
708          if (!noaction && vint(INTERP))          /* create dummy frames */
# Line 707 | Line 713 | char   *vfn;
713                                  close(open(combuf, O_RDONLY|O_CREAT, 0666));
714                          }
715                                          /* create command */
716 <        sprintf(combuf, "rpict%s -w0", rendopt);
717 <        if (vint(INTERP) || atoi(vval(MBLUR)))
718 <                sprintf(combuf+strlen(combuf), " -z %s.zbf", vval(BASENAME));
719 <        sprintf(combuf+strlen(combuf), " -o %s.unf %s -S %d",
716 >        sprintf(combuf, "rpict%s%s -w0", rendopt,
717 >                        viewopt(getview(first>1 ? first-1 : 1)));
718 >        inspoint = combuf;
719 >        while (*inspoint) inspoint++;
720 >        if (nblur) {
721 >                sprintf(inspoint, " -pm %.3f", blurf/nblur);
722 >                while (*inspoint) inspoint++;
723 >        }
724 >        if (nblur > 1 || vint(INTERP)) {
725 >                sprintf(inspoint, " -z %s.zbf", vval(BASENAME));
726 >                while (*inspoint) inspoint++;
727 >        }
728 >        sprintf(inspoint, " -o %s.unf %s -S %d",
729                          vval(BASENAME), rresopt, first);
730 <        inspoint = combuf + strlen(combuf);
730 >        while (*inspoint) inspoint++;
731          sprintf(inspoint, " %s < %s", vval(OCTREE), vfn);
732                                          /* run in parallel */
733          i = (last-first+1)/(vint(INTERP)+1);
# Line 738 | Line 753 | int    frame;
753   {
754          static int      *rfrm;          /* list of recovered frames */
755          static int      nrfrms = 0;
756 +        double  blurf;
757 +        int     nblur = getblur(&blurf);
758          char    combuf[2048];
759          char    fname[128];
760          register char   *cp;
# Line 753 | Line 770 | int    frame;
770                                  vval(ANIMATE), frame, rendopt);
771          else
772                  sprintf(combuf, "rpict%s -w0", rendopt);
773 <        cp = combuf + strlen(combuf);
774 <        if (vint(INTERP) || atoi(vval(MBLUR))) {
773 >        cp = combuf;
774 >        while (*cp) cp++;
775 >        if (nblur) {
776 >                sprintf(cp, " -pm %.3f", blurf/nblur);
777 >                while (*cp) cp++;
778 >        }
779 >        if (nblur > 1 || vint(INTERP)) {
780                  sprintf(cp, " -z %s.zbf", fname);
781                  while (*cp) cp++;
782          }
# Line 768 | Line 790 | int    frame;
790                  return(1);
791                                          /* add frame to recovered list */
792          if (nrfrms)
793 <                rfrm = (int *)realloc((char *)rfrm, (nrfrms+1)*sizeof(int));
793 >                rfrm = (int *)realloc((void *)rfrm, (nrfrms+1)*sizeof(int));
794          else
795                  rfrm = (int *)malloc(sizeof(int));
796          if (rfrm == NULL) {
# Line 784 | Line 806 | int
806   frecover(frame)                         /* recover filtered frame */
807   int     frame;
808   {
809 <        VIEW    *vp;
788 <        char    *ex;
789 <
790 <        vp = getview(frame);
791 <        ex = getexp(frame);
792 <        if (dofilt(frame, vp, ex, 2) && dofilt(frame, vp, ex, 1))
809 >        if (dofilt(frame, 2) && dofilt(frame, 1))
810                  return(1);
811          return(0);
812   }
# Line 799 | Line 816 | archive()                      /* archive and remove renderings */
816   {
817   #define RMCOML  (sizeof(rmcom)-1)
818          static char     rmcom[] = "rm -f";
819 <        register int    i;
819 >        char    basedir[128];
820 >        int     dlen, alen;
821 >        register int    j;
822  
823          if (arcnext == arcfirst)
824                  return;                         /* nothing to do */
825 +        dirfile(basedir, vval(BASENAME));
826 +        dlen = strlen(basedir);
827          if (vdef(ARCHIVE)) {                    /* run archive command */
828 <                i = strlen(vval(ARCHIVE));
829 <                strncpy(arcfirst-i, vval(ARCHIVE), i);
830 <                if (runcom(arcfirst-i)) {
828 >                alen = strlen(vval(ARCHIVE));
829 >                if (dlen) {
830 >                        j = alen + dlen + 5;
831 >                        strncpy(arcfirst-j, "cd ", 3);
832 >                        strncpy(arcfirst-j+3, basedir, dlen);
833 >                        (arcfirst-j)[dlen+3] = ';'; (arcfirst-j)[dlen+4] = ' ';
834 >                } else
835 >                        j = alen;
836 >                strncpy(arcfirst-alen, vval(ARCHIVE), alen);
837 >                if (runcom(arcfirst-j)) {
838                          fprintf(stderr, "%s: error running archive command\n",
839                                          progname);
840                          quit(1);
841                  }
842          }
843 +        if (dlen) {
844 +                j = RMCOML + dlen + 5;
845 +                strncpy(arcfirst-j, "cd ", 3);
846 +                strncpy(arcfirst-j+3, basedir, dlen);
847 +                (arcfirst-j)[dlen+3] = ';'; (arcfirst-j)[dlen+4] = ' ';
848 +        } else
849 +                j = RMCOML;
850                                                  /* run remove command */
851          strncpy(arcfirst-RMCOML, rmcom, RMCOML);
852 <        runcom(arcfirst-RMCOML);
852 >        runcom(arcfirst-j);
853          arcnext = arcfirst;                     /* reset argument list */
854   #undef RMCOML
855   }
856  
857  
858   int
859 < dofilt(frame, vp, ep, rvr)                      /* filter frame */
859 > dofilt(frame, rvr)                              /* filter frame */
860   int     frame;
826 VIEW    *vp;
827 char    *ep;
861   int     rvr;
862   {
863          extern int      frecover();
864          static int      iter = 0;
865 <        char    fnbefore[128], fnafter[128];
865 >        double  blurf;
866 >        int     nblur = getblur(&blurf);
867 >        VIEW    *vp = getview(frame);
868 >        char    *ep = getexp(frame);
869 >        char    fnbefore[128], fnafter[128], *fbase;
870          char    combuf[1024], fname0[128], fname1[128];
871          int     usepinterp, usepfilt, nora_rgbe;
872          int     frseq[2];
873                                                  /* check what is needed */
874 <        usepinterp = atoi(vval(MBLUR));
875 <        usepfilt = pfiltalways | ep==NULL;
874 >        if (vp == NULL) {
875 >                 fprintf(stderr,
876 >                        "%s: unexpected error reading view for frame %d\n",
877 >                                          progname, frame);
878 >                quit(1);
879 >        }
880 >        if (ep == NULL) {
881 >                 fprintf(stderr,
882 >                        "%s: unexpected error reading exposure for frame %d\n",
883 >                                          progname, frame);
884 >                quit(1);
885 >        }
886 >        usepinterp = (nblur > 1);
887 >        usepfilt = pfiltalways | (ep==NULL);
888          if (ep != NULL && !strcmp(ep, "1"))
889                  ep = "+0";
890          nora_rgbe = strcmp(vval(OVERSAMP),"1") || ep==NULL ||
# Line 843 | Line 892 | int    rvr;
892                                                  /* compute rendered views */
893          frseq[0] = frame - ((frame-1) % (vint(INTERP)+1));
894          frseq[1] = frseq[0] + vint(INTERP) + 1;
895 +        fbase = dirfile(NULL, vval(BASENAME));
896          if (frseq[1] > vint(END))
897                  frseq[1] = vint(END);
898          if (frseq[1] == frame) {                        /* pfilt only */
# Line 852 | Line 902 | int    rvr;
902          } else if (frseq[0] == frame) {         /* no interpolation needed */
903                  if (!rvr && frame > 1+vint(INTERP)) {   /* archive previous */
904                          *arcnext++ = ' ';
905 <                        sprintf(arcnext, vval(BASENAME), frame-vint(INTERP)-1);
905 >                        sprintf(arcnext, fbase, frame-vint(INTERP)-1);
906                          while (*arcnext) arcnext++;
907                          strcpy(arcnext, ".unf");
908                          arcnext += 4;
909                          if (usepinterp || vint(INTERP)) {       /* and Z-buf */
910                                  *arcnext++ = ' ';
911 <                                sprintf(arcnext, vval(BASENAME),
862 <                                                frame-vint(INTERP)-1);
911 >                                sprintf(arcnext, fbase, frame-vint(INTERP)-1);
912                                  while (*arcnext) arcnext++;
913                                  strcpy(arcnext, ".zbf");
914                                  arcnext += 4;
# Line 879 | Line 928 | int    rvr;
928          if (usepinterp) {                       /* using pinterp */
929                  if (rvr == 2 && recover(frseq[1]))      /* recover after? */
930                          return(1);
931 <                if (atoi(vval(MBLUR))) {
883 <                        FILE    *fp;            /* motion blurring */
931 >                if (nblur > 1) {                /* with pmblur */
932                          sprintf(fname0, "%s/vw0%c", vval(DIRECTORY),
933                                          'a'+(iter%26));
886                        if ((fp = fopen(fname0, "w")) == NULL) {
887                                perror(fname0); quit(1);
888                        }
889                        fputs(VIEWSTR, fp);
890                        fprintview(vp, fp);
891                        putc('\n', fp); fclose(fp);
892                        if ((vp = getview(frame+1)) == NULL) {
893                                fprintf(stderr,
894                        "%s: unexpected error reading view for frame %d\n",
895                                                progname, frame+1);
896                                quit(1);
897                        }
934                          sprintf(fname1, "%s/vw1%c", vval(DIRECTORY),
935                                          'a'+(iter%26));
936 <                        if ((fp = fopen(fname1, "w")) == NULL) {
937 <                                perror(fname1); quit(1);
936 >                        if (!noaction) {
937 >                                FILE    *fp;            /* motion blurring */
938 >                                if ((fp = fopen(fname0, "w")) == NULL) {
939 >                                        perror(fname0); quit(1);
940 >                                }
941 >                                fputs(VIEWSTR, fp);
942 >                                fprintview(vp, fp);
943 >                                putc('\n', fp); fclose(fp);
944 >                                if ((vp = getview(frame+1)) == NULL) {
945 >                                        fprintf(stderr,
946 >                        "%s: unexpected error reading view for frame %d\n",
947 >                                                        progname, frame+1);
948 >                                        quit(1);
949 >                                }
950 >                                if ((fp = fopen(fname1, "w")) == NULL) {
951 >                                        perror(fname1); quit(1);
952 >                                }
953 >                                fputs(VIEWSTR, fp);
954 >                                fprintview(vp, fp);
955 >                                putc('\n', fp); fclose(fp);
956                          }
903                        fputs(VIEWSTR, fp);
904                        fprintview(vp, fp);
905                        putc('\n', fp); fclose(fp);
957                          sprintf(combuf,
958 <                        "(pmblur %s %d %s %s; rm -f %s %s) | pinterp -B",
959 <                        *sskip(vval(MBLUR)) ? sskip2(vval(MBLUR),1) : "1",
909 <                                        atoi(vval(MBLUR)),
958 >                        "(pmblur %.3f %d %s %s; rm -f %s %s) | pinterp -B -a",
959 >                                        blurf, nblur,
960                                          fname0, fname1, fname0, fname1);
961                          iter++;
962                  } else                          /* no blurring */
# Line 920 | Line 970 | int    rvr;
970                  if (usepfilt)
971                          sprintf(combuf+strlen(combuf), " %s", rresopt);
972                  else
973 <                        sprintf(combuf+strlen(combuf), " %s -e %s",
973 >                        sprintf(combuf+strlen(combuf), " -a %s -e %s",
974                                          fresopt, ep);
975                  sprintf(combuf+strlen(combuf), " %s.unf %s.zbf",
976                                  fnbefore, fnbefore);
# Line 981 | Line 1031 | int    n;
1031                          fclose(viewfp);
1032                          viewfp = NULL;
1033                          viewnum = 0;
1034 <                        copystruct(&curview, &stdview);
1034 >                        curview = stdview;
1035                  }
1036                  return(NULL);
1037          }
# Line 997 | Line 1047 | int    n;
1047                          perror(vval(VIEWFILE));
1048                          quit(1);
1049                  }
1050 <                copystruct(&curview, &stdview);
1050 >                curview = stdview;
1051                  viewnum = 0;
1052          }
1053          if (n < 0) {                            /* get next view */
# Line 1044 | Line 1094 | int    n;
1094          if (n == 0) {                           /* signal to close file */
1095                  if (expfp != NULL) {
1096                          fclose(expfp);
1097 <                        free((char *)exppos);
1097 >                        free((void *)exppos);
1098                          expfp = NULL;
1099                  }
1100                  return(NULL);
# Line 1249 | Line 1299 | int    maxcopies;
1299                          strcpy(com1=buf, com);  /* build -PP command */
1300                          sprintf(com1+(ppins-com), " -PP %s/%s.persist",
1301                                          vval(DIRECTORY), phostname(ps));
1302 +                        unlink(com1+(ppins-com)+5);
1303                          strcat(com1, ppins);
1304                  } else
1305                          com1 = com;
# Line 1309 | Line 1360 | rmfile(fn)                     /* remove a file */
1360   char    *fn;
1361   {
1362          if (!silent)
1363 < #ifdef MSDOS
1363 > #ifdef _WIN32
1364                  printf("\tdel %s\n", fn);
1365   #else
1366                  printf("\trm -f %s\n", fn);
# Line 1326 | Line 1377 | int    vc;
1377          fprintf(stderr, "%s: bad value for variable '%s'\n",
1378                          progname, vnam(vc));
1379          quit(1);
1380 + }
1381 +
1382 +
1383 + char *
1384 + dirfile(df, path)               /* separate path into directory and file */
1385 + char    *df;
1386 + register char   *path;
1387 + {
1388 +        register int    i;
1389 +        int     psep;
1390 +
1391 +        for (i = 0, psep = -1; path[i]; i++)
1392 +                if (path[i] == '/')
1393 +                        psep = i;
1394 +        if (df != NULL) {
1395 +                if (psep == 0) {
1396 +                        df[0] = '/';
1397 +                        df[1] = '\0';
1398 +                } else if (psep > 0) {
1399 +                        strncpy(df, path, psep);
1400 +                        df[psep] = '\0';
1401 +                } else
1402 +                        df[0] = '\0';
1403 +        }
1404 +        return(path+psep+1);
1405 + }
1406 +
1407 +
1408 + int
1409 + getblur(double *bf)             /* get # blur samples (and fraction) */
1410 + {
1411 +        double  blurf;
1412 +        int     nblur;
1413 +        char    *s;
1414 +
1415 +        if (!vdef(MBLUR)) {
1416 +                if (bf != NULL)
1417 +                        *bf = 0.0;
1418 +                return(0);
1419 +        }
1420 +        blurf = atof(vval(MBLUR));
1421 +        if (blurf < 0.0)
1422 +                blurf = 0.0;
1423 +        if (bf != NULL)
1424 +                *bf = blurf;
1425 +        if (blurf <= FTINY)
1426 +                return(0);
1427 +        s = sskip(vval(MBLUR));
1428 +        if (!*s)
1429 +                return(DEF_NBLUR);
1430 +        nblur = atoi(s);
1431 +        if (nblur <= 0)
1432 +                return(1);
1433 +        return(nblur);
1434   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines