From 1b3c70387627033b78898b101654ac7b35d58487 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 18 Nov 2011 04:56:34 +0000 Subject: Update dynmanifest extension. --- Doxyfile | 2 +- ext/dyn-manifest.lv2/Makefile | 20 --- ext/dyn-manifest.lv2/dyn-manifest.h | 245 --------------------------------- ext/dyn-manifest.lv2/dyn-manifest.ttl | 109 --------------- ext/dyn-manifest.lv2/ext.pc.in | 1 - ext/dyn-manifest.lv2/manifest.ttl | 9 -- ext/dyn-manifest.lv2/waf | 1 - ext/dyn-manifest.lv2/wscript | 1 - ext/dynmanifest.lv2/Makefile | 20 +++ ext/dynmanifest.lv2/dynmanifest.h | 247 ++++++++++++++++++++++++++++++++++ ext/dynmanifest.lv2/dynmanifest.ttl | 80 +++++++++++ ext/dynmanifest.lv2/ext.pc.in | 1 + ext/dynmanifest.lv2/manifest.ttl | 9 ++ ext/dynmanifest.lv2/waf | 1 + ext/dynmanifest.lv2/wscript | 1 + 15 files changed, 360 insertions(+), 387 deletions(-) delete mode 100644 ext/dyn-manifest.lv2/Makefile delete mode 100644 ext/dyn-manifest.lv2/dyn-manifest.h delete mode 100644 ext/dyn-manifest.lv2/dyn-manifest.ttl delete mode 120000 ext/dyn-manifest.lv2/ext.pc.in delete mode 100644 ext/dyn-manifest.lv2/manifest.ttl delete mode 120000 ext/dyn-manifest.lv2/waf delete mode 120000 ext/dyn-manifest.lv2/wscript create mode 100644 ext/dynmanifest.lv2/Makefile create mode 100644 ext/dynmanifest.lv2/dynmanifest.h create mode 100644 ext/dynmanifest.lv2/dynmanifest.ttl create mode 120000 ext/dynmanifest.lv2/ext.pc.in create mode 100644 ext/dynmanifest.lv2/manifest.ttl create mode 120000 ext/dynmanifest.lv2/waf create mode 120000 ext/dynmanifest.lv2/wscript diff --git a/Doxyfile b/Doxyfile index 4a4ff1d..9eff8cb 100644 --- a/Doxyfile +++ b/Doxyfile @@ -571,7 +571,7 @@ INPUT = \ ext/atom.lv2/atom.h \ ext/contexts.lv2/contexts.h \ ext/data-access.lv2/data-access.h \ - ext/dyn-manifest.lv2/dyn-manifest.h \ + ext/dynmanifest.lv2/dynmanifest.h \ ext/event.lv2/event-helpers.h \ ext/event.lv2/event.h \ ext/files.lv2/files.h \ diff --git a/ext/dyn-manifest.lv2/Makefile b/ext/dyn-manifest.lv2/Makefile deleted file mode 100644 index c575035..0000000 --- a/ext/dyn-manifest.lv2/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -PREFIX = /usr/local -LV2_DIR = $(PREFIX)/lib/lv2 -INCLUDE_DIR = $(PREFIX)/include - -all: - @echo "There's nothing to build here, just 'make install'" - @echo - @echo "The variables PREFIX, LV2_DIR, and INCLUDE_DIR are used, e.g.:" - @echo "make PREFIX=/usr LV2_DIR=/usr/lib/lv2 INCLUDE_DIR=/usr/include" - @echo - @echo "Defaults:" - @echo " PREFIX = /usr/local" - @echo " LV2_DIR = PREFIX/lib/lv2" - @echo " INCLUDE_DIR = PREFIX/include" - -install: - install -d $(LV2_DIR)/lv2_dyn_manifest.lv2 - install -m 0644 lv2_dyn_manifest.ttl $(LV2_DIR)/lv2_dyn_manifest.lv2/ - install -d $(INCLUDE_DIR)/ - install -m 0644 lv2_dyn_manifest.h $(INCLUDE_DIR)/ diff --git a/ext/dyn-manifest.lv2/dyn-manifest.h b/ext/dyn-manifest.lv2/dyn-manifest.h deleted file mode 100644 index 45e7549..0000000 --- a/ext/dyn-manifest.lv2/dyn-manifest.h +++ /dev/null @@ -1,245 +0,0 @@ -/* Dynamic manifest specification for LV2 - * Revision 1 - * - * Copyright (C) 2008, 2009 Stefano D'Angelo - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef LV2_DYN_MANIFEST_H_INCLUDED -#define LV2_DYN_MANIFEST_H_INCLUDED - -#include -#include "lv2.h" - -#ifdef __cplusplus -extern "C" { -#endif - - -/* ************************************************************************* */ - - -/** @file - * C header for the LV2 Dynamic Manifest extension - * . - * Revision: 1 - * - * == Overview == - * - * The LV2 API, on its own, cannot be used to write plugin libraries where - * data is dynamically generated at runtime (e.g. API wrappers), since LV2 - * requires needed information to be provided in one or more static data (RDF) - * files. This API addresses this limitation by extending the LV2 API. - * - * A host implementing support for this API should first detect that the plugin - * library implements a dynamic manifest generator by examining its static - * manifest file, then fetch data from the shared object file by accessing it as - * usual (dlopen() and family) and using this API. - * - * The host is allowed to request regeneration of the dynamic manifest multiple - * times, and the plugin library is expected to provide updated data if/when - * possible. All data and references provided via this API before the last - * regeneration of the dynamic manifest is to be considered invalid by the - * host, including plugin descriptors whose URIs were discovered using this API. - * - * This API is extensible in a similar fashion as the LV2 plugin API. - * - * == Threading rules == - * - * This specification defines threading rule classes, similarly to the LV2 - * specification. - * - * The functions defined by this API belong to: - * - * - Dynamic manifest open class: lv2_dyn_manifest_open() - * - Dynamic manifest close class: lv2_dyn_manifest_close() - * - Dynamic manifest file class: lv2_dyn_manifest_get_subjects(), - * lv2_dyn_manifest_get_data() - * - * The rules that hosts must follow are these: - * - * - When a function from the Dynamic manifest open or the Dynamic manifest - * close class is running, no other functions in the same shared object file - * may run. - * - When a function from the Dynamic manifest file class is called, no other - * functions from the same class may run if they are given at least one - * FILE * argument with the same value. - * - A function from the Dynamic manifest open class may not run after a - * successful call to a function from the same class, in case a function from - * the Dynamic manifest close class was not successfully called in the - * meanwhile. - * - A function from the Dynamic manifest close class may only run after a - * successful call to a function from the Dynamic manifest open class. - * - A function from the Dynamic manifest file class may only run beetween a - * successful call to a function from the Dynamic manifest open class and the - * following successful call to a function from the Dynamic manifest close - * class. - * - * Extensions to this specification which add new functions MUST declare in - * which of these classes the functions belong, or define new classes for them; - * furthermore, classes defined by such extensions MUST only allow calls after - * a successful call to a function from the Dynamic manifest open class and - * before the following successful call to a function from the Dynamic manifest - * close class. - * - * Any simultaneous calls that are not explicitly forbidden by these rules are - * allowed. - */ - - -/* ************************************************************************* */ - - -/** Dynamic manifest generator handle. - * - * This handle indicates a particular status of a dynamic manifest generator. - * The host MUST NOT attempt to interpret it and, unlikely LV2_Handle, it is NOT - * even valid to compare this to NULL. The dynamic manifest generator may use it - * to reference internal data. */ -typedef void * LV2_Dyn_Manifest_Handle; - - -/* ************************************************************************* */ - - -/** Accessing data. - * - * Whenever a host wants to access data using this API, it could: - * - * 1. Call lv2_dyn_manifest_open(); - * 2. Create an empty resource identified by a FILE *; - * 3. Get a "list" of exposed subject URIs using - * lv2_dyn_manifest_get_subjects(); - * 4. Call lv2_dyn_manifest_get_data() for each URI of interest, in order to - * get data related to that URI (either by calling the function subsequently - * with the same FILE * resource, or by creating more FILE * resources to - * perform parallel calls); - * 5. Call lv2_dyn_manifest_close(); - * 6. Parse the content of the FILE * resource(s). - * 7. Free/delete/unlink the FILE * resource(s). - * - * The content of the FILE * resources has to be interpreted by the host as a - * regular file in Turtle syntax. This also means that each FILE * resource - * should also contain needed prefix definitions, in case any are used. - * - * Each call to lv2_dyn_manifest_open() automatically implies the (re)generation - * of the dynamic manifest on the library side. - * - * When such calls are made, data fetched from the involved library using this - * API before such call is to be considered no more valid. - * - * In case the library uses this same API to access other dynamic manifests, it - * MUST implement some mechanism to avoid potentially endless loops (such as A - * loads B, B loads A, etc.) in functions from the Dynamic manifest open class - * (the open-like operation MUST fail). For this purpose, use of a static - * boolean flag is suggested. - */ - -/** Function that (re)generates the dynamic manifest. - * - * handle is a pointer to an uninitialized dynamic manifest generator handle. - * - * features is a NULL terminated array of LV2_Feature structs which - * represent the features the host supports. The dynamic manifest geenrator may - * refuse to (re)generate the dynamic manifest if required features are not - * found here (however hosts SHOULD NOT use this as a discovery mechanism, - * instead of reading the static manifest file). This array must always exist; - * if a host has no features, it MUST pass a single element array containing - * NULL. - * - * This function MUST return 0 on success, otherwise a non-zero error code, and - * the host SHOULD evaluate the result of the operation by examining the - * returned value, rather than try to interpret the value of handle. - */ -int lv2_dyn_manifest_open(LV2_Dyn_Manifest_Handle * handle, - const LV2_Feature *const * features); - -/** Function that fetches a "list" of subject URIs exposed by the dynamic - * manifest generator. - * - * handle is the dynamic manifest generator handle. - * - * fp is the FILE * identifying the resource the host has to set up for the - * dynamic manifest generator. The host MUST pass a writable, empty resource to - * this function, and the dynamic manifest generator MUST ONLY perform write - * operations on it at the end of the stream (e.g. use only fprintf(), fwrite() - * and similar). - * - * The dynamic manifest generator has to fill the resource only with the needed - * triples to make the host aware of the "objects" it wants to expose. For - * example, if the library exposes a regular LV2 plugin, it should output only a - * triple like the following: - * - * a lv2:Plugin . - * - * This function MUST return 0 on success, otherwise a non-zero error code. - */ -int lv2_dyn_manifest_get_subjects(LV2_Dyn_Manifest_Handle handle, - FILE * fp); - -/** Function that fetches data related to a specific URI. - * - * handle is the dynamic manifest generator handle. - * - * fp is the FILE * identifying the resource the host has to set up for the - * dynamic manifest generator. The host MUST pass a writable resource to this - * function, and the dynamic manifest generator MUST ONLY perform write - * operations on it at the current position of the stream (e.g. use only - * fprintf(), fwrite() and similar). - * - * uri is the URI to get data about (in the "plain" form, a.k.a. without RDF - * prefixes). - * - * The dynamic manifest generator has to fill the resource with data related to - * the URI. For example, if the library exposes a regular LV2 plugin whose URI, - * as retrieved by the host using lv2_dyn_manifest_get_subjects() is - * http://www.example.com/plugin/uri, it should output something like: - * - * a lv2:Plugin; - * lv2:binary ; - * doap:name "My Plugin"; - * ... etc... - * - * This function MUST return 0 on success, otherwise a non-zero error code. - */ -int lv2_dyn_manifest_get_data(LV2_Dyn_Manifest_Handle handle, - FILE * fp, - const char * uri); - -/** Function that ends the operations on the dynamic manifest generator. - * - * handle is the dynamic manifest generator handle. - * - * This function should be used by the dynamic manifest generator to perform - * cleanup operations, etc. - */ -void lv2_dyn_manifest_close(LV2_Dyn_Manifest_Handle handle); - -#ifdef __cplusplus -} -#endif - -#endif /* LV2_DYN_MANIFEST_H_INCLUDED */ - diff --git a/ext/dyn-manifest.lv2/dyn-manifest.ttl b/ext/dyn-manifest.lv2/dyn-manifest.ttl deleted file mode 100644 index 78f0e31..0000000 --- a/ext/dyn-manifest.lv2/dyn-manifest.ttl +++ /dev/null @@ -1,109 +0,0 @@ -# Dynamic manifest specification for LV2 -# Revision 1 -# -# Copyright (C) 2008, 2009 Stefano D'Angelo -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# 3. The name of the author may not be used to endorse or promote products -# derived from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -@prefix dman: . -@prefix lv2: . -@prefix rdf: . -@prefix rdfs: . -@prefix owl: . -@prefix xsd: . -@prefix doap: . -@prefix foaf: . - - - a doap:Project ; - a lv2:Specification ; - doap:license ; - doap:name "LV2 Dynamic Manifest" ; - doap:homepage ; - doap:created "2009-06-13" ; - doap:shortdesc "An LV2-based specification for dynamic data generation." ; - doap:programming-language "C" ; - doap:release [ - doap:revision "1.1" ; - doap:created "2010-10-29" - ] ; - doap:maintainer [ - a foaf:Person ; - foaf:name "Stefano D'Angelo" ; - ] . - -###################################### -## Dynamic manifest generator class ## -###################################### - -dman:DynManifest a rdfs:Class ; - rdfs:label "Dynamic manifest generator" ; - rdfs:subClassOf [ a owl:Restriction ; - owl:onProperty rdf:type ; - owl:hasValue dman:DynManifest ; - rdfs:comment "A DynManifest has rdf:type dman:DynManifest." - ] , [ a owl:Restriction ; - owl:onProperty lv2:binary ; - owl:minCardinality 1 ; - rdfs:comment """A DynManifest has at least 1 lv2:binary. -The binary must be a library with at least the functions described in -lv2_dyn_manifest.h implemented. -""" ] ; - rdfs:comment """ -The class which represents a dynamic manifest generator. - -There MUST NOT be any instances of :DynManifest in the generated manifest. - -All relative URIs in the generated data MUST be relative to the base path -that would be used to parse a normal LV2 manifest (the bundle path). -""" . - -############## -## Features ## -############## - -dman:optionalFeature a rdf:Property ; - rdfs:domain dman:DynManifest ; - rdfs:range lv2:Feature ; - rdfs:label "Optional feature" ; - rdfs:comment """ -Signifies that a dynamic manifest generator is able to make use of or provide a -certain feature. If the host supports this feature, it MUST pass its URI and any -additional data to the dynamic manifest generator in the lv2_dyn_manifest_open() -function. The dynamic manifest generator MUST NOT fail because an optional -feature is possibly not supported by the host.""" . - -dman:requiredFeature a rdf:Property ; - rdfs:domain dman:DynManifest ; - rdfs:range lv2:Feature ; - rdfs:label "Required feature" ; - rdfs:comment """ -Signifies that a dynamic manifest generator requires a certain feature in order -to function. If the host supports this feature, it MUST pass its URI and any -additional data to the dynamic manifest generator in the lv2_dyn_manifest_open() -function. The dynamic manifest generator MUST fail if a required feature is not -present; hosts SHOULD always check this before attempting to perform futher -operations on the dynamic manifest generator. -""" . - diff --git a/ext/dyn-manifest.lv2/ext.pc.in b/ext/dyn-manifest.lv2/ext.pc.in deleted file mode 120000 index 950cb3b..0000000 --- a/ext/dyn-manifest.lv2/ext.pc.in +++ /dev/null @@ -1 +0,0 @@ -../../ext.pc.in \ No newline at end of file diff --git a/ext/dyn-manifest.lv2/manifest.ttl b/ext/dyn-manifest.lv2/manifest.ttl deleted file mode 100644 index 1925428..0000000 --- a/ext/dyn-manifest.lv2/manifest.ttl +++ /dev/null @@ -1,9 +0,0 @@ -@prefix lv2: . -@prefix rdfs: . - - - a lv2:Specification ; - lv2:minorVersion 1 ; - lv2:microVersion 1 ; - rdfs:seeAlso . - diff --git a/ext/dyn-manifest.lv2/waf b/ext/dyn-manifest.lv2/waf deleted file mode 120000 index 59a1ac9..0000000 --- a/ext/dyn-manifest.lv2/waf +++ /dev/null @@ -1 +0,0 @@ -../../waf \ No newline at end of file diff --git a/ext/dyn-manifest.lv2/wscript b/ext/dyn-manifest.lv2/wscript deleted file mode 120000 index b82a3d0..0000000 --- a/ext/dyn-manifest.lv2/wscript +++ /dev/null @@ -1 +0,0 @@ -../../ext.wscript \ No newline at end of file diff --git a/ext/dynmanifest.lv2/Makefile b/ext/dynmanifest.lv2/Makefile new file mode 100644 index 0000000..c575035 --- /dev/null +++ b/ext/dynmanifest.lv2/Makefile @@ -0,0 +1,20 @@ +PREFIX = /usr/local +LV2_DIR = $(PREFIX)/lib/lv2 +INCLUDE_DIR = $(PREFIX)/include + +all: + @echo "There's nothing to build here, just 'make install'" + @echo + @echo "The variables PREFIX, LV2_DIR, and INCLUDE_DIR are used, e.g.:" + @echo "make PREFIX=/usr LV2_DIR=/usr/lib/lv2 INCLUDE_DIR=/usr/include" + @echo + @echo "Defaults:" + @echo " PREFIX = /usr/local" + @echo " LV2_DIR = PREFIX/lib/lv2" + @echo " INCLUDE_DIR = PREFIX/include" + +install: + install -d $(LV2_DIR)/lv2_dyn_manifest.lv2 + install -m 0644 lv2_dyn_manifest.ttl $(LV2_DIR)/lv2_dyn_manifest.lv2/ + install -d $(INCLUDE_DIR)/ + install -m 0644 lv2_dyn_manifest.h $(INCLUDE_DIR)/ diff --git a/ext/dynmanifest.lv2/dynmanifest.h b/ext/dynmanifest.lv2/dynmanifest.h new file mode 100644 index 0000000..204e18b --- /dev/null +++ b/ext/dynmanifest.lv2/dynmanifest.h @@ -0,0 +1,247 @@ +/* Dynamic manifest specification for LV2 + * Revision 1.1 + * + * Copyright (C) 2008-2011 Stefano D'Angelo + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef LV2_DYN_MANIFEST_H_INCLUDED +#define LV2_DYN_MANIFEST_H_INCLUDED + +#include +#include "lv2.h" + +#define LV2_DYN_MANIFEST_URI "http://lv2plug.in/ns/ext/dynmanifest" + +#ifdef __cplusplus +extern "C" { +#endif + + +/* ************************************************************************* */ + + +/** @file + * C header for the LV2 Dynamic Manifest extension + * . + * Revision: 1.1 + * + * == Overview == + * + * The LV2 API, on its own, cannot be used to write plugin libraries where + * data is dynamically generated at runtime (e.g. API wrappers), since LV2 + * requires needed information to be provided in one or more static data (RDF) + * files. This API addresses this limitation by extending the LV2 API. + * + * A host implementing support for this API should first detect that the plugin + * library implements a dynamic manifest generator by examining its static + * manifest file, then fetch data from the shared object file by accessing it as + * usual (e.g., dlopen() and family) and using this API. + * + * The host is allowed to request regeneration of the dynamic manifest multiple + * times, and the plugin library is expected to provide updated data if/when + * possible. All data and references provided via this API before the last + * regeneration of the dynamic manifest is to be considered invalid by the + * host, including plugin descriptors whose URIs were discovered using this API. + * + * This API is extensible in a similar fashion as the LV2 API. + * + * == Threading rules == + * + * This specification defines threading rule classes, similarly to the LV2 + * specification. + * + * The functions defined by this API belong to: + * + * - Dynamic manifest open class: lv2_dyn_manifest_open() + * - Dynamic manifest close class: lv2_dyn_manifest_close() + * - Dynamic manifest file class: lv2_dyn_manifest_get_subjects(), + * lv2_dyn_manifest_get_data() + * + * The rules that hosts must follow are these: + * + * - When a function from the Dynamic manifest open or the Dynamic manifest + * close class is running, no other functions in the same shared object file + * may run. + * - When a function from the Dynamic manifest file class is called, no other + * functions from the same class may run if they are given at least one + * FILE * argument with the same value. + * - A function from the Dynamic manifest open class may not run after a + * successful call to a function from the same class, in case a function from + * the Dynamic manifest close class was not successfully called in the + * meanwhile. + * - A function from the Dynamic manifest close class may only run after a + * successful call to a function from the Dynamic manifest open class. + * - A function from the Dynamic manifest file class may only run beetween a + * successful call to a function from the Dynamic manifest open class and the + * following successful call to a function from the Dynamic manifest close + * class. + * + * Extensions to this specification which add new functions MUST declare in + * which of these classes the functions belong, or define new classes for them; + * furthermore, classes defined by such extensions MUST only allow calls after + * a successful call to a function from the Dynamic manifest open class and + * before the following successful call to a function from the Dynamic manifest + * close class. + * + * Any simultaneous calls that are not explicitly forbidden by these rules are + * allowed. + */ + + +/* ************************************************************************* */ + + +/** Dynamic manifest generator handle. + * + * This handle indicates a particular status of a dynamic manifest generator. + * The host MUST NOT attempt to interpret it and, unlikely LV2_Handle, it is NOT + * even valid to compare this to NULL. The dynamic manifest generator may use it + * to reference internal data. */ +typedef void * LV2_Dyn_Manifest_Handle; + + +/* ************************************************************************* */ + + +/** Accessing data. + * + * Whenever a host wants to access data using this API, it could: + * + * 1. Call lv2_dyn_manifest_open(); + * 2. Create an empty resource identified by a FILE *; + * 3. Get a "list" of exposed subject URIs using + * lv2_dyn_manifest_get_subjects(); + * 4. Call lv2_dyn_manifest_get_data() for each URI of interest, in order to + * get data related to that URI (either by calling the function subsequently + * with the same FILE * resource, or by creating more FILE * resources to + * perform parallel calls); + * 5. Call lv2_dyn_manifest_close(); + * 6. Parse the content of the FILE * resource(s). + * 7. Free/delete/unlink the FILE * resource(s). + * + * The content of the FILE * resources has to be interpreted by the host as a + * regular file in Turtle syntax. This also means that each FILE * resource + * should also contain needed prefix definitions, in case any are used. + * + * Each call to lv2_dyn_manifest_open() automatically implies the (re)generation + * of the dynamic manifest on the library side. + * + * When such calls are made, data fetched from the involved library using this + * API before such call is to be considered no more valid. + * + * In case the library uses this same API to access other dynamic manifests, it + * MUST implement some mechanism to avoid potentially endless loops (such as A + * loads B, B loads A, etc.) in functions from the Dynamic manifest open class + * (the open-like operation MUST fail). For this purpose, use of a static + * boolean flag is suggested. + */ + +/** Function that (re)generates the dynamic manifest. + * + * handle is a pointer to an uninitialized dynamic manifest generator handle. + * + * features is a NULL terminated array of LV2_Feature structs which + * represent the features the host supports. The dynamic manifest geenrator may + * refuse to (re)generate the dynamic manifest if required features are not + * found here (however hosts SHOULD NOT use this as a discovery mechanism, + * instead of reading the static manifest file). This array must always exist; + * if a host has no features, it MUST pass a single element array containing + * NULL. + * + * This function MUST return 0 on success, otherwise a non-zero error code, and + * the host SHOULD evaluate the result of the operation by examining the + * returned value, rather than try to interpret the value of handle. + */ +int lv2_dyn_manifest_open(LV2_Dyn_Manifest_Handle * handle, + const LV2_Feature *const * features); + +/** Function that fetches a "list" of subject URIs exposed by the dynamic + * manifest generator. + * + * handle is the dynamic manifest generator handle. + * + * fp is the FILE * identifying the resource the host has to set up for the + * dynamic manifest generator. The host MUST pass a writable, empty resource to + * this function, and the dynamic manifest generator MUST ONLY perform write + * operations on it at the end of the stream (e.g. use only fprintf(), fwrite() + * and similar). + * + * The dynamic manifest generator has to fill the resource only with the needed + * triples to make the host aware of the "objects" it wants to expose. For + * example, if the library exposes a regular LV2 plugin, it should output only a + * triple like the following: + * + * a lv2:Plugin . + * + * This function MUST return 0 on success, otherwise a non-zero error code. + */ +int lv2_dyn_manifest_get_subjects(LV2_Dyn_Manifest_Handle handle, + FILE * fp); + +/** Function that fetches data related to a specific URI. + * + * handle is the dynamic manifest generator handle. + * + * fp is the FILE * identifying the resource the host has to set up for the + * dynamic manifest generator. The host MUST pass a writable resource to this + * function, and the dynamic manifest generator MUST ONLY perform write + * operations on it at the current position of the stream (e.g. use only + * fprintf(), fwrite() and similar). + * + * uri is the URI to get data about (in the "plain" form, a.k.a. without RDF + * prefixes). + * + * The dynamic manifest generator has to fill the resource with data related to + * the URI. For example, if the library exposes a regular LV2 plugin whose URI, + * as retrieved by the host using lv2_dyn_manifest_get_subjects() is + * http://www.example.com/plugin/uri, it should output something like: + * + * a lv2:Plugin; + * lv2:binary ; + * doap:name "My Plugin"; + * ... etc... + * + * This function MUST return 0 on success, otherwise a non-zero error code. + */ +int lv2_dyn_manifest_get_data(LV2_Dyn_Manifest_Handle handle, + FILE * fp, + const char * uri); + +/** Function that ends the operations on the dynamic manifest generator. + * + * handle is the dynamic manifest generator handle. + * + * This function should be used by the dynamic manifest generator to perform + * cleanup operations, etc. + */ +void lv2_dyn_manifest_close(LV2_Dyn_Manifest_Handle handle); + +#ifdef __cplusplus +} +#endif + +#endif /* LV2_DYN_MANIFEST_H_INCLUDED */ + diff --git a/ext/dynmanifest.lv2/dynmanifest.ttl b/ext/dynmanifest.lv2/dynmanifest.ttl new file mode 100644 index 0000000..235a249 --- /dev/null +++ b/ext/dynmanifest.lv2/dynmanifest.ttl @@ -0,0 +1,80 @@ +# Dynamic manifest specification for LV2 +# Revision 1 +# +# Copyright (C) 2008, 2009 Stefano D'Angelo +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +@prefix dman: . +@prefix lv2: . +@prefix rdf: . +@prefix rdfs: . +@prefix owl: . +@prefix xsd: . +@prefix doap: . +@prefix foaf: . + + + a doap:Project ; + a lv2:Specification ; + doap:license ; + doap:name "LV2 Dynamic Manifest" ; + doap:homepage ; + doap:created "2009-06-13" ; + doap:shortdesc "An LV2-based specification for dynamic data generation." ; + doap:programming-language "C" ; + doap:release [ + doap:revision "1.1" ; + doap:created "2011-11-17" + ] ; + doap:maintainer [ + a foaf:Person ; + foaf:name "Stefano D'Angelo" ; + ] . + +###################################### +## Dynamic manifest generator class ## +###################################### + +dman:DynManifest a rdfs:Class ; + rdfs:label "Dynamic manifest generator" ; + rdfs:subClassOf [ a owl:Restriction ; + owl:onProperty rdf:type ; + owl:hasValue dman:DynManifest ; + rdfs:comment "A DynManifest has rdf:type dman:DynManifest." + ] , [ a owl:Restriction ; + owl:onProperty lv2:binary ; + owl:minCardinality 1 ; + rdfs:comment """A DynManifest has at least 1 lv2:binary. +The binary must be a library with at least the functions described in +lv2_dyn_manifest.h implemented. +""" ] ; + rdfs:comment """ +The class which represents a dynamic manifest generator. + +There MUST NOT be any instances of :DynManifest in the generated manifest. + +All relative URIs in the generated data MUST be relative to the base path +that would be used to parse a normal LV2 manifest (the bundle path). +""" . diff --git a/ext/dynmanifest.lv2/ext.pc.in b/ext/dynmanifest.lv2/ext.pc.in new file mode 120000 index 0000000..950cb3b --- /dev/null +++ b/ext/dynmanifest.lv2/ext.pc.in @@ -0,0 +1 @@ +../../ext.pc.in \ No newline at end of file diff --git a/ext/dynmanifest.lv2/manifest.ttl b/ext/dynmanifest.lv2/manifest.ttl new file mode 100644 index 0000000..a23e849 --- /dev/null +++ b/ext/dynmanifest.lv2/manifest.ttl @@ -0,0 +1,9 @@ +@prefix lv2: . +@prefix rdfs: . + + + a lv2:Specification ; + lv2:minorVersion 1 ; + lv2:microVersion 1 ; + rdfs:seeAlso . + diff --git a/ext/dynmanifest.lv2/waf b/ext/dynmanifest.lv2/waf new file mode 120000 index 0000000..59a1ac9 --- /dev/null +++ b/ext/dynmanifest.lv2/waf @@ -0,0 +1 @@ +../../waf \ No newline at end of file diff --git a/ext/dynmanifest.lv2/wscript b/ext/dynmanifest.lv2/wscript new file mode 120000 index 0000000..b82a3d0 --- /dev/null +++ b/ext/dynmanifest.lv2/wscript @@ -0,0 +1 @@ +../../ext.wscript \ No newline at end of file -- cgit v1.2.1