NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
tools.cpp File Reference
#include "tools.hpp"
#include "../../kernel.hpp"
#include "../io/file.hpp"
#include <cstdlib>
#include <omp.h>
Include dependency graph for tools.cpp:

Go to the source code of this file.

Classes

class  ThreadsafeRandGen
 This class represents a thread safe random number generator (it is a container for multiple generator instances, each for every possible OMP thread). More...
 

Functions

std::mt19937 & getRandGenInstance ()
 Returns a reference to the central random number generator instance, which is globally accessible by all random number functions. More...
 
int findParameter (const string &sCmd, const string &sParam, const char cFollowing)
 This function searches the passed parameter in the passed command string. If something is found, the position of the parameter+1 is returned. More...
 
bool getStringArgument (const string &sCmd, string &sArgument)
 This function searches for the first string value in the passed expression and writes that into sArgument. If nothing was found, this function returns false, true otherwise. More...
 
string extractStringToken (const string &sCmd, size_t nPos)
 This function extracts a string token at the selected position. If the position is start of an option value, the possible equal sign is ignored. More...
 
unsigned int getMatchingParenthesis (const StringView &sLine)
 Returns the position of the closing parenthesis. More...
 
bool isMultiValue (const string &sExpr, bool bIgnoreClosingParenthesis)
 Determines, if a string contains multiple comma-separated expressions. More...
 
static std::map< std::string, std::string > getTeXCodePage ()
 Static helper returning the TeX code page. More...
 
static std::map< std::string, std::string > getTeXCodePageSpecial ()
 
static void handleTeXIndicesAndExponents (std::string &sReturn, const std::map< std::string, std::string > &mCodePage)
 This function is a static helper function for the function replaceToTeX further down. More...
 
std::string replaceToTeX (const std::string &sString, bool replaceForTeXFile)
 Replace the special tokens with their TeX counterparts, so that they can be handled by a LaTeX interpreter (like such in the plotting lib). More...
 
static Match findCasualCommand (StringView sCmd)
 This is a static helper function for the findCommand function. More...
 
static bool findShortestMatchForCommand (Match &_mMatch, size_t position, char character, StringView sCmd, const std::string &sCommand)
 This is a static helper function for the findCommandWithReturnValue function. More...
 
static Match findCommandWithReturnValue (StringView sCmd, const string &sCommand)
 This is a static helper function for the findCommand function. More...
 
Match findCommand (StringView sCmd, const std::string &sCommand)
 This function is very important for the command handler. More...
 
string extractCommandString (const string &sCmd, const Match &_mMatch)
 Extracts the whole command string from a command line (which might contain more than one). More...
 
void openExternally (const string &sFile)
 Opens a file with the program, which is associated by default within the Windows shell. More...
 
void moveFile (const string &sFile, const string &sNewFileName)
 Move a file from one to another location. Can be used for renaming as well. More...
 
void copyFile (const string &sFile, const string &sTarget)
 Copy the file's contents to another file. More...
 
void writeTeXMain (const string &sTeXFile)
 
static size_t isStringContinuation (const std::string &sCmd, size_t pos)
 This static function detects, whether the current string expression is continued. More...
 
static void parseArg (std::string &sArg, int flags)
 This static function is a helper for getArgAtPos to parse the expressions in the string. More...
 
string getArgAtPos (const string &sCmd, unsigned int nPos, int extraction)
 Extracts a options value at the selected position and applies automatic parsing, if necessary. More...
 
bool isInQuotes (StringView sExpr, unsigned int nPos, bool bIgnoreVarParser)
 Checks, whether the position in the passed expression is part of a string literal. More...
 
bool isToStringArg (const string &sExpr, unsigned int nPos)
 This function determines, whether the current position is part of an argument of the three value to string conversion functions. More...
 
long long int intCast (double number)
 Casts doubles to integers and avoids rounding errors. More...
 
long long int intCast (const std::complex< double > &number)
 Casts the real part of the complex number to an integer and avoids rounding errors. More...
 
bool isInt (const std::complex< double > &number)
 Determines, whether the content of a complex value is actually a regular integer. More...
 
bool isDelimiter (char c)
 This function determines, if the passed character is a delimiter character. More...
 
bool addLegends (string &sExpr)
 This function adds the missing legend strings to the expressions in the passed string. More...
 
bool checkDelimiter (const string &sString, bool stringdelim)
 Checks, whether the first and the last character in the passed string is a delimiter character. More...
 
std::vector< std::string > splitIntoLines (std::string sOutput, size_t lineWidth, bool bAllowDashBreaks, int nFirstIndent, int nIndent)
 This function splits a string into multiple lines if the line is longer than the desired line width. More...
 
std::string outputString (std::vector< std::string > stringInLines, int nFirstIndent, int nIndent)
 This function outputs a string by adding the required prefixes and joining the various strings together. More...
 
std::string LineBreak (std::string sOutput, const Settings &_option, bool bAllowDashBreaks, int nFirstIndent, int nIndent)
 This function takes a string, splits it into multiple lines if it is too long and returns the result. More...
 
double Linearize (double x_0, double y_0, double x_1, double y_1)
 Determines the root of the line connecting the two passed points. More...
 
static StringView getNextCommandLineToken (StringView &sArgList, char cSep)
 This function gets the first argument in the passed argument list if the boolean bCut is true then the argument is erased from the string. More...
 
string getNextArgument (string &sArgList, bool bCut)
 
string getNextIndex (string &sArgList, bool bCut)
 
string getNextSemiColonSeparatedToken (string &sArgList, bool bCut)
 
StringView getNextViewedArgument (StringView &sView)
 
StringView getNextViewedIndex (StringView &sView)
 
EndlessVector< StringViewgetAllArguments (StringView sArgList)
 Splits up the complete argument list and returns them as an EndlessVector. More...
 
EndlessVector< string > getAllArguments (string sArgList)
 Splits up the complete argument list and returns them as an EndlessVector. More...
 
EndlessVector< string > getAllIndices (string sArgList)
 Splits up the complete index list and returns them as an EndlessVector. More...
 
EndlessVector< string > getAllSemiColonSeparatedTokens (string sArgList)
 Splits up the complete index list and returns them as an EndlessVector. More...
 
void make_progressBar (int nStep, int nFirstStep, int nFinalStep, const string &sType)
 Wrapper for the static member function of the kernel. More...
 
static bool containsStringClusters (const string &sLine)
 This function is a static helper function for containsStrings to search through the list of known clusters for string-containing clusters. More...
 
bool containsStrings (const string &sLine)
 This function checks, whether the passed expression contains strings or valtostring parser. More...
 
bool fileExists (const string &sFilename)
 This function checks, whether the file with the passed file name exists. More...
 
void eraseToken (string &sExpr, const string &sToken, bool bTokenHasValue)
 This function erases option tokens including their possible value from a parameter string. More...
 
vector< string > resolveChooseTokens (const string &sDirectory, const Settings &_option)
 This function resolves the possibility to select multiple paths at once by inserting something like this/is/a/<path|with|tokens>/which/will/search/at/different/locations. More...
 
static HANDLE initializeFileHandle (string &sDir, WIN32_FIND_DATA *FindFileData, const Settings &_option)
 This function is a static helper function for getFileList and getFolderList. More...
 
vector< string > getFileList (const string &sDirectory, const Settings &_option, int nFlags)
 This function returns a list of files (including their paths, if nFlags & 1). More...
 
vector< string > getFolderList (const string &sDirectory, const Settings &_option, int nFlags)
 This function returns a list of directories (including their paths, if nFlags & 1). More...
 
void reduceLogFilesize (const string &sFileName)
 This function is used to reduce the log file size from >= 100.000 to 20.000 lines to reduce the needed disk space. More...
 
static void OprtRplc_setup (map< string, string > &mOprtRplc)
 This function is a variable initializer for the function replaceToVector name. It will only be called once. More...
 
