aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2019-03-10 16:32:02 +0100
committerDavid Robillard <d@drobilla.net>2020-06-21 18:12:04 +0200
commit68b9271054eb73c8e2a4d4ff49f8068a2e01b0e7 (patch)
tree86fffb8c03454925c3a9d292af2b1ca250e5ba29
parent742bcbd58eda402f3a74ca5167fa7baa57a42714 (diff)
downloadserd-68b9271054eb73c8e2a4d4ff49f8068a2e01b0e7.tar.gz
serd-68b9271054eb73c8e2a4d4ff49f8068a2e01b0e7.tar.bz2
serd-68b9271054eb73c8e2a4d4ff49f8068a2e01b0e7.zip
Add initial flags to write context
-rw-r--r--src/writer.c36
1 files changed, 22 insertions, 14 deletions
diff --git a/src/writer.c b/src/writer.c
index 1cd0c9eb..71e7285d 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,
@@ -155,19 +157,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;
}
@@ -875,9 +882,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)) {
@@ -886,6 +893,7 @@ serd_writer_write_statement(SerdWriter* writer,
push_context(writer,
is_list ? CTX_LIST : CTX_BLANK,
+ flags,
graph,
subject,
is_subject ? predicate : NULL);