SNAP Library, Developer Reference  2012-10-02 12:56:23
SNAP, a general purpose network analysis and graph mining library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
exp.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  TExpBi

Enumerations

enum  TExpValType {
  evtUndef, evtFlt, evtStr, evtVec,
  evtLst
}
enum  TExpFuncArgType {
  efatUndef, efatVoid, efatFlt, efatFltFlt,
  efatFltStr, efatStr, efatStrFlt, efatStrStr,
  efatStrAny
}
enum  TExpBiId {
  ebi_Undef, ebi_True, ebi_False, ebi_E,
  ebi_Pi, ebi_Sin, ebi_Cos, ebi_Tan,
  ebi_ASin, ebi_ACos, ebi_ATan, ebi_SinH,
  ebi_CosH, ebi_TanH, ebi_Pow, ebi_Exp,
  ebi_Sqr, ebi_Sqrt, ebi_Log, ebi_Log10,
  ebi_Ceil, ebi_Floor, ebi_Int, ebi_Frac,
  ebi_Abs, ebi_UniDev, ebi_NrmDev, ebi_ExpDev,
  ebi_GamDev, ebi_PoiDev, ebi_BinDev, ebi_UniDevStep,
  ebi_NrmDevStep, ebi_ExpDevStep
}
enum  TExpBiArgType { ebatUndef, ebatVoid, ebatFlt, ebatFltFlt }
enum  TExpType {
  etUndef, etVal, etVec, etLst,
  etOp, etVar, etBiConst, etFunc,
  etBiFunc
}
enum  TExpOp {
  eoUndef, eoUPlus, eoUMinus, eoPlus,
  eoMinus, eoMul, eoDiv, eoIDiv,
  eoMod, eoNot, eoAnd, eoOr,
  eoEq, eoNEq, eoLss, eoGtr,
  eoLEq, eoGEq, eoIf
}
enum  TExpHelpObjType {
  ehotUndef, ehotOp, ehotVar, ehotFunc,
  ehotTempl
}

Functions

 TExpVal (const TExpValType &_ValType=evtUndef)
 TExpVal (const TFlt &_Flt)
 TExpVal (const double &_Flt)
 TExpVal (const TStr &_Str)
static PExpVal New (const TExpValType &ValType=evtUndef)
static PExpVal New (const TFlt &Flt)
static PExpVal New (const double &Flt)
static PExpVal New (const TStr &Str)
 ~TExpVal ()
 TExpVal (TSIn &SIn)
static PExpVal Load (TSIn &SIn)
void Save (TSOut &SOut) const
TExpValoperator= (const TExpVal &)
bool operator== (const TExpVal &ExpVal) const
bool operator< (const TExpVal &ExpVal) const
void AddToVec (const PExpVal &ExpVal)
void AddToLst (const PExpVal &ExpVal)
TExpValType GetValType () const
bool IsFltVal (TFlt &_Flt) const
bool IsFltVal (double &_Flt) const
double GetFltVal () const
int GetFltValAsInt (const bool &ThrowExceptP=true) const
TStr GetStrVal () const
void SaveTxt (TOLx &Lx) const
void SaveTxt (const PSOut &SOut) const
TStr GetStr () const
static PExpVal MkClone (const PExpVal &ExpVal)
static PExpVal GetUndefExpVal ()
static PExpVal GetZeroExpVal ()
 TExpEnv ()
virtual ~TExpEnv ()
 TExpEnv (TSIn &SIn)
TExpEnvoperator= (const TExpEnv &)
bool operator== (const TExpEnv &) const
virtual void PutVarVal (const TStr &, const PExpVal &)
virtual PExpVal GetVarVal (const TStr &, bool &IsVar)
virtual PExpVal GetVarVal (const TStr &VarNm)
virtual int GetVars () const
virtual void GetVarNmVal (const int &, TStr &, PExpVal &) const
virtual PExpVal GetFuncVal (const TStr &, const TExpValV &, bool &IsFunc)
virtual TRndGetRnd ()
static bool IsFuncOk (const TStr &RqFuncNm, const TExpFuncArgType &RqFuncArgType, const TStr &FuncNm, const TExpValV &ArgValV)
static TExpOp GetExpOpFromLxSym (const TLxSym &LxSym)
static TLxSym GetLxSymFromExpOp (const TExpOp &ExpOp)
static PExp LoadTxtFact (TILx &Lx, const TFSet &Expect)
static PExp LoadTxtMulExp (TILx &Lx, const TFSet &Expect)
static PExp LoadTxtAddExp (TILx &Lx, const TFSet &Expect)
static PExp LoadTxtRelExp (TILx &Lx, const TFSet &Expect)
static PExp LoadTxtExp (TILx &Lx, const TFSet &Expect)
void SaveTxtOp (TOLx &Lx) const
PExpVal EvalExpOp (const PExpEnv &ExpEnv, const bool &DbgP, TChA &DbgChA)
PExpVal EvalExp (const PExpEnv &ExpEnv, const bool &DbgP, TChA &DbgChA)
 TExp (const TExpType &_ExpType=etUndef)
 TExp (const TExpOp &_ExpOp, const PExp &Exp1, const PExp &Exp2=NULL, const PExp &Exp3=NULL)
 TExp (const PExpVal &_ExpVal)
 TExp (const TStr &_VarNm)
 TExp (const TStr &_FuncNm, const TExpV &_ArgExpV)
 ~TExp ()
 TExp (TSIn &SIn)
TExpoperator= (const TExp &)
bool operator== (const TExp &) const
static bool IsExpStrOk (const TStr &ExpStr, TStr &MsgStr)
static PExp LoadTxt (const PSIn &SIn, bool &Ok, TStr &MsgStr, const TFSet &Expect=TFSet()|syEof)
static PExp LoadTxt (const TStr &ExpStr, bool &Ok, TStr &MsgStr)
static PExp LoadTxt (const TStr &ExpStr)
TStr GetTopObjNm () const
int GetArgExps () const
TStr GetArgExpStr (const int &ArgExpN) const
PExpVal Eval (bool &Ok, TStr &MsgStr, const bool &DbgP, TStr &DbgStr, const PExpEnv &ExpEnv=TExpEnv::DfExpEnv)
PExpVal Eval (const PExpEnv &ExpEnv=TExpEnv::DfExpEnv)
PExpVal Eval (bool &Ok, TStr &MsgStr, const PExpEnv &ExpEnv=TExpEnv::DfExpEnv)
PExpVal Eval (const PExpEnv &ExpEnv, const bool &DbgP, TStr &DbgStr)
static PExpVal LoadAndEvalExpL (const TStr &ExpLStr, bool &Ok, TStr &MsgStr, const PExpEnv &ExpEnv=TExpEnv::DfExpEnv)
static TStr GetExpTypeStr (const TExpType &ExpType)
static TStr GetExpOpStr (const TExpOp &ExpOp)
static void GetBiDescV (TStrPrV &BiDescV)
 TExpHelpItem ()
 TExpHelpItem (const TStr &_Nm, const TStr &_TypeStr, const TStr &_DescStr, const TStr &_DfValStr)
static PExpHelpItem New (const TStr &Nm, const TStr &TypeStr, const TStr &DescStr, const TStr &DfValStr)
 ~TExpHelpItem ()
 TExpHelpItem (TSIn &SIn)
TExpHelpItemoperator= (const TExpHelpItem &)
bool operator== (const TExpHelpItem &) const
TStr GetNm () const
TStr GetTypeStr () const
TStr GetDescStr () const
TStr GetDfValStr () const
 TExpHelpObj ()
 TExpHelpObj (const TExpHelpObjType &_Type, const TStr &_CatNm, const PExpHelpItem &_HdItem, const TExpHelpItemV &_ArgItemV)
static PExpHelpObj New (const TExpHelpObjType &Type, const TStr &CatNm, const PExpHelpItem &HdItem, const TExpHelpItemV &ArgItemV=TExpHelpItemV())
 ~TExpHelpObj ()
 TExpHelpObj (TSIn &SIn)
TExpHelpObjoperator= (const TExpHelpObj &)
bool operator== (const TExpHelpObj &) const
TExpHelpObjType GetType () const
TStr GetCatNm () const
PExpHelpItem GetHdItem () const
int GetArgItems () const
PExpHelpItem GetArgItem (const int &ArgItemN) const
TStr GetHdArgNmStr () const
static TExpHelpObjType GetObjTypeFromStr (const TStr &TypeStr)
 TExpHelp ()
static PExpHelp New ()
 ~TExpHelp ()
 TExpHelp (TSIn &SIn)
TExpHelpoperator= (const TExpHelp &)
bool operator== (const TExpHelp &) const
static PExpHelp LoadXml (const PSIn &SIn)
static PExpHelp LoadXml (const TStr &FNm)
void AddObj (const PExpHelpObj &Obj)
void GetCatNmV (TStrV &CatNmV) const
void GetObjHdNmV (const TStr &CatNm, TStrV &ObjHdNmV) const
PExpHelpObj GetObj (const TStr &ObjNm) const

Variables

