aboutsummaryrefslogtreecommitdiff
path: root/src/libbio/phylo.c
diff options
context:
space:
mode:
authorNicholas Noll <nbnoll@eml.cc>2021-12-05 15:17:44 -0800
committerNicholas Noll <nbnoll@eml.cc>2021-12-05 15:17:44 -0800
commitb48327d357e0818d1a6ae2a064cfa7d1567e1242 (patch)
tree4677f228a9846937a7ec71c72a1ab63ab69d68ab /src/libbio/phylo.c
parentc200dd832789afa298ba45e0b9efdec96c0e92cc (diff)
feat(huge): huge refactor (in progress).
Commented out libc includes to uncover all explicit dependencies. A large fraction has now been ported over (no testing). I did not port over the command line tools, such as the rc shell. These will be done independently - as of now I just want the library to stand independent. Compilation currently fails due to the lack of math functions.
Diffstat (limited to 'src/libbio/phylo.c')
-rw-r--r--src/libbio/phylo.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/libbio/phylo.c b/src/libbio/phylo.c
index 41b0f04..1b0ae59 100644
--- a/src/libbio/phylo.c
+++ b/src/libbio/phylo.c
@@ -328,11 +328,11 @@ phylo·diameter(bio·Tree tree, int *len, bio·Node **path)
sort·nodedists(n, fbuf, nbuf);
path[0] = nbuf[n-1];
- printf("first end '%s'\n", path[0]->name);
+ fmt·print("first end '%s'\n", path[0]->name);
n = phylo·getdistsfrom(path[0], n, fbuf, nbuf);
sort·nodedists(n, fbuf, nbuf);
- printf("second end '%s'\n", nbuf[n-1]->name);
+ fmt·print("second end '%s'\n", nbuf[n-1]->name);
*len = 0;
@@ -393,17 +393,17 @@ phylo·reroot(bio·Tree *tree, bio·Node *node, double d)
// TODO: should check that node is part of this tree?
// TODO: should we check if node->parent != nil?
- if (fabs(d) < PREC) {
+ if(fabs(d) < PREC){
new = node;
rotateparent(node->parent, node);
- } else if (fabs(d-node->dist) < PREC) {
+ }else if(fabs(d-node->dist) < PREC){
new = node->parent;
if (new->parent->parent) {
rotateparent(new->parent->parent, new->parent);
}
- } else {
+ }else{
new = tree->mem.alloc(tree->heap, 1, sizeof(*new));
- memset(new, 0, sizeof(*new));
+ mem·set(new, sizeof(*new), 0);
phylo·addchild(new, node);
node->parent = new;
@@ -415,7 +415,7 @@ phylo·reroot(bio·Tree *tree, bio·Node *node, double d)
node->parent->parent = new;
}
- printf("number of children on old root: %d\n", tree->root->nchild);
+ fmt·print("number of children on old root: %d\n", tree->root->nchild);
tree->root = new;
tree->nleaf = 0;