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

Comparing ray/src/util/wrapBSDF.c (file contents):
Revision 2.17 by greg, Tue Feb 2 18:02:32 2016 UTC vs.
Revision 2.20 by schorsch, Sun Mar 6 01:13:18 2016 UTC

# Line 7 | Line 7 | static const char RCSid[] = "$Id$";
7   *      G. Ward         February 2015
8   */
9  
10 + #include "platform.h"
11   #include <ctype.h>
12   #include "rtio.h"
13   #include "paths.h"
# Line 82 | Line 83 | struct s_dfile {
83  
84   int             ndataf = 0;             /* number of data files */
85  
86 + int             unlink_datafiles = 0;   /* unlink data files when done */
87 +
88   const char      *spectr_file[MAXFILES]; /* custom spectral curve input */
89  
90   const char      top_level_name[] = "WindowElement";
# Line 163 | Line 166 | input2str(const char *inpspec)
166                          fprintf(stderr, "%s: cannot open\n", inpspec);
167                          return "";
168                  }
169 < #ifndef _WIN32                          /* XXX somehow broken on Windows */
169 > #if !defined(_WIN32) && !defined(_WIN64)
170 >                                /* XXX somehow broken on Windows */
171                  len = lseek(fd, 0L, SEEK_END);
172                  if (len > 0) {
173                          lseek(fd, 0L, SEEK_SET);
# Line 604 | Line 608 | writeBSDF(const char *caller, ezxml_t fl)
608          fputs(xml+ei, stdout);                  /* write trailer */
609          free(xml);                              /* free string */
610          fputc('\n', stdout);
611 <        return (fflush(stdout) == 0);
611 >        if (fflush(stdout) != 0)
612 >                return 0;
613 >                                                /* unlink data files if req. */
614 >        for (i = ndataf*(unlink_datafiles != 0); i--; )
615 >                if (data_file[i].fname != stdin_name &&
616 >                                data_file[i].fname[0] != '!')
617 >                        unlink(data_file[i].fname);
618 >        if (unlink_datafiles > 1 && mgf_geometry != NULL &&
619 >                        mgf_geometry != stdin_name &&
620 >                        mgf_geometry[0] != '!')
621 >                unlink(mgf_geometry);
622 >        return 1;
623   }
624  
625   /* Insert BSDF data into XML wrapper */
# Line 767 | Line 782 | main(int argc, char *argv[])
782                                  return 1;
783                          }
784                          attr_unit = argv[i];
785 +                        continue;
786 +                case 'U':               /* unlink data files when done */
787 +                        unlink_datafiles = 1 + (argv[i][2] == 'U');
788                          continue;
789                  case 'a':               /* angle basis */
790                          if (++i >= argc)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines