From bcb7872768bce6c60770308d2e1babad11c2b6a0 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 8 May 2007 16:04:09 +0000 Subject: Code cleanups. Updated lv2.ttl. git-svn-id: http://svn.drobilla.net/lad/slv2@518 a436a847-0d15-0410-975c-d299462d15a1 --- data/lv2.ttl | 6 ++---- slv2/value.h | 21 -------------------- slv2/world.h | 3 ++- src/query.c | 5 ++++- src/slv2_internal.h | 57 +++++++++++++++++++++++++++++++++++++++++------------ src/value.c | 22 --------------------- 6 files changed, 52 insertions(+), 62 deletions(-) diff --git a/data/lv2.ttl b/data/lv2.ttl index b82566d..d79db7e 100644 --- a/data/lv2.ttl +++ b/data/lv2.ttl @@ -1,7 +1,5 @@ # RDF Schema for LV2 plugins -# *** PROVISIONAL *** -# -# *** PROPOSED Revision 2007-04-20 *** +# *** PROVISIONAL Revision 2007-05-08 *** # # This document describes the classes and properties that are defined by the # core LV2 specification. See for more information. @@ -42,7 +40,7 @@ doap:programming-language "C" ; doap:release [ doap:revision "1.0beta2" ; - doap:created "2007-04-20" + doap:created "2007-05-08" ] ; doap:maintainer [ a foaf:Person ; diff --git a/slv2/value.h b/slv2/value.h index 2d0fb51..3073e7e 100644 --- a/slv2/value.h +++ b/slv2/value.h @@ -31,27 +31,6 @@ extern "C" { */ -#if 0 -/** Wrap a URI string (e.g. "http://example.org/foo") as an SLV2Value. - * - * The result is returned by value and refers directly to \a uri, it - * does not need to be freed by the caller - calling slv2_value_free - * on the returned value will destroy \a uri. - */ -SLV2Value -slv2_uri(const char* uri); - - -/** Wrap a QName string (e.g. "lv2:Plugin") as an SLV2Value. - * - * The result is returned by value and refers directly to \a uri, it - * does not need to be freed by the caller - calling slv2_value_free - * on the returned value will destroy \a qname. - */ -SLV2Value -slv2_qname(const char* qname); -#endif - /** Return whether two values are equivalent. */ diff --git a/slv2/world.h b/slv2/world.h index b5a4f30..8dfa1d3 100644 --- a/slv2/world.h +++ b/slv2/world.h @@ -160,6 +160,7 @@ slv2_world_get_plugins_by_filter(SLV2World world, bool (*include)(SLV2Plugin)); +#if 0 /** Return a list of found plugins in a given class. * * Returned list must be freed by user with slv2_plugins_free. The contained @@ -170,7 +171,7 @@ slv2_world_get_plugins_by_filter(SLV2World world, SLV2Plugins slv2_world_get_plugins_by_class(SLV2World world, SLV2PluginClass plugin_class); - +#endif #if 0 /** Get plugins filtered by a user-defined SPARQL query. diff --git a/src/query.c b/src/query.c index b7eae2d..d7f583f 100644 --- a/src/query.c +++ b/src/query.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -160,9 +161,11 @@ slv2_plugin_simple_query(SLV2Plugin plugin, const char* sparql_str, unsigned variable) { + assert(variable < INT_MAX); + librdf_query_results* results = slv2_plugin_query(plugin, sparql_str); - SLV2Values ret = slv2_query_get_variable_bindings(results, variable); + SLV2Values ret = slv2_query_get_variable_bindings(results, (int)variable); librdf_free_query_results(results); diff --git a/src/slv2_internal.h b/src/slv2_internal.h index 97fbbce..abe6a59 100644 --- a/src/slv2_internal.h +++ b/src/slv2_internal.h @@ -30,20 +30,26 @@ extern "C" { #include -/** Reference to a port on some plugin. - */ + +/* ********* PORT ********* */ + + +/** Reference to a port on some plugin. */ struct _SLV2Port { - uint32_t index; ///< LV2 index - char* symbol; ///< LV2 symbol - //char* node_id; ///< RDF Node ID + uint32_t index; ///< LV2 index + char* symbol; ///< LV2 symbol }; -SLV2Port slv2_port_new(uint32_t index, const char* symbol/*, const char* node_id*/); +SLV2Port slv2_port_new(uint32_t index, const char* symbol); SLV2Port slv2_port_duplicate(SLV2Port port); void slv2_port_free(SLV2Port port); + +/* ********* Plugin ********* */ + + /** Record of an installed/available plugin. * * A simple reference to a plugin somewhere on the system. This just holds @@ -52,10 +58,10 @@ void slv2_port_free(SLV2Port port); struct _SLV2Plugin { struct _SLV2World* world; librdf_uri* plugin_uri; -// char* bundle_url; // Bundle directory plugin was loaded from - char* binary_uri; // lv2:binary +// char* bundle_url; ///< Bundle directory plugin was loaded from + char* binary_uri; ///< lv2:binary SLV2PluginClass plugin_class; - raptor_sequence* data_uris; // rdfs::seeAlso + raptor_sequence* data_uris; ///< rdfs::seeAlso raptor_sequence* ports; librdf_storage* storage; librdf_model* rdf; @@ -69,6 +75,10 @@ librdf_query_results* slv2_plugin_query(SLV2Plugin plugin, const char* sparql_str); + +/* ********* Plugins ********* */ + + /** Create a new, empty plugin list. * * Returned object must be freed with slv2_plugins_free. @@ -77,12 +87,20 @@ SLV2Plugins slv2_plugins_new(); + +/* ********* Instance ********* */ + + /** Pimpl portion of SLV2Instance */ struct _InstanceImpl { void* lib_handle; }; + +/* ********* Plugin Class ********* */ + + struct _SLV2PluginClass { struct _SLV2World* world; char* parent_uri; @@ -90,13 +108,23 @@ struct _SLV2PluginClass { char* label; }; -SLV2PluginClass slv2_plugin_class_new(SLV2World world, - const char* parent_uri, const char* uri, const char* label); -void slv2_plugin_class_free(SLV2PluginClass class); +SLV2PluginClass slv2_plugin_class_new(SLV2World world, const char* parent_uri, + const char* uri, const char* label); +void slv2_plugin_class_free(SLV2PluginClass class); + + + +/* ********* Plugin Classes ********* */ + SLV2PluginClasses slv2_plugin_classes_new(); void slv2_plugin_classes_free(); + + +/* ********* World ********* */ + + /** Model of LV2 (RDF) data loaded from bundles. */ struct _SLV2World { @@ -122,9 +150,12 @@ slv2_world_load_path(SLV2World world, const char* search_path); + +/* ********* Value ********* */ + + typedef enum _SLV2ValueType { SLV2_VALUE_URI, - SLV2_VALUE_QNAME, SLV2_VALUE_STRING, SLV2_VALUE_INT, SLV2_VALUE_FLOAT diff --git a/src/value.c b/src/value.c index 8911619..e728333 100644 --- a/src/value.c +++ b/src/value.c @@ -59,27 +59,6 @@ slv2_value_free(SLV2Value val) } -/* -SLV2Value -slv2_uri(const char* uri) -{ - struct _SLV2Value val; - val->str_val = (char*)uri; // const cast FTW! - val->type = SLV2_VALUE_URI; - return val; -} - - -SLV2Value -slv2_qname(const char* qname) -{ - SLV2Value val; - val->str_val = (char*)qname; // const cast FTW! - val->type = SLV2_VALUE_QNAME; - return val; -} -*/ - bool slv2_value_equals(SLV2Value value, SLV2Value other) { @@ -102,7 +81,6 @@ slv2_value_get_turtle_token(SLV2Value value) result = calloc(len, sizeof(char)); snprintf(result, len, "<%s>", value->str_val); break; - case SLV2_VALUE_QNAME: case SLV2_VALUE_STRING: result = strdup(value->str_val); break; -- cgit v1.2.1