SNAP Library, User Reference  2012-10-15 15:06:59
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

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.

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

Definition at line 38 of file exp.h.

                                      {
    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.

                                                                               {
  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;
}
PExpVal Eval ( const PExpEnv &  ExpEnv = TExpEnv::DfExpEnv)

Definition at line 251 of file exp.h.

                                                     {
    bool Ok; TStr MsgStr; TStr DbgStr;
    return Eval(Ok, MsgStr, false, DbgStr, ExpEnv);}
PExpVal Eval ( bool &  Ok,
TStr MsgStr,
const PExpEnv &  ExpEnv = TExpEnv::DfExpEnv 
)

Definition at line 254 of file exp.h.

                                                                             {
    TStr DbgStr; return Eval(Ok, MsgStr, false, DbgStr, ExpEnv);}
PExpVal Eval ( const PExpEnv &  ExpEnv,
const bool &  DbgP,
TStr DbgStr 
)

Definition at line 256 of file exp.h.

                                                                     {
    bool Ok; TStr MsgStr; return Eval(Ok, MsgStr, DbgP, DbgStr, ExpEnv);}
PExpVal TExp::EvalExp ( const PExpEnv &  ExpEnv,
const bool &  DbgP,
TChA DbgChA 
) [private]

Definition at line 517 of file exp.cpp.

                                                       {
  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;
}
PExpVal TExp::EvalExpOp ( const PExpEnv &  ExpEnv,
const bool &  DbgP,
TChA DbgChA 
) [private]

Definition at line 377 of file exp.cpp.

                                                       {
  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;
}
int TExp::GetArgExps ( ) const

Definition at line 890 of file exp.cpp.

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

Definition at line 894 of file exp.cpp.

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

Definition at line 337 of file exp.h.

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

Definition at line 336 of file exp.h.

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

Definition at line 967 of file exp.cpp.

                                     {
  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."));
}
TStr GetCatNm ( ) const

Definition at line 334 of file exp.h.

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

Definition at line 1126 of file exp.cpp.

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

Definition at line 299 of file exp.h.

{return DescStr;}
TStr GetDfValStr ( ) const

Definition at line 300 of file exp.h.

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

Definition at line 606 of file exp.cpp.

                                                 {
  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;
  }
}
static TStr GetExpOpStr ( const TExpOp ExpOp) [static]

Definition at line 264 of file exp.h.

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

Definition at line 952 of file exp.cpp.

                                               {
  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 "";
  }
}
double GetFltVal ( ) const

Definition at line 48 of file exp.h.

                           {
    if (GetValType()==evtFlt){return Flt;} else {return 0;}}
int TExpVal::GetFltValAsInt ( const bool &  ThrowExceptP = true) const

Definition at line 62 of file exp.cpp.

                                                          {
  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);
}
virtual PExpVal GetFuncVal ( const TStr ,
const TExpValV &  ,
bool &  IsFunc 
) [virtual]

Definition at line 93 of file exp.h.

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

Definition at line 1032 of file exp.cpp.

                                      {
  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.

{return HdItem;}
TLxSym TExp::GetLxSymFromExpOp ( const TExpOp ExpOp) [static, private]

Definition at line 628 of file exp.cpp.

                                                 {
  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;
  }
}
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.

                                                    {
  PExpHelpObj Obj;
  for (int ObjN=0; ObjN<ObjV.Len(); ObjN++){
    if (ObjV[ObjN]->GetHdItem()->GetNm().GetUc()==ObjNm.GetUc()){
      return ObjV[ObjN];}
  }
  return NULL;
}
void TExpHelp::GetObjHdNmV ( const TStr CatNm,
TStrV ObjHdNmV 
) const

Definition at line 1135 of file exp.cpp.

                                                                   {
  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();
}
TExpHelpObjType TExpHelpObj::GetObjTypeFromStr ( const TStr TypeStr) [static]

Definition at line 1074 of file exp.cpp.

                                                                 {
  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;}
}
virtual TRnd& GetRnd ( ) [virtual]

Definition at line 97 of file exp.h.

{return Rnd;}
TStr GetStr ( ) const

Definition at line 201 of file html.h.

{return Str;}
TStr GetStrVal ( ) const

Definition at line 51 of file exp.h.

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

Definition at line 872 of file exp.cpp.

                             {
  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;
}

Definition at line 333 of file exp.h.

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

Definition at line 298 of file exp.h.

{return TypeStr;}
PExpVal TExpVal::GetUndefExpVal ( ) [static]

