diff options
author | David Robillard <d@drobilla.net> | 2011-02-12 05:25:15 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-02-12 05:25:15 +0000 |
commit | d573fec37c6c20ba12ec36ca2a188a65497511bd (patch) | |
tree | d39eba0a0aab4d759ef1477f7be9fa17044910d4 /utils/lv2_inspect.c | |
parent | 40b37f3b0fc9523e81bf7142fb02b61bb8a5eed9 (diff) | |
download | lilv-d573fec37c6c20ba12ec36ca2a188a65497511bd.tar.gz lilv-d573fec37c6c20ba12ec36ca2a188a65497511bd.tar.bz2 lilv-d573fec37c6c20ba12ec36ca2a188a65497511bd.zip |
Tidy up programs.
git-svn-id: http://svn.drobilla.net/lad/trunk/slv2@2933 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'utils/lv2_inspect.c')
-rw-r--r-- | utils/lv2_inspect.c | 64 |
1 files changed, 31 insertions, 33 deletions
diff --git a/utils/lv2_inspect.c b/utils/lv2_inspect.c index a63b5d0..7484d96 100644 --- a/utils/lv2_inspect.c +++ b/utils/lv2_inspect.c @@ -1,5 +1,5 @@ /* lv2_inspect - Display information about an LV2 plugin. - * Copyright (C) 2007-2009 David Robillard <drobilla.net> + * Copyright (C) 2007-2011 David Robillard <http://drobilla.net> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free @@ -16,18 +16,19 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include "slv2-config.h" -#include <stdlib.h> +#include <locale.h> +#include <math.h> #include <stdio.h> +#include <stdlib.h> #include <string.h> -#include <math.h> -#include <locale.h> #include "slv2/slv2.h" #ifdef SLV2_WITH_UI #include "slv2/ui.h" #endif +#include "slv2-config.h" + SLV2Value event_class = NULL; SLV2Value control_class = NULL; SLV2Value in_group_pred = NULL; @@ -58,7 +59,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: "); - for (unsigned i=0; i < slv2_values_size(classes); ++i) { + for (unsigned i = 0; i < slv2_values_size(classes); ++i) { printf("%s", slv2_value_as_uri(slv2_values_get_at(classes, i))); if (i != slv2_values_size(classes) - 1) printf("\n\t\t "); @@ -69,7 +70,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"); - for (unsigned i=0; i < slv2_values_size(supported); ++i) { + for (unsigned i = 0; i < slv2_values_size(supported); ++i) { printf("\t\t\t%s\n", slv2_value_as_uri(slv2_values_get_at(supported, i))); } } @@ -79,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"); - for (unsigned i=0; i < slv2_scale_points_size(points); ++i) { + for (unsigned i = 0; i < slv2_scale_points_size(points); ++i) { SLV2ScalePoint p = slv2_scale_points_get_at(points, i); printf("\t\t\t%s = \"%s\"\n", slv2_value_as_string(slv2_scale_point_get_value(p)), @@ -116,7 +117,7 @@ print_port(SLV2Plugin p, uint32_t index, float* mins, float* maxes, float* defau SLV2Values properties = slv2_port_get_properties(p, port); if (slv2_values_size(properties) > 0) printf("\t\tProperties: "); - for (unsigned i=0; i < slv2_values_size(properties); ++i) { + for (unsigned i = 0; i < slv2_values_size(properties); ++i) { if (i > 0) { printf("\t\t "); } @@ -177,14 +178,14 @@ print_plugin(SLV2Plugin p) SLV2UIs uis = slv2_plugin_get_uis(p); if (slv2_values_size(uis) > 0) { printf("\tGUI: "); - for (unsigned i=0; i < slv2_uis_size(uis); ++i) { + for (unsigned i = 0; i < slv2_uis_size(uis); ++i) { SLV2UI ui = slv2_uis_get_at(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); - for (unsigned i=0; i < slv2_values_size(types); ++i) { + for (unsigned i = 0; i < slv2_values_size(types); ++i) { printf("\t Class: %s\n", slv2_value_as_uri(slv2_values_get_at(types, i))); } @@ -201,7 +202,7 @@ print_plugin(SLV2Plugin p) printf("\tData URIs: "); SLV2Values data_uris = slv2_plugin_get_data_uris(p); - for (unsigned i=0; i < slv2_values_size(data_uris); ++i) { + for (unsigned i = 0; i < slv2_values_size(data_uris); ++i) { if (i > 0) { printf("\n\t "); } @@ -209,13 +210,12 @@ print_plugin(SLV2Plugin p) } printf("\n"); - /* Required Features */ SLV2Values features = slv2_plugin_get_required_features(p); if (features) printf("\tRequired Features: "); - for (unsigned i=0; i < slv2_values_size(features); ++i) { + for (unsigned i = 0; i < slv2_values_size(features); ++i) { if (i > 0) { printf("\n\t "); } @@ -225,13 +225,12 @@ print_plugin(SLV2Plugin p) printf("\n"); slv2_values_free(features); - /* Optional Features */ features = slv2_plugin_get_optional_features(p); if (features) printf("\tOptional Features: "); - for (unsigned i=0; i < slv2_values_size(features); ++i) { + for (unsigned i = 0; i < slv2_values_size(features); ++i) { if (i > 0) { printf("\n\t "); } @@ -241,13 +240,12 @@ print_plugin(SLV2Plugin p) printf("\n"); slv2_values_free(features); - /* Presets */ SLV2Values presets = slv2_plugin_get_value(p, preset_pred); if (presets) printf("\tPresets: \n"); - for (unsigned i=0; i < slv2_values_size(presets); ++i) { + for (unsigned i = 0; i < slv2_values_size(presets); ++i) { SLV2Values titles = slv2_plugin_get_value_for_subject( p, slv2_values_get_at(presets, i), title_pred); if (titles) { @@ -256,7 +254,6 @@ print_plugin(SLV2Plugin p) } } - /* Ports */ const uint32_t num_ports = slv2_plugin_get_num_ports(p); @@ -265,9 +262,7 @@ print_plugin(SLV2Plugin p) float* defaults = calloc(num_ports, sizeof(float)); slv2_plugin_get_port_ranges_float(p, mins, maxes, defaults); - //printf("\n\t# Ports: %d\n", num_ports); - - for (uint32_t i=0; i < num_ports; ++i) + for (uint32_t i = 0; i < num_ports; ++i) print_port(p, i, mins, maxes, defaults); free(mins); @@ -275,18 +270,16 @@ print_plugin(SLV2Plugin p) free(defaults); } - void print_version() { printf("lv2_inspect (slv2) " SLV2_VERSION "\n"); - printf("Copyright (C) 2007-2009 David Robillard <http://drobilla.net>\n"); + printf("Copyright (C) 2007-2011 David Robillard <http://drobilla.net>\n"); printf("License: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>\n"); printf("This is free software: you are free to change and redistribute it.\n"); printf("There is NO WARRANTY, to the extent permitted by law.\n"); } - void print_usage() { @@ -294,7 +287,6 @@ print_usage() printf("Show information about an installed LV2 plugin.\n"); } - int main(int argc, char** argv) { @@ -304,12 +296,16 @@ main(int argc, char** argv) SLV2World world = slv2_world_new(); slv2_world_load_all(world); - event_class = slv2_value_new_uri(world, SLV2_PORT_CLASS_EVENT); +#define NS_DC "http://dublincore.org/documents/dcmi-namespace/" +#define NS_PG "http://lv2plug.in/ns/ext/port-groups#" +#define NS_PSET "http://lv2plug.in/ns/ext/presets#" + control_class = slv2_value_new_uri(world, SLV2_PORT_CLASS_CONTROL); - in_group_pred = slv2_value_new_uri(world, "http://lv2plug.in/ns/ext/port-groups#inGroup"); - role_pred = slv2_value_new_uri(world, "http://lv2plug.in/ns/ext/port-groups#role"); - preset_pred = slv2_value_new_uri(world, "http://lv2plug.in/ns/dev/presets#hasPreset"); - title_pred = slv2_value_new_uri(world, "http://dublincore.org/documents/dcmi-namespace/title"); + event_class = slv2_value_new_uri(world, SLV2_PORT_CLASS_EVENT); + in_group_pred = slv2_value_new_uri(world, NS_PG "inGroup"); + preset_pred = slv2_value_new_uri(world, NS_PSET "hasPreset"); + role_pred = slv2_value_new_uri(world, NS_PG "role"); + title_pred = slv2_value_new_uri(world, NS_DC "title"); if (argc != 2) { print_usage(); @@ -348,10 +344,12 @@ main(int argc, char** argv) slv2_plugins_free(world, plugins); done: + slv2_value_free(title_pred); + slv2_value_free(role_pred); + slv2_value_free(preset_pred); + slv2_value_free(in_group_pred); slv2_value_free(event_class); slv2_value_free(control_class); - slv2_value_free(in_group_pred); - slv2_value_free(role_pred); slv2_world_free(world); return ret; } |