1 /*************************************************************************** 2 File : MyParser.h 3 Project : QtiPlot 4 -------------------------------------------------------------------- 5 Copyright : (C) 2006 by Ion Vasilief 6 Email (use @ for *) : ion_vasilief*yahoo.fr 7 Description : Parser class based on muParser 8 9 ***************************************************************************/ 10 11 /*************************************************************************** 12 * * 13 * This program is free software; you can redistribute it and/or modify * 14 * it under the terms of the GNU General Public License as published by * 15 * the Free Software Foundation; either version 2 of the License, or * 16 * (at your option) any later version. * 17 * * 18 * This program is distributed in the hope that it will be useful, * 19 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 21 * GNU General Public License for more details. * 22 * * 23 * You should have received a copy of the GNU General Public License * 24 * along with this program; if not, write to the Free Software * 25 * Foundation, Inc., 51 Franklin Street, Fifth Floor, * 26 * Boston, MA 02110-1301 USA * 27 * * 28 ***************************************************************************/ 29 #ifndef MYPARSER_H 30 #define MYPARSER_H 31 32 #include <muParser.h> 33 #include <qstringlist.h> 34 35 using namespace mu; 36 37 class QLocale; 38 39 /*!\brief Mathematical parser class based on muParser. 40 * 41 * \section future Future Plans 42 * Eliminate in favour of Script/ScriptingEnv. 43 * This will allow you to use e.g. Python's global variables and functions everywhere. 44 * Before this happens, a cleaner and more generic solution for accessing the current ScriptingEnv 45 * should be implemented (maybe by making it a property of Project; see ApplicationWindow). 46 */ 47 class MyParser : public Parser 48 { 49 public: 50 MyParser(); 51 void addGSLConstants(); 52 void setLocale(const QLocale& locale); 53 static QLocale getLocale(); 54 55 const static QStringList functionsList(); 56 const static QStringList functionNamesList(); 57 static QString explainFunction(int index); 58 59 double EvalRemoveSingularity(double *xvar, bool noisy = true) const; 60 double DiffRemoveSingularity(double *xvar, double *a_Var,double a_fPos) const; 61 static void SingularityErrorMessage(double xvar); 62 63 class Singularity {}; 64 class Pole {}; 65 }; 66 67 #endif 68