1 /* Copyright (c) 2004-2008 Sami Pietila
2 * Copyright (c) 2008-2009 Robert Ancell
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2, or (at your option)
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
30 PARSER_ERR_UNKNOWN_VARIABLE
,
31 PARSER_ERR_UNKNOWN_FUNCTION
,
32 PARSER_ERR_UNKNOWN_CONVERSION
,
36 /* Options for parser */
38 /* Default number base */
41 /* The wordlength for binary operations in bits (e.g. 8, 16, 32) */
44 /* Units for angles (e.g. radians, degrees) */
45 MPAngleUnit angle_units
;
48 // int enable_builtins;
50 /* Data to pass to callbacks */
53 /* Function to check if a variable is defined */
54 int (*variable_is_defined
)(const char *name
, void *data
);
56 /* Function to get variable values */
57 int (*get_variable
)(const char *name
, MPNumber
*z
, void *data
);
59 /* Function to set variable values */
60 void (*set_variable
)(const char *name
, const MPNumber
*x
, void *data
);
62 /* Function to check if a function is defined */
63 int (*function_is_defined
)(const char *name
, void *data
);
65 /* Function to solve functions */
66 int (*get_function
)(const char *name
, const MPNumber
*x
, MPNumber
*z
, void *data
);
68 /* Function to convert units */
69 int (*convert
)(const MPNumber
*x
, const char *x_units
, const char *z_units
, MPNumber
*z
, void *data
);
72 MPErrorCode
mp_equation_parse(const char *expression
, MPEquationOptions
*options
, MPNumber
*result
, char **error_token
);
73 const char *mp_error_code_to_string(MPErrorCode error_code
);
75 int sub_atoi(const char *data
);
76 int super_atoi(const char *data
);