OpenASIP  2.0
Static Public Member Functions | Private Member Functions | Static Private Member Functions | Static Private Attributes | List of all members
Environment Class Reference

#include <Environment.hh>

Collaboration diagram for Environment:
Collaboration graph

Static Public Member Functions

static void initialize ()
 
static std::string schemaDirPath (const std::string &prog)
 
static std::string dataDirPath (const std::string &prog)
 
static std::string bitmapsDirPath (const std::string &prog)
 
static std::string manDirPath (const std::string &prog)
 
static TCEString confPath (const std::string &fileName)
 
static TCEString userConfPath (const std::string &fileName)
 
static std::string errorLogFilePath ()
 
static std::string iconDirPath ()
 
static std::vector< std::string > includeDirPaths ()
 
static std::vector< std::string > opsetIncludeDir ()
 
static void setNewSchemaFileDir (const std::string &path)
 
static void setNewDataFileDir (const std::string &path)
 
static void setNewBitmapsFileDir (const std::string &path)
 
static void setNewManFileDir (const std::string &path)
 
static void setNewErrorLogFileDir (const std::string &path)
 
static std::string environmentVariable (const std::string &variable)
 
static std::vector< std::string > osalPaths ()
 
static std::vector< std::string > codeCompressorPaths (bool libraryPathsOnly=false)
 
static std::vector< std::string > schedulerPluginPaths ()
 
static std::vector< std::string > icDecoderPluginPaths (bool libraryPathsOnly=false)
 
static std::vector< std::string > hwModulePaths ()
 
static std::vector< std::string > hdbPaths (bool libraryPathsOnly=false)
 
static TCEString shortHDBPath (const TCEString &hdbPath)
 
static TCEString longHDBPath (const TCEString &hdbPath)
 
static std::vector< std::string > vhdlPaths (const std::string &hdbPath)
 
static std::vector< std::string > decompressorPaths (bool libraryPathsOnly=false)
 
static std::vector< std::string > explorerPluginPaths ()
 
static std::vector< std::string > estimatorPluginPaths ()
 
static std::string pdfManual ()
 
static std::string minimalADF ()
 
static std::string tceCompiler ()
 
static std::string defaultSchedulerConf ()
 
static std::string oldGccSchedulerConf ()
 
static std::string defaultICDecoderPlugin ()
 
static std::string defaultTextEditorPath ()
 
static std::string llvmtceCachePath ()
 
static std::vector< std::string > implementationTesterTemplatePaths ()
 
static std::string simTraceDirPath ()
 
static bool developerMode ()
 

Private Member Functions

 Environment ()
 
 ~Environment ()
 

Static Private Member Functions

static std::string pathTo (const std::string &name)
 
static void parsePathEnvVariable (std::vector< std::string > &paths)
 
static std::string findExecutableFromPATH (const std::vector< std::string > &file)
 

Static Private Attributes

static const std::string SCHEMA_DIR_NAME_ = "data"
 Name of the XML Schema directory. More...
 
static const std::string DATA_DIR_NAME_ = "data"
 Name of the data directory. More...
 
static const std::string BITMAPS_DIR_NAME_ = "bitmaps"
 Name of the bitmaps directory. More...
 
static const std::string MAN_DIR_NAME_ = "man"
 Name of the manual directory. More...
 
static const std::string CONF_DIR_NAME_ = "conf"
 Name of the configuration directory. More...
 
static const std::string ICON_DIR_NAME_ = "icons"
 Name of the toolbar icon directory. More...
 
static const std::string ERROR_LOG_FILE_NAME_ = "error_log.log"
 Name of the system error log file. More...
 
static bool initialized_ = false
 Flag indicating whether class has been initialized. More...
 
static bool developerMode_ = false
 Flag indicating whether TCE is executing in developer mode. More...
 
static std::vector< std::string > schemaPaths_
 Schema directory search paths. More...
 
static std::vector< std::string > dataPaths_
 Data directory search paths. More...
 
static std::vector< std::string > bitmapsPaths_
 Bitmaps directory search paths. More...
 
static std::vector< std::string > manPaths_
 Man directory search paths. More...
 
static std::vector< std::string > iconPaths_
 Toolbar icon search paths. More...
 
static std::vector< std::string > errorPaths_
 Error file search paths. More...
 
static std::vector< std::string > pathsToUse_
 Paths used in a particular search. More...
 
static std::string newSchemaFileDir_ = ""
 Directory for new schema file. More...
 
static std::string newDataFileDir_ = ""
 Directory for new data file. More...
 
static std::string newBitmapsFileDir_ = ""
 Directory for new bitmaps file. More...
 
static std::string newIconFileDir_ = ""
 Directory for new icon file. More...
 
static std::string newManFileDir_ = ""
 Directory for new manual file. More...
 
static std::string newConfFile_ = ""
 Directory for new configure file. More...
 
static std::string newErrorLogFileDir_ = ""
 Directory for new error log file. More...
 
static std::string simTraceDir_ = ""
 Directory to store ttasim traces. More...
 
static const std::string PDF_MANUAL_INSTALLED = "manual/OpenASIP_manual.pdf"
 Relative path to the installed TCE .pdf manual. More...
 
static const std::string PDF_MANUAL_SRC = "manual/OpenASIP_manual.pdf"
 Relative path to the TCE .pdf manual in source tree. More...
 
static const std::string MINIMAL_ADF_INSTALLED = "data/mach/minimal.adf"
 Relative path to the installed minimal.adf. More...
 
static const std::string MINIMAL_ADF_SRC = "data/mach/minimal.adf"
 Relative path to the minimal.adf in source tree. More...
 

Detailed Description

A class to get the environmental variable values as well as to find files or directories from the project's directory structure.

Definition at line 47 of file Environment.hh.

Constructor & Destructor Documentation

◆ Environment()

Environment::Environment ( )
private

Constructor.

Definition at line 420 of file Environment.cc.

420  {
421 }

◆ ~Environment()

Environment::~Environment ( )
private

Destructor.

Definition at line 427 of file Environment.cc.

427  {
428 }

Member Function Documentation

◆ bitmapsDirPath()

string Environment::bitmapsDirPath ( const std::string &  prog)
static

Tries to locate the directory where the application bitmaps are stored.

Returns the first absolute path of the directory where the file is found. If bitmaps directory is not found and a new directory is given, it is created. If creation fails, an empty string is returned.

Parameters
progThe program whose bitmaps directory are searched.
Returns
The path of the bitmaps directory.

Definition at line 201 of file Environment.cc.

201  {
202  initialize();
205  pathsToUse_.assign(bitmapsPaths_.begin(), bitmapsPaths_.end());
206  string bitmapsPath = pathTo(path);
207  if (bitmapsPath == "" && newBitmapsFileDir_ != "") {
209  return newBitmapsFileDir_;
210  }
211  }
212  return bitmapsPath;
213 }

References BITMAPS_DIR_NAME_, bitmapsPaths_, FileSystem::createDirectory(), DATA_DIR_NAME_, FileSystem::DIRECTORY_SEPARATOR, initialize(), newBitmapsFileDir_, pathsToUse_, and pathTo().

Referenced by ProDe::bitmapsDirPath(), OSEdAboutDialog::createContents(), HelpBrowser::HelpBrowser(), and OSEdMainFrame::OSEdMainFrame().

Here is the call graph for this function:

◆ codeCompressorPaths()

vector< string > Environment::codeCompressorPaths ( bool  libraryPathsOnly = false)
static

Returns the paths in which code compressor plugins are searched.

Parameters
libraryPathsOnlyWhen set to true, excludes CWD from search paths.
Returns
The paths in which code compressor plugins are searched.

Definition at line 571 of file Environment.cc.

571  {
572 
573  vector<string> paths;
574 
576  string path = string(TCE_SRC_ROOT) + DS + "compressors";
577  paths.push_back(path);
578  } else {
579  string base = Application::installationDir() + string(INSTALLATION_DIR) +
580  "codecompressors" + DS + "base";
581  string custom = Application::installationDir() + string(INSTALLATION_DIR)+
582  "codecompressors" + DS + "custom";
583  string personal = FileSystem::homeDirectory() + DS + ".openasip" + DS +
584  "codecompressors" + DS + "custom";
585 
586  paths.push_back(base);
587  paths.push_back(personal);
588  paths.push_back(custom);
589  }
590  string cwd = FileSystem::currentWorkingDir();
591  if (!libraryPathsOnly) paths.push_back(cwd);
592  return paths;
593 }

