00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 namespace FUNCTIONPARSERTYPES
00019 {
00020
00021 enum OPCODE
00022 {
00023 cAbs, cAcos,
00024 #ifndef NO_ASINH
00025 cAcosh,
00026 #endif
00027 cAsin,
00028 #ifndef NO_ASINH
00029 cAsinh,
00030 #endif
00031 cAtan,
00032 cAtan2,
00033 #ifndef NO_ASINH
00034 cAtanh,
00035 #endif
00036 cCeil, cCos, cCosh, cCot, cCsc,
00037 #ifndef DISABLE_EVAL
00038 cEval,
00039 #endif
00040 cExp, cFloor, cIf, cInt, cLog, cLog10, cMax, cMin,
00041 cSec, cSin, cSinh, cSqrt, cTan, cTanh,
00042
00043
00044 cImmed, cJump,
00045 cNeg, cAdd, cSub, cMul, cDiv, cMod, cPow,
00046 cEqual, cNEqual, cLess, cLessOrEq, cGreater, cGreaterOrEq,
00047 cNot, cAnd, cOr,
00048
00049 cDeg, cRad,
00050
00051 cFCall, cPCall,
00052
00053 #ifdef SUPPORT_OPTIMIZER
00054 cVar, cDup, cInv,
00055 #endif
00056
00057 VarBegin
00058 };
00059
00060 struct FuncDefinition
00061 {
00062 const char* name;
00063 unsigned nameLength;
00064 unsigned opcode;
00065 unsigned params;
00066
00067
00068
00069 bool operator<(const FuncDefinition& rhs) const
00070 {
00071 for(unsigned i = 0; i < nameLength; ++i)
00072 {
00073 if(i == rhs.nameLength) return false;
00074 const char c1 = name[i], c2 = rhs.name[i];
00075 if(c1 < c2) return true;
00076 if(c2 < c1) return false;
00077 }
00078 return nameLength < rhs.nameLength;
00079 }
00080 };
00081
00082
00083
00084 const FuncDefinition Functions[]=
00085 {
00086 { "abs", 3, cAbs, 1 },
00087 { "acos", 4, cAcos, 1 },
00088 #ifndef NO_ASINH
00089 { "acosh", 5, cAcosh, 1 },
00090 #endif
00091 { "asin", 4, cAsin, 1 },
00092 #ifndef NO_ASINH
00093 { "asinh", 5, cAsinh, 1 },
00094 #endif
00095 { "atan", 4, cAtan, 1 },
00096 { "atan2", 5, cAtan2, 2 },
00097 #ifndef NO_ASINH
00098 { "atanh", 5, cAtanh, 1 },
00099 #endif
00100 { "ceil", 4, cCeil, 1 },
00101 { "cos", 3, cCos, 1 },
00102 { "cosh", 4, cCosh, 1 },
00103 { "cot", 3, cCot, 1 },
00104 { "csc", 3, cCsc, 1 },
00105 #ifndef DISABLE_EVAL
00106 { "eval", 4, cEval, 0 },
00107 #endif
00108 { "exp", 3, cExp, 1 },
00109 { "floor", 5, cFloor, 1 },
00110 { "if", 2, cIf, 0 },
00111 { "int", 3, cInt, 1 },
00112 { "log", 3, cLog, 1 },
00113 { "log10", 5, cLog10, 1 },
00114 { "max", 3, cMax, 2 },
00115 { "min", 3, cMin, 2 },
00116 { "sec", 3, cSec, 1 },
00117 { "sin", 3, cSin, 1 },
00118 { "sinh", 4, cSinh, 1 },
00119 { "sqrt", 4, cSqrt, 1 },
00120 { "tan", 3, cTan, 1 },
00121 { "tanh", 4, cTanh, 1 }
00122 };
00123 }