comparison src/expr.h @ 37:538e15927776

Added symbol handling to expression subsystem; adpated instruction handlers to the new scheme; misc fixes
author lost
date Sat, 03 Jan 2009 04:20:49 +0000
parents ec0bf61a5502
children d5fe306f1ab1
comparison
equal deleted inserted replaced
36:99e3b3310bac 37:538e15927776
95 value which will be a constant. Otherwise, the stack will contain the 95 value which will be a constant. Otherwise, the stack will contain the
96 expression with all operations that can be evaluated completely evaluated. 96 expression with all operations that can be evaluated completely evaluated.
97 You must call lwasm_expr_stack_free() on the result when you are finished 97 You must call lwasm_expr_stack_free() on the result when you are finished
98 with it. 98 with it.
99 */ 99 */
100 __expr_E__ lwasm_expr_stack_t *lwasm_expr_eval(const char *inp, const char **outp); 100 __expr_E__ lwasm_expr_stack_t *lwasm_expr_eval(const char *inp, const char **outp, int (*sfunc)(char *sym, void *state, int *val), void *state);
101 101
102 // simplify expression 102 // simplify expression
103 __expr_E__ int lwasm_expr_reval(lwasm_expr_stack_t *s); 103 __expr_E__ int lwasm_expr_reval(lwasm_expr_stack_t *s, int (*sfunc)(char *sym, void *state, int *val), void *state);
104 104
105 // useful macros 105 // useful macros
106 // is the expression "simple" (one term)? 106 // is the expression "simple" (one term)?
107 #define lwasm_expr_is_simple(s) ((s) -> head == (s) -> tail) 107 #define lwasm_expr_is_simple(s) ((s) -> head == (s) -> tail)
108 108