X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=engine.cpp;h=ad7a7ad73ad03660976137117b15035d2d2b4757;hb=5d6d303e481489e226fdf8d6c5385b99b50718bc;hp=fbf986dc6965de7d9d269c31f35e99ed85467a9d;hpb=11c115c802602be50e106aae56969e15d2c49a62;p=mothur.git diff --git a/engine.cpp b/engine.cpp index fbf986d..ad7a7ad 100644 --- a/engine.cpp +++ b/engine.cpp @@ -49,7 +49,7 @@ InteractEngine::InteractEngine(string path){ //break apart path variable by ':' vector dirs; - splitAtChar(envPath, dirs, delim); + mout->splitAtChar(envPath, dirs, delim); //get path related to mothur string mothurPath = ""; @@ -181,7 +181,7 @@ string Engine::getCommand() { if(nextCommand != NULL) { add_history(nextCommand); } else{ //^D causes null string and we want it to quit mothur - nextCommand = "quit"; + strcpy(nextCommand, "quit"); mout->mothurOut(nextCommand); } @@ -218,7 +218,7 @@ BatchEngine::BatchEngine(string path, string batchFileName){ try { globaldata = GlobalData::getInstance(); - openedBatch = openInputFile(batchFileName, inputBatchFile); + openedBatch = mout->openInputFile(batchFileName, inputBatchFile); string temppath = path.substr(0, (path.find_last_of('m'))); @@ -237,7 +237,7 @@ BatchEngine::BatchEngine(string path, string batchFileName){ //break apart path variable by ':' vector dirs; - splitAtChar(envPath, dirs, delim); + mout->splitAtChar(envPath, dirs, delim); //get path related to mothur string mothurPath = ""; @@ -370,7 +370,7 @@ bool BatchEngine::getInput(){ } } - gobble(inputBatchFile); + mout->gobble(inputBatchFile); } inputBatchFile.close(); @@ -388,7 +388,7 @@ string BatchEngine::getNextCommand(ifstream& inputBatchFile) { string nextcommand = ""; if (inputBatchFile.eof()) { nextcommand = "quit()"; } - else { nextcommand = getline(inputBatchFile); } + else { nextcommand = mout->getline(inputBatchFile); } return nextcommand; } @@ -425,7 +425,7 @@ ScriptEngine::ScriptEngine(string path, string commandString){ //break apart path variable by ':' vector dirs; - splitAtChar(envPath, dirs, delim); + mout->splitAtChar(envPath, dirs, delim); //get path related to mothur string mothurPath = ""; @@ -531,7 +531,6 @@ bool ScriptEngine::getInput(){ mout->executing = true; #ifdef USE_MPI int pid, numProcesses; - MPI_Status status; MPI_Comm_rank(MPI_COMM_WORLD, &pid); MPI_Comm_size(MPI_COMM_WORLD, &numProcesses); @@ -571,11 +570,16 @@ string ScriptEngine::getNextCommand(string& commandString) { string nextcommand = ""; int count = 0; + bool ignoreSemiColons = false; //go through string until you reach ; or end while (count < commandString.length()) { - if (commandString[count] == ';') { break; } + //you want to ignore any ; until you reach the next ' + if ((commandString[count] == '\'') && (!ignoreSemiColons)) { ignoreSemiColons = true; } + else if ((commandString[count] == '\'') && (ignoreSemiColons)) { ignoreSemiColons = false; } + + if ((commandString[count] == ';') && (!ignoreSemiColons)) { break; } else { nextcommand += commandString[count]; } count++;