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

Comparing ray/src/util/rad.c (file contents):
Revision 2.114 by greg, Wed May 27 13:29:57 2015 UTC vs.
Revision 2.124 by schorsch, Sun Mar 6 01:13:18 2016 UTC

# Line 9 | Line 9 | static const char      RCSid[] = "$Id$";
9  
10   #include <ctype.h>
11   #include <time.h>
12 + #include <signal.h>
13  
14   #include "platform.h"
15   #include "rtprocess.h"
# Line 16 | Line 17 | static const char      RCSid[] = "$Id$";
17   #include "paths.h"
18   #include "vars.h"
19  
20 < #ifdef _WIN32
20 > #if defined(_WIN32) || defined(_WIN64)
21    #define DELCMD "del"
22    #define RENAMECMD "rename"
23   #else
# Line 644 | Line 645 | mkpmap(void)                   /* run mkpmap if indicated */
645                  for (cp = combuf; *cp; cp++)
646                          ;
647                  mkpmapopts(cp);
648 +                                /* force file overwrite */
649 +                cp = addarg(cp, "-fo+");
650                  if (vdef(REPORT)) {
651                          char    errfile[256];
652                          int     n;
# Line 672 | Line 675 | mkpmap(void)                   /* run mkpmap if indicated */
675                  if (runcom(combuf)) {
676                          fprintf(stderr, "%s: error running %s\n",
677                                          progname, c_mkpmap);
678 <                        if (pgmapname != NULL)
678 >                        if (pgmapname != NULL && pgmapdate < oct1date)
679                                  unlink(pgmapname);
680 <                        if (pcmapname != NULL)
680 >                        if (pcmapname != NULL && pcmapdate < oct1date)
681                                  unlink(pcmapname);
682                          quit(1);
683                  }
# Line 803 | Line 806 | renderopts(                    /* set rendering options */
806   {
807          char    pmapf[256], *bw;
808  
809 +        if (vdef(PGMAP)) {
810 +                *op = '\0';
811 +                bw = sskip2(vval(PGMAP), 2);
812 +                atos(pmapf, sizeof(pmapf), vval(PGMAP));
813 +                op = addarg(addarg(op, "-ap"), pmapf);
814 +                if (atoi(bw) > 0) op = addarg(op, bw);
815 +        }
816          switch(vscale(QUALITY)) {
817          case LOW:
818                  lowqopts(op, po);
# Line 814 | Line 824 | renderopts(                    /* set rendering options */
824                  hiqopts(op, po);
825                  break;
826          }
817        if (vdef(PGMAP)) {
818                bw = sskip2(vval(PGMAP), 2);
819                atos(pmapf, sizeof(pmapf), vval(PGMAP));
820                op = addarg(addarg(op, "-ap"), pmapf);
821                if (atoi(bw) > 0) op = addarg(op, bw);
822        }
827          if (vdef(PCMAP)) {
828                  bw = sskip2(vval(PCMAP), 2);
829                  atos(pmapf, sizeof(pmapf), vval(PCMAP));
# Line 829 | Line 833 | renderopts(                    /* set rendering options */
833          if (vdef(RENDER))
834                  op = addarg(op, vval(RENDER));
835          if (rvdevice != NULL) {
836 <                if (vdef(RVU))
836 >                if (vdef(RVU)) {
837                          if (vval(RVU)[0] != '-') {
838                                  atos(c_rvu, sizeof(c_rvu), vval(RVU));
839                                  po = addarg(po, sskip2(vval(RVU), 1));
840                          } else
841                                  po = addarg(po, vval(RVU));
842 +                }
843          } else {
844 <                if (vdef(RPICT))
844 >                if (vdef(RPICT)) {
845                          if (vval(RPICT)[0] != '-') {
846                                  atos(c_rpict, sizeof(c_rpict), vval(RPICT));
847                                  po = addarg(po, sskip2(vval(RPICT), 1));
848                          } else
849                                  po = addarg(po, vval(RPICT));
850 +                }
851          }
852   }
853  
# Line 1068 | Line 1074 | hiqopts(                               /* high quality rendering options */
1074   }
1075  
1076  
1077 < #ifdef _WIN32
1077 > #if defined(_WIN32) || defined(_WIN64)
1078   static void
1079   setenv(                 /* set an environment variable */
1080          char    *vname,
# Line 1115 | Line 1121 | xferopts(                              /* transfer options if indicated */
1121                          syserr(vval(OPTFILE));
1122                  sprintf(ro, " @%s", vval(OPTFILE));
1123          }
1124 < #ifdef _WIN32
1124 > #if defined(_WIN32) || defined(_WIN64)
1125          else if (n > 50) {
1126                  setenv("ROPT", ro+1);
1127                  strcpy(ro, " $ROPT");
# Line 1142 | Line 1148 | pfiltopts(                             /* get pfilt options */
1148                  po = addarg(po, "-m .25");
1149                  break;
1150          }
1151 <        if (vdef(PFILT))
1151 >        if (vdef(PFILT)) {
1152                  if (vval(PFILT)[0] != '-') {
1153                          atos(c_pfilt, sizeof(c_pfilt), vval(PFILT));
1154                          po = addarg(po, sskip2(vval(PFILT), 1));
1155                  } else
1156                          po = addarg(po, vval(PFILT));
1157 +        }
1158   }
1159  
1160  
# Line 1292 | Line 1299 | specview(                              /* get proper view spec from vs */
1299          if (cp == viewopts)             /* append any additional options */
1300                  vs++;           /* skip prefixed space if unneeded */
1301          strcpy(cp, vs);
1302 < #ifdef _WIN32
1302 > #if defined(_WIN32) || defined(_WIN64)
1303          if (strlen(viewopts) > 40) {
1304                  setenv("VIEW", viewopts);
1305                  return("$VIEW");
# Line 1338 | Line 1345 | getview(                               /* get view n, or NULL if none */
1345          }
1346   numview:
1347          mv = nvalue(VIEWS, n);          /* use view n */
1348 <        if ((vn != NULL) & (mv != NULL))
1348 >        if ((vn != NULL) & (mv != NULL)) {
1349                  if (*mv != '-') {
1350                          char    *mv2 = mv;
1351                          while (*mv2 && !isspace(*mv2))
# Line 1346 | Line 1353 | numview:
1353                          *vn = '\0';
1354                  } else
1355                          sprintf(vn, "%d", n+1);
1356 <
1356 >        }
1357          return(specview(mv));
1358   }
1359  
# Line 1360 | Line 1367 | myprintview(                   /* print out selected view */
1367          VIEW    vwr;
1368          char    buf[128];
1369          char    *cp;
1370 < #ifdef _WIN32
1370 > #if defined(_WIN32) || defined(_WIN64)
1371   /* XXX Should we allow something like this for all platforms? */
1372   /* XXX Or is it still required at all? */
1373   again:
1374   #endif
1375          if (vopts == NULL)
1376                  return(-1);
1377 < #ifdef _WIN32
1377 > #if defined(_WIN32) || defined(_WIN64)
1378          if (vopts[0] == '$') {
1379                  vopts = getenv(vopts+1);
1380                  goto again;
# Line 1514 | Line 1521 | rpict(                         /* run rpict and pfilt for each view */
1521                                  fprintf(stderr, "%s: cannot create\n", pfile);
1522                                  quit(1);
1523                          }
1524 +                        pfile[-5] = '\0';
1525                          pfile = NULL;
1526                  }
1527          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines