X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=blobdiff_plain;f=readtree.cpp;h=b9c38e973f2cea531c03c17071ed65a155bf65a3;hp=4c9def84dcb08fb28084b52c8464f2fc98f0da85;hb=df7e3ff9f68ef157b0328a2d353c3258c5d45d89;hpb=deba0af0ccdcb6005ed5b2b82649b137c63fbdf7 diff --git a/readtree.cpp b/readtree.cpp index 4c9def8..b9c38e9 100644 --- a/readtree.cpp +++ b/readtree.cpp @@ -115,8 +115,10 @@ int ReadNewickTree::read(CountTable* ct) { //if you are not a nexus file if ((c = filehandle.peek()) != '#') { - while((c = filehandle.peek()) != EOF) { + while((c = filehandle.peek()) != EOF) { + if (m->control_pressed) { filehandle.close(); return 0; } while ((c = filehandle.peek()) != EOF) { + if (m->control_pressed) { filehandle.close(); return 0; } // get past comments if(c == '[') { comment = 1; @@ -146,9 +148,11 @@ int ReadNewickTree::read(CountTable* ct) { Tree* temp = new Tree(ct); delete temp; nexusTranslation(ct); //reads file through the translation and updates treemap - while((c = filehandle.peek()) != EOF) { + while((c = filehandle.peek()) != EOF) { + if (m->control_pressed) { filehandle.close(); return 0; } // get past comments - while ((c = filehandle.peek()) != EOF) { + while ((c = filehandle.peek()) != EOF) { + if (m->control_pressed) { filehandle.close(); return 0; } if(holder == "[" || holder == "[!"){ comment = 1; } @@ -242,7 +246,7 @@ int ReadNewickTree::readTreeString(CountTable* ct) { n = numLeaves; //number of leaves / sequences, we want node 1 to start where the leaves left off lc = readNewickInt(filehandle, n, T, ct); - if (lc == -1) { m->mothurOut("error with lc"); m->mothurOutEndLine(); return -1; } //reports an error in reading + if (lc == -1) { m->mothurOut("error with lc"); m->mothurOutEndLine(); m->control_pressed = true; return -1; } //reports an error in reading if(filehandle.peek()==','){ readSpecialChar(filehandle,',',"comma"); @@ -254,7 +258,7 @@ int ReadNewickTree::readTreeString(CountTable* ct) { if(rooted != 1){ rc = readNewickInt(filehandle, n, T, ct); - if (rc == -1) { m->mothurOut("error with rc"); m->mothurOutEndLine(); return -1; } //reports an error in reading + if (rc == -1) { m->mothurOut("error with rc"); m->mothurOutEndLine(); m->control_pressed = true; return -1; } //reports an error in reading if(filehandle.peek() == ')'){ readSpecialChar(filehandle,')',"right parenthesis"); }