| 76 |
|
/* photometric types */ |
| 77 |
|
#define PM_C 1 |
| 78 |
|
#define PM_B 2 |
| 79 |
+ |
#define PM_A 3 |
| 80 |
|
/* unit types */ |
| 81 |
|
#define U_FEET 1 |
| 82 |
|
#define U_METERS 2 |
| 339 |
|
|
| 340 |
|
char * |
| 341 |
|
stradd( /* add a string at dst */ |
| 342 |
< |
register char *dst, |
| 343 |
< |
register char *src, |
| 342 |
> |
char *dst, |
| 343 |
> |
char *src, |
| 344 |
|
int sep |
| 345 |
|
) |
| 346 |
|
{ |
| 392 |
|
|
| 393 |
|
char * |
| 394 |
|
filename( /* get final component of pathname */ |
| 395 |
< |
register char *path |
| 395 |
> |
char *path |
| 396 |
|
) |
| 397 |
|
{ |
| 398 |
< |
register char *cp; |
| 398 |
> |
char *cp; |
| 399 |
|
|
| 400 |
|
for (cp = path; *path; path++) |
| 401 |
|
if (ISDIRSEP(*path)) |
| 409 |
|
char *path |
| 410 |
|
) |
| 411 |
|
{ |
| 412 |
< |
register char *p1, *p2; |
| 412 |
> |
char *p1, *p2; |
| 413 |
|
|
| 414 |
|
for (p1 = p2 = path; *p2; p2++) |
| 415 |
|
if (ISDIRSEP(*p2)) |
| 426 |
|
char *name |
| 427 |
|
) |
| 428 |
|
{ |
| 429 |
< |
register char *p1, *p2; |
| 429 |
> |
char *p1, *p2; |
| 430 |
|
|
| 431 |
|
for (p1 = filename(name); *p1 == '.'; p1++) |
| 432 |
|
; |
| 445 |
|
char *s |
| 446 |
|
) |
| 447 |
|
{ |
| 448 |
< |
register char *cp; |
| 448 |
> |
char *cp; |
| 449 |
|
|
| 450 |
|
for (cp = s; *cp; cp++) |
| 451 |
|
; |
| 457 |
|
|
| 458 |
|
int |
| 459 |
|
k_match( /* header line matches keyword? */ |
| 460 |
< |
register char *kwd, |
| 461 |
< |
register char *hdl |
| 460 |
> |
char *kwd, |
| 461 |
> |
char *hdl |
| 462 |
|
) |
| 463 |
|
{ |
| 464 |
< |
if (!*hdl++ == '[') |
| 464 |
> |
if (*hdl++ != '[') |
| 465 |
|
return(0); |
| 466 |
|
while (islower(*hdl) ? toupper(*hdl) == *kwd++ : *hdl == *kwd++) |
| 467 |
|
if (!*hdl++) |
| 472 |
|
|
| 473 |
|
char * |
| 474 |
|
keyargs( /* return keyword arguments */ |
| 475 |
< |
register char *hdl |
| 475 |
> |
char *hdl |
| 476 |
|
) |
| 477 |
|
{ |
| 478 |
|
while (*hdl && *hdl++ != ']') |
| 488 |
|
FILE *out |
| 489 |
|
) |
| 490 |
|
{ |
| 491 |
< |
register int i; |
| 491 |
> |
int i; |
| 492 |
|
|
| 493 |
|
putc('#', out); |
| 494 |
|
for (i = 0; i < gargc; i++) { |
| 700 |
|
fprintf(stderr, "dosource: bad lamp specification\n"); |
| 701 |
|
return(-1); |
| 702 |
|
} |
| 703 |
+ |
if (pmtype != PM_C && pmtype != PM_B) { |
| 704 |
+ |
fprintf(stderr, "dosource: unsupported photometric type (%d)\n", |
| 705 |
+ |
pmtype); |
| 706 |
+ |
return(-1); |
| 707 |
+ |
} |
| 708 |
|
sinf->mult = multiplier*mult*bfactor*pfactor; |
| 709 |
|
if (nangles[0] < 2 || nangles[1] < 1) { |
| 710 |
|
fprintf(stderr, "dosource: too few measured angles\n"); |
| 756 |
|
else |
| 757 |
|
fprintf(out, "srcB_horiz "); |
| 758 |
|
fprintf(out, "srcB_vert "); |
| 759 |
< |
} else /* pmtype == PM_A */ { |
| 759 |
> |
} else /* pmtype == PM_C */ { |
| 760 |
|
if (nangles[1] >= 2) { |
| 761 |
|
d1 = bounds[1][1] - bounds[1][0]; |
| 762 |
|
if (d1 <= 90.+FTINY) |
| 834 |
|
|
| 835 |
|
int |
| 836 |
|
makeshape( /* make source shape */ |
| 837 |
< |
register SRCINFO *shp, |
| 837 |
> |
SRCINFO *shp, |
| 838 |
|
double width, |
| 839 |
|
double length, |
| 840 |
|
double height |
| 903 |
|
|
| 904 |
|
void |
| 905 |
|
putsides( /* put out sides of box */ |
| 906 |
< |
register SRCINFO *shp, |
| 906 |
> |
SRCINFO *shp, |
| 907 |
|
FILE *fp, |
| 908 |
|
char *mod, |
| 909 |
|
char *name |
| 939 |
|
|
| 940 |
|
void |
| 941 |
|
putpoint( /* put out a point */ |
| 942 |
< |
register SRCINFO *shp, |
| 942 |
> |
SRCINFO *shp, |
| 943 |
|
FILE *fp, |
| 944 |
|
int p |
| 945 |
|
) |
| 955 |
|
|
| 956 |
|
void |
| 957 |
|
putdisksrc( /* put out a disk source */ |
| 958 |
< |
register SRCINFO *shp, |
| 958 |
> |
SRCINFO *shp, |
| 959 |
|
FILE *fp, |
| 960 |
|
char *mod, |
| 961 |
|
char *name, |
| 980 |
|
|
| 981 |
|
void |
| 982 |
|
putcyl( /* put out a cylinder */ |
| 983 |
< |
register SRCINFO *shp, |
| 983 |
> |
SRCINFO *shp, |
| 984 |
|
FILE *fp, |
| 985 |
|
char *mod, |
| 986 |
|
char *name |
| 1018 |
|
) |
| 1019 |
|
{ |
| 1020 |
|
double *pt[4]; |
| 1021 |
< |
register int i, j; |
| 1021 |
> |
int i, j; |
| 1022 |
|
double val; |
| 1023 |
|
int total; |
| 1024 |
|
|
| 1076 |
|
|
| 1077 |
|
char * |
| 1078 |
|
getword( /* scan a word from fp */ |
| 1079 |
< |
register FILE *fp |
| 1079 |
> |
FILE *fp |
| 1080 |
|
) |
| 1081 |
|
{ |
| 1082 |
|
static char wrd[RMAXWORD]; |
| 1083 |
< |
register char *cp; |
| 1084 |
< |
register int c; |
| 1083 |
> |
char *cp; |
| 1084 |
> |
int c; |
| 1085 |
|
|
| 1086 |
|
while (isspace(c=getc(fp))) |
| 1087 |
|
; |
| 1129 |
|
int |
| 1130 |
|
cvgeometry( |
| 1131 |
|
char *inpname, |
| 1132 |
< |
register SRCINFO *sinf, |
| 1132 |
> |
SRCINFO *sinf, |
| 1133 |
|
char *outname, |
| 1134 |
|
FILE *outfp /* close output file upon return */ |
| 1135 |
|
) |
| 1136 |
|
{ |
| 1137 |
|
char buf[256]; |
| 1138 |
< |
register char *cp; |
| 1138 |
> |
char *cp; |
| 1139 |
|
|
| 1140 |
|
if (inpname == NULL || !inpname[0]) { /* no geometry file */ |
| 1141 |
|
fclose(outfp); |
| 1145 |
|
strcpy(buf, "mgf2rad "); /* build mgf2rad command */ |
| 1146 |
|
cp = buf+8; |
| 1147 |
|
if (!FEQ(sinf->mult, 1.0)) { |
| 1148 |
< |
sprintf(cp, "-m %f ", sinf->mult); |
| 1148 |
> |
sprintf(cp, "-e %f ", sinf->mult); |
| 1149 |
|
cp += strlen(cp); |
| 1150 |
|
} |
| 1151 |
|
sprintf(cp, "-g %f %s ", |