References FileSystem::currentWorkingDir(), developerMode(), DS, FileSystem::homeDirectory(), INSTALLATION_DIR, and Application::installationDir().

Referenced by ProgramImageGenerator::availableCompressors(), and ProgramImageGenerator::createCompressor().

Here is the call graph for this function:

◆ confPath()

TCEString Environment::confPath ( const std::string &  fileName)
static

Tries to locate the application's configuration file for reading.

First tries to find one in the user's homedir, if not found, uses the installed one (with defaults). Note: when writing (overriding) configuration files, one should call userConfDirPath() instead!

Parameters
fileNameThe name of the configuration file.
Returns
The path of the configuration file.

Definition at line 277 of file Environment.cc.

277  {
278  initialize();
279 
280  TCEString userConf =
281  FileSystem::homeDirectory() + DS + ".openasip" + DS + fileName;
282  TCEString srcDirConf =
283  TCEString(TCE_SRC_ROOT) + DS + CONF_DIR_NAME_ + DS + fileName;
284 
285  TCEString installedConf =
287  DS + CONF_DIR_NAME_ + DS + fileName;
288  if (FileSystem::fileExists(userConf)) {
289  return userConf;
290  }
291 
292  if (Environment::developerMode() && FileSystem::fileExists(srcDirConf)) {
293  return srcDirConf;
294  } else if (FileSystem::fileExists(installedConf)) {
295  return installedConf;
296  }
297 
298  FileSystem::createFile(userConf);
299  return userConf;
300 }

References CONF_DIR_NAME_, FileSystem::createFile(), developerMode(), DS, FileSystem::fileExists(), FileSystem::homeDirectory(), initialize(), INSTALLATION_DIR, and Application::installationDir().

Referenced by Proxim::loadOptions(), OSEd::OnInit(), and ProDe::OnInit().

Here is the call graph for this function:

◆ dataDirPath()

string Environment::dataDirPath ( const std::string &  prog)
static

Tries to locate the directory where the application data is stored.

Returns the first absolute path of the directory where the data is found. If directory is not found and directory for new data file is given, it is created. If creation fails, an empty string is returned.

Parameters
progThe program whose data directory is searched.
Returns
The path of data directory or an empty string.

Definition at line 176 of file Environment.cc.

176  {
177  initialize();
178  string path = DATA_DIR_NAME_ + FileSystem::DIRECTORY_SEPARATOR + prog;
179  pathsToUse_.assign(dataPaths_.begin(), dataPaths_.end());
180  string dataPath = pathTo(path);
181  if (dataPath == "" && newDataFileDir_ != "") {
183  return newDataFileDir_;
184  }
185  }
186  return dataPath;
187 }

References FileSystem::createDirectory(), DATA_DIR_NAME_, dataPaths_, FileSystem::DIRECTORY_SEPARATOR, initialize(), newDataFileDir_, pathsToUse_, and pathTo().

Referenced by AlmaIFIntegrator::addAlmaifFiles(), AlmaIFIntegrator::connectCoreMemories(), ProGe::BlockSourceCopier::copyProcessorSpecific(), ProGe::BlockSourceCopier::copyShared(), ProGeTestBenchGenerator::copyTestBenchFiles(), ProGeTestBenchGenerator::createProcArchVhdl(), OSEdModifyBehaviorCmd::Do(), DefaultICDecoderGenerator::generate(), ProGeScriptGenerator::generateCompileStart(), ProGeScriptGenerator::generateSimulationStart(), ProGe::RV32MicroCodeGenerator::generateWrapper(), AlmaIFIntegrator::initAlmaifBlock(), Proxim::loadOptions(), ProDe::OnInit(), OperationPropertyDialog::onOpen(), MemoryGenerator::templatePath(), ProGe::TestBenchBlock::write(), ProGe::SinglePortSSRAMBlock::write(), ProGe::SinglePortByteMaskSSRAMBlock::write(), and ProGe::LoopBufferBlock::write().

Here is the call graph for this function:

◆ decompressorPaths()

std::vector< std::string > Environment::decompressorPaths ( bool  libraryPathsOnly = false)
static

Returns the paths in which decompressor module definitions are searhed.

Parameters
libraryPathsOnlyWhen set to true, excludes CWD from search paths.
Returns
The paths in which decompressor module definitions are searched.

Definition at line 793 of file Environment.cc.

793  {
794  vector<string> paths;
795  if (!libraryPathsOnly) {
796  paths.push_back(FileSystem::currentWorkingDir());
797  paths.push_back(FileSystem::currentWorkingDir() + DS + "data");
798  }
799  return paths;
800 }

References FileSystem::currentWorkingDir(), and DS.

Referenced by IDF::MachineImplementation::checkImplFiles(), IDF::MachineImplementation::decompressorFile(), IDF::MachineImplementation::isLibraryImplFile(), IDF::MachineImplementation::makeImplFilesRelative(), and IDF::MachineImplementation::setDecompressorFile().

Here is the call graph for this function:

◆ defaultICDecoderPlugin()

string Environment::defaultICDecoderPlugin ( )
static

Returns full path to the default IC/Decoder plugin file.

Returns
Full path to the defaultICDecoderPlugin.so

Definition at line 1012 of file Environment.cc.

1012  {
1013 
1014  try {
1015  std::string file = "DefaultICDecoderPlugin.so";
1016  vector<std::string> paths = icDecoderPluginPaths();
1017  std::string path = FileSystem::findFileInSearchPaths(paths, file);
1018 
1019  return path;
1020  } catch(FileNotFound e) {
1022  "Installation broken, DefaultICDecoderPlugin.so not found.");
1023  return ""; // just to remove a warning
1024  }
1025 }

References abortWithError, FileSystem::findFileInSearchPaths(), and icDecoderPluginPaths().

Referenced by ProcessorImplementationWindow::ProcessorImplementationWindow().

Here is the call graph for this function:

◆ defaultSchedulerConf()

string Environment::defaultSchedulerConf ( )
static

Returns full path to the default scheduler pass configuration file.

Returns
Full path to the default_scheduler.conf

Definition at line 957 of file Environment.cc.

957  {
958 
960  std::string srcPath =
961  string(TCE_SRC_ROOT) + "/scheduler/passes/default_scheduler.conf";
962  assert(
963  FileSystem::fileExists(srcPath) &&
964  "Build broken, default_scheduler.conf not found.");
965  return srcPath;
966  } else {
967  std::string path = Application::installationDir() +
968  string(INSTALLATION_DIR) + "/scheduler/passes/default_scheduler.conf";
969  assert(
970  FileSystem::fileExists(path) &&
971  "Installation broken, default_scheduler.conf not found.");
972  return path;
973  }
974 }

References assert, developerMode(), FileSystem::fileExists(), INSTALLATION_DIR, and Application::installationDir().

Here is the call graph for this function:

◆ defaultTextEditorPath()

string Environment::defaultTextEditorPath ( )
static

Returns default GUI text editor to be used, atm. for osed

Returns
Full path of default text editor, first from VISUAL and, failing that, from a list of popular GUI editors

Definition at line 1034 of file Environment.cc.

1034  {
1035 
1036  std::string editor = environmentVariable("VISUAL");
1037 
1038  if (editor.empty()) {
1039  // If env variable is empty, check a list of known GUI editors
1040  vector<std::string> editors;
1041  editors.push_back("gedit"); // Gnome
1042  editors.push_back("leafpad"); // LXDE
1043  editors.push_back("mousepad"); // XFCE (old)
1044  editors.push_back("kate"); // KDE
1045 
1046  // returns empty string if none found
1047  return findExecutableFromPATH(editors);
1048  }
1049 
1050  // test if env variable contained full path to text editor executable
1051  if (FileSystem::fileIsExecutable(editor)) {
1052  return editor;
1053  }
1054 
1055  // EDITOR and VISUAL doesn't have to contain full path
1056  // so let's search PATH enviroment variable to get the full path
1057  std::string testEditor = "";
1058  vector<std::string> paths;
1059  parsePathEnvVariable(paths);
1060  for (unsigned int i = 0; i < paths.size(); ++i) {
1061  testEditor = paths.at(i) + DS + editor;
1062  if (FileSystem::fileIsExecutable(testEditor)) {
1063  return testEditor;
1064  }
1065  }
1066 
1067  // no editor were found
1068  return "";
1069 }

References DS, environmentVariable(), FileSystem::fileIsExecutable(), findExecutableFromPATH(), and parsePathEnvVariable().

Here is the call graph for this function:

◆ developerMode()

bool Environment::developerMode ( )
static

