Separated library source code from testing code, fixing #6
[rodin/chimara.git] / libchimara / stream.h
1 #ifndef STREAM_H
2 #define STREAM_H
3
4 #include <gtk/gtk.h>
5 #include "glk.h"
6 #include "window.h"
7
8 enum StreamType
9 {
10         STREAM_TYPE_WINDOW,
11         STREAM_TYPE_MEMORY,
12         STREAM_TYPE_FILE
13 };
14
15 /**
16  * glk_stream_struct:
17  *
18  * This is an opaque structure (see <link linkend="chimara-Opaque-Structures">
19  * Opaque Structures</link> and should not be accessed directly.
20  */
21 struct glk_stream_struct
22 {
23         /*< private >*/
24         glui32 magic, rock;
25         /* Pointer to the list node in the global stream list that contains this
26         stream */
27         GList* stream_list;
28         /* Stream parameters */
29         glui32 file_mode;
30         glui32 read_count;
31         glui32 write_count;
32         enum StreamType type;
33         /* Specific to window stream: the window this stream is connected to */
34         winid_t window;
35         /* For memory and file streams */
36         gboolean unicode;
37         /* Specific to memory streams */
38         gchar *buffer;
39         glui32 *ubuffer;
40         glui32 mark;
41         glui32 buflen;
42         /* Specific to file streams */
43         FILE *file_pointer;
44         gboolean binary;
45         gchar *filename; /* Displayable filename in UTF-8 for error handling */
46
47         gchar *style; /* Name of the current style */
48 };
49
50 G_GNUC_INTERNAL strid_t window_stream_new(winid_t window);
51 G_GNUC_INTERNAL void stream_close_common(strid_t str, stream_result_t *result);
52 #endif