diff options
author | David Robillard <d@drobilla.net> | 2018-12-30 13:52:33 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2018-12-31 11:37:48 -0500 |
commit | ef3554df938fbe419615c270573d72994f0bb67d (patch) | |
tree | 35e3b10d12b3cc0c212e02487f6514227b282c63 | |
parent | 0edc2af7dde0593eda7c42211be2590c26859a4f (diff) | |
download | serd-ef3554df938fbe419615c270573d72994f0bb67d.tar.gz serd-ef3554df938fbe419615c270573d72994f0bb67d.tar.bz2 serd-ef3554df938fbe419615c270573d72994f0bb67d.zip |
Use simpler names for statement flags
-rw-r--r-- | serd/serd.h | 10 | ||||
-rw-r--r-- | src/n3.c | 8 | ||||
-rw-r--r-- | src/writer.c | 24 |
3 files changed, 21 insertions, 21 deletions
diff --git a/serd/serd.h b/serd/serd.h index 11b1e8c3..0b4e118a 100644 --- a/serd/serd.h +++ b/serd/serd.h @@ -166,11 +166,11 @@ typedef enum { Flags indicating inline abbreviation information for a statement. */ typedef enum { - SERD_EMPTY_S = 1 << 0, /**< Empty blank node subject */ - SERD_ANON_S_BEGIN = 1 << 1, /**< Start of anonymous subject */ - SERD_ANON_O_BEGIN = 1 << 2, /**< Start of anonymous object */ - SERD_LIST_S_BEGIN = 1 << 3, /**< Start of list subject */ - SERD_LIST_O_BEGIN = 1 << 4, /**< Start of list object */ + SERD_EMPTY_S = 1 << 0, /**< Empty blank node subject */ + SERD_ANON_S = 1 << 1, /**< Start of anonymous subject */ + SERD_ANON_O = 1 << 2, /**< Start of anonymous object */ + SERD_LIST_S = 1 << 3, /**< Start of list subject */ + SERD_LIST_O = 1 << 4 /**< Start of list object */ } SerdStatementFlag; /** @@ -935,9 +935,9 @@ read_anon(SerdReader* reader, ReadContext ctx, bool subject, SerdNode** dest) bool empty; eat_byte_safe(reader, '['); if ((empty = peek_delim(reader, ']'))) { - *ctx.flags |= (subject) ? SERD_EMPTY_S : SERD_ANON_O_BEGIN; + *ctx.flags |= (subject) ? SERD_EMPTY_S : SERD_ANON_O; } else { - *ctx.flags |= (subject) ? SERD_ANON_S_BEGIN : SERD_ANON_O_BEGIN; + *ctx.flags |= (subject) ? SERD_ANON_S : SERD_ANON_O; if (peek_delim(reader, '=')) { if (!(*dest = read_blankName(reader)) || !eat_delim(reader, ';')) { @@ -1137,10 +1137,10 @@ read_collection(SerdReader* reader, ReadContext ctx, SerdNode** dest) *dest = end ? reader->rdf_nil : blank_id(reader); if (ctx.subject) { // subject predicate _:head - *ctx.flags |= (end ? 0 : SERD_LIST_O_BEGIN); + *ctx.flags |= (end ? 0 : SERD_LIST_O); TRY(st, emit_statement(reader, ctx, *dest)); } else { - *ctx.flags |= (end ? 0 : SERD_LIST_S_BEGIN); + *ctx.flags |= (end ? 0 : SERD_LIST_S); } if (end) { diff --git a/src/writer.c b/src/writer.c index eb909f04..90395a0b 100644 --- a/src/writer.c +++ b/src/writer.c @@ -448,8 +448,8 @@ is_inline_start(const SerdWriter* writer, SerdStatementFlags flags) { return (supports_abbrev(writer) && - ((field == SERD_SUBJECT && (flags & SERD_ANON_S_BEGIN)) || - (field == SERD_OBJECT && (flags & SERD_ANON_O_BEGIN)))); + ((field == SERD_SUBJECT && (flags & SERD_ANON_S)) || + (field == SERD_OBJECT && (flags & SERD_ANON_O)))); } static bool @@ -621,8 +621,8 @@ write_blank(SerdWriter* const writer, if (supports_abbrev(writer)) { if (is_inline_start(writer, field, flags)) { return write_sep(writer, SEP_ANON_BEGIN); - } else if ((field == SERD_SUBJECT && (flags & SERD_LIST_S_BEGIN)) || - (field == SERD_OBJECT && (flags & SERD_LIST_O_BEGIN))) { + } else if ((field == SERD_SUBJECT && (flags & SERD_LIST_S)) || + (field == SERD_OBJECT && (flags & SERD_LIST_O))) { return write_sep(writer, SEP_LIST_BEGIN); } else if (field == SERD_SUBJECT && (flags & SERD_EMPTY_S)) { /* Last character is technically a separator, but reset because we @@ -804,9 +804,9 @@ serd_writer_write_statement(SerdWriter* writer, if (serd_stack_is_empty(&writer->anon_stack)) { write_node(writer, subject, SERD_SUBJECT, flags); - if (!(flags & (SERD_ANON_S_BEGIN | SERD_LIST_S_BEGIN))) { + if (!(flags & (SERD_ANON_S | SERD_LIST_S))) { write_sep(writer, SEP_S_P); - } else if (flags & SERD_ANON_S_BEGIN) { + } else if (flags & SERD_ANON_S) { write_sep(writer, SEP_ANON_S_P); } } else { @@ -816,14 +816,14 @@ serd_writer_write_statement(SerdWriter* writer, reset_context(writer, false); serd_node_set(&writer->context.subject, subject); - if (!(flags & SERD_LIST_S_BEGIN)) { + if (!(flags & SERD_LIST_S)) { write_pred(writer, flags, predicate); } write_node(writer, object, SERD_OBJECT, flags); } - if (flags & (SERD_LIST_S_BEGIN)) { + if (flags & (SERD_LIST_S)) { WriteContext* ctx = (WriteContext*)serd_stack_push( &writer->anon_stack, sizeof(WriteContext)); *ctx = writer->context; @@ -833,7 +833,7 @@ serd_writer_write_statement(SerdWriter* writer, writer->context = new_context; } - if (flags & (SERD_LIST_O_BEGIN)) { + if (flags & (SERD_LIST_O)) { WriteContext* ctx = (WriteContext*)serd_stack_push( &writer->anon_stack, sizeof(WriteContext)); *ctx = writer->context; @@ -843,15 +843,15 @@ serd_writer_write_statement(SerdWriter* writer, writer->context = new_context; } - if (flags & (SERD_ANON_S_BEGIN|SERD_ANON_O_BEGIN)) { + if (flags & (SERD_ANON_S|SERD_ANON_O)) { WriteContext* ctx = (WriteContext*)serd_stack_push( &writer->anon_stack, sizeof(WriteContext)); *ctx = writer->context; WriteContext new_context = { - (flags & (SERD_LIST_S_BEGIN|SERD_LIST_O_BEGIN)) + (flags & (SERD_LIST_S|SERD_LIST_O)) ? CTX_LIST : CTX_BLANK, serd_node_copy(graph), serd_node_copy(subject), NULL }; - if ((flags & SERD_ANON_S_BEGIN)) { + if ((flags & SERD_ANON_S)) { new_context.predicate = serd_node_copy(predicate); } writer->context = new_context; |