Returns true in case TCE is running in developer mode.

The developer mode can be enabled by setting environment variable TCE_DEVEL_MODE to 1 and causes the following differences at TCE runtime:

  • build directories are used as various search paths instead of installation prefix paths
  • debug output printed to stderr

Definition at line 1166 of file Environment.cc.

1166  {
1168  return developerMode_;
1169 }

References developerMode_, and initialize().

Referenced by OperationBuilder::buildObject(), codeCompressorPaths(), confPath(), defaultSchedulerConf(), estimatorPluginPaths(), explorerPluginPaths(), hdbPaths(), icDecoderPluginPaths(), implementationTesterTemplatePaths(), includeDirPaths(), Application::initialize(), Application::isInstalled(), minimalADF(), oldGccSchedulerConf(), osalPaths(), pdfManual(), schedulerPluginPaths(), tceCompiler(), and vhdlPaths().

Here is the call graph for this function:

◆ environmentVariable()

string Environment::environmentVariable ( const std::string &  variable)
static

Returns the value of the given environment variable.

An empty string is returned if the variable does not exist.

Parameters
variableThe environment variable whose value is required.
Returns
The value of the environment variable.

Definition at line 406 of file Environment.cc.

406  {
407 
408  char* varValue = getenv(variable.c_str());
409  if (varValue == NULL) {
410  return "";
411  }
412 
413  return varValue;
414 }

Referenced by OperationBuilder::buildObject(), CompiledSimCompiler::CompiledSimCompiler(), ConflictDetectionCodeGenerator::ConflictDetectionCodeGenerator(), defaultTextEditorPath(), UserManualCmd::Do(), initialize(), Application::installationDir(), osalPaths(), parsePathEnvVariable(), and QuartusProjectGenerator::writeScripts().

◆ errorLogFilePath()

string Environment::errorLogFilePath ( )
static

Tries to locate the error log file on system.

Returns the first absolute path where the file is found. If the file is not found and directory for the error log file is given, the directory and the error log file is created. If creation fails, an empty string is returned.

Returns
The path of the error log file.

Definition at line 323 of file Environment.cc.

323  {
324  initialize();
325  pathsToUse_.assign(errorPaths_.begin(), errorPaths_.end());
326  string errorPath = pathTo(ERROR_LOG_FILE_NAME_);
327  if (errorPath == "" && newErrorLogFileDir_ != "") {
329  string filePath = newErrorLogFileDir_ +
331  if (FileSystem::createFile(filePath)) {
332  return filePath;
333  }
334  }
335  }
336  return errorPath;
337 }

References FileSystem::createDirectory(), FileSystem::createFile(), FileSystem::DIRECTORY_SEPARATOR, ERROR_LOG_FILE_NAME_, errorPaths_, initialize(), newErrorLogFileDir_, pathsToUse_, and pathTo().

Referenced by Application::initialize().

Here is the call graph for this function:

◆ estimatorPluginPaths()

vector< string > Environment::estimatorPluginPaths ( )
static

Returns the paths in which estimator plugins are searched.

Returns
The paths in which estimator plugins are searched.

Definition at line 842 of file Environment.cc.

842  {
843 
844  vector<string> paths;
845  string base = Application::installationDir() + string(INSTALLATION_DIR) +
846  "cost_estimator_plugins";
847  string baseRF = Application::installationDir() + string(INSTALLATION_DIR) +
848  "cost_estimator_plugins/rf";
849  string baseFU = Application::installationDir() + string(INSTALLATION_DIR) +
850  "cost_estimator_plugins/fu";
851  string personal = FileSystem::homeDirectory() + DS + ".openasip" + DS +
852  "cost_estimator_plugins";
853  string custom = string(TCE_SRC_ROOT) + DS + "cost_estimator_plugins";
854  string cwd = FileSystem::currentWorkingDir();
855  string data = FileSystem::currentWorkingDir() + DS + "data";
856 
858  paths.push_back(custom);
859  } else {
860  paths.push_back(base);
861  paths.push_back(baseRF);
862  paths.push_back(baseFU);
863  }
864  paths.push_back(personal);
865  paths.push_back(cwd);
866  paths.push_back(data);
867  return paths;
868 }

References FileSystem::currentWorkingDir(), developerMode(), DS, FileSystem::homeDirectory(), INSTALLATION_DIR, and Application::installationDir().

Here is the call graph for this function:

◆ explorerPluginPaths()

vector< string > Environment::explorerPluginPaths ( )
static

Returns the paths in which explorer plugins are searched.

Returns
The paths in which explorer plugins are searched.

Definition at line 809 of file Environment.cc.

809  {
810 
811  vector<string> paths;
812 
814  string srcBase = string(TCE_SRC_ROOT) + DS + "explorer";
815  paths.push_back(srcBase);
816  } else {
817  string base = Application::installationDir() + string(INSTALLATION_DIR) +
818  "explorer" + DS + "base";
819  paths.push_back(base);
820 
821  string personal = FileSystem::homeDirectory() + DS + ".openasip" + DS +
822  "explorer";
823  paths.push_back(personal);
824  }
825 
826  string cwd = FileSystem::currentWorkingDir();
827  paths.push_back(cwd);
828 
829  string data = FileSystem::currentWorkingDir() + DS + "data";
830  paths.push_back(data);
831 
832  return paths;
833 }

References FileSystem::currentWorkingDir(), developerMode(), DS, FileSystem::homeDirectory(), INSTALLATION_DIR, and Application::installationDir().

Referenced by DesignSpaceExplorer::getPlugins(), DesignSpaceExplorer::loadExplorerPlugin(), and printPlugins().

Here is the call graph for this function:

◆ findExecutableFromPATH()

std::string Environment::findExecutableFromPATH ( const std::vector< std::string > &  execs)
staticprivate

Finds a first match of a given list of files from PATH env variable.

Finds a first executable match of a given list of files from paths in the PATH environment variable.

Parameters
execsA list of file names, that are to be searched from PATH.
Returns
Full path of the executable found or a zero length string, in case nothing was found.

Definition at line 1109 of file Environment.cc.

1109  {
1110  vector<std::string> paths;
1111  parsePathEnvVariable(paths);
1112  for (unsigned int i = 0; i < paths.size(); ++i) {
1113  for (unsigned int j = 0; j < execs.size(); ++j) {
1114  std::string exec = paths.at(i) + DS + execs.at(j);
1115  if (FileSystem::fileIsExecutable(exec)) {
1116  return exec;
1117  }
1118  }
1119  }
1120  return "";
1121 }

References DS, FileSystem::fileIsExecutable(), and parsePathEnvVariable().

Referenced by defaultTextEditorPath().

Here is the call graph for this function:

◆ hdbPaths()

std::vector< std::string > Environment::hdbPaths ( bool  libraryPathsOnly = false)
static

Returns the paths in which hardware databases are searched.

Parameters
libraryPathsOnlyWhen set to true, excludes CWD from search paths.
Returns
The paths in which hardware databases are searched.

Definition at line 683 of file Environment.cc.

683  {
684 
685  vector<string> paths;
687  string srcBase = string(TCE_SRC_ROOT) + DS + "hdb";
688  paths.push_back(srcBase);
689  } else {
690  string instBase = Application::installationDir() +
691  string(INSTALLATION_DIR) + "hdb";
692  paths.push_back(instBase);
693  }
694  if (!libraryPathsOnly) {
695  string cwd = FileSystem::currentWorkingDir();
696  paths.push_back(cwd);
697  paths.push_back(cwd + DS + "data");
698  }
699  return paths;
700 }

References FileSystem::currentWorkingDir(), developerMode(), DS, INSTALLATION_DIR, and Application::installationDir().

Referenced by IDF::MachineImplementation::checkImplFiles(), ProcessorImplementationWindow::doSaveIDF(), FUGen::findAbsolutePath(), Automagic::findHDBPath(), ProGeTools::findHDBPath(), IDF::UnitImplementationLocation::hdbFile(), IDF::MachineImplementation::icDecoderHDB(), IDF::MachineImplementation::isLibraryImplFile(), HDB::HDBRegistry::loadFromSearchPaths(), main(), IDF::MachineImplementation::makeHDBPathRelative(), IDF::MachineImplementation::makeImplFilesRelative(), IDF::MachineImplementation::setICDecoderHDB(), and AddIUFromHDBDialog::TransferDataToWindow().

Here is the call graph for this function:

◆ hwModulePaths()

std::vector< std::string > Environment::hwModulePaths ( )
static

Returns the paths in which hardware modules are searched.

