summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/collections.c2
-rw-r--r--src/lilv_internal.h298
-rw-r--r--src/util.c2
-rw-r--r--src/world.c2
-rw-r--r--test/lilv_test.c38
-rw-r--r--utils/lilv-bench.c4
-rw-r--r--utils/lv2info.c4
-rw-r--r--utils/lv2ls.c4
8 files changed, 150 insertions, 204 deletions
diff --git a/src/collections.c b/src/collections.c
index 6439f09..0049d1f 100644
--- a/src/collections.c
+++ b/src/collections.c
@@ -97,7 +97,7 @@ lilv_uis_get_by_uri(const LilvUIs* coll, const LilvNode* uri)
/* Plugins */
LilvPlugins*
-lilv_plugins_new()
+lilv_plugins_new(void)
{
return g_sequence_new(NULL);
}
diff --git a/src/lilv_internal.h b/src/lilv_internal.h
index 32c3420..caa5fbc 100644
--- a/src/lilv_internal.h
+++ b/src/lilv_internal.h
@@ -55,163 +55,65 @@ static inline char* dlerror(void) { return "Unknown error"; }
#define LILV_NS_XSD "http://www.w3.org/2001/XMLSchema#"
#define LILV_NS_RDF "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-#define FOREACH_MATCH(iter) \
- for (; !sord_iter_end(iter); sord_iter_next(iter))
-
-static inline const SordNode*
-lilv_match_subject(SordIter* iter) {
- SordQuad tup;
- sord_iter_get(iter, tup);
- return tup[SORD_SUBJECT];
-}
-
-static inline const SordNode*
-lilv_match_object(SordIter* iter) {
- SordQuad tup;
- sord_iter_get(iter, tup);
- return tup[SORD_OBJECT];
-}
+/*
+ *
+ * Types
+ *
+ */
-static inline void
-lilv_match_end(SordIter* iter)
-{
- sord_iter_free(iter);
-}
+typedef struct LilvSpecImpl LilvSpec;
-/* ********* PORT ********* */
+typedef void LilvCollection;
-/** Reference to a port on some plugin. */
struct LilvPortImpl {
- uint32_t index; ///< lv2:index
- LilvNode* symbol; ///< lv2:symbol
- LilvNodes* classes; ///< rdf:type
+ uint32_t index; ///< lv2:index
+ LilvNode* symbol; ///< lv2:symbol
+ LilvNodes* classes; ///< rdf:type
};
-LilvPort* lilv_port_new(LilvWorld* world, uint32_t index, const char* symbol);
-void lilv_port_free(LilvPort* port);
-
-/* ********* Spec ********* */
struct LilvSpecImpl {
- SordNode* spec;
- SordNode* bundle;
+ SordNode* spec;
+ SordNode* bundle;
LilvNodes* data_uris;
};
-typedef struct LilvSpecImpl LilvSpec;
-
-/* ********* Plugin ********* */
-
-/** Header of an LilvPlugin, LilvPluginClass, or LilvUI.
- * Any of these structs may be safely casted to LilvHeader, which is used to
- * implement sequences without code duplication (see lilv_sequence_get_by_uri).
- */
+/**
+ Header of an LilvPlugin, LilvPluginClass, or LilvUI.
+ Any of these structs may be safely casted to LilvHeader, which is used to
+ implement sequences without code duplication (see lilv_sequence_get_by_uri).
+*/
struct LilvHeader {
LilvWorld* world;
- LilvNode* uri;
+ LilvNode* uri;
};
-/** Record of an installed/available plugin.
- *
- * A simple reference to a plugin somewhere on the system. This just holds
- * paths of relevant files, the actual data therein isn't loaded into memory.
- */
struct LilvPluginImpl {
LilvWorld* world;
- LilvNode* plugin_uri;
- LilvNode* bundle_uri; ///< Bundle directory plugin was loaded from
- LilvNode* binary_uri; ///< lv2:binary
- LilvNode* dynman_uri; ///< dynamic manifest binary
+ LilvNode* plugin_uri;
+ LilvNode* bundle_uri; ///< Bundle plugin was loaded from
+ LilvNode* binary_uri; ///< lv2:binary
+ LilvNode* dynman_uri; ///< dynamic manifest binary
const LilvPluginClass* plugin_class;
- LilvNodes* data_uris; ///< rdfs::seeAlso
+ LilvNodes* data_uris; ///< rdfs::seeAlso
LilvPort** ports;
uint32_t num_ports;
bool loaded;
bool replaced;
};
-LilvPlugin* lilv_plugin_new(LilvWorld* world, LilvNode* uri, LilvNode* bundle_uri);
-void lilv_plugin_load_if_necessary(const LilvPlugin* p);
-void lilv_plugin_free(LilvPlugin* plugin);
-
-LilvNode*
-lilv_plugin_get_unique(const LilvPlugin* p,
- const SordNode* subject,
- const SordNode* predicate);
-
-/* ********* Plugins ********* */
-
-typedef void LilvCollection;
-
-LilvPlugins*
-lilv_plugins_new();
-
-
-/**
- Increment @a i to point at the next element in the collection.
-*/
-LilvIter*
-lilv_iter_next(LilvIter* i);
-
-/**
- Return true iff @a i is at the end of the collection.
-*/
-bool
-lilv_iter_end(LilvIter* i);
-
-LilvIter*
-lilv_collection_begin(const LilvCollection* collection);
-
-void*
-lilv_collection_get(const LilvCollection* collection,
- const LilvIter* i);
-
-/**
- Free @a collection.
-*/
-void
-lilv_collection_free(LilvCollection* collection);
-
-/**
- Get the number of elements in @a collection.
-*/
-unsigned
-lilv_collection_size(const LilvCollection* collection);
-
-LilvNodes*
-lilv_nodes_new(void);
-
-LilvScalePoints*
-lilv_scale_points_new(void);
-
struct LilvPluginClassImpl {
LilvWorld* world;
- LilvNode* uri;
- LilvNode* parent_uri;
- LilvNode* label;
+ LilvNode* uri;
+ LilvNode* parent_uri;
+ LilvNode* label;
};
-LilvPluginClass* lilv_plugin_class_new(LilvWorld* world,
- const SordNode* parent_uri,
- const SordNode* uri,
- const char* label);
-
-void lilv_plugin_class_free(LilvPluginClass* plugin_class);
-
-/* ********* Plugin Classes ********* */
-
-LilvPluginClasses* lilv_plugin_classes_new();
-void lilv_plugin_classes_free();
-
-/* ********* World ********* */
-
typedef struct {
bool dyn_manifest;
bool filter_language;
} LilvOptions;
-/** Model of LV2 (RDF) data loaded from bundles.
- */
struct LilvWorldImpl {
SordWorld* world;
SordModel* model;
@@ -245,41 +147,14 @@ struct LilvWorldImpl {
SordNode* xsd_decimal_node;
SordNode* xsd_double_node;
SordNode* xsd_integer_node;
- LilvNode* doap_name_val;
- LilvNode* lv2_name_val;
- LilvNode* lv2_optionalFeature_val;
- LilvNode* lv2_requiredFeature_val;
+ LilvNode* doap_name_val;
+ LilvNode* lv2_name_val;
+ LilvNode* lv2_optionalFeature_val;
+ LilvNode* lv2_requiredFeature_val;
LilvOptions opt;
};
-const uint8_t*
-lilv_world_blank_node_prefix(LilvWorld* world);
-void
-lilv_world_load_file(LilvWorld* world, const char* file_uri);
-
-/* ********* Plugin UI ********* */
-
-struct LilvUIImpl {
- LilvWorld* world;
- LilvNode* uri;
- LilvNode* bundle_uri;
- LilvNode* binary_uri;
- LilvNodes* classes;
-};
-
-LilvUIs* lilv_uis_new();
-
-LilvUI*
-lilv_ui_new(LilvWorld* world,
- LilvNode* uri,
- LilvNode* type_uri,
- LilvNode* binary_uri);
-
-void lilv_ui_free(LilvUI* ui);
-
-/* ********* Value ********* */
-
-typedef enum _LilvNodeType {
+typedef enum {
LILV_VALUE_URI,
LILV_VALUE_STRING,
LILV_VALUE_INT,
@@ -297,15 +172,75 @@ struct LilvNodeImpl {
bool bool_val;
SordNode* uri_val;
} val;
- LilvNodeType type;
+ LilvNodeType type;
+};
+
+struct LilvScalePointImpl {
+ LilvNode* value;
+ LilvNode* label;
};
-LilvNode* lilv_node_new(LilvWorld* world, LilvNodeType type, const char* val);
-LilvNode* lilv_node_new_from_node(LilvWorld* world, const SordNode* node);
-const SordNode* lilv_node_as_node(const LilvNode* value);
+struct LilvUIImpl {
+ LilvWorld* world;
+ LilvNode* uri;
+ LilvNode* bundle_uri;
+ LilvNode* binary_uri;
+ LilvNodes* classes;
+};
+
+/*
+ *
+ * Functions
+ *
+ */
+
+LilvPort* lilv_port_new(LilvWorld* world, uint32_t index, const char* symbol);
+void lilv_port_free(LilvPort* port);
+
+LilvPlugin* lilv_plugin_new(LilvWorld* world, LilvNode* uri, LilvNode* bundle_uri);
+void lilv_plugin_load_if_necessary(const LilvPlugin* p);
+void lilv_plugin_free(LilvPlugin* plugin);
+LilvNode* lilv_plugin_get_unique(const LilvPlugin* p,
+ const SordNode* subject,
+ const SordNode* predicate);
+
+LilvIter* lilv_iter_next(LilvIter* i);
+bool lilv_iter_end(LilvIter* i);
+
+void lilv_collection_free(LilvCollection* collection);
+unsigned lilv_collection_size(const LilvCollection* collection);
+LilvIter* lilv_collection_begin(const LilvCollection* collection);
+void* lilv_collection_get(const LilvCollection* collection,
+ const LilvIter* i);
+
+LilvPluginClass* lilv_plugin_class_new(LilvWorld* world,
+ const SordNode* parent_uri,
+ const SordNode* uri,
+ const char* label);
+
+void lilv_plugin_class_free(LilvPluginClass* plugin_class);
+
+LilvNodes* lilv_nodes_new(void);
+LilvPlugins* lilv_plugins_new(void);
+LilvScalePoints* lilv_scale_points_new(void);
+LilvPluginClasses* lilv_plugin_classes_new(void);
+LilvUIs* lilv_uis_new(void);
+
+const uint8_t* lilv_world_blank_node_prefix(LilvWorld* world);
+void lilv_world_load_file(LilvWorld* world, const char* file_uri);
-int
-lilv_header_compare_by_uri(const void* a, const void* b, void* user_data);
+LilvUI* lilv_ui_new(LilvWorld* world,
+ LilvNode* uri,
+ LilvNode* type_uri,
+ LilvNode* binary_uri);
+
+void lilv_ui_free(LilvUI* ui);
+
+LilvNode* lilv_node_new(LilvWorld* world, LilvNodeType type, const char* val);
+LilvNode* lilv_node_new_from_node(LilvWorld* world, const SordNode* node);
+const SordNode* lilv_node_as_node(const LilvNode* value);
+
+int lilv_header_compare_by_uri(const void* a, const void* b, void* user_data);
static inline void
lilv_sequence_insert(GSequence* seq, void* value)
@@ -321,18 +256,9 @@ lilv_array_append(GSequence* seq, void* value) {
struct LilvHeader*
lilv_sequence_get_by_uri(const GSequence* seq, const LilvNode* uri);
-/* ********* Scale Points ********* */
-
-struct LilvScalePointImpl {
- LilvNode* value;
- LilvNode* label;
-};
-
LilvScalePoint* lilv_scale_point_new(LilvNode* value, LilvNode* label);
void lilv_scale_point_free(LilvScalePoint* point);
-/* ********* Query Results ********* */
-
SordIter*
lilv_world_query(LilvWorld* world,
const SordNode* subject,
@@ -345,6 +271,29 @@ lilv_world_query_values(LilvWorld* world,
const SordNode* predicate,
const SordNode* object);
+#define FOREACH_MATCH(iter) \
+ for (; !sord_iter_end(iter); sord_iter_next(iter))
+
+static inline const SordNode*
+lilv_match_subject(SordIter* iter) {
+ SordQuad tup;
+ sord_iter_get(iter, tup);
+ return tup[SORD_SUBJECT];
+}
+
+static inline const SordNode*
+lilv_match_object(SordIter* iter) {
+ SordQuad tup;
+ sord_iter_get(iter, tup);
+ return tup[SORD_OBJECT];
+}
+
+static inline void
+lilv_match_end(SordIter* iter)
+{
+ sord_iter_free(iter);
+}
+
static inline bool lilv_matches_next(SordIter* matches) {
return sord_iter_next(matches);
}
@@ -356,13 +305,11 @@ static inline bool lilv_matches_end(SordIter* matches) {
LilvNodes* lilv_nodes_from_stream_objects(LilvWorld* w,
SordIter* stream);
-/* ********* Utilities ********* */
-
char* lilv_strjoin(const char* first, ...);
char* lilv_strdup(const char* str);
-char* lilv_get_lang();
+char* lilv_get_lang(void);
-typedef void (*VoidFunc)();
+typedef void (*VoidFunc)(void);
/** dlsym wrapper to return a function pointer (without annoying warning) */
static inline VoidFunc
@@ -373,7 +320,6 @@ lilv_dlfunc(void* handle, const char* symbol)
return dlfunc(handle, symbol);
}
-/* ********* Dynamic Manifest ********* */
#ifdef LILV_DYN_MANIFEST
static const LV2_Feature* const dman_features = { NULL };
#endif
diff --git a/src/util.c b/src/util.c
index 2122418..9f04a2d 100644
--- a/src/util.c
+++ b/src/util.c
@@ -78,7 +78,7 @@ lilv_uri_to_path(const char* uri)
* For example, if LANG is set to "en_CA.utf-8", this returns "en-ca".
*/
char*
-lilv_get_lang()
+lilv_get_lang(void)
{
const char* const env_lang = getenv("LANG");
if (!env_lang || !strcmp(env_lang, "")
diff --git a/src/world.c b/src/world.c
index 7d1c307..5d093d0 100644
--- a/src/world.c
+++ b/src/world.c
@@ -40,7 +40,7 @@ lilv_world_set_prefix(LilvWorld* world, const char* name, const char* uri)
LILV_API
LilvWorld*
-lilv_world_new()
+lilv_world_new(void)
{
LilvWorld* world = malloc(sizeof(struct LilvWorldImpl));
diff --git a/test/lilv_test.c b/test/lilv_test.c
index 24c5f5b..ade2c23 100644
--- a/test/lilv_test.c
+++ b/test/lilv_test.c
@@ -44,7 +44,7 @@ int test_count = 0;
int error_count = 0;
void
-delete_bundle()
+delete_bundle(void)
{
unlink(content_name);
unlink(manifest_name);
@@ -52,7 +52,7 @@ delete_bundle()
}
void
-init_tests()
+init_tests(void)
{
strncpy(bundle_dir_name, getenv("HOME"), 900);
strcat(bundle_dir_name, "/.lv2/lilv-test.lv2");
@@ -84,14 +84,14 @@ write_file(const char *name, const char *content)
}
int
-init_world()
+init_world(void)
{
world = lilv_world_new();
return world != NULL;
}
int
-load_all_bundles()
+load_all_bundles(void)
{
if (!init_world())
return 0;
@@ -116,7 +116,7 @@ start_bundle(char *manifest, char *content)
}
void
-unload_bundle()
+unload_bundle(void)
{
if (world)
lilv_world_free(world);
@@ -124,7 +124,7 @@ unload_bundle()
}
void
-cleanup()
+cleanup(void)
{
delete_bundle();
}
@@ -140,7 +140,7 @@ cleanup()
}\
} while (0)
-typedef int (*TestFunc)();
+typedef int (*TestFunc)(void);
struct TestCase {
const char *title;
@@ -168,7 +168,7 @@ static LilvNode* plugin2_uri_value;
/*****************************************************************************/
void
-init_uris()
+init_uris(void)
{
plugin_uri_value = lilv_new_uri(world, uris_plugin);
plugin2_uri_value = lilv_new_uri(world, "http://example.org/foobar");
@@ -177,7 +177,7 @@ init_uris()
}
void
-cleanup_uris()
+cleanup_uris(void)
{
lilv_node_free(plugin2_uri_value);
lilv_node_free(plugin_uri_value);
@@ -188,7 +188,7 @@ cleanup_uris()
/*****************************************************************************/
int
-test_utils()
+test_utils(void)
{
TEST_ASSERT(!strcmp(lilv_uri_to_path("file:///tmp/blah"), "/tmp/blah"));
TEST_ASSERT(!lilv_uri_to_path("file:/example.org/blah"));
@@ -199,7 +199,7 @@ test_utils()
/*****************************************************************************/
int
-test_value()
+test_value(void)
{
if (!start_bundle(MANIFEST_PREFIXES
":plug a lv2:Plugin ; lv2:binary <foo.so> ; rdfs:seeAlso <plugin.ttl> .\n",
@@ -327,7 +327,7 @@ discovery_verify_plugin(const LilvPlugin* plugin)
}
int
-test_discovery()
+test_discovery(void)
{
if (!start_bundle(MANIFEST_PREFIXES
":plug a lv2:Plugin ; lv2:binary <foo.so> ; rdfs:seeAlso <plugin.ttl> .\n",
@@ -370,7 +370,7 @@ test_discovery()
/*****************************************************************************/
int
-test_verify()
+test_verify(void)
{
if (!start_bundle(MANIFEST_PREFIXES
":plug a lv2:Plugin ; lv2:binary <foo.so> ; rdfs:seeAlso <plugin.ttl> .\n",
@@ -394,7 +394,7 @@ test_verify()
/*****************************************************************************/
int
-test_no_verify()
+test_no_verify(void)
{
if (!start_bundle(MANIFEST_PREFIXES
":plug a lv2:Plugin ; lv2:binary <foo.so> ; rdfs:seeAlso <plugin.ttl> .\n",
@@ -414,7 +414,7 @@ test_no_verify()
/*****************************************************************************/
int
-test_classes()
+test_classes(void)
{
if (!start_bundle(MANIFEST_PREFIXES
":plug a lv2:Plugin ; lv2:binary <foo.so> ; rdfs:seeAlso <plugin.ttl> .\n",
@@ -458,7 +458,7 @@ test_classes()
/*****************************************************************************/
int
-test_plugin()
+test_plugin(void)
{
if (!start_bundle(MANIFEST_PREFIXES
":plug a lv2:Plugin ; lv2:binary <foo.so> ; rdfs:seeAlso <plugin.ttl> .\n",
@@ -637,7 +637,7 @@ test_plugin()
/*****************************************************************************/
int
-test_port()
+test_port(void)
{
if (!start_bundle(MANIFEST_PREFIXES
":plug a lv2:Plugin ; lv2:binary <foo.so> ; rdfs:seeAlso <plugin.ttl> .\n",
@@ -824,7 +824,7 @@ test_port()
/*****************************************************************************/
int
-test_ui()
+test_ui(void)
{
if (!start_bundle(MANIFEST_PREFIXES
":plug a lv2:Plugin ; lv2:binary <foo.so> ; rdfs:seeAlso <plugin.ttl> .\n",
@@ -939,7 +939,7 @@ static struct TestCase tests[] = {
};
void
-run_tests()
+run_tests(void)
{
int i;
for (i = 0; tests[i].title; i++) {
diff --git a/utils/lilv-bench.c b/utils/lilv-bench.c
index b9e72db..979f48c 100644
--- a/utils/lilv-bench.c
+++ b/utils/lilv-bench.c
@@ -21,7 +21,7 @@
#include "lilv-config.h"
void
-print_version()
+print_version(void)
{
printf("lilv_bench (lilv) " LILV_VERSION "\n");
printf("Copyright 2011-2011 David Robillard <http://drobilla.net>\n");
@@ -31,7 +31,7 @@ print_version()
}
void
-print_usage()
+print_usage(void)
{
printf("Usage: lilv_bench\n");
printf("Load all discovered LV2 plugins.\n");
diff --git a/utils/lv2info.c b/utils/lv2info.c
index 48d2935..f1f3fab 100644
--- a/utils/lv2info.c
+++ b/utils/lv2info.c
@@ -296,7 +296,7 @@ print_plugin(const LilvPlugin* p)
}
void
-print_version()
+print_version(void)
{
printf(
"lv2_inspect (lilv) " LILV_VERSION "\n"
@@ -307,7 +307,7 @@ print_version()
}
void
-print_usage()
+print_usage(void)
{
printf("Usage: lv2_inspect PLUGIN_URI\n");
printf("Show information about an installed LV2 plugin.\n");
diff --git a/utils/lv2ls.c b/utils/lv2ls.c
index c8db8aa..4822fe2 100644
--- a/utils/lv2ls.c
+++ b/utils/lv2ls.c
@@ -38,7 +38,7 @@ list_plugins(const LilvPlugins* list, bool show_names)
}
void
-print_version()
+print_version(void)
{
printf(
"lv2_list (lilv) " LILV_VERSION "\n"
@@ -49,7 +49,7 @@ print_version()
}
void
-print_usage()
+print_usage(void)
{
printf("Usage: lv2_list [OPTIONS]\n");
printf("List all installed LV2 plugins.\n");