string replaceToVectorname (const string &sExpression)
 This function replaces a data access expression (i.e. the contents of the object argument parentheses) into a vector name, which is valid for the parser. More...
 
static bool handleRecursiveOperators (string &sExpr, size_t &nPos, size_t &nArgSepPos)
 This function is a static helper function for evalRecursiveExpressions. More...
 
static void handleIncAndDecOperators (string &sExpr, size_t nPos, size_t nArgSepPos)
 This function is a static helper function for evalRecursiveExpressions. More...
 
void evalRecursiveExpressions (string &sExpr)
 This function converts the recursive assignments like VAR += VAL into VAR = VAR + (VAL) More...
 
string getFileInfo (const string &sFileName)
 This function opens a NumeRe-Datafile file, reads its header and converts it to a human-readable string. More...
 
string decodeNameSpace (string sCommandLine, const string &sThisNameSpace)
 
bool validateParenthesisNumber (const string &sCmd)
 This function is used to validate the number of parentheses, i.e. whether there's a closing parenthesis for each opened one. More...
 
void addArgumentQuotes (string &sToAdd, const string &sParam)
 This function adds quotation marks around the value of the specified parameter. More...
 
void addArgumentQuotes (string &sToAdd, size_t pos)
 This function adds quotation marks around the value of the specified parameter. More...
 
double intPower (double dNumber, int nExponent)
 This function calculates the power of a value with the specialization that the exponent is an integer. More...
 
std::complex< double > intPower (const std::complex< double > &dNumber, int nExponent)
 This function calculates the power of a value with the specialization that the exponent is an integer. Function overload for complex-valued bases. More...
 
bool isToCmd (const string &sCmd, unsigned int nPos)
 This function evaluates, whether the desired position is part of the argument of a to_cmd() function. More...
 
unsigned int countEscapeSymbols (const string &sLine)
 This function counts the number of escaped dollar signs. More...
 
static int compareDouble (const void *p1, const void *p2)
 This is a static helper function for the standard qsort algorithm. More...
 
size_t qSortDouble (double *dArray, size_t nlength)
 This is a wrapper for the standard qsort algorithm. It returns the number of valid elements and sorts the elements in-place. More...
 
static void replaceSearchMethods (string &sLine, size_t nPos, size_t nFinalPos, const string &sReplacement, const string &sMethod, string &sArgument)
 This static function replaces all search-oriented methods in the current string variable access. More...
 
static void replaceAccessMethods (string &sLine, size_t nPos, size_t nFinalPos, const string &sReplacement, const string &sMethod, string &sArgument)
 This static function replaces all access-oriented methods and the string splitter in the current string variable access. More...
 
void replaceStringMethod (string &sLine, size_t nPos, size_t nLength, const string &sReplacement)
 This function searches the indicated string variable occurence for possible string methods and replaces them with the standard string function. More...
 
std::string shortenFileName (const std::string &sFullFileName)
 This function will return a shortened version of the data file name, where each "/Path/" string part is transformed to "/../". More...
 
std::string incrementVersion (std::string _sVer)
 Increments a MAJOR.MINOR.BUILD version string by one build count. More...
 

Variables

static ThreadsafeRandGen randGenerator
 

Function Documentation

◆ addArgumentQuotes() [1/2]

void addArgumentQuotes ( string &  sToAdd,
const string &  sParam 
)

This function adds quotation marks around the value of the specified parameter.

Parameters
sToAddstring&
sParamconst string&
Returns
void

Definition at line 3560 of file tools.cpp.

References addArgumentQuotes(), and findParameter().

Referenced by addArgumentQuotes(), cmd_define(), cmd_ifndefined(), cmd_redefine(), cmd_set(), cmd_stats(), and getPathForSetting().

Here is the call graph for this function:

◆ addArgumentQuotes() [2/2]

void addArgumentQuotes ( string &  sToAdd,
size_t  pos 
)

This function adds quotation marks around the value of the specified parameter.

Parameters
sToAddstring&
possize_t
Returns
void

Definition at line 3580 of file tools.cpp.

References containsStrings(), and getArgAtPos().

Here is the call graph for this function:

◆ addLegends()

bool addLegends ( string &  sExpr)

This function adds the missing legend strings to the expressions in the passed string.

Parameters
sExprstring&
Returns
bool

Definition at line 1875 of file tools.cpp.

References getAllArguments(), getMatchingParenthesis(), StripSpaces(), SyntaxError::UNMATCHED_PARENTHESIS, and validateParenthesisNumber().

Referenced by Plot::createSubPlotSet().

Here is the call graph for this function:

◆ checkDelimiter()

bool checkDelimiter ( const string &  sString,
bool  stringdelim 
)

Checks, whether the first and the last character in the passed string is a delimiter character.

Parameters
sStringconst string&
stringdelimbool
Returns
bool

Definition at line 1982 of file tools.cpp.

References isDelimiter().

Referenced by FunctionDefinitionManager::call(), FunctionDefinition::convertToValues(), NumeRe::StringParser::eval(), findCommandWithReturnValue(), Fitcontroller::getFitFunction(), FunctionDefinition::replaceArgumentOccurences(), FlowCtrl::replaceLocalVars(), replaceToTeX(), ProcedureVarFactory::resolveArguments(), ProcedureVarFactory::resolveLocalClusters(), ProcedureVarFactory::resolveLocalStrings(), ProcedureVarFactory::resolveLocalTables(), ProcedureVarFactory::resolveLocalVars(), and splitIntoLines().

Here is the call graph for this function:

◆ compareDouble()

static int compareDouble ( const void *  p1,
const void *  p2 
)
static

This is a static helper function for the standard qsort algorithm.

Parameters
p1const void*
p2const void*
Returns
int

Definition at line 3734 of file tools.cpp.

References mu::isnan().

Referenced by qSortDouble().

Here is the call graph for this function:

◆ containsStringClusters()

static bool containsStringClusters ( const string &  sLine)
static

This function is a static helper function for containsStrings to search through the list of known clusters for string-containing clusters.

Parameters
sLineconst string&
Returns
bool

Definition at line 2442 of file tools.cpp.

References NumeRe::ClusterManager::getClusterMap(), NumeReKernel::getInstance(), NumeReKernel::getMemoryManager(), and isDelimiter().

Referenced by containsStrings().

Here is the call graph for this function:

◆ containsStrings()

bool containsStrings ( const string &  sLine)

This function checks, whether the passed expression contains strings or valtostring parser.

Parameters
sLineconst string&
Returns
bool

Definition at line 2470 of file tools.cpp.

References containsStringClusters().

Referenced by addArgumentQuotes(), cmd_install(), convertVectorToExpression(), NumeReDebugger::decodeType(), getStringArgument(), and taylor().

Here is the call graph for this function:

◆ copyFile()

void copyFile ( const string &  sFile,
const string &  sTarget 
)

Copy the file's contents to another file.

Parameters
sFileconst string&
sTargetconst string&
Returns
void

Definition at line 1431 of file tools.cpp.

References SyntaxError::CANNOT_OPEN_SOURCE, SyntaxError::CANNOT_OPEN_TARGET, and SyntaxError::invalid_position.

Referenced by moveFile(), and moveOrCopyFiles().

◆ countEscapeSymbols()

unsigned int countEscapeSymbols ( const string &  sLine)

This function counts the number of escaped dollar signs.

Parameters
sLineconst string&
Returns
unsigned int

Definition at line 3708 of file tools.cpp.

◆ decodeNameSpace()

string decodeNameSpace ( string  sCommandLine,
const string &  sThisNameSpace 
)

Definition at line 3476 of file tools.cpp.

References StripSpaces().

Referenced by Procedure::execute(), SearchController::FindNameSpaceOfProcedure(), and Dependencies::getProcedureDependencies().

Here is the call graph for this function:

◆ eraseToken()

void eraseToken ( string &  sExpr,
const string &  sToken,
bool  bTokenHasValue 
)

This function erases option tokens including their possible value from a parameter string.

