| @@ -1,29 +0,0 @@ | |||||
| This library is designed to allow parallel installation of different major | |||||
| versions. To facilitate this, the shared library name, include directory, and | |||||
| pkg-config file are suffixed with the major version number of the library. | |||||
| For example, if this library was named "foo" and at version 1.x.y: | |||||
| /usr/include/foo-1/foo/foo.h | |||||
| /usr/lib/foo-1.so.1.x.y | |||||
| /usr/lib/pkgconfig/foo-1.pc | |||||
| Dependencies check for pkg-config name "foo-1" and will build | |||||
| against a compatible version 1, regardless any other installed versions. | |||||
| *** IMPORTANT GUIDELINES FOR PACKAGERS *** | |||||
| Packages should follow the same conventions as above, i.e. include the major | |||||
| version (and only the major version) in the name of the package. Continuing the | |||||
| example above, the package(s) would be named foo-1 and foo-1-dev. This way, | |||||
| if/when version 2 comes out, it may be installed at the same time as version 1 | |||||
| without breaking anything. | |||||
| Please do not create packages of this library that do not follow these | |||||
| guidelines, you will break things and cause unnecessary headaches. Please do | |||||
| not use any number as a suffix other than the actual major version number of the | |||||
| upstream source package. | |||||
| Because program and documentation names are not versioned, these should be | |||||
| included in separate packages which may replace previous versions, since | |||||
| there is little use in having parallel installations of them. | |||||
| @@ -8,11 +8,7 @@ Building this software requires only Python. To install with default options: | |||||
| ./waf configure | ./waf configure | ||||
| ./waf | ./waf | ||||
| ./waf install | |||||
| You may need to become root for the install stage, for example: | |||||
| sudo ./waf install | |||||
| ./waf install # or sudo ./waf install | |||||
| Configuration Options | Configuration Options | ||||
| --------------------- | --------------------- | ||||
| @@ -40,12 +36,20 @@ invoked: | |||||
| * CPPFLAGS: C preprocessor options | * CPPFLAGS: C preprocessor options | ||||
| * LINKFLAGS: Linker options | * LINKFLAGS: Linker options | ||||
| Installation Directories | |||||
| ------------------------ | |||||
| Library Versioning | |||||
| ------------------ | |||||
| This library uses semantic versioning <http://semver.org/>. | |||||
| Several major versions can be installed in parallel. The shared library name, | |||||
| include directory, and pkg-config file are suffixed with the major version | |||||
| number. For example, a library named "foo" at version 1.x.y might install: | |||||
| The --prefix option (or the PREFIX environment variable) can be used to change | |||||
| the prefix which all files are installed under. There are also several options | |||||
| allowing for more fine-tuned control, see the --help output for details. | |||||
| /usr/include/foo-1/foo/foo.h | |||||
| /usr/lib/foo-1.so.1.x.y | |||||
| /usr/lib/pkgconfig/foo-1.pc | |||||
| Dependencies can check for the package "foo-1" with pkg-config. | |||||
| Packaging | Packaging | ||||
| --------- | --------- | ||||
| @@ -57,3 +61,6 @@ which adds a prefix to all install paths. For example: | |||||
| ./waf configure --prefix=/usr | ./waf configure --prefix=/usr | ||||
| ./waf | ./waf | ||||
| ./waf install --destdir=/tmp/package | ./waf install --destdir=/tmp/package | ||||
| Packages should allow parallel installation of several major versions. For | |||||
| example, the above would be packaged as "foo-1". | |||||
| @@ -1,4 +1,10 @@ | |||||
| lilv (0.21.3) unstable; | |||||
| lilv (0.22.1) unstable; | |||||
| * Fix Python bindings | |||||
| -- David Robillard <d@drobilla.net> Fri, 09 Oct 2015 13:01:14 -0400 | |||||
| lilv (0.22.0) stable; | |||||
| * Fix loading files with spaces in their path | * Fix loading files with spaces in their path | ||||
| * Add lilv_file_uri_parse() for correct URI to path conversion | * Add lilv_file_uri_parse() for correct URI to path conversion | ||||
| @@ -6,6 +12,7 @@ lilv (0.21.3) unstable; | |||||
| * Add lilv_state_emit_port_values() for special port value handling | * Add lilv_state_emit_port_values() for special port value handling | ||||
| * Add lilv_state_get_uri() | * Add lilv_state_get_uri() | ||||
| * Add lilv_state_delete() for deleting user saved presets | * Add lilv_state_delete() for deleting user saved presets | ||||
| * Add lilv_free() for systems picky about such things | |||||
| * Fix lilv_world_ask() to work with wildcards | * Fix lilv_world_ask() to work with wildcards | ||||
| * Fix creation of duplicate manifest entries when saving state | * Fix creation of duplicate manifest entries when saving state | ||||
| * Fix bindings for Python 3 | * Fix bindings for Python 3 | ||||
| @@ -16,10 +23,13 @@ lilv (0.21.3) unstable; | |||||
| * Preserve absolute paths in state if no link directory is given | * Preserve absolute paths in state if no link directory is given | ||||
| * Fix a few minor/unlikely memory errors | * Fix a few minor/unlikely memory errors | ||||
| * Configure based on compiler target OS for cross-compilation | * Configure based on compiler target OS for cross-compilation | ||||
| * Fix lilv_realpath() on pre-POSIX-2008 systems | |||||
| * Fix directory walking on some systems (thanks Matt Fischer) | |||||
| * Windows fixes (thanks John Emmas) | * Windows fixes (thanks John Emmas) | ||||
| * Minor documentation improvements | * Minor documentation improvements | ||||
| * Upgrade to waf 1.8.14 | |||||
| -- David Robillard <d@drobilla.net> Mon, 16 Mar 2015 03:24:05 -0400 | |||||
| -- David Robillard <d@drobilla.net> Thu, 08 Oct 2015 15:39:29 -0400 | |||||
| lilv (0.20.0) stable; | lilv (0.20.0) stable; | ||||
| @@ -40,6 +40,10 @@ namespace Lilv { | |||||
| self.iter = self.plugins.next(self.iter) | self.iter = self.plugins.next(self.iter) | ||||
| return plugin | return plugin | ||||
| def next(self): | |||||
| "Python 2 iterator protocol" | |||||
| return Iterator.__next__(self) | |||||
| return Iterator(self) | return Iterator(self) | ||||
| def get_by_uri(self, *args): | def get_by_uri(self, *args): | ||||
| @@ -58,7 +58,7 @@ PROJECT_LOGO = | |||||
| # entered, it will be relative to the location where doxygen was started. If | # entered, it will be relative to the location where doxygen was started. If | ||||
| # left blank the current directory will be used. | # left blank the current directory will be used. | ||||
| OUTPUT_DIRECTORY = @LILV_DOC_DIR@ | |||||
| OUTPUT_DIRECTORY = . | |||||
| # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 4096 sub- | # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 4096 sub- | ||||
| # directories (in 2 levels) under the output directory of each output format and | # directories (in 2 levels) under the output directory of each output format and | ||||
| @@ -7,5 +7,5 @@ Name: Lilv | |||||
| Version: @LILV_VERSION@ | Version: @LILV_VERSION@ | ||||
| Description: Simple C library for hosting LV2 plugins | Description: Simple C library for hosting LV2 plugins | ||||
| Requires: lv2 @PKG_serd_0@ @PKG_sord_0@ @PKG_sratom_0@ | Requires: lv2 @PKG_serd_0@ @PKG_sord_0@ @PKG_sratom_0@ | ||||
| Libs: -L${libdir} -l@LIB_LILV@ @LILV_PKG_LIBS@ -lsratom-0 -lsord-0 -lserd-0 -lm -ldl | |||||
| Libs: -L${libdir} -l@LIB_LILV@ @LILV_PKG_LIBS@ | |||||
| Cflags: -I${includedir}/lilv-@LILV_MAJOR_VERSION@ | Cflags: -I${includedir}/lilv-@LILV_MAJOR_VERSION@ | ||||
| @@ -26,9 +26,8 @@ | |||||
| #include <stdint.h> | #include <stdint.h> | ||||
| #include <stdio.h> | #include <stdio.h> | ||||
| #include "lv2/lv2.h" | |||||
| #include "lv2/state.h" | |||||
| #include "lv2/urid.h" | |||||
| #include "lv2/lv2plug.in/ns/lv2core/lv2.h" | |||||
| #include "lv2/lv2plug.in/ns/ext/urid/urid.h" | |||||
| #ifdef LILV_SHARED | #ifdef LILV_SHARED | ||||
| # ifdef _WIN32 | # ifdef _WIN32 | ||||
| @@ -101,6 +100,16 @@ typedef void LilvNodes; /**< set<Node>. */ | |||||
| @{ | @{ | ||||
| */ | */ | ||||
| /** | |||||
| Free memory allocated by Lilv. | |||||
| This function exists because some systems require memory allocated by a | |||||
| library to be freed by code in the same library. It is otherwise equivalent | |||||
| to the standard C free() function. | |||||
| */ | |||||
| LILV_API void | |||||
| lilv_free(void* ptr); | |||||
| /** | /** | ||||
| @name Node | @name Node | ||||
| @{ | @{ | ||||
| @@ -120,7 +129,7 @@ lilv_uri_to_path(const char* uri); | |||||
| /** | /** | ||||
| Convert a file URI string to a local path string. | Convert a file URI string to a local path string. | ||||
| For example, "file://foo/bar%20one/baz.ttl" returns "/foo/bar one/baz.ttl". | For example, "file://foo/bar%20one/baz.ttl" returns "/foo/bar one/baz.ttl". | ||||
| Return value must be freed by caller. | |||||
| Return value must be freed by caller with lilv_free(). | |||||
| @param uri The file URI to parse. | @param uri The file URI to parse. | ||||
| @param hostname If non-NULL, set to the hostname in the URI, if any. | @param hostname If non-NULL, set to the hostname in the URI, if any. | ||||
| @return `uri` converted to a path, or NULL on failure (URI is not local). | @return `uri` converted to a path, or NULL on failure (URI is not local). | ||||
| @@ -197,7 +206,7 @@ lilv_node_equals(const LilvNode* value, const LilvNode* other); | |||||
| /** | /** | ||||
| Return this value as a Turtle/SPARQL token. | Return this value as a Turtle/SPARQL token. | ||||
| Returned value must be freed by caller with free(). | |||||
| Returned value must be freed by caller with lilv_free(). | |||||
| <table> | <table> | ||||
| <caption>Example Turtle Tokens</caption> | <caption>Example Turtle Tokens</caption> | ||||
| <tr><th>URI</th><td><http://example.org/foo ></td></tr> | <tr><th>URI</th><td><http://example.org/foo ></td></tr> | ||||
| @@ -262,7 +271,7 @@ lilv_node_as_string(const LilvNode* value); | |||||
| /** | /** | ||||
| Return the path of a file URI node. | Return the path of a file URI node. | ||||
| Returns NULL if `value` is not a file URI. | Returns NULL if `value` is not a file URI. | ||||
| Returned value must be freed by caller. | |||||
| Returned value must be freed by caller with lilv_free(). | |||||
| */ | */ | ||||
| LILV_API char* | LILV_API char* | ||||
| lilv_node_get_path(const LilvNode* value, char** hostname); | lilv_node_get_path(const LilvNode* value, char** hostname); | ||||
| @@ -553,7 +562,7 @@ lilv_world_free(LilvWorld* world); | |||||
| with special plugin bundles which are installed to a known location). | with special plugin bundles which are installed to a known location). | ||||
| */ | */ | ||||
| LILV_API void | LILV_API void | ||||
| lilv_world_load_all(LilvWorld* world, const char* lv2_path); | |||||
| lilv_world_load_all(LilvWorld* world); | |||||
| /** | /** | ||||
| Load a specific bundle. | Load a specific bundle. | ||||
| @@ -1200,9 +1209,9 @@ lilv_port_get_scale_points(const LilvPlugin* plugin, | |||||
| @return A new LilvState which must be freed with lilv_state_free(), or NULL. | @return A new LilvState which must be freed with lilv_state_free(), or NULL. | ||||
| */ | */ | ||||
| LILV_API LilvState* | LILV_API LilvState* | ||||
| lilv_state_new_from_world(LilvWorld* world, | |||||
| const LV2_URID_Map* map, | |||||
| const LilvNode* subject); | |||||
| lilv_state_new_from_world(LilvWorld* world, | |||||
| LV2_URID_Map* map, | |||||
| const LilvNode* subject); | |||||
| /** | /** | ||||
| Load a state snapshot from a file. | Load a state snapshot from a file. | ||||
| @@ -1220,18 +1229,18 @@ lilv_state_new_from_world(LilvWorld* world, | |||||
| new memory consumed once this function returns. | new memory consumed once this function returns. | ||||
| */ | */ | ||||
| LILV_API LilvState* | LILV_API LilvState* | ||||
| lilv_state_new_from_file(LilvWorld* world, | |||||
| const LV2_URID_Map* map, | |||||
| const LilvNode* subject, | |||||
| const char* path); | |||||
| lilv_state_new_from_file(LilvWorld* world, | |||||
| LV2_URID_Map* map, | |||||
| const LilvNode* subject, | |||||
| const char* path); | |||||
| /** | /** | ||||
| Load a state snapshot from a string made by lilv_state_to_string(). | Load a state snapshot from a string made by lilv_state_to_string(). | ||||
| */ | */ | ||||
| LILV_API LilvState* | LILV_API LilvState* | ||||
| lilv_state_new_from_string(LilvWorld* world, | |||||
| const LV2_URID_Map* map, | |||||
| const char* str); | |||||
| lilv_state_new_from_string(LilvWorld* world, | |||||
| LV2_URID_Map* map, | |||||
| const char* str); | |||||
| /** | /** | ||||
| Function to get a port value. | Function to get a port value. | ||||
| @@ -1426,8 +1435,7 @@ lilv_state_emit_port_values(const LilvState* state, | |||||
| */ | */ | ||||
| LILV_API void | LILV_API void | ||||
| lilv_state_restore(const LilvState* state, | lilv_state_restore(const LilvState* state, | ||||
| const LV2_State_Interface* iface, | |||||
| LV2_Handle handle, | |||||
| LilvInstance* instance, | |||||
| LilvSetPortValueFunc set_value, | LilvSetPortValueFunc set_value, | ||||
| void* user_data, | void* user_data, | ||||
| uint32_t flags, | uint32_t flags, | ||||
| @@ -1787,42 +1795,6 @@ lilv_ui_get_bundle_uri(const LilvUI* ui); | |||||
| LILV_API const LilvNode* | LILV_API const LilvNode* | ||||
| lilv_ui_get_binary_uri(const LilvUI* ui); | lilv_ui_get_binary_uri(const LilvUI* ui); | ||||
| /** | |||||
| Custom calls | |||||
| */ | |||||
| LILV_API LilvNode* | |||||
| lilv_plugin_get_modgui_resources_directory(const LilvPlugin* plugin); | |||||
| LILV_API LilvNode* | |||||
| lilv_plugin_get_modgui_stylesheet(const LilvPlugin* plugin); | |||||
| LILV_API LilvNode* | |||||
| lilv_plugin_get_modgui_icon_template(const LilvPlugin* plugin); | |||||
| LILV_API LilvNode* | |||||
| lilv_plugin_get_modgui_settings_template(const LilvPlugin* plugin); | |||||
| LILV_API LilvNode* | |||||
| lilv_plugin_get_modgui_template_data(const LilvPlugin* plugin); | |||||
| LILV_API LilvNode* | |||||
| lilv_plugin_get_modgui_screenshot(const LilvPlugin* plugin); | |||||
| LILV_API LilvNode* | |||||
| lilv_plugin_get_modgui_thumbnail(const LilvPlugin* plugin); | |||||
| LILV_API const LilvNodes* | |||||
| lilv_ui_get_supported_features(const LilvUI* ui); | |||||
| LILV_API const LilvNodes* | |||||
| lilv_ui_get_required_features(const LilvUI* ui); | |||||
| LILV_API const LilvNodes* | |||||
| lilv_ui_get_optional_features(const LilvUI* ui); | |||||
| LILV_API const LilvNodes* | |||||
| lilv_ui_get_extension_data(const LilvUI* ui); | |||||
| /** | /** | ||||
| @} | @} | ||||
| @} | @} | ||||
| @@ -17,8 +17,6 @@ | |||||
| #ifndef LILV_LILVMM_HPP | #ifndef LILV_LILVMM_HPP | ||||
| #define LILV_LILVMM_HPP | #define LILV_LILVMM_HPP | ||||
| #include "CarlaDefines.h" | |||||
| #include "lilv/lilv.h" | #include "lilv/lilv.h" | ||||
| #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) | #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) | ||||
| @@ -29,12 +27,14 @@ | |||||
| namespace Lilv { | namespace Lilv { | ||||
| static inline const char* | |||||
| uri_to_path(const char* uri) { | |||||
| return lilv_uri_to_path(uri); | |||||
| } | |||||
| #define LILV_WRAP0(RT, prefix, name) \ | #define LILV_WRAP0(RT, prefix, name) \ | ||||
| inline RT name() { return lilv_ ## prefix ## _ ## name (me); } | inline RT name() { return lilv_ ## prefix ## _ ## name (me); } | ||||
| #define LILV_WRAP0_CONST(RT, prefix, name) \ | |||||
| inline RT name() const { return lilv_ ## prefix ## _ ## name (me); } | |||||
| #define LILV_WRAP0_VOID(prefix, name) \ | #define LILV_WRAP0_VOID(prefix, name) \ | ||||
| inline void name() { lilv_ ## prefix ## _ ## name(me); } | inline void name() { lilv_ ## prefix ## _ ## name(me); } | ||||
| @@ -65,7 +65,6 @@ namespace Lilv { | |||||
| #endif | #endif | ||||
| struct Node { | struct Node { | ||||
| inline Node(LilvNode* node) : me(node) {} | |||||
| inline Node(const LilvNode* node) : me(lilv_node_duplicate(node)) {} | inline Node(const LilvNode* node) : me(lilv_node_duplicate(node)) {} | ||||
| inline Node(const Node& copy) : me(lilv_node_duplicate(copy.me)) {} | inline Node(const Node& copy) : me(lilv_node_duplicate(copy.me)) {} | ||||
| @@ -79,26 +78,20 @@ struct Node { | |||||
| LILV_WRAP_CONVERSION(LilvNode); | LILV_WRAP_CONVERSION(LilvNode); | ||||
| LILV_WRAP0_CONST(char*, node, get_turtle_token); | |||||
| LILV_WRAP0_CONST(bool, node, is_uri); | |||||
| LILV_WRAP0_CONST(const char*, node, as_uri); | |||||
| LILV_WRAP0_CONST(bool, node, is_blank); | |||||
| LILV_WRAP0_CONST(const char*, node, as_blank); | |||||
| LILV_WRAP0_CONST(bool, node, is_literal); | |||||
| LILV_WRAP0_CONST(bool, node, is_string); | |||||
| LILV_WRAP0_CONST(const char*, node, as_string); | |||||
| LILV_WRAP0_CONST(bool, node, is_float); | |||||
| LILV_WRAP0_CONST(float, node, as_float); | |||||
| LILV_WRAP0_CONST(bool, node, is_int); | |||||
| LILV_WRAP0_CONST(int, node, as_int); | |||||
| LILV_WRAP0_CONST(bool, node, is_bool); | |||||
| LILV_WRAP0_CONST(bool, node, as_bool); | |||||
| Node& operator=(const Node& copy) { | |||||
| lilv_node_free(me); | |||||
| me = lilv_node_duplicate(copy.me); | |||||
| return *this; | |||||
| } | |||||
| LILV_WRAP0(char*, node, get_turtle_token); | |||||
| LILV_WRAP0(bool, node, is_uri); | |||||
| LILV_WRAP0(const char*, node, as_uri); | |||||
| LILV_WRAP0(bool, node, is_blank); | |||||
| LILV_WRAP0(const char*, node, as_blank); | |||||
| LILV_WRAP0(bool, node, is_literal); | |||||
| LILV_WRAP0(bool, node, is_string); | |||||
| LILV_WRAP0(const char*, node, as_string); | |||||
| LILV_WRAP0(bool, node, is_float); | |||||
| LILV_WRAP0(float, node, as_float); | |||||
| LILV_WRAP0(bool, node, is_int); | |||||
| LILV_WRAP0(int, node, as_int); | |||||
| LILV_WRAP0(bool, node, is_bool); | |||||
| LILV_WRAP0(bool, node, as_bool); | |||||
| LilvNode* me; | LilvNode* me; | ||||
| }; | }; | ||||
| @@ -133,7 +126,7 @@ struct PluginClass { | |||||
| LILV_WRAP0(LilvIter*, prefix, begin); \ | LILV_WRAP0(LilvIter*, prefix, begin); \ | ||||
| LILV_WRAP1(LilvIter*, prefix, next, LilvIter*, i); \ | LILV_WRAP1(LilvIter*, prefix, next, LilvIter*, i); \ | ||||
| LILV_WRAP1(bool, prefix, is_end, LilvIter*, i); \ | LILV_WRAP1(bool, prefix, is_end, LilvIter*, i); \ | ||||
| const Lilv ## CT* me | |||||
| const Lilv ## CT* me; \ | |||||
| struct PluginClasses { | struct PluginClasses { | ||||
| LILV_WRAP_COLL(PluginClasses, PluginClass, plugin_classes); | LILV_WRAP_COLL(PluginClasses, PluginClass, plugin_classes); | ||||
| @@ -148,24 +141,22 @@ struct ScalePoints { | |||||
| struct Nodes { | struct Nodes { | ||||
| LILV_WRAP_COLL(Nodes, Node, nodes); | LILV_WRAP_COLL(Nodes, Node, nodes); | ||||
| LILV_WRAP1(bool, nodes, contains, const Node, node); | LILV_WRAP1(bool, nodes, contains, const Node, node); | ||||
| inline Node get_first() const { | |||||
| return Node((const LilvNode*)lilv_nodes_get_first(me)); | |||||
| } | |||||
| LILV_WRAP0(Node, nodes, get_first); | |||||
| }; | }; | ||||
| struct UI { | struct UI { | ||||
| inline UI(const LilvUI* c_obj) : me(c_obj) {} | inline UI(const LilvUI* c_obj) : me(c_obj) {} | ||||
| LILV_WRAP_CONVERSION(const LilvUI); | LILV_WRAP_CONVERSION(const LilvUI); | ||||
| LILV_WRAP0(Node, ui, get_uri); | |||||
| LILV_WRAP1(bool, ui, is_a, LilvNode*, ui_class); | |||||
| LILV_WRAP0(Node, ui, get_bundle_uri); | |||||
| LILV_WRAP0(Node, ui, get_binary_uri); | |||||
| LILV_WRAP0(Nodes, ui, get_supported_features); | |||||
| LILV_WRAP0(Nodes, ui, get_required_features); | |||||
| LILV_WRAP0(Nodes, ui, get_optional_features); | |||||
| LILV_WRAP0(Nodes, ui, get_extension_data); | |||||
| LILV_WRAP0(const LilvNode*, ui, get_uri); | |||||
| LILV_WRAP0(const LilvNode*, ui, get_bundle_uri); | |||||
| LILV_WRAP0(const LilvNode*, ui, get_binary_uri); | |||||
| LILV_WRAP0(const LilvNodes*, ui, get_classes); | |||||
| /*LILV_WRAP3(bool, ui, is_supported, | |||||
| LilvUISupportedFunc, supported_func, | |||||
| const LilvNode*, container_type, | |||||
| const LilvNode**, ui_type);*/ | |||||
| LILV_WRAP1(bool, ui, is_a, const LilvNode*, class_uri); | |||||
| const LilvUI* me; | const LilvUI* me; | ||||
| }; | }; | ||||
| @@ -229,13 +220,6 @@ struct Plugin { | |||||
| LILV_WRAP0(Nodes, plugin, get_extension_data); | LILV_WRAP0(Nodes, plugin, get_extension_data); | ||||
| LILV_WRAP0(UIs, plugin, get_uis); | LILV_WRAP0(UIs, plugin, get_uis); | ||||
| LILV_WRAP1(Nodes, plugin, get_related, Node, type); | LILV_WRAP1(Nodes, plugin, get_related, Node, type); | ||||
| LILV_WRAP0(Node, plugin, get_modgui_resources_directory); | |||||
| LILV_WRAP0(Node, plugin, get_modgui_stylesheet); | |||||
| LILV_WRAP0(Node, plugin, get_modgui_icon_template); | |||||
| LILV_WRAP0(Node, plugin, get_modgui_settings_template); | |||||
| LILV_WRAP0(Node, plugin, get_modgui_template_data); | |||||
| LILV_WRAP0(Node, plugin, get_modgui_screenshot); | |||||
| LILV_WRAP0(Node, plugin, get_modgui_thumbnail); | |||||
| inline Port get_port_by_index(unsigned index) { | inline Port get_port_by_index(unsigned index) { | ||||
| return Port(me, lilv_plugin_get_port_by_index(me, index)); | return Port(me, lilv_plugin_get_port_by_index(me, index)); | ||||
| @@ -275,13 +259,15 @@ struct Instance { | |||||
| inline Instance(LilvInstance* instance) : me(instance) {} | inline Instance(LilvInstance* instance) : me(instance) {} | ||||
| LILV_DEPRECATED | LILV_DEPRECATED | ||||
| inline Instance(Plugin plugin, double sample_rate) | |||||
| : me(lilv_plugin_instantiate(plugin, sample_rate, NULL)) {} | |||||
| inline Instance(Plugin plugin, double sample_rate) { | |||||
| me = lilv_plugin_instantiate(plugin, sample_rate, NULL); | |||||
| } | |||||
| LILV_DEPRECATED inline Instance(Plugin plugin, | LILV_DEPRECATED inline Instance(Plugin plugin, | ||||
| double sample_rate, | double sample_rate, | ||||
| LV2_Feature* const* features) | |||||
| : me(lilv_plugin_instantiate(plugin, sample_rate, features)) {} | |||||
| LV2_Feature* const* features) { | |||||
| me = lilv_plugin_instantiate(plugin, sample_rate, features); | |||||
| } | |||||
| static inline Instance* create(Plugin plugin, | static inline Instance* create(Plugin plugin, | ||||
| double sample_rate, | double sample_rate, | ||||
| @@ -318,25 +304,22 @@ struct Instance { | |||||
| }; | }; | ||||
| struct World { | struct World { | ||||
| inline World() : me(lilv_world_new()) {} | |||||
| inline virtual ~World() { lilv_world_free(me); } | |||||
| inline World() : me(lilv_world_new()) {} | |||||
| inline ~World() { lilv_world_free(me); } | |||||
| inline LilvNode* new_uri(const char* uri) const { | |||||
| inline LilvNode* new_uri(const char* uri) { | |||||
| return lilv_new_uri(me, uri); | return lilv_new_uri(me, uri); | ||||
| } | } | ||||
| inline LilvNode* new_file_uri(const char* host, const char* path) const { | |||||
| return lilv_new_file_uri(me, host, path); | |||||
| } | |||||
| inline LilvNode* new_string(const char* str) const { | |||||
| inline LilvNode* new_string(const char* str) { | |||||
| return lilv_new_string(me, str); | return lilv_new_string(me, str); | ||||
| } | } | ||||
| inline LilvNode* new_int(int val) const { | |||||
| inline LilvNode* new_int(int val) { | |||||
| return lilv_new_int(me, val); | return lilv_new_int(me, val); | ||||
| } | } | ||||
| inline LilvNode* new_float(float val) const { | |||||
| inline LilvNode* new_float(float val) { | |||||
| return lilv_new_float(me, val); | return lilv_new_float(me, val); | ||||
| } | } | ||||
| inline LilvNode* new_bool(bool val) const { | |||||
| inline LilvNode* new_bool(bool val) { | |||||
| return lilv_new_bool(me, val); | return lilv_new_bool(me, val); | ||||
| } | } | ||||
| inline Nodes find_nodes(const LilvNode* subject, | inline Nodes find_nodes(const LilvNode* subject, | ||||
| @@ -346,7 +329,7 @@ struct World { | |||||
| } | } | ||||
| LILV_WRAP2_VOID(world, set_option, const char*, uri, LilvNode*, value); | LILV_WRAP2_VOID(world, set_option, const char*, uri, LilvNode*, value); | ||||
| LILV_WRAP1_VOID(world, load_all, const char*, lv2_path); | |||||
| LILV_WRAP0_VOID(world, load_all); | |||||
| LILV_WRAP1_VOID(world, load_bundle, LilvNode*, bundle_uri); | LILV_WRAP1_VOID(world, load_bundle, LilvNode*, bundle_uri); | ||||
| LILV_WRAP0(const LilvPluginClass*, world, get_plugin_class); | LILV_WRAP0(const LilvPluginClass*, world, get_plugin_class); | ||||
| LILV_WRAP0(const LilvPluginClasses*, world, get_plugin_classes); | LILV_WRAP0(const LilvPluginClasses*, world, get_plugin_classes); | ||||
| @@ -354,8 +337,6 @@ struct World { | |||||
| LILV_WRAP1(int, world, load_resource, const LilvNode*, resource); | LILV_WRAP1(int, world, load_resource, const LilvNode*, resource); | ||||
| LilvWorld* me; | LilvWorld* me; | ||||
| CARLA_DECLARE_NON_COPY_STRUCT(World) | |||||
| }; | }; | ||||
| } /* namespace Lilv */ | } /* namespace Lilv */ | ||||
| @@ -1,5 +1,5 @@ | |||||
| /* | /* | ||||
| Copyright 2007-2014 David Robillard <http://drobilla.net> | |||||
| Copyright 2007-2015 David Robillard <http://drobilla.net> | |||||
| Permission to use, copy, modify, and/or distribute this software for any | Permission to use, copy, modify, and/or distribute this software for any | ||||
| purpose with or without fee is hereby granted, provided that the above | purpose with or without fee is hereby granted, provided that the above | ||||
| @@ -14,7 +14,6 @@ | |||||
| OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||||
| */ | */ | ||||
| #include <assert.h> | |||||
| #include <stdio.h> | #include <stdio.h> | ||||
| #include <stdlib.h> | #include <stdlib.h> | ||||
| #include <string.h> | #include <string.h> | ||||
| @@ -38,7 +37,7 @@ lilv_plugin_instantiate(const LilvPlugin* plugin, | |||||
| LilvLib* lib = lilv_lib_open(plugin->world, lib_uri, bundle_path, features); | LilvLib* lib = lilv_lib_open(plugin->world, lib_uri, bundle_path, features); | ||||
| if (!lib) { | if (!lib) { | ||||
| free(bundle_path); | |||||
| lilv_free(bundle_path); | |||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| @@ -47,7 +46,7 @@ lilv_plugin_instantiate(const LilvPlugin* plugin, | |||||
| SerdURI base_uri; | SerdURI base_uri; | ||||
| if (serd_uri_parse((const uint8_t*)bundle_uri_str, &base_uri)) { | if (serd_uri_parse((const uint8_t*)bundle_uri_str, &base_uri)) { | ||||
| lilv_lib_close(lib); | lilv_lib_close(lib); | ||||
| free(bundle_path); | |||||
| lilv_free(bundle_path); | |||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| @@ -95,7 +94,7 @@ lilv_plugin_instantiate(const LilvPlugin* plugin, | |||||
| } | } | ||||
| free(local_features); | free(local_features); | ||||
| free(bundle_path); | |||||
| lilv_free(bundle_path); | |||||
| if (result) { | if (result) { | ||||
| // Failed to instantiate | // Failed to instantiate | ||||
| @@ -42,7 +42,7 @@ lilv_lib_open(LilvWorld* world, | |||||
| void* lib = dlopen(lib_path, RTLD_NOW); | void* lib = dlopen(lib_path, RTLD_NOW); | ||||
| if (!lib) { | if (!lib) { | ||||
| LILV_ERRORF("Failed to open library %s (%s)\n", lib_path, dlerror()); | LILV_ERRORF("Failed to open library %s (%s)\n", lib_path, dlerror()); | ||||
| free(lib_path); | |||||
| lilv_free(lib_path); | |||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| @@ -57,17 +57,17 @@ lilv_lib_open(LilvWorld* world, | |||||
| desc = ldf(bundle_path, features); | desc = ldf(bundle_path, features); | ||||
| if (!desc) { | if (!desc) { | ||||
| LILV_ERRORF("Call to `lv2_lib_descriptor' in %s failed\n", lib_path); | LILV_ERRORF("Call to `lv2_lib_descriptor' in %s failed\n", lib_path); | ||||
| free(lib_path); | |||||
| lilv_free(lib_path); | |||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| } else if (!df) { | } else if (!df) { | ||||
| LILV_ERRORF("No `lv2_descriptor' or `lv2_lib_descriptor' in %s\n", | LILV_ERRORF("No `lv2_descriptor' or `lv2_lib_descriptor' in %s\n", | ||||
| lib_path); | lib_path); | ||||
| dlclose(lib); | dlclose(lib); | ||||
| free(lib_path); | |||||
| lilv_free(lib_path); | |||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| free(lib_path); | |||||
| lilv_free(lib_path); | |||||
| LilvLib* llib = (LilvLib*)malloc(sizeof(LilvLib)); | LilvLib* llib = (LilvLib*)malloc(sizeof(LilvLib)); | ||||
| llib->world = world; | llib->world = world; | ||||
| @@ -28,16 +28,21 @@ extern "C" { | |||||
| #ifdef _WIN32 | #ifdef _WIN32 | ||||
| # include <windows.h> | # include <windows.h> | ||||
| # include <direct.h> | |||||
| # define dlopen(path, flags) LoadLibrary(path) | # define dlopen(path, flags) LoadLibrary(path) | ||||
| # define dlclose(lib) FreeLibrary((HMODULE)lib) | # define dlclose(lib) FreeLibrary((HMODULE)lib) | ||||
| # define unlink(path) _unlink(path) | # define unlink(path) _unlink(path) | ||||
| # define rmdir(path) _rmdir(path) | # define rmdir(path) _rmdir(path) | ||||
| # ifdef _MSC_VER | # ifdef _MSC_VER | ||||
| # define __func__ __FUNCTION__ | # define __func__ __FUNCTION__ | ||||
| # define INFINITY DBL_MAX + DBL_MAX | |||||
| # define NAN INFINITY - INFINITY | |||||
| # define snprintf _snprintf | # define snprintf _snprintf | ||||
| # endif | # endif | ||||
| #ifndef INFINITY | |||||
| # define INFINITY DBL_MAX + DBL_MAX | |||||
| #endif | |||||
| #ifndef NAN | |||||
| # define NAN INFINITY - INFINITY | |||||
| #endif | |||||
| static inline char* dlerror(void) { return "Unknown error"; } | static inline char* dlerror(void) { return "Unknown error"; } | ||||
| #else | #else | ||||
| # include <dlfcn.h> | # include <dlfcn.h> | ||||
| @@ -53,7 +58,7 @@ static inline char* dlerror(void) { return "Unknown error"; } | |||||
| #include "lilv/lilv.h" | #include "lilv/lilv.h" | ||||
| #ifdef LILV_DYN_MANIFEST | #ifdef LILV_DYN_MANIFEST | ||||
| # include "lv2/dynmanifest.h" | |||||
| # include "lv2/lv2plug.in/ns/ext/dynmanifest/dynmanifest.h" | |||||
| #endif | #endif | ||||
| /* | /* | ||||
| @@ -1,5 +1,5 @@ | |||||
| /* | /* | ||||
| Copyright 2007-2014 David Robillard <http://drobilla.net> | |||||
| Copyright 2007-2015 David Robillard <http://drobilla.net> | |||||
| Permission to use, copy, modify, and/or distribute this software for any | Permission to use, copy, modify, and/or distribute this software for any | ||||
| purpose with or without fee is hereby granted, provided that the above | purpose with or without fee is hereby granted, provided that the above | ||||
| @@ -14,7 +14,7 @@ | |||||
| OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||||
| */ | */ | ||||
| #include <assert.h> | |||||
| #include <math.h> | |||||
| #include <stdlib.h> | #include <stdlib.h> | ||||
| #include <string.h> | #include <string.h> | ||||
| @@ -140,8 +140,6 @@ lilv_node_new_from_node(LilvWorld* world, const SordNode* node) | |||||
| world, type, (const char*)sord_node_get_string_counted(node, &len)); | world, type, (const char*)sord_node_get_string_counted(node, &len)); | ||||
| lilv_node_set_numerics_from_string(result, len); | lilv_node_set_numerics_from_string(result, len); | ||||
| break; | break; | ||||
| default: | |||||
| assert(false); | |||||
| } | } | ||||
| return result; | return result; | ||||
| @@ -327,6 +325,7 @@ lilv_node_is_literal(const LilvNode* value) | |||||
| case LILV_VALUE_STRING: | case LILV_VALUE_STRING: | ||||
| case LILV_VALUE_INT: | case LILV_VALUE_INT: | ||||
| case LILV_VALUE_FLOAT: | case LILV_VALUE_FLOAT: | ||||
| case LILV_VALUE_BLOB: | |||||
| return true; | return true; | ||||
| default: | default: | ||||
| return false; | return false; | ||||
| @@ -366,12 +365,12 @@ lilv_node_is_float(const LilvNode* value) | |||||
| LILV_API float | LILV_API float | ||||
| lilv_node_as_float(const LilvNode* value) | lilv_node_as_float(const LilvNode* value) | ||||
| { | { | ||||
| assert(lilv_node_is_float(value) || lilv_node_is_int(value)); | |||||
| if (lilv_node_is_float(value)) { | if (lilv_node_is_float(value)) { | ||||
| return value->val.float_val; | return value->val.float_val; | ||||
| } else { // lilv_node_is_int(value) | |||||
| } else if (lilv_node_is_int(value)) { | |||||
| return (float)value->val.int_val; | return (float)value->val.int_val; | ||||
| } | } | ||||
| return NAN; | |||||
| } | } | ||||
| LILV_API bool | LILV_API bool | ||||
| @@ -27,11 +27,10 @@ | |||||
| #include "lilv_config.h" | #include "lilv_config.h" | ||||
| #include "lilv_internal.h" | #include "lilv_internal.h" | ||||
| #include "lv2/ui.h" | |||||
| #include "lv2/lv2plug.in/ns/extensions/ui/ui.h" | |||||
| #define NS_DOAP (const uint8_t*)"http://usefulinc.com/ns/doap#" | #define NS_DOAP (const uint8_t*)"http://usefulinc.com/ns/doap#" | ||||
| #define NS_FOAF (const uint8_t*)"http://xmlns.com/foaf/0.1/" | #define NS_FOAF (const uint8_t*)"http://xmlns.com/foaf/0.1/" | ||||
| #define NS_MOD (const uint8_t*)"http://moddevices.com/ns/modgui#" | |||||
| /** Ownership of `uri` is taken */ | /** Ownership of `uri` is taken */ | ||||
| LilvPlugin* | LilvPlugin* | ||||
| @@ -909,131 +908,6 @@ lilv_plugin_get_author_homepage(const LilvPlugin* plugin) | |||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| static const SordNode* | |||||
| lilv_plugin_get_modgui(const LilvPlugin* p) | |||||
| { | |||||
| lilv_plugin_load_if_necessary(p); | |||||
| SordNode* mod_gui = sord_new_uri( | |||||
| p->world->world, NS_MOD "gui"); | |||||
| SordIter* gui = lilv_world_query_internal( | |||||
| p->world, | |||||
| p->plugin_uri->node, | |||||
| mod_gui, | |||||
| NULL); | |||||
| sord_node_free(p->world->world, mod_gui); | |||||
| if (sord_iter_end(gui)) { | |||||
| sord_iter_free(gui); | |||||
| return NULL; | |||||
| } | |||||
| const SordNode* Gui = sord_iter_get_node(gui, SORD_OBJECT); | |||||
| sord_iter_free(gui); | |||||
| return Gui; | |||||
| } | |||||
| LILV_API LilvNode* | |||||
| lilv_plugin_get_modgui_resources_directory(const LilvPlugin* plugin) | |||||
| { | |||||
| const SordNode* modgui = lilv_plugin_get_modgui(plugin); | |||||
| if (modgui) { | |||||
| SordWorld* sworld = plugin->world->world; | |||||
| SordNode* modgui_res = sord_new_uri(sworld, NS_MOD "resourcesDirectory"); | |||||
| LilvNode* ret = lilv_plugin_get_one(plugin, modgui, modgui_res); | |||||
| sord_node_free(sworld, modgui_res); | |||||
| return ret; | |||||
| } | |||||
| return NULL; | |||||
| } | |||||
| LILV_API LilvNode* | |||||
| lilv_plugin_get_modgui_stylesheet(const LilvPlugin* plugin) | |||||
| { | |||||
| const SordNode* modgui = lilv_plugin_get_modgui(plugin); | |||||
| if (modgui) { | |||||
| SordWorld* sworld = plugin->world->world; | |||||
| SordNode* modgui_style = sord_new_uri(sworld, NS_MOD "stylesheet"); | |||||
| LilvNode* ret = lilv_plugin_get_one(plugin, modgui, modgui_style); | |||||
| sord_node_free(sworld, modgui_style); | |||||
| return ret; | |||||
| } | |||||
| return NULL; | |||||
| } | |||||
| LILV_API LilvNode* | |||||
| lilv_plugin_get_modgui_icon_template(const LilvPlugin* plugin) | |||||
| { | |||||
| const SordNode* modgui = lilv_plugin_get_modgui(plugin); | |||||
| if (modgui) { | |||||
| SordWorld* sworld = plugin->world->world; | |||||
| SordNode* modgui_tmpl = sord_new_uri(sworld, NS_MOD "iconTemplate"); | |||||
| LilvNode* ret = lilv_plugin_get_one(plugin, modgui, modgui_tmpl); | |||||
| sord_node_free(sworld, modgui_tmpl); | |||||
| return ret; | |||||
| } | |||||
| return NULL; | |||||
| } | |||||
| LILV_API LilvNode* | |||||
| lilv_plugin_get_modgui_settings_template(const LilvPlugin* plugin) | |||||
| { | |||||
| const SordNode* modgui = lilv_plugin_get_modgui(plugin); | |||||
| if (modgui) { | |||||
| SordWorld* sworld = plugin->world->world; | |||||
| SordNode* modgui_tmpl = sord_new_uri(sworld, NS_MOD "settingsTemplate"); | |||||
| LilvNode* ret = lilv_plugin_get_one(plugin, modgui, modgui_tmpl); | |||||
| sord_node_free(sworld, modgui_tmpl); | |||||
| return ret; | |||||
| } | |||||
| return NULL; | |||||
| } | |||||
| LILV_API LilvNode* | |||||
| lilv_plugin_get_modgui_template_data(const LilvPlugin* plugin) | |||||
| { | |||||
| const SordNode* modgui = lilv_plugin_get_modgui(plugin); | |||||
| if (modgui) { | |||||
| SordWorld* sworld = plugin->world->world; | |||||
| SordNode* modgui_tmpl = sord_new_uri(sworld, NS_MOD "templateData"); | |||||
| LilvNode* ret = lilv_plugin_get_one(plugin, modgui, modgui_tmpl); | |||||
| sord_node_free(sworld, modgui_tmpl); | |||||
| return ret; | |||||
| } | |||||
| return NULL; | |||||
| } | |||||
| LILV_API LilvNode* | |||||
| lilv_plugin_get_modgui_screenshot(const LilvPlugin* plugin) | |||||
| { | |||||
| const SordNode* modgui = lilv_plugin_get_modgui(plugin); | |||||
| if (modgui) { | |||||
| SordWorld* sworld = plugin->world->world; | |||||
| SordNode* modgui_scr = sord_new_uri(sworld, NS_MOD "screenshot"); | |||||
| LilvNode* ret = lilv_plugin_get_one(plugin, modgui, modgui_scr); | |||||
| sord_node_free(sworld, modgui_scr); | |||||
| return ret; | |||||
| } | |||||
| return NULL; | |||||
| } | |||||
| LILV_API LilvNode* | |||||
| lilv_plugin_get_modgui_thumbnail(const LilvPlugin* plugin) | |||||
| { | |||||
| const SordNode* modgui = lilv_plugin_get_modgui(plugin); | |||||
| if (modgui) { | |||||
| SordWorld* sworld = plugin->world->world; | |||||
| SordNode* modgui_thumb = sord_new_uri(sworld, NS_MOD "thumbnail"); | |||||
| LilvNode* ret = lilv_plugin_get_one(plugin, modgui, modgui_thumb); | |||||
| sord_node_free(sworld, modgui_thumb); | |||||
| return ret; | |||||
| } | |||||
| return NULL; | |||||
| } | |||||
| LILV_API bool | LILV_API bool | ||||
| lilv_plugin_is_replaced(const LilvPlugin* plugin) | lilv_plugin_is_replaced(const LilvPlugin* plugin) | ||||
| { | { | ||||
| @@ -1,5 +1,5 @@ | |||||
| /* | /* | ||||
| Copyright 2007-2014 David Robillard <http://drobilla.net> | |||||
| Copyright 2007-2015 David Robillard <http://drobilla.net> | |||||
| Permission to use, copy, modify, and/or distribute this software for any | Permission to use, copy, modify, and/or distribute this software for any | ||||
| purpose with or without fee is hereby granted, provided that the above | purpose with or without fee is hereby granted, provided that the above | ||||
| @@ -14,7 +14,6 @@ | |||||
| OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||||
| */ | */ | ||||
| #include <assert.h> | |||||
| #include <stdlib.h> | #include <stdlib.h> | ||||
| #include <string.h> | #include <string.h> | ||||
| @@ -26,9 +25,6 @@ lilv_plugin_class_new(LilvWorld* world, | |||||
| const SordNode* uri, | const SordNode* uri, | ||||
| const char* label) | const char* label) | ||||
| { | { | ||||
| if (parent_node && sord_node_get_type(parent_node) != SORD_URI) { | |||||
| return NULL; // Not an LV2 plugin superclass (FIXME: discover properly) | |||||
| } | |||||
| LilvPluginClass* pc = (LilvPluginClass*)malloc(sizeof(LilvPluginClass)); | LilvPluginClass* pc = (LilvPluginClass*)malloc(sizeof(LilvPluginClass)); | ||||
| pc->world = world; | pc->world = world; | ||||
| pc->uri = lilv_node_new_from_node(world, uri); | pc->uri = lilv_node_new_from_node(world, uri); | ||||
| @@ -42,7 +38,10 @@ lilv_plugin_class_new(LilvWorld* world, | |||||
| void | void | ||||
| lilv_plugin_class_free(LilvPluginClass* plugin_class) | lilv_plugin_class_free(LilvPluginClass* plugin_class) | ||||
| { | { | ||||
| assert(plugin_class->uri); | |||||
| if (!plugin_class) { | |||||
| return; | |||||
| } | |||||
| lilv_node_free(plugin_class->uri); | lilv_node_free(plugin_class->uri); | ||||
| lilv_node_free(plugin_class->parent_uri); | lilv_node_free(plugin_class->parent_uri); | ||||
| lilv_node_free(plugin_class->label); | lilv_node_free(plugin_class->label); | ||||
| @@ -20,8 +20,8 @@ | |||||
| #include <stdlib.h> | #include <stdlib.h> | ||||
| #include <string.h> | #include <string.h> | ||||
| #include "lv2/atom.h" | |||||
| #include "lv2/event.h" | |||||
| #include "lv2/lv2plug.in/ns/ext/atom/atom.h" | |||||
| #include "lv2/lv2plug.in/ns/ext/event/event.h" | |||||
| #include "lilv_internal.h" | #include "lilv_internal.h" | ||||
| @@ -1,5 +1,5 @@ | |||||
| /* | /* | ||||
| Copyright 2007-2014 David Robillard <http://drobilla.net> | |||||
| Copyright 2007-2015 David Robillard <http://drobilla.net> | |||||
| Permission to use, copy, modify, and/or distribute this software for any | Permission to use, copy, modify, and/or distribute this software for any | ||||
| purpose with or without fee is hereby granted, provided that the above | purpose with or without fee is hereby granted, provided that the above | ||||
| @@ -14,7 +14,6 @@ | |||||
| OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||||
| */ | */ | ||||
| #include <assert.h> | |||||
| #include <limits.h> | #include <limits.h> | ||||
| #include <stdlib.h> | #include <stdlib.h> | ||||
| #include <string.h> | #include <string.h> | ||||
| @@ -1,5 +1,5 @@ | |||||
| /* | /* | ||||
| Copyright 2007-2014 David Robillard <http://drobilla.net> | |||||
| Copyright 2007-2015 David Robillard <http://drobilla.net> | |||||
| Permission to use, copy, modify, and/or distribute this software for any | Permission to use, copy, modify, and/or distribute this software for any | ||||
| purpose with or without fee is hereby granted, provided that the above | purpose with or without fee is hereby granted, provided that the above | ||||
| @@ -18,10 +18,10 @@ | |||||
| #include <stdio.h> | #include <stdio.h> | ||||
| #include <string.h> | #include <string.h> | ||||
| #include "lv2/atom.h" | |||||
| #include "lv2/atom-forge.h" | |||||
| #include "lv2/presets.h" | |||||
| #include "lv2/state.h" | |||||
| #include "lv2/lv2plug.in/ns/ext/atom/atom.h" | |||||
| #include "lv2/lv2plug.in/ns/ext/atom/forge.h" | |||||
| #include "lv2/lv2plug.in/ns/ext/presets/presets.h" | |||||
| #include "lv2/lv2plug.in/ns/ext/state/state.h" | |||||
| #include "lilv_config.h" | #include "lilv_config.h" | ||||
| #include "lilv_internal.h" | #include "lilv_internal.h" | ||||
| @@ -231,7 +231,11 @@ abstract_path(LV2_State_Map_Path_Handle handle, | |||||
| if (!copy || !lilv_file_equals(real_path, copy)) { | if (!copy || !lilv_file_equals(real_path, copy)) { | ||||
| // No recent enough copy, make a new one | // No recent enough copy, make a new one | ||||
| copy = lilv_find_free_path(cpath, lilv_path_exists, NULL); | copy = lilv_find_free_path(cpath, lilv_path_exists, NULL); | ||||
| lilv_copy_file(real_path, copy); | |||||
| const int st = lilv_copy_file(real_path, copy); | |||||
| if (st) { | |||||
| LILV_ERRORF("Error copying state file %s (%s)\n", | |||||
| copy, strerror(st)); | |||||
| } | |||||
| } | } | ||||
| free(real_path); | free(real_path); | ||||
| free(cpath); | free(cpath); | ||||
| @@ -411,18 +415,35 @@ lilv_state_emit_port_values(const LilvState* state, | |||||
| LILV_API void | LILV_API void | ||||
| lilv_state_restore(const LilvState* state, | lilv_state_restore(const LilvState* state, | ||||
| const LV2_State_Interface* iface, | |||||
| LV2_Handle handle, | |||||
| LilvInstance* instance, | |||||
| LilvSetPortValueFunc set_value, | LilvSetPortValueFunc set_value, | ||||
| void* user_data, | void* user_data, | ||||
| uint32_t flags, | uint32_t flags, | ||||
| const LV2_Feature *const * features) | const LV2_Feature *const * features) | ||||
| { | { | ||||
| if (!state) { | |||||
| LILV_ERROR("lilv_state_restore() called on NULL state\n"); | |||||
| return; | |||||
| } | |||||
| LV2_State_Map_Path map_path = { | |||||
| (LilvState*)state, abstract_path, absolute_path }; | |||||
| LV2_Feature map_feature = { LV2_STATE__mapPath, &map_path }; | |||||
| const LV2_Feature** sfeatures = add_features(features, &map_feature, NULL); | |||||
| const LV2_Descriptor* desc = instance ? instance->lv2_descriptor : NULL; | |||||
| const LV2_State_Interface* iface = (desc && desc->extension_data) | |||||
| ? (const LV2_State_Interface*)desc->extension_data(LV2_STATE__interface) | |||||
| : NULL; | |||||
| if (iface) { | if (iface) { | ||||
| iface->restore(handle, retrieve_callback, | |||||
| (LV2_State_Handle)state, flags, features); | |||||
| iface->restore(instance->lv2_handle, retrieve_callback, | |||||
| (LV2_State_Handle)state, flags, sfeatures); | |||||
| } | } | ||||
| free(sfeatures); | |||||
| if (set_value) { | if (set_value) { | ||||
| lilv_state_emit_port_values(state, set_value, user_data); | lilv_state_emit_port_values(state, set_value, user_data); | ||||
| } | } | ||||
| @@ -569,9 +590,9 @@ new_state_from_model(LilvWorld* world, | |||||
| } | } | ||||
| LILV_API LilvState* | LILV_API LilvState* | ||||
| lilv_state_new_from_world(LilvWorld* world, | |||||
| const LV2_URID_Map* map, | |||||
| const LilvNode* node) | |||||
| lilv_state_new_from_world(LilvWorld* world, | |||||
| LV2_URID_Map* map, | |||||
| const LilvNode* node) | |||||
| { | { | ||||
| if (!lilv_node_is_uri(node) && !lilv_node_is_blank(node)) { | if (!lilv_node_is_uri(node) && !lilv_node_is_blank(node)) { | ||||
| LILV_ERRORF("Subject `%s' is not a URI or blank node.\n", | LILV_ERRORF("Subject `%s' is not a URI or blank node.\n", | ||||
| @@ -583,10 +604,10 @@ lilv_state_new_from_world(LilvWorld* world, | |||||
| } | } | ||||
| LILV_API LilvState* | LILV_API LilvState* | ||||
| lilv_state_new_from_file(LilvWorld* world, | |||||
| const LV2_URID_Map* map, | |||||
| const LilvNode* subject, | |||||
| const char* path) | |||||
| lilv_state_new_from_file(LilvWorld* world, | |||||
| LV2_URID_Map* map, | |||||
| const LilvNode* subject, | |||||
| const char* path) | |||||
| { | { | ||||
| if (subject && !lilv_node_is_uri(subject) | if (subject && !lilv_node_is_uri(subject) | ||||
| && !lilv_node_is_blank(subject)) { | && !lilv_node_is_blank(subject)) { | ||||
| @@ -636,9 +657,9 @@ set_prefixes(SerdEnv* env) | |||||
| } | } | ||||
| LILV_API LilvState* | LILV_API LilvState* | ||||
| lilv_state_new_from_string(LilvWorld* world, | |||||
| const LV2_URID_Map* map, | |||||
| const char* str) | |||||
| lilv_state_new_from_string(LilvWorld* world, | |||||
| LV2_URID_Map* map, | |||||
| const char* str) | |||||
| { | { | ||||
| if (!str) { | if (!str) { | ||||
| return NULL; | return NULL; | ||||
| @@ -1100,7 +1121,7 @@ lilv_state_delete(LilvWorld* world, | |||||
| if (unlink(file_path)) { | if (unlink(file_path)) { | ||||
| LILV_ERRORF("Failed to remove %s (%s)\n", file_path, strerror(errno)); | LILV_ERRORF("Failed to remove %s (%s)\n", file_path, strerror(errno)); | ||||
| } | } | ||||
| free(file_path); | |||||
| lilv_free(file_path); | |||||
| } | } | ||||
| // Remove any existing manifest entries for this state | // Remove any existing manifest entries for this state | ||||
| @@ -1123,14 +1144,14 @@ lilv_state_delete(LilvWorld* world, | |||||
| LILV_ERRORF("Failed to remove %s (%s)\n", | LILV_ERRORF("Failed to remove %s (%s)\n", | ||||
| dir_path, strerror(errno)); | dir_path, strerror(errno)); | ||||
| } | } | ||||
| free(dir_path); | |||||
| lilv_free(dir_path); | |||||
| } else { | } else { | ||||
| // Still something in the manifest, reload bundle | // Still something in the manifest, reload bundle | ||||
| lilv_world_load_bundle(world, bundle); | lilv_world_load_bundle(world, bundle); | ||||
| } | } | ||||
| sord_free(model); | sord_free(model); | ||||
| free(manifest_path); | |||||
| lilv_free(manifest_path); | |||||
| lilv_node_free(manifest); | lilv_node_free(manifest); | ||||
| lilv_node_free(bundle); | lilv_node_free(bundle); | ||||
| @@ -109,54 +109,3 @@ lilv_ui_get_binary_uri(const LilvUI* ui) | |||||
| { | { | ||||
| return ui->binary_uri; | return ui->binary_uri; | ||||
| } | } | ||||
| static LilvNodes* | |||||
| lilv_ui_get_value_internal(const LilvUI* ui, const SordNode* predicate) | |||||
| { | |||||
| assert(ui); | |||||
| return lilv_world_find_nodes_internal(ui->world, ui->uri->node, predicate, NULL); | |||||
| } | |||||
| LILV_API const LilvNodes* | |||||
| lilv_ui_get_supported_features(const LilvUI* ui) | |||||
| { | |||||
| assert(ui); | |||||
| LilvNodes* optional = lilv_ui_get_optional_features(ui); | |||||
| LilvNodes* required = lilv_ui_get_required_features(ui); | |||||
| LilvNodes* result = lilv_nodes_new(); | |||||
| LILV_FOREACH(nodes, i, optional) | |||||
| zix_tree_insert((ZixTree*)result, lilv_node_duplicate(lilv_nodes_get(optional, i)), NULL); | |||||
| LILV_FOREACH(nodes, i, required) | |||||
| zix_tree_insert((ZixTree*)result, lilv_node_duplicate(lilv_nodes_get(required, i)), NULL); | |||||
| lilv_nodes_free(optional); | |||||
| lilv_nodes_free(required); | |||||
| return result; | |||||
| } | |||||
| LILV_API const LilvNodes* | |||||
| lilv_ui_get_required_features(const LilvUI* ui) | |||||
| { | |||||
| assert(ui); | |||||
| assert(ui->world); | |||||
| return lilv_ui_get_value_internal(ui, ui->world->uris.lv2_requiredFeature); | |||||
| } | |||||
| LILV_API const LilvNodes* | |||||
| lilv_ui_get_optional_features(const LilvUI* ui) | |||||
| { | |||||
| assert(ui); | |||||
| assert(ui->world); | |||||
| return lilv_ui_get_value_internal(ui, ui->world->uris.lv2_optionalFeature); | |||||
| } | |||||
| LILV_API const LilvNodes* | |||||
| lilv_ui_get_extension_data(const LilvUI* ui) | |||||
| { | |||||
| assert(ui); | |||||
| assert(ui->world); | |||||
| return lilv_ui_get_value_internal(ui, ui->world->uris.lv2_extensionData); | |||||
| } | |||||
| @@ -1,5 +1,5 @@ | |||||
| /* | /* | ||||
| Copyright 2007-2014 David Robillard <http://drobilla.net> | |||||
| Copyright 2007-2015 David Robillard <http://drobilla.net> | |||||
| Permission to use, copy, modify, and/or distribute this software for any | Permission to use, copy, modify, and/or distribute this software for any | ||||
| purpose with or without fee is hereby granted, provided that the above | purpose with or without fee is hereby granted, provided that the above | ||||
| @@ -14,14 +14,13 @@ | |||||
| OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||||
| */ | */ | ||||
| #define _POSIX_C_SOURCE 1 /* for fileno */ | |||||
| #define _BSD_SOURCE 1 /* for realpath, symlink */ | |||||
| #define _POSIX_C_SOURCE 200809L /* for fileno */ | |||||
| #define _BSD_SOURCE 1 /* for realpath, symlink */ | |||||
| #ifdef __APPLE__ | #ifdef __APPLE__ | ||||
| # define _DARWIN_C_SOURCE 1 /* for flock */ | # define _DARWIN_C_SOURCE 1 /* for flock */ | ||||
| #endif | #endif | ||||
| #include <assert.h> | |||||
| #include <ctype.h> | #include <ctype.h> | ||||
| #include <errno.h> | #include <errno.h> | ||||
| #include <stdarg.h> | #include <stdarg.h> | ||||
| @@ -30,6 +29,7 @@ | |||||
| #include <string.h> | #include <string.h> | ||||
| #ifdef _WIN32 | #ifdef _WIN32 | ||||
| # define _WIN32_WINNT 0x0600 /* for CreateSymbolicLink */ | |||||
| # include <windows.h> | # include <windows.h> | ||||
| # include <direct.h> | # include <direct.h> | ||||
| # include <io.h> | # include <io.h> | ||||
| @@ -48,6 +48,7 @@ CreateSymbolicLink(LPCTSTR linkpath, LPCTSTR targetpath, DWORD flags) | |||||
| # endif /* _MSC_VER < 1500 */ | # endif /* _MSC_VER < 1500 */ | ||||
| #else | #else | ||||
| # include <dirent.h> | # include <dirent.h> | ||||
| # include <limits.h> | |||||
| # include <unistd.h> | # include <unistd.h> | ||||
| #endif | #endif | ||||
| @@ -64,6 +65,12 @@ CreateSymbolicLink(LPCTSTR linkpath, LPCTSTR targetpath, DWORD flags) | |||||
| # define PAGE_SIZE 4096 | # define PAGE_SIZE 4096 | ||||
| #endif | #endif | ||||
| void | |||||
| lilv_free(void* ptr) | |||||
| { | |||||
| free(ptr); | |||||
| } | |||||
| char* | char* | ||||
| lilv_strjoin(const char* first, ...) | lilv_strjoin(const char* first, ...) | ||||
| { | { | ||||
| @@ -83,7 +90,6 @@ lilv_strjoin(const char* first, ...) | |||||
| char* new_result = (char*)realloc(result, len + this_len + 1); | char* new_result = (char*)realloc(result, len + this_len + 1); | ||||
| if (!new_result) { | if (!new_result) { | ||||
| free(result); | free(result); | ||||
| LILV_ERROR("realloc() failed\n"); | |||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| @@ -286,36 +292,33 @@ lilv_copy_file(const char* src, const char* dst) | |||||
| { | { | ||||
| FILE* in = fopen(src, "r"); | FILE* in = fopen(src, "r"); | ||||
| if (!in) { | if (!in) { | ||||
| LILV_ERRORF("error opening %s (%s)\n", src, strerror(errno)); | |||||
| return 1; | |||||
| return errno; | |||||
| } | } | ||||
| FILE* out = fopen(dst, "w"); | FILE* out = fopen(dst, "w"); | ||||
| if (!out) { | if (!out) { | ||||
| LILV_ERRORF("error opening %s (%s)\n", dst, strerror(errno)); | |||||
| fclose(in); | |||||
| return 2; | |||||
| return errno; | |||||
| } | } | ||||
| char* page = (char*)malloc(PAGE_SIZE); | char* page = (char*)malloc(PAGE_SIZE); | ||||
| size_t n_read = 0; | size_t n_read = 0; | ||||
| int st = 0; | |||||
| while ((n_read = fread(page, 1, PAGE_SIZE, in)) > 0) { | while ((n_read = fread(page, 1, PAGE_SIZE, in)) > 0) { | ||||
| if (fwrite(page, 1, n_read, out) != n_read) { | if (fwrite(page, 1, n_read, out) != n_read) { | ||||
| LILV_ERRORF("write to %s failed (%s)\n", dst, strerror(errno)); | |||||
| st = errno; | |||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| const int ret = ferror(in) || ferror(out); | |||||
| if (ferror(in)) { | |||||
| LILV_ERRORF("read from %s failed (%s)\n", src, strerror(errno)); | |||||
| if (!st && (ferror(in) || ferror(out))) { | |||||
| st = EBADF; | |||||
| } | } | ||||
| free(page); | free(page); | ||||
| fclose(in); | fclose(in); | ||||
| fclose(out); | fclose(out); | ||||
| return ret; | |||||
| return st; | |||||
| } | } | ||||
| bool | bool | ||||
| @@ -374,6 +377,7 @@ lilv_size_mtime(const char* path, off_t* size, time_t* time) | |||||
| struct stat buf; | struct stat buf; | ||||
| if (stat(path, &buf)) { | if (stat(path, &buf)) { | ||||
| LILV_ERRORF("stat(%s) (%s)\n", path, strerror(errno)); | LILV_ERRORF("stat(%s) (%s)\n", path, strerror(errno)); | ||||
| return; | |||||
| } | } | ||||
| if (size) { | if (size) { | ||||
| @@ -429,13 +433,23 @@ lilv_get_latest_copy(const char* path, const char* copy_path) | |||||
| char* | char* | ||||
| lilv_realpath(const char* path) | lilv_realpath(const char* path) | ||||
| { | { | ||||
| #ifdef _WIN32 | |||||
| #if defined(_WIN32) | |||||
| char* out = (char*)malloc(MAX_PATH); | char* out = (char*)malloc(MAX_PATH); | ||||
| GetFullPathName(path, MAX_PATH, out, NULL); | GetFullPathName(path, MAX_PATH, out, NULL); | ||||
| return out; | return out; | ||||
| #else | |||||
| #elif _POSIX_VERSION >= 200809L | |||||
| char* real_path = realpath(path, NULL); | char* real_path = realpath(path, NULL); | ||||
| return real_path ? real_path : lilv_strdup(path); | return real_path ? real_path : lilv_strdup(path); | ||||
| #else | |||||
| // OSX <= 10.5, if anyone cares. I sure don't. | |||||
| char* out = (char*)malloc(PATH_MAX); | |||||
| char* real_path = realpath(path, out); | |||||
| if (!real_path) { | |||||
| free(out); | |||||
| return lilv_strdup(path); | |||||
| } else { | |||||
| return real_path; | |||||
| } | |||||
| #endif | #endif | ||||
| } | } | ||||
| @@ -445,7 +459,10 @@ lilv_symlink(const char* oldpath, const char* newpath) | |||||
| int ret = 0; | int ret = 0; | ||||
| if (strcmp(oldpath, newpath)) { | if (strcmp(oldpath, newpath)) { | ||||
| #ifdef _WIN32 | #ifdef _WIN32 | ||||
| ret = 1; | |||||
| ret = !CreateSymbolicLink(newpath, oldpath, 0); | |||||
| if (ret) { | |||||
| ret = !CreateHardLink(newpath, oldpath, 0); | |||||
| } | |||||
| #else | #else | ||||
| ret = symlink(oldpath, newpath); | ret = symlink(oldpath, newpath); | ||||
| #endif | #endif | ||||
| @@ -536,11 +553,18 @@ lilv_dir_for_each(const char* path, | |||||
| #else | #else | ||||
| DIR* dir = opendir(path); | DIR* dir = opendir(path); | ||||
| if (dir) { | if (dir) { | ||||
| struct dirent entry; | |||||
| long name_max = pathconf(path, _PC_NAME_MAX); | |||||
| if (name_max == -1) { | |||||
| name_max = 255; // Limit not defined, or error | |||||
| } | |||||
| const size_t len = offsetof(struct dirent, d_name) + name_max + 1; | |||||
| struct dirent* entry = (struct dirent*)malloc(len); | |||||
| struct dirent* result; | struct dirent* result; | ||||
| while (!readdir_r(dir, &entry, &result) && result) { | |||||
| f(path, entry.d_name, data); | |||||
| while (!readdir_r(dir, entry, &result) && result) { | |||||
| f(path, entry->d_name, data); | |||||
| } | } | ||||
| free(entry); | |||||
| closedir(dir); | closedir(dir); | ||||
| } | } | ||||
| #endif | #endif | ||||
| @@ -555,10 +579,8 @@ lilv_mkdir_p(const char* dir_path) | |||||
| if (path[i] == LILV_DIR_SEP[0] || path[i] == '\0') { | if (path[i] == LILV_DIR_SEP[0] || path[i] == '\0') { | ||||
| path[i] = '\0'; | path[i] = '\0'; | ||||
| if (mkdir(path, 0755) && errno != EEXIST) { | if (mkdir(path, 0755) && errno != EEXIST) { | ||||
| LILV_ERRORF("Failed to create %s (%s)\n", | |||||
| path, strerror(errno)); | |||||
| free(path); | free(path); | ||||
| return 1; | |||||
| return errno; | |||||
| } | } | ||||
| path[i] = LILV_DIR_SEP[0]; | path[i] = LILV_DIR_SEP[0]; | ||||
| } | } | ||||
| @@ -19,7 +19,7 @@ | |||||
| #include <stdlib.h> | #include <stdlib.h> | ||||
| #include <string.h> | #include <string.h> | ||||
| #include "lv2/presets.h" | |||||
| #include "lv2/lv2plug.in/ns/ext/presets/presets.h" | |||||
| #include "lilv_internal.h" | #include "lilv_internal.h" | ||||
| @@ -797,8 +797,12 @@ lilv_world_load_plugin_classes(LilvWorld* world) | |||||
| } | } | ||||
| LILV_API void | LILV_API void | ||||
| lilv_world_load_all(LilvWorld* world, const char* lv2_path) | |||||
| lilv_world_load_all(LilvWorld* world) | |||||
| { | { | ||||
| const char* lv2_path = getenv("LV2_PATH"); | |||||
| if (!lv2_path) | |||||
| lv2_path = LILV_DEFAULT_LV2_PATH; | |||||
| // Discover bundles and read all manifest files into model | // Discover bundles and read all manifest files into model | ||||
| lilv_world_load_path(world, lv2_path); | lilv_world_load_path(world, lv2_path); | ||||
| @@ -0,0 +1,30 @@ | |||||
| /* | |||||
| Lilv Test Plugin - Failed lib descriptor | |||||
| Copyright 2011-2015 David Robillard <d@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. | |||||
| */ | |||||
| #include <stdlib.h> | |||||
| #include "lv2/lv2plug.in/ns/lv2core/lv2.h" | |||||
| #define PLUGIN_URI "http://example.org/failed-lib-descriptor" | |||||
| LV2_SYMBOL_EXPORT | |||||
| const LV2_Lib_Descriptor* | |||||
| lv2_lib_descriptor(const char* bundle_path, | |||||
| const LV2_Feature*const* features) | |||||
| { | |||||
| return NULL; | |||||
| } | |||||
| @@ -0,0 +1,38 @@ | |||||
| # Lilv Test Plugin - Failed lib descriptor | |||||
| # Copyright 2011-2015 David Robillard <d@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. | |||||
| @prefix doap: <http://usefulinc.com/ns/doap#> . | |||||
| @prefix foaf: <http://xmlns.com/foaf/0.1/> . | |||||
| @prefix lv2: <http://lv2plug.in/ns/lv2core#> . | |||||
| @prefix ui: <http://lv2plug.in/ns/extensions/ui#> . | |||||
| <http://example.org/failed-lib-descriptor> | |||||
| a lv2:Plugin ; | |||||
| doap:name "Missing descriptor test" ; | |||||
| doap:license <http://opensource.org/licenses/isc> ; | |||||
| lv2:optionalFeature lv2:hardRTCapable ; | |||||
| lv2:port [ | |||||
| a lv2:InputPort , | |||||
| lv2:ControlPort ; | |||||
| lv2:index 0 ; | |||||
| lv2:symbol "input" ; | |||||
| lv2:name "Input" | |||||
| ] , [ | |||||
| a lv2:OutputPort , | |||||
| lv2:ControlPort ; | |||||
| lv2:index 1 ; | |||||
| lv2:symbol "output" ; | |||||
| lv2:name "Output" | |||||
| ] . | |||||
| @@ -0,0 +1,7 @@ | |||||
| @prefix lv2: <http://lv2plug.in/ns/lv2core#> . | |||||
| @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . | |||||
| <http://example.org/failed-lib-descriptor> | |||||
| a lv2:Plugin ; | |||||
| lv2:binary <failed_lib_descriptor@SHLIB_EXT@> ; | |||||
| rdfs:seeAlso <failed_lib_descriptor.ttl> . | |||||
| @@ -0,0 +1,44 @@ | |||||
| #include "lilv/lilv.h" | |||||
| #include "../src/lilv_internal.h" | |||||
| #define PLUGIN_URI "http://example.org/failed-lib-descriptor" | |||||
| #define TEST_ASSERT(check) do {\ | |||||
| if (!(check)) {\ | |||||
| fprintf(stderr, "%s:%d: failed test: %s\n", __FILE__, __LINE__, #check);\ | |||||
| return 1;\ | |||||
| }\ | |||||
| } while (0) | |||||
| int | |||||
| main(int argc, char** argv) | |||||
| { | |||||
| if (argc != 2) { | |||||
| fprintf(stderr, "USAGE: %s BUNDLE\n", argv[0]); | |||||
| return 1; | |||||
| } | |||||
| const char* bundle_path = argv[1]; | |||||
| LilvWorld* world = lilv_world_new(); | |||||
| // Load test plugin bundle | |||||
| uint8_t* abs_bundle = (uint8_t*)lilv_path_absolute(bundle_path); | |||||
| SerdNode bundle = serd_node_new_file_uri(abs_bundle, 0, 0, true); | |||||
| LilvNode* bundle_uri = lilv_new_uri(world, (const char*)bundle.buf); | |||||
| lilv_world_load_bundle(world, bundle_uri); | |||||
| free(abs_bundle); | |||||
| serd_node_free(&bundle); | |||||
| LilvNode* plugin_uri = lilv_new_uri(world, PLUGIN_URI); | |||||
| const LilvPlugins* plugins = lilv_world_get_all_plugins(world); | |||||
| const LilvPlugin* plugin = lilv_plugins_get_by_uri(plugins, plugin_uri); | |||||
| TEST_ASSERT(plugin); | |||||
| LilvInstance* instance = lilv_plugin_instantiate(plugin, 48000.0, NULL); | |||||
| TEST_ASSERT(!instance); | |||||
| lilv_world_free(world); | |||||
| return 0; | |||||
| } | |||||
| @@ -0,0 +1,112 @@ | |||||
| /* | |||||
| Lilv Test Plugin - Missing descriptor | |||||
| Copyright 2011-2015 David Robillard <d@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. | |||||
| */ | |||||
| #include <stdlib.h> | |||||
| #include "lv2/lv2plug.in/ns/lv2core/lv2.h" | |||||
| #define PLUGIN_URI "http://example.org/lib-descriptor" | |||||
| enum { | |||||
| TEST_INPUT = 0, | |||||
| TEST_OUTPUT = 1 | |||||
| }; | |||||
| typedef struct { | |||||
| float* input; | |||||
| float* output; | |||||
| } Test; | |||||
| static void | |||||
| cleanup(LV2_Handle instance) | |||||
| { | |||||
| free((Test*)instance); | |||||
| } | |||||
| static void | |||||
| connect_port(LV2_Handle instance, uint32_t port, void* data) | |||||
| { | |||||
| Test* test = (Test*)instance; | |||||
| switch (port) { | |||||
| case TEST_INPUT: | |||||
| test->input = (float*)data; | |||||
| break; | |||||
| case TEST_OUTPUT: | |||||
| test->output = (float*)data; | |||||
| break; | |||||
| default: | |||||
| break; | |||||
| } | |||||
| } | |||||
| static LV2_Handle | |||||
| instantiate(const LV2_Descriptor* descriptor, | |||||
| double rate, | |||||
| const char* path, | |||||
| const LV2_Feature* const* features) | |||||
| { | |||||
| Test* test = (Test*)calloc(1, sizeof(Test)); | |||||
| if (!test) { | |||||
| return NULL; | |||||
| } | |||||
| return (LV2_Handle)test; | |||||
| } | |||||
| static void | |||||
| run(LV2_Handle instance, uint32_t sample_count) | |||||
| { | |||||
| Test* test = (Test*)instance; | |||||
| *test->output = *test->input; | |||||
| } | |||||
| static const LV2_Descriptor descriptor = { | |||||
| PLUGIN_URI, | |||||
| instantiate, | |||||
| connect_port, | |||||
| NULL, // activate, | |||||
| run, | |||||
| NULL, // deactivate, | |||||
| cleanup, | |||||
| NULL // extension_data | |||||
| }; | |||||
| static const LV2_Descriptor* | |||||
| get_plugin(LV2_Lib_Handle handle, uint32_t index) | |||||
| { | |||||
| switch (index) { | |||||
| case 0: | |||||
| return &descriptor; | |||||
| default: | |||||
| return NULL; | |||||
| } | |||||
| } | |||||
| static const LV2_Lib_Descriptor lib = { | |||||
| NULL, | |||||
| sizeof(LV2_Lib_Descriptor), | |||||
| NULL, | |||||
| get_plugin }; | |||||
| LV2_SYMBOL_EXPORT | |||||
| const LV2_Lib_Descriptor* | |||||
| lv2_lib_descriptor(const char* bundle_path, | |||||
| const LV2_Feature*const* features) | |||||
| { | |||||
| return &lib; | |||||
| } | |||||
| @@ -0,0 +1,41 @@ | |||||
| # Lilv Test Plugin - Missing descriptor | |||||
| # Copyright 2011-2015 David Robillard <d@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. | |||||
| @prefix doap: <http://usefulinc.com/ns/doap#> . | |||||
| @prefix foaf: <http://xmlns.com/foaf/0.1/> . | |||||
| @prefix lv2: <http://lv2plug.in/ns/lv2core#> . | |||||
| @prefix ui: <http://lv2plug.in/ns/extensions/ui#> . | |||||
| @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . | |||||
| <http://example.org/lib-descriptor> | |||||
| a lv2:Plugin ; | |||||
| doap:name "Missing descriptor test" ; | |||||
| doap:license <http://opensource.org/licenses/isc> ; | |||||
| lv2:optionalFeature lv2:hardRTCapable ; | |||||
| <http://example.org/blob> "aGVsbG8sIHdvcmxk"^^xsd:base64Binary ; | |||||
| <http://example.org/junk> "opaque"^^<http://example.org/binary> ; | |||||
| lv2:port [ | |||||
| a lv2:InputPort , | |||||
| lv2:ControlPort ; | |||||
| lv2:index 0 ; | |||||
| lv2:symbol "input" ; | |||||
| lv2:name "Input" | |||||
| ] , [ | |||||
| a lv2:OutputPort , | |||||
| lv2:ControlPort ; | |||||
| lv2:index 1 ; | |||||
| lv2:symbol "output" ; | |||||
| lv2:name "Output" | |||||
| ] . | |||||
| @@ -0,0 +1,7 @@ | |||||
| @prefix lv2: <http://lv2plug.in/ns/lv2core#> . | |||||
| @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . | |||||
| <http://example.org/lib-descriptor> | |||||
| a lv2:Plugin ; | |||||
| lv2:binary <lib_descriptor@SHLIB_EXT@> ; | |||||
| rdfs:seeAlso <lib_descriptor.ttl> . | |||||
| @@ -0,0 +1,52 @@ | |||||
| #include "lilv/lilv.h" | |||||
| #include "../src/lilv_internal.h" | |||||
| #define PLUGIN_URI "http://example.org/lib-descriptor" | |||||
| #define TEST_ASSERT(check) do {\ | |||||
| if (!(check)) {\ | |||||
| fprintf(stderr, "%s:%d: failed test: %s\n", __FILE__, __LINE__, #check);\ | |||||
| return 1;\ | |||||
| }\ | |||||
| } while (0) | |||||
| int | |||||
| main(int argc, char** argv) | |||||
| { | |||||
| if (argc != 2) { | |||||
| fprintf(stderr, "USAGE: %s BUNDLE\n", argv[0]); | |||||
| return 1; | |||||
| } | |||||
| const char* bundle_path = argv[1]; | |||||
| LilvWorld* world = lilv_world_new(); | |||||
| // Load test plugin bundle | |||||
| uint8_t* abs_bundle = (uint8_t*)lilv_path_absolute(bundle_path); | |||||
| SerdNode bundle = serd_node_new_file_uri(abs_bundle, 0, 0, true); | |||||
| LilvNode* bundle_uri = lilv_new_uri(world, (const char*)bundle.buf); | |||||
| lilv_world_load_bundle(world, bundle_uri); | |||||
| free(abs_bundle); | |||||
| serd_node_free(&bundle); | |||||
| LilvNode* plugin_uri = lilv_new_uri(world, PLUGIN_URI); | |||||
| const LilvPlugins* plugins = lilv_world_get_all_plugins(world); | |||||
| const LilvPlugin* plugin = lilv_plugins_get_by_uri(plugins, plugin_uri); | |||||
| TEST_ASSERT(plugin); | |||||
| LilvInstance* instance = lilv_plugin_instantiate(plugin, 48000.0, NULL); | |||||
| TEST_ASSERT(instance); | |||||
| LilvNode* eg_blob = lilv_new_uri(world, "http://example.org/blob"); | |||||
| LilvNode* blob = lilv_world_get(world, plugin_uri, eg_blob, NULL); | |||||
| TEST_ASSERT(lilv_node_is_literal(blob)); | |||||
| LilvNode* eg_junk = lilv_new_uri(world, "http://example.org/junk"); | |||||
| LilvNode* junk = lilv_world_get(world, plugin_uri, eg_junk, NULL); | |||||
| TEST_ASSERT(lilv_node_is_literal(junk)); | |||||
| lilv_world_free(world); | |||||
| return 0; | |||||
| } | |||||
| @@ -1,5 +1,5 @@ | |||||
| /* | /* | ||||
| Copyright 2007-2014 David Robillard <http://drobilla.net> | |||||
| Copyright 2007-2015 David Robillard <http://drobilla.net> | |||||
| Copyright 2008 Krzysztof Foltman | Copyright 2008 Krzysztof Foltman | ||||
| Permission to use, copy, modify, and/or distribute this software for any | Permission to use, copy, modify, and/or distribute this software for any | ||||
| @@ -241,6 +241,7 @@ test_value(void) | |||||
| TEST_ASSERT(lilv_node_is_int(ival)); | TEST_ASSERT(lilv_node_is_int(ival)); | ||||
| TEST_ASSERT(lilv_node_is_float(fval)); | TEST_ASSERT(lilv_node_is_float(fval)); | ||||
| TEST_ASSERT(!lilv_node_is_literal(NULL)); | |||||
| TEST_ASSERT(!lilv_node_is_literal(uval)); | TEST_ASSERT(!lilv_node_is_literal(uval)); | ||||
| TEST_ASSERT(lilv_node_is_literal(sval)); | TEST_ASSERT(lilv_node_is_literal(sval)); | ||||
| TEST_ASSERT(lilv_node_is_literal(ival)); | TEST_ASSERT(lilv_node_is_literal(ival)); | ||||
| @@ -269,16 +270,16 @@ test_value(void) | |||||
| char* tok = lilv_node_get_turtle_token(uval); | char* tok = lilv_node_get_turtle_token(uval); | ||||
| TEST_ASSERT(!strcmp(tok, "<http://example.org>")); | TEST_ASSERT(!strcmp(tok, "<http://example.org>")); | ||||
| free(tok); | |||||
| lilv_free(tok); | |||||
| tok = lilv_node_get_turtle_token(sval); | tok = lilv_node_get_turtle_token(sval); | ||||
| TEST_ASSERT(!strcmp(tok, "Foo")); | TEST_ASSERT(!strcmp(tok, "Foo")); | ||||
| free(tok); | |||||
| lilv_free(tok); | |||||
| tok = lilv_node_get_turtle_token(ival); | tok = lilv_node_get_turtle_token(ival); | ||||
| TEST_ASSERT(!strcmp(tok, "42")); | TEST_ASSERT(!strcmp(tok, "42")); | ||||
| free(tok); | |||||
| lilv_free(tok); | |||||
| tok = lilv_node_get_turtle_token(fval); | tok = lilv_node_get_turtle_token(fval); | ||||
| TEST_ASSERT(!strncmp(tok, "1.6180", 6)); | TEST_ASSERT(!strncmp(tok, "1.6180", 6)); | ||||
| free(tok); | |||||
| lilv_free(tok); | |||||
| LilvNode* uval_e = lilv_new_uri(world, "http://example.org"); | LilvNode* uval_e = lilv_new_uri(world, "http://example.org"); | ||||
| LilvNode* sval_e = lilv_new_string(world, "Foo"); | LilvNode* sval_e = lilv_new_string(world, "Foo"); | ||||
| @@ -339,6 +340,16 @@ test_value(void) | |||||
| /*****************************************************************************/ | /*****************************************************************************/ | ||||
| static int | |||||
| test_util(void) | |||||
| { | |||||
| TEST_ASSERT(!lilv_realpath(NULL)); | |||||
| return 1; | |||||
| } | |||||
| /*****************************************************************************/ | |||||
| static int discovery_plugin_found = 0; | static int discovery_plugin_found = 0; | ||||
| static void | static void | ||||
| @@ -605,6 +616,10 @@ test_plugin(void) | |||||
| TEST_ASSERT(lilv_nodes_contains(data_uris, data_uri_val)); | TEST_ASSERT(lilv_nodes_contains(data_uris, data_uri_val)); | ||||
| lilv_node_free(data_uri_val); | lilv_node_free(data_uri_val); | ||||
| LilvNode* unknown_uri_val = lilv_new_uri(world, "http://example.org/unknown"); | |||||
| TEST_ASSERT(!lilv_nodes_contains(data_uris, unknown_uri_val)); | |||||
| lilv_node_free(unknown_uri_val); | |||||
| free(manifest_uri); | free(manifest_uri); | ||||
| free(data_uri); | free(data_uri); | ||||
| @@ -645,6 +660,7 @@ test_plugin(void) | |||||
| TEST_ASSERT(latency_port); | TEST_ASSERT(latency_port); | ||||
| TEST_ASSERT(lilv_port_get_index(plug, latency_port) == 2); | TEST_ASSERT(lilv_port_get_index(plug, latency_port) == 2); | ||||
| TEST_ASSERT(lilv_node_is_blank(lilv_port_get_node(plug, latency_port))); | |||||
| LilvNode* rt_feature = lilv_new_uri(world, | LilvNode* rt_feature = lilv_new_uri(world, | ||||
| "http://lv2plug.in/ns/lv2core#hardRTCapable"); | "http://lv2plug.in/ns/lv2core#hardRTCapable"); | ||||
| @@ -701,7 +717,7 @@ test_plugin(void) | |||||
| char* blank_tok = lilv_node_get_turtle_token(blank); | char* blank_tok = lilv_node_get_turtle_token(blank); | ||||
| TEST_ASSERT(!strncmp(blank_tok, "_:", 2)); | TEST_ASSERT(!strncmp(blank_tok, "_:", 2)); | ||||
| TEST_ASSERT(!strcmp(blank_tok + 2, blank_str)); | TEST_ASSERT(!strcmp(blank_tok + 2, blank_str)); | ||||
| free(blank_tok); | |||||
| lilv_free(blank_tok); | |||||
| lilv_node_free(blank_p); | lilv_node_free(blank_p); | ||||
| lilv_nodes_free(blanks); | lilv_nodes_free(blanks); | ||||
| @@ -1060,6 +1076,12 @@ test_port(void) | |||||
| TEST_ASSERT(p3 == NULL); | TEST_ASSERT(p3 == NULL); | ||||
| lilv_node_free(nopsym); | lilv_node_free(nopsym); | ||||
| // Try getting an invalid property | |||||
| LilvNode* num = lilv_new_int(world, 1); | |||||
| LilvNodes* nothing = lilv_port_get_value(plug, p, num); | |||||
| TEST_ASSERT(!nothing); | |||||
| lilv_node_free(num); | |||||
| LilvNode* audio_class = lilv_new_uri(world, | LilvNode* audio_class = lilv_new_uri(world, | ||||
| "http://lv2plug.in/ns/lv2core#AudioPort"); | "http://lv2plug.in/ns/lv2core#AudioPort"); | ||||
| LilvNode* control_class = lilv_new_uri(world, | LilvNode* control_class = lilv_new_uri(world, | ||||
| @@ -1116,6 +1138,12 @@ test_port(void) | |||||
| TEST_ASSERT(!strcmp(lilv_node_as_string(name), "store")); | TEST_ASSERT(!strcmp(lilv_node_as_string(name), "store")); | ||||
| lilv_node_free(name); | lilv_node_free(name); | ||||
| // Invalid language | |||||
| setenv("LANG", "1!", 1); | |||||
| name = lilv_port_get_name(plug, p); | |||||
| TEST_ASSERT(!strcmp(lilv_node_as_string(name), "store")); | |||||
| lilv_node_free(name); | |||||
| setenv("LANG", "en_CA.utf-8", 1); | setenv("LANG", "en_CA.utf-8", 1); | ||||
| // Language tagged value with no untranslated values | // Language tagged value with no untranslated values | ||||
| @@ -1347,11 +1375,15 @@ test_ui(void) | |||||
| LilvNode* ui_class_uri = lilv_new_uri(world, | LilvNode* ui_class_uri = lilv_new_uri(world, | ||||
| "http://lv2plug.in/ns/extensions/ui#GtkUI"); | "http://lv2plug.in/ns/extensions/ui#GtkUI"); | ||||
| LilvNode* unknown_ui_class_uri = lilv_new_uri(world, | |||||
| "http://example.org/mysteryUI"); | |||||
| TEST_ASSERT(lilv_node_equals(lilv_nodes_get_first(classes), ui_class_uri)); | TEST_ASSERT(lilv_node_equals(lilv_nodes_get_first(classes), ui_class_uri)); | ||||
| TEST_ASSERT(lilv_ui_is_a(ui0, ui_class_uri)); | TEST_ASSERT(lilv_ui_is_a(ui0, ui_class_uri)); | ||||
| const LilvNode* ui_type = NULL; | const LilvNode* ui_type = NULL; | ||||
| TEST_ASSERT(lilv_ui_is_supported(ui0, ui_supported, ui_class_uri, &ui_type)); | TEST_ASSERT(lilv_ui_is_supported(ui0, ui_supported, ui_class_uri, &ui_type)); | ||||
| TEST_ASSERT(!lilv_ui_is_supported(ui0, ui_supported, unknown_ui_class_uri, &ui_type)); | |||||
| TEST_ASSERT(lilv_node_equals(ui_type, ui_class_uri)); | TEST_ASSERT(lilv_node_equals(ui_type, ui_class_uri)); | ||||
| const LilvNode* plug_bundle_uri = lilv_plugin_get_bundle_uri(plug); | const LilvNode* plug_bundle_uri = lilv_plugin_get_bundle_uri(plug); | ||||
| @@ -1368,6 +1400,7 @@ test_ui(void) | |||||
| TEST_ASSERT(lilv_node_equals(expected_uri, ui_binary_uri)); | TEST_ASSERT(lilv_node_equals(expected_uri, ui_binary_uri)); | ||||
| free(ui_binary_uri_str); | free(ui_binary_uri_str); | ||||
| lilv_node_free(unknown_ui_class_uri); | |||||
| lilv_node_free(ui_class_uri); | lilv_node_free(ui_class_uri); | ||||
| lilv_node_free(ui_uri); | lilv_node_free(ui_uri); | ||||
| lilv_node_free(ui2_uri); | lilv_node_free(ui2_uri); | ||||
| @@ -1647,6 +1680,15 @@ test_state(void) | |||||
| lilv_instance_connect_port(instance, 1, &out); | lilv_instance_connect_port(instance, 1, &out); | ||||
| lilv_instance_run(instance, 1); | lilv_instance_run(instance, 1); | ||||
| // Test instantiating twice | |||||
| LilvInstance* instance2 = lilv_plugin_instantiate(plugin, 48000.0, ffeatures); | |||||
| if (!instance2) { | |||||
| fatal_error("Failed to create multiple instances of <%s>\n", | |||||
| lilv_node_as_uri(state_plugin_uri)); | |||||
| return 0; | |||||
| } | |||||
| lilv_instance_free(instance2); | |||||
| // Get instance state state | // Get instance state state | ||||
| LilvState* fstate = lilv_state_new_from_instance( | LilvState* fstate = lilv_state_new_from_instance( | ||||
| plugin, instance, &map, | plugin, instance, &map, | ||||
| @@ -1869,8 +1911,38 @@ test_string(void) | |||||
| /*****************************************************************************/ | /*****************************************************************************/ | ||||
| static int | |||||
| test_world(void) | |||||
| { | |||||
| if (!init_world()) { | |||||
| return 0; | |||||
| } | |||||
| LilvNode* num = lilv_new_int(world, 4); | |||||
| LilvNode* uri = lilv_new_uri(world, "http://example.org/object"); | |||||
| LilvNodes* matches = lilv_world_find_nodes(world, num, NULL, NULL); | |||||
| TEST_ASSERT(!matches); | |||||
| matches = lilv_world_find_nodes(world, NULL, num, NULL); | |||||
| TEST_ASSERT(!matches); | |||||
| matches = lilv_world_find_nodes(world, NULL, uri, NULL); | |||||
| TEST_ASSERT(!matches); | |||||
| lilv_node_free(uri); | |||||
| lilv_node_free(num); | |||||
| lilv_world_unload_bundle(world, NULL); | |||||
| return 1; | |||||
| } | |||||
| /*****************************************************************************/ | |||||
| /* add tests here */ | /* add tests here */ | ||||
| static struct TestCase tests[] = { | static struct TestCase tests[] = { | ||||
| TEST_CASE(util), | |||||
| TEST_CASE(value), | TEST_CASE(value), | ||||
| TEST_CASE(verify), | TEST_CASE(verify), | ||||
| TEST_CASE(no_verify), | TEST_CASE(no_verify), | ||||
| @@ -1889,6 +1961,7 @@ static struct TestCase tests[] = { | |||||
| TEST_CASE(bad_port_index), | TEST_CASE(bad_port_index), | ||||
| TEST_CASE(bad_port_index), | TEST_CASE(bad_port_index), | ||||
| TEST_CASE(string), | TEST_CASE(string), | ||||
| TEST_CASE(world), | |||||
| TEST_CASE(state), | TEST_CASE(state), | ||||
| { NULL, NULL } | { NULL, NULL } | ||||
| }; | }; | ||||
| @@ -0,0 +1,7 @@ | |||||
| @prefix lv2: <http://lv2plug.in/ns/lv2core#> . | |||||
| @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . | |||||
| <http://example.org/missing-descriptor> | |||||
| a lv2:Plugin ; | |||||
| lv2:binary <missing_descriptor@SHLIB_EXT@> ; | |||||
| rdfs:seeAlso <missing_descriptor.ttl> . | |||||
| @@ -0,0 +1,20 @@ | |||||
| /* | |||||
| Lilv Test Plugin - Missing descriptor | |||||
| Copyright 2011-2015 David Robillard <d@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. | |||||
| */ | |||||
| #include "lv2/lv2plug.in/ns/lv2core/lv2.h" | |||||
| LV2_SYMBOL_EXPORT const char* msg = "this is not the thing you're looking for"; | |||||
| @@ -0,0 +1,38 @@ | |||||
| # Lilv Test Plugin - Missing descriptor | |||||
| # Copyright 2011-2015 David Robillard <d@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. | |||||
| @prefix doap: <http://usefulinc.com/ns/doap#> . | |||||
| @prefix foaf: <http://xmlns.com/foaf/0.1/> . | |||||
| @prefix lv2: <http://lv2plug.in/ns/lv2core#> . | |||||
| @prefix ui: <http://lv2plug.in/ns/extensions/ui#> . | |||||
| <http://example.org/missing-descriptor> | |||||
| a lv2:Plugin ; | |||||
| doap:name "Missing descriptor test" ; | |||||
| doap:license <http://opensource.org/licenses/isc> ; | |||||
| lv2:optionalFeature lv2:hardRTCapable ; | |||||
| lv2:port [ | |||||
| a lv2:InputPort , | |||||
| lv2:ControlPort ; | |||||
| lv2:index 0 ; | |||||
| lv2:symbol "input" ; | |||||
| lv2:name "Input" | |||||
| ] , [ | |||||
| a lv2:OutputPort , | |||||
| lv2:ControlPort ; | |||||
| lv2:index 1 ; | |||||
| lv2:symbol "output" ; | |||||
| lv2:name "Output" | |||||
| ] . | |||||
| @@ -0,0 +1,44 @@ | |||||
| #include "lilv/lilv.h" | |||||
| #include "../src/lilv_internal.h" | |||||
| #define PLUGIN_URI "http://example.org/missing-descriptor" | |||||
| #define TEST_ASSERT(check) do {\ | |||||
| if (!(check)) {\ | |||||
| fprintf(stderr, "%s:%d: failed test: %s\n", __FILE__, __LINE__, #check);\ | |||||
| return 1;\ | |||||
| }\ | |||||
| } while (0) | |||||
| int | |||||
| main(int argc, char** argv) | |||||
| { | |||||
| if (argc != 2) { | |||||
| fprintf(stderr, "USAGE: %s BUNDLE\n", argv[0]); | |||||
| return 1; | |||||
| } | |||||
| const char* bundle_path = argv[1]; | |||||
| LilvWorld* world = lilv_world_new(); | |||||
| // Load test plugin bundle | |||||
| uint8_t* abs_bundle = (uint8_t*)lilv_path_absolute(bundle_path); | |||||
| SerdNode bundle = serd_node_new_file_uri(abs_bundle, 0, 0, true); | |||||
| LilvNode* bundle_uri = lilv_new_uri(world, (const char*)bundle.buf); | |||||
| lilv_world_load_bundle(world, bundle_uri); | |||||
| free(abs_bundle); | |||||
| serd_node_free(&bundle); | |||||
| LilvNode* plugin_uri = lilv_new_uri(world, PLUGIN_URI); | |||||
| const LilvPlugins* plugins = lilv_world_get_all_plugins(world); | |||||
| const LilvPlugin* plugin = lilv_plugins_get_by_uri(plugins, plugin_uri); | |||||
| TEST_ASSERT(plugin); | |||||
| LilvInstance* instance = lilv_plugin_instantiate(plugin, 48000.0, NULL); | |||||
| TEST_ASSERT(!instance); | |||||
| lilv_world_free(world); | |||||
| return 0; | |||||
| } | |||||
| @@ -0,0 +1,7 @@ | |||||
| @prefix lv2: <http://lv2plug.in/ns/lv2core#> . | |||||
| @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . | |||||
| <http://example.org/missing-name> | |||||
| a lv2:Plugin ; | |||||
| lv2:binary <missing_name@SHLIB_EXT@> ; | |||||
| rdfs:seeAlso <missing_name.ttl> . | |||||
| @@ -0,0 +1,93 @@ | |||||
| /* | |||||
| Lilv Test Plugin - Missing descriptor | |||||
| Copyright 2011-2015 David Robillard <d@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. | |||||
| */ | |||||
| #include <stdlib.h> | |||||
| #include "lv2/lv2plug.in/ns/lv2core/lv2.h" | |||||
| #define PLUGIN_URI "http://example.org/missing-name" | |||||
| enum { | |||||
| TEST_INPUT = 0, | |||||
| TEST_OUTPUT = 1 | |||||
| }; | |||||
| typedef struct { | |||||
| float* input; | |||||
| float* output; | |||||
| } Test; | |||||
| static void | |||||
| cleanup(LV2_Handle instance) | |||||
| { | |||||
| free((Test*)instance); | |||||
| } | |||||
| static void | |||||
| connect_port(LV2_Handle instance, uint32_t port, void* data) | |||||
| { | |||||
| Test* test = (Test*)instance; | |||||
| switch (port) { | |||||
| case TEST_INPUT: | |||||
| test->input = (float*)data; | |||||
| break; | |||||
| case TEST_OUTPUT: | |||||
| test->output = (float*)data; | |||||
| break; | |||||
| default: | |||||
| break; | |||||
| } | |||||
| } | |||||
| static LV2_Handle | |||||
| instantiate(const LV2_Descriptor* descriptor, | |||||
| double rate, | |||||
| const char* path, | |||||
| const LV2_Feature* const* features) | |||||
| { | |||||
| Test* test = (Test*)calloc(1, sizeof(Test)); | |||||
| if (!test) { | |||||
| return NULL; | |||||
| } | |||||
| return (LV2_Handle)test; | |||||
| } | |||||
| static void | |||||
| run(LV2_Handle instance, uint32_t sample_count) | |||||
| { | |||||
| Test* test = (Test*)instance; | |||||
| *test->output = *test->input; | |||||
| } | |||||
| static const LV2_Descriptor descriptor = { | |||||
| PLUGIN_URI, | |||||
| instantiate, | |||||
| connect_port, | |||||
| NULL, // activate, | |||||
| run, | |||||
| NULL, // deactivate, | |||||
| cleanup, | |||||
| NULL // extension_data | |||||
| }; | |||||
| LV2_SYMBOL_EXPORT | |||||
| const LV2_Descriptor* lv2_descriptor(uint32_t index) | |||||
| { | |||||
| return (index == 0) ? &descriptor : NULL; | |||||
| } | |||||
| @@ -0,0 +1,37 @@ | |||||
| # Lilv Test Plugin - Missing plugin name | |||||
| # Copyright 2011-2015 David Robillard <d@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. | |||||
| @prefix doap: <http://usefulinc.com/ns/doap#> . | |||||
| @prefix foaf: <http://xmlns.com/foaf/0.1/> . | |||||
| @prefix lv2: <http://lv2plug.in/ns/lv2core#> . | |||||
| @prefix ui: <http://lv2plug.in/ns/extensions/ui#> . | |||||
| <http://example.org/missing-name> | |||||
| a lv2:Plugin ; | |||||
| doap:license <http://opensource.org/licenses/isc> ; | |||||
| lv2:optionalFeature lv2:hardRTCapable ; | |||||
| lv2:port [ | |||||
| a lv2:InputPort , | |||||
| lv2:ControlPort ; | |||||
| lv2:index 0 ; | |||||
| lv2:symbol "input" ; | |||||
| lv2:name "Input" | |||||
| ] , [ | |||||
| a lv2:OutputPort , | |||||
| lv2:ControlPort ; | |||||
| lv2:index 1 ; | |||||
| lv2:symbol "output" ; | |||||
| lv2:name "Output" | |||||
| ] . | |||||
| @@ -0,0 +1,44 @@ | |||||
| #include "lilv/lilv.h" | |||||
| #include "../src/lilv_internal.h" | |||||
| #define PLUGIN_URI "http://example.org/missing-name" | |||||
| #define TEST_ASSERT(check) do {\ | |||||
| if (!(check)) {\ | |||||
| fprintf(stderr, "%s:%d: failed test: %s\n", __FILE__, __LINE__, #check);\ | |||||
| return 1;\ | |||||
| }\ | |||||
| } while (0) | |||||
| int | |||||
| main(int argc, char** argv) | |||||
| { | |||||
| if (argc != 2) { | |||||
| fprintf(stderr, "USAGE: %s BUNDLE\n", argv[0]); | |||||
| return 1; | |||||
| } | |||||
| const char* bundle_path = argv[1]; | |||||
| LilvWorld* world = lilv_world_new(); | |||||
| // Load test plugin bundle | |||||
| uint8_t* abs_bundle = (uint8_t*)lilv_path_absolute(bundle_path); | |||||
| SerdNode bundle = serd_node_new_file_uri(abs_bundle, 0, 0, true); | |||||
| LilvNode* bundle_uri = lilv_new_uri(world, (const char*)bundle.buf); | |||||
| lilv_world_load_bundle(world, bundle_uri); | |||||
| free(abs_bundle); | |||||
| serd_node_free(&bundle); | |||||
| LilvNode* plugin_uri = lilv_new_uri(world, PLUGIN_URI); | |||||
| const LilvPlugins* plugins = lilv_world_get_all_plugins(world); | |||||
| const LilvPlugin* plugin = lilv_plugins_get_by_uri(plugins, plugin_uri); | |||||
| TEST_ASSERT(plugin); | |||||
| LilvInstance* instance = lilv_plugin_instantiate(plugin, 48000.0, NULL); | |||||
| TEST_ASSERT(instance); | |||||
| lilv_world_free(world); | |||||
| return 0; | |||||
| } | |||||
| @@ -0,0 +1,7 @@ | |||||
| @prefix lv2: <http://lv2plug.in/ns/lv2core#> . | |||||
| @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . | |||||
| <http://example.org/missing-plugin> | |||||
| a lv2:Plugin ; | |||||
| lv2:binary <missing_plugin@SHLIB_EXT@> ; | |||||
| rdfs:seeAlso <missing_plugin.ttl> . | |||||
| @@ -0,0 +1,28 @@ | |||||
| /* | |||||
| Lilv Test Plugin - Missing plugin | |||||
| Copyright 2011-2015 David Robillard <d@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. | |||||
| */ | |||||
| #include <stdlib.h> | |||||
| #include "lv2/lv2plug.in/ns/lv2core/lv2.h" | |||||
| #define PLUGIN_URI "http://example.org/missing-plugin" | |||||
| LV2_SYMBOL_EXPORT | |||||
| const LV2_Descriptor* lv2_descriptor(uint32_t index) | |||||
| { | |||||
| return NULL; | |||||
| } | |||||
| @@ -0,0 +1,38 @@ | |||||
| # Lilv Test Plugin - Missing plugin | |||||
| # Copyright 2011-2015 David Robillard <d@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. | |||||
| @prefix doap: <http://usefulinc.com/ns/doap#> . | |||||
| @prefix foaf: <http://xmlns.com/foaf/0.1/> . | |||||
| @prefix lv2: <http://lv2plug.in/ns/lv2core#> . | |||||
| @prefix ui: <http://lv2plug.in/ns/extensions/ui#> . | |||||
| <http://example.org/missing-plugin> | |||||
| a lv2:Plugin ; | |||||
| doap:name "Missing descriptor test" ; | |||||
| doap:license <http://opensource.org/licenses/isc> ; | |||||
| lv2:optionalFeature lv2:hardRTCapable ; | |||||
| lv2:port [ | |||||
| a lv2:InputPort , | |||||
| lv2:ControlPort ; | |||||
| lv2:index 0 ; | |||||
| lv2:symbol "input" ; | |||||
| lv2:name "Input" | |||||
| ] , [ | |||||
| a lv2:OutputPort , | |||||
| lv2:ControlPort ; | |||||
| lv2:index 1 ; | |||||
| lv2:symbol "output" ; | |||||
| lv2:name "Output" | |||||
| ] . | |||||
| @@ -0,0 +1,44 @@ | |||||
| #include "lilv/lilv.h" | |||||
| #include "../src/lilv_internal.h" | |||||
| #define PLUGIN_URI "http://example.org/missing-plugin" | |||||
| #define TEST_ASSERT(check) do {\ | |||||
| if (!(check)) {\ | |||||
| fprintf(stderr, "%s:%d: failed test: %s\n", __FILE__, __LINE__, #check);\ | |||||
| return 1;\ | |||||
| }\ | |||||
| } while (0) | |||||
| int | |||||
| main(int argc, char** argv) | |||||
| { | |||||
| if (argc != 2) { | |||||
| fprintf(stderr, "USAGE: %s BUNDLE\n", argv[0]); | |||||
| return 1; | |||||
| } | |||||
| const char* bundle_path = argv[1]; | |||||
| LilvWorld* world = lilv_world_new(); | |||||
| // Load test plugin bundle | |||||
| uint8_t* abs_bundle = (uint8_t*)lilv_path_absolute(bundle_path); | |||||
| SerdNode bundle = serd_node_new_file_uri(abs_bundle, 0, 0, true); | |||||
| LilvNode* bundle_uri = lilv_new_uri(world, (const char*)bundle.buf); | |||||
| lilv_world_load_bundle(world, bundle_uri); | |||||
| free(abs_bundle); | |||||
| serd_node_free(&bundle); | |||||
| LilvNode* plugin_uri = lilv_new_uri(world, PLUGIN_URI); | |||||
| const LilvPlugins* plugins = lilv_world_get_all_plugins(world); | |||||
| const LilvPlugin* plugin = lilv_plugins_get_by_uri(plugins, plugin_uri); | |||||
| TEST_ASSERT(plugin); | |||||
| LilvInstance* instance = lilv_plugin_instantiate(plugin, 48000.0, NULL); | |||||
| TEST_ASSERT(!instance); | |||||
| lilv_world_free(world); | |||||
| return 0; | |||||
| } | |||||
| @@ -0,0 +1,7 @@ | |||||
| @prefix lv2: <http://lv2plug.in/ns/lv2core#> . | |||||
| @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . | |||||
| <http://example.org/missing-port-name> | |||||
| a lv2:Plugin ; | |||||
| lv2:binary <missing_port_name@SHLIB_EXT@> ; | |||||
| rdfs:seeAlso <missing_port_name.ttl> . | |||||
| @@ -0,0 +1,93 @@ | |||||
| /* | |||||
| Lilv Test Plugin - Missing port name | |||||
| Copyright 2011-2015 David Robillard <d@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. | |||||
| */ | |||||
| #include <stdlib.h> | |||||
| #include "lv2/lv2plug.in/ns/lv2core/lv2.h" | |||||
| #define PLUGIN_URI "http://example.org/missing-port-name" | |||||
| enum { | |||||
| TEST_INPUT = 0, | |||||
| TEST_OUTPUT = 1 | |||||
| }; | |||||
| typedef struct { | |||||
| float* input; | |||||
| float* output; | |||||
| } Test; | |||||
| static void | |||||
| cleanup(LV2_Handle instance) | |||||
| { | |||||
| free((Test*)instance); | |||||
| } | |||||
| static void | |||||
| connect_port(LV2_Handle instance, uint32_t port, void* data) | |||||
| { | |||||
| Test* test = (Test*)instance; | |||||
| switch (port) { | |||||
| case TEST_INPUT: | |||||
| test->input = (float*)data; | |||||
| break; | |||||
| case TEST_OUTPUT: | |||||
| test->output = (float*)data; | |||||
| break; | |||||
| default: | |||||
| break; | |||||
| } | |||||
| } | |||||
| static LV2_Handle | |||||
| instantiate(const LV2_Descriptor* descriptor, | |||||
| double rate, | |||||
| const char* path, | |||||
| const LV2_Feature* const* features) | |||||
| { | |||||
| Test* test = (Test*)calloc(1, sizeof(Test)); | |||||
| if (!test) { | |||||
| return NULL; | |||||
| } | |||||
| return (LV2_Handle)test; | |||||
| } | |||||
| static void | |||||
| run(LV2_Handle instance, uint32_t sample_count) | |||||
| { | |||||
| Test* test = (Test*)instance; | |||||
| *test->output = *test->input; | |||||
| } | |||||
| static const LV2_Descriptor descriptor = { | |||||
| PLUGIN_URI, | |||||
| instantiate, | |||||
| connect_port, | |||||
| NULL, // activate, | |||||
| run, | |||||
| NULL, // deactivate, | |||||
| cleanup, | |||||
| NULL // extension_data | |||||
| }; | |||||
| LV2_SYMBOL_EXPORT | |||||
| const LV2_Descriptor* lv2_descriptor(uint32_t index) | |||||
| { | |||||
| return (index == 0) ? &descriptor : NULL; | |||||
| } | |||||
| @@ -0,0 +1,30 @@ | |||||
| # Lilv Test Plugin - Missing port name | |||||
| # Copyright 2011-2015 David Robillard <d@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. | |||||
| @prefix doap: <http://usefulinc.com/ns/doap#> . | |||||
| @prefix foaf: <http://xmlns.com/foaf/0.1/> . | |||||
| @prefix lv2: <http://lv2plug.in/ns/lv2core#> . | |||||
| @prefix ui: <http://lv2plug.in/ns/extensions/ui#> . | |||||
| <http://example.org/missing-port-name> | |||||
| a lv2:Plugin ; | |||||
| doap:license <http://opensource.org/licenses/isc> ; | |||||
| lv2:optionalFeature lv2:hardRTCapable ; | |||||
| lv2:port [ | |||||
| a lv2:InputPort , | |||||
| lv2:ControlPort ; | |||||
| lv2:index 0 ; | |||||
| lv2:symbol "input" ; | |||||
| ] . | |||||
| @@ -0,0 +1,46 @@ | |||||
| #include "lilv/lilv.h" | |||||
| #include "../src/lilv_internal.h" | |||||
| #define PLUGIN_URI "http://example.org/missing-port-name" | |||||
| #define TEST_ASSERT(check) do {\ | |||||
| if (!(check)) {\ | |||||
| fprintf(stderr, "%s:%d: failed test: %s\n", __FILE__, __LINE__, #check);\ | |||||
| return 1;\ | |||||
| }\ | |||||
| } while (0) | |||||
| int | |||||
| main(int argc, char** argv) | |||||
| { | |||||
| if (argc != 2) { | |||||
| fprintf(stderr, "USAGE: %s BUNDLE\n", argv[0]); | |||||
| return 1; | |||||
| } | |||||
| const char* bundle_path = argv[1]; | |||||
| LilvWorld* world = lilv_world_new(); | |||||
| // Load test plugin bundle | |||||
| uint8_t* abs_bundle = (uint8_t*)lilv_path_absolute(bundle_path); | |||||
| SerdNode bundle = serd_node_new_file_uri(abs_bundle, 0, 0, true); | |||||
| LilvNode* bundle_uri = lilv_new_uri(world, (const char*)bundle.buf); | |||||
| lilv_world_load_bundle(world, bundle_uri); | |||||
| free(abs_bundle); | |||||
| serd_node_free(&bundle); | |||||
| LilvNode* plugin_uri = lilv_new_uri(world, PLUGIN_URI); | |||||
| const LilvPlugins* plugins = lilv_world_get_all_plugins(world); | |||||
| const LilvPlugin* plugin = lilv_plugins_get_by_uri(plugins, plugin_uri); | |||||
| TEST_ASSERT(plugin); | |||||
| const LilvPort* port = lilv_plugin_get_port_by_index(plugin, 0); | |||||
| TEST_ASSERT(port); | |||||
| LilvNode* name = lilv_port_get_name(plugin, port); | |||||
| TEST_ASSERT(!name); | |||||
| lilv_world_free(world); | |||||
| return 0; | |||||
| } | |||||
| @@ -3,5 +3,5 @@ | |||||
| <http://example.org/lilv-test-plugin> | <http://example.org/lilv-test-plugin> | ||||
| a lv2:Plugin ; | a lv2:Plugin ; | ||||
| lv2:binary <test_plugin@SHLIB_EXT@> ; | |||||
| rdfs:seeAlso <test_plugin.ttl> . | |||||
| lv2:binary <test@SHLIB_EXT@> ; | |||||
| rdfs:seeAlso <test.ttl> . | |||||
| @@ -1,6 +1,6 @@ | |||||
| /* | /* | ||||
| Lilv Test Plugin | Lilv Test Plugin | ||||
| Copyright 2011-2012 David Robillard <d@drobilla.net> | |||||
| Copyright 2011-2015 David Robillard <d@drobilla.net> | |||||
| Permission to use, copy, modify, and/or distribute this software for any | Permission to use, copy, modify, and/or distribute this software for any | ||||
| purpose with or without fee is hereby granted, provided that the above | purpose with or without fee is hereby granted, provided that the above | ||||
| @@ -1,5 +1,5 @@ | |||||
| # Lilv Test Plugin | # Lilv Test Plugin | ||||
| # Copyright 2011 David Robillard <d@drobilla.net> | |||||
| # Copyright 2011-2015 David Robillard <d@drobilla.net> | |||||
| # | # | ||||
| # Permission to use, copy, modify, and/or distribute this software for any | # Permission to use, copy, modify, and/or distribute this software for any | ||||
| # purpose with or without fee is hereby granted, provided that the above | # purpose with or without fee is hereby granted, provided that the above | ||||
| @@ -12,7 +12,7 @@ import waflib.Logs as Logs | |||||
| # major increment <=> incompatible changes | # major increment <=> incompatible changes | ||||
| # minor increment <=> compatible changes (additions) | # minor increment <=> compatible changes (additions) | ||||
| # micro increment <=> no interface changes | # micro increment <=> no interface changes | ||||
| LILV_VERSION = '0.21.3' | |||||
| LILV_VERSION = '0.22.1' | |||||
| LILV_MAJOR_VERSION = '0' | LILV_MAJOR_VERSION = '0' | ||||
| # Mandatory waf variables | # Mandatory waf variables | ||||
| @@ -21,6 +21,13 @@ VERSION = LILV_VERSION # Package version for waf dist | |||||
| top = '.' # Source directory | top = '.' # Source directory | ||||
| out = 'build' # Build directory | out = 'build' # Build directory | ||||
| test_plugins = ['missing_descriptor', | |||||
| 'missing_plugin', | |||||
| 'missing_name', | |||||
| 'missing_port_name', | |||||
| 'lib_descriptor', | |||||
| 'failed_lib_descriptor'] | |||||
| def options(opt): | def options(opt): | ||||
| opt.load('compiler_c') | opt.load('compiler_c') | ||||
| opt.load('compiler_cxx') | opt.load('compiler_cxx') | ||||
| @@ -34,6 +41,8 @@ def options(opt): | |||||
| help='Build support for dynamic manifests') | help='Build support for dynamic manifests') | ||||
| opt.add_option('--test', action='store_true', dest='build_tests', | opt.add_option('--test', action='store_true', dest='build_tests', | ||||
| help='Build unit tests') | help='Build unit tests') | ||||
| opt.add_option('--no-coverage', action='store_true', dest='no_coverage', | |||||
| help='Do not use gcov for code coverage') | |||||
| opt.add_option('--no-bash-completion', action='store_true', | opt.add_option('--no-bash-completion', action='store_true', | ||||
| dest='no_bash_completion', | dest='no_bash_completion', | ||||
| help='Do not install bash completion script in CONFIGDIR') | help='Do not install bash completion script in CONFIGDIR') | ||||
| @@ -88,11 +97,8 @@ def configure(conf): | |||||
| if conf.env.DEST_OS == 'darwin': | if conf.env.DEST_OS == 'darwin': | ||||
| defines += ['_DARWIN_C_SOURCE'] | defines += ['_DARWIN_C_SOURCE'] | ||||
| # Check for gcov library (for test coverage) | |||||
| if conf.env.BUILD_TESTS: | |||||
| conf.check_cc(lib='gcov', | |||||
| define_name='HAVE_GCOV', | |||||
| mandatory=False) | |||||
| if conf.env.BUILD_TESTS and not Options.options.no_coverage: | |||||
| conf.check_cc(lib='gcov', define_name='HAVE_GCOV', mandatory=False) | |||||
| conf.check_cc(function_name='flock', | conf.check_cc(function_name='flock', | ||||
| header_name='sys/file.h', | header_name='sys/file.h', | ||||
| @@ -182,7 +188,6 @@ def build_util(bld, name, defines): | |||||
| obj.lib = ['m'] | obj.lib = ['m'] | ||||
| obj.env.SHLIB_MARKER = obj.env.STLIB_MARKER | obj.env.SHLIB_MARKER = obj.env.STLIB_MARKER | ||||
| obj.linkflags = ['-static', '-Wl,--start-group'] | obj.linkflags = ['-static', '-Wl,--start-group'] | ||||
| obj.lib = ['dl', 'm'] | |||||
| return obj | return obj | ||||
| def build(bld): | def build(bld): | ||||
| @@ -268,23 +273,39 @@ def build(bld): | |||||
| penv.cshlib_PATTERN = shlib_pattern | penv.cshlib_PATTERN = shlib_pattern | ||||
| shlib_ext = shlib_pattern[shlib_pattern.rfind('.'):] | shlib_ext = shlib_pattern[shlib_pattern.rfind('.'):] | ||||
| obj = bld(features = 'c cshlib', | |||||
| env = penv, | |||||
| source = 'test/test_plugin.c', | |||||
| name = 'test_plugin', | |||||
| target = 'test/test_plugin.lv2/test_plugin', | |||||
| install_path = None, | |||||
| defines = defines, | |||||
| cflags = test_cflags, | |||||
| lib = test_libs, | |||||
| uselib = 'LV2') | |||||
| for p in ['test'] + test_plugins: | |||||
| obj = bld(features = 'c cshlib', | |||||
| env = penv, | |||||
| source = 'test/%s.lv2/%s.c' % (p, p), | |||||
| name = p, | |||||
| target = 'test/%s.lv2/%s' % (p, p), | |||||
| install_path = None, | |||||
| defines = defines, | |||||
| cflags = test_cflags, | |||||
| lib = test_libs, | |||||
| uselib = 'LV2') | |||||
| for p in test_plugins: | |||||
| obj = bld(features = 'c cprogram', | |||||
| source = 'test/%s.lv2/test_%s.c' % (p, p), | |||||
| target = 'test/test_%s' % p, | |||||
| includes = ['.', './src'], | |||||
| use = 'liblilv_profiled', | |||||
| install_path = None, | |||||
| defines = defines, | |||||
| cflags = test_cflags, | |||||
| lib = test_libs, | |||||
| uselib = 'LV2') | |||||
| autowaf.use_lib(bld, obj, 'SERD SORD SRATOM LV2') | |||||
| # Test plugin data files | # Test plugin data files | ||||
| for i in [ 'manifest.ttl.in', 'test_plugin.ttl.in' ]: | |||||
| bld(features = 'subst', | |||||
| source = 'test/' + i, | |||||
| target = 'test/test_plugin.lv2/' + i.replace('.in', ''), | |||||
| install_path = None, | |||||
| for p in ['test'] + test_plugins: | |||||
| for i in [ 'manifest.ttl.in', p + '.ttl.in' ]: | |||||
| bundle = 'test/%s.lv2/' % p | |||||
| bld(features = 'subst', | |||||
| source = bundle + i, | |||||
| target = bundle + i.replace('.in', ''), | |||||
| install_path = None, | |||||
| SHLIB_EXT = shlib_ext) | SHLIB_EXT = shlib_ext) | ||||
| # Static profiled library (for unit test code coverage) | # Static profiled library (for unit test code coverage) | ||||
| @@ -301,7 +322,7 @@ def build(bld): | |||||
| # Unit test program | # Unit test program | ||||
| blddir = autowaf.build_dir(APPNAME, 'test') | blddir = autowaf.build_dir(APPNAME, 'test') | ||||
| bpath = os.path.abspath(os.path.join(blddir, 'test_plugin.lv2')) | |||||
| bpath = os.path.abspath(os.path.join(blddir, 'test.lv2')) | |||||
| bpath = bpath.replace('\\', '/') | bpath = bpath.replace('\\', '/') | ||||
| obj = bld(features = 'c cprogram', | obj = bld(features = 'c cprogram', | ||||
| source = 'test/lilv_test.c', | source = 'test/lilv_test.c', | ||||
| @@ -358,7 +379,7 @@ def build(bld): | |||||
| if bld.is_defined('HAVE_CLOCK_GETTIME') and not bld.env.STATIC_PROGS: | if bld.is_defined('HAVE_CLOCK_GETTIME') and not bld.env.STATIC_PROGS: | ||||
| obj = build_util(bld, 'utils/lv2bench', defines) | obj = build_util(bld, 'utils/lv2bench', defines) | ||||
| if not bld.env.MSVC_COMPILER: | if not bld.env.MSVC_COMPILER: | ||||
| obj.lib = ['dl', 'rt'] | |||||
| obj.lib = ['rt'] | |||||
| # Documentation | # Documentation | ||||
| autowaf.build_dox(bld, 'LILV', LILV_VERSION, top, out) | autowaf.build_dox(bld, 'LILV', LILV_VERSION, top, out) | ||||
| @@ -384,6 +405,7 @@ def build(bld): | |||||
| bld.install_files('${PYTHONDIR}', 'bindings/lilv.py') | bld.install_files('${PYTHONDIR}', 'bindings/lilv.py') | ||||
| bld.add_post_fun(autowaf.run_ldconfig) | |||||
| if bld.env.DOCS: | if bld.env.DOCS: | ||||
| bld.add_post_fun(fix_docs) | bld.add_post_fun(fix_docs) | ||||
| @@ -410,7 +432,13 @@ def test(ctx): | |||||
| os.environ['LD_LIBRARY_PATH'] = os.getcwd() | os.environ['LD_LIBRARY_PATH'] = os.getcwd() | ||||
| autowaf.run_tests(ctx, 'Python ' + APPNAME, ['python -m unittest discover bindings/']) | autowaf.run_tests(ctx, 'Python ' + APPNAME, ['python -m unittest discover bindings/']) | ||||
| os.environ['PATH'] = 'test' + os.pathsep + os.getenv('PATH') | os.environ['PATH'] = 'test' + os.pathsep + os.getenv('PATH') | ||||
| autowaf.run_tests(ctx, APPNAME, ['lilv_test'], dirs=['./src','./test']) | |||||
| autowaf.run_test(ctx, APPNAME, 'lilv_test', dirs=['./src','./test'], name='lilv_test', header=True) | |||||
| for p in test_plugins: | |||||
| autowaf.run_test(ctx, APPNAME, | |||||
| 'test_' + p + ' ' + ('test/%s.lv2/' % p), | |||||
| 0, dirs=['./src','./test','./test/%s.lv2' % p], name=p, header=True) | |||||
| autowaf.post_test(ctx, APPNAME) | autowaf.post_test(ctx, APPNAME) | ||||
| try: | try: | ||||
| shutil.rmtree('state') | shutil.rmtree('state') | ||||