summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lilv/lilv.h435
-rw-r--r--src/collections.c35
-rw-r--r--src/instance.c6
-rw-r--r--src/lilv_internal.h19
-rw-r--r--src/node.c96
-rw-r--r--src/plugin.c175
-rw-r--r--src/pluginclass.c24
-rw-r--r--src/port.c77
-rw-r--r--src/scalepoint.c11
-rw-r--r--src/state.c39
-rw-r--r--src/ui.c31
-rw-r--r--src/world.c160
12 files changed, 385 insertions, 723 deletions
diff --git a/lilv/lilv.h b/lilv/lilv.h
index 7de90d4..b86a884 100644
--- a/lilv/lilv.h
+++ b/lilv/lilv.h
@@ -106,16 +106,14 @@ typedef void LilvNodes; /**< set<Node>. */
Return value is shared and must not be deleted by caller.
@return @a uri converted to a path, or NULL on failure (URI is not local).
*/
-LILV_API
-const char*
+LILV_API const char*
lilv_uri_to_path(const char* uri);
/**
Create a new URI value.
Returned value must be freed by caller with lilv_node_free.
*/
-LILV_API
-LilvNode*
+LILV_API LilvNode*
lilv_new_uri(LilvWorld* world, const char* uri);
/**
@@ -127,62 +125,54 @@ lilv_new_uri(LilvWorld* world, const char* uri);
Relative paths are resolved against the current working directory. Note
that this may yield unexpected results if @p host is another machine.
*/
-LILV_API
-LilvNode*
+LILV_API LilvNode*
lilv_new_file_uri(LilvWorld* world, const char* host, const char* path);
/**
Create a new string value (with no language).
Returned value must be freed by caller with lilv_node_free.
*/
-LILV_API
-LilvNode*
+LILV_API LilvNode*
lilv_new_string(LilvWorld* world, const char* str);
/**
Create a new integer value.
Returned value must be freed by caller with lilv_node_free.
*/
-LILV_API
-LilvNode*
+LILV_API LilvNode*
lilv_new_int(LilvWorld* world, int val);
/**
Create a new floating point value.
Returned value must be freed by caller with lilv_node_free.
*/
-LILV_API
-LilvNode*
+LILV_API LilvNode*
lilv_new_float(LilvWorld* world, float val);
/**
Create a new boolean value.
Returned value must be freed by caller with lilv_node_free.
*/
-LILV_API
-LilvNode*
+LILV_API LilvNode*
lilv_new_bool(LilvWorld* world, bool val);
/**
Free a LilvNode.
It is safe to call this function on NULL.
*/
-LILV_API
-void
+LILV_API void
lilv_node_free(LilvNode* val);
/**
Duplicate a LilvNode.
*/
-LILV_API
-LilvNode*
+LILV_API LilvNode*
lilv_node_duplicate(const LilvNode* val);
/**
Return whether two values are equivalent.
*/
-LILV_API
-bool
+LILV_API bool
lilv_node_equals(const LilvNode* value, const LilvNode* other);
/**
@@ -198,15 +188,13 @@ lilv_node_equals(const LilvNode* value, const LilvNode* other);
<tr><th>Boolean</td><td>true</td></tr>
</table>
*/
-LILV_API
-char*
+LILV_API char*
lilv_node_get_turtle_token(const LilvNode* value);
/**
Return whether the value is a URI (resource).
*/
-LILV_API
-bool
+LILV_API bool
lilv_node_is_uri(const LilvNode* value);
/**
@@ -214,15 +202,13 @@ lilv_node_is_uri(const LilvNode* value);
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_API const char*
lilv_node_as_uri(const LilvNode* value);
/**
Return whether the value is a blank node (resource with no URI).
*/
-LILV_API
-bool
+LILV_API bool
lilv_node_is_blank(const LilvNode* value);
/**
@@ -230,38 +216,33 @@ lilv_node_is_blank(const LilvNode* value);
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_API const char*
lilv_node_as_blank(const LilvNode* value);
/**
Return whether this value is a literal (i.e. not a URI).
Returns true if @a value is a string or numeric value.
*/
-LILV_API
-bool
+LILV_API bool
lilv_node_is_literal(const LilvNode* value);
/**
Return whether this value is a string literal.
Returns true if @a value is a string value (and not numeric).
*/
-LILV_API
-bool
+LILV_API bool
lilv_node_is_string(const LilvNode* value);
/**
Return @a value as a string.
*/
-LILV_API
-const char*
+LILV_API const char*
lilv_node_as_string(const LilvNode* value);
/**
Return whether this value is a decimal literal.
*/
-LILV_API
-bool
+LILV_API bool
lilv_node_is_float(const LilvNode* value);
/**
@@ -269,38 +250,33 @@ lilv_node_is_float(const LilvNode* value);
Valid to call only if lilv_node_is_float(@a value) or
lilv_node_is_int(@a value) returns true.
*/
-LILV_API
-float
+LILV_API float
lilv_node_as_float(const LilvNode* value);
/**
Return whether this value is an integer literal.
*/
-LILV_API
-bool
+LILV_API bool
lilv_node_is_int(const LilvNode* value);
/**
Return @a value as an integer.
Valid to call only if lilv_node_is_int(@a value) returns true.
*/
-LILV_API
-int
+LILV_API int
lilv_node_as_int(const LilvNode* value);
/**
Return whether this value is a boolean.
*/
-LILV_API
-bool
+LILV_API bool
lilv_node_is_bool(const LilvNode* value);
/**
Return @a value as a bool.
Valid to call only if lilv_node_is_bool(@a value) returns true.
*/
-LILV_API
-bool
+LILV_API bool
lilv_node_as_bool(const LilvNode* value);
/**
@@ -343,28 +319,22 @@ lilv_node_as_bool(const LilvNode* value);
/* LilvPluginClasses */
-LILV_API
-void
+LILV_API void
lilv_plugin_classes_free(LilvPluginClasses* collection);
-LILV_API
-unsigned
+LILV_API unsigned
lilv_plugin_classes_size(const LilvPluginClasses* collection);
-LILV_API
-LilvIter*
+LILV_API LilvIter*
lilv_plugin_classes_begin(const LilvPluginClasses* collection);
-LILV_API
-const LilvPluginClass*
+LILV_API const LilvPluginClass*
lilv_plugin_classes_get(const LilvPluginClasses* collection, LilvIter* i);
-LILV_API
-LilvIter*
+LILV_API LilvIter*
lilv_plugin_classes_next(const LilvPluginClasses* collection, LilvIter* i);
-LILV_API
-bool
+LILV_API bool
lilv_plugin_classes_is_end(const LilvPluginClasses* collection, LilvIter* i);
/**
@@ -373,61 +343,48 @@ lilv_plugin_classes_is_end(const LilvPluginClasses* collection, LilvIter* i);
modified by the caller in any way.
@return NULL if no plugin class with @a uri is found in @a classes.
*/
-LILV_API
-const LilvPluginClass*
+LILV_API const LilvPluginClass*
lilv_plugin_classes_get_by_uri(const LilvPluginClasses* classes,
const LilvNode* uri);
/* ScalePoints */
-LILV_API
-void
+LILV_API void
lilv_scale_points_free(LilvScalePoints* collection);
-LILV_API
-unsigned
+LILV_API unsigned
lilv_scale_points_size(const LilvScalePoints* collection);
-LILV_API
-LilvIter*
+LILV_API LilvIter*
lilv_scale_points_begin(const LilvScalePoints* collection);
-LILV_API
-const LilvScalePoint*
+LILV_API const LilvScalePoint*
lilv_scale_points_get(const LilvScalePoints* collection, LilvIter* i);
-LILV_API
-LilvIter*
+LILV_API LilvIter*
lilv_scale_points_next(const LilvScalePoints* collection, LilvIter* i);
-LILV_API
-bool
+LILV_API bool
lilv_scale_points_is_end(const LilvScalePoints* collection, LilvIter* i);
/* UIs */
-LILV_API
-void
+LILV_API void
lilv_uis_free(LilvUIs* collection);
-LILV_API
-unsigned
+LILV_API unsigned
lilv_uis_size(const LilvUIs* collection);
-LILV_API
-LilvIter*
+LILV_API LilvIter*
lilv_uis_begin(const LilvUIs* collection);
-LILV_API
-const LilvUI*
+LILV_API const LilvUI*
lilv_uis_get(const LilvUIs* collection, LilvIter* i);
-LILV_API
-LilvIter*
+LILV_API LilvIter*
lilv_uis_next(const LilvUIs* collection, LilvIter* i);
-LILV_API
-bool
+LILV_API bool
lilv_uis_is_end(const LilvUIs* collection, LilvIter* i);
/**
@@ -436,75 +393,60 @@ lilv_uis_is_end(const LilvUIs* collection, LilvIter* i);
modified by the caller in any way.
@return NULL if no UI with @a uri is found in @a list.
*/
-LILV_API
-const LilvUI*
+LILV_API const LilvUI*
lilv_uis_get_by_uri(const LilvUIs* uis,
const LilvNode* uri);
/* Nodes */
-LILV_API
-void
+LILV_API void
lilv_nodes_free(LilvNodes* collection);
-LILV_API
-unsigned
+LILV_API unsigned
lilv_nodes_size(const LilvNodes* collection);
-LILV_API
-LilvIter*
+LILV_API LilvIter*
lilv_nodes_begin(const LilvNodes* collection);
-LILV_API
-const LilvNode*
+LILV_API const LilvNode*
lilv_nodes_get(const LilvNodes* collection, LilvIter* i);
-LILV_API
-LilvIter*
+LILV_API LilvIter*
lilv_nodes_next(const LilvNodes* collection, LilvIter* i);
-LILV_API
-bool
+LILV_API bool
lilv_nodes_is_end(const LilvNodes* collection, LilvIter* i);
-LILV_API
-LilvNode*
+LILV_API LilvNode*
lilv_nodes_get_first(const LilvNodes* collection);
/**
Return whether @a values contains @a value.
*/
-LILV_API
-bool
+LILV_API bool
lilv_nodes_contains(const LilvNodes* values, const LilvNode* value);
/**
Return a new LilvNodes that contains all nodes from both @p a and @p b.
*/
-LILV_API
-LilvNodes*
+LILV_API LilvNodes*
lilv_nodes_merge(const LilvNodes* a, const LilvNodes* b);
/* Plugins */
-LILV_API
-unsigned
+LILV_API unsigned
lilv_plugins_size(const LilvPlugins* collection);
-LILV_API
-LilvIter*
+LILV_API LilvIter*
lilv_plugins_begin(const LilvPlugins* collection);
-LILV_API
-const LilvPlugin*
+LILV_API const LilvPlugin*
lilv_plugins_get(const LilvPlugins* collection, LilvIter* i);
-LILV_API
-LilvIter*
+LILV_API LilvIter*
lilv_plugins_next(const LilvPlugins* collection, LilvIter* i);
-LILV_API
-bool
+LILV_API bool
lilv_plugins_is_end(const LilvPlugins* collection, LilvIter* i);
/**
@@ -513,8 +455,7 @@ lilv_plugins_is_end(const LilvPlugins* collection, LilvIter* i);
modified by the caller in any way.
@return NULL if no plugin with @a uri is found in @a plugins.
*/
-LILV_API
-const LilvPlugin*
+LILV_API const LilvPlugin*
lilv_plugins_get_by_uri(const LilvPlugins* plugins,
const LilvNode* uri);
@@ -532,8 +473,7 @@ lilv_plugins_get_by_uri(const LilvPlugins* plugins,
Initialize a new, empty world.
If initialization fails, NULL is returned.
*/
-LILV_API
-LilvWorld*
+LILV_API LilvWorld*
lilv_world_new(void);
/**
@@ -558,8 +498,7 @@ lilv_world_new(void);
@ref LILV_OPTION_FILTER_LANG
@ref LILV_OPTION_DYN_MANIFEST
*/
-LILV_API
-void
+LILV_API void
lilv_world_set_option(LilvWorld* world,
const char* uri,
const LilvNode* value);
@@ -571,8 +510,7 @@ lilv_world_set_option(LilvWorld* world,
(e.g. instances of LilvPlugin). Do not destroy the world until you are
finished with all objects that came from it.
*/
-LILV_API
-void
+LILV_API void
lilv_world_free(LilvWorld* world);
/**
@@ -586,8 +524,7 @@ lilv_world_free(LilvWorld* world);
in special circumstances (e.g. development utilities, or hosts that ship
with special plugin bundles which are installed to a known location).
*/
-LILV_API
-void
+LILV_API void
lilv_world_load_all(LilvWorld* world);
/**
@@ -602,8 +539,7 @@ lilv_world_load_all(LilvWorld* world);
unchanged between (or even during) program invocations. Plugins (among
other things) MUST be identified by URIs (not paths) in save files.
*/
-LILV_API
-void
+LILV_API void
lilv_world_load_bundle(LilvWorld* world,
LilvNode* bundle_uri);
@@ -615,8 +551,7 @@ lilv_world_load_bundle(LilvWorld* world,
have been separately loaded with liv_world_load_resource(), they must be
separately unloaded with lilv_world_unload_resource().
*/
-LILV_API
-int
+LILV_API int
lilv_world_unload_bundle(LilvWorld* world, LilvNode* bundle_uri);
/**
@@ -627,8 +562,7 @@ lilv_world_unload_bundle(LilvWorld* world, LilvNode* bundle_uri);
All accessible data files linked to @c resource with rdfs:seeAlso will be
loaded into the world model.
*/
-LILV_API
-int
+LILV_API int
lilv_world_load_resource(LilvWorld* world,
const LilvNode* resource);
@@ -639,24 +573,21 @@ lilv_world_load_resource(LilvWorld* world,
This unloads all data loaded by a previous call to
lilv_world_load_resource() with the given @c resource.
*/
-LILV_API
-int
+LILV_API int
lilv_world_unload_resource(LilvWorld* world,
const LilvNode* resource);
/**
Get the parent of all other plugin classes, lv2:Plugin.
*/
-LILV_API
-const LilvPluginClass*
+LILV_API const LilvPluginClass*
lilv_world_get_plugin_class(const LilvWorld* world);
/**
Return a list of all found plugin classes.
Returned list is owned by world and must not be freed by the caller.
*/
-LILV_API
-const LilvPluginClasses*
+LILV_API const LilvPluginClasses*
lilv_world_get_plugin_classes(const LilvWorld* world);
/**
@@ -670,8 +601,7 @@ lilv_world_get_plugin_classes(const LilvWorld* world);
The returned list and the plugins it contains are owned by @a world
and must not be freed by caller.
*/
-LILV_API
-const LilvPlugins*
+LILV_API const LilvPlugins*
lilv_world_get_all_plugins(const LilvWorld* world);
/**
@@ -679,8 +609,7 @@ lilv_world_get_all_plugins(const LilvWorld* world);
Either @c subject or @c object may be NULL (i.e. a wildcard), but not both.
@return All matches for the wildcard field, or NULL.
*/
-LILV_API
-LilvNodes*
+LILV_API LilvNodes*
lilv_world_find_nodes(LilvWorld* world,
const LilvNode* subject,
const LilvNode* predicate,
@@ -694,8 +623,7 @@ lilv_world_find_nodes(LilvWorld* world,
case of only wanting a single value.
@return the first matching node, or NULL if no matches are found.
*/
-LILV_API
-LilvNode*
+LILV_API LilvNode*
lilv_world_get(LilvWorld* world,
const LilvNode* subject,
const LilvNode* predicate,
@@ -711,8 +639,7 @@ lilv_world_get(LilvWorld* world,
@param predicate Predicate (key) of statement, or NULL for anything.
@param object Object (value) of statement, or NULL for anything.
*/
-LILV_API
-bool
+LILV_API bool
lilv_world_ask(LilvWorld* world,
const LilvNode* subject,
const LilvNode* predicate,
@@ -734,8 +661,7 @@ lilv_world_ask(LilvWorld* world,
testing utilities, etc.
@return true iff @a plugin is valid.
*/
-LILV_API
-bool
+LILV_API bool
lilv_plugin_verify(const LilvPlugin* plugin);
/**
@@ -752,8 +678,7 @@ lilv_plugin_verify(const LilvPlugin* plugin);
@return A shared URI value which must not be modified or freed.
*/
-LILV_API
-const LilvNode*
+LILV_API const LilvNode*
lilv_plugin_get_uri(const LilvPlugin* plugin);
/**
@@ -767,8 +692,7 @@ lilv_plugin_get_uri(const LilvPlugin* plugin);
filesystem path, use lilv_uri_to_path.
@return a shared string which must not be modified or freed.
*/
-LILV_API
-const LilvNode*
+LILV_API const LilvNode*
lilv_plugin_get_bundle_uri(const LilvPlugin* plugin);
/**
@@ -779,8 +703,7 @@ lilv_plugin_get_bundle_uri(const LilvPlugin* plugin);
@return a list of complete URLs eg. "file:///foo/ABundle.lv2/aplug.ttl",
which is shared and must not be modified or freed.
*/
-LILV_API
-const LilvNodes*
+LILV_API const LilvNodes*
lilv_plugin_get_data_uris(const LilvPlugin* plugin);
/**
@@ -789,8 +712,7 @@ lilv_plugin_get_data_uris(const LilvPlugin* plugin);
filesystem path, use lilv_uri_to_path.
@return a shared string which must not be modified or freed.
*/
-LILV_API
-const LilvNode*
+LILV_API const LilvNode*
lilv_plugin_get_library_uri(const LilvPlugin* plugin);
/**
@@ -800,15 +722,13 @@ lilv_plugin_get_library_uri(const LilvPlugin* plugin);
as a plugin identifier (use the URI for that).
Returned value must be freed by the caller.
*/
-LILV_API
-LilvNode*
+LILV_API LilvNode*
lilv_plugin_get_name(const LilvPlugin* plugin);
/**
Get the class this plugin belongs to (e.g. Filters).
*/
-LILV_API
-const LilvPluginClass*
+LILV_API const LilvPluginClass*
lilv_plugin_get_class(const LilvPlugin* plugin);
/**
@@ -823,8 +743,7 @@ lilv_plugin_get_class(const LilvPlugin* plugin);
sensibly represented as a LilvNodes (e.g. blank nodes).
Return value must be freed by caller with lilv_nodes_free.
*/
-LILV_API
-LilvNodes*
+LILV_API LilvNodes*
lilv_plugin_get_value(const LilvPlugin* p,
const LilvNode* predicate);
@@ -833,8 +752,7 @@ lilv_plugin_get_value(const LilvPlugin* p,
This will return true if the feature is an optional or required feature
of the plugin.
*/
-LILV_API
-bool
+LILV_API bool
lilv_plugin_has_feature(const LilvPlugin* p,
const LilvNode* feature_uri);
@@ -848,8 +766,7 @@ lilv_plugin_has_feature(const LilvPlugin* p,
Returned value must be freed by caller with lilv_nodes_free.
*/
-LILV_API
-LilvNodes*
+LILV_API LilvNodes*
lilv_plugin_get_supported_features(const LilvPlugin* p);
/**
@@ -863,8 +780,7 @@ lilv_plugin_get_supported_features(const LilvPlugin* p);
Return value must be freed by caller with lilv_nodes_free.
*/
-LILV_API
-LilvNodes*
+LILV_API LilvNodes*
lilv_plugin_get_required_features(const LilvPlugin* p);
/**
@@ -875,15 +791,13 @@ lilv_plugin_get_required_features(const LilvPlugin* p);
Return value must be freed by caller with lilv_nodes_free.
*/
-LILV_API
-LilvNodes*
+LILV_API LilvNodes*
lilv_plugin_get_optional_features(const LilvPlugin* p);
/**
Return whether or not a plugin provides a specific extension data.
*/
-LILV_API
-bool
+LILV_API bool
lilv_plugin_has_extension_data(const LilvPlugin* p,
const LilvNode* uri);
@@ -892,15 +806,13 @@ lilv_plugin_has_extension_data(const LilvPlugin* p,
This can be used to find which URIs lilv_instance_get_extension_data()
will return a value for without instantiating the plugin.
*/
-LILV_API
-LilvNodes*
+LILV_API LilvNodes*
lilv_plugin_get_extension_data(const LilvPlugin* p);
/**
Get the number of ports on this plugin.
*/
-LILV_API
-uint32_t
+LILV_API uint32_t
lilv_plugin_get_num_ports(const LilvPlugin* p);
/**
@@ -917,8 +829,7 @@ lilv_plugin_get_num_ports(const LilvPlugin* p);
all float ports on a plugin, and may be significantly faster than
repeated calls to lilv_port_get_range.
*/
-LILV_API
-void
+LILV_API void
lilv_plugin_get_port_ranges_float(const LilvPlugin* p,
float* min_values,
float* max_values,
@@ -930,8 +841,7 @@ lilv_plugin_get_port_ranges_float(const LilvPlugin* p,
desired can be found quickly. REMEMBER TO TERMINATE THE PARAMETER LIST
OF THIS FUNCTION WITH NULL OR VERY NASTY THINGS WILL HAPPEN.
*/
-LILV_API
-uint32_t
+LILV_API uint32_t
lilv_plugin_get_num_ports_of_class(const LilvPlugin* p,
const LilvNode* class_1, ...);
@@ -941,8 +851,7 @@ lilv_plugin_get_num_ports_of_class(const LilvPlugin* p,
This function calls va_arg() on @p args but does not call va_end().
*/
-LILV_API
-uint32_t
+LILV_API uint32_t
lilv_plugin_get_num_ports_of_class_va(const LilvPlugin* p,
const LilvNode* class_1,
va_list args);
@@ -953,8 +862,7 @@ lilv_plugin_get_num_ports_of_class_va(const LilvPlugin* p,
The index of the latency port can be found with lilv_plugin_get_latency_port
ONLY if this function returns true.
*/
-LILV_API
-bool
+LILV_API bool
lilv_plugin_has_latency(const LilvPlugin* p);
/**
@@ -966,15 +874,13 @@ lilv_plugin_has_latency(const LilvPlugin* p);
(by hosts with the ability/need) MUST provide this port, which is a control
rate output port that reports the latency for each cycle in frames.
*/
-LILV_API
-uint32_t
+LILV_API uint32_t
lilv_plugin_get_latency_port_index(const LilvPlugin* p);
/**
Get a port on @a plugin by @a index.
*/
-LILV_API
-const LilvPort*
+LILV_API const LilvPort*
lilv_plugin_get_port_by_index(const LilvPlugin* plugin,
uint32_t index);
@@ -983,8 +889,7 @@ lilv_plugin_get_port_by_index(const LilvPlugin* plugin,
Note this function is slower than lilv_plugin_get_port_by_index,
especially on plugins with a very large number of ports.
*/
-LILV_API
-const LilvPort*
+LILV_API const LilvPort*
lilv_plugin_get_port_by_symbol(const LilvPlugin* plugin,
const LilvNode* symbol);
@@ -998,8 +903,7 @@ lilv_plugin_get_port_by_symbol(const LilvPlugin* plugin,
ports for a particular designation. If @a port_class is NULL, any port
with the given designation will be returned.
*/
-LILV_API
-const LilvPort*
+LILV_API const LilvPort*
lilv_plugin_get_port_by_designation(const LilvPlugin* plugin,
const LilvNode* port_class,
const LilvNode* designation);
@@ -1010,8 +914,7 @@ lilv_plugin_get_port_by_designation(const LilvPlugin* plugin,
More information about the project can be read via lilv_world_find_nodes(),
typically using properties from DOAP (e.g. doap:name).
*/
-LILV_API
-LilvNode*
+LILV_API LilvNode*
lilv_plugin_get_project(const LilvPlugin* plugin);
/**
@@ -1019,8 +922,7 @@ lilv_plugin_get_project(const LilvPlugin* plugin);
Returns NULL if author name is not present.
Returned value must be freed by caller.
*/
-LILV_API
-LilvNode*
+LILV_API LilvNode*
lilv_plugin_get_author_name(const LilvPlugin* plugin);
/**
@@ -1028,8 +930,7 @@ lilv_plugin_get_author_name(const LilvPlugin* plugin);
Returns NULL if author email address is not present.
Returned value must be freed by caller.
*/
-LILV_API
-LilvNode*
+LILV_API LilvNode*
lilv_plugin_get_author_email(const LilvPlugin* plugin);
/**
@@ -1037,8 +938,7 @@ lilv_plugin_get_author_email(const LilvPlugin* plugin);
Returns NULL if author homepage is not present.
Returned value must be freed by caller.
*/
-LILV_API
-LilvNode*
+LILV_API LilvNode*
lilv_plugin_get_author_homepage(const LilvPlugin* plugin);
/**
@@ -1047,8 +947,7 @@ lilv_plugin_get_author_homepage(const LilvPlugin* plugin);
The plugin will still be usable, but hosts should hide them from their
user interfaces to prevent users from using deprecated plugins.
*/
-LILV_API
-bool
+LILV_API bool
lilv_plugin_is_replaced(const LilvPlugin* plugin);
/**
@@ -1057,8 +956,7 @@ lilv_plugin_is_replaced(const LilvPlugin* plugin);
This function is particularly useful for porting plugins in conjunction with
an LV2 bridge such as NASPRO.
*/
-LILV_API
-void
+LILV_API void
lilv_plugin_write_description(LilvWorld* world,
const LilvPlugin* plugin,
const LilvNode* base_uri,
@@ -1070,8 +968,7 @@ lilv_plugin_write_description(LilvWorld* world,
This function is intended for use with lilv_plugin_write_description to
write a complete description of a plugin to a bundle.
*/
-LILV_API
-void
+LILV_API void
lilv_plugin_write_manifest_entry(LilvWorld* world,
const LilvPlugin* plugin,
const LilvNode* base_uri,
@@ -1091,8 +988,7 @@ lilv_plugin_write_manifest_entry(LilvWorld* world,
To actually load the data for each returned resource, use
lilv_world_load_resource.
*/
-LILV_API
-LilvNodes*
+LILV_API LilvNodes*
lilv_plugin_get_related(const LilvPlugin* plugin, const LilvNode* type);
/**
@@ -1108,16 +1004,14 @@ lilv_plugin_get_related(const LilvPlugin* plugin, const LilvNode* type);
@return A shared node which must not be modified or freed.
*/
-LILV_API
-const LilvNode*
+LILV_API const LilvNode*
lilv_port_get_node(const LilvPlugin* plugin,
const LilvPort* port);
/**
Port analog of lilv_plugin_get_value.
*/
-LILV_API
-LilvNodes*
+LILV_API LilvNodes*
lilv_port_get_value(const LilvPlugin* plugin,
const LilvPort* port,
const LilvNode* predicate);
@@ -1129,8 +1023,7 @@ lilv_port_get_value(const LilvPlugin* plugin,
simpler to use in the common case of only caring about one value. The
caller is responsible for freeing the returned node.
*/
-LILV_API
-LilvNode*
+LILV_API LilvNode*
lilv_port_get(const LilvPlugin* plugin,
const LilvPort* port,
const LilvNode* predicate);
@@ -1138,16 +1031,14 @@ lilv_port_get(const LilvPlugin* plugin,
/**
Return the LV2 port properties of a port.
*/
-LILV_API
-LilvNodes*
+LILV_API LilvNodes*
lilv_port_get_properties(const LilvPlugin* plugin,
const LilvPort* port);
/**
Return whether a port has a certain property.
*/
-LILV_API
-bool
+LILV_API bool
lilv_port_has_property(const LilvPlugin* p,
const LilvPort* port,
const LilvNode* property_uri);
@@ -1158,8 +1049,7 @@ lilv_port_has_property(const LilvPlugin* p,
More precisely, this returns true iff the port has an atom:supports or an
ev:supportsEvent property with @p event_type as the value.
*/
-LILV_API
-bool
+LILV_API bool
lilv_port_supports_event(const LilvPlugin* p,
const LilvPort* port,
const LilvNode* event_type);
@@ -1169,8 +1059,7 @@ lilv_port_supports_event(const LilvPlugin* p,
The index is only valid for the life of the plugin and may change between
versions. For a stable identifier, use the symbol.
*/
-LILV_API
-uint32_t
+LILV_API uint32_t
lilv_port_get_index(const LilvPlugin* plugin,
const LilvPort* port);
@@ -1179,8 +1068,7 @@ lilv_port_get_index(const LilvPlugin* plugin,
The 'symbol' is a short string, a valid C identifier.
Returned value is owned by @a port and must not be freed.
*/
-LILV_API
-const LilvNode*
+LILV_API const LilvNode*
lilv_port_get_symbol(const LilvPlugin* plugin,
const LilvPort* port);
@@ -1190,8 +1078,7 @@ lilv_port_get_symbol(const LilvPlugin* plugin,
data file without a language tag). Returned value must be freed by
the caller.
*/
-LILV_API
-LilvNode*
+LILV_API LilvNode*
lilv_port_get_name(const LilvPlugin* plugin,
const LilvPort* port);
@@ -1202,8 +1089,7 @@ lilv_port_get_name(const LilvPlugin* plugin,
The returned list does not include lv2:Port, which is implied.
Returned value is shared and must not be destroyed by caller.
*/
-LILV_API
-const LilvNodes*
+LILV_API const LilvNodes*
lilv_port_get_classes(const LilvPlugin* plugin,
const LilvPort* port);
@@ -1215,8 +1101,7 @@ lilv_port_get_classes(const LilvPlugin* plugin,
this function is designed so that Lilv is usable with any port types
without requiring explicit support in Lilv.
*/
-LILV_API
-bool
+LILV_API bool
lilv_port_is_a(const LilvPlugin* plugin,
const LilvPort* port,
const LilvNode* port_class);
@@ -1229,8 +1114,7 @@ lilv_port_is_a(const LilvPlugin* plugin,
be freed by the caller using lilv_node_free), or NULL if the value does not
exist.
*/
-LILV_API
-void
+LILV_API void
lilv_port_get_range(const LilvPlugin* plugin,
const LilvPort* port,
LilvNode** deflt,
@@ -1244,8 +1128,7 @@ lilv_port_get_range(const LilvPlugin* plugin,
Returned value may be NULL if @a port has no scale points, otherwise it
must be freed by caller with lilv_scale_points_free.
*/
-LILV_API
-LilvScalePoints*
+LILV_API LilvScalePoints*
lilv_port_get_scale_points(const LilvPlugin* plugin,
const LilvPort* port);
@@ -1262,8 +1145,7 @@ lilv_port_get_scale_points(const LilvPlugin* plugin,
@param subject The subject of the state description (e.g. a preset URI).
@return A new LilvState which must be freed with lilv_state_free(), or NULL.
*/
-LILV_API
-LilvState*
+LILV_API LilvState*
lilv_state_new_from_world(LilvWorld* world,
LV2_URID_Map* map,
const LilvNode* subject);
@@ -1281,8 +1163,7 @@ lilv_state_new_from_world(LilvWorld* world,
parse the file into the world model, i.e. the returned state is the only
new memory consumed once this function returns.
*/
-LILV_API
-LilvState*
+LILV_API LilvState*
lilv_state_new_from_file(LilvWorld* world,
LV2_URID_Map* map,
const LilvNode* subject,
@@ -1291,8 +1172,7 @@ lilv_state_new_from_file(LilvWorld* world,
/**
Load a state snapshot from a string made by lilv_state_to_string().
*/
-LILV_API
-LilvState*
+LILV_API LilvState*
lilv_state_new_from_string(LilvWorld* world,
LV2_URID_Map* map,
const char* str);
@@ -1369,8 +1249,7 @@ typedef const void* (*LilvGetPortValueFunc)(const char* port_symbol,
See <a href="http://lv2plug.in/ns/ext/state/state.h">state.h</a> from the
LV2 State extension for details on the @c flags and @c features parameters.
*/
-LILV_API
-LilvState*
+LILV_API LilvState*
lilv_state_new_from_instance(const LilvPlugin* plugin,
LilvInstance* instance,
LV2_URID_Map* map,
@@ -1386,43 +1265,37 @@ lilv_state_new_from_instance(const LilvPlugin* plugin,
/**
Free @c state.
*/
-LILV_API
-void
+LILV_API void
lilv_state_free(LilvState* state);
/**
Return true iff @c a is equivalent to @c b.
*/
-LILV_API
-bool
+LILV_API bool
lilv_state_equals(const LilvState* a, const LilvState* b);
/**
Return the number of properties in @c state.
*/
-LILV_API
-unsigned
+LILV_API unsigned
lilv_state_get_num_properties(const LilvState* state);
/**
Get the URI of the plugin @c state applies to.
*/
-LILV_API
-const LilvNode*
+LILV_API const LilvNode*
lilv_state_get_plugin_uri(const LilvState* state);
/**
Get the label of @c state.
*/
-LILV_API
-const char*
+LILV_API const char*
lilv_state_get_label(const LilvState* state);
/**
Set the label of @c state.
*/
-LILV_API
-void
+LILV_API void
lilv_state_set_label(LilvState* state,
const char* label);
@@ -1462,8 +1335,7 @@ typedef void (*LilvSetPortValueFunc)(const char* port_symbol,
See <a href="http://lv2plug.in/ns/ext/state/state.h">state.h</a> from the
LV2 State extension for details on the @c flags and @c features parameters.
*/
-LILV_API
-void
+LILV_API void
lilv_state_restore(const LilvState* state,
LilvInstance* instance,
LilvSetPortValueFunc set_value,
@@ -1486,8 +1358,7 @@ lilv_state_restore(const LilvState* state,
If @c uri is NULL, the preset URI will be a file URI, but the bundle
can safely be moved (i.e. the state file will use "<>" as the subject).
*/
-LILV_API
-int
+LILV_API int
lilv_state_save(LilvWorld* world,
LV2_URID_Map* map,
LV2_URID_Unmap* unmap,
@@ -1504,8 +1375,7 @@ lilv_state_save(LilvWorld* world,
doing, pass NULL for this, otherwise the state may not be restorable via
lilv_state_new_from_string().
*/
-LILV_API
-char*
+LILV_API char*
lilv_state_to_string(LilvWorld* world,
LV2_URID_Map* map,
LV2_URID_Unmap* unmap,
@@ -1523,16 +1393,14 @@ lilv_state_to_string(LilvWorld* world,
Get the label of this scale point (enumeration value)
Returned value is owned by @a point and must not be freed.
*/
-LILV_API
-const LilvNode*
+LILV_API const LilvNode*
lilv_scale_point_get_label(const LilvScalePoint* point);
/**
Get the value of this scale point (enumeration value)
Returned value is owned by @a point and must not be freed.
*/
-LILV_API
-const LilvNode*
+LILV_API const LilvNode*
lilv_scale_point_get_value(const LilvScalePoint* point);
/**
@@ -1546,32 +1414,28 @@ lilv_scale_point_get_value(const LilvScalePoint* point);
Returned value is owned by @a plugin_class and must not be freed by caller.
Returned value may be NULL, if class has no parent.
*/
-LILV_API
-const LilvNode*
+LILV_API const LilvNode*
lilv_plugin_class_get_parent_uri(const LilvPluginClass* plugin_class);
/**
Get the URI of this plugin class.
Returned value is owned by @a plugin_class and must not be freed by caller.
*/
-LILV_API
-const LilvNode*
+LILV_API const LilvNode*
lilv_plugin_class_get_uri(const LilvPluginClass* plugin_class);
/**
Get the label of this plugin class, ie "Oscillators".
Returned value is owned by @a plugin_class and must not be freed by caller.
*/
-LILV_API
-const LilvNode*
+LILV_API const LilvNode*
lilv_plugin_class_get_label(const LilvPluginClass* plugin_class);
/**
Get the subclasses of this plugin class.
Returned value must be freed by caller with lilv_plugin_classes_free.
*/
-LILV_API
-LilvPluginClasses*
+LILV_API LilvPluginClasses*
lilv_plugin_class_get_children(const LilvPluginClass* plugin_class);
/**
@@ -1610,8 +1474,7 @@ struct LilvInstanceImpl {
NULL may be passed if the host supports no additional features.
@return NULL if instantiation failed.
*/
-LILV_API
-LilvInstance*
+LILV_API LilvInstance*
lilv_plugin_instantiate(const LilvPlugin* plugin,
double sample_rate,
const LV2_Feature*const* features);
@@ -1621,8 +1484,7 @@ lilv_plugin_instantiate(const LilvPlugin* plugin,
It is safe to call this function on NULL.
@a instance is invalid after this call.
*/
-LILV_API
-void
+LILV_API void
lilv_instance_free(LilvInstance* instance);
#ifndef LILV_INTERNAL
@@ -1741,8 +1603,7 @@ lilv_instance_get_handle(const LilvInstance* instance)
Get all UIs for @a plugin.
Returned value must be freed by caller using lilv_uis_free.
*/
-LILV_API
-LilvUIs*
+LILV_API LilvUIs*
lilv_plugin_get_uis(const LilvPlugin* plugin);
/**
@@ -1750,8 +1611,7 @@ lilv_plugin_get_uis(const LilvPlugin* plugin);
@param ui The Plugin UI
@return a shared value which must not be modified or freed.
*/
-LILV_API
-const LilvNode*
+LILV_API const LilvNode*
lilv_ui_get_uri(const LilvUI* ui);
/**
@@ -1762,8 +1622,7 @@ lilv_ui_get_uri(const LilvUI* ui);
Note that in most cases lilv_ui_is_supported should be used which finds the
UI type, avoding the need to use this function (and type specific logic).
*/
-LILV_API
-const LilvNodes*
+LILV_API const LilvNodes*
lilv_ui_get_classes(const LilvUI* ui);
/**
@@ -1771,8 +1630,7 @@ lilv_ui_get_classes(const LilvUI* ui);
@param ui The Plugin UI
@param class_uri The URI of the LV2 UI type to check this UI against
*/
-LILV_API
-bool
+LILV_API bool
lilv_ui_is_a(const LilvUI* ui, const LilvNode* class_uri);
/**
@@ -1793,8 +1651,7 @@ typedef unsigned (*LilvUISupportedFunc)(const char* container_type_uri,
which is owned by @c ui and must not be freed by the caller.
@return The embedding quality level returned by @c supported_func.
*/
-LILV_API
-unsigned
+LILV_API unsigned
lilv_ui_is_supported(const LilvUI* ui,
LilvUISupportedFunc supported_func,
const LilvNode* container_type,
@@ -1805,8 +1662,7 @@ lilv_ui_is_supported(const LilvUI* ui,
@param ui The Plugin UI
@return a shared value which must not be modified or freed.
*/
-LILV_API
-const LilvNode*
+LILV_API const LilvNode*
lilv_ui_get_bundle_uri(const LilvUI* ui);
/**
@@ -1814,8 +1670,7 @@ lilv_ui_get_bundle_uri(const LilvUI* ui);
@param ui The Plugin UI
@return a shared value which must not be modified or freed.
*/
-LILV_API
-const LilvNode*
+LILV_API const LilvNode*
lilv_ui_get_binary_uri(const LilvUI* ui);
/**
diff --git a/src/collections.c b/src/collections.c
index 6a3488b..6437c3e 100644
--- a/src/collections.c
+++ b/src/collections.c
@@ -54,10 +54,7 @@ lilv_collection_size(const LilvCollection* coll)
LilvIter*
lilv_collection_begin(const LilvCollection* collection)
{
- if (collection) {
- return (LilvIter*)zix_tree_begin((ZixTree*)collection);
- }
- return NULL;
+ return collection ? (LilvIter*)zix_tree_begin((ZixTree*)collection) : NULL;
}
void*
@@ -99,8 +96,7 @@ lilv_plugin_classes_new(void)
/* URI based accessors (for collections of things with URIs) */
-LILV_API
-const LilvPluginClass*
+LILV_API const LilvPluginClass*
lilv_plugin_classes_get_by_uri(const LilvPluginClasses* coll,
const LilvNode* uri)
{
@@ -108,8 +104,7 @@ lilv_plugin_classes_get_by_uri(const LilvPluginClasses* coll,
(const ZixTree*)coll, uri);
}
-LILV_API
-const LilvUI*
+LILV_API const LilvUI*
lilv_uis_get_by_uri(const LilvUIs* coll, const LilvNode* uri)
{
return (LilvUI*)lilv_collection_get_by_uri((const ZixTree*)coll, uri);
@@ -123,8 +118,7 @@ lilv_plugins_new(void)
return lilv_collection_new(lilv_header_compare_by_uri, NULL);
}
-LILV_API
-const LilvPlugin*
+LILV_API const LilvPlugin*
lilv_plugins_get_by_uri(const LilvPlugins* list, const LilvNode* uri)
{
return (LilvPlugin*)lilv_collection_get_by_uri((const ZixTree*)list, uri);
@@ -132,8 +126,7 @@ lilv_plugins_get_by_uri(const LilvPlugins* list, const LilvNode* uri)
/* Nodes */
-LILV_API
-bool
+LILV_API bool
lilv_nodes_contains(const LilvNodes* list, const LilvNode* value)
{
LILV_FOREACH(nodes, i, list)
@@ -143,8 +136,7 @@ lilv_nodes_contains(const LilvNodes* list, const LilvNode* value)
return false;
}
-LILV_API
-LilvNodes*
+LILV_API LilvNodes*
lilv_nodes_merge(const LilvNodes* a, const LilvNodes* b)
{
LilvNodes* result = lilv_nodes_new();
@@ -201,32 +193,27 @@ LILV_COLLECTION_IMPL(lilv_uis, LilvUIs, LilvUI)
LILV_COLLECTION_IMPL(lilv_nodes, LilvNodes, LilvNode)
LILV_COLLECTION_IMPL(lilv_plugins, LilvPlugins, LilvPlugin)
-LILV_API
-void
+LILV_API void
lilv_plugin_classes_free(LilvPluginClasses* collection) {
lilv_collection_free(collection);
}
-LILV_API
-void
+LILV_API void
lilv_scale_points_free(LilvScalePoints* collection) {
lilv_collection_free(collection);
}
-LILV_API
-void
+LILV_API void
lilv_uis_free(LilvUIs* collection) {
lilv_collection_free(collection);
}
-LILV_API
-void
+LILV_API void
lilv_nodes_free(LilvNodes* collection) {
lilv_collection_free(collection);
}
-LILV_API
-LilvNode*
+LILV_API 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 ea109d5..21f3d03 100644
--- a/src/instance.c
+++ b/src/instance.c
@@ -21,8 +21,7 @@
#include "lilv_internal.h"
-LILV_API
-LilvInstance*
+LILV_API LilvInstance*
lilv_plugin_instantiate(const LilvPlugin* plugin,
double sample_rate,
const LV2_Feature*const* features)
@@ -110,8 +109,7 @@ lilv_plugin_instantiate(const LilvPlugin* plugin,
return result;
}
-LILV_API
-void
+LILV_API void
lilv_instance_free(LilvInstance* instance)
{
if (!instance)
diff --git a/src/lilv_internal.h b/src/lilv_internal.h
index f078084..9e9de2f 100644
--- a/src/lilv_internal.h
+++ b/src/lilv_internal.h
@@ -29,11 +29,11 @@ extern "C" {
#ifdef _WIN32
# include <windows.h>
# define dlopen(path, flags) LoadLibrary(path)
-# define dlclose(lib) FreeLibrary((HMODULE)lib)
+# define dlclose(lib) FreeLibrary((HMODULE)lib)
# ifdef _MSC_VER
# define __func__ __FUNCTION__
# define INFINITY DBL_MAX + DBL_MAX
-# define NAN INFINITY - INFINITY
+# define NAN INFINITY - INFINITY
# define snprintf _snprintf
# endif
static inline char* dlerror(void) { return "Unknown error"; }
@@ -293,21 +293,14 @@ LilvUI* lilv_ui_new(LilvWorld* world,
void lilv_ui_free(LilvUI* ui);
-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);
+LilvNode* lilv_node_new(LilvWorld* world, LilvNodeType type, const char* val);
+LilvNode* lilv_node_new_from_node(LilvWorld* world, const SordNode* node);
int lilv_header_compare_by_uri(const void* a, const void* b, void* user_data);
int lilv_lib_compare(const void* a, const void* b, void* user_data);
-int
-lilv_ptr_cmp(const void* a, const void* b, void* user_data);
-
-int
-lilv_resource_node_cmp(const void* a, const void* b, void* user_data);
+int lilv_ptr_cmp(const void* a, const void* b, void* user_data);
+int lilv_resource_node_cmp(const void* a, const void* b, void* user_data);
struct LilvHeader*
lilv_collection_get_by_uri(const ZixTree* seq, const LilvNode* uri);
diff --git a/src/node.c b/src/node.c
index 3d074a4..c771e40 100644
--- a/src/node.c
+++ b/src/node.c
@@ -1,5 +1,5 @@
/*
- Copyright 2007-2011 David Robillard <http://drobilla.net>
+ Copyright 2007-2014 David Robillard <http://drobilla.net>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
@@ -147,15 +147,13 @@ lilv_node_new_from_node(LilvWorld* world, const SordNode* node)
return result;
}
-LILV_API
-LilvNode*
+LILV_API LilvNode*
lilv_new_uri(LilvWorld* world, const char* uri)
{
return lilv_node_new(world, LILV_VALUE_URI, uri);
}
-LILV_API
-LilvNode*
+LILV_API LilvNode*
lilv_new_file_uri(LilvWorld* world, const char* host, const char* path)
{
char* abs_path = lilv_path_absolute(path);
@@ -168,15 +166,13 @@ lilv_new_file_uri(LilvWorld* world, const char* host, const char* path)
return ret;
}
-LILV_API
-LilvNode*
+LILV_API LilvNode*
lilv_new_string(LilvWorld* world, const char* str)
{
return lilv_node_new(world, LILV_VALUE_STRING, str);
}
-LILV_API
-LilvNode*
+LILV_API LilvNode*
lilv_new_int(LilvWorld* world, int val)
{
char str[32];
@@ -186,8 +182,7 @@ lilv_new_int(LilvWorld* world, int val)
return ret;
}
-LILV_API
-LilvNode*
+LILV_API LilvNode*
lilv_new_float(LilvWorld* world, float val)
{
char str[32];
@@ -197,8 +192,7 @@ lilv_new_float(LilvWorld* world, float val)
return ret;
}
-LILV_API
-LilvNode*
+LILV_API LilvNode*
lilv_new_bool(LilvWorld* world, bool val)
{
LilvNode* ret = lilv_node_new(world, LILV_VALUE_BOOL,
@@ -207,8 +201,7 @@ lilv_new_bool(LilvWorld* world, bool val)
return ret;
}
-LILV_API
-LilvNode*
+LILV_API LilvNode*
lilv_node_duplicate(const LilvNode* val)
{
if (!val) {
@@ -223,8 +216,7 @@ lilv_node_duplicate(const LilvNode* val)
return result;
}
-LILV_API
-void
+LILV_API void
lilv_node_free(LilvNode* val)
{
if (val) {
@@ -233,8 +225,7 @@ lilv_node_free(LilvNode* val)
}
}
-LILV_API
-bool
+LILV_API bool
lilv_node_equals(const LilvNode* value, const LilvNode* other)
{
if (value == NULL && other == NULL)
@@ -261,8 +252,7 @@ lilv_node_equals(const LilvNode* value, const LilvNode* other)
return false; /* shouldn't get here */
}
-LILV_API
-char*
+LILV_API char*
lilv_node_get_turtle_token(const LilvNode* value)
{
const char* str = (const char*)sord_node_get_string(value->node);
@@ -299,45 +289,35 @@ lilv_node_get_turtle_token(const LilvNode* value)
return result;
}
-LILV_API
-bool
+LILV_API bool
lilv_node_is_uri(const LilvNode* value)
{
return (value && value->type == LILV_VALUE_URI);
}
-LILV_API
-const char*
+LILV_API const char*
lilv_node_as_uri(const LilvNode* value)
{
- assert(!value || lilv_node_is_uri(value));
- return value ? (const char*)sord_node_get_string(value->node) : NULL;
-}
-
-const SordNode*
-lilv_node_as_node(const LilvNode* value)
-{
- assert(lilv_node_is_uri(value));
- return value->node;
+ return (lilv_node_is_uri(value)
+ ? (const char*)sord_node_get_string(value->node)
+ : NULL);
}
-LILV_API
-bool
+LILV_API bool
lilv_node_is_blank(const LilvNode* value)
{
return (value && value->type == LILV_VALUE_BLANK);
}
-LILV_API
-const char*
+LILV_API const char*
lilv_node_as_blank(const LilvNode* value)
{
- assert(!value || lilv_node_is_blank(value));
- return value ? (const char*)sord_node_get_string(value->node) : NULL;
+ return (lilv_node_is_blank(value)
+ ? (const char*)sord_node_get_string(value->node)
+ : NULL);
}
-LILV_API
-bool
+LILV_API bool
lilv_node_is_literal(const LilvNode* value)
{
if (!value)
@@ -353,45 +333,37 @@ lilv_node_is_literal(const LilvNode* value)
}
}
-LILV_API
-bool
+LILV_API bool
lilv_node_is_string(const LilvNode* value)
{
return (value && value->type == LILV_VALUE_STRING);
}
-LILV_API
-const char*
+LILV_API const char*
lilv_node_as_string(const LilvNode* value)
{
return value ? (const char*)sord_node_get_string(value->node) : NULL;
}
-LILV_API
-bool
+LILV_API bool
lilv_node_is_int(const LilvNode* value)
{
return (value && value->type == LILV_VALUE_INT);
}
-LILV_API
-int
+LILV_API int
lilv_node_as_int(const LilvNode* value)
{
- assert(value);
- assert(lilv_node_is_int(value));
- return value->val.int_val;
+ return lilv_node_is_int(value) ? value->val.int_val : 0;
}
-LILV_API
-bool
+LILV_API bool
lilv_node_is_float(const LilvNode* value)
{
return (value && value->type == LILV_VALUE_FLOAT);
}
-LILV_API
-float
+LILV_API float
lilv_node_as_float(const LilvNode* value)
{
assert(lilv_node_is_float(value) || lilv_node_is_int(value));
@@ -402,18 +374,14 @@ lilv_node_as_float(const LilvNode* value)
}
}
-LILV_API
-bool
+LILV_API bool
lilv_node_is_bool(const LilvNode* value)
{
return (value && value->type == LILV_VALUE_BOOL);
}
-LILV_API
-bool
+LILV_API bool
lilv_node_as_bool(const LilvNode* value)
{
- assert(value);
- assert(lilv_node_is_bool(value));
- return value->val.bool_val;
+ return lilv_node_is_bool(value) ? value->val.bool_val : false;
}
diff --git a/src/plugin.c b/src/plugin.c
index 2f9e5b8..0d97290 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -207,12 +207,11 @@ lilv_plugin_load(LilvPlugin* p)
static bool
is_symbol(const char* str)
{
- const size_t len = strlen(str);
- for (size_t i = 0; i < len; ++i) {
- if (!((str[i] >= 'a' && str[i] <= 'z')
- || (str[i] >= 'A' && str[i] <= 'Z')
- || (i > 0 && str[i] >= '0' && str[i] <= '9')
- || str[i] == '_')) {
+ for (const char* s = str; *s; ++s) {
+ if (!((*s >= 'a' && *s <= 'z') ||
+ (*s >= 'A' && *s <= 'Z') ||
+ (s > str && *s >= '0' && *s <= '9') ||
+ *s == '_')) {
return false;
}
}
@@ -325,45 +324,37 @@ lilv_plugin_load_if_necessary(const LilvPlugin* p)
lilv_plugin_load((LilvPlugin*)p);
}
-LILV_API
-const LilvNode*
+LILV_API const LilvNode*
lilv_plugin_get_uri(const LilvPlugin* p)
{
- assert(p);
- assert(p->plugin_uri);
return p->plugin_uri;
}
-LILV_API
-const LilvNode*
+LILV_API const LilvNode*
lilv_plugin_get_bundle_uri(const LilvPlugin* p)
{
- assert(p);
- assert(p->bundle_uri);
return p->bundle_uri;
}
-LILV_API
-const LilvNode*
+LILV_API const LilvNode*
lilv_plugin_get_library_uri(const LilvPlugin* const_p)
{
LilvPlugin* p = (LilvPlugin*)const_p;
lilv_plugin_load_if_necessary(p);
if (!p->binary_uri) {
// <plugin> lv2:binary ?binary
- SordIter* results = lilv_world_query_internal(
- p->world,
- p->plugin_uri->node,
- p->world->uris.lv2_binary,
- NULL);
- FOREACH_MATCH(results) {
- const SordNode* binary_node = sord_iter_get_node(results, SORD_OBJECT);
+ SordIter* i = lilv_world_query_internal(p->world,
+ p->plugin_uri->node,
+ p->world->uris.lv2_binary,
+ NULL);
+ FOREACH_MATCH(i) {
+ const SordNode* binary_node = sord_iter_get_node(i, SORD_OBJECT);
if (sord_node_get_type(binary_node) == SORD_URI) {
p->binary_uri = lilv_node_new_from_node(p->world, binary_node);
break;
}
}
- sord_iter_free(results);
+ sord_iter_free(i);
}
if (!p->binary_uri) {
LILV_WARNF("Plugin <%s> has no lv2:binary\n",
@@ -372,26 +363,23 @@ lilv_plugin_get_library_uri(const LilvPlugin* const_p)
return p->binary_uri;
}
-LILV_API
-const LilvNodes*
+LILV_API const LilvNodes*
lilv_plugin_get_data_uris(const LilvPlugin* p)
{
return p->data_uris;
}
-LILV_API
-const LilvPluginClass*
+LILV_API const LilvPluginClass*
lilv_plugin_get_class(const LilvPlugin* const_p)
{
LilvPlugin* p = (LilvPlugin*)const_p;
lilv_plugin_load_if_necessary(p);
if (!p->plugin_class) {
// <plugin> a ?class
- SordIter* results = lilv_world_query_internal(
- p->world,
- p->plugin_uri->node,
- p->world->uris.rdf_a,
- NULL);
+ SordIter* results = lilv_world_query_internal(p->world,
+ p->plugin_uri->node,
+ p->world->uris.rdf_a,
+ NULL);
FOREACH_MATCH(results) {
const SordNode* class_node = sord_iter_get_node(results, SORD_OBJECT);
if (sord_node_get_type(class_node) != SORD_URI) {
@@ -429,8 +417,7 @@ lilv_plugin_get_value_internal(const LilvPlugin* p,
p->world, p->plugin_uri->node, predicate, NULL);
}
-LILV_API
-bool
+LILV_API bool
lilv_plugin_verify(const LilvPlugin* plugin)
{
LilvNode* rdf_type = lilv_new_uri(plugin->world, LILV_NS_RDF "type");
@@ -459,8 +446,7 @@ lilv_plugin_verify(const LilvPlugin* plugin)
return true;
}
-LILV_API
-LilvNode*
+LILV_API LilvNode*
lilv_plugin_get_name(const LilvPlugin* plugin)
{
LilvNodes* results = lilv_plugin_get_value_internal(
@@ -481,8 +467,7 @@ lilv_plugin_get_name(const LilvPlugin* plugin)
return ret;
}
-LILV_API
-LilvNodes*
+LILV_API LilvNodes*
lilv_plugin_get_value(const LilvPlugin* p,
const LilvNode* predicate)
{
@@ -490,16 +475,14 @@ lilv_plugin_get_value(const LilvPlugin* p,
return lilv_world_find_nodes(p->world, p->plugin_uri, predicate, NULL);
}
-LILV_API
-uint32_t
+LILV_API uint32_t
lilv_plugin_get_num_ports(const LilvPlugin* p)
{
lilv_plugin_load_ports_if_necessary(p);
return p->num_ports;
}
-LILV_API
-void
+LILV_API void
lilv_plugin_get_port_ranges_float(const LilvPlugin* p,
float* min_values,
float* max_values,
@@ -546,8 +529,7 @@ lilv_plugin_get_port_ranges_float(const LilvPlugin* p,
}
}
-LILV_API
-uint32_t
+LILV_API uint32_t
lilv_plugin_get_num_ports_of_class_va(const LilvPlugin* p,
const LilvNode* class_1,
va_list args)
@@ -559,10 +541,10 @@ lilv_plugin_get_num_ports_of_class_va(const LilvPlugin* p,
// Build array of classes from args so we can walk it several times
size_t n_classes = 0;
const LilvNode** classes = NULL;
- for (LilvNode* class_i = NULL; (class_i = va_arg(args, LilvNode*)); ) {
+ for (LilvNode* c = NULL; (c = va_arg(args, LilvNode*)); ) {
classes = (const LilvNode**)realloc(
classes, ++n_classes * sizeof(LilvNode*));
- classes[n_classes - 1] = class_i;
+ classes[n_classes - 1] = c;
}
// Check each port against every type
@@ -587,8 +569,7 @@ lilv_plugin_get_num_ports_of_class_va(const LilvPlugin* p,
return count;
}
-LILV_API
-uint32_t
+LILV_API uint32_t
lilv_plugin_get_num_ports_of_class(const LilvPlugin* p,
const LilvNode* class_1, ...)
{
@@ -601,8 +582,7 @@ lilv_plugin_get_num_ports_of_class(const LilvPlugin* p,
return count;
}
-LILV_API
-bool
+LILV_API bool
lilv_plugin_has_latency(const LilvPlugin* p)
{
lilv_plugin_load_if_necessary(p);
@@ -620,7 +600,7 @@ lilv_plugin_has_latency(const LilvPlugin* p)
port,
p->world->uris.lv2_portProperty,
p->world->uris.lv2_reportsLatency);
- SordIter* des = lilv_world_query_internal(
+ SordIter* des = lilv_world_query_internal(
p->world,
port,
p->world->uris.lv2_designation,
@@ -640,7 +620,7 @@ lilv_plugin_has_latency(const LilvPlugin* p)
static const LilvPort*
lilv_plugin_get_port_by_property(const LilvPlugin* plugin,
- const LilvNode* port_property)
+ const SordNode* port_property)
{
lilv_plugin_load_ports_if_necessary(plugin);
for (uint32_t i = 0; i < plugin->num_ports; ++i) {
@@ -649,7 +629,7 @@ lilv_plugin_get_port_by_property(const LilvPlugin* plugin,
plugin->world,
port->node->node,
plugin->world->uris.lv2_portProperty,
- port_property->node);
+ port_property);
const bool found = !sord_iter_end(iter);
sord_iter_free(iter);
@@ -662,8 +642,7 @@ lilv_plugin_get_port_by_property(const LilvPlugin* plugin,
return NULL;
}
-LILV_API
-const LilvPort*
+LILV_API const LilvPort*
lilv_plugin_get_port_by_designation(const LilvPlugin* plugin,
const LilvNode* port_class,
const LilvNode* designation)
@@ -690,18 +669,13 @@ lilv_plugin_get_port_by_designation(const LilvPlugin* plugin,
return NULL;
}
-LILV_API
-uint32_t
+LILV_API uint32_t
lilv_plugin_get_latency_port_index(const LilvPlugin* p)
{
- LilvNode* prop = lilv_node_new_from_node(
- p->world, p->world->uris.lv2_reportsLatency);
- LilvNode* des = lilv_node_new_from_node(
- p->world, p->world->uris.lv2_latency);
- const LilvPort* prop_port = lilv_plugin_get_port_by_property(p, prop);
- const LilvPort* des_port = lilv_plugin_get_port_by_property(p, des);
- lilv_node_free(prop);
- lilv_node_free(des);
+ const LilvPort* prop_port = lilv_plugin_get_port_by_property(
+ p, p->world->uris.lv2_reportsLatency);
+ const LilvPort* des_port = lilv_plugin_get_port_by_property(
+ p, p->world->uris.lv2_latency);
if (prop_port) {
return prop_port->index;
} else if (des_port) {
@@ -711,8 +685,7 @@ lilv_plugin_get_latency_port_index(const LilvPlugin* p)
}
}
-LILV_API
-bool
+LILV_API bool
lilv_plugin_has_feature(const LilvPlugin* p,
const LilvNode* feature)
{
@@ -730,8 +703,7 @@ lilv_plugin_has_feature(const LilvPlugin* p,
return false;
}
-LILV_API
-LilvNodes*
+LILV_API LilvNodes*
lilv_plugin_get_supported_features(const LilvPlugin* p)
{
LilvNodes* optional = lilv_plugin_get_optional_features(p);
@@ -742,8 +714,7 @@ lilv_plugin_get_supported_features(const LilvPlugin* p)
return result;
}
-LILV_API
-LilvNodes*
+LILV_API LilvNodes*
lilv_plugin_get_optional_features(const LilvPlugin* p)
{
lilv_plugin_load_if_necessary(p);
@@ -753,8 +724,7 @@ lilv_plugin_get_optional_features(const LilvPlugin* p)
NULL);
}
-LILV_API
-LilvNodes*
+LILV_API LilvNodes*
lilv_plugin_get_required_features(const LilvPlugin* p)
{
lilv_plugin_load_if_necessary(p);
@@ -764,8 +734,7 @@ lilv_plugin_get_required_features(const LilvPlugin* p)
NULL);
}
-LILV_API
-bool
+LILV_API bool
lilv_plugin_has_extension_data(const LilvPlugin* p,
const LilvNode* uri)
{
@@ -783,15 +752,13 @@ lilv_plugin_has_extension_data(const LilvPlugin* p,
uri->node);
}
-LILV_API
-LilvNodes*
+LILV_API LilvNodes*
lilv_plugin_get_extension_data(const LilvPlugin* p)
{
return lilv_plugin_get_value_internal(p, p->world->uris.lv2_extensionData);
}
-LILV_API
-const LilvPort*
+LILV_API const LilvPort*
lilv_plugin_get_port_by_index(const LilvPlugin* p,
uint32_t index)
{
@@ -802,8 +769,7 @@ lilv_plugin_get_port_by_index(const LilvPlugin* p,
return NULL;
}
-LILV_API
-const LilvPort*
+LILV_API const LilvPort*
lilv_plugin_get_port_by_symbol(const LilvPlugin* p,
const LilvNode* symbol)
{
@@ -817,8 +783,7 @@ lilv_plugin_get_port_by_symbol(const LilvPlugin* p,
return NULL;
}
-LILV_API
-LilvNode*
+LILV_API LilvNode*
lilv_plugin_get_project(const LilvPlugin* p)
{
lilv_plugin_load_if_necessary(p);
@@ -826,11 +791,10 @@ lilv_plugin_get_project(const LilvPlugin* p)
SordNode* lv2_project = sord_new_uri(p->world->world,
(const uint8_t*)LV2_CORE__project);
- SordIter* projects = lilv_world_query_internal(
- p->world,
- p->plugin_uri->node,
- lv2_project,
- NULL);
+ SordIter* projects = lilv_world_query_internal(p->world,
+ p->plugin_uri->node,
+ lv2_project,
+ NULL);
sord_node_free(p->world->world, lv2_project);
@@ -890,8 +854,7 @@ lilv_plugin_get_author(const LilvPlugin* p)
return author;
}
-LILV_API
-LilvNode*
+LILV_API LilvNode*
lilv_plugin_get_author_name(const LilvPlugin* plugin)
{
const SordNode* author = lilv_plugin_get_author(plugin);
@@ -905,8 +868,7 @@ lilv_plugin_get_author_name(const LilvPlugin* plugin)
return NULL;
}
-LILV_API
-LilvNode*
+LILV_API LilvNode*
lilv_plugin_get_author_email(const LilvPlugin* plugin)
{
const SordNode* author = lilv_plugin_get_author(plugin);
@@ -920,8 +882,7 @@ lilv_plugin_get_author_email(const LilvPlugin* plugin)
return NULL;
}
-LILV_API
-LilvNode*
+LILV_API LilvNode*
lilv_plugin_get_author_homepage(const LilvPlugin* plugin)
{
const SordNode* author = lilv_plugin_get_author(plugin);
@@ -935,15 +896,13 @@ lilv_plugin_get_author_homepage(const LilvPlugin* plugin)
return NULL;
}
-LILV_API
-bool
+LILV_API bool
lilv_plugin_is_replaced(const LilvPlugin* plugin)
{
return plugin->replaced;
}
-LILV_API
-LilvUIs*
+LILV_API LilvUIs*
lilv_plugin_get_uis(const LilvPlugin* p)
{
lilv_plugin_load_if_necessary(p);
@@ -954,11 +913,10 @@ lilv_plugin_get_uis(const LilvPlugin* p)
(const uint8_t*)LV2_UI__binary);
LilvUIs* result = lilv_uis_new();
- SordIter* uis = lilv_world_query_internal(
- p->world,
- p->plugin_uri->node,
- ui_ui_node,
- NULL);
+ SordIter* uis = lilv_world_query_internal(p->world,
+ p->plugin_uri->node,
+ ui_ui_node,
+ NULL);
FOREACH_MATCH(uis) {
const SordNode* ui = sord_iter_get_node(uis, SORD_OBJECT);
@@ -996,8 +954,7 @@ lilv_plugin_get_uis(const LilvPlugin* p)
}
}
-LILV_API
-LilvNodes*
+LILV_API LilvNodes*
lilv_plugin_get_related(const LilvPlugin* plugin, const LilvNode* type)
{
lilv_plugin_load_if_necessary(plugin);
@@ -1057,8 +1014,7 @@ maybe_write_prefixes(SerdWriter* writer, SerdEnv* env, FILE* file)
}
}
-LILV_API
-void
+LILV_API void
lilv_plugin_write_description(LilvWorld* world,
const LilvPlugin* plugin,
const LilvNode* base_uri,
@@ -1097,8 +1053,7 @@ lilv_plugin_write_description(LilvWorld* world,
serd_env_free(env);
}
-LILV_API
-void
+LILV_API void
lilv_plugin_write_manifest_entry(LilvWorld* world,
const LilvPlugin* plugin,
const LilvNode* base_uri,
diff --git a/src/pluginclass.c b/src/pluginclass.c
index 46308ab..599d97a 100644
--- a/src/pluginclass.c
+++ b/src/pluginclass.c
@@ -33,9 +33,9 @@ lilv_plugin_class_new(LilvWorld* world,
pc->world = world;
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_node_new_from_node(world, parent_node)
- : NULL;
+ pc->parent_uri = (parent_node
+ ? lilv_node_new_from_node(world, parent_node)
+ : NULL);
return pc;
}
@@ -49,33 +49,25 @@ lilv_plugin_class_free(LilvPluginClass* plugin_class)
free(plugin_class);
}
-LILV_API
-const LilvNode*
+LILV_API const LilvNode*
lilv_plugin_class_get_parent_uri(const LilvPluginClass* plugin_class)
{
- if (plugin_class->parent_uri)
- return plugin_class->parent_uri;
- else
- return NULL;
+ return plugin_class->parent_uri ? plugin_class->parent_uri : NULL;
}
-LILV_API
-const LilvNode*
+LILV_API const LilvNode*
lilv_plugin_class_get_uri(const LilvPluginClass* plugin_class)
{
- assert(plugin_class->uri);
return plugin_class->uri;
}
-LILV_API
-const LilvNode*
+LILV_API const LilvNode*
lilv_plugin_class_get_label(const LilvPluginClass* plugin_class)
{
return plugin_class->label;
}
-LILV_API
-LilvPluginClasses*
+LILV_API LilvPluginClasses*
lilv_plugin_class_get_children(const LilvPluginClass* plugin_class)
{
// Returned list doesn't own categories
diff --git a/src/port.c b/src/port.c
index 5d076fd..b1eccf6 100644
--- a/src/port.c
+++ b/src/port.c
@@ -50,8 +50,7 @@ lilv_port_free(const LilvPlugin* plugin, LilvPort* port)
}
}
-LILV_API
-bool
+LILV_API bool
lilv_port_is_a(const LilvPlugin* plugin,
const LilvPort* port,
const LilvNode* port_class)
@@ -63,21 +62,18 @@ lilv_port_is_a(const LilvPlugin* plugin,
return false;
}
-LILV_API
-bool
+LILV_API bool
lilv_port_has_property(const LilvPlugin* p,
const LilvPort* port,
const LilvNode* property)
{
- return lilv_world_ask_internal(
- p->world,
- port->node->node,
- p->world->uris.lv2_portProperty,
- lilv_node_as_node(property));
+ return lilv_world_ask_internal(p->world,
+ port->node->node,
+ p->world->uris.lv2_portProperty,
+ property->node);
}
-LILV_API
-bool
+LILV_API bool
lilv_port_supports_event(const LilvPlugin* p,
const LilvPort* port,
const LilvNode* event)
@@ -90,7 +86,7 @@ lilv_port_supports_event(const LilvPlugin* p,
if (lilv_world_ask_internal(p->world,
port->node->node,
sord_new_uri(p->world->world, *pred),
- lilv_node_as_node(event))) {
+ event->node)) {
return true;
}
}
@@ -102,23 +98,20 @@ lilv_port_get_value_by_node(const LilvPlugin* p,
const LilvPort* port,
const SordNode* predicate)
{
- return lilv_world_find_nodes_internal(
- p->world,
- port->node->node,
- predicate,
- NULL);
+ return lilv_world_find_nodes_internal(p->world,
+ port->node->node,
+ predicate,
+ NULL);
}
-LILV_API
-const LilvNode*
+LILV_API const LilvNode*
lilv_port_get_node(const LilvPlugin* plugin,
const LilvPort* port)
{
return port->node;
}
-LILV_API
-LilvNodes*
+LILV_API LilvNodes*
lilv_port_get_value(const LilvPlugin* p,
const LilvPort* port,
const LilvNode* predicate)
@@ -129,13 +122,10 @@ lilv_port_get_value(const LilvPlugin* p,
return NULL;
}
- return lilv_port_get_value_by_node(
- p, port,
- lilv_node_as_node(predicate));
+ return lilv_port_get_value_by_node(p, port, predicate->node);
}
-LILV_API
-LilvNode*
+LILV_API LilvNode*
lilv_port_get(const LilvPlugin* p,
const LilvPort* port,
const LilvNode* predicate)
@@ -149,24 +139,21 @@ lilv_port_get(const LilvPlugin* p,
return value;
}
-LILV_API
-uint32_t
+LILV_API uint32_t
lilv_port_get_index(const LilvPlugin* p,
const LilvPort* port)
{
return port->index;
}
-LILV_API
-const LilvNode*
+LILV_API const LilvNode*
lilv_port_get_symbol(const LilvPlugin* p,
const LilvPort* port)
{
return port->symbol;
}
-LILV_API
-LilvNode*
+LILV_API LilvNode*
lilv_port_get_name(const LilvPlugin* p,
const LilvPort* port)
{
@@ -188,16 +175,14 @@ lilv_port_get_name(const LilvPlugin* p,
return ret;
}
-LILV_API
-const LilvNodes*
+LILV_API const LilvNodes*
lilv_port_get_classes(const LilvPlugin* p,
const LilvPort* port)
{
return port->classes;
}
-LILV_API
-void
+LILV_API void
lilv_port_get_range(const LilvPlugin* p,
const LilvPort* port,
LilvNode** def,
@@ -230,8 +215,7 @@ lilv_port_get_range(const LilvPlugin* p,
}
}
-LILV_API
-LilvScalePoints*
+LILV_API LilvScalePoints*
lilv_port_get_scale_points(const LilvPlugin* p,
const LilvPort* port)
{
@@ -248,15 +232,13 @@ lilv_port_get_scale_points(const LilvPlugin* p,
FOREACH_MATCH(points) {
const SordNode* point = sord_iter_get_node(points, SORD_OBJECT);
- LilvNode* value = lilv_plugin_get_unique(
- p,
- point,
- p->world->uris.rdf_value);
+ LilvNode* value = lilv_plugin_get_unique(p,
+ point,
+ p->world->uris.rdf_value);
- LilvNode* label = lilv_plugin_get_unique(
- p,
- point,
- p->world->uris.rdfs_label);
+ LilvNode* label = lilv_plugin_get_unique(p,
+ point,
+ p->world->uris.rdfs_label);
if (value && label) {
zix_tree_insert(
@@ -269,8 +251,7 @@ lilv_port_get_scale_points(const LilvPlugin* p,
return ret;
}
-LILV_API
-LilvNodes*
+LILV_API LilvNodes*
lilv_port_get_properties(const LilvPlugin* p,
const LilvPort* port)
{
diff --git a/src/scalepoint.c b/src/scalepoint.c
index 0138e61..55c2315 100644
--- a/src/scalepoint.c
+++ b/src/scalepoint.c
@@ -1,5 +1,5 @@
/*
- Copyright 2007-2011 David Robillard <http://drobilla.net>
+ Copyright 2007-2014 David Robillard <http://drobilla.net>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
@@ -20,8 +20,7 @@
LilvScalePoint*
lilv_scale_point_new(LilvNode* value, LilvNode* label)
{
- LilvScalePoint* point = (LilvScalePoint*)malloc(
- sizeof(struct LilvScalePointImpl));
+ LilvScalePoint* point = (LilvScalePoint*)malloc(sizeof(LilvScalePoint));
point->value = value;
point->label = label;
return point;
@@ -37,15 +36,13 @@ lilv_scale_point_free(LilvScalePoint* point)
}
}
-LILV_API
-const LilvNode*
+LILV_API const LilvNode*
lilv_scale_point_get_value(const LilvScalePoint* p)
{
return p->value;
}
-LILV_API
-const LilvNode*
+LILV_API const LilvNode*
lilv_scale_point_get_label(const LilvScalePoint* p)
{
return p->label;
diff --git a/src/state.c b/src/state.c
index 0a775c9..b0cec18 100644
--- a/src/state.c
+++ b/src/state.c
@@ -319,8 +319,7 @@ state_strerror(LV2_State_Status st)
}
}
-LILV_API
-LilvState*
+LILV_API LilvState*
lilv_state_new_from_instance(const LilvPlugin* plugin,
LilvInstance* instance,
LV2_URID_Map* map,
@@ -396,8 +395,7 @@ lilv_state_new_from_instance(const LilvPlugin* plugin,
return state;
}
-LILV_API
-void
+LILV_API void
lilv_state_restore(const LilvState* state,
LilvInstance* instance,
LilvSetPortValueFunc set_value,
@@ -572,8 +570,7 @@ new_state_from_model(LilvWorld* world,
return state;
}
-LILV_API
-LilvState*
+LILV_API LilvState*
lilv_state_new_from_world(LilvWorld* world,
LV2_URID_Map* map,
const LilvNode* node)
@@ -590,8 +587,7 @@ lilv_state_new_from_world(LilvWorld* world,
return state;
}
-LILV_API
-LilvState*
+LILV_API LilvState*
lilv_state_new_from_file(LilvWorld* world,
LV2_URID_Map* map,
const LilvNode* subject,
@@ -644,8 +640,7 @@ set_prefixes(SerdEnv* env)
SET_PSET(env, USTR("xsd"), USTR(LILV_NS_XSD));
}
-LILV_API
-LilvState*
+LILV_API LilvState*
lilv_state_new_from_string(LilvWorld* world,
LV2_URID_Map* map,
const char* str)
@@ -930,8 +925,7 @@ lilv_state_make_links(const LilvState* state, const char* dir)
}
}
-LILV_API
-int
+LILV_API int
lilv_state_save(LilvWorld* world,
LV2_URID_Map* map,
LV2_URID_Unmap* unmap,
@@ -986,8 +980,7 @@ lilv_state_save(LilvWorld* world,
return ret;
}
-LILV_API
-char*
+LILV_API char*
lilv_state_to_string(LilvWorld* world,
LV2_URID_Map* map,
LV2_URID_Unmap* unmap,
@@ -1012,8 +1005,7 @@ lilv_state_to_string(LilvWorld* world,
return (char*)serd_chunk_sink_finish(&chunk);
}
-LILV_API
-void
+LILV_API void
lilv_state_free(LilvState* state)
{
if (state) {
@@ -1038,8 +1030,7 @@ lilv_state_free(LilvState* state)
}
}
-LILV_API
-bool
+LILV_API bool
lilv_state_equals(const LilvState* a, const LilvState* b)
{
if (!lilv_node_equals(a->plugin_uri, b->plugin_uri)
@@ -1082,29 +1073,25 @@ lilv_state_equals(const LilvState* a, const LilvState* b)
return true;
}
-LILV_API
-unsigned
+LILV_API unsigned
lilv_state_get_num_properties(const LilvState* state)
{
return state->num_props;
}
-LILV_API
-const LilvNode*
+LILV_API const LilvNode*
lilv_state_get_plugin_uri(const LilvState* state)
{
return state->plugin_uri;
}
-LILV_API
-const char*
+LILV_API const char*
lilv_state_get_label(const LilvState* state)
{
return state->label;
}
-LILV_API
-void
+LILV_API void
lilv_state_set_label(LilvState* state, const char* label)
{
const size_t len = strlen(label);
diff --git a/src/ui.c b/src/ui.c
index 6eac62a..a11f0a5 100644
--- a/src/ui.c
+++ b/src/ui.c
@@ -52,30 +52,19 @@ void
lilv_ui_free(LilvUI* ui)
{
lilv_node_free(ui->uri);
- ui->uri = NULL;
-
lilv_node_free(ui->bundle_uri);
- ui->bundle_uri = NULL;
-
lilv_node_free(ui->binary_uri);
- ui->binary_uri = NULL;
-
lilv_nodes_free(ui->classes);
-
free(ui);
}
-LILV_API
-const LilvNode*
+LILV_API const LilvNode*
lilv_ui_get_uri(const LilvUI* ui)
{
- assert(ui);
- assert(ui->uri);
return ui->uri;
}
-LILV_API
-unsigned
+LILV_API unsigned
lilv_ui_is_supported(const LilvUI* ui,
LilvUISupportedFunc supported_func,
const LilvNode* container_type,
@@ -97,34 +86,26 @@ lilv_ui_is_supported(const LilvUI* ui,
return 0;
}
-LILV_API
-const LilvNodes*
+LILV_API const LilvNodes*
lilv_ui_get_classes(const LilvUI* ui)
{
return ui->classes;
}
-LILV_API
-bool
+LILV_API bool
lilv_ui_is_a(const LilvUI* ui, const LilvNode* ui_class_uri)
{
return lilv_nodes_contains(ui->classes, ui_class_uri);
}
-LILV_API
-const LilvNode*
+LILV_API const LilvNode*
lilv_ui_get_bundle_uri(const LilvUI* ui)
{
- assert(ui);
- assert(ui->bundle_uri);
return ui->bundle_uri;
}
-LILV_API
-const LilvNode*
+LILV_API const LilvNode*
lilv_ui_get_binary_uri(const LilvUI* ui)
{
- assert(ui);
- assert(ui->binary_uri);
return ui->binary_uri;
}
diff --git a/src/world.c b/src/world.c
index 48bf401..8983e40 100644
--- a/src/world.c
+++ b/src/world.c
@@ -23,8 +23,7 @@
#include "lilv_internal.h"
-LILV_API
-LilvWorld*
+LILV_API LilvWorld*
lilv_world_new(void)
{
LilvWorld* world = (LilvWorld*)malloc(sizeof(LilvWorld));
@@ -103,8 +102,7 @@ fail:
return NULL;
}
-LILV_API
-void
+LILV_API void
lilv_world_free(LilvWorld* world)
{
if (!world) {
@@ -155,8 +153,7 @@ lilv_world_free(LilvWorld* world)
free(world);
}
-LILV_API
-void
+LILV_API void
lilv_world_set_option(LilvWorld* world,
const char* option,
const LilvNode* value)
@@ -175,8 +172,7 @@ lilv_world_set_option(LilvWorld* world,
LILV_WARNF("Unrecognized or invalid option `%s'\n", option);
}
-LILV_API
-LilvNodes*
+LILV_API LilvNodes*
lilv_world_find_nodes(LilvWorld* world,
const LilvNode* subject,
const LilvNode* predicate,
@@ -195,15 +191,13 @@ lilv_world_find_nodes(LilvWorld* world,
return NULL;
}
- return lilv_world_find_nodes_internal(
- world,
- subject ? subject->node : NULL,
- predicate->node,
- object ? object->node : NULL);
+ return lilv_world_find_nodes_internal(world,
+ subject ? subject->node : NULL,
+ predicate->node,
+ object ? object->node : NULL);
}
-LILV_API
-LilvNode*
+LILV_API LilvNode*
lilv_world_get(LilvWorld* world,
const LilvNode* subject,
const LilvNode* predicate,
@@ -237,8 +231,7 @@ lilv_world_ask_internal(LilvWorld* world,
return sord_ask(world->model, subject, predicate, object, NULL);
}
-LILV_API
-bool
+LILV_API bool
lilv_world_ask(LilvWorld* world,
const LilvNode* subject,
const LilvNode* predicate,
@@ -319,9 +312,8 @@ lilv_collection_get_by_uri(const ZixTree* const_seq,
ZixTree* seq = (ZixTree*)const_seq;
struct LilvHeader key = { NULL, (LilvNode*)uri };
-
- ZixTreeIter* i = NULL;
- ZixStatus st = zix_tree_find(seq, &key, &i);
+ ZixTreeIter* i = NULL;
+ ZixStatus st = zix_tree_find(seq, &key, &i);
if (!st) {
return (struct LilvHeader*)zix_tree_get(i);
}
@@ -340,12 +332,11 @@ lilv_world_add_spec(LilvWorld* world,
spec->data_uris = lilv_nodes_new();
// Add all data files (rdfs:seeAlso)
- SordIter* files = sord_search(
- world->model,
- specification_node,
- world->uris.rdfs_seeAlso,
- NULL,
- NULL);
+ SordIter* files = sord_search(world->model,
+ specification_node,
+ world->uris.rdfs_seeAlso,
+ NULL,
+ NULL);
FOREACH_MATCH(files) {
const SordNode* file_node = sord_iter_get_node(files, SORD_OBJECT);
zix_tree_insert((ZixTree*)spec->data_uris,
@@ -397,12 +388,11 @@ lilv_world_add_plugin(LilvWorld* world,
#endif
// Add all plugin data files (rdfs:seeAlso)
- SordIter* files = sord_search(
- world->model,
- plugin_node,
- world->uris.rdfs_seeAlso,
- NULL,
- NULL);
+ SordIter* files = sord_search(world->model,
+ plugin_node,
+ world->uris.rdfs_seeAlso,
+ NULL,
+ NULL);
FOREACH_MATCH(files) {
const SordNode* file_node = sord_iter_get_node(files, SORD_OBJECT);
zix_tree_insert((ZixTree*)plugin->data_uris,
@@ -444,22 +434,20 @@ lilv_world_load_dyn_manifest(LilvWorld* world,
LV2_Dyn_Manifest_Handle handle = NULL;
// ?dman a dynman:DynManifest
- SordIter* dmanifests = sord_search(
- world->model,
- NULL,
- world->uris.rdf_a,
- world->uris.dman_DynManifest,
- bundle_node);
+ SordIter* dmanifests = sord_search(world->model,
+ NULL,
+ world->uris.rdf_a,
+ world->uris.dman_DynManifest,
+ bundle_node);
FOREACH_MATCH(dmanifests) {
const SordNode* dmanifest = sord_iter_get_node(dmanifests, SORD_SUBJECT);
// ?dman lv2:binary ?binary
- SordIter* binaries = sord_search(
- world->model,
- dmanifest,
- world->uris.lv2_binary,
- NULL,
- bundle_node);
+ SordIter* binaries = sord_search(world->model,
+ dmanifest,
+ world->uris.lv2_binary,
+ NULL,
+ bundle_node);
if (sord_iter_end(binaries)) {
sord_iter_free(binaries);
LILV_ERRORF("Dynamic manifest in <%s> has no binaries, ignored\n",
@@ -565,8 +553,7 @@ lilv_world_get_manifest_uri(LilvWorld* world, LilvNode* bundle_uri)
return manifest;
}
-LILV_API
-void
+LILV_API void
lilv_world_load_bundle(LilvWorld* world, LilvNode* bundle_uri)
{
if (!lilv_node_is_uri(bundle_uri)) {
@@ -587,12 +574,11 @@ lilv_world_load_bundle(LilvWorld* world, LilvNode* bundle_uri)
}
// ?plugin a lv2:Plugin
- SordIter* plug_results = sord_search(
- world->model,
- NULL,
- world->uris.rdf_a,
- world->uris.lv2_Plugin,
- bundle_node);
+ SordIter* plug_results = sord_search(world->model,
+ NULL,
+ world->uris.rdf_a,
+ world->uris.lv2_Plugin,
+ bundle_node);
FOREACH_MATCH(plug_results) {
const SordNode* plug = sord_iter_get_node(plug_results, SORD_SUBJECT);
lilv_world_add_plugin(world, plug, manifest, NULL, bundle_node);
@@ -602,12 +588,11 @@ lilv_world_load_bundle(LilvWorld* world, LilvNode* bundle_uri)
lilv_world_load_dyn_manifest(world, bundle_node, manifest);
// ?specification a lv2:Specification
- SordIter* spec_results = sord_search(
- world->model,
- NULL,
- world->uris.rdf_a,
- world->uris.lv2_Specification,
- bundle_node);
+ SordIter* spec_results = sord_search(world->model,
+ NULL,
+ world->uris.rdf_a,
+ world->uris.lv2_Specification,
+ bundle_node);
FOREACH_MATCH(spec_results) {
const SordNode* spec = sord_iter_get_node(spec_results, SORD_SUBJECT);
lilv_world_add_spec(world, spec, bundle_node);
@@ -648,8 +633,7 @@ lilv_world_unload_file(LilvWorld* world, LilvNode* file)
return 1;
}
-LILV_API
-int
+LILV_API int
lilv_world_unload_bundle(LilvWorld* world, LilvNode* bundle_uri)
{
// Remove loaded_files entry for manifest.ttl
@@ -682,26 +666,17 @@ static void
lilv_world_load_directory(LilvWorld* world, const char* dir_path)
{
char* path = lilv_expand(dir_path);
- if (!path) {
- LILV_WARNF("Empty path `%s'\n", path);
- return;
+ if (path) {
+ lilv_dir_for_each(path, world, load_dir_entry);
+ free(path);
}
-
- lilv_dir_for_each(path, world, load_dir_entry);
- free(path);
-}
-
-static bool
-is_path_sep(char c)
-{
- return c == LILV_PATH_SEP[0];
}
static const char*
first_path_sep(const char* path)
{
for (const char* p = path; *p != '\0'; ++p) {
- if (is_path_sep(*p)) {
+ if (*p == LILV_PATH_SEP[0]) {
return p;
}
}
@@ -754,12 +729,11 @@ lilv_world_load_plugin_classes(LilvWorld* world)
a menu), they won't be seen anyway...
*/
- SordIter* classes = sord_search(
- world->model,
- NULL,
- world->uris.rdf_a,
- world->uris.rdfs_Class,
- NULL);
+ SordIter* classes = sord_search(world->model,
+ NULL,
+ world->uris.rdf_a,
+ world->uris.rdfs_Class,
+ NULL);
FOREACH_MATCH(classes) {
const SordNode* class_node = sord_iter_get_node(classes, SORD_SUBJECT);
@@ -789,8 +763,7 @@ lilv_world_load_plugin_classes(LilvWorld* world)
sord_iter_free(classes);
}
-LILV_API
-void
+LILV_API void
lilv_world_load_all(LilvWorld* world)
{
const char* lv2_path = getenv("LV2_PATH");
@@ -808,7 +781,7 @@ lilv_world_load_all(LilvWorld* world)
if (sord_ask(world->model,
NULL,
world->uris.dc_replaces,
- lilv_node_as_node(lilv_plugin_get_uri(plugin)),
+ lilv_plugin_get_uri(plugin)->node,
NULL)) {
// TODO: Check if replacement is a known plugin? (expensive)
((LilvPlugin*)plugin)->replaced = true;
@@ -829,8 +802,8 @@ lilv_world_load_file(LilvWorld* world, SerdReader* reader, const LilvNode* uri)
}
serd_reader_add_blank_prefix(reader, lilv_world_blank_node_prefix(world));
- const uint8_t* uri_str = sord_node_get_string(uri->node);
- SerdStatus st = serd_reader_read_file(reader, uri_str);
+ const SerdStatus st = serd_reader_read_file(
+ reader, sord_node_get_string(uri->node));
if (st) {
LILV_ERRORF("Error loading file `%s'\n", lilv_node_as_string(uri));
return st;
@@ -842,8 +815,7 @@ lilv_world_load_file(LilvWorld* world, SerdReader* reader, const LilvNode* uri)
return SERD_SUCCESS;
}
-LILV_API
-int
+LILV_API int
lilv_world_load_resource(LilvWorld* world,
const LilvNode* resource)
{
@@ -874,8 +846,7 @@ lilv_world_load_resource(LilvWorld* world,
return n_read;
}
-LILV_API
-int
+LILV_API int
lilv_world_unload_resource(LilvWorld* world,
const LilvNode* resource)
{
@@ -892,10 +863,10 @@ lilv_world_unload_resource(LilvWorld* world,
NULL, NULL);
FOREACH_MATCH(files) {
const SordNode* file = sord_iter_get_node(files, SORD_OBJECT);
- const uint8_t* file_str = sord_node_get_string(file);
LilvNode* file_node = lilv_node_new_from_node(world, file);
if (sord_node_get_type(file) != SORD_URI) {
- LILV_ERRORF("rdfs:seeAlso node `%s' is not a URI\n", file_str);
+ LILV_ERRORF("rdfs:seeAlso node `%s' is not a URI\n",
+ sord_node_get_string(file));
} else if (!lilv_world_drop_graph(world, file_node)) {
lilv_world_unload_file(world, file_node);
++n_dropped;
@@ -907,22 +878,19 @@ lilv_world_unload_resource(LilvWorld* world,
return n_dropped;
}
-LILV_API
-const LilvPluginClass*
+LILV_API const LilvPluginClass*
lilv_world_get_plugin_class(const LilvWorld* world)
{
return world->lv2_plugin_class;
}
-LILV_API
-const LilvPluginClasses*
+LILV_API const LilvPluginClasses*
lilv_world_get_plugin_classes(const LilvWorld* world)
{
return world->plugin_classes;
}
-LILV_API
-const LilvPlugins*
+LILV_API const LilvPlugins*
lilv_world_get_all_plugins(const LilvWorld* world)
{
return world->plugins;