git: Line endings of README.txt
[projects/chimara/chimara.git] / libchimara / stream.h
1 #ifndef STREAM_H
2 #define STREAM_H
3
4 #include <gtk/gtk.h>
5 #include "chimara-glk-private.h"
6 #include "glk.h"
7 #include "gi_dispa.h"
8 #include "window.h"
9 #include "fileref.h"
10
11 enum StreamType
12 {
13         STREAM_TYPE_WINDOW,
14         STREAM_TYPE_MEMORY,
15         STREAM_TYPE_FILE,
16         STREAM_TYPE_RESOURCE
17 };
18
19 /**
20  * glk_stream_struct:
21  *
22  * This is an opaque structure (see <link linkend="chimara-Opaque-Structures">
23  * Opaque Structures</link> and should not be accessed directly.
24  */
25 struct glk_stream_struct
26 {
27         /*< private >*/
28         glui32 magic, rock;
29         gidispatch_rock_t disprock;
30         /* Pointer to the list node in the global stream list that contains this
31         stream */
32         GList* stream_list;
33         /* Stream parameters */
34         glui32 file_mode;
35         glui32 read_count;
36         glui32 write_count;
37         enum StreamType type;
38         /* Specific to window stream: the window this stream is connected to */
39         winid_t window;
40         /* For memory, file, and resource streams */
41         gboolean unicode;
42         /* For file and resource streams */
43         gboolean binary;
44         /* For memory and resource streams */
45         char *buffer;
46         glui32 *ubuffer;
47         glui32 mark;
48         glui32 endmark;
49         glui32 buflen;
50         /* Specific to memory streams */
51         gidispatch_rock_t buffer_rock;
52         /* Specific to file streams */
53         FILE *file_pointer;
54         gchar *filename; /* Displayable filename in UTF-8 for error handling */
55         glui32 lastop; /* 0, filemode_Write, or filemode_Read */
56
57         gchar *style; /* Name of the current style */
58         gchar *glk_style; /* Name of the current glk style override */
59         gboolean hyperlink_mode; /* When turned on, text written to the stream will be a hyperlink */
60 };
61
62 G_GNUC_INTERNAL strid_t file_stream_new(frefid_t fileref, glui32 fmode, glui32 rock, gboolean unicode);
63 G_GNUC_INTERNAL strid_t stream_new_common(glui32 rock);
64 G_GNUC_INTERNAL void stream_close_common(strid_t str, stream_result_t *result);
65
66 #endif