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
20 #ifndef MP_EQUATION_PRIVATE_H
21 #define MP_EQUATION_PRIVATE_H
23 #include "mp-equation.h"
25 typedef struct MPEquationParserState MPEquationParserState
;
27 /* State for parser */
28 struct MPEquationParserState
{
29 /* User provided options */
30 MPEquationOptions
*options
;
32 /* Function to check if a variable is defined */
33 int (*variable_is_defined
)(MPEquationParserState
*state
, const char *name
);
35 /* Function to get variable values */
36 int (*get_variable
)(MPEquationParserState
*state
, const char *name
, MPNumber
*z
);
38 /* Function to set variable values */
39 void (*set_variable
)(MPEquationParserState
*state
, const char *name
, const MPNumber
*x
);
41 /* Function to check if a function is defined */
42 int (*function_is_defined
)(MPEquationParserState
*state
, const char *name
);
44 /* Function to solve functions */
45 int (*get_function
)(MPEquationParserState
*state
, const char *name
, const MPNumber
*x
, MPNumber
*z
);
47 /* Function to convert units */
48 int (*convert
)(MPEquationParserState
*state
, const MPNumber
*x
, const char *x_units
, const char *z_units
, MPNumber
*z
);
50 // FIXME: get_operator??
52 /* Error returned from parser */
55 /* Name of token where error occured */
58 /* Value returned from parser */
62 int _mp_equation_error(void *yylloc
, MPEquationParserState
*state
, char *text
);