aboutsummaryrefslogtreecommitdiff
path: root/src/stylesheet.c
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2011-11-04 00:10:03 +0100
committerThomas White <taw@bitwiz.org.uk>2011-11-04 00:10:03 +0100
commit1d1806f5cffa1ffda929de0ef7b74eb6c7df9fba (patch)
treeb84bfbc004af73ecebe2bc29094d1dfc89a7cd7e /src/stylesheet.c
parent04d9338eef4c3b864a1693f8312ce35f9ac8302c (diff)
Add most of the serializer
Diffstat (limited to 'src/stylesheet.c')
-rw-r--r--src/stylesheet.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/stylesheet.c b/src/stylesheet.c
index 69ff98c..61b37fe 100644
--- a/src/stylesheet.c
+++ b/src/stylesheet.c
@@ -574,8 +574,27 @@ StyleSheet *new_stylesheet()
}
-void save_stylesheet(StyleSheet *ss, const char *filename)
+int save_stylesheet(StyleSheet *ss, const char *filename)
{
+ FILE *fh;
+ struct serializer ser;
+
+ fh = fopen(filename, "w");
+ if ( fh == NULL ) return 1;
+
+ /* Set up the serializer */
+ ser.fh = fh;
+ ser.stack_depth = 0;
+ ser.prefix = NULL;
+
+ fprintf(fh, "# Colloquium style sheet file\n");
+ serialize_f(&ser, "version", 0.1);
+
+ serialize_start(&ser, "stylesheet");
+ write_stylesheet(ss, &ser);
+ serialize_end(&ser);
+
+ return 0;
}