summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/reference.doxygen.in2
-rw-r--r--hosts/lv2_jack_host.c20
-rw-r--r--hosts/lv2_simple_jack_host.c20
-rw-r--r--slv2/Makefile.am3
-rw-r--r--slv2/plugin.h18
-rw-r--r--slv2/plugininstance.h2
-rw-r--r--slv2/pluginlist.h46
-rw-r--r--slv2/port.h11
-rw-r--r--slv2/private_types.h5
-rw-r--r--slv2/query.h8
-rw-r--r--slv2/slv2.h1
-rw-r--r--slv2/stringlist.h69
-rw-r--r--slv2/types.h35
-rw-r--r--slv2/util.h10
-rw-r--r--src/Makefile.am2
-rw-r--r--src/plugin.c71
-rw-r--r--src/pluginlist.c39
-rw-r--r--src/port.c72
-rw-r--r--src/query.c64
-rw-r--r--src/stringlist.c (renamed from src/types.c)16
-rw-r--r--utils/lv2_inspect.c26
-rw-r--r--utils/lv2_list.c10
22 files changed, 299 insertions, 251 deletions
diff --git a/doc/reference.doxygen.in b/doc/reference.doxygen.in
index 0d2e936..9eb3e81 100644
--- a/doc/reference.doxygen.in
+++ b/doc/reference.doxygen.in
@@ -422,9 +422,11 @@ WARN_LOGFILE =
INPUT = @top_srcdir@/doc/mainpage.dox \
@top_srcdir@/slv2/types.h \
@top_srcdir@/slv2/pluginlist.h \
+ @top_srcdir@/slv2/stringlist.h \
@top_srcdir@/slv2/plugin.h \
@top_srcdir@/slv2/port.h \
@top_srcdir@/slv2/plugininstance.h \
+ @top_srcdir@/slv2/util.h \
@top_srcdir@/slv2/lv2.h #\
#@top_srcdir@/slv2/query.h #\
#@top_srcdir@/include
diff --git a/hosts/lv2_jack_host.c b/hosts/lv2_jack_host.c
index 6f72449..30ce919 100644
--- a/hosts/lv2_jack_host.c
+++ b/hosts/lv2_jack_host.c
@@ -53,7 +53,7 @@ struct JackHost {
void die(const char* msg);
void create_port(struct JackHost* host, uint32_t port_index);
int jack_process_cb(jack_nframes_t nframes, void* data);
-void list_plugins(SLV2List list);
+void list_plugins(SLV2Plugins list);
int
@@ -67,9 +67,9 @@ main(int argc, char** argv)
slv2_init();
/* Find all installed plugins */
- SLV2List plugins = slv2_list_new();
- slv2_list_load_all(plugins);
- //slv2_list_load_bundle(plugins, "http://www.scs.carleton.ca/~drobilla/files/Amp-swh.lv2");
+ SLV2Plugins plugins = slv2_plugins_new();
+ slv2_plugins_load_all(plugins);
+ //slv2_plugins_load_bundle(plugins, "http://www.scs.carleton.ca/~drobilla/files/Amp-swh.lv2");
/* Find the plugin to run */
const char* plugin_uri = (argc == 2) ? argv[1] : NULL;
@@ -82,11 +82,11 @@ main(int argc, char** argv)
}
printf("URI:\t%s\n", plugin_uri);
- host.plugin = slv2_list_get_plugin_by_uri(plugins, plugin_uri);
+ host.plugin = slv2_plugins_get_by_uri(plugins, plugin_uri);
if (!host.plugin) {
fprintf(stderr, "Failed to find plugin %s.\n", plugin_uri);
- slv2_list_free(plugins);
+ slv2_plugins_free(plugins);
return EXIT_FAILURE;
}
@@ -130,7 +130,7 @@ main(int argc, char** argv)
/* Deactivate plugin and JACK */
slv2_instance_free(host.instance);
- slv2_list_free(plugins);
+ slv2_plugins_free(plugins);
printf("Shutting down JACK.\n");
for (unsigned long i=0; i < host.num_ports; ++i) {
@@ -307,10 +307,10 @@ jack_process_cb(jack_nframes_t nframes, void* data)
void
-list_plugins(SLV2List list)
+list_plugins(SLV2Plugins list)
{
- for (size_t i=0; i < slv2_list_get_length(list); ++i) {
- const SLV2Plugin* const p = slv2_list_get_plugin_by_index(list, i);
+ for (size_t i=0; i < slv2_plugins_size(list); ++i) {
+ const SLV2Plugin* const p = slv2_plugins_get_at(list, i);
printf("%s\n", slv2_plugin_get_uri(p));
}
}
diff --git a/hosts/lv2_simple_jack_host.c b/hosts/lv2_simple_jack_host.c
index 5e1e0a9..e6eeaad 100644
--- a/hosts/lv2_simple_jack_host.c
+++ b/hosts/lv2_simple_jack_host.c
@@ -37,7 +37,7 @@ struct JackHost {
void die(const char* msg);
void create_port(struct JackHost* host, uint32_t port_index);
int jack_process_cb(jack_nframes_t nframes, void* data);
-void list_plugins(SLV2List list);
+void list_plugins(SLV2Plugins list);
int
@@ -52,9 +52,9 @@ main(int argc, char** argv)
slv2_init();
/* Find all installed plugins */
- SLV2List plugins = slv2_list_new();
- slv2_list_load_all(plugins);
- //slv2_list_load_bundle(plugins, "http://www.scs.carleton.ca/~drobilla/files/Amp-swh.lv2");
+ SLV2Plugins plugins = slv2_plugins_new();
+ slv2_plugins_load_all(plugins);
+ //slv2_plugins_load_bundle(plugins, "http://www.scs.carleton.ca/~drobilla/files/Amp-swh.lv2");
/* Find the plugin to run */
const char* plugin_uri = (argc == 2) ? argv[1] : NULL;
@@ -67,11 +67,11 @@ main(int argc, char** argv)
}
printf("URI:\t%s\n", plugin_uri);
- host.plugin = slv2_list_get_plugin_by_uri(plugins, plugin_uri);
+ host.plugin = slv2_plugins_get_by_uri(plugins, plugin_uri);
if (!host.plugin) {
fprintf(stderr, "Failed to find plugin %s.\n", plugin_uri);
- slv2_list_free(plugins);
+ slv2_plugins_free(plugins);
return EXIT_FAILURE;
}
@@ -116,7 +116,7 @@ main(int argc, char** argv)
/* Deactivate plugin and JACK */
slv2_instance_free(host.instance);
- slv2_list_free(plugins);
+ slv2_plugins_free(plugins);
printf("Shutting down JACK.\n");
for (unsigned long i=0; i < host.num_ports; ++i) {
@@ -212,10 +212,10 @@ jack_process_cb(jack_nframes_t nframes, void* data)
void
-list_plugins(SLV2List list)
+list_plugins(SLV2Plugins list)
{
- for (size_t i=0; i < slv2_list_get_length(list); ++i) {
- const SLV2Plugin* const p = slv2_list_get_plugin_by_index(list, i);
+ for (size_t i=0; i < slv2_plugins_size(list); ++i) {
+ const SLV2Plugin* const p = slv2_plugins_get_at(list, i);
printf("%s\n", slv2_plugin_get_uri(p));
}
}
diff --git a/slv2/Makefile.am b/slv2/Makefile.am
index d2153ef..8ce74f2 100644
--- a/slv2/Makefile.am
+++ b/slv2/Makefile.am
@@ -11,4 +11,5 @@ slv2include_HEADERS = \
port.h \
pluginlist.h \
plugininstance.h \
- util.h
+ util.h \
+ stringlist.h
diff --git a/slv2/plugin.h b/slv2/plugin.h
index 5555437..05bba75 100644
--- a/slv2/plugin.h
+++ b/slv2/plugin.h
@@ -32,7 +32,7 @@ extern "C" {
typedef const struct _Plugin SLV2Plugin;
-/** \defgroup data Plugin data file access
+/** \defgroup data Plugin - RDF data access
*
* These functions work exclusively with the plugin's RDF data file. They do
* not load the plugin dynamic library (or access
@@ -95,7 +95,7 @@ slv2_plugin_get_uri(const SLV2Plugin* plugin);
* \return a complete URL eg. "file:///usr/foo/SomeBundle.lv2/someplug.ttl",
* which is shared and must not be modified or free()'d.
*/
-SLV2URIList
+SLV2Strings
slv2_plugin_get_data_uris(const SLV2Plugin* plugin);
@@ -124,7 +124,7 @@ slv2_plugin_get_name(const SLV2Plugin* plugin);
/** Request some arbitrary RDF object of the plugin.
*
* May return NULL if the property was not found (ie is not defined in the
- * data file), or if object is not sensibly represented as an SLV2Value
+ * data file), or if object is not sensibly represented as an SLV2Strings
* (e.g. blank nodes).
*
* Return value must be freed by caller with slv2_value_free.
@@ -134,7 +134,7 @@ slv2_plugin_get_name(const SLV2Plugin* plugin);
* $LANG will be returned if it is set. Otherwise all values will be
* returned.
*/
-SLV2Value
+SLV2Strings
slv2_plugin_get_value(const SLV2Plugin* p,
const char* predicate);
@@ -147,7 +147,7 @@ slv2_plugin_get_value(const SLV2Plugin* p,
*
* Return value must be freed by caller with slv2_value_free.
*/
-SLV2Value
+SLV2Strings
slv2_plugin_get_properties(const SLV2Plugin* p);
@@ -158,7 +158,7 @@ slv2_plugin_get_properties(const SLV2Plugin* p);
*
* Return value must be freed by caller with slv2_value_free.
*/
-SLV2Value
+SLV2Strings
slv2_plugin_get_hints(const SLV2Plugin* p);
@@ -193,7 +193,7 @@ slv2_plugin_get_latency_port(const SLV2Plugin* p);
*
* This returns a list of all supported features (both required and optional).
*/
-SLV2Value
+SLV2Strings
slv2_plugin_get_supported_features(const SLV2Plugin* p);
@@ -202,7 +202,7 @@ slv2_plugin_get_supported_features(const SLV2Plugin* p);
* All feature URI's returned by this call MUST be passed to the plugin's
* instantiate method for the plugin to instantiate successfully.
*/
-SLV2Value
+SLV2Strings
slv2_plugin_get_required_features(const SLV2Plugin* p);
@@ -212,7 +212,7 @@ slv2_plugin_get_required_features(const SLV2Plugin* p);
* instantiate method, those features will be used by the function, otherwise
* the plugin will act as it would if it did not support that feature at all.
*/
-SLV2Value
+SLV2Strings
slv2_plugin_get_optional_features(const SLV2Plugin* p);
diff --git a/slv2/plugininstance.h b/slv2/plugininstance.h
index bf86010..1b475c2 100644
--- a/slv2/plugininstance.h
+++ b/slv2/plugininstance.h
@@ -34,7 +34,7 @@ extern "C" {
typedef const struct _Instance SLV2Instance;
-/** \defgroup lib Plugin library access
+/** \defgroup lib Plugin Instance - Shared library access
*
* An SLV2Instance is an instantiated SLV2Plugin (eg a loaded dynamic
* library). These functions interact with the binary library code only,
diff --git a/slv2/pluginlist.h b/slv2/pluginlist.h
index aca3bb7..5410bc3 100644
--- a/slv2/pluginlist.h
+++ b/slv2/pluginlist.h
@@ -24,16 +24,16 @@ extern "C" {
#endif
-typedef struct _PluginList* SLV2List;
+typedef struct _PluginList* SLV2Plugins;
-/** \defgroup lists Plugin discovery
- *
+/** \defgroup plugins Plugins - Collection of plugins, plugin discovery
+ *
* These functions are for locating plugins installed on the system.
*
* Normal hosts which just want to easily load plugins by URI are strongly
* recommended to simply find all installed plugins with
- * \ref slv2_list_load_all rather than find and load bundles manually.
+ * \ref slv2_plugins_load_all rather than find and load bundles manually.
*
* Functions are provided for hosts that wish to access bundles explicitly and
* individually for some reason, as well as make custom lists of plugins from
@@ -46,10 +46,10 @@ typedef struct _PluginList* SLV2List;
/** Create a new, empty plugin list.
*
- * Returned object must be freed with slv2_list_free.
+ * Returned object must be freed with slv2_plugins_free.
*/
-SLV2List
-slv2_list_new();
+SLV2Plugins
+slv2_plugins_new();
/** Free a plugin list.
@@ -61,10 +61,10 @@ slv2_list_new();
* will have to copy it with slv2_plugin_duplicate().
*
* \a list is invalid after this call (though it may be used again after a
- * "list = slv2_list_new()")
+ * "list = slv2_plugins_new()")
*/
void
-slv2_list_free(SLV2List list);
+slv2_plugins_free(SLV2Plugins list);
/** Add all plugins installed on the system to \a list.
@@ -81,18 +81,18 @@ slv2_list_free(SLV2List list);
* discouraged without a special reason to do so - use this one.
*/
void
-slv2_list_load_all(SLV2List list);
+slv2_plugins_load_all(SLV2Plugins list);
/** Add all plugins found in \a search_path to \a list.
*
* If \a search_path is NULL, \a list will be unmodified.
*
- * Use of this function is \b not recommended. Use \ref slv2_list_load_all.
+ * Use of this function is \b not recommended. Use \ref slv2_plugins_load_all.
*/
void
-slv2_list_load_path(SLV2List list,
- const char* search_path);
+slv2_plugins_load_path(SLV2Plugins list,
+ const char* search_path);
/** Add all plugins found in the bundle at \a bundle_base_url to \a list.
@@ -105,35 +105,37 @@ slv2_list_load_path(SLV2List list,
* remain consistent whatsoever. This function should only be used by apps
* which ship with a special bundle (which it knows exists at some path).
* It is \b not to be used by normal hosts that want to load system
- * installed plugins. Use \ref slv2_list_load_all for that.
+ * installed plugins. Use \ref slv2_plugins_load_all for that.
*/
void
-slv2_list_load_bundle(SLV2List list,
- const char* bundle_base_url);
+slv2_plugins_load_bundle(SLV2Plugins list,
+ const char* bundle_base_url);
/** Get the number of plugins in the list.
*/
size_t
-slv2_list_get_length(const SLV2List list);
+slv2_plugins_size(const SLV2Plugins list);
/** Get a plugin from the list by URI.
*
* Return value is shared (stored in \a list) and must not be freed or
* modified by the caller in any way.
+ * This functions is a search, slv2_plugins_get_at is
+ * significantly faster.
*
* \return NULL if plugin with \a url not found in \a list.
*/
const SLV2Plugin*
-slv2_list_get_plugin_by_uri(const SLV2List list,
- const char* uri);
+slv2_plugins_get_by_uri(const SLV2Plugins list,
+ const char* uri);
/** Get a plugin from the list by index.
*
* \a index has no significance. Any \a index not less than
- * slv2list_get_length(list) will return NULL. * All plugins in a list can
+ * slv2list_get_length(list) will return NULL. All plugins in a list can
* thus be easily enumerated by repeated calls to this function starting
* with \a index 0.
*
@@ -143,8 +145,8 @@ slv2_list_get_plugin_by_uri(const SLV2List list,
* \return NULL if \a index out of range.
*/
const SLV2Plugin*
-slv2_list_get_plugin_by_index(const SLV2List list,
- size_t index);
+slv2_plugins_get_at(const SLV2Plugins list,
+ size_t index);
/** @} */
diff --git a/slv2/port.h b/slv2/port.h
index 5c29774..9106a9c 100644
--- a/slv2/port.h
+++ b/slv2/port.h
@@ -23,8 +23,9 @@
extern "C" {
#endif
-#include "types.h"
-#include "plugin.h"
+#include <slv2/types.h>
+#include <slv2/plugin.h>
+#include <slv2/stringlist.h>
/** \addtogroup data
* @{
@@ -45,7 +46,7 @@ slv2_port_by_symbol(const char* symbol);
/** Port equivalent to slv2_plugin_get_value.
*/
-SLV2Value
+SLV2Strings
slv2_port_get_value(SLV2Plugin* plugin,
SLV2PortID id,
const char* property);
@@ -53,14 +54,14 @@ slv2_port_get_value(SLV2Plugin* plugin,
/** Port equivalent to slv2_plugin_get_properties.
*/
-SLV2Value
+SLV2Strings
slv2_port_get_properties(const SLV2Plugin* p,
SLV2PortID id);
/** Port equivalent to slv2_plugin_get_hints.
*/
-SLV2Value
+SLV2Strings
slv2_port_get_hints(const SLV2Plugin* p,
SLV2PortID id);
diff --git a/slv2/private_types.h b/slv2/private_types.h
index cfdcb9c..abda0a1 100644
--- a/slv2/private_types.h
+++ b/slv2/private_types.h
@@ -69,9 +69,10 @@ struct _PluginList {
};
-typedef raptor_sequence* SLV2URIList;
+/** An ordered, indexable collection of strings. */
+typedef raptor_sequence* SLV2Strings;
-SLV2URIList slv2_uri_list_new();
+SLV2Strings slv2_strings_new();
#ifdef __cplusplus
diff --git a/slv2/query.h b/slv2/query.h
index 3faba15..ea78735 100644
--- a/slv2/query.h
+++ b/slv2/query.h
@@ -82,11 +82,15 @@ rasqal_query_results*
slv2_plugin_query(SLV2Plugin* plugin,
const char* sparql_str);
-SLV2Value
+SLV2Strings
slv2_plugin_simple_query(SLV2Plugin* plugin,
const char* sparql_str,
const char* variable);
+unsigned
+slv2_plugin_query_count(SLV2Plugin* plugin,
+ const char* sparql_str);
+
#if 0
/** Run a SPARQL query on a plugin's data file and return variable matches.
*
@@ -96,7 +100,7 @@ slv2_plugin_simple_query(SLV2Plugin* plugin,
*
* Returned is a list of all matches for the query variable \a var_name.
*/
-SLV2Value
+SLV2Strings
slv2_query_get_results(const SLV2Plugin* p,
const char* query_string,
const char* var_name);
diff --git a/slv2/slv2.h b/slv2/slv2.h
index 44744c9..07e9201 100644
--- a/slv2/slv2.h
+++ b/slv2/slv2.h
@@ -30,6 +30,7 @@ extern "C" {
#include <slv2/plugin.h>
#include <slv2/plugininstance.h>
#include <slv2/pluginlist.h>
+#include <slv2/stringlist.h>
#include <slv2/port.h>
diff --git a/slv2/stringlist.h b/slv2/stringlist.h
new file mode 100644
index 0000000..5ed711b
--- /dev/null
+++ b/slv2/stringlist.h
@@ -0,0 +1,69 @@
+/* SLV2
+ * Copyright (C) 2007 Dave Robillard <http://drobilla.net>
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef __SLV2_STRINGLIST_H__
+#define __SLV2_STRINGLIST_H__
+
+#include <slv2/private_types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/** \defgroup strings Strings - Collection of strings
+ *
+ * SLV2Strings is an ordered collection of strings which is fast for random
+ * access by index (i.e. a fancy array).
+ *
+ * @{
+ */
+
+/** Get the number of elements in a string list.
+ */
+int
+slv2_strings_size(const SLV2Strings list);
+
+
+/** Get a string from a string list at the given index.
+ *
+ * @return the element at @a index, or NULL if index is out of range.
+ */
+char*
+slv2_strings_get_at(const SLV2Strings list, int index);
+
+
+/** Return whether @a list contains @a uri.
+ */
+bool
+slv2_strings_contains(const SLV2Strings list, const char* uri);
+
+
+/** Free a string list. */
+void
+slv2_strings_free(SLV2Strings);
+
+
+/** @} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __SLV2_STRINGLIST_H__ */
+
diff --git a/slv2/types.h b/slv2/types.h
index 4fb8cf4..018c8e2 100644
--- a/slv2/types.h
+++ b/slv2/types.h
@@ -29,22 +29,6 @@ extern "C" {
#endif
-/* A property, resulting from a query.
- *
- * Note that properties may have many values.
- */
-struct _Value {
- size_t num_values;
- char** values;
-};
-
-typedef struct _Value* SLV2Value;
-
-
-/** Free an SLV2Value. */
-void
-slv2_value_free(SLV2Value);
-
/** Port ID type, to allow passing either symbol or index
* to port related functions.
@@ -73,25 +57,6 @@ typedef enum _PortClass {
} SLV2PortClass;
-/** Get the number of elements in a URI list.
- */
-int
-slv2_uri_list_size(const SLV2URIList list);
-
-
-/** Get a URI from a URI list at the given index.
- *
- * @return the element at @index, or NULL if index is out of range.
- */
-char*
-slv2_uri_list_get_at(const SLV2URIList list, int index);
-
-
-/** Return whether @list contains @uri.
- */
-bool
-slv2_uri_list_contains(const SLV2URIList list, const char* uri);
-
#ifdef __cplusplus
}
#endif
diff --git a/slv2/util.h b/slv2/util.h
index f6c90d4..eb8dea7 100644
--- a/slv2/util.h
+++ b/slv2/util.h
@@ -32,6 +32,12 @@ extern "C" {
#endif
+/** \defgroup util Utility functions
+ *
+ * @{
+ */
+
+
/** Convert a full URI (eg file://foo/bar/baz.ttl) to a local path (e.g. /foo/bar/baz.ttl).
*
* Return value is shared and must not be deleted by caller.
@@ -61,9 +67,7 @@ char*
slv2_vstrjoin(const char** first, va_list args_list);
-const char*
-slv2_url2path(const char* const url);
-
+/** @} */
#ifdef __cplusplus
}
diff --git a/src/Makefile.am b/src/Makefile.am
index 5ad71df..43aa62a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -13,4 +13,4 @@ libslv2_la_SOURCES = \
util.c \
plugininstance.c \
library.c \
- types.c
+ stringlist.c
diff --git a/src/plugin.c b/src/plugin.c
index 30e737a..703b2a3 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -27,6 +27,7 @@
#include <slv2/types.h>
#include <slv2/query.h>
#include <slv2/util.h>
+#include <slv2/stringlist.h>
SLV2Plugin*
@@ -38,9 +39,9 @@ slv2_plugin_duplicate(const SLV2Plugin* p)
result->bundle_url = p->bundle_url;
result->lib_uri = p->lib_uri;
- result->data_uris = slv2_uri_list_new();
- for (int i=0; i < slv2_uri_list_size(p->data_uris); ++i)
- raptor_sequence_push(result->data_uris, strdup(slv2_uri_list_get_at(p->data_uris, i)));
+ result->data_uris = slv2_strings_new();
+ for (int i=0; i < slv2_strings_size(p->data_uris); ++i)
+ raptor_sequence_push(result->data_uris, strdup(slv2_strings_get_at(p->data_uris, i)));
return result;
}
@@ -53,7 +54,7 @@ slv2_plugin_get_uri(const SLV2Plugin* p)
}
-SLV2URIList
+SLV2Strings
slv2_plugin_get_data_uris(const SLV2Plugin* p)
{
assert(p);
@@ -76,10 +77,10 @@ slv2_plugin_verify(const SLV2Plugin* plugin)
size_t num_values = 0;
- struct _Value* prop = slv2_plugin_get_value(plugin, "doap:name");
+ SLV2Strings prop = slv2_plugin_get_value(plugin, "doap:name");
if (prop) {
- num_values = prop->num_values;
- free(prop);
+ num_values = slv2_strings_size(prop);
+ slv2_strings_free(prop);
}
if (num_values < 1)
return false;
@@ -97,19 +98,21 @@ slv2_plugin_verify(const SLV2Plugin* plugin)
char*
slv2_plugin_get_name(const SLV2Plugin* plugin)
{
-// FIXME: leak
- char* result = NULL;
- struct _Value* prop = slv2_plugin_get_value(plugin, "doap:name");
+ char* result = NULL;
+ SLV2Strings prop = slv2_plugin_get_value(plugin, "doap:name");
// FIXME: guaranteed to be the untagged one?
- if (prop && prop->num_values >= 1)
- result = prop->values[0];
+ if (prop && slv2_strings_size(prop) >= 1)
+ result = strdup(slv2_strings_get_at(prop, 0));
+
+ if (prop)
+ slv2_strings_free(prop);
return result;
}
-SLV2Value
+SLV2Strings
slv2_plugin_get_value(const SLV2Plugin* p,
const char* predicate)
{
@@ -134,7 +137,7 @@ slv2_plugin_get_value(const SLV2Plugin* p,
"plugin: ", predicate, " ?value .\n"
"}\n", NULL);
- SLV2Value result = slv2_plugin_simple_query(p, query, "value");
+ SLV2Strings result = slv2_plugin_simple_query(p, query, "value");
free(query);
@@ -142,14 +145,14 @@ slv2_plugin_get_value(const SLV2Plugin* p,
}
-SLV2Value
+SLV2Strings
slv2_plugin_get_properties(const SLV2Plugin* p)
{
return slv2_plugin_get_value(p, "lv2:pluginProperty");
}
-SLV2Value
+SLV2Strings
slv2_plugin_get_hints(const SLV2Plugin* p)
{
return slv2_plugin_get_value(p, "lv2:pluginHint");
@@ -160,16 +163,10 @@ uint32_t
slv2_plugin_get_num_ports(const SLV2Plugin* p)
{
const char* const query =
- "SELECT DISTINCT ?value\n"
- "WHERE { plugin: lv2:port ?value }\n";
-
- SLV2Value results = slv2_plugin_simple_query(p, query, "value");
-
- size_t count = results->num_values;
-
- slv2_value_free(results);
+ "SELECT DISTINCT ?port\n"
+ "WHERE { plugin: lv2:port ?port }\n";
- return count;
+ return (uint32_t)slv2_plugin_query_count(p, query);
}
@@ -182,11 +179,11 @@ slv2_plugin_has_latency(const SLV2Plugin* p)
" ?port lv2:portHint lv2:reportsLatency .\n"
"}\n";
- SLV2Value results = slv2_plugin_simple_query(p, query, "port");
+ SLV2Strings results = slv2_plugin_simple_query(p, query, "port");
- bool exists = (results->num_values > 0);
+ bool exists = (slv2_strings_size(results) > 0);
- slv2_value_free(results);
+ slv2_strings_free(results);
return exists;
}
@@ -202,19 +199,19 @@ slv2_plugin_get_latency_port(const SLV2Plugin* p)
" lv2:index ?index .\n"
"}\n";
- SLV2Value result = slv2_plugin_simple_query(p, query, "index");
+ SLV2Strings result = slv2_plugin_simple_query(p, query, "index");
// FIXME: need a sane error handling strategy
- assert(result->num_values == 1);
+ assert(slv2_strings_size(result) == 1);
char* endptr = 0;
- uint32_t index = strtol(result->values[0], &endptr, 10);
+ uint32_t index = strtol(slv2_strings_get_at(result, 0), &endptr, 10);
// FIXME: check.. stuff..
return index;
}
-SLV2Value
+SLV2Strings
slv2_plugin_get_supported_features(const SLV2Plugin* p)
{
const char* const query =
@@ -224,13 +221,13 @@ slv2_plugin_get_supported_features(const SLV2Plugin* p)
" { plugin: lv2:requiredHostFeature ?feature }\n"
"}\n";
- SLV2Value result = slv2_plugin_simple_query(p, query, "feature");
+ SLV2Strings result = slv2_plugin_simple_query(p, query, "feature");
return result;
}
-SLV2Value
+SLV2Strings
slv2_plugin_get_optional_features(const SLV2Plugin* p)
{
const char* const query =
@@ -238,13 +235,13 @@ slv2_plugin_get_optional_features(const SLV2Plugin* p)
" plugin: lv2:optionalHostFeature ?feature .\n"
"}\n";
- SLV2Value result = slv2_plugin_simple_query(p, query, "feature");
+ SLV2Strings result = slv2_plugin_simple_query(p, query, "feature");
return result;
}
-SLV2Value
+SLV2Strings
slv2_plugin_get_required_features(const SLV2Plugin* p)
{
const char* const query =
@@ -252,7 +249,7 @@ slv2_plugin_get_required_features(const SLV2Plugin* p)
" plugin: lv2:requiredHostFeature ?feature .\n"
"}\n";
- SLV2Value result = slv2_plugin_simple_query(p, query, "feature");
+ SLV2Strings result = slv2_plugin_simple_query(p, query, "feature");
return result;
}
diff --git a/src/pluginlist.c b/src/pluginlist.c
index d9bbe7b..1c28f01 100644
--- a/src/pluginlist.c
+++ b/src/pluginlist.c
@@ -28,6 +28,7 @@
#include <slv2/types.h>
#include <slv2/plugin.h>
#include <slv2/pluginlist.h>
+#include <slv2/stringlist.h>
#include <slv2/util.h>
@@ -40,14 +41,14 @@ slv2_plugin_new()
result->bundle_url = NULL;
result->lib_uri = NULL;
- result->data_uris = slv2_uri_list_new();
+ result->data_uris = slv2_strings_new();
return result;
}
struct _PluginList*
-slv2_list_new()
+slv2_plugins_new()
{
struct _PluginList* result = malloc(sizeof(struct _PluginList));
result->num_plugins = 0;
@@ -57,7 +58,7 @@ slv2_list_new()
void
-slv2_list_free(SLV2List list)
+slv2_plugins_free(SLV2Plugins list)
{
list->num_plugins = 0;
free(list->plugins);
@@ -66,14 +67,14 @@ slv2_list_free(SLV2List list)
void
-slv2_list_load_all(SLV2List list)
+slv2_plugins_load_all(SLV2Plugins list)
{
assert(list != NULL);
char* slv2_path = getenv("LV2_PATH");
if (slv2_path) {
- slv2_list_load_path(list, slv2_path);
+ slv2_plugins_load_path(list, slv2_path);
} else {
const char* const home = getenv("HOME");
const char* const suffix = "/.lv2:/usr/local/lib/lv2:usr/lib/lv2";
@@ -82,10 +83,10 @@ slv2_list_load_all(SLV2List list)
fprintf(stderr, "$LV2_PATH is unset. Using default path %s\n", slv2_path);
/* pass 1: find all plugins */
- slv2_list_load_path(list, slv2_path);
+ slv2_plugins_load_path(list, slv2_path);
/* pass 2: find all data files for plugins */
- slv2_list_load_path(list, slv2_path);
+ slv2_plugins_load_path(list, slv2_path);
free(slv2_path);
}
@@ -96,7 +97,7 @@ slv2_list_load_all(SLV2List list)
* This is called twice on each bundle in the discovery process, which is (much) less
* efficient than it could be.... */
void
-slv2_list_load_bundle(SLV2List list,
+slv2_plugins_load_bundle(SLV2Plugins list,
const char* bundle_base_url)
{
unsigned char* manifest_url = malloc(
@@ -127,7 +128,7 @@ slv2_list_load_bundle(SLV2List list,
rasqal_literal* literal = rasqal_query_results_get_binding_value(results, 0);
assert(literal);
- if (!slv2_list_get_plugin_by_uri(list, (const char*)rasqal_literal_as_string(literal))) {
+ if (!slv2_plugins_get_by_uri(list, (const char*)rasqal_literal_as_string(literal))) {
/* Create a new plugin */
struct _Plugin* new_plugin = slv2_plugin_new();
new_plugin->plugin_uri = strdup((const char*)rasqal_literal_as_string(literal));
@@ -178,13 +179,13 @@ slv2_list_load_bundle(SLV2List list,
const char* binary = (const char*)rasqal_literal_as_string(
rasqal_query_results_get_binding_value(results, 2));
- struct _Plugin* plugin = slv2_list_get_plugin_by_uri(list, subject);
+ SLV2Plugin* plugin = slv2_plugins_get_by_uri(list, subject);
- if (plugin && data_uri && !slv2_uri_list_contains(plugin->data_uris, data_uri))
+ if (plugin && data_uri && !slv2_strings_contains(plugin->data_uris, data_uri))
raptor_sequence_push(plugin->data_uris, strdup(data_uri));
if (plugin && binary && !plugin->lib_uri)
- plugin->lib_uri = strdup(binary);
+ ((struct _Plugin*)plugin)->lib_uri = strdup(binary);
rasqal_query_results_next(results);
@@ -205,7 +206,7 @@ slv2_list_load_bundle(SLV2List list,
* (Private helper function, not exposed in public API)
*/
void
-slv2_list_load_dir(SLV2List list, const char* dir)
+slv2_plugins_load_dir(SLV2Plugins list, const char* dir)
{
DIR* pdir = opendir(dir);
if (!pdir)
@@ -223,7 +224,7 @@ slv2_list_load_dir(SLV2List list, const char* dir)
if (bundle_dir != NULL) {
closedir(bundle_dir);
- slv2_list_load_bundle(list, bundle_url);
+ slv2_plugins_load_bundle(list, bundle_url);
//printf("Loaded bundle %s\n", bundle_url);
}
@@ -235,7 +236,7 @@ slv2_list_load_dir(SLV2List list, const char* dir)
void
-slv2_list_load_path(SLV2List list,
+slv2_plugins_load_path(SLV2Plugins list,
const char* lv2_path)
{
char* path = slv2_strjoin(lv2_path, ":", NULL);
@@ -248,7 +249,7 @@ slv2_list_load_path(SLV2List list,
char* delim = strchr(path, ':');
*delim = '\0';
- slv2_list_load_dir(list, dir);
+ slv2_plugins_load_dir(list, dir);
*delim = 'X';
dir = delim + 1;
@@ -261,7 +262,7 @@ slv2_list_load_path(SLV2List list,
size_t
-slv2_list_get_length(const SLV2List list)
+slv2_plugins_size(const SLV2Plugins list)
{
assert(list != NULL);
return list->num_plugins;
@@ -269,7 +270,7 @@ slv2_list_get_length(const SLV2List list)
SLV2Plugin*
-slv2_list_get_plugin_by_uri(const SLV2List list, const char* uri)
+slv2_plugins_get_by_uri(const SLV2Plugins list, const char* uri)
{
if (list->num_plugins > 0) {
assert(list->plugins != NULL);
@@ -284,7 +285,7 @@ slv2_list_get_plugin_by_uri(const SLV2List list, const char* uri)
SLV2Plugin*
-slv2_list_get_plugin_by_index(const SLV2List list, size_t index)
+slv2_plugins_get_at(const SLV2Plugins list, size_t index)
{
if (list->num_plugins == 0)
return NULL;
diff --git a/src/port.c b/src/port.c
index b92e12b..478a070 100644
--- a/src/port.c
+++ b/src/port.c
@@ -53,26 +53,24 @@ SLV2PortClass
slv2_port_get_class(SLV2Plugin* p,
SLV2PortID id)
{
- struct _Value* class = slv2_port_get_value(p, id, "rdf:type");
- assert(class);
- assert(class->num_values > 0);
- assert(class->values);
+ SLV2Strings class = slv2_port_get_value(p, id, "rdf:type");
SLV2PortClass ret = SLV2_UNKNOWN_PORT_CLASS;
int io = -1; // 0 = in, 1 = out
enum { UNKNOWN, AUDIO, CONTROL, MIDI } type = UNKNOWN;
- for (size_t i=0; i < class->num_values; ++i) {
- if (!strcmp((char*)class->values[i], "http://lv2plug.in/ontology#InputPort"))
+ for (int i=0; i < slv2_strings_size(class); ++i) {
+ char* value = slv2_strings_get_at(class, i);
+ if (!strcmp(value, "http://lv2plug.in/ontology#InputPort"))
io = 0;
- else if (!strcmp((char*)class->values[i], "http://lv2plug.in/ontology#OutputPort"))
+ else if (!strcmp(value, "http://lv2plug.in/ontology#OutputPort"))
io = 1;
- else if (!strcmp((char*)class->values[i], "http://lv2plug.in/ontology#ControlPort"))
+ else if (!strcmp(value, "http://lv2plug.in/ontology#ControlPort"))
type = CONTROL;
- else if (!strcmp((char*)class->values[i], "http://lv2plug.in/ontology#AudioPort"))
+ else if (!strcmp(value, "http://lv2plug.in/ontology#AudioPort"))
type = AUDIO;
- else if (!strcmp((char*)class->values[i], "http://ll-plugins.nongnu.org/lv2/ext/MidiPort"))
+ else if (!strcmp(value, "http://ll-plugins.nongnu.org/lv2/ext/MidiPort"))
type = MIDI;
}
@@ -92,20 +90,20 @@ slv2_port_get_class(SLV2Plugin* p,
ret = SLV2_MIDI_OUTPUT;
}
- slv2_value_free(class);
+ slv2_strings_free(class);
return ret;
}
-SLV2Value
+SLV2Strings
slv2_port_get_value(SLV2Plugin* p,
SLV2PortID id,
const char* property)
{
assert(property);
- SLV2Value result = NULL;
+ SLV2Strings result = NULL;
if (id.is_index) {
char index_str[16];
@@ -143,15 +141,13 @@ slv2_port_get_symbol(SLV2Plugin* p,
{
char* result = NULL;
- SLV2Value prop
+ SLV2Strings prop
= slv2_port_get_value(p, id, "lv2:symbol");
- if (prop && prop->num_values == 1) {
- result = prop->values[0];
- prop->values[0] = NULL; // prevent deletion
- }
+ if (prop && slv2_strings_size(prop) == 1)
+ result = strdup(slv2_strings_get_at(prop, 0));
- slv2_value_free(prop);
+ slv2_strings_free(prop);
return result;
}
@@ -163,15 +159,13 @@ slv2_port_get_name(SLV2Plugin* p,
{
char* result = NULL;
- SLV2Value prop
+ SLV2Strings prop
= slv2_port_get_value(p, id, "lv2:name");
- if (prop && prop->num_values == 1) {
- result = prop->values[0];
- prop->values[0] = NULL; // prevent deletion
- }
+ if (prop && slv2_strings_size(prop) == 1)
+ result = strdup(slv2_strings_get_at(prop, 0));
- slv2_value_free(prop);
+ slv2_strings_free(prop);
return result;
}
@@ -185,13 +179,13 @@ slv2_port_get_default_value(SLV2Plugin* p,
float result = 0.0f;
- SLV2Value prop
+ SLV2Strings prop
= slv2_port_get_value(p, id, "lv2:default");
- if (prop && prop->num_values == 1)
- result = atof((char*)prop->values[0]);
+ if (prop && slv2_strings_size(prop) == 1)
+ result = atof(slv2_strings_get_at(prop, 0));
- slv2_value_free(prop);
+ slv2_strings_free(prop);
return result;
}
@@ -205,13 +199,13 @@ slv2_port_get_minimum_value(SLV2Plugin* p,
float result = 0.0f;
- SLV2Value prop
+ SLV2Strings prop
= slv2_port_get_value(p, id, "lv2:minimum");
- if (prop && prop->num_values == 1)
- result = atof((char*)prop->values[0]);
+ if (prop && slv2_strings_size(prop) == 1)
+ result = atof(slv2_strings_get_at(prop, 0));
- slv2_value_free(prop);
+ slv2_strings_free(prop);
return result;
}
@@ -225,19 +219,19 @@ slv2_port_get_maximum_value(SLV2Plugin* p,
float result = 0.0f;
- SLV2Value prop
+ SLV2Strings prop
= slv2_port_get_value(p, id, "lv2:maximum");
- if (prop && prop->num_values == 1)
- result = atof((char*)prop->values[0]);
+ if (prop && slv2_strings_size(prop) == 1)
+ result = atof(slv2_strings_get_at(prop, 0));
- slv2_value_free(prop);
+ slv2_strings_free(prop);
return result;
}
-SLV2Value
+SLV2Strings
slv2_port_get_properties(const SLV2Plugin* p,
SLV2PortID id)
{
@@ -245,7 +239,7 @@ slv2_port_get_properties(const SLV2Plugin* p,
}
-SLV2Value
+SLV2Strings
slv2_port_get_hints(const SLV2Plugin* p,
SLV2PortID id)
{
diff --git a/src/query.c b/src/query.c
index 0d44533..311ef50 100644
--- a/src/query.c
+++ b/src/query.c
@@ -23,13 +23,14 @@
#include <slv2/query.h>
#include <slv2/library.h>
#include <slv2/util.h>
+#include <slv2/stringlist.h>
char*
slv2_query_header(const SLV2Plugin* p)
{
const char* const plugin_uri = slv2_plugin_get_uri(p);
- //SLV2URIList files = slv2_plugin_get_data_uris(p);
+ //SLV2Strings files = slv2_plugin_get_data_uris(p);
char* query_string = slv2_strjoin(
"PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n"
@@ -38,8 +39,8 @@ slv2_query_header(const SLV2Plugin* p)
"PREFIX lv2: <http://lv2plug.in/ontology#>\n"
"PREFIX plugin: <", plugin_uri, ">\n", NULL);
- /*for (int i=0; i < slv2_uri_list_size(files); ++i) {
- const char* file_uri = slv2_uri_list_get_at(files, i);
+ /*for (int i=0; i < slv2_strings_size(files); ++i) {
+ const char* file_uri = slv2_strings_get_at(files, i);
slv2_strappend(&query_string, "PREFIX data: <");
slv2_strappend(&query_string, file_uri);
slv2_strappend(&query_string, ">\n");
@@ -68,17 +69,14 @@ slv2_query_lang_filter(const char* variable)
}
-SLV2Value
+SLV2Strings
slv2_query_get_variable_bindings(rasqal_query_results* results,
const char* variable)
{
- struct _Value* result = NULL;
+ SLV2Strings result = NULL;
- if (rasqal_query_results_get_bindings_count(results) > 0) {
- result = malloc(sizeof(struct _Value));
- result->num_values = 0;
- result->values = NULL;
- }
+ if (rasqal_query_results_get_bindings_count(results) > 0)
+ result = slv2_strings_new();
while (!rasqal_query_results_finished(results)) {
@@ -86,12 +84,7 @@ slv2_query_get_variable_bindings(rasqal_query_results* results,
rasqal_query_results_get_binding_value_by_name(results, (const unsigned char*)variable);
assert(literal != NULL);
- // Add value on to the array, reallocing all the way.
- // Yes, this is disgusting. Roughly as disgusting as the rasqal query
- // results API. coincidentally.
- result->num_values++;
- result->values = realloc(result->values, result->num_values * sizeof(char*));
- result->values[result->num_values-1] = strdup((const char*)rasqal_literal_as_string(literal));
+ raptor_sequence_push(result, strdup((const char*)rasqal_literal_as_string(literal)));
rasqal_query_results_next(results);
}
@@ -101,7 +94,7 @@ slv2_query_get_variable_bindings(rasqal_query_results* results,
size_t
-slv2_query_count_variable_bindings(rasqal_query_results* results)
+slv2_query_count_bindings(rasqal_query_results* results)
{
size_t count = 0;
@@ -134,8 +127,8 @@ slv2_plugin_query(SLV2Plugin* plugin,
NULL, RASQAL_DATA_GRAPH_BACKGROUND);
// Add all plugin data files to query sources
- for (int i=0; i < slv2_uri_list_size(plugin->data_uris); ++i) {
- const char* file_uri_str = slv2_uri_list_get_at(plugin->data_uris, i);
+ for (int i=0; i < slv2_strings_size(plugin->data_uris); ++i) {
+ const char* file_uri_str = slv2_strings_get_at(plugin->data_uris, i);
raptor_uri* file_uri = raptor_new_uri((const unsigned char*)file_uri_str);
rasqal_query_add_data_graph(rq, file_uri,
NULL, RASQAL_DATA_GRAPH_BACKGROUND);
@@ -151,7 +144,7 @@ slv2_plugin_query(SLV2Plugin* plugin,
return results;
/*
- SLV2Value ret = slv2_query_get_variable_bindings(results, var_name);
+ SLV2Strings ret = slv2_query_get_variable_bindings(results, var_name);
rasqal_free_query_results(results);
rasqal_free_query(rq);
@@ -161,13 +154,30 @@ slv2_plugin_query(SLV2Plugin* plugin,
/** Query a single variable */
-SLV2Value
+SLV2Strings
slv2_plugin_simple_query(SLV2Plugin* plugin,
const char* sparql_str,
const char* variable)
{
rasqal_query_results* results = slv2_plugin_query(plugin, sparql_str);
- SLV2Value ret = slv2_query_get_variable_bindings(results, variable);
+ SLV2Strings ret = slv2_query_get_variable_bindings(results, variable);
+ rasqal_free_query_results(results);
+
+ return ret;
+}
+
+
+/** Run a query and count number of matches.
+ *
+ * More efficient than slv2_plugin_simple_query if you're only interested
+ * in the number of results (ie slv2_plugin_num_ports).
+ */
+unsigned
+slv2_plugin_query_count(SLV2Plugin* plugin,
+ const char* sparql_str)
+{
+ rasqal_query_results* results = slv2_plugin_query(plugin, sparql_str);
+ unsigned ret = slv2_query_count_bindings(results);
rasqal_free_query_results(results);
return ret;
@@ -198,7 +208,7 @@ slv2_query_count_results(const SLV2Plugin* p,
rasqal_query_results* results = rasqal_query_execute(rq);
assert(results);
- size_t count = slv2_query_count_variable_bindings(results);
+ size_t count = slv2_query_count_bindings(results);
rasqal_free_query_results(results);
rasqal_free_query(rq);
@@ -230,12 +240,8 @@ slv2_query_get_num_results(rasqal_query_results* results, const char* var_name)
*/
void
-slv2_value_free(struct _Value* prop)
+slv2_strings_free(SLV2Strings list)
{
- for (size_t i=0; i < prop->num_values; ++i)
- free(prop->values[i]);
-
- free(prop->values);
- free(prop);
+ raptor_free_sequence(list);
}
diff --git a/src/types.c b/src/stringlist.c
index 76521c0..04f2de7 100644
--- a/src/types.c
+++ b/src/stringlist.c
@@ -19,35 +19,35 @@
#include <string.h>
#include <stdlib.h>
#include <raptor.h>
-#include <slv2/types.h>
+#include <slv2/stringlist.h>
-SLV2URIList
-slv2_uri_list_new()
+SLV2Strings
+slv2_strings_new()
{
return raptor_new_sequence(&free, NULL);
}
int
-slv2_uri_list_size(const SLV2URIList list)
+slv2_strings_size(const SLV2Strings list)
{
return raptor_sequence_size(list);
}
char*
-slv2_uri_list_get_at(const SLV2URIList list, int index)
+slv2_strings_get_at(const SLV2Strings list, int index)
{
return (char*)raptor_sequence_get_at(list, index);
}
bool
-slv2_uri_list_contains(const SLV2URIList list, const char* uri)
+slv2_strings_contains(const SLV2Strings list, const char* uri)
{
- for (int i=0; i < slv2_uri_list_size(list); ++i)
- if (!strcmp(slv2_uri_list_get_at(list, i), uri))
+ for (int i=0; i < slv2_strings_size(list); ++i)
+ if (!strcmp(slv2_strings_get_at(list, i), uri))
return true;
return false;
diff --git a/utils/lv2_inspect.c b/utils/lv2_inspect.c
index 8dbc6e6..32c07dd 100644
--- a/utils/lv2_inspect.c
+++ b/utils/lv2_inspect.c
@@ -83,9 +83,9 @@ print_plugin(SLV2Plugin* p)
printf("<%s>\n", slv2_plugin_get_uri(p));
printf("\tData URIs:\n");
- SLV2URIList data_uris = slv2_plugin_get_data_uris(p);
- for (int i=0; i < slv2_uri_list_size(data_uris); ++i)
- printf("\t\t%s\n", slv2_uri_list_get_at(data_uris, i));
+ SLV2Strings data_uris = slv2_plugin_get_data_uris(p);
+ for (int i=0; i < slv2_strings_size(data_uris); ++i)
+ printf("\t\t%s\n", slv2_strings_get_at(data_uris, i));
printf("\n\tLibrary URI: %s\n\n", slv2_plugin_get_library_uri(p));
@@ -99,16 +99,16 @@ print_plugin(SLV2Plugin* p)
printf("\tHas latency: no\n");
printf("\tProperties:\n");
- SLV2Value v = slv2_plugin_get_properties(p);
- for (size_t i=0; i < v->num_values; ++i)
- printf("\t\t%s\n", v->values[i]);
- slv2_value_free(v);
+ SLV2Strings v = slv2_plugin_get_properties(p);
+ for (int i=0; i < slv2_strings_size(v); ++i)
+ printf("\t\t%s\n", slv2_strings_get_at(v, i));
+ slv2_strings_free(v);
printf("\tHints:\n");
v = slv2_plugin_get_hints(p);
- for (size_t i=0; i < v->num_values; ++i)
- printf("\t\t%s\n", v->values[i]);
- slv2_value_free(v);
+ for (int i=0; i < slv2_strings_size(v); ++i)
+ printf("\t\t%s\n", slv2_strings_get_at(v, i));
+ slv2_strings_free(v);
uint32_t num_ports = slv2_plugin_get_num_ports(p);
for (uint32_t i=0; i < num_ports; ++i)
@@ -127,10 +127,10 @@ main(int argc, char** argv)
return -1;
}
- SLV2List plugins = slv2_list_new();
- slv2_list_load_all(plugins);
+ SLV2Plugins plugins = slv2_plugins_new();
+ slv2_plugins_load_all(plugins);
- SLV2Plugin* p = slv2_list_get_plugin_by_uri(plugins, argv[1]);
+ SLV2Plugin* p = slv2_plugins_get_by_uri(plugins, argv[1]);
if (!p) {
fprintf(stderr, "Plugin not found.\n");
diff --git a/utils/lv2_list.c b/utils/lv2_list.c
index 923cba9..71cf34c 100644
--- a/utils/lv2_list.c
+++ b/utils/lv2_list.c
@@ -21,10 +21,10 @@
void
-list_plugins(SLV2List list)
+list_plugins(SLV2Plugins list)
{
- for (size_t i=0; i < slv2_list_get_length(list); ++i) {
- const SLV2Plugin* const p = slv2_list_get_plugin_by_index(list, i);
+ for (size_t i=0; i < slv2_plugins_size(list); ++i) {
+ const SLV2Plugin* const p = slv2_plugins_get_at(list, i);
printf("%s\n", slv2_plugin_get_uri(p));
}
}
@@ -35,8 +35,8 @@ main()//int argc, char** argv)
{
slv2_init();
- SLV2List plugins = slv2_list_new();
- slv2_list_load_all(plugins);
+ SLV2Plugins plugins = slv2_plugins_new();
+ slv2_plugins_load_all(plugins);
list_plugins(plugins);