summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lilv/lilv.h509
-rw-r--r--lilv/lilvmm.hpp104
-rw-r--r--src/collections.c91
-rw-r--r--src/lilv_internal.h272
-rw-r--r--src/plugin.c223
-rw-r--r--src/pluginclass.c37
-rw-r--r--src/plugininstance.c33
-rw-r--r--src/pluginui.c46
-rw-r--r--src/port.c122
-rw-r--r--src/query.c30
-rw-r--r--src/scalepoint.c17
-rw-r--r--src/util.c2
-rw-r--r--src/value.c84
-rw-r--r--src/world.c122
-rw-r--r--test/lilv_test.c223
-rw-r--r--utils/lilv_bench.c6
-rw-r--r--utils/lv2_inspect.c86
-rw-r--r--utils/lv2_jack_host.c48
-rw-r--r--utils/lv2_list.c10
19 files changed, 1018 insertions, 1047 deletions
diff --git a/lilv/lilv.h b/lilv/lilv.h
index 41c16d8..ce0729d 100644
--- a/lilv/lilv.h
+++ b/lilv/lilv.h
@@ -57,19 +57,21 @@ extern "C" {
#define LILV_PORT_CLASS_EVENT "http://lv2plug.in/ns/ext/event#EventPort"
#define LILV_EVENT_CLASS_MIDI "http://lv2plug.in/ns/ext/midi#MidiEvent"
-typedef struct _LilvPlugin* LilvPlugin; /**< LV2 Plugin. */
-typedef struct _LilvPluginClass* LilvPluginClass; /**< Plugin Class. */
-typedef struct _LilvPort* LilvPort; /**< Port. */
-typedef struct _LilvScalePoint* LilvScalePoint; /**< Scale Point (Notch). */
-typedef struct _LilvUI* LilvUI; /**< Plugin UI. */
-typedef struct _LilvValue* LilvValue; /**< Typed Value. */
-typedef struct _LilvWorld* LilvWorld; /**< Lilv World. */
-
-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 struct LilvPluginImpl LilvPlugin; /**< LV2 Plugin. */
+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 LilvWorldImpl LilvWorld; /**< Lilv World. */
+typedef struct LilvInstanceImpl LilvInstance; /**< Plugin instance. */
+
+typedef void LilvIter; /**< Collection iterator */
+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>. */
/**
@defgroup lilv Lilv
@@ -100,61 +102,61 @@ lilv_uri_to_path(const char* uri);
Returned value must be freed by caller with lilv_value_free.
*/
LILV_API
-LilvValue
-lilv_value_new_uri(LilvWorld world, const char* uri);
+LilvValue*
+lilv_value_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.
*/
LILV_API
-LilvValue
-lilv_value_new_string(LilvWorld world, const char* str);
+LilvValue*
+lilv_value_new_string(LilvWorld* world, const char* str);
/**
Create a new integer value.
Returned value must be freed by caller with lilv_value_free.
*/
LILV_API
-LilvValue
-lilv_value_new_int(LilvWorld world, int val);
+LilvValue*
+lilv_value_new_int(LilvWorld* world, int val);
/**
Create a new floating point value.
Returned value must be freed by caller with lilv_value_free.
*/
LILV_API
-LilvValue
-lilv_value_new_float(LilvWorld world, float val);
+LilvValue*
+lilv_value_new_float(LilvWorld* world, float val);
/**
Create a new boolean value.
Returned value must be freed by caller with lilv_value_free.
*/
LILV_API
-LilvValue
-lilv_value_new_bool(LilvWorld world, bool val);
+LilvValue*
+lilv_value_new_bool(LilvWorld* world, bool val);
/**
Free an LilvValue.
*/
LILV_API
void
-lilv_value_free(LilvValue val);
+lilv_value_free(LilvValue* val);
/**
Duplicate an LilvValue.
*/
LILV_API
-LilvValue
-lilv_value_duplicate(LilvValue val);
+LilvValue*
+lilv_value_duplicate(const LilvValue* val);
/**
Return whether two values are equivalent.
*/
LILV_API
bool
-lilv_value_equals(LilvValue value, LilvValue other);
+lilv_value_equals(const LilvValue* value, const LilvValue* other);
/**
Return this value as a Turtle/SPARQL token.
@@ -171,14 +173,14 @@ lilv_value_equals(LilvValue value, LilvValue other);
*/
LILV_API
char*
-lilv_value_get_turtle_token(LilvValue value);
+lilv_value_get_turtle_token(const LilvValue* value);
/**
Return whether the value is a URI (resource).
*/
LILV_API
bool
-lilv_value_is_uri(LilvValue value);
+lilv_value_is_uri(const LilvValue* value);
/**
Return this value as a URI string, e.g. "http://example.org/foo".
@@ -187,14 +189,14 @@ lilv_value_is_uri(LilvValue value);
*/
LILV_API
const char*
-lilv_value_as_uri(LilvValue value);
+lilv_value_as_uri(const LilvValue* value);
/**
Return whether the value is a blank node (resource with no URI).
*/
LILV_API
bool
-lilv_value_is_blank(LilvValue value);
+lilv_value_is_blank(const LilvValue* value);
/**
Return this value as a blank node identifier, e.g. "genid03".
@@ -203,7 +205,7 @@ lilv_value_is_blank(LilvValue value);
*/
LILV_API
const char*
-lilv_value_as_blank(LilvValue value);
+lilv_value_as_blank(const LilvValue* value);
/**
Return whether this value is a literal (i.e. not a URI).
@@ -211,7 +213,7 @@ lilv_value_as_blank(LilvValue value);
*/
LILV_API
bool
-lilv_value_is_literal(LilvValue value);
+lilv_value_is_literal(const LilvValue* value);
/**
Return whether this value is a string literal.
@@ -219,21 +221,21 @@ lilv_value_is_literal(LilvValue value);
*/
LILV_API
bool
-lilv_value_is_string(LilvValue value);
+lilv_value_is_string(const LilvValue* value);
/**
Return @a value as a string.
*/
LILV_API
const char*
-lilv_value_as_string(LilvValue value);
+lilv_value_as_string(const LilvValue* value);
/**
Return whether this value is a decimal literal.
*/
LILV_API
bool
-lilv_value_is_float(LilvValue value);
+lilv_value_is_float(const LilvValue* value);
/**
Return @a value as a float.
@@ -242,14 +244,14 @@ lilv_value_is_float(LilvValue value);
*/
LILV_API
float
-lilv_value_as_float(LilvValue value);
+lilv_value_as_float(const LilvValue* value);
/**
Return whether this value is an integer literal.
*/
LILV_API
bool
-lilv_value_is_int(LilvValue value);
+lilv_value_is_int(const LilvValue* value);
/**
Return @a value as an integer.
@@ -257,14 +259,14 @@ lilv_value_is_int(LilvValue value);
*/
LILV_API
int
-lilv_value_as_int(LilvValue value);
+lilv_value_as_int(const LilvValue* value);
/**
Return whether this value is a boolean.
*/
LILV_API
bool
-lilv_value_is_bool(LilvValue value);
+lilv_value_is_bool(const LilvValue* value);
/**
Return @a value as a bool.
@@ -272,7 +274,7 @@ lilv_value_is_bool(LilvValue value);
*/
LILV_API
bool
-lilv_value_as_bool(LilvValue value);
+lilv_value_as_bool(const LilvValue* value);
/**
@}
@@ -290,15 +292,13 @@ lilv_value_as_bool(LilvValue value);
<ul>
<li>void PREFIX_free (coll)</li>
<li>unsigned PREFIX_size (coll)</li>
- <li>LilvIter PREFIX_begin (coll)</li>
+ <li>LilvIter* PREFIX_begin (coll)</li>
</ul>
@{
*/
/* Collections */
-typedef void* LilvIter;
-
/**
Iterate over each element of a collection.
@code
@@ -309,7 +309,7 @@ typedef void* LilvIter;
@endcode
*/
#define LILV_FOREACH(colltype, iter, collection) \
- for (LilvIter (iter) = lilv_ ## colltype ## _begin(collection); \
+ for (LilvIter* (iter) = lilv_ ## colltype ## _begin(collection); \
!lilv_ ## colltype ## _is_end(collection, iter); \
(iter) = lilv_ ## colltype ## _next(collection, iter))
@@ -317,27 +317,27 @@ typedef void* LilvIter;
LILV_API
void
-lilv_plugin_classes_free(LilvPluginClasses collection);
+lilv_plugin_classes_free(LilvPluginClasses* collection);
LILV_API
unsigned
-lilv_plugin_classes_size(LilvPluginClasses collection);
+lilv_plugin_classes_size(const LilvPluginClasses* collection);
LILV_API
-LilvIter
-lilv_plugin_classes_begin(LilvPluginClasses collection);
+LilvIter*
+lilv_plugin_classes_begin(const LilvPluginClasses* collection);
LILV_API
-LilvPluginClass
-lilv_plugin_classes_get(LilvPluginClasses collection, LilvIter i);
+const LilvPluginClass*
+lilv_plugin_classes_get(const LilvPluginClasses* collection, LilvIter* i);
LILV_API
-LilvIter
-lilv_plugin_classes_next(LilvPluginClasses collection, LilvIter i);
+LilvIter*
+lilv_plugin_classes_next(const LilvPluginClasses* collection, LilvIter* i);
LILV_API
bool
-lilv_plugin_classes_is_end(LilvPluginClasses collection, LilvIter i);
+lilv_plugin_classes_is_end(const LilvPluginClasses* collection, LilvIter* i);
/**
Get a plugin class from @a classes by URI.
@@ -346,61 +346,61 @@ lilv_plugin_classes_is_end(LilvPluginClasses collection, LilvIter i);
@return NULL if no plugin class with @a uri is found in @a classes.
*/
LILV_API
-LilvPluginClass
-lilv_plugin_classes_get_by_uri(LilvPluginClasses classes,
- LilvValue uri);
+const LilvPluginClass*
+lilv_plugin_classes_get_by_uri(const LilvPluginClasses* classes,
+ const LilvValue* uri);
/* ScalePoints */
LILV_API
void
-lilv_scale_points_free(LilvScalePoints collection);
+lilv_scale_points_free(LilvScalePoints* collection);
LILV_API
unsigned
-lilv_scale_points_size(LilvScalePoints collection);
+lilv_scale_points_size(const LilvScalePoints* collection);
LILV_API
-LilvIter
-lilv_scale_points_begin(LilvScalePoints collection);
+LilvIter*
+lilv_scale_points_begin(const LilvScalePoints* collection);
LILV_API
-LilvScalePoint
-lilv_scale_points_get(LilvScalePoints collection, LilvIter i);
+const LilvScalePoint*
+lilv_scale_points_get(const LilvScalePoints* collection, LilvIter* i);
LILV_API
-LilvIter
-lilv_scale_points_next(LilvScalePoints collection, LilvIter i);
+LilvIter*
+lilv_scale_points_next(const LilvScalePoints* collection, LilvIter* i);
LILV_API
bool
-lilv_scale_points_is_end(LilvScalePoints collection, LilvIter i);
+lilv_scale_points_is_end(const LilvScalePoints* collection, LilvIter* i);
/* UIs */
LILV_API
void
-lilv_uis_free(LilvUIs collection);
+lilv_uis_free(LilvUIs* collection);
LILV_API
unsigned
-lilv_uis_size(LilvUIs collection);
+lilv_uis_size(const LilvUIs* collection);
LILV_API
-LilvIter
-lilv_uis_begin(LilvUIs collection);
+LilvIter*
+lilv_uis_begin(const LilvUIs* collection);
LILV_API
-LilvUI
-lilv_uis_get(LilvUIs collection, LilvIter i);
+const LilvUI*
+lilv_uis_get(const LilvUIs* collection, LilvIter* i);
LILV_API
-LilvIter
-lilv_uis_next(LilvUIs collection, LilvIter i);
+LilvIter*
+lilv_uis_next(const LilvUIs* collection, LilvIter* i);
LILV_API
bool
-lilv_uis_is_end(LilvUIs collection, LilvIter i);
+lilv_uis_is_end(const LilvUIs* collection, LilvIter* i);
/**
Get a UI from @a uis by URI.
@@ -409,72 +409,68 @@ lilv_uis_is_end(LilvUIs collection, LilvIter i);
@return NULL if no UI with @a uri is found in @a list.
*/
LILV_API
-LilvUI
-lilv_uis_get_by_uri(LilvUIs uis,
- LilvValue uri);
+const LilvUI*
+lilv_uis_get_by_uri(const LilvUIs* uis,
+ const LilvValue* uri);
/* Values */
LILV_API
void
-lilv_values_free(LilvValues collection);
+lilv_values_free(LilvValues* collection);
LILV_API
unsigned
-lilv_values_size(LilvValues collection);
+lilv_values_size(const LilvValues* collection);
LILV_API
-LilvIter
-lilv_values_begin(LilvValues collection);
+LilvIter*
+lilv_values_begin(const LilvValues* collection);
LILV_API
-LilvValue
-lilv_values_get(LilvValues collection, LilvIter i);
+const LilvValue*
+lilv_values_get(const LilvValues* collection, LilvIter* i);
LILV_API
-LilvIter
-lilv_values_next(LilvValues collection, LilvIter i);
+LilvIter*
+lilv_values_next(const LilvValues* collection, LilvIter* i);
LILV_API
bool
-lilv_values_is_end(LilvValues collection, LilvIter i);
+lilv_values_is_end(const LilvValues* collection, LilvIter* i);
LILV_API
-LilvValue
-lilv_values_get_first(LilvValues collection);
+LilvValue*
+lilv_values_get_first(const LilvValues* collection);
/**
Return whether @a values contains @a value.
*/
LILV_API
bool
-lilv_values_contains(LilvValues values, LilvValue value);
+lilv_values_contains(const LilvValues* values, const LilvValue* value);
/* Plugins */
LILV_API
unsigned
-lilv_plugins_size(LilvPlugins collection);
+lilv_plugins_size(const LilvPlugins* collection);
LILV_API
-LilvIter
-lilv_plugins_begin(LilvPlugins collection);
+LilvIter*
+lilv_plugins_begin(const LilvPlugins* collection);
LILV_API
-LilvPlugin
-lilv_plugins_get(LilvPlugins collection, LilvIter i);
+const LilvPlugin*
+lilv_plugins_get(const LilvPlugins* collection, LilvIter* i);
LILV_API
-LilvIter
-lilv_plugins_next(LilvPlugins collection, LilvIter i);
+LilvIter*
+lilv_plugins_next(const LilvPlugins* collection, LilvIter* i);
LILV_API
bool
-lilv_plugins_is_end(LilvPlugins collection, LilvIter i);
-
-LILV_API
-void
-lilv_plugins_free(LilvWorld world, LilvPlugins plugins);
+lilv_plugins_is_end(const LilvPlugins* collection, LilvIter* i);
/**
Get a plugin from @a plugins by URI.
@@ -483,9 +479,9 @@ lilv_plugins_free(LilvWorld world, LilvPlugins plugins);
@return NULL if no plugin with @a uri is found in @a plugins.
*/
LILV_API
-LilvPlugin
-lilv_plugins_get_by_uri(LilvPlugins plugins,
- LilvValue uri);
+const LilvPlugin*
+lilv_plugins_get_by_uri(const LilvPlugins* plugins,
+ const LilvValue* uri);
/**
@}
@@ -502,7 +498,7 @@ lilv_plugins_get_by_uri(LilvPlugins plugins,
If initialization fails, NULL is returned.
*/
LILV_API
-LilvWorld
+LilvWorld*
lilv_world_new(void);
/**
@@ -529,9 +525,9 @@ lilv_world_new(void);
*/
LILV_API
void
-lilv_world_set_option(LilvWorld world,
- const char* uri,
- const LilvValue value);
+lilv_world_set_option(LilvWorld* world,
+ const char* uri,
+ const LilvValue* value);
/**
Destroy the world, mwahaha.
@@ -541,7 +537,7 @@ lilv_world_set_option(LilvWorld world,
*/
LILV_API
void
-lilv_world_free(LilvWorld world);
+lilv_world_free(LilvWorld* world);
/**
Load all installed LV2 bundles on the system.
@@ -556,7 +552,7 @@ lilv_world_free(LilvWorld world);
*/
LILV_API
void
-lilv_world_load_all(LilvWorld world);
+lilv_world_load_all(LilvWorld* world);
/**
Load a specific bundle.
@@ -572,23 +568,23 @@ lilv_world_load_all(LilvWorld world);
*/
LILV_API
void
-lilv_world_load_bundle(LilvWorld world,
- LilvValue bundle_uri);
+lilv_world_load_bundle(LilvWorld* world,
+ LilvValue* bundle_uri);
/**
Get the parent of all other plugin classes, lv2:Plugin.
*/
LILV_API
-LilvPluginClass
-lilv_world_get_plugin_class(LilvWorld world);
+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
-LilvPluginClasses
-lilv_world_get_plugin_classes(LilvWorld world);
+const LilvPluginClasses*
+lilv_world_get_plugin_classes(const LilvWorld* world);
/**
Return a list of all found plugins.
@@ -602,16 +598,8 @@ lilv_world_get_plugin_classes(LilvWorld world);
and must not be freed by caller.
*/
LILV_API
-LilvPlugins
-lilv_world_get_all_plugins(LilvWorld world);
-
-/**
- Return the plugin with the given @a uri, or NULL if not found.
-*/
-LILV_API
-LilvPlugin
-lilv_world_get_plugin_by_uri_string(LilvWorld world,
- const char* uri);
+const LilvPlugins*
+lilv_world_get_all_plugins(const LilvWorld* world);
/**
@}
@@ -631,7 +619,7 @@ lilv_world_get_plugin_by_uri_string(LilvWorld world,
*/
LILV_API
bool
-lilv_plugin_verify(LilvPlugin plugin);
+lilv_plugin_verify(const LilvPlugin* plugin);
/**
Get the URI of @a plugin.
@@ -648,8 +636,8 @@ lilv_plugin_verify(LilvPlugin plugin);
@return A shared URI value which must not be modified or freed.
*/
LILV_API
-LilvValue
-lilv_plugin_get_uri(LilvPlugin plugin);
+const LilvValue*
+lilv_plugin_get_uri(const LilvPlugin* plugin);
/**
Get the (resolvable) URI of the plugin's "main" bundle.
@@ -663,8 +651,8 @@ lilv_plugin_get_uri(LilvPlugin plugin);
@return a shared string which must not be modified or freed.
*/
LILV_API
-LilvValue
-lilv_plugin_get_bundle_uri(LilvPlugin plugin);
+const LilvValue*
+lilv_plugin_get_bundle_uri(const LilvPlugin* plugin);
/**
Get the (resolvable) URIs of the RDF data files that define a plugin.
@@ -675,8 +663,8 @@ lilv_plugin_get_bundle_uri(LilvPlugin plugin);
which is shared and must not be modified or freed.
*/
LILV_API
-LilvValues
-lilv_plugin_get_data_uris(LilvPlugin plugin);
+const LilvValues*
+lilv_plugin_get_data_uris(const LilvPlugin* plugin);
/**
Get the (resolvable) URI of the shared library for @a plugin.
@@ -685,8 +673,8 @@ lilv_plugin_get_data_uris(LilvPlugin plugin);
@return a shared string which must not be modified or freed.
*/
LILV_API
-LilvValue
-lilv_plugin_get_library_uri(LilvPlugin plugin);
+const LilvValue*
+lilv_plugin_get_library_uri(const LilvPlugin* plugin);
/**
Get the name of @a plugin.
@@ -696,15 +684,15 @@ lilv_plugin_get_library_uri(LilvPlugin plugin);
Returned value must be freed by the caller.
*/
LILV_API
-LilvValue
-lilv_plugin_get_name(LilvPlugin plugin);
+LilvValue*
+lilv_plugin_get_name(const LilvPlugin* plugin);
/**
- Get the class this plugin belongs to (ie Filters).
+ Get the class this plugin belongs to (e.g. Filters).
*/
LILV_API
-LilvPluginClass
-lilv_plugin_get_class(LilvPlugin plugin);
+const LilvPluginClass*
+lilv_plugin_get_class(const LilvPlugin* plugin);
/**
Get a value associated with the plugin in a plugin's data files.
@@ -719,9 +707,9 @@ lilv_plugin_get_class(LilvPlugin plugin);
Return value must be freed by caller with lilv_values_free.
*/
LILV_API
-LilvValues
-lilv_plugin_get_value(LilvPlugin p,
- LilvValue predicate);
+LilvValues*
+lilv_plugin_get_value(const LilvPlugin* p,
+ const LilvValue* predicate);
/**
Get a value associated with the plugin in a plugin's data files.
@@ -730,9 +718,9 @@ lilv_plugin_get_value(LilvPlugin p,
more convenient.
*/
LILV_API
-LilvValues
-lilv_plugin_get_value_by_qname(LilvPlugin p,
- const char* predicate);
+LilvValues*
+lilv_plugin_get_value_by_qname(const LilvPlugin* p,
+ const char* predicate);
/**
Get a value associated with some subject in a plugin's data files.
@@ -750,10 +738,10 @@ lilv_plugin_get_value_by_qname(LilvPlugin p,
Return value must be freed by caller with lilv_values_free.
*/
LILV_API
-LilvValues
-lilv_plugin_get_value_for_subject(LilvPlugin p,
- LilvValue subject_uri,
- LilvValue predicate_uri);
+LilvValues*
+lilv_plugin_get_value_for_subject(const LilvPlugin* p,
+ const LilvValue* subject_uri,
+ const LilvValue* predicate_uri);
/**
Return whether a feature is supported by a plugin.
@@ -762,8 +750,8 @@ lilv_plugin_get_value_for_subject(LilvPlugin p,
*/
LILV_API
bool
-lilv_plugin_has_feature(LilvPlugin p,
- LilvValue feature_uri);
+lilv_plugin_has_feature(const LilvPlugin* p,
+ const LilvValue* feature_uri);
/**
Get the LV2 Features supported (required or optionally) by a plugin.
@@ -776,8 +764,8 @@ lilv_plugin_has_feature(LilvPlugin p,
Returned value must be freed by caller with lilv_values_free.
*/
LILV_API
-LilvValues
-lilv_plugin_get_supported_features(LilvPlugin p);
+LilvValues*
+lilv_plugin_get_supported_features(const LilvPlugin* p);
/**
Get the LV2 Features required by a plugin.
@@ -791,8 +779,8 @@ lilv_plugin_get_supported_features(LilvPlugin p);
Return value must be freed by caller with lilv_values_free.
*/
LILV_API
-LilvValues
-lilv_plugin_get_required_features(LilvPlugin p);
+LilvValues*
+lilv_plugin_get_required_features(const LilvPlugin* p);
/**
Get the LV2 Features optionally supported by a plugin.
@@ -803,15 +791,15 @@ lilv_plugin_get_required_features(LilvPlugin p);
Return value must be freed by caller with lilv_values_free.
*/
LILV_API
-LilvValues
-lilv_plugin_get_optional_features(LilvPlugin p);
+LilvValues*
+lilv_plugin_get_optional_features(const LilvPlugin* p);
/**
Get the number of ports on this plugin.
*/
LILV_API
uint32_t
-lilv_plugin_get_num_ports(LilvPlugin p);
+lilv_plugin_get_num_ports(const LilvPlugin* p);
/**
Get the port ranges (minimum, maximum and default values) for all ports.
@@ -829,10 +817,10 @@ lilv_plugin_get_num_ports(LilvPlugin p);
*/
LILV_API
void
-lilv_plugin_get_port_ranges_float(LilvPlugin p,
- float* min_values,
- float* max_values,
- float* def_values);
+lilv_plugin_get_port_ranges_float(const LilvPlugin* p,
+ float* min_values,
+ float* max_values,
+ float* def_values);
/**
Get the number of ports on this plugin that are members of some class(es).
@@ -842,8 +830,8 @@ lilv_plugin_get_port_ranges_float(LilvPlugin p,
*/
LILV_API
uint32_t
-lilv_plugin_get_num_ports_of_class(LilvPlugin p,
- LilvValue class_1, ...);
+lilv_plugin_get_num_ports_of_class(const LilvPlugin* p,
+ const LilvValue* class_1, ...);
/**
Return whether or not the plugin introduces (and reports) latency.
@@ -852,7 +840,7 @@ lilv_plugin_get_num_ports_of_class(LilvPlugin p,
*/
LILV_API
bool
-lilv_plugin_has_latency(LilvPlugin p);
+lilv_plugin_has_latency(const LilvPlugin* p);
/**
Return the index of the plugin's latency port.
@@ -865,15 +853,15 @@ lilv_plugin_has_latency(LilvPlugin p);
*/
LILV_API
uint32_t
-lilv_plugin_get_latency_port_index(LilvPlugin p);
+lilv_plugin_get_latency_port_index(const LilvPlugin* p);
/**
Get a port on @a plugin by @a index.
*/
LILV_API
-LilvPort
-lilv_plugin_get_port_by_index(LilvPlugin plugin,
- uint32_t index);
+const LilvPort*
+lilv_plugin_get_port_by_index(const LilvPlugin* plugin,
+ uint32_t index);
/**
Get a port on @a plugin by @a symbol.
@@ -881,9 +869,9 @@ lilv_plugin_get_port_by_index(LilvPlugin plugin,
especially on plugins with a very large number of ports.
*/
LILV_API
-LilvPort
-lilv_plugin_get_port_by_symbol(LilvPlugin plugin,
- LilvValue symbol);
+const LilvPort*
+lilv_plugin_get_port_by_symbol(const LilvPlugin* plugin,
+ const LilvValue* symbol);
/**
Get the full name of the plugin's author.
@@ -891,8 +879,8 @@ lilv_plugin_get_port_by_symbol(LilvPlugin plugin,
Returned value must be freed by caller.
*/
LILV_API
-LilvValue
-lilv_plugin_get_author_name(LilvPlugin plugin);
+LilvValue*
+lilv_plugin_get_author_name(const LilvPlugin* plugin);
/**
Get the email address of the plugin's author.
@@ -900,8 +888,8 @@ lilv_plugin_get_author_name(LilvPlugin plugin);
Returned value must be freed by caller.
*/
LILV_API
-LilvValue
-lilv_plugin_get_author_email(LilvPlugin plugin);
+LilvValue*
+lilv_plugin_get_author_email(const LilvPlugin* plugin);
/**
Get the email address of the plugin's author.
@@ -909,8 +897,8 @@ lilv_plugin_get_author_email(LilvPlugin plugin);
Returned value must be freed by caller.
*/
LILV_API
-LilvValue
-lilv_plugin_get_author_homepage(LilvPlugin plugin);
+LilvValue*
+lilv_plugin_get_author_homepage(const LilvPlugin* plugin);
/**
Return true iff @a plugin has been replaced by another plugin.
@@ -920,7 +908,7 @@ lilv_plugin_get_author_homepage(LilvPlugin plugin);
*/
LILV_API
bool
-lilv_plugin_is_replaced(LilvPlugin plugin);
+lilv_plugin_is_replaced(const LilvPlugin* plugin);
/**
@}
@@ -932,45 +920,45 @@ lilv_plugin_is_replaced(LilvPlugin plugin);
Port analog of lilv_plugin_get_value.
*/
LILV_API
-LilvValues
-lilv_port_get_value(LilvPlugin plugin,
- LilvPort port,
- LilvValue predicate);
+LilvValues*
+lilv_port_get_value(const LilvPlugin* plugin,
+ const LilvPort* port,
+ const LilvValue* predicate);
/**
Port analog of lilv_plugin_get_value_by_qname.
*/
LILV_API
-LilvValues
-lilv_port_get_value_by_qname(LilvPlugin plugin,
- LilvPort port,
+LilvValues*
+lilv_port_get_value_by_qname(const LilvPlugin* plugin,
+ const LilvPort* port,
const char* predicate);
/**
Return the LV2 port properties of a port.
*/
LILV_API
-LilvValues
-lilv_port_get_properties(LilvPlugin plugin,
- LilvPort port);
+LilvValues*
+lilv_port_get_properties(const LilvPlugin* plugin,
+ const LilvPort* port);
/**
Return whether a port has a certain property.
*/
LILV_API
bool
-lilv_port_has_property(LilvPlugin p,
- LilvPort port,
- LilvValue property_uri);
+lilv_port_has_property(const LilvPlugin* p,
+ const LilvPort* port,
+ const LilvValue* property_uri);
/**
Return whether a port is an event port and supports a certain event type.
*/
LILV_API
bool
-lilv_port_supports_event(LilvPlugin p,
- LilvPort port,
- LilvValue event_uri);
+lilv_port_supports_event(const LilvPlugin* p,
+ const LilvPort* port,
+ const LilvValue* event_uri);
/**
Get the symbol of a port.
@@ -978,9 +966,9 @@ lilv_port_supports_event(LilvPlugin p,
Returned value is owned by @a port and must not be freed.
*/
LILV_API
-LilvValue
-lilv_port_get_symbol(LilvPlugin plugin,
- LilvPort port);
+const LilvValue*
+lilv_port_get_symbol(const LilvPlugin* plugin,
+ const LilvPort* port);
/**
Get the name of a port.
@@ -989,9 +977,9 @@ lilv_port_get_symbol(LilvPlugin plugin,
the caller.
*/
LILV_API
-LilvValue
-lilv_port_get_name(LilvPlugin plugin,
- LilvPort port);
+LilvValue*
+lilv_port_get_name(const LilvPlugin* plugin,
+ const LilvPort* port);
/**
Get all the classes of a port.
@@ -1001,9 +989,9 @@ lilv_port_get_name(LilvPlugin plugin,
Returned value is shared and must not be destroyed by caller.
*/
LILV_API
-LilvValues
-lilv_port_get_classes(LilvPlugin plugin,
- LilvPort port);
+const LilvValues*
+lilv_port_get_classes(const LilvPlugin* plugin,
+ const LilvPort* port);
/**
Determine if a port is of a given class (input, output, audio, etc).
@@ -1015,9 +1003,9 @@ lilv_port_get_classes(LilvPlugin plugin,
*/
LILV_API
bool
-lilv_port_is_a(LilvPlugin plugin,
- LilvPort port,
- LilvValue port_class);
+lilv_port_is_a(const LilvPlugin* plugin,
+ const LilvPort* port,
+ const LilvValue* port_class);
/**
Get the default, minimum, and maximum values of a port.
@@ -1028,11 +1016,11 @@ lilv_port_is_a(LilvPlugin plugin,
*/
LILV_API
void
-lilv_port_get_range(LilvPlugin plugin,
- LilvPort port,
- LilvValue* deflt,
- LilvValue* min,
- LilvValue* max);
+lilv_port_get_range(const LilvPlugin* plugin,
+ const LilvPort* port,
+ LilvValue** deflt,
+ LilvValue** min,
+ LilvValue** max);
/**
Get the scale points (enumeration values) of a port.
@@ -1042,9 +1030,9 @@ lilv_port_get_range(LilvPlugin plugin,
must be freed by caller with lilv_scale_points_free.
*/
LILV_API
-LilvScalePoints
-lilv_port_get_scale_points(LilvPlugin plugin,
- LilvPort port);
+LilvScalePoints*
+lilv_port_get_scale_points(const LilvPlugin* plugin,
+ const LilvPort* port);
/**
@}
@@ -1057,16 +1045,16 @@ lilv_port_get_scale_points(LilvPlugin plugin,
Returned value is owned by @a point and must not be freed.
*/
LILV_API
-LilvValue
-lilv_scale_point_get_label(LilvScalePoint point);
+const LilvValue*
+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
-LilvValue
-lilv_scale_point_get_value(LilvScalePoint point);
+const LilvValue*
+lilv_scale_point_get_value(const LilvScalePoint* point);
/**
@}
@@ -1080,31 +1068,32 @@ lilv_scale_point_get_value(LilvScalePoint point);
Returned value may be NULL, if class has no parent.
*/
LILV_API
-LilvValue
-lilv_plugin_class_get_parent_uri(LilvPluginClass plugin_class);
+const LilvValue*
+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
-LilvValue
-lilv_plugin_class_get_uri(LilvPluginClass plugin_class);
+const LilvValue*
+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
-LilvValue lilv_plugin_class_get_label(LilvPluginClass plugin_class);
+const LilvValue*
+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_plugin_class_get_children(LilvPluginClass plugin_class);
+LilvPluginClasses*
+lilv_plugin_class_get_children(const LilvPluginClass* plugin_class);
/**
@}
@@ -1112,8 +1101,6 @@ lilv_plugin_class_get_children(LilvPluginClass plugin_class);
@{
*/
-typedef struct _LilvInstanceImpl* LilvInstanceImpl;
-
/**
@cond 0
*/
@@ -1125,11 +1112,11 @@ typedef struct _LilvInstanceImpl* LilvInstanceImpl;
in any way (which is why it is not machine documented).
Truly private implementation details are hidden via @a ref pimpl.
*/
-typedef struct _Instance {
+struct LilvInstanceImpl {
const LV2_Descriptor* lv2_descriptor;
LV2_Handle lv2_handle;
- LilvInstanceImpl pimpl;
-}* LilvInstance;
+ void* pimpl;
+};
/**
@endcond
@@ -1145,8 +1132,8 @@ typedef struct _Instance {
@return NULL if instantiation failed.
*/
LILV_API
-LilvInstance
-lilv_plugin_instantiate(LilvPlugin plugin,
+LilvInstance*
+lilv_plugin_instantiate(const LilvPlugin* plugin,
double sample_rate,
const LV2_Feature*const* features);
@@ -1156,7 +1143,7 @@ lilv_plugin_instantiate(LilvPlugin plugin,
*/
LILV_API
void
-lilv_instance_free(LilvInstance instance);
+lilv_instance_free(LilvInstance* instance);
#ifndef LILV_INTERNAL
@@ -1165,7 +1152,7 @@ lilv_instance_free(LilvInstance instance);
Returned string is shared and must not be modified or deleted.
*/
static inline const char*
-lilv_instance_get_uri(LilvInstance instance)
+lilv_instance_get_uri(const LilvInstance* instance)
{
return instance->lv2_descriptor->URI;
}
@@ -1176,9 +1163,9 @@ lilv_instance_get_uri(LilvInstance instance)
activation and deactivation does not destroy port connections.
*/
static inline void
-lilv_instance_connect_port(LilvInstance instance,
- uint32_t port_index,
- void* data_location)
+lilv_instance_connect_port(LilvInstance* instance,
+ uint32_t port_index,
+ void* data_location)
{
instance->lv2_descriptor->connect_port
(instance->lv2_handle, port_index, data_location);
@@ -1191,7 +1178,7 @@ lilv_instance_connect_port(LilvInstance instance,
before calling lilv_instance_run.
*/
static inline void
-lilv_instance_activate(LilvInstance instance)
+lilv_instance_activate(LilvInstance* instance)
{
if (instance->lv2_descriptor->activate)
instance->lv2_descriptor->activate(instance->lv2_handle);
@@ -1203,7 +1190,7 @@ lilv_instance_activate(LilvInstance instance)
guaranteed not to block.
*/
static inline void
-lilv_instance_run(LilvInstance instance,
+lilv_instance_run(LilvInstance* instance,
uint32_t sample_count)
{
instance->lv2_descriptor->run(instance->lv2_handle, sample_count);
@@ -1215,7 +1202,7 @@ lilv_instance_run(LilvInstance instance,
reset all state information (except port connections).
*/
static inline void
-lilv_instance_deactivate(LilvInstance instance)
+lilv_instance_deactivate(LilvInstance* instance)
{
if (instance->lv2_descriptor->deactivate)
instance->lv2_descriptor->deactivate(instance->lv2_handle);
@@ -1227,8 +1214,8 @@ lilv_instance_deactivate(LilvInstance instance)
extension, though in all cases it is shared and must not be deleted.
*/
static inline const void*
-lilv_instance_get_extension_data(LilvInstance instance,
- const char* uri)
+lilv_instance_get_extension_data(const LilvInstance* instance,
+ const char* uri)
{
if (instance->lv2_descriptor->extension_data)
return instance->lv2_descriptor->extension_data(uri);
@@ -1244,7 +1231,7 @@ lilv_instance_get_extension_data(LilvInstance instance,
The returned descriptor is shared and must not be deleted.
*/
static inline const LV2_Descriptor*
-lilv_instance_get_descriptor(LilvInstance instance)
+lilv_instance_get_descriptor(const LilvInstance* instance)
{
return instance->lv2_descriptor;
}
@@ -1257,7 +1244,7 @@ lilv_instance_get_descriptor(LilvInstance instance)
The returned handle is shared and must not be deleted.
*/
static inline LV2_Handle
-lilv_instance_get_handle(LilvInstance instance)
+lilv_instance_get_handle(const LilvInstance* instance)
{
return instance->lv2_handle;
}
@@ -1275,8 +1262,8 @@ lilv_instance_get_handle(LilvInstance instance)
Returned value must be freed by caller using lilv_uis_free.
*/
LILV_API
-LilvUIs
-lilv_plugin_get_uis(LilvPlugin plugin);
+LilvUIs*
+lilv_plugin_get_uis(const LilvPlugin* plugin);
/**
Get the URI of a Plugin UI.
@@ -1284,8 +1271,8 @@ lilv_plugin_get_uis(LilvPlugin plugin);
@return a shared value which must not be modified or freed.
*/
LILV_API
-LilvValue
-lilv_ui_get_uri(LilvUI ui);
+const LilvValue*
+lilv_ui_get_uri(const LilvUI* ui);
/**
Get the types (URIs of RDF classes) of a Plugin UI.
@@ -1296,8 +1283,8 @@ lilv_ui_get_uri(LilvUI ui);
UI type, avoding the need to use this function (and type specific logic).
*/
LILV_API
-LilvValues
-lilv_ui_get_classes(LilvUI ui);
+const LilvValues*
+lilv_ui_get_classes(const LilvUI* ui);
/**
Check whether a plugin UI has a given type.
@@ -1306,7 +1293,7 @@ lilv_ui_get_classes(LilvUI ui);
*/
LILV_API
bool
-lilv_ui_is_a(LilvUI ui, LilvValue class_uri);
+lilv_ui_is_a(const LilvUI* ui, const LilvValue* class_uri);
/**
Function to determine whether a UI type is supported.
@@ -1328,10 +1315,10 @@ typedef unsigned (*LilvUISupportedFunc)(const char* container_type_uri,
*/
LILV_API
unsigned
-lilv_ui_is_supported(LilvUI ui,
+lilv_ui_is_supported(const LilvUI* ui,
LilvUISupportedFunc supported_func,
- LilvValue container_type,
- LilvValue* ui_type);
+ const LilvValue* container_type,
+ const LilvValue** ui_type);
/**
Get the URI for a Plugin UI's bundle.
@@ -1339,8 +1326,8 @@ lilv_ui_is_supported(LilvUI ui,
@return a shared value which must not be modified or freed.
*/
LILV_API
-LilvValue
-lilv_ui_get_bundle_uri(LilvUI ui);
+const LilvValue*
+lilv_ui_get_bundle_uri(const LilvUI* ui);
/**
Get the URI for a Plugin UI's shared library.
@@ -1348,8 +1335,8 @@ lilv_ui_get_bundle_uri(LilvUI ui);
@return a shared value which must not be modified or freed.
*/
LILV_API
-LilvValue
-lilv_ui_get_binary_uri(LilvUI ui);
+const LilvValue*
+lilv_ui_get_binary_uri(const LilvUI* ui);
/**
@}
diff --git a/lilv/lilvmm.hpp b/lilv/lilvmm.hpp
index 7f25d33..66a0276 100644
--- a/lilv/lilvmm.hpp
+++ b/lilv/lilvmm.hpp
@@ -43,16 +43,16 @@ const char* uri_to_path(const char* uri) { return lilv_uri_to_path(uri); }
#ifndef SWIG
#define LILV_WRAP_CONVERSION(CT) \
- inline operator CT() const { return me; }
+ inline operator CT*() const { return me; }
#else
#define LILV_WRAP_CONVERSION(CT)
#endif
struct Value {
- inline Value(LilvValue value) : me(value) {}
- inline Value(const Value& copy) : me(lilv_value_duplicate(copy.me)) {}
+ inline Value(const LilvValue* value) : me(lilv_value_duplicate(value)) {}
+ inline Value(const Value& copy) : me(lilv_value_duplicate(copy.me)) {}
- inline ~Value() { /*lilv_value_free(me);*/ }
+ inline ~Value() { lilv_value_free(me); }
inline bool equals(const Value& other) const {
return lilv_value_equals(me, other.me);
@@ -77,41 +77,41 @@ struct Value {
LILV_WRAP0(bool, value, is_bool);
LILV_WRAP0(bool, value, as_bool);
- LilvValue me;
+ LilvValue* me;
};
struct ScalePoint {
- inline ScalePoint(LilvScalePoint c_obj) : me(c_obj) {}
- LILV_WRAP_CONVERSION(LilvScalePoint);
+ inline ScalePoint(const LilvScalePoint* c_obj) : me(c_obj) {}
+ LILV_WRAP_CONVERSION(const LilvScalePoint);
- LILV_WRAP0(LilvValue, scale_point, get_label);
- LILV_WRAP0(LilvValue, scale_point, get_value);
+ LILV_WRAP0(const LilvValue*, scale_point, get_label);
+ LILV_WRAP0(const LilvValue*, scale_point, get_value);
- LilvScalePoint me;
+ const LilvScalePoint* me;
};
struct PluginClass {
- inline PluginClass(LilvPluginClass c_obj) : me(c_obj) {}
- LILV_WRAP_CONVERSION(LilvPluginClass);
+ 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);
- inline LilvPluginClasses get_children() {
+ inline LilvPluginClasses* get_children() {
return lilv_plugin_class_get_children(me);
}
- LilvPluginClass me;
+ const LilvPluginClass* me;
};
#define LILV_WRAP_COLL(CT, ET, prefix) \
struct CT { \
- inline CT(Lilv ## CT c_obj) : me(c_obj) {} \
- LILV_WRAP_CONVERSION(Lilv ## CT); \
+ inline CT(const Lilv ## CT* c_obj) : me(c_obj) {} \
+ LILV_WRAP_CONVERSION(const Lilv ## CT); \
LILV_WRAP0(unsigned, prefix, size); \
- LILV_WRAP1(ET, prefix, get, LilvIter, i); \
- Lilv ## CT me; \
+ LILV_WRAP1(const ET, prefix, get, LilvIter*, i); \
+ const Lilv ## CT* me; \
}; \
LILV_WRAP_COLL(PluginClasses, PluginClass, plugin_classes);
@@ -119,47 +119,47 @@ LILV_WRAP_COLL(ScalePoints, ScalePoint, scale_points);
LILV_WRAP_COLL(Values, Value, values);
struct Plugins {
- inline Plugins(LilvPlugins c_obj) : me(c_obj) {}
- LILV_WRAP_CONVERSION(LilvPlugins);
+ inline Plugins(const LilvPlugins* c_obj) : me(c_obj) {}
+ LILV_WRAP_CONVERSION(const LilvPlugins);
- LilvPlugins me;
+ const LilvPlugins* me;
};
struct World {
inline World() : me(lilv_world_new()) {}
inline ~World() { /*lilv_world_free(me);*/ }
- inline LilvValue new_uri(const char* uri) {
+ inline LilvValue* new_uri(const char* uri) {
return lilv_value_new_uri(me, uri);
}
- inline LilvValue new_string(const char* str) {
+ inline LilvValue* new_string(const char* str) {
return lilv_value_new_string(me, str);
}
- inline LilvValue new_int(int val) {
+ inline LilvValue* new_int(int val) {
return lilv_value_new_int(me, val);
}
- inline LilvValue new_float(float val) {
+ inline LilvValue* new_float(float val) {
return lilv_value_new_float(me, val);
}
- inline LilvValue new_bool(bool val) {
+ inline LilvValue* new_bool(bool val) {
return lilv_value_new_bool(me, val);
}
- LILV_WRAP2_VOID(world, set_option, const char*, uri, LilvValue, value);
+ LILV_WRAP2_VOID(world, set_option, const char*, uri, LilvValue*, value);
LILV_WRAP0_VOID(world, free);
LILV_WRAP0_VOID(world, load_all);
- LILV_WRAP1_VOID(world, load_bundle, LilvValue, bundle_uri);
- LILV_WRAP0(LilvPluginClass, world, get_plugin_class);
- LILV_WRAP0(LilvPluginClasses, world, get_plugin_classes);
+ LILV_WRAP1_VOID(world, load_bundle, LilvValue*, 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);
//LILV_WRAP1(Plugin, world, get_plugin_by_uri_string, const char*, uri);
- LilvWorld me;
+ LilvWorld* me;
};
struct Port {
- inline Port(LilvPlugin p, LilvPort c_obj) : parent(p), me(c_obj) {}
- LILV_WRAP_CONVERSION(LilvPort);
+ inline Port(const LilvPlugin* p, const LilvPort* c_obj) : parent(p), me(c_obj) {}
+ LILV_WRAP_CONVERSION(const LilvPort);
#define LILV_PORT_WRAP0(RT, name) \
inline RT name () { return lilv_port_ ## name (parent, me); }
@@ -167,26 +167,26 @@ 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_WRAP1(LilvValues, get_value_by_qname, const char*, 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(LilvValue, get_symbol);
- LILV_PORT_WRAP0(LilvValue, get_name);
- LILV_PORT_WRAP0(LilvValues, get_classes);
- LILV_PORT_WRAP1(bool, is_a, LilvValue, port_class);
- LILV_PORT_WRAP0(LilvScalePoints, get_scale_points);
+ LILV_PORT_WRAP1(LilvValues*, get_value, LilvValue*, predicate);
+ LILV_PORT_WRAP1(LilvValues*, get_value_by_qname, const char*, 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_WRAP0(LilvScalePoints*, get_scale_points);
// TODO: get_range (output parameters)
- LilvPlugin parent;
- LilvPort me;
+ const LilvPlugin* parent;
+ const LilvPort* me;
};
struct Plugin {
- inline Plugin(LilvPlugin c_obj) : me(c_obj) {}
- LILV_WRAP_CONVERSION(LilvPlugin);
+ inline Plugin(const LilvPlugin* c_obj) : me(c_obj) {}
+ LILV_WRAP_CONVERSION(const LilvPlugin);
LILV_WRAP0(bool, plugin, verify);
LILV_WRAP0(Value, plugin, get_uri);
@@ -214,7 +214,7 @@ struct Plugin {
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(LilvValue* symbol) {
return Port(me, lilv_plugin_get_port_by_symbol(me, symbol));
}
@@ -225,13 +225,13 @@ 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(LilvValue* class_1,
+ LilvValue* class_2) {
// TODO: varargs
return lilv_plugin_get_num_ports_of_class(me, class_1, class_2, NULL);
}
- LilvPlugin me;
+ const LilvPlugin* me;
};
struct Instance {
@@ -256,7 +256,7 @@ struct Instance {
return lilv_instance_get_descriptor(me);
}
- LilvInstance me;
+ LilvInstance* me;
};
} /* namespace Lilv */
diff --git a/src/collections.c b/src/collections.c
index 9111835..58207f9 100644
--- a/src/collections.c
+++ b/src/collections.c
@@ -20,59 +20,59 @@
/* Generic collection functions */
-static inline LilvCollection
+static inline LilvCollection*
lilv_collection_new(GDestroyNotify destructor)
{
return g_sequence_new(destructor);
}
void
-lilv_collection_free(LilvCollection coll)
+lilv_collection_free(LilvCollection* coll)
{
if (coll)
g_sequence_free((GSequence*)coll);
}
unsigned
-lilv_collection_size(LilvCollection coll)
+lilv_collection_size(const LilvCollection* coll)
{
return (coll ? g_sequence_get_length((GSequence*)coll) : 0);
}
-LilvIter
-lilv_collection_begin(LilvCollection collection)
+LilvIter*
+lilv_collection_begin(const LilvCollection* collection)
{
- return collection ? g_sequence_get_begin_iter(collection) : NULL;
+ return collection ? g_sequence_get_begin_iter((LilvCollection*)collection) : NULL;
}
void*
-lilv_collection_get(LilvCollection collection,
- LilvIter i)
+lilv_collection_get(const LilvCollection* collection,
+ const LilvIter* i)
{
return g_sequence_get((GSequenceIter*)i);
}
/* Constructors */
-LilvScalePoints
+LilvScalePoints*
lilv_scale_points_new(void)
{
return lilv_collection_new((GDestroyNotify)lilv_scale_point_free);
}
-LilvValues
+LilvValues*
lilv_values_new(void)
{
return lilv_collection_new((GDestroyNotify)lilv_value_free);
}
-LilvUIs
+LilvUIs*
lilv_uis_new(void)
{
return lilv_collection_new((GDestroyNotify)lilv_ui_free);
}
-LilvPluginClasses
+LilvPluginClasses*
lilv_plugin_classes_new(void)
{
return lilv_collection_new((GDestroyNotify)lilv_plugin_class_free);
@@ -81,39 +81,39 @@ lilv_plugin_classes_new(void)
/* URI based accessors (for collections of things with URIs) */
LILV_API
-LilvPluginClass
-lilv_plugin_classes_get_by_uri(LilvPluginClasses coll, LilvValue uri)
+const LilvPluginClass*
+lilv_plugin_classes_get_by_uri(const LilvPluginClasses* coll, const LilvValue* uri)
{
- return (LilvPluginClass)lilv_sequence_get_by_uri(coll, uri);
+ return (LilvPluginClass*)lilv_sequence_get_by_uri(coll, uri);
}
LILV_API
-LilvUI
-lilv_uis_get_by_uri(LilvUIs coll, LilvValue uri)
+const LilvUI*
+lilv_uis_get_by_uri(const LilvUIs* coll, const LilvValue* uri)
{
- return (LilvUIs)lilv_sequence_get_by_uri(coll, uri);
+ return (LilvUI*)lilv_sequence_get_by_uri((LilvUIs*)coll, uri);
}
/* Plugins */
-LilvPlugins
+LilvPlugins*
lilv_plugins_new()
{
return g_sequence_new(NULL);
}
LILV_API
-LilvPlugin
-lilv_plugins_get_by_uri(LilvPlugins list, LilvValue uri)
+const LilvPlugin*
+lilv_plugins_get_by_uri(const LilvPlugins* list, const LilvValue* uri)
{
- return (LilvPlugin)lilv_sequence_get_by_uri(list, uri);
+ return (LilvPlugin*)lilv_sequence_get_by_uri((LilvPlugins*)list, uri);
}
/* Values */
LILV_API
bool
-lilv_values_contains(LilvValues list, LilvValue value)
+lilv_values_contains(const LilvValues* list, const LilvValue* value)
{
LILV_FOREACH(values, i, list)
if (lilv_value_equals(lilv_values_get(list, i), value))
@@ -124,14 +124,14 @@ lilv_values_contains(LilvValues list, LilvValue value)
/* Iterator */
-LilvIter
-lilv_iter_next(LilvIter i)
+LilvIter*
+lilv_iter_next(LilvIter* i)
{
return g_sequence_iter_next((GSequenceIter*)i);
}
bool
-lilv_iter_end(LilvIter i)
+lilv_iter_end(LilvIter* i)
{
return !i || g_sequence_iter_is_end((GSequenceIter*)i);
}
@@ -139,31 +139,31 @@ lilv_iter_end(LilvIter i)
#define LILV_COLLECTION_IMPL(prefix, CT, ET) \
LILV_API \
unsigned \
-prefix##_size(CT collection) { \
+prefix##_size(const CT* collection) { \
return lilv_collection_size(collection); \
} \
\
LILV_API \
-LilvIter \
-prefix##_begin(CT collection) { \
+LilvIter* \
+prefix##_begin(const CT* collection) { \
return lilv_collection_begin(collection); \
} \
\
LILV_API \
-ET \
-prefix##_get(CT collection, LilvIter i) { \
- return (ET)lilv_collection_get(collection, i); \
+const ET* \
+prefix##_get(const CT* collection, LilvIter* i) { \
+ return (ET*)lilv_collection_get(collection, i); \
} \
\
LILV_API \
-LilvIter \
-prefix##_next(CT collection, LilvIter i) { \
+LilvIter* \
+prefix##_next(const CT* collection, LilvIter* i) { \
return lilv_iter_next(i); \
} \
\
LILV_API \
bool \
-prefix##_is_end(CT collection, LilvIter i) { \
+prefix##_is_end(const CT* collection, LilvIter* i) { \
return lilv_iter_end(i); \
}
@@ -175,36 +175,31 @@ LILV_COLLECTION_IMPL(lilv_plugins, LilvPlugins, LilvPlugin)
LILV_API
void
-lilv_plugin_classes_free(LilvPluginClasses collection) {
+lilv_plugin_classes_free(LilvPluginClasses* collection) {
lilv_collection_free(collection);
}
LILV_API
void
-lilv_scale_points_free(LilvScalePoints collection) {
+lilv_scale_points_free(LilvScalePoints* collection) {
lilv_collection_free(collection);
}
LILV_API
void
-lilv_uis_free(LilvUIs collection) {
+lilv_uis_free(LilvUIs* collection) {
lilv_collection_free(collection);
}
LILV_API
void
-lilv_values_free(LilvValues collection) {
+lilv_values_free(LilvValues* collection) {
lilv_collection_free(collection);
}
LILV_API
-void
-lilv_plugins_free(LilvWorld world, LilvPlugins plugins){
-}
-
-LILV_API
-LilvValue
-lilv_values_get_first(LilvValues collection) {
- return (LilvValue)lilv_collection_get(collection,
- lilv_collection_begin(collection));
+LilvValue*
+lilv_values_get_first(const LilvValues* collection) {
+ return (LilvValue*)lilv_collection_get(collection,
+ lilv_collection_begin(collection));
}
diff --git a/src/lilv_internal.h b/src/lilv_internal.h
index f856508..841dbba 100644
--- a/src/lilv_internal.h
+++ b/src/lilv_internal.h
@@ -85,34 +85,34 @@ lilv_match_end(LilvMatches iter)
/* ********* PORT ********* */
/** Reference to a port on some plugin. */
-struct _LilvPort {
- uint32_t index; ///< lv2:index
- LilvValue symbol; ///< lv2:symbol
- LilvValues classes; ///< rdf:type
+struct LilvPortImpl {
+ uint32_t index; ///< lv2:index
+ LilvValue* symbol; ///< lv2:symbol
+ LilvValues* classes; ///< rdf:type
};
-LilvPort lilv_port_new(LilvWorld world, uint32_t index, const char* symbol);
-void lilv_port_free(LilvPort port);
+LilvPort* lilv_port_new(LilvWorld* world, uint32_t index, const char* symbol);
+void lilv_port_free(LilvPort* port);
/* ********* Spec ********* */
-struct _LilvSpec {
- SordNode* spec;
- SordNode* bundle;
- LilvValues data_uris;
+struct LilvSpecImpl {
+ SordNode* spec;
+ SordNode* bundle;
+ LilvValues* data_uris;
};
-typedef struct _LilvSpec* LilvSpec;
+typedef struct LilvSpecImpl LilvSpec;
/* ********* Plugin ********* */
/** Header of an LilvPlugin, LilvPluginClass, or LilvUI.
- * Any of these structs may be safely casted to _LilvHeader, which is used to
+ * Any of these structs may be safely casted to LilvHeader, which is used to
* implement sequences without code duplication (see lilv_sequence_get_by_uri).
*/
-struct _LilvHeader {
- struct _LilvWorld* world;
- LilvValue uri;
+struct LilvHeader {
+ LilvWorld* world;
+ LilvValue* uri;
};
/** Record of an installed/available plugin.
@@ -120,102 +120,92 @@ struct _LilvHeader {
* A simple reference to a plugin somewhere on the system. This just holds
* paths of relevant files, the actual data therein isn't loaded into memory.
*/
-struct _LilvPlugin {
- struct _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
- LilvPluginClass plugin_class;
- LilvValues data_uris; ///< rdfs::seeAlso
- LilvPort* ports;
- uint32_t num_ports;
- bool loaded;
- bool replaced;
+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
+ const LilvPluginClass* plugin_class;
+ LilvValues* 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);
-void lilv_plugin_load_if_necessary(LilvPlugin p);
-void lilv_plugin_free(LilvPlugin plugin);
+LilvPlugin* lilv_plugin_new(LilvWorld* world, LilvValue* uri, LilvValue* bundle_uri);
+void lilv_plugin_load_if_necessary(const LilvPlugin* p);
+void lilv_plugin_free(LilvPlugin* plugin);
-LilvValue
-lilv_plugin_get_unique(LilvPlugin p,
- LilvNode subject,
- LilvNode predicate);
+LilvValue*
+lilv_plugin_get_unique(const LilvPlugin* p,
+ LilvNode subject,
+ LilvNode predicate);
/* ********* Plugins ********* */
-typedef void* LilvCollection;
+typedef void LilvCollection;
-LilvPlugins
+LilvPlugins*
lilv_plugins_new();
/**
Increment @a i to point at the next element in the collection.
*/
-LilvIter
-lilv_iter_next(LilvIter i);
+LilvIter*
+lilv_iter_next(LilvIter* i);
/**
Return true iff @a i is at the end of the collection.
*/
bool
-lilv_iter_end(LilvIter i);
+lilv_iter_end(LilvIter* i);
-LilvIter
-lilv_collection_begin(LilvCollection collection);
+LilvIter*
+lilv_collection_begin(const LilvCollection* collection);
void*
-lilv_collection_get(LilvCollection collection,
- LilvIter i);
+lilv_collection_get(const LilvCollection* collection,
+ const LilvIter* i);
/**
Free @a collection.
*/
void
-lilv_collection_free(LilvCollection collection);
+lilv_collection_free(LilvCollection* collection);
/**
Get the number of elements in @a collection.
*/
unsigned
-lilv_collection_size(LilvCollection collection);
+lilv_collection_size(const LilvCollection* collection);
-LilvValues
+LilvValues*
lilv_values_new(void);
-LilvScalePoints
+LilvScalePoints*
lilv_scale_points_new(void);
-
-/* ********* Instance ********* */
-
-/** Pimpl portion of LilvInstance */
-struct _LilvInstanceImpl {
- void* lib_handle;
-};
-
-/* ********* Plugin Class ********* */
-
-struct _LilvPluginClass {
- struct _LilvWorld* world;
- LilvValue uri;
- LilvValue parent_uri;
- LilvValue label;
+struct LilvPluginClassImpl {
+ LilvWorld* world;
+ LilvValue* uri;
+ LilvValue* parent_uri;
+ LilvValue* label;
};
-LilvPluginClass lilv_plugin_class_new(LilvWorld world,
- LilvNode parent_uri,
- LilvNode uri,
- const char* label);
+LilvPluginClass* lilv_plugin_class_new(LilvWorld* world,
+ LilvNode parent_uri,
+ LilvNode uri,
+ const char* label);
-void lilv_plugin_class_free(LilvPluginClass plugin_class);
+void lilv_plugin_class_free(LilvPluginClass* plugin_class);
/* ********* Plugin Classes ********* */
-LilvPluginClasses lilv_plugin_classes_new();
-void lilv_plugin_classes_free();
+LilvPluginClasses* lilv_plugin_classes_new();
+void lilv_plugin_classes_free();
/* ********* World ********* */
@@ -226,69 +216,69 @@ typedef struct {
/** Model of LV2 (RDF) data loaded from bundles.
*/
-struct _LilvWorld {
- SordWorld* world;
- SordModel* model;
- SerdReader* reader;
- SerdEnv* namespaces;
- unsigned n_read_files;
- LilvPluginClass lv2_plugin_class;
- LilvPluginClasses plugin_classes;
- GSList* specs;
- LilvPlugins plugins;
- SordNode* dc_replaces_node;
- SordNode* dyn_manifest_node;
- SordNode* lv2_specification_node;
- SordNode* lv2_plugin_node;
- SordNode* lv2_binary_node;
- SordNode* lv2_default_node;
- SordNode* lv2_minimum_node;
- SordNode* lv2_maximum_node;
- SordNode* lv2_port_node;
- SordNode* lv2_portproperty_node;
- SordNode* lv2_reportslatency_node;
- SordNode* lv2_index_node;
- SordNode* lv2_symbol_node;
- SordNode* rdf_a_node;
- SordNode* rdf_value_node;
- SordNode* rdfs_class_node;
- SordNode* rdfs_label_node;
- SordNode* rdfs_seealso_node;
- SordNode* rdfs_subclassof_node;
- SordNode* lilv_dmanifest_node;
- SordNode* xsd_boolean_node;
- SordNode* xsd_decimal_node;
- SordNode* xsd_double_node;
- SordNode* xsd_integer_node;
- LilvValue doap_name_val;
- LilvValue lv2_name_val;
- LilvOptions opt;
+struct LilvWorldImpl {
+ SordWorld* world;
+ SordModel* model;
+ SerdReader* reader;
+ SerdEnv* namespaces;
+ unsigned n_read_files;
+ LilvPluginClass* lv2_plugin_class;
+ LilvPluginClasses* plugin_classes;
+ GSList* specs;
+ LilvPlugins* plugins;
+ SordNode* dc_replaces_node;
+ SordNode* dyn_manifest_node;
+ SordNode* lv2_specification_node;
+ SordNode* lv2_plugin_node;
+ SordNode* lv2_binary_node;
+ SordNode* lv2_default_node;
+ SordNode* lv2_minimum_node;
+ SordNode* lv2_maximum_node;
+ SordNode* lv2_port_node;
+ SordNode* lv2_portproperty_node;
+ SordNode* lv2_reportslatency_node;
+ SordNode* lv2_index_node;
+ SordNode* lv2_symbol_node;
+ SordNode* rdf_a_node;
+ SordNode* rdf_value_node;
+ SordNode* rdfs_class_node;
+ SordNode* rdfs_label_node;
+ SordNode* rdfs_seealso_node;
+ SordNode* rdfs_subclassof_node;
+ SordNode* lilv_dmanifest_node;
+ SordNode* xsd_boolean_node;
+ SordNode* xsd_decimal_node;
+ SordNode* xsd_double_node;
+ SordNode* xsd_integer_node;
+ LilvValue* doap_name_val;
+ LilvValue* lv2_name_val;
+ LilvOptions opt;
};
const uint8_t*
-lilv_world_blank_node_prefix(LilvWorld world);
+lilv_world_blank_node_prefix(LilvWorld* world);
void
-lilv_world_load_file(LilvWorld world, const char* file_uri);
+lilv_world_load_file(LilvWorld* world, const char* file_uri);
/* ********* Plugin UI ********* */
-struct _LilvUI {
- struct _LilvWorld* world;
- LilvValue uri;
- LilvValue bundle_uri;
- LilvValue binary_uri;
- LilvValues classes;
+struct LilvUIImpl {
+ LilvWorld* world;
+ LilvValue* uri;
+ LilvValue* bundle_uri;
+ LilvValue* binary_uri;
+ LilvValues* classes;
};
-LilvUIs lilv_uis_new();
+LilvUIs* lilv_uis_new();
-LilvUI
-lilv_ui_new(LilvWorld world,
- LilvValue uri,
- LilvValue type_uri,
- LilvValue binary_uri);
+LilvUI*
+lilv_ui_new(LilvWorld* world,
+ LilvValue* uri,
+ LilvValue* type_uri,
+ LilvValue* binary_uri);
-void lilv_ui_free(LilvUI ui);
+void lilv_ui_free(LilvUI* ui);
/* ********* Value ********* */
@@ -302,8 +292,8 @@ typedef enum _LilvValueType {
LILV_VALUE_BLANK
} LilvValueType;
-struct _LilvValue {
- LilvWorld world;
+struct LilvValueImpl {
+ LilvWorld* world;
char* str_val; ///< always present
union {
int int_val;
@@ -314,9 +304,9 @@ struct _LilvValue {
LilvValueType type;
};
-LilvValue lilv_value_new(LilvWorld world, LilvValueType type, const char* val);
-LilvValue lilv_value_new_from_node(LilvWorld world, LilvNode node);
-LilvNode lilv_value_as_node(LilvValue value);
+LilvValue* lilv_value_new(LilvWorld* world, LilvValueType type, const char* val);
+LilvValue* lilv_value_new_from_node(LilvWorld* world, LilvNode node);
+LilvNode lilv_value_as_node(const LilvValue* value);
int
lilv_header_compare_by_uri(const void* a, const void* b, void* user_data);
@@ -332,33 +322,33 @@ lilv_array_append(GSequence* seq, void* value) {
g_sequence_append(seq, value);
}
-struct _LilvHeader*
-lilv_sequence_get_by_uri(GSequence* seq, LilvValue uri);
+struct LilvHeader*
+lilv_sequence_get_by_uri(const GSequence* seq, const LilvValue* uri);
static inline SordNode* lilv_node_copy(LilvNode node) {
return sord_node_copy(node);
}
-static inline void lilv_node_free(LilvWorld world, SordNode* node) {
+static inline void lilv_node_free(LilvWorld* world, SordNode* node) {
sord_node_free(world->world, node);
}
/* ********* Scale Points ********* */
-struct _LilvScalePoint {
- LilvValue value;
- LilvValue label;
+struct LilvScalePointImpl {
+ LilvValue* value;
+ LilvValue* label;
};
-LilvScalePoint lilv_scale_point_new(LilvValue value, LilvValue label);
-void lilv_scale_point_free(LilvScalePoint point);
+LilvScalePoint* lilv_scale_point_new(LilvValue* value, LilvValue* label);
+void lilv_scale_point_free(LilvScalePoint* point);
/* ********* Query Results ********* */
-LilvMatches lilv_plugin_find_statements(LilvPlugin plugin,
- LilvNode subject,
- LilvNode predicate,
- LilvNode object);
+LilvMatches lilv_plugin_find_statements(const LilvPlugin* plugin,
+ LilvNode subject,
+ LilvNode predicate,
+ LilvNode object);
static inline bool lilv_matches_next(LilvMatches matches) {
return sord_iter_next(matches);
@@ -368,15 +358,15 @@ static inline bool lilv_matches_end(LilvMatches matches) {
return sord_iter_end(matches);
}
-LilvValues lilv_values_from_stream_objects(LilvPlugin p,
- LilvMatches stream);
+LilvValues* lilv_values_from_stream_objects(const LilvPlugin* p,
+ LilvMatches stream);
/* ********* Utilities ********* */
char* lilv_strjoin(const char* first, ...);
char* lilv_strdup(const char* str);
char* lilv_get_lang();
-uint8_t* lilv_qname_expand(LilvPlugin p, const char* qname);
+uint8_t* lilv_qname_expand(const LilvPlugin* p, const char* qname);
typedef void (*VoidFunc)();
diff --git a/src/plugin.c b/src/plugin.c
index 6ba6676..b03205c 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -29,11 +29,11 @@
#define NS_FOAF (const uint8_t*)"http://xmlns.com/foaf/0.1/"
/** Ownership of @a uri is taken */
-LilvPlugin
-lilv_plugin_new(LilvWorld world, LilvValue uri, LilvValue bundle_uri)
+LilvPlugin*
+lilv_plugin_new(LilvWorld* world, LilvValue* uri, LilvValue* bundle_uri)
{
assert(bundle_uri);
- struct _LilvPlugin* plugin = malloc(sizeof(struct _LilvPlugin));
+ LilvPlugin* plugin = malloc(sizeof(struct LilvPluginImpl));
plugin->world = world;
plugin->plugin_uri = uri;
plugin->bundle_uri = bundle_uri;
@@ -52,7 +52,7 @@ lilv_plugin_new(LilvWorld world, LilvValue uri, LilvValue bundle_uri)
}
void
-lilv_plugin_free(LilvPlugin p)
+lilv_plugin_free(LilvPlugin* p)
{
lilv_value_free(p->plugin_uri);
p->plugin_uri = NULL;
@@ -81,8 +81,8 @@ lilv_plugin_free(LilvPlugin p)
free(p);
}
-static LilvValues
-lilv_plugin_query_node(LilvPlugin p, LilvNode subject, LilvNode predicate)
+static LilvValues*
+lilv_plugin_query_node(const LilvPlugin* p, LilvNode subject, LilvNode predicate)
{
lilv_plugin_load_if_necessary(p);
// <subject> <predicate> ?value
@@ -94,10 +94,10 @@ lilv_plugin_query_node(LilvPlugin p, LilvNode subject, LilvNode predicate)
return NULL;
}
- LilvValues result = lilv_values_new();
+ LilvValues* result = lilv_values_new();
FOREACH_MATCH(results) {
- LilvNode node = lilv_match_object(results);
- LilvValue value = lilv_value_new_from_node(p->world, node);
+ LilvNode node = lilv_match_object(results);
+ LilvValue* value = lilv_value_new_from_node(p->world, node);
if (value)
lilv_array_append(result, value);
}
@@ -106,38 +106,38 @@ lilv_plugin_query_node(LilvPlugin p, LilvNode subject, LilvNode predicate)
return result;
}
-LilvValue
-lilv_plugin_get_unique(LilvPlugin p, LilvNode subject, LilvNode predicate)
+LilvValue*
+lilv_plugin_get_unique(const LilvPlugin* p, LilvNode subject, LilvNode predicate)
{
- LilvValues values = lilv_plugin_query_node(p, subject, predicate);
+ LilvValues* values = lilv_plugin_query_node(p, subject, predicate);
if (!values || lilv_values_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));
+ LilvValue* ret = lilv_value_duplicate(lilv_values_get_first(values));
lilv_values_free(values);
return ret;
}
-static LilvValue
-lilv_plugin_get_one(LilvPlugin p, LilvNode subject, LilvNode predicate)
+static LilvValue*
+lilv_plugin_get_one(const LilvPlugin* p, LilvNode subject, LilvNode predicate)
{
- LilvValues values = lilv_plugin_query_node(p, subject, predicate);
+ LilvValues* values = lilv_plugin_query_node(p, subject, predicate);
if (!values) {
return NULL;
}
- LilvValue ret = lilv_value_duplicate(lilv_values_get_first(values));
+ LilvValue* ret = lilv_value_duplicate(lilv_values_get_first(values));
lilv_values_free(values);
return ret;
}
static void
-lilv_plugin_load(LilvPlugin p)
+lilv_plugin_load(LilvPlugin* p)
{
// Parse all the plugin's data files into RDF model
LILV_FOREACH(values, i, p->data_uris) {
- LilvValue data_uri_val = lilv_values_get(p->data_uris, i);
+ const LilvValue* data_uri_val = lilv_values_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,
@@ -190,8 +190,9 @@ lilv_plugin_load(LilvPlugin p)
}
static void
-lilv_plugin_load_ports_if_necessary(LilvPlugin p)
+lilv_plugin_load_ports_if_necessary(const LilvPlugin* const_p)
{
+ LilvPlugin* p = (LilvPlugin*)const_p;
if (!p->loaded)
lilv_plugin_load(p);
@@ -206,9 +207,9 @@ lilv_plugin_load_ports_if_necessary(LilvPlugin p)
NULL);
FOREACH_MATCH(ports) {
- LilvValue index = NULL;
- LilvNode port = lilv_match_object(ports);
- LilvValue symbol = lilv_plugin_get_unique(
+ LilvValue* index = NULL;
+ LilvNode port = lilv_match_object(ports);
+ LilvValue* symbol = lilv_plugin_get_unique(
p, port, p->world->lv2_symbol_node);
if (!lilv_value_is_string(symbol)) {
@@ -225,14 +226,14 @@ lilv_plugin_load_ports_if_necessary(LilvPlugin p)
goto error;
}
- uint32_t this_index = lilv_value_as_int(index);
- LilvPort this_port = NULL;
+ uint32_t this_index = lilv_value_as_int(index);
+ LilvPort* this_port = NULL;
if (p->num_ports > this_index) {
this_port = p->ports[this_index];
} else {
p->ports = realloc(p->ports, (this_index + 1) * sizeof(LilvPort*));
memset(p->ports + p->num_ports, '\0',
- (this_index - p->num_ports) * sizeof(LilvPort));
+ (this_index - p->num_ports) * sizeof(LilvPort*));
p->num_ports = this_index + 1;
}
@@ -276,15 +277,15 @@ lilv_plugin_load_ports_if_necessary(LilvPlugin p)
}
void
-lilv_plugin_load_if_necessary(LilvPlugin p)
+lilv_plugin_load_if_necessary(const LilvPlugin* p)
{
if (!p->loaded)
- lilv_plugin_load(p);
+ lilv_plugin_load((LilvPlugin*)p);
}
LILV_API
-LilvValue
-lilv_plugin_get_uri(LilvPlugin p)
+const LilvValue*
+lilv_plugin_get_uri(const LilvPlugin* p)
{
assert(p);
assert(p->plugin_uri);
@@ -292,8 +293,8 @@ lilv_plugin_get_uri(LilvPlugin p)
}
LILV_API
-LilvValue
-lilv_plugin_get_bundle_uri(LilvPlugin p)
+const LilvValue*
+lilv_plugin_get_bundle_uri(const LilvPlugin* p)
{
assert(p);
assert(p->bundle_uri);
@@ -301,9 +302,10 @@ lilv_plugin_get_bundle_uri(LilvPlugin p)
}
LILV_API
-LilvValue
-lilv_plugin_get_library_uri(LilvPlugin p)
+const LilvValue*
+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
@@ -329,16 +331,17 @@ lilv_plugin_get_library_uri(LilvPlugin p)
}
LILV_API
-LilvValues
-lilv_plugin_get_data_uris(LilvPlugin p)
+const LilvValues*
+lilv_plugin_get_data_uris(const LilvPlugin* p)
{
return p->data_uris;
}
LILV_API
-LilvPluginClass
-lilv_plugin_get_class(LilvPlugin p)
+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
@@ -353,14 +356,14 @@ lilv_plugin_get_class(LilvPlugin p)
continue;
}
- LilvValue class = lilv_value_new_from_node(p->world, class_node);
+ LilvValue* class = lilv_value_new_from_node(p->world, class_node);
if ( ! lilv_value_equals(class, p->world->lv2_plugin_class->uri)) {
- LilvPluginClass plugin_class = lilv_plugin_classes_get_by_uri(
+ const LilvPluginClass* plugin_class = lilv_plugin_classes_get_by_uri(
p->world->plugin_classes, class);
if (plugin_class) {
- p->plugin_class = plugin_class;
+ ((LilvPlugin*)p)->plugin_class = plugin_class;
lilv_value_free(class);
break;
}
@@ -378,9 +381,9 @@ lilv_plugin_get_class(LilvPlugin p)
LILV_API
bool
-lilv_plugin_verify(LilvPlugin plugin)
+lilv_plugin_verify(const LilvPlugin* plugin)
{
- LilvValues results = lilv_plugin_get_value_by_qname(plugin, "rdf:type");
+ LilvValues* results = lilv_plugin_get_value_by_qname(plugin, "rdf:type");
if (!results) {
return false;
}
@@ -408,15 +411,15 @@ lilv_plugin_verify(LilvPlugin plugin)
}
LILV_API
-LilvValue
-lilv_plugin_get_name(LilvPlugin plugin)
+LilvValue*
+lilv_plugin_get_name(const LilvPlugin* plugin)
{
- LilvValues results = lilv_plugin_get_value(plugin,
- plugin->world->doap_name_val);
+ LilvValues* results = lilv_plugin_get_value(plugin,
+ plugin->world->doap_name_val);
- LilvValue ret = NULL;
+ LilvValue* ret = NULL;
if (results) {
- LilvValue val = lilv_values_get_first(results);
+ LilvValue* val = lilv_values_get_first(results);
if (lilv_value_is_string(val))
ret = lilv_value_duplicate(val);
lilv_values_free(results);
@@ -430,24 +433,24 @@ lilv_plugin_get_name(LilvPlugin plugin)
}
LILV_API
-LilvValues
-lilv_plugin_get_value(LilvPlugin p,
- LilvValue predicate)
+LilvValues*
+lilv_plugin_get_value(const LilvPlugin* p,
+ const LilvValue* predicate)
{
return lilv_plugin_get_value_for_subject(p, p->plugin_uri, predicate);
}
LILV_API
-LilvValues
-lilv_plugin_get_value_by_qname(LilvPlugin p,
+LilvValues*
+lilv_plugin_get_value_by_qname(const LilvPlugin* p,
const char* predicate)
{
char* pred_uri = (char*)lilv_qname_expand(p, predicate);
if (!pred_uri) {
return NULL;
}
- LilvValue pred_value = lilv_value_new_uri(p->world, pred_uri);
- LilvValues ret = lilv_plugin_get_value(p, pred_value);
+ LilvValue* pred_value = lilv_value_new_uri(p->world, pred_uri);
+ LilvValues* ret = lilv_plugin_get_value(p, pred_value);
lilv_value_free(pred_value);
free(pred_uri);
@@ -455,10 +458,10 @@ lilv_plugin_get_value_by_qname(LilvPlugin p,
}
LILV_API
-LilvValues
-lilv_plugin_get_value_for_subject(LilvPlugin p,
- LilvValue subject,
- LilvValue predicate)
+LilvValues*
+lilv_plugin_get_value_for_subject(const LilvPlugin* p,
+ const LilvValue* subject,
+ const LilvValue* predicate)
{
if ( ! lilv_value_is_uri(subject) && ! lilv_value_is_blank(subject)) {
LILV_ERROR("Subject is not a resource\n");
@@ -474,9 +477,9 @@ lilv_plugin_get_value_for_subject(LilvPlugin p,
: sord_new_blank(p->world->world,
(const uint8_t*)lilv_value_as_blank(subject));
- LilvValues ret = lilv_plugin_query_node(p,
- subject_node,
- predicate->val.uri_val);
+ LilvValues* ret = lilv_plugin_query_node(p,
+ subject_node,
+ predicate->val.uri_val);
lilv_node_free(p->world, subject_node);
return ret;
@@ -484,7 +487,7 @@ lilv_plugin_get_value_for_subject(LilvPlugin p,
LILV_API
uint32_t
-lilv_plugin_get_num_ports(LilvPlugin p)
+lilv_plugin_get_num_ports(const LilvPlugin* p)
{
lilv_plugin_load_ports_if_necessary(p);
return p->num_ports;
@@ -492,14 +495,14 @@ lilv_plugin_get_num_ports(LilvPlugin p)
LILV_API
void
-lilv_plugin_get_port_ranges_float(LilvPlugin p,
- float* min_values,
- float* max_values,
- float* def_values)
+lilv_plugin_get_port_ranges_float(const LilvPlugin* p,
+ 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;
+ LilvValue *def, *min, *max;
lilv_port_get_range(p, p->ports[i], &def, &min, &max);
if (min_values)
@@ -519,8 +522,8 @@ lilv_plugin_get_port_ranges_float(LilvPlugin p,
LILV_API
uint32_t
-lilv_plugin_get_num_ports_of_class(LilvPlugin p,
- LilvValue class_1, ...)
+lilv_plugin_get_num_ports_of_class(const LilvPlugin* p,
+ const LilvValue* class_1, ...)
{
lilv_plugin_load_ports_if_necessary(p);
@@ -528,14 +531,14 @@ lilv_plugin_get_num_ports_of_class(LilvPlugin p,
va_list args;
for (unsigned i = 0; i < p->num_ports; ++i) {
- LilvPort port = p->ports[i];
+ LilvPort* port = p->ports[i];
if (!port || !lilv_port_is_a(p, port, class_1))
continue;
va_start(args, class_1);
bool matches = true;
- for (LilvValue class_i = NULL; (class_i = va_arg(args, LilvValue)) != NULL ; ) {
+ for (LilvValue* class_i = NULL; (class_i = va_arg(args, LilvValue*)) != NULL ; ) {
if (!lilv_port_is_a(p, port, class_i)) {
va_end(args);
matches = false;
@@ -554,7 +557,7 @@ lilv_plugin_get_num_ports_of_class(LilvPlugin p,
LILV_API
bool
-lilv_plugin_has_latency(LilvPlugin p)
+lilv_plugin_has_latency(const LilvPlugin* p)
{
LilvMatches ports = lilv_plugin_find_statements(
p,
@@ -584,7 +587,7 @@ lilv_plugin_has_latency(LilvPlugin p)
LILV_API
uint32_t
-lilv_plugin_get_latency_port_index(LilvPlugin p)
+lilv_plugin_get_latency_port_index(const LilvPlugin* p)
{
LilvMatches ports = lilv_plugin_find_statements(
p,
@@ -601,7 +604,7 @@ lilv_plugin_get_latency_port_index(LilvPlugin p)
p->world->lv2_portproperty_node,
p->world->lv2_reportslatency_node);
if (!lilv_matches_end(reports_latency)) {
- LilvValue index = lilv_plugin_get_unique(
+ LilvValue* index = lilv_plugin_get_unique(
p, port, p->world->lv2_index_node);
ret = lilv_value_as_int(index);
@@ -618,10 +621,10 @@ lilv_plugin_get_latency_port_index(LilvPlugin p)
LILV_API
bool
-lilv_plugin_has_feature(LilvPlugin p,
- LilvValue feature)
+lilv_plugin_has_feature(const LilvPlugin* p,
+ const LilvValue* feature)
{
- LilvValues features = lilv_plugin_get_supported_features(p);
+ LilvValues* features = lilv_plugin_get_supported_features(p);
const bool ret = features && feature && lilv_values_contains(features, feature);
@@ -630,12 +633,12 @@ lilv_plugin_has_feature(LilvPlugin p,
}
LILV_API
-LilvValues
-lilv_plugin_get_supported_features(LilvPlugin p)
+LilvValues*
+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();
+ LilvValues* optional = lilv_plugin_get_optional_features(p);
+ LilvValues* required = lilv_plugin_get_required_features(p);
+ LilvValues* result = lilv_values_new();
LILV_FOREACH(values, i, optional)
lilv_array_append(
@@ -651,23 +654,23 @@ lilv_plugin_get_supported_features(LilvPlugin p)
}
LILV_API
-LilvValues
-lilv_plugin_get_optional_features(LilvPlugin p)
+LilvValues*
+lilv_plugin_get_optional_features(const LilvPlugin* p)
{
return lilv_plugin_get_value_by_qname(p, "lv2:optionalFeature");
}
LILV_API
-LilvValues
-lilv_plugin_get_required_features(LilvPlugin p)
+LilvValues*
+lilv_plugin_get_required_features(const LilvPlugin* p)
{
return lilv_plugin_get_value_by_qname(p, "lv2:requiredFeature");
}
LILV_API
-LilvPort
-lilv_plugin_get_port_by_index(LilvPlugin p,
- uint32_t index)
+const LilvPort*
+lilv_plugin_get_port_by_index(const LilvPlugin* p,
+ uint32_t index)
{
lilv_plugin_load_ports_if_necessary(p);
if (index < p->num_ports)
@@ -677,13 +680,13 @@ lilv_plugin_get_port_by_index(LilvPlugin p,
}
LILV_API
-LilvPort
-lilv_plugin_get_port_by_symbol(LilvPlugin p,
- LilvValue symbol)
+const LilvPort*
+lilv_plugin_get_port_by_symbol(const LilvPlugin* p,
+ const LilvValue* symbol)
{
lilv_plugin_load_ports_if_necessary(p);
for (uint32_t i = 0; i < p->num_ports; ++i) {
- LilvPort port = p->ports[i];
+ LilvPort* port = p->ports[i];
if (lilv_value_equals(port->symbol, symbol))
return port;
}
@@ -692,7 +695,7 @@ lilv_plugin_get_port_by_symbol(LilvPlugin p,
}
static LilvNode
-lilv_plugin_get_author(LilvPlugin p)
+lilv_plugin_get_author(const LilvPlugin* p)
{
SordNode* doap_maintainer = sord_new_uri(
p->world->world, NS_DOAP "maintainer");
@@ -716,8 +719,8 @@ lilv_plugin_get_author(LilvPlugin p)
}
LILV_API
-LilvValue
-lilv_plugin_get_author_name(LilvPlugin plugin)
+LilvValue*
+lilv_plugin_get_author_name(const LilvPlugin* plugin)
{
LilvNode author = lilv_plugin_get_author(plugin);
if (author) {
@@ -729,8 +732,8 @@ lilv_plugin_get_author_name(LilvPlugin plugin)
}
LILV_API
-LilvValue
-lilv_plugin_get_author_email(LilvPlugin plugin)
+LilvValue*
+lilv_plugin_get_author_email(const LilvPlugin* plugin)
{
LilvNode author = lilv_plugin_get_author(plugin);
if (author) {
@@ -742,8 +745,8 @@ lilv_plugin_get_author_email(LilvPlugin plugin)
}
LILV_API
-LilvValue
-lilv_plugin_get_author_homepage(LilvPlugin plugin)
+LilvValue*
+lilv_plugin_get_author_homepage(const LilvPlugin* plugin)
{
LilvNode author = lilv_plugin_get_author(plugin);
if (author) {
@@ -756,19 +759,19 @@ lilv_plugin_get_author_homepage(LilvPlugin plugin)
LILV_API
bool
-lilv_plugin_is_replaced(LilvPlugin plugin)
+lilv_plugin_is_replaced(const LilvPlugin* plugin)
{
return plugin->replaced;
}
LILV_API
-LilvUIs
-lilv_plugin_get_uis(LilvPlugin p)
+LilvUIs*
+lilv_plugin_get_uis(const LilvPlugin* p)
{
SordNode* ui_ui_node = sord_new_uri(p->world->world, NS_UI "ui");
SordNode* ui_binary_node = sord_new_uri(p->world->world, NS_UI "binary");
- LilvUIs result = lilv_uis_new();
+ LilvUIs* result = lilv_uis_new();
LilvMatches uis = lilv_plugin_find_statements(
p,
p->plugin_uri->val.uri_val,
@@ -776,9 +779,9 @@ lilv_plugin_get_uis(LilvPlugin p)
NULL);
FOREACH_MATCH(uis) {
- LilvNode 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 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);
if (sord_node_get_type(ui) != SORD_URI
|| !lilv_value_is_uri(type)
@@ -789,7 +792,7 @@ lilv_plugin_get_uis(LilvPlugin p)
continue;
}
- LilvUI lilv_ui = lilv_ui_new(
+ LilvUI* lilv_ui = lilv_ui_new(
p->world,
lilv_value_new_from_node(p->world, ui),
type,
diff --git a/src/pluginclass.c b/src/pluginclass.c
index 7144cad..010f99e 100644
--- a/src/pluginclass.c
+++ b/src/pluginclass.c
@@ -22,8 +22,8 @@
#include "lilv_internal.h"
-LilvPluginClass
-lilv_plugin_class_new(LilvWorld world,
+LilvPluginClass*
+lilv_plugin_class_new(LilvWorld* world,
LilvNode parent_node,
LilvNode uri,
const char* label)
@@ -31,7 +31,7 @@ lilv_plugin_class_new(LilvWorld world,
if (parent_node && sord_node_get_type(parent_node) != SORD_URI) {
return NULL; // Not an LV2 plugin superclass (FIXME: discover properly)
}
- LilvPluginClass pc = (LilvPluginClass)malloc(sizeof(struct _LilvPluginClass));
+ 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);
@@ -42,7 +42,7 @@ lilv_plugin_class_new(LilvWorld world,
}
void
-lilv_plugin_class_free(LilvPluginClass plugin_class)
+lilv_plugin_class_free(LilvPluginClass* plugin_class)
{
assert(plugin_class->uri);
lilv_value_free(plugin_class->uri);
@@ -52,8 +52,8 @@ lilv_plugin_class_free(LilvPluginClass plugin_class)
}
LILV_API
-LilvValue
-lilv_plugin_class_get_parent_uri(LilvPluginClass plugin_class)
+const LilvValue*
+lilv_plugin_class_get_parent_uri(const LilvPluginClass* plugin_class)
{
if (plugin_class->parent_uri)
return plugin_class->parent_uri;
@@ -62,35 +62,36 @@ lilv_plugin_class_get_parent_uri(LilvPluginClass plugin_class)
}
LILV_API
-LilvValue
-lilv_plugin_class_get_uri(LilvPluginClass plugin_class)
+const LilvValue*
+lilv_plugin_class_get_uri(const LilvPluginClass* plugin_class)
{
assert(plugin_class->uri);
return plugin_class->uri;
}
LILV_API
-LilvValue
-lilv_plugin_class_get_label(LilvPluginClass plugin_class)
+const LilvValue*
+lilv_plugin_class_get_label(const LilvPluginClass* plugin_class)
{
return plugin_class->label;
}
LILV_API
-LilvPluginClasses
-lilv_plugin_class_get_children(LilvPluginClass plugin_class)
+LilvPluginClasses*
+lilv_plugin_class_get_children(const LilvPluginClass* plugin_class)
{
// Returned list doesn't own categories
- LilvPluginClasses all = plugin_class->world->plugin_classes;
- LilvPluginClasses result = g_sequence_new(NULL);
+ LilvPluginClasses* all = plugin_class->world->plugin_classes;
+ LilvPluginClasses* result = g_sequence_new(NULL);
for (GSequenceIter* i = g_sequence_get_begin_iter(all);
i != g_sequence_get_end_iter(all);
i = g_sequence_iter_next(i)) {
- LilvPluginClass c = g_sequence_get(i);
- LilvValue parent = lilv_plugin_class_get_parent_uri(c);
- if (parent && lilv_value_equals(lilv_plugin_class_get_uri(plugin_class), parent))
- lilv_sequence_insert(result, c);
+ 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),
+ parent))
+ lilv_sequence_insert(result, (LilvPluginClass*)c);
}
return result;
diff --git a/src/plugininstance.c b/src/plugininstance.c
index e77f7a8..55e0f99 100644
--- a/src/plugininstance.c
+++ b/src/plugininstance.c
@@ -24,12 +24,12 @@
#include "lilv_internal.h"
LILV_API
-LilvInstance
-lilv_plugin_instantiate(LilvPlugin plugin,
+LilvInstance*
+lilv_plugin_instantiate(const LilvPlugin* plugin,
double sample_rate,
const LV2_Feature*const* features)
{
- struct _Instance* result = NULL;
+ LilvInstance* result = NULL;
const LV2_Feature** local_features = NULL;
if (features == NULL) {
@@ -73,9 +73,9 @@ lilv_plugin_instantiate(LilvPlugin plugin,
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);
- SerdURI base_uri;
+ const LilvValue* bundle_uri = lilv_plugin_get_bundle_uri(plugin);
+ const char* bundle_uri_str = lilv_value_as_uri(bundle_uri);
+ SerdURI base_uri;
if (!serd_uri_parse((const uint8_t*)bundle_uri_str, &base_uri)) {
dlclose(lib);
break;
@@ -94,13 +94,11 @@ lilv_plugin_instantiate(LilvPlugin plugin,
if (!strcmp((const char*)abs_uri_node.buf,
lilv_value_as_uri(lilv_plugin_get_uri(plugin)))) {
// Create LilvInstance to return
- result = malloc(sizeof(struct _Instance));
+ result = malloc(sizeof(struct LilvInstanceImpl));
result->lv2_descriptor = ld;
result->lv2_handle = ld->instantiate(ld, sample_rate, (char*)bundle_path,
(features) ? features : local_features);
- struct _LilvInstanceImpl* impl = malloc(sizeof(struct _LilvInstanceImpl));
- impl->lib_handle = lib;
- result->pimpl = impl;
+ result->pimpl = lib;
serd_node_free(&abs_uri_node);
break;
} else {
@@ -131,18 +129,15 @@ lilv_plugin_instantiate(LilvPlugin plugin,
LILV_API
void
-lilv_instance_free(LilvInstance instance)
+lilv_instance_free(LilvInstance* instance)
{
if (!instance)
return;
- struct _Instance* i = (struct _Instance*)instance;
- i->lv2_descriptor->cleanup(i->lv2_handle);
- i->lv2_descriptor = NULL;
- dlclose(i->pimpl->lib_handle);
- i->pimpl->lib_handle = NULL;
- free(i->pimpl);
- i->pimpl = NULL;
- free(i);
+ instance->lv2_descriptor->cleanup(instance->lv2_handle);
+ instance->lv2_descriptor = NULL;
+ dlclose(instance->pimpl);
+ instance->pimpl = NULL;
+ free(instance);
}
diff --git a/src/pluginui.c b/src/pluginui.c
index b8e9db1..b6fa60a 100644
--- a/src/pluginui.c
+++ b/src/pluginui.c
@@ -22,17 +22,17 @@
#include "lilv_internal.h"
-LilvUI
-lilv_ui_new(LilvWorld world,
- LilvValue uri,
- LilvValue type_uri,
- LilvValue binary_uri)
+LilvUI*
+lilv_ui_new(LilvWorld* world,
+ LilvValue* uri,
+ LilvValue* type_uri,
+ LilvValue* binary_uri)
{
assert(uri);
assert(type_uri);
assert(binary_uri);
- struct _LilvUI* ui = malloc(sizeof(struct _LilvUI));
+ LilvUI* ui = malloc(sizeof(struct LilvUIImpl));
ui->world = world;
ui->uri = uri;
ui->binary_uri = binary_uri;
@@ -51,7 +51,7 @@ lilv_ui_new(LilvWorld world,
}
void
-lilv_ui_free(LilvUI ui)
+lilv_ui_free(LilvUI* ui)
{
lilv_value_free(ui->uri);
ui->uri = NULL;
@@ -68,8 +68,8 @@ lilv_ui_free(LilvUI ui)
}
LILV_API
-LilvValue
-lilv_ui_get_uri(LilvUI ui)
+const LilvValue*
+lilv_ui_get_uri(const LilvUI* ui)
{
assert(ui);
assert(ui->uri);
@@ -78,17 +78,17 @@ lilv_ui_get_uri(LilvUI ui)
LILV_API
unsigned
-lilv_ui_is_supported(LilvUI ui,
+lilv_ui_is_supported(const LilvUI* ui,
LilvUISupportedFunc supported_func,
- LilvValue container_type,
- LilvValue* ui_type)
+ const LilvValue* container_type,
+ const LilvValue** ui_type)
{
#ifdef HAVE_SUIL
- LilvValues classes = lilv_ui_get_classes(ui);
+ const LilvValues* classes = lilv_ui_get_classes(ui);
LILV_FOREACH(values, c, classes) {
- LilvValue type = lilv_values_get(classes, c);
- const unsigned q = supported_func(lilv_value_as_uri(container_type),
- lilv_value_as_uri(type));
+ const LilvValue* type = lilv_values_get(classes, c);
+ const unsigned q = supported_func(lilv_value_as_uri(container_type),
+ lilv_value_as_uri(type));
if (q) {
if (ui_type) {
*ui_type = lilv_value_duplicate(type);
@@ -101,22 +101,22 @@ lilv_ui_is_supported(LilvUI ui,
}
LILV_API
-LilvValues
-lilv_ui_get_classes(LilvUI ui)
+const LilvValues*
+lilv_ui_get_classes(const LilvUI* ui)
{
return ui->classes;
}
LILV_API
bool
-lilv_ui_is_a(LilvUI ui, LilvValue ui_class_uri)
+lilv_ui_is_a(const LilvUI* ui, const LilvValue* ui_class_uri)
{
return lilv_values_contains(ui->classes, ui_class_uri);
}
LILV_API
-LilvValue
-lilv_ui_get_bundle_uri(LilvUI ui)
+const LilvValue*
+lilv_ui_get_bundle_uri(const LilvUI* ui)
{
assert(ui);
assert(ui->bundle_uri);
@@ -124,8 +124,8 @@ lilv_ui_get_bundle_uri(LilvUI ui)
}
LILV_API
-LilvValue
-lilv_ui_get_binary_uri(LilvUI ui)
+const LilvValue*
+lilv_ui_get_binary_uri(const LilvUI* ui)
{
assert(ui);
assert(ui->binary_uri);
diff --git a/src/port.c b/src/port.c
index 6be5d7e..3f4d871 100644
--- a/src/port.c
+++ b/src/port.c
@@ -24,10 +24,10 @@
#include "lilv_internal.h"
-LilvPort
-lilv_port_new(LilvWorld world, uint32_t index, const char* symbol)
+LilvPort*
+lilv_port_new(LilvWorld* world, uint32_t index, const char* symbol)
{
- struct _LilvPort* port = malloc(sizeof(struct _LilvPort));
+ LilvPort* port = malloc(sizeof(struct LilvPortImpl));
port->index = index;
port->symbol = lilv_value_new(world, LILV_VALUE_STRING, symbol);
port->classes = lilv_values_new();
@@ -35,7 +35,7 @@ lilv_port_new(LilvWorld world, uint32_t index, const char* symbol)
}
void
-lilv_port_free(LilvPort port)
+lilv_port_free(LilvPort* port)
{
lilv_values_free(port->classes);
lilv_value_free(port->symbol);
@@ -44,9 +44,9 @@ lilv_port_free(LilvPort port)
LILV_API
bool
-lilv_port_is_a(LilvPlugin plugin,
- LilvPort port,
- LilvValue port_class)
+lilv_port_is_a(const LilvPlugin* plugin,
+ const LilvPort* port,
+ const LilvValue* port_class)
{
LILV_FOREACH(values, i, port->classes)
if (lilv_value_equals(lilv_values_get(port->classes, i), port_class))
@@ -56,8 +56,8 @@ lilv_port_is_a(LilvPlugin plugin,
}
static LilvNode
-lilv_port_get_node(LilvPlugin p,
- LilvPort port)
+lilv_port_get_node(const LilvPlugin* p,
+ const LilvPort* port)
{
LilvMatches ports = lilv_plugin_find_statements(
p,
@@ -66,8 +66,8 @@ lilv_port_get_node(LilvPlugin p,
NULL);
LilvNode ret = NULL;
FOREACH_MATCH(ports) {
- LilvNode node = lilv_match_object(ports);
- LilvValue symbol = lilv_plugin_get_unique(
+ LilvNode node = lilv_match_object(ports);
+ LilvValue* symbol = lilv_plugin_get_unique(
p,
node,
p->world->lv2_symbol_node);
@@ -88,9 +88,9 @@ lilv_port_get_node(LilvPlugin p,
LILV_API
bool
-lilv_port_has_property(LilvPlugin p,
- LilvPort port,
- LilvValue property)
+lilv_port_has_property(const LilvPlugin* p,
+ const LilvPort* port,
+ const LilvValue* property)
{
assert(property);
LilvNode port_node = lilv_port_get_node(p, port);
@@ -107,9 +107,9 @@ lilv_port_has_property(LilvPlugin p,
LILV_API
bool
-lilv_port_supports_event(LilvPlugin p,
- LilvPort port,
- LilvValue event)
+lilv_port_supports_event(const LilvPlugin* p,
+ const LilvPort* port,
+ const LilvValue* event)
{
#define NS_EV (const uint8_t*)"http://lv2plug.in/ns/ext/event#"
@@ -127,10 +127,10 @@ lilv_port_supports_event(LilvPlugin p,
}
LILV_API
-LilvValues
-lilv_port_get_value_by_qname(LilvPlugin p,
- LilvPort port,
- const char* predicate)
+LilvValues*
+lilv_port_get_value_by_qname(const LilvPlugin* p,
+ const LilvPort* port,
+ const char* predicate)
{
assert(predicate);
uint8_t* pred_uri = lilv_qname_expand(p, predicate);
@@ -149,10 +149,10 @@ lilv_port_get_value_by_qname(LilvPlugin p,
return lilv_values_from_stream_objects(p, results);
}
-static LilvValues
-lilv_port_get_value_by_node(LilvPlugin p,
- LilvPort port,
- LilvNode predicate)
+static LilvValues*
+lilv_port_get_value_by_node(const LilvPlugin* p,
+ const LilvPort* port,
+ LilvNode predicate)
{
assert(sord_node_get_type(predicate) == SORD_URI);
@@ -167,10 +167,10 @@ lilv_port_get_value_by_node(LilvPlugin p,
}
LILV_API
-LilvValues
-lilv_port_get_value(LilvPlugin p,
- LilvPort port,
- LilvValue predicate)
+LilvValues*
+lilv_port_get_value(const LilvPlugin* p,
+ const LilvPort* port,
+ const LilvValue* predicate)
{
if ( ! lilv_value_is_uri(predicate)) {
LILV_ERROR("Predicate is not a URI\n");
@@ -183,24 +183,24 @@ lilv_port_get_value(LilvPlugin p,
}
LILV_API
-LilvValue
-lilv_port_get_symbol(LilvPlugin p,
- LilvPort port)
+const LilvValue*
+lilv_port_get_symbol(const LilvPlugin* p,
+ const LilvPort* port)
{
return port->symbol;
}
LILV_API
-LilvValue
-lilv_port_get_name(LilvPlugin p,
- LilvPort port)
+LilvValue*
+lilv_port_get_name(const LilvPlugin* p,
+ const LilvPort* port)
{
- LilvValues results = lilv_port_get_value(p, port,
- p->world->lv2_name_val);
+ LilvValues* results = lilv_port_get_value(p, port,
+ p->world->lv2_name_val);
- LilvValue ret = NULL;
+ LilvValue* ret = NULL;
if (results) {
- LilvValue val = lilv_values_get_first(results);
+ LilvValue* val = lilv_values_get_first(results);
if (lilv_value_is_string(val))
ret = lilv_value_duplicate(val);
lilv_values_free(results);
@@ -214,23 +214,23 @@ lilv_port_get_name(LilvPlugin p,
}
LILV_API
-LilvValues
-lilv_port_get_classes(LilvPlugin p,
- LilvPort port)
+const LilvValues*
+lilv_port_get_classes(const LilvPlugin* p,
+ const LilvPort* port)
{
return port->classes;
}
LILV_API
void
-lilv_port_get_range(LilvPlugin p,
- LilvPort port,
- LilvValue* def,
- LilvValue* min,
- LilvValue* max)
+lilv_port_get_range(const LilvPlugin* p,
+ const LilvPort* port,
+ LilvValue** def,
+ LilvValue** min,
+ LilvValue** max)
{
if (def) {
- LilvValues defaults = lilv_port_get_value_by_node(
+ LilvValues* defaults = lilv_port_get_value_by_node(
p, port, p->world->lv2_default_node);
*def = defaults
? lilv_value_duplicate(lilv_values_get_first(defaults))
@@ -238,7 +238,7 @@ lilv_port_get_range(LilvPlugin p,
lilv_values_free(defaults);
}
if (min) {
- LilvValues minimums = lilv_port_get_value_by_node(
+ LilvValues* minimums = lilv_port_get_value_by_node(
p, port, p->world->lv2_minimum_node);
*min = minimums
? lilv_value_duplicate(lilv_values_get_first(minimums))
@@ -246,7 +246,7 @@ lilv_port_get_range(LilvPlugin p,
lilv_values_free(minimums);
}
if (max) {
- LilvValues maximums = lilv_port_get_value_by_node(
+ LilvValues* maximums = lilv_port_get_value_by_node(
p, port, p->world->lv2_maximum_node);
*max = maximums
? lilv_value_duplicate(lilv_values_get_first(maximums))
@@ -256,9 +256,9 @@ lilv_port_get_range(LilvPlugin p,
}
LILV_API
-LilvScalePoints
-lilv_port_get_scale_points(LilvPlugin p,
- LilvPort port)
+LilvScalePoints*
+lilv_port_get_scale_points(const LilvPlugin* p,
+ const LilvPort* port)
{
LilvNode port_node = lilv_port_get_node(p, port);
LilvMatches points = lilv_plugin_find_statements(
@@ -267,19 +267,19 @@ lilv_port_get_scale_points(LilvPlugin p,
sord_new_uri(p->world->world, LILV_NS_LV2 "scalePoint"),
NULL);
- LilvScalePoints ret = NULL;
+ LilvScalePoints* ret = NULL;
if (!lilv_matches_end(points))
ret = lilv_scale_points_new();
FOREACH_MATCH(points) {
LilvNode point = lilv_match_object(points);
- LilvValue value = lilv_plugin_get_unique(
+ LilvValue* value = lilv_plugin_get_unique(
p,
point,
p->world->rdf_value_node);
- LilvValue label = lilv_plugin_get_unique(
+ LilvValue* label = lilv_plugin_get_unique(
p,
point,
p->world->rdfs_label_node);
@@ -295,13 +295,13 @@ lilv_port_get_scale_points(LilvPlugin p,
}
LILV_API
-LilvValues
-lilv_port_get_properties(LilvPlugin p,
- LilvPort port)
+LilvValues*
+lilv_port_get_properties(const LilvPlugin* p,
+ const LilvPort* port)
{
- LilvValue pred = lilv_value_new_from_node(
+ LilvValue* pred = lilv_value_new_from_node(
p->world, p->world->lv2_portproperty_node);
- LilvValues ret = lilv_port_get_value(p, port, pred);
+ LilvValues* ret = lilv_port_get_value(p, port, pred);
lilv_value_free(pred);
return ret;
}
diff --git a/src/query.c b/src/query.c
index b82256c..d84a20f 100644
--- a/src/query.c
+++ b/src/query.c
@@ -24,10 +24,10 @@
#include "lilv_internal.h"
LilvMatches
-lilv_plugin_find_statements(LilvPlugin plugin,
- LilvNode subject,
- LilvNode predicate,
- LilvNode object)
+lilv_plugin_find_statements(const LilvPlugin* plugin,
+ LilvNode subject,
+ LilvNode predicate,
+ LilvNode object)
{
lilv_plugin_load_if_necessary(plugin);
SordQuad pat = { subject, predicate, object, NULL };
@@ -64,14 +64,14 @@ lilv_lang_matches(const char* a, const char* b)
return LILV_LANG_MATCH_NONE;
}
-LilvValues
-lilv_values_from_stream_objects_i18n(LilvPlugin p,
- LilvMatches stream)
+LilvValues*
+lilv_values_from_stream_objects_i18n(const LilvPlugin* p,
+ LilvMatches stream)
{
- LilvValues values = lilv_values_new();
- LilvNode nolang = NULL; // Untranslated value
- LilvNode partial = NULL; // Partial language match
- char* syslang = lilv_get_lang();
+ LilvValues* values = lilv_values_new();
+ LilvNode nolang = NULL; // Untranslated value
+ LilvNode partial = NULL; // Partial language match
+ char* syslang = lilv_get_lang();
FOREACH_MATCH(stream) {
LilvNode value = lilv_match_object(stream);
if (sord_node_get_type(value) == SORD_LITERAL) {
@@ -127,9 +127,9 @@ lilv_values_from_stream_objects_i18n(LilvPlugin p,
return values;
}
-LilvValues
-lilv_values_from_stream_objects(LilvPlugin p,
- LilvMatches stream)
+LilvValues*
+lilv_values_from_stream_objects(const LilvPlugin* p,
+ LilvMatches stream)
{
if (lilv_matches_end(stream)) {
lilv_match_end(stream);
@@ -137,7 +137,7 @@ lilv_values_from_stream_objects(LilvPlugin p,
} else if (p->world->opt.filter_language) {
return lilv_values_from_stream_objects_i18n(p, stream);
} else {
- LilvValues values = lilv_values_new();
+ LilvValues* values = lilv_values_new();
FOREACH_MATCH(stream) {
lilv_array_append(
values,
diff --git a/src/scalepoint.c b/src/scalepoint.c
index aa27d04..0f3c7f6 100644
--- a/src/scalepoint.c
+++ b/src/scalepoint.c
@@ -17,17 +17,18 @@
#include "lilv_internal.h"
/** Ownership of value and label is taken */
-LilvScalePoint
-lilv_scale_point_new(LilvValue value, LilvValue label)
+LilvScalePoint*
+lilv_scale_point_new(LilvValue* value, LilvValue* label)
{
- LilvScalePoint point = (LilvScalePoint)malloc(sizeof(struct _LilvScalePoint));
+ LilvScalePoint* point = (LilvScalePoint*)malloc(
+ sizeof(struct LilvScalePointImpl));
point->value = value;
point->label = label;
return point;
}
void
-lilv_scale_point_free(LilvScalePoint point)
+lilv_scale_point_free(LilvScalePoint* point)
{
lilv_value_free(point->value);
lilv_value_free(point->label);
@@ -35,15 +36,15 @@ lilv_scale_point_free(LilvScalePoint point)
}
LILV_API
-LilvValue
-lilv_scale_point_get_value(LilvScalePoint p)
+const LilvValue*
+lilv_scale_point_get_value(const LilvScalePoint* p)
{
return p->value;
}
LILV_API
-LilvValue
-lilv_scale_point_get_label(LilvScalePoint p)
+const LilvValue*
+lilv_scale_point_get_label(const LilvScalePoint* p)
{
return p->label;
}
diff --git a/src/util.c b/src/util.c
index a1689a4..0603a7a 100644
--- a/src/util.c
+++ b/src/util.c
@@ -112,7 +112,7 @@ lilv_get_lang()
}
uint8_t*
-lilv_qname_expand(LilvPlugin p, const char* qname)
+lilv_qname_expand(const LilvPlugin* p, const char* qname)
{
const size_t qname_len = strlen(qname);
SerdNode qname_node = { (const uint8_t*)qname,
diff --git a/src/value.c b/src/value.c
index 991f681..3ede347 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_value_set_numerics_from_string(LilvValue* val)
{
char* locale;
char* endptr;
@@ -64,10 +64,10 @@ lilv_value_set_numerics_from_string(LilvValue val)
* 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)
+LilvValue*
+lilv_value_new(LilvWorld* world, LilvValueType type, const char* str)
{
- LilvValue val = (LilvValue)malloc(sizeof(struct _LilvValue));
+ LilvValue* val = malloc(sizeof(struct LilvValueImpl));
val->world = world;
val->type = type;
@@ -91,17 +91,17 @@ lilv_value_new(LilvWorld world, LilvValueType type, const char* str)
}
/** Create a new LilvValue from @a node, or return NULL if impossible */
-LilvValue
-lilv_value_new_from_node(LilvWorld world, const SordNode* node)
+LilvValue*
+lilv_value_new_from_node(LilvWorld* world, const SordNode* node)
{
- LilvValue result = NULL;
+ LilvValue* result = NULL;
SordNode* datatype_uri = NULL;
LilvValueType type = LILV_VALUE_STRING;
switch (sord_node_get_type(node)) {
case SORD_URI:
type = LILV_VALUE_URI;
- result = (LilvValue)malloc(sizeof(struct _LilvValue));
+ result = malloc(sizeof(struct LilvValueImpl));
result->world = world;
result->type = LILV_VALUE_URI;
result->val.uri_val = lilv_node_copy(node);
@@ -142,58 +142,58 @@ lilv_value_new_from_node(LilvWorld world, const SordNode* node)
}
LILV_API
-LilvValue
-lilv_value_new_uri(LilvWorld world, const char* uri)
+LilvValue*
+lilv_value_new_uri(LilvWorld* world, const char* uri)
{
return lilv_value_new(world, LILV_VALUE_URI, uri);
}
LILV_API
-LilvValue
-lilv_value_new_string(LilvWorld world, const char* str)
+LilvValue*
+lilv_value_new_string(LilvWorld* world, const char* str)
{
return lilv_value_new(world, LILV_VALUE_STRING, str);
}
LILV_API
-LilvValue
-lilv_value_new_int(LilvWorld world, int val)
+LilvValue*
+lilv_value_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);
+ LilvValue* ret = lilv_value_new(world, LILV_VALUE_INT, str);
ret->val.int_val = val;
return ret;
}
LILV_API
-LilvValue
-lilv_value_new_float(LilvWorld world, float val)
+LilvValue*
+lilv_value_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);
+ LilvValue* ret = lilv_value_new(world, LILV_VALUE_FLOAT, str);
ret->val.float_val = val;
return ret;
}
LILV_API
-LilvValue
-lilv_value_new_bool(LilvWorld world, bool val)
+LilvValue*
+lilv_value_new_bool(LilvWorld* world, bool val)
{
- LilvValue ret = lilv_value_new(world, LILV_VALUE_BOOL, val ? "true" : "false");
+ LilvValue* ret = lilv_value_new(world, LILV_VALUE_BOOL, val ? "true" : "false");
ret->val.bool_val = val;
return ret;
}
LILV_API
-LilvValue
-lilv_value_duplicate(LilvValue val)
+LilvValue*
+lilv_value_duplicate(const LilvValue* val)
{
if (val == NULL)
- return val;
+ return NULL;
- LilvValue result = (LilvValue)malloc(sizeof(struct _LilvValue));
+ LilvValue* result = malloc(sizeof(struct LilvValueImpl));
result->world = val->world;
result->type = val->type;
@@ -210,7 +210,7 @@ lilv_value_duplicate(LilvValue val)
LILV_API
void
-lilv_value_free(LilvValue val)
+lilv_value_free(LilvValue* val)
{
if (val) {
if (val->type == LILV_VALUE_URI) {
@@ -224,7 +224,7 @@ lilv_value_free(LilvValue val)
LILV_API
bool
-lilv_value_equals(LilvValue value, LilvValue other)
+lilv_value_equals(const LilvValue* value, const LilvValue* other)
{
if (value == NULL && other == NULL)
return true;
@@ -253,7 +253,7 @@ lilv_value_equals(LilvValue value, LilvValue other)
LILV_API
char*
-lilv_value_get_turtle_token(LilvValue value)
+lilv_value_get_turtle_token(const LilvValue* value)
{
size_t len = 0;
char* result = NULL;
@@ -303,21 +303,21 @@ lilv_value_get_turtle_token(LilvValue value)
LILV_API
bool
-lilv_value_is_uri(LilvValue value)
+lilv_value_is_uri(const LilvValue* value)
{
return (value && value->type == LILV_VALUE_URI);
}
LILV_API
const char*
-lilv_value_as_uri(LilvValue value)
+lilv_value_as_uri(const LilvValue* value)
{
assert(lilv_value_is_uri(value));
return value->str_val;
}
LilvNode
-lilv_value_as_node(LilvValue value)
+lilv_value_as_node(const LilvValue* value)
{
assert(lilv_value_is_uri(value));
return value->val.uri_val;
@@ -325,14 +325,14 @@ lilv_value_as_node(LilvValue value)
LILV_API
bool
-lilv_value_is_blank(LilvValue value)
+lilv_value_is_blank(const LilvValue* value)
{
return (value && value->type == LILV_VALUE_BLANK);
}
LILV_API
const char*
-lilv_value_as_blank(LilvValue value)
+lilv_value_as_blank(const LilvValue* value)
{
assert(lilv_value_is_blank(value));
return value->str_val;
@@ -340,7 +340,7 @@ lilv_value_as_blank(LilvValue value)
LILV_API
bool
-lilv_value_is_literal(LilvValue value)
+lilv_value_is_literal(const LilvValue* value)
{
if (!value)
return false;
@@ -357,28 +357,28 @@ lilv_value_is_literal(LilvValue value)
LILV_API
bool
-lilv_value_is_string(LilvValue value)
+lilv_value_is_string(const LilvValue* value)
{
return (value && value->type == LILV_VALUE_STRING);
}
LILV_API
const char*
-lilv_value_as_string(LilvValue value)
+lilv_value_as_string(const LilvValue* value)
{
return value->str_val;
}
LILV_API
bool
-lilv_value_is_int(LilvValue value)
+lilv_value_is_int(const LilvValue* value)
{
return (value && value->type == LILV_VALUE_INT);
}
LILV_API
int
-lilv_value_as_int(LilvValue value)
+lilv_value_as_int(const LilvValue* value)
{
assert(value);
assert(lilv_value_is_int(value));
@@ -387,14 +387,14 @@ lilv_value_as_int(LilvValue value)
LILV_API
bool
-lilv_value_is_float(LilvValue value)
+lilv_value_is_float(const LilvValue* value)
{
return (value && value->type == LILV_VALUE_FLOAT);
}
LILV_API
float
-lilv_value_as_float(LilvValue value)
+lilv_value_as_float(const LilvValue* value)
{
assert(lilv_value_is_float(value) || lilv_value_is_int(value));
if (lilv_value_is_float(value))
@@ -405,14 +405,14 @@ lilv_value_as_float(LilvValue value)
LILV_API
bool
-lilv_value_is_bool(LilvValue value)
+lilv_value_is_bool(const LilvValue* value)
{
return (value && value->type == LILV_VALUE_BOOL);
}
LILV_API
bool
-lilv_value_as_bool(LilvValue value)
+lilv_value_as_bool(const LilvValue* value)
{
assert(value);
assert(lilv_value_is_bool(value));
diff --git a/src/world.c b/src/world.c
index 133185b..92f3ddc 100644
--- a/src/world.c
+++ b/src/world.c
@@ -29,7 +29,7 @@
#include "lilv_internal.h"
static void
-lilv_world_set_prefix(LilvWorld world, const char* name, const char* uri)
+lilv_world_set_prefix(LilvWorld* world, const char* name, const char* uri)
{
const SerdNode name_node = serd_node_from_string(SERD_LITERAL,
(const uint8_t*)name);
@@ -39,10 +39,10 @@ lilv_world_set_prefix(LilvWorld world, const char* name, const char* uri)
}
LILV_API
-LilvWorld
+LilvWorld*
lilv_world_new()
{
- LilvWorld world = (LilvWorld)malloc(sizeof(struct _LilvWorld));
+ LilvWorld* world = malloc(sizeof(struct LilvWorldImpl));
world->world = sord_world_new();
if (!world->world)
@@ -115,7 +115,7 @@ fail:
LILV_API
void
-lilv_world_free(LilvWorld world)
+lilv_world_free(LilvWorld* world)
{
lilv_plugin_class_free(world->lv2_plugin_class);
world->lv2_plugin_class = NULL;
@@ -148,7 +148,7 @@ lilv_world_free(LilvWorld world)
lilv_value_free(world->lv2_name_val);
for (GSList* l = world->specs; l; l = l->next) {
- LilvSpec spec = (LilvSpec)l->data;
+ LilvSpec* spec = (LilvSpec*)l->data;
lilv_node_free(world, spec->spec);
lilv_node_free(world, spec->bundle);
lilv_values_free(spec->data_uris);
@@ -158,8 +158,8 @@ lilv_world_free(LilvWorld world)
world->specs = NULL;
LILV_FOREACH(plugins, i, world->plugins) {
- LilvPlugin p = lilv_plugins_get(world->plugins, i);
- lilv_plugin_free(p);
+ const LilvPlugin* p = lilv_plugins_get(world->plugins, i);
+ lilv_plugin_free((LilvPlugin*)p);
}
g_sequence_free(world->plugins);
world->plugins = NULL;
@@ -180,9 +180,9 @@ lilv_world_free(LilvWorld world)
LILV_API
void
-lilv_world_set_option(LilvWorld world,
- const char* option,
- const LilvValue value)
+lilv_world_set_option(LilvWorld* world,
+ const char* option,
+ const LilvValue* value)
{
if (!strcmp(option, LILV_OPTION_DYN_MANIFEST)) {
if (lilv_value_is_bool(value)) {
@@ -199,7 +199,7 @@ lilv_world_set_option(LilvWorld world,
}
static LilvMatches
-lilv_world_find_statements(LilvWorld world,
+lilv_world_find_statements(LilvWorld* world,
SordModel* model,
LilvNode subject,
LilvNode predicate,
@@ -224,7 +224,7 @@ lilv_new_uri_relative_to_base(const uint8_t* uri_str,
}
const uint8_t*
-lilv_world_blank_node_prefix(LilvWorld world)
+lilv_world_blank_node_prefix(LilvWorld* world)
{
static char str[32];
snprintf(str, sizeof(str), "%d", world->n_read_files++);
@@ -235,36 +235,37 @@ lilv_world_blank_node_prefix(LilvWorld world)
int
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;
+ 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));
}
/** Get an element of a sequence of any object with an LilvHeader by URI. */
-struct _LilvHeader*
-lilv_sequence_get_by_uri(GSequence* seq,
- LilvValue uri)
+struct LilvHeader*
+lilv_sequence_get_by_uri(const GSequence* const_seq,
+ const LilvValue* uri)
{
- struct _LilvHeader key = { NULL, uri };
- GSequenceIter* i = g_sequence_search(
+ GSequence* seq = (GSequence*)const_seq;
+ struct LilvHeader key = { NULL, (LilvValue*)uri };
+ GSequenceIter* i = g_sequence_search(
seq, &key, lilv_header_compare_by_uri, NULL);
// i points to where plugin would be inserted (not necessarily a match)
if (!g_sequence_iter_is_end(i)) {
- LilvPlugin p = g_sequence_get(i);
+ LilvPlugin* p = g_sequence_get(i);
if (lilv_value_equals(lilv_plugin_get_uri(p), uri)) {
- return (struct _LilvHeader*)p;
+ return (struct LilvHeader*)p;
}
}
if (!g_sequence_iter_is_begin(i)) {
// Check if i is just past a match
i = g_sequence_iter_prev(i);
- LilvPlugin p = g_sequence_get(i);
+ LilvPlugin* p = g_sequence_get(i);
if (lilv_value_equals(lilv_plugin_get_uri(p), uri)) {
- return (struct _LilvHeader*)p;
+ return (struct LilvHeader*)p;
}
}
@@ -272,11 +273,11 @@ lilv_sequence_get_by_uri(GSequence* seq,
}
static void
-lilv_world_add_spec(LilvWorld world,
+lilv_world_add_spec(LilvWorld* world,
LilvNode specification_node,
LilvNode bundle_node)
{
- LilvSpec spec = malloc(sizeof(struct _LilvSpec));
+ 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();
@@ -300,15 +301,15 @@ lilv_world_add_spec(LilvWorld world,
}
static void
-lilv_world_add_plugin(LilvWorld world,
- LilvNode plugin_node,
- SerdNode* manifest_uri,
- LilvNode dyn_manifest_lib,
- LilvNode bundle_node)
+lilv_world_add_plugin(LilvWorld* world,
+ LilvNode plugin_node,
+ SerdNode* manifest_uri,
+ LilvNode dyn_manifest_lib,
+ LilvNode bundle_node)
{
- LilvValue plugin_uri = lilv_value_new_from_node(world, plugin_node);
+ LilvValue* plugin_uri = lilv_value_new_from_node(world, plugin_node);
- LilvPlugin last = lilv_plugins_get_by_uri(world->plugins, plugin_uri);
+ 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(
@@ -319,8 +320,8 @@ lilv_world_add_plugin(LilvWorld world,
}
// Create LilvPlugin
- LilvValue bundle_uri = lilv_value_new_from_node(world, bundle_node);
- LilvPlugin plugin = lilv_plugin_new(world, plugin_uri, bundle_uri);
+ LilvValue* bundle_uri = lilv_value_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)
lilv_array_append(plugin->data_uris,
@@ -350,7 +351,7 @@ lilv_world_add_plugin(LilvWorld world,
}
static void
-lilv_world_load_dyn_manifest(LilvWorld world,
+lilv_world_load_dyn_manifest(LilvWorld* world,
SordNode* bundle_node,
SerdNode manifest_uri)
{
@@ -455,7 +456,7 @@ 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, LilvValue* bundle_uri)
{
if (!lilv_value_is_uri(bundle_uri)) {
LILV_ERROR("Bundle 'URI' is not a URI\n");
@@ -534,7 +535,7 @@ expand(const char* path)
/** Load all bundles in the directory at @a dir_path. */
static void
-lilv_world_load_directory(LilvWorld world, const char* dir_path)
+lilv_world_load_directory(LilvWorld* world, const char* dir_path)
{
char* path = expand(dir_path);
if (!path) {
@@ -568,7 +569,7 @@ 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_value_new_uri(world, uri);
+ LilvValue* uri_val = lilv_value_new_uri(world, uri);
lilv_world_load_bundle(world, uri_val);
lilv_value_free(uri_val);
} else {
@@ -605,7 +606,7 @@ first_path_sep(const char* path)
* parent directories of bundles, not a list of bundle directories).
*/
static void
-lilv_world_load_path(LilvWorld world,
+lilv_world_load_path(LilvWorld* world,
const char* lv2_path)
{
while (lv2_path[0] != '\0') {
@@ -626,12 +627,12 @@ lilv_world_load_path(LilvWorld world,
}
static void
-lilv_world_load_specifications(LilvWorld world)
+lilv_world_load_specifications(LilvWorld* world)
{
for (GSList* l = world->specs; l; l = l->next) {
- LilvSpec spec = (LilvSpec)l->data;
+ LilvSpec* spec = (LilvSpec*)l->data;
LILV_FOREACH(values, f, spec->data_uris) {
- LilvValue file = lilv_collection_get(spec->data_uris, f);
+ LilvValue* file = lilv_collection_get(spec->data_uris, f);
sord_read_file(world->model,
(const uint8_t*)lilv_value_as_uri(file),
NULL,
@@ -641,7 +642,7 @@ lilv_world_load_specifications(LilvWorld world)
}
static void
-lilv_world_load_plugin_classes(LilvWorld world)
+lilv_world_load_plugin_classes(LilvWorld* world)
{
/* FIXME: This loads all classes, not just lv2:Plugin subclasses.
However, if the host gets all the classes via lilv_plugin_class_get_children
@@ -696,8 +697,8 @@ lilv_world_load_plugin_classes(LilvWorld world)
const uint8_t* label = (const uint8_t*)sord_node_get_string(label_node);
lilv_match_end(labels);
- LilvPluginClasses classes = world->plugin_classes;
- LilvPluginClass pclass = lilv_plugin_class_new(
+ LilvPluginClasses* classes = world->plugin_classes;
+ LilvPluginClass* pclass = lilv_plugin_class_new(
world, parent_node, class_node, (const char*)label);
if (pclass) {
@@ -709,7 +710,7 @@ lilv_world_load_plugin_classes(LilvWorld world)
LILV_API
void
-lilv_world_load_all(LilvWorld world)
+lilv_world_load_all(LilvWorld* world)
{
const char* lv2_path = getenv("LV2_PATH");
if (!lv2_path)
@@ -719,8 +720,8 @@ lilv_world_load_all(LilvWorld world)
lilv_world_load_path(world, lv2_path);
LILV_FOREACH(plugins, p, world->plugins) {
- LilvPlugin plugin = lilv_collection_get(world->plugins, p);
- LilvValue plugin_uri = lilv_plugin_get_uri(plugin);
+ const LilvPlugin* plugin = lilv_collection_get(world->plugins, p);
+ const LilvValue* plugin_uri = lilv_plugin_get_uri(plugin);
// ?new dc:replaces plugin
LilvMatches replacement = lilv_world_find_statements(
@@ -733,7 +734,7 @@ lilv_world_load_all(LilvWorld world)
/* TODO: Check if replacement is actually a known plugin,
though this is expensive...
*/
- plugin->replaced = true;
+ ((LilvPlugin*)plugin)->replaced = true;
}
lilv_match_end(replacement);
}
@@ -744,33 +745,22 @@ lilv_world_load_all(LilvWorld world)
}
LILV_API
-LilvPluginClass
-lilv_world_get_plugin_class(LilvWorld world)
+const LilvPluginClass*
+lilv_world_get_plugin_class(const LilvWorld* world)
{
return world->lv2_plugin_class;
}
LILV_API
-LilvPluginClasses
-lilv_world_get_plugin_classes(LilvWorld world)
+const LilvPluginClasses*
+lilv_world_get_plugin_classes(const LilvWorld* world)
{
return world->plugin_classes;
}
LILV_API
-LilvPlugins
-lilv_world_get_all_plugins(LilvWorld world)
+const LilvPlugins*
+lilv_world_get_all_plugins(const LilvWorld* world)
{
return world->plugins;
}
-
-LILV_API
-LilvPlugin
-lilv_world_get_plugin_by_uri_string(LilvWorld world,
- const char* uri)
-{
- LilvValue uri_val = lilv_value_new_uri(world, uri);
- LilvPlugin plugin = lilv_plugins_get_by_uri(world->plugins, uri_val);
- lilv_value_free(uri_val);
- return plugin;
-}
diff --git a/test/lilv_test.c b/test/lilv_test.c
index 3c1396a..3ebf128 100644
--- a/test/lilv_test.c
+++ b/test/lilv_test.c
@@ -38,7 +38,7 @@ static char bundle_dir_uri[TEST_PATH_MAX];
static char manifest_name[TEST_PATH_MAX];
static char content_name[TEST_PATH_MAX];
-static LilvWorld world;
+static LilvWorld* world;
int test_count = 0;
int error_count = 0;
@@ -162,7 +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, plugin2_uri_value;
+static LilvValue* plugin_uri_value;
+static LilvValue* plugin2_uri_value;
/*****************************************************************************/
@@ -214,10 +215,10 @@ test_value()
init_uris();
- LilvValue uval = lilv_value_new_uri(world, "http://example.org");
- LilvValue sval = lilv_value_new_string(world, "Foo");
- LilvValue ival = lilv_value_new_int(world, 42);
- LilvValue fval = lilv_value_new_float(world, 1.6180);
+ LilvValue* uval = lilv_value_new_uri(world, "http://example.org");
+ LilvValue* sval = lilv_value_new_string(world, "Foo");
+ LilvValue* ival = lilv_value_new_int(world, 42);
+ LilvValue* fval = lilv_value_new_float(world, 1.6180);
TEST_ASSERT(lilv_value_is_uri(uval));
TEST_ASSERT(lilv_value_is_string(sval));
@@ -247,14 +248,14 @@ test_value()
TEST_ASSERT(!strncmp(tok, "1.6180", 6));
free(tok);
- LilvValue uval_e = lilv_value_new_uri(world, "http://example.org");
- LilvValue sval_e = lilv_value_new_string(world, "Foo");
- LilvValue ival_e = lilv_value_new_int(world, 42);
- LilvValue fval_e = lilv_value_new_float(world, 1.6180);
- LilvValue uval_ne = lilv_value_new_uri(world, "http://no-example.org");
- LilvValue sval_ne = lilv_value_new_string(world, "Bar");
- LilvValue ival_ne = lilv_value_new_int(world, 24);
- LilvValue fval_ne = lilv_value_new_float(world, 3.14159);
+ LilvValue* uval_e = lilv_value_new_uri(world, "http://example.org");
+ LilvValue* sval_e = lilv_value_new_string(world, "Foo");
+ LilvValue* ival_e = lilv_value_new_int(world, 42);
+ LilvValue* fval_e = lilv_value_new_float(world, 1.6180);
+ LilvValue* uval_ne = lilv_value_new_uri(world, "http://no-example.org");
+ LilvValue* sval_ne = lilv_value_new_string(world, "Bar");
+ LilvValue* ival_ne = lilv_value_new_int(world, 24);
+ LilvValue* fval_ne = lilv_value_new_float(world, 3.14159);
TEST_ASSERT(lilv_value_equals(uval, uval_e));
TEST_ASSERT(lilv_value_equals(sval, sval_e));
@@ -270,19 +271,19 @@ test_value()
TEST_ASSERT(!lilv_value_equals(sval, ival));
TEST_ASSERT(!lilv_value_equals(ival, fval));
- LilvValue uval_dup = lilv_value_duplicate(uval);
+ LilvValue* uval_dup = lilv_value_duplicate(uval);
TEST_ASSERT(lilv_value_equals(uval, uval_dup));
- LilvValue ifval = lilv_value_new_float(world, 42.0);
+ LilvValue* ifval = lilv_value_new_float(world, 42.0);
TEST_ASSERT(!lilv_value_equals(ival, ifval));
lilv_value_free(ifval);
- LilvValue nil = NULL;
+ 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);
+ LilvValue* nil2 = lilv_value_duplicate(nil);
TEST_ASSERT(lilv_value_equals(nil, nil2));
lilv_value_free(uval);
@@ -309,11 +310,11 @@ test_value()
static int discovery_plugin_found = 0;
static void
-discovery_verify_plugin(LilvPlugin plugin)
+discovery_verify_plugin(const LilvPlugin* plugin)
{
- LilvValue value = lilv_plugin_get_uri(plugin);
+ const LilvValue* value = lilv_plugin_get_uri(plugin);
if (lilv_value_equals(value, plugin_uri_value)) {
- LilvValue lib_uri = NULL;
+ const LilvValue* lib_uri = NULL;
TEST_ASSERT(!lilv_value_equals(value, plugin2_uri_value));
discovery_plugin_found = 1;
lib_uri = lilv_plugin_get_library_uri(plugin);
@@ -340,16 +341,16 @@ test_discovery()
init_uris();
- LilvPlugins plugins = lilv_world_get_all_plugins(world);
+ const LilvPlugins* plugins = lilv_world_get_all_plugins(world);
TEST_ASSERT(lilv_plugins_size(plugins) > 0);
- LilvPlugin explug = lilv_plugins_get_by_uri(plugins, plugin_uri_value);
+ const const LilvPlugin* explug = lilv_plugins_get_by_uri(plugins, plugin_uri_value);
TEST_ASSERT(explug != NULL);
- LilvPlugin explug2 = lilv_plugins_get_by_uri(plugins, plugin2_uri_value);
+ const const LilvPlugin* explug2 = lilv_plugins_get_by_uri(plugins, plugin2_uri_value);
TEST_ASSERT(explug2 == NULL);
if (explug) {
- LilvValue name = lilv_plugin_get_name(explug);
+ LilvValue* name = lilv_plugin_get_name(explug);
TEST_ASSERT(!strcmp(lilv_value_as_string(name), "Test plugin"));
lilv_value_free(name);
}
@@ -382,8 +383,8 @@ test_verify()
return 0;
init_uris();
- LilvPlugins plugins = lilv_world_get_all_plugins(world);
- LilvPlugin explug = lilv_plugins_get_by_uri(plugins, plugin_uri_value);
+ const LilvPlugins* plugins = lilv_world_get_all_plugins(world);
+ const const LilvPlugin* explug = lilv_plugins_get_by_uri(plugins, plugin_uri_value);
TEST_ASSERT(explug);
TEST_ASSERT(lilv_plugin_verify(explug));
cleanup_uris();
@@ -402,8 +403,8 @@ test_no_verify()
return 0;
init_uris();
- LilvPlugins plugins = lilv_world_get_all_plugins(world);
- LilvPlugin explug = lilv_plugins_get_by_uri(plugins, plugin_uri_value);
+ const LilvPlugins* plugins = lilv_world_get_all_plugins(world);
+ const LilvPlugin* explug = lilv_plugins_get_by_uri(plugins, plugin_uri_value);
TEST_ASSERT(explug);
TEST_ASSERT(!lilv_plugin_verify(explug));
cleanup_uris();
@@ -428,9 +429,9 @@ test_classes()
return 0;
init_uris();
- LilvPluginClass plugin = lilv_world_get_plugin_class(world);
- LilvPluginClasses classes = lilv_world_get_plugin_classes(world);
- LilvPluginClasses children = lilv_plugin_class_get_children(plugin);
+ const LilvPluginClass* plugin = lilv_world_get_plugin_class(world);
+ const LilvPluginClasses* classes = lilv_world_get_plugin_classes(world);
+ LilvPluginClasses* children = lilv_plugin_class_get_children(plugin);
TEST_ASSERT(lilv_plugin_class_get_parent_uri(plugin) == NULL);
TEST_ASSERT(lilv_plugin_classes_size(classes) > lilv_plugin_classes_size(children));
@@ -444,7 +445,7 @@ test_classes()
lilv_plugin_class_get_uri(plugin)));
}
- LilvValue some_uri = lilv_value_new_uri(world, "http://example.org/whatever");
+ LilvValue* some_uri = lilv_value_new_uri(world, "http://example.org/whatever");
TEST_ASSERT(lilv_plugin_classes_get_by_uri(classes, some_uri) == NULL);
lilv_value_free(some_uri);
@@ -489,19 +490,19 @@ test_plugin()
return 0;
init_uris();
- LilvPlugins plugins = lilv_world_get_all_plugins(world);
- LilvPlugin plug = lilv_plugins_get_by_uri(plugins, plugin_uri_value);
+ const LilvPlugins* plugins = lilv_world_get_all_plugins(world);
+ const LilvPlugin* plug = lilv_plugins_get_by_uri(plugins, plugin_uri_value);
TEST_ASSERT(plug);
- LilvPluginClass class = lilv_plugin_get_class(plug);
- LilvValue class_uri = lilv_plugin_class_get_uri(class);
+ 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),
"http://lv2plug.in/ns/lv2core#CompressorPlugin"));
- LilvValue plug_bundle_uri = lilv_plugin_get_bundle_uri(plug);
+ const LilvValue* plug_bundle_uri = lilv_plugin_get_bundle_uri(plug);
TEST_ASSERT(!strcmp(lilv_value_as_string(plug_bundle_uri), bundle_dir_uri));
- LilvValues data_uris = lilv_plugin_get_data_uris(plug);
+ const LilvValues* data_uris = lilv_plugin_get_data_uris(plug);
TEST_ASSERT(lilv_values_size(data_uris) == 2);
char* manifest_uri = (char*)malloc(TEST_PATH_MAX);
@@ -511,11 +512,11 @@ test_plugin()
snprintf(data_uri, TEST_PATH_MAX, "%s%s",
lilv_value_as_string(plug_bundle_uri), "plugin.ttl");
- LilvValue manifest_uri_val = lilv_value_new_uri(world, manifest_uri);
+ LilvValue* manifest_uri_val = lilv_value_new_uri(world, manifest_uri);
TEST_ASSERT(lilv_values_contains(data_uris, manifest_uri_val));
lilv_value_free(manifest_uri_val);
- LilvValue data_uri_val = lilv_value_new_uri(world, data_uri);
+ LilvValue* data_uri_val = lilv_value_new_uri(world, data_uri);
TEST_ASSERT(lilv_values_contains(data_uris, data_uri_val));
lilv_value_free(data_uri_val);
@@ -530,13 +531,13 @@ test_plugin()
TEST_ASSERT(maxs[0] == 1.0f);
TEST_ASSERT(defs[0] == 0.5f);
- LilvValue audio_class = lilv_value_new_uri(world,
+ LilvValue* audio_class = lilv_value_new_uri(world,
"http://lv2plug.in/ns/lv2core#AudioPort");
- LilvValue control_class = lilv_value_new_uri(world,
+ LilvValue* control_class = lilv_value_new_uri(world,
"http://lv2plug.in/ns/lv2core#ControlPort");
- LilvValue in_class = lilv_value_new_uri(world,
+ LilvValue* in_class = lilv_value_new_uri(world,
"http://lv2plug.in/ns/lv2core#InputPort");
- LilvValue out_class = lilv_value_new_uri(world,
+ LilvValue* out_class = lilv_value_new_uri(world,
"http://lv2plug.in/ns/lv2core#OutputPort");
TEST_ASSERT(lilv_plugin_get_num_ports_of_class(plug, control_class, NULL) == 3);
@@ -551,11 +552,11 @@ test_plugin()
TEST_ASSERT(lilv_plugin_has_latency(plug));
TEST_ASSERT(lilv_plugin_get_latency_port_index(plug) == 2);
- LilvValue rt_feature = lilv_value_new_uri(world,
+ LilvValue* rt_feature = lilv_value_new_uri(world,
"http://lv2plug.in/ns/lv2core#hardRTCapable");
- LilvValue event_feature = lilv_value_new_uri(world,
+ LilvValue* event_feature = lilv_value_new_uri(world,
"http://lv2plug.in/ns/ext/event");
- LilvValue pretend_feature = lilv_value_new_uri(world,
+ LilvValue* pretend_feature = lilv_value_new_uri(world,
"http://example.org/solvesWorldHunger");
TEST_ASSERT(lilv_plugin_has_feature(plug, rt_feature));
@@ -566,9 +567,9 @@ test_plugin()
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);
+ 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);
@@ -576,49 +577,49 @@ test_plugin()
lilv_values_free(required);
lilv_values_free(optional);
- LilvValue foo_p = lilv_value_new_uri(world, "http://example.org/foo");
- LilvValues foos = lilv_plugin_get_value(plug, foo_p);
+ LilvValue* foo_p = lilv_value_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_value_new_uri(world, "http://example.org/bar");
- LilvValues bars = lilv_plugin_get_value(plug, bar_p);
+ LilvValue* bar_p = lilv_value_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_value_new_uri(world, "http://example.org/baz");
- LilvValues bazs = lilv_plugin_get_value(plug, baz_p);
+ LilvValue* baz_p = lilv_value_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);
+ 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);
+ 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);
+ 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_value_new_uri(world, "http://example.org/thing");
- LilvValue name_p = lilv_value_new_uri(world, "http://usefulinc.com/ns/doap#name");
- LilvValues thing_names = lilv_plugin_get_value_for_subject(plug, thing_uri, name_p);
+ LilvValue* thing_uri = lilv_value_new_uri(world, "http://example.org/thing");
+ LilvValue* name_p = lilv_value_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);
+ LilvValue* thing_name = lilv_values_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"));
- LilvUIs uis = lilv_plugin_get_uis(plug);
+ LilvUIs* uis = lilv_plugin_get_uis(plug);
TEST_ASSERT(lilv_uis_size(uis) == 0);
lilv_uis_free(uis);
@@ -664,28 +665,28 @@ test_port()
return 0;
init_uris();
- LilvPlugins plugins = lilv_world_get_all_plugins(world);
- LilvPlugin plug = lilv_plugins_get_by_uri(plugins, plugin_uri_value);
+ const LilvPlugins* plugins = lilv_world_get_all_plugins(world);
+ const LilvPlugin* plug = lilv_plugins_get_by_uri(plugins, plugin_uri_value);
TEST_ASSERT(plug);
- LilvValue psym = lilv_value_new_string(world, "foo");
- LilvPort p = lilv_plugin_get_port_by_index(plug, 0);
- LilvPort p2 = lilv_plugin_get_port_by_symbol(plug, psym);
+ LilvValue* psym = lilv_value_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);
TEST_ASSERT(p != NULL);
TEST_ASSERT(p2 != NULL);
TEST_ASSERT(p == p2);
- LilvValue nopsym = lilv_value_new_string(world, "thisaintnoportfoo");
- LilvPort p3 = lilv_plugin_get_port_by_symbol(plug, nopsym);
+ LilvValue* nopsym = lilv_value_new_string(world, "thisaintnoportfoo");
+ const LilvPort* p3 = lilv_plugin_get_port_by_symbol(plug, nopsym);
TEST_ASSERT(p3 == NULL);
lilv_value_free(nopsym);
- LilvValue audio_class = lilv_value_new_uri(world,
+ LilvValue* audio_class = lilv_value_new_uri(world,
"http://lv2plug.in/ns/lv2core#AudioPort");
- LilvValue control_class = lilv_value_new_uri(world,
+ LilvValue* control_class = lilv_value_new_uri(world,
"http://lv2plug.in/ns/lv2core#ControlPort");
- LilvValue in_class = lilv_value_new_uri(world,
+ LilvValue* in_class = lilv_value_new_uri(world,
"http://lv2plug.in/ns/lv2core#InputPort");
TEST_ASSERT(lilv_values_size(lilv_port_get_classes(plug, p)) == 2);
@@ -694,13 +695,13 @@ test_port()
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);
+ LilvValues* port_properties = lilv_port_get_properties(plug, p);
TEST_ASSERT(lilv_values_size(port_properties) == 1);
lilv_values_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);
+ LilvValue* name = lilv_port_get_name(plug, p);
TEST_ASSERT(!strcmp(lilv_value_as_string(name), "store"));
lilv_value_free(name);
@@ -731,14 +732,14 @@ test_port()
setenv("LANG", "C", 1); // Reset locale
- LilvScalePoints points = lilv_port_get_scale_points(plug, p);
+ LilvScalePoints* points = lilv_port_get_scale_points(plug, p);
TEST_ASSERT(lilv_scale_points_size(points) == 2);
- LilvIter sp_iter = lilv_scale_points_begin(points);
- LilvScalePoint sp0 = lilv_scale_points_get(points, sp_iter);
+ LilvIter* sp_iter = lilv_scale_points_begin(points);
+ const LilvScalePoint* sp0 = lilv_scale_points_get(points, sp_iter);
TEST_ASSERT(sp0);
lilv_scale_points_next(points, sp_iter);
- LilvScalePoint sp1 = lilv_scale_points_get(points, sp_iter);
+ 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"));
@@ -746,13 +747,13 @@ test_port()
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);
- LilvValue homepage_p = lilv_value_new_uri(world, "http://usefulinc.com/ns/doap#homepage");
- LilvValues homepages = lilv_plugin_get_value(plug, homepage_p);
+ LilvValue* homepage_p = lilv_value_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)),
"http://example.org/someplug"));
- LilvValue min, max, def;
+ LilvValue *min, *max, *def;
lilv_port_get_range(plug, p, &def, &min, &max);
TEST_ASSERT(def);
TEST_ASSERT(min);
@@ -761,28 +762,28 @@ test_port()
TEST_ASSERT(lilv_value_as_float(min) == -1.0);
TEST_ASSERT(lilv_value_as_float(max) == 1.0);
- LilvValue integer_prop = lilv_value_new_uri(world, "http://lv2plug.in/ns/lv2core#integer");
- LilvValue toggled_prop = lilv_value_new_uri(world, "http://lv2plug.in/ns/lv2core#toggled");
+ LilvValue* integer_prop = lilv_value_new_uri(world, "http://lv2plug.in/ns/lv2core#integer");
+ LilvValue* toggled_prop = lilv_value_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));
- LilvPort ep = lilv_plugin_get_port_by_index(plug, 1);
+ const LilvPort* ep = lilv_plugin_get_port_by_index(plug, 1);
- LilvValue event_type = lilv_value_new_uri(world, "http://example.org/event");
- LilvValue event_type_2 = lilv_value_new_uri(world, "http://example.org/otherEvent");
+ LilvValue* event_type = lilv_value_new_uri(world, "http://example.org/event");
+ LilvValue* event_type_2 = lilv_value_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_value_new_uri(world, "http://lv2plug.in/ns/lv2core#name");
- LilvValues names = lilv_port_get_value(plug, p, name_p);
+ LilvValue* name_p = lilv_value_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)),
"store"));
lilv_values_free(names);
- LilvValue true_val = lilv_value_new_bool(world, true);
- LilvValue false_val = lilv_value_new_bool(world, false);
+ LilvValue* true_val = lilv_value_new_bool(world, true);
+ LilvValue* false_val = lilv_value_new_bool(world, false);
lilv_world_set_option(world, LILV_OPTION_FILTER_LANG, false_val);
names = lilv_port_get_value(plug, p, name_p);
@@ -859,53 +860,53 @@ test_ui()
return 0;
init_uris();
- LilvPlugins plugins = lilv_world_get_all_plugins(world);
- LilvPlugin plug = lilv_plugins_get_by_uri(plugins, plugin_uri_value);
+ const LilvPlugins* plugins = lilv_world_get_all_plugins(world);
+ const LilvPlugin* plug = lilv_plugins_get_by_uri(plugins, plugin_uri_value);
TEST_ASSERT(plug);
- LilvUIs uis = lilv_plugin_get_uis(plug);
+ LilvUIs* uis = lilv_plugin_get_uis(plug);
TEST_ASSERT(lilv_uis_size(uis) == 4);
- LilvUI ui0 = lilv_uis_get(uis, lilv_uis_begin(uis));
+ const LilvUI* ui0 = lilv_uis_get(uis, lilv_uis_begin(uis));
TEST_ASSERT(ui0);
- LilvValue ui_uri = lilv_value_new_uri(world, "http://example.org/ui");
- LilvValue ui2_uri = lilv_value_new_uri(world, "http://example.org/ui3");
- LilvValue ui3_uri = lilv_value_new_uri(world, "http://example.org/ui4");
- LilvValue noui_uri = lilv_value_new_uri(world, "http://example.org/notaui");
+ LilvValue* ui_uri = lilv_value_new_uri(world, "http://example.org/ui");
+ LilvValue* ui2_uri = lilv_value_new_uri(world, "http://example.org/ui3");
+ LilvValue* ui3_uri = lilv_value_new_uri(world, "http://example.org/ui4");
+ LilvValue* noui_uri = lilv_value_new_uri(world, "http://example.org/notaui");
- LilvUI ui0_2 = lilv_uis_get_by_uri(uis, ui_uri);
+ const LilvUI* ui0_2 = lilv_uis_get_by_uri(uis, ui_uri);
TEST_ASSERT(ui0 == ui0_2);
- LilvUI ui2 = lilv_uis_get_by_uri(uis, ui2_uri);
+ const LilvUI* ui2 = lilv_uis_get_by_uri(uis, ui2_uri);
TEST_ASSERT(ui2 != ui0);
- LilvUI ui3 = lilv_uis_get_by_uri(uis, ui3_uri);
+ const LilvUI* ui3 = lilv_uis_get_by_uri(uis, ui3_uri);
TEST_ASSERT(ui3 != ui0);
- LilvUI noui = lilv_uis_get_by_uri(uis, noui_uri);
+ const LilvUI* noui = lilv_uis_get_by_uri(uis, noui_uri);
TEST_ASSERT(noui == NULL);
- LilvValues classes = lilv_ui_get_classes(ui0);
+ const LilvValues* classes = lilv_ui_get_classes(ui0);
TEST_ASSERT(lilv_values_size(classes) == 1);
- LilvValue ui_class_uri = lilv_value_new_uri(world,
+ LilvValue* ui_class_uri = lilv_value_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_ui_is_a(ui0, ui_class_uri));
- LilvValue plug_bundle_uri = lilv_plugin_get_bundle_uri(plug);
- LilvValue ui_bundle_uri = lilv_ui_get_bundle_uri(ui0);
+ 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));
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");
- LilvValue ui_binary_uri = lilv_ui_get_binary_uri(ui0);
+ const LilvValue* ui_binary_uri = lilv_ui_get_binary_uri(ui0);
- LilvValue expected_uri = lilv_value_new_uri(world, ui_binary_uri_str);
+ LilvValue* expected_uri = lilv_value_new_uri(world, ui_binary_uri_str);
TEST_ASSERT(lilv_value_equals(expected_uri, ui_binary_uri));
free(ui_binary_uri_str);
diff --git a/utils/lilv_bench.c b/utils/lilv_bench.c
index 2920fb5..b9e72db 100644
--- a/utils/lilv_bench.c
+++ b/utils/lilv_bench.c
@@ -40,12 +40,12 @@ print_usage()
int
main(int argc, char** argv)
{
- LilvWorld world = lilv_world_new();
+ LilvWorld* world = lilv_world_new();
lilv_world_load_all(world);
- LilvPlugins plugins = lilv_world_get_all_plugins(world);
+ const LilvPlugins* plugins = lilv_world_get_all_plugins(world);
LILV_FOREACH(plugins, p, plugins) {
- LilvPlugin plugin = lilv_plugins_get(plugins, p);
+ const LilvPlugin* plugin = lilv_plugins_get(plugins, p);
lilv_plugin_get_class(plugin);
}
diff --git a/utils/lv2_inspect.c b/utils/lv2_inspect.c
index e9b7cf5..453f37f 100644
--- a/utils/lv2_inspect.c
+++ b/utils/lv2_inspect.c
@@ -24,15 +24,18 @@
#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* event_class = NULL;
+LilvValue* control_class = NULL;
+LilvValue* in_group_pred = NULL;
+LilvValue* role_pred = NULL;
+LilvValue* preset_pred = NULL;
+LilvValue* title_pred = NULL;
void
-print_group(LilvPlugin p, LilvValue group, LilvValue type, LilvValue symbol)
+print_group(const LilvPlugin* p,
+ const LilvValue* group,
+ LilvValue* type,
+ LilvValue* symbol)
{
printf("\n\tGroup %s:\n", lilv_value_as_string(group));
printf("\t\tType: %s\n", lilv_value_as_string(type));
@@ -40,9 +43,13 @@ print_group(LilvPlugin p, LilvValue group, LilvValue type, LilvValue symbol)
}
void
-print_port(LilvPlugin p, uint32_t index, float* mins, float* maxes, float* defaults)
+print_port(const LilvPlugin* p,
+ uint32_t index,
+ float* mins,
+ float* maxes,
+ float* defaults)
{
- LilvPort port = lilv_plugin_get_port_by_index(p, index);
+ const LilvPort* port = lilv_plugin_get_port_by_index(p, index);
printf("\n\tPort %d:\n", index);
@@ -53,10 +60,10 @@ print_port(LilvPlugin p, uint32_t index, float* mins, float* maxes, float* defau
bool first = true;
- LilvValues classes = lilv_port_get_classes(p, port);
+ const LilvValues* classes = lilv_port_get_classes(p, port);
printf("\t\tType: ");
LILV_FOREACH(values, i, classes) {
- LilvValue value = lilv_values_get(classes, i);
+ const LilvValue* value = lilv_values_get(classes, i);
if (!first) {
printf("\n\t\t ");
}
@@ -65,44 +72,44 @@ print_port(LilvPlugin p, uint32_t index, float* mins, float* maxes, float* defau
}
if (lilv_port_is_a(p, port, event_class)) {
- LilvValues supported = lilv_port_get_value_by_qname(p, port,
+ LilvValues* supported = lilv_port_get_value_by_qname(p, port,
"lv2ev:supportsEvent");
if (lilv_values_size(supported) > 0) {
printf("\n\t\tSupported events:\n");
LILV_FOREACH(values, i, supported) {
- LilvValue value = lilv_values_get(supported, i);
+ const LilvValue* value = lilv_values_get(supported, i);
printf("\t\t\t%s\n", lilv_value_as_uri(value));
}
}
lilv_values_free(supported);
}
- LilvScalePoints points = lilv_port_get_scale_points(p, port);
+ LilvScalePoints* points = lilv_port_get_scale_points(p, port);
if (points)
printf("\n\t\tScale Points:\n");
LILV_FOREACH(scale_points, i, points) {
- LilvScalePoint p = lilv_scale_points_get(points, i);
+ 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_scale_points_free(points);
- LilvValue val = lilv_port_get_symbol(p, port);
- printf("\n\t\tSymbol: %s\n", lilv_value_as_string(val));
+ const LilvValue* sym = lilv_port_get_symbol(p, port);
+ printf("\n\t\tSymbol: %s\n", lilv_value_as_string(sym));
- val = lilv_port_get_name(p, port);
- printf("\t\tName: %s\n", lilv_value_as_string(val));
- lilv_value_free(val);
+ LilvValue* name = lilv_port_get_name(p, port);
+ printf("\t\tName: %s\n", lilv_value_as_string(name));
+ lilv_value_free(name);
- LilvValues groups = lilv_port_get_value(p, port, in_group_pred);
+ LilvValues* groups = lilv_port_get_value(p, port, in_group_pred);
if (lilv_values_size(groups) > 0)
printf("\t\tGroup: %s\n",
lilv_value_as_string(
lilv_values_get(groups, lilv_values_begin(groups))));
lilv_values_free(groups);
- LilvValues roles = lilv_port_get_value(p, port, role_pred);
+ LilvValues* roles = lilv_port_get_value(p, port, role_pred);
if (lilv_values_size(roles) > 0)
printf("\t\tRole: %s\n",
lilv_value_as_string(
@@ -118,7 +125,7 @@ print_port(LilvPlugin p, uint32_t index, float* mins, float* maxes, float* defau
printf("\t\tDefault: %f\n", defaults[index]);
}
- LilvValues properties = lilv_port_get_properties(p, port);
+ LilvValues* properties = lilv_port_get_properties(p, port);
if (lilv_values_size(properties) > 0)
printf("\t\tProperties: ");
first = true;
@@ -135,9 +142,9 @@ print_port(LilvPlugin p, uint32_t index, float* mins, float* maxes, float* defau
}
void
-print_plugin(LilvPlugin p)
+print_plugin(const LilvPlugin* p)
{
- LilvValue val = NULL;
+ LilvValue* val = NULL;
printf("%s\n\n", lilv_value_as_uri(lilv_plugin_get_uri(p)));
@@ -147,7 +154,8 @@ print_plugin(LilvPlugin p)
lilv_value_free(val);
}
- LilvValue class_label = lilv_plugin_class_get_label(lilv_plugin_get_class(p));
+ const LilvPluginClass* pclass = lilv_plugin_get_class(p);
+ const LilvValue* class_label = lilv_plugin_class_get_label(pclass);
if (class_label) {
printf("\tClass: %s\n", lilv_value_as_string(class_label));
}
@@ -180,22 +188,22 @@ print_plugin(LilvPlugin p)
printf("\tBundle: %s\n",
lilv_value_as_uri(lilv_plugin_get_bundle_uri(p)));
- LilvValue binary_uri = lilv_plugin_get_library_uri(p);
+ const LilvValue* 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)));
}
- LilvUIs uis = lilv_plugin_get_uis(p);
+ LilvUIs* uis = lilv_plugin_get_uis(p);
if (lilv_values_size(uis) > 0) {
printf("\tUI: ");
LILV_FOREACH(uis, i, uis) {
- LilvUI ui = lilv_uis_get(uis, i);
+ const LilvUI* ui = lilv_uis_get(uis, i);
printf("%s\n", lilv_value_as_uri(lilv_ui_get_uri(ui)));
const char* binary = lilv_value_as_uri(lilv_ui_get_binary_uri(ui));
- LilvValues types = lilv_ui_get_classes(ui);
+ const LilvValues* types = lilv_ui_get_classes(ui);
LILV_FOREACH(values, i, types) {
printf("\t Class: %s\n",
lilv_value_as_uri(lilv_values_get(types, i)));
@@ -211,7 +219,7 @@ print_plugin(LilvPlugin p)
lilv_uis_free(uis);
printf("\tData URIs: ");
- LilvValues data_uris = lilv_plugin_get_data_uris(p);
+ const LilvValues* data_uris = lilv_plugin_get_data_uris(p);
bool first = true;
LILV_FOREACH(values, i, data_uris) {
if (!first) {
@@ -224,7 +232,7 @@ print_plugin(LilvPlugin p)
/* Required Features */
- LilvValues features = lilv_plugin_get_required_features(p);
+ LilvValues* features = lilv_plugin_get_required_features(p);
if (features)
printf("\tRequired Features: ");
first = true;
@@ -258,14 +266,14 @@ print_plugin(LilvPlugin p)
/* Presets */
- LilvValues presets = lilv_plugin_get_value(p, preset_pred);
+ LilvValues* 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(
+ LilvValues* titles = lilv_plugin_get_value_for_subject(
p, lilv_values_get(presets, i), title_pred);
if (titles) {
- LilvValue title = lilv_values_get(titles, lilv_values_begin(titles));
+ const LilvValue* title = lilv_values_get(titles, lilv_values_begin(titles));
printf("\t %s\n", lilv_value_as_string(title));
}
}
@@ -310,7 +318,7 @@ main(int argc, char** argv)
int ret = 0;
setlocale (LC_ALL, "");
- LilvWorld world = lilv_world_new();
+ LilvWorld* world = lilv_world_new();
lilv_world_load_all(world);
#define NS_DC "http://dublincore.org/documents/dcmi-namespace/"
@@ -344,10 +352,10 @@ main(int argc, char** argv)
goto done;
}
- LilvPlugins plugins = lilv_world_get_all_plugins(world);
- LilvValue uri = lilv_value_new_uri(world, argv[1]);
+ const LilvPlugins* plugins = lilv_world_get_all_plugins(world);
+ LilvValue* uri = lilv_value_new_uri(world, argv[1]);
- LilvPlugin p = lilv_plugins_get_by_uri(plugins, uri);
+ const LilvPlugin* p = lilv_plugins_get_by_uri(plugins, uri);
if (p) {
print_plugin(p);
diff --git a/utils/lv2_jack_host.c b/utils/lv2_jack_host.c
index 20c9ad7..1bdfe61 100644
--- a/utils/lv2_jack_host.c
+++ b/utils/lv2_jack_host.c
@@ -51,28 +51,28 @@ enum PortType {
};
struct Port {
- LilvPort lilv_port;
- enum PortType type;
- jack_port_t* jack_port; /**< For audio/MIDI ports, otherwise NULL */
- float control; /**< For control ports, otherwise 0.0f */
- LV2_Event_Buffer* ev_buffer; /**< For MIDI ports, otherwise NULL */
- bool is_input;
+ const LilvPort* lilv_port;
+ enum PortType type;
+ jack_port_t* jack_port; /**< For audio/MIDI ports, otherwise NULL */
+ float control; /**< For control ports, otherwise 0.0f */
+ LV2_Event_Buffer* ev_buffer; /**< For MIDI ports, otherwise NULL */
+ bool is_input;
};
/** This program's data */
struct JackHost {
- jack_client_t* jack_client; /**< Jack client */
- LilvPlugin plugin; /**< Plugin "class" (actually just a few strings) */
- 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 */
+ jack_client_t* jack_client; /**< Jack client */
+ const LilvPlugin* plugin; /**< Plugin "class" (actually just a few strings) */
+ 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 */
};
/** 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 */
- LilvValue symbol = lilv_port_get_symbol(host->plugin, port->lilv_port);
- const char* symbol_str = lilv_value_as_string(symbol);
+ const LilvValue* symbol = lilv_port_get_symbol(host->plugin, port->lilv_port);
+ const char* symbol_str = lilv_value_as_string(symbol);
enum JackPortFlags jack_flags = 0;
if (lilv_port_is_a(host->plugin, port->lilv_port, host->input_class)) {
@@ -305,9 +305,9 @@ main(int argc, char** argv)
signal(SIGTERM, signal_handler);
/* Find all installed plugins */
- LilvWorld world = lilv_world_new();
+ LilvWorld* world = lilv_world_new();
lilv_world_load_all(world);
- LilvPlugins plugins = lilv_world_get_all_plugins(world);
+ const LilvPlugins* plugins = lilv_world_get_all_plugins(world);
/* Set up the port classes this app supports */
host.input_class = lilv_value_new_uri(world, LILV_PORT_CLASS_INPUT);
@@ -334,7 +334,7 @@ main(int argc, char** argv)
printf("Plugin: %s\n", plugin_uri_str);
- LilvValue plugin_uri = lilv_value_new_uri(world, plugin_uri_str);
+ LilvValue* plugin_uri = lilv_value_new_uri(world, plugin_uri_str);
host.plugin = lilv_plugins_get_by_uri(plugins, plugin_uri);
lilv_value_free(plugin_uri);
@@ -345,7 +345,7 @@ main(int argc, char** argv)
}
/* Get the plugin's name */
- LilvValue name = lilv_plugin_get_name(host.plugin);
+ LilvValue* name = lilv_plugin_get_name(host.plugin);
const char* name_str = lilv_value_as_string(name);
/* Truncate plugin name to suit JACK (if necessary) */
diff --git a/utils/lv2_list.c b/utils/lv2_list.c
index 34d8670..471c1bd 100644
--- a/utils/lv2_list.c
+++ b/utils/lv2_list.c
@@ -23,12 +23,12 @@
#include "lilv-config.h"
void
-list_plugins(LilvPlugins list, bool show_names)
+list_plugins(const LilvPlugins* list, bool show_names)
{
LILV_FOREACH(plugins, i, list) {
- LilvPlugin p = lilv_plugins_get(list, i);
+ const LilvPlugin* p = lilv_plugins_get(list, i);
if (show_names) {
- LilvValue n = lilv_plugin_get_name(p);
+ LilvValue* n = lilv_plugin_get_name(p);
printf("%s\n", lilv_value_as_string(n));
lilv_value_free(n);
} else {
@@ -81,10 +81,10 @@ main(int argc, char** argv)
}
}
- LilvWorld world = lilv_world_new();
+ LilvWorld* world = lilv_world_new();
lilv_world_load_all(world);
- LilvPlugins plugins = lilv_world_get_all_plugins(world);
+ const LilvPlugins* plugins = lilv_world_get_all_plugins(world);
list_plugins(plugins, show_names);