22#include "../../kernel.hpp"
98 if (
sThisNameSpace.substr(0, sProcDefPath.length()) == sProcDefPath)
149 iter->second.unique();
164 std::pair<int, ProcedureCommandLine> commandline = procedureFile->
getCurrentLine(nCurrentLine);
165 std::string sProcedureName;
166 std::string sCurrentNameSpace =
"main~";
171 commandline = procedureFile->
getNextLine(commandline.first);
173 if (procedureFile->
isLastLine(commandline.first))
174 return commandline.first;
182 if (sProcedureName.find(
'~') != std::string::npos && procedureFile->
getFileName().substr(procedureFile->
getFileName().rfind(
'/')+1) != sProcedureName.substr(sProcedureName.rfind(
'~')+1) +
".nprc")
184 else if (sProcedureName.find(
'/') != std::string::npos && procedureFile->
getFileName().substr(procedureFile->
getFileName().rfind(
'/')+1) != sProcedureName.substr(sProcedureName.rfind(
'/')+1) +
".nprc")
196 commandline = procedureFile->
getNextLine(commandline.first);
203 if (sCurrentNameSpace.length())
204 sCurrentNameSpace +=
"~";
206 sCurrentNameSpace =
"main~";
213 return commandline.first;
227 if (sCommandLine.find(
"procedure ") == std::string::npos || sCommandLine.find(
'$') == std::string::npos)
231 return "$" +
sThisNameSpace +
"/" + sCommandLine.substr(sCommandLine.find(
'$')+1, sCommandLine.find(
'(') - sCommandLine.find(
'$')-1);
233 return "$" +
sThisNameSpace +
"~" + sCommandLine.substr(sCommandLine.find(
'$')+1, sCommandLine.find(
'(') - sCommandLine.find(
'$')-1);
250 if (sLine.find(
'$') != std::string::npos && sLine.find(
'(', sLine.find(
'$')) != std::string::npos)
256 while (sLine.find(
'$', nPos) != std::string::npos && sLine.find(
'(', sLine.find(
'$', nPos)) != std::string::npos)
258 nPos = sLine.find(
'$', nPos) + 1;
259 std::string __sName = sLine.substr(nPos, sLine.find(
'(', nPos) - nPos);
264 if (__sName.find(
'~') == std::string::npos)
265 __sName = sCurrentNameSpace + __sName;
267 if (__sName.substr(0, 5) ==
"this~")
270 if (__sName.substr(0, 9) ==
"thisfile~")
274 if (sLine[nPos] ==
'\'')
275 __sName = sLine.substr(nPos + 1, sLine.find(
'\'', nPos + 1) - nPos - 1);
277 if (__sName.find(
'/') != std::string::npos && __sName.find(
"thisfile~") == std::string::npos)
285 nPos += __sName.length() + 1;
305 if (sProc.find(
"thisfile~") != std::string::npos)
311 for (
size_t i = 0; i < sProc.length(); i++)
315 if (sProc.length() > 5 && i >= 4 && sProc.substr(i - 4, 5) ==
"main~")
316 sProc = sProc.substr(0, i - 4) + sProc.substr(i + 1);
std::string getProcedureName(std::string sCommandLine) const
This member function extracts the procedure name from the procedure head.
std::map< std::string, DependencyList > mDependencies
void resolveProcedureCalls(std::string sCommandLine, const std::string &sProcedureName, const std::string &sCurrentNameSpace)
This member function resilves the procedure calls contained in the current procedure command line.
std::string sMainProcedure
std::string getProcedureFileName(std::string sProc) const
This member function returns the file name of the current called procedure.
std::string sThisFileNameSpacePrefix
Dependencies(ProcedureElement *procedureFile)
Dependencies constructor.
int getProcedureDependencies(ProcedureElement *procedureFile, int nCurrentLine)
This member function calculates the dependencies of the current procedure.
std::string sThisNameSpace
void walk(ProcedureElement *procedureFile)
This member function will walk through the file and redirect the control to getProcedureDependencies(...
This class resembles a simple dependency containing a procedure name and the corresponding file name.
std::string & getProcedureName()
This class is a child of the std::list, where the function unique() has been overridden (i....
void unique()
Implementation of DependencyList::unique.
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 pre...
static NumeReKernel * getInstance()
This static member function returns a a pointer to the singleton instance of the kernel.
Procedure & getProcedureInterpreter()
This class contains the pre-parsed contents of a single procedure file.
std::string getFileName() const
std::pair< int, ProcedureCommandLine > getCurrentLine(int currentLine)
This function returns the selected line of the stored file. This member function will be used in comb...
bool isLastLine(int currentline)
This member function determines, whether the current line is the last line of the stored procedure fi...
std::pair< int, ProcedureCommandLine > getFirstLine()
This function returns the first line of the stored file.
std::pair< int, ProcedureCommandLine > getNextLine(int currentline)
This member function returns the line after the current selected line. This is probably not the same ...
std::string getProcPath() const
Returns the current procedure root import path.
static bool isequal(const Dependency &first, const Dependency &second)
Static helper function for DependencyList::unique.
static bool compare(const Dependency &first, const Dependency &second)
Static helper function for DependencyList::unique.
std::string replacePathSeparator(const std::string &)
This function replaces the Windows style path sparators to UNIX style.