diff 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
line wrap: on
line diff
--- a/lwlib/lw_expr.h	Thu Mar 25 23:17:54 2010 -0600
+++ b/lwlib/lw_expr.h	Sat Mar 27 19:04:03 2010 -0600
@@ -45,7 +45,8 @@
 	lw_expr_oper_and,			// boolean and
 	lw_expr_oper_or,			// boolean or
 	lw_expr_oper_neg,			// unary negation, 2's complement
-	lw_expr_oper_com			// unary 1's complement
+	lw_expr_oper_com,			// unary 1's complement
+	lw_expr_oper_none = 0
 };
 
 #ifdef ___lw_expr_c_seen___
@@ -66,9 +67,9 @@
 	struct lw_expr_opers *operands;		// ptr to list of operands (for operators)
 };
 
-typedef lw_expr_t lw_expr_fn_t(int t, void *ptr);
-typedef lw_expr_t lw_expr_fn2_t(char *var);
-
+typedef lw_expr_t lw_expr_fn_t(int t, void *ptr, void *priv);
+typedef lw_expr_t lw_expr_fn2_t(char *var, void *priv);
+typedef lw_expr_t lw_expr_fn3_t(char **p, void *priv);
 
 #else /* def ___lw_expr_c_seen___ */
 
@@ -81,13 +82,17 @@
 extern lw_expr_t lw_expr_build(int exprtype, ...);
 extern void lw_expr_print(lw_expr_t E);
 extern int lw_expr_compare(lw_expr_t E1, lw_expr_t E2);
-extern void lw_expr_simplify(lw_expr_t E);
+extern void lw_expr_simplify(lw_expr_t E, void *priv);
 
-typedef lw_expr_t lw_expr_fn_t(int t, void *ptr);
-typedef lw_expr_t lw_expr_fn2_t(char *var);
+typedef lw_expr_t lw_expr_fn_t(int t, void *ptr, void *priv);
+typedef lw_expr_t lw_expr_fn2_t(char *var, void *priv);
+typedef lw_expr_t lw_expr_fn3_t(char **p, void *priv);
 
 extern void lw_expr_set_special_handler(lw_expr_fn_t *fn);
 extern void lw_expr_set_var_handler(lw_expr_fn2_t *fn);
+extern void lw_expr_set_term_parser(lw_expr_fn3_t *fn);
+
+extern lw_expr_t lw_expr_parse(char **p, void *priv);
 
 #endif /* def ___lw_expr_c_seen___ */