26 |
|
#include <math.h> |
27 |
|
#include <stdlib.h> |
28 |
|
|
29 |
+ |
#include "rterror.h" |
30 |
|
#include "calcomp.h" |
31 |
|
|
32 |
|
#define MAXLINE 256 /* maximum line length */ |
35 |
|
|
36 |
|
#define isdecimal(c) (isdigit(c) || (c) == '.') |
37 |
|
|
38 |
< |
static double euminus(), eargument(), enumber(); |
39 |
< |
static double echannel(); |
40 |
< |
static double eadd(), esubtr(), emult(), edivi(), epow(); |
41 |
< |
static double ebotch(); |
38 |
> |
static double euminus(EPNODE *), eargument(EPNODE *), enumber(EPNODE *); |
39 |
> |
static double echannel(EPNODE *); |
40 |
> |
static double eadd(EPNODE *), esubtr(EPNODE *), |
41 |
> |
emult(EPNODE *), edivi(EPNODE *), |
42 |
> |
epow(EPNODE *); |
43 |
> |
static double ebotch(EPNODE *); |
44 |
|
|
45 |
|
unsigned int esupport = /* what to support */ |
46 |
|
E_VARIABLE | E_FUNCTION ; |
476 |
|
char * |
477 |
|
getname() /* scan an identifier */ |
478 |
|
{ |
479 |
< |
static char str[MAXWORD+1]; |
479 |
> |
static char str[RMAXWORD+1]; |
480 |
|
register int i, lnext; |
481 |
|
|
482 |
|
lnext = nextc; |
483 |
< |
for (i = 0; i < MAXWORD && isid(lnext); i++, lnext = scan()) |
483 |
> |
for (i = 0; i < RMAXWORD && isid(lnext); i++, lnext = scan()) |
484 |
|
str[i] = lnext; |
485 |
|
str[i] = '\0'; |
486 |
|
while (isid(lnext)) /* skip rest of name */ |
509 |
|
getnum() /* scan a positive float */ |
510 |
|
{ |
511 |
|
register int i, lnext; |
512 |
< |
char str[MAXWORD+1]; |
512 |
> |
char str[RMAXWORD+1]; |
513 |
|
|
514 |
|
i = 0; |
515 |
|
lnext = nextc; |
516 |
< |
while (isdigit(lnext) && i < MAXWORD) { |
516 |
> |
while (isdigit(lnext) && i < RMAXWORD) { |
517 |
|
str[i++] = lnext; |
518 |
|
lnext = scan(); |
519 |
|
} |
520 |
< |
if (lnext == '.' && i < MAXWORD) { |
520 |
> |
if (lnext == '.' && i < RMAXWORD) { |
521 |
|
str[i++] = lnext; |
522 |
|
lnext = scan(); |
523 |
|
if (i == 1 && !isdigit(lnext)) |
524 |
|
syntax("badly formed number"); |
525 |
< |
while (isdigit(lnext) && i < MAXWORD) { |
525 |
> |
while (isdigit(lnext) && i < RMAXWORD) { |
526 |
|
str[i++] = lnext; |
527 |
|
lnext = scan(); |
528 |
|
} |
529 |
|
} |
530 |
< |
if ((lnext == 'e' | lnext == 'E') && i < MAXWORD) { |
530 |
> |
if ((lnext == 'e' | lnext == 'E') && i < RMAXWORD) { |
531 |
|
str[i++] = lnext; |
532 |
|
lnext = scan(); |
533 |
< |
if ((lnext == '-' | lnext == '+') && i < MAXWORD) { |
533 |
> |
if ((lnext == '-' | lnext == '+') && i < RMAXWORD) { |
534 |
|
str[i++] = lnext; |
535 |
|
lnext = scan(); |
536 |
|
} |
537 |
|
if (!isdigit(lnext)) |
538 |
|
syntax("missing exponent"); |
539 |
< |
while (isdigit(lnext) && i < MAXWORD) { |
539 |
> |
while (isdigit(lnext) && i < RMAXWORD) { |
540 |
|
str[i++] = lnext; |
541 |
|
lnext = scan(); |
542 |
|
} |