diff options
author | David Robillard <d@drobilla.net> | 2020-10-10 12:31:29 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2023-12-02 18:49:08 -0500 |
commit | 155f5e2f24c24f5b5ffbf13fcea5cf1a355ec372 (patch) | |
tree | 5f5f7009e96379aa0e31cb1db3757f8d6589669f /src | |
parent | e8f392d57bf6eba9b62509a32e4073e8b34b18e2 (diff) | |
download | serd-155f5e2f24c24f5b5ffbf13fcea5cf1a355ec372.tar.gz serd-155f5e2f24c24f5b5ffbf13fcea5cf1a355ec372.tar.bz2 serd-155f5e2f24c24f5b5ffbf13fcea5cf1a355ec372.zip |
[WIP] Simplify reader and writer flags
[WIP] Testing?
Diffstat (limited to 'src')
-rw-r--r-- | src/read_ntriples.c | 3 | ||||
-rw-r--r-- | src/read_turtle.c | 2 | ||||
-rw-r--r-- | src/writer.c | 8 |
3 files changed, 7 insertions, 6 deletions
diff --git a/src/read_ntriples.c b/src/read_ntriples.c index 6822b64f..7a43e4c2 100644 --- a/src/read_ntriples.c +++ b/src/read_ntriples.c @@ -240,7 +240,8 @@ read_STRING_LITERAL(SerdReader* const reader, static bool avoid_blank_clashes(const SerdReader* const reader) { - return reader->syntax == SERD_TURTLE || reader->syntax == SERD_TRIG; + return (reader->syntax == SERD_TURTLE || reader->syntax == SERD_TRIG) && + !(reader->flags & SERD_READ_VERBATIM); } static SerdStatus diff --git a/src/read_turtle.c b/src/read_turtle.c index 042393e0..613b33d2 100644 --- a/src/read_turtle.c +++ b/src/read_turtle.c @@ -372,7 +372,7 @@ read_IRIREF(SerdReader* const reader, SerdNode** const dest) return st; } - return (reader->flags & SERD_READ_RELATIVE) + return (reader->flags & SERD_READ_VERBATIM) ? SERD_SUCCESS : resolve_IRIREF(reader, *dest, string_start_offset); } diff --git a/src/writer.c b/src/writer.c index 31daa71c..fa1abd9f 100644 --- a/src/writer.c +++ b/src/writer.c @@ -801,10 +801,10 @@ write_literal(SerdWriter* const writer, SERD_NODISCARD static SerdStatus write_full_uri_node(SerdWriter* const writer, const SerdNode* const node) { - SerdStatus st = SERD_SUCCESS; - const bool resolve_disabled = writer->flags & SERD_WRITE_UNRESOLVED; + SerdStatus st = SERD_SUCCESS; + const bool verbatim = (writer->flags & SERD_WRITE_VERBATIM); - if (resolve_disabled || !serd_env_base_uri(writer->env)) { + if (verbatim || !serd_env_base_uri(writer->env)) { // Resolution disabled or we have no base URI, simply write the node TRY(st, esink("<", 1, writer)); TRY(st, write_uri_from_node(writer, node)); @@ -855,7 +855,7 @@ write_uri_node(SerdWriter* const writer, SerdStringView prefix = {NULL, 0}; SerdStringView suffix = {NULL, 0}; - if (has_scheme && !(writer->flags & SERD_WRITE_UNQUALIFIED) && + if (has_scheme && !(writer->flags & SERD_WRITE_EXPANDED) && !serd_env_qualify(writer->env, string, &prefix, &suffix)) { TRY(st, write_lname(writer, prefix.data, prefix.length)); TRY(st, esink(":", 1, writer)); |