diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/collections.c | 23 | ||||
-rw-r--r-- | src/plugin.c | 6 | ||||
-rw-r--r-- | src/pluginui.c | 2 | ||||
-rw-r--r-- | src/port.c | 2 | ||||
-rw-r--r-- | src/slv2_internal.h | 30 | ||||
-rw-r--r-- | src/world.c | 6 |
6 files changed, 48 insertions, 21 deletions
diff --git a/src/collections.c b/src/collections.c index 254d406..d8f5e1b 100644 --- a/src/collections.c +++ b/src/collections.c @@ -26,7 +26,6 @@ slv2_collection_new(GDestroyNotify destructor) return g_sequence_new(destructor); } -SLV2_API void slv2_collection_free(SLV2Collection coll) { @@ -34,14 +33,12 @@ slv2_collection_free(SLV2Collection coll) g_sequence_free((GSequence*)coll); } -SLV2_API unsigned slv2_collection_size(SLV2Collection coll) { return (coll ? g_sequence_get_length((GSequence*)coll) : 0); } -SLV2_API void* slv2_collection_get_at(SLV2Collection coll, unsigned index) { @@ -53,14 +50,12 @@ slv2_collection_get_at(SLV2Collection coll, unsigned index) } } -SLV2_API SLV2Iter slv2_collection_begin(SLV2Collection collection) { return collection ? g_sequence_get_begin_iter(collection) : NULL; } -SLV2_API void* slv2_collection_get(SLV2Collection collection, SLV2Iter i) @@ -70,14 +65,12 @@ slv2_collection_get(SLV2Collection collection, /* Constructors */ -SLV2_API SLV2ScalePoints slv2_scale_points_new(void) { return slv2_collection_new((GDestroyNotify)slv2_scale_point_free); } -SLV2_API SLV2Values slv2_values_new(void) { @@ -133,7 +126,7 @@ SLV2_API bool slv2_values_contains(SLV2Values list, SLV2Value value) { - SLV2_FOREACH(i, list) + SLV2_FOREACH(values, i, list) if (slv2_value_equals(slv2_values_get(list, i), value)) return true; @@ -142,14 +135,12 @@ slv2_values_contains(SLV2Values list, SLV2Value value) /* Iterator */ -SLV2_API SLV2Iter slv2_iter_next(SLV2Iter i) { return g_sequence_iter_next((GSequenceIter*)i); } -SLV2_API bool slv2_iter_end(SLV2Iter i) { @@ -175,6 +166,18 @@ prefix##_get(CT collection, SLV2Iter i) { \ return (ET)slv2_collection_get(collection, i); \ } \ \ +SLV2_API \ +SLV2Iter \ +prefix##_next(CT collection, SLV2Iter i) { \ + return slv2_iter_next(i); \ +} \ +\ +SLV2_API \ +bool \ +prefix##_is_end(CT collection, SLV2Iter i) { \ + return slv2_iter_end(i); \ +} \ +\ SLV2_DEPRECATED \ SLV2_API \ ET \ diff --git a/src/plugin.c b/src/plugin.c index 5de6a1a..d5c9880 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -140,7 +140,7 @@ static void slv2_plugin_load(SLV2Plugin p) { // Parse all the plugin's data files into RDF model - SLV2_FOREACH(i, p->data_uris) { + SLV2_FOREACH(values, i, p->data_uris) { SLV2Value data_uri_val = slv2_values_get(p->data_uris, i); sord_read_file(p->world->model, sord_node_get_string(data_uri_val->val.uri_val), @@ -641,10 +641,10 @@ slv2_plugin_get_supported_features(SLV2Plugin p) SLV2Values required = slv2_plugin_get_required_features(p); SLV2Values result = slv2_values_new(); - SLV2_FOREACH(i, optional) + SLV2_FOREACH(values, i, optional) slv2_array_append( result, slv2_value_duplicate(slv2_values_get(optional, i))); - SLV2_FOREACH(i, required) + SLV2_FOREACH(values, i, required) slv2_array_append( result, slv2_value_duplicate(slv2_values_get(required, i))); diff --git a/src/pluginui.c b/src/pluginui.c index 250ce42..3cb2439 100644 --- a/src/pluginui.c +++ b/src/pluginui.c @@ -89,7 +89,7 @@ slv2_ui_is_supported(SLV2UI ui, { #ifdef HAVE_SUIL SLV2Values classes = slv2_ui_get_classes(ui); - SLV2_FOREACH(c, classes) { + SLV2_FOREACH(values, c, classes) { SLV2Value type = slv2_values_get(classes, c); const unsigned q = supported_func(slv2_value_as_uri(container_type), slv2_value_as_uri(type)); @@ -48,7 +48,7 @@ slv2_port_is_a(SLV2Plugin plugin, SLV2Port port, SLV2Value port_class) { - SLV2_FOREACH(i, port->classes) + SLV2_FOREACH(values, i, port->classes) if (slv2_value_equals(slv2_values_get(port->classes, i), port_class)) return true; diff --git a/src/slv2_internal.h b/src/slv2_internal.h index e17eebd..2e89891 100644 --- a/src/slv2_internal.h +++ b/src/slv2_internal.h @@ -152,17 +152,35 @@ slv2_plugin_get_unique(SLV2Plugin p, SLV2Plugins slv2_plugins_new(); + +/** + Increment @a i to point at the next element in the collection. +*/ +SLV2Iter +slv2_iter_next(SLV2Iter i); + +/** + Return true iff @a i is at the end of the collection. +*/ +bool +slv2_iter_end(SLV2Iter i); + +SLV2Iter +slv2_collection_begin(SLV2Collection collection); + +void* +slv2_collection_get(SLV2Collection collection, + SLV2Iter i); + /** Free @a collection. */ -SLV2_API void slv2_collection_free(SLV2Collection collection); /** Get the number of elements in @a collection. */ -SLV2_API unsigned slv2_collection_size(SLV2Collection collection); @@ -181,11 +199,17 @@ slv2_collection_size(SLV2Collection collection); @return NULL if @a index is out of range. */ SLV2_DEPRECATED -SLV2_API void* slv2_collection_get_at(SLV2Collection collection, unsigned index); +SLV2Values +slv2_values_new(void); + +SLV2ScalePoints +slv2_scale_points_new(void); + + /* ********* Instance ********* */ /** Pimpl portion of SLV2Instance */ diff --git a/src/world.c b/src/world.c index e722024..6970598 100644 --- a/src/world.c +++ b/src/world.c @@ -157,7 +157,7 @@ slv2_world_free(SLV2World world) g_slist_free(world->specs); world->specs = NULL; - SLV2_FOREACH(i, world->plugins) { + SLV2_FOREACH(plugins, i, world->plugins) { SLV2Plugin p = slv2_plugins_get(world->plugins, i); slv2_plugin_free(p); } @@ -630,7 +630,7 @@ slv2_world_load_specifications(SLV2World world) { for (GSList* l = world->specs; l; l = l->next) { SLV2Spec spec = (SLV2Spec)l->data; - SLV2_FOREACH(f, spec->data_uris) { + SLV2_FOREACH(values, f, spec->data_uris) { SLV2Value file = slv2_collection_get(spec->data_uris, f); sord_read_file(world->model, (const uint8_t*)slv2_value_as_uri(file), @@ -718,7 +718,7 @@ slv2_world_load_all(SLV2World world) // Discover bundles and read all manifest files into model slv2_world_load_path(world, lv2_path); - SLV2_FOREACH(p, world->plugins) { + SLV2_FOREACH(plugins, p, world->plugins) { SLV2Plugin plugin = slv2_collection_get(world->plugins, p); SLV2Value plugin_uri = slv2_plugin_get_uri(plugin); |