Returns
The paths in which hardware modules are searched.

Definition at line 669 of file Environment.cc.

669  {
670  vector<string> paths;
671  paths.push_back(FileSystem::currentWorkingDir());
672  return paths;
673 }

References FileSystem::currentWorkingDir().

Here is the call graph for this function:

◆ icDecoderPluginPaths()

vector< string > Environment::icDecoderPluginPaths ( bool  libraryPathsOnly = false)
static

Returns the paths in which IC/decoder plugins are searched.

Parameters
libraryPathsOnlySet to true excludes CWD from search paths.
Returns
The paths in which IC/decoder plugins are searched.

Definition at line 635 of file Environment.cc.

635  {
636 
637  vector<string> paths;
638 
639  string base = Application::installationDir() + string(INSTALLATION_DIR) +
640  "icdecoder_plugins" + DS + "base";
641  string custom = Application::installationDir() + string(INSTALLATION_DIR)+
642  "icdecoder_plugins" + DS + "custom";
643  string personal = FileSystem::homeDirectory() + DS + ".openasip" + DS +
644  "icdecoder_plugins";
645  string cwd = FileSystem::currentWorkingDir();
646  string data = cwd + DS + "data";
648  // first find from the src tree to make the system tests etc.
649  // to test the plugins in source base, not the installed plugins
650  string path = string(TCE_SRC_ROOT) + DS + "icdecoder_plugins";
651  paths.push_back(path);
652  } else {
653  paths.push_back(base);
654  paths.push_back(personal);
655  paths.push_back(custom);
656  }
657  if (!libraryPathsOnly) paths.push_back(cwd);
658  if (!libraryPathsOnly) paths.push_back(data);
659  return paths;
660 }

References FileSystem::currentWorkingDir(), developerMode(), DS, FileSystem::homeDirectory(), INSTALLATION_DIR, and Application::installationDir().

Referenced by IDF::MachineImplementation::checkImplFiles(), defaultICDecoderPlugin(), IDF::MachineImplementation::icDecoderPluginFile(), IDF::MachineImplementation::isLibraryImplFile(), GenerateProcessor::listICDecPluginParameters(), GenerateProcessorDialog::loadICDecoderGeneratorPlugin(), ProGe::ProGeUI::loadICDecoderGeneratorPlugin(), ProcessorImplementationWindow::loadICDecoderPlugin(), IDF::MachineImplementation::makeImplFilesRelative(), ComponentImplementationSelector::selectComponents(), and IDF::MachineImplementation::setICDecoderPluginFile().

Here is the call graph for this function:

◆ iconDirPath()

string Environment::iconDirPath ( )
static

Tries to locate the directory where common toolbar icon files are stored.

Returns the first absolute path of the directory where the file is found. If icons directory is not found and a new directory is given, it is created. If creation fails, an empty string is returned.

Returns
The path of the icons directory.

Definition at line 225 of file Environment.cc.

225  {
226  initialize();
229  pathsToUse_.assign(bitmapsPaths_.begin(), bitmapsPaths_.end());
230  string iconPath = pathTo(path);
231  if (iconPath == "" && newIconFileDir_ != "") {
233  return newIconFileDir_;
234  }
235  }
236  return iconPath;
237 }

References bitmapsPaths_, FileSystem::createDirectory(), DATA_DIR_NAME_, FileSystem::DIRECTORY_SEPARATOR, ICON_DIR_NAME_, initialize(), newIconFileDir_, pathsToUse_, and pathTo().

Referenced by AddFUFromHDBDialog::AddFUFromHDBDialog(), AddIUFromHDBDialog::AddIUFromHDBDialog(), AddRFFromHDBDialog::AddRFFromHDBDialog(), MainFrame::createToolbar(), and ProximMainFrame::createToolbar().

Here is the call graph for this function:

◆ implementationTesterTemplatePaths()

std::vector< std::string > Environment::implementationTesterTemplatePaths ( )
static

Returns full paths to implementation tester vhdl testbench template directory

Returns
Paths to testbench templates

Definition at line 1129 of file Environment.cc.

1129  {
1130  std::vector<std::string> paths;
1132  string path = string(TCE_SRC_ROOT) + DS + "data" + DS + "hdb";
1133  paths.push_back(path);
1134  }
1135  string path = Application::installationDir() + string(INSTALLATION_DIR) +
1136  "data" + DS + "hdb";
1137  paths.push_back(path);
1138  return paths;
1139 }

References developerMode(), DS, INSTALLATION_DIR, and Application::installationDir().

Referenced by TestbenchGenerator::findVhdlTemplate().

Here is the call graph for this function:

◆ includeDirPaths()

std::vector< std::string > Environment::includeDirPaths ( )
static

Returns path where installable tce include headers reside.

The list returned contains both post-installation paths and the paths to the original header files found in the source tree.

Returns
Paths where tce installable headers files reside.

Definition at line 348 of file Environment.cc.

348  {
349  vector<string> includes;
350  const std::string ROOT = string(TCE_SRC_ROOT);
351  const std::string BASE = ROOT + DS + "src" + DS + "base";
352  const std::string APPLIBS = ROOT + DS + "src" + DS + "applibs";
353  const std::string BLD = string(TCE_BLD_ROOT);
354 
356  includes.push_back(ROOT);
357  includes.push_back(ROOT + DS + "src" + DS + "tools");
358  includes.push_back(BASE + DS + "osal");
359  includes.push_back(BASE + DS + "memory");
360  includes.push_back(BASE + DS + "bem");
361  includes.push_back(BASE + DS + "Graph");
362  includes.push_back(BASE + DS + "idf");
363  includes.push_back(BASE + DS + "mach");
364  includes.push_back(BASE + DS + "program");
365  includes.push_back(BASE + DS + "tpef");
366  includes.push_back(BASE + DS + "umach");
367  includes.push_back(APPLIBS + DS + "Simulator");
368  includes.push_back(APPLIBS + DS + "mach");
369  includes.push_back(APPLIBS + DS + "FSA");
370  includes.push_back(TCE_BLD_ROOT);
371  } else {
372  includes.push_back(Application::installationDir() + DS + "include");
373  }
374 
375  return includes;
376 }

References developerMode(), DS, and Application::installationDir().

Referenced by OperationBuilder::buildObject(), CompiledSimCompiler::compileFile(), and CompiledSimCodeGenerator::generateMakefile().

Here is the call graph for this function:

◆ initialize()

void Environment::initialize ( )
static

Initializes the program environment.

Initializes all of the source directories the program needs.

Definition at line 95 of file Environment.cc.

95  {
96 
97  if (initialized_) {
98  return;
99  }
100 
102  Environment::environmentVariable("TCE_DEVEL_MODE") == "1";
103 
104  errorPaths_.push_back(
106  FileSystem::DIRECTORY_SEPARATOR + string(".openasip"));
107 
108  if (developerMode_) {
109  schemaPaths_.push_back(string(TCE_SRC_ROOT));
110  iconPaths_.push_back(string(TCE_SRC_ROOT));
111  dataPaths_.push_back(string(TCE_SRC_ROOT));
112  bitmapsPaths_.push_back(string(TCE_SRC_ROOT));
113  manPaths_.push_back(
114  string(TCE_SRC_ROOT) +
115  FileSystem::DIRECTORY_SEPARATOR + string("doc"));
116  } else {
117  string instDir =
119  schemaPaths_.push_back(instDir);
120  iconPaths_.push_back(instDir);
121  dataPaths_.push_back(instDir);
122  bitmapsPaths_.push_back(instDir);
123  manPaths_.push_back(instDir);
124  }
125 
126  string traceEnv = environmentVariable("TTASIM_TRACE_DIR");
127  if (traceEnv != "") {
128  if (!FileSystem::fileExists(traceEnv)) {
129  if (!FileSystem::createDirectory(traceEnv)) {
130  traceEnv = "";
131  }
132  }
133  }
134  simTraceDir_ = traceEnv;
135 
136  initialized_ = true;
137 }

References bitmapsPaths_, FileSystem::createDirectory(), dataPaths_, developerMode_, FileSystem::DIRECTORY_SEPARATOR, environmentVariable(), errorPaths_, FileSystem::fileExists(), FileSystem::homeDirectory(), iconPaths_, initialized_, INSTALLATION_DIR, Application::installationDir(), manPaths_, schemaPaths_, and simTraceDir_.

Referenced by bitmapsDirPath(), confPath(), dataDirPath(), developerMode(), errorLogFilePath(), iconDirPath(), manDirPath(), schemaDirPath(), and simTraceDirPath().

