infixcalc#
Simple infix calculator for integer arithmetic Only the following binary operators are implemented:
| logical or
& logical and
= logical equal
! logical not equal
> logical greather than
< logical smaller than
+ plus
- minus
times
/ division
% modulus
^ power
Defines
-
INT_MIN#
Functions
-
int infixcalc(const char *expr, const InfixCalcVariable *vars, size_t nvars, char *err, size_t errlen)#
Parses the infix expression
exprand returns the evaluated result.The array
varslists available variables and should have lengthnvars. If there are no variables,varsmay be set to NULL.On error INT_MIN is returned and a message will be written to
err. No more thanerrlencharacters will be written. On successerr[0]will be set to NUL. If one is not interested to check for errors, one can seterrto NULL.
-
int infixcalc_depend(const char *expr, const char *varname)#
Returns non-zero if variable
varnameis in expressionexpr.
-
struct InfixCalcVariable#
- #include <infixcalc.h>
Variable with associated value