65 |
|
|
66 |
|
/* Set parameters for current evaluation */ |
67 |
|
void |
68 |
< |
set_eparams(char *prms) |
68 |
> |
set_eparams(const char *prms) |
69 |
|
{ |
70 |
< |
static char *last_params = NULL; |
71 |
< |
char vname[RMAXWORD]; |
72 |
< |
double value; |
73 |
< |
char *cpd; |
70 |
> |
static const char *last_params = NULL; |
71 |
> |
char vname[RMAXWORD]; |
72 |
> |
double value; |
73 |
> |
char *cpd; |
74 |
|
/* check if already set */ |
75 |
|
if (prms == NULL || !*prms) |
76 |
|
return; |
96 |
|
if (*prms++ != '=') |
97 |
|
goto bad_params; |
98 |
|
value = atof(prms); |
99 |
< |
if ((prms = fskip(prms)) == NULL) |
99 |
> |
if ((prms = fskip((char *)prms)) == NULL) |
100 |
|
goto bad_params; |
101 |
|
while (isspace(*prms)) prms++; |
102 |
|
prms += (*prms == ',') | (*prms == ';') | (*prms == ':'); |
127 |
|
if ((f = (MFUNC *)m->os) != NULL) |
128 |
|
return(f); |
129 |
|
fobj = NULL; fray = NULL; |
130 |
– |
if (rayinitcal[0]) /* initialize on first call */ |
131 |
– |
initfunc(); |
130 |
|
if ((na = m->oargs.nsargs) <= ff) |
131 |
|
goto toofew; |
132 |
|
arg = m->oargs.sarg; |
146 |
|
} else /* reference_count++ */ |
147 |
|
varset(REFVNAME, '=', varvalue(REFVNAME)+1.0); |
148 |
|
} |
149 |
< |
curfunc = NULL; /* parse expressions */ |
149 |
> |
ecurfunc = NULL; /* parse expressions */ |
150 |
|
sprintf(sbuf, "%s \"%s\"", ofun[m->otype].funame, m->oname); |
151 |
|
for (i=0, ne=0; ef && i < na; i++, ef>>=1) |
152 |
|
if (ef & 1) { /* flagged as an expression? */ |
155 |
|
initstr(arg[i], sbuf, 0); |
156 |
|
f->ep[ne++] = getE1(); |
157 |
|
if (nextc != EOF) |
158 |
< |
syntax("unexpected character"); |
158 |
> |
esyntax("unexpected character"); |
159 |
|
} |
160 |
|
if (ef) |
161 |
|
goto toofew; |
201 |
|
if ((f = (MFUNC *)m->os) == NULL) |
202 |
|
return; |
203 |
|
for (i = 0; f->ep[i] != NULL; i++) |
204 |
< |
epfree(f->ep[i]); |
204 |
> |
epfree(f->ep[i],1); |
205 |
|
if (f->ctx[0]) { /* done with definitions */ |
206 |
|
calcontext(f->ctx); |
207 |
|
i = varvalue(REFVNAME)-.5; /* reference_count-- */ |
254 |
|
|
255 |
|
int |
256 |
|
worldfunc( /* special function context sans object */ |
257 |
< |
char *ctx, |
257 |
> |
const char *ctx, |
258 |
|
RAY *r |
259 |
|
) |
260 |
|
{ |
261 |
|
static RNUMBER lastrno = ~0; |
264 |
– |
|
265 |
– |
if (rayinitcal[0]) /* initialize on first call */ |
266 |
– |
initfunc(); |
262 |
|
/* set evaluator context */ |
263 |
< |
calcontext(ctx); |
263 |
> |
calcontext((char *)ctx); |
264 |
|
/* check if ray already set */ |
265 |
|
if ((fobj == NULL) & (r->rno == lastrno)) |
266 |
|
return(0); |
285 |
|
error(SYSTEM, errmsg); |
286 |
|
} |
287 |
|
fcompile(ffname); |
288 |
+ |
doptimize(1); /* optimize definitions */ |
289 |
|
} |
290 |
|
|
291 |
|
|
331 |
|
) |
332 |
|
{ |
333 |
|
if (fray == NULL) |
334 |
< |
syntax("ray parameter used in constant expression"); |
334 |
> |
esyntax("ray parameter used in constant expression"); |
335 |
|
|
336 |
|
if (--n < 0) |
337 |
|
goto badchan; |