Here is the call graph for this function:

◆ llvmtceCachePath()

string Environment::llvmtceCachePath ( )
static

Returns full path to the default LLVM backend plugin cache directory.

Definition at line 1087 of file Environment.cc.

1087  {
1088 
1089  std::string path =
1091  FileSystem::DIRECTORY_SEPARATOR + string(".openasip") +
1092  FileSystem::DIRECTORY_SEPARATOR + string("tcecc") +
1093  FileSystem::DIRECTORY_SEPARATOR + string("cache");
1094 
1095  return path;
1096 }

References FileSystem::DIRECTORY_SEPARATOR, and FileSystem::homeDirectory().

Referenced by LLVMTCECmdLineOptions::backendCacheDir(), and LLVMBackend::LLVMBackend().

Here is the call graph for this function:

◆ longHDBPath()

TCEString Environment::longHDBPath ( const TCEString hdbPath)
static

Undoes the shortening done by shortHDBPath

Definition at line 731 of file Environment.cc.

731  {
732  string sourceRoot = string("<source tree>") + DS;
733  string installRoot = string("<install directory>") + DS;
734  string cwd = string(".") + DS;
735 
736  TCEString longPath = hdbPath;
737  if (hdbPath.startsWith(sourceRoot)) {
738  int rootPathLength = sourceRoot.length();
739  longPath = string(TCE_SRC_ROOT) + DS + hdbPath.substr(rootPathLength);
740  } else if (hdbPath.startsWith(installRoot)) {
741  int installDirLength = installRoot.length();
742  longPath = Application::installationDir() + DS +
743  hdbPath.substr(installDirLength);
744  } else if (hdbPath.startsWith(cwd)) {
745  int cwdLength = cwd.length();
746  longPath = FileSystem::currentWorkingDir() + DS +
747  hdbPath.substr(cwdLength);
748  }
749  return longPath;
750 }

References FileSystem::currentWorkingDir(), DS, Application::installationDir(), and TCEString::startsWith().

Referenced by BlockImplementationDialog::doOK(), AutoSelectImplementationsDialog::onFind(), and BlockImplementationDialog::onHDBSelection().

Here is the call graph for this function:

◆ manDirPath()

string Environment::manDirPath ( const std::string &  prog)
static

Tries to locate the directory where the system's manual is stored.

Returns the first absolute path of the directory where the file is found. If no directory is found and a new directory for manual is given, it is created. If creation fails, an empty string is returned.

Parameters
progThe program whose manual directory is searched.
Returns
The path of the manual directory.

Definition at line 250 of file Environment.cc.

250  {
251  initialize();
252  string path = MAN_DIR_NAME_ + FileSystem::DIRECTORY_SEPARATOR + prog;
253  pathsToUse_.assign(manPaths_.begin(), manPaths_.end());
254  string manPath = pathTo(path);
255  if (manPath == "" && newManFileDir_ != "") {
257  return newManFileDir_;
258  }
259  }
260  return manPath;
261 }

References FileSystem::createDirectory(), FileSystem::DIRECTORY_SEPARATOR, initialize(), MAN_DIR_NAME_, manPaths_, newManFileDir_, pathsToUse_, and pathTo().

Referenced by OSEdUserManualCmd::userManual().

Here is the call graph for this function:

◆ minimalADF()

string Environment::minimalADF ( )
static

Returns the full path to the minimal.adf.

Definition at line 901 of file Environment.cc.

901  {
902 
904  std::string srcPath =
905  string(TCE_SRC_ROOT) + FileSystem::DIRECTORY_SEPARATOR +
907 
908  assert(
909  FileSystem::fileExists(srcPath) &&
910  "Installation broken, minimal.adf not found");
911  return srcPath;
912  } else {
913  std::string path = Application::installationDir() +
915 
916  assert(
917  FileSystem::fileExists(path) &&
918  "Installation broken, minimal.adf not found");
919  return path;
920  }
921 }

References assert, developerMode(), FileSystem::DIRECTORY_SEPARATOR, FileSystem::fileExists(), INSTALLATION_DIR, Application::installationDir(), MINIMAL_ADF_INSTALLED, and MINIMAL_ADF_SRC.

Referenced by MinimalOpSetCheck::buildMinimalOpSet(), and MinimalOpSetCheck::fix().

Here is the call graph for this function:

◆ oldGccSchedulerConf()

string Environment::oldGccSchedulerConf ( )
static

Returns full path to the old gcc scheduler pass configuration file.

This is the scheduler conf that is used to schedule code from the old gcc compiler.

Returns
Full path to the old_gcc.conf

Definition at line 986 of file Environment.cc.

986  {
987 
989  // first find from the src tree
990  std::string srcPath =
991  string(TCE_SRC_ROOT) + "/scheduler/passes/old_gcc.conf";
992  assert(
993  FileSystem::fileExists(srcPath) &&
994  "Build broken, old_gcc.conf not found.");
995  return srcPath;
996  } else {
997  std::string path = Application::installationDir() +
998  string(INSTALLATION_DIR) + "/scheduler/passes/old_gcc.conf";
999  assert(
1000  FileSystem::fileExists(path) &&
1001  "Installation broken, old_gcc.conf not found.");
1002  return path;
1003  }
1004 }

References assert, developerMode(), FileSystem::fileExists(), INSTALLATION_DIR, and Application::installationDir().

Here is the call graph for this function:

◆ opsetIncludeDir()

vector< string > Environment::opsetIncludeDir ( )
static

Returns the include dir needed to build base opset in compiling the distributed version of TCE

Definition at line 384 of file Environment.cc.

384  {
385  string BASE = TCE_SRC_ROOT + DS + "src" + DS + "base";
386 
387  vector<string> includePaths;
388  includePaths.push_back(BASE + DS + "osal ");
389  includePaths.push_back(BASE + DS + "tpef ");
390  includePaths.push_back(BASE + DS + "memory ");
391  includePaths.push_back(TCE_SRC_ROOT + DS + "src" + DS + "tools");
392  includePaths.push_back(TCE_SRC_ROOT);
393 
394  return includePaths;
395 }

References DS.

Referenced by OperationBuilder::buildObject().

◆ osalPaths()

vector< string > Environment::osalPaths ( )
static

Returns the paths in which operation set files are searched.

The paths are returned in the order of preference. The user can override global operation definitions by redefining them in a local search path.

Returns
The paths in which operations are searched.

Definition at line 519 of file Environment.cc.

519  {
520 
521  vector<string> paths;
522 
523  // ./data
524  string data = FileSystem::currentWorkingDir() + DS + "data";
525 
526  // tce/opset/base -- these are needed during newlib build,
527  // specifically STDOUT is needed to build puts() correctly.
528  string src = string(TCE_BLD_ROOT) + DS + "opset" + DS + "base";
529 
530  // default path for predefined and "standard" operations
531  string basePath =
532  Application::installationDir() + string(INSTALLATION_DIR) + "opset" +
533  DS + "base";
534  // path for user-local custom operations
535  string userPath =
536  FileSystem::homeDirectory() + DS + ".openasip" + DS + "opset" +
537  DS + "custom";
538  // path for system-wide, shared custom operations
539  string customPath =
540  Application::installationDir() + string(INSTALLATION_DIR) + "opset" +
541  DS + "custom";
542  // search path taken from environment
543  string envPath = Environment::environmentVariable("TCE_OSAL_PATH");
544  envPath = FileSystem::absolutePathOf(envPath);
545  // as a last resort fall-back, operations are always searched in
546  // in current working directory
547  string cwd = FileSystem::currentWorkingDir();
548 
549  if (envPath != "")
550  VectorTools::insertUnique(paths, envPath);
551  VectorTools::insertUnique(paths, cwd);
552  VectorTools::insertUnique(paths, data);
554  VectorTools::insertUnique(paths, src);
555  } else {
556  VectorTools::insertUnique(paths, userPath);
557  VectorTools::insertUnique(paths, customPath);
558  VectorTools::insertUnique(paths, basePath);
559  }
560 
561  return paths;
562 }

References FileSystem::absolutePathOf(), FileSystem::currentWorkingDir(), developerMode(), DS, environmentVariable(), FileSystem::homeDirectory(), VectorTools::insertUnique(), INSTALLATION_DIR, and Application::installationDir().

Referenced by OSEdTreeView::constructTree(), OperationContainer::operationIndex(), OperationPoolPimpl::OperationPoolPimpl(), OSEdInfoView::pathView(), and OperationBuilder::xmlFilePath().