Parameters
sExprstring&
sTokenconst string&
bTokenHasValuebool
Returns
void

Definition at line 2527 of file tools.cpp.

References findParameter(), getMatchingParenthesis(), and isInQuotes().

Referenced by doc_Help(), and evaluateFittingParams().

Here is the call graph for this function:

◆ evalRecursiveExpressions()

void evalRecursiveExpressions ( string &  sExpr)

This function converts the recursive assignments like VAR += VAL into VAR = VAR + (VAL)

Parameters
sExprstring&
Returns
void

Definition at line 3346 of file tools.cpp.

References getMatchingParenthesis(), handleIncAndDecOperators(), and handleRecursiveOperators().

Referenced by FlowCtrl::calc(), FlowCtrl::compile(), FlowCtrl::fillJumpTableAndExpandRecursives(), NumeReKernel::MainLoop(), performMatrixOperation(), and Procedure::ProcCalc().

Here is the call graph for this function:

◆ extractCommandString()

string extractCommandString ( const string &  sCmd,
const Match _mMatch 
)

Extracts the whole command string from a command line (which might contain more than one).

Parameters
sCmdconst string&
_mMatchconst Match&
Returns
string

Definition at line 1325 of file tools.cpp.

References getMatchingParenthesis(), isInQuotes(), Match::nPos, and SyntaxError::UNMATCHED_PARENTHESIS.

Referenced by cmd_get(), CommandLineParser::CommandLineParser(), and PackageManager::evalPluginCmd().

Here is the call graph for this function:

◆ extractStringToken()

string extractStringToken ( const string &  sCmd,
size_t  nPos 
)

This function extracts a string token at the selected position. If the position is start of an option value, the possible equal sign is ignored.

Parameters
sCmdconst string&
nPossize_t
Returns
string

Definition at line 310 of file tools.cpp.

References getMatchingParenthesis(), and isInQuotes().

Referenced by getStringArgument().

Here is the call graph for this function:

◆ fileExists()

◆ findCasualCommand()

static Match findCasualCommand ( StringView  sCmd)
static

This is a static helper function for the findCommand function.

Parameters
sCmdStringView
Returns
Match

Definition at line 950 of file tools.cpp.

References StringViewBase::find_first_not_of(), isInQuotes(), StringViewBase::length(), Match::nPos, Match::sString, StringView::subview(), and StringViewBase::to_string().

Referenced by findCommand().

Here is the call graph for this function:

◆ findCommand()

Match findCommand ( StringView  sCmd,
const std::string &  sCommand 
)

This function is very important for the command handler.

It extracts the command out of the complete command line. It is also capable of finding a command, which is not at the start of the line (i.e. commands, which are returning values).

Parameters
sCmdStringView
sCommandconst std::string&
Returns
Match

Definition at line 1275 of file tools.cpp.

References StringViewBase::find(), findCasualCommand(), findCommand(), findCommandWithReturnValue(), Match::nPos, Match::sString, StripSpaces(), and StringViewBase::to_string().

Referenced by CodeAnalyzer::analyseCommands(), Procedure::applyInliningRuleset(), Assertion::assertionFail(), FlowCtrl::calc(), ProcedureVarFactory::checkArgument(), ProcedureVarFactory::checkArgumentValue(), FlowCtrl::checkParsingModeAndExpandDefinitions(), ProcedureElement::cleanCurrentLine(), cmd_clear(), cmd_get(), cmd_help(), cmd_install(), cmd_new(), cmd_plotting(), cmd_print(), cmd_redefine(), cmd_reload(), cmd_retouch(), cmd_stats(), cmd_undefine(), commandHandler(), CommandLineParser::CommandLineParser(), FlowCtrl::compile(), Plot::createSubPlotSet(), editObject(), PackageManager::evalPluginCmd(), NumeReKernel::evaluateProcedureCalls(), Plot::evaluateSubplot(), Procedure::execute(), FlowCtrl::fillJumpTableAndExpandRecursives(), findCommand(), findExtrema(), NumeRe::FindProcedureDefinition(), findShortestMatchForCommand(), fitDataSet(), FlowCtrl::for_loop(), Procedure::getInlined(), Includer::getNextLine(), Script::getNextScriptCommandFromScript(), Dependencies::getProcedureDependencies(), getVarList(), NumeReKernel::handleCommandLineSource(), NumeReKernel::handleComposeBlock(), Script::handleLocalDefinitions(), NumeReKernel::handleToCmd(), FlowCtrl::if_fork(), Includer::is_including_syntax(), Procedure::isInlineable(), PackageManager::isPluginCmd(), NumeReKernel::MainLoop(), Includer::openIncludedFile(), parseLayoutScript(), performMatrixOperation(), Plot::Plot(), plugin_histogram(), Procedure::ProcCalc(), Procedure::procedureCmdInterface(), ProcedureElement::ProcedureElement(), Procedure::procedureInterface(), FlowCtrl::range_based_for_loop(), Procedure::replaceReturnVal(), FlowCtrl::setCommand(), Odesolver::solve(), MemoryManager::sortElements(), FlowCtrl::switch_fork(), FlowCtrl::try_catch(), NumeReKernel::uninstallPlugin(), FlowCtrl::while_loop(), Script::writeProcedure(), and Procedure::writeProcedure().

Here is the call graph for this function:

◆ findCommandWithReturnValue()

static Match findCommandWithReturnValue ( StringView  sCmd,
const string &  sCommand 
)
static

This is a static helper function for the findCommand function.

Parameters
sCmdStringView
sCommandconst string&
Returns
Match

Definition at line 1103 of file tools.cpp.

References checkDelimiter(), StringViewBase::find(), findShortestMatchForCommand(), isInQuotes(), StringViewBase::length(), Match::nPos, Match::sString, StringView::subview(), and StringViewBase::to_string().

Referenced by findCommand().

Here is the call graph for this function:

◆ findParameter()

int findParameter ( const string &  sCmd,
const string &  sParam,
const char  cFollowing 
)

This function searches the passed parameter in the passed command string. If something is found, the position of the parameter+1 is returned.

Parameters
sCmdconst string&
sParamconst string&
cFollowingconst char
Returns
int

This function is one of the most important ones in the whole application as it provides the support for the defined command syntax.

Definition at line 113 of file tools.cpp.

References toLowerCase().

Referenced by addArgumentQuotes(), CodeAnalyzer::analyseCommands(), FunctionDefinition::appendComment(), FlowCtrl::calc(), cmd_close(), cmd_define(), cmd_get(), cmd_hline(), cmd_ifndefined(), cmd_load(), cmd_new(), cmd_quit(), cmd_redefine(), cmd_rename(), cmd_retouch(), cmd_save(), cmd_stats(), FlowCtrl::compile(), FunctionDefinition::convertToValues(), Plot::CoordSettings(), createHist1D(), createHist2D(), PackageManager::declareNewPackage(), FunctionDefinition::decodeDefinition(), NumeRe::StringParser::decodeStringParams(), FunctionDefinitionManager::defineFunc(), dialogCommand(), doc_Help(), editObject(), eraseToken(), evaluateFittingParams(), Script::evaluateInstallInformation(), evaluateParameterValues(), Plot::evaluateSubplot(), evaluateTargetOptionInCommand(), FlowCtrl::extractFlagsAndIndexVariables(), findExtrema(), findSettingOption(), findZeroes(), getEventProcedures(), CommandLineParser::getFileParameterValue(), getIntervalDef(), getItemId(), Package::getOptionValue(), getParametersFromWindow(), getParameterValue(), CommandLineParser::getParameterValue(), CommandLineParser::getParameterValueAsNumericalValue(), CommandLineParser::getParameterValueAsString(), getTagValue(), getTargetTable(), getVarList(), NumeReKernel::handleComposeBlock(), CommandLineParser::hasParam(), FunctionDefinition::importFunction(), IntervalSet::IntervalSet(), MemoryManager::matchTableAsParameter(), parseLayoutCommand(), parseLayoutScript(), Plot::Plot(), plugin_histogram(), plugin_random(), plugin_statistics(), ProcedureElement::ProcedureElement(), readAndParseIntervals(), readAndParseLegacyIntervals(), Settings::set(), setParametersInWindow(), PlotData::setParams(), Odesolver::solve(), MemoryManager::sortElements(), Memory::sortElements(), NumeRe::Cluster::sortElements(), StringInternalMemory::sortElements(), strfnc_findparam(), swapTables(), and windowCommand().

