]> git.donarmstrong.com Git - mothur.git/blobdiff - engine.cpp
bugs fixes while testing for 1.5 release
[mothur.git] / engine.cpp
index f0fd05ab2f46d5f6ebbd680de70639d8599da5d5..e5898036e2e4ebd5ddea0af89735ed7efacdf924 100644 (file)
@@ -20,10 +20,8 @@ InteractEngine::InteractEngine(string path){
 
        globaldata = GlobalData::getInstance();
        globaldata->argv = path;
-       string logFileName = "mothur.logFile";
-       remove(logFileName.c_str());
        
-       system("clear");
+       
 }
 
 /***********************************************************************/
@@ -41,33 +39,7 @@ bool InteractEngine::getInput(){
                string options = "";
                int quitCommandCalled = 0;
                
-               mothurOut("mothur v.1.4.1");
-               mothurOutEndLine();             
-               mothurOut("Last updated: 6/23/2009");
-               mothurOutEndLine();     
-               mothurOutEndLine();             
-               mothurOut("by");
-               mothurOutEndLine();             
-               mothurOut("Patrick D. Schloss");
-               mothurOutEndLine();
-               mothurOutEndLine();                     
-               mothurOut("Department of Microbiology");
-               mothurOutEndLine();             
-               mothurOut("pschloss@micro.umass.edu");
-               mothurOutEndLine();             
-               mothurOut("http://schloss.micro.umass.edu/mothur");
-               mothurOutEndLine();     
-               mothurOutEndLine();     
-               mothurOutEndLine();             
-               mothurOut("Distributed under the GNU General Public License");
-               mothurOutEndLine();
-               mothurOutEndLine();                     
-               mothurOut("Type 'help()' for information on the commands that are available");
-               mothurOutEndLine();
-               mothurOutEndLine();                     
-               mothurOut("Type 'quit()' to exit program");
-               mothurOutEndLine();     
-               
+                               
                while(quitCommandCalled != 1){
                        
                        mothurOutEndLine();
@@ -113,17 +85,7 @@ BatchEngine::BatchEngine(string path, string batchFileName){
        
                openedBatch = openInputFile(batchFileName, inputBatchFile);
                globaldata->argv = path;
-               string logFileName = "mothur.logFile";
-               remove(logFileName.c_str());
-               
-               system("clear");
-       
-       //      char buffer = ' ';
-       //      ifstream header("introtext.txt");
-       //      while(!header.eof()){
-       //              cout << buffer;
-       //              buffer = header.get();
-       //      }
+                               
        }
        catch(exception& e) {
                errorOut(e, "BatchEngine", "BatchEngine");
@@ -158,8 +120,9 @@ bool BatchEngine::getInput(){
        
                        if (inputBatchFile.eof()) { input = "quit()"; }
                        else { getline(inputBatchFile, input); }
-                       
-                       
+       //cout << "input = ";           
+       //for (int i = 0; i < input.size();  i++) {  cout << input[i];  if ((input[i] == '\n') || (input[i] == '\r')) {  char c = input[i]; cout << "line feed = " << c << endl; } }
+       //cout << endl;         
                        
                        if (input[0] != '#') {
                                
@@ -211,10 +174,8 @@ ScriptEngine::ScriptEngine(string path, string commandString){
                listOfCommands = commandString.substr(1, (commandString.length()-1));
 
                globaldata->argv = path;
-               string logFileName = "mothur.logFile";
-               remove(logFileName.c_str());
-
-               system("clear");
+               
+               
        
        }
        catch(exception& e) {
@@ -284,13 +245,21 @@ bool ScriptEngine::getInput(){
 string ScriptEngine::getNextCommand(string& commandString) {
        try {
                string nextcommand = "";
+               int count = 0;
                
-               nextcommand = commandString.substr(0,commandString.find_first_of(';'));
-
+               //go through string until you reach ; or end
+               while (count < commandString.length()) { 
+                       
+                       if (commandString[count] == ';') {  break;   }
+                       else {          nextcommand += commandString[count];    }
+                       
+                       count++;
+               }
+               
+               //if you are not at the end
+               if (count != commandString.length())  {   commandString = commandString.substr(count+1, commandString.length());  }
+               else { commandString = ""; }
                                
-               if ((commandString.find_first_of(';')+1) <= commandString.length()) {
-                       commandString = commandString.substr(commandString.find_first_of(';')+1, commandString.length());
-               }else { commandString = ""; } //you have reached the last command.
                
                //get rid of spaces in between commands if any
                if (commandString.length() > 0) {