diff --git a/include/Tester.h b/include/Tester.h index 6aa6be2..188cbb6 100644 --- a/include/Tester.h +++ b/include/Tester.h @@ -12,7 +12,6 @@ class Tester { public: Tester(std::string krakenInvocation, std::string krakenGrammerLocation); ~Tester(); - int ssystem(std::string command); bool run(std::string fileName); bool compareFiles(std::string file1Path, std::string file2Path); void cleanExtras(std::string path); diff --git a/include/util.h b/include/util.h index 372f705..242cbd6 100644 --- a/include/util.h +++ b/include/util.h @@ -13,6 +13,7 @@ #include #include +int ssystem(std::string command); std::string intToString(int theInt); std::string replaceExEscape(std::string first, std::string search, std::string replace); std::string strSlice(std::string str, int begin, int end); diff --git a/src/CGenerator.cpp b/src/CGenerator.cpp index 089226c..3d5fa9f 100644 --- a/src/CGenerator.cpp +++ b/src/CGenerator.cpp @@ -37,9 +37,12 @@ void CGenerator::generateCompSet(std::map*> ASTs, buildString += linkerString; buildString += "-o " + outputName; std::ofstream outputBuild; - outputBuild.open(outputName + "/" + split(outputName, '/').back() + ".sh"); + std::string scriptName = split(outputName, '/').back() + ".sh"; + outputBuild.open(outputName + "/" + scriptName); outputBuild << buildString; outputBuild.close(); + std::cout << "KRAKEN COMPILING DONE, CALLING C COMPILER" << std::endl; + ssystem("cd " + outputName + "/; sh " + scriptName); std::cout << "DEFER DOUBLE STACK " << deferDoubleStack.size() << std::endl; } diff --git a/src/Tester.cpp b/src/Tester.cpp index 01f07b3..7f5cd37 100644 --- a/src/Tester.cpp +++ b/src/Tester.cpp @@ -17,10 +17,6 @@ Tester::~Tester() { //Nothing } -int Tester::ssystem(std::string command) { - return system(command.c_str()); -} - void Tester::cleanExtras(std::string fileName) { ssystem(removeCmd + " " + fileName); } @@ -31,9 +27,10 @@ bool Tester::run(std::string path) { cleanExtras(path); ssystem(krakenInvocation + " " + path + krakenExtention + " " + path); - ssystem(changePermissions + " " + path + sep + fileName + ".sh"); - ssystem(cd + " " + path + "; " + "./" + fileName + ".sh"); - ssystem(changePermissions + " " + path + sep + fileName); + // done automatically now + //ssystem(changePermissions + " " + path + sep + fileName + ".sh"); + //ssystem(cd + " " + path + "; " + "./" + fileName + ".sh"); + //ssystem(changePermissions + " " + path + sep + fileName); ssystem(path + sep + fileName + " " + redirect + " " + path + sep + fileName + resultsExtention); bool result = compareFiles(fileName + expectedExtention, path + sep + fileName + resultsExtention); diff --git a/src/util.cpp b/src/util.cpp index 6f81d2d..3483fb7 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -1,5 +1,8 @@ #include "util.h" +int ssystem(std::string command) { + return system(command.c_str()); +} std::string intToString(int theInt) { std::stringstream converter; converter << theInt;