23 |
|
#endif |
24 |
|
|
25 |
|
#ifdef _WIN32 |
26 |
< |
#define SPECIALS " \t$*?" |
26 |
> |
#define SPECIALS " \t\"$*?" |
27 |
|
#define QUOTCHAR '"' |
28 |
|
#else |
29 |
< |
#define SPECIALS " \t\n'\"()${}*?[]" |
29 |
> |
#define SPECIALS " \t\n'\"()${}*?[];|&" |
30 |
|
#define QUOTCHAR '\'' |
31 |
|
#define ALTQUOT '"' |
32 |
|
#endif |
45 |
|
#define CHECKARGC(n) if (nrcargs >= MAXRCARG-(n)) \ |
46 |
|
{ fprintf(stderr, overflowerr, progname); exit(1); } |
47 |
|
|
48 |
< |
int sampcnt = 0; /* sample count (unset) */ |
48 |
> |
int sampcnt = 0; /* sample count (0==unset) */ |
49 |
|
|
50 |
< |
char *reinhfn = "reinhart.cal"; |
51 |
< |
char *shirchufn = "disk2square.cal"; |
50 |
> |
char *reinhfn = "reinhartb.cal"; |
51 |
> |
char *shirchiufn = "disk2square.cal"; |
52 |
|
char *kfullfn = "klems_full.cal"; |
53 |
|
char *khalffn = "klems_half.cal"; |
54 |
|
char *kquarterfn = "klems_quarter.cal"; |
68 |
|
FVECT snrm; /* surface normal */ |
69 |
|
double area; /* surface area (or solid angle) */ |
70 |
|
short styp; /* surface type */ |
71 |
< |
short nfargs; /* number of arguments */ |
72 |
< |
double farg[1]; /* arguments (extends struct) */ |
71 |
> |
short nfargs; /* number of real arguments */ |
72 |
> |
double farg[1]; /* real values (extends struct) */ |
73 |
|
} SURF; /* surface structure */ |
74 |
|
|
75 |
|
typedef struct { |
372 |
|
static void |
373 |
|
finish_receiver(void) |
374 |
|
{ |
375 |
< |
char binbuf[128]; |
375 |
> |
char *calfn = NULL; |
376 |
> |
char *binv = NULL; |
377 |
> |
char *binf = NULL; |
378 |
> |
char *nbins = NULL; |
379 |
> |
char sbuf[256]; |
380 |
|
|
381 |
|
if (!curmod[0]) { |
382 |
|
fputs(progname, stderr); |
405 |
|
else |
406 |
|
curparams.vup[1] = 1; |
407 |
|
if (tolower(curparams.hemis[0]) == 'u' | curparams.hemis[0] == '1') { |
408 |
< |
CHECKARGC(2); |
405 |
< |
rcarg[nrcargs++] = "-b"; |
406 |
< |
rcarg[nrcargs++] = "0"; |
408 |
> |
binv = "0"; |
409 |
|
} else if (tolower(curparams.hemis[0]) == 's' && |
410 |
|
tolower(curparams.hemis[1]) == 'c') { |
411 |
< |
if (shirchufn != NULL) { |
410 |
< |
CHECKARGC(2); |
411 |
< |
rcarg[nrcargs++] = "-f"; |
412 |
< |
rcarg[nrcargs++] = shirchufn; |
413 |
< |
shirchufn = NULL; |
414 |
< |
} |
415 |
< |
fputs("Shirley-Chiu unimplemented...\n",stderr); exit(1); |
411 |
> |
/* assign parameters */ |
412 |
|
if (curparams.hsiz <= 1) { |
413 |
|
fputs(progname, stderr); |
414 |
|
fputs(": missing size for Shirley-Chiu sampling!\n", stderr); |
415 |
|
exit(1); |
416 |
|
} |
417 |
+ |
sprintf(sbuf, "SCdim=%d,Nx=%g,Ny=%g,Nz=%g,Ux=%g,Uy=%g,Uz=%g", |
418 |
+ |
curparams.hsiz, |
419 |
+ |
curparams.nrm[0], curparams.nrm[1], curparams.nrm[2], |
420 |
+ |
curparams.vup[0], curparams.vup[1], curparams.vup[2]); |
421 |
+ |
CHECKARGC(2); |
422 |
+ |
rcarg[nrcargs++] = "-p"; |
423 |
+ |
rcarg[nrcargs++] = savqstr(sbuf); |
424 |
+ |
calfn = shirchiufn; shirchiufn = NULL; |
425 |
+ |
binv = "scbin"; |
426 |
+ |
nbins = "SCdim*SCdim"; |
427 |
|
} else if ((tolower(curparams.hemis[0]) == 'r') | |
428 |
|
(tolower(curparams.hemis[0]) == 't')) { |
429 |
< |
if (reinhfn != NULL) { |
430 |
< |
CHECKARGC(2); |
431 |
< |
rcarg[nrcargs++] = "-f"; |
432 |
< |
rcarg[nrcargs++] = reinhfn; |
427 |
< |
reinhfn = NULL; |
428 |
< |
} |
429 |
< |
fputs("Reinhart/Tregenza unimplemented...\n",stderr); exit(1); |
429 |
> |
calfn = reinhfn; reinhfn = NULL; |
430 |
> |
/* XXX Need to set number of divisions */ |
431 |
> |
binf = "rhbin"; |
432 |
> |
nbins = "Nrhbins"; |
433 |
|
} else if (tolower(curparams.hemis[0]) == 'k' && |
434 |
|
!curparams.hemis[1] | |
435 |
|
(tolower(curparams.hemis[1]) == 'f') | |
436 |
|
(curparams.hemis[1] == '1')) { |
437 |
< |
if (kfullfn != NULL) { |
438 |
< |
CHECKARGC(2); |
439 |
< |
rcarg[nrcargs++] = "-f"; |
437 |
< |
rcarg[nrcargs++] = kfullfn; |
438 |
< |
kfullfn = NULL; |
439 |
< |
} |
440 |
< |
CHECKARGC(4); |
441 |
< |
sprintf(binbuf, "kbin(%g,%g,%g,%g,%g,%g)", |
442 |
< |
curparams.nrm[0], curparams.nrm[1], curparams.nrm[2], |
443 |
< |
curparams.vup[0], curparams.vup[1], curparams.vup[2]); |
444 |
< |
rcarg[nrcargs++] = "-b"; |
445 |
< |
rcarg[nrcargs++] = savqstr(binbuf); |
446 |
< |
rcarg[nrcargs++] = "-bn"; |
447 |
< |
rcarg[nrcargs++] = "Nkbins"; |
437 |
> |
calfn = kfullfn; kfullfn = NULL; |
438 |
> |
binf = "kbin"; |
439 |
> |
nbins = "Nkbins"; |
440 |
|
} else if (tolower(curparams.hemis[0]) == 'k' && |
441 |
|
(tolower(curparams.hemis[1]) == 'h') | |
442 |
|
(curparams.hemis[1] == '2')) { |
443 |
< |
if (khalffn != NULL) { |
444 |
< |
CHECKARGC(2); |
445 |
< |
rcarg[nrcargs++] = "-f"; |
454 |
< |
rcarg[nrcargs++] = khalffn; |
455 |
< |
khalffn = NULL; |
456 |
< |
} |
457 |
< |
CHECKARGC(4); |
458 |
< |
sprintf(binbuf, "khbin(%g,%g,%g,%g,%g,%g)", |
459 |
< |
curparams.nrm[0], curparams.nrm[1], curparams.nrm[2], |
460 |
< |
curparams.vup[0], curparams.vup[1], curparams.vup[2]); |
461 |
< |
rcarg[nrcargs++] = "-b"; |
462 |
< |
rcarg[nrcargs++] = savqstr(binbuf); |
463 |
< |
rcarg[nrcargs++] = "-bn"; |
464 |
< |
rcarg[nrcargs++] = "Nkhbins"; |
443 |
> |
calfn = khalffn; khalffn = NULL; |
444 |
> |
binf = "khbin"; |
445 |
> |
nbins = "Nkhbins"; |
446 |
|
} else if (tolower(curparams.hemis[0]) == 'k' && |
447 |
|
(tolower(curparams.hemis[1]) == 'q') | |
448 |
|
(curparams.hemis[1] == '4')) { |
449 |
< |
if (kquarterfn != NULL) { |
450 |
< |
CHECKARGC(2); |
451 |
< |
rcarg[nrcargs++] = "-f"; |
471 |
< |
rcarg[nrcargs++] = kquarterfn; |
472 |
< |
kquarterfn = NULL; |
473 |
< |
} |
474 |
< |
CHECKARGC(4); |
475 |
< |
sprintf(binbuf, "kqbin(%g,%g,%g,%g,%g,%g)", |
476 |
< |
curparams.nrm[0], curparams.nrm[1], curparams.nrm[2], |
477 |
< |
curparams.vup[0], curparams.vup[1], curparams.vup[2]); |
478 |
< |
rcarg[nrcargs++] = "-b"; |
479 |
< |
rcarg[nrcargs++] = savqstr(binbuf); |
480 |
< |
rcarg[nrcargs++] = "-bn"; |
481 |
< |
rcarg[nrcargs++] = "Nkqbins"; |
449 |
> |
calfn = kquarterfn; kquarterfn = NULL; |
450 |
> |
binf = "kqbin"; |
451 |
> |
nbins = "Nkqbins"; |
452 |
|
} else { |
453 |
|
fprintf(stderr, "%s: unrecognized hemisphere sampling: h=%s\n", |
454 |
|
progname, curparams.hemis); |
455 |
|
exit(1); |
456 |
|
} |
457 |
< |
CHECKARGC(2); /* modifier argument goes last */ |
457 |
> |
if (calfn != NULL) { /* add cal file if needed */ |
458 |
> |
CHECKARGC(2); |
459 |
> |
rcarg[nrcargs++] = "-f"; |
460 |
> |
rcarg[nrcargs++] = calfn; |
461 |
> |
} |
462 |
> |
if (nbins != NULL) { /* add #bins if set */ |
463 |
> |
CHECKARGC(2); |
464 |
> |
rcarg[nrcargs++] = "-bn"; |
465 |
> |
rcarg[nrcargs++] = nbins; |
466 |
> |
} |
467 |
> |
if (binfv != NULL) { |
468 |
> |
CHECKARGC(2); /* assign bin variable */ |
469 |
> |
rcarg[nrcargs++] = "-b"; |
470 |
> |
rcarg[nrcargs++] = binv; |
471 |
> |
} else if (binf != NULL) { |
472 |
> |
CHECKARGC(2); /* assign bin function */ |
473 |
> |
sprintf(sbuf, "%s(%g,%g,%g,%g,%g,%g)", binf, |
474 |
> |
curparams.nrm[0], curparams.nrm[1], curparams.nrm[2], |
475 |
> |
curparams.vup[0], curparams.vup[1], curparams.vup[2]); |
476 |
> |
rcarg[nrcargs++] = "-b"; |
477 |
> |
rcarg[nrcargs++] = savqstr(sbuf); |
478 |
> |
} |
479 |
> |
CHECKARGC(2); /* modifier argument goes last */ |
480 |
|
rcarg[nrcargs++] = "-m"; |
481 |
|
rcarg[nrcargs++] = savqstr(curmod); |
482 |
|
} |