Here is the call graph for this function:

◆ findShortestMatchForCommand()

static bool findShortestMatchForCommand ( Match _mMatch,
size_t  position,
char  character,
StringView  sCmd,
const std::string &  sCommand 
)
static

This is a static helper function for the findCommandWithReturnValue function.

Parameters
_mMatchMatch&
positionsize_t
characterchar
sCmdStringView
sCommandconst std::string&
Returns
bool

Definition at line 1049 of file tools.cpp.

References StringViewBase::find(), findCommand(), isDelimiter(), isInQuotes(), StringViewBase::length(), Match::nPos, Match::sString, StringView::subview(), and StringViewBase::to_string().

Referenced by findCommandWithReturnValue().

Here is the call graph for this function:

◆ getAllArguments() [1/2]

EndlessVector< string > getAllArguments ( string  sArgList)

Splits up the complete argument list and returns them as an EndlessVector.

Parameters
sArgListstring
Returns
EndlessVector<string>

Definition at line 2365 of file tools.cpp.

References getNextArgument().

Here is the call graph for this function:

◆ getAllArguments() [2/2]

EndlessVector< StringView > getAllArguments ( StringView  sArgList)

Splits up the complete argument list and returns them as an EndlessVector.

Parameters
sArgListStringView
Returns
EndlessVector<StringView>

Definition at line 2346 of file tools.cpp.

References getNextViewedArgument(), and StringViewBase::length().

Referenced by Documentation::addEntry(), addLegends(), CodeAnalyzer::analysePreDefs(), mu::ParserBase::compileVectorExpansion(), SymDefManager::createSymbol(), determineWindowSize(), Plot::fillData(), Documentation::findPositionUsingIdxKeys(), Documentation::getDocIndex(), Documentation::getHelpArticle(), getIndices(), handleMafDataAccess(), IntervalSet::IntervalSet(), FlowCtrl::range_based_for_loop(), readAndParseIntervals(), NumeRe::JcampDX::readFile(), readFromFile(), and PlotData::setParams().

Here is the call graph for this function:

◆ getAllIndices()

EndlessVector< string > getAllIndices ( string  sArgList)

Splits up the complete index list and returns them as an EndlessVector.

Parameters
sArgListstring
Returns
EndlessVector<string>

Definition at line 2384 of file tools.cpp.

References getNextIndex().

Referenced by Plot::createDataLegends(), evalPoints(), findExtrema(), findZeroes(), readAndParseIntervals(), readAndParseLegacyIntervals(), and Interval::refresh().

Here is the call graph for this function:

◆ getAllSemiColonSeparatedTokens()

EndlessVector< string > getAllSemiColonSeparatedTokens ( string  sArgList)

Splits up the complete index list and returns them as an EndlessVector.

Parameters
sArgListstring
Returns
EndlessVector<string>

Definition at line 2403 of file tools.cpp.

References getNextSemiColonSeparatedToken().

Referenced by cmd_reload(), Procedure::execute(), NumeReKernel::getLineFromCommandCache(), and NumeReSyntax::splitDefs().

Here is the call graph for this function:

◆ getArgAtPos()

string getArgAtPos ( const string &  sCmd,
unsigned int  nPos,
int  extraction 
)

Extracts a options value at the selected position and applies automatic parsing, if necessary.

Parameters
sCmdconst string&
nPosunsigned int
extractionint
Returns
string

Definition at line 1598 of file tools.cpp.

References ARGEXTRACT_PARSED, ARGEXTRACT_STRIPPED, NumeReKernel::getInstance(), getMatchingParenthesis(), NumeReKernel::getStringParser(), isStringContinuation(), NumeRe::StringParser::isStringExpression(), parseArg(), and StripSpaces().

Referenced by addArgumentQuotes(), FunctionDefinition::appendComment(), FlowCtrl::calc(), cmd_list(), cmd_rename(), cmd_set(), FlowCtrl::compile(), FunctionDefinition::convertToValues(), PackageManager::declareNewPackage(), FunctionDefinition::decodeDefinition(), FunctionDefinitionManager::defineFunc(), dialogCommand(), evaluateFittingParams(), Script::evaluateInstallInformation(), Plot::evaluateSubplot(), evaluateTargetOptionInCommand(), NumeRe::OpenDocumentSpreadSheet::expandLine(), FlowCtrl::extractFlagsAndIndexVariables(), findExtrema(), findZeroes(), CommandLineParser::getFileParameterValue(), getIntervalDef(), getIntervalForSearchFunctions(), getItemId(), Package::getOptionValue(), getParametersFromWindow(), getParameterValue(), CommandLineParser::getParameterValue(), CommandLineParser::getParameterValueAsNumericalValue(), CommandLineParser::getParameterValueAsString(), getTagValue(), getTargetTable(), NumeReKernel::handleComposeBlock(), Script::handleInstallInformation(), FunctionDefinition::importFunction(), IntervalSet::IntervalSet(), listDirectory(), listFiles(), loadDocumentationArticle(), parseEventOpt(), MemoryManager::parseEvery(), parseLayoutCommand(), parseLayoutScript(), parseNumOpt(), parseStringOpt(), Plot::Plot(), plugin_histogram(), plugin_random(), plugin_statistics(), ProcedureElement::ProcedureElement(), readAndParseLegacyIntervals(), setParametersInWindow(), PlotData::setParams(), Odesolver::solve(), MemoryManager::sortElements(), Memory::sortElements(), StringInternalMemory::sortElements(), strfnc_getopt(), swapTables(), NumeReKernel::uninstallPlugin(), windowCommand(), and Script::writeLayout().

Here is the call graph for this function:

◆ getFileInfo()

string getFileInfo ( const string &  sFileName)

This function opens a NumeRe-Datafile file, reads its header and converts it to a human-readable string.

Parameters
sFileNameconst string&
Returns
string

Definition at line 3446 of file tools.cpp.

References NumeRe::FileHeaderInfo::fileVersion, NumeRe::NumeReDataFile::getFileHeaderInformation(), NumeRe::FileHeaderInfo::nCols, NumeRe::FileHeaderInfo::nRows, NumeRe::NumeReDataFile::readFileInformation(), NumeRe::FileHeaderInfo::sComment, NumeRe::FileHeaderInfo::sTableName, NumeRe::FileHeaderInfo::timeStamp, and toString().

Referenced by NumeReWindow::getFileDetails(), and listDirectory().

Here is the call graph for this function:

◆ getFileList()

vector< string > getFileList ( const string &  sDirectory,
const Settings _option,
int  nFlags 
)

This function returns a list of files (including their paths, if nFlags & 1).

Parameters
sDirectoryconst string&
_optionconst Settings&
nFlagsint
Returns
vector<string>

Definition at line 2853 of file tools.cpp.

References initializeFileHandle(), replacePathSeparator(), and resolveChooseTokens().

Referenced by append_data(), cmd_load(), Documentation::createDocumentationIndex(), NumeReWindow::CreateProcedureTree(), moveOrCopyFiles(), Archive::pack(), removeFile(), and strfnc_getfilelist().

Here is the call graph for this function:

◆ getFolderList()

vector< string > getFolderList ( const string &  sDirectory,
const Settings _option,
int  nFlags 
)

This function returns a list of directories (including their paths, if nFlags & 1).

Parameters
sDirectoryconst string&
_optionconst Settings&
nFlagsint
Returns
vector<string>

Definition at line 2925 of file tools.cpp.

References initializeFileHandle(), replacePathSeparator(), and resolveChooseTokens().

