summaryrefslogtreecommitdiffstats
path: root/slv2
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-02-18 04:16:24 +0000
committerDavid Robillard <d@drobilla.net>2007-02-18 04:16:24 +0000
commita80e895b0b23d478807377360b85b4bb1d7073b7 (patch)
treee2ea19db66cd44bce0d84176c4c87a90d9b5d9e0 /slv2
parent07c3b4ce3ed385368147bd4f2e058f83d9064b0d (diff)
downloadlilv-a80e895b0b23d478807377360b85b4bb1d7073b7.tar.gz
lilv-a80e895b0b23d478807377360b85b4bb1d7073b7.tar.bz2
lilv-a80e895b0b23d478807377360b85b4bb1d7073b7.zip
Implemented discovery of plugin extension bundles.
git-svn-id: http://svn.drobilla.net/lad/slv2@309 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'slv2')
-rw-r--r--slv2/Makefile.am3
-rw-r--r--slv2/plugin.h37
-rw-r--r--slv2/private_types.h23
-rw-r--r--slv2/types.h21
-rw-r--r--slv2/util.h73
5 files changed, 123 insertions, 34 deletions
diff --git a/slv2/Makefile.am b/slv2/Makefile.am
index 5fba079..d2153ef 100644
--- a/slv2/Makefile.am
+++ b/slv2/Makefile.am
@@ -10,4 +10,5 @@ slv2include_HEADERS = \
query.h \
port.h \
pluginlist.h \
- plugininstance.h
+ plugininstance.h \
+ util.h
diff --git a/slv2/plugin.h b/slv2/plugin.h
index d646504..5555437 100644
--- a/slv2/plugin.h
+++ b/slv2/plugin.h
@@ -48,11 +48,11 @@ typedef const struct _Plugin SLV2Plugin;
* and will not work with libslv2 (eg plugins missing required fields, or
* having multiple values for mandatory single-valued fields, etc.
*
- * Note that normal hosts do not need to worry about this - libslv2 does not
+ * Note that normal hosts do NOT need to use this - slv2 does not
* load invalid plugins into plugin lists. This is included for plugin
* testing utilities, etc.
*
- * \return True if \a plugin is valid.
+ * \return true if \a plugin is valid.
*/
bool
slv2_plugin_verify(const SLV2Plugin* plugin);
@@ -87,44 +87,29 @@ const char*
slv2_plugin_get_uri(const SLV2Plugin* plugin);
-/** Get the URL of the RDF data file plugin information is located in.
+/** Get the (resolvable) URIs of the RDF data files that define a plugin.
*
- * Only file: URL's are supported at this time.
+ * Note this always returns fully qualified URIs. If you want local
+ * filesystem paths, use slv2_uri_to_path.
*
* \return a complete URL eg. "file:///usr/foo/SomeBundle.lv2/someplug.ttl",
* which is shared and must not be modified or free()'d.
*/
-const char*
-slv2_plugin_get_data_url(const SLV2Plugin* plugin);
+SLV2URIList
+slv2_plugin_get_data_uris(const SLV2Plugin* plugin);
-/** Get the local filesystem path of the RDF data file for \a plugin.
+/** Get the (resolvable) URI of the shared library for \a plugin.
*
- * \return a valid path on the local filesystem
- * eg. "/usr/foo/SomeBundle.lv2/someplug.ttl" which is shared and must not
- * be free()'d; or NULL if URL is not a local filesystem path.
- */
-const char*
-slv2_plugin_get_data_path(const SLV2Plugin* plugin);
-
-
-/** Get the URL of the shared library for \a plugin.
+ * Note this always returns a fully qualified URI. If you want a local
+ * filesystem path, use slv2_uri_to_path.
*
* \return a shared string which must not be modified or free()'d.
*/
const char*
-slv2_plugin_get_library_url(const SLV2Plugin* plugin);
+slv2_plugin_get_library_uri(const SLV2Plugin* plugin);
-/** Get the local filesystem path of the shared library for \a plugin.
- *
- * \return a valid path on the local filesystem
- * eg. "/usr/foo/SomeBundle.lv2/someplug.so" which is shared and must not
- * be free()'d; or NULL if URL is not a local filesystem path.
- */
-const char*
-slv2_plugin_get_library_path(const SLV2Plugin* plugin);
-
/** Get the name of \a plugin.
*
diff --git a/slv2/private_types.h b/slv2/private_types.h
index 590ecae..cfdcb9c 100644
--- a/slv2/private_types.h
+++ b/slv2/private_types.h
@@ -25,13 +25,17 @@ extern "C" {
#include <stdbool.h>
#include <stddef.h>
+#include <raptor.h>
#include <slv2/lv2.h>
-/* If you're a user of SLV2, stop reading this file RIGHT NOW.
+/* @file private_types.h
+ *
+ * If you're a user of SLV2, stop reading this RIGHT NOW :)
* Unfortunately it needs to be exposed to allow inlining of some things that
- * really need to be inlined, but these are opaque types. Don't even think
- * about writing code that depends on any information here :)
+ * really need to be inlined, but these are opaque types.
+ *
+ * DO NOT WRITE CODE THAT DEPENDS ON DEFINITIONS IN THIS FILE
*/
@@ -41,10 +45,10 @@ extern "C" {
* paths of relevant files, the actual data therein isn't loaded into memory.
*/
struct _Plugin {
- char* plugin_uri;
- char* bundle_url; // Bundle directory plugin was loaded from
- char* data_url; // rdfs::seeAlso
- char* lib_url; // lv2:binary
+ char* plugin_uri;
+ char* bundle_url; // Bundle directory plugin was loaded from
+ raptor_sequence* data_uris; // rdfs::seeAlso
+ char* lib_uri; // lv2:binary
};
@@ -65,6 +69,11 @@ struct _PluginList {
};
+typedef raptor_sequence* SLV2URIList;
+
+SLV2URIList slv2_uri_list_new();
+
+
#ifdef __cplusplus
}
#endif
diff --git a/slv2/types.h b/slv2/types.h
index 7e366ba..4fb8cf4 100644
--- a/slv2/types.h
+++ b/slv2/types.h
@@ -22,6 +22,7 @@
#include <stddef.h>
#include <stdbool.h>
#include <stdint.h>
+#include <slv2/private_types.h>
#ifdef __cplusplus
extern "C" {
@@ -72,9 +73,29 @@ 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
+
#endif /* __SLV2_TYPES_H__ */
diff --git a/slv2/util.h b/slv2/util.h
new file mode 100644
index 0000000..f6c90d4
--- /dev/null
+++ b/slv2/util.h
@@ -0,0 +1,73 @@
+/* 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_UTIL_H__
+#define __SLV2_UTIL_H__
+
+#define _XOPEN_SOURCE 500
+#include <string.h>
+#include <stdarg.h>
+#include <stddef.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <slv2/types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/** 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.
+ * @return @uri converted to a path, or NULL on failure (URI is not local).
+ */
+const char* slv2_uri_to_path(const char* uri);
+
+
+/** Append \a suffix to \a *dst, reallocating \a dst as necessary.
+ *
+ * \a dst will (possibly) be freed, it must be dynamically allocated with malloc
+ * or NULL.
+ */
+void
+slv2_strappend(char** dst, const char* suffix);
+
+
+/** Join all arguments into one string.
+ *
+ * Arguments are not modified, return value must be free()'d.
+ */
+char*
+slv2_strjoin(const char* first, ...);
+
+
+char*
+slv2_vstrjoin(const char** first, va_list args_list);
+
+
+const char*
+slv2_url2path(const char* const url);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __SLV2_UTIL_H__ */
+