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" |
23 |
|
|
24 |
|
/* bits in argument flag (better be right!) */ |
25 |
|
#define AFLAGSIZ (8*sizeof(unsigned long)) |
26 |
< |
#define ALISTSIZ 8 /* maximum saved argument list */ |
26 |
> |
#define ALISTSIZ 10 /* maximum saved argument list */ |
27 |
|
|
28 |
|
typedef struct activation { |
29 |
|
char *name; /* function name */ |
201 |
|
argument(int n) /* return nth argument for active function */ |
202 |
|
{ |
203 |
|
ACTIVATION *actp = curact; |
204 |
< |
EPNODE *ep = NULL; |
204 |
> |
EPNODE *ep; |
205 |
|
double aval; |
206 |
|
|
206 |
– |
if (!n) /* asking for # arguments? */ |
207 |
– |
return((double)nargum()); |
208 |
– |
|
207 |
|
if (!actp | (--n < 0)) { |
208 |
|
eputs("Bad call to argument!\n"); |
209 |
|
quit(1); |
295 |
|
|
296 |
|
curact = act.prev; /* pop environment */ |
297 |
|
return(rval); |
298 |
+ |
} |
299 |
+ |
|
300 |
+ |
|
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 |
|
|