X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;ds=sidebyside;f=libchimara%2Fstream.c;h=f9a6cf5bf4cea649c405ff7382dc8a5767276707;hb=cbb35cca2d0a87a664e5d72fe71dce45c3030823;hp=0113b989edfe9245cbf66d025758e42f35141ca4;hpb=23e5517a7005693faf3a6789309f41f61d945fed;p=projects%2Fchimara%2Fchimara.git
diff --git a/libchimara/stream.c b/libchimara/stream.c
index 0113b98..f9a6cf5 100644
--- a/libchimara/stream.c
+++ b/libchimara/stream.c
@@ -284,6 +284,7 @@ glk_stream_open_memory(char *buf, glui32 buflen, glui32 fmode, glui32 rock)
str->file_mode = fmode;
str->type = STREAM_TYPE_MEMORY;
str->mark = 0;
+ str->endmark = 0;
str->unicode = FALSE;
if(buf && buflen)
@@ -322,6 +323,7 @@ glk_stream_open_memory_uni(glui32 *buf, glui32 buflen, glui32 fmode, glui32 rock
str->file_mode = fmode;
str->type = STREAM_TYPE_MEMORY;
str->mark = 0;
+ str->endmark = 0;
str->unicode = TRUE;
if(buf && buflen)
@@ -486,6 +488,64 @@ glk_stream_open_file_uni(frefid_t fileref, glui32 fmode, glui32 rock)
return file_stream_new(fileref, fmode, rock, TRUE);
}
+/**
+ * glk_stream_open_resource:
+ * @filenum: Resource chunk number to open.
+ * @rock: The new stream's rock value.
+ *
+ * Open the given data resource for reading (only), as a normal stream.
+ *
+ *
+ * Note that there is no notion of file usage — the resource does not
+ * have to be specified as saved game
or whatever.
+ *
+ *
+ * If no resource chunk of the given number exists, the open function returns
+ * %NULL.
+ *
+ * As with file streams, a binary resource stream reads the resource as bytes. A
+ * text resource stream reads characters encoded as Latin-1.
+ *
+ * When reading from a resource stream, newlines are not remapped, even if they
+ * normally would be when reading from a text file on the host OS. If you read a
+ * line (glk_get_line_stream() or glk_get_line_stream_uni()), a Unix newline
+ * (0x0A) terminates the line.
+ *
+ * Returns: the new stream, or %NULL.
+ */
+strid_t
+glk_stream_open_resource(glui32 filenum, glui32 rock)
+{
+ g_warning("Not implemented");
+ return NULL;
+}
+
+/**
+ * glk_stream_open_resource_uni:
+ * @filenum: Resource chunk number to open.
+ * @rock: The new stream's rock value.
+ *
+ * Open the given data resource for reading (only), as a Unicode stream. See
+ * glk_stream_open_resource() for more information.
+ *
+ * As with file streams, a binary resource stream reads the resource as
+ * four-byte (big-endian) words. A text resource stream reads characters encoded
+ * as UTF-8.
+ *
+ *
+ * Thus, the difference between text and binary resources is only important
+ * when opened as a Unicode stream.
+ *
+ *
+ * Returns: the new stream, or %NULL.
+ */
+strid_t
+glk_stream_open_resource_uni(glui32 filenum, glui32 rock)
+{
+ g_warning("Not implemented");
+ return NULL;
+}
+
/**
* glk_stream_close:
* @str: Stream to close.