aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2019-03-10 16:32:02 +0100
committerDavid Robillard <d@drobilla.net>2020-10-27 13:13:58 +0100
commitaf5a7af4ac4aada57c2e95f47fef6dd7ff6a31b2 (patch)
treeb06fdcc118a938a711220176240a7ea4412e6c2d
parent5e8e744c7bbc7ce9dafd1196a4c30767de5eec16 (diff)
downloadserd-af5a7af4ac4aada57c2e95f47fef6dd7ff6a31b2.tar.gz
serd-af5a7af4ac4aada57c2e95f47fef6dd7ff6a31b2.tar.bz2
serd-af5a7af4ac4aada57c2e95f47fef6dd7ff6a31b2.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 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);