24 |
|
|
25 |
|
#include <errno.h> |
26 |
|
|
27 |
+ |
#include <math.h> |
28 |
+ |
|
29 |
|
#include "calcomp.h" |
30 |
|
|
31 |
|
#define MAXLINE 256 /* maximum line length */ |
37 |
|
#ifndef atof |
38 |
|
extern double atof(); |
39 |
|
#endif |
38 |
– |
extern double pow(); |
40 |
|
extern char *fgets(), *savestr(); |
41 |
|
extern char *emalloc(), *ecalloc(); |
42 |
|
extern EPNODE *curfunc; |
128 |
|
epfree(epar) /* free a parse tree */ |
129 |
|
register EPNODE *epar; |
130 |
|
{ |
131 |
< |
register EPNODE *ep; |
131 |
> |
register EPNODE *ep, *epn; |
132 |
|
|
133 |
|
switch (epar->type) { |
134 |
|
|
149 |
|
break; |
150 |
|
|
151 |
|
default: |
152 |
< |
for (ep = epar->v.kid; ep != NULL; ep = ep->sibling) |
152 |
> |
for (ep = epar->v.kid; ep != NULL; ep = epn) { |
153 |
> |
epn = ep->sibling; |
154 |
|
epfree(ep); |
155 |
+ |
} |
156 |
|
break; |
157 |
|
|
158 |
|
} |
374 |
|
|
375 |
|
|
376 |
|
char * |
377 |
< |
ltoa(l) /* convert long to ascii */ |
377 |
> |
long2ascii(l) /* convert long to ascii */ |
378 |
|
long l; |
379 |
|
{ |
380 |
|
static char buf[16]; |
408 |
|
if (infile != NULL) eputs(infile); |
409 |
|
if (lineno != 0) { |
410 |
|
eputs(infile != NULL ? ", line " : "line "); |
411 |
< |
eputs(ltoa((long)lineno)); |
411 |
> |
eputs(long2ascii((long)lineno)); |
412 |
|
} |
413 |
< |
eputs(": syntax error:\n"); |
413 |
> |
eputs(":\n"); |
414 |
|
} |
415 |
|
eputs(linbuf); |
416 |
|
if (linbuf[strlen(linbuf)-1] != '\n') |