aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/serd/serd.h38
-rw-r--r--src/env.c2
-rw-r--r--src/n3.c12
-rw-r--r--src/reader.c26
-rw-r--r--src/reader.h10
-rw-r--r--src/serd_internal.h6
-rw-r--r--src/serdi.c8
-rw-r--r--src/writer.c8
8 files changed, 55 insertions, 55 deletions
diff --git a/include/serd/serd.h b/include/serd/serd.h
index fcc8fb47..08b81269 100644
--- a/include/serd/serd.h
+++ b/include/serd/serd.h
@@ -686,37 +686,37 @@ serd_node_equals(const SerdNode* SERD_NULLABLE a,
*/
/**
- Sink (callback) for errors.
+ Callback function for errors.
@param handle Handle for user data.
@param error Error description.
*/
-typedef SerdStatus (*SerdErrorSink)(void* SERD_NULLABLE handle,
+typedef SerdStatus (*SerdErrorFunc)(void* SERD_NULLABLE handle,
const SerdError* SERD_NONNULL error);
/**
- Sink (callback) for base URI changes
+ Sink function for base URI changes
Called whenever the base URI of the serialisation changes.
*/
-typedef SerdStatus (*SerdBaseSink)(void* SERD_NULLABLE handle,
+typedef SerdStatus (*SerdBaseFunc)(void* SERD_NULLABLE handle,
const SerdNode* SERD_NONNULL uri);
/**
- Sink (callback) for namespace definitions
+ Sink function for namespace definitions
Called whenever a prefix is defined in the serialisation.
*/
-typedef SerdStatus (*SerdPrefixSink)(void* SERD_NULLABLE handle,
+typedef SerdStatus (*SerdPrefixFunc)(void* SERD_NULLABLE handle,
const SerdNode* SERD_NONNULL name,
const SerdNode* SERD_NONNULL uri);
/**
- Sink (callback) for statements
+ Sink function for statements
Called for every RDF statement in the serialisation.
*/
-typedef SerdStatus (*SerdStatementSink)(void* SERD_NULLABLE handle,
+typedef SerdStatus (*SerdStatementFunc)(void* SERD_NULLABLE handle,
SerdStatementFlags flags,
const SerdNode* SERD_NULLABLE graph,
const SerdNode* SERD_NONNULL subject,
@@ -724,13 +724,13 @@ typedef SerdStatus (*SerdStatementSink)(void* SERD_NULLABLE handle,
const SerdNode* SERD_NONNULL object);
/**
- Sink (callback) for anonymous node end markers
+ Sink function for anonymous node end markers
This is called to indicate that the anonymous node with the given
`value` will no longer be referred to by any future statements
(i.e. the anonymous serialisation of the node is finished).
*/
-typedef SerdStatus (*SerdEndSink)(void* SERD_NULLABLE handle,
+typedef SerdStatus (*SerdEndFunc)(void* SERD_NULLABLE handle,
const SerdNode* SERD_NONNULL node);
/**
@@ -807,7 +807,7 @@ serd_env_expand_node(const SerdEnv* SERD_NONNULL env,
SERD_API
void
serd_env_foreach(const SerdEnv* SERD_NONNULL env,
- SerdPrefixSink SERD_NONNULL func,
+ SerdPrefixFunc SERD_NONNULL func,
void* SERD_NULLABLE handle);
/**
@@ -822,10 +822,10 @@ SerdReader* SERD_ALLOCATED
serd_reader_new(SerdSyntax syntax,
void* SERD_NULLABLE handle,
void (*SERD_NULLABLE free_handle)(void* SERD_NULLABLE),
- SerdBaseSink SERD_NULLABLE base_sink,
- SerdPrefixSink SERD_NULLABLE prefix_sink,
- SerdStatementSink SERD_NULLABLE statement_sink,
- SerdEndSink SERD_NULLABLE end_sink);
+ SerdBaseFunc SERD_NULLABLE base_func,
+ SerdPrefixFunc SERD_NULLABLE prefix_func,
+ SerdStatementFunc SERD_NULLABLE statement_func,
+ SerdEndFunc SERD_NULLABLE end_func);
/**
Enable or disable strict parsing
@@ -841,13 +841,13 @@ serd_reader_set_strict(SerdReader* SERD_NONNULL reader, bool strict);
/**
Set a function to be called when errors occur during reading.
- The `error_sink` will be called with `handle` as its first argument. If
+ The `error_func` will be called with `handle` as its first argument. If
no error function is set, errors are printed to stderr in GCC style.
*/
SERD_API
void
serd_reader_set_error_sink(SerdReader* SERD_NONNULL reader,
- SerdErrorSink SERD_NULLABLE error_sink,
+ SerdErrorFunc SERD_NULLABLE error_func,
void* SERD_NULLABLE error_handle);
/// Return the `handle` passed to serd_reader_new()
@@ -1000,13 +1000,13 @@ serd_buffer_sink_finish(SerdBuffer* SERD_NONNULL stream);
/**
Set a function to be called when errors occur during writing.
- The `error_sink` will be called with `handle` as its first argument. If
+ The `error_func` will be called with `handle` as its first argument. If
no error function is set, errors are printed to stderr.
*/
SERD_API
void
serd_writer_set_error_sink(SerdWriter* SERD_NONNULL writer,
- SerdErrorSink SERD_NONNULL error_sink,
+ SerdErrorFunc SERD_NONNULL error_func,
void* SERD_NULLABLE error_handle);
/**
diff --git a/src/env.c b/src/env.c
index de10ca6b..66457df8 100644
--- a/src/env.c
+++ b/src/env.c
@@ -230,7 +230,7 @@ serd_env_expand_node(const SerdEnv* env, const SerdNode* node)
}
void
-serd_env_foreach(const SerdEnv* env, SerdPrefixSink func, void* handle)
+serd_env_foreach(const SerdEnv* env, SerdPrefixFunc func, void* handle)
{
for (size_t i = 0; i < env->n_prefixes; ++i) {
func(handle, env->prefixes[i].name, env->prefixes[i].uri);
diff --git a/src/n3.c b/src/n3.c
index 4ea6adbe..4c4b9eb9 100644
--- a/src/n3.c
+++ b/src/n3.c
@@ -1091,8 +1091,8 @@ read_anon(SerdReader* reader, ReadContext ctx, bool subject, Ref* dest)
return r_err(reader, SERD_ERR_BAD_SYNTAX, "`.' inside blank\n");
}
read_ws_star(reader);
- if (reader->end_sink) {
- reader->end_sink(reader->handle, deref(reader, *dest));
+ if (reader->end_func) {
+ reader->end_func(reader->handle, deref(reader, *dest));
}
*ctx.flags = old_flags;
}
@@ -1432,8 +1432,8 @@ read_base(SerdReader* reader, bool sparql, bool token)
Ref uri = 0;
TRY(st, read_IRIREF(reader, &uri));
- if (reader->base_sink) {
- TRY(st, reader->base_sink(reader->handle, deref(reader, uri)));
+ if (reader->base_func) {
+ TRY(st, reader->base_func(reader->handle, deref(reader, uri)));
}
pop_node(reader, uri);
@@ -1472,8 +1472,8 @@ read_prefixID(SerdReader* reader, bool sparql, bool token)
Ref uri = 0;
TRY(st, read_IRIREF(reader, &uri));
- if (reader->prefix_sink) {
- st = reader->prefix_sink(
+ if (reader->prefix_func) {
+ st = reader->prefix_func(
reader->handle, deref(reader, name), deref(reader, uri));
}
diff --git a/src/reader.c b/src/reader.c
index 0c4ff5e2..d5de67d2 100644
--- a/src/reader.c
+++ b/src/reader.c
@@ -37,7 +37,7 @@ r_err(SerdReader* reader, SerdStatus st, const char* fmt, ...)
va_start(args, fmt);
const Cursor* const cur = &reader->source.cur;
const SerdError e = {st, cur->filename, cur->line, cur->col, fmt, &args};
- serd_error(reader->error_sink, reader->error_handle, &e);
+ serd_error(reader->error_func, reader->error_handle, &e);
va_end(args);
return st;
}
@@ -132,9 +132,9 @@ emit_statement(SerdReader* reader, ReadContext ctx, Ref o)
graph = reader->default_graph;
}
- const SerdStatus st = !reader->statement_sink
+ const SerdStatus st = !reader->statement_func
? SERD_SUCCESS
- : reader->statement_sink(reader->handle,
+ : reader->statement_func(reader->handle,
*ctx.flags,
graph,
deref(reader, ctx.subject),
@@ -169,18 +169,18 @@ SerdReader*
serd_reader_new(SerdSyntax syntax,
void* handle,
void (*free_handle)(void*),
- SerdBaseSink base_sink,
- SerdPrefixSink prefix_sink,
- SerdStatementSink statement_sink,
- SerdEndSink end_sink)
+ SerdBaseFunc base_func,
+ SerdPrefixFunc prefix_func,
+ SerdStatementFunc statement_func,
+ SerdEndFunc end_func)
{
SerdReader* me = (SerdReader*)calloc(1, sizeof(SerdReader));
me->handle = handle;
me->free_handle = free_handle;
- me->base_sink = base_sink;
- me->prefix_sink = prefix_sink;
- me->statement_sink = statement_sink;
- me->end_sink = end_sink;
+ me->base_func = base_func;
+ me->prefix_func = prefix_func;
+ me->statement_func = statement_func;
+ me->end_func = end_func;
me->default_graph = NULL;
me->stack = serd_stack_new(SERD_PAGE_SIZE);
me->syntax = syntax;
@@ -202,10 +202,10 @@ serd_reader_set_strict(SerdReader* reader, bool strict)
void
serd_reader_set_error_sink(SerdReader* reader,
- SerdErrorSink error_sink,
+ SerdErrorFunc error_func,
void* error_handle)
{
- reader->error_sink = error_sink;
+ reader->error_func = error_func;
reader->error_handle = error_handle;
}
diff --git a/src/reader.h b/src/reader.h
index c598f6b3..8df16da3 100644
--- a/src/reader.h
+++ b/src/reader.h
@@ -59,11 +59,11 @@ typedef struct {
struct SerdReaderImpl {
void* handle;
void (*free_handle)(void* ptr);
- SerdBaseSink base_sink;
- SerdPrefixSink prefix_sink;
- SerdStatementSink statement_sink;
- SerdEndSink end_sink;
- SerdErrorSink error_sink;
+ SerdBaseFunc base_func;
+ SerdPrefixFunc prefix_func;
+ SerdStatementFunc statement_func;
+ SerdEndFunc end_func;
+ SerdErrorFunc error_func;
void* error_handle;
Ref rdf_first;
Ref rdf_rest;
diff --git a/src/serd_internal.h b/src/serd_internal.h
index 139e6659..e16a2c12 100644
--- a/src/serd_internal.h
+++ b/src/serd_internal.h
@@ -33,10 +33,10 @@
/* Error reporting */
static inline void
-serd_error(SerdErrorSink error_sink, void* handle, const SerdError* e)
+serd_error(SerdErrorFunc error_func, void* handle, const SerdError* e)
{
- if (error_sink) {
- error_sink(handle, e);
+ if (error_func) {
+ error_func(handle, e);
} else {
fprintf(stderr, "error: %s:%u:%u: ", e->filename, e->line, e->col);
vfprintf(stderr, e->fmt, *e->args);
diff --git a/src/serdi.c b/src/serdi.c
index 62d1e44a..c54d82e6 100644
--- a/src/serdi.c
+++ b/src/serdi.c
@@ -343,10 +343,10 @@ main(int argc, char** argv)
serd_reader_new(input_syntax,
writer,
NULL,
- (SerdBaseSink)serd_writer_set_base_uri,
- (SerdPrefixSink)serd_writer_set_prefix,
- (SerdStatementSink)serd_writer_write_statement,
- (SerdEndSink)serd_writer_end_anon);
+ (SerdBaseFunc)serd_writer_set_base_uri,
+ (SerdPrefixFunc)serd_writer_set_prefix,
+ (SerdStatementFunc)serd_writer_write_statement,
+ (SerdEndFunc)serd_writer_end_anon);
serd_reader_set_strict(reader, !lax);
if (quiet) {
diff --git a/src/writer.c b/src/writer.c
index c70c5f1d..e23058f0 100644
--- a/src/writer.c
+++ b/src/writer.c
@@ -99,7 +99,7 @@ struct SerdWriterImpl {
SerdURIView root_uri;
SerdStack anon_stack;
SerdByteSink byte_sink;
- SerdErrorSink error_sink;
+ SerdErrorFunc error_func;
void* error_handle;
WriteContext context;
SerdNode* list_subj;
@@ -143,7 +143,7 @@ w_err(SerdWriter* writer, SerdStatus st, const char* fmt, ...)
va_list args;
va_start(args, fmt);
const SerdError e = {st, "", 0, 0, fmt, &args};
- serd_error(writer->error_sink, writer->error_handle, &e);
+ serd_error(writer->error_func, writer->error_handle, &e);
va_end(args);
}
@@ -981,10 +981,10 @@ serd_writer_new(SerdSyntax syntax,
void
serd_writer_set_error_sink(SerdWriter* writer,
- SerdErrorSink error_sink,
+ SerdErrorFunc error_func,
void* error_handle)
{
- writer->error_sink = error_sink;
+ writer->error_func = error_func;
writer->error_handle = error_handle;
}