Here is the call graph for this function:

◆ parsePathEnvVariable()

void Environment::parsePathEnvVariable ( std::vector< std::string > &  paths)
inlinestaticprivate

Returns Paths in PATH environment variable.

Returns
Paths in PATH environment variable.

Definition at line 1077 of file Environment.cc.

1077  {
1078 
1079  std::string pathsEnv = environmentVariable("PATH");
1080  StringTools::chopString(pathsEnv, ":", paths);
1081 }

References StringTools::chopString(), and environmentVariable().

Referenced by defaultTextEditorPath(), and findExecutableFromPATH().

Here is the call graph for this function:

◆ pathTo()

string Environment::pathTo ( const std::string &  name)
staticprivate

Tries to locate the given directory or file on system.

Returns the first absolute path of the directory if the directory/file is found. In case the directory/file is not found in any of the search paths, returns an empty string.

@fixme this is not thread safe due to the use of pathsToUse_ member variable for data passing!

Parameters
nameThe name of the searched directory/file.
Returns
The path of the directory/file.

Definition at line 444 of file Environment.cc.

444  {
445 
446  // test the stored paths and try to open the file
447  for (unsigned int i = 0; i < pathsToUse_.size(); ++i) {
448  string path =
450 
451  if (FileSystem::fileExists(path)) {
452  return path;
453  }
454  }
455 
456  return "";
457 }

References FileSystem::DIRECTORY_SEPARATOR, FileSystem::fileExists(), and pathsToUse_.

Referenced by bitmapsDirPath(), dataDirPath(), errorLogFilePath(), iconDirPath(), manDirPath(), and schemaDirPath().

Here is the call graph for this function:

◆ pdfManual()

string Environment::pdfManual ( )
static

Returns full path to the TCE .pdf manual.

Returns
Full path to the TCE manual pdf.

Definition at line 877 of file Environment.cc.

877  {
878 
880  std::string srcPath =
881  string(TCE_SRC_ROOT) + FileSystem::DIRECTORY_SEPARATOR +
883  assert(
884  FileSystem::fileExists(srcPath) &&
885  "Installation broken, minimal.adf not found");
886  return srcPath;
887  } else {
888  std::string path = Application::installationDir() +
890 
891  if (!FileSystem::fileExists(path))
892  debugLog("Installation broken, manual not found");
893  return path;
894  }
895 }

References assert, debugLog, developerMode(), FileSystem::DIRECTORY_SEPARATOR, FileSystem::fileExists(), INSTALLATION_DIR, Application::installationDir(), PDF_MANUAL_INSTALLED, and PDF_MANUAL_SRC.

Referenced by UserManualCmd::askFromUser(), and UserManualCmd::Do().

Here is the call graph for this function:

◆ schedulerPluginPaths()

vector< string > Environment::schedulerPluginPaths ( )
static

Returns the paths in which scheduler plugins are searched.

Returns
The paths in which scheduler plugins are searched.

Definition at line 601 of file Environment.cc.

601  {
602 
603  vector<string> paths;
604 
605  string base = Application::installationDir() + string(INSTALLATION_DIR) +
606  "scheduler" + DS + "passes";
607 
608  string personal = FileSystem::homeDirectory() + DS + ".openasip" + DS +
609  "scheduler" + DS + "passes";
610 
611  string srcBase = string(TCE_SRC_ROOT) + DS + "scheduler" + DS + "passes";
612 
613  string cwd = FileSystem::currentWorkingDir();
614 
616  // first find from the src tree to make the system tests etc.
617  // to test the plugins in source base, not the installed plugins
618  paths.push_back(srcBase);
619  } else {
620  paths.push_back(base);
621  paths.push_back(personal);
622  }
623  paths.push_back(cwd);
624 
625  return paths;
626 }

References FileSystem::currentWorkingDir(), developerMode(), DS, FileSystem::homeDirectory(), INSTALLATION_DIR, and Application::installationDir().

Here is the call graph for this function:

◆ schemaDirPath()

string Environment::schemaDirPath ( const std::string &  prog)
static

Tries to locate the directory where the XML Schema file is stored.

Returns the first absolute path of the directory where the file is found. If directory for new data file is given, it is created and returned. If the directory can not be created, an empty string is returned.

Parameters
progThe program whose Schema is searched.
Returns
The path of the Schema directory.

Definition at line 151 of file Environment.cc.

151  {
152  initialize();
153  string path = SCHEMA_DIR_NAME_ + FileSystem::DIRECTORY_SEPARATOR + prog;
154  pathsToUse_.assign(schemaPaths_.begin(), schemaPaths_.end());
155  string schemaPath = pathTo(path);
156  if (schemaPath == "" && newSchemaFileDir_ != "") {
158  return newSchemaFileDir_;
159  }
160  }
161  return schemaPath;
162 }

References FileSystem::createDirectory(), FileSystem::DIRECTORY_SEPARATOR, initialize(), newSchemaFileDir_, pathsToUse_, pathTo(), SCHEMA_DIR_NAME_, and schemaPaths_.

Referenced by ADFSerializer::ADFSerializer(), BEMSerializer::BEMSerializer(), IDF::IDFSerializer::IDFSerializer(), and OperationSerializer::OperationSerializer().

Here is the call graph for this function:

◆ setNewBitmapsFileDir()

void Environment::setNewBitmapsFileDir ( const std::string &  path)
static

Sets the value for new bitmaps file directory.

Parameters
pathThe path for new bitmaps directory.

Definition at line 485 of file Environment.cc.

485  {
486  newBitmapsFileDir_ = path;
487 }

References newBitmapsFileDir_.

◆ setNewDataFileDir()

void Environment::setNewDataFileDir ( const std::string &  path)
static

Sets the value for new data file directory

Parameters
pathThe path of new data file directory.

Definition at line 475 of file Environment.cc.

475  {
476  newDataFileDir_ = path;
477 }

References newDataFileDir_.

◆ setNewErrorLogFileDir()

void Environment::setNewErrorLogFileDir ( const std::string &  path)
static

Sets the path for new error log file directory.

Parameters
pathThe path of new error log file directory.

Definition at line 505 of file Environment.cc.

505  {
506  newErrorLogFileDir_ = path;
507 }

References newErrorLogFileDir_.

◆ setNewManFileDir()

void Environment::setNewManFileDir ( const std::string &  path)
static

Sets the path for new manual file directory.

Parameters
pathThe path of new manual file directory.

Definition at line 495 of file Environment.cc.

495  {
496  newManFileDir_ = path;
497 }

References newManFileDir_.

◆ setNewSchemaFileDir()

void Environment::setNewSchemaFileDir ( const std::string &  path)
static

Sets the value for new schema file directory.

Parameters
pathThe path of new schema file directory.

Definition at line 465 of file Environment.cc.

465  {
466  newSchemaFileDir_ = path;
467 }

References newSchemaFileDir_.

◆ shortHDBPath()

TCEString Environment::shortHDBPath ( const TCEString hdbPath)
static

Shortens the given HDB path by replacing source tree, install directory or current working directory paths with human-readable aliases.

Definition at line 707 of file Environment.cc.

707  {
708  string sourceRoot = string(TCE_SRC_ROOT) + DS;
709  string installRoot = Application::installationDir() + DS;
710  string cwd = FileSystem::currentWorkingDir() + DS;
711 
712  TCEString shortPath = hdbPath;
713  if (hdbPath.startsWith(sourceRoot)) {
714  int rootPathLength = sourceRoot.length();
715  shortPath = "<source tree>" + DS + hdbPath.substr(rootPathLength);
716  } else if (hdbPath.startsWith(installRoot)) {
717  int installDirLength = installRoot.length();
718  shortPath = "<install directory>" + DS +
719  hdbPath.substr(installDirLength);
720  } else if (hdbPath.startsWith(cwd)) {
721  int cwdLength = cwd.length();
722  shortPath = "." + DS + hdbPath.substr(cwdLength);
723  }
724  return shortPath;
725 }

References FileSystem::currentWorkingDir(), DS, Application::installationDir(), and TCEString::startsWith().

Referenced by AutoSelectImplementationsDialog::AutoSelectImplementationsDialog(), BlockImplementationDialog::BlockImplementationDialog(), BlockImplementationDialog::onBrowse(), AutoSelectImplementationsDialog::onBrowse(), ProcessorImplementationWindow::updateFUList(), ProcessorImplementationWindow::updateImplementationLists(), and ProcessorImplementationWindow::updateRFList().

Here is the call graph for this function:

