2 * Copyright (C) 2004-2008 Sami Pietila
3 * Copyright (C) 2008-2011 Robert Ancell.
5 * This program is free software: you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License as published by the Free Software
7 * Foundation, either version 2 of the License, or (at your option) any later
8 * version. See http://www.gnu.org/copyleft/gpl.html the full text of the
22 PARSER_ERR_UNKNOWN_VARIABLE
,
23 PARSER_ERR_UNKNOWN_FUNCTION
,
24 PARSER_ERR_UNKNOWN_CONVERSION
,
28 /* Options for parser */
30 /* Default number base */
33 /* The wordlength for binary operations in bits (e.g. 8, 16, 32) */
36 /* Units for angles (e.g. radians, degrees) */
37 MPAngleUnit angle_units
;
40 // int enable_builtins;
42 /* Data to pass to callbacks */
45 /* Function to check if a variable is defined */
46 int (*variable_is_defined
)(const char *name
, void *data
);
48 /* Function to get variable values */
49 int (*get_variable
)(const char *name
, MPNumber
*z
, void *data
);
51 /* Function to set variable values */
52 void (*set_variable
)(const char *name
, const MPNumber
*x
, void *data
);
54 /* Function to check if a function is defined */
55 int (*function_is_defined
)(const char *name
, void *data
);
57 /* Function to solve functions */
58 int (*get_function
)(const char *name
, const MPNumber
*x
, MPNumber
*z
, void *data
);
60 /* Function to convert units */
61 int (*convert
)(const MPNumber
*x
, const char *x_units
, const char *z_units
, MPNumber
*z
, void *data
);
64 MPErrorCode
mp_equation_parse(const char *expression
, MPEquationOptions
*options
, MPNumber
*result
, char **error_token
);
65 const char *mp_error_code_to_string(MPErrorCode error_code
);
67 int sub_atoi(const char *data
);
68 int super_atoi(const char *data
);