55 const std::string& code,
56 const std::string& cflags) {
58 std::stringstream codeStream(code);
70 std::stringstream& code,
71 const std::string& cflags) {
78 if (tempDir.empty()) {
81 std::string tempAdfFile =
83 std::string sourceCFile =
85 std::string resultFile =
97 std::ofstream cStream(sourceCFile);
102 cStream << code.rdbuf();
106 "-a " + tempAdfFile +
" " +
107 "-o " + resultFile +
" " +
110 std::vector<std::string> output;
115 resultProgram = Program::loadFromTPEF(resultFile, target);
123 return resultProgram;
135 const std::stringstream& code,
136 const std::string compileOptions) {
143 if (tempDir.empty()) {
146 std::string tempAdfFile =
148 std::string sourceLLFile =
150 std::string resultFile =
162 std::ofstream llStream(sourceLLFile);
163 if (llStream.fail()) {
167 llStream << code.rdbuf();
171 +
"-a " + tempAdfFile +
" "
172 +
"-o " + resultFile +
" " +
" "
173 + compileOptions +
" "
178 resultProgram = Program::loadFromTPEF(resultFile, target);
186 return resultProgram;
void writeMachine(const TTAMachine::Machine &machine)
static int runShellCommandAndGetOutput(const std::string &command, std::vector< std::string > &outputLines, std::size_t maxOutputLines=DEFAULT_MAX_OUTPUT_LINES, bool includeStdErr=false)
static int runShellCommandSilently(const std::string &command)
static std::string tceCompiler()
static bool removeFileOrDirectory(const std::string &path)
static const std::string DIRECTORY_SEPARATOR
static std::string createTempDirectory(const std::string &path="/tmp", const std::string &tempDirPrefix="tmp_tce_")
static std::string currentWorkingDir()
static bool fileExists(const std::string fileName)
void setDestinationFile(const std::string &fileName)