summaryrefslogtreecommitdiffstats
path: root/src/world.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-03-11 00:06:07 +0000
committerDavid Robillard <d@drobilla.net>2011-03-11 00:06:07 +0000
commit0ad295a550f8637cbc71cf15652f94a0cba763d6 (patch)
tree780fc86cb4ac8cc3c0da6454c6e0a77968b5eb1c /src/world.c
parent21d99cda2491dca95217a4a0012020da31090d8a (diff)
downloadlilv-0ad295a550f8637cbc71cf15652f94a0cba763d6.tar.gz
lilv-0ad295a550f8637cbc71cf15652f94a0cba763d6.tar.bz2
lilv-0ad295a550f8637cbc71cf15652f94a0cba763d6.zip
Add slv2_plugin_is_replaced to allow hosts to hide old plugins.
git-svn-id: http://svn.drobilla.net/lad/trunk/slv2@3066 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/world.c')
-rw-r--r--src/world.c36
1 files changed, 35 insertions, 1 deletions
diff --git a/src/world.c b/src/world.c
index 97539c0..f014d1a 100644
--- a/src/world.c
+++ b/src/world.c
@@ -65,11 +65,13 @@ slv2_world_new()
world->plugins = slv2_plugins_new();
#define NS_DYNMAN (const uint8_t*)"http://lv2plug.in/ns/ext/dynmanifest#"
+#define NS_DC (const uint8_t*)"http://dublincore.org/documents/dcmi-namespace/"
#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->world, uri));
+ world->dc_replaces_node = NEW_URI(NS_DC "replaces");
world->dyn_manifest_node = NEW_URI(NS_DYNMAN "DynManifest");
world->lv2_specification_node = NEW_URI(SLV2_NS_LV2 "Specification");
world->lv2_plugin_node = NEW_URI(SLV2_NS_LV2 "Plugin");
@@ -127,6 +129,7 @@ slv2_world_free(SLV2World world)
slv2_plugin_class_free(world->lv2_plugin_class);
world->lv2_plugin_class = NULL;
+ slv2_node_free(world, world->dc_replaces_node);
slv2_node_free(world, world->dyn_manifest_node);
slv2_node_free(world, world->lv2_specification_node);
slv2_node_free(world, world->lv2_plugin_node);
@@ -430,7 +433,7 @@ slv2_world_load_bundle(SLV2World world, SLV2Value bundle_uri)
}
slv2_match_end(dmanifests);
#endif // SLV2_DYN_MANIFEST
-
+
// ?specification a lv2:Specification
SLV2Matches spec_results = slv2_world_find_statements(
world, world->model,
@@ -660,6 +663,37 @@ slv2_world_load_all(SLV2World world)
// Discover bundles and read all manifest files into model
slv2_world_load_path(world, lv2_path);
+ SLV2_FOREACH(p, world->plugins) {
+ SLV2Plugin plugin = slv2_collection_get(world->plugins, p);
+ SLV2Value plugin_uri = slv2_plugin_get_uri(plugin);
+
+ // ?new dc:replaces plugin
+ SLV2Matches replacements = slv2_world_find_statements(
+ world, world->model,
+ NULL,
+ world->dc_replaces_node,
+ slv2_value_as_node(plugin_uri),
+ NULL);
+ FOREACH_MATCH(replacements) {
+ SLV2Node subject = slv2_match_subject(replacements);
+ SLV2Node object = slv2_match_object(replacements);
+ if (sord_node_get_type(subject) != SORD_URI
+ || sord_node_get_type(object) != SORD_URI) {
+ continue;
+ }
+
+ SLV2Value subject_val = slv2_value_new_from_node(world, subject);
+ SLV2Value object_val = slv2_value_new_from_node(world, object);
+
+ fprintf(stderr, "%s REPLACES %s\n",
+ slv2_value_as_uri(subject_val),
+ slv2_value_as_uri(object_val));
+
+ plugin->replaced = true;
+ }
+ slv2_match_end(replacements);
+ }
+
// Query out things to cache
slv2_world_load_specifications(world);
slv2_world_load_plugin_classes(world);