diff options
author | Nicholas Noll <nbnoll@eml.cc> | 2021-12-05 15:17:44 -0800 |
---|---|---|
committer | Nicholas Noll <nbnoll@eml.cc> | 2021-12-05 15:17:44 -0800 |
commit | b48327d357e0818d1a6ae2a064cfa7d1567e1242 (patch) | |
tree | 4677f228a9846937a7ec71c72a1ab63ab69d68ab /src/libbio/newick.c | |
parent | c200dd832789afa298ba45e0b9efdec96c0e92cc (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/newick.c')
-rw-r--r-- | src/libbio/newick.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/libbio/newick.c b/src/libbio/newick.c index a855cea..a555379 100644 --- a/src/libbio/newick.c +++ b/src/libbio/newick.c @@ -50,8 +50,8 @@ tokstr(struct Token tok) case tok·comma: return ","; case tok·semi: return ";"; case tok·colon: return ":"; - case tok·number: - snprintf(b, arrlen(b), "%f", tok.lit.x); + case tok·number: + fmt·nsprint(b, arrlen(b), "%f", tok.lit.x); return b; default: return nil; @@ -80,8 +80,8 @@ lex(io·Peeker s, void* fp) c = b; *c = s.get(fp); - if (isspace(*c)) { - while (isspace(*c)) { + if(utf8·isspace(*c)){ + while(utf8·isspace(*c)){ *(++c) = s.get(fp); } @@ -107,7 +107,7 @@ lex(io·Peeker s, void* fp) case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': - while (isdigit(*c)) { + while(utf8·isdigit(*c)){ NUM: *(++c) = s.get(fp); } if (*c == '.') goto NUM; @@ -194,7 +194,7 @@ parse(struct Parser *p) } node = p->mem.alloc(p->heap, 1, sizeof(*node)); - memset(node, 0, sizeof(*node)); + mem·set(node, sizeof(*node), 0); if (p->root) { phylo·addchild(p->root, node); @@ -281,7 +281,7 @@ parse(struct Parser *p) } node = p->mem.alloc(p->heap, 1, sizeof(*node)); - memset(node, 0, sizeof(*node)); + mem·set(node, sizeof(*node), 0); node->name = string·make(tok.lit.s); @@ -396,7 +396,7 @@ dump(bio·Node *node, void *impl, io·Putter out) if (node->parent) { out.put(impl, ':'); - snprintf(b, arrlen(b), "%f", node->dist); + fmt·nsprint(b, arrlen(b), "%f", node->dist); out.puts(impl, b); } |