13#ifndef MCRL2_UTILITY_UNCOMPILED_LIBRARY_H
14#define MCRL2_UTILITY_UNCOMPILED_LIBRARY_H
39#ifndef MCRL2_PLATFORM_WINDOWS
61 std::stringstream commandline;
62 commandline <<
'"' <<
m_compile_script <<
"\" " << filename <<
" " <<
" 2>&1";
65 FILE* stream = popen(commandline.str().c_str(),
"r");
66 if (stream ==
nullptr)
68 throw std::runtime_error(
"Could not execute compile script.");
78 if (fgets(buf,
sizeof(buf), stream) !=
nullptr)
80 std::string line(buf);
81 assert(*line.rbegin() ==
'\n');
82 line.erase(line.size() - 1);
91 while (fgets(buf,
sizeof(buf), stream) !=
nullptr)
96 throw std::runtime_error(
"Compile script failed.");
100 else if(ferror(stream) && errno == EINTR)
106 perror(
"Error according to errno");
114 throw std::runtime_error(
"There was a problem reading the output of the compile script.");
131 if (remove((*f).c_str()))
134 s <<
"Could not remove file: " << *f;
135 throw std::runtime_error(s.str());
152 catch (std::runtime_error &
error)
virtual ~uncompiled_library()
std::string m_compile_script
std::list< std::string > m_tempfiles
uncompiled_library()=delete
void compile(const std::string &filename)
uncompiled_library(const std::string &script)
add your file description here.
#define mCRL2log(LEVEL)
mCRL2log(LEVEL) provides the stream used to log.
bool file_exists(const std::string &filename)