NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
|
#include <script.hpp>
Public Member Functions | |
Script () | |
Default constructor. More... | |
~Script () | |
Destructor. More... | |
std::string | getNextScriptCommand () |
This member function is the main interface to the internal managed script. It will always return the next valid script line. More... | |
std::string | getScriptFileName () const |
void | setPredefinedFuncs (const std::string &sPredefined) |
unsigned int | getCurrentLine () const |
void | openScript (std::string &_sScriptFileName) |
This member function opens the script with the passed file name. More... | |
void | close () |
This member function closes an opened script. More... | |
void | returnCommand () |
This member function closes the script, if the code reached a "return" statement. More... | |
void | setInstallProcedures (bool _bInstall=true) |
bool | isOpen () const |
bool | isValid () const |
bool | wasLastCommand () |
bool | installProcedures () const |
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) |
Private Types | |
enum | { ENABLE_DEFAULTS = 0x0 , ENABLE_FULL_LOGGING = 0x1 , DISABLE_SCREEN_OUTPUT = 0x2 } |
Private Member Functions | |
bool | startInstallation (std::string &sScriptCommand) |
This member function starts the current installation section. More... | |
bool | handleInstallInformation (std::string &sScriptCommand) |
This member function handles the install information tags of the current installation section. More... | |
void | writeDocumentationArticle (std::string &sScriptCommand) |
This member function writes the appended documentation article to the target file. More... | |
void | writeLayout (std::string &sScriptCommand) |
This member function writes the embedded window layout to the target file. More... | |
void | writeProcedure () |
Writes a procedure including the comments to a procedure file. More... | |
bool | writeWholeFile () |
Writes the contents of a whole file to the target file, which has been specified by the XML-like tags. More... | |
void | evaluateInstallInformation (std::string &sInstallInfoString) |
This member function evaluates the flags from the installation information string and also removes unnecessary comments. More... | |
std::string | getNextScriptCommandFromScript () |
This member function returns the next valid line from the currently opened script. More... | |
std::string | getNextScriptCommandFromInclude () |
This member function returns the next valid line from the included script. More... | |
std::string | handleIncludeSyntax (std::string &sScriptCommand) |
This member function handles the script include syntax ("@SCRIPT") and prepares the included file stream. More... | |
bool | handleLocalDefinitions (std::string &sScriptCommand) |
This private member function handles the definition and replacement of local functions. More... | |
Private Attributes | |
std::unique_ptr< StyledTextFile > | m_script |
std::unique_ptr< Includer > | m_include |
Logger | m_logger |
std::string | sScriptFileName |
bool | bValidScript |
bool | bLastScriptCommand |
int | nLine |
int | nInstallModeFlags |
bool | isInstallMode |
bool | isInInstallSection |
std::string | sHelpID |
std::string | sInstallID |
std::vector< std::string > | vInstallPackages |
unsigned int | nCurrentPackage |
FunctionDefinitionManager | _localDef |
SymDefManager | _symdefs |
Additional Inherited Members | |
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 FileSystem | |
std::string | sPath |
std::string | sExecutablePath |
std::string | sTokens [7][2] |
std::string | sValidExtensions |
Definition at line 35 of file script.hpp.
|
private |
Enumerator | |
---|---|
ENABLE_DEFAULTS | |
ENABLE_FULL_LOGGING | |
DISABLE_SCREEN_OUTPUT |
Definition at line 41 of file script.hpp.
Script::Script | ( | ) |
Default constructor.
Definition at line 36 of file script.cpp.
References bLastScriptCommand, bValidScript, ENABLE_DEFAULTS, isInstallMode, nCurrentPackage, nInstallModeFlags, and nLine.
Script::~Script | ( | ) |
Destructor.
Definition at line 50 of file script.cpp.
References close(), and m_script.
void Script::close | ( | ) |
This member function closes an opened script.
Definition at line 107 of file script.cpp.
References _localDef, _symdefs, bLastScriptCommand, bValidScript, SymDefManager::clear(), Logger::close(), ENABLE_DEFAULTS, NumeReKernel::installationDone(), Logger::is_open(), isInstallMode, m_include, m_logger, m_script, nCurrentPackage, nInstallModeFlags, nLine, openScript(), Logger::push(), FunctionDefinitionManager::reset(), sHelpID, sInstallID, sScriptFileName, and vInstallPackages.
Referenced by getNextScriptCommandFromScript(), handleInstallInformation(), NumeReKernel::MainLoop(), openScript(), NumeReKernel::resetAfterError(), returnCommand(), and ~Script().
|
private |
This member function evaluates the flags from the installation information string and also removes unnecessary comments.
sInstallInfoString | std::string& |
Definition at line 717 of file script.cpp.
References _lang, DISABLE_SCREEN_OUTPUT, ENABLE_FULL_LOGGING, findParameter(), Language::get(), getArgAtPos(), m_logger, nInstallModeFlags, NumeReKernel::print(), Logger::push_line(), and toSystemCodePage().
Referenced by handleInstallInformation().
|
inline |
Definition at line 91 of file script.hpp.
References m_include, and nLine.
Referenced by NumeReKernel::handleFlowControls(), NumeReKernel::MainLoop(), and NumeReKernel::resetAfterError().
string Script::getNextScriptCommand | ( | ) |
This member function is the main interface to the internal managed script. It will always return the next valid script line.
Definition at line 1055 of file script.cpp.
References getNextScriptCommandFromInclude(), getNextScriptCommandFromScript(), handleIncludeSyntax(), handleLocalDefinitions(), SyntaxError::invalid_position, isInstallMode, m_include, m_script, SyntaxError::PROCEDURE_WITHOUT_INSTALL_FOUND, and sScriptFileName.
Referenced by NumeReKernel::handleCommandLineSource().
|
private |
This member function returns the next valid line from the included script.
Definition at line 967 of file script.cpp.
References m_include.
Referenced by getNextScriptCommand().
|
private |
This member function returns the next valid line from the currently opened script.
Definition at line 751 of file script.cpp.
References _lang, bLastScriptCommand, Logger::close(), close(), DISABLE_SCREEN_OUTPUT, ENABLE_FULL_LOGGING, findCommand(), Language::get(), NumeReKernel::getInstance(), handleInstallInformation(), NumeReKernel::installationDone(), Logger::is_open(), isInInstallSection, isInstallMode, m_logger, m_script, nInstallModeFlags, nLine, NumeReKernel::print(), Logger::push(), Logger::push_line(), sScriptFileName, startInstallation(), StripSpaces(), toSystemCodePage(), writeDocumentationArticle(), writeLayout(), writeProcedure(), and writeWholeFile().
Referenced by getNextScriptCommand().
|
inline |
Definition at line 85 of file script.hpp.
References sScriptFileName.
Referenced by NumeReKernel::evaluateStrings(), NumeReKernel::handleFlowControls(), and NumeReKernel::MainLoop().
|
private |
This member function handles the script include syntax ("@SCRIPT") and prepares the included file stream.
sScriptCommand | string& |
Definition at line 985 of file script.cpp.
References SyntaxError::invalid_position, Includer::is_including_syntax(), m_include, m_script, and SyntaxError::SCRIPT_NOT_EXIST.
Referenced by getNextScriptCommand().
|
private |
This member function handles the install information tags of the current installation section.
sScriptCommand | string& |
Definition at line 247 of file script.cpp.
References _lang, AutoVersion::BUILD, close(), PackageManager::declareNewPackage(), evaluateInstallInformation(), fileExists(), Language::get(), getArgAtPos(), NumeReKernel::getInstalledPackages(), NumeReKernel::getInstance(), NumeReKernel::getline(), getNextArgument(), NumeReKernel::getProcedureInterpreter(), NumeReKernel::getSettings(), SyntaxError::INSUFFICIENT_NUMERE_VERSION, SyntaxError::invalid_position, isInInstallSection, LineBreak(), m_script, AutoVersion::MAJOR, AutoVersion::MINOR, nLine, NumeReKernel::print(), NumeReKernel::printPreFmt(), SyntaxError::SCRIPT_NOT_EXIST, sInstallID, sScriptFileName, StripSpaces(), toString(), FileSystem::ValidFileName(), versionToInt(), vInstallPackages, and Language::YES().
Referenced by getNextScriptCommandFromScript(), and startInstallation().
|
private |
This private member function handles the definition and replacement of local functions.
sScriptCommand | string& |
Definition at line 1018 of file script.cpp.
References _localDef, _symdefs, FunctionDefinitionManager::call(), SymDefManager::createSymbol(), FunctionDefinitionManager::defineFunc(), findCommand(), SymDefManager::resolveSymbols(), Match::sString, and SYMDEF_COMMAND.
Referenced by getNextScriptCommand().
|
inline |
Definition at line 114 of file script.hpp.
References isInstallMode.
|
inline |
Definition at line 101 of file script.hpp.
References m_script.
Referenced by cmd_install(), cmd_start(), NumeReKernel::createCalculationAnswer(), NumeReKernel::evaluateStrings(), NumeReKernel::handleCommandLineSource(), NumeReKernel::handleComposeBlock(), NumeReKernel::handleFlowControls(), NumeReKernel::handleProcedureWrite(), NumeReKernel::MainLoop(), and NumeReKernel::resetAfterError().
|
inline |
Definition at line 103 of file script.hpp.
References bValidScript.
Referenced by NumeReKernel::createCalculationAnswer(), NumeReKernel::evaluateStrings(), NumeReKernel::handleCommandLineSource(), NumeReKernel::handleComposeBlock(), NumeReKernel::handleFlowControls(), NumeReKernel::handleProcedureWrite(), NumeReKernel::MainLoop(), and NumeReKernel::resetAfterError().
void Script::openScript | ( | std::string & | _sScriptFileName | ) |
This member function opens the script with the passed file name.
_sScriptFileName | string& |
Definition at line 67 of file script.cpp.
References _localDef, _symdefs, bValidScript, SymDefManager::clear(), close(), ENABLE_DEFAULTS, SyntaxError::invalid_position, m_script, nInstallModeFlags, nLine, FunctionDefinitionManager::reset(), SyntaxError::SCRIPT_NOT_EXIST, sHelpID, sInstallID, sScriptFileName, and FileSystem::ValidFileName().
Referenced by close(), cmd_install(), and cmd_start().
void Script::returnCommand | ( | ) |
This member function closes the script, if the code reached a "return" statement.
This function has to be called from the outside, because this class won't track this command internally.
Definition at line 176 of file script.cpp.
References _lang, Logger::close(), close(), DISABLE_SCREEN_OUTPUT, Language::get(), NumeReKernel::installationDone(), Logger::is_open(), m_logger, m_script, nInstallModeFlags, NumeReKernel::print(), Logger::push(), and toSystemCodePage().
Referenced by NumeReKernel::handleFlowControls().
|
inline |
|
inline |
Definition at line 87 of file script.hpp.
References _localDef, and FunctionDefinitionManager::setPredefinedFuncs().
Referenced by NumeReKernel::StartUp().
|
private |
This member function starts the current installation section.
sScriptCommand | string& |
Definition at line 204 of file script.cpp.
References SyntaxError::CANNOT_OPEN_LOGFILE, getTimeStamp(), handleInstallInformation(), SyntaxError::invalid_position, isInInstallSection, m_logger, Logger::open(), Logger::push_line(), FileSystem::sTokens, and StripSpaces().
Referenced by getNextScriptCommandFromScript().
|
inline |
Definition at line 105 of file script.hpp.
References bLastScriptCommand.
Referenced by NumeReKernel::evaluateStrings(), NumeReKernel::handleFlowControls(), and NumeReKernel::MainLoop().
|
private |
This member function writes the appended documentation article to the target file.
sScriptCommand | string& |
Definition at line 390 of file script.cpp.
References Documentation::addFileToDocumentationIndex(), PackageManager::addHelpIndex(), DocumentationFile::getArticles(), NumeReKernel::getInstance(), NumeReKernel::getProcedureInterpreter(), NumeReKernel::getSettings(), m_script, nLine, DocumentationFile::print(), sHelpID, sInstallID, StripSpaces(), and FileSystem::ValidFileName().
Referenced by getNextScriptCommandFromScript().
|
private |
This member function writes the embedded window layout to the target file.
sScriptCommand | std::string& |
Definition at line 472 of file script.cpp.
References SyntaxError::CANNOT_READ_FILE, ENABLE_FULL_LOGGING, getArgAtPos(), SyntaxError::invalid_position, m_logger, m_script, nInstallModeFlags, nLine, Logger::push_line(), StripSpaces(), and FileSystem::ValidFileName().
Referenced by getNextScriptCommandFromScript().
|
private |
Writes a procedure including the comments to a procedure file.
Definition at line 585 of file script.cpp.
References _lang, DISABLE_SCREEN_OUTPUT, ENABLE_FULL_LOGGING, findCommand(), Language::get(), NumeReKernel::getInstance(), NumeReKernel::getProcedureInterpreter(), m_logger, m_script, nInstallModeFlags, nLine, NumeReKernel::print(), Logger::push_line(), Match::sString, StripSpaces(), toSystemCodePage(), and Procedure::writeProcedure().
Referenced by getNextScriptCommandFromScript().
|
private |
Writes the contents of a whole file to the target file, which has been specified by the XML-like tags.
Definition at line 652 of file script.cpp.
References ENABLE_FULL_LOGGING, Documentation::getArgAtPos(), m_logger, m_script, nInstallModeFlags, nLine, Logger::push_line(), replaceAll(), and FileSystem::ValidizeAndPrepareName().
Referenced by getNextScriptCommandFromScript().
|
private |
Definition at line 64 of file script.hpp.
Referenced by close(), handleLocalDefinitions(), openScript(), and setPredefinedFuncs().
|
private |
Definition at line 65 of file script.hpp.
Referenced by close(), handleLocalDefinitions(), and openScript().
|
private |
Definition at line 52 of file script.hpp.
Referenced by close(), getNextScriptCommandFromScript(), Script(), and wasLastCommand().
|
private |
Definition at line 51 of file script.hpp.
Referenced by close(), isValid(), openScript(), and Script().
|
private |
Definition at line 56 of file script.hpp.
Referenced by getNextScriptCommandFromScript(), handleInstallInformation(), and startInstallation().
|
private |
Definition at line 55 of file script.hpp.
Referenced by close(), getNextScriptCommand(), getNextScriptCommandFromScript(), installProcedures(), Script(), and setInstallProcedures().
|
private |
Definition at line 39 of file script.hpp.
Referenced by close(), getCurrentLine(), getNextScriptCommand(), getNextScriptCommandFromInclude(), and handleIncludeSyntax().
|
private |
Definition at line 48 of file script.hpp.
Referenced by close(), evaluateInstallInformation(), getNextScriptCommandFromScript(), returnCommand(), startInstallation(), writeLayout(), writeProcedure(), and writeWholeFile().
|
private |
Definition at line 38 of file script.hpp.
Referenced by close(), getNextScriptCommand(), getNextScriptCommandFromScript(), handleIncludeSyntax(), handleInstallInformation(), isOpen(), openScript(), returnCommand(), writeDocumentationArticle(), writeLayout(), writeProcedure(), writeWholeFile(), and ~Script().
|
private |
Definition at line 62 of file script.hpp.
|
private |
Definition at line 54 of file script.hpp.
Referenced by close(), evaluateInstallInformation(), getNextScriptCommandFromScript(), openScript(), returnCommand(), Script(), writeLayout(), writeProcedure(), and writeWholeFile().
|
private |
Definition at line 53 of file script.hpp.
Referenced by close(), getCurrentLine(), getNextScriptCommandFromScript(), handleInstallInformation(), openScript(), Script(), writeDocumentationArticle(), writeLayout(), writeProcedure(), and writeWholeFile().
|
private |
Definition at line 58 of file script.hpp.
Referenced by close(), openScript(), and writeDocumentationArticle().
|
private |
Definition at line 59 of file script.hpp.
Referenced by close(), handleInstallInformation(), openScript(), and writeDocumentationArticle().
|
private |
Definition at line 49 of file script.hpp.
Referenced by close(), getNextScriptCommand(), getNextScriptCommandFromScript(), getScriptFileName(), handleInstallInformation(), and openScript().
|
private |
Definition at line 61 of file script.hpp.
Referenced by close(), and handleInstallInformation().