◆ simTraceDirPath()

string Environment::simTraceDirPath ( )
static

Returns full path to ttasim trace dir if set using TTASIM_TRACE_DIR environment variable

Return full path to ttasim trace dir location if environment variable TTASIM_TRACE_DIR is pointing to valid dir. Empty string otherwise.

Definition at line 1149 of file Environment.cc.

1149  {
1150  initialize();
1151  return simTraceDir_;
1152 }

References initialize(), and simTraceDir_.

Referenced by SimulatorFrontend::loadProgram().

Here is the call graph for this function:

◆ tceCompiler()

string Environment::tceCompiler ( )
static
Returns
Full path to the tce compiler tcecc.

Definition at line 928 of file Environment.cc.

928  {
929 
931  std::string srcPath =
932  string(TCE_SRC_ROOT) + "/src/bintools/Compiler/oacc";
933 
934  std::string llvmTceSrcPath =
935  string(TCE_SRC_ROOT) + "/src/bintools/Compiler/llvm-tce/llvm-tce";
936 
937  assert(FileSystem::fileExists(srcPath) &&
938  FileSystem::fileExists(llvmTceSrcPath) &&
939  "Build broken, compiler paths not found.");
940  return srcPath;
941  } else {
942  std::string path = Application::installationDir() + "/bin/oacc";
943  assert(
944  FileSystem::fileExists(path) &&
945  "Installation broken: oacc not found.");
946  return path;
947  }
948 }

References assert, developerMode(), FileSystem::fileExists(), and Application::installationDir().

Referenced by CompileTools::compileAsC(), CompileTools::compileAsLLVM(), and DesignSpaceExplorer::schedule().

Here is the call graph for this function:

◆ userConfPath()

TCEString Environment::userConfPath ( const std::string &  fileName)
static

Definition at line 303 of file Environment.cc.

303  {
304  TCEString userConf =
305  FileSystem::homeDirectory() + DS + ".openasip" + DS + fileName;
306  if (!FileSystem::fileExists(userConf)) {
307  FileSystem::createFile(userConf);
308  }
309  return userConf;
310 }

References FileSystem::createFile(), DS, FileSystem::fileExists(), and FileSystem::homeDirectory().

Referenced by OSEd::createDefaultOptions(), Proxim::createDefaultOptions(), SaveOptionsCmd::Do(), ProximQuitCmd::Do(), and OSEdOptionsDialog::onSave().

Here is the call graph for this function:

◆ vhdlPaths()

std::vector< std::string > Environment::vhdlPaths ( const std::string &  hdbPath)
static

Returns the paths in which VHDL files are searched for.

Parameters
hdbPathThe path where the HDB file is, to be added to the search paths.
Returns
The paths in which VHDL files are searched for.

Definition at line 760 of file Environment.cc.

760  {
761 
762  vector<string> paths;
763 
764  // Drop the name of hdb file from hdb path
765  string hdbDir = FileSystem::directoryOfPath(hdbPath);
766  paths.push_back(hdbDir);
767  paths.push_back(hdbDir + DS + "vhdl");
768 
770  string srcBase = string(TCE_SRC_ROOT) + DS + "hdb";
771  paths.push_back(srcBase);
772  paths.push_back(srcBase + DS + "vhdl");
773  } else {
774  string srcBase = Application::installationDir() +
775  string(INSTALLATION_DIR) + "hdb";
776  paths.push_back(srcBase);
777  paths.push_back(srcBase + DS + "vhdl");
778  }
779  string cwd = FileSystem::currentWorkingDir();
780  paths.push_back(cwd);
781  paths.push_back(cwd + DS + "data");
782  return paths;
783 }

References FileSystem::currentWorkingDir(), developerMode(), FileSystem::directoryOfPath(), DS, INSTALLATION_DIR, and Application::installationDir().

Referenced by ProGe::BlockSourceCopier::copyFiles(), BlockImplementationFileDialog::onBrowse(), and BlockImplementationFileDialog::onOK().

Here is the call graph for this function:

Member Data Documentation

◆ BITMAPS_DIR_NAME_

const string Environment::BITMAPS_DIR_NAME_ = "bitmaps"
staticprivate

Name of the bitmaps directory.

Definition at line 117 of file Environment.hh.

Referenced by bitmapsDirPath().

◆ bitmapsPaths_

vector< string > Environment::bitmapsPaths_
staticprivate

Bitmaps directory search paths.

Definition at line 136 of file Environment.hh.

Referenced by bitmapsDirPath(), iconDirPath(), and initialize().

◆ CONF_DIR_NAME_

const string Environment::CONF_DIR_NAME_ = "conf"
staticprivate

Name of the configuration directory.

Definition at line 121 of file Environment.hh.

Referenced by confPath().

◆ DATA_DIR_NAME_

const string Environment::DATA_DIR_NAME_ = "data"
staticprivate

Name of the data directory.

Definition at line 115 of file Environment.hh.

Referenced by bitmapsDirPath(), dataDirPath(), and iconDirPath().

◆ dataPaths_

vector< string > Environment::dataPaths_
staticprivate

Data directory search paths.

Definition at line 134 of file Environment.hh.

Referenced by dataDirPath(), and initialize().

◆ developerMode_

bool Environment::developerMode_ = false
staticprivate

Flag indicating whether TCE is executing in developer mode.

Definition at line 129 of file Environment.hh.

Referenced by developerMode(), and initialize().

◆ ERROR_LOG_FILE_NAME_

const string Environment::ERROR_LOG_FILE_NAME_ = "error_log.log"
staticprivate

Name of the system error log file.

Definition at line 125 of file Environment.hh.

Referenced by errorLogFilePath().

◆ errorPaths_

vector< string > Environment::errorPaths_
staticprivate

Error file search paths.

Definition at line 142 of file Environment.hh.

Referenced by errorLogFilePath(), and initialize().

◆ ICON_DIR_NAME_

const string Environment::ICON_DIR_NAME_ = "icons"
staticprivate

Name of the toolbar icon directory.

Definition at line 123 of file Environment.hh.

Referenced by iconDirPath().

◆ iconPaths_

vector< string > Environment::iconPaths_
staticprivate

Toolbar icon search paths.

Definition at line 140 of file Environment.hh.

Referenced by initialize().

◆ initialized_

bool Environment::initialized_ = false
staticprivate

Flag indicating whether class has been initialized.

Definition at line 127 of file Environment.hh.

Referenced by initialize().

◆ MAN_DIR_NAME_

const string Environment::MAN_DIR_NAME_ = "man"
staticprivate

Name of the manual directory.

Definition at line 119 of file Environment.hh.

Referenced by manDirPath().

◆ manPaths_

vector< string > Environment::manPaths_
staticprivate

Man directory search paths.

Definition at line 138 of file Environment.hh.

Referenced by initialize(), and manDirPath().

◆ MINIMAL_ADF_INSTALLED

const string Environment::MINIMAL_ADF_INSTALLED = "data/mach/minimal.adf"
staticprivate

Relative path to the installed minimal.adf.

Definition at line 168 of file Environment.hh.

Referenced by minimalADF().

◆ MINIMAL_ADF_SRC

const string Environment::MINIMAL_ADF_SRC = "data/mach/minimal.adf"
staticprivate

Relative path to the minimal.adf in source tree.

Definition at line 170 of file Environment.hh.

Referenced by minimalADF().

◆ newBitmapsFileDir_

string Environment::newBitmapsFileDir_ = ""
staticprivate

Directory for new bitmaps file.

Definition at line 151 of file Environment.hh.

Referenced by bitmapsDirPath(), and setNewBitmapsFileDir().

◆ newConfFile_

string Environment::newConfFile_ = ""
staticprivate

Directory for new configure file.

Definition at line 157 of file Environment.hh.

◆ newDataFileDir_

string Environment::newDataFileDir_ = ""
staticprivate

Directory for new data file.

Definition at line 149 of file Environment.hh.

Referenced by dataDirPath(), and setNewDataFileDir().

◆ newErrorLogFileDir_

string Environment::newErrorLogFileDir_ = ""
staticprivate

Directory for new error log file.

Definition at line 159 of file Environment.hh.

Referenced by errorLogFilePath(), and setNewErrorLogFileDir().

◆ newIconFileDir_

string Environment::newIconFileDir_ = ""
staticprivate

Directory for new icon file.

Definition at line 153 of file Environment.hh.

Referenced by iconDirPath().

◆ newManFileDir_

string Environment::newManFileDir_ = ""
staticprivate

Directory for new manual file.

