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