static ClassTPVL(TExpVal,
PExpVal, TExpValV, TExpValL,
TExpValLN) private PExpVal 
ZeroExpVal = NULL
TInt ValType
TAscFlt Flt
TStr Str
TExpValV ValV
TExpValL ValL
static PExpEnv DfExpEnv = PExpEnv(new TExpEnv())
ClassTPV(TExp, PExp, TExpV)
private TInt 
ExpType
TBool IsParen
PExpVal ExpVal
TStr ExpNm
TInt ExpOp
TInt ExpBiId
TExpV ArgExpV
static const TFSet MulOpSymSet
static const TFSet UAddOpSymSet
static const TFSet AddOpSymSet
static const TFSet RelOpSymSet
static const TFSet FactExpExpect
static const TFSet MulExpExpect
static const TFSet AddExpExpect
static const TFSet RelExpExpect
static const TFSet ExpExpect
ClassTPV(TExpHelpItem,
PExpHelpItem, TExpHelpItemV)
private TStr 
TypeStr
TStr DescStr
TStr DfValStr
ClassTPV(TExpHelpObj,
PExpHelpObj, TExpHelpObjV)
private TStr 
CatNm
PExpHelpItem HdItem
TExpHelpItemV ArgItemV

Enumeration Type Documentation

Enumerator:
ebatUndef 
ebatVoid 
ebatFlt 
ebatFltFlt 

Definition at line 132 of file exp.h.

enum TExpBiId
Enumerator:
ebi_Undef 
ebi_True 
ebi_False 
ebi_E 
ebi_Pi 
ebi_Sin 
ebi_Cos 
ebi_Tan 
ebi_ASin 
ebi_ACos 
ebi_ATan 
ebi_SinH 
ebi_CosH 
ebi_TanH 
ebi_Pow 
ebi_Exp 
ebi_Sqr 
ebi_Sqrt 
ebi_Log 
ebi_Log10 
ebi_Ceil 
ebi_Floor 
ebi_Int 
ebi_Frac 
ebi_Abs 
ebi_UniDev 
ebi_NrmDev 
ebi_ExpDev 
ebi_GamDev 
ebi_PoiDev 
ebi_BinDev 
ebi_UniDevStep 
ebi_NrmDevStep 
ebi_ExpDevStep 

Definition at line 108 of file exp.h.

Enumerator:
efatUndef 
efatVoid 
efatFlt 
efatFltFlt 
efatFltStr 
efatStr 
efatStrFlt 
efatStrStr 
efatStrAny 

Definition at line 64 of file exp.h.

Enumerator:
ehotUndef 
ehotOp 
ehotVar 
ehotFunc 
ehotTempl 

Definition at line 305 of file exp.h.

enum TExpOp
Enumerator:
eoUndef 
eoUPlus 
eoUMinus 
eoPlus 
eoMinus 
eoMul 
eoDiv 
eoIDiv 
eoMod 
eoNot 
eoAnd 
eoOr 
eoEq 
eoNEq 
eoLss 
eoGtr 
eoLEq 
eoGEq 
eoIf 

Definition at line 173 of file exp.h.

enum TExpType
Enumerator:
etUndef 
etVal 
etVec 
etLst 
etOp 
etVar 
etBiConst 
etFunc 
etBiFunc 

Definition at line 166 of file exp.h.

Enumerator:
evtUndef 
evtFlt 
evtStr 
evtVec 
evtLst 

Definition at line 3 of file exp.h.


Function Documentation

void AddObj ( const PExpHelpObj &  Obj)

Definition at line 367 of file exp.h.

{ObjV.Add(Obj);}
void AddToLst ( const PExpVal &  ExpVal)

Definition at line 40 of file exp.h.

References evtLst, IAssert, ValL, and ValType.

                                      {
    IAssert(TExpValType(static_cast<int>(ValType))==evtLst); ValL.AddBack(ExpVal);}
void AddToVec ( const PExpVal &  ExpVal)

Definition at line 38 of file exp.h.

References evtVec, IAssert, ValType, and ValV.

                                      {
    IAssert(TExpValType(static_cast<int>(ValType))==evtVec); ValV.Add(ExpVal);}
PExpVal TExp::Eval ( bool &  Ok,
TStr MsgStr,
const bool &  DbgP,
TStr DbgStr,
const PExpEnv &  ExpEnv = TExpEnv::DfExpEnv 
)

Definition at line 898 of file exp.cpp.

References EvalExp(), ExpVal, GetStr(), GetUndefExpVal(), and MsgStr.

