muParser API -  1.35
Namespaces | Macros | Typedefs | Enumerations | Functions | Variables
muParserDef.h File Reference

This file contains standard definitions used by the parser. More...

#include <iostream>
#include <string>
#include <sstream>
#include <map>
#include "muParserFixes.h"
Include dependency graph for muParserDef.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 mu
 Namespace for mathematical applications.
 

Macros

#define MUP_BASETYPE   double
 Define the base datatype for values. More...
 
#define _T(x)   x
 Activate this option in order to compile with OpenMP support. More...
 
#define MUP_STRING_TYPE   std::string
 Definition of the basic parser string type.
 
#define MUP_ASSERT(COND)
 An assertion that does not kill the program. More...
 

Typedefs

typedef MUP_BASETYPE mu::value_type
 The numeric datatype used by the parser. More...
 
typedef MUP_STRING_TYPE mu::string_type
 The stringtype used by the parser. More...
 
typedef string_type::value_type mu::char_type
 The character type used by the parser. More...
 
typedef std::basic_stringstream< char_type, std::char_traits< char_type >, std::allocator< char_type > > mu::stringstream_type
 Typedef for easily using stringstream that respect the parser stringtype.
 
typedef std::map< string_type, value_type * > mu::varmap_type
 Type used for storing variables.
 
typedef std::map< string_type, value_type > mu::valmap_type
 Type used for storing constants.
 
typedef std::map< string_type, std::size_t > mu::strmap_type
 Type for assigning a string name to an index in the internal string table.
 
typedef void(* mu::erased_fun_type) ()
 Function type used to erase type. Voluntarily needs explicit cast with all other fun_type.
 
typedef value_type(* mu::fun_type0) ()
 Callback type used for functions without arguments.
 
typedef value_type(* mu::fun_type1) (value_type)
 Callback type used for functions with a single arguments.
 
typedef value_type(* mu::fun_type2) (value_type, value_type)
 Callback type used for functions with two arguments.
 
typedef value_type(* mu::fun_type3) (value_type, value_type, value_type)
 Callback type used for functions with three arguments.
 
typedef value_type(* mu::fun_type4) (value_type, value_type, value_type, value_type)
 Callback type used for functions with four arguments.
 
typedef value_type(* mu::fun_type5) (value_type, value_type, value_type, value_type, value_type)
 Callback type used for functions with five arguments.
 
typedef value_type(* mu::fun_type6) (value_type, value_type, value_type, value_type, value_type, value_type)
 Callback type used for functions with six arguments.
 
typedef value_type(* mu::fun_type7) (value_type, value_type, value_type, value_type, value_type, value_type, value_type)
 Callback type used for functions with seven arguments.
 
typedef value_type(* mu::fun_type8) (value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type)
 Callback type used for functions with eight arguments.
 
typedef value_type(* mu::fun_type9) (value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type)
 Callback type used for functions with nine arguments.
 
typedef value_type(* mu::fun_type10) (value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type)
 Callback type used for functions with ten arguments.
 
typedef value_type(* mu::fun_userdata_type0) (void *)
 Callback type with user data (not null) used for functions without arguments.
 
typedef value_type(* mu::fun_userdata_type1) (void *, value_type)
 Callback type with user data (not null) used for functions with a single arguments.
 
typedef value_type(* mu::fun_userdata_type2) (void *, value_type, value_type)
 Callback type with user data (not null) used for functions with two arguments.
 
typedef value_type(* mu::fun_userdata_type3) (void *, value_type, value_type, value_type)
 Callback type with user data (not null) used for functions with three arguments.
 
typedef value_type(* mu::fun_userdata_type4) (void *, value_type, value_type, value_type, value_type)
 Callback type with user data (not null) used for functions with four arguments.
 
typedef value_type(* mu::fun_userdata_type5) (void *, value_type, value_type, value_type, value_type, value_type)
 Callback type with user data (not null) used for functions with five arguments.
 
typedef value_type(* mu::fun_userdata_type6) (void *, value_type, value_type, value_type, value_type, value_type, value_type)
 Callback type with user data (not null) used for functions with six arguments.
 
typedef value_type(* mu::fun_userdata_type7) (void *, value_type, value_type, value_type, value_type, value_type, value_type, value_type)
 Callback type with user data (not null) used for functions with seven arguments.
 
typedef value_type(* mu::fun_userdata_type8) (void *, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type)
 Callback type with user data (not null) used for functions with eight arguments.
 
