MBDyn-1.7.3
|
#include <mathp.h>
Classes | |
class | ErrGeneric |
class | MathArg_t |
class | MathArgPriv_t |
class | MathArgVoid_t |
struct | MathFunc_t |
class | NameSpace |
class | PlugIn |
struct | PlugInRegister |
class | PlugInVar |
class | StaticNameSpace |
struct | TokenVal |
Public Member Functions | |
Table & | GetSymbolTable (void) const |
void | PutSymbolTable (Table &T) |
int | GetLineNumber (void) const |
const NameSpaceMap & | GetNameSpaceMap (void) const |
MathParser (const InputStream &strm, Table &t, bool bRedefineVars=false) | |
MathParser (Table &t, bool bRedefineVars=false) | |
~MathParser (void) | |
NamedValue * | InsertSym (const char *const s, const Real &v, int redefine=0) |
NamedValue * | InsertSym (const char *const s, const Int &v, int redefine=0) |
Real | GetLastStmt (Real d=0., Token t=ARGSEP) |
Real | GetLastStmt (const InputStream &strm, Real d=0., Token t=ARGSEP) |
Real | Get (Real d=0.) |
Real | Get (const InputStream &strm, Real d=0.) |
TypedValue | Get (const TypedValue &v) |
TypedValue | Get (const InputStream &strm, const TypedValue &v) |
void | GetForever (std::ostream &out, const char *const sep="\n") |
void | GetForever (const InputStream &strm, std::ostream &out, const char *const sep="\n") |
int | RegisterPlugIn (const char *name, MathParser::PlugIn *(*)(MathParser &, void *), void *arg) |
int | RegisterNameSpace (NameSpace *ns) |
NameSpace * | GetNameSpace (const std::string &name) const |
bool | bNameValidate (const std::string &s) const |
Public Attributes | |
Table & | table |
bool | bRedefineVars |
InputStream * | in |
Static Public Attributes | |
static const char | ONE_LINE_REMARK = '#' |
Protected Attributes | |
struct MathParser::PlugInRegister * | PlugIns |
StaticNameSpace * | defaultNameSpace |
NameSpaceMap | nameSpaceMap |
std::string | namebuf |
TypedValue | value |
enum Token | currtoken |
std::stack< TokenVal > | TokenStack |
Private Member Functions | |
MathParser (const MathParser &) | |
typedef MathArgPriv_t<bool, AT_BOOL> MathParser::MathArgBool_t |
typedef MathArgPriv_t<Int, AT_INT> MathParser::MathArgInt_t |
typedef MathArgPriv_t<Real, AT_REAL> MathParser::MathArgReal_t |
typedef std::vector<MathArg_t*> MathParser::MathArgs |
typedef MathArgPriv_t<std::string, AT_STRING> MathParser::MathArgString_t |
typedef MathArgPriv_t<ArgType, AT_TYPE> MathParser::MathArgType_t |
typedef std::map<std::string, NameSpace *> MathParser::NameSpaceMap |
enum MathParser::ArgFlag |
Enumerator | |
---|---|
AF_NONE | |
AF_OPTIONAL | |
AF_OPTIONAL_NON_PRESENT | |
AF_CONST |
enum MathParser::ArgType |
Enumerator | |
---|---|
AT_PRIVATE | |
AT_TYPE | |
AT_ANY | |
AT_VOID | |
AT_BOOL | |
AT_INT | |
AT_REAL | |
AT_STRING |
Definition at line 65 of file mathp.h.
Enumerator | |
---|---|
DMOD_UNKNOWN | |
DMOD_IFNDEF | |
DMOD_LAST |
enum MathParser::Token |
Enumerator | |
---|---|
ENDOFFILE | |
UNKNOWNTOKEN | |
MP_INT | |
MP_REAL | |
MP_STRING | |
NUM | |
NAME | |
EXP | |
MULT | |
DIV | |
MOD | |
MINUS | |
PLUS | |
GT | |
GE | |
EQ | |
LE | |
LT | |
NE | |
NOT | |
AND | |
OR | |
XOR | |
OBR | |
CBR | |
OPGIN | |
CPGIN | |
STMTSEP | |
ARGSEP | |
NAMESPACESEP | |
ASSIGN | |
LASTTOKEN |
Definition at line 301 of file mathp.h.
|
private |
MathParser::MathParser | ( | const InputStream & | strm, |
Table & | t, | ||
bool | bRedefineVars = false |
||
) |
Definition at line 4266 of file mathp.cc.
References DEBUGCOUTFNAME, defaultNameSpace, MBDYN_EXCEPT_ARGS, RegisterNameSpace(), and MathParser::NameSpace::sGetName().
Definition at line 4290 of file mathp.cc.
References DEBUGCOUTFNAME, defaultNameSpace, MBDYN_EXCEPT_ARGS, RegisterNameSpace(), and MathParser::NameSpace::sGetName().
MathParser::~MathParser | ( | void | ) |
Definition at line 4385 of file mathp.cc.
References DEBUGCOUTFNAME, MathParser::PlugInRegister::name, nameSpaceMap, MathParser::PlugInRegister::next, PlugIns, SAFEDELETE, and SAFEDELETEARR.
|
protected |
Definition at line 3403 of file mathp.cc.
References binary_int(), and mult().
Referenced by relational(), and relational_int().
|
protected |
Definition at line 3409 of file mathp.cc.
References binary_int(), and mult().
|
protected |
Definition at line 3415 of file mathp.cc.
References currtoken, GetToken(), MINUS, mult(), and PLUS.
Referenced by binary().
bool MathParser::bNameValidate | ( | const std::string & | s | ) | const |
Definition at line 3292 of file mathp.cc.
Referenced by module_init(), and NameSpaceDR::Read().
|
protected |
Definition at line 3576 of file mathp.cc.
References AF_OPTIONAL, AF_OPTIONAL_NON_PRESENT, MathParser::MathFunc_t::args, ARGSEP, AT_ANY, AT_BOOL, AT_INT, AT_PRIVATE, AT_REAL, AT_STRING, CBR, currtoken, DEBUGCERR, MathParser::MathFunc_t::errmsg, MathParser::NameSpace::EvalFunc(), MathParser::MathFunc_t::fname, TypedValue::GetBool(), TypedValue::GetInt(), TypedValue::GetReal(), TypedValue::GetString(), GetToken(), MBDYN_EXCEPT_ARGS, MathParser::NameSpace::sGetName(), stmtlist(), and MathParser::MathFunc_t::t.
Referenced by expr(), and stmt().
|
protected |
Definition at line 3691 of file mathp.cc.
References CBR, CPGIN, currtoken, defaultNameSpace, ENDOFFILE, evalfunc(), MathParser::MathFunc_t::fname, Table::Get(), MathParser::NameSpace::GetFunc(), MathParser::NameSpace::GetTable(), GetToken(), NamedValue::GetVal(), MBDYN_EXCEPT_ARGS, NAME, namebuf, nameSpaceMap, NAMESPACESEP, NUM, OBR, OPGIN, readplugin(), stmtlist(), table, and value.
Referenced by unary().
Definition at line 4496 of file mathp.cc.
References TypedValue::GetReal().
Referenced by Get(), GetForever(), HighParser::GetValue(), DofPlugIn::ReadLabel(), and PrivPlugIn::ReadLabel().
Real MathParser::Get | ( | const InputStream & | strm, |
Real | d = 0. |
||
) |
Definition at line 4504 of file mathp.cc.
References Get(), and TypedValue::GetReal().
TypedValue MathParser::Get | ( | const TypedValue & | v | ) |
Definition at line 4512 of file mathp.cc.
References currtoken, ENDOFFILE, ExpressionElement::Eval(), GetToken(), MBDYN_EXCEPT_ARGS, ExpressionElement::Output(), stmt(), and STMTSEP.
TypedValue MathParser::Get | ( | const InputStream & | strm, |
const TypedValue & | v | ||
) |
Definition at line 4532 of file mathp.cc.
References ARGSEP, currtoken, ExpressionElement::Eval(), GetToken(), in, MBDYN_EXCEPT_ARGS, ExpressionElement::Output(), InputStream::putback(), stmt(), and STMTSEP.
|
protected |
Definition at line 2915 of file mathp.cc.
References DMOD_UNKNOWN, declarationmodifiernames::name, and declarationmodifiernames::type.
Referenced by IsDeclarationModifier(), and stmt().
void MathParser::GetForever | ( | std::ostream & | out, |
const char *const | sep = "\n" |
||
) |
Definition at line 4565 of file mathp.cc.
References currtoken, Get(), and STMTSEP.
Referenced by GetForever(), and main().
void MathParser::GetForever | ( | const InputStream & | strm, |
std::ostream & | out, | ||
const char *const | sep = "\n" |
||
) |
Definition at line 4574 of file mathp.cc.
References GetForever(), and in.
Definition at line 4402 of file mathp.cc.
References currtoken, ENDOFFILE, ExpressionElement::Eval(), TypedValue::GetReal(), GetToken(), MBDYN_EXCEPT_ARGS, ExpressionElement::Output(), stmtlist(), and STMTSEP.
Referenced by DriveHandler::dGet(), GetEnviron(), and GetLastStmt().
Real MathParser::GetLastStmt | ( | const InputStream & | strm, |
Real | d = 0. , |
||
Token | t = ARGSEP |
||
) |
Definition at line 4431 of file mathp.cc.
References currtoken, GetLastStmt(), in, and UNKNOWNTOKEN.
int MathParser::GetLineNumber | ( | void | ) | const |
Definition at line 1943 of file mathp.cc.
References ASSERT, InputStream::GetLineNumber(), and in.
Referenced by MathParser::ErrGeneric::ErrGeneric(), and GetToken().
MathParser::NameSpace * MathParser::GetNameSpace | ( | const std::string & | name | ) | const |
Definition at line 4620 of file mathp.cc.
References nameSpaceMap.
Referenced by DataManager::PopCurrData(), DataManager::PushCurrData(), and PrintSymbolTableDR::Read().
const MathParser::NameSpaceMap & MathParser::GetNameSpaceMap | ( | void | ) | const |
Definition at line 1984 of file mathp.cc.
References nameSpaceMap.
Referenced by PrintSymbolTableDR::Read().
Table & MathParser::GetSymbolTable | ( | void | ) | const |
Definition at line 1931 of file mathp.cc.
References table.
Referenced by DataManager::DataManager(), DriveHandler::DriveHandler(), GetEnviron(), mbdyn_program(), InverseSolver::Prepare(), Solver::Prepare(), PrintSymbolTableDR::Read(), and DataManager::SetTime().
|
protected |
Definition at line 2960 of file mathp.cc.
References AND, ARGSEP, ASSERT, ASSIGN, c, CBR, CPGIN, currtoken, DIV, ENDOFFILE, InputStream::eof(), EQ, EXP, GE, InputStream::get(), GetLineNumber(), InputStream::GetStream(), GT, in, LE, LT, MBDYN_EXCEPT_ARGS, MINUS, MOD, MULT, NAME, namebuf, NAMESPACESEP, NE, NO_OP, NOT, NUM, OBR, ONE_LINE_REMARK, OPGIN, OR, PLUS, InputStream::putback(), TypedValue::Set(), TypedValue::SetType(), STMTSEP, TokenPop(), UNKNOWNTOKEN, value, TypedValue::VAR_INT, TypedValue::VAR_REAL, TypedValue::VAR_STRING, and XOR.
Referenced by binary_int(), evalfunc(), expr(), Get(), GetLastStmt(), logical_int(), mult_int(), power_int(), readplugin(), relational_int(), stmt(), stmtlist(), and unary().
|
protected |
Definition at line 2891 of file mathp.cc.
References TypeName_t::name, TypeName_t::type, and TypedValue::VAR_UNKNOWN.
Referenced by IsType(), and stmt().
|
protected |
Definition at line 2903 of file mathp.cc.
References TypedValue::MOD_UNKNOWN, typemodifiernames::name, and typemodifiernames::type.
Referenced by IsTypeModifier(), and stmt().
NamedValue * MathParser::InsertSym | ( | const char *const | s, |
const Real & | v, | ||
int | redefine = 0 |
||
) |
Definition at line 4315 of file mathp.cc.
References Table::Get(), NamedValue::GetName(), NamedValue::IsVar(), MBDYN_EXCEPT_ARGS, Table::Put(), and table.
Referenced by DataManager::InsertSym().
NamedValue * MathParser::InsertSym | ( | const char *const | s, |
const Int & | v, | ||
int | redefine = 0 |
||
) |
Definition at line 4349 of file mathp.cc.
References Table::Get(), NamedValue::GetName(), NamedValue::IsVar(), MBDYN_EXCEPT_ARGS, Table::Put(), and table.
|
protected |
Definition at line 2939 of file mathp.cc.
References DMOD_UNKNOWN, and GetDeclarationModifier().
|
protected |
Definition at line 2945 of file mathp.cc.
References MathParser::NameSpace::IsFunc(), IsType(), and IsTypeModifier().
Referenced by stmt().
|
protected |
Definition at line 2927 of file mathp.cc.
References GetType(), and TypedValue::VAR_UNKNOWN.
Referenced by IsKeyWord().
|
protected |
Definition at line 2933 of file mathp.cc.
References GetTypeModifier(), and TypedValue::MOD_UNKNOWN.
Referenced by IsKeyWord().
|
protected |
Definition at line 3310 of file mathp.cc.
References logical_int(), and relational().
Referenced by stmt().
|
protected |
Definition at line 3316 of file mathp.cc.
References logical_int(), and relational().
|
protected |
Definition at line 3322 of file mathp.cc.
References AND, currtoken, GetToken(), OR, relational(), and XOR.
Referenced by logical().
|
protected |
Definition at line 3436 of file mathp.cc.
References mult_int(), and power().
Referenced by binary(), and binary_int().
|
protected |
Definition at line 3442 of file mathp.cc.
References mult_int(), and power().
|
protected |
Definition at line 3448 of file mathp.cc.
References currtoken, DIV, GetToken(), MBDYN_EXCEPT_ARGS, MOD, MULT, and power().
Referenced by mult().
|
protected |
Definition at line 3485 of file mathp.cc.
References power_int(), and unary().
Referenced by mult(), mult_int(), and power_int().
|
protected |
Definition at line 3491 of file mathp.cc.
References power_int().
|
protected |
Definition at line 3497 of file mathp.cc.
References currtoken, DEBUGCERR, EXP, TypedValue::GetInt(), TypedValue::GetReal(), GetToken(), TypedValue::GetType(), MBDYN_EXCEPT_ARGS, grad::pow(), power(), TypedValue::SetType(), TypedValue::VAR_INT, and TypedValue::VAR_REAL.
Referenced by power().
void MathParser::PutSymbolTable | ( | Table & | T | ) |
Definition at line 1937 of file mathp.cc.
References table.
Referenced by DriveHandler::PutSymbolTable().
|
protected |
Definition at line 4063 of file mathp.cc.
References buf, c, InputStream::eof(), Table::Get(), InputStream::get(), GetToken(), NamedValue::GetVal(), in, MBDYN_EXCEPT_ARGS, MathParser::PlugInRegister::next, NO_OP, PlugIns, Table::Put(), InputStream::putback(), MathParser::PlugIn::Read(), SAFEDELETEARR, SAFENEWWITHCONSTRUCTOR, SAFESTRDUP, table, and trim_arg().
Referenced by expr().
int MathParser::RegisterNameSpace | ( | MathParser::NameSpace * | ns | ) |
Definition at line 4602 of file mathp.cc.
References ASSERT, nameSpaceMap, and MathParser::NameSpace::sGetName().
Referenced by DataManager::DataManager(), MathParser(), module_init(), and NameSpaceDR::Read().
int MathParser::RegisterPlugIn | ( | const char * | name, |
MathParser::PlugIn * | *)(MathParser &, void *, | ||
void * | arg | ||
) |
Definition at line 4584 of file mathp.cc.
References MathParser::PlugInRegister::arg, MathParser::PlugInRegister::constructor, MathParser::PlugInRegister::name, MathParser::PlugInRegister::next, PlugIns, SAFENEW, and SAFESTRDUP.
Referenced by DataManager::DataManager(), and module_init().
|
protected |
Definition at line 3350 of file mathp.cc.
References binary(), and relational_int().
Referenced by logical(), and logical_int().
|
protected |
Definition at line 3356 of file mathp.cc.
References binary(), and relational_int().
|
protected |
Definition at line 3362 of file mathp.cc.
References binary(), currtoken, EQ, GE, GetToken(), GT, LE, LT, and NE.
Referenced by relational().
|
protected |
Definition at line 3781 of file mathp.cc.
References ASSIGN, bRedefineVars, TypedValue::Cast(), CBR, NamedValue::Const(), currtoken, defaultNameSpace, DMOD_IFNDEF, DMOD_UNKNOWN, evalfunc(), MathParser::MathFunc_t::fname, Table::Get(), GetDeclarationModifier(), MathParser::NameSpace::GetFunc(), MathParser::NameSpace::GetTable(), GetToken(), NamedValue::GetType(), GetType(), GetTypeModifier(), TypedValue::GetTypeName(), NamedValue::GetTypeName(), NamedValue::GetVal(), IsKeyWord(), NamedValue::IsVar(), logical(), MBDYN_EXCEPT_ARGS, mbdyn_get_line_data(), TypedValue::MOD_CONST, TypedValue::MOD_UNKNOWN, NAME, namebuf, nameSpaceMap, NAMESPACESEP, OBR, Table::Put(), TypedValue::SetConst(), MathParser::NameSpace::sGetName(), STMTSEP, table, TokenPush(), and TypedValue::VAR_UNKNOWN.
Referenced by Get(), and stmtlist().
|
protected |
Definition at line 4253 of file mathp.cc.
References currtoken, GetToken(), stmt(), and STMTSEP.
Referenced by evalfunc(), expr(), and GetLastStmt().
|
protected |
Definition at line 1963 of file mathp.cc.
References currtoken, TypedValue::GetString(), MathParser::TokenVal::m_t, MathParser::TokenVal::m_v, NAME, namebuf, NUM, TokenStack, and value.
Referenced by GetToken().
|
protected |
Definition at line 1950 of file mathp.cc.
References MathParser::TokenVal::m_t, MathParser::TokenVal::m_v, NAME, namebuf, NUM, TokenStack, and value.
Referenced by stmt().
|
protected |
|
protected |
Definition at line 3555 of file mathp.cc.
References currtoken, expr(), GetToken(), MINUS, NOT, and PLUS.
Referenced by power().
|
protected |
Definition at line 364 of file mathp.h.
Referenced by binary_int(), evalfunc(), expr(), Get(), GetForever(), GetLastStmt(), GetToken(), logical_int(), mult_int(), power_int(), relational_int(), stmt(), stmtlist(), TokenPop(), and unary().
|
protected |
Definition at line 348 of file mathp.h.
Referenced by expr(), MathParser(), and stmt().
InputStream* MathParser::in |
Definition at line 295 of file mathp.h.
Referenced by Get(), GetForever(), GetLastStmt(), GetLineNumber(), GetToken(), and readplugin().
|
protected |
Definition at line 358 of file mathp.h.
Referenced by expr(), GetToken(), stmt(), TokenPop(), and TokenPush().
|
protected |
Definition at line 355 of file mathp.h.
Referenced by expr(), GetNameSpace(), GetNameSpaceMap(), RegisterNameSpace(), stmt(), and ~MathParser().
|
static |
Definition at line 188 of file mathp.h.
Referenced by GetToken(), and skip_remarks().
|
protected |
Referenced by readplugin(), RegisterPlugIn(), and ~MathParser().
Table& MathParser::table |
Definition at line 287 of file mathp.h.
Referenced by expr(), GetSymbolTable(), InsertSym(), PutSymbolTable(), readplugin(), and stmt().
|
protected |
Definition at line 370 of file mathp.h.
Referenced by TokenPop(), and TokenPush().
|
protected |
Definition at line 361 of file mathp.h.
Referenced by expr(), GetToken(), TokenPop(), and TokenPush().