summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2009-05-13 16:04:14 +0000
committerDavid Robillard <d@drobilla.net>2009-05-13 16:04:14 +0000
commit0a04be1e9e8f3c6b355c014f5755bb30da0d5aec (patch)
treeb4eb149da0fc57af8c4e9356231aa191e6f1a118
parent011d130c2b7f54b859ae41aac8b95d5825b975be (diff)
downloadlilv-0a04be1e9e8f3c6b355c014f5755bb30da0d5aec.tar.gz
lilv-0a04be1e9e8f3c6b355c014f5755bb30da0d5aec.tar.bz2
lilv-0a04be1e9e8f3c6b355c014f5755bb30da0d5aec.zip
Strip trailing whitespace.
git-svn-id: http://svn.drobilla.net/lad/trunk/slv2@1999 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--hosts/lv2_jack_host.c34
-rw-r--r--hosts/lv2_simple_jack_host.c34
-rw-r--r--slv2/collections.h10
-rw-r--r--slv2/plugin.h18
-rw-r--r--slv2/pluginclass.h2
-rw-r--r--slv2/plugininstance.h10
-rw-r--r--slv2/pluginui.h2
-rw-r--r--slv2/pluginuiinstance.h8
-rw-r--r--slv2/port.h6
-rw-r--r--slv2/query.h2
-rw-r--r--slv2/scalepoint.h2
-rw-r--r--slv2/slv2.h2
-rw-r--r--slv2/types.h2
-rw-r--r--slv2/util.h2
-rw-r--r--slv2/value.h16
-rw-r--r--slv2/world.h6
-rw-r--r--src/collections.c16
-rw-r--r--src/plugin.c78
-rw-r--r--src/pluginclass.c2
-rw-r--r--src/plugininstance.c20
-rw-r--r--src/plugins.c10
-rw-r--r--src/pluginui.c12
-rw-r--r--src/pluginuiinstance.c28
-rw-r--r--src/port.c40
-rw-r--r--src/query.c16
-rw-r--r--src/scalepoint.c2
-rw-r--r--src/slv2_internal.h6
-rw-r--r--src/util.c4
-rw-r--r--src/value.c14
-rw-r--r--src/world.c116
-rw-r--r--test/slv2_test.c64
-rw-r--r--utils/ladspa.h38
-rw-r--r--utils/ladspa2lv2.c44
-rw-r--r--utils/lv2_inspect.c30
-rw-r--r--utils/lv2_list.c4
35 files changed, 350 insertions, 350 deletions
diff --git a/hosts/lv2_jack_host.c b/hosts/lv2_jack_host.c
index 1beef0e..8daaaad 100644
--- a/hosts/lv2_jack_host.c
+++ b/hosts/lv2_jack_host.c
@@ -1,6 +1,6 @@
/* jack_host - SLV2 Jack Host
* Copyright (C) 2007 Dave Robillard <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
* Software Foundation; either version 2 of the License, or (at your option)
@@ -113,12 +113,12 @@ main(int argc, char** argv)
host.jack_client = NULL;
host.num_ports = 0;
host.ports = NULL;
-
+
/* Find all installed plugins */
SLV2World world = slv2_world_new();
slv2_world_load_all(world);
SLV2Plugins plugins = slv2_world_get_all_plugins(world);
-
+
/* Set up the port classes this app supports */
host.input_class = slv2_value_new_uri(world, SLV2_PORT_CLASS_INPUT);
host.output_class = slv2_value_new_uri(world, SLV2_PORT_CLASS_OUTPUT);
@@ -130,7 +130,7 @@ main(int argc, char** argv)
/* Find the plugin to run */
const char* plugin_uri_str = (argc == 2) ? argv[1] : NULL;
-
+
if (!plugin_uri_str) {
fprintf(stderr, "\nYou must specify a plugin URI to load.\n");
fprintf(stderr, "\nKnown plugins:\n\n");
@@ -144,7 +144,7 @@ main(int argc, char** argv)
SLV2Value plugin_uri = slv2_value_new_uri(world, plugin_uri_str);
host.plugin = slv2_plugins_get_by_uri(plugins, plugin_uri);
slv2_value_free(plugin_uri);
-
+
if (!host.plugin) {
fprintf(stderr, "Failed to find plugin %s.\n", plugin_uri_str);
slv2_world_free(world);
@@ -164,7 +164,7 @@ main(int argc, char** argv)
} else {
jack_name = strdup(name_str);
}
-
+
/* Connect to JACK */
printf("JACK Name:\t%s\n", jack_name);
host.jack_client = jack_client_open(jack_name, JackNullOption, NULL);
@@ -176,7 +176,7 @@ main(int argc, char** argv)
die("Failed to connect to JACK.");
else
printf("Connected to JACK.\n");
-
+
/* Instantiate the plugin */
host.instance = slv2_plugin_instantiate(
host.plugin, jack_get_sample_rate(host.jack_client), features);
@@ -186,11 +186,11 @@ main(int argc, char** argv)
printf("Succesfully instantiated plugin.\n");
jack_set_process_callback(host.jack_client, &jack_process_cb, (void*)(&host));
-
+
/* Create ports */
host.num_ports = slv2_plugin_get_num_ports(host.plugin);
host.ports = calloc((size_t)host.num_ports, sizeof(struct Port));
- float* default_values = calloc(slv2_plugin_get_num_ports(host.plugin),
+ float* default_values = calloc(slv2_plugin_get_num_ports(host.plugin),
sizeof(float));
slv2_plugin_get_port_ranges_float(host.plugin, NULL, NULL, default_values);
@@ -198,19 +198,19 @@ main(int argc, char** argv)
create_port(&host, i, default_values[i]);
free(default_values);
-
+
/* Activate plugin and JACK */
slv2_instance_activate(host.instance);
jack_activate(host.jack_client);
-
+
/* Run */
printf("Press enter to quit: ");
getc(stdin);
printf("\n");
-
+
/* Deactivate JACK */
jack_deactivate(host.jack_client);
-
+
printf("Shutting down JACK.\n");
for (unsigned long i=0; i < host.num_ports; ++i) {
if (host.ports[i].jack_port != NULL) {
@@ -222,11 +222,11 @@ main(int argc, char** argv)
}
}
jack_client_close(host.jack_client);
-
+
/* Deactivate plugin */
slv2_instance_deactivate(host.instance);
slv2_instance_free(host.instance);
-
+
/* Clean up */
free(host.ports);
slv2_value_free(host.input_class);
@@ -289,7 +289,7 @@ create_port(struct JackHost* host,
} else {
die("Mandatory port has unknown type (neither input or output)");
}
-
+
/* Set control values */
if (slv2_port_is_a(host->plugin, port->slv2_port, host->control_class)) {
port->type = CONTROL;
@@ -362,7 +362,7 @@ jack_process_cb(jack_nframes_t nframes, void* data)
}
}
}
-
+
/* Run plugin for this cycle */
slv2_instance_run(host->instance, nframes);
diff --git a/hosts/lv2_simple_jack_host.c b/hosts/lv2_simple_jack_host.c
index 32c852c..7751464 100644
--- a/hosts/lv2_simple_jack_host.c
+++ b/hosts/lv2_simple_jack_host.c
@@ -1,6 +1,6 @@
/* SLV2 Simple Jack Host Example
* Copyright (C) 2007 Dave 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
* Software Foundation; either version 2 of the License, or (at your option)
@@ -53,7 +53,7 @@ main(int argc, char** argv)
host.num_ports = 0;
host.jack_ports = NULL;
host.controls = NULL;
-
+
/* Find all installed plugins */
host.world = slv2_world_new();
slv2_world_load_all(host.world);
@@ -70,7 +70,7 @@ main(int argc, char** argv)
/* Find the plugin to run */
const char* plugin_uri_str = (argc == 2) ? argv[1] : NULL;
-
+
if (!plugin_uri_str) {
fprintf(stderr, "\nYou must specify a plugin URI to load.\n");
fprintf(stderr, "\nKnown plugins:\n\n");
@@ -83,7 +83,7 @@ main(int argc, char** argv)
SLV2Value plugin_uri = slv2_value_new_uri(host.world, plugin_uri_str);
host.plugin = slv2_plugins_get_by_uri(plugins, plugin_uri);
slv2_value_free(plugin_uri);
-
+
if (!host.plugin) {
fprintf(stderr, "Failed to find plugin %s.\n", plugin_uri_str);
slv2_world_free(host.world);
@@ -107,7 +107,7 @@ main(int argc, char** argv)
/* Connect to JACK */
printf("JACK Name:\t%s\n", jack_name);
host.jack_client = jack_client_open(jack_name, JackNullOption, NULL);
-
+
free(jack_name);
slv2_value_free(name);
@@ -115,7 +115,7 @@ main(int argc, char** argv)
die("Failed to connect to JACK.");
else
printf("Connected to JACK.\n");
-
+
/* Instantiate the plugin */
host.instance = slv2_plugin_instantiate(
host.plugin, jack_get_sample_rate(host.jack_client), NULL);
@@ -125,27 +125,27 @@ main(int argc, char** argv)
printf("Succesfully instantiated plugin.\n");
jack_set_process_callback(host.jack_client, &jack_process_cb, (void*)(&host));
-
+
/* Create ports */
host.num_ports = slv2_plugin_get_num_ports(host.plugin);
host.jack_ports = calloc((size_t)host.num_ports, sizeof(jack_port_t*));
host.controls = calloc((size_t)host.num_ports, sizeof(float*));
-
+
for (uint32_t i=0; i < host.num_ports; ++i)
create_port(&host, i);
-
+
/* Activate plugin and JACK */
slv2_instance_activate(host.instance);
jack_activate(host.jack_client);
-
+
/* Run */
printf("Press enter to quit: ");
getc(stdin);
printf("\n");
-
+
/* Deactivate JACK */
jack_deactivate(host.jack_client);
-
+
printf("Shutting down JACK.\n");
for (unsigned long i=0; i < host.num_ports; ++i) {
if (host.jack_ports[i] != NULL) {
@@ -154,7 +154,7 @@ main(int argc, char** argv)
}
}
jack_client_close(host.jack_client);
-
+
/* Deactivate plugin */
slv2_instance_deactivate(host.instance);
slv2_instance_free(host.instance);
@@ -195,11 +195,11 @@ create_port(struct JackHost* host,
/* Get the port symbol (label) for console printing */
SLV2Value symbol = slv2_port_get_symbol(host->plugin, port);
const char* symbol_str = slv2_value_as_string(symbol);
-
+
/* Initialize the port array elements */
host->jack_ports[index] = NULL;
host->controls[index] = 0.0f;
-
+
/* Connect control ports to controls array */
if (slv2_port_is_a(host->plugin, port, host->control_class)) {
@@ -211,7 +211,7 @@ create_port(struct JackHost* host,
printf("Set %s to %f\n", symbol_str, host->controls[index]);
slv2_value_free(def);
}
-
+
slv2_instance_connect_port(host->instance, index, &host->controls[index]);
} else if (slv2_port_is_a(host->plugin, port, host->audio_class)) {
@@ -240,7 +240,7 @@ jack_process_cb(jack_nframes_t nframes, void* data)
if (host->jack_ports[i] != NULL)
slv2_instance_connect_port(host->instance, i,
jack_port_get_buffer(host->jack_ports[i], nframes));
-
+
/* Run plugin for this cycle */
slv2_instance_run(host->instance, nframes);
diff --git a/slv2/collections.h b/slv2/collections.h
index a76e80c..86b5589 100644
--- a/slv2/collections.h
+++ b/slv2/collections.h
@@ -1,6 +1,6 @@
/* SLV2
* Copyright (C) 2008 Dave Robillard <http://drobilla.net>
- *
+ *
* This library 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
* Software Foundation; either version 2 of the License, or (at your option)
@@ -40,7 +40,7 @@ extern "C" {
#define SLV2_COLLECTION(CollType, ElemType, prefix) \
\
/** Free a collection.
- *
+ *
* Time = O(1)
*/ \
void \
@@ -103,7 +103,7 @@ slv2_plugins_size(SLV2Plugins plugins);
* modified by the caller in any way.
*
* Time = O(log2(n))
- *
+ *
* \return NULL if plugin with \a url not found in \a plugins.
*/
SLV2Plugin
@@ -136,7 +136,7 @@ slv2_plugins_get_at(SLV2Plugins plugins,
* modified by the caller in any way.
*
* Time = O(log2(n))
- *
+ *
* \return NULL if plugin with \a url not found in \a classes.
*/
SLV2PluginClass
@@ -179,7 +179,7 @@ slv2_values_contains(SLV2Values values, SLV2Value value);
* modified by the caller in any way.
*
* Time = O(log2(n))
- *
+ *
* \return NULL if plugin with \a url not found in \a list.
*/
SLV2UI
diff --git a/slv2/plugin.h b/slv2/plugin.h
index 473a12b..fa533f9 100644
--- a/slv2/plugin.h
+++ b/slv2/plugin.h
@@ -1,6 +1,6 @@
/* SLV2
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* This library 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
* Software Foundation; either version 2 of the License, or (at your option)
@@ -47,7 +47,7 @@ extern "C" {
* This is used by plugin lists to avoid loading plugins that are not valid
* and will not work with libslv2 (eg plugins missing required fields, or
* having multiple values for mandatory single-valued fields, etc.
- *
+ *
* Note that normal hosts do NOT need to use this - slv2 does not
* load invalid plugins into plugin lists. This is included for plugin
* testing utilities, etc.
@@ -90,7 +90,7 @@ slv2_plugin_get_uri(SLV2Plugin plugin);
*
* Note this always returns a fully qualified URI. If you want a local
* filesystem path, use slv2_uri_to_path.
- *
+ *
* \return a shared string which must not be modified or freed.
*
* Time = O(1)
@@ -119,7 +119,7 @@ slv2_plugin_get_data_uris(SLV2Plugin plugin);
*
* Note this always returns a fully qualified URI. If you want a local
* filesystem path, use slv2_uri_to_path.
- *
+ *
* \return a shared string which must not be modified or freed.
*
* Time = O(1)
@@ -151,7 +151,7 @@ slv2_plugin_get_class(SLV2Plugin plugin);
* Returns the ?object of all triples found of the form:
*
* <code>&lt;plugin-uri&gt; predicate ?object</code>
- *
+ *
* May return NULL if the property was not found, or if object(s) is not
* sensibly represented as an SLV2Values (e.g. blank nodes).
*
@@ -291,14 +291,14 @@ slv2_plugin_get_num_ports(SLV2Plugin p);
* with array index corresponding to port index. If a port doesn't have a
* minimum, maximum or default value, or the port's type is not float, the
* corresponding array element will be set to NAN.
- *
+ *
* This is a convenience method for the common case of getting the range of
* all float ports on a plugin, and may be significantly faster than
* repeated calls to slv2_port_get_range.
*/
void
-slv2_plugin_get_port_ranges_float(SLV2Plugin p,
- float* min_values,
+slv2_plugin_get_port_ranges_float(SLV2Plugin p,
+ float* min_values,
float* max_values,
float* def_values);
@@ -405,7 +405,7 @@ slv2_plugin_get_port_by_symbol(SLV2Plugin plugin,
*
* Returned value must be freed by caller using slv2_uis_free.
*
- * \param plugin The plugin to get the UIs for.
+ * \param plugin The plugin to get the UIs for.
*
* Time = Query
*/
diff --git a/slv2/pluginclass.h b/slv2/pluginclass.h
index 2b19ac8..58864d7 100644
--- a/slv2/pluginclass.h
+++ b/slv2/pluginclass.h
@@ -1,6 +1,6 @@
/* SLV2
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* This library 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
* Software Foundation; either version 2 of the License, or (at your option)
diff --git a/slv2/plugininstance.h b/slv2/plugininstance.h
index 784cea3..bbb77af 100644
--- a/slv2/plugininstance.h
+++ b/slv2/plugininstance.h
@@ -1,6 +1,6 @@
/* SLV2
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* This library 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
* Software Foundation; either version 2 of the License, or (at your option)
@@ -55,7 +55,7 @@ typedef struct _Instance {
* An SLV2Instance is an instantiated SLV2Plugin (ie a loaded dynamic
* library). These functions interact with the binary library code only,
* they do not read data files in any way.
- *
+ *
* @{
*/
@@ -64,10 +64,10 @@ typedef struct _Instance {
* The returned object represents shared library objects loaded into memory,
* it must be cleaned up with slv2_instance_free when no longer
* needed.
- *
+ *
* \a plugin is not modified or directly referenced by the returned object
* (instances store only a copy of the plugin's URI).
- *
+ *
* \a host_features NULL-terminated array of features the host supports.
* NULL may be passed if the host supports no additional features (unlike
* the LV2 specification - SLV2 takes care of it).
@@ -190,7 +190,7 @@ slv2_instance_get_descriptor(SLV2Instance instance)
*
* Normally hosts should not need to access the LV2_Handle directly,
* use the slv2_instance_* functions.
- *
+ *
* The returned handle is shared and must not be deleted.
*/
static inline LV2_Handle
diff --git a/slv2/pluginui.h b/slv2/pluginui.h
index f862024..3ce9807 100644
--- a/slv2/pluginui.h
+++ b/slv2/pluginui.h
@@ -1,6 +1,6 @@
/* SLV2
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* This library 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
* Software Foundation; either version 2 of the License, or (at your option)
diff --git a/slv2/pluginuiinstance.h b/slv2/pluginuiinstance.h
index 84ee690..a0e8002 100644
--- a/slv2/pluginuiinstance.h
+++ b/slv2/pluginuiinstance.h
@@ -1,6 +1,6 @@
/* SLV2
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* This library 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
* Software Foundation; either version 2 of the License, or (at your option)
@@ -49,10 +49,10 @@ typedef struct _SLV2UIInstance {
* The returned object represents shared library objects loaded into memory,
* it must be cleaned up with slv2_ui_instance_free when no longer
* needed.
- *
+ *
* \a plugin is not modified or directly referenced by the returned object
* (instances store only a copy of the plugin's URI).
- *
+ *
* \a host_features NULL-terminated array of features the host supports.
* NULL may be passed if the host supports no additional features (unlike
* the LV2 specification - SLV2 takes care of it).
@@ -100,7 +100,7 @@ slv2_ui_instance_get_descriptor(SLV2UIInstance instance);
*
* Normally hosts should not need to access the LV2UI_Handle directly,
* use the slv2_ui_instance_* functions.
- *
+ *
* The returned handle is shared and must not be deleted.
*/
LV2UI_Handle
diff --git a/slv2/port.h b/slv2/port.h
index 498da54..c219100 100644
--- a/slv2/port.h
+++ b/slv2/port.h
@@ -1,6 +1,6 @@
/* SLV2
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* This library 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
* Software Foundation; either version 2 of the License, or (at your option)
@@ -129,7 +129,7 @@ slv2_port_get_name(SLV2Plugin plugin,
SLV2Values
slv2_port_get_classes(SLV2Plugin plugin,
SLV2Port port);
-
+
/** Determine if a port is of a given class (input, output, audio, etc).
*
@@ -158,7 +158,7 @@ slv2_port_is_a(SLV2Plugin plugin,
* Time = Query
*/
void
-slv2_port_get_range(SLV2Plugin plugin,
+slv2_port_get_range(SLV2Plugin plugin,
SLV2Port port,
SLV2Value* def,
SLV2Value* min,
diff --git a/slv2/query.h b/slv2/query.h
index 7319c84..48bea95 100644
--- a/slv2/query.h
+++ b/slv2/query.h
@@ -1,6 +1,6 @@
/* SLV2
* Copyright (C) 2008 Dave Robillard <http://drobilla.net>
- *
+ *
* This library 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
* Software Foundation; either version 2 of the License, or (at your option)
diff --git a/slv2/scalepoint.h b/slv2/scalepoint.h
index 1fb6867..e7deab3 100644
--- a/slv2/scalepoint.h
+++ b/slv2/scalepoint.h
@@ -1,6 +1,6 @@
/* SLV2
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* This library 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
* Software Foundation; either version 2 of the License, or (at your option)
diff --git a/slv2/slv2.h b/slv2/slv2.h
index 0960282..ae53ee7 100644
--- a/slv2/slv2.h
+++ b/slv2/slv2.h
@@ -1,6 +1,6 @@
/* SLV2
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* This library 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
* Software Foundation; either version 2 of the License, or (at your option)
diff --git a/slv2/types.h b/slv2/types.h
index 0e18d6d..01e41b8 100644
--- a/slv2/types.h
+++ b/slv2/types.h
@@ -1,6 +1,6 @@
/* SLV2
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* This library 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
* Software Foundation; either version 2 of the License, or (at your option)
diff --git a/slv2/util.h b/slv2/util.h
index f01fdaa..65cb38d 100644
--- a/slv2/util.h
+++ b/slv2/util.h
@@ -1,6 +1,6 @@
/* SLV2
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* This library 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
* Software Foundation; either version 2 of the License, or (at your option)
diff --git a/slv2/value.h b/slv2/value.h
index f1af35f..299b1e8 100644
--- a/slv2/value.h
+++ b/slv2/value.h
@@ -1,6 +1,6 @@
/* SLV2
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* This library 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
* Software Foundation; either version 2 of the License, or (at your option)
@@ -104,10 +104,10 @@ slv2_value_is_uri(SLV2Value value);
/** Return this value as a URI string, e.g. "http://example.org/foo".
- *
+ *
* Valid to call only if slv2_value_is_uri(\a value) returns true.
* Returned value is owned by \a value and must not be freed by caller.
- *
+ *
* Time = O(1)
*/
const char*
@@ -127,10 +127,10 @@ slv2_value_is_qname(SLV2Value value);
/** Return this value as a QName string, e.g. "lv2:Plugin".
- *
+ *
* Valid to call only if slv2_value_is_qname(\a value) returns true.
* Returned value is owned by \a value and must not be freed by caller.
- *
+ *
* Time = O(1)
*/
const char*
@@ -175,7 +175,7 @@ slv2_value_is_float(SLV2Value value);
/** Return \a value as a float.
- *
+ *
* Valid to call only if slv2_value_is_float(\a value) or
* slv2_value_is_int(\a value) returns true.
*
@@ -186,7 +186,7 @@ slv2_value_as_float(SLV2Value value);
/** Return whether this value is an integer literal.
- *
+ *
* Time = O(1)
*/
bool
@@ -194,7 +194,7 @@ slv2_value_is_int(SLV2Value value);
/** Return \a value as an integer.
- *
+ *
* Valid to call only if slv2_value_is_int(\a value) returns true.
*
* Time = O(1)
diff --git a/slv2/world.h b/slv2/world.h
index 0e6106c..9cf0058 100644
--- a/slv2/world.h
+++ b/slv2/world.h
@@ -1,6 +1,6 @@
/* SLV2
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* This library 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
* Software Foundation; either version 2 of the License, or (at your option)
@@ -27,7 +27,7 @@ extern "C" {
#include "slv2/collections.h"
/** \defgroup slv2_world Global library state
- *
+ *
* The "world" represents all library state, and the data found in bundles'
* manifest.ttl (ie it is an in-memory index of all things LV2 found).
* Plugins (and plugin extensions) and the LV2 specification (and LV2
@@ -121,7 +121,7 @@ slv2_world_get_plugin_class(SLV2World world);
/** Return a list of all found plugin classes.
*
* Returned list is owned by world and must not be freed by the caller.
- *
+ *
* Time = O(1)
*/
SLV2PluginClasses
diff --git a/src/collections.c b/src/collections.c
index 4598eab..a16c7fb 100644
--- a/src/collections.c
+++ b/src/collections.c
@@ -1,6 +1,6 @@
/* SLV2
* Copyright (C) 2008 Dave Robillard <http://drobilla.net>
- *
+ *
* This library 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
* Software Foundation; either version 2 of the License, or (at your option)
@@ -75,19 +75,19 @@ SLV2PluginClass
slv2_plugin_classes_get_by_uri(SLV2PluginClasses list, SLV2Value uri)
{
// good old fashioned binary search
-
+
int lower = 0;
int upper = raptor_sequence_size(list) - 1;
int i;
-
+
while (upper >= lower) {
i = lower + ((upper - lower) / 2);
SLV2PluginClass p = raptor_sequence_get_at(list, i);
-
+
const int cmp = strcmp(slv2_value_as_uri(slv2_plugin_class_get_uri(p)),
slv2_value_as_uri(uri));
-
+
if (cmp == 0)
return p;
else if (cmp > 0)
@@ -109,7 +109,7 @@ slv2_values_contains(SLV2Values list, SLV2Value value)
for (unsigned i=0; i < slv2_values_size(list); ++i)
if (slv2_value_equals(slv2_values_get_at(list, i), value))
return true;
-
+
return false;
}
@@ -129,11 +129,11 @@ SLV2UI
slv2_uis_get_by_uri(SLV2UIs list, SLV2Value uri)
{
// good old fashioned binary search
-
+
int lower = 0;
int upper = raptor_sequence_size(list) - 1;
int i;
-
+
while (upper >= lower) {
i = lower + ((upper - lower) / 2);
diff --git a/src/plugin.c b/src/plugin.c
index 314bbbe..6987f4c 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -1,6 +1,6 @@
/* SLV2
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* This library 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
* Software Foundation; either version 2 of the License, or (at your option)
@@ -59,13 +59,13 @@ slv2_plugin_free(SLV2Plugin p)
{
slv2_value_free(p->plugin_uri);
p->plugin_uri = NULL;
-
+
slv2_value_free(p->bundle_uri);
p->bundle_uri = NULL;
-
+
slv2_value_free(p->binary_uri);
p->binary_uri = NULL;
-
+
if (p->ports)
raptor_free_sequence(p->ports);
p->ports = NULL;
@@ -74,12 +74,12 @@ slv2_plugin_free(SLV2Plugin p)
librdf_free_model(p->rdf);
p->rdf = NULL;
}
-
+
if (p->storage) {
librdf_free_storage(p->storage);
p->storage = NULL;
}
-
+
slv2_values_free(p->data_uris);
p->data_uris = NULL;
@@ -331,7 +331,7 @@ slv2_plugin_get_class(SLV2Plugin p)
bool
slv2_plugin_verify(SLV2Plugin plugin)
{
- char* query_str =
+ char* query_str =
"SELECT DISTINCT ?type ?name ?license ?port WHERE {\n"
"<> a ?type ;\n"
"doap:name ?name ;\n"
@@ -353,13 +353,13 @@ slv2_plugin_verify(SLV2Plugin plugin)
if (librdf_node_get_type(type_node) == LIBRDF_NODE_TYPE_RESOURCE)
has_type = true;
-
+
if (name_node)
has_name = true;
-
+
if (license_node)
has_license = true;
-
+
if (port_node)
has_port = true;
@@ -388,7 +388,7 @@ slv2_plugin_get_name(SLV2Plugin plugin)
{
SLV2Values results = slv2_plugin_get_value_by_qname_i18n(plugin, "doap:name");
SLV2Value ret = NULL;
-
+
if (results) {
SLV2Value val = slv2_values_get_at(results, 0);
if (slv2_value_is_string(val))
@@ -411,7 +411,7 @@ slv2_plugin_get_value(SLV2Plugin p,
SLV2Value predicate)
{
char* query = NULL;
-
+
/* Hack around broken RASQAL, full URI predicates don't work :/ */
query = slv2_strjoin(
"PREFIX slv2predicate: <", slv2_value_as_string(predicate), ">\n",
@@ -420,7 +420,7 @@ slv2_plugin_get_value(SLV2Plugin p,
"}\n", NULL);
SLV2Values result = slv2_plugin_query_variable(p, query, 0);
-
+
free(query);
return result;
@@ -438,13 +438,13 @@ slv2_plugin_get_value_by_qname(SLV2Plugin p,
"}\n", NULL);
SLV2Values result = slv2_plugin_query_variable(p, query, 0);
-
+
free(query);
return result;
}
-
+
/* internal: get i18n value if possible */
SLV2Values
slv2_plugin_get_value_by_qname_i18n(SLV2Plugin p,
@@ -457,13 +457,13 @@ slv2_plugin_get_value_by_qname_i18n(SLV2Plugin p,
"}\n", NULL);
SLV2Values result = slv2_plugin_query_variable(p, query, 0);
-
+
free(query);
return result;
}
-
+
SLV2Values
slv2_plugin_get_value_for_subject(SLV2Plugin p,
SLV2Value subject,
@@ -489,7 +489,7 @@ slv2_plugin_get_value_for_subject(SLV2Plugin p,
"}\n", NULL);
SLV2Values result = slv2_plugin_query_variable(p, query, 0);
-
+
free(query);
free(subject_token);
@@ -525,7 +525,7 @@ void
slv2_plugin_get_port_float_values(SLV2Plugin p,
const char* qname,
float* values)
-{
+{
slv2_plugin_load_ports_if_necessary(p);
for (int i = 0; i < raptor_sequence_size(p->ports); ++i)
@@ -565,8 +565,8 @@ slv2_plugin_get_port_float_values(SLV2Plugin p,
void
-slv2_plugin_get_port_ranges_float(SLV2Plugin p,
- float* min_values,
+slv2_plugin_get_port_ranges_float(SLV2Plugin p,
+ float* min_values,
float* max_values,
float* def_values)
{
@@ -596,7 +596,7 @@ slv2_plugin_get_num_ports_of_class(SLV2Plugin p,
continue;
va_start(args, class_1);
-
+
bool matches = true;
for (SLV2Value class_i = NULL; (class_i = va_arg(args, SLV2Value)) != NULL ; ) {
if (!slv2_port_is_a(p, port, class_i)) {
@@ -619,7 +619,7 @@ slv2_plugin_get_num_ports_of_class(SLV2Plugin p,
bool
slv2_plugin_has_latency(SLV2Plugin p)
{
- const char* const query =
+ const char* const query =
"SELECT ?index WHERE {\n"
" <> lv2:port ?port .\n"
" ?port lv2:portProperty lv2:reportsLatency ;\n"
@@ -629,7 +629,7 @@ slv2_plugin_has_latency(SLV2Plugin p)
SLV2Values results = slv2_plugin_query_variable(p, query, 0);
const bool latent = (slv2_values_size(results) > 0);
slv2_values_free(results);
-
+
return latent;
}
@@ -637,7 +637,7 @@ slv2_plugin_has_latency(SLV2Plugin p)
uint32_t
slv2_plugin_get_latency_port_index(SLV2Plugin p)
{
- const char* const query =
+ const char* const query =
"SELECT ?index WHERE {\n"
" <> lv2:port ?port .\n"
" ?port lv2:portProperty lv2:reportsLatency ;\n"
@@ -645,7 +645,7 @@ slv2_plugin_get_latency_port_index(SLV2Plugin p)
"}\n";
SLV2Values result = slv2_plugin_query_variable(p, query, 0);
-
+
// FIXME: need a sane error handling strategy
assert(slv2_values_size(result) > 0);
SLV2Value val = slv2_values_get_at(result, 0);
@@ -656,13 +656,13 @@ slv2_plugin_get_latency_port_index(SLV2Plugin p)
return ret;
}
-
+
bool
slv2_plugin_has_feature(SLV2Plugin p,
SLV2Value feature)
{
SLV2Values features = slv2_plugin_get_supported_features(p);
-
+
const bool ret = features && feature && slv2_values_contains(features, feature);
slv2_values_free(features);
@@ -675,7 +675,7 @@ slv2_plugin_get_supported_features(SLV2Plugin p)
{
SLV2Values optional = slv2_plugin_get_optional_features(p);
SLV2Values required = slv2_plugin_get_required_features(p);
-
+
SLV2Values result = slv2_values_new();
unsigned n_optional = slv2_values_size(optional);
unsigned n_required = slv2_values_size(required);
@@ -687,7 +687,7 @@ slv2_plugin_get_supported_features(SLV2Plugin p)
slv2_values_free(optional);
slv2_values_free(required);
-
+
return result;
}
@@ -735,14 +735,14 @@ slv2_plugin_get_author_name(SLV2Plugin plugin)
{
SLV2Value ret = NULL;
- const char* const query =
+ const char* const query =
"SELECT ?name WHERE {\n"
" <> doap:maintainer ?maint . \n"
" ?maint foaf:name ?name . \n"
"}\n";
SLV2Values results = slv2_plugin_query_variable(plugin, query, 0);
-
+
if (results && slv2_values_size(results) > 0) {
SLV2Value val = slv2_values_get_at(results, 0);
if (slv2_value_is_string(val))
@@ -761,14 +761,14 @@ slv2_plugin_get_author_email(SLV2Plugin plugin)
{
SLV2Value ret = NULL;
- const char* const query =
+ const char* const query =
"SELECT ?email WHERE {\n"
" <> doap:maintainer ?maint . \n"
" ?maint foaf:mbox ?email . \n"
"}\n";
-
+
SLV2Values results = slv2_plugin_query_variable(plugin, query, 0);
-
+
if (results && slv2_values_size(results) > 0) {
SLV2Value val = slv2_values_get_at(results, 0);
if (slv2_value_is_uri(val))
@@ -781,20 +781,20 @@ slv2_plugin_get_author_email(SLV2Plugin plugin)
return ret;
}
-
+
SLV2Value
slv2_plugin_get_author_homepage(SLV2Plugin plugin)
{
SLV2Value ret = NULL;
- const char* const query =
+ const char* const query =
"SELECT ?page WHERE {\n"
" <> doap:maintainer ?maint . \n"
" ?maint foaf:homepage ?page . \n"
"}\n";
-
+
SLV2Values results = slv2_plugin_query_variable(plugin, query, 0);
-
+
if (results && slv2_values_size(results) > 0) {
SLV2Value val = slv2_values_get_at(results, 0);
if (slv2_value_is_uri(val))
diff --git a/src/pluginclass.c b/src/pluginclass.c
index 6cc3bfe..cf7acf0 100644
--- a/src/pluginclass.c
+++ b/src/pluginclass.c
@@ -1,6 +1,6 @@
/* SLV2
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* This library 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
* Software Foundation; either version 2 of the License, or (at your option)
diff --git a/src/plugininstance.c b/src/plugininstance.c
index c3e0601..365535b 100644
--- a/src/plugininstance.c
+++ b/src/plugininstance.c
@@ -1,6 +1,6 @@
/* SLV2
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* This library 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
* Software Foundation; either version 2 of the License, or (at your option)
@@ -37,19 +37,19 @@ slv2_plugin_instantiate(SLV2Plugin plugin,
const LV2_Feature*const* features)
{
struct _Instance* result = NULL;
-
+
const LV2_Feature** local_features = NULL;
if (features == NULL) {
local_features = malloc(sizeof(LV2_Feature));
local_features[0] = NULL;
}
-
+
const char* const lib_uri = slv2_value_as_uri(slv2_plugin_get_library_uri(plugin));
const char* const lib_path = slv2_uri_to_path(lib_uri);
-
+
if (!lib_path)
return NULL;
-
+
dlerror();
void* lib = dlopen(lib_path, RTLD_NOW);
if (!lib) {
@@ -66,24 +66,24 @@ slv2_plugin_instantiate(SLV2Plugin plugin,
return NULL;
} else {
// Search for plugin by URI
-
+
// FIXME: Kludge to get bundle path (containing directory of binary)
const char* bundle_path = slv2_uri_to_path(slv2_value_as_uri(
slv2_plugin_get_bundle_uri(plugin)));
//printf("Bundle path: %s\n", bundle_path);
-
+
for (uint32_t i=0; 1; ++i) {
-
+
const LV2_Descriptor* ld = df(i);
-
+
if (!ld) {
fprintf(stderr, "Did not find plugin %s in %s\n",
slv2_value_as_uri(slv2_plugin_get_uri(plugin)), lib_path);
dlclose(lib);
break; // return NULL
} else if (!strcmp(ld->URI, slv2_value_as_uri(slv2_plugin_get_uri(plugin)))) {
-
+
assert(plugin->plugin_uri);
//printf("Found %s at index %u in:\n\t%s\n\n",
diff --git a/src/plugins.c b/src/plugins.c
index f392bcd..97e1323 100644
--- a/src/plugins.c
+++ b/src/plugins.c
@@ -1,6 +1,6 @@
/* SLV2
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* This library 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
* Software Foundation; either version 2 of the License, or (at your option)
@@ -29,7 +29,7 @@
#include "slv2/util.h"
#include "slv2_internal.h"
-
+
SLV2Plugins
slv2_plugins_new()
{
@@ -71,11 +71,11 @@ SLV2Plugin
slv2_plugins_get_by_uri(SLV2Plugins list, SLV2Value uri)
{
// good old fashioned binary search
-
+
int lower = 0;
int upper = raptor_sequence_size(list) - 1;
int i;
-
+
while (upper >= lower) {
i = lower + ((upper - lower) / 2);
@@ -98,7 +98,7 @@ slv2_plugins_get_by_uri(SLV2Plugins list, SLV2Value uri)
SLV2Plugin
slv2_plugins_get_at(SLV2Plugins list, unsigned index)
-{
+{
if (index > INT_MAX)
return NULL;
else
diff --git a/src/pluginui.c b/src/pluginui.c
index fb87f63..0ac3dca 100644
--- a/src/pluginui.c
+++ b/src/pluginui.c
@@ -1,6 +1,6 @@
/* SLV2
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* This library 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
* Software Foundation; either version 2 of the License, or (at your option)
@@ -40,9 +40,9 @@ slv2_ui_new(SLV2World world,
ui->world = world;
ui->uri = slv2_value_new_librdf_uri(world, uri);
ui->binary_uri = slv2_value_new_librdf_uri(world, binary_uri);
-
+
assert(ui->binary_uri);
-
+
// FIXME: kludge
char* bundle = strdup(slv2_value_as_string(ui->binary_uri));
char* last_slash = strrchr(bundle, '/') + 1;
@@ -63,15 +63,15 @@ slv2_ui_free(SLV2UI ui)
{
slv2_value_free(ui->uri);
ui->uri = NULL;
-
+
slv2_value_free(ui->bundle_uri);
ui->bundle_uri = NULL;
-
+
slv2_value_free(ui->binary_uri);
ui->binary_uri = NULL;
slv2_values_free(ui->classes);
-
+
free(ui);
}
diff --git a/src/pluginuiinstance.c b/src/pluginuiinstance.c
index c1c4720..44b41e5 100644
--- a/src/pluginuiinstance.c
+++ b/src/pluginuiinstance.c
@@ -40,48 +40,48 @@ slv2_ui_instantiate(SLV2Plugin plugin,
const LV2_Feature* const* features)
{
struct _SLV2UIInstance* result = NULL;
-
+
bool local_features = (features == NULL);
if (local_features) {
features = malloc(sizeof(LV2_Feature));
((LV2_Feature**)features)[0] = NULL;
}
-
+
const char* const lib_uri = slv2_value_as_string(slv2_ui_get_binary_uri(ui));
const char* const lib_path = slv2_uri_to_path(lib_uri);
-
+
if (!lib_path)
return NULL;
-
+
dlerror();
void* lib = dlopen(lib_path, RTLD_NOW);
if (!lib) {
fprintf(stderr, "Unable to open UI library %s (%s)\n", lib_path, dlerror());
return NULL;
}
-
+
LV2UI_DescriptorFunction df = dlsym(lib, "lv2ui_descriptor");
-
+
if (!df) {
fprintf(stderr, "Could not find symbol 'lv2ui_descriptor', "
"%s is not a LV2 plugin UI.\n", lib_path);
dlclose(lib);
return NULL;
} else {
-
+
const char* bundle_path = slv2_uri_to_path(slv2_value_as_uri(slv2_ui_get_bundle_uri(ui)));
-
+
for (uint32_t i=0; 1; ++i) {
-
+
const LV2UI_Descriptor* ld = df(i);
-
+
if (!ld) {
fprintf(stderr, "Did not find UI %s in %s\n",
slv2_value_as_uri(slv2_ui_get_uri(ui)), lib_path);
dlclose(lib);
break; // return NULL
} else if (!strcmp(ld->URI, slv2_value_as_uri(slv2_ui_get_uri(ui)))) {
-
+
assert(plugin->plugin_uri);
printf("Found UI %s at index %u in:\n\t%s\n\n",
@@ -93,9 +93,9 @@ slv2_ui_instantiate(SLV2Plugin plugin,
result = malloc(sizeof(struct _SLV2UIInstance));
struct _SLV2UIInstanceImpl* impl = malloc(sizeof(struct _SLV2UIInstanceImpl));
impl->lv2ui_descriptor = ld;
- impl->lv2ui_handle = ld->instantiate(ld,
+ impl->lv2ui_handle = ld->instantiate(ld,
slv2_value_as_uri(slv2_plugin_get_uri(plugin)),
- (char*)bundle_path,
+ (char*)bundle_path,
write_function,
controller,
&impl->widget,
@@ -114,7 +114,7 @@ slv2_ui_instantiate(SLV2Plugin plugin,
free(result);
return NULL;
}
-
+
// Failed to create a widget, but still got a handle - this means that
// the plugin is buggy
if (result->pimpl->widget == NULL) {
diff --git a/src/port.c b/src/port.c
index e72aba0..6ccd0f3 100644
--- a/src/port.c
+++ b/src/port.c
@@ -1,6 +1,6 @@
/* SLV2
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* This library 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
* Software Foundation; either version 2 of the License, or (at your option)
@@ -90,12 +90,12 @@ slv2_port_has_property(SLV2Plugin p,
"<", slv2_value_as_uri(p->plugin_uri), "> lv2:port ?port ."
"?port lv2:symbol \"", slv2_value_as_string(port->symbol), "\";\n",
" lv2:portProperty <", slv2_value_as_uri(property), "> .\n}", NULL);
-
+
SLV2Values results = slv2_plugin_query_variable(p, query, 0);
const bool ret = (slv2_values_size(results) > 0);
slv2_values_free(results);
free(query);
-
+
return ret;
}
@@ -113,7 +113,7 @@ slv2_port_supports_event(SLV2Plugin p,
"?port lv2:symbol \"", slv2_value_as_string(port->symbol), "\";\n",
" lv2ev:supportsEvent <", slv2_value_as_uri(event), "> .\n"
"}", NULL);
-
+
SLV2Results results = slv2_plugin_query_sparql(p, query);
assert(librdf_query_results_is_boolean(results->rdf_results));
@@ -121,7 +121,7 @@ slv2_port_supports_event(SLV2Plugin p,
free(query);
slv2_results_free(results);
-
+
return ret;
}
@@ -140,7 +140,7 @@ slv2_port_get_value_by_qname(SLV2Plugin p,
"?port lv2:symbol \"", slv2_value_as_string(port->symbol), "\";\n\t",
property, " ?value .\n"
"FILTER(lang(?value) = \"\") }", NULL);
-
+
results = slv2_plugin_query_variable(p, query, 0);
free(query);
@@ -154,7 +154,7 @@ slv2_port_get_value(SLV2Plugin p,
SLV2Value predicate)
{
char* query = NULL;
-
+
/* Hack around broken RASQAL, full URI predicates don't work :/ */
query = slv2_strjoin(
"PREFIX slv2predicate: <", slv2_value_as_string(predicate), ">",
@@ -165,7 +165,7 @@ slv2_port_get_value(SLV2Plugin p,
"}\n", NULL);
SLV2Values result = slv2_plugin_query_variable(p, query, 0);
-
+
free(query);
return result;
@@ -185,9 +185,9 @@ slv2_port_get_value_by_qname_i18n(SLV2Plugin p,
"<", slv2_value_as_uri(p->plugin_uri), "> lv2:port ?port .\n"
"?port lv2:symbol \"", slv2_value_as_string(port->symbol), "\";\n\t",
property, " ?value .\n"
- "FILTER(lang(?value) = \"", slv2_get_lang(),
+ "FILTER(lang(?value) = \"", slv2_get_lang(),
"\") }", NULL);
-
+
results = slv2_plugin_query_variable(p, query, 0);
free(query);
@@ -202,7 +202,7 @@ slv2_port_get_symbol(SLV2Plugin p,
return port->symbol;
}
-
+
SLV2Value
slv2_port_get_name(SLV2Plugin p,
SLV2Port port)
@@ -217,13 +217,13 @@ slv2_port_get_name(SLV2Plugin p,
if (results && slv2_values_size(results) > 0)
ret = slv2_value_duplicate(slv2_values_get_at(results, 0));
}
-
+
slv2_values_free(results);
return ret;
}
-
+
SLV2Values
slv2_port_get_classes(SLV2Plugin p,
SLV2Port port)
@@ -233,7 +233,7 @@ slv2_port_get_classes(SLV2Plugin p,
void
-slv2_port_get_range(SLV2Plugin p,
+slv2_port_get_range(SLV2Plugin p,
SLV2Port port,
SLV2Value* def,
SLV2Value* min,
@@ -254,7 +254,7 @@ slv2_port_get_range(SLV2Plugin p,
"OPTIONAL { ?port lv2:minimum ?min }\n",
"OPTIONAL { ?port lv2:maximum ?max }\n",
"\n}", NULL);
-
+
SLV2Results results = slv2_plugin_query_sparql(p, query);
while (!librdf_query_results_finished(results->rdf_results)) {
@@ -274,7 +274,7 @@ slv2_port_get_range(SLV2Plugin p,
librdf_query_results_next(results->rdf_results);
}
-
+
slv2_results_free(results);
free(query);
@@ -293,9 +293,9 @@ slv2_port_get_scale_points(SLV2Plugin p,
"?point rdf:value ?value ;\n"
" rdfs:label ?label .\n"
"\n} ORDER BY ?value", NULL);
-
+
SLV2Results results = slv2_plugin_query_sparql(p, query);
-
+
SLV2ScalePoints ret = NULL;
if (!slv2_results_finished(results))
@@ -307,10 +307,10 @@ slv2_port_get_scale_points(SLV2Plugin p,
if (value && label)
raptor_sequence_push(ret, slv2_scale_point_new(value, label));
-
+
slv2_results_next(results);
}
-
+
slv2_results_free(results);
free(query);
diff --git a/src/query.c b/src/query.c
index 8990c9b..8655eab 100644
--- a/src/query.c
+++ b/src/query.c
@@ -1,6 +1,6 @@
/* SLV2
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* This library 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
* Software Foundation; either version 2 of the License, or (at your option)
@@ -137,24 +137,24 @@ slv2_plugin_query_sparql(SLV2Plugin plugin,
char* query_str = slv2_strjoin(slv2_query_prefixes, sparql_str, NULL);
//printf("******** Query \n%s********\n", query_str);
-
+
librdf_query* query = librdf_new_query(plugin->world->world, "sparql", NULL,
(const unsigned char*)query_str, base_uri);
-
+
if (!query) {
fprintf(stderr, "ERROR: Could not create query\n");
return NULL;
}
-
+
// FIXME: locale kludges to work around librdf bug
char* locale = strdup(setlocale(LC_NUMERIC, NULL));
setlocale(LC_NUMERIC, "POSIX");
librdf_query_results* results = librdf_query_execute(query, plugin->rdf);
setlocale(LC_NUMERIC, locale);
-
+
free(locale);
-
+
librdf_free_query(query);
free(query_str);
@@ -225,7 +225,7 @@ slv2_plugin_query_variable(SLV2Plugin plugin,
SLV2Values ret = slv2_query_get_variable_bindings(plugin->world,
results, (int)variable);
-
+
slv2_results_free(results);
return ret;
@@ -236,7 +236,7 @@ slv2_plugin_query_variable(SLV2Plugin plugin,
*
* More efficient than slv2_plugin_simple_query if you're only interested
* in the number of results (ie slv2_plugin_num_ports).
- *
+ *
* Note the result of this function is probably meaningless unless the query
* is a SELECT DISTINCT.
*/
diff --git a/src/scalepoint.c b/src/scalepoint.c
index 29bedf9..8c22ce2 100644
--- a/src/scalepoint.c
+++ b/src/scalepoint.c
@@ -1,6 +1,6 @@
/* SLV2
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* This library 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
* Software Foundation; either version 2 of the License, or (at your option)
diff --git a/src/slv2_internal.h b/src/slv2_internal.h
index a6de9ad..d55c0dc 100644
--- a/src/slv2_internal.h
+++ b/src/slv2_internal.h
@@ -1,6 +1,6 @@
/* SLV2
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* This library 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
* Software Foundation; either version 2 of the License, or (at your option)
@@ -157,7 +157,7 @@ void
slv2_world_load_path(SLV2World world,
const char* search_path);
-
+
void
slv2_world_load_specifications(SLV2World world);
@@ -210,7 +210,7 @@ SLV2Value slv2_value_new_librdf_node(SLV2World world, librdf_node* node);
SLV2Value slv2_value_new_librdf_uri(SLV2World world, librdf_uri* uri);
librdf_uri* slv2_value_as_librdf_uri(SLV2Value value);
-
+
/* ********* Values ********* */
void slv2_values_set_at(SLV2Values list, unsigned index, void* value);
diff --git a/src/util.c b/src/util.c
index 71094ab..3e6afb9 100644
--- a/src/util.c
+++ b/src/util.c
@@ -1,6 +1,6 @@
/* SLV2
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* This library 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
* Software Foundation; either version 2 of the License, or (at your option)
@@ -71,7 +71,7 @@ slv2_uri_to_path(const char* uri)
}
-char*
+char*
slv2_get_lang()
{
static char lang[32];
diff --git a/src/value.c b/src/value.c
index ae24a68..d05ba58 100644
--- a/src/value.c
+++ b/src/value.c
@@ -1,6 +1,6 @@
/* SLV2
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* This library 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
* Software Foundation; either version 2 of the License, or (at your option)
@@ -45,7 +45,7 @@ slv2_value_set_numerics_from_string(SLV2Value val)
val->val.float_val = strtod(val->str_val, &endptr);
setlocale(LC_NUMERIC, locale);
}
-
+
free(locale);
}
@@ -78,7 +78,7 @@ slv2_value_new_librdf_node(SLV2World world, librdf_node* node)
SLV2Value val = (SLV2Value)malloc(sizeof(struct _SLV2Value));
val->type = SLV2_VALUE_STRING;
val->str_val = NULL;
-
+
librdf_uri* datatype_uri = NULL;
switch (librdf_node_get_type(node)) {
@@ -107,7 +107,7 @@ slv2_value_new_librdf_node(SLV2World world, librdf_node* node)
val = NULL;
break;
}
-
+
if (val)
slv2_value_set_numerics_from_string(val);
@@ -227,7 +227,7 @@ slv2_value_get_turtle_token(SLV2Value value)
size_t len = 0;
char* result = NULL;
char* locale = strdup(setlocale(LC_NUMERIC, NULL));
-
+
// FIXME: locale kludges to work around librdf bug
switch (value->type) {
@@ -258,7 +258,7 @@ slv2_value_get_turtle_token(SLV2Value value)
}
free(locale);
-
+
return result;
}
@@ -277,7 +277,7 @@ slv2_value_as_uri(SLV2Value value)
return value->str_val;
}
-
+
/* private */
librdf_uri*
slv2_value_as_librdf_uri(SLV2Value value)
diff --git a/src/world.c b/src/world.c
index 88a1f63..d905e52 100644
--- a/src/world.c
+++ b/src/world.c
@@ -1,6 +1,6 @@
/* SLV2
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* This library 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
* Software Foundation; either version 2 of the License, or (at your option)
@@ -44,7 +44,7 @@ slv2_world_new_internal(SLV2World world)
world->storage = librdf_new_storage(world->world, "hashes", NULL,
"hash-type='memory'");
}
-
+
if (!world->storage)
goto fail;
@@ -57,27 +57,27 @@ slv2_world_new_internal(SLV2World world)
goto fail;
world->plugin_classes = slv2_plugin_classes_new();
-
+
world->plugins = slv2_plugins_new();
-
+
world->lv2_specification_node = librdf_new_node_from_uri_string(world->world,
(const unsigned char*)"http://lv2plug.in/ns/lv2core#Specification");
-
+
world->lv2_plugin_node = librdf_new_node_from_uri_string(world->world,
(const unsigned char*)"http://lv2plug.in/ns/lv2core#Plugin");
-
+
world->rdf_a_node = librdf_new_node_from_uri_string(world->world,
(const unsigned char*)"http://www.w3.org/1999/02/22-rdf-syntax-ns#type");
-
+
world->xsd_integer_node = librdf_new_node_from_uri_string(world->world,
(const unsigned char*)"http://www.w3.org/2001/XMLSchema#integer");
-
+
world->xsd_decimal_node = librdf_new_node_from_uri_string(world->world,
(const unsigned char*)"http://www.w3.org/2001/XMLSchema#decimal");
-
+
world->lv2_plugin_class = slv2_plugin_class_new(world, NULL,
librdf_node_get_uri(world->lv2_plugin_node), "Plugin");
-
+
return world;
fail:
@@ -96,11 +96,11 @@ slv2_world_new()
free(world);
return NULL;
}
-
+
world->local_world = true;
-
+
librdf_world_open(world->world);
-
+
return slv2_world_new_internal(world);
}
@@ -136,24 +136,24 @@ slv2_world_free(SLV2World world)
slv2_plugin_free(raptor_sequence_get_at(world->plugins, i));
raptor_free_sequence(world->plugins);
world->plugins = NULL;
-
+
raptor_free_sequence(world->plugin_classes);
world->plugin_classes = NULL;
-
+
librdf_free_parser(world->parser);
world->parser = NULL;
-
+
librdf_free_model(world->model);
world->model = NULL;
-
+
librdf_free_storage(world->storage);
world->storage = NULL;
-
+
if (world->local_world)
librdf_free_world(world->world);
world->world = NULL;
-
+
free(world);
}
@@ -181,7 +181,7 @@ slv2_world_load_bundle(SLV2World world, SLV2Value bundle_uri)
librdf_model* manifest_model = librdf_new_model(world->world,
manifest_storage, NULL);
- librdf_parser_parse_into_model(world->parser, manifest_uri, NULL,
+ librdf_parser_parse_into_model(world->parser, manifest_uri, NULL,
manifest_model);
/* Query statement: ?plugin a lv2:Plugin */
@@ -198,16 +198,16 @@ slv2_world_load_bundle(SLV2World world, SLV2Value bundle_uri)
/* Add ?plugin rdfs:seeAlso <manifest.ttl>*/
librdf_node* subject = plugin_node;
- librdf_node* predicate = librdf_new_node_from_uri_string(world->world,
+ librdf_node* predicate = librdf_new_node_from_uri_string(world->world,
(unsigned char*)"http://www.w3.org/2000/01/rdf-schema#seeAlso");
librdf_node* object = librdf_new_node_from_uri(world->world,
manifest_uri);
librdf_model_add(world->model, subject, predicate, object);
-
+
/* Add ?plugin slv2:bundleURI <file://some/path> */
subject = librdf_new_node_from_node(plugin_node);
- predicate = librdf_new_node_from_uri_string(world->world,
+ predicate = librdf_new_node_from_uri_string(world->world,
(unsigned char*)"http://drobilla.net/ns/slv2#bundleURI");
object = librdf_new_node_from_uri(world->world, bundle_uri->val.uri_val);
@@ -215,10 +215,10 @@ slv2_world_load_bundle(SLV2World world, SLV2Value bundle_uri)
librdf_stream_next(results);
}
-
+
librdf_free_stream(results);
librdf_free_statement(q);
-
+
/* Query statement: ?specification a lv2:Specification */
q = librdf_new_statement_from_nodes(world->world,
NULL, librdf_new_node_from_node(world->rdf_a_node),
@@ -233,16 +233,16 @@ slv2_world_load_bundle(SLV2World world, SLV2Value bundle_uri)
/* Add ?specification rdfs:seeAlso <manifest.ttl> */
librdf_node* subject = spec_node;
- librdf_node* predicate = librdf_new_node_from_uri_string(world->world,
+ librdf_node* predicate = librdf_new_node_from_uri_string(world->world,
(unsigned char*)"http://www.w3.org/2000/01/rdf-schema#seeAlso");
librdf_node* object = librdf_new_node_from_uri(world->world,
manifest_uri);
-
+
librdf_model_add(world->model, subject, predicate, object);
-
+
/* Add ?specification slv2:bundleURI <file://some/path> */
subject = librdf_new_node_from_node(spec_node);
- predicate = librdf_new_node_from_uri_string(world->world,
+ predicate = librdf_new_node_from_uri_string(world->world,
(unsigned char*)"http://drobilla.net/ns/slv2#bundleURI");
object = librdf_new_node_from_uri(world->world, bundle_uri->val.uri_val);
@@ -250,10 +250,10 @@ slv2_world_load_bundle(SLV2World world, SLV2Value bundle_uri)
librdf_stream_next(results);
}
-
+
librdf_free_stream(results);
librdf_free_statement(q);
-
+
/* Join the temporary model to the main model */
librdf_stream* manifest_stream = librdf_model_as_stream(manifest_model);
librdf_model_add_statements(world->model, manifest_stream);
@@ -274,7 +274,7 @@ slv2_world_load_directory(SLV2World world, const char* dir)
DIR* pdir = opendir(dir);
if (!pdir)
return;
-
+
struct dirent* pfile;
while ((pfile = readdir(pdir))) {
if (!strcmp(pfile->d_name, ".") || !strcmp(pfile->d_name, ".."))
@@ -291,7 +291,7 @@ slv2_world_load_directory(SLV2World world, const char* dir)
slv2_world_load_bundle(world, uri_val);
slv2_value_free(uri_val);
}
-
+
free(uri);
}
@@ -305,19 +305,19 @@ slv2_world_load_path(SLV2World world,
{
char* path = slv2_strjoin(lv2_path, ":", NULL);
char* dir = path; // Pointer into path
-
+
// Go through string replacing ':' with '\0', using the substring,
// then replacing it with 'X' and moving on. i.e. strtok on crack.
while (strchr(path, ':') != NULL) {
char* delim = strchr(path, ':');
*delim = '\0';
-
+
slv2_world_load_directory(world, dir);
-
+
*delim = 'X';
dir = delim + 1;
}
-
+
free(path);
}
@@ -356,9 +356,9 @@ slv2_world_load_specifications(SLV2World world)
" ?spec a :Specification ;\n"
" rdfs:seeAlso ?data .\n"
"}\n";
-
+
librdf_query* q = librdf_new_query(world->world, "sparql", NULL, query_string, NULL);
-
+
librdf_query_results* results = librdf_query_execute(q, world->model);
while (!librdf_query_results_finished(results)) {
@@ -385,9 +385,9 @@ slv2_world_load_plugin_classes(SLV2World world)
{
// FIXME: This will need to be a bit more clever when more data is around
// then the ontology (ie classes which aren't LV2 plugin_classes)
-
+
// FIXME: This loads things that aren't plugin categories
-
+
unsigned char* query_string = (unsigned char*)
"PREFIX : <http://lv2plug.in/ns/lv2core#>\n"
"PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n"
@@ -395,10 +395,10 @@ slv2_world_load_plugin_classes(SLV2World world)
//" ?plugin a ?class .\n"
" ?class a rdfs:Class; rdfs:subClassOf ?parent; rdfs:label ?label\n"
"}\n"; // ORDER BY ?class\n";
-
+
librdf_query* q = librdf_new_query(world->world, "sparql",
NULL, query_string, NULL);
-
+
librdf_query_results* results = librdf_query_execute(q, world->model);
while (!librdf_query_results_finished(results)) {
@@ -425,7 +425,7 @@ slv2_world_load_plugin_classes(SLV2World world)
}
// FIXME: filter list here
-
+
librdf_free_query_results(results);
librdf_free_query(q);
}
@@ -463,7 +463,7 @@ slv2_world_load_all(SLV2World world)
free(lv2_path);
}
-
+
/* 2. Query out things to cache */
slv2_world_load_specifications(world);
@@ -478,10 +478,10 @@ slv2_world_load_all(SLV2World world)
"SELECT DISTINCT ?plugin ?data ?bundle\n"
"WHERE { ?plugin a :Plugin; slv2:bundleURI ?bundle; rdfs:seeAlso ?data }\n";
//"ORDER BY ?plugin\n";
-
+
librdf_query* q = librdf_new_query(world->world, "sparql",
NULL, query_string, NULL);
-
+
librdf_query_results* results = librdf_query_execute(q, world->model);
while (!librdf_query_results_finished(results)) {
@@ -524,7 +524,7 @@ slv2_world_load_all(SLV2World world)
if (results)
librdf_free_query_results(results);
-
+
librdf_free_query(q);
}
@@ -535,7 +535,7 @@ slv2_world_serialize(const char* filename)
{
librdf_uri* lv2_uri = librdf_new_uri(slv2_rdf_world,
(unsigned char*)"http://lv2plug.in/ns/lv2core#");
-
+
librdf_uri* rdfs_uri = librdf_new_uri(slv2_rdf_world,
(unsigned char*)"http://www.w3.org/2000/01/rdf-schema#");
@@ -590,17 +590,17 @@ slv2_world_get_plugins_by_filter(SLV2World world, bool (*include)(SLV2Plugin))
SLV2Plugins
slv2_world_get_plugins_by_query(SLV2World world, const char* query)
{
- SLV2Plugins list = slv2_plugins_new();
+ SLV2Plugins list = slv2_plugins_new();
librdf_query* rq = librdf_new_query(world->world, "sparql",
NULL, (const unsigned char*)query, NULL);
-
+
librdf_query_results* results = librdf_query_execute(rq, world->model);
-
+
while (!librdf_query_results_finished(results)) {
librdf_node* plugin_node = librdf_query_results_get_binding_value(results, 0);
librdf_uri* plugin_uri = librdf_node_get_uri(plugin_node);
-
+
SLV2Plugin plugin = slv2_plugins_get_by_uri(list,
(const char*)librdf_uri_as_string(plugin_uri));
@@ -609,15 +609,15 @@ slv2_world_get_plugins_by_query(SLV2World world, const char* query)
SLV2Plugin new_plugin = slv2_plugin_new(world, plugin_uri);
raptor_sequence_push(list, new_plugin);
}
-
+
librdf_free_node(plugin_node);
-
+
librdf_query_results_next(results);
- }
-
+ }
+
if (results)
librdf_free_query_results(results);
-
+
librdf_free_query(rq);
return list;
diff --git a/test/slv2_test.c b/test/slv2_test.c
index 24f26a0..5f5bd50 100644
--- a/test/slv2_test.c
+++ b/test/slv2_test.c
@@ -222,7 +222,7 @@ test_value()
TEST_ASSERT(slv2_value_is_string(sval));
TEST_ASSERT(slv2_value_is_int(ival));
TEST_ASSERT(slv2_value_is_float(fval));
-
+
TEST_ASSERT(!slv2_value_is_literal(uval));
TEST_ASSERT(slv2_value_is_literal(sval));
TEST_ASSERT(slv2_value_is_literal(ival));
@@ -245,7 +245,7 @@ test_value()
tok = slv2_value_get_turtle_token(fval);
TEST_ASSERT(!strncmp(tok, "1.6180", 6));
free(tok);
-
+
SLV2Value uval_e = slv2_value_new_uri(world, "http://example.org");
SLV2Value sval_e = slv2_value_new_string(world, "Foo");
SLV2Value ival_e = slv2_value_new_int(world, 42);
@@ -259,23 +259,23 @@ test_value()
TEST_ASSERT(slv2_value_equals(sval, sval_e));
TEST_ASSERT(slv2_value_equals(ival, ival_e));
TEST_ASSERT(slv2_value_equals(fval, fval_e));
-
+
TEST_ASSERT(!slv2_value_equals(uval, uval_ne));
TEST_ASSERT(!slv2_value_equals(sval, sval_ne));
TEST_ASSERT(!slv2_value_equals(ival, ival_ne));
TEST_ASSERT(!slv2_value_equals(fval, fval_ne));
-
+
TEST_ASSERT(!slv2_value_equals(uval, sval));
TEST_ASSERT(!slv2_value_equals(sval, ival));
TEST_ASSERT(!slv2_value_equals(ival, fval));
-
+
SLV2Value uval_dup = slv2_value_duplicate(uval);
TEST_ASSERT(slv2_value_equals(uval, uval_dup));
SLV2Value ifval = slv2_value_new_float(world, 42.0);
TEST_ASSERT(!slv2_value_equals(ival, ifval));
slv2_value_free(ifval);
-
+
SLV2Value nil = NULL;
TEST_ASSERT(!slv2_value_equals(uval, nil));
TEST_ASSERT(!slv2_value_equals(nil, uval));
@@ -517,7 +517,7 @@ test_classes()
SLV2PluginClass plugin = slv2_world_get_plugin_class(world);
SLV2PluginClasses classes = slv2_world_get_plugin_classes(world);
SLV2PluginClasses children = slv2_plugin_class_get_children(plugin);
-
+
TEST_ASSERT(slv2_plugin_class_get_parent_uri(plugin) == NULL);
TEST_ASSERT(slv2_plugin_classes_size(classes) > slv2_plugin_classes_size(children));
TEST_ASSERT(!strcmp(slv2_value_as_string(slv2_plugin_class_get_label(plugin)), "Plugin"));
@@ -533,9 +533,9 @@ test_classes()
SLV2Value some_uri = slv2_value_new_uri(world, "http://example.org/whatever");
TEST_ASSERT(slv2_plugin_classes_get_by_uri(classes, some_uri) == NULL);
slv2_value_free(some_uri);
-
+
TEST_ASSERT(slv2_plugin_classes_get_at(classes, (unsigned)INT_MAX + 1) == NULL);
-
+
slv2_plugin_classes_free(children);
cleanup_uris();
@@ -574,7 +574,7 @@ test_plugin()
"] . \n"
":thing doap:name \"Something else\" .\n"))
return 0;
-
+
init_uris();
SLV2Plugins plugins = slv2_world_get_all_plugins(world);
SLV2Plugin plug = slv2_plugins_get_by_uri(plugins, plugin_uri_value);
@@ -587,17 +587,17 @@ test_plugin()
SLV2Value plug_bundle_uri = slv2_plugin_get_bundle_uri(plug);
TEST_ASSERT(!strcmp(slv2_value_as_string(plug_bundle_uri), bundle_dir_uri));
-
+
SLV2Values data_uris = slv2_plugin_get_data_uris(plug);
TEST_ASSERT(slv2_values_size(data_uris) == 2);
-
+
char* manifest_uri = (char*)malloc(TEST_PATH_MAX);
char* data_uri = (char*)malloc(TEST_PATH_MAX);
snprintf(manifest_uri, TEST_PATH_MAX, "%s%s",
slv2_value_as_string(plug_bundle_uri), "manifest.ttl");
snprintf(data_uri, TEST_PATH_MAX, "%s%s",
slv2_value_as_string(plug_bundle_uri), "plugin.ttl");
-
+
SLV2Value manifest_uri_val = slv2_value_new_uri(world, manifest_uri);
TEST_ASSERT(slv2_values_contains(data_uris, manifest_uri_val));
slv2_value_free(manifest_uri_val);
@@ -615,7 +615,7 @@ test_plugin()
TEST_ASSERT(mins[0] == -1.0f);
TEST_ASSERT(maxs[0] == 1.0f);
TEST_ASSERT(defs[0] == 0.5f);
-
+
SLV2Value audio_class = slv2_value_new_uri(world,
"http://lv2plug.in/ns/lv2core#AudioPort");
SLV2Value control_class = slv2_value_new_uri(world,
@@ -661,7 +661,7 @@ test_plugin()
slv2_values_free(supported);
slv2_values_free(required);
slv2_values_free(optional);
-
+
SLV2Value foo_p = slv2_value_new_uri(world, "http://example.org/foo");
SLV2Values foos = slv2_plugin_get_value(plug, foo_p);
TEST_ASSERT(slv2_values_size(foos) == 1);
@@ -672,11 +672,11 @@ test_plugin()
SLV2Value author_name = slv2_plugin_get_author_name(plug);
TEST_ASSERT(!strcmp(slv2_value_as_string(author_name), "David Robillard"));
slv2_value_free(author_name);
-
+
SLV2Value author_email = slv2_plugin_get_author_email(plug);
TEST_ASSERT(!strcmp(slv2_value_as_string(author_email), "mailto:dave@drobilla.net"));
slv2_value_free(author_email);
-
+
SLV2Value author_homepage = slv2_plugin_get_author_homepage(plug);
TEST_ASSERT(!strcmp(slv2_value_as_string(author_homepage), "http://drobilla.net"));
slv2_value_free(author_homepage);
@@ -689,10 +689,10 @@ test_plugin()
TEST_ASSERT(thing_name);
TEST_ASSERT(slv2_value_is_string(thing_name));
TEST_ASSERT(!strcmp(slv2_value_as_string(thing_name), "Something else"));
-
+
SLV2UIs uis = slv2_plugin_get_uis(plug);
TEST_ASSERT(slv2_uis_size(uis) == 0);
-
+
SLV2Results results = slv2_plugin_query_sparql(plug,
"SELECT ?name WHERE { <> doap:maintainer [ foaf:name ?name ] }");
TEST_ASSERT(!slv2_results_finished(results));
@@ -758,7 +758,7 @@ test_port()
TEST_ASSERT(p != NULL);
TEST_ASSERT(p2 != NULL);
TEST_ASSERT(p == p2);
-
+
SLV2Value nopsym = slv2_value_new_string(world, "thisaintnoportfoo");
SLV2Port p3 = slv2_plugin_get_port_by_symbol(plug, nopsym);
TEST_ASSERT(p3 == NULL);
@@ -777,7 +777,7 @@ test_port()
TEST_ASSERT(slv2_port_is_a(plug, p, control_class));
TEST_ASSERT(slv2_port_is_a(plug, p, in_class));
TEST_ASSERT(!slv2_port_is_a(plug, p, audio_class));
-
+
TEST_ASSERT(slv2_values_size(slv2_port_get_properties(plug, p)) == 0);
TEST_ASSERT(!strcmp(slv2_value_as_string(slv2_port_get_symbol(plug, p)), "foo"));
@@ -794,7 +794,7 @@ test_port()
TEST_ASSERT(sp0);
SLV2ScalePoint sp1 = slv2_scale_points_get_at(points, 1);
TEST_ASSERT(sp1);
-
+
TEST_ASSERT(!strcmp(slv2_value_as_string(slv2_scale_point_get_label(sp0)), "Sin"));
TEST_ASSERT(slv2_value_as_float(slv2_scale_point_get_value(sp0)) == 3);
TEST_ASSERT(!strcmp(slv2_value_as_string(slv2_scale_point_get_label(sp1)), "Cos"));
@@ -808,10 +808,10 @@ test_port()
TEST_ASSERT(slv2_plugin_query_count(plug, "SELECT DISTINCT ?bin WHERE {\n"
"<> lv2:binary ?bin . }") == 1);
-
+
TEST_ASSERT(slv2_plugin_query_count(plug, "SELECT DISTINCT ?parent WHERE {\n"
"<> rdfs:subClassOf ?parent . }") == 0);
-
+
SLV2Value min, max, def;
slv2_port_get_range(plug, p, &def, &min, &max);
TEST_ASSERT(def);
@@ -820,20 +820,20 @@ test_port()
TEST_ASSERT(slv2_value_as_float(def) == 0.5);
TEST_ASSERT(slv2_value_as_float(min) == -1.0);
TEST_ASSERT(slv2_value_as_float(max) == 1.0);
-
+
SLV2Value integer_prop = slv2_value_new_uri(world, "http://lv2plug.in/ns/lv2core#integer");
SLV2Value toggled_prop = slv2_value_new_uri(world, "http://lv2plug.in/ns/lv2core#toggled");
TEST_ASSERT(slv2_port_has_property(plug, p, integer_prop));
TEST_ASSERT(!slv2_port_has_property(plug, p, toggled_prop));
-
+
SLV2Port ep = slv2_plugin_get_port_by_index(plug, 1);
SLV2Value event_type = slv2_value_new_uri(world, "http://example.org/event");
SLV2Value event_type_2 = slv2_value_new_uri(world, "http://example.org/otherEvent");
TEST_ASSERT(slv2_port_supports_event(plug, ep, event_type));
TEST_ASSERT(!slv2_port_supports_event(plug, ep, event_type_2));
-
+
SLV2Value name_p = slv2_value_new_uri(world, "http://lv2plug.in/ns/lv2core#name");
SLV2Values names = slv2_port_get_value(plug, p, name_p);
TEST_ASSERT(slv2_values_size(names) == 2);
@@ -928,16 +928,16 @@ test_ui()
SLV2UI ui0_2 = slv2_uis_get_by_uri(uis, ui_uri);
TEST_ASSERT(ui0 == ui0_2);
-
+
SLV2UI ui2 = slv2_uis_get_by_uri(uis, ui2_uri);
TEST_ASSERT(ui2 != ui0);
-
+
SLV2UI ui3 = slv2_uis_get_by_uri(uis, ui3_uri);
TEST_ASSERT(ui3 != ui0);
-
+
SLV2UI noui = slv2_uis_get_by_uri(uis, noui_uri);
TEST_ASSERT(noui == NULL);
-
+
SLV2Values classes = slv2_ui_get_classes(ui0);
TEST_ASSERT(slv2_values_size(classes) == 1);
@@ -946,7 +946,7 @@ test_ui()
TEST_ASSERT(slv2_value_equals(slv2_values_get_at(classes, 0), ui_class_uri));
TEST_ASSERT(slv2_ui_is_a(ui0, ui_class_uri));
-
+
SLV2Value plug_bundle_uri = slv2_plugin_get_bundle_uri(plug);
SLV2Value ui_bundle_uri = slv2_ui_get_bundle_uri(ui0);
TEST_ASSERT(slv2_value_equals(plug_bundle_uri, ui_bundle_uri));
diff --git a/utils/ladspa.h b/utils/ladspa.h
index 5c30a8a..b1a9c4e 100644
--- a/utils/ladspa.h
+++ b/utils/ladspa.h
@@ -3,17 +3,17 @@
Linux Audio Developer's Simple Plugin API Version 1.1[LGPL].
Copyright (C) 2000-2002 Richard W.E. Furse, Paul Barton-Davis,
Stefan Westerfeld.
-
+
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public License
as published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version.
-
+
This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -32,7 +32,7 @@ extern "C" {
/*****************************************************************************/
-/* Overview:
+/* Overview:
There is a large number of synthesis packages in use or development
on the Linux platform at this time. This API (`The Linux Audio
@@ -76,7 +76,7 @@ extern "C" {
/* Fundamental data type passed in and out of plugin. This data type
is used to communicate audio samples and control values. It is
assumed that the plugin will work sensibly given any numeric input
- value although it may have a preferred range (see hints below).
+ value although it may have a preferred range (see hints below).
For audio it is generally assumed that 1.0f is the `0dB' reference
amplitude and is a `normal' signal level. */
@@ -85,8 +85,8 @@ typedef float LADSPA_Data;
/*****************************************************************************/
-/* Special Plugin Properties:
-
+/* Special Plugin Properties:
+
Optional features of the plugin type are encapsulated in the
LADSPA_Properties type. This is assembled by ORing individual
properties together. */
@@ -122,7 +122,7 @@ typedef int LADSPA_Properties;
(3) The plugin will not access files, devices, pipes, sockets, IPC
or any other mechanism that might result in process or thread
blocking.
-
+
(4) The plugin will take an amount of time to execute a run() or
run_adding() call approximately of form (A+B*SampleCount) where A
and B depend on the machine and host in use. This amount of time
@@ -137,7 +137,7 @@ typedef int LADSPA_Properties;
/*****************************************************************************/
-/* Plugin Ports:
+/* Plugin Ports:
Plugins have `ports' that are inputs or outputs for audio or
data. Ports can communicate arrays of LADSPA_Data (for audio
@@ -172,23 +172,23 @@ typedef int LADSPA_PortDescriptor;
/*****************************************************************************/
-/* Plugin Port Range Hints:
+/* Plugin Port Range Hints:
The host may wish to provide a representation of data entering or
leaving a plugin (e.g. to generate a GUI automatically). To make
this more meaningful, the plugin should provide `hints' to the host
describing the usual values taken by the data.
-
+
Note that these are only hints. The host may ignore them and the
plugin must not assume that data supplied to it is meaningful. If
the plugin receives invalid input data it is expected to continue
to run without failure and, where possible, produce a sensible
output (e.g. a high-pass filter given a negative cutoff frequency
might switch to an all-pass mode).
-
+
Hints are meaningful for all input and output ports but hints for
input control ports are expected to be particularly useful.
-
+
More hint information is encapsulated in the
LADSPA_PortRangeHintDescriptor type which is assembled by ORing
individual hint types together. Hints may require further
@@ -353,7 +353,7 @@ typedef struct _LADSPA_PortRangeHint {
/*****************************************************************************/
-/* Plugin Handles:
+/* Plugin Handles:
This plugin handle indicates a particular instance of the plugin
concerned. It is valid to compare this to NULL (0 for C++) but
@@ -364,13 +364,13 @@ typedef void * LADSPA_Handle;
/*****************************************************************************/
-/* Descriptor for a Type of Plugin:
+/* Descriptor for a Type of Plugin:
This structure is used to describe a plugin type. It provides a
number of functions to examine the type, instantiate it, link it to
buffers and workspaces and to run it. */
-typedef struct _LADSPA_Descriptor {
+typedef struct _LADSPA_Descriptor {
/* This numeric identifier indicates the plugin type
uniquely. Plugin programmers may reserve ranges of IDs from a
@@ -430,7 +430,7 @@ typedef struct _LADSPA_Descriptor {
instantiation function accepts a sample rate as a parameter. The
plugin descriptor from which this instantiate function was found
must also be passed. This function must return NULL if
- instantiation fails.
+ instantiation fails.
Note that instance initialisation should generally occur in
activate() rather than here. */
@@ -551,7 +551,7 @@ typedef struct _LADSPA_Descriptor {
/* Once an instance of a plugin has been finished with it can be
deleted using the following function. The instance handle passed
ceases to be valid after this call.
-
+
If activate() was called for a plugin instance then a
corresponding call to deactivate() must be made before cleanup()
is called. */
@@ -589,7 +589,7 @@ typedef struct _LADSPA_Descriptor {
const LADSPA_Descriptor * ladspa_descriptor(unsigned long Index);
/* Datatype corresponding to the ladspa_descriptor() function. */
-typedef const LADSPA_Descriptor *
+typedef const LADSPA_Descriptor *
(*LADSPA_Descriptor_Function)(unsigned long Index);
/**********************************************************************/
diff --git a/utils/ladspa2lv2.c b/utils/ladspa2lv2.c
index 023c40d..fb33f5c 100644
--- a/utils/ladspa2lv2.c
+++ b/utils/ladspa2lv2.c
@@ -1,6 +1,6 @@
/* ladspa2lv2
* Copyright (C) 2007 Dave 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
* Software Foundation; either version 2 of the License, or (at your option)
@@ -43,9 +43,9 @@ add_resource(librdf_model* model,
{
librdf_node* predicate = librdf_new_node_from_uri_string(world, U(predicate_uri));
librdf_node* object = librdf_new_node_from_uri_string(world, U(object_uri));
-
+
librdf_statement* triple = librdf_new_statement_from_nodes(world, subject, predicate, object);
-
+
librdf_model_add_statement(model, triple);
//librdf_free_statement(triple);
@@ -59,9 +59,9 @@ add_node(librdf_model* model,
librdf_node* object)
{
librdf_node* predicate = librdf_new_node_from_uri_string(world, U(predicate_uri));
-
+
librdf_statement* triple = librdf_new_statement_from_nodes(world, subject, predicate, object);
-
+
librdf_model_add_statement(model, triple);
//librdf_free_statement(triple);
@@ -76,9 +76,9 @@ add_string(librdf_model* model,
{
librdf_node* predicate = librdf_new_node_from_uri_string(world, U(predicate_uri));
librdf_node* object = librdf_new_node_from_literal(world, U(object_string), NULL, 0);
-
+
librdf_statement* triple = librdf_new_statement_from_nodes(world, subject, predicate, object);
-
+
librdf_model_add_statement(model, triple);
//librdf_free_statement(triple);
@@ -99,9 +99,9 @@ add_int(librdf_model* model,
librdf_node* predicate = librdf_new_node_from_uri_string(world, U(predicate_uri));
librdf_node* object = librdf_new_node_from_typed_literal(world, U(object_str), NULL, type);
-
+
librdf_statement* triple = librdf_new_statement_from_nodes(world, subject, predicate, object);
-
+
librdf_model_add_statement(model, triple);
//librdf_free_statement(triple);
@@ -123,9 +123,9 @@ add_float(librdf_model* model,
librdf_node* predicate = librdf_new_node_from_uri_string(world, U(predicate_uri));
librdf_node* object = librdf_new_node_from_typed_literal(world, U(object_str), NULL, type);
-
+
librdf_statement* triple = librdf_new_statement_from_nodes(world, subject, predicate, object);
-
+
librdf_model_add_statement(model, triple);
//librdf_free_statement(triple);
@@ -146,7 +146,7 @@ load_ladspa_plugin(const char* lib_path, unsigned long index)
if (df == NULL) {
dlclose(handle);
return NULL;
- }
+ }
LADSPA_Descriptor* const descriptor = (LADSPA_Descriptor*)df(index);
@@ -174,14 +174,14 @@ add_port_range(LADSPA_Descriptor* plugin,
lower = plugin->PortRangeHints[port_index].LowerBound;
range_valid = true;
}
-
+
if (LADSPA_IS_HINT_INTEGER(hint_descriptor)) {
add_resource(model, port, NS_LV2("portHint"), NS_LV2("integer"));
upper = plugin->PortRangeHints[port_index].UpperBound;
lower = plugin->PortRangeHints[port_index].LowerBound;
range_valid = true;
}
-
+
if (LADSPA_IS_HINT_TOGGLED(hint_descriptor)) {
add_resource(model, port, NS_LV2("portHint"), NS_LV2("toggled"));
upper = 1.0;
@@ -236,12 +236,12 @@ add_port_range(LADSPA_Descriptor* plugin,
} else {
valid = false;
}
-
+
if (valid)
add_float(model, port, NS_LV2("default"), normal);
} else { // No default hint
-
+
if (range_valid && LADSPA_IS_HINT_BOUNDED_BELOW(hint_descriptor)) {
normal = lower;
add_float(model, port, NS_LV2("default"), normal);
@@ -278,11 +278,11 @@ write_lv2_turtle(LADSPA_Descriptor* descriptor, const char* plugin_uri, const ch
U("http://xmlns.com/foaf/0.1/")), "foaf");
librdf_serializer_set_namespace(serializer, librdf_new_uri(world,
U("http://lv2plug.in/ns/lv2core#")), "lv2");
-
+
add_resource(model, plugin,
NS_RDF("type"),
NS_LV2("Plugin"));
-
+
add_string(model, plugin,
NS_DOAP("name"),
descriptor->Name);
@@ -291,7 +291,7 @@ write_lv2_turtle(LADSPA_Descriptor* descriptor, const char* plugin_uri, const ch
add_resource(model, plugin,
NS_LV2("optionalFeature"),
NS_LV2("hardRTCapable"));
-
+
for (uint32_t i=0; i < descriptor->PortCount; ++i) {
char index_str[32];
snprintf(index_str, (size_t)32, "%u", i);
@@ -308,7 +308,7 @@ write_lv2_turtle(LADSPA_Descriptor* descriptor, const char* plugin_uri, const ch
add_int(model, port_node,
NS_LV2("index"),
(int)i);
-
+
if (LADSPA_IS_PORT_INPUT(port_descriptor))
add_resource(model, port_node,
NS_RDF("type"),
@@ -317,7 +317,7 @@ write_lv2_turtle(LADSPA_Descriptor* descriptor, const char* plugin_uri, const ch
add_resource(model, port_node,
NS_RDF("type"),
NS_LV2("OutputPort"));
-
+
if (LADSPA_IS_PORT_AUDIO(port_descriptor))
add_resource(model, port_node,
NS_RDF("type"),
@@ -326,7 +326,7 @@ write_lv2_turtle(LADSPA_Descriptor* descriptor, const char* plugin_uri, const ch
add_resource(model, port_node,
NS_RDF("type"),
NS_LV2("ControlPort"));
-
+
add_string(model, port_node,
NS_LV2("name"),
descriptor->PortNames[i]);
diff --git a/utils/lv2_inspect.c b/utils/lv2_inspect.c
index 33043dd..37f962d 100644
--- a/utils/lv2_inspect.c
+++ b/utils/lv2_inspect.c
@@ -1,6 +1,6 @@
/* lv2_inspect - Display information about an LV2 plugin.
* Copyright (C) 2007 Dave Robillard <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
* Software Foundation; either version 2 of the License, or (at your option)
@@ -104,7 +104,7 @@ print_plugin(SLV2Plugin p)
val = slv2_plugin_get_name(p);
printf("\tName: %s\n", slv2_value_as_string(val));
slv2_value_free(val);
-
+
SLV2Value class_label = slv2_plugin_class_get_label(slv2_plugin_get_class(p));
printf("\tClass: %s\n", slv2_value_as_string(class_label));
@@ -113,13 +113,13 @@ print_plugin(SLV2Plugin p)
printf("\tAuthor: %s\n", slv2_value_as_string(val));
slv2_value_free(val);
}
-
+
val = slv2_plugin_get_author_email(p);
if (val) {
printf("\tAuthor Email: %s\n", slv2_value_as_uri(val));
slv2_value_free(val);
}
-
+
val = slv2_plugin_get_author_homepage(p);
if (val) {
printf("\tAuthor Homepage: %s\n", slv2_value_as_uri(val));
@@ -144,16 +144,16 @@ print_plugin(SLV2Plugin p)
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) {
printf("\t Class: %s\n",
slv2_value_as_uri(slv2_values_get_at(types, i)));
}
-
+
if (binary)
printf("\t Binary: %s\n", binary);
-
+
printf("\t Bundle: %s\n",
slv2_value_as_uri(slv2_ui_get_bundle_uri(ui)));
}
@@ -188,8 +188,8 @@ print_plugin(SLV2Plugin p)
if (features)
printf("\n");
slv2_values_free(features);
-
-
+
+
/* Optional Features */
features = slv2_plugin_get_optional_features(p);
@@ -204,7 +204,7 @@ print_plugin(SLV2Plugin p)
if (features)
printf("\n");
slv2_values_free(features);
-
+
/* Presets */
@@ -219,7 +219,7 @@ SELECT ?name WHERE { <> lv2p:hasPreset ?preset . ?preset dc:title ?name }");
printf("\t %s\n", slv2_value_as_string(name));
}
slv2_results_free(presets);
-
+
/* Ports */
@@ -228,9 +228,9 @@ SELECT ?name WHERE { <> lv2p:hasPreset ?preset . ?preset dc:title ?name }");
float* maxes = calloc(num_ports, sizeof(float));
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)
print_port(p, i, mins, maxes, defaults);
@@ -258,7 +258,7 @@ print_usage()
printf("Show information about an installed LV2 plugin.\n");
}
-
+
int
main(int argc, char** argv)
{
@@ -303,7 +303,7 @@ main(int argc, char** argv)
}
ret = (p != NULL ? 0 : -1);
-
+
slv2_value_free(uri);
slv2_plugins_free(world, plugins);
diff --git a/utils/lv2_list.c b/utils/lv2_list.c
index cefd24e..dc08c73 100644
--- a/utils/lv2_list.c
+++ b/utils/lv2_list.c
@@ -1,6 +1,6 @@
/* lv2_list - List system installed LV2 plugins.
* Copyright (C) 2007 Dave Robillard <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
* Software Foundation; either version 2 of the License, or (at your option)
@@ -75,7 +75,7 @@ main(int argc, char** argv)
SLV2Plugins plugins = slv2_world_get_all_plugins(world);
list_plugins(plugins);
-
+
slv2_plugins_free(world, plugins);
slv2_world_free(world);