typedef value_type(* mu::fun_userdata_type9) (void *, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type)
 Callback type with user data (not null) used for functions with nine arguments.
 
typedef value_type(* mu::fun_userdata_type10) (void *, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type)
 Callback type with user data (not null) used for functions with ten arguments.
 
typedef value_type(* mu::bulkfun_type0) (int, int)
 Callback type used for functions without arguments.
 
typedef value_type(* mu::bulkfun_type1) (int, int, value_type)
 Callback type used for functions with a single arguments.
 
typedef value_type(* mu::bulkfun_type2) (int, int, value_type, value_type)
 Callback type used for functions with two arguments.
 
typedef value_type(* mu::bulkfun_type3) (int, int, value_type, value_type, value_type)
 Callback type used for functions with three arguments.
 
typedef value_type(* mu::bulkfun_type4) (int, int, value_type, value_type, value_type, value_type)
 Callback type used for functions with four arguments.
 
typedef value_type(* mu::bulkfun_type5) (int, int, value_type, value_type, value_type, value_type, value_type)
 Callback type used for functions with five arguments.
 
typedef value_type(* mu::bulkfun_type6) (int, int, value_type, value_type, value_type, value_type, value_type, value_type)
 Callback type used for functions with six arguments.
 
typedef value_type(* mu::bulkfun_type7) (int, int, value_type, value_type, value_type, value_type, value_type, value_type, value_type)
 Callback type used for functions with seven arguments.
 
typedef value_type(* mu::bulkfun_type8) (int, int, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type)
 Callback type used for functions with eight arguments.
 
typedef value_type(* mu::bulkfun_type9) (int, int, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type)
 Callback type used for functions with nine arguments.
 
typedef value_type(* mu::bulkfun_type10) (int, int, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type)
 Callback type used for functions with ten arguments.
 
typedef value_type(* mu::bulkfun_userdata_type0) (void *, int, int)
 Callback type with user data (not null) used for functions without arguments.
 
typedef value_type(* mu::bulkfun_userdata_type1) (void *, int, int, value_type)
 Callback type with user data (not null) used for functions with a single arguments.
 
typedef value_type(* mu::bulkfun_userdata_type2) (void *, int, int, value_type, value_type)
 Callback type with user data (not null) used for functions with two arguments.
 
typedef value_type(* mu::bulkfun_userdata_type3) (void *, int, int, value_type, value_type, value_type)
 Callback type with user data (not null) used for functions with three arguments.
 
typedef value_type(* mu::bulkfun_userdata_type4) (void *, int, int, value_type, value_type, value_type, value_type)
 Callback type with user data (not null) used for functions with four arguments.
 
typedef value_type(* mu::bulkfun_userdata_type5) (void *, int, int, value_type, value_type, value_type, value_type, value_type)
 Callback type with user data (not null) used for functions with five arguments.
 
typedef value_type(* mu::bulkfun_userdata_type6) (void *, int, int, value_type, value_type, value_type, value_type, value_type, value_type)
 Callback type with user data (not null) used for functions with six arguments.
 
typedef value_type(* mu::bulkfun_userdata_type7) (void *, int, int, value_type, value_type, value_type, value_type, value_type, value_type, value_type)
 Callback type with user data (not null) used for functions with seven arguments.
 
typedef value_type(* mu::bulkfun_userdata_type8) (void *, int, int, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type)
 Callback type with user data (not null) used for functions with eight arguments.
 
typedef value_type(* mu::bulkfun_userdata_type9) (void *, int, int, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type)
 Callback type with user data (not null) used for functions with nine arguments.
 
typedef value_type(* mu::bulkfun_userdata_type10) (void *, int, int, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type)
 Callback type with user data (not null) used for functions with ten arguments.
 
typedef value_type(* mu::multfun_type) (const value_type *, int)
 Callback type used for functions with a variable argument list.
 
typedef value_type(* mu::multfun_userdata_type) (void *, const value_type *, int)
 Callback type with user data (not null) used for functions and a variable argument list.
 
typedef value_type(* mu::strfun_type1) (const char_type *)
 Callback type used for functions taking a string as an argument.
 
typedef value_type(* mu::strfun_type2) (const char_type *, value_type)
 Callback type used for functions taking a string and a value as arguments.
 
typedef value_type(* mu::strfun_type3) (const char_type *, value_type, value_type)
 Callback type used for functions taking a string and two values as arguments.
 
