]> git.donarmstrong.com Git - mothur.git/blob - mothur.cpp
fixed some issues while testing 1.6
[mothur.git] / mothur.cpp
1 /*
2  *  interface.cpp
3  *  
4  *
5  *  Created by Pat Schloss on 8/14/08.
6  *  Copyright 2008 Patrick D. Schloss. All rights reserved.
7  *
8  */
9  
10 #include "mothur.h"
11 #include "engine.hpp"
12 #include "globaldata.hpp"
13
14 /**************************************************************************************************/
15
16 GlobalData* GlobalData::_uniqueInstance = 0;
17
18 int main(int argc, char *argv[]){
19         try {
20                 
21                 //remove old logfile
22                 string logFileName = "mothur.logFile";
23                 remove(logFileName.c_str());
24                 
25                 //version
26                 #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
27                         system("clear");
28                         #if defined (__APPLE__) || (__MACH__)
29                                 mothurOutJustToLog("Mac version");
30                                 mothurOutEndLine(); mothurOutEndLine();
31                         #else
32                                 mothurOutJustToLog("Linux version");
33                                 mothurOutEndLine(); mothurOutEndLine();
34                         #endif
35
36                 #else
37                         system("CLS");
38                         mothurOutJustToLog("Windows version");
39                         mothurOutEndLine(); mothurOutEndLine();
40                 #endif          
41
42                 
43                 //header
44                 mothurOut("mothur v.1.6.0");
45                 mothurOutEndLine();             
46                 mothurOut("Last updated: 9/15/2009");
47                 mothurOutEndLine();     
48                 mothurOutEndLine();             
49                 mothurOut("by");
50                 mothurOutEndLine();             
51                 mothurOut("Patrick D. Schloss");
52                 mothurOutEndLine();
53                 mothurOutEndLine();                     
54                 mothurOut("Department of Microbiology & Immunology");
55                 mothurOutEndLine();     
56                 mothurOut("University of Michigan");
57                 mothurOutEndLine();                     
58                 mothurOut("pschloss@umich.edu");
59                 mothurOutEndLine();             
60                 mothurOut("http://www.mothur.org");
61                 mothurOutEndLine();     
62                 mothurOutEndLine();     
63                 mothurOutEndLine();             
64                 mothurOut("Distributed under the GNU General Public License");
65                 mothurOutEndLine();
66                 mothurOutEndLine();                     
67                 mothurOut("Type 'help()' for information on the commands that are available");
68                 mothurOutEndLine();
69                 mothurOutEndLine();                     
70                 mothurOut("Type 'quit()' to exit program");
71                 mothurOutEndLine();     
72
73                                 
74                 //srand(54321);
75                 srand( (unsigned)time( NULL ) );
76
77                 Engine* mothur;
78                 bool bail = 0;
79                 string input;
80
81                 if(argc>1){
82                         input = argv[1];
83
84                         if (input[0] == '#') {
85                                 mothur = new ScriptEngine(argv[0], argv[1]);
86                         }else{
87                                 mothur = new BatchEngine(argv[0], argv[1]);
88                         }
89                 }
90                 else{
91                         mothur = new InteractEngine(argv[0]);           
92                 }
93
94                 while(bail == 0)                {       bail = mothur->getInput();                      }
95         
96                 delete mothur;
97         
98                 return 0;
99         }
100         catch(exception& e) {
101                 errorOut(e, "mothur", "main");
102                 exit(1);
103         }
104 }
105
106 /**************************************************************************************************/
107