51 |
|
static double l_exp(char *), l_log(char *), l_log10(char *); |
52 |
|
|
53 |
|
/* functions must be listed alphabetically */ |
54 |
< |
static LIBR library[MAXLIB] = { |
54 |
> |
static ELIBR library[MAXLIB] = { |
55 |
|
{ "acos", 1, ':', l_acos }, |
56 |
|
{ "asin", 1, ':', l_asin }, |
57 |
|
{ "atan", 1, ':', l_atan }, |
74 |
|
|
75 |
|
static int libsize = 18; |
76 |
|
|
77 |
< |
#define resolve(ep) ((ep)->type==VAR?(ep)->v.ln:argf((ep)->v.chan)) |
77 |
> |
#define resolve(ep) ((ep)->type==VAR?(ep)->v.ln:eargf((ep)->v.chan)) |
78 |
|
|
79 |
|
|
80 |
|
int |
82 |
|
char *fname |
83 |
|
) |
84 |
|
{ |
85 |
< |
LIBR *lp; |
85 |
> |
ELIBR *lp; |
86 |
|
VARDEF *vp; |
87 |
|
|
88 |
|
if ((vp = varlookup(fname)) != NULL && vp->def != NULL |
89 |
|
&& vp->def->v.kid->type == FUNC) |
90 |
|
return(nekids(vp->def->v.kid) - 1); |
91 |
< |
lp = vp != NULL ? vp->lib : liblookup(fname); |
91 |
> |
lp = vp != NULL ? vp->lib : eliblookup(fname); |
92 |
|
if (lp == NULL) |
93 |
|
return(0); |
94 |
|
return(lp->nargs); |
140 |
|
{ |
141 |
|
int oldlibsize = libsize; |
142 |
|
char *cp; |
143 |
< |
LIBR *lp; |
143 |
> |
ELIBR *lp; |
144 |
|
/* check for context */ |
145 |
|
for (cp = fname; *cp; cp++) |
146 |
|
; |
150 |
|
*--cp = '\0'; |
151 |
|
if (cp == fname) return; |
152 |
|
} |
153 |
< |
if ((lp = liblookup(fname)) == NULL) { /* insert */ |
153 |
> |
if ((lp = eliblookup(fname)) == NULL) { /* insert */ |
154 |
|
if (fptr == NULL) |
155 |
|
return; /* nothing! */ |
156 |
|
if (libsize >= MAXLIB) { |
177 |
|
lp[0].f = fptr; |
178 |
|
} |
179 |
|
if (libsize != oldlibsize) |
180 |
< |
libupdate(fname); /* relink library */ |
180 |
> |
elibupdate(fname); /* relink library */ |
181 |
|
} |
182 |
|
|
183 |
|
|
228 |
|
|
229 |
|
|
230 |
|
VARDEF * |
231 |
< |
argf(int n) /* return function def for nth argument */ |
231 |
> |
eargf(int n) /* return function def for nth argument */ |
232 |
|
{ |
233 |
|
ACTIVATION *actp; |
234 |
|
EPNODE *ep; |
254 |
|
|
255 |
|
n = ep->v.chan; /* try previous context */ |
256 |
|
} |
257 |
< |
eputs("Bad call to argf!\n"); |
257 |
> |
eputs("Bad call to eargf!\n"); |
258 |
|
quit(1); |
259 |
|
|
260 |
|
badarg: |
266 |
|
|
267 |
|
|
268 |
|
char * |
269 |
< |
argfun(int n) /* return function name for nth argument */ |
269 |
> |
eargfun(int n) /* return function name for nth argument */ |
270 |
|
{ |
271 |
< |
return(argf(n)->name); |
271 |
> |
return(eargf(n)->name); |
272 |
|
} |
273 |
|
|
274 |
|
|
310 |
|
} |
311 |
|
|
312 |
|
|
313 |
< |
LIBR * |
314 |
< |
liblookup(char *fname) /* look up a library function */ |
313 |
> |
ELIBR * |
314 |
> |
eliblookup(char *fname) /* look up a library function */ |
315 |
|
{ |
316 |
|
int upper, lower; |
317 |
|
int cm, i; |
344 |
|
VARDEF *vp |
345 |
|
) |
346 |
|
{ |
347 |
< |
LIBR *lp; |
347 |
> |
ELIBR *lp; |
348 |
|
double d; |
349 |
|
int lasterrno; |
350 |
|
|
351 |
|
if (vp != NULL) |
352 |
|
lp = vp->lib; |
353 |
|
else |
354 |
< |
lp = liblookup(fname); |
354 |
> |
lp = eliblookup(fname); |
355 |
|
if (lp == NULL) { |
356 |
|
eputs(fname); |
357 |
|
eputs(": undefined function\n"); |