typedef value_type(* mu::strfun_type4) (const char_type *, value_type, value_type, value_type)
 Callback type used for functions taking a string and three values as arguments.
 
typedef value_type(* mu::strfun_type5) (const char_type *, value_type, value_type, value_type, value_type)
 Callback type used for functions taking a string and four values as arguments.
 
typedef value_type(* mu::strfun_type6) (const char_type *, value_type, value_type, value_type, value_type, value_type)
 Callback type used for functions taking a string and five values as arguments.
 
typedef value_type(* mu::strfun_userdata_type1) (void *, const char_type *)
 Callback type with user data (not null) used for functions taking a string as an argument.
 
typedef value_type(* mu::strfun_userdata_type2) (void *, const char_type *, value_type)
 Callback type with user data (not null) used for functions taking a string and a value as arguments.
 
typedef value_type(* mu::strfun_userdata_type3) (void *, const char_type *, value_type, value_type)
 Callback type with user data (not null) used for functions taking a string and two values as arguments.
 
typedef value_type(* mu::strfun_userdata_type4) (void *, const char_type *, value_type, value_type, value_type)
 Callback type with user data (not null) used for functions taking a string and a value as arguments.
 
typedef value_type(* mu::strfun_userdata_type5) (void *, const char_type *, value_type, value_type, value_type, value_type)
 Callback type with user data (not null) used for functions taking a string and two values as arguments.
 
typedef value_type(* mu::strfun_userdata_type6) (void *, const char_type *, value_type, value_type, value_type, value_type, value_type)
 Callback type with user data (not null) used for functions taking a string and five values as arguments.
 
typedef int(* mu::identfun_type) (const char_type *sExpr, int *nPos, value_type *fVal)
 Callback used for functions that identify values in a string.
 
typedef value_type *(* mu::facfun_type) (const char_type *, void *)
 Callback used for variable creation factory functions.
 

Enumerations

enum  mu::ECmdCode {
  mu::cmLE = 0, mu::cmGE = 1, mu::cmNEQ = 2, mu::cmEQ = 3,
  mu::cmLT = 4, mu::cmGT = 5, mu::cmADD = 6, mu::cmSUB = 7,
  mu::cmMUL = 8, mu::cmDIV = 9, mu::cmPOW = 10, cmLAND = 11,
  cmLOR = 12, mu::cmASSIGN = 13, mu::cmBO = 14, mu::cmBC = 15,
  mu::cmIF = 16, mu::cmELSE = 17, mu::cmENDIF = 18, mu::cmARG_SEP = 19,
  mu::cmVAR = 20, mu::cmVAL = 21, cmVARPOW2 = 22, cmVARPOW3 = 23,
  cmVARPOW4 = 24, cmVARMUL = 25, mu::cmFUNC = 26, mu::cmFUNC_STR,
  mu::cmFUNC_BULK, mu::cmSTRING, mu::cmOPRT_BIN, mu::cmOPRT_POSTFIX,
  mu::cmOPRT_INFIX, mu::cmEND, mu::cmUNKNOWN
}
 Bytecode values. More...
 
enum  mu::ETypeCode { mu::tpSTR = 0, mu::tpDBL = 1, mu::tpVOID = 2 }
 Types internally used by the parser. More...
 
enum  EParserVersionInfo { pviBRIEF, pviFULL }
 
enum  mu::EOprtAssociativity { oaLEFT = 0, oaRIGHT = 1, oaNONE = 2 }
 Parser operator precedence values.
 
enum  mu::EOprtPrecedence {
  mu::prLOR = 1, mu::prLAND = 2, mu::prBOR = 3, mu::prBAND = 4,
  mu::prCMP = 5, mu::prADD_SUB = 6, mu::prMUL_DIV = 7, mu::prPOW = 8,
  mu::prINFIX = 7, mu::prPOSTFIX = 7
}
 Parser operator precedence values. More...
 
