Played around with nitfol build process, adding rules to generate the
[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 #include "fileref.h"
8
9 enum StreamType
10 {
11         STREAM_TYPE_WINDOW,
12         STREAM_TYPE_MEMORY,
13         STREAM_TYPE_FILE
14 };
15
16 /**
17  * glk_stream_struct:
18  *
19  * This is an opaque structure (see <link linkend="chimara-Opaque-Structures">
20  * Opaque Structures</link> and should not be accessed directly.
21  */
22 struct glk_stream_struct
23 {
24         /*< private >*/
25         glui32 magic, rock;
26         /* Pointer to the list node in the global stream list that contains this
27         stream */
28         GList* stream_list;
29         /* Stream parameters */
30         glui32 file_mode;
31         glui32 read_count;
32         glui32 write_count;
33         enum StreamType type;
34         /* Specific to window stream: the window this stream is connected to */
35         winid_t window;
36         /* For memory and file streams */
37         gboolean unicode;
38         /* Specific to memory streams */
39         gchar *buffer;
40         glui32 *ubuffer;
41         glui32 mark;
42         glui32 buflen;
43         /* Specific to file streams */
44         FILE *file_pointer;
45         gboolean binary;
46         gchar *filename; /* Displayable filename in UTF-8 for error handling */
47
48         gchar *style; /* Name of the current style */
49 };
50
51 G_GNUC_INTERNAL strid_t window_stream_new(winid_t window);
52 G_GNUC_INTERNAL strid_t file_stream_new(frefid_t fileref, glui32 fmode, glui32 rock, gboolean unicode);
53 G_GNUC_INTERNAL void stream_close_common(strid_t str, stream_result_t *result);
54
55 #endif