Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fresh start for nw_prune

  • Loading branch information...
commit b5d8822fdee1df4cae5c1cce022d46387668a81c 1 parent afeee21
Thomas Junier authored
Showing with 10 additions and 17 deletions.
  1. +4 −16 src/prune.c
  2. +0 −1  src/rnode.c
  3. +6 −0 src/rnode_iterator.h
View
20 src/prune.c
@@ -38,7 +38,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <ctype.h>
#include "tree.h"
-#include "nodemap.h"
#include "parser.h"
#include "to_newick.h"
#include "rnode.h"
@@ -46,9 +45,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "set.h"
#include "list.h"
-/* define this to enable debugging of the decision process */
-#define DEBUG_PRUNE_DECISION 1
-
enum prune_mode { PRUNE_DIRECT, PRUNE_REVERSE };
struct parameters {
@@ -182,17 +178,6 @@ struct parameters get_params(int argc, char *argv[])
return params;
}
-/* Return true IFF string is numeric (incl. float), see http://rosettacode.org/wiki/Determine_if_a_string_is_numeric#C */
-
-static bool is_numeric (const char * s)
-{
- if (NULL == s || '\0' == *s || isspace(*s))
- return 0;
- char * p;
- strtod (s, &p);
- return *p == '\0';
-}
-
/* We build a hash of the passed labels, and go through the tree in reverse
* Newick order, unlinking nodes as needed (and [eventually] preventing further
* visiting, as in nw_ed). This will entail at most one passage through the
@@ -200,8 +185,11 @@ static bool is_numeric (const char * s)
* a single hash to be constructed for all the trees. In fact, if the labels
* list is short, one does not need a hash at all. */
-static void process_tree(struct rooted_tree *tree, set_t *cl_labels, enum prune_mode mode)
+static void process_tree(struct rooted_tree *tree, set_t *cl_labels,
+ enum prune_mode mode)
{
+ // TODO: forget about iterator; do it with reversed nodes-in-order and
+ // set some node data to keep track of processed status, as in nw_*ed.
}
int main(int argc, char *argv[])
View
1  src/rnode.c
@@ -117,7 +117,6 @@ void destroy_rnode(struct rnode *node, void (*free_data)(void *))
free(node);
}
-
void destroy_all_rnodes(void (*free_data)(void *))
{
while (rnode_count > 0)
View
6 src/rnode_iterator.h
@@ -92,3 +92,9 @@ struct rnode *rnode_iterator_next(struct rnode_iterator *);
/* Returns true IFF there are more children to visit on the current node. */
bool more_children_to_visit (struct rnode_iterator *);
+
+/* Returns (and set the iterator's current node to) the node's next sibling. If
+ * there is no such node, returns NULL and does not change the iterator's
+ * state. */
+
+struct rnode *rnode_iterator_next_sibling(struct rnode_iterator *iter);
Please sign in to comment.
Something went wrong with that request. Please try again.