Definition at line 123 of file exp.cpp.

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

Definition at line 43 of file exp.h.

{return TExpValType(int(ValType));}
virtual void GetVarNmVal ( const int &  ,
TStr ,
PExpVal &   
) const [virtual]

Definition at line 90 of file exp.h.

                                            {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.

                                                       {
    IsVar=false; return TExpVal::GetUndefExpVal();}
virtual PExpVal GetVarVal ( const TStr VarNm) [virtual]

Definition at line 87 of file exp.h.

                                              {
    bool IsVar; return GetVarVal(VarNm, IsVar);}
PExpVal TExpVal::GetZeroExpVal ( ) [static]

Definition at line 129 of file exp.cpp.

                              {
  if (ZeroExpVal.Empty()){
    ZeroExpVal=TExpVal::New(double(0));}
  return ZeroExpVal;
}
static bool IsExpStrOk ( const TStr ExpStr,
TStr MsgStr 
) [static]

Definition at line 232 of file exp.h.

                                                          {
    bool Ok; LoadTxt(ExpStr, Ok, MsgStr); return Ok;}
bool IsFltVal ( TFlt _Flt) const

Definition at line 44 of file exp.h.

                                  {
    if (GetValType()==evtFlt){_Flt=Flt; return true;} else {return false;}}
bool IsFltVal ( double &  _Flt) const

Definition at line 46 of file exp.h.

                                    {
    if (GetValType()==evtFlt){_Flt=Flt; return true;} else {return false;}}
bool TExpEnv::IsFuncOk ( const TStr RqFuncNm,
const TExpFuncArgType RqFuncArgType,
const TStr FuncNm,
const TExpValV &  ArgValV 
) [static]

Definition at line 137 of file exp.cpp.

                                             {
  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;
  }
}
static PExpHelp Load ( TSIn SIn) [static]

Definition at line 29 of file exp.h.

{return PExpVal(new TExpVal(SIn));}
PExpVal TExp::LoadAndEvalExpL ( const TStr ExpLStr,
bool &  Ok,
TStr MsgStr,
const PExpEnv &  ExpEnv = TExpEnv::DfExpEnv 
) [static]

Definition at line 918 of file exp.cpp.

                                                                    {
  // 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;
}
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.

                                                                 {
    PSIn SIn=TStrIn::New(ExpStr); return LoadTxt(SIn, Ok, MsgStr);}
static PExp LoadTxt ( const TStr ExpStr) [static]

Definition at line 238 of file exp.h.

                                         {
    bool Ok; TStr MsgStr; return LoadTxt(ExpStr, Ok, MsgStr);}
PExp TExp::LoadTxtAddExp ( TILx Lx,
const TFSet Expect 
) [static, private]

Definition at line 704 of file exp.cpp.

                                                     {
  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;
}
PExp TExp::LoadTxtExp ( TILx Lx,
const TFSet Expect 
) [static, private]

Definition at line 731 of file exp.cpp.

                                                  {
  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;
}
PExp TExp::LoadTxtFact ( TILx Lx,
const TFSet Expect 
) [static, private]

Definition at line 652 of file exp.cpp.

                                                   {
  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;
}
PExp TExp::LoadTxtMulExp ( TILx Lx,
const TFSet Expect 
) [static, private]

Definition at line 693 of file exp.cpp.

                                                     {
  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;
}
PExp TExp::LoadTxtRelExp ( TILx Lx,
const TFSet Expect 
) [static, private]

Definition at line 720 of file exp.cpp.

                                                     {
  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;
}
static PExpHelp LoadXml ( const PSIn SIn) [static]
static PExpHelp LoadXml ( const TStr FNm) [static]

Definition at line 364 of file exp.h.

                                          {
    PSIn SIn=TFIn::New(FNm); return LoadXml(SIn);}
static PExpVal MkClone ( const PExpVal &  ExpVal) [static]
static PExpVal New ( const TExpValType ValType = evtUndef) [static]

Definition at line 21 of file exp.h.

                                                         {
    return PExpVal(new TExpVal(ValType));}
static PExpVal New ( const TFlt Flt) [static]

Definition at line 23 of file exp.h.

{return PExpVal(new TExpVal(Flt));}
static PExpVal New ( const double &  Flt) [static]

Definition at line 24 of file exp.h.

{return PExpVal(new TExpVal(Flt));}
static PExpVal New ( const TStr Str) [static]

Definition at line 25 of file exp.h.

