aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorNicholas Noll <nbnoll@eml.cc>2021-04-22 14:08:40 -0700
committerNicholas Noll <nbnoll@eml.cc>2021-04-22 14:08:40 -0700
commit62f04ff585edd4f932f18ecad109f1d0213973a6 (patch)
tree30ac82ea314913842f9f9bdab9e289267bd2c49c /include
parent4b0ef5bf1644520bcec05a7b2f59d6787eb616f8 (diff)
chore(refactor): libraries to define explicit interfaces
Diffstat (limited to 'include')
-rw-r--r--include/libbio.h4
-rw-r--r--include/libn.h17
2 files changed, 6 insertions, 15 deletions
diff --git a/include/libbio.h b/include/libbio.h
index 7b28a55..558c163 100644
--- a/include/libbio.h
+++ b/include/libbio.h
@@ -63,8 +63,8 @@ typedef struct bio·Seq
char *q;
} bio·Seq;
-bio·SeqReader *bio·open(io·Reader io, void *rdr, mem·Allocator mem, void *heap);
-error bio·close(bio·SeqReader *rdr);
+bio·SeqReader *bio·openseq(io·Reader io, void *rdr, mem·Allocator mem, void *heap);
+error bio·closeseq(bio·SeqReader *rdr);
error bio·readfasta(bio·SeqReader *rdr, bio·Seq *seq);
error bio·readfastq(bio·SeqReader *rdr, bio·Seq *seq);
diff --git a/include/libn.h b/include/libn.h
index 30b4c87..2b8dc4c 100644
--- a/include/libn.h
+++ b/include/libn.h
@@ -52,31 +52,22 @@ void* bufgrow(void*, vlong, vlong);
void _bufpop(void*, int, vlong);
// -----------------------------------------------------------------------------
-// interfaces
-// TODO(nnoll): Think about this idea
-/*
-typedef struct Iface {
- void* impl;
- byte fcn[];
-} Iface;
-*/
-// -----------------------------------------------------------------------------
// memory allocation
// TODO(nnoll): Allow for nil iterfaces?
/* allocator interface */
typedef struct mem·Allocator {
- void *(*alloc)(void *iface, uint n, ulong size);
- void (*free)(void *iface, void *ptr);
+ void *(*alloc)(void *heap, uint n, ulong size);
+ void (*free)(void *heap, void *ptr);
} mem·Allocator;
-extern mem·Allocator mem·System;
+extern mem·Allocator sys·Memory;
typedef struct mem·Reallocator {
void *(*alloc)(void *iface, uint n, ulong size);
void *(*realloc)(void *iface, void *ptr, uint n, ulong size);
void (*free)(void *iface, void *ptr);
} mem·Reallocator;
-extern mem·Reallocator mem·FullSystem;
+extern mem·Reallocator sys·Relocator;
/* simple memory arena */
typedef struct mem·Arena mem·Arena;