aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2019-03-10 16:32:02 +0100
committerDavid Robillard <d@drobilla.net>2019-04-13 19:48:23 +0200
commitd9283fc609d22299bd1615de6e00cce43329a07c (patch)
tree4a82217dd2f777a3b565c7ce496bf029310f2744
parentedf7d6cbfd03184af131d419d65607ed9847a233 (diff)
downloadserd-d9283fc609d22299bd1615de6e00cce43329a07c.tar.gz
serd-d9283fc609d22299bd1615de6e00cce43329a07c.tar.bz2
serd-d9283fc609d22299bd1615de6e00cce43329a07c.zip
Add initial flags to write context
-rw-r--r--src/writer.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/src/writer.c b/src/writer.c
index 303385a4..4c40ca6c 100644
--- a/src/writer.c
+++ b/src/writer.c
@@ -40,13 +40,14 @@ typedef enum {
typedef struct
{
- ContextType type;
- SerdNode* graph;
- SerdNode* subject;
- SerdNode* predicate;
+ ContextType type;
+ SerdStatementFlags flags;
+ SerdNode* graph;
+ SerdNode* subject;
+ SerdNode* predicate;
} WriteContext;
-static const WriteContext WRITE_CONTEXT_NULL = { CTX_NAMED, NULL, NULL, NULL };
+static const WriteContext WRITE_CONTEXT_NULL = {CTX_NAMED, 0, NULL, NULL, NULL};
typedef enum {
SEP_NONE,
@@ -721,18 +722,19 @@ write_list_obj(SerdWriter* writer,
}
static WriteContext*
-push_context(SerdWriter* const writer,
- const ContextType type,
- const SerdNode* const g,
- const SerdNode* const s,
- const SerdNode* const p)
+push_context(SerdWriter* const writer,
+ const ContextType type,
+ const SerdStatementFlags flags,
+ const SerdNode* const g,
+ const SerdNode* const s,
+ const SerdNode* const p)
{
WriteContext* old = (WriteContext*)serd_stack_push(&writer->anon_stack,
sizeof(WriteContext));
*old = writer->context;
const WriteContext new_context = {
- type, serd_node_copy(g), serd_node_copy(s), serd_node_copy(p)
+ type, flags, serd_node_copy(g), serd_node_copy(s), serd_node_copy(p)
};
writer->context = new_context;
@@ -850,17 +852,18 @@ serd_writer_write_statement(SerdWriter* writer,
WriteContext* old_ctx = NULL;
if (flags & SERD_LIST_S) {
- old_ctx = push_context(writer, CTX_LIST, graph, subject, NULL);
+ old_ctx = push_context(writer, CTX_LIST, flags, graph, subject, NULL);
}
if (flags & SERD_LIST_O) {
- old_ctx = push_context(writer, CTX_LIST, graph, object, NULL);
+ old_ctx = push_context(writer, CTX_LIST, flags, graph, object, NULL);
}
if (flags & (SERD_ANON_S | SERD_ANON_O)) {
old_ctx = push_context(
writer,
(flags & (SERD_LIST_S | SERD_LIST_O)) ? CTX_LIST : CTX_BLANK,
+ flags,
graph,
subject,
(flags & SERD_ANON_S) ? predicate : NULL);