00001
00002 #ifndef EVAL_H
00003 #define EVAL_H
00004 #include "func_types.h"
00005 #include "param_types.h"
00006
00007 #define VAL_T 1
00008 #define PREFUN_T 3
00009 #define TREE_T 4
00010 #define NONE_T 0
00011
00012
00013 #define CONSTANT_TERM_T 0
00014 #define PARAM_TERM_T 1
00015
00016 #define INFIX_ADD 0
00017 #define INFIX_MINUS 1
00018 #define INFIX_MOD 2
00019 #define INFIX_DIV 3
00020 #define INFIX_MULT 4
00021 #define INFIX_OR 5
00022 #define INFIX_AND 6
00023
00024
00025
00026
00027 inline double eval_gen_expr(gen_expr_t * gen_expr);
00028 inline gen_expr_t * opt_gen_expr(gen_expr_t * gen_expr, int ** param_list);
00029
00030 gen_expr_t * const_to_expr(double val);
00031 gen_expr_t * param_to_expr(struct PARAM_T * param);
00032 gen_expr_t * prefun_to_expr(double (*func_ptr)(), gen_expr_t ** expr_list, int num_args);
00033
00034 tree_expr_t * new_tree_expr(infix_op_t * infix_op, gen_expr_t * gen_expr, tree_expr_t * left, tree_expr_t * right);
00035 gen_expr_t * new_gen_expr(int type, void * item);
00036 val_expr_t * new_val_expr(int type, term_t term);
00037
00038 int free_gen_expr(gen_expr_t * gen_expr);
00039 int free_prefun_expr(prefun_expr_t * prefun_expr);
00040 int free_tree_expr(tree_expr_t * tree_expr);
00041 int free_val_expr(val_expr_t * val_expr);
00042
00043 infix_op_t * new_infix_op(int type, int precedence);
00044 int init_infix_ops();
00045 int destroy_infix_ops();
00046 void reset_engine_vars();
00047
00048 gen_expr_t * clone_gen_expr(gen_expr_t * gen_expr);
00049 tree_expr_t * clone_tree_expr(tree_expr_t * tree_expr);
00050 val_expr_t * clone_val_expr(val_expr_t * val_expr);
00051 prefun_expr_t * clone_prefun_expr(prefun_expr_t * prefun_expr);
00052
00053
00054
00055 #endif