3 ** EVAL.H Master include file for Eval.
4 ** Contains function definitions and global definitions
7 ** originally written 5/89
9 ** Eval is a floating point expression evaluator.
10 ** This is version 1.12
11 ** Copyright (C) 1993 Will Menninger
13 ** This program is free software; you can redistribute it and/or modify it
14 ** under the terms of the GNU General Public License as published by the
15 ** Free Software Foundation; either version 2 of the License, or any
18 ** This program is distributed in the hope that it will be useful, but
19 ** WITHOUT ANY WARRANTY; without even the implied warranty of
20 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 ** General Public License for more details.
23 ** You should have received a copy of the GNU General Public License along
24 ** with this program; if not, write to the Free Software Foundation, Inc.,
25 ** 675 Mass Ave, Cambridge, MA 02139, USA.
27 ** The author until 9/93 can be contacted at:
28 ** e-mail: willus@ilm.pfc.mit.edu
29 ** U.S. mail: Will Menninger, 45 River St., #2, Boston, MA 02108-1124
42 /* For math functions */
43 #define SGN(x) ((x)<0 ? -1 : ((x)>0 ? 1 : 0))
44 #define ABS(x) ((x)<0 ? -(x) : (x))
45 #define SWAP(a,b) {float temp=(a);(a)=(b);(b)=temp;}
48 /* Global definitions */
49 #define VERSION "1.12"
64 #define MAXOUTLEN 1100
65 /* I removed the original definition of MAXOUTLEN because it was
66 too big on some compilers */
68 #define MAXOUTLEN (DBL_MAX_EXP+100)
85 /* binary operators */
97 #define BSTRING "+-*/^&|?%"
103 #define USTRING "+-~"
106 /* Global typecasts */
110 char name
[MAXNAMELEN
+1];
119 /* Function definitions */
121 /* ----- EVAL.C functions ---------------------------------------------- */
123 BOOLEAN
insert_var (VARPTR
new,VARPTR vlist
);
124 BOOLEAN
search_varlist (VARPTR var
,VARPTR vlist
,int *n
,int max
);
125 void fixup (char *s
);
127 /* ----- FUNCS.C functions --------------------------------------------- */
129 int func_code (char *);
130 BOOLEAN
func_eval (int,double *,double *);
131 char *func_name (int);
132 int func_nargs (int);
133 int print_funclist (FILE *s
,char *input
,int d
);
135 /* ----- PARSE.C functions -------------------------------------------- */
137 void evaluate (char *,int,VARPTR
,VARPTR
);
138 BOOLEAN
eerror (char *message
);
139 void tokcpy (TOKENPTR dest
,TOKENPTR source
);
141 /* ----- ESTACK.C functions ------------------------------------------- */
143 void clear_stack (void);
144 BOOLEAN
pop_token (TOKENPTR
);
145 BOOLEAN
push_token (TOKENPTR
);
146 BOOLEAN
top_of_stack (TOKENPTR
);
148 /* ----- ETABLE.C functions ------------------------------------------- */
150 BOOLEAN
add_token (TOKENPTR
);
151 void clear_table (void);
152 BOOLEAN
result (int,int,double *,double *);
153 BOOLEAN
table_value (double *);
155 /* ----- BASE.C functions --------------------------------------------- */
157 void baseconv (double val
,char *buf
);
158 void set_scinote (int val
);
159 void set_sigfig (int val
);
160 void set_dplace (int val
);
161 void set_maxexp (int val
);
162 void set_fix (int val
);
163 void setobase (int base
);
164 void setibase (int base
);
167 int get_scinote (void);
169 int precision (int base
);
170 void print_outtype (void);
171 double asciiconv (int base
,char *s
);
173 /* ----- BITWISE.C functions --------------------------------------------- */
175 double not (double val
);
176 double or (double val1
,double val2
);
177 double and (double val1
,double val2
);
178 double xor (double val1
,double val2
);
180 /* ----- EMATH.C functions ----------------------------------------------- */
182 double bessi (int,double);
183 double bessj (int,double);
184 double bessk (int,double);
185 double dbessi (int,double);
186 double dbessj (int,double);
187 double dbessk (int,double);
188 double jroot (int,int);
189 double djroot (int,int);
190 double factorial (int);
191 double root (double(*F
)(double),double,double,double,int *);
192 double root2 (double(*F
)(int,double),int,double,double,double,
194 double atanh (double x
);
195 double asinh (double x
);
196 double acosh (double x
);