Updated Danish translation
[gcalctool.git] / src / mp-equation-private.h
blob7ef96c2acfd30b43c8a34ae54a832b31b0d01d84
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)
7 * any later version.
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
17 * 02111-1307, USA.
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 */
53 int error;
55 /* Name of token where error occured */
56 char *error_token;
58 /* Value returned from parser */
59 MPNumber ret;
62 int _mp_equation_error(void *yylloc, MPEquationParserState *state, char *text);
64 #endif