| 96 |
|
|
| 97 |
|
PARAMS curparams; |
| 98 |
|
char curmod[128]; |
| 99 |
+ |
char newparams[1024]; |
| 100 |
|
|
| 101 |
|
typedef int SURFSAMP(FVECT, SURF *, double); |
| 102 |
|
|
| 110 |
|
static void |
| 111 |
|
clear_params(PARAMS *p, int reset_only) |
| 112 |
|
{ |
| 112 |
– |
curmod[0] = '\0'; |
| 113 |
|
while (p->slist != NULL) { |
| 114 |
|
SURF *sdel = p->slist; |
| 115 |
|
p->slist = sdel->next; |
| 124 |
|
p->outfn = NULL; |
| 125 |
|
return; |
| 126 |
|
} |
| 127 |
< |
memset(p, 0, sizeof(curparams)); |
| 127 |
> |
memset(p, 0, sizeof(PARAMS)); |
| 128 |
|
} |
| 129 |
|
|
| 130 |
|
/* Get surface type from name */ |
| 309 |
|
|
| 310 |
|
/* Parse program parameters (directives) */ |
| 311 |
|
static int |
| 312 |
< |
parse_params(char *pargs) |
| 312 |
> |
parse_params(PARAMS *p, char *pargs) |
| 313 |
|
{ |
| 314 |
|
char *cp = pargs; |
| 315 |
|
int nparams = 0; |
| 320 |
|
case 'h': |
| 321 |
|
if (*cp++ != '=') |
| 322 |
|
break; |
| 323 |
< |
curparams.hsiz = 0; |
| 323 |
> |
p->hsiz = 0; |
| 324 |
|
i = 0; |
| 325 |
|
while (*cp && !isspace(*cp)) { |
| 326 |
|
if (isdigit(*cp)) |
| 327 |
< |
curparams.hsiz = 10*curparams.hsiz + |
| 328 |
< |
*cp - '0'; |
| 329 |
< |
curparams.hemis[i++] = *cp++; |
| 327 |
> |
p->hsiz = 10*p->hsiz + *cp - '0'; |
| 328 |
> |
p->hemis[i++] = *cp++; |
| 329 |
|
} |
| 330 |
|
if (!i) |
| 331 |
|
break; |
| 332 |
< |
curparams.hemis[i] = '\0'; |
| 333 |
< |
curparams.hsiz += !curparams.hsiz; |
| 332 |
> |
p->hemis[i] = '\0'; |
| 333 |
> |
p->hsiz += !p->hsiz; |
| 334 |
|
++nparams; |
| 335 |
|
continue; |
| 336 |
|
case 'u': |
| 337 |
|
if (*cp++ != '=') |
| 338 |
|
break; |
| 339 |
< |
if (!get_direction(curparams.vup, cp)) |
| 339 |
> |
if (!get_direction(p->vup, cp)) |
| 340 |
|
break; |
| 341 |
|
++nparams; |
| 342 |
|
continue; |
| 349 |
|
if (!i) |
| 350 |
|
break; |
| 351 |
|
*--cp = '\0'; |
| 352 |
< |
curparams.outfn = savqstr(cp-i); |
| 352 |
> |
p->outfn = savqstr(cp-i); |
| 353 |
|
*cp++ = ' '; |
| 354 |
|
++nparams; |
| 355 |
|
continue; |
| 553 |
|
sp->priv = (void *)uva; |
| 554 |
|
} |
| 555 |
|
SDmultiSamp(samp2, 2, x); |
| 556 |
< |
samp2[0] = sp->farg[6] + sqrt(samp2[0]*sp->area*(1./PI)); |
| 556 |
> |
samp2[0] = sqrt(samp2[0]*sp->area*(1./PI) + sp->farg[6]*sp->farg[6]); |
| 557 |
|
samp2[1] *= 2.*PI; |
| 558 |
|
uv[0] = samp2[0]*tcos(samp2[1]); |
| 559 |
|
uv[1] = samp2[0]*tsin(samp2[1]); |
| 1043 |
|
finish_receiver(); |
| 1044 |
|
clear_params(&curparams, 1); |
| 1045 |
|
} |
| 1046 |
+ |
parse_params(&curparams, newparams); |
| 1047 |
+ |
newparams[0] = '\0'; |
| 1048 |
|
strcpy(curmod, thismod); |
| 1049 |
|
} |
| 1050 |
|
add_surface(st, oname, fp); /* read & store surface */ |
| 1081 |
|
fputs(": cannot use source as a sender!\n", stderr); |
| 1082 |
|
return(-1); |
| 1083 |
|
} |
| 1084 |
+ |
parse_params(&curparams, newparams); |
| 1085 |
+ |
newparams[0] = '\0'; |
| 1086 |
|
add_surface(st, oname, fp); /* read & store surface */ |
| 1087 |
|
return(0); |
| 1088 |
|
} |
| 1131 |
|
if (!isspace(c) && fscanf(fp, "%s", inpbuf) == 1 && |
| 1132 |
|
!strcmp(inpbuf, PARAMSTART)) { |
| 1133 |
|
if (fgets(inpbuf, sizeof(inpbuf), fp) != NULL) |
| 1134 |
< |
parse_params(inpbuf); |
| 1134 |
> |
strcat(newparams, inpbuf); |
| 1135 |
|
continue; |
| 1136 |
|
} |
| 1137 |
|
while ((c = getc(fp)) != EOF && c != '\n'); |
| 1183 |
|
case 'f': |
| 1184 |
|
case 'd': |
| 1185 |
|
case 'c': |
| 1186 |
< |
if (!(fmtopt[4] = argv[a][3])) |
| 1187 |
< |
fmtopt[4] = argv[a][2]; |
| 1188 |
< |
fmtopt[3] = argv[a][2]; |
| 1186 |
> |
if (!(fmtopt[3] = argv[a][3])) |
| 1187 |
> |
fmtopt[3] = argv[a][2]; |
| 1188 |
> |
fmtopt[2] = argv[a][2]; |
| 1189 |
|
na = 0; |
| 1190 |
|
continue; /* will pass later */ |
| 1191 |
|
default: |
| 1201 |
|
na = 0; |
| 1202 |
|
continue; |
| 1203 |
|
case 'c': /* number of samples */ |
| 1204 |
< |
sampcnt = atoi(argv[a+1]); |
| 1204 |
> |
sampcnt = atoi(argv[++a]); |
| 1205 |
|
if (sampcnt <= 0) |
| 1206 |
|
goto userr; |
| 1207 |
|
na = 0; /* we re-add this later */ |
| 1273 |
|
} |
| 1274 |
|
if (sampcnt <= 0) sampcnt = 1; |
| 1275 |
|
} else { /* else FVECT determines input format */ |
| 1276 |
< |
fmtopt[3] = (sizeof(RREAL)==sizeof(double)) ? 'd' : 'f'; |
| 1276 |
> |
fmtopt[2] = (sizeof(RREAL)==sizeof(double)) ? 'd' : 'f'; |
| 1277 |
|
if (sampcnt <= 0) sampcnt = 10000; |
| 1278 |
|
} |
| 1279 |
|
sprintf(sampcntbuf, "%d", sampcnt); |