6 // Note use of 32 bit ints, should fix at some point to use
7 // platform-dependent fpos_t/size_t or just punt and use int64_t
10 // The naContext is passed in for error reporting via
13 void (*close)(naContext c, void* f);
14 int (*read) (naContext c, void* f, char* buf, unsigned int len);
15 int (*write)(naContext c, void* f, char* buf, unsigned int len);
16 void (*seek) (naContext c, void* f, unsigned int off, int whence);
17 int (*tell) (naContext c, void* f);
18 void (*flush) (naContext c, void* f);
19 void (*destroy)(void* f);
23 struct naIOType* type;
24 void* handle; // descriptor, FILE*, HANDLE, etc...
27 extern naGhostType naIOGhostType;
28 extern struct naIOType naStdIOType;
30 #define IOGHOST(r) ((struct naIOGhost*)naGhost_ptr(r))
31 #define IS_IO(r) (IS_GHOST(r) && naGhost_type(r) == &naIOGhostType)
32 #define IS_STDIO(r) (IS_IO(r) && (IOGHOST(r)->type == &naStdIOType))
34 // Defined in iolib.c, there is no "library" header to put this in
35 naRef naIOGhost(naContext c, FILE* f);