PandA-2024.02
|
utility function used to read files. More...
#include "gzstream.hpp"
#include "refcount.hpp"
#include <filesystem>
#include <iostream>
#include <string>
Go to the source code of this file.
Macros | |
#define | TIMEOUT 124 |
Return value of timeout signaling timeout has reached. More... | |
#define | ULIMIT 153 |
Return value of an application which was signaled by ulimit. More... | |
Typedefs | |
using | fileIO_istreamRef = refcount< std::istream > |
RefCount type definition for the input stream object. More... | |
using | fileIO_istreamConstRef = refcount< const std::istream > |
using | fileIO_ostreamRef = refcount< std::ostream > |
RefCount type definition for the input stream object. More... | |
Functions | |
CONSTREF_FORWARD_DECL (Parameter) | |
fileIO_istreamRef | fileIO_istream_open (const std::string &name) |
this function returns an istream compressed or not. More... | |
fileIO_istreamRef | fileIO_istream_open_from_string (const std::string &input) |
Create a fileIO_istreamRef starting from a string. More... | |
fileIO_ostreamRef | fileIO_ostream_open (const std::string &name) |
this function returns an ostream compressed or not. More... | |
void | CopyStdout (const std::string &filename) |
Copy a file to the standard output. More... | |
std::string | GetCurrentPath () |
std::string | GetPath (std::filesystem::path path) |
std::string | relocate_compiler_path (const std::string &path, bool resolve_path=false) |
void | CopyFile (std::filesystem::path file_source, std::filesystem::path file_target) |
Copy file; if target already exist, overwrite. More... | |
int | PandaSystem (const ParameterConstRef Param, const std::string &system_command, bool host_exec=true, const std::string &output="", const unsigned int type=3, const bool background=false, const size_t timeout=0) |
System call forcing execution with bash. More... | |
bool | NaturalVersionOrder (const std::filesystem::path &_x, const std::filesystem::path &_y) |
std::filesystem::path | unique_path (const std::filesystem::path &model) |
utility function used to read files.
Definition in file fileIO.hpp.
#define TIMEOUT 124 |
Return value of timeout signaling timeout has reached.
Definition at line 58 of file fileIO.hpp.
#define ULIMIT 153 |
Return value of an application which was signaled by ulimit.
Definition at line 61 of file fileIO.hpp.
using fileIO_istreamConstRef = refcount<const std::istream> |
Definition at line 67 of file fileIO.hpp.
using fileIO_istreamRef = refcount<std::istream> |
RefCount type definition for the input stream object.
Definition at line 66 of file fileIO.hpp.
using fileIO_ostreamRef = refcount<std::ostream> |
RefCount type definition for the input stream object.
Definition at line 72 of file fileIO.hpp.
CONSTREF_FORWARD_DECL | ( | Parameter | ) |
|
inline |
Copy file; if target already exist, overwrite.
file_source | is the file to be copied |
file_target | is the destination |
Definition at line 187 of file fileIO.hpp.
References line(), lenet_tvm::model, NaturalVersionOrder(), output, PandaSystem(), test_panda::type, and unique_path().
Referenced by AlteraBackendFlow::CheckSynthesisResults(), XilinxBackendFlow::CheckSynthesisResults(), CompilerWrapper::CompileFile(), and XilinxBackendFlow::parse_timing().
|
inline |
Copy a file to the standard output.
Definition at line 106 of file fileIO.hpp.
References test_panda::stdout.
Referenced by BashBackendFlow::CheckSynthesisResults(), NanoXploreBackendFlow::CheckSynthesisResults(), XilinxBackendFlow::CheckSynthesisResults(), CompilerWrapper::CompileFile(), CompilerWrapper::CreateExecutable(), ToolManager::execute_command(), and CompilerWrapper::QueryCompilerConfig().
fileIO_istreamRef fileIO_istream_open | ( | const std::string & | name | ) |
this function returns an istream compressed or not.
It first check for a compressed file, then search for the compressed version of the file and finally in case no compressed file is found it look for the plain text file. this function is mainly based on the gzstream wrapper and on zlib library.
name | is the file name. |
Definition at line 55 of file fileIO.cpp.
References THROW_ERROR.
Referenced by AsnParser::Exec(), AadlParser::Exec(), Parameter::GetFileFormat(), and TestVectorParser::ParseXMLFile().
|
inline |
Create a fileIO_istreamRef starting from a string.
Definition at line 87 of file fileIO.hpp.
Referenced by CInitializationParser::Parse().
|
inline |
this function returns an ostream compressed or not.
this function is mainly based on the gzstream wrapper and on zlib library.
name | is the file name. |
Definition at line 98 of file fileIO.hpp.
Referenced by main().
|
inline |
Definition at line 123 of file fileIO.hpp.
Referenced by create_project_file(), BackendFlow::CreateScripts(), SimulationTool::GenerateSimulationScript(), XilinxTasteBackendFlow::GenerateSynthesisScripts(), GetPath(), PandaSystem(), Parameter::SetCommonDefaults(), EucalyptusParameter::SetDefaults(), and BashBackendFlow::WriteFlowConfiguration().
|
inline |
Definition at line 140 of file fileIO.hpp.
References GetCurrentPath().
Referenced by RTLCharacterization::AnalyzeCell(), minimal_interface::build_wrapper(), buildCircuit(), SpiderParameter::CheckParameters(), BambuParameter::CheckParameters(), AlteraBackendFlow::CheckSynthesisResults(), LatticeBackendFlow::CheckSynthesisResults(), NanoXploreBackendFlow::CheckSynthesisResults(), BackendFlow::CreateScripts(), HWDiscrepancyAnalysis::Exec(), GenerateTasteHDLArchitecture::Exec(), WriteHLSSummary::Exec(), WriteTechnology::Exec(), tree_panda_gcc_parameter::Exec(), SpiderParameter::Exec(), EucalyptusParameter::Exec(), Evaluation::Exec(), BambuParameter::Exec(), create_tree_manager::Exec(), SimulationTool::GenerateSimulationScript(), XilinxTasteBackendFlow::GenerateSynthesisScripts(), CompilerWrapper::GetSystemIncludes(), HLS_constraints::HLS_constraints(), TasteInterfaceGeneration::InternalExec(), ControlFlowChecker::InternalExec(), port_swapping::InternalExec(), parametric_list_based::InternalExec(), generic_device::load_devices(), main(), Parameter::ManageDefaultOptions(), PandaSystem(), DataXmlParser::Parse(), TestVectorParser::ParseXMLFile(), SpiderParameter::SetDefaults(), BambuParameter::SetDefaults(), fu_binding::specialise_fu(), fu_binding::specialize_memory_unit(), HDL_manager::write_components(), flopoco_wrapper::writeVHDL(), flopoco_wrapper::writeVHDLcommon(), and RTLCharacterization::xwrite_device_file().
bool NaturalVersionOrder | ( | const std::filesystem::path & | _x, |
const std::filesystem::path & | _y | ||
) |
Definition at line 195 of file fileIO.cpp.
References distance(), and x.
Referenced by BambuParameter::CheckParameters(), EucalyptusParameter::CheckParameters(), and CopyFile().
int PandaSystem | ( | const ParameterConstRef | Param, |
const std::string & | system_command, | ||
bool | host_exec = true , |
||
const std::string & | output = "" , |
||
const unsigned int | type = 3 , |
||
const bool | background = false , |
||
const size_t | timeout = 0 |
||
) |
System call forcing execution with bash.
Param | is the set of input parameters |
system_command | is the to be executed |
host_exec | specifies if the executable is expected to be in the host system or distributed within the AppImage |
output | is the file where output has to be saved |
type | specifies which streams have to be saved; possible values are 0 (none), 1 (stdout), 2 (stderr), 3(stdout and stderr) |
background | specifies if the command has to be executed in background |
timeout | is the timeout for the command (in minutes) |
Definition at line 78 of file fileIO.cpp.
References test_panda::command, counter, GetCurrentPath(), GetPath(), OUTPUT_LEVEL_PEDANTIC, STR, STR_CST_file_IO_shell_output_file, STR_CST_file_IO_shell_script, THROW_ASSERT, and THROW_UNREACHABLE.
Referenced by CompilerWrapper::CompileFile(), CopyFile(), CompilerWrapper::CreateExecutable(), CTestbenchExecution::Exec(), BasicBlocksProfiling::Exec(), create_tree_manager::Exec(), ToolManager::execute_command(), FindMaxTransformations::ExecuteBambu(), NonDeterministicFlows::ExecuteTool(), XilinxTasteBackendFlow::GenerateSynthesisScripts(), CompilerWrapper::GetSystemIncludes(), main(), and CompilerWrapper::QueryCompilerConfig().
Definition at line 149 of file fileIO.hpp.
Referenced by BambuParameter::add_bambu_library(), AlteraBackendFlow::AlteraBackendFlow(), BashBackendFlow::BashBackendFlow(), tree_panda_gcc_parameter::CheckParameters(), BambuParameter::CheckParameters(), LoadDefaultTechnology::Exec(), SimulationTool::GenerateLibraryBuildScript(), SimulationTool::GenerateSimulationScript(), XilinxTasteBackendFlow::GenerateSynthesisScripts(), CompilerWrapper::GetAnalyzeCompiler(), CompilerWrapper::GetCompiler(), LatticeBackendFlow::LatticeBackendFlow(), generic_device::load_devices(), NanoXploreBackendFlow::NanoXploreBackendFlow(), BashBackendFlow::WriteFlowConfiguration(), and XilinxBackendFlow::XilinxBackendFlow().
std::filesystem::path unique_path | ( | const std::filesystem::path & | model | ) |
Definition at line 286 of file fileIO.cpp.
References array_rand(), and ran.
Referenced by BambuParameter::CheckParameters(), CompilerWrapper::CompileFile(), CopyFile(), CompilerWrapper::FillTreeManager(), main(), and Parameter::ManageDefaultOptions().