/*****************************************************************/
//this code is a mess and should be rethought...-slw
-void Tree::parseTreeFile() {
+int Tree::parseTreeFile() {
//only takes names from the first tree and assumes that all trees use the same names.
try {
//ifyou are not a nexus file
if((c = filehandle.peek()) != '#') {
- while((c = filehandle.peek()) != ';') {
+ while((c = filehandle.peek()) != ';') {
+ if (m->control_pressed) { filehandle.close(); return 0; }
while ((c = filehandle.peek()) != ';') {
+ if (m->control_pressed) { filehandle.close(); return 0; }
// get past comments
if(c == '[') {
comment = 1;
string holder = "";
// get past comments
- while(holder != "translate" && holder != "Translate"){
+ while(holder != "translate" && holder != "Translate"){
+ if (m->control_pressed) { filehandle.close(); return 0; }
if(holder == "[" || holder == "[!"){
comment = 1;
}
string number, name, h;
h = ""; // so it enters the loop the first time
- while((h != ";") && (number != ";")) {
+ while((h != ";") && (number != ";")) {
+ if (m->control_pressed) { filehandle.close(); return 0; }
filehandle >> number;
filehandle >> name;
}
}
filehandle.close();
-
+ return 0;
//for (int i = 0; i < globaldata->Treenames.size(); i++) {
//cout << globaldata->Treenames[i] << endl; }
//cout << globaldata->Treenames.size() << endl;
int c;
string name; //, k
- while((c = filehandle.peek()) != ';') {
+ while((c = filehandle.peek()) != ';') {
+ if (m->control_pressed) { return 0; }
//k = c;
//cout << " at beginning of while " << k << endl;
if(c == ')') {