Referenced by NumeReWindow::CreateProcedureTree(), Archive::pack(), resolveChooseTokens(), and strfnc_getfolderlist().

Here is the call graph for this function:

◆ getMatchingParenthesis()

unsigned int getMatchingParenthesis ( const StringView sLine)

Returns the position of the closing parenthesis.

Parameters
sLineStringView
Returns
unsigned int The position of the closing parenthesis

This function determines the type of the desired parenthesis by itself by using the first parenthesis-like character that might be found in the passed string. This function also considers quotation marks, so that parentheses in strings are not considered as matching. If the function does not find the matching parenthesis, it returns string::npos

Definition at line 414 of file tools.cpp.

References StringViewBase::find_first_of(), and StringViewBase::length().

Referenced by addLegends(), applyValueHeuristics(), FlowCtrl::calc(), FunctionDefinitionManager::call(), FlowCtrl::checkFlowControlArgument(), cmd_stats(), FlowCtrl::compile(), mu::ParserBase::compileVectorExpansion(), mu::ParserBase::compileVectors(), mu::ParserBase::compileVectorsInMultiArgFunc(), containsFreeOperators(), convertVectorToExpression(), Plot::createDataLegends(), createEveryDefinition(), createMafVectorName(), NumeRe::StringParser::createStack(), Plot::createStd3dPlot(), FunctionDefinition::decodeDefinition(), differentiate(), doc_ReplaceExprContentForHTML(), eraseToken(), NumeRe::StringParser::eval(), evalMatOp(), evalRecursiveExpressions(), NumeRe::StringLogicParser::evalStringLogic(), evaluateFittingParams(), Sorter::evaluateKeyList(), NumeReKernel::evaluateProcedureCalls(), Procedure::expandInlineProcedures(), extractCommandString(), extractFirstParameterStringValue(), Procedure::extractProcedureInformation(), extractStringToken(), NumeRe::StringExpression::findAssignmentOperator(), mu::ParserBase::FindMultiArgFunc(), NumeRe::StringFuncHandler::findNextFunction(), NumeRe::FindProcedureDefinition(), SearchController::FindProcedureDefinitionInLocalFile(), Documentation::getArgAtPos(), getArgAtPos(), NumeReEditor::GetCurrentArgument(), getFittingParameters(), getIndices(), getIntervalForSearchFunctions(), getMafAccessString(), getNextCommandLineToken(), getPositionOfFirstDelimiter(), NumeRe::StringLogicParser::getStringTernaryExpression(), GenericTerminal::handle_calltip(), handleRecursiveOperators(), NumeReKernel::handleToCmd(), FunctionDefinition::importFunction(), integrate(), IntervalSet::IntervalSet(), isClusterCandidate(), isInQuotes(), isMultiValue(), NumeRe::StringVarFactory::isNumericCandidate(), isToCmd(), isToStringArg(), NumeRe::StringParser::numToString(), CommandLineParser::parse(), parseCmdArg(), Procedure::ProcCalc(), ProcedureElement::ProcedureElement(), Procedure::procedureInterface(), readAndParseIntervals(), NumeRe::realignLangString(), removeObsoleteParentheses(), replaceDataEntities(), replaceEntityOccurence(), replaceStringMethod(), replaceToTeX(), ProcedureVarFactory::resolveArguments(), Plot::separateFunctionsAndData(), FlowCtrl::setCommand(), FunctionDefinition::splitAndValidateArguments(), strfnc_getmatchingparens(), and Procedure::writeProcedure().

Here is the call graph for this function:

◆ getNextArgument()

string getNextArgument ( string &  sArgList,
bool  bCut 
)

Definition at line 2294 of file tools.cpp.

References getNextCommandLineToken(), and StringViewBase::to_string().

Referenced by NumeReEditor::AbstrahizeSection(), NumeReEditor::AddProcedureDocumentation(), CodeAnalyzer::analyseCommands(), NumeRe::StringFuncHandler::applySpecialStringFuncs(), applyValueHeuristics(), NumeRe::StringFuncHandler::argumentParser(), FlowCtrl::checkCaseValue(), cmd_pack(), cmd_remove(), cmd_rename(), convertVectorToExpression(), Plot::createDataLegends(), ProcedureVarFactory::createLocalClusters(), ProcedureVarFactory::createLocalInlineStrings(), ProcedureVarFactory::createLocalInlineVars(), ProcedureVarFactory::createLocalStrings(), ProcedureVarFactory::createLocalTables(), ProcedureVarFactory::createLocalVars(), createMatFromLines(), createMatFromLinesFilled(), ProcedureVarFactory::createProcedureArguments(), Plot::createSubPlotSet(), NumeReDebugger::decodeType(), deleteCacheEntry(), dialogCommand(), differentiate(), NumeRe::StringParser::eval(), evalMatOp(), ProcedureVarFactory::evaluateProcedureArguments(), NumeRe::StringVarFactory::evaluateStringVectors(), NumeRe::FindProcedureDefinition(), SearchController::FindProcedureDefinitionInLocalFile(), getAllArguments(), NumeReEditor::GetCurrentArgument(), CommandLineParser::getParameterValueAsNumericalValue(), Script::handleInstallInformation(), Package::importDefinition(), newObject(), FunctionDefinition::parse(), NumeRe::StringParser::parseStringsInIndices(), FlowCtrl::prepareSwitchExpression(), replaceEntityOccurence(), replaceSearchMethods(), PackageRepoBrowser::resolveDependencies(), Plot::separateFunctionsAndData(), PlotData::setParams(), NumeReWindow::showDirDialog(), NumeReWindow::showFileDialog(), NumeReWindow::showListDialog(), NumeReWindow::showSelectionDialog(), NumeReWindow::showTextEntry(), FunctionDefinition::splitAndValidateArguments(), NumeRe::StringParser::storeStringResults(), swapTables(), tableMethod_anova(), tableMethod_binsof(), tableMethod_categorize(), tableMethod_convert(), tableMethod_counteq(), tableMethod_cov(), tableMethod_findCols(), tableMethod_index(), tableMethod_pcorr(), tableMethod_rank(), tableMethod_scorr(), tableMethod_zscore(), toStrVector(), undefineFunctions(), NumeReKernel::uninstallPlugin(), and writeToFile().

Here is the call graph for this function:

◆ getNextCommandLineToken()

static StringView getNextCommandLineToken ( StringView sArgList,
char  cSep 
)
static

This function gets the first argument in the passed argument list if the boolean bCut is true then the argument is erased from the string.

Parameters
sArgListStringView&
cSepchar
Returns
StringView

Definition at line 2242 of file tools.cpp.

References getMatchingParenthesis(), StringViewBase::length(), StringViewBase::strip(), StringView::subview(), and StringViewBase::trim_front().

Referenced by getNextArgument(), getNextIndex(), getNextSemiColonSeparatedToken(), getNextViewedArgument(), and getNextViewedIndex().

Here is the call graph for this function:

◆ getNextIndex()

string getNextIndex ( string &  sArgList,
bool  bCut 
)

Definition at line 2305 of file tools.cpp.

References getNextCommandLineToken(), and StringViewBase::to_string().

Referenced by evaluateParameterValues(), and getAllIndices().

Here is the call graph for this function:

◆ getNextSemiColonSeparatedToken()

string getNextSemiColonSeparatedToken ( string &  sArgList,
bool  bCut 
)

Definition at line 2316 of file tools.cpp.

References getNextCommandLineToken(), and StringViewBase::to_string().

Referenced by getAllSemiColonSeparatedTokens().

Here is the call graph for this function:

◆ getNextViewedArgument()

StringView getNextViewedArgument ( StringView sView)

Definition at line 2327 of file tools.cpp.

References getNextCommandLineToken().

Referenced by NumeRe::StringFuncHandler::argumentParser(), mu::ExpressionTarget::create(), extractIndexList(), and getAllArguments().

Here is the call graph for this function:

◆ getNextViewedIndex()

