diff options
author | David Robillard <d@drobilla.net> | 2011-04-29 17:30:30 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-04-29 17:30:30 +0000 |
commit | 1e7b27c7b322476c437a8524cff4a88245c5efbf (patch) | |
tree | 842f8d0e79218859bb2afcb08250a10b9b3509f8 | |
parent | 22f4ed918d99c17cd3bb8890eeaac173060394bf (diff) | |
download | lilv-1e7b27c7b322476c437a8524cff4a88245c5efbf.tar.gz lilv-1e7b27c7b322476c437a8524cff4a88245c5efbf.tar.bz2 lilv-1e7b27c7b322476c437a8524cff4a88245c5efbf.zip |
LilvValue => LilvNode.
git-svn-id: http://svn.drobilla.net/lad/trunk/lilv@3234 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r-- | lilv/lilv.h | 216 | ||||
-rw-r--r-- | lilv/lilvmm.hpp | 130 | ||||
-rw-r--r-- | src/collections.c | 28 | ||||
-rw-r--r-- | src/instance.c | 12 | ||||
-rw-r--r-- | src/lilv_internal.h | 88 | ||||
-rw-r--r-- | src/plugin.c | 234 | ||||
-rw-r--r-- | src/pluginclass.c | 22 | ||||
-rw-r--r-- | src/port.c | 98 | ||||
-rw-r--r-- | src/query.c | 26 | ||||
-rw-r--r-- | src/scalepoint.c | 10 | ||||
-rw-r--r-- | src/ui.c | 46 | ||||
-rw-r--r-- | src/value.c | 110 | ||||
-rw-r--r-- | src/world.c | 126 | ||||
-rw-r--r-- | swig/lilv.i | 2 | ||||
-rw-r--r-- | test/lilv_test.c | 522 | ||||
-rw-r--r-- | utils/lv2_inspect.c | 184 | ||||
-rw-r--r-- | utils/lv2_jack_host.c | 44 | ||||
-rw-r--r-- | utils/lv2_list.c | 8 |
18 files changed, 949 insertions, 957 deletions
diff --git a/lilv/lilv.h b/lilv/lilv.h index 9631efe..0f3e998 100644 --- a/lilv/lilv.h +++ b/lilv/lilv.h @@ -62,7 +62,7 @@ typedef struct LilvPluginClassImpl LilvPluginClass; /**< Plugin Class. */ typedef struct LilvPortImpl LilvPort; /**< Port. */ typedef struct LilvScalePointImpl LilvScalePoint; /**< Scale Point (Notch). */ typedef struct LilvUIImpl LilvUI; /**< Plugin UI. */ -typedef struct LilvValueImpl LilvValue; /**< Typed Value. */ +typedef struct LilvNodeImpl LilvNode; /**< Typed Value. */ typedef struct LilvWorldImpl LilvWorld; /**< Lilv World. */ typedef struct LilvInstanceImpl LilvInstance; /**< Plugin instance. */ @@ -71,7 +71,7 @@ typedef void LilvPluginClasses; /**< set<PluginClass>. */ typedef void LilvPlugins; /**< set<Plugin>. */ typedef void LilvScalePoints; /**< set<ScalePoint>. */ typedef void LilvUIs; /**< set<UI>. */ -typedef void LilvValues; /**< set<Value>. */ +typedef void LilvNodes; /**< set<Value>. */ /** @defgroup lilv Lilv @@ -99,64 +99,64 @@ lilv_uri_to_path(const char* uri); /** Create a new URI value. - Returned value must be freed by caller with lilv_value_free. + Returned value must be freed by caller with lilv_node_free. */ LILV_API -LilvValue* +LilvNode* lilv_new_uri(LilvWorld* world, const char* uri); /** Create a new string value (with no language). - Returned value must be freed by caller with lilv_value_free. + Returned value must be freed by caller with lilv_node_free. */ LILV_API -LilvValue* +LilvNode* lilv_new_string(LilvWorld* world, const char* str); /** Create a new integer value. - Returned value must be freed by caller with lilv_value_free. + Returned value must be freed by caller with lilv_node_free. */ LILV_API -LilvValue* +LilvNode* lilv_new_int(LilvWorld* world, int val); /** Create a new floating point value. - Returned value must be freed by caller with lilv_value_free. + Returned value must be freed by caller with lilv_node_free. */ LILV_API -LilvValue* +LilvNode* lilv_new_float(LilvWorld* world, float val); /** Create a new boolean value. - Returned value must be freed by caller with lilv_value_free. + Returned value must be freed by caller with lilv_node_free. */ LILV_API -LilvValue* +LilvNode* lilv_new_bool(LilvWorld* world, bool val); /** - Free an LilvValue. + Free an LilvNode. */ LILV_API void -lilv_value_free(LilvValue* val); +lilv_node_free(LilvNode* val); /** - Duplicate an LilvValue. + Duplicate an LilvNode. */ LILV_API -LilvValue* -lilv_value_duplicate(const LilvValue* val); +LilvNode* +lilv_node_duplicate(const LilvNode* val); /** Return whether two values are equivalent. */ LILV_API bool -lilv_value_equals(const LilvValue* value, const LilvValue* other); +lilv_node_equals(const LilvNode* value, const LilvNode* other); /** Return this value as a Turtle/SPARQL token. @@ -173,39 +173,39 @@ lilv_value_equals(const LilvValue* value, const LilvValue* other); */ LILV_API char* -lilv_value_get_turtle_token(const LilvValue* value); +lilv_node_get_turtle_token(const LilvNode* value); /** Return whether the value is a URI (resource). */ LILV_API bool -lilv_value_is_uri(const LilvValue* value); +lilv_node_is_uri(const LilvNode* value); /** Return this value as a URI string, e.g. "http://example.org/foo". - Valid to call only if lilv_value_is_uri(@a value) returns true. + Valid to call only if lilv_node_is_uri(@a value) returns true. Returned value is owned by @a value and must not be freed by caller. */ LILV_API const char* -lilv_value_as_uri(const LilvValue* value); +lilv_node_as_uri(const LilvNode* value); /** Return whether the value is a blank node (resource with no URI). */ LILV_API bool -lilv_value_is_blank(const LilvValue* value); +lilv_node_is_blank(const LilvNode* value); /** Return this value as a blank node identifier, e.g. "genid03". - Valid to call only if lilv_value_is_blank(@a value) returns true. + Valid to call only if lilv_node_is_blank(@a value) returns true. Returned value is owned by @a value and must not be freed by caller. */ LILV_API const char* -lilv_value_as_blank(const LilvValue* value); +lilv_node_as_blank(const LilvNode* value); /** Return whether this value is a literal (i.e. not a URI). @@ -213,7 +213,7 @@ lilv_value_as_blank(const LilvValue* value); */ LILV_API bool -lilv_value_is_literal(const LilvValue* value); +lilv_node_is_literal(const LilvNode* value); /** Return whether this value is a string literal. @@ -221,60 +221,60 @@ lilv_value_is_literal(const LilvValue* value); */ LILV_API bool -lilv_value_is_string(const LilvValue* value); +lilv_node_is_string(const LilvNode* value); /** Return @a value as a string. */ LILV_API const char* -lilv_value_as_string(const LilvValue* value); +lilv_node_as_string(const LilvNode* value); /** Return whether this value is a decimal literal. */ LILV_API bool -lilv_value_is_float(const LilvValue* value); +lilv_node_is_float(const LilvNode* value); /** Return @a value as a float. - Valid to call only if lilv_value_is_float(@a value) or - lilv_value_is_int(@a value) returns true. + Valid to call only if lilv_node_is_float(@a value) or + lilv_node_is_int(@a value) returns true. */ LILV_API float -lilv_value_as_float(const LilvValue* value); +lilv_node_as_float(const LilvNode* value); /** Return whether this value is an integer literal. */ LILV_API bool -lilv_value_is_int(const LilvValue* value); +lilv_node_is_int(const LilvNode* value); /** Return @a value as an integer. - Valid to call only if lilv_value_is_int(@a value) returns true. + Valid to call only if lilv_node_is_int(@a value) returns true. */ LILV_API int -lilv_value_as_int(const LilvValue* value); +lilv_node_as_int(const LilvNode* value); /** Return whether this value is a boolean. */ LILV_API bool -lilv_value_is_bool(const LilvValue* value); +lilv_node_is_bool(const LilvNode* value); /** Return @a value as a bool. - Valid to call only if lilv_value_is_bool(@a value) returns true. + Valid to call only if lilv_node_is_bool(@a value) returns true. */ LILV_API bool -lilv_value_as_bool(const LilvValue* value); +lilv_node_as_bool(const LilvNode* value); /** @} @@ -284,7 +284,7 @@ lilv_value_as_bool(const LilvValue* value); <li>LilvPlugins (function prefix "lilv_plugins_")</li> <li>LilvPluginClasses (function prefix "lilv_plugin_classes_")</li> <li>LilvScalePoints (function prefix "lilv_scale_points_")</li> - <li>LilvValues (function prefix "lilv_values_")</li> + <li>LilvNodes (function prefix "lilv_nodes_")</li> <li>LilvUIs (function prefix "lilv_uis_")</li> </ul> @@ -348,7 +348,7 @@ lilv_plugin_classes_is_end(const LilvPluginClasses* collection, LilvIter* i); LILV_API const LilvPluginClass* lilv_plugin_classes_get_by_uri(const LilvPluginClasses* classes, - const LilvValue* uri); + const LilvNode* uri); /* ScalePoints */ @@ -411,44 +411,44 @@ lilv_uis_is_end(const LilvUIs* collection, LilvIter* i); LILV_API const LilvUI* lilv_uis_get_by_uri(const LilvUIs* uis, - const LilvValue* uri); + const LilvNode* uri); /* Values */ LILV_API void -lilv_values_free(LilvValues* collection); +lilv_nodes_free(LilvNodes* collection); LILV_API unsigned -lilv_values_size(const LilvValues* collection); +lilv_nodes_size(const LilvNodes* collection); LILV_API LilvIter* -lilv_values_begin(const LilvValues* collection); +lilv_nodes_begin(const LilvNodes* collection); LILV_API -const LilvValue* -lilv_values_get(const LilvValues* collection, LilvIter* i); +const LilvNode* +lilv_nodes_get(const LilvNodes* collection, LilvIter* i); LILV_API LilvIter* -lilv_values_next(const LilvValues* collection, LilvIter* i); +lilv_nodes_next(const LilvNodes* collection, LilvIter* i); LILV_API bool -lilv_values_is_end(const LilvValues* collection, LilvIter* i); +lilv_nodes_is_end(const LilvNodes* collection, LilvIter* i); LILV_API -LilvValue* -lilv_values_get_first(const LilvValues* collection); +LilvNode* +lilv_nodes_get_first(const LilvNodes* collection); /** Return whether @a values contains @a value. */ LILV_API bool -lilv_values_contains(const LilvValues* values, const LilvValue* value); +lilv_nodes_contains(const LilvNodes* values, const LilvNode* value); /* Plugins */ @@ -481,7 +481,7 @@ lilv_plugins_is_end(const LilvPlugins* collection, LilvIter* i); LILV_API const LilvPlugin* lilv_plugins_get_by_uri(const LilvPlugins* plugins, - const LilvValue* uri); + const LilvNode* uri); /** @} @@ -527,7 +527,7 @@ LILV_API void lilv_world_set_option(LilvWorld* world, const char* uri, - const LilvValue* value); + const LilvNode* value); /** Destroy the world, mwahaha. @@ -569,7 +569,7 @@ lilv_world_load_all(LilvWorld* world); LILV_API void lilv_world_load_bundle(LilvWorld* world, - LilvValue* bundle_uri); + LilvNode* bundle_uri); /** Get the parent of all other plugin classes, lv2:Plugin. @@ -636,7 +636,7 @@ lilv_plugin_verify(const LilvPlugin* plugin); @return A shared URI value which must not be modified or freed. */ LILV_API -const LilvValue* +const LilvNode* lilv_plugin_get_uri(const LilvPlugin* plugin); /** @@ -651,7 +651,7 @@ lilv_plugin_get_uri(const LilvPlugin* plugin); @return a shared string which must not be modified or freed. */ LILV_API -const LilvValue* +const LilvNode* lilv_plugin_get_bundle_uri(const LilvPlugin* plugin); /** @@ -663,7 +663,7 @@ lilv_plugin_get_bundle_uri(const LilvPlugin* plugin); which is shared and must not be modified or freed. */ LILV_API -const LilvValues* +const LilvNodes* lilv_plugin_get_data_uris(const LilvPlugin* plugin); /** @@ -673,7 +673,7 @@ lilv_plugin_get_data_uris(const LilvPlugin* plugin); @return a shared string which must not be modified or freed. */ LILV_API -const LilvValue* +const LilvNode* lilv_plugin_get_library_uri(const LilvPlugin* plugin); /** @@ -684,7 +684,7 @@ lilv_plugin_get_library_uri(const LilvPlugin* plugin); Returned value must be freed by the caller. */ LILV_API -LilvValue* +LilvNode* lilv_plugin_get_name(const LilvPlugin* plugin); /** @@ -703,13 +703,13 @@ lilv_plugin_get_class(const LilvPlugin* plugin); <code><plugin-uri> predicate ?object</code> May return NULL if the property was not found, or if object(s) is not - sensibly represented as an LilvValues (e.g. blank nodes). - Return value must be freed by caller with lilv_values_free. + sensibly represented as an LilvNodes (e.g. blank nodes). + Return value must be freed by caller with lilv_nodes_free. */ LILV_API -LilvValues* +LilvNodes* lilv_plugin_get_value(const LilvPlugin* p, - const LilvValue* predicate); + const LilvNode* predicate); /** Get a value associated with some subject in a plugin's data files. @@ -723,14 +723,14 @@ lilv_plugin_get_value(const LilvPlugin* p, (if information about it is contained in the plugin's data files). May return NULL if the property was not found, or if object is not - sensibly represented as an LilvValues (e.g. blank nodes). - Return value must be freed by caller with lilv_values_free. + sensibly represented as an LilvNodes (e.g. blank nodes). + Return value must be freed by caller with lilv_nodes_free. */ LILV_API -LilvValues* +LilvNodes* lilv_plugin_get_value_for_subject(const LilvPlugin* p, - const LilvValue* subject_uri, - const LilvValue* predicate_uri); + const LilvNode* subject_uri, + const LilvNode* predicate_uri); /** Return whether a feature is supported by a plugin. @@ -740,7 +740,7 @@ lilv_plugin_get_value_for_subject(const LilvPlugin* p, LILV_API bool lilv_plugin_has_feature(const LilvPlugin* p, - const LilvValue* feature_uri); + const LilvNode* feature_uri); /** Get the LV2 Features supported (required or optionally) by a plugin. @@ -750,10 +750,10 @@ lilv_plugin_has_feature(const LilvPlugin* p, probably shouldn't be used by normal hosts. Using lilv_plugin_get_optional_features and lilv_plugin_get_required_features separately is best in most cases. - Returned value must be freed by caller with lilv_values_free. + Returned value must be freed by caller with lilv_nodes_free. */ LILV_API -LilvValues* +LilvNodes* lilv_plugin_get_supported_features(const LilvPlugin* p); /** @@ -765,10 +765,10 @@ lilv_plugin_get_supported_features(const LilvPlugin* p); (along with data, if necessary, as defined by the feature specification) or plugin instantiation will fail. - Return value must be freed by caller with lilv_values_free. + Return value must be freed by caller with lilv_nodes_free. */ LILV_API -LilvValues* +LilvNodes* lilv_plugin_get_required_features(const LilvPlugin* p); /** @@ -777,10 +777,10 @@ lilv_plugin_get_required_features(const LilvPlugin* p); MUST operate (at least somewhat) if they are instantiated without being passed optional features. - Return value must be freed by caller with lilv_values_free. + Return value must be freed by caller with lilv_nodes_free. */ LILV_API -LilvValues* +LilvNodes* lilv_plugin_get_optional_features(const LilvPlugin* p); /** @@ -820,7 +820,7 @@ lilv_plugin_get_port_ranges_float(const LilvPlugin* p, LILV_API uint32_t lilv_plugin_get_num_ports_of_class(const LilvPlugin* p, - const LilvValue* class_1, ...); + const LilvNode* class_1, ...); /** Return whether or not the plugin introduces (and reports) latency. @@ -860,7 +860,7 @@ lilv_plugin_get_port_by_index(const LilvPlugin* plugin, LILV_API const LilvPort* lilv_plugin_get_port_by_symbol(const LilvPlugin* plugin, - const LilvValue* symbol); + const LilvNode* symbol); /** Get the full name of the plugin's author. @@ -868,7 +868,7 @@ lilv_plugin_get_port_by_symbol(const LilvPlugin* plugin, Returned value must be freed by caller. */ LILV_API -LilvValue* +LilvNode* lilv_plugin_get_author_name(const LilvPlugin* plugin); /** @@ -877,7 +877,7 @@ lilv_plugin_get_author_name(const LilvPlugin* plugin); Returned value must be freed by caller. */ LILV_API -LilvValue* +LilvNode* lilv_plugin_get_author_email(const LilvPlugin* plugin); /** @@ -886,7 +886,7 @@ lilv_plugin_get_author_email(const LilvPlugin* plugin); Returned value must be freed by caller. */ LILV_API -LilvValue* +LilvNode* lilv_plugin_get_author_homepage(const LilvPlugin* plugin); /** @@ -909,16 +909,16 @@ lilv_plugin_is_replaced(const LilvPlugin* plugin); Port analog of lilv_plugin_get_value. */ LILV_API -LilvValues* +LilvNodes* lilv_port_get_value(const LilvPlugin* plugin, const LilvPort* port, - const LilvValue* predicate); + const LilvNode* predicate); /** Return the LV2 port properties of a port. */ LILV_API -LilvValues* +LilvNodes* lilv_port_get_properties(const LilvPlugin* plugin, const LilvPort* port); @@ -929,7 +929,7 @@ LILV_API bool lilv_port_has_property(const LilvPlugin* p, const LilvPort* port, - const LilvValue* property_uri); + const LilvNode* property_uri); /** Return whether a port is an event port and supports a certain event type. @@ -938,7 +938,7 @@ LILV_API bool lilv_port_supports_event(const LilvPlugin* p, const LilvPort* port, - const LilvValue* event_uri); + const LilvNode* event_uri); /** Get the symbol of a port. @@ -946,7 +946,7 @@ lilv_port_supports_event(const LilvPlugin* p, Returned value is owned by @a port and must not be freed. */ LILV_API -const LilvValue* +const LilvNode* lilv_port_get_symbol(const LilvPlugin* plugin, const LilvPort* port); @@ -957,7 +957,7 @@ lilv_port_get_symbol(const LilvPlugin* plugin, the caller. */ LILV_API -LilvValue* +LilvNode* lilv_port_get_name(const LilvPlugin* plugin, const LilvPort* port); @@ -969,14 +969,14 @@ lilv_port_get_name(const LilvPlugin* plugin, Returned value is shared and must not be destroyed by caller. */ LILV_API -const LilvValues* +const LilvNodes* lilv_port_get_classes(const LilvPlugin* plugin, const LilvPort* port); /** Determine if a port is of a given class (input, output, audio, etc). For convenience/performance/extensibility reasons, hosts are expected to - create an LilvValue for each port class they "care about". Well-known type + create an LilvNode for each port class they "care about". Well-known type URI strings are defined (e.g. LILV_PORT_CLASS_INPUT) for convenience, but this function is designed so that Lilv is usable with any port types without requiring explicit support in Lilv. @@ -985,23 +985,23 @@ LILV_API bool lilv_port_is_a(const LilvPlugin* plugin, const LilvPort* port, - const LilvValue* port_class); + const LilvNode* port_class); /** Get the default, minimum, and maximum values of a port. @a def, @a min, and @a max are outputs, pass pointers to uninitialized - LilvValue* variables. These will be set to point at new values (which must - be freed by the caller using lilv_value_free), or NULL if the value does not + LilvNode* variables. These will be set to point at new values (which must + be freed by the caller using lilv_node_free), or NULL if the value does not exist. */ LILV_API void lilv_port_get_range(const LilvPlugin* plugin, const LilvPort* port, - LilvValue** deflt, - LilvValue** min, - LilvValue** max); + LilvNode** deflt, + LilvNode** min, + LilvNode** max); /** Get the scale points (enumeration values) of a port. @@ -1026,7 +1026,7 @@ lilv_port_get_scale_points(const LilvPlugin* plugin, Returned value is owned by @a point and must not be freed. */ LILV_API -const LilvValue* +const LilvNode* lilv_scale_point_get_label(const LilvScalePoint* point); /** @@ -1034,7 +1034,7 @@ lilv_scale_point_get_label(const LilvScalePoint* point); Returned value is owned by @a point and must not be freed. */ LILV_API -const LilvValue* +const LilvNode* lilv_scale_point_get_value(const LilvScalePoint* point); /** @@ -1049,7 +1049,7 @@ lilv_scale_point_get_value(const LilvScalePoint* point); Returned value may be NULL, if class has no parent. */ LILV_API -const LilvValue* +const LilvNode* lilv_plugin_class_get_parent_uri(const LilvPluginClass* plugin_class); /** @@ -1057,7 +1057,7 @@ lilv_plugin_class_get_parent_uri(const LilvPluginClass* plugin_class); Returned value is owned by @a plugin_class and must not be freed by caller. */ LILV_API -const LilvValue* +const LilvNode* lilv_plugin_class_get_uri(const LilvPluginClass* plugin_class); /** @@ -1065,7 +1065,7 @@ lilv_plugin_class_get_uri(const LilvPluginClass* plugin_class); Returned value is owned by @a plugin_class and must not be freed by caller. */ LILV_API -const LilvValue* +const LilvNode* lilv_plugin_class_get_label(const LilvPluginClass* plugin_class); /** @@ -1252,7 +1252,7 @@ lilv_plugin_get_uis(const LilvPlugin* plugin); @return a shared value which must not be modified or freed. */ LILV_API -const LilvValue* +const LilvNode* lilv_ui_get_uri(const LilvUI* ui); /** @@ -1264,7 +1264,7 @@ lilv_ui_get_uri(const LilvUI* ui); UI type, avoding the need to use this function (and type specific logic). */ LILV_API -const LilvValues* +const LilvNodes* lilv_ui_get_classes(const LilvUI* ui); /** @@ -1274,7 +1274,7 @@ lilv_ui_get_classes(const LilvUI* ui); */ LILV_API bool -lilv_ui_is_a(const LilvUI* ui, const LilvValue* class_uri); +lilv_ui_is_a(const LilvUI* ui, const LilvNode* class_uri); /** Function to determine whether a UI type is supported. @@ -1291,15 +1291,15 @@ typedef unsigned (*LilvUISupportedFunc)(const char* container_type_uri, @param supported_func User provided supported predicate. @param container_type The widget type to host the UI within. @param ui_type (Output) If non-NULL, set to the native type of the UI - which the caller must free with lilv_value_free. + which the caller must free with lilv_node_free. @return The embedding quality level returned by @c supported_func. */ LILV_API unsigned lilv_ui_is_supported(const LilvUI* ui, LilvUISupportedFunc supported_func, - const LilvValue* container_type, - const LilvValue** ui_type); + const LilvNode* container_type, + const LilvNode** ui_type); /** Get the URI for a Plugin UI's bundle. @@ -1307,7 +1307,7 @@ lilv_ui_is_supported(const LilvUI* ui, @return a shared value which must not be modified or freed. */ LILV_API -const LilvValue* +const LilvNode* lilv_ui_get_bundle_uri(const LilvUI* ui); /** @@ -1316,7 +1316,7 @@ lilv_ui_get_bundle_uri(const LilvUI* ui); @return a shared value which must not be modified or freed. */ LILV_API -const LilvValue* +const LilvNode* lilv_ui_get_binary_uri(const LilvUI* ui); /** diff --git a/lilv/lilvmm.hpp b/lilv/lilvmm.hpp index b2fe293..9a256b0 100644 --- a/lilv/lilvmm.hpp +++ b/lilv/lilvmm.hpp @@ -48,44 +48,44 @@ const char* uri_to_path(const char* uri) { return lilv_uri_to_path(uri); } #define LILV_WRAP_CONVERSION(CT) #endif -struct Value { - inline Value(const LilvValue* value) : me(lilv_value_duplicate(value)) {} - inline Value(const Value& copy) : me(lilv_value_duplicate(copy.me)) {} +struct Node { + inline Node(const LilvNode* node) : me(lilv_node_duplicate(node)) {} + inline Node(const Node& copy) : me(lilv_node_duplicate(copy.me)) {} - inline ~Value() { lilv_value_free(me); } + inline ~Node() { lilv_node_free(me); } - inline bool equals(const Value& other) const { - return lilv_value_equals(me, other.me); + inline bool equals(const Node& other) const { + return lilv_node_equals(me, other.me); } - inline bool operator==(const Value& other) const { return equals(other); } - - LILV_WRAP_CONVERSION(LilvValue); - - LILV_WRAP0(char*, value, get_turtle_token); - LILV_WRAP0(bool, value, is_uri); - LILV_WRAP0(const char*, value, as_uri); - LILV_WRAP0(bool, value, is_blank); - LILV_WRAP0(const char*, value, as_blank); - LILV_WRAP0(bool, value, is_literal); - LILV_WRAP0(bool, value, is_string); - LILV_WRAP0(const char*, value, as_string); - LILV_WRAP0(bool, value, is_float); - LILV_WRAP0(float, value, as_float); - LILV_WRAP0(bool, value, is_int); - LILV_WRAP0(int, value, as_int); - LILV_WRAP0(bool, value, is_bool); - LILV_WRAP0(bool, value, as_bool); - - LilvValue* me; + inline bool operator==(const Node& other) const { return equals(other); } + + LILV_WRAP_CONVERSION(LilvNode); + + 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; }; struct ScalePoint { inline ScalePoint(const LilvScalePoint* c_obj) : me(c_obj) {} LILV_WRAP_CONVERSION(const LilvScalePoint); - LILV_WRAP0(const LilvValue*, scale_point, get_label); - LILV_WRAP0(const LilvValue*, scale_point, get_value); + LILV_WRAP0(const LilvNode*, scale_point, get_label); + LILV_WRAP0(const LilvNode*, scale_point, get_value); const LilvScalePoint* me; }; @@ -94,9 +94,9 @@ struct PluginClass { inline PluginClass(const LilvPluginClass* c_obj) : me(c_obj) {} LILV_WRAP_CONVERSION(const LilvPluginClass); - LILV_WRAP0(Value, plugin_class, get_parent_uri); - LILV_WRAP0(Value, plugin_class, get_uri); - LILV_WRAP0(Value, plugin_class, get_label); + LILV_WRAP0(Node, plugin_class, get_parent_uri); + LILV_WRAP0(Node, plugin_class, get_uri); + LILV_WRAP0(Node, plugin_class, get_label); inline LilvPluginClasses* get_children() { return lilv_plugin_class_get_children(me); @@ -116,7 +116,7 @@ struct PluginClass { LILV_WRAP_COLL(PluginClasses, PluginClass, plugin_classes); LILV_WRAP_COLL(ScalePoints, ScalePoint, scale_points); -LILV_WRAP_COLL(Values, Value, values); +LILV_WRAP_COLL(Nodes, Node, nodes); struct Plugins { inline Plugins(const LilvPlugins* c_obj) : me(c_obj) {} @@ -129,26 +129,26 @@ struct World { inline World() : me(lilv_world_new()) {} inline ~World() { /*lilv_world_free(me);*/ } - inline LilvValue* new_uri(const char* uri) { + inline LilvNode* new_uri(const char* uri) { return lilv_new_uri(me, uri); } - inline LilvValue* new_string(const char* str) { + inline LilvNode* new_string(const char* str) { return lilv_new_string(me, str); } - inline LilvValue* new_int(int val) { + inline LilvNode* new_int(int val) { return lilv_new_int(me, val); } - inline LilvValue* new_float(float val) { + inline LilvNode* new_float(float val) { return lilv_new_float(me, val); } - inline LilvValue* new_bool(bool val) { + inline LilvNode* new_bool(bool val) { return lilv_new_bool(me, val); } - LILV_WRAP2_VOID(world, set_option, const char*, uri, LilvValue*, value); + LILV_WRAP2_VOID(world, set_option, const char*, uri, LilvNode*, value); LILV_WRAP0_VOID(world, free); LILV_WRAP0_VOID(world, load_all); - LILV_WRAP1_VOID(world, load_bundle, LilvValue*, bundle_uri); + LILV_WRAP1_VOID(world, load_bundle, LilvNode*, bundle_uri); LILV_WRAP0(const LilvPluginClass*, world, get_plugin_class); LILV_WRAP0(const LilvPluginClasses*, world, get_plugin_classes); LILV_WRAP0(Plugins, world, get_all_plugins); @@ -167,14 +167,14 @@ struct Port { #define LILV_PORT_WRAP1(RT, name, T1, a1) \ inline RT name (T1 a1) { return lilv_port_ ## name (parent, me, a1); } - LILV_PORT_WRAP1(LilvValues*, get_value, LilvValue*, predicate); - LILV_PORT_WRAP0(LilvValues*, get_properties) - LILV_PORT_WRAP1(bool, has_property, LilvValue*, property_uri); - LILV_PORT_WRAP1(bool, supports_event, LilvValue*, event_uri); - LILV_PORT_WRAP0(const LilvValue*, get_symbol); - LILV_PORT_WRAP0(LilvValue*, get_name); - LILV_PORT_WRAP0(const LilvValues*, get_classes); - LILV_PORT_WRAP1(bool, is_a, LilvValue*, port_class); + LILV_PORT_WRAP1(LilvNodes*, get_value, LilvNode*, predicate); + LILV_PORT_WRAP0(LilvNodes*, get_properties) + LILV_PORT_WRAP1(bool, has_property, LilvNode*, property_uri); + LILV_PORT_WRAP1(bool, supports_event, LilvNode*, event_uri); + LILV_PORT_WRAP0(const LilvNode*, get_symbol); + LILV_PORT_WRAP0(LilvNode*, get_name); + LILV_PORT_WRAP0(const LilvNodes*, get_classes); + LILV_PORT_WRAP1(bool, is_a, LilvNode*, port_class); LILV_PORT_WRAP0(LilvScalePoints*, get_scale_points); // TODO: get_range (output parameters) @@ -188,31 +188,31 @@ struct Plugin { LILV_WRAP_CONVERSION(const LilvPlugin); LILV_WRAP0(bool, plugin, verify); - LILV_WRAP0(Value, plugin, get_uri); - LILV_WRAP0(Value, plugin, get_bundle_uri); - LILV_WRAP0(Values, plugin, get_data_uris); - LILV_WRAP0(Value, plugin, get_library_uri); - LILV_WRAP0(Value, plugin, get_name); + LILV_WRAP0(Node, plugin, get_uri); + LILV_WRAP0(Node, plugin, get_bundle_uri); + LILV_WRAP0(Nodes, plugin, get_data_uris); + LILV_WRAP0(Node, plugin, get_library_uri); + LILV_WRAP0(Node, plugin, get_name); LILV_WRAP0(PluginClass, plugin, get_class); - LILV_WRAP1(Values, plugin, get_value, Value, pred); - LILV_WRAP2(Values, plugin, get_value_for_subject, Value, subject, - Value, predicate); - LILV_WRAP1(bool, plugin, has_feature, Value, feature_uri); - LILV_WRAP0(Values, plugin, get_supported_features); - LILV_WRAP0(Values, plugin, get_required_features); - LILV_WRAP0(Values, plugin, get_optional_features); + LILV_WRAP1(Nodes, plugin, get_value, Node, pred); + LILV_WRAP2(Nodes, plugin, get_value_for_subject, Node, subject, + Node, predicate); + LILV_WRAP1(bool, plugin, has_feature, Node, feature_uri); + LILV_WRAP0(Nodes, plugin, get_supported_features); + LILV_WRAP0(Nodes, plugin, get_required_features); + LILV_WRAP0(Nodes, plugin, get_optional_features); LILV_WRAP0(unsigned, plugin, get_num_ports); LILV_WRAP0(bool, plugin, has_latency); LILV_WRAP0(unsigned, plugin, get_latency_port_index); - LILV_WRAP0(Value, plugin, get_author_name); - LILV_WRAP0(Value, plugin, get_author_email); - LILV_WRAP0(Value, plugin, get_author_homepage); + LILV_WRAP0(Node, plugin, get_author_name); + LILV_WRAP0(Node, plugin, get_author_email); + LILV_WRAP0(Node, plugin, get_author_homepage); inline Port get_port_by_index(unsigned index) { return Port(me, lilv_plugin_get_port_by_index(me, index)); } - inline Port get_port_by_symbol(LilvValue* symbol) { + inline Port get_port_by_symbol(LilvNode* symbol) { return Port(me, lilv_plugin_get_port_by_symbol(me, symbol)); } @@ -223,8 +223,8 @@ struct Plugin { me, min_values, max_values, def_values); } - inline unsigned get_num_ports_of_class(LilvValue* class_1, - LilvValue* class_2) { + inline unsigned get_num_ports_of_class(LilvNode* class_1, + LilvNode* class_2) { // TODO: varargs return lilv_plugin_get_num_ports_of_class(me, class_1, class_2, NULL); } diff --git a/src/collections.c b/src/collections.c index 58207f9..11f3bfc 100644 --- a/src/collections.c +++ b/src/collections.c @@ -60,10 +60,10 @@ lilv_scale_points_new(void) return lilv_collection_new((GDestroyNotify)lilv_scale_point_free); } -LilvValues* -lilv_values_new(void) +LilvNodes* +lilv_nodes_new(void) { - return lilv_collection_new((GDestroyNotify)lilv_value_free); + return lilv_collection_new((GDestroyNotify)lilv_node_free); } LilvUIs* @@ -82,14 +82,14 @@ lilv_plugin_classes_new(void) LILV_API const LilvPluginClass* -lilv_plugin_classes_get_by_uri(const LilvPluginClasses* coll, const LilvValue* uri) +lilv_plugin_classes_get_by_uri(const LilvPluginClasses* coll, const LilvNode* uri) { return (LilvPluginClass*)lilv_sequence_get_by_uri(coll, uri); } LILV_API const LilvUI* -lilv_uis_get_by_uri(const LilvUIs* coll, const LilvValue* uri) +lilv_uis_get_by_uri(const LilvUIs* coll, const LilvNode* uri) { return (LilvUI*)lilv_sequence_get_by_uri((LilvUIs*)coll, uri); } @@ -104,7 +104,7 @@ lilv_plugins_new() LILV_API const LilvPlugin* -lilv_plugins_get_by_uri(const LilvPlugins* list, const LilvValue* uri) +lilv_plugins_get_by_uri(const LilvPlugins* list, const LilvNode* uri) { return (LilvPlugin*)lilv_sequence_get_by_uri((LilvPlugins*)list, uri); } @@ -113,10 +113,10 @@ lilv_plugins_get_by_uri(const LilvPlugins* list, const LilvValue* uri) LILV_API bool -lilv_values_contains(const LilvValues* list, const LilvValue* value) +lilv_nodes_contains(const LilvNodes* list, const LilvNode* value) { - LILV_FOREACH(values, i, list) - if (lilv_value_equals(lilv_values_get(list, i), value)) + LILV_FOREACH(nodes, i, list) + if (lilv_node_equals(lilv_nodes_get(list, i), value)) return true; return false; @@ -170,7 +170,7 @@ prefix##_is_end(const CT* collection, LilvIter* i) { \ LILV_COLLECTION_IMPL(lilv_plugin_classes, LilvPluginClasses, LilvPluginClass) LILV_COLLECTION_IMPL(lilv_scale_points, LilvScalePoints, LilvScalePoint) LILV_COLLECTION_IMPL(lilv_uis, LilvUIs, LilvUI) -LILV_COLLECTION_IMPL(lilv_values, LilvValues, LilvValue) +LILV_COLLECTION_IMPL(lilv_nodes, LilvNodes, LilvNode) LILV_COLLECTION_IMPL(lilv_plugins, LilvPlugins, LilvPlugin) LILV_API @@ -193,13 +193,13 @@ lilv_uis_free(LilvUIs* collection) { LILV_API void -lilv_values_free(LilvValues* collection) { +lilv_nodes_free(LilvNodes* collection) { lilv_collection_free(collection); } LILV_API -LilvValue* -lilv_values_get_first(const LilvValues* collection) { - return (LilvValue*)lilv_collection_get(collection, +LilvNode* +lilv_nodes_get_first(const LilvNodes* collection) { + return (LilvNode*)lilv_collection_get(collection, lilv_collection_begin(collection)); } diff --git a/src/instance.c b/src/instance.c index 55e0f99..9f99534 100644 --- a/src/instance.c +++ b/src/instance.c @@ -37,7 +37,7 @@ lilv_plugin_instantiate(const LilvPlugin* plugin, local_features[0] = NULL; } - const char* const lib_uri = lilv_value_as_uri(lilv_plugin_get_library_uri(plugin)); + const char* const lib_uri = lilv_node_as_uri(lilv_plugin_get_library_uri(plugin)); const char* const lib_path = lilv_uri_to_path(lib_uri); if (!lib_path) @@ -61,20 +61,20 @@ lilv_plugin_instantiate(const LilvPlugin* plugin, } else { // Search for plugin by URI - const char* bundle_path = lilv_uri_to_path(lilv_value_as_uri( + const char* bundle_path = lilv_uri_to_path(lilv_node_as_uri( lilv_plugin_get_bundle_uri(plugin))); for (uint32_t i = 0; true; ++i) { const LV2_Descriptor* ld = df(i); if (!ld) { LILV_ERRORF("Did not find plugin %s in %s\n", - lilv_value_as_uri(lilv_plugin_get_uri(plugin)), lib_path); + lilv_node_as_uri(lilv_plugin_get_uri(plugin)), lib_path); dlclose(lib); break; // return NULL } else { // Parse bundle URI to use as base URI - const LilvValue* bundle_uri = lilv_plugin_get_bundle_uri(plugin); - const char* bundle_uri_str = lilv_value_as_uri(bundle_uri); + const LilvNode* bundle_uri = lilv_plugin_get_bundle_uri(plugin); + const char* bundle_uri_str = lilv_node_as_uri(bundle_uri); SerdURI base_uri; if (!serd_uri_parse((const uint8_t*)bundle_uri_str, &base_uri)) { dlclose(lib); @@ -92,7 +92,7 @@ lilv_plugin_instantiate(const LilvPlugin* plugin, } if (!strcmp((const char*)abs_uri_node.buf, - lilv_value_as_uri(lilv_plugin_get_uri(plugin)))) { + lilv_node_as_uri(lilv_plugin_get_uri(plugin)))) { // Create LilvInstance to return result = malloc(sizeof(struct LilvInstanceImpl)); result->lv2_descriptor = ld; diff --git a/src/lilv_internal.h b/src/lilv_internal.h index 774f5fd..78b377d 100644 --- a/src/lilv_internal.h +++ b/src/lilv_internal.h @@ -83,8 +83,8 @@ lilv_match_end(SordIter* iter) /** Reference to a port on some plugin. */ struct LilvPortImpl { uint32_t index; ///< lv2:index - LilvValue* symbol; ///< lv2:symbol - LilvValues* classes; ///< rdf:type + LilvNode* symbol; ///< lv2:symbol + LilvNodes* classes; ///< rdf:type }; LilvPort* lilv_port_new(LilvWorld* world, uint32_t index, const char* symbol); @@ -95,7 +95,7 @@ void lilv_port_free(LilvPort* port); struct LilvSpecImpl { SordNode* spec; SordNode* bundle; - LilvValues* data_uris; + LilvNodes* data_uris; }; typedef struct LilvSpecImpl LilvSpec; @@ -108,7 +108,7 @@ typedef struct LilvSpecImpl LilvSpec; */ struct LilvHeader { LilvWorld* world; - LilvValue* uri; + LilvNode* uri; }; /** Record of an installed/available plugin. @@ -118,23 +118,23 @@ struct LilvHeader { */ struct LilvPluginImpl { LilvWorld* world; - LilvValue* plugin_uri; - LilvValue* bundle_uri; ///< Bundle directory plugin was loaded from - LilvValue* binary_uri; ///< lv2:binary - LilvValue* dynman_uri; ///< dynamic manifest binary + LilvNode* plugin_uri; + LilvNode* bundle_uri; ///< Bundle directory plugin was loaded from + LilvNode* binary_uri; ///< lv2:binary + LilvNode* dynman_uri; ///< dynamic manifest binary const LilvPluginClass* plugin_class; - LilvValues* data_uris; ///< rdfs::seeAlso + LilvNodes* data_uris; ///< rdfs::seeAlso LilvPort** ports; uint32_t num_ports; bool loaded; bool replaced; }; -LilvPlugin* lilv_plugin_new(LilvWorld* world, LilvValue* uri, LilvValue* bundle_uri); +LilvPlugin* lilv_plugin_new(LilvWorld* world, LilvNode* uri, LilvNode* bundle_uri); void lilv_plugin_load_if_necessary(const LilvPlugin* p); void lilv_plugin_free(LilvPlugin* plugin); -LilvValue* +LilvNode* lilv_plugin_get_unique(const LilvPlugin* p, const SordNode* subject, const SordNode* predicate); @@ -178,17 +178,17 @@ lilv_collection_free(LilvCollection* collection); unsigned lilv_collection_size(const LilvCollection* collection); -LilvValues* -lilv_values_new(void); +LilvNodes* +lilv_nodes_new(void); LilvScalePoints* lilv_scale_points_new(void); struct LilvPluginClassImpl { LilvWorld* world; - LilvValue* uri; - LilvValue* parent_uri; - LilvValue* label; + LilvNode* uri; + LilvNode* parent_uri; + LilvNode* label; }; LilvPluginClass* lilv_plugin_class_new(LilvWorld* world, @@ -245,10 +245,10 @@ struct LilvWorldImpl { SordNode* xsd_decimal_node; SordNode* xsd_double_node; SordNode* xsd_integer_node; - LilvValue* doap_name_val; - LilvValue* lv2_name_val; - LilvValue* lv2_optionalFeature_val; - LilvValue* lv2_requiredFeature_val; + LilvNode* doap_name_val; + LilvNode* lv2_name_val; + LilvNode* lv2_optionalFeature_val; + LilvNode* lv2_requiredFeature_val; LilvOptions opt; }; @@ -261,34 +261,34 @@ lilv_world_load_file(LilvWorld* world, const char* file_uri); struct LilvUIImpl { LilvWorld* world; - LilvValue* uri; - LilvValue* bundle_uri; - LilvValue* binary_uri; - LilvValues* classes; + LilvNode* uri; + LilvNode* bundle_uri; + LilvNode* binary_uri; + LilvNodes* classes; }; LilvUIs* lilv_uis_new(); LilvUI* lilv_ui_new(LilvWorld* world, - LilvValue* uri, - LilvValue* type_uri, - LilvValue* binary_uri); + LilvNode* uri, + LilvNode* type_uri, + LilvNode* binary_uri); void lilv_ui_free(LilvUI* ui); /* ********* Value ********* */ -typedef enum _LilvValueType { +typedef enum _LilvNodeType { LILV_VALUE_URI, LILV_VALUE_STRING, LILV_VALUE_INT, LILV_VALUE_FLOAT, LILV_VALUE_BOOL, LILV_VALUE_BLANK -} LilvValueType; +} LilvNodeType; -struct LilvValueImpl { +struct LilvNodeImpl { LilvWorld* world; char* str_val; ///< always present union { @@ -297,12 +297,12 @@ struct LilvValueImpl { bool bool_val; SordNode* uri_val; } val; - LilvValueType type; + LilvNodeType type; }; -LilvValue* lilv_value_new(LilvWorld* world, LilvValueType type, const char* val); -LilvValue* lilv_value_new_from_node(LilvWorld* world, const SordNode* node); -const SordNode* lilv_value_as_node(const LilvValue* value); +LilvNode* lilv_node_new(LilvWorld* world, LilvNodeType type, const char* val); +LilvNode* lilv_node_new_from_node(LilvWorld* world, const SordNode* node); +const SordNode* lilv_node_as_node(const LilvNode* value); int lilv_header_compare_by_uri(const void* a, const void* b, void* user_data); @@ -319,24 +319,16 @@ lilv_array_append(GSequence* seq, void* value) { } struct LilvHeader* -lilv_sequence_get_by_uri(const GSequence* seq, const LilvValue* uri); - -static inline SordNode* lilv_node_copy(const SordNode* node) { - return sord_node_copy(node); -} - -static inline void lilv_node_free(LilvWorld* world, SordNode* node) { - sord_node_free(world->world, node); -} +lilv_sequence_get_by_uri(const GSequence* seq, const LilvNode* uri); /* ********* Scale Points ********* */ struct LilvScalePointImpl { - LilvValue* value; - LilvValue* label; + LilvNode* value; + LilvNode* label; }; -LilvScalePoint* lilv_scale_point_new(LilvValue* value, LilvValue* label); +LilvScalePoint* lilv_scale_point_new(LilvNode* value, LilvNode* label); void lilv_scale_point_free(LilvScalePoint* point); /* ********* Query Results ********* */ @@ -347,7 +339,7 @@ lilv_world_query(LilvWorld* world, const SordNode* predicate, const SordNode* object); -LilvValues* +LilvNodes* lilv_world_query_values(LilvWorld* world, const SordNode* subject, const SordNode* predicate, @@ -361,7 +353,7 @@ static inline bool lilv_matches_end(SordIter* matches) { return sord_iter_end(matches); } -LilvValues* lilv_values_from_stream_objects(LilvWorld* w, +LilvNodes* lilv_nodes_from_stream_objects(LilvWorld* w, SordIter* stream); /* ********* Utilities ********* */ diff --git a/src/plugin.c b/src/plugin.c index 3703ed6..3682896 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -30,7 +30,7 @@ /** Ownership of @a uri is taken */ LilvPlugin* -lilv_plugin_new(LilvWorld* world, LilvValue* uri, LilvValue* bundle_uri) +lilv_plugin_new(LilvWorld* world, LilvNode* uri, LilvNode* bundle_uri) { assert(bundle_uri); LilvPlugin* plugin = malloc(sizeof(struct LilvPluginImpl)); @@ -42,7 +42,7 @@ lilv_plugin_new(LilvWorld* world, LilvValue* uri, LilvValue* bundle_uri) plugin->dynman_uri = NULL; #endif plugin->plugin_class = NULL; - plugin->data_uris = lilv_values_new(); + plugin->data_uris = lilv_nodes_new(); plugin->ports = NULL; plugin->num_ports = 0; plugin->loaded = false; @@ -54,17 +54,17 @@ lilv_plugin_new(LilvWorld* world, LilvValue* uri, LilvValue* bundle_uri) void lilv_plugin_free(LilvPlugin* p) { - lilv_value_free(p->plugin_uri); + lilv_node_free(p->plugin_uri); p->plugin_uri = NULL; - lilv_value_free(p->bundle_uri); + lilv_node_free(p->bundle_uri); p->bundle_uri = NULL; - lilv_value_free(p->binary_uri); + lilv_node_free(p->binary_uri); p->binary_uri = NULL; #ifdef LILV_DYN_MANIFEST - lilv_value_free(p->dynman_uri); + lilv_node_free(p->dynman_uri); p->dynman_uri = NULL; #endif @@ -75,37 +75,37 @@ lilv_plugin_free(LilvPlugin* p) p->ports = NULL; } - lilv_values_free(p->data_uris); + lilv_nodes_free(p->data_uris); p->data_uris = NULL; free(p); } -LilvValue* +LilvNode* lilv_plugin_get_unique(const LilvPlugin* p, const SordNode* subject, const SordNode* predicate) { - LilvValues* values = lilv_world_query_values(p->world, - subject, predicate, NULL); - if (!values || lilv_values_size(values) != 1) { + LilvNodes* values = lilv_world_query_values(p->world, + subject, predicate, NULL); + if (!values || lilv_nodes_size(values) != 1) { LILV_ERRORF("Port does not have exactly one `%s' property\n", sord_node_get_string(predicate)); return NULL; } - LilvValue* ret = lilv_value_duplicate(lilv_values_get_first(values)); - lilv_values_free(values); + LilvNode* ret = lilv_node_duplicate(lilv_nodes_get_first(values)); + lilv_nodes_free(values); return ret; } -static LilvValue* +static LilvNode* lilv_plugin_get_one(const LilvPlugin* p, const SordNode* subject, const SordNode* predicate) { - LilvValues* values = lilv_world_query_values(p->world, - subject, predicate, NULL); + LilvNodes* values = lilv_world_query_values(p->world, + subject, predicate, NULL); if (!values) { return NULL; } - LilvValue* ret = lilv_value_duplicate(lilv_values_get_first(values)); - lilv_values_free(values); + LilvNode* ret = lilv_node_duplicate(lilv_nodes_get_first(values)); + lilv_nodes_free(values); return ret; } @@ -113,8 +113,8 @@ static void lilv_plugin_load(LilvPlugin* p) { // Parse all the plugin's data files into RDF model - LILV_FOREACH(values, i, p->data_uris) { - const LilvValue* data_uri_val = lilv_values_get(p->data_uris, i); + LILV_FOREACH(nodes, i, p->data_uris) { + const LilvNode* data_uri_val = lilv_nodes_get(p->data_uris, i); sord_read_file(p->world->model, sord_node_get_string(data_uri_val->val.uri_val), p->bundle_uri->val.uri_val, @@ -125,11 +125,11 @@ lilv_plugin_load(LilvPlugin* p) typedef void* LV2_Dyn_Manifest_Handle; // Load and parse dynamic manifest data, if this is a library if (p->dynman_uri) { - const char* lib_path = lilv_uri_to_path(lilv_value_as_string(p->dynman_uri)); + const char* lib_path = lilv_uri_to_path(lilv_node_as_string(p->dynman_uri)); void* lib = dlopen(lib_path, RTLD_LAZY); if (!lib) { LILV_WARNF("Unable to open dynamic manifest %s\n", - lilv_value_as_string(p->dynman_uri)); + lilv_node_as_string(p->dynman_uri)); return; } @@ -146,11 +146,11 @@ lilv_plugin_load(LilvPlugin* p) lib, "lv2_dyn_manifest_get_data"); if (get_data_func) { FILE* fd = tmpfile(); - get_data_func(handle, fd, lilv_value_as_string(p->plugin_uri)); + get_data_func(handle, fd, lilv_node_as_string(p->plugin_uri)); rewind(fd); sord_read_file_handle(p->world->model, fd, - (const uint8_t*)lilv_value_as_uri(p->dynman_uri), + (const uint8_t*)lilv_node_as_uri(p->dynman_uri), p->bundle_uri->val.uri_val, lilv_world_blank_node_prefix(p->world)); fclose(fd); @@ -184,12 +184,12 @@ lilv_plugin_load_ports_if_necessary(const LilvPlugin* const_p) NULL); FOREACH_MATCH(ports) { - LilvValue* index = NULL; + LilvNode* index = NULL; const SordNode* port = lilv_match_object(ports); - LilvValue* symbol = lilv_plugin_get_unique( + LilvNode* symbol = lilv_plugin_get_unique( p, port, p->world->lv2_symbol_node); - if (!lilv_value_is_string(symbol)) { + if (!lilv_node_is_string(symbol)) { LILV_ERROR("port has a non-string symbol\n"); p->num_ports = 0; goto error; @@ -197,13 +197,13 @@ lilv_plugin_load_ports_if_necessary(const LilvPlugin* const_p) index = lilv_plugin_get_unique(p, port, p->world->lv2_index_node); - if (!lilv_value_is_int(index)) { + if (!lilv_node_is_int(index)) { LILV_ERROR("port has a non-integer index\n"); p->num_ports = 0; goto error; } - uint32_t this_index = lilv_value_as_int(index); + uint32_t this_index = lilv_node_as_int(index); LilvPort* this_port = NULL; if (p->num_ports > this_index) { this_port = p->ports[this_index]; @@ -218,7 +218,7 @@ lilv_plugin_load_ports_if_necessary(const LilvPlugin* const_p) if (!this_port) { this_port = lilv_port_new(p->world, this_index, - lilv_value_as_string(symbol)); + lilv_node_as_string(symbol)); p->ports[this_index] = this_port; } @@ -229,7 +229,7 @@ lilv_plugin_load_ports_if_necessary(const LilvPlugin* const_p) if (sord_node_get_type(type) == SORD_URI) { lilv_array_append( this_port->classes, - lilv_value_new_from_node(p->world, type)); + lilv_node_new_from_node(p->world, type)); } else { LILV_WARN("port has non-URI rdf:type\n"); } @@ -237,8 +237,8 @@ lilv_plugin_load_ports_if_necessary(const LilvPlugin* const_p) lilv_match_end(types); error: - lilv_value_free(symbol); - lilv_value_free(index); + lilv_node_free(symbol); + lilv_node_free(index); if (p->num_ports == 0) { if (p->ports) { for (uint32_t i = 0; i < p->num_ports; ++i) @@ -261,7 +261,7 @@ lilv_plugin_load_if_necessary(const LilvPlugin* p) } LILV_API -const LilvValue* +const LilvNode* lilv_plugin_get_uri(const LilvPlugin* p) { assert(p); @@ -270,7 +270,7 @@ lilv_plugin_get_uri(const LilvPlugin* p) } LILV_API -const LilvValue* +const LilvNode* lilv_plugin_get_bundle_uri(const LilvPlugin* p) { assert(p); @@ -279,7 +279,7 @@ lilv_plugin_get_bundle_uri(const LilvPlugin* p) } LILV_API -const LilvValue* +const LilvNode* lilv_plugin_get_library_uri(const LilvPlugin* const_p) { LilvPlugin* p = (LilvPlugin*)const_p; @@ -294,7 +294,7 @@ lilv_plugin_get_library_uri(const LilvPlugin* const_p) FOREACH_MATCH(results) { const SordNode* binary_node = lilv_match_object(results); if (sord_node_get_type(binary_node) == SORD_URI) { - p->binary_uri = lilv_value_new_from_node(p->world, binary_node); + p->binary_uri = lilv_node_new_from_node(p->world, binary_node); break; } } @@ -302,13 +302,13 @@ lilv_plugin_get_library_uri(const LilvPlugin* const_p) } if (!p->binary_uri) { LILV_WARNF("Plugin <%s> has no lv2:binary\n", - lilv_value_as_uri(lilv_plugin_get_uri(p))); + lilv_node_as_uri(lilv_plugin_get_uri(p))); } return p->binary_uri; } LILV_API -const LilvValues* +const LilvNodes* lilv_plugin_get_data_uris(const LilvPlugin* p) { return p->data_uris; @@ -333,20 +333,20 @@ lilv_plugin_get_class(const LilvPlugin* const_p) continue; } - LilvValue* class = lilv_value_new_from_node(p->world, class_node); - if ( ! lilv_value_equals(class, p->world->lv2_plugin_class->uri)) { + LilvNode* class = lilv_node_new_from_node(p->world, class_node); + if ( ! lilv_node_equals(class, p->world->lv2_plugin_class->uri)) { const LilvPluginClass* plugin_class = lilv_plugin_classes_get_by_uri( p->world->plugin_classes, class); if (plugin_class) { ((LilvPlugin*)p)->plugin_class = plugin_class; - lilv_value_free(class); + lilv_node_free(class); break; } } - lilv_value_free(class); + lilv_node_free(class); } lilv_match_end(results); @@ -360,88 +360,88 @@ LILV_API bool lilv_plugin_verify(const LilvPlugin* plugin) { - LilvValue* rdf_type = lilv_new_uri(plugin->world, LILV_NS_RDF "type"); - LilvValues* results = lilv_plugin_get_value(plugin, rdf_type); - lilv_value_free(rdf_type); + LilvNode* rdf_type = lilv_new_uri(plugin->world, LILV_NS_RDF "type"); + LilvNodes* results = lilv_plugin_get_value(plugin, rdf_type); + lilv_node_free(rdf_type); if (!results) { return false; } - lilv_values_free(results); + lilv_nodes_free(results); results = lilv_plugin_get_value(plugin, plugin->world->doap_name_val); if (!results) { return false; } - lilv_values_free(results); - LilvValue* lv2_port = lilv_new_uri(plugin->world, LILV_NS_LV2 "port"); + lilv_nodes_free(results); + LilvNode* lv2_port = lilv_new_uri(plugin->world, LILV_NS_LV2 "port"); results = lilv_plugin_get_value(plugin, lv2_port); - lilv_value_free(lv2_port); + lilv_node_free(lv2_port); if (!results) { return false; } - lilv_values_free(results); + lilv_nodes_free(results); return true; } LILV_API -LilvValue* +LilvNode* lilv_plugin_get_name(const LilvPlugin* plugin) { - LilvValues* results = lilv_plugin_get_value(plugin, + LilvNodes* results = lilv_plugin_get_value(plugin, plugin->world->doap_name_val); - LilvValue* ret = NULL; + LilvNode* ret = NULL; if (results) { - LilvValue* val = lilv_values_get_first(results); - if (lilv_value_is_string(val)) - ret = lilv_value_duplicate(val); - lilv_values_free(results); + LilvNode* val = lilv_nodes_get_first(results); + if (lilv_node_is_string(val)) + ret = lilv_node_duplicate(val); + lilv_nodes_free(results); } if (!ret) LILV_WARNF("<%s> has no (mandatory) doap:name\n", - lilv_value_as_string(lilv_plugin_get_uri(plugin))); + lilv_node_as_string(lilv_plugin_get_uri(plugin))); return ret; } LILV_API -LilvValues* +LilvNodes* lilv_plugin_get_value(const LilvPlugin* p, - const LilvValue* predicate) + const LilvNode* predicate) { return lilv_plugin_get_value_for_subject(p, p->plugin_uri, predicate); } LILV_API -LilvValues* +LilvNodes* lilv_plugin_get_value_for_subject(const LilvPlugin* p, - const LilvValue* subject, - const LilvValue* predicate) + const LilvNode* subject, + const LilvNode* predicate) { lilv_plugin_load_ports_if_necessary(p); - if ( ! lilv_value_is_uri(subject) && ! lilv_value_is_blank(subject)) { + if ( ! lilv_node_is_uri(subject) && ! lilv_node_is_blank(subject)) { LILV_ERROR("Subject is not a resource\n"); return NULL; } - if ( ! lilv_value_is_uri(predicate)) { + if ( ! lilv_node_is_uri(predicate)) { LILV_ERROR("Predicate is not a URI\n"); return NULL; } - SordNode* subject_node = (lilv_value_is_uri(subject)) - ? lilv_node_copy(subject->val.uri_val) + SordNode* subject_node = (lilv_node_is_uri(subject)) + ? sord_node_copy(subject->val.uri_val) : sord_new_blank(p->world->world, - (const uint8_t*)lilv_value_as_blank(subject)); + (const uint8_t*)lilv_node_as_blank(subject)); - LilvValues* ret = lilv_world_query_values(p->world, + LilvNodes* ret = lilv_world_query_values(p->world, subject_node, predicate->val.uri_val, NULL); - lilv_node_free(p->world, subject_node); + sord_node_free(p->world->world, subject_node); return ret; } @@ -456,34 +456,34 @@ lilv_plugin_get_num_ports(const LilvPlugin* p) LILV_API void lilv_plugin_get_port_ranges_float(const LilvPlugin* p, - float* min_values, - float* max_values, - float* def_values) + float* min_values, + float* max_values, + float* def_values) { lilv_plugin_load_ports_if_necessary(p); for (uint32_t i = 0; i < p->num_ports; ++i) { - LilvValue *def, *min, *max; + LilvNode *def, *min, *max; lilv_port_get_range(p, p->ports[i], &def, &min, &max); if (min_values) - min_values[i] = min ? lilv_value_as_float(min) : NAN; + min_values[i] = min ? lilv_node_as_float(min) : NAN; if (max_values) - max_values[i] = max ? lilv_value_as_float(max) : NAN; + max_values[i] = max ? lilv_node_as_float(max) : NAN; if (def_values) - def_values[i] = def ? lilv_value_as_float(def) : NAN; + def_values[i] = def ? lilv_node_as_float(def) : NAN; - lilv_value_free(def); - lilv_value_free(min); - lilv_value_free(max); + lilv_node_free(def); + lilv_node_free(min); + lilv_node_free(max); } } LILV_API uint32_t lilv_plugin_get_num_ports_of_class(const LilvPlugin* p, - const LilvValue* class_1, ...) + const LilvNode* class_1, ...) { lilv_plugin_load_ports_if_necessary(p); @@ -498,7 +498,7 @@ lilv_plugin_get_num_ports_of_class(const LilvPlugin* p, va_start(args, class_1); bool matches = true; - for (LilvValue* class_i = NULL; (class_i = va_arg(args, LilvValue*)) != NULL ; ) { + for (LilvNode* class_i = NULL; (class_i = va_arg(args, LilvNode*)) != NULL ; ) { if (!lilv_port_is_a(p, port, class_i)) { va_end(args); matches = false; @@ -566,11 +566,11 @@ lilv_plugin_get_latency_port_index(const LilvPlugin* p) p->world->lv2_portproperty_node, p->world->lv2_reportslatency_node); if (!lilv_matches_end(reports_latency)) { - LilvValue* index = lilv_plugin_get_unique( + LilvNode* index = lilv_plugin_get_unique( p, port, p->world->lv2_index_node); - ret = lilv_value_as_int(index); - lilv_value_free(index); + ret = lilv_node_as_int(index); + lilv_node_free(index); lilv_match_end(reports_latency); break; } @@ -584,46 +584,46 @@ lilv_plugin_get_latency_port_index(const LilvPlugin* p) LILV_API bool lilv_plugin_has_feature(const LilvPlugin* p, - const LilvValue* feature) + const LilvNode* feature) { - LilvValues* features = lilv_plugin_get_supported_features(p); + LilvNodes* features = lilv_plugin_get_supported_features(p); - const bool ret = features && feature && lilv_values_contains(features, feature); + const bool ret = features && feature && lilv_nodes_contains(features, feature); - lilv_values_free(features); + lilv_nodes_free(features); return ret; } LILV_API -LilvValues* +LilvNodes* lilv_plugin_get_supported_features(const LilvPlugin* p) { - LilvValues* optional = lilv_plugin_get_optional_features(p); - LilvValues* required = lilv_plugin_get_required_features(p); - LilvValues* result = lilv_values_new(); + LilvNodes* optional = lilv_plugin_get_optional_features(p); + LilvNodes* required = lilv_plugin_get_required_features(p); + LilvNodes* result = lilv_nodes_new(); - LILV_FOREACH(values, i, optional) + LILV_FOREACH(nodes, i, optional) lilv_array_append( - result, lilv_value_duplicate(lilv_values_get(optional, i))); - LILV_FOREACH(values, i, required) + result, lilv_node_duplicate(lilv_nodes_get(optional, i))); + LILV_FOREACH(nodes, i, required) lilv_array_append( - result, lilv_value_duplicate(lilv_values_get(required, i))); + result, lilv_node_duplicate(lilv_nodes_get(required, i))); - lilv_values_free(optional); - lilv_values_free(required); + lilv_nodes_free(optional); + lilv_nodes_free(required); return result; } LILV_API -LilvValues* +LilvNodes* lilv_plugin_get_optional_features(const LilvPlugin* p) { return lilv_plugin_get_value(p, p->world->lv2_optionalFeature_val); } LILV_API -LilvValues* +LilvNodes* lilv_plugin_get_required_features(const LilvPlugin* p) { return lilv_plugin_get_value(p, p->world->lv2_requiredFeature_val); @@ -644,12 +644,12 @@ lilv_plugin_get_port_by_index(const LilvPlugin* p, LILV_API const LilvPort* lilv_plugin_get_port_by_symbol(const LilvPlugin* p, - const LilvValue* symbol) + const LilvNode* symbol) { lilv_plugin_load_ports_if_necessary(p); for (uint32_t i = 0; i < p->num_ports; ++i) { LilvPort* port = p->ports[i]; - if (lilv_value_equals(port->symbol, symbol)) + if (lilv_node_equals(port->symbol, symbol)) return port; } @@ -670,7 +670,7 @@ lilv_plugin_get_author(const LilvPlugin* p) doap_maintainer, NULL); - lilv_node_free(p->world, doap_maintainer); + sord_node_free(p->world->world, doap_maintainer); if (lilv_matches_end(maintainers)) { return NULL; @@ -683,7 +683,7 @@ lilv_plugin_get_author(const LilvPlugin* p) } LILV_API -LilvValue* +LilvNode* lilv_plugin_get_author_name(const LilvPlugin* plugin) { const SordNode* author = lilv_plugin_get_author(plugin); @@ -696,7 +696,7 @@ lilv_plugin_get_author_name(const LilvPlugin* plugin) } LILV_API -LilvValue* +LilvNode* lilv_plugin_get_author_email(const LilvPlugin* plugin) { const SordNode* author = lilv_plugin_get_author(plugin); @@ -709,7 +709,7 @@ lilv_plugin_get_author_email(const LilvPlugin* plugin) } LILV_API -LilvValue* +LilvNode* lilv_plugin_get_author_homepage(const LilvPlugin* plugin) { const SordNode* author = lilv_plugin_get_author(plugin); @@ -746,21 +746,21 @@ lilv_plugin_get_uis(const LilvPlugin* p) FOREACH_MATCH(uis) { const SordNode* ui = lilv_match_object(uis); - LilvValue* type = lilv_plugin_get_unique(p, ui, p->world->rdf_a_node); - LilvValue* binary = lilv_plugin_get_unique(p, ui, ui_binary_node); + LilvNode* type = lilv_plugin_get_unique(p, ui, p->world->rdf_a_node); + LilvNode* binary = lilv_plugin_get_unique(p, ui, ui_binary_node); if (sord_node_get_type(ui) != SORD_URI - || !lilv_value_is_uri(type) - || !lilv_value_is_uri(binary)) { - lilv_value_free(binary); - lilv_value_free(type); + || !lilv_node_is_uri(type) + || !lilv_node_is_uri(binary)) { + lilv_node_free(binary); + lilv_node_free(type); LILV_ERROR("Corrupt UI\n"); continue; } LilvUI* lilv_ui = lilv_ui_new( p->world, - lilv_value_new_from_node(p->world, ui), + lilv_node_new_from_node(p->world, ui), type, binary); @@ -768,8 +768,8 @@ lilv_plugin_get_uis(const LilvPlugin* p) } lilv_match_end(uis); - lilv_node_free(p->world, ui_binary_node); - lilv_node_free(p->world, ui_ui_node); + sord_node_free(p->world->world, ui_binary_node); + sord_node_free(p->world->world, ui_ui_node); if (lilv_uis_size(result) > 0) { return result; diff --git a/src/pluginclass.c b/src/pluginclass.c index 60e57dc..cceda49 100644 --- a/src/pluginclass.c +++ b/src/pluginclass.c @@ -33,10 +33,10 @@ lilv_plugin_class_new(LilvWorld* world, } LilvPluginClass* pc = malloc(sizeof(struct LilvPluginClassImpl)); pc->world = world; - pc->uri = lilv_value_new_from_node(world, uri); - pc->label = lilv_value_new(world, LILV_VALUE_STRING, label); + pc->uri = lilv_node_new_from_node(world, uri); + pc->label = lilv_node_new(world, LILV_VALUE_STRING, label); pc->parent_uri = (parent_node) - ? lilv_value_new_from_node(world, parent_node) + ? lilv_node_new_from_node(world, parent_node) : NULL; return pc; } @@ -45,14 +45,14 @@ void lilv_plugin_class_free(LilvPluginClass* plugin_class) { assert(plugin_class->uri); - lilv_value_free(plugin_class->uri); - lilv_value_free(plugin_class->parent_uri); - lilv_value_free(plugin_class->label); + lilv_node_free(plugin_class->uri); + lilv_node_free(plugin_class->parent_uri); + lilv_node_free(plugin_class->label); free(plugin_class); } LILV_API -const LilvValue* +const LilvNode* lilv_plugin_class_get_parent_uri(const LilvPluginClass* plugin_class) { if (plugin_class->parent_uri) @@ -62,7 +62,7 @@ lilv_plugin_class_get_parent_uri(const LilvPluginClass* plugin_class) } LILV_API -const LilvValue* +const LilvNode* lilv_plugin_class_get_uri(const LilvPluginClass* plugin_class) { assert(plugin_class->uri); @@ -70,7 +70,7 @@ lilv_plugin_class_get_uri(const LilvPluginClass* plugin_class) } LILV_API -const LilvValue* +const LilvNode* lilv_plugin_class_get_label(const LilvPluginClass* plugin_class) { return plugin_class->label; @@ -88,8 +88,8 @@ lilv_plugin_class_get_children(const LilvPluginClass* plugin_class) i != g_sequence_get_end_iter(all); i = g_sequence_iter_next(i)) { const LilvPluginClass* c = g_sequence_get(i); - const LilvValue* parent = lilv_plugin_class_get_parent_uri(c); - if (parent && lilv_value_equals(lilv_plugin_class_get_uri(plugin_class), + const LilvNode* parent = lilv_plugin_class_get_parent_uri(c); + if (parent && lilv_node_equals(lilv_plugin_class_get_uri(plugin_class), parent)) lilv_sequence_insert(result, (LilvPluginClass*)c); } @@ -29,16 +29,16 @@ lilv_port_new(LilvWorld* world, uint32_t index, const char* symbol) { LilvPort* port = malloc(sizeof(struct LilvPortImpl)); port->index = index; - port->symbol = lilv_value_new(world, LILV_VALUE_STRING, symbol); - port->classes = lilv_values_new(); + port->symbol = lilv_node_new(world, LILV_VALUE_STRING, symbol); + port->classes = lilv_nodes_new(); return port; } void lilv_port_free(LilvPort* port) { - lilv_values_free(port->classes); - lilv_value_free(port->symbol); + lilv_nodes_free(port->classes); + lilv_node_free(port->symbol); free(port); } @@ -46,10 +46,10 @@ LILV_API bool lilv_port_is_a(const LilvPlugin* plugin, const LilvPort* port, - const LilvValue* port_class) + const LilvNode* port_class) { - LILV_FOREACH(values, i, port->classes) - if (lilv_value_equals(lilv_values_get(port->classes, i), port_class)) + LILV_FOREACH(nodes, i, port->classes) + if (lilv_node_equals(lilv_nodes_get(port->classes, i), port_class)) return true; return false; @@ -67,15 +67,15 @@ lilv_port_get_node(const LilvPlugin* p, const SordNode* ret = NULL; FOREACH_MATCH(ports) { const SordNode* node = lilv_match_object(ports); - LilvValue* symbol = lilv_plugin_get_unique( + LilvNode* symbol = lilv_plugin_get_unique( p, node, p->world->lv2_symbol_node); - const bool matches = lilv_value_equals(symbol, + const bool matches = lilv_node_equals(symbol, lilv_port_get_symbol(p, port)); - lilv_value_free(symbol); + lilv_node_free(symbol); if (matches) { ret = node; break; @@ -90,7 +90,7 @@ LILV_API bool lilv_port_has_property(const LilvPlugin* p, const LilvPort* port, - const LilvValue* property) + const LilvNode* property) { assert(property); const SordNode* port_node = lilv_port_get_node(p, port); @@ -98,7 +98,7 @@ lilv_port_has_property(const LilvPlugin* p, p->world, port_node, p->world->lv2_portproperty_node, - lilv_value_as_node(property)); + lilv_node_as_node(property)); const bool ret = !lilv_matches_end(results); lilv_match_end(results); @@ -109,7 +109,7 @@ LILV_API bool lilv_port_supports_event(const LilvPlugin* p, const LilvPort* port, - const LilvValue* event) + const LilvNode* event) { #define NS_EV (const uint8_t*)"http://lv2plug.in/ns/ext/event#" @@ -119,14 +119,14 @@ lilv_port_supports_event(const LilvPlugin* p, p->world, port_node, sord_new_uri(p->world->world, NS_EV "supportsEvent"), - lilv_value_as_node(event)); + lilv_node_as_node(event)); const bool ret = !lilv_matches_end(results); lilv_match_end(results); return ret; } -static LilvValues* +static LilvNodes* lilv_port_get_value_by_node(const LilvPlugin* p, const LilvPort* port, const SordNode* predicate) @@ -140,27 +140,27 @@ lilv_port_get_value_by_node(const LilvPlugin* p, predicate, NULL); - return lilv_values_from_stream_objects(p->world, results); + return lilv_nodes_from_stream_objects(p->world, results); } LILV_API -LilvValues* +LilvNodes* lilv_port_get_value(const LilvPlugin* p, const LilvPort* port, - const LilvValue* predicate) + const LilvNode* predicate) { - if ( ! lilv_value_is_uri(predicate)) { + if ( ! lilv_node_is_uri(predicate)) { LILV_ERROR("Predicate is not a URI\n"); return NULL; } return lilv_port_get_value_by_node( p, port, - lilv_value_as_node(predicate)); + lilv_node_as_node(predicate)); } LILV_API -const LilvValue* +const LilvNode* lilv_port_get_symbol(const LilvPlugin* p, const LilvPort* port) { @@ -168,30 +168,30 @@ lilv_port_get_symbol(const LilvPlugin* p, } LILV_API -LilvValue* +LilvNode* lilv_port_get_name(const LilvPlugin* p, const LilvPort* port) { - LilvValues* results = lilv_port_get_value(p, port, + LilvNodes* results = lilv_port_get_value(p, port, p->world->lv2_name_val); - LilvValue* ret = NULL; + LilvNode* ret = NULL; if (results) { - LilvValue* val = lilv_values_get_first(results); - if (lilv_value_is_string(val)) - ret = lilv_value_duplicate(val); - lilv_values_free(results); + LilvNode* val = lilv_nodes_get_first(results); + if (lilv_node_is_string(val)) + ret = lilv_node_duplicate(val); + lilv_nodes_free(results); } if (!ret) LILV_WARNF("<%s> has no (mandatory) doap:name\n", - lilv_value_as_string(lilv_plugin_get_uri(p))); + lilv_node_as_string(lilv_plugin_get_uri(p))); return ret; } LILV_API -const LilvValues* +const LilvNodes* lilv_port_get_classes(const LilvPlugin* p, const LilvPort* port) { @@ -202,33 +202,33 @@ LILV_API void lilv_port_get_range(const LilvPlugin* p, const LilvPort* port, - LilvValue** def, - LilvValue** min, - LilvValue** max) + LilvNode** def, + LilvNode** min, + LilvNode** max) { if (def) { - LilvValues* defaults = lilv_port_get_value_by_node( + LilvNodes* defaults = lilv_port_get_value_by_node( p, port, p->world->lv2_default_node); *def = defaults - ? lilv_value_duplicate(lilv_values_get_first(defaults)) + ? lilv_node_duplicate(lilv_nodes_get_first(defaults)) : NULL; - lilv_values_free(defaults); + lilv_nodes_free(defaults); } if (min) { - LilvValues* minimums = lilv_port_get_value_by_node( + LilvNodes* minimums = lilv_port_get_value_by_node( p, port, p->world->lv2_minimum_node); *min = minimums - ? lilv_value_duplicate(lilv_values_get_first(minimums)) + ? lilv_node_duplicate(lilv_nodes_get_first(minimums)) : NULL; - lilv_values_free(minimums); + lilv_nodes_free(minimums); } if (max) { - LilvValues* maximums = lilv_port_get_value_by_node( + LilvNodes* maximums = lilv_port_get_value_by_node( p, port, p->world->lv2_maximum_node); *max = maximums - ? lilv_value_duplicate(lilv_values_get_first(maximums)) + ? lilv_node_duplicate(lilv_nodes_get_first(maximums)) : NULL; - lilv_values_free(maximums); + lilv_nodes_free(maximums); } } @@ -251,12 +251,12 @@ lilv_port_get_scale_points(const LilvPlugin* p, FOREACH_MATCH(points) { const SordNode* point = lilv_match_object(points); - LilvValue* value = lilv_plugin_get_unique( + LilvNode* value = lilv_plugin_get_unique( p, point, p->world->rdf_value_node); - LilvValue* label = lilv_plugin_get_unique( + LilvNode* label = lilv_plugin_get_unique( p, point, p->world->rdfs_label_node); @@ -267,18 +267,18 @@ lilv_port_get_scale_points(const LilvPlugin* p, } lilv_match_end(points); - assert(!ret || lilv_values_size(ret) > 0); + assert(!ret || lilv_nodes_size(ret) > 0); return ret; } LILV_API -LilvValues* +LilvNodes* lilv_port_get_properties(const LilvPlugin* p, const LilvPort* port) { - LilvValue* pred = lilv_value_new_from_node( + LilvNode* pred = lilv_node_new_from_node( p->world, p->world->lv2_portproperty_node); - LilvValues* ret = lilv_port_get_value(p, port, pred); - lilv_value_free(pred); + LilvNodes* ret = lilv_port_get_value(p, port, pred); + lilv_node_free(pred); return ret; } diff --git a/src/query.c b/src/query.c index c55fe5b..c64b8c4 100644 --- a/src/query.c +++ b/src/query.c @@ -53,11 +53,11 @@ lilv_lang_matches(const char* a, const char* b) return LILV_LANG_MATCH_NONE; } -LilvValues* -lilv_values_from_stream_objects_i18n(LilvWorld* world, +LilvNodes* +lilv_nodes_from_stream_objects_i18n(LilvWorld* world, SordIter* stream) { - LilvValues* values = lilv_values_new(); + LilvNodes* values = lilv_nodes_new(); const SordNode* nolang = NULL; // Untranslated value const SordNode* partial = NULL; // Partial language match char* syslang = lilv_get_lang(); @@ -79,19 +79,19 @@ lilv_values_from_stream_objects_i18n(LilvWorld* world, if (lm == LILV_LANG_MATCH_EXACT) { // Exact language match, add to results - lilv_array_append(values, lilv_value_new_from_node(world, value)); + lilv_array_append(values, lilv_node_new_from_node(world, value)); } else if (lm == LILV_LANG_MATCH_PARTIAL) { // Partial language match, save in case we find no exact partial = value; } } else { - lilv_array_append(values, lilv_value_new_from_node(world, value)); + lilv_array_append(values, lilv_node_new_from_node(world, value)); } } lilv_match_end(stream); free(syslang); - if (lilv_values_size(values) > 0) { + if (lilv_nodes_size(values) > 0) { return values; } @@ -106,29 +106,29 @@ lilv_values_from_stream_objects_i18n(LilvWorld* world, } if (best) { - lilv_array_append(values, lilv_value_new_from_node(world, best)); + lilv_array_append(values, lilv_node_new_from_node(world, best)); } else { // No matches whatsoever - lilv_values_free(values); + lilv_nodes_free(values); values = NULL; } return values; } -LilvValues* -lilv_values_from_stream_objects(LilvWorld* world, +LilvNodes* +lilv_nodes_from_stream_objects(LilvWorld* world, SordIter* stream) { if (lilv_matches_end(stream)) { lilv_match_end(stream); return NULL; } else if (world->opt.filter_language) { - return lilv_values_from_stream_objects_i18n(world, stream); + return lilv_nodes_from_stream_objects_i18n(world, stream); } else { - LilvValues* values = lilv_values_new(); + LilvNodes* values = lilv_nodes_new(); FOREACH_MATCH(stream) { - LilvValue* value = lilv_value_new_from_node( + LilvNode* value = lilv_node_new_from_node( world, lilv_match_object(stream)); if (value) { lilv_array_append(values, value); diff --git a/src/scalepoint.c b/src/scalepoint.c index 0f3c7f6..6995b85 100644 --- a/src/scalepoint.c +++ b/src/scalepoint.c @@ -18,7 +18,7 @@ /** Ownership of value and label is taken */ LilvScalePoint* -lilv_scale_point_new(LilvValue* value, LilvValue* label) +lilv_scale_point_new(LilvNode* value, LilvNode* label) { LilvScalePoint* point = (LilvScalePoint*)malloc( sizeof(struct LilvScalePointImpl)); @@ -30,20 +30,20 @@ lilv_scale_point_new(LilvValue* value, LilvValue* label) void lilv_scale_point_free(LilvScalePoint* point) { - lilv_value_free(point->value); - lilv_value_free(point->label); + lilv_node_free(point->value); + lilv_node_free(point->label); free(point); } LILV_API -const LilvValue* +const LilvNode* lilv_scale_point_get_value(const LilvScalePoint* p) { return p->value; } LILV_API -const LilvValue* +const LilvNode* lilv_scale_point_get_label(const LilvScalePoint* p) { return p->label; @@ -24,9 +24,9 @@ LilvUI* lilv_ui_new(LilvWorld* world, - LilvValue* uri, - LilvValue* type_uri, - LilvValue* binary_uri) + LilvNode* uri, + LilvNode* type_uri, + LilvNode* binary_uri) { assert(uri); assert(type_uri); @@ -38,13 +38,13 @@ lilv_ui_new(LilvWorld* world, ui->binary_uri = binary_uri; // FIXME: kludge - char* bundle = lilv_strdup(lilv_value_as_string(ui->binary_uri)); + char* bundle = lilv_strdup(lilv_node_as_string(ui->binary_uri)); char* last_slash = strrchr(bundle, '/') + 1; *last_slash = '\0'; ui->bundle_uri = lilv_new_uri(world, bundle); free(bundle); - ui->classes = lilv_values_new(); + ui->classes = lilv_nodes_new(); lilv_array_append(ui->classes, type_uri); return ui; @@ -53,22 +53,22 @@ lilv_ui_new(LilvWorld* world, void lilv_ui_free(LilvUI* ui) { - lilv_value_free(ui->uri); + lilv_node_free(ui->uri); ui->uri = NULL; - lilv_value_free(ui->bundle_uri); + lilv_node_free(ui->bundle_uri); ui->bundle_uri = NULL; - lilv_value_free(ui->binary_uri); + lilv_node_free(ui->binary_uri); ui->binary_uri = NULL; - lilv_values_free(ui->classes); + lilv_nodes_free(ui->classes); free(ui); } LILV_API -const LilvValue* +const LilvNode* lilv_ui_get_uri(const LilvUI* ui) { assert(ui); @@ -80,18 +80,18 @@ LILV_API unsigned lilv_ui_is_supported(const LilvUI* ui, LilvUISupportedFunc supported_func, - const LilvValue* container_type, - const LilvValue** ui_type) + const LilvNode* container_type, + const LilvNode** ui_type) { #ifdef HAVE_SUIL - const LilvValues* classes = lilv_ui_get_classes(ui); - LILV_FOREACH(values, c, classes) { - const LilvValue* type = lilv_values_get(classes, c); - const unsigned q = supported_func(lilv_value_as_uri(container_type), - lilv_value_as_uri(type)); + const LilvNodes* classes = lilv_ui_get_classes(ui); + LILV_FOREACH(nodes, c, classes) { + const LilvNode* type = lilv_nodes_get(classes, c); + const unsigned q = supported_func(lilv_node_as_uri(container_type), + lilv_node_as_uri(type)); if (q) { if (ui_type) { - *ui_type = lilv_value_duplicate(type); + *ui_type = lilv_node_duplicate(type); } return q; } @@ -101,7 +101,7 @@ lilv_ui_is_supported(const LilvUI* ui, } LILV_API -const LilvValues* +const LilvNodes* lilv_ui_get_classes(const LilvUI* ui) { return ui->classes; @@ -109,13 +109,13 @@ lilv_ui_get_classes(const LilvUI* ui) LILV_API bool -lilv_ui_is_a(const LilvUI* ui, const LilvValue* ui_class_uri) +lilv_ui_is_a(const LilvUI* ui, const LilvNode* ui_class_uri) { - return lilv_values_contains(ui->classes, ui_class_uri); + return lilv_nodes_contains(ui->classes, ui_class_uri); } LILV_API -const LilvValue* +const LilvNode* lilv_ui_get_bundle_uri(const LilvUI* ui) { assert(ui); @@ -124,7 +124,7 @@ lilv_ui_get_bundle_uri(const LilvUI* ui) } LILV_API -const LilvValue* +const LilvNode* lilv_ui_get_binary_uri(const LilvUI* ui) { assert(ui); diff --git a/src/value.c b/src/value.c index f50c6bd..8fbf5b1 100644 --- a/src/value.c +++ b/src/value.c @@ -26,7 +26,7 @@ #include "lilv_internal.h" static void -lilv_value_set_numerics_from_string(LilvValue* val) +lilv_node_set_numerics_from_string(LilvNode* val) { char* locale; char* endptr; @@ -59,14 +59,14 @@ lilv_value_set_numerics_from_string(LilvValue* val) } /** Note that if @a type is numeric or boolean, the returned value is corrupt - * until lilv_value_set_numerics_from_string is called. It is not + * until lilv_node_set_numerics_from_string is called. It is not * automatically called from here to avoid overhead and imprecision when the * exact string value is known. */ -LilvValue* -lilv_value_new(LilvWorld* world, LilvValueType type, const char* str) +LilvNode* +lilv_node_new(LilvWorld* world, LilvNodeType type, const char* str) { - LilvValue* val = malloc(sizeof(struct LilvValueImpl)); + LilvNode* val = malloc(sizeof(struct LilvNodeImpl)); val->world = world; val->type = type; @@ -88,21 +88,21 @@ lilv_value_new(LilvWorld* world, LilvValueType type, const char* str) return val; } -/** Create a new LilvValue from @a node, or return NULL if impossible */ -LilvValue* -lilv_value_new_from_node(LilvWorld* world, const SordNode* node) +/** Create a new LilvNode from @a node, or return NULL if impossible */ +LilvNode* +lilv_node_new_from_node(LilvWorld* world, const SordNode* node) { - LilvValue* result = NULL; + LilvNode* result = NULL; SordNode* datatype_uri = NULL; - LilvValueType type = LILV_VALUE_STRING; + LilvNodeType type = LILV_VALUE_STRING; switch (sord_node_get_type(node)) { case SORD_URI: type = LILV_VALUE_URI; - result = malloc(sizeof(struct LilvValueImpl)); + result = malloc(sizeof(struct LilvNodeImpl)); result->world = world; result->type = LILV_VALUE_URI; - result->val.uri_val = lilv_node_copy(node); + result->val.uri_val = sord_node_copy(node); result->str_val = (char*)sord_node_get_string(result->val.uri_val); break; case SORD_LITERAL: @@ -118,19 +118,19 @@ lilv_value_new_from_node(LilvWorld* world, const SordNode* node) else LILV_ERRORF("Unknown datatype %s\n", sord_node_get_string(datatype_uri)); } - result = lilv_value_new(world, type, (const char*)sord_node_get_string(node)); + result = lilv_node_new(world, type, (const char*)sord_node_get_string(node)); switch (result->type) { case LILV_VALUE_INT: case LILV_VALUE_FLOAT: case LILV_VALUE_BOOL: - lilv_value_set_numerics_from_string(result); + lilv_node_set_numerics_from_string(result); default: break; } break; case SORD_BLANK: type = LILV_VALUE_BLANK; - result = lilv_value_new(world, type, (const char*)sord_node_get_string(node)); + result = lilv_node_new(world, type, (const char*)sord_node_get_string(node)); break; default: assert(false); @@ -140,63 +140,63 @@ lilv_value_new_from_node(LilvWorld* world, const SordNode* node) } LILV_API -LilvValue* +LilvNode* lilv_new_uri(LilvWorld* world, const char* uri) { - return lilv_value_new(world, LILV_VALUE_URI, uri); + return lilv_node_new(world, LILV_VALUE_URI, uri); } LILV_API -LilvValue* +LilvNode* lilv_new_string(LilvWorld* world, const char* str) { - return lilv_value_new(world, LILV_VALUE_STRING, str); + return lilv_node_new(world, LILV_VALUE_STRING, str); } LILV_API -LilvValue* +LilvNode* lilv_new_int(LilvWorld* world, int val) { char str[32]; snprintf(str, sizeof(str), "%d", val); - LilvValue* ret = lilv_value_new(world, LILV_VALUE_INT, str); + LilvNode* ret = lilv_node_new(world, LILV_VALUE_INT, str); ret->val.int_val = val; return ret; } LILV_API -LilvValue* +LilvNode* lilv_new_float(LilvWorld* world, float val) { char str[32]; snprintf(str, sizeof(str), "%f", val); - LilvValue* ret = lilv_value_new(world, LILV_VALUE_FLOAT, str); + LilvNode* ret = lilv_node_new(world, LILV_VALUE_FLOAT, str); ret->val.float_val = val; return ret; } LILV_API -LilvValue* +LilvNode* lilv_new_bool(LilvWorld* world, bool val) { - LilvValue* ret = lilv_value_new(world, LILV_VALUE_BOOL, val ? "true" : "false"); + LilvNode* ret = lilv_node_new(world, LILV_VALUE_BOOL, val ? "true" : "false"); ret->val.bool_val = val; return ret; } LILV_API -LilvValue* -lilv_value_duplicate(const LilvValue* val) +LilvNode* +lilv_node_duplicate(const LilvNode* val) { if (val == NULL) return NULL; - LilvValue* result = malloc(sizeof(struct LilvValueImpl)); + LilvNode* result = malloc(sizeof(struct LilvNodeImpl)); result->world = val->world; result->type = val->type; if (val->type == LILV_VALUE_URI) { - result->val.uri_val = lilv_node_copy(val->val.uri_val); + result->val.uri_val = sord_node_copy(val->val.uri_val); result->str_val = (char*)sord_node_get_string(result->val.uri_val); } else { result->str_val = lilv_strdup(val->str_val); @@ -208,11 +208,11 @@ lilv_value_duplicate(const LilvValue* val) LILV_API void -lilv_value_free(LilvValue* val) +lilv_node_free(LilvNode* val) { if (val) { if (val->type == LILV_VALUE_URI) { - lilv_node_free(val->world, val->val.uri_val); + sord_node_free(val->world->world, val->val.uri_val); } else { free(val->str_val); } @@ -222,7 +222,7 @@ lilv_value_free(LilvValue* val) LILV_API bool -lilv_value_equals(const LilvValue* value, const LilvValue* other) +lilv_node_equals(const LilvNode* value, const LilvNode* other) { if (value == NULL && other == NULL) return true; @@ -250,7 +250,7 @@ lilv_value_equals(const LilvValue* value, const LilvValue* other) LILV_API char* -lilv_value_get_turtle_token(const LilvValue* value) +lilv_node_get_turtle_token(const LilvNode* value) { size_t len = 0; char* result = NULL; @@ -299,44 +299,44 @@ lilv_value_get_turtle_token(const LilvValue* value) LILV_API bool -lilv_value_is_uri(const LilvValue* value) +lilv_node_is_uri(const LilvNode* value) { return (value && value->type == LILV_VALUE_URI); } LILV_API const char* -lilv_value_as_uri(const LilvValue* value) +lilv_node_as_uri(const LilvNode* value) { - assert(lilv_value_is_uri(value)); + assert(lilv_node_is_uri(value)); return value->str_val; } const SordNode* -lilv_value_as_node(const LilvValue* value) +lilv_node_as_node(const LilvNode* value) { - assert(lilv_value_is_uri(value)); + assert(lilv_node_is_uri(value)); return value->val.uri_val; } LILV_API bool -lilv_value_is_blank(const LilvValue* value) +lilv_node_is_blank(const LilvNode* value) { return (value && value->type == LILV_VALUE_BLANK); } LILV_API const char* -lilv_value_as_blank(const LilvValue* value) +lilv_node_as_blank(const LilvNode* value) { - assert(lilv_value_is_blank(value)); + assert(lilv_node_is_blank(value)); return value->str_val; } LILV_API bool -lilv_value_is_literal(const LilvValue* value) +lilv_node_is_literal(const LilvNode* value) { if (!value) return false; @@ -353,64 +353,64 @@ lilv_value_is_literal(const LilvValue* value) LILV_API bool -lilv_value_is_string(const LilvValue* value) +lilv_node_is_string(const LilvNode* value) { return (value && value->type == LILV_VALUE_STRING); } LILV_API const char* -lilv_value_as_string(const LilvValue* value) +lilv_node_as_string(const LilvNode* value) { return value->str_val; } LILV_API bool -lilv_value_is_int(const LilvValue* value) +lilv_node_is_int(const LilvNode* value) { return (value && value->type == LILV_VALUE_INT); } LILV_API int -lilv_value_as_int(const LilvValue* value) +lilv_node_as_int(const LilvNode* value) { assert(value); - assert(lilv_value_is_int(value)); + assert(lilv_node_is_int(value)); return value->val.int_val; } LILV_API bool -lilv_value_is_float(const LilvValue* value) +lilv_node_is_float(const LilvNode* value) { return (value && value->type == LILV_VALUE_FLOAT); } LILV_API float -lilv_value_as_float(const LilvValue* value) +lilv_node_as_float(const LilvNode* value) { - assert(lilv_value_is_float(value) || lilv_value_is_int(value)); - if (lilv_value_is_float(value)) + assert(lilv_node_is_float(value) || lilv_node_is_int(value)); + if (lilv_node_is_float(value)) return value->val.float_val; - else // lilv_value_is_int(value) + else // lilv_node_is_int(value) return (float)value->val.int_val; } LILV_API bool -lilv_value_is_bool(const LilvValue* value) +lilv_node_is_bool(const LilvNode* value) { return (value && value->type == LILV_VALUE_BOOL); } LILV_API bool -lilv_value_as_bool(const LilvValue* value) +lilv_node_as_bool(const LilvNode* value) { assert(value); - assert(lilv_value_is_bool(value)); + assert(lilv_node_is_bool(value)); return value->val.bool_val; } diff --git a/src/world.c b/src/world.c index 8bc4b49..9d6ac45 100644 --- a/src/world.c +++ b/src/world.c @@ -121,39 +121,39 @@ lilv_world_free(LilvWorld* world) lilv_plugin_class_free(world->lv2_plugin_class); world->lv2_plugin_class = NULL; - lilv_node_free(world, world->dc_replaces_node); - lilv_node_free(world, world->dyn_manifest_node); - lilv_node_free(world, world->lv2_binary_node); - lilv_node_free(world, world->lv2_default_node); - lilv_node_free(world, world->lv2_index_node); - lilv_node_free(world, world->lv2_maximum_node); - lilv_node_free(world, world->lv2_minimum_node); - lilv_node_free(world, world->lv2_plugin_node); - lilv_node_free(world, world->lv2_port_node); - lilv_node_free(world, world->lv2_portproperty_node); - lilv_node_free(world, world->lv2_reportslatency_node); - lilv_node_free(world, world->lv2_specification_node); - lilv_node_free(world, world->lv2_symbol_node); - lilv_node_free(world, world->rdf_a_node); - lilv_node_free(world, world->rdf_value_node); - lilv_node_free(world, world->rdfs_class_node); - lilv_node_free(world, world->rdfs_label_node); - lilv_node_free(world, world->rdfs_seealso_node); - lilv_node_free(world, world->rdfs_subclassof_node); - lilv_node_free(world, world->xsd_boolean_node); - lilv_node_free(world, world->xsd_decimal_node); - lilv_node_free(world, world->xsd_double_node); - lilv_node_free(world, world->xsd_integer_node); - lilv_value_free(world->doap_name_val); - lilv_value_free(world->lv2_name_val); - lilv_value_free(world->lv2_optionalFeature_val); - lilv_value_free(world->lv2_requiredFeature_val); + sord_node_free(world->world, world->dc_replaces_node); + sord_node_free(world->world, world->dyn_manifest_node); + sord_node_free(world->world, world->lv2_binary_node); + sord_node_free(world->world, world->lv2_default_node); + sord_node_free(world->world, world->lv2_index_node); + sord_node_free(world->world, world->lv2_maximum_node); + sord_node_free(world->world, world->lv2_minimum_node); + sord_node_free(world->world, world->lv2_plugin_node); + sord_node_free(world->world, world->lv2_port_node); + sord_node_free(world->world, world->lv2_portproperty_node); + sord_node_free(world->world, world->lv2_reportslatency_node); + sord_node_free(world->world, world->lv2_specification_node); + sord_node_free(world->world, world->lv2_symbol_node); + sord_node_free(world->world, world->rdf_a_node); + sord_node_free(world->world, world->rdf_value_node); + sord_node_free(world->world, world->rdfs_class_node); + sord_node_free(world->world, world->rdfs_label_node); + sord_node_free(world->world, world->rdfs_seealso_node); + sord_node_free(world->world, world->rdfs_subclassof_node); + sord_node_free(world->world, world->xsd_boolean_node); + sord_node_free(world->world, world->xsd_decimal_node); + sord_node_free(world->world, world->xsd_double_node); + sord_node_free(world->world, world->xsd_integer_node); + lilv_node_free(world->doap_name_val); + lilv_node_free(world->lv2_name_val); + lilv_node_free(world->lv2_optionalFeature_val); + lilv_node_free(world->lv2_requiredFeature_val); for (GSList* l = world->specs; l; l = l->next) { LilvSpec* spec = (LilvSpec*)l->data; - lilv_node_free(world, spec->spec); - lilv_node_free(world, spec->bundle); - lilv_values_free(spec->data_uris); + sord_node_free(world->world, spec->spec); + sord_node_free(world->world, spec->bundle); + lilv_nodes_free(spec->data_uris); free(spec); } g_slist_free(world->specs); @@ -184,16 +184,16 @@ LILV_API void lilv_world_set_option(LilvWorld* world, const char* option, - const LilvValue* value) + const LilvNode* value) { if (!strcmp(option, LILV_OPTION_DYN_MANIFEST)) { - if (lilv_value_is_bool(value)) { - world->opt.dyn_manifest = lilv_value_as_bool(value); + if (lilv_node_is_bool(value)) { + world->opt.dyn_manifest = lilv_node_as_bool(value); return; } } else if (!strcmp(option, LILV_OPTION_FILTER_LANG)) { - if (lilv_value_is_bool(value)) { - world->opt.filter_language = lilv_value_as_bool(value); + if (lilv_node_is_bool(value)) { + world->opt.filter_language = lilv_node_as_bool(value); return; } } @@ -222,13 +222,13 @@ lilv_world_query(LilvWorld* world, subject, predicate, object, NULL); } -LilvValues* +LilvNodes* lilv_world_query_values(LilvWorld* world, const SordNode* subject, const SordNode* predicate, const SordNode* object) { - return lilv_values_from_stream_objects(world, + return lilv_nodes_from_stream_objects(world, lilv_world_query(world, subject, predicate, object)); } @@ -259,17 +259,17 @@ lilv_header_compare_by_uri(const void* a, const void* b, void* user_data) { const struct LilvHeader* const header_a = (const struct LilvHeader*)a; const struct LilvHeader* const header_b = (const struct LilvHeader*)b; - return strcmp(lilv_value_as_uri(header_a->uri), - lilv_value_as_uri(header_b->uri)); + return strcmp(lilv_node_as_uri(header_a->uri), + lilv_node_as_uri(header_b->uri)); } /** Get an element of a sequence of any object with an LilvHeader by URI. */ struct LilvHeader* lilv_sequence_get_by_uri(const GSequence* const_seq, - const LilvValue* uri) + const LilvNode* uri) { GSequence* seq = (GSequence*)const_seq; - struct LilvHeader key = { NULL, (LilvValue*)uri }; + struct LilvHeader key = { NULL, (LilvNode*)uri }; GSequenceIter* i = g_sequence_search( seq, &key, lilv_header_compare_by_uri, NULL); @@ -277,7 +277,7 @@ lilv_sequence_get_by_uri(const GSequence* const_seq, if (!g_sequence_iter_is_end(i)) { LilvPlugin* p = g_sequence_get(i); - if (lilv_value_equals(lilv_plugin_get_uri(p), uri)) { + if (lilv_node_equals(lilv_plugin_get_uri(p), uri)) { return (struct LilvHeader*)p; } } @@ -286,7 +286,7 @@ lilv_sequence_get_by_uri(const GSequence* const_seq, // Check if i is just past a match i = g_sequence_iter_prev(i); LilvPlugin* p = g_sequence_get(i); - if (lilv_value_equals(lilv_plugin_get_uri(p), uri)) { + if (lilv_node_equals(lilv_plugin_get_uri(p), uri)) { return (struct LilvHeader*)p; } } @@ -300,9 +300,9 @@ lilv_world_add_spec(LilvWorld* world, const SordNode* bundle_node) { LilvSpec* spec = malloc(sizeof(struct LilvSpecImpl)); - spec->spec = lilv_node_copy(specification_node); - spec->bundle = lilv_node_copy(bundle_node); - spec->data_uris = lilv_values_new(); + spec->spec = sord_node_copy(specification_node); + spec->bundle = sord_node_copy(bundle_node); + spec->data_uris = lilv_nodes_new(); // Add all plugin data files (rdfs:seeAlso) SordIter* files = lilv_world_find_statements( @@ -314,7 +314,7 @@ lilv_world_add_spec(LilvWorld* world, FOREACH_MATCH(files) { const SordNode* file_node = lilv_match_object(files); lilv_array_append(spec->data_uris, - lilv_value_new_from_node(world, file_node)); + lilv_node_new_from_node(world, file_node)); } lilv_match_end(files); @@ -329,20 +329,20 @@ lilv_world_add_plugin(LilvWorld* world, const SordNode* dyn_manifest_lib, const SordNode* bundle_node) { - LilvValue* plugin_uri = lilv_value_new_from_node(world, plugin_node); + LilvNode* plugin_uri = lilv_node_new_from_node(world, plugin_node); const LilvPlugin* last = lilv_plugins_get_by_uri(world->plugins, plugin_uri); if (last) { - LILV_ERRORF("Duplicate plugin <%s>\n", lilv_value_as_uri(plugin_uri)); - LILV_ERRORF("... found in %s\n", lilv_value_as_string( + LILV_ERRORF("Duplicate plugin <%s>\n", lilv_node_as_uri(plugin_uri)); + LILV_ERRORF("... found in %s\n", lilv_node_as_string( lilv_plugin_get_bundle_uri(last))); LILV_ERRORF("... and %s\n", sord_node_get_string(bundle_node)); - lilv_value_free(plugin_uri); + lilv_node_free(plugin_uri); return; } // Create LilvPlugin - LilvValue* bundle_uri = lilv_value_new_from_node(world, bundle_node); + LilvNode* bundle_uri = lilv_node_new_from_node(world, bundle_node); LilvPlugin* plugin = lilv_plugin_new(world, plugin_uri, bundle_uri); // Add manifest as plugin data file (as if it were rdfs:seeAlso) @@ -351,7 +351,7 @@ lilv_world_add_plugin(LilvWorld* world, // Set dynamic manifest library URI, if applicable if (dyn_manifest_lib) { - plugin->dynman_uri = lilv_value_new_from_node(world, dyn_manifest_lib); + plugin->dynman_uri = lilv_node_new_from_node(world, dyn_manifest_lib); } // Add all plugin data files (rdfs:seeAlso) @@ -364,7 +364,7 @@ lilv_world_add_plugin(LilvWorld* world, FOREACH_MATCH(files) { const SordNode* file_node = lilv_match_object(files); lilv_array_append(plugin->data_uris, - lilv_value_new_from_node(world, file_node)); + lilv_node_new_from_node(world, file_node)); } lilv_match_end(files); @@ -478,9 +478,9 @@ lilv_world_load_dyn_manifest(LilvWorld* world, LILV_API void -lilv_world_load_bundle(LilvWorld* world, LilvValue* bundle_uri) +lilv_world_load_bundle(LilvWorld* world, LilvNode* bundle_uri) { - if (!lilv_value_is_uri(bundle_uri)) { + if (!lilv_node_is_uri(bundle_uri)) { LILV_ERROR("Bundle 'URI' is not a URI\n"); return; } @@ -591,9 +591,9 @@ lilv_world_load_directory(LilvWorld* world, const char* dir_path) DIR* const bundle_dir = opendir(uri + file_scheme_len); if (bundle_dir) { closedir(bundle_dir); - LilvValue* uri_val = lilv_new_uri(world, uri); + LilvNode* uri_val = lilv_new_uri(world, uri); lilv_world_load_bundle(world, uri_val); - lilv_value_free(uri_val); + lilv_node_free(uri_val); } else { LILV_WARNF("failed to open bundle `%s'\n", uri); } @@ -653,10 +653,10 @@ lilv_world_load_specifications(LilvWorld* world) { for (GSList* l = world->specs; l; l = l->next) { LilvSpec* spec = (LilvSpec*)l->data; - LILV_FOREACH(values, f, spec->data_uris) { - LilvValue* file = lilv_collection_get(spec->data_uris, f); + LILV_FOREACH(nodes, f, spec->data_uris) { + LilvNode* file = lilv_collection_get(spec->data_uris, f); sord_read_file(world->model, - (const uint8_t*)lilv_value_as_uri(file), + (const uint8_t*)lilv_node_as_uri(file), NULL, lilv_world_blank_node_prefix(world)); } @@ -743,14 +743,14 @@ lilv_world_load_all(LilvWorld* world) LILV_FOREACH(plugins, p, world->plugins) { const LilvPlugin* plugin = lilv_collection_get(world->plugins, p); - const LilvValue* plugin_uri = lilv_plugin_get_uri(plugin); + const LilvNode* plugin_uri = lilv_plugin_get_uri(plugin); // ?new dc:replaces plugin SordIter* replacement = lilv_world_find_statements( world, world->model, NULL, world->dc_replaces_node, - lilv_value_as_node(plugin_uri), + lilv_node_as_node(plugin_uri), NULL); if (!sord_iter_end(replacement)) { /* TODO: Check if replacement is actually a known plugin, diff --git a/swig/lilv.i b/swig/lilv.i index c3943dd..0d7c83c 100644 --- a/swig/lilv.i +++ b/swig/lilv.i @@ -31,7 +31,7 @@ namespace Lilv { %} }; -%extend Value { +%extend Node { %pythoncode %{ def __str__(self): return lilv_value_get_turtle_token(self.me) diff --git a/test/lilv_test.c b/test/lilv_test.c index 300184c..24c5f5b 100644 --- a/test/lilv_test.c +++ b/test/lilv_test.c @@ -162,8 +162,8 @@ struct TestCase { #define LICENSE_GPL "doap:license <http://usefulinc.com/doap/licenses/gpl>" static char *uris_plugin = "http://example.org/plug"; -static LilvValue* plugin_uri_value; -static LilvValue* plugin2_uri_value; +static LilvNode* plugin_uri_value; +static LilvNode* plugin2_uri_value; /*****************************************************************************/ @@ -179,8 +179,8 @@ init_uris() void cleanup_uris() { - lilv_value_free(plugin2_uri_value); - lilv_value_free(plugin_uri_value); + lilv_node_free(plugin2_uri_value); + lilv_node_free(plugin_uri_value); plugin2_uri_value = NULL; plugin_uri_value = NULL; } @@ -215,91 +215,91 @@ test_value() init_uris(); - LilvValue* uval = lilv_new_uri(world, "http://example.org"); - LilvValue* sval = lilv_new_string(world, "Foo"); - LilvValue* ival = lilv_new_int(world, 42); - LilvValue* fval = lilv_new_float(world, 1.6180); + LilvNode* uval = lilv_new_uri(world, "http://example.org"); + LilvNode* sval = lilv_new_string(world, "Foo"); + LilvNode* ival = lilv_new_int(world, 42); + LilvNode* fval = lilv_new_float(world, 1.6180); - TEST_ASSERT(lilv_value_is_uri(uval)); - TEST_ASSERT(lilv_value_is_string(sval)); - TEST_ASSERT(lilv_value_is_int(ival)); - TEST_ASSERT(lilv_value_is_float(fval)); + TEST_ASSERT(lilv_node_is_uri(uval)); + TEST_ASSERT(lilv_node_is_string(sval)); + TEST_ASSERT(lilv_node_is_int(ival)); + TEST_ASSERT(lilv_node_is_float(fval)); - TEST_ASSERT(!lilv_value_is_literal(uval)); - TEST_ASSERT(lilv_value_is_literal(sval)); - TEST_ASSERT(lilv_value_is_literal(ival)); - TEST_ASSERT(lilv_value_is_literal(fval)); + TEST_ASSERT(!lilv_node_is_literal(uval)); + TEST_ASSERT(lilv_node_is_literal(sval)); + TEST_ASSERT(lilv_node_is_literal(ival)); + TEST_ASSERT(lilv_node_is_literal(fval)); - TEST_ASSERT(!strcmp(lilv_value_as_uri(uval), "http://example.org")); - TEST_ASSERT(!strcmp(lilv_value_as_string(sval), "Foo")); - TEST_ASSERT(lilv_value_as_int(ival) == 42); - TEST_ASSERT(fabs(lilv_value_as_float(fval) - 1.6180) < FLT_EPSILON); + TEST_ASSERT(!strcmp(lilv_node_as_uri(uval), "http://example.org")); + TEST_ASSERT(!strcmp(lilv_node_as_string(sval), "Foo")); + TEST_ASSERT(lilv_node_as_int(ival) == 42); + TEST_ASSERT(fabs(lilv_node_as_float(fval) - 1.6180) < FLT_EPSILON); - char* tok = lilv_value_get_turtle_token(uval); + char* tok = lilv_node_get_turtle_token(uval); TEST_ASSERT(!strcmp(tok, "<http://example.org>")); free(tok); - tok = lilv_value_get_turtle_token(sval); + tok = lilv_node_get_turtle_token(sval); TEST_ASSERT(!strcmp(tok, "Foo")); free(tok); - tok = lilv_value_get_turtle_token(ival); + tok = lilv_node_get_turtle_token(ival); TEST_ASSERT(!strcmp(tok, "42")); free(tok); - tok = lilv_value_get_turtle_token(fval); + tok = lilv_node_get_turtle_token(fval); TEST_ASSERT(!strncmp(tok, "1.6180", 6)); free(tok); - LilvValue* uval_e = lilv_new_uri(world, "http://example.org"); - LilvValue* sval_e = lilv_new_string(world, "Foo"); - LilvValue* ival_e = lilv_new_int(world, 42); - LilvValue* fval_e = lilv_new_float(world, 1.6180); - LilvValue* uval_ne = lilv_new_uri(world, "http://no-example.org"); - LilvValue* sval_ne = lilv_new_string(world, "Bar"); - LilvValue* ival_ne = lilv_new_int(world, 24); - LilvValue* fval_ne = lilv_new_float(world, 3.14159); - - TEST_ASSERT(lilv_value_equals(uval, uval_e)); - TEST_ASSERT(lilv_value_equals(sval, sval_e)); - TEST_ASSERT(lilv_value_equals(ival, ival_e)); - TEST_ASSERT(lilv_value_equals(fval, fval_e)); - - TEST_ASSERT(!lilv_value_equals(uval, uval_ne)); - TEST_ASSERT(!lilv_value_equals(sval, sval_ne)); - TEST_ASSERT(!lilv_value_equals(ival, ival_ne)); - TEST_ASSERT(!lilv_value_equals(fval, fval_ne)); - - TEST_ASSERT(!lilv_value_equals(uval, sval)); - TEST_ASSERT(!lilv_value_equals(sval, ival)); - TEST_ASSERT(!lilv_value_equals(ival, fval)); - - LilvValue* uval_dup = lilv_value_duplicate(uval); - TEST_ASSERT(lilv_value_equals(uval, uval_dup)); - - LilvValue* ifval = lilv_new_float(world, 42.0); - TEST_ASSERT(!lilv_value_equals(ival, ifval)); - lilv_value_free(ifval); - - LilvValue* nil = NULL; - TEST_ASSERT(!lilv_value_equals(uval, nil)); - TEST_ASSERT(!lilv_value_equals(nil, uval)); - TEST_ASSERT(lilv_value_equals(nil, nil)); - - LilvValue* nil2 = lilv_value_duplicate(nil); - TEST_ASSERT(lilv_value_equals(nil, nil2)); - - lilv_value_free(uval); - lilv_value_free(sval); - lilv_value_free(ival); - lilv_value_free(fval); - lilv_value_free(uval_e); - lilv_value_free(sval_e); - lilv_value_free(ival_e); - lilv_value_free(fval_e); - lilv_value_free(uval_ne); - lilv_value_free(sval_ne); - lilv_value_free(ival_ne); - lilv_value_free(fval_ne); - lilv_value_free(uval_dup); - lilv_value_free(nil2); + LilvNode* uval_e = lilv_new_uri(world, "http://example.org"); + LilvNode* sval_e = lilv_new_string(world, "Foo"); + LilvNode* ival_e = lilv_new_int(world, 42); + LilvNode* fval_e = lilv_new_float(world, 1.6180); + LilvNode* uval_ne = lilv_new_uri(world, "http://no-example.org"); + LilvNode* sval_ne = lilv_new_string(world, "Bar"); + LilvNode* ival_ne = lilv_new_int(world, 24); + LilvNode* fval_ne = lilv_new_float(world, 3.14159); + + TEST_ASSERT(lilv_node_equals(uval, uval_e)); + TEST_ASSERT(lilv_node_equals(sval, sval_e)); + TEST_ASSERT(lilv_node_equals(ival, ival_e)); + TEST_ASSERT(lilv_node_equals(fval, fval_e)); + + TEST_ASSERT(!lilv_node_equals(uval, uval_ne)); + TEST_ASSERT(!lilv_node_equals(sval, sval_ne)); + TEST_ASSERT(!lilv_node_equals(ival, ival_ne)); + TEST_ASSERT(!lilv_node_equals(fval, fval_ne)); + + TEST_ASSERT(!lilv_node_equals(uval, sval)); + TEST_ASSERT(!lilv_node_equals(sval, ival)); + TEST_ASSERT(!lilv_node_equals(ival, fval)); + + LilvNode* uval_dup = lilv_node_duplicate(uval); + TEST_ASSERT(lilv_node_equals(uval, uval_dup)); + + LilvNode* ifval = lilv_new_float(world, 42.0); + TEST_ASSERT(!lilv_node_equals(ival, ifval)); + lilv_node_free(ifval); + + LilvNode* nil = NULL; + TEST_ASSERT(!lilv_node_equals(uval, nil)); + TEST_ASSERT(!lilv_node_equals(nil, uval)); + TEST_ASSERT(lilv_node_equals(nil, nil)); + + LilvNode* nil2 = lilv_node_duplicate(nil); + TEST_ASSERT(lilv_node_equals(nil, nil2)); + + lilv_node_free(uval); + lilv_node_free(sval); + lilv_node_free(ival); + lilv_node_free(fval); + lilv_node_free(uval_e); + lilv_node_free(sval_e); + lilv_node_free(ival_e); + lilv_node_free(fval_e); + lilv_node_free(uval_ne); + lilv_node_free(sval_ne); + lilv_node_free(ival_ne); + lilv_node_free(fval_ne); + lilv_node_free(uval_dup); + lilv_node_free(nil2); cleanup_uris(); return 1; @@ -312,16 +312,16 @@ static int discovery_plugin_found = 0; static void discovery_verify_plugin(const LilvPlugin* plugin) { - const LilvValue* value = lilv_plugin_get_uri(plugin); - if (lilv_value_equals(value, plugin_uri_value)) { - const LilvValue* lib_uri = NULL; - TEST_ASSERT(!lilv_value_equals(value, plugin2_uri_value)); + const LilvNode* value = lilv_plugin_get_uri(plugin); + if (lilv_node_equals(value, plugin_uri_value)) { + const LilvNode* lib_uri = NULL; + TEST_ASSERT(!lilv_node_equals(value, plugin2_uri_value)); discovery_plugin_found = 1; lib_uri = lilv_plugin_get_library_uri(plugin); TEST_ASSERT(lib_uri); - TEST_ASSERT(lilv_value_is_uri(lib_uri)); - TEST_ASSERT(lilv_value_as_uri(lib_uri)); - TEST_ASSERT(strstr(lilv_value_as_uri(lib_uri), "foo.so")); + TEST_ASSERT(lilv_node_is_uri(lib_uri)); + TEST_ASSERT(lilv_node_as_uri(lib_uri)); + TEST_ASSERT(strstr(lilv_node_as_uri(lib_uri), "foo.so")); TEST_ASSERT(lilv_plugin_verify(plugin)); } } @@ -350,9 +350,9 @@ test_discovery() TEST_ASSERT(explug2 == NULL); if (explug) { - LilvValue* name = lilv_plugin_get_name(explug); - TEST_ASSERT(!strcmp(lilv_value_as_string(name), "Test plugin")); - lilv_value_free(name); + LilvNode* name = lilv_plugin_get_name(explug); + TEST_ASSERT(!strcmp(lilv_node_as_string(name), "Test plugin")); + lilv_node_free(name); } discovery_plugin_found = 0; @@ -435,19 +435,19 @@ test_classes() TEST_ASSERT(lilv_plugin_class_get_parent_uri(plugin) == NULL); TEST_ASSERT(lilv_plugin_classes_size(classes) > lilv_plugin_classes_size(children)); - TEST_ASSERT(!strcmp(lilv_value_as_string(lilv_plugin_class_get_label(plugin)), "Plugin")); - TEST_ASSERT(!strcmp(lilv_value_as_string(lilv_plugin_class_get_uri(plugin)), + TEST_ASSERT(!strcmp(lilv_node_as_string(lilv_plugin_class_get_label(plugin)), "Plugin")); + TEST_ASSERT(!strcmp(lilv_node_as_string(lilv_plugin_class_get_uri(plugin)), "http://lv2plug.in/ns/lv2core#Plugin")); LILV_FOREACH(plugin_classes, i, children) { - TEST_ASSERT(lilv_value_equals( + TEST_ASSERT(lilv_node_equals( lilv_plugin_class_get_parent_uri(lilv_plugin_classes_get(children, i)), lilv_plugin_class_get_uri(plugin))); } - LilvValue* some_uri = lilv_new_uri(world, "http://example.org/whatever"); + LilvNode* some_uri = lilv_new_uri(world, "http://example.org/whatever"); TEST_ASSERT(lilv_plugin_classes_get_by_uri(classes, some_uri) == NULL); - lilv_value_free(some_uri); + lilv_node_free(some_uri); lilv_plugin_classes_free(children); @@ -495,30 +495,30 @@ test_plugin() TEST_ASSERT(plug); const LilvPluginClass* class = lilv_plugin_get_class(plug); - const LilvValue* class_uri = lilv_plugin_class_get_uri(class); - TEST_ASSERT(!strcmp(lilv_value_as_string(class_uri), + const LilvNode* class_uri = lilv_plugin_class_get_uri(class); + TEST_ASSERT(!strcmp(lilv_node_as_string(class_uri), "http://lv2plug.in/ns/lv2core#CompressorPlugin")); - const LilvValue* plug_bundle_uri = lilv_plugin_get_bundle_uri(plug); - TEST_ASSERT(!strcmp(lilv_value_as_string(plug_bundle_uri), bundle_dir_uri)); + const LilvNode* plug_bundle_uri = lilv_plugin_get_bundle_uri(plug); + TEST_ASSERT(!strcmp(lilv_node_as_string(plug_bundle_uri), bundle_dir_uri)); - const LilvValues* data_uris = lilv_plugin_get_data_uris(plug); - TEST_ASSERT(lilv_values_size(data_uris) == 2); + const LilvNodes* data_uris = lilv_plugin_get_data_uris(plug); + TEST_ASSERT(lilv_nodes_size(data_uris) == 2); char* manifest_uri = (char*)malloc(TEST_PATH_MAX); char* data_uri = (char*)malloc(TEST_PATH_MAX); snprintf(manifest_uri, TEST_PATH_MAX, "%s%s", - lilv_value_as_string(plug_bundle_uri), "manifest.ttl"); + lilv_node_as_string(plug_bundle_uri), "manifest.ttl"); snprintf(data_uri, TEST_PATH_MAX, "%s%s", - lilv_value_as_string(plug_bundle_uri), "plugin.ttl"); + lilv_node_as_string(plug_bundle_uri), "plugin.ttl"); - LilvValue* manifest_uri_val = lilv_new_uri(world, manifest_uri); - TEST_ASSERT(lilv_values_contains(data_uris, manifest_uri_val)); - lilv_value_free(manifest_uri_val); + LilvNode* manifest_uri_val = lilv_new_uri(world, manifest_uri); + TEST_ASSERT(lilv_nodes_contains(data_uris, manifest_uri_val)); + lilv_node_free(manifest_uri_val); - LilvValue* data_uri_val = lilv_new_uri(world, data_uri); - TEST_ASSERT(lilv_values_contains(data_uris, data_uri_val)); - lilv_value_free(data_uri_val); + LilvNode* data_uri_val = lilv_new_uri(world, data_uri); + TEST_ASSERT(lilv_nodes_contains(data_uris, data_uri_val)); + lilv_node_free(data_uri_val); free(manifest_uri); free(data_uri); @@ -531,13 +531,13 @@ test_plugin() TEST_ASSERT(maxs[0] == 1.0f); TEST_ASSERT(defs[0] == 0.5f); - LilvValue* audio_class = lilv_new_uri(world, + LilvNode* audio_class = lilv_new_uri(world, "http://lv2plug.in/ns/lv2core#AudioPort"); - LilvValue* control_class = lilv_new_uri(world, + LilvNode* control_class = lilv_new_uri(world, "http://lv2plug.in/ns/lv2core#ControlPort"); - LilvValue* in_class = lilv_new_uri(world, + LilvNode* in_class = lilv_new_uri(world, "http://lv2plug.in/ns/lv2core#InputPort"); - LilvValue* out_class = lilv_new_uri(world, + LilvNode* out_class = lilv_new_uri(world, "http://lv2plug.in/ns/lv2core#OutputPort"); TEST_ASSERT(lilv_plugin_get_num_ports_of_class(plug, control_class, NULL) == 3); @@ -552,84 +552,84 @@ test_plugin() TEST_ASSERT(lilv_plugin_has_latency(plug)); TEST_ASSERT(lilv_plugin_get_latency_port_index(plug) == 2); - LilvValue* rt_feature = lilv_new_uri(world, + LilvNode* rt_feature = lilv_new_uri(world, "http://lv2plug.in/ns/lv2core#hardRTCapable"); - LilvValue* event_feature = lilv_new_uri(world, + LilvNode* event_feature = lilv_new_uri(world, "http://lv2plug.in/ns/ext/event"); - LilvValue* pretend_feature = lilv_new_uri(world, + LilvNode* pretend_feature = lilv_new_uri(world, "http://example.org/solvesWorldHunger"); TEST_ASSERT(lilv_plugin_has_feature(plug, rt_feature)); TEST_ASSERT(lilv_plugin_has_feature(plug, event_feature)); TEST_ASSERT(!lilv_plugin_has_feature(plug, pretend_feature)); - lilv_value_free(rt_feature); - lilv_value_free(event_feature); - lilv_value_free(pretend_feature); - - LilvValues* supported = lilv_plugin_get_supported_features(plug); - LilvValues* required = lilv_plugin_get_required_features(plug); - LilvValues* optional = lilv_plugin_get_optional_features(plug); - TEST_ASSERT(lilv_values_size(supported) == 2); - TEST_ASSERT(lilv_values_size(required) == 1); - TEST_ASSERT(lilv_values_size(optional) == 1); - lilv_values_free(supported); - lilv_values_free(required); - lilv_values_free(optional); - - LilvValue* foo_p = lilv_new_uri(world, "http://example.org/foo"); - LilvValues* foos = lilv_plugin_get_value(plug, foo_p); - TEST_ASSERT(lilv_values_size(foos) == 1); - TEST_ASSERT(fabs(lilv_value_as_float(lilv_values_get_first(foos)) - 1.6180) < FLT_EPSILON); - lilv_value_free(foo_p); - lilv_values_free(foos); - - LilvValue* bar_p = lilv_new_uri(world, "http://example.org/bar"); - LilvValues* bars = lilv_plugin_get_value(plug, bar_p); - TEST_ASSERT(lilv_values_size(bars) == 1); - TEST_ASSERT(lilv_value_as_bool(lilv_values_get_first(bars)) == true); - lilv_value_free(bar_p); - lilv_values_free(bars); - - LilvValue* baz_p = lilv_new_uri(world, "http://example.org/baz"); - LilvValues* bazs = lilv_plugin_get_value(plug, baz_p); - TEST_ASSERT(lilv_values_size(bazs) == 1); - TEST_ASSERT(lilv_value_as_bool(lilv_values_get_first(bazs)) == false); - lilv_value_free(baz_p); - lilv_values_free(bazs); - - LilvValue* author_name = lilv_plugin_get_author_name(plug); - TEST_ASSERT(!strcmp(lilv_value_as_string(author_name), "David Robillard")); - lilv_value_free(author_name); - - LilvValue* author_email = lilv_plugin_get_author_email(plug); - TEST_ASSERT(!strcmp(lilv_value_as_string(author_email), "mailto:d@drobilla.net")); - lilv_value_free(author_email); - - LilvValue* author_homepage = lilv_plugin_get_author_homepage(plug); - TEST_ASSERT(!strcmp(lilv_value_as_string(author_homepage), "http://drobilla.net")); - lilv_value_free(author_homepage); - - LilvValue* thing_uri = lilv_new_uri(world, "http://example.org/thing"); - LilvValue* name_p = lilv_new_uri(world, "http://usefulinc.com/ns/doap#name"); - LilvValues* thing_names = lilv_plugin_get_value_for_subject(plug, thing_uri, name_p); - TEST_ASSERT(lilv_values_size(thing_names) == 1); - LilvValue* thing_name = lilv_values_get_first(thing_names); + lilv_node_free(rt_feature); + lilv_node_free(event_feature); + lilv_node_free(pretend_feature); + + LilvNodes* supported = lilv_plugin_get_supported_features(plug); + LilvNodes* required = lilv_plugin_get_required_features(plug); + LilvNodes* optional = lilv_plugin_get_optional_features(plug); + TEST_ASSERT(lilv_nodes_size(supported) == 2); + TEST_ASSERT(lilv_nodes_size(required) == 1); + TEST_ASSERT(lilv_nodes_size(optional) == 1); + lilv_nodes_free(supported); + lilv_nodes_free(required); + lilv_nodes_free(optional); + + LilvNode* foo_p = lilv_new_uri(world, "http://example.org/foo"); + LilvNodes* foos = lilv_plugin_get_value(plug, foo_p); + TEST_ASSERT(lilv_nodes_size(foos) == 1); + TEST_ASSERT(fabs(lilv_node_as_float(lilv_nodes_get_first(foos)) - 1.6180) < FLT_EPSILON); + lilv_node_free(foo_p); + lilv_nodes_free(foos); + + LilvNode* bar_p = lilv_new_uri(world, "http://example.org/bar"); + LilvNodes* bars = lilv_plugin_get_value(plug, bar_p); + TEST_ASSERT(lilv_nodes_size(bars) == 1); + TEST_ASSERT(lilv_node_as_bool(lilv_nodes_get_first(bars)) == true); + lilv_node_free(bar_p); + lilv_nodes_free(bars); + + LilvNode* baz_p = lilv_new_uri(world, "http://example.org/baz"); + LilvNodes* bazs = lilv_plugin_get_value(plug, baz_p); + TEST_ASSERT(lilv_nodes_size(bazs) == 1); + TEST_ASSERT(lilv_node_as_bool(lilv_nodes_get_first(bazs)) == false); + lilv_node_free(baz_p); + lilv_nodes_free(bazs); + + LilvNode* author_name = lilv_plugin_get_author_name(plug); + TEST_ASSERT(!strcmp(lilv_node_as_string(author_name), "David Robillard")); + lilv_node_free(author_name); + + LilvNode* author_email = lilv_plugin_get_author_email(plug); + TEST_ASSERT(!strcmp(lilv_node_as_string(author_email), "mailto:d@drobilla.net")); + lilv_node_free(author_email); + + LilvNode* author_homepage = lilv_plugin_get_author_homepage(plug); + TEST_ASSERT(!strcmp(lilv_node_as_string(author_homepage), "http://drobilla.net")); + lilv_node_free(author_homepage); + + LilvNode* thing_uri = lilv_new_uri(world, "http://example.org/thing"); + LilvNode* name_p = lilv_new_uri(world, "http://usefulinc.com/ns/doap#name"); + LilvNodes* thing_names = lilv_plugin_get_value_for_subject(plug, thing_uri, name_p); + TEST_ASSERT(lilv_nodes_size(thing_names) == 1); + LilvNode* thing_name = lilv_nodes_get_first(thing_names); TEST_ASSERT(thing_name); - TEST_ASSERT(lilv_value_is_string(thing_name)); - TEST_ASSERT(!strcmp(lilv_value_as_string(thing_name), "Something else")); + TEST_ASSERT(lilv_node_is_string(thing_name)); + TEST_ASSERT(!strcmp(lilv_node_as_string(thing_name), "Something else")); LilvUIs* uis = lilv_plugin_get_uis(plug); TEST_ASSERT(lilv_uis_size(uis) == 0); lilv_uis_free(uis); - lilv_values_free(thing_names); - lilv_value_free(thing_uri); - lilv_value_free(name_p); - lilv_value_free(control_class); - lilv_value_free(audio_class); - lilv_value_free(in_class); - lilv_value_free(out_class); + lilv_nodes_free(thing_names); + lilv_node_free(thing_uri); + lilv_node_free(name_p); + lilv_node_free(control_class); + lilv_node_free(audio_class); + lilv_node_free(in_class); + lilv_node_free(out_class); cleanup_uris(); return 1; } @@ -669,66 +669,66 @@ test_port() const LilvPlugin* plug = lilv_plugins_get_by_uri(plugins, plugin_uri_value); TEST_ASSERT(plug); - LilvValue* psym = lilv_new_string(world, "foo"); + LilvNode* psym = lilv_new_string(world, "foo"); const LilvPort* p = lilv_plugin_get_port_by_index(plug, 0); const LilvPort* p2 = lilv_plugin_get_port_by_symbol(plug, psym); - lilv_value_free(psym); + lilv_node_free(psym); TEST_ASSERT(p != NULL); TEST_ASSERT(p2 != NULL); TEST_ASSERT(p == p2); - LilvValue* nopsym = lilv_new_string(world, "thisaintnoportfoo"); + LilvNode* nopsym = lilv_new_string(world, "thisaintnoportfoo"); const LilvPort* p3 = lilv_plugin_get_port_by_symbol(plug, nopsym); TEST_ASSERT(p3 == NULL); - lilv_value_free(nopsym); + lilv_node_free(nopsym); - LilvValue* audio_class = lilv_new_uri(world, + LilvNode* audio_class = lilv_new_uri(world, "http://lv2plug.in/ns/lv2core#AudioPort"); - LilvValue* control_class = lilv_new_uri(world, + LilvNode* control_class = lilv_new_uri(world, "http://lv2plug.in/ns/lv2core#ControlPort"); - LilvValue* in_class = lilv_new_uri(world, + LilvNode* in_class = lilv_new_uri(world, "http://lv2plug.in/ns/lv2core#InputPort"); - TEST_ASSERT(lilv_values_size(lilv_port_get_classes(plug, p)) == 2); + TEST_ASSERT(lilv_nodes_size(lilv_port_get_classes(plug, p)) == 2); TEST_ASSERT(lilv_plugin_get_num_ports(plug) == 2); TEST_ASSERT(lilv_port_is_a(plug, p, control_class)); TEST_ASSERT(lilv_port_is_a(plug, p, in_class)); TEST_ASSERT(!lilv_port_is_a(plug, p, audio_class)); - LilvValues* port_properties = lilv_port_get_properties(plug, p); - TEST_ASSERT(lilv_values_size(port_properties) == 1); - lilv_values_free(port_properties); + LilvNodes* port_properties = lilv_port_get_properties(plug, p); + TEST_ASSERT(lilv_nodes_size(port_properties) == 1); + lilv_nodes_free(port_properties); // Untranslated name (current locale is set to "C" in main) - TEST_ASSERT(!strcmp(lilv_value_as_string(lilv_port_get_symbol(plug, p)), "foo")); - LilvValue* name = lilv_port_get_name(plug, p); - TEST_ASSERT(!strcmp(lilv_value_as_string(name), "store")); - lilv_value_free(name); + TEST_ASSERT(!strcmp(lilv_node_as_string(lilv_port_get_symbol(plug, p)), "foo")); + LilvNode* name = lilv_port_get_name(plug, p); + TEST_ASSERT(!strcmp(lilv_node_as_string(name), "store")); + lilv_node_free(name); // Exact language match setenv("LANG", "fr_FR", 1); name = lilv_port_get_name(plug, p); - TEST_ASSERT(!strcmp(lilv_value_as_string(name), "épicerie")); - lilv_value_free(name); + TEST_ASSERT(!strcmp(lilv_node_as_string(name), "épicerie")); + lilv_node_free(name); // Exact language match (with charset suffix) setenv("LANG", "fr_CA.utf8", 1); name = lilv_port_get_name(plug, p); - TEST_ASSERT(!strcmp(lilv_value_as_string(name), "dépanneur")); - lilv_value_free(name); + TEST_ASSERT(!strcmp(lilv_node_as_string(name), "dépanneur")); + lilv_node_free(name); // Partial language match (choose value translated for different country) setenv("LANG", "fr_BE", 1); name = lilv_port_get_name(plug, p); - TEST_ASSERT((!strcmp(lilv_value_as_string(name), "dépanneur")) - ||(!strcmp(lilv_value_as_string(name), "épicerie"))); - lilv_value_free(name); + TEST_ASSERT((!strcmp(lilv_node_as_string(name), "dépanneur")) + ||(!strcmp(lilv_node_as_string(name), "épicerie"))); + lilv_node_free(name); // Partial language match (choose country-less language tagged value) setenv("LANG", "es_MX", 1); name = lilv_port_get_name(plug, p); - TEST_ASSERT(!strcmp(lilv_value_as_string(name), "tienda")); - lilv_value_free(name); + TEST_ASSERT(!strcmp(lilv_node_as_string(name), "tienda")); + lilv_node_free(name); setenv("LANG", "C", 1); // Reset locale @@ -742,81 +742,81 @@ test_port() const LilvScalePoint* sp1 = lilv_scale_points_get(points, sp_iter); TEST_ASSERT(sp1); - TEST_ASSERT(!strcmp(lilv_value_as_string(lilv_scale_point_get_label(sp0)), "Sin")); - TEST_ASSERT(lilv_value_as_float(lilv_scale_point_get_value(sp0)) == 3); - TEST_ASSERT(!strcmp(lilv_value_as_string(lilv_scale_point_get_label(sp1)), "Cos")); - TEST_ASSERT(lilv_value_as_float(lilv_scale_point_get_value(sp1)) == 4); + TEST_ASSERT(!strcmp(lilv_node_as_string(lilv_scale_point_get_label(sp0)), "Sin")); + TEST_ASSERT(lilv_node_as_float(lilv_scale_point_get_value(sp0)) == 3); + TEST_ASSERT(!strcmp(lilv_node_as_string(lilv_scale_point_get_label(sp1)), "Cos")); + TEST_ASSERT(lilv_node_as_float(lilv_scale_point_get_value(sp1)) == 4); - LilvValue* homepage_p = lilv_new_uri(world, "http://usefulinc.com/ns/doap#homepage"); - LilvValues* homepages = lilv_plugin_get_value(plug, homepage_p); - TEST_ASSERT(lilv_values_size(homepages) == 1); - TEST_ASSERT(!strcmp(lilv_value_as_string(lilv_values_get_first(homepages)), + LilvNode* homepage_p = lilv_new_uri(world, "http://usefulinc.com/ns/doap#homepage"); + LilvNodes* homepages = lilv_plugin_get_value(plug, homepage_p); + TEST_ASSERT(lilv_nodes_size(homepages) == 1); + TEST_ASSERT(!strcmp(lilv_node_as_string(lilv_nodes_get_first(homepages)), "http://example.org/someplug")); - LilvValue *min, *max, *def; + LilvNode *min, *max, *def; lilv_port_get_range(plug, p, &def, &min, &max); TEST_ASSERT(def); TEST_ASSERT(min); TEST_ASSERT(max); - TEST_ASSERT(lilv_value_as_float(def) == 0.5); - TEST_ASSERT(lilv_value_as_float(min) == -1.0); - TEST_ASSERT(lilv_value_as_float(max) == 1.0); + TEST_ASSERT(lilv_node_as_float(def) == 0.5); + TEST_ASSERT(lilv_node_as_float(min) == -1.0); + TEST_ASSERT(lilv_node_as_float(max) == 1.0); - LilvValue* integer_prop = lilv_new_uri(world, "http://lv2plug.in/ns/lv2core#integer"); - LilvValue* toggled_prop = lilv_new_uri(world, "http://lv2plug.in/ns/lv2core#toggled"); + LilvNode* integer_prop = lilv_new_uri(world, "http://lv2plug.in/ns/lv2core#integer"); + LilvNode* toggled_prop = lilv_new_uri(world, "http://lv2plug.in/ns/lv2core#toggled"); TEST_ASSERT(lilv_port_has_property(plug, p, integer_prop)); TEST_ASSERT(!lilv_port_has_property(plug, p, toggled_prop)); const LilvPort* ep = lilv_plugin_get_port_by_index(plug, 1); - LilvValue* event_type = lilv_new_uri(world, "http://example.org/event"); - LilvValue* event_type_2 = lilv_new_uri(world, "http://example.org/otherEvent"); + LilvNode* event_type = lilv_new_uri(world, "http://example.org/event"); + LilvNode* event_type_2 = lilv_new_uri(world, "http://example.org/otherEvent"); TEST_ASSERT(lilv_port_supports_event(plug, ep, event_type)); TEST_ASSERT(!lilv_port_supports_event(plug, ep, event_type_2)); - LilvValue* name_p = lilv_new_uri(world, "http://lv2plug.in/ns/lv2core#name"); - LilvValues* names = lilv_port_get_value(plug, p, name_p); - TEST_ASSERT(lilv_values_size(names) == 1); - TEST_ASSERT(!strcmp(lilv_value_as_string(lilv_values_get_first(names)), + LilvNode* name_p = lilv_new_uri(world, "http://lv2plug.in/ns/lv2core#name"); + LilvNodes* names = lilv_port_get_value(plug, p, name_p); + TEST_ASSERT(lilv_nodes_size(names) == 1); + TEST_ASSERT(!strcmp(lilv_node_as_string(lilv_nodes_get_first(names)), "store")); - lilv_values_free(names); + lilv_nodes_free(names); - LilvValue* true_val = lilv_new_bool(world, true); - LilvValue* false_val = lilv_new_bool(world, false); + LilvNode* true_val = lilv_new_bool(world, true); + LilvNode* false_val = lilv_new_bool(world, false); lilv_world_set_option(world, LILV_OPTION_FILTER_LANG, false_val); names = lilv_port_get_value(plug, p, name_p); - TEST_ASSERT(lilv_values_size(names) == 4); - lilv_values_free(names); + TEST_ASSERT(lilv_nodes_size(names) == 4); + lilv_nodes_free(names); lilv_world_set_option(world, LILV_OPTION_FILTER_LANG, true_val); - lilv_value_free(false_val); - lilv_value_free(true_val); + lilv_node_free(false_val); + lilv_node_free(true_val); names = lilv_port_get_value(plug, ep, name_p); - TEST_ASSERT(lilv_values_size(names) == 1); - TEST_ASSERT(!strcmp(lilv_value_as_string(lilv_values_get_first(names)), + TEST_ASSERT(lilv_nodes_size(names) == 1); + TEST_ASSERT(!strcmp(lilv_node_as_string(lilv_nodes_get_first(names)), "Event Input")); - lilv_values_free(names); - lilv_value_free(name_p); + lilv_nodes_free(names); + lilv_node_free(name_p); - lilv_value_free(integer_prop); - lilv_value_free(toggled_prop); - lilv_value_free(event_type); - lilv_value_free(event_type_2); + lilv_node_free(integer_prop); + lilv_node_free(toggled_prop); + lilv_node_free(event_type); + lilv_node_free(event_type_2); - lilv_value_free(min); - lilv_value_free(max); - lilv_value_free(def); + lilv_node_free(min); + lilv_node_free(max); + lilv_node_free(def); - lilv_value_free(homepage_p); - lilv_values_free(homepages); + lilv_node_free(homepage_p); + lilv_nodes_free(homepages); lilv_scale_points_free(points); - lilv_value_free(control_class); - lilv_value_free(audio_class); - lilv_value_free(in_class); + lilv_node_free(control_class); + lilv_node_free(audio_class); + lilv_node_free(in_class); cleanup_uris(); return 1; } @@ -870,10 +870,10 @@ test_ui() const LilvUI* ui0 = lilv_uis_get(uis, lilv_uis_begin(uis)); TEST_ASSERT(ui0); - LilvValue* ui_uri = lilv_new_uri(world, "http://example.org/ui"); - LilvValue* ui2_uri = lilv_new_uri(world, "http://example.org/ui3"); - LilvValue* ui3_uri = lilv_new_uri(world, "http://example.org/ui4"); - LilvValue* noui_uri = lilv_new_uri(world, "http://example.org/notaui"); + LilvNode* ui_uri = lilv_new_uri(world, "http://example.org/ui"); + LilvNode* ui2_uri = lilv_new_uri(world, "http://example.org/ui3"); + LilvNode* ui3_uri = lilv_new_uri(world, "http://example.org/ui4"); + LilvNode* noui_uri = lilv_new_uri(world, "http://example.org/notaui"); const LilvUI* ui0_2 = lilv_uis_get_by_uri(uis, ui_uri); TEST_ASSERT(ui0 == ui0_2); @@ -887,35 +887,35 @@ test_ui() const LilvUI* noui = lilv_uis_get_by_uri(uis, noui_uri); TEST_ASSERT(noui == NULL); - const LilvValues* classes = lilv_ui_get_classes(ui0); - TEST_ASSERT(lilv_values_size(classes) == 1); + const LilvNodes* classes = lilv_ui_get_classes(ui0); + TEST_ASSERT(lilv_nodes_size(classes) == 1); - LilvValue* ui_class_uri = lilv_new_uri(world, + LilvNode* ui_class_uri = lilv_new_uri(world, "http://lv2plug.in/ns/extensions/ui#GtkUI"); - TEST_ASSERT(lilv_value_equals(lilv_values_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)); - const LilvValue* plug_bundle_uri = lilv_plugin_get_bundle_uri(plug); - const LilvValue* ui_bundle_uri = lilv_ui_get_bundle_uri(ui0); - TEST_ASSERT(lilv_value_equals(plug_bundle_uri, ui_bundle_uri)); + const LilvNode* plug_bundle_uri = lilv_plugin_get_bundle_uri(plug); + const LilvNode* ui_bundle_uri = lilv_ui_get_bundle_uri(ui0); + TEST_ASSERT(lilv_node_equals(plug_bundle_uri, ui_bundle_uri)); char* ui_binary_uri_str = (char*)malloc(TEST_PATH_MAX); snprintf(ui_binary_uri_str, TEST_PATH_MAX, "%s%s", - lilv_value_as_string(plug_bundle_uri), "ui.so"); + lilv_node_as_string(plug_bundle_uri), "ui.so"); - const LilvValue* ui_binary_uri = lilv_ui_get_binary_uri(ui0); + const LilvNode* ui_binary_uri = lilv_ui_get_binary_uri(ui0); - LilvValue* expected_uri = lilv_new_uri(world, ui_binary_uri_str); - TEST_ASSERT(lilv_value_equals(expected_uri, ui_binary_uri)); + LilvNode* expected_uri = lilv_new_uri(world, ui_binary_uri_str); + TEST_ASSERT(lilv_node_equals(expected_uri, ui_binary_uri)); free(ui_binary_uri_str); - lilv_value_free(ui_class_uri); - lilv_value_free(ui_uri); - lilv_value_free(ui2_uri); - lilv_value_free(ui3_uri); - lilv_value_free(noui_uri); - lilv_value_free(expected_uri); + lilv_node_free(ui_class_uri); + lilv_node_free(ui_uri); + lilv_node_free(ui2_uri); + lilv_node_free(ui3_uri); + lilv_node_free(noui_uri); + lilv_node_free(expected_uri); lilv_uis_free(uis); cleanup_uris(); diff --git a/utils/lv2_inspect.c b/utils/lv2_inspect.c index 46176f5..48d2935 100644 --- a/utils/lv2_inspect.c +++ b/utils/lv2_inspect.c @@ -24,23 +24,23 @@ #include "lilv-config.h" -LilvValue* event_class = NULL; -LilvValue* control_class = NULL; -LilvValue* in_group_pred = NULL; -LilvValue* role_pred = NULL; -LilvValue* preset_pred = NULL; -LilvValue* title_pred = NULL; -LilvValue* supports_event_pred = NULL; +LilvNode* event_class = NULL; +LilvNode* control_class = NULL; +LilvNode* in_group_pred = NULL; +LilvNode* role_pred = NULL; +LilvNode* preset_pred = NULL; +LilvNode* title_pred = NULL; +LilvNode* supports_event_pred = NULL; void print_group(const LilvPlugin* p, - const LilvValue* group, - LilvValue* type, - LilvValue* symbol) + const LilvNode* group, + LilvNode* type, + LilvNode* symbol) { - printf("\n\tGroup %s:\n", lilv_value_as_string(group)); - printf("\t\tType: %s\n", lilv_value_as_string(type)); - printf("\t\tSymbol: %s\n", lilv_value_as_string(symbol)); + printf("\n\tGroup %s:\n", lilv_node_as_string(group)); + printf("\t\tType: %s\n", lilv_node_as_string(type)); + printf("\t\tSymbol: %s\n", lilv_node_as_string(symbol)); } void @@ -61,28 +61,28 @@ print_port(const LilvPlugin* p, bool first = true; - const LilvValues* classes = lilv_port_get_classes(p, port); + const LilvNodes* classes = lilv_port_get_classes(p, port); printf("\t\tType: "); - LILV_FOREACH(values, i, classes) { - const LilvValue* value = lilv_values_get(classes, i); + LILV_FOREACH(nodes, i, classes) { + const LilvNode* value = lilv_nodes_get(classes, i); if (!first) { printf("\n\t\t "); } - printf("%s", lilv_value_as_uri(value)); + printf("%s", lilv_node_as_uri(value)); first = false; } if (lilv_port_is_a(p, port, event_class)) { - LilvValues* supported = lilv_port_get_value( + LilvNodes* supported = lilv_port_get_value( p, port, supports_event_pred); - if (lilv_values_size(supported) > 0) { + if (lilv_nodes_size(supported) > 0) { printf("\n\t\tSupported events:\n"); - LILV_FOREACH(values, i, supported) { - const LilvValue* value = lilv_values_get(supported, i); - printf("\t\t\t%s\n", lilv_value_as_uri(value)); + LILV_FOREACH(nodes, i, supported) { + const LilvNode* value = lilv_nodes_get(supported, i); + printf("\t\t\t%s\n", lilv_node_as_uri(value)); } } - lilv_values_free(supported); + lilv_nodes_free(supported); } LilvScalePoints* points = lilv_port_get_scale_points(p, port); @@ -91,31 +91,31 @@ print_port(const LilvPlugin* p, LILV_FOREACH(scale_points, i, points) { const LilvScalePoint* p = lilv_scale_points_get(points, i); printf("\t\t\t%s = \"%s\"\n", - lilv_value_as_string(lilv_scale_point_get_value(p)), - lilv_value_as_string(lilv_scale_point_get_label(p))); + lilv_node_as_string(lilv_scale_point_get_value(p)), + lilv_node_as_string(lilv_scale_point_get_label(p))); } lilv_scale_points_free(points); - const LilvValue* sym = lilv_port_get_symbol(p, port); - printf("\n\t\tSymbol: %s\n", lilv_value_as_string(sym)); + const LilvNode* sym = lilv_port_get_symbol(p, port); + printf("\n\t\tSymbol: %s\n", lilv_node_as_string(sym)); - LilvValue* name = lilv_port_get_name(p, port); - printf("\t\tName: %s\n", lilv_value_as_string(name)); - lilv_value_free(name); + LilvNode* name = lilv_port_get_name(p, port); + printf("\t\tName: %s\n", lilv_node_as_string(name)); + lilv_node_free(name); - LilvValues* groups = lilv_port_get_value(p, port, in_group_pred); - if (lilv_values_size(groups) > 0) + LilvNodes* groups = lilv_port_get_value(p, port, in_group_pred); + if (lilv_nodes_size(groups) > 0) printf("\t\tGroup: %s\n", - lilv_value_as_string( - lilv_values_get(groups, lilv_values_begin(groups)))); - lilv_values_free(groups); + lilv_node_as_string( + lilv_nodes_get(groups, lilv_nodes_begin(groups)))); + lilv_nodes_free(groups); - LilvValues* roles = lilv_port_get_value(p, port, role_pred); - if (lilv_values_size(roles) > 0) + LilvNodes* roles = lilv_port_get_value(p, port, role_pred); + if (lilv_nodes_size(roles) > 0) printf("\t\tRole: %s\n", - lilv_value_as_string( - lilv_values_get(roles, lilv_values_begin(roles)))); - lilv_values_free(roles); + lilv_node_as_string( + lilv_nodes_get(roles, lilv_nodes_begin(roles)))); + lilv_nodes_free(roles); if (lilv_port_is_a(p, port, control_class)) { if (!isnan(mins[index])) @@ -126,57 +126,57 @@ print_port(const LilvPlugin* p, printf("\t\tDefault: %f\n", defaults[index]); } - LilvValues* properties = lilv_port_get_properties(p, port); - if (lilv_values_size(properties) > 0) + LilvNodes* properties = lilv_port_get_properties(p, port); + if (lilv_nodes_size(properties) > 0) printf("\t\tProperties: "); first = true; - LILV_FOREACH(values, i, properties) { + LILV_FOREACH(nodes, i, properties) { if (!first) { printf("\t\t "); } - printf("%s\n", lilv_value_as_uri(lilv_values_get(properties, i))); + printf("%s\n", lilv_node_as_uri(lilv_nodes_get(properties, i))); first = false; } - if (lilv_values_size(properties) > 0) + if (lilv_nodes_size(properties) > 0) printf("\n"); - lilv_values_free(properties); + lilv_nodes_free(properties); } void print_plugin(const LilvPlugin* p) { - LilvValue* val = NULL; + LilvNode* val = NULL; - printf("%s\n\n", lilv_value_as_uri(lilv_plugin_get_uri(p))); + printf("%s\n\n", lilv_node_as_uri(lilv_plugin_get_uri(p))); val = lilv_plugin_get_name(p); if (val) { - printf("\tName: %s\n", lilv_value_as_string(val)); - lilv_value_free(val); + printf("\tName: %s\n", lilv_node_as_string(val)); + lilv_node_free(val); } const LilvPluginClass* pclass = lilv_plugin_get_class(p); - const LilvValue* class_label = lilv_plugin_class_get_label(pclass); + const LilvNode* class_label = lilv_plugin_class_get_label(pclass); if (class_label) { - printf("\tClass: %s\n", lilv_value_as_string(class_label)); + printf("\tClass: %s\n", lilv_node_as_string(class_label)); } val = lilv_plugin_get_author_name(p); if (val) { - printf("\tAuthor: %s\n", lilv_value_as_string(val)); - lilv_value_free(val); + printf("\tAuthor: %s\n", lilv_node_as_string(val)); + lilv_node_free(val); } val = lilv_plugin_get_author_email(p); if (val) { - printf("\tAuthor Email: %s\n", lilv_value_as_uri(val)); - lilv_value_free(val); + printf("\tAuthor Email: %s\n", lilv_node_as_uri(val)); + lilv_node_free(val); } val = lilv_plugin_get_author_homepage(p); if (val) { - printf("\tAuthor Homepage: %s\n", lilv_value_as_uri(val)); - lilv_value_free(val); + printf("\tAuthor Homepage: %s\n", lilv_node_as_uri(val)); + lilv_node_free(val); } if (lilv_plugin_has_latency(p)) { @@ -187,66 +187,66 @@ print_plugin(const LilvPlugin* p) } printf("\tBundle: %s\n", - lilv_value_as_uri(lilv_plugin_get_bundle_uri(p))); + lilv_node_as_uri(lilv_plugin_get_bundle_uri(p))); - const LilvValue* binary_uri = lilv_plugin_get_library_uri(p); + const LilvNode* binary_uri = lilv_plugin_get_library_uri(p); if (binary_uri) { printf("\tBinary: %s\n", - lilv_value_as_uri(lilv_plugin_get_library_uri(p))); + lilv_node_as_uri(lilv_plugin_get_library_uri(p))); } LilvUIs* uis = lilv_plugin_get_uis(p); - if (lilv_values_size(uis) > 0) { + if (lilv_nodes_size(uis) > 0) { printf("\tUI: "); LILV_FOREACH(uis, i, uis) { const LilvUI* ui = lilv_uis_get(uis, i); - printf("%s\n", lilv_value_as_uri(lilv_ui_get_uri(ui))); + printf("%s\n", lilv_node_as_uri(lilv_ui_get_uri(ui))); - const char* binary = lilv_value_as_uri(lilv_ui_get_binary_uri(ui)); + const char* binary = lilv_node_as_uri(lilv_ui_get_binary_uri(ui)); - const LilvValues* types = lilv_ui_get_classes(ui); - LILV_FOREACH(values, i, types) { + const LilvNodes* types = lilv_ui_get_classes(ui); + LILV_FOREACH(nodes, i, types) { printf("\t Class: %s\n", - lilv_value_as_uri(lilv_values_get(types, i))); + lilv_node_as_uri(lilv_nodes_get(types, i))); } if (binary) printf("\t Binary: %s\n", binary); printf("\t Bundle: %s\n", - lilv_value_as_uri(lilv_ui_get_bundle_uri(ui))); + lilv_node_as_uri(lilv_ui_get_bundle_uri(ui))); } } lilv_uis_free(uis); printf("\tData URIs: "); - const LilvValues* data_uris = lilv_plugin_get_data_uris(p); + const LilvNodes* data_uris = lilv_plugin_get_data_uris(p); bool first = true; - LILV_FOREACH(values, i, data_uris) { + LILV_FOREACH(nodes, i, data_uris) { if (!first) { printf("\n\t "); } - printf("%s", lilv_value_as_uri(lilv_values_get(data_uris, i))); + printf("%s", lilv_node_as_uri(lilv_nodes_get(data_uris, i))); first = false; } printf("\n"); /* Required Features */ - LilvValues* features = lilv_plugin_get_required_features(p); + LilvNodes* features = lilv_plugin_get_required_features(p); if (features) printf("\tRequired Features: "); first = true; - LILV_FOREACH(values, i, features) { + LILV_FOREACH(nodes, i, features) { if (!first) { printf("\n\t "); } - printf("%s", lilv_value_as_uri(lilv_values_get(features, i))); + printf("%s", lilv_node_as_uri(lilv_nodes_get(features, i))); first = false; } if (features) printf("\n"); - lilv_values_free(features); + lilv_nodes_free(features); /* Optional Features */ @@ -254,28 +254,28 @@ print_plugin(const LilvPlugin* p) if (features) printf("\tOptional Features: "); first = true; - LILV_FOREACH(values, i, features) { + LILV_FOREACH(nodes, i, features) { if (!first) { printf("\n\t "); } - printf("%s", lilv_value_as_uri(lilv_values_get(features, i))); + printf("%s", lilv_node_as_uri(lilv_nodes_get(features, i))); first = false; } if (features) printf("\n"); - lilv_values_free(features); + lilv_nodes_free(features); /* Presets */ - LilvValues* presets = lilv_plugin_get_value(p, preset_pred); + LilvNodes* presets = lilv_plugin_get_value(p, preset_pred); if (presets) printf("\tPresets: \n"); - LILV_FOREACH(values, i, presets) { - LilvValues* titles = lilv_plugin_get_value_for_subject( - p, lilv_values_get(presets, i), title_pred); + LILV_FOREACH(nodes, i, presets) { + LilvNodes* titles = lilv_plugin_get_value_for_subject( + p, lilv_nodes_get(presets, i), title_pred); if (titles) { - const LilvValue* title = lilv_values_get(titles, lilv_values_begin(titles)); - printf("\t %s\n", lilv_value_as_string(title)); + const LilvNode* title = lilv_nodes_get(titles, lilv_nodes_begin(titles)); + printf("\t %s\n", lilv_node_as_string(title)); } } @@ -356,7 +356,7 @@ main(int argc, char** argv) } const LilvPlugins* plugins = lilv_world_get_all_plugins(world); - LilvValue* uri = lilv_new_uri(world, argv[1]); + LilvNode* uri = lilv_new_uri(world, argv[1]); const LilvPlugin* p = lilv_plugins_get_by_uri(plugins, uri); @@ -368,15 +368,15 @@ main(int argc, char** argv) ret = (p != NULL ? 0 : -1); - lilv_value_free(uri); + lilv_node_free(uri); done: - lilv_value_free(title_pred); - lilv_value_free(role_pred); - lilv_value_free(preset_pred); - lilv_value_free(in_group_pred); - lilv_value_free(event_class); - lilv_value_free(control_class); + lilv_node_free(title_pred); + lilv_node_free(role_pred); + lilv_node_free(preset_pred); + lilv_node_free(in_group_pred); + lilv_node_free(event_class); + lilv_node_free(control_class); lilv_world_free(world); return ret; } diff --git a/utils/lv2_jack_host.c b/utils/lv2_jack_host.c index 24e1c1a..8a388f3 100644 --- a/utils/lv2_jack_host.c +++ b/utils/lv2_jack_host.c @@ -66,13 +66,13 @@ struct JackHost { LilvInstance* instance; /**< Plugin "instance" (loaded shared lib) */ uint32_t num_ports; /**< Size of the two following arrays: */ struct Port* ports; /**< Port array of size num_ports */ - LilvValue* input_class; /**< Input port class (URI) */ - LilvValue* output_class; /**< Output port class (URI) */ - LilvValue* control_class; /**< Control port class (URI) */ - LilvValue* audio_class; /**< Audio port class (URI) */ - LilvValue* event_class; /**< Event port class (URI) */ - LilvValue* midi_class; /**< MIDI event class (URI) */ - LilvValue* optional; /**< lv2:connectionOptional port property */ + LilvNode* input_class; /**< Input port class (URI) */ + LilvNode* output_class; /**< Output port class (URI) */ + LilvNode* control_class; /**< Control port class (URI) */ + LilvNode* audio_class; /**< Audio port class (URI) */ + LilvNode* event_class; /**< Event port class (URI) */ + LilvNode* midi_class; /**< MIDI event class (URI) */ + LilvNode* optional; /**< lv2:connectionOptional port property */ }; /** URI map feature, for event types (we use only MIDI) */ @@ -126,8 +126,8 @@ create_port(struct JackHost* host, lilv_instance_connect_port(host->instance, port_index, NULL); /* Get the port symbol for console printing */ - const LilvValue* symbol = lilv_port_get_symbol(host->plugin, port->lilv_port); - const char* symbol_str = lilv_value_as_string(symbol); + const LilvNode* symbol = lilv_port_get_symbol(host->plugin, port->lilv_port); + const char* symbol_str = lilv_node_as_string(symbol); enum JackPortFlags jack_flags = 0; if (lilv_port_is_a(host->plugin, port->lilv_port, host->input_class)) { @@ -253,7 +253,7 @@ jack_session_cb(jack_session_event_t* event, void* arg) char cmd[256]; snprintf(cmd, sizeof(cmd), "lv2_jack_host %s %s", - lilv_value_as_uri(lilv_plugin_get_uri(host->plugin)), + lilv_node_as_uri(lilv_plugin_get_uri(host->plugin)), event->client_uuid); event->command_line = strdup(cmd); @@ -334,9 +334,9 @@ main(int argc, char** argv) printf("Plugin: %s\n", plugin_uri_str); - LilvValue* plugin_uri = lilv_new_uri(world, plugin_uri_str); + LilvNode* plugin_uri = lilv_new_uri(world, plugin_uri_str); host.plugin = lilv_plugins_get_by_uri(plugins, plugin_uri); - lilv_value_free(plugin_uri); + lilv_node_free(plugin_uri); if (!host.plugin) { fprintf(stderr, "Failed to find plugin %s.\n", plugin_uri_str); @@ -345,8 +345,8 @@ main(int argc, char** argv) } /* Get the plugin's name */ - LilvValue* name = lilv_plugin_get_name(host.plugin); - const char* name_str = lilv_value_as_string(name); + LilvNode* name = lilv_plugin_get_name(host.plugin); + const char* name_str = lilv_node_as_string(name); /* Truncate plugin name to suit JACK (if necessary) */ char* jack_name = NULL; @@ -372,7 +372,7 @@ main(int argc, char** argv) } free(jack_name); - lilv_value_free(name); + lilv_node_free(name); if (!host.jack_client) die("Failed to connect to JACK.\n"); @@ -436,13 +436,13 @@ main(int argc, char** argv) /* Clean up */ free(host.ports); - lilv_value_free(host.input_class); - lilv_value_free(host.output_class); - lilv_value_free(host.control_class); - lilv_value_free(host.audio_class); - lilv_value_free(host.event_class); - lilv_value_free(host.midi_class); - lilv_value_free(host.optional); + lilv_node_free(host.input_class); + lilv_node_free(host.output_class); + lilv_node_free(host.control_class); + lilv_node_free(host.audio_class); + lilv_node_free(host.event_class); + lilv_node_free(host.midi_class); + lilv_node_free(host.optional); lilv_world_free(world); #ifdef LILV_JACK_SESSION diff --git a/utils/lv2_list.c b/utils/lv2_list.c index 471c1bd..c8db8aa 100644 --- a/utils/lv2_list.c +++ b/utils/lv2_list.c @@ -28,11 +28,11 @@ list_plugins(const LilvPlugins* list, bool show_names) LILV_FOREACH(plugins, i, list) { const LilvPlugin* p = lilv_plugins_get(list, i); if (show_names) { - LilvValue* n = lilv_plugin_get_name(p); - printf("%s\n", lilv_value_as_string(n)); - lilv_value_free(n); + LilvNode* n = lilv_plugin_get_name(p); + printf("%s\n", lilv_node_as_string(n)); + lilv_node_free(n); } else { - printf("%s\n", lilv_value_as_uri(lilv_plugin_get_uri(p))); + printf("%s\n", lilv_node_as_uri(lilv_plugin_get_uri(p))); } } } |