X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=engine.cpp;h=24adcb53b59f39f049269d74b4da953a5f387262;hb=94d43af803e4be78b2ba8049669504e854ad13be;hp=dbdcc36300f2fd5d3f5ea6135dbc8666f328bba0;hpb=ca9ac1d80c62f57270b0dcd49410ebe08a8aecd6;p=mothur.git diff --git a/engine.cpp b/engine.cpp index dbdcc36..24adcb5 100644 --- a/engine.cpp +++ b/engine.cpp @@ -34,7 +34,7 @@ string Engine::findMothursPath(){ //delimiting path char char delim; - #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) + #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix) delim = ':'; #else delim = ';'; @@ -56,7 +56,7 @@ string Engine::findMothursPath(){ if (mothurPath != "") { //add mothur so it looks like what argv would look like - #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) + #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix) mothurPath += "/mothur"; #else mothurPath += "\\mothur"; @@ -71,7 +71,7 @@ string Engine::findMothursPath(){ //is this mothurs path? ifstream in; string tempIn = dirs[i]; - #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) + #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix) tempIn += "/mothur"; #else tempIn += "\\mothur"; @@ -179,8 +179,19 @@ bool InteractEngine::getInput(){ //cout << pid << " is in execute " << commandName << endl; #endif //executes valid command + mout->runParse = true; + mout->clearGroups(); + mout->clearAllGroups(); + mout->Treenames.clear(); + mout->saveNextLabel = ""; + mout->printedHeaders = false; + mout->commandInputsConvertError = false; + mout->currentBinLabels.clear(); + mout->binLabelsInFile.clear(); + Command* command = cFactory->getCommand(commandName, options); - quitCommandCalled = command->execute(); + if (mout->commandInputsConvertError) { quitCommandCalled = 2; } + else { quitCommandCalled = command->execute(); } //if we aborted command if (quitCommandCalled == 2) { mout->mothurOut("[ERROR]: did not complete " + commandName + "."); mout->mothurOutEndLine(); } @@ -207,14 +218,14 @@ bool InteractEngine::getInput(){ string Engine::getCommand() { try { - #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) + #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix) #ifdef USE_READLINE char* nextCommand = NULL; nextCommand = readline("mothur > "); if(nextCommand != NULL) { add_history(nextCommand); } else{ //^D causes null string and we want it to quit mothur - strcpy(nextCommand, "quit"); + nextCommand = strdup("quit"); mout->mothurOut(nextCommand); } @@ -353,8 +364,20 @@ bool BatchEngine::getInput(){ if ((cFactory->MPIEnabled(commandName)) || (pid == 0)) { #endif //executes valid command + mout->runParse = true; + mout->clearGroups(); + mout->clearAllGroups(); + mout->Treenames.clear(); + mout->saveNextLabel = ""; + mout->printedHeaders = false; + mout->commandInputsConvertError = false; + mout->currentBinLabels.clear(); + mout->binLabelsInFile.clear(); + + Command* command = cFactory->getCommand(commandName, options); - quitCommandCalled = command->execute(); + if (mout->commandInputsConvertError) { quitCommandCalled = 2; } + else { quitCommandCalled = command->execute(); } //if we aborted command if (quitCommandCalled == 2) { mout->mothurOut("[ERROR]: did not complete " + commandName + "."); mout->mothurOutEndLine(); } @@ -385,7 +408,7 @@ bool BatchEngine::getInput(){ /***********************************************************************/ string BatchEngine::getNextCommand(ifstream& inputBatchFile) { try { - + string nextcommand = ""; if (inputBatchFile.eof()) { nextcommand = "quit()"; } @@ -455,9 +478,13 @@ bool ScriptEngine::getInput(){ if (input == "") { input = "quit()"; } - mout->mothurOutEndLine(); - mout->mothurOut("mothur > " + input); - mout->mothurOutEndLine(); + if (mout->gui) { + if ((input.find("quit") != string::npos) || (input.find("set.logfile") != string::npos)) {} + else if ((input.find("get.current") != string::npos) && (!mout->hasCurrentFiles())) {} + else { mout->mothurOutEndLine(); mout->mothurOut("mothur > " + input); mout->mothurOutEndLine(); } + }else{ + mout->mothurOutEndLine(); mout->mothurOut("mothur > " + input); mout->mothurOutEndLine(); + } #ifdef USE_MPI //send commandName @@ -505,8 +532,19 @@ bool ScriptEngine::getInput(){ //cout << pid << " is in execute" << endl; #endif //executes valid command + mout->runParse = true; + mout->clearGroups(); + mout->clearAllGroups(); + mout->Treenames.clear(); + mout->saveNextLabel = ""; + mout->printedHeaders = false; + mout->commandInputsConvertError = false; + mout->currentBinLabels.clear(); + mout->binLabelsInFile.clear(); + Command* command = cFactory->getCommand(commandName, options); - quitCommandCalled = command->execute(); + if (mout->commandInputsConvertError) { quitCommandCalled = 2; } + else { quitCommandCalled = command->execute(); } //if we aborted command if (quitCommandCalled == 2) { mout->mothurOut("[ERROR]: did not complete " + commandName + "."); mout->mothurOutEndLine(); }