From 65b623afe376e0331e106f00f487b755d555b7d1 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Wed, 3 Apr 2019 00:03:02 +0200 Subject: Stylesheet saving skeleton --- libstorycode/storycode.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'libstorycode/storycode.c') diff --git a/libstorycode/storycode.c b/libstorycode/storycode.c index b34785d..7fe46d7 100644 --- a/libstorycode/storycode.c +++ b/libstorycode/storycode.c @@ -27,10 +27,13 @@ #include #include +#include #include "narrative.h" #include "slide.h" #include "stylesheet.h" +#include "narrative_priv.h" +#include "slide_priv.h" #include "storycode_parse.h" #include "storycode_lex.h" @@ -48,3 +51,42 @@ Narrative *storycode_parse_presentation(const char *sc) return parse_ctx.n; } + + +static int write_string(GOutputStream *fh, char *str) +{ + gssize r; + GError *error = NULL; + r = g_output_stream_write(fh, str, strlen(str), NULL, &error); + if ( r == -1 ) { + fprintf(stderr, "Write failed: %s\n", error->message); + return 1; + } + return 0; +} + + +int storycode_write_presentation(Narrative *n, GOutputStream *fh) +{ + int i; + char *ss_text; + + /* Stylesheet */ + ss_text = stylesheet_serialise(n->stylesheet); + if ( ss_text == NULL ) return 1; + if ( write_string(fh, ss_text) ) return 1; + + for ( i=0; in_items; i++ ) { + + gssize r; + GError *error = NULL; + char *a = "Hello"; + + r = g_output_stream_write(fh, a, strlen(a), NULL, &error); + if ( r == -1 ) { + fprintf(stderr, "Write failed: %s\n", error->message); + return 1; + } + } + return 0; +} -- cgit v1.2.3