19#ifndef COMMANDFUNCTIONS_HPP
20#define COMMANDFUNCTIONS_HPP
29#include "../kernel.hpp"
56static size_t findSettingOption(
const std::string& sCmd,
const std::string& sOption);
70 std::string sArgument;
78 while (!sArgument.length());
80 if (sArgument.substr(0, 1) !=
_lang.
YES())
106 map<string, int> mVars;
113 for (
auto iter = mNumVars.begin(); iter != mNumVars.end(); ++iter)
114 mVars[iter->first] = 0;
116 for (
auto iter = mStringVars.begin(); iter != mStringVars.end(); ++iter)
117 mVars[iter->first] = 1;
130 for (
auto iter = mVars.begin(); iter != mVars.end(); ++iter)
132 sReturn += iter->first +
" = ";
137 sReturn +=
"\\\"" + mStringVars[iter->first] +
"\\\"";
139 sReturn +=
"\"" + mStringVars[iter->first] +
"\"";
152 for (
auto iter = mStringVars.begin(); iter != mStringVars.end(); ++iter)
154 sReturn += iter->first +
" = ";
157 sReturn +=
"\\\"" + iter->second +
"\\\"";
159 sReturn +=
"\"" + iter->second +
"\"";
172 for (
auto iter = mNumVars.begin(); iter != mNumVars.end(); ++iter)
174 sReturn += iter->first +
" = ";
182 sReturn.erase(sReturn.length() - 3);
183 else if (!
findParameter(sCmd,
"asstr") && sReturn.length() > 1)
184 sReturn.erase(sReturn.length() - 2);
203 string sSuccessFulRemoved;
207 while (sFunctionList.length())
215 sSuccessFulRemoved += sFunction +
", ";
219 if (_option.
systemPrints() && sSuccessFulRemoved.length())
235static bool prepareTemplate(
const std::string& sTemplateID,
const std::string& sFileName)
237 std::vector<std::string> vTokens;
240 vTokens.push_back(sFileName.substr(sFileName.rfind(
'/') + 1, sFileName.rfind(
'.') - sFileName.rfind(
'/') - 1));
244 return generateTemplate(sFileName,
"<>/user/lang/" + sTemplateID +
".nlng", vTokens, _option);
246 return generateTemplate(sFileName,
"<>/lang/" + sTemplateID +
".nlng", vTokens, _option);
264 std::string sFileName;
278 else if (cmdParser.
hasParam(
"script"))
282 if (!sFileName.length())
285 if (sFileName.find(
':') == std::string::npos && sFileName.front() !=
'<')
286 sFileName =
"<scriptpath>/" + sFileName;
298 else if (cmdParser.
hasParam(
"proc"))
302 if (!sFileName.length())
309 if (sFileName.find(
':') == std::string::npos && sFileName.front() !=
'<')
310 sFileName =
"<procpath>/" + sFileName;
322 else if (cmdParser.
hasParam(
"file"))
326 if (!sFileName.length())
329 if (sFileName.find(
':') == std::string::npos && sFileName.front() !=
'<')
330 sFileName =
"<>/" + sFileName;
334 if (sFileName.substr(sFileName.rfind(
'.')) ==
".nprc"
335 || sFileName.substr(sFileName.rfind(
'.')) ==
".nscr"
336 || sFileName.substr(sFileName.rfind(
'.')) ==
".nlyt"
337 || sFileName.substr(sFileName.rfind(
'.')) ==
".ndat")
338 sFileName.replace(sFileName.rfind(
'.'), 5,
".txt");
348 else if (cmdParser.
hasParam(
"plugin"))
352 if (!sFileName.length())
355 if (sFileName.find(
':') == std::string::npos && sFileName.front() !=
'<')
356 sFileName =
"<scriptpath>/" + sFileName;
370 if (cmdParser.
getExpr().front() ==
'$')
372 sFileName = cmdParser.
getExpr();
374 if (!sFileName.length())
381 if (sFileName.find(
':') == std::string::npos && sFileName.front() !=
'<')
382 sFileName =
"<procpath>/" + sFileName;
394 else if (cmdParser.
getExpr().find(
"()") != std::string::npos)
397 std::string sReturnVal =
"";
400 if (!sObject.length())
404 while (sObject.length())
413 std::string sName = sTableName.substr(0, sTableName.find(
'('));
416 if (sReturnVal.length())
419 sReturnVal +=
"\"" + sTableName +
"\"";
426 if (_data.
addTable(sTableName, _option))
428 if (sReturnVal.length())
431 sReturnVal +=
"\"" + sTableName +
"\"";
468 int nFileOpenFlag = 0;
474 nFileOpenFlag = 2 | 4;
482 sObject = sCmd.substr(
findCommand(sCmd).sString.length());
486 sObject.erase(sObject.rfind(
'-'));
493 if (sObject.find(
'.') != string::npos)
496 if (!sObject.length())
499 if (sObject[0] ==
'$' && sObject[1] !=
'\'')
500 sObject =
"<procpath>/" + sObject.substr(1);
501 else if (sObject[0] ==
'$')
504 while (sObject.find(
'~') != string::npos)
505 sObject[sObject.find(
'~')] =
'/';
507 while (sObject.find(
'$') != string::npos)
508 sObject.erase(sObject.find(
'$'), 1);
510 if (sObject[0] ==
'\'' && sObject[sObject.length() - 1] ==
'\'')
511 sObject = sObject.substr(1, sObject.length() - 2);
514 if (sObject.find(
"<loadpath>") != string::npos || sObject.find(_option.
getLoadPath()) != string::npos)
519 else if (sObject.find(
"<savepath>") != string::npos || sObject.find(_option.
getSavePath()) != string::npos)
524 else if (sObject.find(
"<scriptpath>") != string::npos || sObject.find(_option.
getScriptPath()) != string::npos)
529 else if (sObject.find(
"<plotpath>") != string::npos || sObject.find(_option.
getPlotPath()) != string::npos)
534 else if (sObject.find(
"<procpath>") != string::npos || sObject.find(_option.
getProcPath()) != string::npos)
539 else if (sObject.find(
"<wp>") != string::npos || sObject.find(_option.
getWorkPath()) != string::npos)
544 else if (sObject.find(
"<>") != string::npos || sObject.find(
"<this>") != string::npos || sObject.find(_option.
getExePath()) != string::npos)
552 if (sObject.find(
'.') == string::npos && (sObject.find(
'/') != string::npos || sObject.find(
'\\') != string::npos))
554 ShellExecute(NULL, NULL, sObject.c_str(), NULL, NULL, SW_SHOWNORMAL);
559 if (sObject[sObject.length() - 1] !=
'*' && sObject.find(
'.') == string::npos)
564 if (sObject.find(
'.') != string::npos)
566 if (sObject.substr(sObject.rfind(
'.')) ==
".dat" || sObject.substr(sObject.rfind(
'.')) ==
".txt")
569 string sTemporaryObjectName = _fSys.
ValidFileName(sObject,
".dat");
574 else if (sObject.substr(sObject.rfind(
'.')) ==
".nscr")
576 else if (sObject.substr(sObject.rfind(
'.')) ==
".nprc")
578 else if (sObject.substr(sObject.rfind(
'.')) ==
".png"
579 || sObject.substr(sObject.rfind(
'.')) ==
".gif"
580 || sObject.substr(sObject.rfind(
'.')) ==
".svg"
581 || sObject.substr(sObject.rfind(
'.')) ==
".eps")
583 else if (sObject.substr(sObject.rfind(
'.')) ==
".tex")
586 string sTemporaryObjectName = _fSys.
ValidFileName(sObject,
".tex");
591 else if (sObject.substr(sObject.rfind(
'.')) ==
".nhlp")
603 if (!_data.
containsTablesOrClusters(sObject) && sObject.find(
'.') == string::npos && (sObject.find(
'/') != string::npos || sObject.find(
'\\') != string::npos))
605 ShellExecute(NULL, NULL, sObject.c_str(), NULL, NULL, SW_SHOWNORMAL);
613 string sTableName = sObject.substr(0, sObject.find(
'('));
629 if (!
fileExists(sObject) || sObject.find(
'.') == string::npos)
631 sObject.erase(sObject.rfind(
'.'));
633 if (sObject.find(
'*') != string::npos)
634 sObject.erase(sObject.rfind(
'*'));
636 if ((
int)ShellExecute(NULL, NULL, sObject.c_str(), NULL, NULL, SW_SHOWNORMAL) > 32)
643 if (sObject.substr(sObject.rfind(
'.')) ==
".dat"
644 || sObject.substr(sObject.rfind(
'.')) ==
".txt"
645 || sObject.substr(sObject.rfind(
'.')) ==
".tex"
646 || sObject.substr(sObject.rfind(
'.')) ==
".xml"
647 || sObject.substr(sObject.rfind(
'.')) ==
".yaml"
648 || sObject.substr(sObject.rfind(
'.')) ==
".yml"
649 || sObject.substr(sObject.rfind(
'.')) ==
".json"
650 || sObject.substr(sObject.rfind(
'.')) ==
".csv"
651 || sObject.substr(sObject.rfind(
'.')) ==
".labx"
652 || sObject.substr(sObject.rfind(
'.')) ==
".jdx"
653 || sObject.substr(sObject.rfind(
'.')) ==
".jcm"
654 || sObject.substr(sObject.rfind(
'.')) ==
".dx"
655 || sObject.substr(sObject.rfind(
'.')) ==
".nscr"
656 || sObject.substr(sObject.rfind(
'.')) ==
".nprc"
657 || sObject.substr(sObject.rfind(
'.')) ==
".nhlp"
658 || sObject.substr(sObject.rfind(
'.')) ==
".nlyt"
659 || sObject.substr(sObject.rfind(
'.')) ==
".png"
660 || sObject.substr(sObject.rfind(
'.')) ==
".gif"
661 || sObject.substr(sObject.rfind(
'.')) ==
".m"
662 || sObject.substr(sObject.rfind(
'.')) ==
".cpp"
663 || sObject.substr(sObject.rfind(
'.')) ==
".cxx"
664 || sObject.substr(sObject.rfind(
'.')) ==
".c"
665 || sObject.substr(sObject.rfind(
'.')) ==
".hpp"
666 || sObject.substr(sObject.rfind(
'.')) ==
".hxx"
667 || sObject.substr(sObject.rfind(
'.')) ==
".h"
668 || sObject.substr(sObject.rfind(
'.')) ==
".log")
670 else if (sObject.substr(sObject.rfind(
'.')) ==
".svg"
671 || sObject.substr(sObject.rfind(
'.')) ==
".eps")
701 WIN32_FIND_DATA FindFileData;
702 HANDLE hFind = INVALID_HANDLE_VALUE;
703 LARGE_INTEGER Filesize;
704 double dFilesize = 0.0;
705 double dFilesizeTotal = 0.0;
707 string sPattern =
"*";
708 string sFilesize =
" Bytes";
710 string sDirectory =
"";
712 int nCount[2] = {0, 0};
713 unsigned int nFirstColLength = _option.
getWindow() / 2 - 6;
714 bool bOnlyDir =
false;
731 if (!sPattern.length())
735 for (
int n = 0; n < 2; n++)
740 if (sDir ==
"LOADPATH")
742 hFind = FindFirstFile((_option.
getLoadPath() +
"\\" + sPattern).c_str(), &FindFileData);
745 else if (sDir ==
"SAVEPATH")
747 hFind = FindFirstFile((_option.
getSavePath() +
"\\" + sPattern).c_str(), &FindFileData);
750 else if (sDir ==
"PLOTPATH")
752 hFind = FindFirstFile((_option.
getPlotPath() +
"\\" + sPattern).c_str(), &FindFileData);
755 else if (sDir ==
"SCRIPTPATH")
757 hFind = FindFirstFile((_option.
getScriptPath() +
"\\" + sPattern).c_str(), &FindFileData);
760 else if (sDir ==
"PROCPATH")
762 hFind = FindFirstFile((_option.
getProcPath() +
"\\" + sPattern).c_str(), &FindFileData);
765 else if (sDir ==
"WORKPATH")
767 hFind = FindFirstFile((_option.
getWorkPath() +
"\\" + sPattern).c_str(), &FindFileData);
774 hFind = FindFirstFile((_option.
getExePath() +
"\\" + sDir +
"\\" + sPattern).c_str(), &FindFileData);
775 sDirectory = _option.
getExePath() +
"/" + sDir;
777 else if (sDir[0] ==
'<')
779 if (sDir.substr(0, 10) ==
"<loadpath>")
781 hFind = FindFirstFile((_option.
getLoadPath() +
"\\" + sDir.substr(sDir.find(
'>') + 1) +
"\\" + sPattern).c_str(), &FindFileData);
782 sDirectory = _option.
getLoadPath() + sDir.substr(10);
784 else if (sDir.substr(0, 10) ==
"<savepath>")
786 hFind = FindFirstFile((_option.
getSavePath() +
"\\" + sDir.substr(sDir.find(
'>') + 1) +
"\\" + sPattern).c_str(), &FindFileData);
787 sDirectory = _option.
getSavePath() + sDir.substr(10);
789 else if (sDir.substr(0, 12) ==
"<scriptpath>")
791 hFind = FindFirstFile((_option.
getScriptPath() +
"\\" + sDir.substr(sDir.find(
'>') + 1) +
"\\" + sPattern).c_str(), &FindFileData);
794 else if (sDir.substr(0, 10) ==
"<plotpath>")
796 hFind = FindFirstFile((_option.
getPlotPath() +
"\\" + sDir.substr(sDir.find(
'>') + 1) +
"\\" + sPattern).c_str(), &FindFileData);
797 sDirectory = _option.
getPlotPath() + sDir.substr(10);
799 else if (sDir.substr(0, 10) ==
"<procpath>")
801 hFind = FindFirstFile((_option.
getProcPath() +
"\\" + sDir.substr(sDir.find(
'>') + 1) +
"\\" + sPattern).c_str(), &FindFileData);
802 sDirectory = _option.
getProcPath() + sDir.substr(10);
804 else if (sDir.substr(0, 4) ==
"<wp>")
806 hFind = FindFirstFile((_option.
getWorkPath() +
"\\" + sDir.substr(sDir.find(
'>') + 1) +
"\\" + sPattern).c_str(), &FindFileData);
807 sDirectory = _option.
getWorkPath() + sDir.substr(10);
809 else if (sDir.substr(0, 2) ==
"<>" || sDir.substr(0, 6) ==
"<this>")
811 hFind = FindFirstFile((_option.
getExePath() +
"\\" + sDir.substr(sDir.find(
'>') + 1) +
"\\" + sPattern).c_str(), &FindFileData);
812 sDirectory = _option.
getExePath() + sDir.substr(sDir.find(
'>') + 1);
817 hFind = FindFirstFile((sDir +
"\\" + sPattern).c_str(), &FindFileData);
822 if (hFind == INVALID_HANDLE_VALUE)
827 sFilesize =
" Bytes";
829 sConnect += FindFileData.cFileName;
830 sFileName = sDirectory +
"/" + FindFileData.cFileName;
832 if (sConnect.length() + 3 > nFirstColLength)
833 sConnect = sConnect.substr(0, nFirstColLength - 14) +
"..." + sConnect.substr(sConnect.length() - 8);
835 nLength = sConnect.length();
837 if (FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
843 if (sConnect.substr(sConnect.length() - 2) ==
".." || sConnect.substr(sConnect.length() - 1) ==
".")
847 sConnect +=
" (...)";
848 sConnect.append(nFirstColLength - 1 - nLength,
' ');
849 sConnect +=
"<" +
_lang.
get(
"BUILTIN_LISTFILES_CUSTOMPATH") +
">";
851 else if (!bOnlyDir && n)
854 Filesize.LowPart = FindFileData.nFileSizeLow;
855 Filesize.HighPart = FindFileData.nFileSizeHigh;
858 if (sConnect.find(
'.') != string::npos)
859 sExt =
toLowerCase(sConnect.substr(sConnect.rfind(
'.'), sConnect.find(
' ', sConnect.rfind(
'.')) - sConnect.rfind(
'.')));
861 sConnect.append(nFirstColLength + 7 - nLength,
'.');
865 sConnect +=
_lang.
get(
"COMMON_FILETYPE_NOEXT");
866 else if (sExt ==
".dx" || sExt ==
".jcm")
867 sConnect +=
_lang.
get(
"COMMON_FILETYPE_JDX");
868 else if (sExt ==
".wave")
869 sConnect +=
_lang.
get(
"COMMON_FILETYPE_WAV");
874 if (sExt.find(
"COMMON_FILETYPE_") != string::npos)
875 sConnect += sExt.substr(sExt.rfind(
'_')+1) +
"-" +
_lang.
get(
"COMMON_FILETYPE_NOEXT");
881 dFilesize = (double)Filesize.QuadPart;
882 dFilesizeTotal += dFilesize;
884 if (dFilesize / 1000.0 >= 1)
887 sFilesize =
"KBytes";
889 if (dFilesize / 1000.0 >= 1)
892 sFilesize =
"MBytes";
894 if (dFilesize / 1000.0 >= 1)
897 sFilesize =
"GBytes";
902 sFilesize =
toString(dFilesize, 3) +
" " + sFilesize;
903 sConnect.append(_option.
getWindow() - sConnect.length() - sFilesize.length(),
'.');
904 sConnect += sFilesize;
908 sConnect +=
"\n| : ";
911 sConnect += sFileInfo;
919 while (FindNextFile(hFind, &FindFileData) != 0);
927 sFilesize =
" Bytes";
929 if (dFilesizeTotal / 1000.0 >= 1)
931 dFilesizeTotal /= 1024.0;
932 sFilesize =
"KBytes";
934 if (dFilesizeTotal / 1000.0 >= 1)
936 dFilesizeTotal /= 1024.0;
937 sFilesize =
"MBytes";
939 if (dFilesizeTotal / 1000.0 >= 1)
941 dFilesizeTotal /= 1024.0;
942 sFilesize =
"GBytes";
947 sFilesize =
"Total: " +
toString(dFilesizeTotal, 3) +
" " + sFilesize;
953 sSummary.append(_option.
getWindow() - sSummary.length() - 4 - sFilesize.length(),
' ');
954 sSummary += sFilesize;
982 size_t nFirstColLength = nWindowLength / 2 - 6;
983 string sHeader = sPathName +
" ";
985 if (sHeader.length() > nFirstColLength)
988 sHeader.append(nFirstColLength,
'-');
991 sHeader.append(nFirstColLength - sHeader.length(),
'-');
995 if (sHeader.find(
'$') != string::npos)
996 sHeader.append(nWindowLength - 4 - sHeader.length() + sHeader.rfind(
'$'),
'-');
998 sHeader.append(nWindowLength - 4 - sHeader.length(),
'-');
1016 string sConnect =
"";
1017 string sSpecified =
"";
1018 string __sCmd = sCmd +
" ";
1019 string sPattern =
"";
1020 unsigned int nFirstColLength = _option.
getWindow() / 2 - 6;
1021 bool bFreePath =
false;
1036 if (sPattern.length())
1037 sPattern =
_lang.
get(
"BUILTIN_LISTFILES_FILTEREDFOR", sPattern);
1046 if (sConnect.length() > nFirstColLength + 6)
1049 sConnect.append(nFirstColLength + 6 - sConnect.length(),
' ');
1057 if (nPos && sCmd[nPos-1] ==
'=')
1062 if (sSpecified[0] ==
'<' && sSpecified[sSpecified.length() - 1] ==
'>' && sSpecified !=
"<>" && sSpecified !=
"<this>")
1064 sSpecified = sSpecified.substr(1, sSpecified.length() - 2);
1067 if (sSpecified !=
"loadpath" && sSpecified !=
"savepath" && sSpecified !=
"plotpath" && sSpecified !=
"scriptpath" && sSpecified !=
"procpath" && sSpecified !=
"wp")
1077 if (!sSpecified.length() || sSpecified ==
"loadpath")
1085 if (!sSpecified.length() || sSpecified ==
"savepath")
1087 if (!sSpecified.length())
1096 if (!sSpecified.length() || sSpecified ==
"scriptpath")
1098 if (!sSpecified.length())
1107 if (!sSpecified.length() || sSpecified ==
"procpath")
1109 if (!sSpecified.length())
1118 if (!sSpecified.length() || sSpecified ==
"plotpath")
1120 if (!sSpecified.length())
1129 if (sSpecified ==
"wp")
1141 if (sSpecified ==
"<>" || sSpecified ==
"<this>")
1180 vector<string> vFuncs;
1190 for (
unsigned int i = 0; i < vFuncs.size(); i++)
1267 vector<string> vLogicals =
_lang.
getList(
"PARSERFUNCS_LISTLOGICAL_ITEM*");
1270 for (
unsigned int i = 0; i < vLogicals.size(); i++)
1299 int nDataSetNum = 1;
1300 map<string, int> VarMap;
1312 map<string, std::pair<size_t,size_t>> CacheMap = _data.
getTableMap();
1314 const map<string, NumeRe::Cluster>& mClusterMap = _data.
getClusterMap();
1318 for (
auto iter = variables.begin(); iter != variables.end(); ++iter)
1320 VarMap[iter->first] = 0;
1322 for (
auto iter = StringMap.begin(); iter != StringMap.end(); ++iter)
1324 VarMap[iter->first] = 1;
1336 for (
auto iter = CacheMap.begin(); iter != CacheMap.end(); ++iter)
1341 if (_data.
getSize(iter->second.second) >= 1024 * 1024)
1343 else if (_data.
getSize(iter->second.second) >= 1024)
1348 nBytesSum += _data.
getSize(iter->second.second);
1354 for (
auto iter = mClusterMap.begin(); iter != mClusterMap.end(); ++iter)
1356 string sClusterSize =
toString(iter->second.size()) +
" x 1";
1359 if (iter->second.getBytes() >= 1024 * 1024)
1361 else if (iter->second.getBytes() >= 1024)
1366 nBytesSum += iter->second.getBytes();
1369 if (mClusterMap.size())
1389 for (
auto item = VarMap.begin(); item != VarMap.end(); ++item)
1402 nBytesSum += StringMap[item->first].size();
1408 nBytesSum += variables[item->first]->imag() ?
sizeof(std::complex<double>) :
sizeof(
double);
1421 nDataSetNum = CacheMap.size() + 1;
1426 nDataSetNum = CacheMap.size();
1437 if (VarMap.size() > 9 && nDataSetNum > 9)
1439 else if (VarMap.size() > 9 || nDataSetNum > 9)
1443 if (nBytesSum >= 1024 * 1024)
1445 else if (nBytesSum >= 1024)
1467 const int nUnits = 20;
1471 static string sUnits[nUnits] =
1475 "_coul_norm[V m/(A s)]",
1490 "_stefan[J/(m^2 s K^4)]",
1501 valmap_type::const_iterator item = cmap.begin();
1505 for (; item != cmap.end(); ++item)
1507 if (item->first[0] !=
'_')
1510 for (
int i = 0; i < nUnits; i++)
1512 if (sUnits[i].substr(0, sUnits[i].find(
'[')) == (item->first).substr(0, sUnits[i].find(
'[')))
1548 vector<string> vCMDList =
_lang.
getList(
"PARSERFUNCS_LISTCMD_CMD_*");
1551 for (
unsigned int i = 0; i < vCMDList.size(); i++)
1577static void printUnits(
const string& sUnit,
const string& sDesc,
const string& sDim,
const string& sValues,
unsigned int nWindowsize)
1607 printUnits(
"1'eV",
_lang.
get(
"PARSERFUNCS_LISTUNITS_UNIT_ELECTRONVOLT"),
"M L^2 / T^2",
"1.60217657e-19 [J]", _option.
getWindow());
1657std::vector<size_t>
calcTableWidth(
size_t maxWidth, std::vector<size_t> minDesiredColWidth)
1659 std::vector<size_t> colWidth;
1662 size_t avgWidth = maxWidth / minDesiredColWidth.size();
1665 for (
size_t i = 0; i < minDesiredColWidth.size(); i++)
1667 if (minDesiredColWidth[i] > 0)
1668 colWidth.push_back(
std::min(avgWidth, minDesiredColWidth[i]));
1670 colWidth.push_back(0);
1674 size_t numOfMarkedColumns = std::count(colWidth.begin(), colWidth.end(), 0);
1677 size_t sumOfChars = 0;
1678 for (
auto& n : colWidth)
1682 for (
size_t i = 0; i < colWidth.size(); i++)
1684 if (colWidth[i] == 0)
1685 colWidth[i] = (maxWidth - sumOfChars) / numOfMarkedColumns;
1703void plotTableBySize(std::vector<std::string> lineEntries, std::vector<size_t> lineColSizes)
1707 for (
auto& thisEntry: lineEntries)
1709 thisEntry =
'"' + thisEntry +
"\" -nq";
1714 std::vector<std::vector<std::string>> splittedLineEntries;
1715 for (
size_t i = 0; i < lineEntries.size(); i++)
1717 splittedLineEntries.push_back(
splitIntoLines(lineEntries[i], lineColSizes[i],
true, 2, 2));
1723 std::string sLine =
"| ";
1726 for (
size_t i = 0; i < splittedLineEntries.size(); i++)
1728 if (splittedLineEntries[i].size())
1730 sLine +=
strlfill(splittedLineEntries[i].front(), lineColSizes[i],
' ');
1731 splittedLineEntries[i].erase(splittedLineEntries[i].begin());
1734 sLine +=
strlfill(
"", lineColSizes[i],
' ');
1738 size_t totalStringElements = 0;
1739 for (std::vector<std::string> thisColumn: splittedLineEntries)
1740 totalStringElements += thisColumn.size();
1743 if (totalStringElements <= 0)
1783 size_t largewindowoffset = _option.
getWindow() > 230 ? 10 : 0;
1786 std::vector<size_t> minDesiredColWidth{20 + largewindowoffset,
1788 25 + largewindowoffset,
1790 20 + largewindowoffset,
1791 15 + largewindowoffset};
1794 size_t maxWidth = _option.
getWindow(0) - 4;
1797 std::vector<size_t> colWidth =
calcTableWidth(maxWidth, minDesiredColWidth);
1800 std::vector<std::string> headerEntries;
1801 headerEntries.push_back(
_lang.
get(
"PARSERFUNCS_LISTPLUGINS_PACKAGENAME"));
1802 headerEntries.push_back(
_lang.
get(
"PARSERFUNCS_LISTPLUGINS_VERSION"));
1803 headerEntries.push_back(
_lang.
get(
"PARSERFUNCS_LISTPLUGINS_COMMAND"));
1804 headerEntries.push_back(
_lang.
get(
"PARSERFUNCS_LISTPLUGINS_DESCRIPTION"));
1805 headerEntries.push_back(
_lang.
get(
"PARSERFUNCS_LISTPLUGINS_AUTHOR"));
1806 headerEntries.push_back(
_lang.
get(
"PARSERFUNCS_LISTPLUGINS_LICENSE"));
1813 std::vector<std::string> lineEntries;
1871 bool bWaitForTermination = cmdParser.
hasParam(
"wait");
1874 if (sObject.find(
'<') != string::npos && sObject.find(
'>', sObject.find(
'<') + 1) != string::npos)
1877 if (sParams.find(
'<') != string::npos && sParams.find(
'>', sParams.find(
'<') + 1) != string::npos)
1879 if (sParams.front() ==
'"')
1885 if (sWorkpath.find(
'<') != string::npos && sWorkpath.find(
'>', sWorkpath.find(
'<') + 1) != string::npos)
1887 if (sWorkpath.front() ==
'"')
1888 sWorkpath =
"\"" + _fSys.
ValidFileName(sWorkpath.substr(1));
1892 if (sWorkpath.rfind(
".dat") != string::npos)
1893 sWorkpath.erase(sWorkpath.rfind(
".dat"), 4);
1900 SHELLEXECUTEINFO ShExecInfo = {0};
1901 ShExecInfo.cbSize =
sizeof(SHELLEXECUTEINFO);
1902 ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
1903 ShExecInfo.hwnd = NULL;
1904 ShExecInfo.lpVerb = NULL;
1905 ShExecInfo.lpFile = sObject.c_str();
1906 ShExecInfo.lpParameters = sParams.c_str();
1907 ShExecInfo.lpDirectory = sWorkpath.c_str();
1908 ShExecInfo.nShow = SW_SHOW;
1909 ShExecInfo.hInstApp = NULL;
1911 nRetVal = ShellExecuteEx(&ShExecInfo);
1917 if (bWaitForTermination)
1925 if (WaitForSingleObject(ShExecInfo.hProcess, 1000) == WAIT_OBJECT_0)
1997 while (sCmd.find(
'\\') != string::npos)
1998 sCmd[sCmd.find(
'\\')] =
'/';
2009 while (!sPath.length());
2039 _cache.
melt(mem,
"table",
true);
2058 return pos+sOption.length();
2063 return pos-1 + sOption.length();
2065 pos = sCmd.find(sOption);
2067 if (pos != std::string::npos
2068 && (!pos || sCmd[pos-1] ==
' '))
2070 if (pos+sOption.length() == sCmd.length() || sCmd[pos+sOption.length()] ==
' ')
2071 return pos + sOption.length();
2073 if (sCmd[pos+sOption.length()] ==
'=')
2074 return pos + sOption.length()+1;
2115 else if (sCmd.find(
"()") != string::npos && sCmd.find(
',') != string::npos)
2128 if (sArgument.find(
'(') != string::npos)
2129 sArgument.erase(sArgument.find(
'('));
2131 if (sCmd.find(
'(') != string::npos)
2132 sCmd.erase(sCmd.find(
'('));
2199 std::string sFileName;
2206 if (!sFileName.length())
2246 if (cmdParser.
getExpr().length())
2272 if (cmdParser.
getCommand().substr(0, 10) ==
"integrate2"
2300 if (cmdParser.
getExpr().length())
2326 if (cmdParser.
getExpr().length())
2406 if (cmdParser.
getExpr().length())
2507 if (sCmd.length() > sCommand.length() + 1)
2509 if (sCommand ==
"graph")
2512 if (sCommand ==
"graph3d")
2513 sCmd.replace(
findCommand(sCmd).nPos, 7,
"plot3d");
2515 if (sCmd.find(
"--") != string::npos || sCmd.find(
"-set") != string::npos)
2519 if (sCmd.find(
"--") != string::npos)
2520 sCmdSubstr = sCmd.substr(4, sCmd.find(
"--") - 4);
2522 sCmdSubstr = sCmd.substr(4, sCmd.find(
"-set") - 4);
2526 if (sCmd.find(
"--") != string::npos)
2527 _pData.
setParams(sCmd.substr(sCmd.find(
"--")));
2529 _pData.
setParams(sCmd.substr(sCmd.find(
"-set")));
2536 createPlot(sCmd, _data, _parser, _option, _functions, _pData);
2539 createPlot(sCmd, _data, _parser, _option, _functions, _pData);
2565 fitDataSet(sCmd, _parser, _data, _functions, _option);
2622 const std::map<std::string, SettingsValue>& mSettings = _option.
getSettings();
2630 for (
auto iter = mSettings.begin(); iter != mSettings.end(); ++iter)
2632 if (
findSettingOption(sCmd, iter->first.substr(iter->first.find(
'.')+1)) && !iter->second.isHidden())
2634 std::string convertedValue;
2636 switch (iter->second.getType())
2639 convertedValue =
toString(iter->second.active());
2642 convertedValue =
toString(iter->second.value());
2645 convertedValue = iter->second.stringval();
2649 switch (iter->second.getType())
2656 sCmd = convertedValue;
2658 sCmd.replace(nPos, sCommand.length(), convertedValue);
2667 sCmd =
"\"" + convertedValue +
"\"";
2669 sCmd.replace(nPos, sCommand.length(),
"\"" + convertedValue +
"\"");
2690 sCmd = convertedValue;
2700 sCmd =
"\"" + convertedValue +
"\"";
2702 sCmd.replace(nPos, sCommand.length(),
"\"" + convertedValue +
"\"");
2715 sCmd =
getVarList(
"vars -asstr", _parser, _data, _option);
2717 sCmd.replace(nPos, sCommand.length(),
getVarList(
"vars -asstr", _parser, _data, _option));
2730 sCmd =
getVarList(
"strings -asstr", _parser, _data, _option);
2732 sCmd.replace(nPos, sCommand.length(),
getVarList(
"strings -asstr", _parser, _data, _option));
2745 sCmd =
getVarList(
"nums -asstr", _parser, _data, _option);
2747 sCmd.replace(nPos, sCommand.length(),
getVarList(
"nums -asstr", _parser, _data, _option));
2762 sCmd.replace(nPos, sCommand.length(), _pData.
getParams(
true));
2792 if (sCmd.length() > 7)
2816 std::string sArgument;
2819 while (!sArgument.length())
2821 string sLastLine =
"";
2824 if (sMessage.length())
2826 sLastLine =
LineBreak(sMessage, _option,
false, 4);
2829 if (sLastLine.find(
'\n') != string::npos)
2830 sLastLine.erase(0, sLastLine.rfind(
'\n'));
2832 if (sLastLine.substr(0, 4) ==
"| " || sLastLine.substr(0, 4) ==
"|<- " || sLastLine.substr(0, 4) ==
"|-> ")
2833 sLastLine.erase(0, 4);
2840 if (sLastLine.length() && sArgument.find(sLastLine) != string::npos)
2841 sArgument.erase(0, sArgument.find(sLastLine) + sLastLine.length());
2845 if (!sArgument.length() && sDefault.length())
2846 sArgument = sDefault;
2849 if (cmdParser.
hasParam(
"asstr") && sArgument[0] !=
'"' && sArgument[sArgument.length() - 1] !=
'"')
2856 GetAsyncKeyState(VK_ESCAPE);
2874 if (cmdParser.
getExpr().length())
2933 || sCmd.find(
"()",
findCommand(sCmd).nPos + 3) != string::npos
2934 || sCmd.find(
'$',
findCommand(sCmd).nPos + 3) != string::npos)
2941 if (!
newObject(sCmd, _parser, _data, _option))
2965 if (sCmd.length() > 5)
2971 sArgument =
"edit " + sArgument;
2972 editObject(sArgument, _parser, _data, _option);
2996 if (cmdParser.
getExpr().length())
3048 if (sCmd.length() > 9)
3050 Odesolver _solver(&_parser, &_data, &_functions, &_option);
3051 _solver.
solve(sCmd);
3132 string sCommand =
"delete " + cmdParser.
getExpr();
3135 sCommand +=
" -ignore";
3139 else if (cmdParser.
hasParam(
"memory"))
3156 else if (cmdParser.
getExpr() ==
"string()")
3211 if (sCmd.find(
' ') != string::npos)
3219 string sArgument = sCmd.substr(sCmd.find(
' '));
3222 if (!_functions.
isDefined(sArgument.substr(0, sArgument.find(
":="))))
3261 sArgument = sCmd.substr(
findCommand(sCmd).nPos + 8);
3362 if (cmdParser.
getExpr().length())
3366 double j1 = _data.
getCols(
"data") + 1;
3512 if (!cmdParser.
getExpr().length())
3537 std::string sMessage = cmdParser.
getExpr();
3539 if (sMessage.length())
3545 if (vVals.size() > 1)
3549 for (
size_t i = 0; i < vVals.size(); i++)
3552 sMessage.back() =
'}';
3581 string sExpr = sCmd;
3583 sExpr.replace(_match.
nPos, string::npos,
"_~load[~_~]");
3584 sCmd.erase(0, _match.
nPos);
3611 sExpr.replace(_match.
nPos, string::npos, sRet);
3680 _functions.
save(_option);
3711 std::map<std::string, SettingsValue>& mSettings = _option.
getSettings();
3720 for (
auto iter = mSettings.begin(); iter != mSettings.end(); ++iter)
3722 if (iter->second.isMutable() && (pos =
findSettingOption(sCmd, iter->first.substr(iter->first.find(
'.')+1))))
3724 switch (iter->second.getType())
3727 if (!
parseCmdArg(sCmd, pos, _parser, nArgument) || (nArgument != 0 && nArgument != 1))
3728 nArgument = !iter->second.active();
3730 iter->second.active() = (bool)nArgument;
3737 _functions.
load(_option);
3741 if (iter->second.isUiModifying())
3750 && nArgument >= iter->second.min()
3751 && nArgument <= iter->second.max())
3753 iter->second.value() = nArgument;
3755 if (iter->second.isUiModifying())
3764 if (iter->second.isPath())
3772 iter->second.stringval() = _fSys.
getPath();
3780 if (iter->second.isUiModifying())
3788 if (sCmd[pos] ==
'=')
3793 if (sArgument.front() ==
'"')
3794 sArgument.erase(0, 1);
3796 if (sArgument.back() ==
'"')
3797 sArgument.erase(sArgument.length() - 1);
3806 iter->second.stringval() = sArgument;
3808 if (iter->second.isUiModifying())
3826 if (sArgument.length() && sArgument ==
"debug")
3842 else if (sArgument.length() && sArgument ==
"developer")
3861 while (!sArgument.length());
3902 if (!sFileName.length())
3930 if (cmdParser.
getCommand().substr(0, 5) ==
"showf")
3948 for (
size_t i = 0; i < _accessParser.
getIndices().row.size(); i++)
3968 for (
size_t j = 0; j < _accessParser.
getIndices().col.size(); j++)
3970 for (
size_t i = 0; i < _accessParser.
getIndices().row.size(); i++)
4024 int nWindowSize = 1;
4025 double dAlpha = NAN;
4033 nWindowSize =
intCast(vParVal.front());
4036 nWindowSize = 2 * nWindowSize + 1;
4042 dAlpha = vParVal.front().real();
4047 if (!sFilterType.length())
4050 if (sFilterType.length())
4052 if (sFilterType ==
"weightedlinear")
4054 else if (sFilterType ==
"gaussian")
4056 else if (sFilterType ==
"savitzkygolay")
4063 else if (cmdParser.
hasParam(
"lines"))
4065 else if (cmdParser.
hasParam(
"cols"))
4080 bool success =
false;
4176 if (cmdParser.
getExpr().length())
4225 std::string sExpression = cmdParser.
getExpr();
4232 if (sType ==
"ziparchive")
4234 else if (sType ==
"gzarchive")
4236 else if (sType ==
"tarchive")
4243 sExpression +=
" -komq";
4244 std::string sDummy =
"";
4248 std::vector<std::string> vFileNames;
4250 while (sExpression.length())
4275 if (cmdParser.
getExpr().length())
4277 std::string sArchiveFileName = cmdParser.
getExprAsFileName(
".zip",
"<loadpath>");
4280 if (sTargetPathName.length())
4283 std::vector<std::string> vFiles =
Archive::unpack(sArchiveFileName, sTargetPathName);
4287 for (
auto& file : vFiles)
4289 file.insert(0, 1,
'"');
4372 if (sCmd.length() >
findCommand(sCmd).sString.length() + 1)
4380 if (_functions.
defineFunc(sCmd.substr(sCmd.find(
' ') + 1),
true))
4415 std::pair<size_t, size_t> samples;
4417 if (vParVal.size() > 1)
4419 samples.first =
intCast(vParVal[0]);
4420 samples.second =
intCast(vParVal[1]);
4422 else if (vParVal.size() == 1)
4424 samples.first =
intCast(vParVal.front());
4425 samples.second =
intCast(vParVal.front());
4442 else if (cmdParser.
hasParam(
"cols"))
4444 else if (cmdParser.
hasParam(
"lines"))
4447 std::string sFilter =
"lanczos3";
4482 std::string sReturnStatement;
4486 std::string sTableList = cmdParser.
getExpr();
4494 size_t nPos = sTable.find(iter->first +
"()");
4496 if (nPos != string::npos && (!nPos ||
isDelimiter(sTable[nPos-1])) && iter->first !=
"table")
4498 sTable = iter->first;
4502 if (sReturnStatement.length())
4503 sReturnStatement +=
", ";
4505 sReturnStatement +=
"\"" + sTable +
"()\"";
4512 if (sReturnStatement.length() && _option.
systemPrints())
4515 else if (cmdParser.
getExpr().length())
4568 else if (sCmd.find(
"()") != string::npos && sCmd.find(
',') != string::npos)
4581 if (sArgument.find(
'(') != string::npos)
4582 sArgument.erase(sArgument.find(
'('));
4584 if (sCmd.find(
'(') != string::npos)
4585 sCmd.erase(sCmd.find(
'('));
4695 if (sCmd.length() > 8)
4707 _functions.
save(_option);
4713 _functions.
load(_option);
4800 if (sArgument ==
"num" || sArgument ==
"numerical")
4802 else if (sArgument ==
"mat" || sArgument ==
"matrix" || sArgument ==
"vec" || sArgument ==
"vector")
4804 else if (sArgument ==
"string")
4806 else if (sArgument ==
"trigonometric")
4808 else if (sArgument ==
"hyperbolic")
4810 else if (sArgument ==
"logarithmic")
4812 else if (sArgument ==
"polynomial")
4814 else if (sArgument ==
"stats" || sArgument ==
"statistical")
4816 else if (sArgument ==
"angular")
4818 else if (sArgument ==
"physics" || sArgument ==
"physical")
4820 else if (sArgument ==
"logic" || sArgument ==
"logical")
4822 else if (sArgument ==
"time")
4824 else if (sArgument ==
"distrib")
4826 else if (sArgument ==
"random")
4828 else if (sArgument ==
"coords")
4830 else if (sArgument ==
"draw")
4860 std::string sTargetTable;
4869 if (sTargetTable.find(
'(') != std::string::npos)
4870 return sTargetTable.substr(0, sTargetTable.find(
'('));
4872 return sTargetTable;
4898 _functions.
load(_option);
4902 else if (cmdParser.
getExpr().length())
4906 double j1 = _data.
getCols(
"data") + 1;
4916 if (sFileName.length())
4920 if (sSlicingParam ==
"xz")
4922 else if (sSlicingParam ==
"yz")
4949 else if ((cmdParser.
hasParam(
"tocache") || cmdParser.
hasParam(
"totable") || cmdParser.
hasParam(
"target")) && cmdParser.
hasParam(
"all") && (sFileName.find(
'*') != string::npos || sFileName.find(
'?') != string::npos))
4952 if (sFileName.find(
'/') == string::npos)
4953 sFileName =
"<loadpath>/" + sFileName;
4955 vector<string> vFilelist =
getFileList(sFileName, _option, 1);
4957 if (!vFilelist.size())
4960 for (
size_t i = 0; i < vFilelist.size(); i++)
4978 if (cmdParser.
hasParam(
"all") && (sFileName.find(
'*') != string::npos || sFileName.find(
'?') != string::npos))
4980 if (sFileName.find(
'/') == string::npos)
4981 sFileName =
"<loadpath>/" + sFileName;
4983 vector<string> vFilelist =
getFileList(sFileName, _option, 1);
4985 if (!vFilelist.size())
4988 for (
size_t i = 0; i < vFilelist.size(); i++)
4991 _data.
openFile(vFilelist[i],
false,
false, nArgument);
5008 if (vParList.size())
5009 nArgument =
intCast(vParList.front());
5014 if (vParList.size())
5015 nArgument =
intCast(vParList.front());
5018 info = _data.
openFile(sFileName,
false,
false, nArgument);
5032 load_data(_data, _option, _parser, sFileName);
5061 if (!_filenames.size())
5066 for (
size_t i = 0; i < _filenames.size(); i++)
5068 if (sCmd.find_first_not_of(
' ', _mMatch.
nPos+6) != string::npos)
5071 if (sCmd[sCmd.find_first_not_of(
' ', _mMatch.
nPos+6)] ==
'-')
5072 sArgument =
"load " + _filenames[i] +
" " + sCmd.substr(sCmd.find_first_not_of(
' ', _mMatch.
nPos+6)) +
" -app";
5074 sArgument = sCmd.substr(_mMatch.
nPos+2) +
" -app";
5077 sArgument =
"load " + _filenames[i] +
" -app";
5083 sCmd.replace(_mMatch.
nPos, string::npos,
"_~load[~_~]");
5121 if (!cmdParser.
getExpr().length())
5125 int frst = 1, lst = 100;
5130 frst =
intCast(vParVal.front());
5135 lst =
intCast(vParVal.front());
5161 string sArgument = sCmd.substr(
findCommand(sCmd).nPos + 6);
5167 if (sArgument.find(
"??") != string::npos)
5170 sArgument +=
" -print";
5238 std::map<std::string, CommandFunc> mCommandFuncMap;
5242 mCommandFuncMap[
"clc"] =
cmd_clc;
5249 mCommandFuncMap[
"copy"] =
cmd_copy;
5262 mCommandFuncMap[
"edit"] =
cmd_edit;
5265 mCommandFuncMap[
"fit"] =
cmd_fit;
5266 mCommandFuncMap[
"fitw"] =
cmd_fit;
5267 mCommandFuncMap[
"fft"] =
cmd_fft;
5268 mCommandFuncMap[
"fft2d"] =
cmd_fft;
5269 mCommandFuncMap[
"fwt"] =
cmd_fwt;
5276 mCommandFuncMap[
"hist"] =
cmd_hist;
5277 mCommandFuncMap[
"hist2d"] =
cmd_hist;
5285 mCommandFuncMap[
"list"] =
cmd_list;
5291 mCommandFuncMap[
"move"] =
cmd_move;
5293 mCommandFuncMap[
"new"] =
cmd_new;
5295 mCommandFuncMap[
"open"] =
cmd_edit;
5296 mCommandFuncMap[
"pack"] =
cmd_pack;
5302 mCommandFuncMap[
"quit"] =
cmd_quit;
5312 mCommandFuncMap[
"save"] =
cmd_save;
5313 mCommandFuncMap[
"set"] =
cmd_set;
5314 mCommandFuncMap[
"show"] =
cmd_show;
5315 mCommandFuncMap[
"showf"] =
cmd_show;
5319 mCommandFuncMap[
"stfa"] =
cmd_stfa;
5324 mCommandFuncMap[
"swap"] =
cmd_swap;
5334 mCommandFuncMap[
"view"] =
cmd_edit;
5335 mCommandFuncMap[
"warn"] =
cmd_warn;
5339 return mCommandFuncMap;
5353 std::map<std::string, CommandFunc> mCommandFuncMap;
5358 mCommandFuncMap[
"diff"] =
cmd_diff;
5359 mCommandFuncMap[
"eval"] =
cmd_eval;
5364 mCommandFuncMap[
"load"] =
cmd_load;
5365 mCommandFuncMap[
"pso"] =
cmd_pso;
5367 mCommandFuncMap[
"read"] =
cmd_read;
5370 mCommandFuncMap[
"seek"] =
cmd_seek;
5371 mCommandFuncMap[
"sort"] =
cmd_sort;
5375 mCommandFuncMap[
"url"] =
cmd_url;
5379 return mCommandFuncMap;
const std::string sVersion
std::string toLowerCase(const std::string &)
Converts uppercase to lowercase letters.
bool extractFirstParameterStringValue(const string &sCmd, string &sArgument)
This function returns the string argument for a single parameter in the command line.
bool parseCmdArg(const string &sCmd, size_t nPos, Parser &_parser, size_t &nArgument)
This function finds the numerical argument to the selected command line parameter and evaluates it.
string evaluateParameterValues(const string &sCmd)
This function evaluates a passed parameter string, so that the values of the parameters are only valu...
@ COMMAND_HAS_RETURNVALUE
This class provides the functionality to extract the different components of a command line into the ...
std::vector< mu::value_type > parseExprAsNumericalValues() const
Parses the expression into numerical values, returned as a vector of doubles.
DataAccessParser getExprAsDataObject() const
Parses the expression to a DataAccessParser, which will extract the needed information for the curren...
const std::string & getReturnValueStatement() const
Returns the return value statement for commands with return values.
std::string getFileParameterValue(std::string sFileExt, const std::string &sBaseFolder="", const std::string &sDefaultName="") const
Parses the value of the common "file" command line parameter and returns a valid filename.
std::vector< mu::value_type > getParameterValueAsNumericalValue(const std::string &sParameter) const
Parses the selected parameter as (one or more) numerical value(s) and returns them as a vector of dou...
std::string getParameterValueAsString(const std::string &sParameter, const std::string &sDefaultValue, bool stripAlways=false, bool onlyStringEvaluation=false) const
Parses the selected parameter value as a string and returns it. If the parameter is not found,...
const std::string & getExpr() const
Returns the expression as plain value.
const std::string & getParameterList() const
Returns the parameter list.
std::string getFileParameterValueForSaving(std::string sFileExt, const std::string &sBaseFolder="", const std::string &sDefaultName="") const
Parses the value of the common "file" command line parameter and returns a valid filename....
void setReturnValue(const std::string &sRetVal)
Sets the return value of the current command by simply appending it to the return value statement.
const std::string & getCommand() const
Returns the command.
std::string parseExprAsString() const
Prepares the expression by handling all string operations and removing the surrounding quotation mark...
std::string getParameterValue(const std::string &sParameter) const
Simply returns the parameter value or an empty string. Does not do any parsing steps.
@ CMD_PAR
Command-parameter sequence.
@ CMD_DAT_PAR
Command-dataobject-parameter sequence (e.g. fit)
@ CMD_EXPR_set_PAR
Command-expression-set-parameter sequence.
std::string getExprAsFileName(std::string sFileExt, const std::string &sBasePath="") const
Converts the expression to a file name and removes the surrounding quotation marks,...
bool exprContainsDataObjects() const
Simply returns, whether the expression contains any data objects.
IntervalSet parseIntervals(bool bErase=false)
Parses intervals in the parameter list and returns them as a vector. The interval may be deleted,...
bool hasParam(const std::string &sParameter) const
Simple wrapper around findParameter(), if used as a boolean flag.
This class is defined to abstrahize the determination of the correct data object and the calculation ...
Indices & getIndices()
Returns a reference to the stored indices.
void evalIndices()
Evaluates open end indices using the identified data object size.
bool isCluster() const
Determines, whether the data access references a cluster.
std::string & getDataObject()
Returns a reference to the data object identifier.
std::string getIndexString()
This member function returns the index definitions as a human-readable string.
void setLoggingLevel(Logger::LogLevel lvl)
Change the logging level or completely disable the logger.
This class implements the basic input/ output file system and provides functionalities to work with f...
std::string getProgramPath() const
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.
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.
void initializeFromKernel()
Member function to remote-initialize the class from the kernel. Cannot be used during kernel start-up...
std::string getPath() const
Returns the default path of this FileSystem instance.
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...
void setTokens(std::string _sTokens)
This member function may be used to update the path placeholders of the current FileSystem instance.
void declareFileType(const std::string &sFileType)
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.
This class implements the function definition managing instance.
std::string getFunctionSignature(size_t _i) const
Returns the function signature of the ith defined custom function.
void setTableList(const std::string &sTableList)
Sets the internal table list. This list is used to avoid redefinition of an already existing table as...
bool defineFunc(const std::string &sExpr, bool bRedefine=false, bool bFallback=false)
This function defines a custom function, by passing it to a new FunctionDefinition class instance.
bool undefineFunc(const std::string &sFunc)
This function removes a previously defined function from the internal memory.
std::string getComment(size_t _i) const
Returns the comment of the ith defined function.
bool isDefined(const std::string &sFunc)
This method checks, whether the passed function is already defined.
bool load(const Settings &_option, bool bAutoLoad=false)
This function loads previously saved function definitions to memory.
bool save(const Settings &_option)
This function saves the function definitions to the definition file.
std::string getNamesOfDefinedFunctions() const
Returns a list of the names of the custom defined functions.
std::string getImplementation(size_t _i) const
Returns the implementation of the ith defined custom function.
size_t getDefinedFunctions() const
Returns the number of defined functions.
std::vector< std::string > getList(const std::string &sMessageScheme) const
This member function returns a vector of language strings matching to the passed identifier containin...
std::string get(const std::string &sMessage, const std::vector< std::string > &vTokens) const
This member function returns the language string for the passed language identifier and replaces all ...
This class represents a single table in memory, or a - so to say - single memory page to be handled b...
Memory * extractRange(const VectorIndex &_vLine, const VectorIndex &_vCol) const
This member function extracts a range of this table and returns it as a new Memory instance.
This class represents the central memory managing instance. It will handle all tables and clusters,...
std::string matchTableAsParameter(const std::string &sExpression, char cFollowing=' ')
void removeData(bool bAutoSave=false)
Removes the "data()" table, if it is available.
bool smooth(const std::string &_sCache, const VectorIndex &_vLine, const VectorIndex &_vCol, const NumeRe::FilterSettings &_settings, AppDir Direction=ALL)
bool saveToCacheFile()
This member function saves the contents of this class to the cache file so that they may be restored ...
bool getSaveStatus() const
Returns, whether there's at least a single table in memory, which has not been saved yet.
virtual void melt(Memory *_mem, const std::string &sTable, bool overrideTarget=false) override
This member function either combines the contents of the passed Memory instance with an existing one ...
void deleteBulk(const std::string &_sCache, int i1, int i2, int j1=0, int j2=0)
int getLines(StringView sTable, bool _bFull=false) const
const std::map< std::string, std::pair< size_t, size_t > > & getTableMap() const
bool isEmpty(const std::string &sTable) const
bool isTable(const std::string &sTable) const
This member function returns, whether the passed table name corresponds to a known table.
void setUserdefinedFuncs(const std::string &sUserFuncs)
void swapTables(std::string sTable1, std::string sTable2)
bool deleteTable(const std::string &sCache)
This member function removes the selected table.
NumeRe::Table extractTable(const std::string &_sTable, const VectorIndex &lines=VectorIndex(0, VectorIndex::OPEN_END), const VectorIndex &cols=VectorIndex(0, VectorIndex::OPEN_END))
bool retouch(const std::string &_sCache, const VectorIndex &_vLine, const VectorIndex &_vCol, AppDir Direction=ALL)
bool resample(const std::string &_sCache, const VectorIndex &_vLine, const VectorIndex &_vCol, std::pair< size_t, size_t > samples, AppDir Direction=ALL, std::string sFilter="lanczos3")
void importTable(NumeRe::Table _table, const std::string &_sTable, const VectorIndex &lines=VectorIndex(0, VectorIndex::OPEN_END), const VectorIndex &cols=VectorIndex(0, VectorIndex::OPEN_END))
bool containsTables(const std::string &sExpression)
This member function detects, whether a table is used in the current expression.
bool isValid() const
Evaluates, whether there's at least a single non-empty table.
void setSaveStatus(bool _bIsSaved)
Changes the save status of all tables in memory.
bool addTable(const std::string &sCache, const Settings &_option)
This member function creates a new table. It is checked, whether its name is valid and not already us...
void renameTable(const std::string &sCache, const std::string &sNewName, bool bForceRenaming=false)
Memory * getTable(const std::string &sTable)
This member function returns a pointer to an existing Memory instance representing the selected table...
std::string getTableNames() const
bool containsTablesOrClusters(const std::string &sCmdLine)
This member function evaluates, whether the passed command line contains tables or clusters.
int getSize(int _nLayer) const
int getCols(StringView sTable, bool _bFull=false) const
int getColElements(const VectorIndex &cols, const std::string &_sTable) const
Returns the maximal number of elements in the selected column range.
This class represents a whole cluster. The single items are stored as pointers to the abstract cluste...
std::string getString(size_t i) const
This member function returns the data of the i-th cluster item in memory as a string.
void setDouble(size_t i, const mu::value_type &value)
This member function assigns a value as data for the i-th cluster item in memory. The type of the i-t...
mu::value_type getDouble(size_t i) const
This member function returns the data of the i-th cluster item in memory as a value.
unsigned short getType(size_t i) const
This member function returns the type of the i-th cluster item in the internal memory buffer.
bool containsClusters(const std::string &sCmdLine) const
This member function detects, whether any cluster is used in the current expression.
Cluster & getCluster(StringView sCluster)
This member function returns a reference to the cluster indicated by the passed cluster identifier.
Cluster & newCluster(const std::string &sCluster)
This member function creates a new cluster from the passed cluster identifier and returns a reference...
const std::map< std::string, Cluster > & getClusterMap() const
void clearAllClusters()
Clear all clusters currently in memory.
void set(size_t row, size_t col, T val)
std::string getDataFileName(const std::string &sTable) const
This member function will return the file name of the selected table. Will default to the table name.
std::string getOutputFileName() const
This member function will return the output file name, which was used for saving the last table.
void setbLoadEmptyColsInNextFile(bool _bLoadEmptyCols)
Set, whether empty columns shall be loaded in the next file.
FileHeaderInfo openFile(std::string _sFile, bool loadToCache=false, bool overrideTarget=false, int _nHeadline=0, const std::string &sTargetTable="")
This member function loads the contents of the selected file to a new Memory class instance....
bool saveFile(const std::string &sTable, std::string _sFileName, unsigned short nPrecision=7)
This member function wraps the saving functionality of the Memory class. The passed filename is evalu...
void setSavePath(const std::string &_sPath)
This function may be used to update the target saving path of this class.
void setbLoadEmptyCols(bool _bLoadEmptyCols)
Set, whether empty columns shall be loaded.
void setPrefix(const std::string &_sPrefix)
This function is used to set a file prefix for the saving file name.
std::string generateFileName(const std::string &sExtension=".ndat")
This member function creates a file name from the file prefix and the time stamp.
virtual bool isStringExpression(const std::string &sExpression) override
Returns true, if the passed expression is an expression containing strings, string variables or strin...
StringParserRetVal evalAndFormat(std::string &sLine, std::string &sCache, bool bSilent=false, bool bCheckAssertions=false)
This public member function evaluates the passed string expression and formats the results for the co...
void getStringValues(std::string &sLine)
This public member function resolves all string variable occurences and replaces them with their valu...
const std::map< std::string, std::string > & getStringVars() const
This data container is a copy- efficient table to interchange data between Kernel and GUI.
bool isEmpty() const
Return, whether the table is empty.
void setActive(bool active)
This class provides the interface to the core of NumeRe. It provides all functionalities,...
static NumeReKernel * getInstance()
This static member function returns a a pointer to the singleton instance of the kernel.
void setAns(NumeRe::Cluster *ans)
NumeRe::StringParser & getStringParser()
static void getline(std::string &sLine)
This function is an implementation replacing the std::getline() function.
void closeWindows(int type)
This member function informs the GUI to close all windows of the selected type. Use 0 or WT_ALL to cl...
static NumeRe::Table getTable()
This member function is used by the kernel to be notified when the user finished the table edit proce...
PlotData & getPlottingData()
static void printPreFmt(const std::string &__sLine, bool printingEnabled=true)
This member function appends the pre- formatted string to the buffer and informs the terminal that we...
NumeReDebugger & getDebugger()
MemoryManager & getMemoryManager()
static void print(const std::string &__sLine, bool printingEnabled=true)
This member function appends the passed string as a new output line to the buffer and informs the ter...
static void clcTerminal()
Clear the terminal.
static void showTable(NumeRe::Table _table, std::string __name, bool openeditable=false)
This member function passes a table to the GUI to be displayed in the table viewer....
void displaySplash()
This function displays the intro text.
FileSystem & getFileSystem()
static void showStringTable(NumeRe::Container< std::string > _stringtable, std::string __name, bool openeditable=false)
This member function passes a string table to the GUI to be displayed in the table viewer.
FunctionDefinitionManager & getDefinitions()
Procedure & getProcedureInterpreter()
static void gotoLine(const std::string &sFile, unsigned int nLine=0)
This member function handles opening files and jumping to lines as requested by the kernel.
static void issueWarning(std::string sWarningMessage)
This static function may be used to issue a warning to the user. The warning will be printed by the t...
static bool GetAsyncCancelState()
This function is used by the kernel to get informed, when the user pressed ESC or used other means of...
static void toggleTableStatus()
Toggles the table writing status, which will reduce the number or events send to the terminal.
static bool modifiedSettings
bool solve(const std::string &sCmd)
void setCompact(bool _bCompact)
std::string getPackageName(unsigned int i=0) const
Returns the plugin name of the ith plugin.
std::string getPackageDescription(unsigned int i=0) const
Returns the description of the ith plugin.
std::string getPluginCommandSignature(unsigned int i=0) const
Returns the plugin command signature of the ith plugin.
std::string getPackageLicense(unsigned int i=0) const
Returns the license information of the ith plugin.
std::string getPackageVersion(unsigned int i=0) const
Returns the version number string of the ith plugin.
unsigned int getPackageCount() const
Returns the number of installed plugins.
std::string getPackageAuthor(unsigned int i=0) const
Returns the author of the ith plugin.
std::string getPluginCommand(unsigned int i=0) const
Returns the plugin command of the ith plugin.
This class contains all the plot settings usable by the plotting algorithm.
void setFont(const std::string &Font)
void setParams(const std::string &__sCmd, int nType=ALL)
Identifies parameters and values in the passed parameter string and updates the selected type of the ...
std::string getParams(bool asstr=false) const
Return the internal plotting parameters as a human-readable string. Can be converted to an internal s...
This class implements the logic to evaluate complex procedures, which may be called recursively.
void openScript(std::string &_sScriptFileName)
This member function opens the script with the passed file name.
void setInstallProcedures(bool _bInstall=true)
This class manages the setting values of the internal (kernel) settings of this application.
bool createCompactTables() const
Returns, whether tables shall be displayed in a more compact way (does nothing in the external table ...
std::map< std::string, SettingsValue > & getSettings()
Returns a reference to the internal map of setting values.
std::string getLoadPath() const
Returns the current loading path.
bool systemPrints() const
Returns, whether system messages shall be printed to the terminal.
bool executeEnabled() const
Returns, whether the user enabled the execute command.
std::string getWorkPath() const
Returns the current working path (connected to the <wp> token).
bool isDeveloperMode() const
Returns, whether the developer mode is currently enabled.
std::string getSavePath() const
Returns the current saving path.
size_t getPrecision() const
Returns the precision for displaying floating numbers in the terminal. This value determines the numb...
std::string getTokenPaths() const
Returns a semicolon-separated list of the current defined path placeholders and their values.
std::string getProcPath() const
Returns the current procedure root import path.
std::string getPlotPath() const
Returns the current plotting path (plot storing location).
bool showExtendedFileInfo() const
Returns, whether the file tree or the terminal file explorer shall display extended file information ...
std::string getExePath() const
Returns the current application root folder path.
SettingsValue & getSetting(const std::string &value)
Returns a reference to the setting value, which corresponds to the passed string. Throws an exception...
size_t getWindow(int nWindow=0) const
Returns the current window size of the terminal.
void setDefaultPlotFont(const std::string &plotFont)
Update the default plotting font. This member function evaluates first, whether the selected font act...
std::string getScriptPath() const
Returns the current script import folder path.
bool useDebugger() const
Returns, whether the debugger is currently active.
void save(const std::string &_sWhere, bool bMkBackUp=false)
Saves the setting values to the corresponding config file. Does only save the setting values,...
std::string & stringval()
Returns a reference to a std::string value type setting.
int getStringSize(unsigned int nCol=std::string::npos) const
unsigned int getStringCols() const
unsigned int getStringElements(unsigned int nCol=std::string::npos) const
std::string readString(unsigned int _nthString=std::string::npos, unsigned int nCol=0)
bool clearStringElements()
bool removeStringElements(unsigned int nCol=0)
Common exception class for all exceptions thrown in NumeRe.
@ EXECUTE_COMMAND_UNSUCCESSFUL
@ TABLE_DOESNT_EXIST
INSERT HERE.
@ EXECUTE_COMMAND_DISABLED
@ CANNOT_REGULARIZE_CACHE
@ CANNOT_GENERATE_PROCEDURE
@ CANNOT_CALL_SCRIPT_RECURSIVELY
@ PROCESS_ABORTED_BY_USER
static size_t invalid_position
This class abstracts all the index logics, i.e. the logical differences between single indices and in...
size_t size() const
This member function returns the size of the indices stored in this class.
bool isOpenEnd() const
This member function determines, whether the internal index set has an open end.
void setRange(int nMin, int nMax)
This member function can be used to force the indices stored internally to be in a defined interval....
int & front()
This member function returns a reference to the first index value stored internally.
const varmap_type & GetVar() const
Return a map containing the used variables only.
const valmap_type & GetConst() const
Return a map containing all parser constants.
static void EnableDebugDump(bool bDumpCmd, bool bDumpStack)
Enable the dumping of bytecode amd stack content on the console.
void SetVectorVar(const std::string &sVarName, const std::vector< mu::value_type > &vVar, bool bAddVectorType=false)
This member function copies the passed vector into the internal storage referencing it with the passe...
Mathematical expressions parser.
bool findZeroes(CommandLineParser &cmdParser)
This function is a wrapper to the actual zeros localisation function localizeZero() further below.
void urlExecute(CommandLineParser &cmdParser)
This function implements the url command providing an interface to http(s) and (s)ftp URLs.
bool writeAudioFile(CommandLineParser &cmdParser)
This function creates a WAVE file from the selected data set.
bool shortTimeFourierAnalysis(CommandLineParser &cmdParser)
This function performs the short-time fourier analysis on the passed data set.
bool integrate2d(CommandLineParser &cmdParser)
Calculate the integral of a function in two dimensions.
void rotateTable(CommandLineParser &cmdParser)
This function rotates a table, an image or a datagrid around a specified angle.
bool analyzePulse(CommandLineParser &cmdParser)
This function performs a pulse analysis on the selected data set.
bool createDatagrid(CommandLineParser &cmdParser)
This function calculates a datagrid from passed functions or (x-y-z) data values.
bool readAudioFile(CommandLineParser &cmdParser)
Reads either the audio file meta information or the whole audio file to memory.
bool fastWaveletTransform(CommandLineParser &cmdParser)
This function calculates the fast wavelet transform of the passed data set.
void boneDetection(CommandLineParser &cmdParser)
This function is the implementation of the detect command.
bool differentiate(CommandLineParser &cmdParser)
Calculate the numerical differential of the passed expression or data set.
bool findExtrema(CommandLineParser &cmdParser)
This function is a wrapper to the actual extrema localisation function localizeExtremum() further bel...
bool seekInAudioFile(CommandLineParser &cmdParser)
Seek a position in an audiofile and extract a length of samples from it.
void taylor(CommandLineParser &cmdParser)
This function approximates the passed expression using Taylor's method.
bool calculateSplines(CommandLineParser &cmdParser)
This function approximates the passed data set using cubic splines.
bool regularizeDataSet(CommandLineParser &cmdParser)
This function regularizes the samples of a defined x-y-data array such that DeltaX is equal for every...
bool integrate(CommandLineParser &cmdParser)
Calculate the integral of a function or a data set in a single dimension.
void particleSwarmOptimizer(CommandLineParser &cmdParser)
This function implements a particle swarm optimizer in up to four dimensions (depending on the number...
bool evalPoints(CommandLineParser &cmdParser)
This function samples a defined expression in an array of discrete values.
bool fastFourierTransform(CommandLineParser &cmdParser)
This function calculates the fast fourier transform of the passed data set.
bool fitDataSet(std::string &sCmd, mu::Parser &_parser, MemoryManager &_data, FunctionDefinitionManager &_functions, const Settings &_option)
static CommandReturnValues cmd_save(string &sCmd)
This static function implements the "save" command.
static CommandReturnValues cmd_redefine(string &sCmd)
This static function implements the "redefine" command.
static CommandReturnValues cmd_imread(string &sCmd)
This static function implements the "imread" command.
static CommandReturnValues cmd_include(string &sCmd)
This static function implements the "include" command.
static CommandReturnValues cmd_copy(string &sCmd)
This static function implements the "copy" command.
static CommandReturnValues cmd_print(string &sCmd)
This static function implements the "print" command.
static CommandReturnValues cmd_detect(string &sCmd)
This static function implements the "detect" command.
static void copyDataToTemporaryTable(const string &sCmd, DataAccessParser &_accessParser, MemoryManager &_data, MemoryManager &_cache)
This static function copies the contents of the selected table to the provided temporary Datafile obj...
static CommandReturnValues cmd_integrate(string &sCmd)
This static function implements the "integrate" command.
static CommandReturnValues cmd_stfa(string &sCmd)
This static function implements the "stfa" command.
static string getVarList(const string &sCmd, Parser &_parser, MemoryManager &_data, Settings &_option)
This function returns a list of the current defined variables either as strings or as plain text.
static void listConstants(const Parser &_parser, const Settings &_option)
This function lists all known constants.
CommandReturnValues(* CommandFunc)(string &)
static CommandReturnValues cmd_readline(string &sCmd)
This static function implements the "readline" command.
static CommandReturnValues cmd_clc(string &sCmd)
This static function implements the "clc" command.
static CommandReturnValues cmd_spline(string &sCmd)
This static function implements the "spline" command.
static CommandReturnValues cmd_ifndefined(string &sCmd)
This static function implements the "ifndefined" command.
static CommandReturnValues cmd_rename(string &sCmd)
This static function implements the "rename" command.
static CommandReturnValues cmd_append(string &sCmd)
This static function implements the "append" command.
static std::map< std::string, CommandFunc > getCommandFunctionsWithReturnValues()
This static function returns a map of commands with return values linked to their function implementa...
static bool prepareTemplate(const std::string &sTemplateID, const std::string &sFileName)
Perpares a template based upon the selected template id. The file has to exist.
static CommandReturnValues cmd_odesolve(string &sCmd)
This static function implements the "odesolve" command.
static void listInstalledPlugins(Parser &_parser, MemoryManager &_data, const Settings &_option)
This function lists all declared plugins including their name, their command and their description.
static CommandReturnValues cmd_audioread(string &sCmd)
This static function implements the "audioread" command.
static CommandReturnValues cmd_workpath(string &sCmd)
This static function implements the "workpath" command.
static CommandReturnValues cmd_reload(string &sCmd)
This static function implements the "reload" command.
static CommandReturnValues cmd_hist(string &sCmd)
This static function implements the "hist" command.
static CommandReturnValues cmd_write(string &sCmd)
This static function implements the "write" command.
static CommandReturnValues cmd_taylor(string &sCmd)
This static function implements the "taylor" command.
static CommandReturnValues cmd_seek(string &sCmd)
This static function implements the "seek" command.
static CommandReturnValues cmd_find(string &sCmd)
This static function implements the "find" command.
static CommandReturnValues cmd_random(string &sCmd)
This static function implements the "random" command.
static CommandReturnValues cmd_fwt(string &sCmd)
This static function implements the "fwt" command.
static CommandReturnValues cmd_zeroes(string &sCmd)
This static function implements the "zeroes" command.
static CommandReturnValues cmd_swap(string &sCmd)
This static function implements the "swap" command.
static CommandReturnValues cmd_plotting(string &sCmd)
This static function implements all plotting commands.
static CommandReturnValues cmd_execute(string &sCmd)
This static function implements the "execute" command.
static bool listFiles(const string &sCmd, const Settings &_option)
This function handles the display of the contents of the selected folders directly in the terminal.
static CommandReturnValues cmd_audio(string &sCmd)
This static function implements the "audio" command.
static CommandReturnValues cmd_pack(string &sCmd)
This static function implements the "pack" command.
static CommandReturnValues saveDataObject(string &sCmd)
This static function handles the saving and exporting of data into files (internally,...
static CommandReturnValues cmd_help(string &sCmd)
This static function implements the "help" command.
static CommandReturnValues cmd_list(string &sCmd)
This static function implements the "list" command.
static CommandReturnValues cmd_stats(string &sCmd)
This static function implements the "stats" command.
static size_t findSettingOption(const std::string &sCmd, const std::string &sOption)
This static function is used to detect a setting option independent on a leading dash character in fr...
static std::map< std::string, CommandFunc > getCommandFunctions()
This static function returns a map of commands linked to their function implementation.
static CommandReturnValues cmd_unpack(string &sCmd)
This static function implements the "unpack" command.
static void listDefinitions(const FunctionDefinitionManager &_functions, const Settings &_option)
This function lists all custom defined functions.
static CommandReturnValues cmd_regularize(string &sCmd)
This static function implements the "regularize" command.
static CommandReturnValues cmd_load(string &sCmd)
This static function implements the "load" command.
static CommandReturnValues cmd_diff(string &sCmd)
This static function implements the "diff" command.
static CommandReturnValues cmd_progress(string &sCmd)
This static function implements the "progress" command.
static CommandReturnValues cmd_hline(string &sCmd)
This static function implements the "hline" command.
static bool newObject(string &sCmd, Parser &_parser, MemoryManager &_data, Settings &_option)
This function creates new objects: files, directories, procedures and tables.
static CommandReturnValues cmd_fit(string &sCmd)
This static function implements the "fit" and "fitw" commands.
static CommandReturnValues cmd_new(string &sCmd)
This static function implements the "new" command.
static CommandReturnValues cmd_rotate(string &sCmd)
This static function implements all "*rot" commands.
static bool confirmOperation(const std::string &sMessage)
Performs the operation confirmation loop, if the user did not supply the ignore command line option.
static CommandReturnValues cmd_resample(string &sCmd)
This static function implements the "resample" command.
static void listCommands(const Settings &_option)
This function lists all defined commands.
static CommandReturnValues cmd_matop(string &sCmd)
This static function implements the "matop" command.
static bool executeCommand(string &sCmd, Parser &_parser, MemoryManager &_data, FunctionDefinitionManager &_functions, const Settings &_option)
This static function implements the possibility to call the Windows shell directly from the code.
static CommandReturnValues cmd_define(string &sCmd)
This static function implements the "define" command.
static CommandReturnValues cmd_datagrid(string &sCmd)
This static function implements the "datagrid" command.
static CommandReturnValues cmd_install(string &sCmd)
This static function implements the "install" command.
static CommandReturnValues cmd_smooth(string &sCmd)
This static function implements the "smooth" command.
static CommandReturnValues cmd_edit(string &sCmd)
This static function implements the "edit" command.
static CommandReturnValues cmd_credits(string &sCmd)
This static function implements the "credits" command.
static CommandReturnValues cmd_read(string &sCmd)
This static function implements the "read" command.
static CommandReturnValues cmd_sort(string &sCmd)
This static function implements the "sort" command.
static bool undefineFunctions(string sFunctionList, FunctionDefinitionManager &_functions, const Settings &_option)
This static function handles the undefinition process of custom defined functions.
static bool editObject(string &sCmd, Parser &_parser, MemoryManager &_data, Settings &_option)
This function opens the object in the editor to edit its contents.
static CommandReturnValues cmd_remove(string &sCmd)
This static function implements the "remove" command.
static void printUnits(const string &sUnit, const string &sDesc, const string &sDim, const string &sValues, unsigned int nWindowsize)
This static function prints the selected unit, its description, its dimension and its value conversio...
static CommandReturnValues cmd_quit(string &sCmd)
This static function implements the "quit" command.
static CommandReturnValues cmd_set(string &sCmd)
This static function implements the "set" command.
static CommandReturnValues swapTables(string &sCmd, MemoryManager &_data, Settings &_option)
This static function handles the swapping of the data of the values of two tables.
string removeQuotationMarks(const string &sString)
This function simply removes the surrounding quotation marks.
void plotTableBySize(std::vector< std::string > lineEntries, std::vector< size_t > lineColSizes)
This function actually plots the table with the desired colun widths. For this all the content to plo...
static CommandReturnValues cmd_delete(string &sCmd)
This static function implements the "delete" command.
static string createListDirectoryHeader(const string &sPathName, const string &sLangString, size_t nWindowLength)
This static function draws the headers for the listed directories.
static CommandReturnValues cmd_warn(string &sCmd)
This static function implements the "warn" command.
static string getPathForSetting(string &sCmd, size_t pos)
This static function extracts the path from the selected parameter. It is only used by cmd_set().
static CommandReturnValues cmd_move(string &sCmd)
This static function implements the "move" command.
static CommandReturnValues cmd_pso(string &sCmd)
This static function implements the interface to the particle swarm optimizer.
static bool listDirectory(const string &sDir, const string &sParams, const Settings &_option)
This function displays the contents of a single directory directly in the terminal.
static void listFunctions(const Settings &_option, const string &sType)
This function lists all known functions in the terminal.
static CommandReturnValues cmd_get(string &sCmd)
This static function implements the "get" command.
std::vector< size_t > calcTableWidth(size_t maxWidth, std::vector< size_t > minDesiredColWidth)
This function returns a vector with column widths for a table, depending on the overall table size an...
static CommandReturnValues cmd_eval(string &sCmd)
This static function implements the "eval" command.
static CommandReturnValues cmd_show(string &sCmd)
This static function implements the "show" command. Editing of tables is not supplied by this functio...
static CommandReturnValues cmd_dialog(string &sCmd)
This static function handles the displaying of user interaction dialogs.
static CommandReturnValues cmd_fft(string &sCmd)
This static function implements the "fft" command.
static CommandReturnValues cmd_undefine(string &sCmd)
This static function implements the "undefine" command.
static std::string getTargetTable(const std::string &sCmd)
Simple handler function for cmd_load.
static void autoSave(MemoryManager &_data, Output &_out, Settings &_option)
This function performs the autosave at the application termination.
static CommandReturnValues cmd_url(string &sCmd)
This static function implements the "url" command.
static CommandReturnValues cmd_extrema(string &sCmd)
This static function implements the "extrema" command.
static void listUnitConversions(const Settings &_option)
This function lists all unit conversions and their result, if applied on 1.
static CommandReturnValues cmd_close(string &sCmd)
This static function implements the "close" command.
static CommandReturnValues cmd_clear(string &sCmd)
This static function implements the "clear" command.
static CommandReturnValues cmd_start(string &sCmd)
This static function implements the "start" command.
static void listLogicalOperators(const Settings &_option)
This function lists all logical expressions.
static CommandReturnValues cmd_window(string &sCmd)
This static function implements the "window" command.
static CommandReturnValues cmd_pulse(string &sCmd)
This static function implements the "pulse" command.
static CommandReturnValues cmd_retouch(string &sCmd)
This static function implements the "retouch" command.
static void listDeclaredVariables(Parser &_parser, const Settings &_option, const MemoryManager &_data)
This function lists all declared variables, which are known by the numerical and the string parser as...
bool isNotEmptyExpression(const string &sExpr)
This function checks, whether the passed expression is non-empty (i.e. it contains more than white sp...
bool isValidIndexSet(const Indices &_idx)
bool sortData(CommandLineParser &cmdParser)
This function is a wrapper for the corresponding member function of the Datafile object.
bool readImage(CommandLineParser &cmdParser)
This function reads image data from an image file and stores it as a cache table.
bool moveData(CommandLineParser &cmdParser)
This function will move the selected part of a data table to a new location.
bool CopyData(CommandLineParser &cmdParser)
This function copies whole chunks of data between tables.
void load_data(MemoryManager &_data, Settings &_option, Parser &_parser, string sFileName)
This function is a wrapper for the Datafile object. It will simply do the whole UI stuff and let the ...
bool deleteCacheEntry(CommandLineParser &cmdParser)
This function removes one or multiple entries in the selected table or cluster.
bool readFromFile(CommandLineParser &cmdParser)
This function reads the content of a file as strings and copies them to a temporary string vector var...
void clear_cache(MemoryManager &_data, Settings &_option, bool bIgnore)
This function removes all allocated tables and frees the assigned memory.
void append_data(CommandLineParser &cmdParser)
This function handles appending data sets to already existing data.
bool writeToFile(CommandLineParser &cmdParser)
This function writes the string contents in the command to a file.
void show_data(MemoryManager &_data, Output &_out, Settings &_option, const string &_sCache, size_t nPrecision)
This function presents the passed data to the user in a visual way.
WindowType
This enumeration defines all terminal- closable window types.
void doc_SearchFct(const std::string &sToLookFor, Settings &_option)
This function provides the logic for searching for entries in the keywords database.
void doc_Help(const std::string &__sTopic, Settings &_option)
This function shows the content of a documentation article based upon the passed topic....
bool generateTemplate(const std::string &sFile, const std::string &sTempl, const std::vector< std::string > &vTokens, Settings &_option)
bool removeFile(CommandLineParser &cmdParser)
Removes one or more files from the disk.
bool moveOrCopyFiles(CommandLineParser &cmdParser)
Moves or copies files from one location to another. Supports also wildcards and file lists.
std::string fromSystemCodePage(std::string)
Transforms the system code page to the internal one.
std::string toSystemCodePage(std::string)
Converts an internal to an external string. Does nothing currently.
std::string replacePathSeparator(const std::string &)
This function replaces the Windows style path sparators to UNIX style.
std::string sectionHeadline(const std::string &sString, char cHeadLineSep='-')
This function provides a headline for the "windows" in the console.
std::string strfill(const std::string &sString, unsigned int nWidth, char cFill=' ', bool limit=false)
This function fills the passed string up to the width nWidth with the characters cFill....
std::string strlfill(const std::string &sString, unsigned int nWidth, char cFill=' ')
This function fills the passed string up to the width nWidth with the characters cFill....
bool fileExists(const string &)
This function checks, whether the file with the passed file name exists.
if(nReturnType==EIGENVALUES)
bool performMatrixOperation(string &sCmd, Parser &_parser, MemoryManager &_data, FunctionDefinitionManager &_functions, const Settings &_option)
This function is the main interface to the matrix operations.
unsigned int getMatchingParenthesis(const StringView &)
Returns the position of the closing parenthesis.
std::vector< std::string > unpack(const std::string &sArchiveName, const std::string &sTargetPath)
Unpacks an archive file format into its folder structure at the specified location....
void pack(const std::vector< std::string > &vFileList, const std::string &sTargetFile, Type type)
Pack a set of files or folders into an archive file type with the specified file name....
static const char MONTH[]
static const char STATUS[]
Namespace for mathematical applications.
bool isnan(const value_type &v)
std::map< string_type, value_type > valmap_type
Type used for storing constants.
std::map< string_type, value_type * > varmap_type
Type used for storing variables.
string promptForUserInput(const string &__sCommand)
This function is invoked, if a prompt operator ("??") was found in a string.
void createPlot(std::string &sCmd, MemoryManager &_data, mu::Parser &_parser, Settings &_option, FunctionDefinitionManager &_functions, PlotData &_pData)
Wrapper function for creating plots. Will create an instance of the Plot class, which will handle the...
void plugin_histogram(std::string &sCmd)
This function is the interface to both the 1D and the 2D histogram generation.
void plugin_random(std::string &sCmd)
This function is the implementation of the random command.
std::string plugin_statistics(std::string &sCmd, MemoryManager &_data)
This is the implementation of the stats command.
void StripSpaces(std::string &)
Removes leading and trailing white spaces and tabulator characters.
int findParameter(const std::string &sCmd, const std::string &sParam, const char cFollowing)
This function searches the passed parameter in the passed command string. If something is found,...
#define SETTING_S_PLOTFONT
#define SETTING_B_LOADEMPTYCOLS
#define SETTING_S_EXEPATH
#define SETTING_V_WINDOW_X
#define SETTING_B_DEVELOPERMODE
#define SETTING_S_LOADPATH
#define SETTING_V_WINDOW_Y
#define SETTING_S_SAVEPATH
#define SETTING_B_DEFCONTROL
#define SETTING_S_WORKPATH
#define SETTING_B_DEBUGGER
#define SETTING_S_PLOTPATH
#define SETTING_S_SCRIPTPATH
size_t size() const
Return the number of intervals.
Structure for the findCommand function.
This structure contains the necessary information to create an instance of one of the following filte...
long long int intCast(const std::complex< double > &)
Casts the real part of the complex number to an integer and avoids rounding errors.
std::string toString(int)
Converts an integer to a string without the Settings bloat.
void dialogCommand(CommandLineParser &cmdParser)
This function is the actual implementation of the dialog command.
void windowCommand(CommandLineParser &cmdParser)
This function is the actual implementation of the window command.