Mercurial > hg-old > index.cgi
comparison lwlib/lw_expr.h @ 346:a82c55070624
Added expression parsing infrastructure and misc fixes
author | lost@starbug |
---|---|
date | Sat, 27 Mar 2010 19:04:03 -0600 |
parents | 7b4123dce741 |
children | 1649bc7bda5a |
comparison
equal
deleted
inserted
replaced
345:7416c3f9c321 | 346:a82c55070624 |
---|---|
43 lw_expr_oper_bwor, // bitwise or | 43 lw_expr_oper_bwor, // bitwise or |
44 lw_expr_oper_bwxor, // bitwise xor | 44 lw_expr_oper_bwxor, // bitwise xor |
45 lw_expr_oper_and, // boolean and | 45 lw_expr_oper_and, // boolean and |
46 lw_expr_oper_or, // boolean or | 46 lw_expr_oper_or, // boolean or |
47 lw_expr_oper_neg, // unary negation, 2's complement | 47 lw_expr_oper_neg, // unary negation, 2's complement |
48 lw_expr_oper_com // unary 1's complement | 48 lw_expr_oper_com, // unary 1's complement |
49 lw_expr_oper_none = 0 | |
49 }; | 50 }; |
50 | 51 |
51 #ifdef ___lw_expr_c_seen___ | 52 #ifdef ___lw_expr_c_seen___ |
52 | 53 |
53 typedef struct lw_expr_priv * lw_expr_t; | 54 typedef struct lw_expr_priv * lw_expr_t; |
64 int value; // integer value | 65 int value; // integer value |
65 void *value2; // misc pointer value | 66 void *value2; // misc pointer value |
66 struct lw_expr_opers *operands; // ptr to list of operands (for operators) | 67 struct lw_expr_opers *operands; // ptr to list of operands (for operators) |
67 }; | 68 }; |
68 | 69 |
69 typedef lw_expr_t lw_expr_fn_t(int t, void *ptr); | 70 typedef lw_expr_t lw_expr_fn_t(int t, void *ptr, void *priv); |
70 typedef lw_expr_t lw_expr_fn2_t(char *var); | 71 typedef lw_expr_t lw_expr_fn2_t(char *var, void *priv); |
71 | 72 typedef lw_expr_t lw_expr_fn3_t(char **p, void *priv); |
72 | 73 |
73 #else /* def ___lw_expr_c_seen___ */ | 74 #else /* def ___lw_expr_c_seen___ */ |
74 | 75 |
75 typedef void * lw_expr_t; | 76 typedef void * lw_expr_t; |
76 | 77 |
79 extern lw_expr_t lw_expr_copy(lw_expr_t E); | 80 extern lw_expr_t lw_expr_copy(lw_expr_t E); |
80 extern void lw_expr_add_operand(lw_expr_t E, lw_expr_t O); | 81 extern void lw_expr_add_operand(lw_expr_t E, lw_expr_t O); |
81 extern lw_expr_t lw_expr_build(int exprtype, ...); | 82 extern lw_expr_t lw_expr_build(int exprtype, ...); |
82 extern void lw_expr_print(lw_expr_t E); | 83 extern void lw_expr_print(lw_expr_t E); |
83 extern int lw_expr_compare(lw_expr_t E1, lw_expr_t E2); | 84 extern int lw_expr_compare(lw_expr_t E1, lw_expr_t E2); |
84 extern void lw_expr_simplify(lw_expr_t E); | 85 extern void lw_expr_simplify(lw_expr_t E, void *priv); |
85 | 86 |
86 typedef lw_expr_t lw_expr_fn_t(int t, void *ptr); | 87 typedef lw_expr_t lw_expr_fn_t(int t, void *ptr, void *priv); |
87 typedef lw_expr_t lw_expr_fn2_t(char *var); | 88 typedef lw_expr_t lw_expr_fn2_t(char *var, void *priv); |
89 typedef lw_expr_t lw_expr_fn3_t(char **p, void *priv); | |
88 | 90 |
89 extern void lw_expr_set_special_handler(lw_expr_fn_t *fn); | 91 extern void lw_expr_set_special_handler(lw_expr_fn_t *fn); |
90 extern void lw_expr_set_var_handler(lw_expr_fn2_t *fn); | 92 extern void lw_expr_set_var_handler(lw_expr_fn2_t *fn); |
93 extern void lw_expr_set_term_parser(lw_expr_fn3_t *fn); | |
94 | |
95 extern lw_expr_t lw_expr_parse(char **p, void *priv); | |
91 | 96 |
92 #endif /* def ___lw_expr_c_seen___ */ | 97 #endif /* def ___lw_expr_c_seen___ */ |
93 | 98 |
94 #endif /* ___lw_expr_h_seen___ */ | 99 #endif /* ___lw_expr_h_seen___ */ |