1 |
– |
/* Copyright (c) 1986 Regents of the University of California */ |
2 |
– |
|
1 |
|
#ifndef lint |
2 |
< |
static char SCCSid[] = "$SunId$ LBL"; |
2 |
> |
static const char RCSid[] = "$Id$"; |
3 |
|
#endif |
6 |
– |
|
4 |
|
/* |
5 |
|
* calfunc.c - routines for calcomp using functions. |
6 |
|
* |
7 |
< |
* The define BIGLIB pulls in a large number of the |
11 |
< |
* available math routines. |
12 |
< |
* |
13 |
< |
* If VARIABLE is not defined, only library functions |
7 |
> |
* If VARIABLE is not set, only library functions |
8 |
|
* can be accessed. |
9 |
|
* |
10 |
< |
* 4/2/86 |
10 |
> |
* 2/19/03 Eliminated conditional compiles in favor of esupport extern. |
11 |
|
*/ |
12 |
|
|
13 |
< |
#include <stdio.h> |
13 |
> |
#include "copyright.h" |
14 |
|
|
15 |
+ |
#include <stdio.h> |
16 |
+ |
#include <string.h> |
17 |
|
#include <errno.h> |
18 |
+ |
#include <stdlib.h> |
19 |
+ |
#include <math.h> |
20 |
|
|
21 |
+ |
#include "rterror.h" |
22 |
|
#include "calcomp.h" |
23 |
|
|
24 |
+ |
/* bits in argument flag (better be right!) */ |
25 |
+ |
#define AFLAGSIZ (8*sizeof(unsigned long)) |
26 |
+ |
#define ALISTSIZ 10 /* maximum saved argument list */ |
27 |
|
|
26 |
– |
#define ALISTSIZ 6 /* maximum saved argument list */ |
27 |
– |
|
28 |
|
typedef struct activation { |
29 |
|
char *name; /* function name */ |
30 |
|
struct activation *prev; /* previous activation */ |
35 |
|
|
36 |
|
static ACTIVATION *curact = NULL; |
37 |
|
|
38 |
< |
static double libfunc(); |
38 |
> |
static double libfunc(char *fname, VARDEF *vp); |
39 |
|
|
40 |
+ |
#ifndef MAXLIB |
41 |
|
#define MAXLIB 64 /* maximum number of library functions */ |
41 |
– |
|
42 |
– |
static double l_if(), l_select(), l_rand(); |
43 |
– |
static double l_floor(), l_ceil(); |
44 |
– |
#ifdef BIGLIB |
45 |
– |
static double l_sqrt(); |
46 |
– |
static double l_sin(), l_cos(), l_tan(); |
47 |
– |
static double l_asin(), l_acos(), l_atan(), l_atan2(); |
48 |
– |
static double l_exp(), l_log(), l_log10(); |
42 |
|
#endif |
43 |
|
|
44 |
< |
#ifdef BIGLIB |
44 |
> |
static double l_if(char *), l_select(char *); |
45 |
> |
static double l_min(char *), l_max(char *); |
46 |
> |
static double l_rand(char *); |
47 |
> |
static double l_floor(char *), l_ceil(char *); |
48 |
> |
static double l_sqrt(char *); |
49 |
> |
static double l_sin(char *), l_cos(char *), l_tan(char *); |
50 |
> |
static double l_asin(char *), l_acos(char *), l_atan(char *), l_atan2(char *); |
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 }, |
63 |
|
{ "if", 3, ':', l_if }, |
64 |
|
{ "log", 1, ':', l_log }, |
65 |
|
{ "log10", 1, ':', l_log10 }, |
66 |
+ |
{ "max", 1, ':', l_max }, |
67 |
+ |
{ "min", 1, ':', l_min }, |
68 |
|
{ "rand", 1, ':', l_rand }, |
69 |
|
{ "select", 1, ':', l_select }, |
70 |
|
{ "sin", 1, ':', l_sin }, |
72 |
|
{ "tan", 1, ':', l_tan }, |
73 |
|
}; |
74 |
|
|
75 |
< |
static int libsize = 16; |
75 |
> |
static int libsize = 18; |
76 |
|
|
77 |
< |
#else |
75 |
< |
/* functions must be listed alphabetically */ |
76 |
< |
static LIBR library[MAXLIB] = { |
77 |
< |
{ "ceil", 1, ':', l_ceil }, |
78 |
< |
{ "floor", 1, ':', l_floor }, |
79 |
< |
{ "if", 3, ':', l_if }, |
80 |
< |
{ "rand", 1, ':', l_rand }, |
81 |
< |
{ "select", 1, ':', l_select }, |
82 |
< |
}; |
77 |
> |
#define resolve(ep) ((ep)->type==VAR?(ep)->v.ln:eargf((ep)->v.chan)) |
78 |
|
|
84 |
– |
static int libsize = 5; |
79 |
|
|
86 |
– |
#endif |
87 |
– |
|
88 |
– |
extern char *savestr(), *emalloc(); |
89 |
– |
|
90 |
– |
extern LIBR *liblookup(); |
91 |
– |
|
92 |
– |
extern VARDEF *argf(); |
93 |
– |
|
94 |
– |
#ifdef VARIABLE |
95 |
– |
#define resolve(ep) ((ep)->type==VAR?(ep)->v.ln:argf((ep)->v.chan)) |
96 |
– |
#else |
97 |
– |
#define resolve(ep) ((ep)->v.ln) |
98 |
– |
#define varlookup(name) NULL |
99 |
– |
#endif |
100 |
– |
|
101 |
– |
|
80 |
|
int |
81 |
< |
fundefined(fname) /* return # of arguments for function */ |
82 |
< |
char *fname; |
81 |
> |
fundefined( /* return # of req'd arguments for function */ |
82 |
> |
char *fname |
83 |
> |
) |
84 |
|
{ |
85 |
< |
LIBR *lp; |
86 |
< |
register VARDEF *vp; |
85 |
> |
ELIBR *lp; |
86 |
> |
VARDEF *vp; |
87 |
|
|
88 |
< |
if ((vp = varlookup(fname)) == NULL || vp->def == NULL |
89 |
< |
|| vp->def->v.kid->type != FUNC) |
111 |
< |
if ((lp = liblookup(fname)) == NULL) |
112 |
< |
return(0); |
113 |
< |
else |
114 |
< |
return(lp->nargs); |
115 |
< |
else |
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 : eliblookup(fname); |
92 |
+ |
if (lp == NULL) |
93 |
+ |
return(0); |
94 |
+ |
return(lp->nargs); |
95 |
|
} |
96 |
|
|
97 |
|
|
98 |
|
double |
99 |
< |
funvalue(fname, n, a) /* return a function value to the user */ |
100 |
< |
char *fname; |
101 |
< |
int n; |
102 |
< |
double *a; |
99 |
> |
funvalue( /* return a function value to the user */ |
100 |
> |
char *fname, |
101 |
> |
int n, |
102 |
> |
double *a |
103 |
> |
) |
104 |
|
{ |
105 |
|
ACTIVATION act; |
106 |
< |
register VARDEF *vp; |
106 |
> |
VARDEF *vp; |
107 |
|
double rval; |
108 |
|
/* push environment */ |
109 |
|
act.name = fname; |
110 |
|
act.prev = curact; |
111 |
|
act.ap = a; |
112 |
< |
act.an = (1L<<n)-1; |
112 |
> |
if (n < AFLAGSIZ) |
113 |
> |
act.an = (1L<<n)-1; |
114 |
> |
else { |
115 |
> |
act.an = ~0; |
116 |
> |
if (n > AFLAGSIZ) |
117 |
> |
wputs("Excess arguments in funvalue()\n"); |
118 |
> |
} |
119 |
|
act.fun = NULL; |
120 |
|
curact = &act; |
121 |
|
|
130 |
|
} |
131 |
|
|
132 |
|
|
133 |
< |
funset(fname, nargs, assign, fptr) /* set a library function */ |
134 |
< |
char *fname; |
135 |
< |
int nargs; |
136 |
< |
int assign; |
137 |
< |
double (*fptr)(); |
133 |
> |
void |
134 |
> |
funset( /* set a library function */ |
135 |
> |
char *fname, |
136 |
> |
int nargs, |
137 |
> |
int assign, |
138 |
> |
double (*fptr)(char *) |
139 |
> |
) |
140 |
|
{ |
141 |
< |
register LIBR *lp; |
142 |
< |
|
143 |
< |
if ((lp = liblookup(fname)) == NULL) { |
141 |
> |
int oldlibsize = libsize; |
142 |
> |
char *cp; |
143 |
> |
ELIBR *lp; |
144 |
> |
/* check for context */ |
145 |
> |
for (cp = fname; *cp; cp++) |
146 |
> |
; |
147 |
> |
if (cp == fname) |
148 |
> |
return; |
149 |
> |
while (cp[-1] == CNTXMARK) { |
150 |
> |
*--cp = '\0'; |
151 |
> |
if (cp == fname) return; |
152 |
> |
} |
153 |
> |
if ((lp = eliblookup(fname)) == NULL) { /* insert */ |
154 |
> |
if (fptr == NULL) |
155 |
> |
return; /* nothing! */ |
156 |
|
if (libsize >= MAXLIB) { |
157 |
|
eputs("Too many library functons!\n"); |
158 |
|
quit(1); |
159 |
|
} |
160 |
|
for (lp = &library[libsize]; lp > library; lp--) |
161 |
< |
if (strcmp(lp[-1].fname, fname) > 0) { |
162 |
< |
lp[0].fname = lp[-1].fname; |
163 |
< |
lp[0].nargs = lp[-1].nargs; |
165 |
< |
lp[0].atyp = lp[-1].atyp; |
166 |
< |
lp[0].f = lp[-1].f; |
167 |
< |
} else |
161 |
> |
if (strcmp(lp[-1].fname, fname) > 0) |
162 |
> |
lp[0] = lp[-1]; |
163 |
> |
else |
164 |
|
break; |
165 |
|
libsize++; |
166 |
|
} |
167 |
< |
lp[0].fname = savestr(fname); |
168 |
< |
lp[0].nargs = nargs; |
169 |
< |
lp[0].atyp = assign; |
170 |
< |
lp[0].f = fptr; |
167 |
> |
if (fptr == NULL) { /* delete */ |
168 |
> |
while (lp < &library[libsize-1]) { |
169 |
> |
lp[0] = lp[1]; |
170 |
> |
lp++; |
171 |
> |
} |
172 |
> |
libsize--; |
173 |
> |
} else { /* or assign */ |
174 |
> |
lp[0].fname = fname; /* string must be static! */ |
175 |
> |
lp[0].nargs = nargs; |
176 |
> |
lp[0].atyp = assign; |
177 |
> |
lp[0].f = fptr; |
178 |
> |
} |
179 |
> |
if (libsize != oldlibsize) |
180 |
> |
elibupdate(fname); /* relink library */ |
181 |
|
} |
182 |
|
|
183 |
|
|
184 |
|
int |
185 |
< |
nargum() /* return number of available arguments */ |
185 |
> |
nargum(void) /* return number of available arguments */ |
186 |
|
{ |
187 |
< |
register int n; |
187 |
> |
int n; |
188 |
|
|
189 |
|
if (curact == NULL) |
190 |
|
return(0); |
198 |
|
|
199 |
|
|
200 |
|
double |
201 |
< |
argument(n) /* return nth argument for active function */ |
196 |
< |
register int n; |
201 |
> |
argument(int n) /* return nth argument for active function */ |
202 |
|
{ |
203 |
< |
register ACTIVATION *actp = curact; |
203 |
> |
ACTIVATION *actp = curact; |
204 |
|
EPNODE *ep; |
205 |
|
double aval; |
206 |
|
|
207 |
< |
if (actp == NULL || --n < 0) { |
207 |
> |
if (!actp | (--n < 0)) { |
208 |
|
eputs("Bad call to argument!\n"); |
209 |
|
quit(1); |
210 |
|
} |
211 |
< |
/* already computed? */ |
207 |
< |
if (1L<<n & actp->an) |
211 |
> |
if ((n < AFLAGSIZ) & actp->an >> n) /* already computed? */ |
212 |
|
return(actp->ap[n]); |
213 |
|
|
214 |
< |
if (actp->fun == NULL || (ep = ekid(actp->fun, n+1)) == NULL) { |
214 |
> |
if (!actp->fun || !(ep = ekid(actp->fun, n+1))) { |
215 |
|
eputs(actp->name); |
216 |
|
eputs(": too few arguments\n"); |
217 |
|
quit(1); |
218 |
|
} |
219 |
< |
curact = actp->prev; /* pop environment */ |
219 |
> |
curact = actp->prev; /* previous context */ |
220 |
|
aval = evalue(ep); /* compute argument */ |
221 |
< |
curact = actp; /* push back environment */ |
222 |
< |
if (n < ALISTSIZ) { /* save value */ |
221 |
> |
curact = actp; /* put back calling context */ |
222 |
> |
if (n < ALISTSIZ) { /* save value if room */ |
223 |
|
actp->ap[n] = aval; |
224 |
|
actp->an |= 1L<<n; |
225 |
|
} |
227 |
|
} |
228 |
|
|
229 |
|
|
226 |
– |
#ifdef VARIABLE |
230 |
|
VARDEF * |
231 |
< |
argf(n) /* return function def for nth argument */ |
229 |
< |
int n; |
231 |
> |
eargf(int n) /* return function def for nth argument */ |
232 |
|
{ |
233 |
< |
register ACTIVATION *actp; |
234 |
< |
register EPNODE *ep; |
233 |
> |
ACTIVATION *actp; |
234 |
> |
EPNODE *ep; |
235 |
|
|
236 |
|
for (actp = curact; actp != NULL; actp = actp->prev) { |
237 |
|
|
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: |
261 |
|
eputs(actp->name); |
262 |
|
eputs(": argument not a function\n"); |
263 |
|
quit(1); |
264 |
+ |
return NULL; /* pro forma return */ |
265 |
|
} |
266 |
|
|
267 |
|
|
268 |
|
char * |
269 |
< |
argfun(n) /* return function name for nth argument */ |
267 |
< |
int n; |
269 |
> |
eargfun(int n) /* return function name for nth argument */ |
270 |
|
{ |
271 |
< |
return(argf(n)->name); |
271 |
> |
return(eargf(n)->name); |
272 |
|
} |
271 |
– |
#endif |
273 |
|
|
274 |
|
|
275 |
|
double |
276 |
< |
efunc(ep) /* evaluate a function */ |
276 |
< |
register EPNODE *ep; |
276 |
> |
efunc(EPNODE *ep) /* evaluate a function */ |
277 |
|
{ |
278 |
|
ACTIVATION act; |
279 |
|
double alist[ALISTSIZ]; |
280 |
|
double rval; |
281 |
< |
register VARDEF *dp; |
281 |
> |
VARDEF *dp; |
282 |
|
/* push environment */ |
283 |
|
dp = resolve(ep->v.kid); |
284 |
|
act.name = dp->name; |
298 |
|
} |
299 |
|
|
300 |
|
|
301 |
< |
LIBR * |
302 |
< |
liblookup(fname) /* look up a library function */ |
303 |
< |
char *fname; |
301 |
> |
double |
302 |
> |
eargument( /* evaluate an argument */ |
303 |
> |
EPNODE *ep |
304 |
> |
) |
305 |
|
{ |
306 |
+ |
if ((ep->v.chan <= AFLAGSIZ) & curact->an >> (ep->v.chan-1)) |
307 |
+ |
return(curact->ap[ep->v.chan-1]); |
308 |
+ |
|
309 |
+ |
return(argument(ep->v.chan)); |
310 |
+ |
} |
311 |
+ |
|
312 |
+ |
|
313 |
+ |
ELIBR * |
314 |
+ |
eliblookup(char *fname) /* look up a library function */ |
315 |
+ |
{ |
316 |
|
int upper, lower; |
317 |
< |
register int cm, i; |
317 |
> |
int cm, i; |
318 |
|
|
319 |
|
lower = 0; |
320 |
|
upper = cm = libsize; |
333 |
|
} |
334 |
|
|
335 |
|
|
325 |
– |
#ifndef VARIABLE |
326 |
– |
VARDEF * |
327 |
– |
varinsert(vname) /* dummy variable insert */ |
328 |
– |
char *vname; |
329 |
– |
{ |
330 |
– |
register VARDEF *vp; |
331 |
– |
|
332 |
– |
vp = (VARDEF *)emalloc(sizeof(VARDEF)); |
333 |
– |
vp->name = savestr(vname); |
334 |
– |
vp->nlinks = 1; |
335 |
– |
vp->def = NULL; |
336 |
– |
vp->lib = NULL; |
337 |
– |
vp->next = NULL; |
338 |
– |
return(vp); |
339 |
– |
} |
340 |
– |
|
341 |
– |
|
342 |
– |
varfree(vp) /* free dummy variable */ |
343 |
– |
register VARDEF *vp; |
344 |
– |
{ |
345 |
– |
freestr(vp->name); |
346 |
– |
efree((char *)vp); |
347 |
– |
} |
348 |
– |
#endif |
349 |
– |
|
350 |
– |
|
351 |
– |
|
336 |
|
/* |
337 |
|
* The following routines are for internal use: |
338 |
|
*/ |
339 |
|
|
340 |
|
|
341 |
|
static double |
342 |
< |
libfunc(fname, vp) /* execute library function */ |
343 |
< |
char *fname; |
344 |
< |
register VARDEF *vp; |
342 |
> |
libfunc( /* execute library function */ |
343 |
> |
char *fname, |
344 |
> |
VARDEF *vp |
345 |
> |
) |
346 |
|
{ |
347 |
< |
VARDEF dumdef; |
347 |
> |
ELIBR *lp; |
348 |
|
double d; |
349 |
|
int lasterrno; |
350 |
|
|
351 |
< |
if (vp == NULL) { |
352 |
< |
vp = &dumdef; |
353 |
< |
vp->lib = NULL; |
354 |
< |
} |
355 |
< |
if (((vp->lib == NULL || strcmp(fname, vp->lib->fname)) && |
371 |
< |
(vp->lib = liblookup(fname)) == NULL) || |
372 |
< |
vp->lib->f == NULL) { |
351 |
> |
if (vp != NULL) |
352 |
> |
lp = vp->lib; |
353 |
> |
else |
354 |
> |
lp = eliblookup(fname); |
355 |
> |
if (lp == NULL) { |
356 |
|
eputs(fname); |
357 |
|
eputs(": undefined function\n"); |
358 |
|
quit(1); |
359 |
|
} |
360 |
|
lasterrno = errno; |
361 |
|
errno = 0; |
362 |
< |
d = (*vp->lib->f)(); |
363 |
< |
#ifdef IEEE |
364 |
< |
if (!finite(d)) |
365 |
< |
errno = EDOM; |
362 |
> |
d = (*lp->f)(lp->fname); |
363 |
> |
#ifdef isnan |
364 |
> |
if (errno == 0) { |
365 |
> |
if (isnan(d)) |
366 |
> |
errno = EDOM; |
367 |
> |
else if (isinf(d)) |
368 |
> |
errno = ERANGE; |
369 |
> |
} |
370 |
|
#endif |
371 |
< |
if (errno) { |
371 |
> |
if ((errno == EDOM) | (errno == ERANGE)) { |
372 |
|
wputs(fname); |
373 |
< |
wputs(": bad call\n"); |
373 |
> |
if (errno == EDOM) |
374 |
> |
wputs(": domain error\n"); |
375 |
> |
else if (errno == ERANGE) |
376 |
> |
wputs(": range error\n"); |
377 |
> |
else |
378 |
> |
wputs(": error in call\n"); |
379 |
|
return(0.0); |
380 |
|
} |
381 |
|
errno = lasterrno; |
389 |
|
|
390 |
|
|
391 |
|
static double |
392 |
< |
l_if() /* if(cond, then, else) conditional expression */ |
392 |
> |
l_if(char *nm) /* if(cond, then, else) conditional expression */ |
393 |
|
/* cond evaluates true if greater than zero */ |
394 |
|
{ |
395 |
|
if (argument(1) > 0.0) |
400 |
|
|
401 |
|
|
402 |
|
static double |
403 |
< |
l_select() /* return argument #(A1+1) */ |
403 |
> |
l_select(char *nm) /* return argument #(A1+1) */ |
404 |
|
{ |
405 |
< |
register int n; |
405 |
> |
int narg = nargum(); |
406 |
> |
double a1 = argument(1); |
407 |
> |
int n = (int)(a1 + .5); |
408 |
|
|
409 |
< |
n = argument(1) + .5; |
416 |
< |
if (n == 0) |
417 |
< |
return(nargum()-1); |
418 |
< |
if (n < 1 || n > nargum()-1) { |
409 |
> |
if ((a1 < -.5) | (n >= narg)) { |
410 |
|
errno = EDOM; |
411 |
|
return(0.0); |
412 |
|
} |
413 |
+ |
if (!n) /* asking max index? */ |
414 |
+ |
return(narg-1); |
415 |
|
return(argument(n+1)); |
416 |
|
} |
417 |
|
|
418 |
|
|
419 |
|
static double |
420 |
< |
l_rand() /* random function between 0 and 1 */ |
420 |
> |
l_max(char *nm) /* general maximum function */ |
421 |
|
{ |
422 |
< |
extern double floor(); |
422 |
> |
int n = nargum(); |
423 |
> |
double vmax = argument(1); |
424 |
> |
|
425 |
> |
while (n > 1) { |
426 |
> |
double v = argument(n--); |
427 |
> |
if (vmax < v) |
428 |
> |
vmax = v; |
429 |
> |
} |
430 |
> |
return(vmax); |
431 |
> |
} |
432 |
> |
|
433 |
> |
|
434 |
> |
static double |
435 |
> |
l_min(char *nm) /* general minimum function */ |
436 |
> |
{ |
437 |
> |
int n = nargum(); |
438 |
> |
double vmin = argument(1); |
439 |
> |
|
440 |
> |
while (n > 1) { |
441 |
> |
double v = argument(n--); |
442 |
> |
if (vmin > v) |
443 |
> |
vmin = v; |
444 |
> |
} |
445 |
> |
return(vmin); |
446 |
> |
} |
447 |
> |
|
448 |
> |
|
449 |
> |
static double |
450 |
> |
l_rand(char *nm) /* random function between 0 and 1 */ |
451 |
> |
{ |
452 |
|
double x; |
453 |
|
|
454 |
|
x = argument(1); |
460 |
|
|
461 |
|
|
462 |
|
static double |
463 |
< |
l_floor() /* return largest integer not greater than arg1 */ |
463 |
> |
l_floor(char *nm) /* return largest integer not greater than arg1 */ |
464 |
|
{ |
443 |
– |
extern double floor(); |
444 |
– |
|
465 |
|
return(floor(argument(1))); |
466 |
|
} |
467 |
|
|
468 |
|
|
469 |
|
static double |
470 |
< |
l_ceil() /* return smallest integer not less than arg1 */ |
470 |
> |
l_ceil(char *nm) /* return smallest integer not less than arg1 */ |
471 |
|
{ |
452 |
– |
extern double ceil(); |
453 |
– |
|
472 |
|
return(ceil(argument(1))); |
473 |
|
} |
474 |
|
|
475 |
|
|
458 |
– |
#ifdef BIGLIB |
476 |
|
static double |
477 |
< |
l_sqrt() |
477 |
> |
l_sqrt(char *nm) |
478 |
|
{ |
462 |
– |
extern double sqrt(); |
463 |
– |
|
479 |
|
return(sqrt(argument(1))); |
480 |
|
} |
481 |
|
|
482 |
|
|
483 |
|
static double |
484 |
< |
l_sin() |
484 |
> |
l_sin(char *nm) |
485 |
|
{ |
471 |
– |
extern double sin(); |
472 |
– |
|
486 |
|
return(sin(argument(1))); |
487 |
|
} |
488 |
|
|
489 |
|
|
490 |
|
static double |
491 |
< |
l_cos() |
491 |
> |
l_cos(char *nm) |
492 |
|
{ |
480 |
– |
extern double cos(); |
481 |
– |
|
493 |
|
return(cos(argument(1))); |
494 |
|
} |
495 |
|
|
496 |
|
|
497 |
|
static double |
498 |
< |
l_tan() |
498 |
> |
l_tan(char *nm) |
499 |
|
{ |
489 |
– |
extern double tan(); |
490 |
– |
|
500 |
|
return(tan(argument(1))); |
501 |
|
} |
502 |
|
|
503 |
|
|
504 |
|
static double |
505 |
< |
l_asin() |
505 |
> |
l_asin(char *nm) |
506 |
|
{ |
498 |
– |
extern double asin(); |
499 |
– |
|
507 |
|
return(asin(argument(1))); |
508 |
|
} |
509 |
|
|
510 |
|
|
511 |
|
static double |
512 |
< |
l_acos() |
512 |
> |
l_acos(char *nm) |
513 |
|
{ |
507 |
– |
extern double acos(); |
508 |
– |
|
514 |
|
return(acos(argument(1))); |
515 |
|
} |
516 |
|
|
517 |
|
|
518 |
|
static double |
519 |
< |
l_atan() |
519 |
> |
l_atan(char *nm) |
520 |
|
{ |
516 |
– |
extern double atan(); |
517 |
– |
|
521 |
|
return(atan(argument(1))); |
522 |
|
} |
523 |
|
|
524 |
|
|
525 |
|
static double |
526 |
< |
l_atan2() |
526 |
> |
l_atan2(char *nm) |
527 |
|
{ |
525 |
– |
extern double atan2(); |
526 |
– |
|
528 |
|
return(atan2(argument(1), argument(2))); |
529 |
|
} |
530 |
|
|
531 |
|
|
532 |
|
static double |
533 |
< |
l_exp() |
533 |
> |
l_exp(char *nm) |
534 |
|
{ |
534 |
– |
extern double exp(); |
535 |
– |
|
535 |
|
return(exp(argument(1))); |
536 |
|
} |
537 |
|
|
538 |
|
|
539 |
|
static double |
540 |
< |
l_log() |
540 |
> |
l_log(char *nm) |
541 |
|
{ |
543 |
– |
extern double log(); |
544 |
– |
|
542 |
|
return(log(argument(1))); |
543 |
|
} |
544 |
|
|
545 |
|
|
546 |
|
static double |
547 |
< |
l_log10() |
547 |
> |
l_log10(char *nm) |
548 |
|
{ |
552 |
– |
extern double log10(); |
553 |
– |
|
549 |
|
return(log10(argument(1))); |
550 |
|
} |
556 |
– |
#endif |