/* Internal structures */ #include #include #include #include "eval.h" #include "memory.h" #include "pattern.h" #include "subst.h" /* How expressions are stored */ typedef double (*FUNCTION)(double); typedef enum {plus, minus, times, divide, power, opsize} e_op; typedef struct { FUNCTION func; value arg; } function; typedef struct { e_op op; value arg1, arg2; } operator; struct _value { enum {cste, var, fonc, op} type; union { double c; variable v; function f; operator o; } contents; }; /* A few defines to simplify access */ #define vr contents.v #define fn contents.f #define opr contents.o #define cte contents.c /* Table for stroring recognised functions */ typedef struct { FUNCTION func; char *functext; } onefunc; /* The tables of simplifications ... */ extern subst *simp[], *derv[]; onefunc *locate(FUNCTION); /* Find name of function from address */ onefunc *locate_name(char *); /* Find address of function from name */ double check_fp(double, double, double, char *);/* Map exceptions for /+-* to those used by math functions */ value _eval(value, int); /* Evaluate an expression(internal version) */