aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lv2/lv2plug.in/ns/lv2core/lv2_util.h101
-rw-r--r--lv2/lv2plug.in/ns/lv2core/lv2core.doap.ttl9
-rw-r--r--lv2/lv2plug.in/ns/lv2core/lv2core.ttl1
-rw-r--r--lv2/lv2plug.in/ns/lv2core/manifest.ttl4
-rw-r--r--lv2/lv2plug.in/ns/meta/meta.ttl4
-rw-r--r--wscript2
6 files changed, 116 insertions, 5 deletions
diff --git a/lv2/lv2plug.in/ns/lv2core/lv2_util.h b/lv2/lv2plug.in/ns/lv2core/lv2_util.h
new file mode 100644
index 0000000..038b5a6
--- /dev/null
+++ b/lv2/lv2plug.in/ns/lv2core/lv2_util.h
@@ -0,0 +1,101 @@
+/*
+ Copyright 2016 David Robillard <http://drobilla.net>
+
+ Permission to use, copy, modify, and/or distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+
+ THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*/
+
+/**
+ @defgroup util Utilities
+ @ingroup lv2core
+ @{
+*/
+
+#include <string.h>
+
+#include "lv2/lv2plug.in/ns/lv2core/lv2.h"
+
+#ifdef __cplusplus
+extern "C" {
+#else
+# include <stdbool.h>
+#endif
+
+/**
+ Return the data for a feature in a features array.
+
+ If the feature is not found, NULL is returned. Note that this function is
+ only useful for features with data, and can not detect features that are
+ present but have NULL data.
+*/
+static inline void*
+lv2_features_data(const LV2_Feature*const* features,
+ const char* const uri)
+{
+ for (const LV2_Feature*const* f = features; *f; ++f) {
+ if (!strcmp(uri, (*f)->URI)) {
+ return (*f)->data;
+ }
+ }
+ return NULL;
+}
+
+/**
+ Query a features array.
+
+ This function allows getting several features in one call, and detect
+ missing required features, with the same caveat of lv2_features_data().
+
+ The arguments should be a series of const char* uri, void** data, bool
+ required, terminated by a NULL URI. The data pointers MUST be initialized
+ to NULL. For example:
+
+ @code
+ LV2_URID_Log* log = NULL;
+ LV2_URID_Map* map = NULL;
+ const char* missing = lv2_features_query(
+ features,
+ LV2_LOG__log, &log, false,
+ LV2_URID__map, &map, true,
+ NULL);
+ @endcode
+
+ @return NULL on success, otherwise the URI of this missing feature.
+*/
+static inline const char*
+lv2_features_query(const LV2_Feature* const* features, ...)
+{
+ va_list args;
+ va_start(args, features);
+
+ const char* uri = NULL;
+ while ((uri = va_arg(args, const char*))) {
+ void** data = va_arg(args, void**);
+ bool required = va_arg(args, int);
+
+ *data = lv2_features_data(features, uri);
+ if (required && !*data) {
+ return uri;
+ }
+ }
+
+ return NULL;
+}
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+/**
+ @}
+ @}
+*/
diff --git a/lv2/lv2plug.in/ns/lv2core/lv2core.doap.ttl b/lv2/lv2plug.in/ns/lv2core/lv2core.doap.ttl
index 2e74227..3768faf 100644
--- a/lv2/lv2plug.in/ns/lv2core/lv2core.doap.ttl
+++ b/lv2/lv2plug.in/ns/lv2core/lv2core.doap.ttl
@@ -16,6 +16,15 @@
<http://drobilla.net/drobilla#me> ;
doap:maintainer <http://drobilla.net/drobilla#me> ;
doap:release [
+ doap:revision "13.1" ;
+ doap:created "2016-07-30" ;
+ dcs:blame <http://drobilla.net/drobilla#me> ;
+ dcs:changeset [
+ dcs:item [
+ rdfs:label "Add lv2_util.h with lv2_features_data() and lv2_features_query()."
+ ]
+ ]
+ ] , [
doap:revision "12.4" ;
doap:created "2015-04-07" ;
doap:file-release <http://lv2plug.in/spec/lv2-1.12.0.tar.bz2> ;
diff --git a/lv2/lv2plug.in/ns/lv2core/lv2core.ttl b/lv2/lv2plug.in/ns/lv2core/lv2core.ttl
index d08d063..1980f37 100644
--- a/lv2/lv2plug.in/ns/lv2core/lv2core.ttl
+++ b/lv2/lv2plug.in/ns/lv2core/lv2core.ttl
@@ -38,6 +38,7 @@ devices). See <a href="http://www.w3.org/TR/xhtml-basic/#s_xhtmlmodules"
<http://lv2plug.in/ns/lv2core>
a owl:Ontology ;
rdfs:seeAlso <lv2.h> ,
+ <lv2_util.h> ,
<lv2core.doap.ttl> ,
<../meta/meta.ttl> ;
lv2:documentation """
diff --git a/lv2/lv2plug.in/ns/lv2core/manifest.ttl b/lv2/lv2plug.in/ns/lv2core/manifest.ttl
index 2995826..916b596 100644
--- a/lv2/lv2plug.in/ns/lv2core/manifest.ttl
+++ b/lv2/lv2plug.in/ns/lv2core/manifest.ttl
@@ -4,6 +4,6 @@
<http://lv2plug.in/ns/lv2core>
a lv2:Specification ;
- lv2:minorVersion 12 ;
- lv2:microVersion 4 ;
+ lv2:minorVersion 13 ;
+ lv2:microVersion 1 ;
rdfs:seeAlso <lv2core.ttl> .
diff --git a/lv2/lv2plug.in/ns/meta/meta.ttl b/lv2/lv2plug.in/ns/meta/meta.ttl
index a3c21fb..4725a50 100644
--- a/lv2/lv2plug.in/ns/meta/meta.ttl
+++ b/lv2/lv2plug.in/ns/meta/meta.ttl
@@ -46,8 +46,8 @@ THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH R
meta:kfoltman ,
meta:paniq ;
doap:release [
- doap:revision "1.12.1" ;
- doap:created "2015-10-24" ;
+ doap:revision "1.13.1" ;
+ doap:created "2016-07-31" ;
dcs:blame <http://drobilla.net/drobilla#me> ;
dcs:changeset [
dcs:item [
diff --git a/wscript b/wscript
index 8cda191..945a53a 100644
--- a/wscript
+++ b/wscript
@@ -15,7 +15,7 @@ import waflib.Utils as Utils
# Variables for 'waf dist'
APPNAME = 'lv2'
-VERSION = '1.12.1'
+VERSION = '1.13.1'
# Mandatory variables
top = '.'