From 98ea88b5fd404ff4ba43709f731ba074f291eb5b Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 19 Apr 2007 16:49:25 +0000 Subject: Added Redland dependency, using in-memory RDF models. Numerous significant performance improvements. git-svn-id: http://svn.drobilla.net/lad/slv2@457 a436a847-0d15-0410-975c-d299462d15a1 --- utils/Makefile.am | 2 +- utils/lv2_inspect.c | 52 +++++++++++++++++++++++++++++++++++----------------- utils/lv2_list.c | 8 ++++---- 3 files changed, 40 insertions(+), 22 deletions(-) (limited to 'utils') diff --git a/utils/Makefile.am b/utils/Makefile.am index 09935fc..2cca154 100644 --- a/utils/Makefile.am +++ b/utils/Makefile.am @@ -1,4 +1,4 @@ -AM_CFLAGS = -I$(top_srcdir) @RASQAL_CFLAGS@ +AM_CFLAGS = -I$(top_srcdir) @REDLAND_CFLAGS@ bin_PROGRAMS = lv2_list lv2_inspect diff --git a/utils/lv2_inspect.c b/utils/lv2_inspect.c index a993dee..593cc00 100644 --- a/utils/lv2_inspect.c +++ b/utils/lv2_inspect.c @@ -20,18 +20,20 @@ #include #include +// FIXME: remove +#include "../src/private_types.h" void print_port(SLV2Plugin p, uint32_t index) { - SLV2PortID id = slv2_port_by_index(index); + SLV2Port port = slv2_plugin_get_port_by_index(p, index); char* str = NULL; SLV2PortClass cl = SLV2_UNKNOWN_PORT_CLASS; printf("\n\tPort %d:\n", index); - cl = slv2_port_get_class(p, id); + cl = slv2_port_get_class(p, port); printf("\t\tClass: "); switch (cl) { case SLV2_CONTROL_INPUT: @@ -58,22 +60,33 @@ print_port(SLV2Plugin p, uint32_t index) } printf("\n"); - str = slv2_port_get_symbol(p, id); + str = slv2_port_get_symbol(p, port); printf("\t\tSymbol: %s\n", str); free(str); - str = slv2_port_get_name(p, id); + str = slv2_port_get_name(p, port); printf("\t\tName: %s\n", str); free(str); if (cl == SLV2_CONTROL_INPUT || cl == SLV2_CONTROL_OUTPUT) { - printf("\t\tMinimum: %f\n", slv2_port_get_minimum_value(p, id)); - printf("\t\tMaximum: %f\n", slv2_port_get_maximum_value(p, id)); - printf("\t\tDefault: %f\n", slv2_port_get_default_value(p, id)); + printf("\t\tMinimum: %f\n", slv2_port_get_minimum_value(p, port)); + printf("\t\tMaximum: %f\n", slv2_port_get_maximum_value(p, port)); + printf("\t\tDefault: %f\n", slv2_port_get_default_value(p, port)); } -} + printf("\t\tProperties:\n"); + SLV2Strings properties = slv2_port_get_properties(p, port); + for (unsigned i=0; i < slv2_strings_size(properties); ++i) + printf("\t\t\t%s\n", slv2_strings_get_at(properties, i)); + slv2_strings_free(properties); + + printf("\t\tHints:\n"); + SLV2Strings hints = slv2_port_get_hints(p, port); + for (unsigned i=0; i < slv2_strings_size(hints); ++i) + printf("\t\t\t%s\n", slv2_strings_get_at(hints, i)); + slv2_strings_free(hints); +} void print_plugin(SLV2Plugin p) @@ -82,10 +95,12 @@ print_plugin(SLV2Plugin p) printf("<%s>\n", slv2_plugin_get_uri(p)); - printf("\tData URIs:\n"); + printf("FIXME: Data URIs\n"); + /*printf("\tData URIs:\n"); SLV2Strings data_uris = slv2_plugin_get_data_uris(p); for (unsigned i=0; i < slv2_strings_size(data_uris); ++i) printf("\t\t%s\n", slv2_strings_get_at(data_uris, i)); + */ printf("\n\tLibrary URI: %s\n\n", slv2_plugin_get_library_uri(p)); @@ -111,6 +126,9 @@ print_plugin(SLV2Plugin p) slv2_strings_free(v); uint32_t num_ports = slv2_plugin_get_num_ports(p); + + printf("\n\t# Ports: %d\n", num_ports); + for (uint32_t i=0; i < num_ports; ++i) print_port(p, i); } @@ -120,27 +138,27 @@ print_plugin(SLV2Plugin p) int main(int argc, char** argv) { - slv2_init(); + SLV2Model model = slv2_model_new(); + slv2_model_load_all(model); if (argc != 2) { fprintf(stderr, "Usage: %s PLUGIN_URI\n", argv[0]); return -1; } - SLV2Plugins plugins = slv2_plugins_new(); - slv2_plugins_load_all(plugins); + SLV2Plugins plugins = slv2_model_get_all_plugins(model); SLV2Plugin p = slv2_plugins_get_by_uri(plugins, argv[1]); - if (!p) { + if (p) { + print_plugin(p); + } else { fprintf(stderr, "Plugin not found.\n"); return -1; } - print_plugin(p); - slv2_plugins_free(plugins); - slv2_finish(); + slv2_model_free(model); - return 0; + return (p != NULL ? 0 : -1); } diff --git a/utils/lv2_list.c b/utils/lv2_list.c index cab660a..5c2a1dd 100644 --- a/utils/lv2_list.c +++ b/utils/lv2_list.c @@ -33,15 +33,15 @@ list_plugins(SLV2Plugins list) int main()//int argc, char** argv) { - slv2_init(); + SLV2Model model = slv2_model_new(); + slv2_model_load_all(model); - SLV2Plugins plugins = slv2_plugins_new(); - slv2_plugins_load_all(plugins); + SLV2Plugins plugins = slv2_model_get_all_plugins(model); list_plugins(plugins); slv2_plugins_free(plugins); - slv2_finish(); + slv2_model_free(model); return 0; } -- cgit v1.2.1