kexpr evaluates math and boolean expressions
Procs
- proc ke_parse(s: cstring; err: ptr cint): ptr kexpr_t {...}{.importc: "ke_parse", cdecl.} 
- parse an expression and return errors in $err
- proc ke_destroy(ke: ptr kexpr_t) {...}{.importc: "ke_destroy", cdecl.} 
- free memory allocated during parsing
- proc ke_set_int(ke: ptr kexpr_t; `var`: cstring; x: int64): cint {...}{.importc: "ke_set_int", discardable, cdecl.} 
- set a variable to integer value and return the occurrence of the variable
- proc ke_set_real(ke: ptr kexpr_t; `var`: cstring; x: cdouble): cint {...}{. importc: "ke_set_real", discardable, cdecl.} 
- set a variable to real value and return the occurrence of the variable
- proc ke_set_str(ke: ptr kexpr_t; `var`: cstring; x: cstring): cint {...}{. importc: "ke_set_str", discardable, cdecl.} 
- set a variable to string value and return the occurrence of the variable
- proc ke_set_real_func1(ke: ptr kexpr_t; name: cstring; `func`: proc (a2: cdouble): cdouble): cint {...}{. importc: "ke_set_real_func1", cdecl.} 
- proc ke_set_real_func2(ke: ptr kexpr_t; name: cstring; `func`: proc (a2: cdouble; a3: cdouble): cdouble): cint {...}{. importc: "ke_set_real_func2", cdecl.} 
- set a user-defined function
- proc ke_set_default_func(ke: ptr kexpr_t): cint {...}{.importc: "ke_set_default_func", cdecl.} 
- set default math functions
- proc ke_unset(e: ptr kexpr_t) {...}{.importc: "ke_unset", cdecl.} 
- mark all variable as unset
- proc ke_eval(ke: ptr kexpr_t; i: ptr int64; r: ptr cdouble; s: cstringArray; ret_type: ptr cint): cint {...}{.importc: "ke_eval", cdecl.} 
- evaluate expression; return error code; final value is returned via pointers
- proc ke_eval_int(ke: ptr kexpr_t; err: ptr cint): int64 {...}{.importc: "ke_eval_int", cdecl.} 
- proc ke_eval_real(ke: ptr kexpr_t; err: ptr cint): cdouble {...}{.importc: "ke_eval_real", cdecl.} 
- proc ke_print(ke: ptr kexpr_t) {...}{.importc: "ke_print", cdecl.} 
- print the expression in Reverse Polish notation (RPN)
- proc expression(s: string): Expr {...}{.raises: [], tags: [].} 
- initalize an expression
- proc error(e: Expr): int {...}{.inline, raises: [], tags: [].} 
- check the error value of the expression. non-zero values are errors.
- proc clear(e: Expr) {...}{.inline, raises: [], tags: [].} 
- clear the error state and empty the expression.
- proc `[]=`(e: Expr; k: string; val: int or int32 or int64 or int8 or uint or uint8 or uint16 or uint32) {...}{.inline.} 
- proc `[]=`(e: Expr; k: string; val: float or float32 or float64) {...}{.inline.} 
- proc `[]=`(e: Expr; k: string; val: string) {...}{.inline, raises: [], tags: [].} 
Converters
- converter toInt(e: Expr): int {...}{.inline, raises: [], tags: [].} 
- evaluate the epression and interpret the result as an int.
- converter toInt64(e: Expr): int64 {...}{.inline, raises: [], tags: [].} 
- evaluate the epression and interpret the result as an int64.
- converter toBool(e: Expr): bool {...}{.inline, raises: [], tags: [].} 
- evaluate the epression and interpret the result as a bool
- converter toFloat(e: Expr): float {...}{.inline, raises: [], tags: [].} 
- evaluate the expression and interpret the result as a float.
- converter toFloat64(e: Expr): float64 {...}{.inline, raises: [], tags: [].} 
- evaluate the expression and interpret the result as a float64.