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