From 21055a1e5d34dda1b8151dd46a6bedca22bd73d9 Mon Sep 17 00:00:00 2001 From: Nicholas Noll Date: Sat, 18 Apr 2020 13:40:53 -0700 Subject: feat: added prototype of io/buffered io --- include/io.h | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 include/io.h (limited to 'include/io.h') diff --git a/include/io.h b/include/io.h new file mode 100644 index 0000000..9813b85 --- /dev/null +++ b/include/io.h @@ -0,0 +1,34 @@ +#pragma once + +typedef struct io·Reader +{ + Iface impl; + int (*read)(void*, byte *buf, int n); +} io·Reader; + +typedef struct io·ByteReader +{ + Iface impl; + int (*read)(void*, byte *buf, int n); + byte (*get)(void*); +} io·ByteReader; + +typedef struct io·Writer +{ + Iface impl; + int (*write)(void*, byte *buf, int n); +} io·Writer; + +typedef struct io·ReadWriter +{ + Iface impl; + int (*read)(void*, byte *buf, int n); + int (*write)(void*, byte *buf, int n); +} io·ReadWriter; + +typedef enum io·SeekPos +{ + SEEK·set, + SEEK·cur, + SEEK·end, +} io·SeekPos; -- cgit v1.2.1