|
NAMEeval - evaluate simple arithmetic expressionsSYNOPSIS#include <mba/eval.h> struct eval *eval_new(symlook_fn symlook, void *context); DESCRIPTIONThe eval(3m) module will evaluate simple arithmentic expressions consisting of integers, symbols for which the provided symlook_fn returns an integer, and any of the operators |&^+-*/().OperatorPrecedenceOperator precedence is roughly the same as the C language. ( ) higher * / + - ^ & | lower Prefixing integer tokens with minus '-' to indicate a negative value is currently not supported.
typedef int (*symlook_fn)(const tchar *name, unsigned long *val, void *context); The symlook_fn function will be called to resolve any non-numeric symbols and should place the value identified by name into val and return 0. If the symbol is not found -1 should be returned. The eval_new function can be used repeatedly to evaluate any number of expressions before being destroyed with the eval_del function. The context parameter is passed uninterpreted to the symlook_fn (e.g. a map perhaps).
RETURNS
Visit the GSP FreeBSD Man Page Interface. |