StringView getNextViewedIndex ( StringView sView)

Definition at line 2332 of file tools.cpp.

References getNextCommandLineToken().

Referenced by extractIndexList().

Here is the call graph for this function:

◆ getRandGenInstance()

std::mt19937 & getRandGenInstance ( )

Returns a reference to the central random number generator instance, which is globally accessible by all random number functions.

Returns
std::mt19937&

Definition at line 91 of file tools.cpp.

References ThreadsafeRandGen::getGenerator(), and randGenerator.

Referenced by createShuffledMatrix(), parser_gRandom(), and parser_Random().

Here is the call graph for this function:

◆ getStringArgument()

bool getStringArgument ( const string &  sCmd,
string &  sArgument 
)

This function searches for the first string value in the passed expression and writes that into sArgument. If nothing was found, this function returns false, true otherwise.

Parameters
sCmdconst string&
sArgumentstring&
Returns
bool

Definition at line 250 of file tools.cpp.

References containsStrings(), and extractStringToken().

Referenced by evaluateParameterValues(), extractFirstParameterStringValue(), and Procedure::ProcCalc().

Here is the call graph for this function:

◆ getTeXCodePage()

static std::map< std::string, std::string > getTeXCodePage ( )
static

Static helper returning the TeX code page.

Returns
std::map<std::string, std::string>

Definition at line 527 of file tools.cpp.

Referenced by replaceToTeX().

◆ getTeXCodePageSpecial()

static std::map< std::string, std::string > getTeXCodePageSpecial ( )
static

Definition at line 633 of file tools.cpp.

Referenced by replaceToTeX().

◆ handleIncAndDecOperators()

static void handleIncAndDecOperators ( string &  sExpr,
size_t  nPos,
size_t  nArgSepPos 
)
static

This function is a static helper function for evalRecursiveExpressions.

Parameters
sExprstring&
nPossize_t
nArgSepPossize_t
Returns
void

Definition at line 3314 of file tools.cpp.

Referenced by evalRecursiveExpressions().

◆ handleRecursiveOperators()

static bool handleRecursiveOperators ( string &  sExpr,
size_t &  nPos,
size_t &  nArgSepPos 
)
static

This function is a static helper function for evalRecursiveExpressions.

Parameters
sExprstring&
nPossize_t&
nArgSepPossize_t&
Returns
bool

Definition at line 3146 of file tools.cpp.

References getMatchingParenthesis().

Referenced by evalRecursiveExpressions().

Here is the call graph for this function:

◆ handleTeXIndicesAndExponents()

static void handleTeXIndicesAndExponents ( std::string &  sReturn,
const std::map< std::string, std::string > &  mCodePage 
)
static

This function is a static helper function for the function replaceToTeX further down.

Parameters
sReturnstd::string&
std::map<std::stringconst
mCodePagestd::string>&
Returns
void

Definition at line 661 of file tools.cpp.

Referenced by replaceToTeX().

◆ incrementVersion()

std::string incrementVersion ( std::string  _sVer)

Increments a MAJOR.MINOR.BUILD version string by one build count.

Parameters
_sVerstd::string
Returns
std::string

Definition at line 3991 of file tools.cpp.

References intToVersion(), and versionToInt().

Referenced by PackageDialog::loadProjectFile().

Here is the call graph for this function:

◆ initializeFileHandle()

static HANDLE initializeFileHandle ( string &  sDir,
WIN32_FIND_DATA *  FindFileData,
const Settings _option 
)
static

This function is a static helper function for getFileList and getFolderList.

Parameters
sDirstring&
FindFileDataWIN32_FIND_DATA*
_optionconst Settings&
Returns
HANDLE

Definition at line 2789 of file tools.cpp.

References Settings::getExePath(), Settings::getLoadPath(), Settings::getPlotPath(), Settings::getProcPath(), Settings::getSavePath(), Settings::getScriptPath(), Settings::getWorkPath(), and replacePathSeparator().

Referenced by getFileList(), and getFolderList().

Here is the call graph for this function:

◆ intCast() [1/2]

long long int intCast ( const std::complex< double > &  number)

Casts the real part of the complex number to an integer and avoids rounding errors.

Parameters
numberconst std::complex<double>&
Returns
long long int

Definition at line 1824 of file tools.cpp.

References intCast().

Referenced by mu::ParserByteCode::AddOp(), append_data(), NumeRe::StringFuncHandler::applySpecialStringFuncs(), NumeRe::StringFuncHandler::argumentParser(), assemble(), bilinearInterpolation(), FlowCtrl::calc(), cmd_load(), cmd_progress(), cmd_resample(), cmd_smooth(), Memory::cmp(), NumeRe::Cluster::cmp(), FlowCtrl::compile(), Plot::constructDataLegendElement(), createDatagrid(), Plot::createDataLegends(), differentiate(), doc_SearchFct(), evalMatOp(), evalPoints(), Plot::evaluateSubplot(), FlowCtrl::extractFlagsAndIndexVariables(), fastWaveletTransform(), findExtrema(), findZeroes(), FlowCtrl::for_loop(), getIndices(), getWindow(), handleCasualIndices(), handleIndexVectors(), integrate(), integrate2d(), interpolateToGrid(), Memory::maxpos(), Memory::minpos(), parseCmdArg(), MemoryManager::parseEvery(), parser_AssociatedLaguerrePolynomial(), parser_AssociatedLegendrePolynomial(), parser_beta(), parser_BetheWeizsaecker(), parser_BinAND(), parser_Binom(), parser_BinOR(), parser_compare(), parser_digamma(), parser_doubleFaculty(), parser_Faculty(), parser_gcd(), parser_HermitePolynomial(), parser_imSphericalHarmonics(), parser_IrregularCylBessel(), parser_LaguerrePolynomial(), parser_lcm(), parser_LegendrePolynomial(), parser_perlin(), parser_polygamma(), parser_RegularCylBessel(), parser_round(), parser_sleep(), parser_SphericalBessel(), parser_SphericalHarmonics(), parser_SphericalNeumann(), parser_studentFactor(), parser_Zernike(), particleSwarmOptimizer(), Plot::Plot(), plugin_histogram(), plugin_random(), NumeRe::StringFuncHandler::printValue(), NumeReKernel::progressBar(), FlowCtrl::range_based_for_loop(), Memory::readMemInterpolated(), regularizeDataSet(), replaceEntityOccurence(), saveDataObject(), selection(), PlotData::setParams(), CategoricalColumn::setValue(), shortTimeFourierAnalysis(), Odesolver::solve(), tableMethod_anova(), tableMethod_binsof(), tableMethod_cov(), tableMethod_index(), tableMethod_pcorr(), tableMethod_rank(), tableMethod_scorr(), tableMethod_typeof(), tableMethod_zscore(), taylor(), VectorIndex::VectorIndex(), and writeAudioFile().

Here is the call graph for this function:

◆ intCast() [2/2]

long long int intCast ( double  number)

Casts doubles to integers and avoids rounding errors.

Parameters
numberdouble
Returns
long long int

Definition at line 1805 of file tools.cpp.

References mu::rint().

Referenced by intCast(), and parseArg().

Here is the call graph for this function:

◆ intPower() [1/2]

std::complex< double > intPower ( const std::complex< double > &  dNumber,
int  nExponent 
)

This function calculates the power of a value with the specialization that the exponent is an integer. Function overload for complex-valued bases.

Parameters
dNumberconst std::complex<double>&
nExponentint
Returns
std::complex<double>

Definition at line 3640 of file tools.cpp.

References date::abs(), and intPower().

Referenced by applyNiceAxis(), calcStats(), cartToCyl(), cartToPolar(), complex_zeta(), convertBaseToDecimal(), cylToPolar(), mu::Parser::Diff(), differentiate(), Memory::getOneWayAnova(), mu::ParserBase::ParseCmdCodeBulk(), mu::ParserBase::ParseCmdCodeBulkParallel(), parser_AssociatedLaguerrePolynomial(), parser_AssociatedLegendrePolynomial(), parser_LaguerrePolynomial(), parser_LegendrePolynomial(), parser_polynomial(), parser_round(), parser_SphericalBessel(), parser_SphericalNeumann(), parser_ZernikeRadial(), and mu::MathImpl< T >::Pow().

