aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2018-12-29 20:05:00 -0500
committerDavid Robillard <d@drobilla.net>2020-10-27 13:13:58 +0100
commit47d1df0f22cc8330595b7c0e19762aeb28ac80c6 (patch)
tree1bbd29785516242790d76181a6af63fffe56ffcd
parent6ed3c180ef0d90567bffc2c1120701a6a20e2f03 (diff)
downloadserd-47d1df0f22cc8330595b7c0e19762aeb28ac80c6.tar.gz
serd-47d1df0f22cc8330595b7c0e19762aeb28ac80c6.tar.bz2
serd-47d1df0f22cc8330595b7c0e19762aeb28ac80c6.zip
Rename SerdStyle to SerdWriterFlags
-rw-r--r--serd/serd.h10
-rw-r--r--src/serdi.c4
-rw-r--r--src/writer.c56
3 files changed, 35 insertions, 35 deletions
diff --git a/serd/serd.h b/serd/serd.h
index 4894a99c..6b7e87e9 100644
--- a/serd/serd.h
+++ b/serd/serd.h
@@ -301,7 +301,7 @@ typedef struct {
} SerdURI;
/**
- Syntax style options.
+ Writer style options.
The style of the writer output can be controlled by ORing together
values from this enumeration. Note that some options are only supported
@@ -312,12 +312,12 @@ typedef enum {
SERD_STYLE_ASCII = 1 << 0, /**< Escape all non-ASCII characters. */
SERD_STYLE_UNQUALIFIED = 1 << 1, /**< Do not shorten URIs into CURIEs. */
SERD_STYLE_UNRESOLVED = 1 << 2 /**< Do not make URIs relative. */
-} SerdStyle;
+} SerdWriterFlag;
/**
- Bitwise OR of SerdStyle values.
+ Bitwise OR of SerdWriterFlag values.
*/
-typedef uint32_t SerdStyleFlags;
+typedef uint32_t SerdWriterFlags;
/**
Free memory allocated by Serd.
@@ -1316,7 +1316,7 @@ SERD_API
SerdWriter*
serd_writer_new(SerdWorld* world,
SerdSyntax syntax,
- SerdStyleFlags style,
+ SerdWriterFlags flags,
SerdEnv* env,
SerdWriteFunc write_func,
void* stream);
diff --git a/src/serdi.c b/src/serdi.c
index 566a5c60..32a983c6 100644
--- a/src/serdi.c
+++ b/src/serdi.c
@@ -205,7 +205,7 @@ main(int argc, char** argv)
SerdWorld* world = serd_world_new();
SerdEnv* env = serd_env_new(base);
- const SerdStyleFlags output_style =
+ const SerdWriterFlags writer_flags =
((ascii ? SERD_STYLE_ASCII : 0) | //
(full_uris ? (SERD_STYLE_UNQUALIFIED | SERD_STYLE_UNRESOLVED) : 0));
@@ -214,7 +214,7 @@ main(int argc, char** argv)
SerdWriter* writer = serd_writer_new(world,
output_syntax,
- output_style,
+ writer_flags,
env,
(SerdWriteFunc)serd_byte_sink_write,
byte_sink);
diff --git a/src/writer.c b/src/writer.c
index 02f331bc..042d2bfe 100644
--- a/src/writer.c
+++ b/src/writer.c
@@ -103,24 +103,24 @@ static const SepRule rules[] = {
};
struct SerdWriterImpl {
- SerdWorld* world;
- SerdSink iface;
- SerdSyntax syntax;
- SerdStyleFlags style;
- SerdEnv* env;
- SerdNode* root_node;
- SerdURI root_uri;
- SerdStack anon_stack;
- SerdWriteFunc write_func;
- void* stream;
- SerdErrorSink error_sink;
- void* error_handle;
- WriteContext context;
- unsigned indent;
- char* bprefix;
- size_t bprefix_len;
- Sep last_sep;
- bool empty;
+ SerdWorld* world;
+ SerdSink iface;
+ SerdSyntax syntax;
+ SerdWriterFlags flags;
+ SerdEnv* env;
+ SerdNode* root_node;
+ SerdURI root_uri;
+ SerdStack anon_stack;
+ SerdWriteFunc write_func;
+ void* stream;
+ SerdErrorSink error_sink;
+ void* msg_handle;
+ WriteContext context;
+ unsigned indent;
+ char* bprefix;
+ size_t bprefix_len;
+ Sep last_sep;
+ bool empty;
};
typedef enum {
@@ -221,7 +221,7 @@ write_character(SerdWriter* writer, const uint8_t* utf8, size_t* size)
break;
}
- if (!(writer->style & SERD_STYLE_ASCII)) {
+ if (!(writer->flags & SERD_STYLE_ASCII)) {
// Write UTF-8 character directly to UTF-8 output
return sink(utf8, *size, writer);
}
@@ -567,7 +567,7 @@ write_uri_node(SerdWriter* const writer,
serd_node_equals(node, writer->world->rdf_nil)) {
return sink("()", 2, writer) == 2;
} else if (has_scheme && supports_abbrev(writer) &&
- !(writer->style & SERD_STYLE_UNQUALIFIED) &&
+ !(writer->flags & SERD_STYLE_UNQUALIFIED) &&
serd_env_qualify_in_place(writer->env, node, &prefix, &suffix) &&
is_name(serd_node_string(prefix), serd_node_length(prefix)) &&
is_name(suffix.buf, suffix.len)) {
@@ -578,7 +578,7 @@ write_uri_node(SerdWriter* const writer,
}
sink("<", 1, writer);
- if (!(writer->style & SERD_STYLE_UNRESOLVED) &&
+ if (!(writer->flags & SERD_STYLE_UNRESOLVED) &&
serd_env_base_uri(writer->env)) {
const SerdURI* base_uri = serd_env_get_parsed_base_uri(writer->env);
SerdURI uri;
@@ -931,18 +931,18 @@ serd_writer_finish(SerdWriter* writer)
}
SerdWriter*
-serd_writer_new(SerdWorld* world,
- SerdSyntax syntax,
- SerdStyleFlags style,
- SerdEnv* env,
- SerdWriteFunc write_func,
- void* stream)
+serd_writer_new(SerdWorld* world,
+ SerdSyntax syntax,
+ SerdWriterFlags flags,
+ SerdEnv* env,
+ SerdWriteFunc write_func,
+ void* stream)
{
const WriteContext context = WRITE_CONTEXT_NULL;
SerdWriter* writer = (SerdWriter*)calloc(1, sizeof(SerdWriter));
writer->world = world;
writer->syntax = syntax;
- writer->style = style;
+ writer->flags = flags;
writer->env = env;
writer->root_node = NULL;
writer->root_uri = SERD_URI_NULL;