comparison lwlib/lw_expr.h @ 249:1f1a28b797e1

Add trap for divide by zero in expression library Added a trap for division by zero in the expression library and adjusted lwasm to use it and report division by zero errors instead of crashing with a cryptic "arithmetic exception" or even more mysterious "floating point exception".
author William Astle <lost@l-w.ca>
date Fri, 25 Jan 2013 21:48:01 -0700
parents 6b9991fb39b6
children 3b5a45c6ab92
comparison
equal deleted inserted replaced
248:891bab942b5a 249:1f1a28b797e1
110 // run a function on all terms in an expression; if the function 110 // run a function on all terms in an expression; if the function
111 // returns non-zero for any term, return non-zero, else return 111 // returns non-zero for any term, return non-zero, else return
112 // zero 112 // zero
113 extern int lw_expr_testterms(lw_expr_t e, lw_expr_testfn_t *fn, void *priv); 113 extern int lw_expr_testterms(lw_expr_t e, lw_expr_testfn_t *fn, void *priv);
114 114
115 extern void lw_expr_setdivzero(void (*fn)(void *priv));
116
115 #endif /* def ___lw_expr_c_seen___ */ 117 #endif /* def ___lw_expr_c_seen___ */
116 118
117 #endif /* ___lw_expr_h_seen___ */ 119 #endif /* ___lw_expr_h_seen___ */