aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2019-03-10 16:32:02 +0100
committerDavid Robillard <d@drobilla.net>2023-12-02 18:49:07 -0500
commit99141be3df23c17ab219c08c8e496c4bb41297e6 (patch)
treed6a5825bdfe0d22b33658bf9c12f6c94c899909a /src
parentee946a0de13a22ff83c288aa64ef3f4fd381da75 (diff)
downloadserd-99141be3df23c17ab219c08c8e496c4bb41297e6.tar.gz
serd-99141be3df23c17ab219c08c8e496c4bb41297e6.tar.bz2
serd-99141be3df23c17ab219c08c8e496c4bb41297e6.zip
Add initial flags to write context
Diffstat (limited to 'src')
-rw-r--r--src/writer.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/src/writer.c b/src/writer.c
index 23b2c0bd..9fd0110e 100644
--- a/src/writer.c
+++ b/src/writer.c
@@ -44,16 +44,17 @@ typedef enum {
} ContextType;
typedef struct {
- ContextType type;
- SerdNode* graph;
- SerdNode* subject;
- SerdNode* predicate;
- bool predicates;
- bool comma_indented;
+ ContextType type;
+ SerdStatementFlags flags;
+ SerdNode* graph;
+ SerdNode* subject;
+ SerdNode* predicate;
+ bool predicates;
+ bool comma_indented;
} WriteContext;
static const WriteContext WRITE_CONTEXT_NULL =
- {CTX_NAMED, NULL, NULL, NULL, 0U, 0U};
+ {CTX_NAMED, 0U, NULL, NULL, NULL, 0U, 0U};
typedef enum {
SEP_NONE, ///< Sentinel before the start of a document
@@ -208,11 +209,12 @@ ctx(SerdWriter* writer, const SerdField field)
}
SERD_NODISCARD static SerdStatus
-push_context(SerdWriter* const writer,
- const ContextType type,
- const SerdNode* const graph,
- const SerdNode* const subject,
- const SerdNode* const predicate)
+push_context(SerdWriter* const writer,
+ const ContextType type,
+ const SerdStatementFlags flags,
+ const SerdNode* const graph,
+ const SerdNode* const subject,
+ const SerdNode* const predicate)
{
// Push the current context to the stack
void* const top = serd_stack_push(&writer->anon_stack, sizeof(WriteContext));
@@ -225,6 +227,7 @@ push_context(SerdWriter* const writer,
// Update the current context
const WriteContext current = {type,
+ flags,
serd_node_copy(graph),
serd_node_copy(subject),
serd_node_copy(predicate),
@@ -1096,6 +1099,7 @@ serd_writer_write_statement(SerdWriter* const writer,
TRY(st,
push_context(writer,
is_list ? CTX_LIST : CTX_BLANK,
+ flags,
graph,
subject,
is_list ? NULL : predicate));
@@ -1106,6 +1110,7 @@ serd_writer_write_statement(SerdWriter* const writer,
TRY(st,
push_context(writer,
(flags & SERD_LIST_O) ? CTX_LIST : CTX_BLANK,
+ flags,
graph,
object,
NULL));