summaryrefslogtreecommitdiffstats
path: root/src/syntax.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-02-16 02:13:22 +0000
committerDavid Robillard <d@drobilla.net>2011-02-16 02:13:22 +0000
commit35feabf61e3a2f9c15cb21ee5ec047f3c9937765 (patch)
tree96b2af356c060cde43533f98210efa3be19b8907 /src/syntax.c
parent36c03b3f4e878f2a207cb08e80b06a1503568ed0 (diff)
downloadsord-35feabf61e3a2f9c15cb21ee5ec047f3c9937765.tar.gz
sord-35feabf61e3a2f9c15cb21ee5ec047f3c9937765.tar.bz2
sord-35feabf61e3a2f9c15cb21ee5ec047f3c9937765.zip
Add world object (to intern nodes and sanely support several models per library instance).
git-svn-id: http://svn.drobilla.net/sord/trunk@34 3d64ff67-21c5-427c-a301-fe4f08042e5a
Diffstat (limited to 'src/syntax.c')
-rw-r--r--src/syntax.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/syntax.c b/src/syntax.c
index 1cff77b..7444fe5 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -32,6 +32,7 @@ typedef struct {
SordNode graph_uri_node;
SerdNode base_uri_node;
SerdURI base_uri;
+ SordWorld world;
Sord sord;
} ReadState;
@@ -99,12 +100,12 @@ sord_node_from_serd_node(ReadState* state, const SerdNode* sn)
case SERD_NOTHING:
return NULL;
case SERD_LITERAL:
- return sord_new_literal(state->sord, NULL, sn->buf, NULL);
+ return sord_new_literal(state->world, NULL, sn->buf, NULL);
case SERD_URI: {
SerdURI abs_uri;
SerdNode abs_uri_node = serd_node_new_uri_from_node(
sn, &state->base_uri, &abs_uri);
- SordNode ret = sord_new_uri(state->sord, abs_uri_node.buf);
+ SordNode ret = sord_new_uri(state->world, abs_uri_node.buf);
serd_node_free(&abs_uri_node);
return ret;
}
@@ -120,7 +121,7 @@ sord_node_from_serd_node(ReadState* state, const SerdNode* sn)
memcpy(buf, uri_prefix.buf, uri_prefix.len);
memcpy(buf + uri_prefix.len, uri_suffix.buf, uri_suffix.len);
buf[uri_len] = '\0';
- SordNode ret = sord_new_uri_counted(state->sord,
+ SordNode ret = sord_new_uri_counted(state->world,
buf, uri_prefix.len + uri_suffix.len);
free(buf);
return ret;
@@ -128,7 +129,7 @@ sord_node_from_serd_node(ReadState* state, const SerdNode* sn)
case SERD_BLANK_ID:
case SERD_ANON_BEGIN:
case SERD_ANON:
- return sord_new_blank(state->sord, sn->buf);
+ return sord_new_blank(state->world, sn->buf);
}
return NULL;
}
@@ -229,7 +230,9 @@ sord_read_file_handle(Sord sord,
base_uri_n_bytes - 1, // FIXME: UTF-8
base_uri_str };
- ReadState state = { NULL, env, graph, base_uri_node, base_uri, sord };
+ ReadState state = { NULL, env, graph,
+ base_uri_node, base_uri,
+ sord_get_world(sord), sord };
state.reader = serd_reader_new(
SERD_TURTLE, &state,