Add Bocfel interpreter
[projects/chimara/chimara.git] / interpreters / bocfel / io.h
1 #ifndef ZTERP_IO_H
2 #define ZTERP_IO_H
3
4 #include <stdio.h>
5 #include <stdint.h>
6
7 typedef struct zterp_io zterp_io;
8
9 #define ZTERP_IO_DATA           0x00
10 #define ZTERP_IO_SAVE           0x01
11 #define ZTERP_IO_TRANS          0x02
12 #define ZTERP_IO_INPUT          0x04
13 #define ZTERP_IO_RDONLY         0x08
14 #define ZTERP_IO_WRONLY         0x10
15 #define ZTERP_IO_APPEND         0x20
16
17 /* This variable controls whether the IO system writes UTF-8 or
18  * Latin-1; it is distinct from Glk’s Unicode setting.
19  * If this is set, transcripts will be written in UTF-8, and if
20  * Glk is not being used, screen output will be written in UTF-8.
21  */
22 extern int use_utf8_io;
23
24 zterp_io *zterp_io_open(const char *, int);
25 const zterp_io *zterp_io_stdin(void);
26 const zterp_io *zterp_io_stdout(void);
27 void zterp_io_close(zterp_io *);
28 int zterp_io_seek(const zterp_io *, long, int);
29 long zterp_io_tell(const zterp_io *);
30 size_t zterp_io_read(const zterp_io *, void *, size_t);
31 size_t zterp_io_write(const zterp_io *, const void *, size_t);
32 int zterp_io_read16(const zterp_io *, uint16_t *);
33 int zterp_io_read32(const zterp_io *, uint32_t *);
34 long zterp_io_getc(const zterp_io *);
35 void zterp_io_putc(const zterp_io *, uint16_t);
36 long zterp_io_readline(const zterp_io *, uint16_t *, size_t);
37 long zterp_io_filesize(const zterp_io *);
38 void zterp_io_flush(const zterp_io *);
39
40 #endif