diff options
author | David Robillard <d@drobilla.net> | 2011-04-28 06:02:12 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-04-28 06:02:12 +0000 |
commit | 2a16021425dab995e902d133b060ebcf6c59a00c (patch) | |
tree | 042783cc69184323d799da5db497461d108f6a89 /utils | |
parent | 00ceff504269034db8e1bfb54a97b5732c2dadce (diff) | |
download | lilv-2a16021425dab995e902d133b060ebcf6c59a00c.tar.gz lilv-2a16021425dab995e902d133b060ebcf6c59a00c.tar.bz2 lilv-2a16021425dab995e902d133b060ebcf6c59a00c.zip |
More future-proof collection APIs.
Make all iterator actions occur through a collection specific function.
Verbose, and a low of API, but allows for the possibility of different
collection implementation types (given a choice between verbosity and no type
safety, I'll take verbosity).
git-svn-id: http://svn.drobilla.net/lad/trunk/slv2@3211 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'utils')
-rw-r--r-- | utils/lv2_inspect.c | 20 | ||||
-rw-r--r-- | utils/lv2_list.c | 4 | ||||
-rw-r--r-- | utils/slv2_bench.c | 4 |
3 files changed, 13 insertions, 15 deletions
diff --git a/utils/lv2_inspect.c b/utils/lv2_inspect.c index 47204c3..5c7342d 100644 --- a/utils/lv2_inspect.c +++ b/utils/lv2_inspect.c @@ -55,7 +55,7 @@ print_port(SLV2Plugin p, uint32_t index, float* mins, float* maxes, float* defau SLV2Values classes = slv2_port_get_classes(p, port); printf("\t\tType: "); - SLV2_FOREACH(i, classes) { + SLV2_FOREACH(values, i, classes) { SLV2Value value = slv2_values_get(classes, i); if (!first) { printf("\n\t\t "); @@ -69,7 +69,7 @@ print_port(SLV2Plugin p, uint32_t index, float* mins, float* maxes, float* defau "lv2ev:supportsEvent"); if (slv2_values_size(supported) > 0) { printf("\n\t\tSupported events:\n"); - SLV2_FOREACH(i, supported) { + SLV2_FOREACH(values, i, supported) { SLV2Value value = slv2_values_get(supported, i); printf("\t\t\t%s\n", slv2_value_as_uri(value)); } @@ -80,7 +80,7 @@ print_port(SLV2Plugin p, uint32_t index, float* mins, float* maxes, float* defau SLV2ScalePoints points = slv2_port_get_scale_points(p, port); if (points) printf("\n\t\tScale Points:\n"); - SLV2_FOREACH(i, points) { + SLV2_FOREACH(scale_points, i, points) { SLV2ScalePoint p = slv2_scale_points_get(points, i); printf("\t\t\t%s = \"%s\"\n", slv2_value_as_string(slv2_scale_point_get_value(p)), @@ -122,7 +122,7 @@ print_port(SLV2Plugin p, uint32_t index, float* mins, float* maxes, float* defau if (slv2_values_size(properties) > 0) printf("\t\tProperties: "); first = true; - SLV2_FOREACH(i, properties) { + SLV2_FOREACH(values, i, properties) { if (!first) { printf("\t\t "); } @@ -189,14 +189,14 @@ print_plugin(SLV2Plugin p) SLV2UIs uis = slv2_plugin_get_uis(p); if (slv2_values_size(uis) > 0) { printf("\tUI: "); - SLV2_FOREACH(i, uis) { + SLV2_FOREACH(uis, i, uis) { SLV2UI ui = slv2_uis_get(uis, i); printf("%s\n", slv2_value_as_uri(slv2_ui_get_uri(ui))); const char* binary = slv2_value_as_uri(slv2_ui_get_binary_uri(ui)); SLV2Values types = slv2_ui_get_classes(ui); - SLV2_FOREACH(i, types) { + SLV2_FOREACH(values, i, types) { printf("\t Class: %s\n", slv2_value_as_uri(slv2_values_get(types, i))); } @@ -213,7 +213,7 @@ print_plugin(SLV2Plugin p) printf("\tData URIs: "); SLV2Values data_uris = slv2_plugin_get_data_uris(p); bool first = true; - SLV2_FOREACH(i, data_uris) { + SLV2_FOREACH(values, i, data_uris) { if (!first) { printf("\n\t "); } @@ -228,7 +228,7 @@ print_plugin(SLV2Plugin p) if (features) printf("\tRequired Features: "); first = true; - SLV2_FOREACH(i, features) { + SLV2_FOREACH(values, i, features) { if (!first) { printf("\n\t "); } @@ -245,7 +245,7 @@ print_plugin(SLV2Plugin p) if (features) printf("\tOptional Features: "); first = true; - SLV2_FOREACH(i, features) { + SLV2_FOREACH(values, i, features) { if (!first) { printf("\n\t "); } @@ -261,7 +261,7 @@ print_plugin(SLV2Plugin p) SLV2Values presets = slv2_plugin_get_value(p, preset_pred); if (presets) printf("\tPresets: \n"); - SLV2_FOREACH(i, presets) { + SLV2_FOREACH(values, i, presets) { SLV2Values titles = slv2_plugin_get_value_for_subject( p, slv2_values_get(presets, i), title_pred); if (titles) { diff --git a/utils/lv2_list.c b/utils/lv2_list.c index 02779cc..d62699a 100644 --- a/utils/lv2_list.c +++ b/utils/lv2_list.c @@ -25,9 +25,7 @@ void list_plugins(SLV2Plugins list, bool show_names) { - for (SLV2Iter i = slv2_plugins_begin(list); - !slv2_iter_end(i); - i = slv2_iter_next(i)) { + SLV2_FOREACH(plugins, i, list) { SLV2Plugin p = slv2_plugins_get(list, i); if (show_names) { SLV2Value n = slv2_plugin_get_name(p); diff --git a/utils/slv2_bench.c b/utils/slv2_bench.c index a63b876..de1be4e 100644 --- a/utils/slv2_bench.c +++ b/utils/slv2_bench.c @@ -44,8 +44,8 @@ main(int argc, char** argv) slv2_world_load_all(world); SLV2Plugins plugins = slv2_world_get_all_plugins(world); - SLV2_FOREACH(p, plugins) { - SLV2Plugin plugin = slv2_collection_get(plugins, p); + SLV2_FOREACH(plugins, p, plugins) { + SLV2Plugin plugin = slv2_plugins_get(plugins, p); slv2_plugin_get_class(plugin); } |