24 |
|
|
25 |
|
#include <errno.h> |
26 |
|
|
27 |
+ |
#include <math.h> |
28 |
+ |
|
29 |
|
#include "calcomp.h" |
30 |
|
|
31 |
|
#define MAXLINE 256 /* maximum line length */ |
34 |
|
|
35 |
|
#define isdecimal(c) (isdigit(c) || (c) == '.') |
36 |
|
|
37 |
< |
#ifndef atof |
36 |
< |
extern double atof(); |
37 |
< |
#endif |
38 |
< |
extern double pow(); |
39 |
< |
extern char *fgets(), *savestr(); |
37 |
> |
extern char *savestr(); |
38 |
|
extern char *emalloc(), *ecalloc(); |
39 |
|
extern EPNODE *curfunc; |
40 |
|
extern double efunc(), evariable(); |
41 |
< |
static double euminus(), echannel(), eargument(), enumber(); |
41 |
> |
static double euminus(), eargument(), enumber(); |
42 |
> |
#ifdef INCHAN |
43 |
> |
static double echannel(); |
44 |
> |
#endif |
45 |
|
static double eadd(), esubtr(), emult(), edivi(), epow(); |
46 |
|
static double ebotch(); |
47 |
|
|
48 |
+ |
#ifdef DCL_ATOF |
49 |
+ |
extern double atof(); |
50 |
+ |
#endif |
51 |
+ |
|
52 |
|
int nextc; /* lookahead character */ |
53 |
|
|
54 |
|
double (*eoper[])() = { /* expression operations */ |
153 |
|
break; |
154 |
|
|
155 |
|
default: |
156 |
< |
for (ep = epar->v.kid; ep != NULL; ep = ep->sibling) |
156 |
> |
while ((ep = epar->v.kid) != NULL) { |
157 |
> |
epar->v.kid = ep->sibling; |
158 |
|
epfree(ep); |
159 |
+ |
} |
160 |
|
break; |
161 |
|
|
162 |
|
} |
378 |
|
|
379 |
|
|
380 |
|
char * |
381 |
< |
ltoa(l) /* convert long to ascii */ |
381 |
> |
long2ascii(l) /* convert long to ascii */ |
382 |
|
long l; |
383 |
|
{ |
384 |
|
static char buf[16]; |
412 |
|
if (infile != NULL) eputs(infile); |
413 |
|
if (lineno != 0) { |
414 |
|
eputs(infile != NULL ? ", line " : "line "); |
415 |
< |
eputs(ltoa((long)lineno)); |
415 |
> |
eputs(long2ascii((long)lineno)); |
416 |
|
} |
417 |
< |
eputs(": syntax error:\n"); |
417 |
> |
eputs(":\n"); |
418 |
|
} |
419 |
|
eputs(linbuf); |
420 |
|
if (linbuf[strlen(linbuf)-1] != '\n') |