aboutsummaryrefslogtreecommitdiff
path: root/include/bh/io.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/bh/io.h')
-rw-r--r--include/bh/io.h26
1 files changed, 23 insertions, 3 deletions
diff --git a/include/bh/io.h b/include/bh/io.h
index cee0834..f44fce7 100644
--- a/include/bh/io.h
+++ b/include/bh/io.h
@@ -5,6 +5,7 @@
#define BH_IO_ERROR 0x0001
#define BH_IO_EOF 0x0002
+#define BH_IO_UNIFIED 0x0004
#define BH_IO_NONE 0x0000
#define BH_IO_READ 0x0001
@@ -63,13 +64,30 @@ typedef struct bh_io_s
{
const bh_io_table_t *table;
int flags;
+ struct
+ {
+ char *data;
+ size_t head;
+ size_t tail;
+ size_t size;
+ size_t capacity;
+ } buffer;
} bh_io_t;
-bh_io_t *bh_io_new(bh_io_table_t *table,
- size_t size);
+void bh_io_destroy_base(bh_io_t *io);
+
+bh_io_t *bh_io_new(const bh_io_table_t *table,
+ size_t size,
+ int unified);
void bh_io_free(bh_io_t *io);
+void bh_io_init(bh_io_t *io,
+ const bh_io_table_t *table,
+ int unified);
+
+void bh_io_destroy(bh_io_t *io);
+
int bh_io_open(bh_io_t *io,
int mode);
@@ -81,6 +99,9 @@ size_t bh_io_read(bh_io_t *io,
char *data,
size_t size);
+size_t bh_io_peek(bh_io_t *io,
+ char *data,
+ size_t size);
size_t bh_io_write(bh_io_t *io,
const char* data,
@@ -97,7 +118,6 @@ bh_off_t bh_io_size(bh_io_t *io);
bh_off_t bh_io_tell(bh_io_t *io);
-
bh_off_t bh_io_available(bh_io_t *io);
int bh_io_error(bh_io_t *io);