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.113 by greg, Wed May 27 12:50:46 2015 UTC vs.
Revision 2.125 by greg, Tue Jun 7 16:53:19 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 401 | Line 402 | checkfiles(void)                       /* check for existence and modified
402                  atos(fntemp, sizeof(fntemp), vval(PCMAP));
403                  pcmapname = savqstr(fntemp);
404                  pcmapdate = fdate(pcmapname);
404                if (pgmapname == NULL && !nowarn)
405                        fprintf(stderr, "%s: warning - '%s' assigned without '%s'\n",
406                                        progname, vnam(PCMAP), vnam(PGMAP));
405          }
406          matdate = checklast(vval(MATERIAL));
407   }      
# Line 647 | 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 675 | 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 752 | Line 752 | mkpmapopts(                            /* get mkpmap options */
752   {
753          /* BEWARE:  This may be called via setdefaults(), so no assumptions */
754  
755 <        *mo = '\0';
755 >        if (nprocs > 1)
756 >                sprintf(mo, " -n %d", nprocs);
757 >        else
758 >                *mo = '\0';
759          if (!vdef(MKPMAP))
760                  return;
761          if (vval(MKPMAP)[0] != '-') {
# Line 806 | Line 809 | renderopts(                    /* set rendering options */
809   {
810          char    pmapf[256], *bw;
811  
812 +        if (vdef(PGMAP)) {
813 +                *op = '\0';
814 +                bw = sskip2(vval(PGMAP), 2);
815 +                atos(pmapf, sizeof(pmapf), vval(PGMAP));
816 +                op = addarg(addarg(op, "-ap"), pmapf);
817 +                if (atoi(bw) > 0) op = addarg(op, bw);
818 +        }
819          switch(vscale(QUALITY)) {
820          case LOW:
821                  lowqopts(op, po);
# Line 817 | Line 827 | renderopts(                    /* set rendering options */
827                  hiqopts(op, po);
828                  break;
829          }
820        if (vdef(PGMAP)) {
821                bw = sskip2(vval(PGMAP), 2);
822                atos(pmapf, sizeof(pmapf), vval(PGMAP));
823                op = addarg(addarg(op, "-ap"), pmapf);
824                if (atoi(bw) > 0) op = addarg(op, bw);
825        }
830          if (vdef(PCMAP)) {
831                  bw = sskip2(vval(PCMAP), 2);
832                  atos(pmapf, sizeof(pmapf), vval(PCMAP));
# Line 832 | Line 836 | renderopts(                    /* set rendering options */
836          if (vdef(RENDER))
837                  op = addarg(op, vval(RENDER));
838          if (rvdevice != NULL) {
839 <                if (vdef(RVU))
839 >                if (vdef(RVU)) {
840                          if (vval(RVU)[0] != '-') {
841                                  atos(c_rvu, sizeof(c_rvu), vval(RVU));
842                                  po = addarg(po, sskip2(vval(RVU), 1));
843                          } else
844                                  po = addarg(po, vval(RVU));
845 +                }
846          } else {
847 <                if (vdef(RPICT))
847 >                if (vdef(RPICT)) {
848                          if (vval(RPICT)[0] != '-') {
849                                  atos(c_rpict, sizeof(c_rpict), vval(RPICT));
850                                  po = addarg(po, sskip2(vval(RPICT), 1));
851                          } else
852                                  po = addarg(po, vval(RPICT));
853 +                }
854          }
855   }
856  
# Line 1071 | Line 1077 | hiqopts(                               /* high quality rendering options */
1077   }
1078  
1079  
1080 < #ifdef _WIN32
1080 > #if defined(_WIN32) || defined(_WIN64)
1081   static void
1082   setenv(                 /* set an environment variable */
1083          char    *vname,
# Line 1118 | Line 1124 | xferopts(                              /* transfer options if indicated */
1124                          syserr(vval(OPTFILE));
1125                  sprintf(ro, " @%s", vval(OPTFILE));
1126          }
1127 < #ifdef _WIN32
1127 > #if defined(_WIN32) || defined(_WIN64)
1128          else if (n > 50) {
1129                  setenv("ROPT", ro+1);
1130                  strcpy(ro, " $ROPT");
# Line 1145 | Line 1151 | pfiltopts(                             /* get pfilt options */
1151                  po = addarg(po, "-m .25");
1152                  break;
1153          }
1154 <        if (vdef(PFILT))
1154 >        if (vdef(PFILT)) {
1155                  if (vval(PFILT)[0] != '-') {
1156                          atos(c_pfilt, sizeof(c_pfilt), vval(PFILT));
1157                          po = addarg(po, sskip2(vval(PFILT), 1));
1158                  } else
1159                          po = addarg(po, vval(PFILT));
1160 +        }
1161   }
1162  
1163  
# Line 1295 | Line 1302 | specview(                              /* get proper view spec from vs */
1302          if (cp == viewopts)             /* append any additional options */
1303                  vs++;           /* skip prefixed space if unneeded */
1304          strcpy(cp, vs);
1305 < #ifdef _WIN32
1305 > #if defined(_WIN32) || defined(_WIN64)
1306          if (strlen(viewopts) > 40) {
1307                  setenv("VIEW", viewopts);
1308                  return("$VIEW");
# Line 1341 | Line 1348 | getview(                               /* get view n, or NULL if none */
1348          }
1349   numview:
1350          mv = nvalue(VIEWS, n);          /* use view n */
1351 <        if ((vn != NULL) & (mv != NULL))
1351 >        if ((vn != NULL) & (mv != NULL)) {
1352                  if (*mv != '-') {
1353                          char    *mv2 = mv;
1354                          while (*mv2 && !isspace(*mv2))
# Line 1349 | Line 1356 | numview:
1356                          *vn = '\0';
1357                  } else
1358                          sprintf(vn, "%d", n+1);
1359 <
1359 >        }
1360          return(specview(mv));
1361   }
1362  
# Line 1363 | Line 1370 | myprintview(                   /* print out selected view */
1370          VIEW    vwr;
1371          char    buf[128];
1372          char    *cp;
1373 < #ifdef _WIN32
1373 > #if defined(_WIN32) || defined(_WIN64)
1374   /* XXX Should we allow something like this for all platforms? */
1375   /* XXX Or is it still required at all? */
1376   again:
1377   #endif
1378          if (vopts == NULL)
1379                  return(-1);
1380 < #ifdef _WIN32
1380 > #if defined(_WIN32) || defined(_WIN64)
1381          if (vopts[0] == '$') {
1382                  vopts = getenv(vopts+1);
1383                  goto again;
# Line 1517 | Line 1524 | rpict(                         /* run rpict and pfilt for each view */
1524                                  fprintf(stderr, "%s: cannot create\n", pfile);
1525                                  quit(1);
1526                          }
1527 +                        pfile[-5] = '\0';
1528                          pfile = NULL;
1529                  }
1530          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines