From 3433ad241b069037d780c528ff462b3ce7c2c3be Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 9 May 2007 01:34:35 +0000 Subject: Ontology install path fixes. 0.0.1 versioning stuff. Removed GNU 'standard' files I don't maintain anyway and make automake shutup about it. git-svn-id: http://svn.drobilla.net/lad/slv2@521 a436a847-0d15-0410-975c-d299462d15a1 --- src/Makefile.am | 2 +- src/plugin.c | 13 ++++--------- src/world.c | 17 +++++++++++++---- 3 files changed, 18 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am index f7b9f76..c7c70f6 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,4 +1,4 @@ -AM_CFLAGS = -std=c99 -I$(top_srcdir)/include -I$(top_srcdir) @REDLAND_CFLAGS@ -DLIBSLV2_SOURCE -DLV2_TTL_PATH=\"@lv2ttlpath@\" +AM_CFLAGS = -std=c99 -I$(top_srcdir)/include -I$(top_srcdir) @REDLAND_CFLAGS@ -DLIBSLV2_SOURCE AM_LDFLAGS = `pkg-config --libs rasqal` lib_LTLIBRARIES = libslv2.la diff --git a/src/plugin.c b/src/plugin.c index 391ed11..1552c55 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -433,20 +433,15 @@ bool slv2_plugin_has_latency(SLV2Plugin p) { const char* const query = - "ASK WHERE {\n" - " <> lv2:port ?port .\n" + "SELECT DISTINCT ?index WHERE {\n" + " <> lv2:port ?port .\n" " ?port lv2:portHint lv2:reportsLatency ;\n" " lv2:index ?index .\n" "}\n"; - librdf_query_results* results = slv2_plugin_query(p, query); - assert(librdf_query_results_is_boolean(results)); - - bool ret = (librdf_query_results_get_boolean(results) > 0); + SLV2Values result = slv2_plugin_simple_query(p, query, 0); - librdf_free_query_results(results); - - return ret; + return (slv2_values_size(result) > 0); } diff --git a/src/world.c b/src/world.c index ff91ead..913a3ff 100644 --- a/src/world.c +++ b/src/world.c @@ -294,11 +294,20 @@ slv2_world_load_all(SLV2World world) char* lv2_path = getenv("LV2_PATH"); /* 1. Read LV2 ontology into model */ - librdf_uri* ontology_uri = librdf_new_uri(world->world, - (const unsigned char*)"file://" LV2_TTL_PATH); - librdf_parser_parse_into_model(world->parser, ontology_uri, NULL, world->model); - librdf_free_uri(ontology_uri); + const char* ontology_path = "/usr/local/share/slv2/lv2.ttl"; + FILE* ontology = fopen(ontology_path, "r"); + if (ontology == NULL) { + ontology_path = "/usr/share/slv2/lv2.ttl"; + ontology = fopen(ontology_path, "r"); + } + if (ontology) { + fclose(ontology); + librdf_uri* ontology_uri = librdf_new_uri_from_filename(world->world, + ontology_path); + librdf_parser_parse_into_model(world->parser, ontology_uri, NULL, world->model); + librdf_free_uri(ontology_uri); + } /* 2. Read all manifest files into model */ -- cgit v1.2.1