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

Comparing ray/src/cv/ies2rad.c (file contents):
Revision 2.1 by greg, Tue Nov 12 17:02:02 1991 UTC vs.
Revision 2.5 by greg, Mon Feb 22 15:54:55 1993 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1990 Regents of the University of California */
1 > /* Copyright (c) 1992 Regents of the University of California */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
# Line 13 | Line 13 | static char SCCSid[] = "$SunId$ LBL";
13   #include <stdio.h>
14   #include <ctype.h>
15   #include "color.h"
16 + #include "paths.h"
17  
18   #define PI              3.14159265358979323846
19                                          /* floating comparisons */
# Line 35 | Line 36 | static char SCCSid[] = "$SunId$ LBL";
36                                          /* string lengths */
37   #define MAXLINE         132
38   #define MAXWORD         76
38 #define MAXPATH         128
39                                          /* file types */
40   #define T_RAD           ".rad"
41   #define T_DST           ".dat"
# Line 49 | Line 49 | static char SCCSid[] = "$SunId$ LBL";
49  
50   #define F_M             .3048           /* feet to meters */
51  
52 < #define abspath(p)      ((p)[0] == '/' || (p)[0] == '.')
52 > #define abspath(p)      (ISDIRSEP((p)[0]) || (p)[0] == '.')
53  
54   static char     default_name[] = "default";
55  
# Line 64 | Line 64 | float  defcolor[3] = {1.,1.,1.};       /* default lamp color
64   float   *lampcolor = defcolor;          /* pointer to current lamp color */
65   double  multiplier = 1.0;               /* multiplier for all light sources */
66   char    units[64] = "meters";           /* output units */
67 double  minaspect = 0.0;                /* minimum allowed aspect ratio */
68 int     maxemitters = 1;                /* maximum emitters per hemisphere */
67   double  illumrad = 0.0;                 /* radius for illum sphere */
68  
69   typedef struct {
# Line 79 | Line 77 | char   **gargv;                        /* global argv */
77  
78   extern char     *strcpy(), *strcat(), *stradd(), *tailtrunc(), *filetrunc(),
79                  *filename(), *libname(), *fullname(), *malloc();
82 extern double   atof();
80   extern float    *matchlamp();
81  
82  
# Line 157 | Line 154 | char   *argv[];
154                  case 'o':               /* output file name */
155                          outfile = argv[++i];
156                          break;
160                case 's':               /* square emitters */
161                        minaspect = .6;
162                        if (argv[i][2] == '/') {
163                                maxemitters = atoi(argv[i]+3);
164                                if (maxemitters < 1)
165                                        goto badopt;
166                        }
167                        break;
157                  case 'i':               /* illum */
158                          illumrad = atof(argv[++i]);
159                          if (illumrad < MINDIM)
# Line 285 | Line 274 | char   *path, *fname, *suffix;
274          else if (abspath(fname))
275                  strcpy(stradd(path, fname, 0), suffix);
276          else
277 <                libname(stradd(path, libdir, '/'), fname, suffix);
277 >                libname(stradd(path, libdir, DIRSEP), fname, suffix);
278  
279          return(path);
280   }
# Line 298 | Line 287 | char   *path, *fname, *suffix;
287          if (abspath(fname))
288                  strcpy(stradd(path, fname, 0), suffix);
289          else
290 <                strcpy(stradd(stradd(path, prefdir, '/'), fname, 0), suffix);
290 >                strcpy(stradd(stradd(path, prefdir, DIRSEP), fname, 0), suffix);
291  
292          return(path);
293   }
# Line 311 | Line 300 | register char  *path;
300          register char   *cp;
301  
302          for (cp = path; *path; path++)
303 <                if (*path == '/')
303 >                if (ISDIRSEP(*path))
304                          cp = path+1;
305          return(cp);
306   }
# Line 324 | Line 313 | char   *path;
313          register char   *p1, *p2;
314  
315          for (p1 = p2 = path; *p2; p2++)
316 <                if (*p2 == '/')
316 >                if (ISDIRSEP(*p2))
317                          p1 = p2;
318          *p1 = '\0';
319          return(path);
# Line 458 | Line 447 | char   *dir, *tltspec, *dfltname, *tltid;
447                  datin = in;
448                  strcpy(tltname, dfltname);
449          } else {
450 <                if (tltspec[0] == '/')
450 >                if (ISDIRSEP(tltspec[0]))
451                          strcpy(buf, tltspec);
452                  else
453 <                        strcpy(stradd(buf, dir, '/'), tltspec);
453 >                        strcpy(stradd(buf, dir, DIRSEP), tltspec);
454                  if ((datin = fopen(buf, "r")) == NULL) {
455                          perror(buf);
456                          return(-1);
# Line 619 | Line 608 | int    dolower, doupper;
608                          lampcolor[2]/shp->area);
609          if (doupper && dolower && shp->type != SPHERE && shp->h > MINDIM) {
610                  fprintf(fp, "\n%s glow %s_glow\n", mod, name);
611 <                fprintf(fp, "0\n0\n4 %g %g %g 0\n",
611 >                fprintf(fp, "0\n0\n4 %g %g %g -1\n",
612                                  lampcolor[0]/shp->area,
613                                  lampcolor[1]/shp->area,
614                                  lampcolor[2]/shp->area);
# Line 807 | Line 796 | FILE   *in, *out;
796   int     ndim, npts[];
797   double  mult, lim[][2];
798   {
799 <        register double *pt[4];
799 >        double  *pt[4];
800          register int    i, j;
801          double  val;
802          int     total;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines