OpcUaCanOpen
CANopen OPC-UA server
muParserDef.h
Go to the documentation of this file.
1
/*
2
__________
3
_____ __ __\______ \_____ _______ ______ ____ _______
4
/ \ | | \| ___/\__ \ \_ __ \/ ___/_/ __ \\_ __ \
5
| Y Y \| | /| | / __ \_| | \/\___ \ \ ___/ | | \/
6
|__|_| /|____/ |____| (____ /|__| /____ > \___ >|__|
7
\/ \/ \/ \/
8
Copyright (C) 2014 Ingo Berg
9
10
Permission is hereby granted, free of charge, to any person obtaining a copy of this
11
software and associated documentation files (the "Software"), to deal in the Software
12
without restriction, including without limitation the rights to use, copy, modify,
13
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
14
permit persons to whom the Software is furnished to do so, subject to the following conditions:
15
16
The above copyright notice and this permission notice shall be included in all copies or
17
substantial portions of the Software.
18
19
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
20
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
22
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24
*/
25
#ifndef MUP_DEF_H
26
#define MUP_DEF_H
27
28
#include <iostream>
29
#include <string>
30
#include <sstream>
31
#include <map>
32
33
#include "
muParserFixes.h
"
34
39
#define MUP_VERSION _T("2.2.6")
40
#define MUP_VERSION_DATE _T("20181004")
41
42
#define MUP_CHARS _T("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
43
45
//#define MUP_MATH_EXCEPTIONS
46
52
#define MUP_BASETYPE double
53
58
//#define MUP_USE_OPENMP
59
60
#if defined(_UNICODE)
61
62
#define MUP_STRING_TYPE std::wstring
63
64
#if !defined(_T)
65
#define _T(x) L##x
66
#endif // not defined _T
67
#else
68
#ifndef _T
69
#define _T(x) x
70
#endif
71
73
#define MUP_STRING_TYPE std::string
74
#endif
75
76
#if defined(_DEBUG)
77
79
#define MUP_FAIL(MSG) \
80
{ \
81
bool MSG=false; \
82
assert(MSG); \
83
}
84
90
#define MUP_ASSERT(COND) \
91
if (!(COND)) \
92
{ \
93
stringstream_type ss; \
94
ss << _T("Assertion \"") _T(#COND) _T("\" failed: ") \
95
<< __FILE__ << _T(" line ") \
96
<< __LINE__ << _T("."); \
97
throw ParserError( ss.str() ); \
98
}
99
#else
100
#define MUP_FAIL(MSG)
101
#define MUP_ASSERT(COND)
102
#endif
103
104
105
namespace
mu
106
{
107
#if defined(_UNICODE)
108
109
//------------------------------------------------------------------------------
111
inline
std::wostream&
console
()
112
{
113
return
std::wcout;
114
}
115
117
inline
std::wistream&
console_in
()
118
{
119
return
std::wcin;
120
}
121
122
#else
123
128
inline
std::ostream&
console
()
129
{
130
return
std::cout;
131
}
132
137
inline
std::istream&
console_in
()
138
{
139
return
std::cin;
140
}
141
142
#endif
143
144
//------------------------------------------------------------------------------
149
enum
ECmdCode
150
{
151
// The following are codes for built in binary operators
152
// apart from built in operators the user has the opportunity to
153
// add user defined operators.
154
cmLE
= 0,
155
cmGE
= 1,
156
cmNEQ
= 2,
157
cmEQ
= 3,
158
cmLT
= 4,
159
cmGT
= 5,
160
cmADD
= 6,
161
cmSUB
= 7,
162
cmMUL
= 8,
163
cmDIV
= 9,
164
cmPOW
= 10,
165
cmLAND
= 11,
166
cmLOR
= 12,
167
cmASSIGN
= 13,
168
cmBO
= 14,
169
cmBC
= 15,
170
cmIF
= 16,
171
cmELSE
= 17,
172
cmENDIF
= 18,
173
cmARG_SEP
= 19,
174
cmVAR
= 20,
175
cmVAL
= 21,
176
177
// For optimization purposes
178
cmVARPOW2
,
179
cmVARPOW3
,
180
cmVARPOW4
,
181
cmVARMUL
,
182
cmPOW2
,
183
184
// operators and functions
185
cmFUNC
,
186
cmFUNC_STR
,
187
cmFUNC_BULK
,
188
cmSTRING
,
189
cmOPRT_BIN
,
190
cmOPRT_POSTFIX
,
191
cmOPRT_INFIX
,
192
cmEND
,
193
cmUNKNOWN
194
};
195
196
//------------------------------------------------------------------------------
199
enum
ETypeCode
200
{
201
tpSTR
= 0,
202
tpDBL
= 1,
203
tpVOID
= 2
204
};
205
206
//------------------------------------------------------------------------------
207
enum
EParserVersionInfo
208
{
209
pviBRIEF
,
210
pviFULL
211
};
212
213
//------------------------------------------------------------------------------
215
enum
EOprtAssociativity
216
{
217
oaLEFT
= 0,
218
oaRIGHT
= 1,
219
oaNONE
= 2
220
};
221
222
//------------------------------------------------------------------------------
224
enum
EOprtPrecedence
225
{
226
// binary operators
227
prLOR
= 1,
228
prLAND
= 2,
229
prLOGIC
= 3,
230
prCMP
= 4,
231
prADD_SUB
= 5,
232
prMUL_DIV
= 6,
233
prPOW
= 7,
234
235
// infix operators
236
prINFIX
= 6,
237
prPOSTFIX
= 6
238
};
239
240
//------------------------------------------------------------------------------
241
// basic types
242
247
typedef
MUP_BASETYPE
value_type
;
248
253
typedef
MUP_STRING_TYPE
string_type
;
254
259
typedef
string_type::value_type
char_type
;
260
262
typedef
std::basic_stringstream<
char_type
,
263
std::char_traits<char_type>,
264
std::allocator<char_type> >
stringstream_type
;
265
266
// Data container types
267
269
typedef
std::map<string_type, value_type*>
varmap_type
;
270
272
typedef
std::map<string_type, value_type>
valmap_type
;
273
275
typedef
std::map<string_type, std::size_t>
strmap_type
;
276
277
// Parser callbacks
278
280
typedef
value_type
(*
generic_fun_type
)();
281
283
typedef
value_type
(*
fun_type0
)();
284
286
typedef
value_type
(*
fun_type1
)(
value_type
);
287
289
typedef
value_type
(*
fun_type2
)(
value_type
,
value_type
);
290
292
typedef
value_type
(*
fun_type3
)(
value_type
,
value_type
,
value_type
);
293
295
typedef
value_type
(*
fun_type4
)(
value_type
,
value_type
,
value_type
,
value_type
);
296
298
typedef
value_type
(*
fun_type5
)(
value_type
,
value_type
,
value_type
,
value_type
,
value_type
);
299
301
typedef
value_type
(*
fun_type6
)(
value_type
,
value_type
,
value_type
,
value_type
,
value_type
,
value_type
);
302
304
typedef
value_type
(*
fun_type7
)(
value_type
,
value_type
,
value_type
,
value_type
,
value_type
,
value_type
,
value_type
);
305
307
typedef
value_type
(*
fun_type8
)(
value_type
,
value_type
,
value_type
,
value_type
,
value_type
,
value_type
,
value_type
,
value_type
);
308
310
typedef
value_type
(*
fun_type9
)(
value_type
,
value_type
,
value_type
,
value_type
,
value_type
,
value_type
,
value_type
,
value_type
,
value_type
);
311
313
typedef
value_type
(*
fun_type10
)(
value_type
,
value_type
,
value_type
,
value_type
,
value_type
,
value_type
,
value_type
,
value_type
,
value_type
,
value_type
);
314
316
typedef
value_type
(*
bulkfun_type0
)(int, int);
317
319
typedef
value_type
(*
bulkfun_type1
)(int, int,
value_type
);
320
322
typedef
value_type
(*
bulkfun_type2
)(int, int,
value_type
,
value_type
);
323
325
typedef
value_type
(*
bulkfun_type3
)(int, int,
value_type
,
value_type
,
value_type
);
326
328
typedef
value_type
(*
bulkfun_type4
)(int, int,
value_type
,
value_type
,
value_type
,
value_type
);
329
331
typedef
value_type
(*
bulkfun_type5
)(int, int,
value_type
,
value_type
,
value_type
,
value_type
,
value_type
);
332
334
typedef
value_type
(*
bulkfun_type6
)(int, int,
value_type
,
value_type
,
value_type
,
value_type
,
value_type
,
value_type
);
335
337
typedef
value_type
(*
bulkfun_type7
)(int, int,
value_type
,
value_type
,
value_type
,
value_type
,
value_type
,
value_type
,
value_type
);
338
340
typedef
value_type
(*
bulkfun_type8
)(int, int,
value_type
,
value_type
,
value_type
,
value_type
,
value_type
,
value_type
,
value_type
,
value_type
);
341
343
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
);
344
346
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
);
347
349
typedef
value_type
(*
multfun_type
)(
const
value_type
*, int);
350
352
typedef
value_type
(*
strfun_type1
)(
const
char_type
*);
353
355
typedef
value_type
(*
strfun_type2
)(
const
char_type
*,
value_type
);
356
358
typedef
value_type
(*
strfun_type3
)(
const
char_type
*,
value_type
,
value_type
);
359
361
typedef
int (*
identfun_type
)(
const
char_type
*sExpr,
int
*nPos,
value_type
*fVal);
362
364
typedef
value_type
* (*facfun_type)(
const
char_type
*,
void
*);
365
}
// end of namespace
366
367
#endif
368
muparser
include
muParserDef.h
Generated on Fri Sep 11 2020 14:30:11 for OpcUaCanOpen by
1.8.14