NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
|
This class implements the logic to evaluate complex procedures, which may be called recursively. More...
#include <procedure.hpp>
Public Member Functions | |
Procedure () | |
Default constructor. More... | |
Procedure (const Procedure &_procedure) | |
Custom constructor using the presets from the passed procedure instance. Used as a recursion functionality. More... | |
~Procedure () | |
Destructor ensuring that the procedure output file stream will be closed, if it is still open. More... | |
Returnvalue | execute (std::string sProc, std::string sVarList, mu::Parser &_parser, FunctionDefinitionManager &_functions, MemoryManager &_data, Settings &_option, Output &_out, PlotData &_pData, Script &_script, unsigned int nth_procedure=0) |
This member function is central in the execution of the currently selected procedure as it handles all the logic. More... | |
virtual FlowCtrl::ProcedureInterfaceRetVal | procedureInterface (std::string &sLine, mu::Parser &_parser, FunctionDefinitionManager &_functions, MemoryManager &_data, Output &_out, PlotData &_pData, Script &_script, Settings &_option, int nth_command=0) override |
This member function handles the calls for procedures and plugins, resolves them and executes the called procedures by constructing a new instance of this class on the heap. More... | |
bool | writeProcedure (std::string sProcedureLine) |
This member function handles the procedure installation process by governing the file stream and passing the corresponding procedure linewards to the stream. More... | |
virtual int | isInline (const std::string &sProc) override |
This virtual member function checks, whether the procedures in the current line are declared as inline and whether they are inlinable. More... | |
virtual int | evalDebuggerBreakPoint (mu::Parser &_parser, Settings &_option) override |
This virtual member function handles the gathering of all relevant information for the debugger for the currently found breakpoint. More... | |
virtual int | getErrorInformationForDebugger () override |
This virtual member function handles the gathering of all relevant information for the debugger for the currently found error. More... | |
virtual int | catchExceptionForTest (std::exception_ptr e_ptr, bool bSupressAnswer_back, int nLine) override |
This virtual member function is inserted in some automatically catchable locations to convert an error into a warning to avoid that the calculation is aborted. This will only get active, if the corresponding procedure is flagged as "test". More... | |
void | setPredefinedFuncs (const std::string &sPredefined) |
std::string | getCurrentProcedureName () const |
unsigned int | GetCurrentLine () const |
This member function will return the current line number depending on whether a flow control statement is evaluated or not. More... | |
int | getReturnType () const |
bool | is_writing () const |
int | getProcedureFlags () const |
int & | getDebuggerCode () |
size_t | replaceReturnVal (std::string &sLine, mu::Parser &_parser, const Returnvalue &_return, unsigned int nPos, unsigned int nPos2, const std::string &sReplaceName) |
This member function replaces the procedure occurence between the both passed positions using akronymed version of the called procedure. It also declares the numerical return value as a vector to the parser. More... | |
Public Member Functions inherited from FlowCtrl | |
FlowCtrl () | |
Default constructor. More... | |
virtual | ~FlowCtrl () |
Destructor. Cleanes the memory, if necessary. More... | |
int | getCurrentBlockDepth () const |
Returns the current block depth while reading a flow control statement to memory. More... | |
std::string | getCurrentBlock () const |
Returnvalue | getReturnValue () const |
bool | getReturnSignal () const |
void | setCommand (std::string &__sCmd, int nCurrentLine) |
This member function is used to set a command line from the outside into the flow control statement class. The internal flow control command buffer grows as needed. More... | |
void | eval () |
This member function prepares the command array by pre-evaluating all constant stuff or function calls whereever possible. More... | |
void | reset () |
This function clears the memory of this FlowCtrl object and sets everything back to its original state. More... | |
int | getCurrentLineNumber () const |
This member function returns the current line number as enumerated during passing the commands via "setCommand()". More... | |
std::string | getCurrentCommand () const |
This member function returns the current command line, which will or has been evaluated in the current line. More... | |
Public Member Functions inherited from PackageManager | |
PackageManager () | |
PluginManager default constructor. More... | |
PackageManager (const PackageManager &_manager) | |
PluginManager copy constructor. More... | |
~PackageManager () | |
PluginManager destructor. Will close the internal file stream if it is still open. More... | |
PackageManager & | operator= (const PackageManager &_manager) |
This is the overload for the assignment operator. More... | |
bool | loadPlugins () |
This member function will read the plugin definitions from the definitions file and create the internal representations. More... | |
bool | evalPluginCmd (std::string &sCmd) |
This member function converts the call to a plugin in the passed command line into a call to the corresponding plugin main procedure. More... | |
bool | declareNewPackage (const std::string &sInstallInfoString) |
This member function declares a new plugin from the passed install information string. More... | |
bool | isPluginCmd (const std::string &sCmd) const |
This member function determines, whether the passed command line contains a plugin command. More... | |
std::string | deletePackage (const std::string &sPackage) |
This member function deletes the plugin with the passed name from the internal set of definitions and returns the stored documentation index IDs. More... | |
std::map< std::string, std::string > | getMenuMap () const |
Returns the menu map connecting menu entry names with their corresponding procedure, which shall be called. More... | |
unsigned int | getPackageCount () const |
Returns the number of installed plugins. More... | |
std::string | getPluginInfoPath () |
This member function simply returns the plugin definition file path. More... | |
void | addHelpIndex (const std::string &_sPluginName, std::string _sHelpId) |
This member function adds the passed documentation index ID to the plugin definition. More... | |
const std::vector< Package > & | getPackages () const |
Returns a const reference to the currently installed packages. More... | |
std::string | getPluginNames () const |
Returns the names of the installed plugins. More... | |
std::string | getPluginProcName () const |
Returns the current plugin's procedure name. More... | |
std::string | getPluginVarList () const |
Returns the current plugin's procedure argument list. More... | |
std::string | getPluginCommand (unsigned int i=0) const |
Returns the plugin command of the ith plugin. More... | |
std::string | getPluginCommandSignature (unsigned int i=0) const |
Returns the plugin command signature of the ith plugin. More... | |
std::string | getPackageName (unsigned int i=0) const |
Returns the plugin name of the ith plugin. More... | |
std::string | getPackageVersion (unsigned int i=0) const |
Returns the version number string of the ith plugin. More... | |
std::string | getPackageAuthor (unsigned int i=0) const |
Returns the author of the ith plugin. More... | |
std::string | getPackageDescription (unsigned int i=0) const |
Returns the description of the ith plugin. More... | |
std::string | getPackageLicense (unsigned int i=0) const |
Returns the license information of the ith plugin. More... | |
std::string | getPluginMenuEntry (unsigned int i=0) const |
Returns the menu entry of the ith plugin. More... | |
Public Member Functions inherited from FileSystem | |
FileSystem () | |
Default constructor. More... | |
FileSystem & | assign (const FileSystem &_fSys) |
Assignment member function to copy the settings from another FileSystem instance. More... | |
std::string | ValidFileName (std::string _sFileName, const std::string sExtension=".dat", bool checkExtension=true, bool doCleanPath=true) const |
This member function evaluates, whether the passed filename is a valid filename. One may supply a preferred filename extension. More... | |
std::string | ValidFolderName (std::string _sFileName, bool doCleanPath=true, bool appendTrailingSeparator=true) const |
This member function evaluates, whether the passed foldername is a valid foldername. More... | |
std::string | ValidizeAndPrepareName (const std::string &_sFileName, const std::string &sExtension=".dat") const |
This member function validizes the passed file name and creates the needed folders on-the-fly. More... | |
int | setPath (std::string _sPath, bool bMkDir, std::string _sExePath) |
This member function may be used to set the preferred file path of the current FileSystem instance. More... | |
void | createRevisionsFolder () |
This member function creates the hidden revisions folders for the version control system. More... | |
std::string | getPath () const |
Returns the default path of this FileSystem instance. More... | |
std::vector< std::string > | getFileParts (const std::string &sFilePath) const |
This member function separates all path parts into single strings: the drive letter, the path, the name and the extension. This function may also handle folder paths and network paths. More... | |
FileInfo | getFileInfo (const std::string &sFilePath) const |
Return the file information about the passed file path. More... | |
void | setTokens (std::string _sTokens) |
This member function may be used to update the path placeholders of the current FileSystem instance. More... | |
bool | isFile (const std::string &_sPath) const |
This function determines, whether a path name indicates a file or a folder. More... | |
void | initializeFromKernel () |
Member function to remote-initialize the class from the kernel. Cannot be used during kernel start-up. More... | |
void | setProgramPath (std::string _sExePath) |
std::string | getProgramPath () const |
void | declareFileType (const std::string &sFileType) |
Static Public Member Functions | |
static std::string | mangleName (std::string sProcedureName) |
Mangles a procedure name to be used as a usual variable. More... | |
Static Public Member Functions inherited from FlowCtrl | |
static bool | isFlowCtrlStatement (const std::string &sCmd) |
This static member function returns whether the passed command is a flow control statement. More... | |
static bool | isAnyFlowCtrlStatement (const std::string &sCmd) |
This static member function returns whether the passed command is any of the known flow control statements (not only their headers). More... | |
Private Member Functions | |
void | init () |
Private initializing member function. Sets all variables to a reasonable default value. More... | |
Returnvalue | ProcCalc (std::string sLine, std::string sCurrentCommand, int &nByteCode, mu::Parser &_parser, FunctionDefinitionManager &_functions, MemoryManager &_data, Settings &_option, Output &_out, PlotData &_pData, Script &_script) |
This member function does the evaluation stuff regarding strings and numerical expressions for the current procedure. More... | |
bool | setProcName (const std::string &sProc, bool bInstallFileName=false) |
This member function is used to obtain the procedure file name from the selected procedure. It handles the "thisfile" namespace directly. More... | |
void | resetProcedure (mu::Parser &_parser, bool bSupressAnswer) |
This member function sets the current procedure object to its original state. It will be called at the end of the executed procedure. More... | |
void | extractCurrentNamespace (const std::string &sProc) |
This member function extracts the namespace of the currently executed procedure. More... | |
bool | handleVariableDefinitions (std::string &sProcCommandLine, const std::string &sCommand) |
This method handles the definitions of local variables. More... | |
int | handleIncludeSyntax (std::string &sProcCommandLine, std::ifstream &fInclude, bool bReadingFromInclude) |
This member function handles the script include syntax, which one may use in other procedures. More... | |
void | extractProcedureInformation (const std::string &sCmdLine, size_t nPos, std::string &sProcName, std::string &sArgList, std::string &sFileName) |
This private member function extracts procedure name, argument list and the corresponding file name from the passed position in the command line. More... | |
virtual int | procedureCmdInterface (std::string &sLine) override |
Virtual member function allowing to identify and evaluate some special procedure commands. Currently it is only used for the namespace command. More... | |
virtual std::vector< std::string > | expandInlineProcedures (std::string &sLine) override |
This virtual private member function expands all procedures in the current command line, which were declared as "inline" and which are inlinable, into a vector of command lines, which will be inserted in the flow control command array before the current command line. More... | |
int | isInlineable (const std::string &sProc, const std::string &sFileName, int *nInlineFlag=nullptr) |
This private member function evaluates, whether the current procedure is inlineable, i.e. whether it fulfills the internal inlining rules. More... | |
int | applyInliningRuleset (const std::string &sCommandLine, const std::string &sArgumentList) |
This private member function applies the internal inlining rule set for a single procedure command line and returns the corresponding enumeration flags. More... | |
size_t | countProceduresInLine (const std::string &sCommandLine) |
This private member function simply counts the number of procedures, which may be found in the current command line. More... | |
std::vector< std::string > | getInlined (const std::string &sProc, const std::string &sArgumentList, const std::string &sFileName, size_t nProcedures) |
This virtual private member function returns the inlined representation of the selected procedure as a vector containing the single commands. More... | |
Private Attributes | |
std::fstream | fProcedure |
std::string | sProcNames |
std::string | sCurrentProcedureName |
int | nCurrentLine |
std::string | sNameSpace |
std::string | sCallingNameSpace |
std::string | sThisNameSpace |
std::string | sLastWrittenProcedureFile |
std::string | sProcCommandLine |
bool | bProcSupressAnswer |
bool | bWritingTofile |
int | nFlags |
int | nthBlock |
ProcedureVarFactory * | _varFactory |
FunctionDefinitionManager | _localDef |
Friends | |
class | NumeReDebugger |
class | ProcedureVarFactory |
Additional Inherited Members | |
Protected Types inherited from FlowCtrl | |
enum | CalculationType { CALCTYPE_NONE = 0x0 , CALCTYPE_COMMAND = 0x1 , CALCTYPE_NUMERICAL = 0x2 , CALCTYPE_STRING = 0x4 , CALCTYPE_DATAACCESS = 0x8 , CALCTYPE_PROGRESS = 0x10 , CALCTYPE_COMPOSE = 0x20 , CALCTYPE_DEFINITION = 0x40 , CALCTYPE_RETURNCOMMAND = 0x80 , CALCTYPE_THROWCOMMAND = 0x100 , CALCTYPE_DEBUGBREAKPOINT = 0x200 , CALCTYPE_EXPLICIT = 0x400 , CALCTYPE_TOCOMMAND = 0x800 , CALCTYPE_PROCEDURECMDINTERFACE = 0x1000 , CALCTYPE_CONTINUECMD = 0x2000 , CALCTYPE_BREAKCMD = 0x4000 , CALCTYPE_PROMPT = 0x8000 , CALCTYPE_RECURSIVEEXPRESSION = 0x10000 , CALCTYPE_SUPPRESSANSWER = 0x20000 , CALCTYPE_ASSERT = 0x40000 } |
enum | ProcedureInterfaceRetVal { INTERFACE_EMPTY = -2 , INTERFACE_ERROR = -1 , INTERFACE_NONE = 1 , INTERFACE_VALUE = 2 } |
enum | FlowCtrlStatement { FC_FOR , FC_IF , FC_WHILE , FC_SWITCH , FC_TRY , FC_COUNT } |
typedef int(FlowCtrl::* | FlowCtrlFunction) (int, int) |
Definition of a generic FlowCtrl entry point. More... | |
Protected Member Functions inherited from FlowCtrl | |
int | for_loop (int nth_Cmd=0, int nth_Loop=0) |
This member function realizes the FOR control flow statement. The return value is either an error value or the end of the current flow control statement. More... | |
int | range_based_for_loop (int nth_Cmd=0, int nth_Loop=0) |
This member function realizes the FOR control flow statement for range based indices. The return value is either an error value or the end of the current flow control statement. More... | |
int | while_loop (int nth_Cmd=0, int nth_Loop=0) |
This member function realizes the WHILE control flow statement. The return value is either an error value or the end of the current flow control statement. More... | |
int | if_fork (int nth_Cmd=0, int nth_Loop=-1) |
This member function realizes the IF-ELSE control flow statement. The return value is either an error value or the end of the current flow control statement. More... | |
int | switch_fork (int nth_Cmd=0, int nth_Loop=-1) |
This member function realizes the SWITCH-CASE control flow statement. The return value is either an error value or the end of the current flow control statement. More... | |
int | try_catch (int nth_Cmd=0, int nth_Loop=-1) |
Implements a try-catch block. More... | |
int | compile (std::string sLine, int nthCmd) |
This member function does the hard work and compiles the numerical and std::string results for the current command line to provide the bytecode for the usual calculation function. More... | |
int | calc (StringView sLine, int nthCmd) |
This member function does the hard work and calculates the numerical and std::string results for the current command line. It will use the previously determined bytecode whereever possible. More... | |
value_type * | evalHeader (int &nNum, std::string &sHeadExpression, bool bIsForHead, int nth_Cmd, const std::string &sHeadCommand) |
This member function abstracts the evaluation of all flow control headers. It will return an array of evaluated return values, although only the first (one/two) are used here. More... | |
NumeRe::Cluster | evalRangeBasedHeader (std::string &sHeadExpression, int nth_Cmd, const std::string &sHeadCommand) |
This member function handles the evaluation of the range-based flow control headers. It will return a cluster of the evaluated return values. More... | |
int | evalForkFlowCommands (int __j, int nth_loop) |
This member function handles the evaluation of flow control statements from the viewpoint of an if-else control flow. More... | |
void | replaceLocalVars (std::string &sLine) |
This member function is used to replace variable occurences with their (auto-determined) internal name. More... | |
void | replaceLocalVars (const std::string &sOldVar, const std::string &sNewVar, size_t from=0, size_t to=std::string::npos) |
Replaces all occurences of the selected variable in the range of the selected lines with the new name. More... | |
bool | checkFlowControlArgument (const std::string &sFlowControlArgument, bool isForLoop=false) |
This member function checks, whether the passed flow control argument is valid or not. More... | |
bool | checkCaseValue (const std::string &sCaseDefinition) |
This member function checks, whether the entered case definition is valid or not. More... | |
std::string | extractFlagsAndIndexVariables () |
Read the flow control statements only and extract the index variables and the flow control flags. More... | |
void | fillJumpTableAndExpandRecursives () |
Go again through the whole command set and fill the jump table with the corresponding block ends and pre-evaluate the recursive expressions. Furthermore, determine, whether the loop parsing mode is reasonable. More... | |
void | prepareSwitchExpression (int nSwitchStart) |
This member function will prepare the single logical switch expression. More... | |
void | checkParsingModeAndExpandDefinitions () |
If the loop parsing mode is active, ensure that only inline procedures are used in this case. Otherwise turn it off again. Additionally check for "to_cmd()" function, which will also turn the loop parsing mode off. If no function definition commands are found in the command block, replace the definitions with their expanded form. More... | |
void | prepareLocalVarsAndReplace (std::string &sVars) |
This method prepares the local variables including their names and replaces them in the command lines in the current command block. More... | |
void | updateTestStats () |
Updates the test statistics with the total test statistics. More... | |
virtual int | procedureCmdInterface (std::string &sLine) |
Dummy implementation. More... | |
virtual ProcedureInterfaceRetVal | procedureInterface (std::string &sLine, Parser &_parser, FunctionDefinitionManager &_functions, MemoryManager &_data, Output &_out, PlotData &_pData, Script &_script, Settings &_option, int nth_command) |
Dummy implementation. More... | |
virtual int | isInline (const std::string &sProc) |
Dummy implementation. More... | |
virtual int | evalDebuggerBreakPoint (Parser &_parser, Settings &_option) |
Dummy implementation. More... | |
virtual int | getErrorInformationForDebugger () |
Dummy implementation. More... | |
virtual std::vector< std::string > | expandInlineProcedures (std::string &sLine) |
Dummy implementation. More... | |
virtual int | catchExceptionForTest (std::exception_ptr e_ptr, bool bSupressAnswer_back, int nLine) |
Dummy implementation. More... | |
Protected Member Functions inherited from FileSystem | |
int | createFolders (const std::string &_sPath) const |
This member function creates all missing directories in the passed path. More... | |
Protected Attributes inherited from FlowCtrl | |
std::vector< FlowCtrlCommand > | vCmdArray |
std::vector< value_type > | vVarArray |
std::vector< std::string > | sVarArray |
varmap_type | vVars |
std::vector< std::vector< int > > | nJumpTable |
std::vector< int > | nCalcType |
std::string | sLoopNames |
int | nFlowCtrlStatements [FC_COUNT] |
int | nCurrentCommand |
Returnvalue | ReturnVal |
bool | bUseLoopParsingMode |
bool | bLockedPauseMode |
bool | bFunctionsReplaced |
std::string | sLoopPlotCompose |
std::map< std::string, std::string > | mVarMap |
std::set< std::string > | inlineClusters |
bool | bSilent |
bool | bMask |
bool | bPrintedStatus |
bool | bEvaluatingFlowControlStatements |
int | nLoopSafety |
int | nDebuggerCode |
AssertionStats | baseline |
std::string | sTestClusterName |
int | nthRecursion |
int | nReturnType |
bool | bReturnSignal |
Protected Attributes inherited from FileSystem | |
std::string | sPath |
std::string | sExecutablePath |
std::string | sTokens [7][2] |
std::string | sValidExtensions |
This class implements the logic to evaluate complex procedures, which may be called recursively.
Definition at line 55 of file procedure.hpp.
Procedure::Procedure | ( | ) |
Default constructor.
Definition at line 34 of file procedure.cpp.
References init().
Referenced by procedureInterface().
Procedure::Procedure | ( | const Procedure & | _procedure | ) |
Custom constructor using the presets from the passed procedure instance. Used as a recursion functionality.
_procedure | const Procedure& |
Definition at line 49 of file procedure.cpp.
References _localDef, NumeReKernel::DEBUGGER_LEAVE, NumeReKernel::DEBUGGER_STEPOVER, FunctionDefinitionManager::getPredefinedFuncs(), init(), FlowCtrl::nDebuggerCode, sCallingNameSpace, FunctionDefinitionManager::setPredefinedFuncs(), FileSystem::sExecutablePath, FileSystem::sPath, sProcNames, and FileSystem::sTokens.
Procedure::~Procedure | ( | ) |
Destructor ensuring that the procedure output file stream will be closed, if it is still open.
Definition at line 78 of file procedure.cpp.
References _varFactory, and fProcedure.
|
private |
This private member function applies the internal inlining rule set for a single procedure command line and returns the corresponding enumeration flags.
sCommandLine | const string& |
sArgumentList | const string& |
Definition at line 2185 of file procedure.cpp.
References findCommand(), ProcedureCommandLine::INLINING_IMPOSSIBLE, ProcedureCommandLine::INLINING_POSSIBLE, and Match::sString.
Referenced by isInlineable().
|
overridevirtual |
This virtual member function is inserted in some automatically catchable locations to convert an error into a warning to avoid that the calculation is aborted. This will only get active, if the corresponding procedure is flagged as "test".
e_ptr | exception_ptr |
bSupressAnswer_back | bool |
nLine | int |
Reimplemented from FlowCtrl.
Definition at line 2495 of file procedure.cpp.
References NumeReKernel::failMessage(), NumeReDebugger::finalizeCatched(), ProcedureCommandLine::FLAG_TEST, NumeReKernel::getDebugger(), mu::ParserError::GetExpr(), NumeReKernel::getInstance(), SyntaxError::LOOP_THROW, nFlags, SyntaxError::PROCEDURE_THROW, SyntaxError::PROCESS_ABORTED_BY_USER, resetProcedure(), and toString().
Referenced by execute().
|
private |
This private member function simply counts the number of procedures, which may be found in the current command line.
sCommandLine | const string& |
Definition at line 2224 of file procedure.cpp.
References isInQuotes().
Referenced by expandInlineProcedures().
|
overridevirtual |
This virtual member function handles the gathering of all relevant information for the debugger for the currently found breakpoint.
_parser | Parser& |
_option | Settings& |
Reimplemented from FlowCtrl.
Definition at line 2437 of file procedure.cpp.
References _varFactory, NumeReKernel::evalDebuggerBreakPoint(), NumeReDebugger::gatherInformations(), GetCurrentLine(), NumeReKernel::getDebugger(), NumeReKernel::getInstance(), sCurrentProcedureName, and NumeReDebugger::showBreakPoint().
Referenced by execute().
Returnvalue Procedure::execute | ( | std::string | sProc, |
std::string | sVarList, | ||
mu::Parser & | _parser, | ||
FunctionDefinitionManager & | _functions, | ||
MemoryManager & | _data, | ||
Settings & | _option, | ||
Output & | _out, | ||
PlotData & | _pData, | ||
Script & | _script, | ||
unsigned int | nth_procedure = 0 |
||
) |
This member function is central in the execution of the currently selected procedure as it handles all the logic.
sProc | string |
sVarList | string |
_parser | Parser& |
_functions | Define& |
_data | Datafile& |
_option | Settings& |
_out | Output& |
_pData | PlotData& |
_script | Script& |
nth_procedure | unsigned int |
Definition at line 614 of file procedure.cpp.
References _assertionHandler, _localDef, _varFactory, date::abs(), FlowCtrl::baseline, NumeReKernel::baseStackPosition, bProcSupressAnswer, FlowCtrl::bReturnSignal, NumeReKernel::bSupressAnswer, ProcedureCommandLine::BYTECODE_EXPLICIT, ProcedureCommandLine::BYTECODE_FLOWCTRLSTATEMENT, ProcedureCommandLine::BYTECODE_NAMESPACE, ProcedureCommandLine::BYTECODE_NOT_PARSED, ProcedureCommandLine::BYTECODE_PROCEDUREINTERFACE, ProcedureCommandLine::BYTECODE_RETURNCOMMAND, ProcedureCommandLine::BYTECODE_THROWCOMMAND, ProcedureCommandLine::BYTECODE_VARDEF, FunctionDefinitionManager::call(), catchExceptionForTest(), ProcedureVarFactory::createProcedureArguments(), ProcedureVarFactory::createTestStatsCluster(), NumeReKernel::DEBUGGER_LEAVE, NumeReKernel::DEBUGGER_STEP, decodeNameSpace(), FunctionDefinitionManager::defineFunc(), Returnvalue::delayDelete, ProcedureVarFactory::delayDeletionOfReturnedTable(), Settings::enableSystemPrints(), NumeRe::StringParser::evalAndFormat(), evalDebuggerBreakPoint(), extractCurrentNamespace(), findCommand(), ProcedureCommandLine::FLAG_INLINE, ProcedureCommandLine::FLAG_MASK, ProcedureCommandLine::FLAG_PRIVATE, ProcedureCommandLine::FLAG_TEST, g_logger, NumeReDebugger::gatherInformations(), getAllSemiColonSeparatedTokens(), ProcedureCommandLine::getArgumentList(), NumeReDebugger::getBreakpointManager(), FlowCtrl::getCurrentBlockDepth(), GetCurrentLine(), ProcedureElement::getCurrentLine(), NumeReKernel::getDebugger(), NumeReKernel::getInstance(), ProcedureElement::getNextLine(), ProcedureLibrary::getProcedureContents(), FlowCtrl::getReturnSignal(), FlowCtrl::getReturnValue(), Assertion::getStats(), NumeReKernel::getStringParser(), NumeRe::StringVarFactory::getStringValues(), ProcedureElement::gotoProcedure(), handleVariableDefinitions(), SyntaxError::IF_OR_LOOP_SEEMS_NOT_TO_BE_CLOSED, DetachedLogger::info(), SyntaxError::INLINE_PROCEDURE_IS_NOT_INLINE, FlowCtrl::INTERFACE_EMPTY, FlowCtrl::INTERFACE_ERROR, FlowCtrl::INTERFACE_VALUE, SyntaxError::invalid_position, SyntaxError::INVALID_PROCEDURE_NAME, BreakpointManager::isBreakpoint(), FlowCtrl::isFlowCtrlStatement(), ProcedureElement::isLastLine(), NumeRe::StringParser::isStringExpression(), MemoryManager::isTable(), mangleName(), MAX_PROCEDURE_STACK_SIZE, FlowCtrl::mVarMap, mu::ParserBase::mVarMapPntr, nCurrentLine, FlowCtrl::nDebuggerCode, nFlags, FlowCtrl::nReturnType, FlowCtrl::nthRecursion, NumeReDebugger::popStackItem(), SyntaxError::PRIVATE_PROCEDURE_CALLED, ProcCalc(), SyntaxError::PROCEDURE_NOT_FOUND, SyntaxError::PROCEDURE_STACK_OVERFLOW, SyntaxError::PROCEDURE_THROW, procedureInterface(), ProcedureVarFactory, NumeReKernel::ProcLibrary, NumeReDebugger::pushStackItem(), Assertion::reset(), resetProcedure(), ProcedureVarFactory::resolveVariables(), sCallingNameSpace, sCurrentProcedureName, sErrorToken, ProcedureElement::setByteCode(), setProcName(), NumeReDebugger::showError(), sNameSpace, sProcCommandLine, Returnvalue::sReturnedTable, Match::sString, FlowCtrl::sTestClusterName, sThisNameSpace, StripSpaces(), Settings::systemPrints(), NumeReDebugger::throwException(), toString(), ProcedureCommandLine::TYPE_PROCEDURE_FOOT, ProcedureCommandLine::TYPE_PROCEDURE_HEAD, FlowCtrl::updateTestStats(), Settings::useDebugger(), Returnvalue::vNumVal, Returnvalue::vStringVal, and SyntaxError::WRONG_ARG_NAME.
Referenced by NumeReKernel::evaluateProcedureCalls(), and NumeReKernel::executePlugins().
|
overrideprivatevirtual |
This virtual private member function expands all procedures in the current command line, which were declared as "inline" and which are inlinable, into a vector of command lines, which will be inserted in the flow control command array before the current command line.
sProc | string& |
Reimplemented from FlowCtrl.
Definition at line 2026 of file procedure.cpp.
References countProceduresInLine(), expandInlineProcedures(), extractProcedureInformation(), getInlined(), getMatchingParenthesis(), isInlineable(), and isInQuotes().
Referenced by expandInlineProcedures().
|
private |
This member function extracts the namespace of the currently executed procedure.
sProc | const string& |
Definition at line 2728 of file procedure.cpp.
References sCallingNameSpace, and sThisNameSpace.
Referenced by execute().
|
private |
This private member function extracts procedure name, argument list and the corresponding file name from the passed position in the command line.
sCmdLine | const string& |
nPos | size_t |
sProcName | string& |
sArgList | string& |
sFileName | string& |
Definition at line 1880 of file procedure.cpp.
References getMatchingParenthesis(), SyntaxError::invalid_position, SyntaxError::PRIVATE_PROCEDURE_CALLED, sNameSpace, sProcNames, sThisNameSpace, and FileSystem::ValidFileName().
Referenced by expandInlineProcedures(), and isInline().
unsigned int Procedure::GetCurrentLine | ( | ) | const |
This member function will return the current line number depending on whether a flow control statement is evaluated or not.
Definition at line 2563 of file procedure.cpp.
References FlowCtrl::bEvaluatingFlowControlStatements, FlowCtrl::getCurrentLineNumber(), max, and nCurrentLine.
Referenced by ProcedureVarFactory::checkArgument(), ProcedureVarFactory::checkArgumentValue(), ProcedureVarFactory::createLocalClusters(), ProcedureVarFactory::createLocalInlineStrings(), ProcedureVarFactory::createLocalInlineVars(), ProcedureVarFactory::createLocalStrings(), ProcedureVarFactory::createLocalTables(), ProcedureVarFactory::createLocalVars(), ProcedureVarFactory::createProcedureArguments(), evalDebuggerBreakPoint(), ProcedureVarFactory::evaluateProcedureArguments(), execute(), getErrorInformationForDebugger(), NumeReDebugger::getStackTrace(), and NumeReDebugger::select().
|
inline |
Definition at line 113 of file procedure.hpp.
References sCurrentProcedureName.
Referenced by ProcedureVarFactory::checkArgument(), ProcedureVarFactory::checkArgumentValue(), ProcedureVarFactory::createLocalClusters(), ProcedureVarFactory::createLocalInlineStrings(), ProcedureVarFactory::createLocalInlineVars(), ProcedureVarFactory::createLocalStrings(), ProcedureVarFactory::createLocalTables(), ProcedureVarFactory::createLocalVars(), ProcedureVarFactory::createProcedureArguments(), and ProcedureVarFactory::evaluateProcedureArguments().
|
inline |
Definition at line 122 of file procedure.hpp.
References FlowCtrl::nDebuggerCode.
Referenced by NumeReKernel::MainLoop().
|
overridevirtual |
This virtual member function handles the gathering of all relevant information for the debugger for the currently found error.
Reimplemented from FlowCtrl.
Definition at line 2464 of file procedure.cpp.
References _varFactory, NumeReDebugger::gatherInformations(), GetCurrentLine(), NumeReKernel::getDebugger(), NumeReKernel::getInstance(), and sCurrentProcedureName.
|
private |
This virtual private member function returns the inlined representation of the selected procedure as a vector containing the single commands.
sProc | const string& |
sArgumentList | const string& |
sFileName | const string& |
nProcedures | size_t |
Definition at line 2265 of file procedure.cpp.
References ProcedureVarFactory::createLocalStrings(), ProcedureVarFactory::createLocalVars(), ProcedureVarFactory::createProcedureArguments(), NumeRe::ClusterManager::createTemporaryCluster(), findCommand(), NumeReDebugger::getBreakpointManager(), mu::ParserBase::GetConst(), ProcedureElement::getCurrentLine(), NumeReKernel::getDebugger(), NumeReKernel::getInstance(), NumeReKernel::getMemoryManager(), ProcedureElement::getNextLine(), NumeReKernel::getParser(), ProcedureLibrary::getProcedureContents(), ProcedureElement::gotoProcedure(), FlowCtrl::inlineClusters, SyntaxError::invalid_position, BreakpointManager::isBreakpoint(), ProcedureElement::isLastLine(), isMultiValue(), Match::nPos, FlowCtrl::nthRecursion, SyntaxError::PROCEDURE_NOT_FOUND, NumeReKernel::ProcLibrary, ProcedureVarFactory::resolveVariables(), ProcedureVarFactory::sInlineStringDef, ProcedureVarFactory::sInlineVarDef, StripSpaces(), ProcedureCommandLine::TYPE_PROCEDURE_FOOT, and ProcedureVarFactory::vInlineArgDef.
Referenced by expandInlineProcedures().
|
inline |
Definition at line 120 of file procedure.hpp.
References nFlags.
Referenced by ProcedureVarFactory::createLocalClusters(), ProcedureVarFactory::createLocalStrings(), ProcedureVarFactory::createLocalTables(), ProcedureVarFactory::createLocalVars(), and ProcedureVarFactory::evaluateProcedureArguments().
|
inline |
Definition at line 116 of file procedure.hpp.
References FlowCtrl::nReturnType.
Referenced by NumeReKernel::evaluateProcedureCalls().
|
private |
This member function handles the script include syntax, which one may use in other procedures.
sProcCommandLine | string& |
fInclude | ifstream& |
bReadingFromInclude | bool |
The included file is indicated with an "@" and its file name afterwards. This function will decode this syntax and open the corresponding file stream.
Definition at line 2834 of file procedure.cpp.
References SyntaxError::invalid_position, SyntaxError::SCRIPT_NOT_EXIST, sProcCommandLine, StripSpaces(), and FileSystem::ValidFileName().
|
private |
This method handles the definitions of local variables.
sProcCommandLine | string& |
sCommand | const string& |
It will return true, if a definition occured, otherwise false. The return value will be used to create a corresponding byte code.
Definition at line 2776 of file procedure.cpp.
References _varFactory, ProcedureVarFactory::createLocalClusters(), ProcedureVarFactory::createLocalStrings(), ProcedureVarFactory::createLocalTables(), ProcedureVarFactory::createLocalVars(), and sProcCommandLine.
Referenced by execute().
|
private |
Private initializing member function. Sets all variables to a reasonable default value.
Definition at line 98 of file procedure.cpp.
References _varFactory, bProcSupressAnswer, bWritingTofile, nCurrentLine, nFlags, nthBlock, and sCallingNameSpace.
Referenced by Procedure().
|
inline |
Definition at line 118 of file procedure.hpp.
References bWritingTofile.
Referenced by NumeReKernel::getLineFromCommandCache(), NumeReKernel::handleComposeBlock(), NumeReKernel::handleFlowControls(), NumeReKernel::handleProcedureWrite(), and NumeReKernel::MainLoop().
|
overridevirtual |
This virtual member function checks, whether the procedures in the current line are declared as inline and whether they are inlinable.
sProc | const string& |
Reimplemented from FlowCtrl.
Definition at line 1958 of file procedure.cpp.
References extractProcedureInformation(), ProcedureCommandLine::INLINING_IMPOSSIBLE, ProcedureCommandLine::INLINING_POSSIBLE, isInlineable(), isInQuotes(), and max.
|
private |
This private member function evaluates, whether the current procedure is inlineable, i.e. whether it fulfills the internal inlining rules.
sProc | const string& |
sFileName | const string& |
nInlineFlag | int* |
Definition at line 2109 of file procedure.cpp.
References applyInliningRuleset(), findCommand(), ProcedureCommandLine::FLAG_INLINE, ProcedureElement::getCurrentLine(), ProcedureElement::getNextLine(), ProcedureLibrary::getProcedureContents(), ProcedureElement::gotoProcedure(), ProcedureCommandLine::INLINING_IMPOSSIBLE, ProcedureCommandLine::INLINING_UNKNOWN, SyntaxError::invalid_position, ProcedureElement::isLastLine(), SyntaxError::PROCEDURE_NOT_FOUND, NumeReKernel::ProcLibrary, Match::sString, and ProcedureCommandLine::TYPE_PROCEDURE_FOOT.
Referenced by expandInlineProcedures(), and isInline().
|
static |
Mangles a procedure name to be used as a usual variable.
sProcedureName | std::string |
Definition at line 2414 of file procedure.cpp.
Referenced by NumeReKernel::evaluateProcedureCalls(), execute(), and procedureInterface().
|
private |
This member function does the evaluation stuff regarding strings and numerical expressions for the current procedure.
sLine | string |
sCurrentCommand | string |
nByteCode | int& |
_parser | Parser& |
_functions | Define& |
_data | Datafile& |
_option | Settings& |
_out | Output& |
_pData | PlotData& |
_script | Script& |
Definition at line 130 of file procedure.cpp.
References _assertionHandler, mu::ParserBase::ActiveLoopMode(), NumeRe::Cluster::assignResults(), bProcSupressAnswer, NumeReKernel::bSupressAnswer, ProcedureCommandLine::BYTECODE_ASSERT, ProcedureCommandLine::BYTECODE_COMMAND, ProcedureCommandLine::BYTECODE_DATAACCESS, ProcedureCommandLine::BYTECODE_FLOWCTRLSTATEMENT, ProcedureCommandLine::BYTECODE_NOT_PARSED, ProcedureCommandLine::BYTECODE_PROMPT, ProcedureCommandLine::BYTECODE_RECURSIVEEXPRESSION, ProcedureCommandLine::BYTECODE_STRING, ProcedureCommandLine::BYTECODE_THROWCOMMAND, ProcedureCommandLine::BYTECODE_TOCOMMAND, FunctionDefinitionManager::call(), Assertion::checkAssertion(), Returnvalue::clear(), mu::ParserBase::ClearVectorVars(), Indices::col, COMMAND_HAS_RETURNVALUE, COMMAND_PROCESSED, commandHandler(), MemoryManager::containsTablesOrClusters(), Assertion::enable(), mu::ParserBase::Eval(), NumeRe::StringParser::evalAndFormat(), evalRecursiveExpressions(), findCommand(), ProcedureCommandLine::FLAG_INLINE, ProcedureCommandLine::FLAG_TEMPLATE, NumeReKernel::formatResultOutput(), SyntaxError::FUNCTION_ERROR, NumeReKernel::getAns(), NumeReKernel::GetAsyncCancelState(), NumeRe::ClusterManager::getCluster(), FlowCtrl::getCurrentBlockDepth(), getDataElements(), getIndices(), NumeReKernel::getInstance(), getMatchingParenthesis(), getStringArgument(), NumeReKernel::getStringParser(), NumeRe::StringVarFactory::getStringValues(), SyntaxError::INVALID_INDEX, SyntaxError::invalid_position, mu::ParserBase::IsAlreadyParsed(), isClusterCandidate(), FlowCtrl::isFlowCtrlStatement(), isInQuotes(), mu::ParserBase::IsLockedPause(), VectorIndex::isOpenEnd(), NumeRe::StringParser::isStringExpression(), isValidIndexSet(), nCurrentLine, nFlags, NO_COMMAND, SyntaxError::NO_MATRIX, NumeReKernel::print(), SyntaxError::PROCEDURE_THROW, procedureInterface(), SyntaxError::PROCESS_ABORTED_BY_USER, promptForUserInput(), NumeRe::StringVarFactory::removeTempStringVectorVars(), FlowCtrl::replaceLocalVars(), Indices::row, sErrorToken, FlowCtrl::setCommand(), NumeRe::Cluster::setDoubleArray(), mu::ParserBase::SetExpr(), Match::sString, NumeRe::StringParser::STRING_SUCCESS, StripSpaces(), NumeRe::Cluster::to_string(), VectorIndex::to_string(), SyntaxError::UNMATCHED_PARENTHESIS, vAns, Returnvalue::vNumVal, Returnvalue::vStringVal, and MemoryManager::writeToTable().
Referenced by execute().
|
overrideprivatevirtual |
Virtual member function allowing to identify and evaluate some special procedure commands. Currently it is only used for the namespace command.
sLine | string& |
The commands "var", "str", "tab" and "cst" are recognized but not evaluated.
Reimplemented from FlowCtrl.
Definition at line 1494 of file procedure.cpp.
References findCommand(), sNameSpace, Match::sString, sThisNameSpace, and StripSpaces().
|
overridevirtual |
This member function handles the calls for procedures and plugins, resolves them and executes the called procedures by constructing a new instance of this class on the heap.
sLine | string& |
_parser | Parser& |
_functions | Define& |
_data | Datafile& |
_out | Output& |
_pData | PlotData& |
_script | Script& |
_option | Settings& |
nth_command | int |
Reimplemented from FlowCtrl.
Definition at line 1250 of file procedure.cpp.
References FlowCtrl::bReturnSignal, MemoryManager::copyTable(), mu::ParserBase::CreateTempVectorVar(), Returnvalue::delayDelete, MemoryManager::deleteTable(), Settings::enableSystemPrints(), findCommand(), ProcedureCommandLine::FLAG_EXPLICIT, ProcedureCommandLine::FLAG_INLINE, ProcedureCommandLine::FLAG_MASK, MemoryManager::getCols(), MemoryManager::getLines(), getMatchingParenthesis(), SyntaxError::INLINE_PROCEDURE_IS_NOT_INLINE, FlowCtrl::INTERFACE_EMPTY, FlowCtrl::INTERFACE_ERROR, FlowCtrl::INTERFACE_NONE, FlowCtrl::INTERFACE_VALUE, SyntaxError::invalid_position, MemoryManager::isEmpty(), isInQuotes(), MemoryManager::isTable(), mangleName(), FlowCtrl::mVarMap, mu::ParserBase::mVarMapPntr, nFlags, Match::nPos, FlowCtrl::nReturnType, FlowCtrl::nthRecursion, Procedure(), MemoryManager::renameTable(), replaceReturnVal(), FlowCtrl::ReturnVal, mu::ParserBase::SetVectorVar(), sNameSpace, Returnvalue::sReturnedTable, Match::sString, sThisNameSpace, StripSpaces(), MemoryManager::swapTables(), Settings::systemPrints(), toString(), SyntaxError::UNMATCHED_PARENTHESIS, FlowCtrl::updateTestStats(), Returnvalue::vNumVal, and Returnvalue::vStringVal.
Referenced by ProcedureVarFactory::createLocalClusters(), ProcedureVarFactory::createLocalStrings(), ProcedureVarFactory::createLocalTables(), ProcedureVarFactory::createLocalVars(), ProcedureVarFactory::evaluateProcedureArguments(), execute(), and ProcCalc().
size_t Procedure::replaceReturnVal | ( | std::string & | sLine, |
mu::Parser & | _parser, | ||
const Returnvalue & | _return, | ||
unsigned int | nPos, | ||
unsigned int | nPos2, | ||
const std::string & | sReplaceName | ||
) |
This member function replaces the procedure occurence between the both passed positions using akronymed version of the called procedure. It also declares the numerical return value as a vector to the parser.
sLine | string& |
_parser | Parser& |
_return | const Returnvalue& |
nPos | unsigned int |
nPos2 | unsigned int |
sReplaceName | const string& |
Definition at line 2591 of file procedure.cpp.
References FlowCtrl::bReturnSignal, MemoryManager::copyTable(), NumeRe::StringVarFactory::createTempStringVectorVar(), mu::ParserBase::CreateTempVectorVar(), Returnvalue::delayDelete, MemoryManager::deleteTable(), findCommand(), MemoryManager::getCols(), NumeReKernel::getInstance(), MemoryManager::getLines(), NumeReKernel::getMemoryManager(), NumeReKernel::getStringParser(), MemoryManager::isEmpty(), Returnvalue::isNumeric(), Returnvalue::isString(), MemoryManager::isTable(), Match::nPos, MemoryManager::renameTable(), FlowCtrl::ReturnVal, mu::ParserBase::SetVectorVar(), Returnvalue::sReturnedTable, Match::sString, StripSpaces(), MemoryManager::swapTables(), Returnvalue::vNumVal, and Returnvalue::vStringVal.
Referenced by NumeReKernel::evaluateProcedureCalls(), and procedureInterface().
|
private |
This member function sets the current procedure object to its original state. It will be called at the end of the executed procedure.
_parser | Parser& |
bSupressAnswer | bool |
Definition at line 2686 of file procedure.cpp.
References _localDef, _varFactory, NumeReKernel::bSupressAnswer, NumeReKernel::getDebugger(), NumeReKernel::getInstance(), FlowCtrl::mVarMap, mu::ParserBase::mVarMapPntr, FlowCtrl::nDebuggerCode, nFlags, FlowCtrl::nthRecursion, NumeReDebugger::popStackItem(), FunctionDefinitionManager::reset(), sCallingNameSpace, sNameSpace, sProcNames, FlowCtrl::sTestClusterName, and sThisNameSpace.
Referenced by catchExceptionForTest(), and execute().
|
inline |
Definition at line 109 of file procedure.hpp.
References _localDef, and FunctionDefinitionManager::setPredefinedFuncs().
Referenced by NumeReKernel::StartUp().
|
private |
This member function is used to obtain the procedure file name from the selected procedure. It handles the "thisfile" namespace directly.
sProc | const string& |
bInstallFileName | bool |
Definition at line 547 of file procedure.cpp.
References sCurrentProcedureName, sLastWrittenProcedureFile, sProcNames, and FileSystem::ValidFileName().
Referenced by execute(), and writeProcedure().
bool Procedure::writeProcedure | ( | std::string | sProcedureLine | ) |
This member function handles the procedure installation process by governing the file stream and passing the corresponding procedure linewards to the stream.
sProcedureLine | string |
Definition at line 1547 of file procedure.cpp.
References _lang, bWritingTofile, findCommand(), fProcedure, Language::get(), getMatchingParenthesis(), getTimeStamp(), SyntaxError::IF_OR_LOOP_SEEMS_NOT_TO_BE_CLOSED, SyntaxError::invalid_position, isInQuotes(), nthBlock, sCurrentProcedureName, FileSystem::setPath(), setProcName(), sLastWrittenProcedureFile, FileSystem::sTokens, StripSpaces(), toUpperCase(), date::detail::trunc(), and writeProcedure().
Referenced by NumeReKernel::handleProcedureWrite(), Script::writeProcedure(), and writeProcedure().
|
friend |
Definition at line 58 of file procedure.hpp.
|
friend |
Definition at line 59 of file procedure.hpp.
Referenced by execute().
|
private |
Definition at line 76 of file procedure.hpp.
Referenced by execute(), Procedure(), resetProcedure(), and setPredefinedFuncs().
|
private |
Definition at line 74 of file procedure.hpp.
Referenced by evalDebuggerBreakPoint(), execute(), getErrorInformationForDebugger(), handleVariableDefinitions(), init(), resetProcedure(), NumeReDebugger::select(), and ~Procedure().
|
private |
Definition at line 70 of file procedure.hpp.
Referenced by execute(), init(), and ProcCalc().
|
private |
Definition at line 71 of file procedure.hpp.
Referenced by init(), is_writing(), and writeProcedure().
|
private |
Definition at line 61 of file procedure.hpp.
Referenced by writeProcedure(), and ~Procedure().
|
private |
Definition at line 64 of file procedure.hpp.
Referenced by execute(), GetCurrentLine(), init(), and ProcCalc().
|
private |
Definition at line 72 of file procedure.hpp.
Referenced by catchExceptionForTest(), execute(), getProcedureFlags(), init(), ProcCalc(), procedureInterface(), and resetProcedure().
|
private |
Definition at line 73 of file procedure.hpp.
Referenced by init(), and writeProcedure().
|
private |
Definition at line 66 of file procedure.hpp.
Referenced by execute(), extractCurrentNamespace(), init(), Procedure(), and resetProcedure().
|
private |
Definition at line 63 of file procedure.hpp.
Referenced by evalDebuggerBreakPoint(), execute(), getCurrentProcedureName(), getErrorInformationForDebugger(), NumeReDebugger::getStackTrace(), NumeReDebugger::select(), setProcName(), and writeProcedure().
|
private |
Definition at line 68 of file procedure.hpp.
Referenced by setProcName(), and writeProcedure().
|
private |
Definition at line 65 of file procedure.hpp.
Referenced by execute(), extractProcedureInformation(), procedureCmdInterface(), procedureInterface(), and resetProcedure().
|
private |
Definition at line 69 of file procedure.hpp.
Referenced by execute(), handleIncludeSyntax(), handleVariableDefinitions(), and NumeReDebugger::select().
|
private |
Definition at line 62 of file procedure.hpp.
Referenced by extractProcedureInformation(), Procedure(), resetProcedure(), and setProcName().
|
private |
Definition at line 67 of file procedure.hpp.
Referenced by execute(), extractCurrentNamespace(), extractProcedureInformation(), procedureCmdInterface(), procedureInterface(), and resetProcedure().