From 1cb9b0347de2991cb6ce97d93275bba1e8812d69 Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Thu, 16 Jan 2014 18:24:25 +0900 Subject: [PATCH] [WIP] replace FILE* with my own FILE structure (pic_file *) --- include/picrin/port.h | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/include/picrin/port.h b/include/picrin/port.h index c54888da..7604ed48 100644 --- a/include/picrin/port.h +++ b/include/picrin/port.h @@ -15,11 +15,21 @@ enum pic_port_status { PIC_PORT_CLOSE, }; +typedef struct { + struct { + void *cookie; + int (*read)(void *, char *, int); + int (*write)(void *, const char *, int); + fpos_t (*seek)(void *, fpos_t, int); + int (*close)(void *); + } vtable; +} pic_file; + struct pic_port { PIC_OBJECT_HEADER - FILE *file; - short flags; - enum pic_port_status status; + pic_file *file; + int flags; + int status; }; #define pic_port_p(v) (pic_type(v) == PIC_TT_PORT)