41#define MUP_VERSION _nrT("2.2.2")
42#define MUP_VERSION_DATE _nrT("20120218; SF")
44#define MUP_CHARS _nrT("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
54#define MUP_BASETYPE std::complex<double>
65#define MUP_STRING_TYPE std::string
76#define MUP_STRING_TYPE std::string
82#define MUP_FAIL(MSG) \
93#define MUP_ASSERT(COND) \
96 stringstream_type ss; \
97 ss << _T("Assertion \"") _T(#COND) _T("\" failed: ") \
98 << __FILE__ << _T(" line ") \
99 << __LINE__ << _T("."); \
100 throw ParserError( ss.str() ); \
104#define MUP_ASSERT(COND)
114 inline std::wostream&
console()
266 typedef std::basic_stringstream<
char_type,
267 std::char_traits<char_type>,
350 typedef value_type (*
bulkfun_type9)(int, int,
value_type,
value_type,
value_type,
value_type,
value_type,
value_type,
value_type,
value_type,
value_type);
353 typedef value_type (*
bulkfun_type10)(int, int,
value_type,
value_type,
value_type,
value_type,
value_type,
value_type,
value_type,
value_type,
value_type,
value_type);
386 for (
int i = 0; i < nElem; i++)
395 std::vector<double>
real(
const std::vector<value_type>& vVec);
396 std::vector<double>
imag(
const std::vector<value_type>& vVec);
#define MUP_BASETYPE
If this macro is defined mathematical exceptions (div by zero) will be thrown as exceptions.
This file contains compatibility fixes for some platforms.
Namespace for mathematical applications.
value_type(* multfun_type)(const value_type *, int)
Callback type used for functions with a variable argument list.
std::istream & console_in()
Encapsulate cin.
value_type(* fun_type9)(const value_type &, const value_type &, const value_type &, const value_type &, const value_type &, const value_type &, const value_type &, const value_type &, const value_type &)
Callback type used for functions with five arguments.
int(* identfun_type)(const char_type *sExpr, int *nPos, value_type *fVal)
Callback used for functions that identify values in a string.
value_type(* fun_type6)(const value_type &, const value_type &, const value_type &, const value_type &, const value_type &, const value_type &)
Callback type used for functions with five arguments.
value_type(* bulkfun_type6)(int, int, value_type, value_type, value_type, value_type, value_type, value_type)
Callback type used for functions with five arguments.
value_type(* strfun_type2)(const char_type *, value_type)
Callback type used for functions taking a string and a value as arguments.
MUP_BASETYPE value_type
The numeric datatype used by the parser.
value_type(* strfun_type3)(const char_type *, value_type, value_type)
Callback type used for functions taking a string and two values as arguments.
bool isnan(const value_type &v)
value_type(* bulkfun_type1)(int, int, value_type)
Callback type used for functions with a single arguments.
value_type(* bulkfun_type3)(int, int, value_type, value_type, value_type)
Callback type used for functions with three arguments.
value_type(* fun_type10)(const value_type &, const value_type &, const value_type &, const value_type &, const value_type &, const value_type &, const value_type &, const value_type &, const value_type &, const value_type &)
Callback type used for functions with five arguments.
value_type(* 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 five arguments.
value_type(* strfun_type1)(const char_type *)
Callback type used for functions taking a string as an argument.
std::map< string_type, value_type > valmap_type
Type used for storing constants.
std::vector< double > real(const std::vector< value_type > &vVec)
value_type(* bulkfun_type4)(int, int, value_type, value_type, value_type, value_type)
Callback type used for functions with four arguments.
value_type(* fun_type2)(const value_type &, const value_type &)
Callback type used for functions with two arguments.
string_type::value_type char_type
The character type used by the parser.
std::vector< double > imag(const std::vector< value_type > &vVec)
value_type(* fun_type7)(const value_type &, const value_type &, const value_type &, const value_type &, const value_type &, const value_type &, const value_type &)
Callback type used for functions with five arguments.
std::vector< value_type > valbuf_type
Type used for storing an array of values.
bool isinf(const value_type &v)
value_type(* bulkfun_type5)(int, int, value_type, value_type, value_type, value_type, value_type)
Callback type used for functions with five arguments.
value_type(* fun_type5)(const value_type &, const value_type &, const value_type &, const value_type &, const value_type &)
Callback type used for functions with five arguments.
value_type(* bulkfun_type7)(int, int, value_type, value_type, value_type, value_type, value_type, value_type, value_type)
Callback type used for functions with five arguments.
value_type(* bulkfun_type2)(int, int, value_type, value_type)
Callback type used for functions with two arguments.
value_type(* 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 five arguments.
value_type(* fun_type1)(const value_type &)
Callback type used for functions with a single arguments.
std::basic_stringstream< char_type, std::char_traits< char_type >, std::allocator< char_type > > stringstream_type
Typedef for easily using stringstream that respect the parser stringtype.
std::map< string_type, value_type * > varmap_type
Type used for storing variables.
@ cmFUNC_BULK
Special callbacks for Bulk mode with an additional parameter for the bulk index.
@ cmADD
Operator item: add.
@ cmGE
Operator item: greater or equal.
@ cmLT
Operator item: less than.
@ cmPOW
Operator item: y to the power of ...
@ cmASSIGN
Operator item: Assignment operator.
@ cmARG_SEP
function argument separator
@ cmLE
Operator item: less or equal.
@ cmBO
Operator item: opening bracket.
@ cmMUL
Operator item: multiply.
@ cmSTRING
Code for a string token.
@ cmDIV
Operator item: division.
@ cmENDIF
For use in the ternary if-then-else operator.
@ cmVAR_END
Only for identifying the end of the variable block.
@ cmOPRT_INFIX
code for infix operators
@ cmBC
Operator item: closing bracket.
@ cmOPRT_BIN
user defined binary operator
@ cmIF
For use in the ternary if-then-else operator.
@ cmUNKNOWN
uninitialized item
@ cmNEQ
Operator item: not equal.
@ cmGT
Operator item: greater than.
@ cmEQ
Operator item: equals.
@ cmSUB
Operator item: subtract.
@ cmFUNC_STR
Code for a function with a string parameter.
@ cmFUNC
Code for a generic function item.
@ cmOPRT_POSTFIX
code for postfix operators
@ cmELSE
For use in the ternary if-then-else operator.
std::ostream & console()
Encapsulate cout.
value_type rint(value_type v)
ETypeCode
Types internally used by the parser.
@ tpDBL
Floating point variables.
@ tpSTR
String type (Function arguments and constants only, no string variables)
value_type(* fun_type8)(const value_type &, const value_type &, const value_type &, const value_type &, const value_type &, const value_type &, const value_type &, const value_type &)
Callback type used for functions with five arguments.
value_type(* generic_fun_type)()
Callback type used for functions without arguments.
std::string string_type
The stringtype used by the parser.
std::map< string_type, std::size_t > strmap_type
Type for assigning a string name to an index in the internal string table.
value_type(* 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 five arguments.
value_type(* fun_type4)(const value_type &, const value_type &, const value_type &, const value_type &)
Callback type used for functions with four arguments.
EOprtPrecedence
Parser operator precedence values.
@ prPOSTFIX
Postfix operator priority (currently unused)
@ prINFIX
Signs have a higher priority than ADD_SUB, but lower than power operator.
@ prCMP
comparsion operators
@ prPOW
power operator priority (highest)
@ prMUL_DIV
multiplication/division
bool isreal(value_type *v, int nElem)
value_type(* fun_type0)()
Callback type used for functions without arguments.
value_type(* fun_type3)(const value_type &, const value_type &, const value_type &)
Callback type used for functions with three arguments.
EOprtAssociativity
Parser operator precedence values.
value_type(* bulkfun_type0)(int, int)
Callback type used for functions without arguments.