diff options
Diffstat (limited to 'include/libn.h')
-rw-r--r-- | include/libn.h | 23 |
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! |