Definition at line 155 of file Environment.hh.

Referenced by manDirPath(), and setNewManFileDir().

◆ newSchemaFileDir_

string Environment::newSchemaFileDir_ = ""
staticprivate

Directory for new schema file.

Definition at line 147 of file Environment.hh.

Referenced by schemaDirPath(), and setNewSchemaFileDir().

◆ pathsToUse_

vector< string > Environment::pathsToUse_
staticprivate

Paths used in a particular search.

Definition at line 144 of file Environment.hh.

Referenced by bitmapsDirPath(), dataDirPath(), errorLogFilePath(), iconDirPath(), manDirPath(), pathTo(), and schemaDirPath().

◆ PDF_MANUAL_INSTALLED

const string Environment::PDF_MANUAL_INSTALLED = "manual/OpenASIP_manual.pdf"
staticprivate

Relative path to the installed TCE .pdf manual.

Definition at line 164 of file Environment.hh.

Referenced by pdfManual().

◆ PDF_MANUAL_SRC

const string Environment::PDF_MANUAL_SRC = "manual/OpenASIP_manual.pdf"
staticprivate

Relative path to the TCE .pdf manual in source tree.

Definition at line 166 of file Environment.hh.

Referenced by pdfManual().

◆ SCHEMA_DIR_NAME_

const string Environment::SCHEMA_DIR_NAME_ = "data"
staticprivate

Name of the XML Schema directory.

Definition at line 113 of file Environment.hh.

Referenced by schemaDirPath().

◆ schemaPaths_

vector< string > Environment::schemaPaths_
staticprivate

Schema directory search paths.

Definition at line 132 of file Environment.hh.

Referenced by initialize(), and schemaDirPath().

◆ simTraceDir_

string Environment::simTraceDir_ = ""
staticprivate

Directory to store ttasim traces.

Definition at line 161 of file Environment.hh.

Referenced by initialize(), and simTraceDirPath().


The documentation for this class was generated from the following files:
Environment::simTraceDir_
static std::string simTraceDir_
Directory to store ttasim traces.
Definition: Environment.hh:161
Environment::newBitmapsFileDir_
static std::string newBitmapsFileDir_
Directory for new bitmaps file.
Definition: Environment.hh:151
FileNotFound
Definition: Exception.hh:224
Environment::CONF_DIR_NAME_
static const std::string CONF_DIR_NAME_
Name of the configuration directory.
Definition: Environment.hh:121
FileSystem::createDirectory
static bool createDirectory(const std::string &path)
Definition: FileSystem.cc:400
TCEString::startsWith
bool startsWith(const std::string &str) const
DS
#define DS
Definition: Environment.cc:86
Environment::PDF_MANUAL_INSTALLED
static const std::string PDF_MANUAL_INSTALLED
Relative path to the installed TCE .pdf manual.
Definition: Environment.hh:164
Environment::developerMode_
static bool developerMode_
Flag indicating whether TCE is executing in developer mode.
Definition: Environment.hh:129
Environment::schemaPaths_
static std::vector< std::string > schemaPaths_
Schema directory search paths.
Definition: Environment.hh:132
Environment::initialize
static void initialize()
Definition: Environment.cc:95
VectorTools::insertUnique
static bool insertUnique(ContainerType &aVec, const ValueType &aValue)
Environment::newSchemaFileDir_
static std::string newSchemaFileDir_
Directory for new schema file.
Definition: Environment.hh:147
Environment::icDecoderPluginPaths
static std::vector< std::string > icDecoderPluginPaths(bool libraryPathsOnly=false)
Definition: Environment.cc:635
Environment::iconPaths_
static std::vector< std::string > iconPaths_
Toolbar icon search paths.
Definition: Environment.hh:140
FileSystem::absolutePathOf
static std::string absolutePathOf(const std::string &pathName)
Definition: FileSystem.cc:303
Environment::pathTo
static std::string pathTo(const std::string &name)
Definition: Environment.cc:444
Environment::PDF_MANUAL_SRC
static const std::string PDF_MANUAL_SRC
Relative path to the TCE .pdf manual in source tree.
Definition: Environment.hh:166
Environment::newDataFileDir_
static std::string newDataFileDir_
Directory for new data file.
Definition: Environment.hh:149
Environment::bitmapsPaths_
static std::vector< std::string > bitmapsPaths_
Bitmaps directory search paths.
Definition: Environment.hh:136
Environment::MAN_DIR_NAME_
static const std::string MAN_DIR_NAME_
Name of the manual directory.
Definition: Environment.hh:119
Environment::DATA_DIR_NAME_
static const std::string DATA_DIR_NAME_
Name of the data directory.
Definition: Environment.hh:115
assert
#define assert(condition)
Definition: Application.hh:86
FileSystem::homeDirectory
static std::string homeDirectory()
abortWithError
#define abortWithError(message)
Definition: Application.hh:72
Environment::ERROR_LOG_FILE_NAME_
static const std::string ERROR_LOG_FILE_NAME_
Name of the system error log file.
Definition: Environment.hh:125
Environment::MINIMAL_ADF_INSTALLED
static const std::string MINIMAL_ADF_INSTALLED
Relative path to the installed minimal.adf.
Definition: Environment.hh:168
Environment::dataPaths_
static std::vector< std::string > dataPaths_
Data directory search paths.
Definition: Environment.hh:134
FileSystem::directoryOfPath
static std::string directoryOfPath(const std::string fileName)
Definition: FileSystem.cc:79
Environment::parsePathEnvVariable
static void parsePathEnvVariable(std::vector< std::string > &paths)
Definition: Environment.cc:1077
Environment::newIconFileDir_
static std::string newIconFileDir_
Directory for new icon file.
Definition: Environment.hh:153
Environment::newManFileDir_
static std::string newManFileDir_
Directory for new manual file.
Definition: Environment.hh:155
Environment::newErrorLogFileDir_
static std::string newErrorLogFileDir_
Directory for new error log file.
Definition: Environment.hh:159
FileSystem::createFile
static bool createFile(const std::string &file)
Definition: FileSystem.cc:468
Environment::MINIMAL_ADF_SRC
static const std::string MINIMAL_ADF_SRC
Relative path to the minimal.adf in source tree.
Definition: Environment.hh:170
Environment::pathsToUse_
static std::vector< std::string > pathsToUse_
Paths used in a particular search.
Definition: Environment.hh:144
FileSystem::DIRECTORY_SEPARATOR
static const std::string DIRECTORY_SEPARATOR
Definition: FileSystem.hh:189
Environment::manPaths_
static std::vector< std::string > manPaths_
Man directory search paths.
Definition: Environment.hh:138
FileSystem::fileExists
static bool fileExists(const std::string fileName)
Environment::findExecutableFromPATH
static std::string findExecutableFromPATH(const std::vector< std::string > &file)
Definition: Environment.cc:1109
Application::installationDir
static std::string installationDir()
Definition: Application.cc:537
TCEString
Definition: TCEString.hh:53
StringTools::chopString
static std::vector< TCEString > chopString(const std::string &source, const std::string &delimiters)
Definition: StringTools.cc:181
Environment::SCHEMA_DIR_NAME_
static const std::string SCHEMA_DIR_NAME_
Name of the XML Schema directory.
Definition: Environment.hh:113
FileSystem::fileIsExecutable
static bool fileIsExecutable(const std::string fileName)
Environment::ICON_DIR_NAME_
static const std::string ICON_DIR_NAME_
Name of the toolbar icon directory.
Definition: Environment.hh:123
Environment::initialized_
static bool initialized_
Flag indicating whether class has been initialized.
Definition: Environment.hh:127
INSTALLATION_DIR
#define INSTALLATION_DIR
Definition: Environment.cc:85
FileSystem::currentWorkingDir
static std::string currentWorkingDir()
Definition: FileSystem.cc:142
Environment::developerMode
static bool developerMode()
Definition: Environment.cc:1166
Environment::environmentVariable
static std::string environmentVariable(const std::string &variable)
Definition: Environment.cc:406
Environment::errorPaths_
static std::vector< std::string > errorPaths_
Error file search paths.
Definition: Environment.hh:142
debugLog
#define debugLog(text)
Definition: Application.hh:95
FileSystem::findFileInSearchPaths
static std::string findFileInSearchPaths(const std::vector< std::string > &searchPaths, const std::string &file)
Definition: FileSystem.cc:562
Environment::BITMAPS_DIR_NAME_
static const std::string BITMAPS_DIR_NAME_
Name of the bitmaps directory.
Definition: Environment.hh:117