summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/plugin.c12
-rw-r--r--src/pluginclasses.c89
-rw-r--r--src/plugininstance.c5
-rw-r--r--src/plugins.c3
-rw-r--r--src/pluginui.c2
-rw-r--r--src/pluginuis.c92
-rw-r--r--src/port.c3
-rw-r--r--src/query.c8
-rw-r--r--src/scalepoints.c57
-rw-r--r--src/values.c77
10 files changed, 15 insertions, 333 deletions
diff --git a/src/plugin.c b/src/plugin.c
index 870a32e..ae2f8f3 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -18,19 +18,17 @@
#define _XOPEN_SOURCE 500
+#include <assert.h>
#include <math.h>
-#include <string.h>
#include <stdlib.h>
-#include <assert.h>
+#include <string.h>
#include <librdf.h>
-#include "slv2_internal.h"
+#include "slv2/collections.h"
#include "slv2/plugin.h"
+#include "slv2/pluginclass.h"
#include "slv2/types.h"
#include "slv2/util.h"
-#include "slv2/values.h"
-#include "slv2/pluginclass.h"
-#include "slv2/pluginclasses.h"
-#include "slv2/pluginuis.h"
+#include "slv2_internal.h"
/* private
diff --git a/src/pluginclasses.c b/src/pluginclasses.c
deleted file mode 100644
index 1e7e69c..0000000
--- a/src/pluginclasses.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/* 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)
- * 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 General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#define _XOPEN_SOURCE 500
-
-#include <string.h>
-#include <limits.h>
-#include <librdf.h>
-#include "slv2_internal.h"
-#include "slv2/value.h"
-#include "slv2/pluginclass.h"
-#include "slv2/pluginclasses.h"
-
-
-SLV2PluginClasses
-slv2_plugin_classes_new()
-{
- return raptor_new_sequence((void (*)(void*))&slv2_plugin_class_free, NULL);
-}
-
-
-void
-slv2_plugin_classes_free(SLV2PluginClasses list)
-{
- if (list)
- raptor_free_sequence(list);
-}
-
-
-unsigned
-slv2_plugin_classes_size(SLV2PluginClasses list)
-{
- return (list ? raptor_sequence_size(list) : 0);
-}
-
-
-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)
- upper = i - 1;
- else
- lower = i + 1;
- }
-
- return NULL;
-}
-
-
-SLV2PluginClass
-slv2_plugin_classes_get_at(SLV2PluginClasses list, unsigned index)
-{
- if (index > INT_MAX)
- return NULL;
- else
- return (SLV2PluginClass)raptor_sequence_get_at(list, (int)index);
-}
-
diff --git a/src/plugininstance.c b/src/plugininstance.c
index 446a351..c3e0601 100644
--- a/src/plugininstance.c
+++ b/src/plugininstance.c
@@ -23,10 +23,11 @@
#include <string.h>
#include <assert.h>
#include <dlfcn.h>
-#include "slv2/types.h"
#include "slv2/plugin.h"
#include "slv2/plugininstance.h"
+#include "slv2/types.h"
#include "slv2/util.h"
+#include "slv2/value.h"
#include "slv2_internal.h"
@@ -66,7 +67,7 @@ slv2_plugin_instantiate(SLV2Plugin plugin,
} else {
// Search for plugin by URI
- // FIXME: Kluge to get bundle path (containing directory of binary)
+ // 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)));
diff --git a/src/plugins.c b/src/plugins.c
index 1af7a25..f392bcd 100644
--- a/src/plugins.c
+++ b/src/plugins.c
@@ -25,8 +25,7 @@
#include <librdf.h>
#include "slv2/types.h"
#include "slv2/plugin.h"
-#include "slv2/plugins.h"
-#include "slv2/values.h"
+#include "slv2/collections.h"
#include "slv2/util.h"
#include "slv2_internal.h"
diff --git a/src/pluginui.c b/src/pluginui.c
index 606451e..fb87f63 100644
--- a/src/pluginui.c
+++ b/src/pluginui.c
@@ -21,7 +21,7 @@
#include <assert.h>
#include <string.h>
#include <stdlib.h>
-#include "slv2/values.h"
+#include "slv2/collections.h"
#include "slv2_internal.h"
diff --git a/src/pluginuis.c b/src/pluginuis.c
deleted file mode 100644
index 8cc14a2..0000000
--- a/src/pluginuis.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/* 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)
- * 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 General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#define _XOPEN_SOURCE 500
-#include <string.h>
-#include <limits.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <librdf.h>
-#include "slv2/types.h"
-#include "slv2/pluginuis.h"
-#include "slv2/pluginui.h"
-#include "slv2/util.h"
-#include "slv2_internal.h"
-
-
-SLV2UIs
-slv2_uis_new()
-{
- return raptor_new_sequence((void (*)(void*))&slv2_ui_free, NULL);
-}
-
-
-void
-slv2_uis_free(SLV2UIs list)
-{
- if (list)
- raptor_free_sequence(list);
-}
-
-
-unsigned
-slv2_uis_size(SLV2UIs list)
-{
- return (list ? raptor_sequence_size(list) : 0);
-}
-
-
-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);
-
- SLV2UI ui = raptor_sequence_get_at(list, i);
-
- const int cmp = strcmp(slv2_value_as_uri(slv2_ui_get_uri(ui)),
- slv2_value_as_uri(uri));
-
- if (cmp == 0)
- return ui;
- else if (cmp > 0)
- upper = i - 1;
- else
- lower = i + 1;
- }
-
- return NULL;
-}
-
-
-SLV2UI
-slv2_uis_get_at(SLV2UIs list, unsigned index)
-{
- if (index > INT_MAX)
- return NULL;
- else
- return (SLV2UI)raptor_sequence_get_at(list, (int)index);
-}
-
diff --git a/src/port.c b/src/port.c
index 3429f62..50cb946 100644
--- a/src/port.c
+++ b/src/port.c
@@ -25,8 +25,7 @@
#include "slv2/port.h"
#include "slv2/types.h"
#include "slv2/util.h"
-#include "slv2/values.h"
-#include "slv2/scalepoints.h"
+#include "slv2/collections.h"
#include "slv2_internal.h"
diff --git a/src/query.c b/src/query.c
index f32c4e0..c9d0d14 100644
--- a/src/query.c
+++ b/src/query.c
@@ -17,15 +17,15 @@
*/
#define _XOPEN_SOURCE 500
-#include <string.h>
-#include <stdlib.h>
#include <assert.h>
#include <librdf.h>
-#include <locale.h>
#include <limits.h>
+#include <locale.h>
+#include <stdlib.h>
+#include <string.h>
+#include "slv2/collections.h"
#include "slv2/plugin.h"
#include "slv2/util.h"
-#include "slv2/values.h"
#include "slv2_internal.h"
diff --git a/src/scalepoints.c b/src/scalepoints.c
deleted file mode 100644
index 911c3e2..0000000
--- a/src/scalepoints.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/* 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)
- * 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 General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <string.h>
-#include <stdlib.h>
-#include <limits.h>
-#include <raptor.h>
-#include "slv2/scalepoints.h"
-#include "slv2_internal.h"
-
-
-SLV2ScalePoints
-slv2_scale_points_new()
-{
- return raptor_new_sequence((void (*)(void*))&slv2_scale_point_free, NULL);
-}
-
-
-void
-slv2_scale_points_free(SLV2ScalePoints points)
-{
- if (points)
- raptor_free_sequence(points);
-}
-
-
-unsigned
-slv2_scale_points_size(SLV2ScalePoints points)
-{
- return (points ? raptor_sequence_size(points) : 0);
-}
-
-
-SLV2ScalePoint
-slv2_scale_points_get_at(SLV2ScalePoints points, unsigned index)
-{
- if (index > INT_MAX)
- return NULL;
- else
- return (SLV2ScalePoint)raptor_sequence_get_at(points, (int)index);
-}
-
diff --git a/src/values.c b/src/values.c
deleted file mode 100644
index 7f3df3c..0000000
--- a/src/values.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/* 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)
- * 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 General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <string.h>
-#include <stdlib.h>
-#include <limits.h>
-#include <raptor.h>
-#include "slv2/values.h"
-#include "slv2_internal.h"
-
-
-SLV2Values
-slv2_values_new()
-{
- return raptor_new_sequence((void (*)(void*))&slv2_value_free, NULL);
-}
-
-
-void
-slv2_values_free(SLV2Values list)
-{
- if (list)
- raptor_free_sequence(list);
-}
-
-
-unsigned
-slv2_values_size(SLV2Values list)
-{
- return (list ? raptor_sequence_size(list) : 0);
-}
-
-
-SLV2Value
-slv2_values_get_at(SLV2Values list, unsigned index)
-{
- if (index > INT_MAX)
- return NULL;
- else
- return (SLV2Value)raptor_sequence_get_at(list, (int)index);
-}
-
-
-/* private */
-void
-slv2_values_set_at(SLV2Values list, unsigned index, void* value)
-{
- if (index <= INT_MAX)
- raptor_sequence_set_at(list, index, value);
-}
-
-
-bool
-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;
-}
-