From 35feabf61e3a2f9c15cb21ee5ec047f3c9937765 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 16 Feb 2011 02:13:22 +0000 Subject: 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 --- src/syntax.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/syntax.c') 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, -- cgit v1.2.1