2 * Copyright (C) 2004-2008 Sami Pietila
3 * Copyright (C) 2008-2009 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
12 #ifndef MP_EQUATION_PRIVATE_H
13 #define MP_EQUATION_PRIVATE_H
15 #include "mp-equation.h"
17 typedef struct MPEquationParserState MPEquationParserState
;
19 /* State for parser */
20 struct MPEquationParserState
{
21 /* User provided options */
22 MPEquationOptions
*options
;
24 /* Function to check if a variable is defined */
25 int (*variable_is_defined
)(MPEquationParserState
*state
, const char *name
);
27 /* Function to get variable values */
28 int (*get_variable
)(MPEquationParserState
*state
, const char *name
, MPNumber
*z
);
30 /* Function to set variable values */
31 void (*set_variable
)(MPEquationParserState
*state
, const char *name
, const MPNumber
*x
);
33 /* Function to check if a function is defined */
34 int (*function_is_defined
)(MPEquationParserState
*state
, const char *name
);
36 /* Function to solve functions */
37 int (*get_function
)(MPEquationParserState
*state
, const char *name
, const MPNumber
*x
, MPNumber
*z
);
39 /* Function to convert units */
40 int (*convert
)(MPEquationParserState
*state
, const MPNumber
*x
, const char *x_units
, const char *z_units
, MPNumber
*z
);
42 // FIXME: get_operator??
44 /* Error returned from parser */
47 /* Name of token where error occured */
50 /* Value returned from parser */
54 int _mp_equation_error(void *yylloc
, MPEquationParserState
*state
, char *text
);