summaryrefslogtreecommitdiffstats
path: root/src
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
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')
-rw-r--r--src/plugin.c8
-rw-r--r--src/slv2_internal.h2
-rw-r--r--src/world.c36
3 files changed, 45 insertions, 1 deletions
diff --git a/src/plugin.c b/src/plugin.c
index e86b16a..ce5299e 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -63,6 +63,7 @@ slv2_plugin_new(SLV2World world, SLV2Value uri, SLV2Value bundle_uri)
plugin->ports = NULL;
plugin->num_ports = 0;
plugin->loaded = false;
+ plugin->replaced = false;
return plugin;
}
@@ -775,6 +776,13 @@ slv2_plugin_get_author_homepage(SLV2Plugin plugin)
}
SLV2_API
+bool
+slv2_plugin_is_replaced(SLV2Plugin plugin)
+{
+ return plugin->replaced;
+}
+
+SLV2_API
SLV2UIs
slv2_plugin_get_uis(SLV2Plugin p)
{
diff --git a/src/slv2_internal.h b/src/slv2_internal.h
index b1f223f..c6b8a41 100644
--- a/src/slv2_internal.h
+++ b/src/slv2_internal.h
@@ -123,6 +123,7 @@ struct _SLV2Plugin {
SLV2Port* ports;
uint32_t num_ports;
bool loaded;
+ bool replaced;
};
SLV2Plugin slv2_plugin_new(SLV2World world, SLV2Value uri, SLV2Value bundle_uri);
@@ -231,6 +232,7 @@ struct _SLV2World {
SLV2PluginClass lv2_plugin_class;
SLV2PluginClasses plugin_classes;
SLV2Plugins plugins;
+ SLV2Node dc_replaces_node;
SLV2Node dyn_manifest_node;
SLV2Node lv2_specification_node;
SLV2Node lv2_plugin_node;
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);