summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-04-12 23:47:14 +0000
committerDavid Robillard <d@drobilla.net>2012-04-12 23:47:14 +0000
commitb122168527db12971d53697cf384e8ad12821a7d (patch)
treed9d3094b5205e027358702c4112e3bd1dde25cd6 /src
parent538e4694d2d35c808a57937a5f3bec67b299f60f (diff)
downloadlilv-b122168527db12971d53697cf384e8ad12821a7d.tar.gz
lilv-b122168527db12971d53697cf384e8ad12821a7d.tar.bz2
lilv-b122168527db12971d53697cf384e8ad12821a7d.zip
Use URI defines from LV2 headers where possible.
git-svn-id: http://svn.drobilla.net/lad/trunk/lilv@4175 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/plugin.c11
-rw-r--r--src/port.c8
-rw-r--r--src/state.c34
-rw-r--r--src/world.c39
4 files changed, 47 insertions, 45 deletions
diff --git a/src/plugin.c b/src/plugin.c
index 013cbe0..b4a2f0b 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -24,7 +24,8 @@
#include "lilv_config.h"
#include "lilv_internal.h"
-#define NS_UI (const uint8_t*)"http://lv2plug.in/ns/extensions/ui#"
+#include "lv2/lv2plug.in/ns/extensions/ui/ui.h"
+
#define NS_DOAP (const uint8_t*)"http://usefulinc.com/ns/doap#"
#define NS_FOAF (const uint8_t*)"http://xmlns.com/foaf/0.1/"
@@ -423,7 +424,7 @@ lilv_plugin_verify(const LilvPlugin* plugin)
}
lilv_nodes_free(results);
- LilvNode* lv2_port = lilv_new_uri(plugin->world, LILV_NS_LV2 "port");
+ LilvNode* lv2_port = lilv_new_uri(plugin->world, LV2_CORE__port);
results = lilv_plugin_get_value(plugin, lv2_port);
lilv_node_free(lv2_port);
if (!results) {
@@ -839,8 +840,10 @@ lilv_plugin_get_uis(const LilvPlugin* p)
{
lilv_plugin_load_if_necessary(p);
- SordNode* ui_ui_node = sord_new_uri(p->world->world, NS_UI "ui");
- SordNode* ui_binary_node = sord_new_uri(p->world->world, NS_UI "binary");
+ SordNode* ui_ui_node = sord_new_uri(p->world->world,
+ (const uint8_t*)LV2_UI__ui);
+ SordNode* ui_binary_node = sord_new_uri(p->world->world,
+ (const uint8_t*)LV2_UI__binary);
LilvUIs* result = lilv_uis_new();
SordIter* uis = lilv_world_query_internal(
diff --git a/src/port.c b/src/port.c
index a8d1176..2263280 100644
--- a/src/port.c
+++ b/src/port.c
@@ -20,6 +20,8 @@
#include <stdlib.h>
#include <string.h>
+#include "lv2/lv2plug.in/ns/ext/event/event.h"
+
#include "lilv_internal.h"
LilvPort*
@@ -84,13 +86,11 @@ lilv_port_supports_event(const LilvPlugin* p,
const LilvPort* port,
const LilvNode* event)
{
-#define NS_EV (const uint8_t*)"http://lv2plug.in/ns/ext/event#"
-
assert(event);
SordIter* results = lilv_world_query_internal(
p->world,
port->node,
- sord_new_uri(p->world->world, NS_EV "supportsEvent"),
+ sord_new_uri(p->world->world, (const uint8_t*)LV2_EVENT__supportsEvent),
lilv_node_as_node(event));
const bool ret = !sord_iter_end(results);
@@ -219,7 +219,7 @@ lilv_port_get_scale_points(const LilvPlugin* p,
SordIter* points = lilv_world_query_internal(
p->world,
port->node,
- sord_new_uri(p->world->world, (const uint8_t*)LILV_NS_LV2 "scalePoint"),
+ sord_new_uri(p->world->world, (const uint8_t*)LV2_CORE__scalePoint),
NULL);
LilvScalePoints* ret = NULL;
diff --git a/src/state.c b/src/state.c
index 6441f46..03485b9 100644
--- a/src/state.c
+++ b/src/state.c
@@ -20,16 +20,13 @@
#include "lv2/lv2plug.in/ns/ext/atom/atom.h"
#include "lv2/lv2plug.in/ns/ext/atom/forge.h"
+#include "lv2/lv2plug.in/ns/ext/presets/presets.h"
#include "lv2/lv2plug.in/ns/ext/state/state.h"
#include "lilv_config.h"
#include "lilv_internal.h"
#include "sratom/sratom.h"
-#define NS_ATOM "http://lv2plug.in/ns/ext/atom#"
-#define NS_PSET "http://lv2plug.in/ns/ext/presets#"
-#define NS_STATE "http://lv2plug.in/ns/ext/state#"
-
#define USTR(s) ((const uint8_t*)(s))
typedef struct {
@@ -609,13 +606,14 @@ lilv_state_new_from_file(LilvWorld* world,
static void
set_prefixes(SerdEnv* env)
{
- serd_env_set_prefix_from_strings(env, USTR("atom"), USTR(NS_ATOM));
- serd_env_set_prefix_from_strings(env, USTR("lv2"), USTR(LILV_NS_LV2));
- serd_env_set_prefix_from_strings(env, USTR("pset"), USTR(NS_PSET));
- serd_env_set_prefix_from_strings(env, USTR("rdf"), USTR(LILV_NS_RDF));
- serd_env_set_prefix_from_strings(env, USTR("rdfs"), USTR(LILV_NS_RDFS));
- serd_env_set_prefix_from_strings(env, USTR("state"), USTR(NS_STATE));
- serd_env_set_prefix_from_strings(env, USTR("xsd"), USTR(LILV_NS_XSD));
+#define SET_PSET(e, p, u) serd_env_set_prefix_from_strings(e, p, u)
+ SET_PSET(env, USTR("atom"), USTR(LV2_ATOM_PREFIX));
+ SET_PSET(env, USTR("lv2"), USTR(LV2_CORE_PREFIX));
+ SET_PSET(env, USTR("pset"), USTR(LV2_PRESETS_PREFIX));
+ SET_PSET(env, USTR("rdf"), USTR(LILV_NS_RDF));
+ SET_PSET(env, USTR("rdfs"), USTR(LILV_NS_RDFS));
+ SET_PSET(env, USTR("state"), USTR(LV2_STATE_PREFIX));
+ SET_PSET(env, USTR("xsd"), USTR(LILV_NS_XSD));
}
LILV_API
@@ -633,7 +631,7 @@ lilv_state_new_from_string(LilvWorld* world,
serd_reader_read_string(reader, USTR(str));
const SordNode* p = sord_new_uri(world->world, USTR(LILV_NS_RDF "type"));
- const SordNode* o = sord_new_uri(world->world, USTR(NS_PSET "Preset"));
+ const SordNode* o = sord_new_uri(world->world, USTR(LV2_PRESETS__Preset));
SordIter* const i = sord_search(model, NULL, p, o, NULL);
const SordNode* s = sord_iter_get_node(i, SORD_SUBJECT);
@@ -712,7 +710,7 @@ add_state_to_manifest(const LilvNode* plugin_uri,
// <state> a pset:Preset
SerdNode s = serd_node_from_string(SERD_URI, USTR(state_uri));
SerdNode p = serd_node_from_string(SERD_URI, USTR(LILV_NS_RDF "type"));
- SerdNode o = serd_node_from_string(SERD_URI, USTR(NS_PSET "Preset"));
+ SerdNode o = serd_node_from_string(SERD_URI, USTR(LV2_PRESETS__Preset));
serd_writer_write_statement(writer, 0, NULL, &s, &p, &o, NULL, NULL);
// <state> rdfs:seeAlso <file>
@@ -720,7 +718,7 @@ add_state_to_manifest(const LilvNode* plugin_uri,
serd_writer_write_statement(writer, 0, NULL, &s, &p, &file, NULL, NULL);
// <state> lv2:appliesTo <plugin>
- p = serd_node_from_string(SERD_URI, USTR(LILV_NS_LV2 "appliesTo"));
+ p = serd_node_from_string(SERD_URI, USTR(LV2_CORE__appliesTo));
o = serd_node_from_string(
SERD_URI, USTR(lilv_node_as_string(plugin_uri)));
serd_writer_write_statement(writer, 0, NULL, &s, &p, &o, NULL, NULL);
@@ -768,7 +766,7 @@ lilv_state_write(LilvWorld* world,
// <subject> a pset:Preset
SerdNode p = serd_node_from_string(SERD_URI, USTR(LILV_NS_RDF "type"));
- SerdNode o = serd_node_from_string(SERD_URI, USTR(NS_PSET "Preset"));
+ SerdNode o = serd_node_from_string(SERD_URI, USTR(LV2_PRESETS__Preset));
serd_writer_write_statement(writer, 0, NULL,
&subject, &p, &o, NULL, NULL);
@@ -806,18 +804,18 @@ lilv_state_write(LilvWorld* world,
SERD_BLANK, USTR(value->symbol));
// <> lv2:port _:symbol
- p = serd_node_from_string(SERD_URI, USTR(LILV_NS_LV2 "port"));
+ p = serd_node_from_string(SERD_URI, USTR(LV2_CORE__port));
serd_writer_write_statement(writer, SERD_ANON_O_BEGIN,
NULL, &subject, &p, &port, NULL, NULL);
// _:symbol lv2:symbol "symbol"
- p = serd_node_from_string(SERD_URI, USTR(LILV_NS_LV2 "symbol"));
+ p = serd_node_from_string(SERD_URI, USTR(LV2_CORE__symbol));
o = serd_node_from_string(SERD_LITERAL, USTR(value->symbol));
serd_writer_write_statement(writer, SERD_ANON_CONT,
NULL, &port, &p, &o, NULL, NULL);
// _:symbol pset:value value
- p = serd_node_from_string(SERD_URI, USTR(NS_PSET "value"));
+ p = serd_node_from_string(SERD_URI, USTR(LV2_PRESETS__value));
sratom_write(sratom, unmap, SERD_ANON_CONT, &port, &p,
value->type, value->size, value->value);
diff --git a/src/world.c b/src/world.c
index 97901e6..8eb3591 100644
--- a/src/world.c
+++ b/src/world.c
@@ -19,6 +19,8 @@
#include <stdlib.h>
#include <string.h>
+#include "lv2/lv2plug.in/ns/ext/presets/presets.h"
+
#include "lilv_internal.h"
LILV_API
@@ -48,31 +50,30 @@ lilv_world_new(void)
#define NS_DCTERMS "http://purl.org/dc/terms/"
#define NS_DYNMAN "http://lv2plug.in/ns/ext/dynmanifest#"
-#define NS_PSET "http://lv2plug.in/ns/ext/presets#"
#define NEW_URI(uri) sord_new_uri(world->world, (const uint8_t*)uri)
world->uris.dc_replaces = NEW_URI(NS_DCTERMS "replaces");
world->uris.dman_DynManifest = NEW_URI(NS_DYNMAN "DynManifest");
world->uris.doap_name = NEW_URI(LILV_NS_DOAP "name");
- world->uris.lv2_Plugin = NEW_URI(LILV_NS_LV2 "Plugin");
- world->uris.lv2_Specification = NEW_URI(LILV_NS_LV2 "Specification");
- world->uris.lv2_appliesTo = NEW_URI(LILV_NS_LV2 "appliesTo");
- world->uris.lv2_binary = NEW_URI(LILV_NS_LV2 "binary");
- world->uris.lv2_default = NEW_URI(LILV_NS_LV2 "default");
- world->uris.lv2_designation = NEW_URI(LILV_NS_LV2 "designation");
- world->uris.lv2_extensionData = NEW_URI(LILV_NS_LV2 "extensionData");
- world->uris.lv2_index = NEW_URI(LILV_NS_LV2 "index");
- world->uris.lv2_maximum = NEW_URI(LILV_NS_LV2 "maximum");
- world->uris.lv2_minimum = NEW_URI(LILV_NS_LV2 "minimum");
- world->uris.lv2_name = NEW_URI(LILV_NS_LV2 "name");
- world->uris.lv2_optionalFeature = NEW_URI(LILV_NS_LV2 "optionalFeature");
- world->uris.lv2_port = NEW_URI(LILV_NS_LV2 "port");
- world->uris.lv2_portProperty = NEW_URI(LILV_NS_LV2 "portProperty");
- world->uris.lv2_reportsLatency = NEW_URI(LILV_NS_LV2 "reportsLatency");
- world->uris.lv2_requiredFeature = NEW_URI(LILV_NS_LV2 "requiredFeature");
- world->uris.lv2_symbol = NEW_URI(LILV_NS_LV2 "symbol");
- world->uris.pset_value = NEW_URI(NS_PSET "value");
+ world->uris.lv2_Plugin = NEW_URI(LV2_CORE__Plugin);
+ world->uris.lv2_Specification = NEW_URI(LV2_CORE__Specification);
+ world->uris.lv2_appliesTo = NEW_URI(LV2_CORE__appliesTo);
+ world->uris.lv2_binary = NEW_URI(LV2_CORE__binary);
+ world->uris.lv2_default = NEW_URI(LV2_CORE__default);
+ world->uris.lv2_designation = NEW_URI(LV2_CORE__designation);
+ world->uris.lv2_extensionData = NEW_URI(LV2_CORE__extensionData);
+ world->uris.lv2_index = NEW_URI(LV2_CORE__index);
+ world->uris.lv2_maximum = NEW_URI(LV2_CORE__maximum);
+ world->uris.lv2_minimum = NEW_URI(LV2_CORE__minimum);
+ world->uris.lv2_name = NEW_URI(LV2_CORE__name);
+ world->uris.lv2_optionalFeature = NEW_URI(LV2_CORE__optionalFeature);
+ world->uris.lv2_port = NEW_URI(LV2_CORE__port);
+ world->uris.lv2_portProperty = NEW_URI(LV2_CORE__portProperty);
+ world->uris.lv2_reportsLatency = NEW_URI(LV2_CORE__reportsLatency);
+ world->uris.lv2_requiredFeature = NEW_URI(LV2_CORE__requiredFeature);
+ world->uris.lv2_symbol = NEW_URI(LV2_CORE__symbol);
+ world->uris.pset_value = NEW_URI(LV2_PRESETS__value);
world->uris.rdf_a = NEW_URI(LILV_NS_RDF "type");
world->uris.rdf_value = NEW_URI(LILV_NS_RDF "value");
world->uris.rdfs_Class = NEW_URI(LILV_NS_RDFS "Class");