File indexing completed on 2025-01-18 10:02:03
0001 #ifndef MAD_EXPR_H
0002 #define MAD_EXPR_H
0003
0004
0005
0006 struct int_array;
0007 struct double_array;
0008 struct el_list;
0009 struct var_list;
0010
0011 struct expression
0012 {
0013 char name[NAME_L];
0014 char* string;
0015 int status;
0016
0017 struct int_array* polish;
0018 double value;
0019 int stamp;
0020 };
0021
0022 struct expr_list
0023 {
0024 int stamp;
0025 char name[NAME_L];
0026 int max,
0027 curr;
0028 struct expression** list;
0029 };
0030
0031
0032
0033 struct expression* make_expression(int n, char** toks);
0034 struct expression* new_expression(const char* in_string, struct int_array*);
0035 struct expression* clone_expression(struct expression*);
0036 struct expression* delete_expression(struct expression*);
0037 struct expression* scale_expr(struct expression*, double scale);
0038 struct expression* compound_expr(struct expression*, double v1, const char* oper, struct expression*, double v2, int parentheses);
0039 double expr_combine(struct expression*, double v1, const char* oper, struct expression*, double v2, struct expression**);
0040 double expression_value(struct expression*, int flag);
0041 void dump_expression(struct expression*);
0042
0043 struct expr_list* new_expr_list(int length);
0044 struct expr_list* clone_expr_list(struct expr_list*);
0045 struct expr_list* delete_expr_list(struct expr_list*);
0046 void grow_expr_list(struct expr_list*);
0047 void fill_expr_list(char** toks, int s_start, int s_end, struct expr_list*);
0048 void fill_expr_var_list(struct el_list*, struct expression*, struct var_list*);
0049 void update_vector(struct expr_list*, struct double_array*);
0050
0051 double double_from_expr(char** toks, int s_start, int s_end);
0052 int loc_expr(char** items, int nit, int start, int* end);
0053 int scan_expr(int c_item, char** item);
0054
0055 #endif
0056