Here is the call graph for this function:

◆ intPower() [2/2]

double intPower ( double  dNumber,
int  nExponent 
)

This function calculates the power of a value with the specialization that the exponent is an integer.

Calculates the power of a number using an integer as exponent.

Parameters
dNumberdouble
nExponentint
Returns
double

Definition at line 3607 of file tools.cpp.

References date::abs().

Referenced by intPower(), and StrToTime().

Here is the call graph for this function:

◆ isDelimiter()

◆ isInQuotes()

bool isInQuotes ( StringView  sExpr,
unsigned int  nPos,
bool  bIgnoreVarParser 
)

Checks, whether the position in the passed expression is part of a string literal.

Parameters
sExprStringView
nPosunsigned int
boolbIgnoreVarParser = false
Returns
bool

Definition at line 1672 of file tools.cpp.

References getMatchingParenthesis(), isInQuotes(), StringViewBase::length(), StringViewBase::rfind(), and StringView::subview().

Referenced by FlowCtrl::calc(), FunctionDefinitionManager::call(), FlowCtrl::compile(), CodeAnalyzer::containsAssignment(), Procedure::countProceduresInLine(), ProcedureVarFactory::countVarListElements(), Plot::create2dDrawing(), Plot::create3dDrawing(), Plot::createSubPlotSet(), eraseToken(), NumeRe::StringLogicParser::evalStringLogic(), NumeRe::StringLogicParser::evalStringTernary(), evaluateParameterValues(), NumeReKernel::evaluateProcedureCalls(), NumeRe::StringVarFactory::evaluateStringVectors(), Procedure::expandInlineProcedures(), extractCommandString(), extractStringToken(), findCasualCommand(), findCommandWithReturnValue(), NumeRe::StringFuncHandler::findNextFunction(), findShortestMatchForCommand(), findVariableInExpression(), CommandLineParser::getAllParametersWithValues(), NumeRe::StringVarFactory::getStringValues(), NumeRe::StringVarFactory::getStringValuesAsInternalVar(), handleMafDataAccess(), NumeReKernel::handleToCmd(), IntervalSet::IntervalSet(), Procedure::isInline(), isInQuotes(), isToCmd(), NumeRe::StringParser::numToString(), Plot::Plot(), Procedure::ProcCalc(), Procedure::procedureInterface(), readAndParseIntervals(), replaceDataEntities(), FlowCtrl::replaceLocalVars(), ProcedureVarFactory::resolveArguments(), ProcedureVarFactory::resolveLocalClusters(), ProcedureVarFactory::resolveLocalStrings(), ProcedureVarFactory::resolveLocalTables(), ProcedureVarFactory::resolveLocalVars(), Dependencies::resolveProcedureCalls(), PlotData::setParams(), and Procedure::writeProcedure().

Here is the call graph for this function:

◆ isInt()

bool isInt ( const std::complex< double > &  number)

Determines, whether the content of a complex value is actually a regular integer.

Parameters
numberconst std::complex<double>&
Returns
bool

Definition at line 1838 of file tools.cpp.

References mu::rint().

Referenced by CategoricalColumn::setValue().

Here is the call graph for this function:

◆ isMultiValue()

bool isMultiValue ( const string &  sExpr,
bool  bIgnoreClosingParenthesis 
)

Determines, if a string contains multiple comma-separated expressions.

Parameters
sExprconst string&
bIgnoreClosingParenthesisbool
Returns
bool

Definition at line 484 of file tools.cpp.

References getMatchingParenthesis(), and isMultiValue().

Referenced by convertVectorToExpression(), FunctionDefinition::decodeDefinition(), Procedure::getInlined(), and isMultiValue().

Here is the call graph for this function:

◆ isStringContinuation()

static size_t isStringContinuation ( const std::string &  sCmd,
size_t  pos 
)
static

This static function detects, whether the current string expression is continued.

Parameters
sCmdconst std::string&
possize_t
Returns
size_t

Definition at line 1504 of file tools.cpp.

Referenced by getArgAtPos().

◆ isToCmd()

bool isToCmd ( const string &  sCmd,
unsigned int  nPos 
)

This function evaluates, whether the desired position is part of the argument of a to_cmd() function.

Checks, whether the "to_cmd()" function was used.

Parameters
sCmdconst string&
nPosunsigned int
Returns
bool

Definition at line 3675 of file tools.cpp.

References getMatchingParenthesis(), and isInQuotes().

Referenced by ProcedureVarFactory::resolveArguments(), ProcedureVarFactory::resolveLocalClusters(), ProcedureVarFactory::resolveLocalStrings(), ProcedureVarFactory::resolveLocalTables(), and ProcedureVarFactory::resolveLocalVars().

Here is the call graph for this function:

◆ isToStringArg()

bool isToStringArg ( const string &  sExpr,
unsigned int  nPos 
)

This function determines, whether the current position is part of an argument of the three value to string conversion functions.

Parameters
sExprconst string&
nPosunsigned int
Returns
bool

Definition at line 1766 of file tools.cpp.

References getMatchingParenthesis(), and isDelimiter().

Referenced by convertVectorToExpression().

Here is the call graph for this function:

◆ Linearize()

double Linearize ( double  x_0,
double  y_0,
double  x_1,
double  y_1 
)

Determines the root of the line connecting the two passed points.

Parameters
x_0double
y_0double
x_1double
y_1double
Returns
double

Definition at line 2222 of file tools.cpp.

Referenced by findZeroesInMultiResult(), localizeExtremum(), and localizeZero().

◆ LineBreak()

std::string LineBreak ( std::string  sOutput,
const Settings _option,
bool  bAllowDashBreaks,
int  nFirstIndent,
int  nIndent 
)

◆ make_progressBar()

void make_progressBar ( int  nStep,
int  nFirstStep,
int  nFinalStep,
const string &  sType 
)

Wrapper for the static member function of the kernel.

Parameters
nStepint
nFirstStepint
nFinalStepint
sTypeconst string&
Returns
void

Definition at line 2425 of file tools.cpp.

References NumeReKernel::progressBar().

Referenced by FlowCtrl::calc(), cmd_progress(), and FlowCtrl::compile().

Here is the call graph for this function:

◆ moveFile()

void moveFile ( const string &  sFile,
const string &  sNewFileName 
)

Move a file from one to another location. Can be used for renaming as well.

Parameters
sFileconst string&
sNewFileNameconst string&
Returns
void

Definition at line 1412 of file tools.cpp.

References copyFile().

Referenced by moveOrCopyFiles().

Here is the call graph for this function:

◆ openExternally()

void openExternally ( const string &  sFile)

Opens a file with the program, which is associated by default within the Windows shell.

Parameters
sFileconst string&
Returns
void

Definition at line 1375 of file tools.cpp.

References SyntaxError::CANNOT_READ_FILE, SyntaxError::EXTERNAL_PROGRAM_NOT_FOUND, SyntaxError::invalid_position, and replaceAll().

Referenced by editObject().

Here is the call graph for this function:

◆ OprtRplc_setup()

static void OprtRplc_setup ( map< string, string > &  mOprtRplc)
static

This function is a variable initializer for the function replaceToVector name. It will only be called once.

Parameters
map<string
mOprtRplcstring>&
Returns
void

Definition at line 3073 of file tools.cpp.

Referenced by replaceToVectorname().

◆ outputString()

std::string outputString ( std::vector< std::string >  stringInLines,
int  nFirstIndent,
int  nIndent 
)

This function outputs a string by adding the required prefixes and joining the various strings together.

Parameters
stringInLinesstd::vector<std::string>
nFirstIndentint
nIndentint
Returns
std::string

Definition at line 2164 of file tools.cpp.

