From af5a7af4ac4aada57c2e95f47fef6dd7ff6a31b2 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 10 Mar 2019 16:32:02 +0100 Subject: Add initial flags to write context --- src/writer.c | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/writer.c b/src/writer.c index fa15a47a..b3ca783f 100644 --- a/src/writer.c +++ b/src/writer.c @@ -40,14 +40,16 @@ typedef enum { typedef struct { - ContextType type; - SerdNode* graph; - SerdNode* subject; - SerdNode* predicate; - bool indented_object; + ContextType type; + SerdStatementFlags flags; + SerdNode* graph; + SerdNode* subject; + SerdNode* predicate; + bool indented_object; } WriteContext; static const WriteContext WRITE_CONTEXT_NULL = {CTX_NAMED, + 0, NULL, NULL, NULL, @@ -156,19 +158,24 @@ free_context(SerdWriter* writer) } static void -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* top = (WriteContext*)serd_stack_push(&writer->anon_stack, sizeof(WriteContext)); *top = writer->context; - const WriteContext new_context = { - type, serd_node_copy(g), serd_node_copy(s), serd_node_copy(p), false}; + const WriteContext new_context = {type, + flags, + serd_node_copy(g), + serd_node_copy(s), + serd_node_copy(p), + false}; writer->context = new_context; } @@ -876,9 +883,9 @@ serd_writer_write_statement(SerdWriter* writer, } if (flags & SERD_LIST_S) { - push_context(writer, CTX_LIST, graph, subject, NULL); + push_context(writer, CTX_LIST, flags, graph, subject, NULL); } if (flags & SERD_LIST_O) { - push_context(writer, CTX_LIST, graph, object, NULL); + push_context(writer, CTX_LIST, flags, graph, object, NULL); } if (flags & (SERD_ANON_S | SERD_ANON_O)) { @@ -887,6 +894,7 @@ serd_writer_write_statement(SerdWriter* writer, push_context(writer, is_list ? CTX_LIST : CTX_BLANK, + flags, graph, subject, is_subject ? predicate : NULL); -- cgit v1.2.1