From beebe6550e4fc00780b9cff57084bf5da3c56118 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 16 Feb 2011 02:14:40 +0000 Subject: Update for new Sord API. git-svn-id: http://svn.drobilla.net/lad/trunk/slv2@2956 a436a847-0d15-0410-975c-d299462d15a1 --- src/plugin.c | 15 +++++++-------- src/port.c | 6 +++--- src/slv2_internal.h | 1 + src/value.c | 2 +- src/world.c | 15 +++++++++++---- 5 files changed, 23 insertions(+), 16 deletions(-) diff --git a/src/plugin.c b/src/plugin.c index 773f3de..cf6d6d4 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -469,7 +469,7 @@ slv2_plugin_get_value_for_subject(SLV2Plugin p, SLV2Node subject_node = (slv2_value_is_uri(subject)) ? slv2_node_copy(subject->val.uri_val) - : sord_new_blank(p->world->model, + : sord_new_blank(p->world->world, (const uint8_t*)slv2_value_as_blank(subject)); if (!subject_node) { @@ -702,7 +702,7 @@ static SLV2Node slv2_plugin_get_author(SLV2Plugin p) { SLV2Node doap_maintainer = sord_new_uri( - p->world->model, NS_DOAP "maintainer"); + p->world->world, NS_DOAP "maintainer"); SLV2Matches maintainers = slv2_plugin_find_statements( p, @@ -730,7 +730,7 @@ slv2_plugin_get_author_name(SLV2Plugin plugin) if (author) { return slv2_plugin_get_one( plugin, author, sord_new_uri( - plugin->world->model, NS_FOAF "name")); + plugin->world->world, NS_FOAF "name")); } return NULL; } @@ -743,7 +743,7 @@ slv2_plugin_get_author_email(SLV2Plugin plugin) if (author) { return slv2_plugin_get_one( plugin, author, sord_new_uri( - plugin->world->model, NS_FOAF "mbox")); + plugin->world->world, NS_FOAF "mbox")); } return NULL; } @@ -756,7 +756,7 @@ slv2_plugin_get_author_homepage(SLV2Plugin plugin) if (author) { return slv2_plugin_get_one( plugin, author, sord_new_uri( - plugin->world->model, NS_FOAF "homepage")); + plugin->world->world, NS_FOAF "homepage")); } return NULL; } @@ -768,9 +768,8 @@ slv2_plugin_get_uis(SLV2Plugin p) { #define NS_UI (const uint8_t*)"http://lv2plug.in/ns/extensions/ui#" - SLV2Node ui_ui = sord_new_uri(p->world->model, NS_UI "ui"); - - SLV2Node ui_binary_node = sord_new_uri(p->world->model, NS_UI "binary"); + SLV2Node ui_ui = sord_new_uri(p->world->world, NS_UI "ui"); + SLV2Node ui_binary_node = sord_new_uri(p->world->world, NS_UI "binary"); SLV2UIs result = slv2_uis_new(); SLV2Matches uis = slv2_plugin_find_statements( diff --git a/src/port.c b/src/port.c index 49e0d45..6c8867e 100644 --- a/src/port.c +++ b/src/port.c @@ -120,7 +120,7 @@ slv2_port_supports_event(SLV2Plugin p, SLV2Matches results = slv2_plugin_find_statements( p, port_node, - sord_new_uri(p->world->model, NS_EV "supportsEvent"), + sord_new_uri(p->world->world, NS_EV "supportsEvent"), slv2_value_as_node(event)); const bool ret = !slv2_matches_end(results); @@ -144,7 +144,7 @@ slv2_port_get_value_by_qname(SLV2Plugin p, SLV2Matches results = slv2_plugin_find_statements( p, port_node, - sord_new_uri(p->world->model, pred_uri), + sord_new_uri(p->world->world, pred_uri), NULL); free(pred_uri); @@ -266,7 +266,7 @@ slv2_port_get_scale_points(SLV2Plugin p, SLV2Matches points = slv2_plugin_find_statements( p, port_node, - sord_new_uri(p->world->model, SLV2_NS_LV2 "scalePoint"), + sord_new_uri(p->world->world, SLV2_NS_LV2 "scalePoint"), NULL); SLV2ScalePoints ret = NULL; diff --git a/src/slv2_internal.h b/src/slv2_internal.h index 60ed023..1a4e852 100644 --- a/src/slv2_internal.h +++ b/src/slv2_internal.h @@ -190,6 +190,7 @@ void slv2_plugin_classes_free(); /** Model of LV2 (RDF) data loaded from bundles. */ struct _SLV2World { + SordWorld world; Sord model; SerdReader reader; SerdEnv namespaces; diff --git a/src/value.c b/src/value.c index 51ff1a1..0e73aba 100644 --- a/src/value.c +++ b/src/value.c @@ -74,7 +74,7 @@ slv2_value_new(SLV2World world, SLV2ValueType type, const char* str) switch (type) { case SLV2_VALUE_URI: - val->val.uri_val = sord_new_uri(world->model, (const uint8_t*)str); + val->val.uri_val = sord_new_uri(world->world, (const uint8_t*)str); assert(val->val.uri_val); val->str_val = (char*)sord_node_get_string(val->val.uri_val); break; diff --git a/src/world.c b/src/world.c index 8ef301b..b0c4e66 100644 --- a/src/world.c +++ b/src/world.c @@ -46,7 +46,11 @@ slv2_world_new() { SLV2World world = (SLV2World)malloc(sizeof(struct _SLV2World)); - world->model = sord_new(SORD_SPO|SORD_OPS, true); + world->world = sord_world_new(); + if (!world->world) + goto fail; + + world->model = sord_new(world->world, SORD_SPO|SORD_OPS, true); if (!world->model) goto fail; @@ -55,9 +59,9 @@ slv2_world_new() #define NS_DYNMAN (const uint8_t*)"http://lv2plug.in/ns/ext/dynmanifest#" -#define NEW_URI(uri) sord_new_uri(world->model, uri) +#define NEW_URI(uri) sord_new_uri(world->world, uri) #define NEW_URI_VAL(uri) slv2_value_new_from_node( \ - world, sord_new_uri(world->model, uri)); + world, sord_new_uri(world->world, uri)); world->dyn_manifest_node = NEW_URI(NS_DYNMAN "DynManifest"); world->lv2_specification_node = NEW_URI(SLV2_NS_LV2 "Specification"); @@ -160,6 +164,9 @@ slv2_world_free(SLV2World world) sord_free(world->model); world->model = NULL; + sord_world_free(world->world); + world->world = NULL; + serd_env_free(world->namespaces); free(world); @@ -430,7 +437,7 @@ slv2_world_load_bundle(SLV2World world, SLV2Value bundle_uri) SordQuad see_also_tup = { slv2_node_copy(spec), world->rdfs_seealso_node, - sord_new_uri(world->model, manifest_uri.buf), + sord_new_uri(world->world, manifest_uri.buf), NULL }; sord_add(world->model, see_also_tup); -- cgit v1.2.1