summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/query.c5
-rw-r--r--src/slv2_internal.h57
-rw-r--r--src/value.c22
3 files changed, 48 insertions, 36 deletions
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 <stdlib.h>
#include <assert.h>
#include <librdf.h>
+#include <limits.h>
#include <slv2/plugin.h>
#include <slv2/util.h>
#include <slv2/values.h>
@@ -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 <slv2/types.h>
-/** 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;