From 0bf92c1f25a854566212e42deafe72ecd2a5f1a1 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 21 Jan 2008 15:14:53 +0000 Subject: Work on generic LV2 events. git-svn-id: http://svn.drobilla.net/lad/slv2@1090 a436a847-0d15-0410-975c-d299462d15a1 --- src/plugin.c | 34 ++++++++++------------------------ 1 file changed, 10 insertions(+), 24 deletions(-) (limited to 'src/plugin.c') diff --git a/src/plugin.c b/src/plugin.c index 2536277..accce8c 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -42,7 +42,6 @@ slv2_plugin_new(SLV2World world, librdf_uri* uri, librdf_uri* bundle_uri, librdf plugin->bundle_uri = librdf_new_uri_from_uri(bundle_uri); plugin->binary_uri = librdf_new_uri_from_uri(binary_uri); plugin->plugin_class = NULL; - plugin->templt = NULL; plugin->data_uris = slv2_values_new(); plugin->ports = raptor_new_sequence((void (*)(void*))&slv2_port_free, NULL); plugin->storage = NULL; @@ -68,9 +67,6 @@ slv2_plugin_free(SLV2Plugin p) raptor_free_sequence(p->ports); p->ports = NULL; - slv2_template_free(p->templt); - p->templt = NULL; - if (p->rdf) { librdf_free_model(p->rdf); p->rdf = NULL; @@ -215,9 +211,6 @@ slv2_plugin_load(SLV2Plugin p) int num_ports = 0; int last_index = -1; - assert(!p->templt); - p->templt = slv2_template_new(); - while (!librdf_query_results_finished(results)) { librdf_node* type_node = librdf_query_results_get_binding_value(results, 0); @@ -228,26 +221,29 @@ slv2_plugin_load(SLV2Plugin p) assert(librdf_node_is_literal(index_node)); //const char* id = (const char*)librdf_node_get_blank_identifier(port_node); - const char* type = (const char*)librdf_uri_as_string(librdf_node_get_uri(type_node)); + //const char* type = (const char*)librdf_uri_as_string(librdf_node_get_uri(type_node)); const char* symbol = (const char*)librdf_node_get_literal_value(symbol_node); const char* index = (const char*)librdf_node_get_literal_value(index_node); //printf("PORT: %s %s %s\n", type, index, symbol); const int this_index = atoi(index); + SLV2Port this_port = NULL; // Create a new SLV2Port, and add to template if (this_index == num_ports) { assert(this_index == last_index + 1); - SLV2Port port = slv2_port_new((unsigned)atoi(index), symbol); - raptor_sequence_push(p->ports, port); - slv2_template_add_port(p->templt); + this_port = slv2_port_new((unsigned)atoi(index), symbol); + raptor_sequence_push(p->ports, this_port); ++num_ports; ++last_index; + } else { + this_port = slv2_plugin_get_port_by_index(p, this_index); } + + raptor_sequence_push(this_port->classes, slv2_value_new_librdf_uri(p->world, + librdf_node_get_uri(type_node))); - slv2_template_port_type(p->templt, this_index, type); - librdf_free_node(type_node); librdf_free_node(symbol_node); librdf_free_node(index_node); @@ -481,16 +477,6 @@ slv2_plugin_get_num_ports(SLV2Plugin p) } -SLV2Template -slv2_plugin_get_template(SLV2Plugin p) -{ - if (!p->rdf) - slv2_plugin_load(p); - - return p->templt; -} - - bool slv2_plugin_has_latency(SLV2Plugin p) { @@ -537,7 +523,7 @@ slv2_plugin_has_feature(SLV2Plugin p, assert(feature); SLV2Values features = slv2_plugin_get_supported_features(p); - SLV2Value val = slv2_value_new(SLV2_VALUE_URI, feature); + SLV2Value val = slv2_value_new(p->world, SLV2_VALUE_URI, feature); const bool ret = features && slv2_values_contains(features, val); -- cgit v1.2.1