enum  mu::EErrorCodes {
  mu::ecUNEXPECTED_OPERATOR = 0, mu::ecUNASSIGNABLE_TOKEN = 1, mu::ecUNEXPECTED_EOF = 2, mu::ecUNEXPECTED_ARG_SEP = 3,
  mu::ecUNEXPECTED_ARG = 4, mu::ecUNEXPECTED_VAL = 5, mu::ecUNEXPECTED_VAR = 6, mu::ecUNEXPECTED_PARENS = 7,
  mu::ecUNEXPECTED_STR = 8, mu::ecSTRING_EXPECTED = 9, mu::ecVAL_EXPECTED = 10, mu::ecMISSING_PARENS = 11,
  mu::ecUNEXPECTED_FUN = 12, mu::ecUNTERMINATED_STRING = 13, mu::ecTOO_MANY_PARAMS = 14, mu::ecTOO_FEW_PARAMS = 15,
  mu::ecOPRT_TYPE_CONFLICT = 16, mu::ecSTR_RESULT = 17, mu::ecINVALID_NAME = 18, mu::ecINVALID_BINOP_IDENT = 19,
  mu::ecINVALID_INFIX_IDENT = 20, mu::ecINVALID_POSTFIX_IDENT = 21, mu::ecBUILTIN_OVERLOAD = 22, mu::ecINVALID_FUN_PTR = 23,
  mu::ecINVALID_VAR_PTR = 24, mu::ecEMPTY_EXPRESSION = 25, mu::ecNAME_CONFLICT = 26, mu::ecOPT_PRI = 27,
  mu::ecDOMAIN_ERROR = 28, mu::ecDIV_BY_ZERO = 29, mu::ecGENERIC = 30, mu::ecLOCALE = 31,
  ecUNEXPECTED_CONDITIONAL = 32, ecMISSING_ELSE_CLAUSE = 33, ecMISPLACED_COLON = 34, ecUNREASONABLE_NUMBER_OF_COMPUTATIONS = 35,
  mu::ecIDENTIFIER_TOO_LONG = 36, mu::ecEXPRESSION_TOO_LONG = 37, mu::ecINVALID_CHARACTERS_FOUND = 38, mu::ecINTERNAL_ERROR = 39,
  mu::ecBYTECODE_IMPORT_EXPORT_DISABLED = 40, mu::ecCOUNT, mu::ecUNDEFINED = -1
}
 Error codes. More...
 

Functions

std::ostream & mu::console ()
 Encapsulate cout. More...
 
std::istream & mu::console_in ()
 Encapsulate cin. More...
 

Variables

static const int mu::MaxLenExpression = 20000
 
static const int mu::MaxLenIdentifier = 100
 
static const string_type mu::ParserVersion = string_type(_T("2.3.5 (Release)"))
 
static const string_type mu::ParserVersionDate = string_type(_T("20241213"))
 

Detailed Description

This file contains standard definitions used by the parser.

Definition in file muParserDef.h.

Macro Definition Documentation

#define _T (   x)    x

Activate this option in order to compile with OpenMP support.

OpenMP is used only in the bulk mode it may increase the performance a bit.

!!! DO NOT ACTIVATE THIS MACRO HERE IF YOU USE CMAKE FOR BUILDING !!!

use the cmake option instead!

Definition at line 69 of file muParserDef.h.

Referenced by mu::ParserByteCode::AsciiDump(), mu::ParserBase::GetVersion(), mu::Parser::InitCharSets(), mu::Parser::InitConst(), mu::Parser::InitFun(), mu::ParserInt::InitFun(), mu::Parser::InitOprt(), mu::ParserInt::InitOprt(), mu::ParserError::ParserError(), and mu::ParserBase::SetExpr().

#define MUP_ASSERT (   COND)
Value:
if (!(COND)) \
{ \
stringstream_type ss; \
ss << _T("Assertion \"") _T(#COND) _T("\" failed: ") \
<< __FILE__ << _T(" line ") \
<< __LINE__ << _T("."); \
throw ParserError( ecINTERNAL_ERROR, -1, ss.str()); \
}
#define _T(x)
Activate this option in order to compile with OpenMP support.
Definition: muParserDef.h:69

An assertion that does not kill the program.

Definition at line 77 of file muParserDef.h.

Referenced by mu::ParserByteCode::AddOp(), mu::ParserToken< value_type, string_type >::GetArgCount(), mu::ParserTokenReader::ParserTokenReader(), mu::ParserTokenReader::ReadNextToken(), mu::ParserToken< value_type, string_type >::Set(), mu::ParserBase::ValidInfixOprtChars(), mu::ParserBase::ValidNameChars(), and mu::ParserBase::ValidOprtChars().

#define MUP_BASETYPE   double

Define the base datatype for values.

This datatype must be a built in value type. You can not use custom classes. It should be working with all types except "int"!

Definition at line 48 of file muParserDef.h.