Referenced by Eval().

                                                                               {
  Ok=true; MsgStr="Ok";
  PExpVal ExpVal; TChA DbgChA;
  if (DbgP){DbgChA+="Debug Expression: ";}
  try {
    ExpVal=EvalExp(ExpEnv, DbgP, DbgChA);
  }
  catch (PExcept E){
    Ok=false; MsgStr=E->GetMsgStr();
  }
  if (!Ok){return TExpVal::GetUndefExpVal();}
  if (DbgP){
    DbgChA+='['; DbgChA+=GetStr(); DbgChA+=" -> ";
    DbgChA+=ExpVal->GetStr(); DbgChA+="] "; DbgChA+=MsgStr;
    DbgStr=DbgChA;
  }
  return ExpVal;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PExpVal Eval ( const PExpEnv &  ExpEnv = TExpEnv::DfExpEnv)

Definition at line 251 of file exp.h.

References Eval(), and MsgStr.

                                                     {
    bool Ok; TStr MsgStr; TStr DbgStr;
    return Eval(Ok, MsgStr, false, DbgStr, ExpEnv);}

Here is the call graph for this function:

PExpVal Eval ( bool &  Ok,
TStr MsgStr,
const PExpEnv &  ExpEnv = TExpEnv::DfExpEnv 
)

Definition at line 254 of file exp.h.

References Eval().

                                                                             {
    TStr DbgStr; return Eval(Ok, MsgStr, false, DbgStr, ExpEnv);}

Here is the call graph for this function:

PExpVal Eval ( const PExpEnv &  ExpEnv,
const bool &  DbgP,
TStr DbgStr 
)

Definition at line 256 of file exp.h.

References Eval(), and MsgStr.

                                                                     {
    bool Ok; TStr MsgStr; return Eval(Ok, MsgStr, DbgP, DbgStr, ExpEnv);}

Here is the call graph for this function:

PExpVal TExp::EvalExp ( const PExpEnv &  ExpEnv,
const bool &  DbgP,
TChA DbgChA 
) [private]

Definition at line 517 of file exp.cpp.

References ArgExpV, etBiConst, etBiFunc, etFunc, etLst, etOp, etUndef, etVal, etVar, etVec, EvalExpOp(), evtLst, evtVec, ExpBiId, ExpNm, ExpType, ExpVal, Fail, GetExpTypeStr(), TStr::GetUc(), GetUndefExpVal(), New(), and Throw().

Referenced by Eval().

                                                       {
  PExpVal OutExpVal;
  TExpType _ExpType=TExpType(int(ExpType));
  switch (_ExpType){
    case etUndef:
      OutExpVal=TExpVal::GetUndefExpVal();
      break;
    case etVal:
      OutExpVal=ExpVal;
      break;
    case etVec:{
      PExpVal ExpVal=TExpVal::New(evtVec);
      for (int ArgExpN=0; ArgExpN<ArgExpV.Len(); ArgExpN++){
        PExpVal ArgExpVal=
         PExpVal(ArgExpV[ArgExpN]->EvalExp(ExpEnv, DbgP, DbgChA));
        ExpVal->AddToVec(ArgExpVal);
      }
      OutExpVal=ExpVal;
      break;}
    case etLst:{
      PExpVal ExpVal=TExpVal::New(evtLst);
      for (int ArgExpN=0; ArgExpN<ArgExpV.Len(); ArgExpN++){
        PExpVal ArgExpVal=
         PExpVal(ArgExpV[ArgExpN]->EvalExp(ExpEnv, DbgP, DbgChA));
        ExpVal->AddToLst(ArgExpVal);
      }
      OutExpVal=ExpVal;
      break;}
    case etOp:
      OutExpVal=EvalExpOp(ExpEnv, DbgP, DbgChA); break;
    case etVar:{
      bool IsVar=false;
      PExpVal ExpVal=ExpEnv->GetVarVal(ExpNm.GetUc(), IsVar);
      if (!IsVar){TExcept::Throw(TStr("Variable not defined (")+ExpNm+").");}
      OutExpVal=ExpVal;
      break;}
    case etBiConst:
      OutExpVal=ExpBi.GetBiConstVal(TExpBiId(int(ExpBiId)));
      break;
    case etFunc:
    case etBiFunc:{
      TExpValV ArgExpValV(ArgExpV.Len(), 0);
      for (int ArgExpN=0; ArgExpN<ArgExpV.Len(); ArgExpN++){
        PExpVal ArgExpVal=
         PExpVal(ArgExpV[ArgExpN]->EvalExp(ExpEnv, DbgP, DbgChA));
        ArgExpValV.Add(ArgExpVal);
      }
      switch (_ExpType){
        case etFunc:{
          bool IsFunc=false;
          PExpVal ExpVal=ExpEnv->GetFuncVal(ExpNm.GetUc(), ArgExpValV, IsFunc);
          if (!IsFunc){
            TExcept::Throw(TStr("Function not defined (")+ExpNm+").");}
          OutExpVal=ExpVal;
          break;}
        case etBiFunc:
          OutExpVal=ExpBi.GetBiFuncVal(TExpBiId(int(ExpBiId)), ArgExpValV, ExpEnv);
          break;
        default: Fail; OutExpVal=NULL;
      }
      break;}
    default: Fail; OutExpVal=NULL;
  }
  if (DbgP){
    switch (_ExpType){
      case etVal:
      case etOp:
        break;
      case etUndef:
      case etVec:
      case etLst:{
        TStr ExpTypeStr=TExp::GetExpTypeStr(_ExpType);
        DbgChA+='['; DbgChA+=ExpTypeStr; DbgChA+='=';
        DbgChA+=OutExpVal->GetStr(); DbgChA+="] ";
        break;}
      case etVar:
      case etBiConst:
      case etFunc:
      case etBiFunc:
        DbgChA+='['; DbgChA+=ExpNm; DbgChA+='=';
        DbgChA+=OutExpVal->GetStr(); DbgChA+="] ";
        break;
      default: Fail;
    }
  }
  return OutExpVal;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PExpVal TExp::EvalExpOp ( const PExpEnv &  ExpEnv,
const bool &  DbgP,
TChA DbgChA 
) [private]

Definition at line 377 of file exp.cpp.

References ArgExpV, eoAnd, eoDiv, eoEq, eoGEq, eoGtr, eoIDiv, eoIf, eoLEq, eoLss, eoMinus, eoMod, eoMul, eoNEq, eoNot, eoOr, eoPlus, eoUMinus, eoUPlus, evtFlt, evtStr, ExpOp, ExpVal, Fail, Flt, GetExpOpStr(), GetZeroExpVal(), New(), Str, and Throw().

Referenced by EvalExp().

                                                       {
  PExpVal OutExpVal;
  TExpOp _ExpOp=TExpOp(int(ExpOp));
  switch (_ExpOp){
    case eoUPlus:
    case eoUMinus:
    case eoNot:{
      PExpVal ExpVal=ArgExpV[0]->EvalExp(ExpEnv, DbgP, DbgChA);
      TExpValType ExpValType=ExpVal->GetValType();
      if (ExpValType==evtFlt){
        TFlt Flt;
        switch (_ExpOp){
          case eoUPlus: Flt=ExpVal->GetFltVal(); break;
          case eoUMinus: Flt=-ExpVal->GetFltVal(); break;
          case eoNot: Flt=double(ExpVal->GetFltValAsInt()==0);
          default: Fail; Flt=0;
        }
        OutExpVal=TExpVal::New(Flt);
      } else {
        TExcept::Throw("Bad argument types.");
      }
      break;}
    case eoPlus:
    case eoMinus:
    case eoMul:
    case eoDiv:
    case eoIDiv:
    case eoMod:
    case eoAnd:
    case eoOr:{
      PExpVal LExpVal=ArgExpV[0]->EvalExp(ExpEnv, DbgP, DbgChA);
      PExpVal RExpVal=ArgExpV[1]->EvalExp(ExpEnv, DbgP, DbgChA);
      TExpValType LExpValType=LExpVal->GetValType();
      TExpValType RExpValType=RExpVal->GetValType();
      if ((LExpValType==evtFlt)&&(RExpValType==evtFlt)){
        // check left expression
        double LVal=LExpVal->GetFltVal();
        int LValExpon; frexp(LVal, &LValExpon);
        if (LValExpon>150){LExpVal=TExpVal::GetZeroExpVal();}
        // check right expression
        double RVal=LExpVal->GetFltVal();
        int RValExpon; frexp(RVal, &RValExpon);
        if (RValExpon>150){RExpVal=TExpVal::GetZeroExpVal();}
        // calculate
        TFlt Flt;
        switch (_ExpOp){
          case eoPlus: Flt=LExpVal->GetFltVal()+RExpVal->GetFltVal(); break;
          case eoMinus: Flt=LExpVal->GetFltVal()-RExpVal->GetFltVal(); break;
          case eoMul: Flt=LExpVal->GetFltVal()*RExpVal->GetFltVal(); break;
          case eoDiv:
            if (RExpVal->GetFltVal()==0){TExcept::Throw("Division by zero.");}
            else {Flt=LExpVal->GetFltVal()/RExpVal->GetFltVal();}
            break;
          case eoIDiv:
            if (RExpVal->GetFltValAsInt()==0){TExcept::Throw("Division by zero.");}
            else {Flt=LExpVal->GetFltValAsInt()/RExpVal->GetFltValAsInt();}
            break;
          case eoMod:
            if (RExpVal->GetFltValAsInt()==0){TExcept::Throw("Division by zero.");}
            else {Flt=LExpVal->GetFltValAsInt()%RExpVal->GetFltValAsInt();}
            break;
          case eoAnd:
            Flt=(LExpVal->GetFltValAsInt()!=0)&&(RExpVal->GetFltValAsInt()!=0); break;
          case eoOr:
            Flt=(LExpVal->GetFltValAsInt()!=0)||(RExpVal->GetFltValAsInt()!=0); break;
          default: Fail; Flt=0;
        }
        OutExpVal=TExpVal::New(Flt);
      } else
      if ((_ExpOp==eoPlus)&&(LExpValType==evtStr)&&(RExpValType==evtStr)){
        TStr Str=LExpVal->GetStrVal()+RExpVal->GetStrVal();
        OutExpVal=TExpVal::New(Str);
      } else {
        TExcept::Throw("Bad argument types.");
      }
      break;}
    case eoEq:
    case eoNEq:
    case eoLss:
    case eoGtr:
    case eoLEq:
    case eoGEq:{
      PExpVal LExpVal=ArgExpV[0]->EvalExp(ExpEnv, DbgP, DbgChA);
      PExpVal RExpVal=ArgExpV[1]->EvalExp(ExpEnv, DbgP, DbgChA);
      TExpValType LExpValType=LExpVal->GetValType();
      TExpValType RExpValType=RExpVal->GetValType();
      if ((LExpValType==evtFlt)&&(RExpValType==evtFlt)){
        TFlt Flt;
        switch (_ExpOp){
          case eoEq: Flt=double(LExpVal->GetFltVal()==RExpVal->GetFltVal()); break;
          case eoNEq: Flt=double(LExpVal->GetFltVal()!=RExpVal->GetFltVal()); break;
          case eoLss: Flt=double(LExpVal->GetFltVal()<RExpVal->GetFltVal()); break;
          case eoGtr: Flt=double(LExpVal->GetFltVal()>RExpVal->GetFltVal()); break;
          case eoLEq: Flt=double(LExpVal->GetFltVal()<=RExpVal->GetFltVal()); break;
          case eoGEq: Flt=double(LExpVal->GetFltVal()>=RExpVal->GetFltVal()); break;
          default: Fail; Flt=0;
        }
        OutExpVal=TExpVal::New(Flt);
      } else
      if ((LExpValType==evtStr)&&(RExpValType==evtStr)){
        TFlt Flt;
        switch (_ExpOp){
          case eoEq: Flt=double(LExpVal->GetStrVal()==RExpVal->GetStrVal()); break;
          case eoNEq: Flt=double(LExpVal->GetStrVal()!=RExpVal->GetStrVal()); break;
          case eoLss: Flt=double(LExpVal->GetStrVal()<RExpVal->GetStrVal()); break;
          case eoGtr: Flt=double(LExpVal->GetStrVal()>RExpVal->GetStrVal()); break;
          case eoLEq: Flt=double(LExpVal->GetStrVal()<=RExpVal->GetStrVal()); break;
          case eoGEq: Flt=double(LExpVal->GetStrVal()>=RExpVal->GetStrVal()); break;
          default: Fail; Flt=0;
        }
        OutExpVal=TExpVal::New(Flt);
      } else {
        TExcept::Throw("Bad argument types.");
      }
      break;}
    case eoIf:{
      PExpVal CondExpVal=ArgExpV[0]->EvalExp(ExpEnv, DbgP, DbgChA);
      TExpValType CondExpValType=CondExpVal->GetValType();
      if (CondExpValType==evtFlt){
        PExpVal ExpVal;
        if (CondExpVal->GetFltVal()!=0){
          ExpVal=ArgExpV[1]->EvalExp(ExpEnv, DbgP, DbgChA);
        } else {
          ExpVal=ArgExpV[2]->EvalExp(ExpEnv, DbgP, DbgChA);
        }
        OutExpVal=ExpVal;
      } else {
        TExcept::Throw("Bad argument types.");
      }
      break;}
    default: Fail; OutExpVal=NULL;
  }
  if (DbgP){
    DbgChA+="['"; DbgChA+=TExp::GetExpOpStr(_ExpOp);
    DbgChA+="'='"; DbgChA+=OutExpVal->GetStr(); DbgChA+="'] ";
  }
  return OutExpVal;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int TExp::GetArgExps ( ) const

Definition at line 890 of file exp.cpp.

References ArgExpV.

                           {
  return ArgExpV.Len();
}
TStr TExp::GetArgExpStr ( const int &  ArgExpN) const

Definition at line 894 of file exp.cpp.

References ArgExpV.

                                                {
  return ArgExpV[ArgExpN]->GetStr();
}
PExpHelpItem GetArgItem ( const int &  ArgItemN) const

Definition at line 337 of file exp.h.

References ArgItemV.

                                                     {
    return ArgItemV[ArgItemN];}
int GetArgItems ( ) const

Definition at line 336 of file exp.h.

References ArgItemV.

{return ArgItemV.Len();}
void TExp::GetBiDescV ( TStrPrV BiDescV) [static]

Definition at line 967 of file exp.cpp.

References TVec< TVal >::Add(), and TVec< TVal >::Clr().

                                     {
  BiDescV.Clr();
  // constants
  BiDescV.Add(TStrPr("True", "Logical 'True' == 1."));
  BiDescV.Add(TStrPr("False", "Logical 'False' == 0."));
  BiDescV.Add(TStrPr("E", "Nat. logarithm basis (2.7182...)."));
  BiDescV.Add(TStrPr("Pi", "Constant pi (3.1415...)."));

  // trigonometric funcions
  BiDescV.Add(TStrPr("Sin(X)", "Sine of angle in radians."));
  BiDescV.Add(TStrPr("Cos(X)", "Cosine of angle in radians."));
  BiDescV.Add(TStrPr("Tan(X)", "Tangent of angle in radians."));
  BiDescV.Add(TStrPr("ASin(X)", "Arc sine of (-1..+1)."));
  BiDescV.Add(TStrPr("ACos(X)", "Arc cosine of (-1..+1)."));
  BiDescV.Add(TStrPr("ATan(X)", "Arc tangent of (-inf..+inf)."));
  BiDescV.Add(TStrPr("SinH(X)", "Hyperbolic sine."));
  BiDescV.Add(TStrPr("CosH(X)", "Hyperbolic cosine."));
  BiDescV.Add(TStrPr("TanH(X)", "Hyperbolic tangent."));

  // exponential functions
  BiDescV.Add(TStrPr("Pow(X, Y)", "X to the power of Y."));
  BiDescV.Add(TStrPr("Exp(X)", "Exponential E to the power of X."));
  BiDescV.Add(TStrPr("Sqr(X)", "X squared."));
  BiDescV.Add(TStrPr("Sqrt(X)", "Positive square root."));
  BiDescV.Add(TStrPr("Log(X)", "Natural logarithm."));
  BiDescV.Add(TStrPr("Log10(X)", "Base 10 logarithm."));

  // number manipulation functions
  BiDescV.Add(TStrPr("Ceil(X)", "The smallest integer not less than X."));
  BiDescV.Add(TStrPr("Floor(X)", "The largest integer not greater than X."));
  BiDescV.Add(TStrPr("Int(X)", "Integer part of X."));
  BiDescV.Add(TStrPr("Frac(X)", "Fractional part of X."));
  BiDescV.Add(TStrPr("Abs(X)", "Absolute value of X."));

  // random deviates
  BiDescV.Add(TStrPr("UniDev()", "Uniform deviate (0..1)."));
  BiDescV.Add(TStrPr("NrmDev()", "Normal deviate (0, 1)."));
  BiDescV.Add(TStrPr("ExpDev()", "Exponential deviate."));
  BiDescV.Add(TStrPr("GamDev(Order)", "Gamma deviate of Order."));
  BiDescV.Add(TStrPr("PoiDev(Mean)", "Poisson deviate."));
  BiDescV.Add(TStrPr("BinDev(Prb, Trials)", "Binomial deviate."));

  // operators
  BiDescV.Add(TStrPr("+N", "Unary plus."));
  BiDescV.Add(TStrPr("-N", "Unary minus."));
  BiDescV.Add(TStrPr("!L", "Not."));
  BiDescV.Add(TStrPr("N1+N2", "Plus."));
  BiDescV.Add(TStrPr("N1-N2", "Minus."));
  BiDescV.Add(TStrPr("N1*N2", "Multiply."));
  BiDescV.Add(TStrPr("N1/N2", "Division."));
  BiDescV.Add(TStrPr("N1#N2", "Integer division."));
  BiDescV.Add(TStrPr("N1%N2", "Modulo."));
  BiDescV.Add(TStrPr("L1&L2", "And."));
  BiDescV.Add(TStrPr("L1|L2", "Or."));
  BiDescV.Add(TStrPr("E1=E2", "Equal."));
  BiDescV.Add(TStrPr("E1<>E2", "Not equal."));
  BiDescV.Add(TStrPr("E1<E2", "Less."));
  BiDescV.Add(TStrPr("E1>E2", "Greater."));
  BiDescV.Add(TStrPr("E1<=E2", "Less or equal."));
  BiDescV.Add(TStrPr("E1>=E2", "Greater or equal."));
  BiDescV.Add(TStrPr("L?E1:E2", "If L then return E1 else return E2."));
}

Here is the call graph for this function:

TStr GetCatNm ( ) const

Definition at line 334 of file exp.h.

References CatNm.

{return CatNm;}
void TExpHelp::GetCatNmV ( TStrV CatNmV) const

Definition at line 1126 of file exp.cpp.

References TVec< TVal >::AddUnique(), TVec< TVal >::Clr(), and TVec< TVal >::Ins().

                                            {
  CatNmV.Clr();
  for (int ObjN=0; ObjN<ObjV.Len(); ObjN++){
    TStr CatNm=ObjV[ObjN]->GetCatNm();
    CatNmV.AddUnique(CatNm);
  }
  CatNmV.Ins(0, "All");
}

Here is the call graph for this function:

TStr GetDescStr ( ) const

Definition at line 299 of file exp.h.

References DescStr.

{return DescStr;}
TStr GetDfValStr ( ) const

Definition at line 300 of file exp.h.

References DfValStr.

{return DfValStr;}
TExpOp TExp::GetExpOpFromLxSym ( const TLxSym LxSym) [static, private]

Definition at line 606 of file exp.cpp.

References eoAnd, eoDiv, eoEq, eoGEq, eoGtr, eoIDiv, eoIf, eoLEq, eoLss, eoMinus, eoMod, eoMul, eoNEq, eoNot, eoOr, eoPlus, eoUndef, Fail, syAmpersand, syAsterisk, syEq, syExclamation, syGEq, syGtr, syHash, syLEq, syLss, syMinus, syNEq, syPercent, syPlus, syQuestion, sySlash, and syVBar.

Referenced by LoadTxtAddExp(), LoadTxtExp(), LoadTxtMulExp(), and LoadTxtRelExp().

                                                 {
  switch (LxSym){
    case syPlus: return eoPlus;
    case syMinus: return eoMinus;
    case syAsterisk: return eoMul;
    case sySlash: return eoDiv;
    case syPercent: return eoMod;
    case syExclamation: return eoNot;
    case syVBar: return eoOr;
    case syAmpersand: return eoAnd;
    case syQuestion: return eoIf;
    case syHash: return eoIDiv;
    case syEq: return eoEq;
    case syNEq: return eoNEq;
    case syLss: return eoLss;
    case syGtr: return eoGtr;
    case syLEq: return eoLEq;
    case syGEq: return eoGEq;
    default: Fail; return eoUndef;
  }
}

Here is the caller graph for this function:

static TStr GetExpOpStr ( const TExpOp ExpOp) [static]

Definition at line 264 of file exp.h.

References GetLxSymFromExpOp(), and TLxSymStr::GetSymStr().

Referenced by EvalExpOp(), and GetTopObjNm().

Here is the call graph for this function:

Here is the caller graph for this function:

TStr TExp::GetExpTypeStr ( const TExpType ExpType) [static]

Definition at line 952 of file exp.cpp.

References etBiConst, etBiFunc, etFunc, etLst, etOp, etUndef, etVal, etVar, etVec, and Fail.

Referenced by EvalExp().

                                               {
  switch (ExpType){
    case etUndef: return "Undef";
    case etVal: return "Val";
    case etVec: return "Vec";
    case etLst: return "Lst";
    case etOp: return "Op";
    case etVar: return "Var";
    case etBiConst: return "BiConst";
    case etFunc: return "Func";
    case etBiFunc: return "BiFunc";
    default: Fail; return "";
  }
}

Here is the caller graph for this function:

double GetFltVal ( ) const

Definition at line 48 of file exp.h.

References evtFlt, Flt, and GetValType().

Referenced by GetFltValAsInt().

                           {
    if (GetValType()==evtFlt){return Flt;} else {return 0;}}

Here is the call graph for this function:

Here is the caller graph for this function:

int TExpVal::GetFltValAsInt ( const bool &  ThrowExceptP = true) const

Definition at line 62 of file exp.cpp.

References Flt, GetFltVal(), TInt::Mn, TInt::Mx, and Throw().

                                                          {
  double Flt=GetFltVal();
  if ((Flt<double(TInt::Mn))&&(double(TInt::Mx)<Flt)){
    if (ThrowExceptP){TExcept::Throw("Float too big for integer.");}
    else {Flt=0;}
  }
  return int(Flt);
}

Here is the call graph for this function:

virtual PExpVal GetFuncVal ( const TStr ,
const TExpValV &  ,
bool &  IsFunc 
) [virtual]

Definition at line 93 of file exp.h.

References GetUndefExpVal().

                                                  {
    IsFunc=false; return TExpVal::GetUndefExpVal();}

Here is the call graph for this function:

Definition at line 1032 of file exp.cpp.

References ArgItemV, ehotFunc, ehotOp, ehotTempl, ehotVar, Fail, and HdItem.

                                      {
  TChA ChA;
  switch (Type){
    case ehotOp: {// operator
      TStr OpStr=HdItem->GetNm();
      if (ArgItemV.Len()==1){
        ChA+=OpStr; ChA+=" "; ChA+=ArgItemV[0]->GetNm();
      } else
      if (ArgItemV.Len()==2){
        ChA+=ArgItemV[0]->GetNm();
        ChA+=" "; ChA+=OpStr; ChA+=" ";
        ChA+=ArgItemV[1]->GetNm();
      } else
      if (ArgItemV.Len()==3){
        ChA+=ArgItemV[0]->GetNm();
        ChA+=" "; ChA+=OpStr; ChA+=" ";
        ChA+=ArgItemV[1]->GetNm();
        ChA+=" "; ChA+=":"; ChA+=" ";
        ChA+=ArgItemV[2]->GetNm();
      } else {
        Fail;
      }
      break;}
    case ehotVar: // variable
      ChA+=HdItem->GetNm(); break;
    case ehotFunc: // function
      ChA+=HdItem->GetTypeStr(); ChA+=" <- ";
      ChA+=HdItem->GetNm();
      ChA+="(";
      {for (int ArgN=0; ArgN<ArgItemV.Len(); ArgN++){
        if (ArgN>0){ChA+=", ";}
        ChA+=ArgItemV[ArgN]->GetNm();
      }}
      ChA+=")";
      break;
    case ehotTempl: // template
      ChA+=HdItem->GetTypeStr(); break;
    default: Fail;
  }
  return ChA;
}
PExpHelpItem GetHdItem ( ) const

Definition at line 335 of file exp.h.

References HdItem.

Referenced by GetObj().

{return HdItem;}

Here is the caller graph for this function:

TLxSym TExp::GetLxSymFromExpOp ( const TExpOp ExpOp) [static, private]

Definition at line 628 of file exp.cpp.

References eoAnd, eoDiv, eoEq, eoGEq, eoGtr, eoIDiv, eoIf, eoLEq, eoLss, eoMinus, eoMod, eoMul, eoNEq, eoNot, eoOr, eoPlus, eoUMinus, eoUPlus, Fail, syAmpersand, syAsterisk, syEq, syExclamation, syGEq, syGtr, syHash, syLEq, syLss, syMinus, syNEq, syPercent, syPlus, syQuestion, sySlash, syUndef, and syVBar.

Referenced by GetExpOpStr(), and SaveTxtOp().

                                                 {
  switch (ExpOp){
    case eoUPlus: return syPlus;
    case eoUMinus: return syMinus;
    case eoNot: return syExclamation;
    case eoPlus: return syPlus;
    case eoMinus: return syMinus;
    case eoMul: return syAsterisk;
    case eoDiv: return sySlash;
    case eoIDiv: return syHash;
    case eoMod: return syPercent;
    case eoAnd: return syAmpersand;
    case eoOr: return syVBar;
    case eoEq: return syEq;
    case eoNEq: return syNEq;
    case eoLss: return syLss;
    case eoGtr: return syGtr;
    case eoLEq: return syLEq;
    case eoGEq: return syGEq;
    case eoIf: return syQuestion;
    default: Fail; return syUndef;
  }
}

Here is the caller graph for this function:

TStr GetNm ( ) const

Definition at line 297 of file exp.h.

{return Nm;}
PExpHelpObj TExpHelp::GetObj ( const TStr ObjNm) const

Definition at line 1146 of file exp.cpp.

References GetHdItem(), and TStr::GetUc().

                                                    {
  PExpHelpObj Obj;
  for (int ObjN=0; ObjN<ObjV.Len(); ObjN++){
    if (ObjV[ObjN]->GetHdItem()->GetNm().GetUc()==ObjNm.GetUc()){
      return ObjV[ObjN];}
  }
  return NULL;
}

Here is the call graph for this function:

void TExpHelp::GetObjHdNmV ( const TStr CatNm,
TStrV ObjHdNmV 
) const

Definition at line 1135 of file exp.cpp.

References TVec< TVal >::AddUnique(), TVec< TVal >::Clr(), TStr::Empty(), and TVec< TVal >::Sort().

                                                                   {
  ObjHdNmV.Clr();
  for (int ObjN=0; ObjN<ObjV.Len(); ObjN++){
    TStr ObjCatNm=ObjV[ObjN]->GetCatNm();
    TStr ObjHdNm=ObjV[ObjN]->GetHdItem()->GetNm();
    if ((CatNm.Empty())||(CatNm=="All")||(CatNm==ObjCatNm)){
      ObjHdNmV.AddUnique(ObjHdNm);}
  }
  ObjHdNmV.Sort();
}

Here is the call graph for this function:

TExpHelpObjType TExpHelpObj::GetObjTypeFromStr ( const TStr TypeStr) [static]

Definition at line 1074 of file exp.cpp.

References ehotFunc, ehotOp, ehotTempl, ehotUndef, ehotVar, and Throw().

                                                                 {
  if (TypeStr=="Op"){return ehotOp;}
  else if (TypeStr=="Var"){return ehotVar;}
  else if (TypeStr=="Func"){return ehotFunc;}
  else if (TypeStr=="Templ"){return ehotTempl;}
  else {TExcept::Throw("Invalid object type.", TypeStr); return ehotUndef;}
}

Here is the call graph for this function:

virtual TRnd& GetRnd ( ) [virtual]

Definition at line 97 of file exp.h.

Referenced by TVec< THKeyDat >::GetPivotValNCmp().

{return Rnd;}

Here is the caller graph for this function:

TStr GetStr ( ) const

Definition at line 201 of file html.h.

{return Str;}
TStr GetStrVal ( ) const

Definition at line 51 of file exp.h.

References evtStr, GetValType(), IAssert, and Str.

{IAssert(GetValType()==evtStr); return Str;}

Here is the call graph for this function:

Definition at line 872 of file exp.cpp.

References etBiConst, etBiFunc, etFunc, etOp, etVar, ExpNm, ExpOp, ExpType, and GetExpOpStr().

                             {
  TStr TopObjNm;
  TExpType _ExpType=TExpType(int(ExpType));
  switch (_ExpType){
    case etOp:{
      TExpOp _ExpOp=TExpOp(int(ExpOp));
      TopObjNm=GetExpOpStr(_ExpOp);
      break;}
    case etVar:
    case etBiConst:
    case etFunc:
    case etBiFunc:{
      TopObjNm=ExpNm; break;}
    default: break;
  }
  return TopObjNm;
}

Here is the call graph for this function:

Definition at line 333 of file exp.h.

{return TExpHelpObjType(int(Type));}
TStr GetTypeStr ( ) const

Definition at line 298 of file exp.h.

References TypeStr.

Referenced by TStdNotify::OnNotify(), and TStdErrNotify::OnNotify().

{return TypeStr;}

Here is the caller graph for this function:

PExpVal TExpVal::GetUndefExpVal ( ) [static]

Definition at line 123 of file exp.cpp.

References New().

Referenced by Eval(), EvalExp(), GetFuncVal(), GetVarVal(), and TExpBi::TExpBi().

                               {
  if (UndefExpVal.Empty()){
    UndefExpVal=TExpVal::New();}
  return UndefExpVal;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 43 of file exp.h.

References ValType.

Referenced by GetFltVal(), GetStrVal(), IsFltVal(), and IsFuncOk().

{return TExpValType(int(ValType));}

Here is the caller graph for this function:

virtual void GetVarNmVal ( const int &  ,
TStr ,
PExpVal &   
) const [virtual]

Definition at line 90 of file exp.h.

References Fail.

                                            {Fail;}
int GetVars ( ) const [virtual]

Definition at line 89 of file exp.h.

{return 0;}
virtual PExpVal GetVarVal ( const TStr ,
bool &  IsVar 
) [virtual]

Definition at line 85 of file exp.h.

References GetUndefExpVal().

Referenced by GetDstSubstStr(), and GetVarVal().

                                                       {
    IsVar=false; return TExpVal::GetUndefExpVal();}

Here is the call graph for this function:

Here is the caller graph for this function:

virtual PExpVal GetVarVal ( const TStr VarNm) [virtual]

Definition at line 87 of file exp.h.

References GetVarVal().

                                              {
    bool IsVar; return GetVarVal(VarNm, IsVar);}

Here is the call graph for this function:

PExpVal TExpVal::GetZeroExpVal ( ) [static]

Definition at line 129 of file exp.cpp.

References New(), and ZeroExpVal.

Referenced by EvalExpOp().

                              {
  if (ZeroExpVal.Empty()){
    ZeroExpVal=TExpVal::New(double(0));}
  return ZeroExpVal;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static bool IsExpStrOk ( const TStr ExpStr,
TStr MsgStr 
) [static]

Definition at line 232 of file exp.h.

References LoadTxt().

                                                          {
    bool Ok; LoadTxt(ExpStr, Ok, MsgStr); return Ok;}

Here is the call graph for this function:

bool IsFltVal ( TFlt _Flt) const

Definition at line 44 of file exp.h.

References evtFlt, Flt, and GetValType().

                                  {
    if (GetValType()==evtFlt){_Flt=Flt; return true;} else {return false;}}

Here is the call graph for this function:

bool IsFltVal ( double &  _Flt) const

Definition at line 46 of file exp.h.

References evtFlt, Flt, and GetValType().

                                    {
    if (GetValType()==evtFlt){_Flt=Flt; return true;} else {return false;}}

Here is the call graph for this function:

bool TExpEnv::IsFuncOk ( const TStr RqFuncNm,
const TExpFuncArgType RqFuncArgType,
const TStr FuncNm,
const TExpValV &  ArgValV 
) [static]

Definition at line 137 of file exp.cpp.

References efatFlt, efatFltFlt, efatFltStr, efatStr, efatStrAny, efatStrFlt, efatStrStr, efatVoid, evtFlt, evtStr, Fail, TStr::GetUc(), and GetValType().

                                             {
  if (RqFuncNm.GetUc()!=FuncNm.GetUc()){return false;}
  switch (RqFuncArgType){
    case efatVoid: return ArgValV.Len()==0;
    case efatFlt:
      if (ArgValV.Len()!=1){return false;}
      if (ArgValV[0]->GetValType()!=evtFlt){return false;}
      return true;
    case efatStr:
      if (ArgValV.Len()!=1){return false;}
      if (ArgValV[0]->GetValType()!=evtStr){return false;}
      return true;
    case efatFltFlt:
      if (ArgValV.Len()!=2){return false;}
      if (ArgValV[0]->GetValType()!=evtFlt){return false;}
      if (ArgValV[1]->GetValType()!=evtFlt){return false;}
      return true;
    case efatFltStr:
      if (ArgValV.Len()!=2){return false;}
      if (ArgValV[0]->GetValType()!=evtFlt){return false;}
      if (ArgValV[1]->GetValType()!=evtStr){return false;}
      return true;
    case efatStrFlt:
      if (ArgValV.Len()!=2){return false;}
      if (ArgValV[0]->GetValType()!=evtStr){return false;}
      if (ArgValV[1]->GetValType()!=evtFlt){return false;}
      return true;
    case efatStrStr:
      if (ArgValV.Len()!=2){return false;}
      if (ArgValV[0]->GetValType()!=evtStr){return false;}
      if (ArgValV[1]->GetValType()!=evtStr){return false;}
      return true;
    case efatStrAny:
      if (ArgValV.Len()!=2){return false;}
      if (ArgValV[0]->GetValType()!=evtStr){return false;}
      return true;
    default: Fail; return false;
  }
}

Here is the call graph for this function:

static PExpHelp Load ( TSIn SIn) [static]

Definition at line 29 of file exp.h.

References TExpVal().

{return PExpVal(new TExpVal(SIn));}

Here is the call graph for this function:

PExpVal TExp::LoadAndEvalExpL ( const TStr ExpLStr,
bool &  Ok,
TStr MsgStr,
const PExpEnv &  ExpEnv = TExpEnv::DfExpEnv 
) [static]

Definition at line 918 of file exp.cpp.

References etUndef, ExpExpect, ExpVal, TILx::GetSym(), iloCmtAlw, iloCsSens, iloExcept, LoadTxtExp(), TStrIn::New(), syEof, TILx::Sym, sySemicolon, and TExp().

                                                                    {
  // create final expression value
  PExpVal ExpVal;
  // transform exp. str. to input stream
  PSIn SIn=TStrIn::New(ExpLStr);
  // create lexical
  TILx Lx(SIn, TFSet()|iloCmtAlw|iloCsSens|iloExcept);
  TFSet Expect=TFSet()|sySemicolon|syEof;
  // load & evaluate expression separated by semicolon
  while (Lx.Sym!=syEof){
    // create expression
    PExp Exp; Ok=true; MsgStr="Ok";
    try {
      Lx.GetSym(ExpExpect);
      Exp=LoadTxtExp(Lx, Expect);
    }
    catch (PExcept Except){
      Ok=false; MsgStr=Except->GetMsgStr();
      Exp=PExp(new TExp(etUndef));
    }
    // evaluate expression
    if (Ok){
      ExpVal=Exp->Eval(Ok, MsgStr, ExpEnv);
      //printf("%s\n", ExpVal->GetStr().CStr());
      if (!Ok){
        return NULL;}
    } else {
      return NULL;
    }
  }
  return ExpVal;
}

Here is the call graph for this function:

static PExp LoadTxt ( const PSIn SIn,
bool &  Ok,
TStr MsgStr,
const TFSet Expect = TFSet()|syEof 
) [static]
static PExp LoadTxt ( const TStr ExpStr,
bool &  Ok,
TStr MsgStr 
) [static]

Definition at line 236 of file exp.h.

References LoadTxt(), and TStrIn::New().

                                                                 {
    PSIn SIn=TStrIn::New(ExpStr); return LoadTxt(SIn, Ok, MsgStr);}

Here is the call graph for this function:

static PExp LoadTxt ( const TStr ExpStr) [static]

Definition at line 238 of file exp.h.

References LoadTxt(), and MsgStr.

                                         {
    bool Ok; TStr MsgStr; return LoadTxt(ExpStr, Ok, MsgStr);}

Here is the call graph for this function:

PExp TExp::LoadTxtAddExp ( TILx Lx,
const TFSet Expect 
) [static, private]

Definition at line 704 of file exp.cpp.

References AddOpSymSet, eoUMinus, eoUndef, eoUPlus, ExpOp, GetExpOpFromLxSym(), TILx::GetSym(), TFSet::In(), LoadTxtMulExp(), MulExpExpect, TILx::Sym, syMinus, syPlus, and TExp().

Referenced by LoadTxtRelExp().

                                                     {
  TExpOp PrefExpOp=eoUndef;
  if (Lx.Sym==syPlus){PrefExpOp=eoUPlus; Lx.GetSym(MulExpExpect);}
  else if (Lx.Sym==syMinus){PrefExpOp=eoUMinus; Lx.GetSym(MulExpExpect);}
  PExp Exp=LoadTxtMulExp(Lx, TFSet(Expect)|AddOpSymSet);
  if (PrefExpOp!=eoUndef){
    Exp=PExp(new TExp(PrefExpOp, Exp));}
  while (AddOpSymSet.In(Lx.Sym)){
    TExpOp ExpOp=GetExpOpFromLxSym(Lx.Sym);
    Lx.GetSym(MulExpExpect);
    PExp RExp=LoadTxtMulExp(Lx, TFSet(Expect)|AddOpSymSet);
    Exp=PExp(new TExp(ExpOp, Exp, RExp));
  }
  return Exp;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PExp TExp::LoadTxtExp ( TILx Lx,
const TFSet Expect 
) [static, private]

Definition at line 731 of file exp.cpp.

References ExpExpect, ExpOp, GetExpOpFromLxSym(), TILx::GetSym(), LoadTxtRelExp(), syColon, TILx::Sym, syQuestion, and TExp().

Referenced by LoadAndEvalExpL(), and LoadTxtFact().

                                                  {
  PExp Exp=LoadTxtRelExp(Lx, TFSet(Expect)|syQuestion);
  if (Lx.Sym==syQuestion){
    TExpOp ExpOp=GetExpOpFromLxSym(Lx.Sym);
    Lx.GetSym(ExpExpect);
    PExp ThenExp=LoadTxtExp(Lx, TFSet()|syColon);
    Lx.GetSym(ExpExpect);
    PExp ElseExp=LoadTxtExp(Lx, Expect);
    Exp=PExp(new TExp(ExpOp, Exp, ThenExp, ElseExp));
  }
  return Exp;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PExp TExp::LoadTxtFact ( TILx Lx,
const TFSet Expect 
) [static, private]

Definition at line 652 of file exp.cpp.

References ArgExpV, ExpExpect, ExpNm, Fail, TILx::Flt, TILx::GetSym(), LoadTxtExp(), New(), TILx::Str, syComma, syFlt, syIdStr, syLParen, TILx::Sym, syQStr, syRParen, and TExp().

Referenced by LoadTxtMulExp().

                                                   {
  PExp Exp;
  switch (Lx.Sym){
    case syFlt:{
      PExpVal ExpVal=TExpVal::New(Lx.Flt);
      Exp=PExp(new TExp(ExpVal));
      Lx.GetSym(Expect);
      break;}
    case syIdStr:{
      TStr ExpNm=Lx.Str;
      Lx.GetSym(TFSet(Expect)|syLParen);
      if (Lx.Sym==syLParen){
        TExpV ArgExpV;
        Lx.GetSym(TFSet(ExpExpect)|syRParen);
        while (Lx.Sym!=syRParen){
          if (Lx.Sym==syComma){Lx.GetSym(ExpExpect);}
          PExp ArgExp=LoadTxtExp(Lx, TFSet()|syComma|syRParen);
          ArgExpV.Add(ArgExp);
        }
        Lx.GetSym(Expect);
        Exp=PExp(new TExp(ExpNm, ArgExpV));
      } else {
        Exp=PExp(new TExp(ExpNm));
      }
      break;}
    case syQStr:{
      PExpVal ExpVal=TExpVal::New(Lx.Str);
      Exp=PExp(new TExp(ExpVal));
      Lx.GetSym(Expect);
      break;}
    case syLParen:{
      Lx.GetSym(ExpExpect);
      Exp=LoadTxtExp(Lx, TFSet()|syRParen);
      Exp->IsParen=true;
      Lx.GetSym(Expect);
      break;}
    default: Fail;
  }
  return Exp;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PExp TExp::LoadTxtMulExp ( TILx Lx,
const TFSet Expect 
) [static, private]

Definition at line 693 of file exp.cpp.

References ExpOp, FactExpExpect, GetExpOpFromLxSym(), TILx::GetSym(), TFSet::In(), LoadTxtFact(), MulOpSymSet, TILx::Sym, and TExp().

Referenced by LoadTxtAddExp().

                                                     {
  PExp Exp=LoadTxtFact(Lx, TFSet(Expect)|MulOpSymSet);
  while (MulOpSymSet.In(Lx.Sym)){
    TExpOp ExpOp=GetExpOpFromLxSym(Lx.Sym);
    Lx.GetSym(FactExpExpect);
    PExp RExp=LoadTxtFact(Lx, TFSet(Expect)|MulOpSymSet);
    Exp=PExp(new TExp(ExpOp, Exp, RExp));
  }
  return Exp;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PExp TExp::LoadTxtRelExp ( TILx Lx,
const TFSet Expect 
) [static, private]

Definition at line 720 of file exp.cpp.

References AddExpExpect, ExpOp, GetExpOpFromLxSym(), TILx::GetSym(), TFSet::In(), LoadTxtAddExp(), RelOpSymSet, TILx::Sym, and TExp().

Referenced by LoadTxtExp().

                                                     {
  PExp Exp=LoadTxtAddExp(Lx, TFSet(Expect)|RelOpSymSet);
  if (RelOpSymSet.In(Lx.Sym)){
    TExpOp ExpOp=GetExpOpFromLxSym(Lx.Sym);
    Lx.GetSym(AddExpExpect);
    PExp RExp=LoadTxtAddExp(Lx, Expect);
    Exp=PExp(new TExp(ExpOp, Exp, RExp));
  }
  return Exp;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static PExpHelp LoadXml ( const PSIn SIn) [static]
static PExpHelp LoadXml ( const TStr FNm) [static]

Definition at line 364 of file exp.h.

References LoadXml(), and TFIn::New().

                                          {
    PSIn SIn=TFIn::New(FNm); return LoadXml(SIn);}

Here is the call graph for this function:

static PExpVal MkClone ( const PExpVal &  ExpVal) [static]
static PExpVal New ( const TExpValType ValType = evtUndef) [static]

Definition at line 21 of file exp.h.

References TExpVal(), and ValType.

                                                         {
    return PExpVal(new TExpVal(ValType));}

Here is the call graph for this function:

static PExpVal New ( const TFlt Flt) [static]

Definition at line 23 of file exp.h.

References TExpVal().

{return PExpVal(new TExpVal(Flt));}

Here is the call graph for this function:

static PExpVal New ( const double &  Flt) [static]

Definition at line 24 of file exp.h.

References TExpVal().

{return PExpVal(new TExpVal(Flt));}

Here is the call graph for this function:

static PExpVal New ( const TStr Str) [static]

Definition at line 25 of file exp.h.

References TExpVal().

{return PExpVal(new TExpVal(Str));}

Here is the call graph for this function:

static PExpHelpItem New ( const TStr Nm,
const TStr TypeStr,
const TStr DescStr,
const TStr DfValStr 
) [static]

Definition at line 282 of file exp.h.

References TExpHelpItem().

                                             {
    return PExpHelpItem(new TExpHelpItem(Nm, TypeStr, DescStr, DfValStr));}

Here is the call graph for this function:

static PExpHelpObj New ( const TExpHelpObjType Type,
const TStr CatNm,
const PExpHelpItem &  HdItem,
const TExpHelpItemV &  ArgItemV = TExpHelpItemV() 
) [static]

Definition at line 318 of file exp.h.

References ArgItemV, and TExpHelpObj().

                                                                             {
    return PExpHelpObj(new TExpHelpObj(Type, CatNm, HdItem, ArgItemV));}

Here is the call graph for this function:

static PExpHelp New ( ) [static]

Definition at line 354 of file exp.h.

References TExpHelp().

{return PExpHelp(new TExpHelp());}

Here is the call graph for this function:

bool operator< ( const TExpVal ExpVal) const
TExpVal& operator= ( const TExpVal )

Definition at line 34 of file exp.h.

References Fail.

{Fail; return *this;}
TExpEnv& operator= ( const TExpEnv )

Definition at line 81 of file exp.h.

References Fail.

{Fail; return *this;}
TExp& operator= ( const TExp )

Definition at line 229 of file exp.h.

References Fail.

{Fail; return *this;}
TExpHelpItem& operator= ( const TExpHelpItem )

Definition at line 293 of file exp.h.

References Fail.

{Fail; return *this;}
TExpHelpObj& operator= ( const TExpHelpObj )

Definition at line 329 of file exp.h.

References Fail.

{Fail; return *this;}
TExpHelp& operator= ( const TExpHelp )

Definition at line 360 of file exp.h.

References Fail.

{Fail; return *this;}
bool operator== ( const TExpVal ExpVal) const
bool operator== ( const TExpEnv ) const

Definition at line 82 of file exp.h.

References Fail.

{Fail; return false;}
bool operator== ( const TExp ) const

Definition at line 230 of file exp.h.

References Fail.

{Fail; return false;}
bool operator== ( const TExpHelpItem ) const

Definition at line 294 of file exp.h.

References Fail.

{Fail; return false;}
bool operator== ( const TExpHelpObj ) const

Definition at line 330 of file exp.h.

References Fail.

{Fail; return false;}
bool operator== ( const TExpHelp ) const

Definition at line 361 of file exp.h.

References Fail.

{Fail; return false;}
virtual void PutVarVal ( const TStr ,
const PExpVal &   
) [virtual]

Definition at line 84 of file exp.h.

References Fail.

{Fail;}
void Save ( TSOut SOut) const

Definition at line 30 of file exp.h.

References Flt, TStr::Save(), TInt::Save(), TAscFlt::Save(), Str, ValL, ValType, and ValV.

                               {
    ValType.Save(SOut);
    Flt.Save(SOut); Str.Save(SOut); ValV.Save(SOut); ValL.Save(SOut);}

Here is the call graph for this function:

void SaveTxt ( TOLx Lx) const

Referenced by SaveStr(), and SaveTxt().

Here is the caller graph for this function:

void SaveTxt ( const PSOut SOut) const

Definition at line 242 of file exp.h.

References oloCmtAlw, oloCsSens, oloSigNum, and SaveTxt().

Here is the call graph for this function:

void TExp::SaveTxtOp ( TOLx Lx) const [private]

Definition at line 744 of file exp.cpp.

References ArgExpV, eoAnd, eoDiv, eoEq, eoGEq, eoGtr, eoIDiv, eoIf, eoLEq, eoLss, eoMinus, eoMod, eoMul, eoNEq, eoNot, eoOr, eoPlus, eoUMinus, eoUPlus, etOp, ExpOp, ExpType, Fail, GetLxSymFromExpOp(), IAssert, TOLx::PutSym(), and syColon.

                                   {
  IAssert(TExpType(static_cast<int>(ExpType))==etOp);
  TExpOp _ExpOp=TExpOp(int(ExpOp));
  TLxSym OpSym=GetLxSymFromExpOp(_ExpOp);
  switch (_ExpOp){
    case eoUPlus:
    case eoUMinus:
    case eoNot:
      Lx.PutSym(OpSym); ArgExpV[0]->SaveTxt(Lx);
      break;
    case eoPlus: case eoMinus:
    case eoMul: case eoDiv:
    case eoIDiv: case eoMod:
    case eoAnd: case eoOr:
    case eoEq: case eoNEq:
    case eoLss: case eoGtr:
    case eoLEq: case eoGEq:
      ArgExpV[0]->SaveTxt(Lx); Lx.PutSym(OpSym); ArgExpV[1]->SaveTxt(Lx);
      break;
    case eoIf:
      ArgExpV[0]->SaveTxt(Lx); Lx.PutSym(OpSym);
      ArgExpV[1]->SaveTxt(Lx); Lx.PutSym(syColon); ArgExpV[2]->SaveTxt(Lx);
      break;
    default: Fail;
  }
}

Here is the call graph for this function:

TExp ( const TExpType _ExpType = etUndef)

Definition at line 211 of file exp.h.

Referenced by LoadAndEvalExpL(), LoadTxtAddExp(), LoadTxtExp(), LoadTxtFact(), LoadTxtMulExp(), and LoadTxtRelExp().

                                        :
    ExpType(_ExpType), IsParen(false),
    ExpVal(), ExpNm(), ExpOp(), ExpBiId(), ArgExpV(){}

Here is the caller graph for this function:

TExp::TExp ( const TExpOp _ExpOp,
const PExp &  Exp1,
const PExp &  Exp2 = NULL,
const PExp &  Exp3 = NULL 
)

Definition at line 771 of file exp.cpp.

References ArgExpV.

                                                      :
  ExpType(etOp), IsParen(false),
  ExpVal(), ExpNm(), ExpOp(_ExpOp), ExpBiId(), ArgExpV(){
  ArgExpV.Add(Exp1);
  if (!Exp2.Empty()){ArgExpV.Add(Exp2);}
  if (!Exp3.Empty()){ArgExpV.Add(Exp3);}
}
TExp::TExp ( const PExpVal &  _ExpVal)

Definition at line 780 of file exp.cpp.

                                :
  ExpType(etVal), IsParen(false),
  ExpVal(_ExpVal), ExpNm(), ExpOp(), ExpBiId(), ArgExpV(){}
TExp::TExp ( const TStr _VarNm)

Definition at line 784 of file exp.cpp.

References etBiConst, etVar, ExpBiId, ExpNm, and ExpType.

                            :
  ExpType(), IsParen(false),
  ExpVal(), ExpNm(_VarNm), ExpOp(), ExpBiId(), ArgExpV(){
  TExpBiId _ExpBiId;
  if (ExpBi.IsExpBiId(ExpNm, _ExpBiId)){
    ExpType=etBiConst;
    ExpBiId=TInt(int(_ExpBiId));
  } else {
    ExpType=etVar;
  }
}
TExp::TExp ( const TStr _FuncNm,
const TExpV &  _ArgExpV 
)

Definition at line 796 of file exp.cpp.

References etBiFunc, etFunc, ExpBiId, ExpNm, and ExpType.

                                                    :
  ExpType(), IsParen(false),
  ExpVal(), ExpNm(_FuncNm), ExpOp(), ExpBiId(), ArgExpV(_ArgExpV){
  TExpBiId _ExpBiId;
  if (ExpBi.IsExpBiId(ExpNm, _ExpBiId)){
    ExpType=etBiFunc;
    ExpBiId=TInt(int(_ExpBiId));
  } else {
    ExpType=etFunc;
  }
}
TExp ( TSIn SIn)

Definition at line 220 of file exp.h.

                 :
    ExpType(SIn), IsParen(SIn),
    ExpVal(SIn), ExpNm(SIn), ExpOp(SIn), ExpBiId(SIn), ArgExpV(SIn){}
TExpEnv ( )

Definition at line 75 of file exp.h.

: Rnd(){}
TExpEnv ( TSIn SIn)

Definition at line 77 of file exp.h.

: Rnd(SIn){}
TExpHelp ( )

Definition at line 353 of file exp.h.

Referenced by New().

: ObjV(){}

Here is the caller graph for this function:

TExpHelp ( TSIn SIn)

Definition at line 356 of file exp.h.

: ObjV(SIn){}

Definition at line 278 of file exp.h.

Referenced by New().

: Nm(), TypeStr(), DescStr(), DfValStr(){}

Here is the caller graph for this function:

TExpHelpItem ( const TStr _Nm,
const TStr _TypeStr,
const TStr _DescStr,
const TStr _DfValStr 
)

Definition at line 279 of file exp.h.

                                               :
    Nm(_Nm), TypeStr(_TypeStr), DescStr(_DescStr), DfValStr(_DfValStr){}
TExpHelpItem ( TSIn SIn)

Definition at line 286 of file exp.h.

                         :
    Nm(SIn), TypeStr(SIn), DescStr(SIn), DfValStr(SIn){}

Definition at line 314 of file exp.h.

Referenced by New().

{}

Here is the caller graph for this function:

TExpHelpObj ( const TExpHelpObjType _Type,
const TStr _CatNm,
const PExpHelpItem &  _HdItem,
const TExpHelpItemV &  _ArgItemV 
)

Definition at line 315 of file exp.h.

                                                               :
    Type(_Type), CatNm(_CatNm), HdItem(_HdItem), ArgItemV(_ArgItemV){}
TExpHelpObj ( TSIn SIn)

Definition at line 322 of file exp.h.

                        :
    Type(SIn), CatNm(SIn), HdItem(SIn), ArgItemV(SIn){}
TExpVal ( const TExpValType _ValType = evtUndef)

Definition at line 17 of file exp.h.

Referenced by Load(), and New().

: ValType(_ValType){}

Here is the caller graph for this function:

TExpVal ( const TFlt _Flt)

Definition at line 18 of file exp.h.

: ValType(evtFlt), Flt(_Flt){}
TExpVal ( const double &  _Flt)

Definition at line 19 of file exp.h.

: ValType(evtFlt), Flt(TFlt(_Flt)){}
TExpVal ( const TStr _Str)

Definition at line 20 of file exp.h.

: ValType(evtStr), Str(_Str){}
TExpVal ( TSIn SIn)

Definition at line 27 of file exp.h.

                    :
    ValType(SIn), Flt(SIn), Str(SIn), ValV(SIn), ValL(SIn){}
~TExp ( )

Definition at line 219 of file exp.h.

{}
virtual ~TExpEnv ( ) [virtual]

Definition at line 76 of file exp.h.

{}
~TExpHelp ( )

Definition at line 355 of file exp.h.

{}

Definition at line 285 of file exp.h.

{}

Definition at line 321 of file exp.h.

{}
~TExpVal ( )

Definition at line 26 of file exp.h.

{}

Variable Documentation

const TFSet TExp::AddExpExpect [static]

Definition at line 196 of file exp.h.

Referenced by LoadTxtRelExp().

const TFSet TExp::AddOpSymSet [static]

Definition at line 195 of file exp.h.

Referenced by LoadTxtAddExp().

TExpV ArgExpV

Definition at line 193 of file exp.h.

Referenced by EvalExp(), EvalExpOp(), GetArgExps(), GetArgExpStr(), LoadTxtFact(), SaveTxtOp(), and TExp().

TExpHelpItemV ArgItemV

Definition at line 312 of file exp.h.

Referenced by GetArgItem(), GetArgItems(), GetHdArgNmStr(), and New().

ClassTPV (TExpHelpObj, PExpHelpObj, TExpHelpObjV) private TStr CatNm

Definition at line 307 of file exp.h.

Referenced by GetCatNm().

Definition at line 275 of file exp.h.

Referenced by GetDescStr().

PExpEnv TExpEnv::DfExpEnv = PExpEnv(new TExpEnv()) [static]

Definition at line 103 of file exp.h.

Definition at line 276 of file exp.h.

Referenced by GetDfValStr().

Definition at line 192 of file exp.h.

Referenced by EvalExp(), TExpBi::IsExpBiId(), and TExp().

const TFSet TExp::ExpExpect [static]

Definition at line 197 of file exp.h.

Referenced by LoadAndEvalExpL(), LoadTxtExp(), and LoadTxtFact().

Definition at line 190 of file exp.h.

Referenced by EvalExp(), GetTopObjNm(), LoadTxtFact(), and TExp().

ClassTPV (TExp, PExp, TExpV) private TInt ExpType

Definition at line 184 of file exp.h.

Referenced by EvalExp(), GetTopObjNm(), SaveTxtOp(), and TExp().

PExpVal ExpVal

Definition at line 189 of file exp.h.

Referenced by Eval(), EvalExp(), EvalExpOp(), TExpBi::GetBiFuncVal(), and LoadAndEvalExpL().

const TFSet TExp::FactExpExpect [static]

Definition at line 196 of file exp.h.

Referenced by LoadTxtMulExp().

PExpHelpItem HdItem

Definition at line 311 of file exp.h.

Referenced by GetHdArgNmStr(), and GetHdItem().

Definition at line 188 of file exp.h.

const TFSet TExp::MulExpExpect [static]

Definition at line 196 of file exp.h.

Referenced by LoadTxtAddExp().

const TFSet TExp::MulOpSymSet [static]

Definition at line 195 of file exp.h.

Referenced by LoadTxtMulExp().

const TFSet TExp::RelExpExpect [static]

Definition at line 197 of file exp.h.

const TFSet TExp::RelOpSymSet [static]

Definition at line 195 of file exp.h.

Referenced by LoadTxtRelExp().

ClassTPV (TExpHelpItem, PExpHelpItem, TExpHelpItemV) private TStr TypeStr

Definition at line 271 of file exp.h.

Referenced by GetTypeStr(), TStdNotify::OnNotify(), and TStdErrNotify::OnNotify().

const TFSet TExp::UAddOpSymSet [static]

Definition at line 195 of file exp.h.

TExpValL ValL

Definition at line 15 of file exp.h.

Referenced by AddToLst(), and Save().

Definition at line 11 of file exp.h.

Referenced by AddToLst(), AddToVec(), GetValType(), New(), and Save().

PExpVal TExpVal::ZeroExpVal = NULL [static]

Definition at line 7 of file exp.h.

Referenced by GetZeroExpVal().