summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--slv2/plugin.h6
-rw-r--r--slv2/plugininstance.h28
-rw-r--r--src/plugin.c49
-rw-r--r--src/port.c28
-rw-r--r--src/slv2_internal.h2
-rw-r--r--src/value.c4
-rw-r--r--test/slv2_test.c63
7 files changed, 43 insertions, 137 deletions
diff --git a/slv2/plugin.h b/slv2/plugin.h
index 56509ea..473a12b 100644
--- a/slv2/plugin.h
+++ b/slv2/plugin.h
@@ -210,9 +210,9 @@ slv2_plugin_get_value_by_qname_i18n(SLV2Plugin p,
* Time = Query
*/
SLV2Values
-slv2_plugin_get_value_for_subject(SLV2Plugin p,
- SLV2Value subject_uri,
- SLV2Value predicate_uri);
+slv2_plugin_get_value_for_subject(SLV2Plugin p,
+ SLV2Value subject_uri,
+ SLV2Value predicate_uri);
/** Return whether a feature is supported by a plugin.
diff --git a/slv2/plugininstance.h b/slv2/plugininstance.h
index 56573c8..7c7dc92 100644
--- a/slv2/plugininstance.h
+++ b/slv2/plugininstance.h
@@ -23,7 +23,6 @@
extern "C" {
#endif
-#include <assert.h>
#include <stddef.h>
#include "lv2.h"
#include "slv2/plugin.h"
@@ -96,9 +95,6 @@ slv2_instance_free(SLV2Instance instance);
static inline const char*
slv2_instance_get_uri(SLV2Instance instance)
{
- assert(instance);
- assert(instance->lv2_descriptor);
-
return instance->lv2_descriptor->URI;
}
@@ -113,10 +109,6 @@ slv2_instance_connect_port(SLV2Instance instance,
uint32_t port_index,
void* data_location)
{
- assert(instance);
- assert(instance->lv2_descriptor);
- assert(instance->lv2_descriptor->connect_port);
-
instance->lv2_descriptor->connect_port
(instance->lv2_handle, port_index, data_location);
}
@@ -131,9 +123,6 @@ slv2_instance_connect_port(SLV2Instance instance,
static inline void
slv2_instance_activate(SLV2Instance instance)
{
- assert(instance);
- assert(instance->lv2_descriptor);
-
if (instance->lv2_descriptor->activate)
instance->lv2_descriptor->activate(instance->lv2_handle);
}
@@ -148,10 +137,6 @@ static inline void
slv2_instance_run(SLV2Instance instance,
uint32_t sample_count)
{
- assert(instance);
- assert(instance->lv2_descriptor);
- assert(instance->lv2_handle);
-
/*if (instance->lv2_descriptor->run)*/
instance->lv2_descriptor->run(instance->lv2_handle, sample_count);
}
@@ -165,10 +150,6 @@ slv2_instance_run(SLV2Instance instance,
static inline void
slv2_instance_deactivate(SLV2Instance instance)
{
- assert(instance);
- assert(instance->lv2_descriptor);
- assert(instance->lv2_handle);
-
if (instance->lv2_descriptor->deactivate)
instance->lv2_descriptor->deactivate(instance->lv2_handle);
}
@@ -183,9 +164,6 @@ static inline const void*
slv2_instance_get_extension_data(SLV2Instance instance,
const char* uri)
{
- assert(instance);
- assert(instance->lv2_descriptor);
-
if (instance->lv2_descriptor->extension_data)
return instance->lv2_descriptor->extension_data(uri);
else
@@ -203,9 +181,6 @@ slv2_instance_get_extension_data(SLV2Instance instance,
static inline const LV2_Descriptor*
slv2_instance_get_descriptor(SLV2Instance instance)
{
- assert(instance);
- assert(instance->lv2_descriptor);
-
return instance->lv2_descriptor;
}
@@ -220,9 +195,6 @@ slv2_instance_get_descriptor(SLV2Instance instance)
static inline LV2_Handle
slv2_instance_get_handle(SLV2Instance instance)
{
- assert(instance);
- assert(instance->lv2_descriptor);
-
return instance->lv2_handle;
}
diff --git a/src/plugin.c b/src/plugin.c
index b58a3ec..1986f2c 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -404,23 +404,11 @@ slv2_plugin_get_value(SLV2Plugin p,
char* query = NULL;
/* Hack around broken RASQAL, full URI predicates don't work :/ */
-
- if (predicate->type == SLV2_VALUE_URI) {
- query = slv2_strjoin(
- "PREFIX slv2predicate: <", slv2_value_as_string(predicate), ">\n",
- "SELECT DISTINCT ?value WHERE {\n"
- "<> slv2predicate: ?value .\n"
- "}\n", NULL);
- } else if (predicate->type == SLV2_VALUE_QNAME) {
- query = slv2_strjoin(
- "SELECT DISTINCT ?value WHERE {\n"
- "<> ", slv2_value_as_string(predicate), " ?value .\n"
- "}\n", NULL);
- } else {
- fprintf(stderr, "slv2_plugin_get_value error: "
- "predicate is not a URI or QNAME\n");
- return NULL;
- }
+ query = slv2_strjoin(
+ "PREFIX slv2predicate: <", slv2_value_as_string(predicate), ">\n",
+ "SELECT DISTINCT ?value WHERE {\n"
+ "<> slv2predicate: ?value .\n"
+ "}\n", NULL);
SLV2Values result = slv2_plugin_query_variable(p, query, 0);
@@ -480,27 +468,16 @@ slv2_plugin_get_value_for_subject(SLV2Plugin p,
char* query = NULL;
- /* Hack around broken RASQAL, full URI predicates don't work :/ */
+
char* subject_token = slv2_value_get_turtle_token(subject);
- if (predicate->type == SLV2_VALUE_URI) {
- query = slv2_strjoin(
- "PREFIX slv2predicate: <", slv2_value_as_string(predicate), ">\n",
- "SELECT DISTINCT ?value WHERE {\n",
- subject_token, " slv2predicate: ?value .\n"
- "}\n", NULL);
- } else if (predicate->type == SLV2_VALUE_QNAME) {
- query = slv2_strjoin(
- "SELECT DISTINCT ?value WHERE {\n",
- subject_token, " ", slv2_value_as_string(predicate), " ?value .\n"
- "}\n", NULL);
- } else {
- fprintf(stderr, "slv2_plugin_get_value error: "
- "predicate is not a URI or QNAME\n");
- free(subject_token);
- return NULL;
- }
+ /* Hack around broken RASQAL, full URI predicates don't work :/ */
+ query = slv2_strjoin(
+ "PREFIX slv2predicate: <", slv2_value_as_string(predicate), ">\n",
+ "SELECT DISTINCT ?value WHERE {\n",
+ subject_token, " slv2predicate: ?value .\n"
+ "}\n", NULL);
SLV2Values result = slv2_plugin_query_variable(p, query, 0);
@@ -514,6 +491,7 @@ slv2_plugin_get_value_for_subject(SLV2Plugin p,
SLV2Values
slv2_plugin_get_properties(SLV2Plugin p)
{
+ // FIXME: APIBREAK: This predicate does not even exist. Remove this function.
return slv2_plugin_get_value_by_qname(p, "lv2:pluginProperty");
}
@@ -521,6 +499,7 @@ slv2_plugin_get_properties(SLV2Plugin p)
SLV2Values
slv2_plugin_get_hints(SLV2Plugin p)
{
+ // FIXME: APIBREAK: This predicate does not even exist. Remove this function.
return slv2_plugin_get_value_by_qname(p, "lv2:pluginHint");
}
diff --git a/src/port.c b/src/port.c
index bf7ab19..e72aba0 100644
--- a/src/port.c
+++ b/src/port.c
@@ -156,27 +156,13 @@ slv2_port_get_value(SLV2Plugin p,
char* query = NULL;
/* Hack around broken RASQAL, full URI predicates don't work :/ */
-
- if (predicate->type == SLV2_VALUE_URI) {
- query = slv2_strjoin(
- "PREFIX slv2predicate: <", slv2_value_as_string(predicate), ">",
- "SELECT DISTINCT ?value WHERE { \n"
- "<", slv2_value_as_uri(p->plugin_uri), "> lv2:port ?port .\n"
- "?port lv2:symbol \"", slv2_value_as_string(port->symbol), "\";\n\t",
- " slv2predicate: ?value .\n"
- "}\n", NULL);
- } else if (predicate->type == SLV2_VALUE_QNAME) {
- query = slv2_strjoin(
- "SELECT DISTINCT ?value WHERE { \n"
- "<", slv2_value_as_uri(p->plugin_uri), "> lv2:port ?port .\n"
- "?port lv2:symbol \"", slv2_value_as_string(port->symbol), "\";\n\t",
- slv2_value_as_string(predicate), " ?value .\n"
- "}\n", NULL);
- } else {
- fprintf(stderr, "slv2_port_get_value error: "
- "predicate is not a URI or QNAME\n");
- return NULL;
- }
+ query = slv2_strjoin(
+ "PREFIX slv2predicate: <", slv2_value_as_string(predicate), ">",
+ "SELECT DISTINCT ?value WHERE { \n"
+ "<", slv2_value_as_uri(p->plugin_uri), "> lv2:port ?port .\n"
+ "?port lv2:symbol \"", slv2_value_as_string(port->symbol), "\";\n\t",
+ " slv2predicate: ?value .\n"
+ "}\n", NULL);
SLV2Values result = slv2_plugin_query_variable(p, query, 0);
diff --git a/src/slv2_internal.h b/src/slv2_internal.h
index ecb7255..9aea9f9 100644
--- a/src/slv2_internal.h
+++ b/src/slv2_internal.h
@@ -188,7 +188,7 @@ void slv2_ui_free(SLV2UI ui);
typedef enum _SLV2ValueType {
SLV2_VALUE_URI,
- SLV2_VALUE_QNAME,
+ SLV2_VALUE_QNAME_UNUSED, ///< FIXME: APIBREAK: remove
SLV2_VALUE_STRING,
SLV2_VALUE_INT,
SLV2_VALUE_FLOAT,
diff --git a/src/value.c b/src/value.c
index ba39754..ae24a68 100644
--- a/src/value.c
+++ b/src/value.c
@@ -208,8 +208,8 @@ slv2_value_equals(SLV2Value value, SLV2Value other)
switch (value->type) {
case SLV2_VALUE_URI:
return (librdf_uri_equals(value->val.uri_val, other->val.uri_val) != 0);
- case SLV2_VALUE_QNAME:
case SLV2_VALUE_STRING:
+ case SLV2_VALUE_QNAME_UNUSED:
return ! strcmp(value->str_val, other->str_val);
case SLV2_VALUE_INT:
return (value->val.int_val == other->val.int_val);
@@ -236,8 +236,8 @@ slv2_value_get_turtle_token(SLV2Value value)
result = calloc(len, sizeof(char));
snprintf(result, len, "<%s>", value->str_val);
break;
- case SLV2_VALUE_QNAME:
case SLV2_VALUE_STRING:
+ case SLV2_VALUE_QNAME_UNUSED:
result = strdup(value->str_val);
break;
case SLV2_VALUE_INT:
diff --git a/test/slv2_test.c b/test/slv2_test.c
index 47e5d6c..9c1348f 100644
--- a/test/slv2_test.c
+++ b/test/slv2_test.c
@@ -99,18 +99,6 @@ load_all_bundles()
return 1;
}
-int
-load_bundle()
-{
- SLV2Value uri;
- if (!init_world())
- return 0;
- uri = slv2_value_new_uri(world, bundle_dir_uri);
- slv2_world_load_bundle(world, uri);
- slv2_value_free(uri);
- return 1;
-}
-
void
create_bundle(char *manifest, char *content)
{
@@ -121,13 +109,10 @@ create_bundle(char *manifest, char *content)
}
int
-start_bundle(char *manifest, char *content, int load_all)
+start_bundle(char *manifest, char *content)
{
create_bundle(manifest, content);
- if (load_all)
- return load_all_bundles();
- else
- return load_bundle();
+ return load_all_bundles();
}
void
@@ -223,8 +208,7 @@ test_value()
"lv2:port [ "
" a lv2:ControlPort ; a lv2:InputPort ; "
" lv2:index 0 ; lv2:symbol \"foo\" ; lv2:name \"Foo\" ; "
- "] .",
- 1))
+ "] ."))
return 0;
init_uris();
@@ -383,7 +367,7 @@ discovery_verify_plugin(SLV2Plugin plugin)
}
int
-test_discovery_variant(int load_all)
+test_discovery()
{
SLV2Plugins plugins;
@@ -394,8 +378,7 @@ test_discovery_variant(int load_all)
PLUGIN_NAME("Test plugin") " ; "
LICENSE_GPL " ; "
"lv2:port [ a lv2:ControlPort ; a lv2:InputPort ;"
- " lv2:index 0 ; lv2:symbol \"foo\" ; lv2:name \"bar\" ; ] .",
- load_all))
+ " lv2:index 0 ; lv2:symbol \"foo\" ; lv2:name \"bar\" ; ] ."))
return 0;
init_uris();
@@ -466,17 +449,6 @@ test_discovery_variant(int load_all)
return 1;
}
-int
-test_discovery_load_bundle()
-{
- return test_discovery_variant(0);
-}
-
-int
-test_discovery_load_all()
-{
- return test_discovery_variant(1);
-}
/*****************************************************************************/
@@ -490,8 +462,7 @@ test_verify()
PLUGIN_NAME("Test plugin") " ; "
LICENSE_GPL " ; "
"lv2:port [ a lv2:ControlPort ; a lv2:InputPort ;"
- " lv2:index 0 ; lv2:symbol \"foo\" ; lv2:name \"bar\" ] .",
- 1))
+ " lv2:index 0 ; lv2:symbol \"foo\" ; lv2:name \"bar\" ] ."))
return 0;
init_uris();
@@ -512,8 +483,7 @@ test_no_verify()
if (!start_bundle(MANIFEST_PREFIXES
":plug a lv2:Plugin ; lv2:binary <foo.so> ; rdfs:seeAlso <plugin.ttl> .\n",
BUNDLE_PREFIXES
- ":plug a lv2:Plugin . ",
- 1))
+ ":plug a lv2:Plugin . "))
return 0;
init_uris();
@@ -540,8 +510,7 @@ test_classes()
"lv2:port [ "
" a lv2:ControlPort ; a lv2:InputPort ; "
" lv2:index 0 ; lv2:symbol \"foo\" ; lv2:name \"Foo\" ; "
- "] .",
- 1))
+ "] ."))
return 0;
init_uris();
@@ -603,8 +572,7 @@ test_plugin()
" lv2:index 2 ; lv2:symbol \"latency\" ; lv2:name \"Latency\" ; "
" lv2:portProperty lv2:reportsLatency "
"] . \n"
- ":thing doap:name \"Something else\" .\n",
- 1))
+ ":thing doap:name \"Something else\" .\n"))
return 0;
init_uris();
@@ -721,7 +689,11 @@ test_plugin()
TEST_ASSERT(thing_name);
TEST_ASSERT(slv2_value_is_string(thing_name));
TEST_ASSERT(!strcmp(slv2_value_as_string(thing_name), "Something else"));
+
+ SLV2UIs uis = slv2_plugin_get_uis(plug);
+ TEST_ASSERT(slv2_uis_size(uis) == 0);
+ slv2_uis_free(uis);
slv2_values_free(thing_names);
slv2_value_free(thing_uri);
slv2_value_free(name_p);
@@ -758,8 +730,7 @@ test_port()
" lv2:index 1 ; lv2:symbol \"event_in\" ; "
" lv2:name \"Event Input\" ; "
" lv2ev:supportsEvent <http://example.org/event> "
- "] .",
- 1))
+ "] ."))
return 0;
init_uris();
@@ -921,8 +892,7 @@ test_ui()
" lv2ui:optionalFeature lv2ui:ext_presets . "
":ui2 a lv2ui:GtkUI ; lv2ui:binary <ui2.so> . "
":ui3 a lv2ui:GtkUI ; lv2ui:binary <ui3.so> . "
- ":ui4 a lv2ui:GtkUI ; lv2ui:binary <ui4.so> . ",
- 1))
+ ":ui4 a lv2ui:GtkUI ; lv2ui:binary <ui4.so> . "))
return 0;
init_uris();
@@ -997,10 +967,9 @@ static struct TestCase tests[] = {
TEST_CASE(utils),
TEST_CASE(value),
TEST_CASE(values),
- /* TEST_CASE(discovery_load_bundle), */
TEST_CASE(verify),
TEST_CASE(no_verify),
- TEST_CASE(discovery_load_all),
+ TEST_CASE(discovery),
TEST_CASE(classes),
TEST_CASE(plugin),
TEST_CASE(port),