{return PExpVal(new TExpVal(Str));}
static PExpHelpItem New ( const TStr Nm,
const TStr TypeStr,
const TStr DescStr,
const TStr DfValStr 
) [static]

Definition at line 282 of file exp.h.

                                             {
    return PExpHelpItem(new TExpHelpItem(Nm, TypeStr, DescStr, DfValStr));}
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.

                                                                             {
    return PExpHelpObj(new TExpHelpObj(Type, CatNm, HdItem, ArgItemV));}
static PExpHelp New ( ) [static]

Definition at line 354 of file exp.h.

{return PExpHelp(new TExpHelp());}
bool operator< ( const TExpVal ExpVal) const
TExpVal& operator= ( const TExpVal )

Definition at line 34 of file exp.h.

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

Definition at line 81 of file exp.h.

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

Definition at line 229 of file exp.h.

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

Definition at line 293 of file exp.h.

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

Definition at line 329 of file exp.h.

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

Definition at line 360 of file exp.h.

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

Definition at line 82 of file exp.h.

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

Definition at line 230 of file exp.h.

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

Definition at line 294 of file exp.h.

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

Definition at line 330 of file exp.h.

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

Definition at line 361 of file exp.h.

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

Definition at line 84 of file exp.h.

{Fail;}
void Save ( TSOut SOut) const

Definition at line 30 of file exp.h.

                               {
    ValType.Save(SOut);
    Flt.Save(SOut); Str.Save(SOut); ValV.Save(SOut); ValL.Save(SOut);}
void SaveTxt ( TOLx Lx) const
void SaveTxt ( const PSOut SOut) const

Definition at line 242 of file exp.h.

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

Definition at line 744 of file exp.cpp.

                                   {
  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;
  }
}
TExp ( const TExpType _ExpType = etUndef)

Definition at line 211 of file exp.h.

                                        :
    ExpType(_ExpType), IsParen(false),
    ExpVal(), ExpNm(), ExpOp(), ExpBiId(), ArgExpV(){}
TExp::TExp ( const TExpOp _ExpOp,
const PExp &  Exp1,
const PExp &  Exp2 = NULL,
const PExp &  Exp3 = NULL 
)

Definition at line 771 of file exp.cpp.

                                                      :
  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.

                            :
  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.

                                                    :
  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.

: ObjV(){}
TExpHelp ( TSIn SIn)

Definition at line 356 of file exp.h.

: ObjV(SIn){}

Definition at line 278 of file exp.h.

: Nm(), TypeStr(), DescStr(), DfValStr(){}
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.

{}
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.

: ValType(_ValType){}
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.

const TFSet TExp::AddOpSymSet [static]

Definition at line 195 of file exp.h.

TExpV ArgExpV

Definition at line 193 of file exp.h.

TExpHelpItemV ArgItemV

Definition at line 312 of file exp.h.

ClassTPV (TExpHelpObj, PExpHelpObj, TExpHelpObjV) private TStr CatNm

Definition at line 307 of file exp.h.

Definition at line 275 of file exp.h.

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

Definition at line 103 of file exp.h.

Definition at line 276 of file exp.h.

Definition at line 192 of file exp.h.

const TFSet TExp::ExpExpect [static]

Definition at line 197 of file exp.h.

Definition at line 190 of file exp.h.

Definition at line 191 of file exp.h.

ClassTPV (TExp, PExp, TExpV) private TInt ExpType

Definition at line 184 of file exp.h.

PExpVal ExpVal

Definition at line 189 of file exp.h.

const TFSet TExp::FactExpExpect [static]

Definition at line 196 of file exp.h.

Definition at line 12 of file exp.h.

PExpHelpItem HdItem

Definition at line 311 of file exp.h.

Definition at line 188 of file exp.h.

const TFSet TExp::MulExpExpect [static]

Definition at line 196 of file exp.h.

const TFSet TExp::MulOpSymSet [static]

Definition at line 195 of file exp.h.

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.

Definition at line 13 of file exp.h.

ClassTPV (TExpHelpItem, PExpHelpItem, TExpHelpItemV) private TStr TypeStr

Definition at line 271 of file exp.h.

const TFSet TExp::UAddOpSymSet [static]

Definition at line 195 of file exp.h.

TExpValL ValL

Definition at line 15 of file exp.h.

Definition at line 11 of file exp.h.

TExpValV ValV

Definition at line 14 of file exp.h.

PExpVal TExpVal::ZeroExpVal = NULL [static]

Definition at line 7 of file exp.h.