30
PARSER_ERR_UNKNOWN_VARIABLE,
31
PARSER_ERR_UNKNOWN_FUNCTION,
32
PARSER_ERR_UNKNOWN_CONVERSION,
28
#define PARSER_ERR_INVALID 1
29
#define PARSER_ERR_BITWISEOP 3
30
#define PARSER_ERR_MODULUSOP 4
31
#define PARSER_ERR_OVERFLOW 5
32
#define PARSER_ERR_UNKNOWN_VARIABLE 6
33
#define PARSER_ERR_UNKNOWN_FUNCTION 7
34
#define PARSER_ERR_INVALID_BASE 8
35
#define PARSER_ERR_MP 9
36
37
/* Options for parser */
39
/* The numeric base (e.g 2, 8, 10, 16) */
38
42
/* The wordlength for binary operations in bits (e.g. 8, 16, 32) */
41
45
/* Units for angles (e.g. radians, degrees) */
42
46
MPAngleUnit angle_units;
45
49
// int enable_builtins;
47
51
/* Data to pass to callbacks */
48
52
void *callback_data;
50
/* Function to check if a variable is defined */
51
int (*variable_is_defined)(const char *name);
53
54
/* Function to get variable values */
54
55
int (*get_variable)(const char *name, MPNumber *z, void *data);
56
57
/* Function to set variable values */
57
58
void (*set_variable)(const char *name, const MPNumber *x, void *data);
59
/* Function to check if a function is defined */
60
int (*function_is_defined)(const char *name);
62
60
/* Function to solve functions */
63
61
int (*get_function)(const char *name, const MPNumber *x, MPNumber *z, void *data);
65
/* Function to convert units */
66
int (*convert)(const MPNumber *x, const char *x_units, const char *z_units, MPNumber *z, void *data);
67
62
} MPEquationOptions;
69
MPErrorCode mp_equation_parse(const char *expression, MPEquationOptions *options, MPNumber *result, char **error_token);
70
const char *mp_error_code_to_string(MPErrorCode error_code);
64
int mp_equation_parse(const char *expression, MPEquationOptions *options, MPNumber *result);
72
int sub_atoi(const char *data);
73
int super_atoi(const char *data);