2e048ff4a89f730da9c8adc5826ec12ac1ff53b9
[polyglot.git] / io.h
1 \r
2 // io.h\r
3 \r
4 #ifndef IO_H\r
5 #define IO_H\r
6 \r
7 // includes\r
8 \r
9 #include "util.h"\r
10 \r
11 // defined\r
12 \r
13 #define BufferSize 16384\r
14 \r
15 // types\r
16 \r
17 typedef struct {\r
18 \r
19    int in_fd;\r
20    int out_fd;\r
21 \r
22    const char * name;\r
23 \r
24    bool in_eof;\r
25 \r
26    sint32 in_size;\r
27    sint32 out_size;\r
28 \r
29    char in_buffer[BufferSize];\r
30    char out_buffer[BufferSize];\r
31 } io_t;\r
32 \r
33 // functions\r
34 \r
35 extern bool io_is_ok      (const io_t * io);\r
36 \r
37 extern void io_init       (io_t * io);\r
38 extern void io_close      (io_t * io);\r
39 \r
40 extern void io_get_update (io_t * io);\r
41 \r
42 extern bool io_peek       (io_t * io);\r
43 \r
44 extern bool io_line_ready (const io_t * io);\r
45 extern bool io_get_line   (io_t * io, char string[], int size);\r
46 \r
47 extern void io_send       (io_t * io, const char format[], ...);\r
48 extern void io_send_queue (io_t * io, const char format[], ...);\r
49 \r
50 #endif // !defined IO_H\r
51 \r
52 // end of io.h\r
53 \r