| 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"; |
| 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 */ |
| 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" |
| 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 |
|
|
| 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 { |
| 77 |
|
|
| 78 |
|
extern char *strcpy(), *strcat(), *stradd(), *tailtrunc(), *filetrunc(), |
| 79 |
|
*filename(), *libname(), *fullname(), *malloc(); |
| 82 |
– |
extern double atof(); |
| 80 |
|
extern float *matchlamp(); |
| 81 |
|
|
| 82 |
|
|
| 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) |
| 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 |
|
} |
| 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 |
|
} |
| 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 |
|
} |
| 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); |
| 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); |
| 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; |