00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef MU_PARSER_INT_H
00027 #define MU_PARSER_INT_H
00028
00029 #include "muParserBase.h"
00030 #include <vector>
00031
00037 namespace mu
00038 {
00039
00045 class ParserInt : public ParserBase
00046 {
00047 private:
00048 static int Round(value_type v) { return (int)(v + ((v>=0) ? 0.5 : -0.5) ); };
00049
00050 static value_type Abs(value_type);
00051 static value_type Sign(value_type);
00052 static value_type Ite(value_type, value_type, value_type);
00053
00054 static value_type UnaryMinus(value_type);
00055
00056 static value_type Sum(const value_type* a_afArg, int a_iArgc);
00057 static value_type Min(const value_type* a_afArg, int a_iArgc);
00058 static value_type Max(const value_type* a_afArg, int a_iArgc);
00059
00060 static value_type Add(value_type v1, value_type v2);
00061 static value_type Sub(value_type v1, value_type v2);
00062 static value_type Mul(value_type v1, value_type v2);
00063 static value_type Div(value_type v1, value_type v2);
00064 static value_type Mod(value_type v1, value_type v2);
00065 static value_type Shr(value_type v1, value_type v2);
00066 static value_type Shl(value_type v1, value_type v2);
00067 static value_type LogAnd(value_type v1, value_type v2);
00068 static value_type LogOr(value_type v1, value_type v2);
00069 static value_type LogXor(value_type v1, value_type v2);
00070 static value_type And(value_type v1, value_type v2);
00071 static value_type Or(value_type v1, value_type v2);
00072 static value_type Xor(value_type v1, value_type v2);
00073 static value_type Less(value_type v1, value_type v2);
00074 static value_type Greater(value_type v1, value_type v2);
00075 static value_type LessEq(value_type v1, value_type v2);
00076 static value_type GreaterEq(value_type v1, value_type v2);
00077 static value_type Equal(value_type v1, value_type v2);
00078 static value_type NotEqual(value_type v1, value_type v2);
00079 static value_type Not(value_type v1);
00080
00081 static int IsHexVal(const char_type* a_szExpr, int *a_iPos, value_type *a_iVal);
00082 static int IsBinVal(const char_type* a_szExpr, int *a_iPos, value_type *a_iVal);
00083 static int IsVal (const char_type* a_szExpr, int *a_iPos, value_type *a_iVal);
00084
00085 public:
00086 ParserInt();
00087
00088 virtual void InitFun();
00089 virtual void InitOprt();
00090 virtual void InitConst();
00091 virtual void InitCharSets();
00092 };
00093
00094 }
00095
00096 #endif
00097