Referenced by LineBreak().

◆ parseArg()

static void parseArg ( std::string &  sArg,
int  flags 
)
static

This static function is a helper for getArgAtPos to parse the expressions in the string.

Parameters
sArgstd::string&
flagsint
Returns
void

Definition at line 1538 of file tools.cpp.

References ARGEXTRACT_ASINT, ARGEXTRACT_ASSTRING, FunctionDefinitionManager::call(), MemoryManager::containsTablesOrClusters(), mu::ParserBase::Eval(), NumeRe::StringParser::evalAndFormat(), SyntaxError::FUNCTION_ERROR, getDataElements(), NumeReKernel::getDefinitions(), NumeReKernel::getInstance(), NumeReKernel::getMemoryManager(), NumeReKernel::getParser(), Settings::getPrecision(), NumeReKernel::getSettings(), NumeReKernel::getStringParser(), intCast(), NumeRe::StringParser::isStringExpression(), mu::ParserBase::SetExpr(), NumeRe::StringParser::STRING_SUCCESS, and toString().

Referenced by getArgAtPos().

Here is the call graph for this function:

◆ qSortDouble()

size_t qSortDouble ( double *  dArray,
size_t  nlength 
)

This is a wrapper for the standard qsort algorithm. It returns the number of valid elements and sorts the elements in-place.

Parameters
dArraydouble*
nlengthsize_t
Returns
size_t

Definition at line 3762 of file tools.cpp.

References compareDouble(), mu::isinf(), and mu::isnan().

Referenced by PlotAsset::getWeightedRanges(), NumeRe::Cluster::med(), Memory::med(), Memory::pct(), and NumeRe::Cluster::pct().

Here is the call graph for this function:

◆ reduceLogFilesize()

void reduceLogFilesize ( const string &  sFileName)

This function is used to reduce the log file size from >= 100.000 to 20.000 lines to reduce the needed disk space.

Parameters
sFileNameconst string&
Returns
void

Definition at line 2998 of file tools.cpp.

References date::detail::trunc().

Referenced by fitDataSet(), and NumeReKernel::StartUp().

Here is the call graph for this function:

◆ replaceAccessMethods()

static void replaceAccessMethods ( string &  sLine,
size_t  nPos,
size_t  nFinalPos,
const string &  sReplacement,
const string &  sMethod,
string &  sArgument 
)
static

This static function replaces all access-oriented methods and the string splitter in the current string variable access.

Parameters
sLinestring&
nPossize_t
nFinalPossize_t
sReplacementconst string&
sMethodconst string&
sArgumentstring&
Returns
void

Definition at line 3843 of file tools.cpp.

Referenced by replaceStringMethod().

◆ replaceSearchMethods()

static void replaceSearchMethods ( string &  sLine,
size_t  nPos,
size_t  nFinalPos,
const string &  sReplacement,
const string &  sMethod,
string &  sArgument 
)
static

This static function replaces all search-oriented methods in the current string variable access.

Parameters
sLinestring&
nPossize_t
nFinalPossize_t
sReplacementconst string&
sMethodconst string&
sArgumentstring&
Returns
void

Definition at line 3791 of file tools.cpp.

References getNextArgument().

Referenced by replaceStringMethod().

Here is the call graph for this function:

◆ replaceStringMethod()

void replaceStringMethod ( string &  sLine,
size_t  nPos,
size_t  nLength,
const string &  sReplacement 
)

This function searches the indicated string variable occurence for possible string methods and replaces them with the standard string function.

Parameters
sLinestring&
nPossize_t
nLengthsize_t
sReplacementconst string&
Returns
void

Definition at line 3875 of file tools.cpp.

References getMatchingParenthesis(), replaceAccessMethods(), and replaceSearchMethods().

Referenced by NumeRe::StringVarFactory::getStringValues(), NumeRe::StringVarFactory::getStringValuesAsInternalVar(), and ProcedureVarFactory::resolveLocalStrings().

Here is the call graph for this function:

◆ replaceToTeX()

std::string replaceToTeX ( const std::string &  sString,
bool  replaceForTeXFile 
)

Replace the special tokens with their TeX counterparts, so that they can be handled by a LaTeX interpreter (like such in the plotting lib).

Parameters
sStringconst std::string&
replaceForTeXFilebool true for TeX files. Will replace fewer characters.
Returns
std::string

Definition at line 753 of file tools.cpp.

References checkDelimiter(), getMatchingParenthesis(), getTeXCodePage(), getTeXCodePageSpecial(), handleTeXIndicesAndExponents(), isDelimiter(), and StripSpaces().

Referenced by calculateHist1dData(), Plot::create2dPlot(), Plot::createStd3dPlot(), Plot::createStdPlot(), createTeXExport(), and PlotData::getAxisLabel().

Here is the call graph for this function:

◆ replaceToVectorname()

string replaceToVectorname ( const string &  sExpression)

This function replaces a data access expression (i.e. the contents of the object argument parentheses) into a vector name, which is valid for the parser.

Parameters
sExpressionconst string&
Returns
string

Definition at line 3108 of file tools.cpp.

References OprtRplc_setup().

Referenced by NumeRe::StringFuncHandler::applySpecialStringFuncs(), createMafVectorName(), and replaceDataEntities().

Here is the call graph for this function:

◆ resolveChooseTokens()

vector< string > resolveChooseTokens ( const string &  sDirectory,
const Settings _option 
)

This function resolves the possibility to select multiple paths at once by inserting something like this/is/a/<path|with|tokens>/which/will/search/at/different/locations.

Parameters
sDirectoryconst string&
_optionconst Settings&
Returns
vector<string>

Definition at line 2584 of file tools.cpp.

References getFolderList().

Referenced by getFileList(), and getFolderList().

Here is the call graph for this function:

◆ shortenFileName()

std::string shortenFileName ( const std::string &  sFullFileName)

This function will return a shortened version of the data file name, where each "/Path/" string part is transformed to "/../".

Parameters
sFullFileNameconst std::string&
Returns
std::string

Definition at line 3953 of file tools.cpp.

References replacePathSeparator().

Referenced by NumeRe::FileAdapter::getDataFileNameShort(), and EditorNotebook::SetTabText().

Here is the call graph for this function:

◆ splitIntoLines()

std::vector< std::string > splitIntoLines ( std::string  sOutput,
size_t  lineWidth,
bool  bAllowDashBreaks,
int  nFirstIndent,
int  nIndent 
)

This function splits a string into multiple lines if the line is longer than the desired line width.

Parameters
sOutputstd::string
lineWidthsize_t
bAllowDashBreaksbool
nFirstIndentint
nIndentint
Returns
std::vector<std::string>

Definition at line 2002 of file tools.cpp.

References checkDelimiter(), and toSystemCodePage().

Referenced by LineBreak(), and plotTableBySize().

Here is the call graph for this function:

◆ validateParenthesisNumber()

bool validateParenthesisNumber ( const string &  sCmd)

This function is used to validate the number of parentheses, i.e. whether there's a closing parenthesis for each opened one.

Checks, whether the number of parentheses is an even number.

Parameters
sCmdconst string&
Returns
bool

Definition at line 3512 of file tools.cpp.

Referenced by addLegends(), applyValueHeuristics(), ProcedureVarFactory::createProcedureArguments(), getDataElements(), NumeReKernel::handleCommandLineSource(), ProcedureElement::ProcedureElement(), and FlowCtrl::setCommand().

◆ writeTeXMain()

void writeTeXMain ( const string &  sTeXFile)

Definition at line 1449 of file tools.cpp.

References SyntaxError::CANNOT_OPEN_TARGET, and SyntaxError::invalid_position.

Referenced by Plot::Plot().

Variable Documentation

◆ randGenerator

ThreadsafeRandGen randGenerator
static

File static random number generator, which will be usable via the scoped getRandGenInstance function, which will return a reference to this random number generator

Definition at line 79 of file tools.cpp.

Referenced by getRandGenInstance().