aboutsummaryrefslogtreecommitdiff
path: root/include/libn.h
diff options
context:
space:
mode:
authorNicholas Noll <nbnoll@eml.cc>2020-04-25 11:38:29 -0700
committerNicholas Noll <nbnoll@eml.cc>2020-04-25 11:38:29 -0700
commit788ddbd8e113cd4f9694aee779c5b5dcca26e30b (patch)
tree32e2db53cf5cd3fb907e6b17ab9ef6bdab8d9f4c /include/libn.h
parent1f166f0a4ed9ed32ade1ed21a571c9b2d0171ebc (diff)
feat: updated fasta code to allow for iteration
Diffstat (limited to 'include/libn.h')
-rw-r--r--include/libn.h23
1 files changed, 22 insertions, 1 deletions
diff --git a/include/libn.h b/include/libn.h
index 43600c0..99e4fdb 100644
--- a/include/libn.h
+++ b/include/libn.h
@@ -113,6 +113,8 @@ error coro·free(Coro *c);
// I/O
typedef FILE Stream;
+typedef struct stat io·Stat;
+
enum SeekPos
{
seek·CUR = SEEK_CUR,
@@ -121,11 +123,13 @@ enum SeekPos
};
Stream *io·open(byte *name, byte *mode);
+int io·fd(Stream *s);
+error io·stat(Stream *s, io·Stat *buf);
error io·close(Stream *s);
byte io·getbyte(Stream *s);
error io·ungetbyte(Stream *s, byte c);
int io·read(Stream *s, int sz, int n, void *buf);
-int io·readln(Stream *s, int n, byte* buf);
+int io·readln(Stream *s, int n, byte *buf);
error io·putbyte(Stream *s, byte c);
int io·putstring(Stream *s, string str);
int io·write(Stream *s, int sz, int n, void *buf);
@@ -139,6 +143,11 @@ typedef struct io·Reader
int (*read)(void*, int sz, int n, void *buf);
} io·Reader;
+typedef struct io·LineReader
+{
+ int (*readln)(void*, int n, void *buf);
+} io·LineReader;
+
typedef struct io·Peeker
{
byte (*get)(void*);
@@ -175,6 +184,18 @@ typedef struct io·ReadWriter
} io·ReadWriter;
// -----------------------------------------------------------------------------
+// memory mapped files
+
+typedef struct mmap·Reader
+{
+ vlong len;
+ void* buf;
+} mmap·Reader;
+
+mmap·Reader mmap·open(byte *name);
+error mmap·close(mmap·Reader rdr);
+
+// -----------------------------------------------------------------------------
// libflate
// NOTE: Experimental!