diff options
author | David Robillard <d@drobilla.net> | 2017-12-29 14:21:38 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2017-12-29 14:21:38 -0500 |
commit | 7be5489bdd166cdbc9fde5ded4c90f724f005ffd (patch) | |
tree | 73d9b45a4b59559f024b3176c1206495d2e92862 /src | |
parent | da6d53f9e52fc05fdd33052f70406c2c0fd508fe (diff) | |
download | lilv-7be5489bdd166cdbc9fde5ded4c90f724f005ffd.tar.gz lilv-7be5489bdd166cdbc9fde5ded4c90f724f005ffd.tar.bz2 lilv-7be5489bdd166cdbc9fde5ded4c90f724f005ffd.zip |
Fix inconsistent parameter names
Diffstat (limited to 'src')
-rw-r--r-- | src/collections.c | 29 | ||||
-rw-r--r-- | src/lilv_internal.h | 12 | ||||
-rw-r--r-- | src/plugin.c | 435 | ||||
-rw-r--r-- | src/port.c | 68 | ||||
-rw-r--r-- | src/scalepoint.c | 8 | ||||
-rw-r--r-- | src/ui.c | 4 | ||||
-rw-r--r-- | src/world.c | 8 |
7 files changed, 283 insertions, 281 deletions
diff --git a/src/collections.c b/src/collections.c index f519b71..9ded845 100644 --- a/src/collections.c +++ b/src/collections.c @@ -39,17 +39,17 @@ lilv_collection_new(ZixComparator cmp, ZixDestroyFunc destructor) } void -lilv_collection_free(LilvCollection* coll) +lilv_collection_free(LilvCollection* collection) { - if (coll) { - zix_tree_free((ZixTree*)coll); + if (collection) { + zix_tree_free((ZixTree*)collection); } } unsigned -lilv_collection_size(const LilvCollection* coll) +lilv_collection_size(const LilvCollection* collection) { - return (coll ? zix_tree_size((const ZixTree*)coll) : 0); + return (collection ? zix_tree_size((const ZixTree*)collection) : 0); } LilvIter* @@ -98,17 +98,17 @@ lilv_plugin_classes_new(void) /* URI based accessors (for collections of things with URIs) */ LILV_API const LilvPluginClass* -lilv_plugin_classes_get_by_uri(const LilvPluginClasses* coll, +lilv_plugin_classes_get_by_uri(const LilvPluginClasses* classes, const LilvNode* uri) { return (LilvPluginClass*)lilv_collection_get_by_uri( - (const ZixTree*)coll, uri); + (const ZixTree*)classes, uri); } LILV_API const LilvUI* -lilv_uis_get_by_uri(const LilvUIs* coll, const LilvNode* uri) +lilv_uis_get_by_uri(const LilvUIs* uis, const LilvNode* uri) { - return (LilvUI*)lilv_collection_get_by_uri((const ZixTree*)coll, uri); + return (LilvUI*)lilv_collection_get_by_uri((const ZixTree*)uis, uri); } /* Plugins */ @@ -120,18 +120,19 @@ lilv_plugins_new(void) } LILV_API const LilvPlugin* -lilv_plugins_get_by_uri(const LilvPlugins* list, const LilvNode* uri) +lilv_plugins_get_by_uri(const LilvPlugins* plugins, const LilvNode* uri) { - return (LilvPlugin*)lilv_collection_get_by_uri((const ZixTree*)list, uri); + return (LilvPlugin*)lilv_collection_get_by_uri( + (const ZixTree*)plugins, uri); } /* Nodes */ LILV_API bool -lilv_nodes_contains(const LilvNodes* list, const LilvNode* value) +lilv_nodes_contains(const LilvNodes* nodes, const LilvNode* value) { - LILV_FOREACH(nodes, i, list) { - if (lilv_node_equals(lilv_nodes_get(list, i), value)) { + LILV_FOREACH(nodes, i, nodes) { + if (lilv_node_equals(lilv_nodes_get(nodes, i), value)) { return true; } } diff --git a/src/lilv_internal.h b/src/lilv_internal.h index af8e31a..cedc33e 100644 --- a/src/lilv_internal.h +++ b/src/lilv_internal.h @@ -258,9 +258,9 @@ LilvPlugin* lilv_plugin_new(LilvWorld* world, LilvNode* uri, LilvNode* bundle_uri); void lilv_plugin_clear(LilvPlugin* plugin, LilvNode* bundle_uri); -void lilv_plugin_load_if_necessary(const LilvPlugin* p); +void lilv_plugin_load_if_necessary(const LilvPlugin* plugin); void lilv_plugin_free(LilvPlugin* plugin); -LilvNode* lilv_plugin_get_unique(const LilvPlugin* p, +LilvNode* lilv_plugin_get_unique(const LilvPlugin* plugin, const SordNode* subject, const SordNode* predicate); @@ -271,7 +271,7 @@ void* lilv_collection_get(const LilvCollection* collection, const LilvIter* i); LilvPluginClass* lilv_plugin_class_new(LilvWorld* world, - const SordNode* parent_uri, + const SordNode* parent_node, const SordNode* uri, const char* label); @@ -313,7 +313,7 @@ LilvUI* lilv_ui_new(LilvWorld* world, void lilv_ui_free(LilvUI* ui); -LilvNode* lilv_node_new(LilvWorld* world, LilvNodeType type, const char* val); +LilvNode* lilv_node_new(LilvWorld* world, LilvNodeType type, const char* str); LilvNode* lilv_node_new_from_node(LilvWorld* world, const SordNode* node); int lilv_header_compare_by_uri(const void* a, const void* b, void* user_data); @@ -370,7 +370,7 @@ lilv_world_filter_model(LilvWorld* world, #define FOREACH_MATCH(iter) \ for (; !sord_iter_end(iter); sord_iter_next(iter)) -LilvNodes* lilv_nodes_from_stream_objects(LilvWorld* w, +LilvNodes* lilv_nodes_from_stream_objects(LilvWorld* world, SordIter* stream, SordQuadIndex field); @@ -389,7 +389,7 @@ bool lilv_path_is_child(const char* path, const char* dir); int lilv_flock(FILE* file, bool lock); char* lilv_realpath(const char* path); int lilv_symlink(const char* oldpath, const char* newpath); -int lilv_mkdir_p(const char* path); +int lilv_mkdir_p(const char* dir_path); char* lilv_path_join(const char* a, const char* b); bool lilv_file_equals(const char* a_path, const char* b_path); diff --git a/src/plugin.c b/src/plugin.c index d524ebe..0575b32 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -72,63 +72,63 @@ lilv_plugin_clear(LilvPlugin* plugin, LilvNode* bundle_uri) } static void -lilv_plugin_free_ports(LilvPlugin* p) +lilv_plugin_free_ports(LilvPlugin* plugin) { - if (p->ports) { - for (uint32_t i = 0; i < p->num_ports; ++i) { - lilv_port_free(p, p->ports[i]); + if (plugin->ports) { + for (uint32_t i = 0; i < plugin->num_ports; ++i) { + lilv_port_free(plugin, plugin->ports[i]); } - free(p->ports); - p->num_ports = 0; - p->ports = NULL; + free(plugin->ports); + plugin->num_ports = 0; + plugin->ports = NULL; } } void -lilv_plugin_free(LilvPlugin* p) +lilv_plugin_free(LilvPlugin* plugin) { #ifdef LILV_DYN_MANIFEST - if (p->dynmanifest && --p->dynmanifest->refs == 0) { + if (plugin->dynmanifest && --plugin->dynmanifest->refs == 0) { typedef int (*CloseFunc)(LV2_Dyn_Manifest_Handle); - CloseFunc close_func = (CloseFunc)lilv_dlfunc(p->dynmanifest->lib, + CloseFunc close_func = (CloseFunc)lilv_dlfunc(plugin->dynmanifest->lib, "lv2_dyn_manifest_close"); if (close_func) { - close_func(p->dynmanifest->handle); + close_func(plugin->dynmanifest->handle); } - dlclose(p->dynmanifest->lib); - lilv_node_free(p->dynmanifest->bundle); - free(p->dynmanifest); + dlclose(plugin->dynmanifest->lib); + lilv_node_free(plugin->dynmanifest->bundle); + free(plugin->dynmanifest); } #endif - lilv_node_free(p->plugin_uri); - p->plugin_uri = NULL; + lilv_node_free(plugin->plugin_uri); + plugin->plugin_uri = NULL; - lilv_node_free(p->bundle_uri); - p->bundle_uri = NULL; + lilv_node_free(plugin->bundle_uri); + plugin->bundle_uri = NULL; - lilv_node_free(p->binary_uri); - p->binary_uri = NULL; + lilv_node_free(plugin->binary_uri); + plugin->binary_uri = NULL; - lilv_plugin_free_ports(p); + lilv_plugin_free_ports(plugin); - lilv_nodes_free(p->data_uris); - p->data_uris = NULL; + lilv_nodes_free(plugin->data_uris); + plugin->data_uris = NULL; - free(p); + free(plugin); } static LilvNode* -lilv_plugin_get_one(const LilvPlugin* p, +lilv_plugin_get_one(const LilvPlugin* plugin, const SordNode* subject, const SordNode* predicate) { LilvNode* ret = NULL; SordIter* stream = lilv_world_query_internal( - p->world, subject, predicate, NULL); + plugin->world, subject, predicate, NULL); if (!sord_iter_end(stream)) { - ret = lilv_node_new_from_node(p->world, + ret = lilv_node_new_from_node(plugin->world, sord_iter_get_node(stream, SORD_OBJECT)); } sord_iter_free(stream); @@ -136,11 +136,11 @@ lilv_plugin_get_one(const LilvPlugin* p, } LilvNode* -lilv_plugin_get_unique(const LilvPlugin* p, +lilv_plugin_get_unique(const LilvPlugin* plugin, const SordNode* subject, const SordNode* predicate) { - LilvNode* ret = lilv_plugin_get_one(p, subject, predicate); + LilvNode* ret = lilv_plugin_get_one(plugin, subject, predicate); if (!ret) { LILV_ERRORF("No value found for (%s %s ...) property\n", sord_node_get_string(subject), @@ -150,34 +150,35 @@ lilv_plugin_get_unique(const LilvPlugin* p, } static void -lilv_plugin_load(LilvPlugin* p) +lilv_plugin_load(LilvPlugin* plugin) { - SordNode* bundle_uri_node = p->bundle_uri->node; + SordNode* bundle_uri_node = plugin->bundle_uri->node; const SerdNode* bundle_uri_snode = sord_node_to_serd_node(bundle_uri_node); SerdEnv* env = serd_env_new(bundle_uri_snode); - SerdReader* reader = sord_new_reader(p->world->model, env, SERD_TURTLE, + SerdReader* reader = sord_new_reader(plugin->world->model, env, SERD_TURTLE, bundle_uri_node); - SordModel* prots = lilv_world_filter_model(p->world, - p->world->model, - p->plugin_uri->node, - p->world->uris.lv2_prototype, - NULL, NULL); - SordModel* skel = sord_new(p->world->world, SORD_SPO, false); + SordModel* prots = lilv_world_filter_model( + plugin->world, + plugin->world->model, + plugin->plugin_uri->node, + plugin->world->uris.lv2_prototype, + NULL, NULL); + SordModel* skel = sord_new(plugin->world->world, SORD_SPO, false); SordIter* iter = sord_begin(prots); for (; !sord_iter_end(iter); sord_iter_next(iter)) { const SordNode* t = sord_iter_get_node(iter, SORD_OBJECT); - LilvNode* prototype = lilv_node_new_from_node(p->world, t); + LilvNode* prototype = lilv_node_new_from_node(plugin->world, t); - lilv_world_load_resource(p->world, prototype); + lilv_world_load_resource(plugin->world, prototype); SordIter* statements = sord_search( - p->world->model, prototype->node, NULL, NULL, NULL); + plugin->world->model, prototype->node, NULL, NULL, NULL); FOREACH_MATCH(statements) { SordQuad quad; sord_iter_get(statements, quad); - quad[0] = p->plugin_uri->node; + quad[0] = plugin->plugin_uri->node; sord_add(skel, quad); } @@ -189,7 +190,7 @@ lilv_plugin_load(LilvPlugin* p) for (iter = sord_begin(skel); !sord_iter_end(iter); sord_iter_next(iter)) { SordQuad quad; sord_iter_get(iter, quad); - sord_add(p->world->model, quad); + sord_add(plugin->world->model, quad); } sord_iter_free(iter); sord_free(skel); @@ -197,19 +198,19 @@ lilv_plugin_load(LilvPlugin* p) // Parse all the plugin's data files into RDF model SerdStatus st = SERD_SUCCESS; - LILV_FOREACH(nodes, i, p->data_uris) { - const LilvNode* data_uri = lilv_nodes_get(p->data_uris, i); + LILV_FOREACH(nodes, i, plugin->data_uris) { + const LilvNode* data_uri = lilv_nodes_get(plugin->data_uris, i); serd_env_set_base_uri(env, sord_node_to_serd_node(data_uri->node)); - st = lilv_world_load_file(p->world, reader, data_uri); + st = lilv_world_load_file(plugin->world, reader, data_uri); if (st > SERD_FAILURE) { break; } } if (st > SERD_FAILURE) { - p->loaded = true; - p->parse_errors = true; + plugin->loaded = true; + plugin->parse_errors = true; serd_reader_free(reader); serd_env_free(env); return; @@ -217,21 +218,21 @@ lilv_plugin_load(LilvPlugin* p) #ifdef LILV_DYN_MANIFEST // Load and parse dynamic manifest data, if this is a library - if (p->dynmanifest) { + if (plugin->dynmanifest) { typedef int (*GetDataFunc)(LV2_Dyn_Manifest_Handle handle, FILE* fp, const char* uri); GetDataFunc get_data_func = (GetDataFunc)lilv_dlfunc( - p->dynmanifest->lib, "lv2_dyn_manifest_get_data"); + plugin->dynmanifest->lib, "lv2_dyn_manifest_get_data"); if (get_data_func) { - const SordNode* bundle = p->dynmanifest->bundle->node; + const SordNode* bundle = plugin->dynmanifest->bundle->node; serd_env_set_base_uri(env, sord_node_to_serd_node(bundle)); FILE* fd = tmpfile(); - get_data_func(p->dynmanifest->handle, fd, - lilv_node_as_string(p->plugin_uri)); + get_data_func(plugin->dynmanifest->handle, fd, + lilv_node_as_string(plugin->plugin_uri)); rewind(fd); serd_reader_add_blank_prefix( - reader, lilv_world_blank_node_prefix(p->world)); + reader, lilv_world_blank_node_prefix(plugin->world)); serd_reader_read_file_handle( reader, fd, (const uint8_t*)"(dyn-manifest)"); fclose(fd); @@ -241,7 +242,7 @@ lilv_plugin_load(LilvPlugin* p) serd_reader_free(reader); serd_env_free(env); - p->loaded = true; + plugin->loaded = true; } static bool @@ -259,81 +260,81 @@ is_symbol(const char* str) } static void -lilv_plugin_load_ports_if_necessary(const LilvPlugin* const_p) +lilv_plugin_load_ports_if_necessary(const LilvPlugin* const_plugin) { - LilvPlugin* p = (LilvPlugin*)const_p; + LilvPlugin* plugin = (LilvPlugin*)const_plugin; - lilv_plugin_load_if_necessary(p); + lilv_plugin_load_if_necessary(plugin); - if (!p->ports) { - p->ports = (LilvPort**)malloc(sizeof(LilvPort*)); - p->ports[0] = NULL; + if (!plugin->ports) { + plugin->ports = (LilvPort**)malloc(sizeof(LilvPort*)); + plugin->ports[0] = NULL; SordIter* ports = lilv_world_query_internal( - p->world, - p->plugin_uri->node, - p->world->uris.lv2_port, + plugin->world, + plugin->plugin_uri->node, + plugin->world->uris.lv2_port, NULL); FOREACH_MATCH(ports) { const SordNode* port = sord_iter_get_node(ports, SORD_OBJECT); LilvNode* index = lilv_plugin_get_unique( - p, port, p->world->uris.lv2_index); + plugin, port, plugin->world->uris.lv2_index); LilvNode* symbol = lilv_plugin_get_unique( - p, port, p->world->uris.lv2_symbol); + plugin, port, plugin->world->uris.lv2_symbol); if (!lilv_node_is_string(symbol) || !is_symbol((const char*)sord_node_get_string(symbol->node))) { LILV_ERRORF("Plugin <%s> port symbol `%s' is invalid\n", - lilv_node_as_uri(p->plugin_uri), + lilv_node_as_uri(plugin->plugin_uri), lilv_node_as_string(symbol)); lilv_node_free(symbol); lilv_node_free(index); - lilv_plugin_free_ports(p); + lilv_plugin_free_ports(plugin); break; } if (!lilv_node_is_int(index)) { LILV_ERRORF("Plugin <%s> port index is not an integer\n", - lilv_node_as_uri(p->plugin_uri)); + lilv_node_as_uri(plugin->plugin_uri)); lilv_node_free(symbol); lilv_node_free(index); - lilv_plugin_free_ports(p); + lilv_plugin_free_ports(plugin); break; } uint32_t this_index = lilv_node_as_int(index); LilvPort* this_port = NULL; - if (p->num_ports > this_index) { - this_port = p->ports[this_index]; + if (plugin->num_ports > this_index) { + this_port = plugin->ports[this_index]; } else { - p->ports = (LilvPort**)realloc( - p->ports, (this_index + 1) * sizeof(LilvPort*)); - memset(p->ports + p->num_ports, '\0', - (this_index - p->num_ports) * sizeof(LilvPort*)); - p->num_ports = this_index + 1; + plugin->ports = (LilvPort**)realloc( + plugin->ports, (this_index + 1) * sizeof(LilvPort*)); + memset(plugin->ports + plugin->num_ports, '\0', + (this_index - plugin->num_ports) * sizeof(LilvPort*)); + plugin->num_ports = this_index + 1; } // Havn't seen this port yet, add it to array if (!this_port) { - this_port = lilv_port_new(p->world, + this_port = lilv_port_new(plugin->world, port, this_index, lilv_node_as_string(symbol)); - p->ports[this_index] = this_port; + plugin->ports[this_index] = this_port; } SordIter* types = lilv_world_query_internal( - p->world, port, p->world->uris.rdf_a, NULL); + plugin->world, port, plugin->world->uris.rdf_a, NULL); FOREACH_MATCH(types) { const SordNode* type = sord_iter_get_node(types, SORD_OBJECT); if (sord_node_get_type(type) == SORD_URI) { zix_tree_insert( (ZixTree*)this_port->classes, - lilv_node_new_from_node(p->world, type), NULL); + lilv_node_new_from_node(plugin->world, type), NULL); } else { LILV_WARNF("Plugin <%s> port type is not a URI\n", - lilv_node_as_uri(p->plugin_uri)); + lilv_node_as_uri(plugin->plugin_uri)); } } sord_iter_free(types); @@ -344,11 +345,11 @@ lilv_plugin_load_ports_if_necessary(const LilvPlugin* const_p) sord_iter_free(ports); // Check sanity - for (uint32_t i = 0; i < p->num_ports; ++i) { - if (!p->ports[i]) { + for (uint32_t i = 0; i < plugin->num_ports; ++i) { + if (!plugin->ports[i]) { LILV_ERRORF("Plugin <%s> is missing port %d/%d\n", - lilv_node_as_uri(p->plugin_uri), i, p->num_ports); - lilv_plugin_free_ports(p); + lilv_node_as_uri(plugin->plugin_uri), i, plugin->num_ports); + lilv_plugin_free_ports(plugin); break; } } @@ -356,68 +357,67 @@ lilv_plugin_load_ports_if_necessary(const LilvPlugin* const_p) } void -lilv_plugin_load_if_necessary(const LilvPlugin* p) +lilv_plugin_load_if_necessary(const LilvPlugin* plugin) { - if (!p->loaded) { - lilv_plugin_load((LilvPlugin*)p); + if (!plugin->loaded) { + lilv_plugin_load((LilvPlugin*)plugin); } } LILV_API const LilvNode* -lilv_plugin_get_uri(const LilvPlugin* p) +lilv_plugin_get_uri(const LilvPlugin* plugin) { - return p->plugin_uri; + return plugin->plugin_uri; } LILV_API const LilvNode* -lilv_plugin_get_bundle_uri(const LilvPlugin* p) +lilv_plugin_get_bundle_uri(const LilvPlugin* plugin) { - return p->bundle_uri; + return plugin->bundle_uri; } LILV_API const LilvNode* -lilv_plugin_get_library_uri(const LilvPlugin* const_p) +lilv_plugin_get_library_uri(const LilvPlugin* plugin) { - LilvPlugin* p = (LilvPlugin*)const_p; - lilv_plugin_load_if_necessary(p); - if (!p->binary_uri) { + lilv_plugin_load_if_necessary((LilvPlugin*)plugin); + if (!plugin->binary_uri) { // <plugin> lv2:binary ?binary - SordIter* i = lilv_world_query_internal(p->world, - p->plugin_uri->node, - p->world->uris.lv2_binary, + SordIter* i = lilv_world_query_internal(plugin->world, + plugin->plugin_uri->node, + plugin->world->uris.lv2_binary, NULL); FOREACH_MATCH(i) { const SordNode* binary_node = sord_iter_get_node(i, SORD_OBJECT); if (sord_node_get_type(binary_node) == SORD_URI) { - p->binary_uri = lilv_node_new_from_node(p->world, binary_node); + ((LilvPlugin*)plugin)->binary_uri = + lilv_node_new_from_node(plugin->world, binary_node); break; } } sord_iter_free(i); } - if (!p->binary_uri) { + if (!plugin->binary_uri) { LILV_WARNF("Plugin <%s> has no lv2:binary\n", - lilv_node_as_uri(lilv_plugin_get_uri(p))); + lilv_node_as_uri(lilv_plugin_get_uri(plugin))); } - return p->binary_uri; + return plugin->binary_uri; } LILV_API const LilvNodes* -lilv_plugin_get_data_uris(const LilvPlugin* p) +lilv_plugin_get_data_uris(const LilvPlugin* plugin) { - return p->data_uris; + return plugin->data_uris; } LILV_API const LilvPluginClass* -lilv_plugin_get_class(const LilvPlugin* const_p) +lilv_plugin_get_class(const LilvPlugin* plugin) { - LilvPlugin* p = (LilvPlugin*)const_p; - lilv_plugin_load_if_necessary(p); - if (!p->plugin_class) { + lilv_plugin_load_if_necessary((LilvPlugin*)plugin); + if (!plugin->plugin_class) { // <plugin> a ?class - SordIter* c = lilv_world_query_internal(p->world, - p->plugin_uri->node, - p->world->uris.rdf_a, + SordIter* c = lilv_world_query_internal(plugin->world, + plugin->plugin_uri->node, + plugin->world->uris.rdf_a, NULL); FOREACH_MATCH(c) { const SordNode* class_node = sord_iter_get_node(c, SORD_OBJECT); @@ -425,13 +425,13 @@ lilv_plugin_get_class(const LilvPlugin* const_p) continue; } - LilvNode* klass = lilv_node_new_from_node(p->world, class_node); - if (!lilv_node_equals(klass, p->world->lv2_plugin_class->uri)) { + LilvNode* klass = lilv_node_new_from_node(plugin->world, class_node); + if (!lilv_node_equals(klass, plugin->world->lv2_plugin_class->uri)) { const LilvPluginClass* pclass = lilv_plugin_classes_get_by_uri( - p->world->plugin_classes, klass); + plugin->world->plugin_classes, klass); if (pclass) { - p->plugin_class = pclass; + ((LilvPlugin*)plugin)->plugin_class = pclass; lilv_node_free(klass); break; } @@ -441,20 +441,21 @@ lilv_plugin_get_class(const LilvPlugin* const_p) } sord_iter_free(c); - if (p->plugin_class == NULL) { - p->plugin_class = p->world->lv2_plugin_class; + if (plugin->plugin_class == NULL) { + ((LilvPlugin*)plugin)->plugin_class = + plugin->world->lv2_plugin_class; } } - return p->plugin_class; + return plugin->plugin_class; } static LilvNodes* -lilv_plugin_get_value_internal(const LilvPlugin* p, +lilv_plugin_get_value_internal(const LilvPlugin* plugin, const SordNode* predicate) { - lilv_plugin_load_if_necessary(p); + lilv_plugin_load_if_necessary(plugin); return lilv_world_find_nodes_internal( - p->world, p->plugin_uri->node, predicate, NULL); + plugin->world, plugin->plugin_uri->node, predicate, NULL); } LILV_API bool @@ -515,27 +516,27 @@ lilv_plugin_get_name(const LilvPlugin* plugin) } LILV_API LilvNodes* -lilv_plugin_get_value(const LilvPlugin* p, +lilv_plugin_get_value(const LilvPlugin* plugin, const LilvNode* predicate) { - lilv_plugin_load_if_necessary(p); - return lilv_world_find_nodes(p->world, p->plugin_uri, predicate, NULL); + lilv_plugin_load_if_necessary(plugin); + return lilv_world_find_nodes(plugin->world, plugin->plugin_uri, predicate, NULL); } LILV_API uint32_t -lilv_plugin_get_num_ports(const LilvPlugin* p) +lilv_plugin_get_num_ports(const LilvPlugin* plugin) { - lilv_plugin_load_ports_if_necessary(p); - return p->num_ports; + lilv_plugin_load_ports_if_necessary(plugin); + return plugin->num_ports; } LILV_API void -lilv_plugin_get_port_ranges_float(const LilvPlugin* p, +lilv_plugin_get_port_ranges_float(const LilvPlugin* plugin, float* min_values, float* max_values, float* def_values) { - lilv_plugin_load_ports_if_necessary(p); + lilv_plugin_load_ports_if_necessary(plugin); LilvNode* min = NULL; LilvNode* max = NULL; LilvNode* def = NULL; @@ -543,8 +544,8 @@ lilv_plugin_get_port_ranges_float(const LilvPlugin* p, LilvNode** maxptr = max_values ? &max : NULL; LilvNode** defptr = def_values ? &def : NULL; - for (uint32_t i = 0; i < p->num_ports; ++i) { - lilv_port_get_range(p, p->ports[i], defptr, minptr, maxptr); + for (uint32_t i = 0; i < plugin->num_ports; ++i) { + lilv_port_get_range(plugin, plugin->ports[i], defptr, minptr, maxptr); if (min_values) { if (lilv_node_is_float(min) || lilv_node_is_int(min)) { @@ -577,11 +578,11 @@ lilv_plugin_get_port_ranges_float(const LilvPlugin* p, } LILV_API uint32_t -lilv_plugin_get_num_ports_of_class_va(const LilvPlugin* p, +lilv_plugin_get_num_ports_of_class_va(const LilvPlugin* plugin, const LilvNode* class_1, va_list args) { - lilv_plugin_load_ports_if_necessary(p); + lilv_plugin_load_ports_if_necessary(plugin); uint32_t count = 0; @@ -595,12 +596,12 @@ lilv_plugin_get_num_ports_of_class_va(const LilvPlugin* p, } // Check each port against every type - for (unsigned i = 0; i < p->num_ports; ++i) { - LilvPort* port = p->ports[i]; - if (port && lilv_port_is_a(p, port, class_1)) { + for (unsigned i = 0; i < plugin->num_ports; ++i) { + LilvPort* port = plugin->ports[i]; + if (port && lilv_port_is_a(plugin, port, class_1)) { bool matches = true; for (size_t j = 0; j < n_classes; ++j) { - if (!lilv_port_is_a(p, port, classes[j])) { + if (!lilv_port_is_a(plugin, port, classes[j])) { matches = false; break; } @@ -617,41 +618,41 @@ lilv_plugin_get_num_ports_of_class_va(const LilvPlugin* p, } LILV_API uint32_t -lilv_plugin_get_num_ports_of_class(const LilvPlugin* p, +lilv_plugin_get_num_ports_of_class(const LilvPlugin* plugin, const LilvNode* class_1, ...) { va_list args; va_start(args, class_1); - uint32_t count = lilv_plugin_get_num_ports_of_class_va(p, class_1, args); + uint32_t count = lilv_plugin_get_num_ports_of_class_va(plugin, class_1, args); va_end(args); return count; } LILV_API bool -lilv_plugin_has_latency(const LilvPlugin* p) +lilv_plugin_has_latency(const LilvPlugin* plugin) { - lilv_plugin_load_if_necessary(p); + lilv_plugin_load_if_necessary(plugin); SordIter* ports = lilv_world_query_internal( - p->world, - p->plugin_uri->node, - p->world->uris.lv2_port, + plugin->world, + plugin->plugin_uri->node, + plugin->world->uris.lv2_port, NULL); bool ret = false; FOREACH_MATCH(ports) { const SordNode* port = sord_iter_get_node(ports, SORD_OBJECT); SordIter* prop = lilv_world_query_internal( - p->world, + plugin->world, port, - p->world->uris.lv2_portProperty, - p->world->uris.lv2_reportsLatency); + plugin->world->uris.lv2_portProperty, + plugin->world->uris.lv2_reportsLatency); SordIter* des = lilv_world_query_internal( - p->world, + plugin->world, port, - p->world->uris.lv2_designation, - p->world->uris.lv2_latency); + plugin->world->uris.lv2_designation, + plugin->world->uris.lv2_latency); const bool latent = !sord_iter_end(prop) || !sord_iter_end(des); sord_iter_free(prop); sord_iter_free(des); @@ -717,12 +718,12 @@ lilv_plugin_get_port_by_designation(const LilvPlugin* plugin, } LILV_API uint32_t -lilv_plugin_get_latency_port_index(const LilvPlugin* p) +lilv_plugin_get_latency_port_index(const LilvPlugin* plugin) { const LilvPort* prop_port = lilv_plugin_get_port_by_property( - p, p->world->uris.lv2_reportsLatency); + plugin, plugin->world->uris.lv2_reportsLatency); const LilvPort* des_port = lilv_plugin_get_port_by_property( - p, p->world->uris.lv2_latency); + plugin, plugin->world->uris.lv2_latency); if (prop_port) { return prop_port->index; } else if (des_port) { @@ -733,17 +734,17 @@ lilv_plugin_get_latency_port_index(const LilvPlugin* p) } LILV_API bool -lilv_plugin_has_feature(const LilvPlugin* p, +lilv_plugin_has_feature(const LilvPlugin* plugin, const LilvNode* feature) { - lilv_plugin_load_if_necessary(p); - const SordNode* predicates[] = { p->world->uris.lv2_requiredFeature, - p->world->uris.lv2_optionalFeature, + lilv_plugin_load_if_necessary(plugin); + const SordNode* predicates[] = { plugin->world->uris.lv2_requiredFeature, + plugin->world->uris.lv2_optionalFeature, NULL }; for (const SordNode** pred = predicates; *pred; ++pred) { if (lilv_world_ask_internal( - p->world, p->plugin_uri->node, *pred, feature->node)) { + plugin->world, plugin->plugin_uri->node, *pred, feature->node)) { return true; } } @@ -751,10 +752,10 @@ lilv_plugin_has_feature(const LilvPlugin* p, } LILV_API LilvNodes* -lilv_plugin_get_supported_features(const LilvPlugin* p) +lilv_plugin_get_supported_features(const LilvPlugin* plugin) { - LilvNodes* optional = lilv_plugin_get_optional_features(p); - LilvNodes* required = lilv_plugin_get_required_features(p); + LilvNodes* optional = lilv_plugin_get_optional_features(plugin); + LilvNodes* required = lilv_plugin_get_required_features(plugin); LilvNodes* result = lilv_nodes_merge(optional, required); lilv_nodes_free(optional); lilv_nodes_free(required); @@ -762,27 +763,27 @@ lilv_plugin_get_supported_features(const LilvPlugin* p) } LILV_API LilvNodes* -lilv_plugin_get_optional_features(const LilvPlugin* p) +lilv_plugin_get_optional_features(const LilvPlugin* plugin) { - lilv_plugin_load_if_necessary(p); - return lilv_world_find_nodes_internal(p->world, - p->plugin_uri->node, - p->world->uris.lv2_optionalFeature, + lilv_plugin_load_if_necessary(plugin); + return lilv_world_find_nodes_internal(plugin->world, + plugin->plugin_uri->node, + plugin->world->uris.lv2_optionalFeature, NULL); } LILV_API LilvNodes* -lilv_plugin_get_required_features(const LilvPlugin* p) +lilv_plugin_get_required_features(const LilvPlugin* plugin) { - lilv_plugin_load_if_necessary(p); - return lilv_world_find_nodes_internal(p->world, - p->plugin_uri->node, - p->world->uris.lv2_requiredFeature, + lilv_plugin_load_if_necessary(plugin); + return lilv_world_find_nodes_internal(plugin->world, + plugin->plugin_uri->node, + plugin->world->uris.lv2_requiredFeature, NULL); } LILV_API bool -lilv_plugin_has_extension_data(const LilvPlugin* p, +lilv_plugin_has_extension_data(const LilvPlugin* plugin, const LilvNode* uri) { if (!lilv_node_is_uri(uri)) { @@ -791,39 +792,39 @@ lilv_plugin_has_extension_data(const LilvPlugin* p, return false; } - lilv_plugin_load_if_necessary(p); + lilv_plugin_load_if_necessary(plugin); return lilv_world_ask_internal( - p->world, - p->plugin_uri->node, - p->world->uris.lv2_extensionData, + plugin->world, + plugin->plugin_uri->node, + plugin->world->uris.lv2_extensionData, uri->node); } LILV_API LilvNodes* -lilv_plugin_get_extension_data(const LilvPlugin* p) +lilv_plugin_get_extension_data(const LilvPlugin* plugin) { - return lilv_plugin_get_value_internal(p, p->world->uris.lv2_extensionData); + return lilv_plugin_get_value_internal(plugin, plugin->world->uris.lv2_extensionData); } LILV_API const LilvPort* -lilv_plugin_get_port_by_index(const LilvPlugin* p, +lilv_plugin_get_port_by_index(const LilvPlugin* plugin, uint32_t index) { - lilv_plugin_load_ports_if_necessary(p); - if (index < p->num_ports) { - return p->ports[index]; + lilv_plugin_load_ports_if_necessary(plugin); + if (index < plugin->num_ports) { + return plugin->ports[index]; } else { return NULL; } } LILV_API const LilvPort* -lilv_plugin_get_port_by_symbol(const LilvPlugin* p, +lilv_plugin_get_port_by_symbol(const LilvPlugin* plugin, const LilvNode* symbol) { - lilv_plugin_load_ports_if_necessary(p); - for (uint32_t i = 0; i < p->num_ports; ++i) { - LilvPort* port = p->ports[i]; + lilv_plugin_load_ports_if_necessary(plugin); + for (uint32_t i = 0; i < plugin->num_ports; ++i) { + LilvPort* port = plugin->ports[i]; if (lilv_node_equals(port->symbol, symbol)) { return port; } @@ -833,19 +834,19 @@ lilv_plugin_get_port_by_symbol(const LilvPlugin* p, } LILV_API LilvNode* -lilv_plugin_get_project(const LilvPlugin* p) +lilv_plugin_get_project(const LilvPlugin* plugin) { - lilv_plugin_load_if_necessary(p); + lilv_plugin_load_if_necessary(plugin); - SordNode* lv2_project = sord_new_uri(p->world->world, + SordNode* lv2_project = sord_new_uri(plugin->world->world, (const uint8_t*)LV2_CORE__project); - SordIter* projects = lilv_world_query_internal(p->world, - p->plugin_uri->node, + SordIter* projects = lilv_world_query_internal(plugin->world, + plugin->plugin_uri->node, lv2_project, NULL); - sord_node_free(p->world->world, lv2_project); + sord_node_free(plugin->world->world, lv2_project); if (sord_iter_end(projects)) { sord_iter_free(projects); @@ -855,34 +856,34 @@ lilv_plugin_get_project(const LilvPlugin* p) const SordNode* project = sord_iter_get_node(projects, SORD_OBJECT); sord_iter_free(projects); - return lilv_node_new_from_node(p->world, project); + return lilv_node_new_from_node(plugin->world, project); } static const SordNode* -lilv_plugin_get_author(const LilvPlugin* p) +lilv_plugin_get_author(const LilvPlugin* plugin) { - lilv_plugin_load_if_necessary(p); + lilv_plugin_load_if_necessary(plugin); SordNode* doap_maintainer = sord_new_uri( - p->world->world, NS_DOAP "maintainer"); + plugin->world->world, NS_DOAP "maintainer"); SordIter* maintainers = lilv_world_query_internal( - p->world, - p->plugin_uri->node, + plugin->world, + plugin->plugin_uri->node, doap_maintainer, NULL); if (sord_iter_end(maintainers)) { sord_iter_free(maintainers); - LilvNode* project = lilv_plugin_get_project(p); + LilvNode* project = lilv_plugin_get_project(plugin); if (!project) { - sord_node_free(p->world->world, doap_maintainer); + sord_node_free(plugin->world->world, doap_maintainer); return NULL; } maintainers = lilv_world_query_internal( - p->world, + plugin->world, project->node, doap_maintainer, NULL); @@ -890,7 +891,7 @@ lilv_plugin_get_author(const LilvPlugin* p) lilv_node_free(project); } - sord_node_free(p->world->world, doap_maintainer); + sord_node_free(plugin->world->world, doap_maintainer); if (sord_iter_end(maintainers)) { sord_iter_free(maintainers); @@ -942,28 +943,28 @@ lilv_plugin_is_replaced(const LilvPlugin* plugin) } LILV_API LilvUIs* -lilv_plugin_get_uis(const LilvPlugin* p) +lilv_plugin_get_uis(const LilvPlugin* plugin) { - lilv_plugin_load_if_necessary(p); + lilv_plugin_load_if_necessary(plugin); - SordNode* ui_ui_node = sord_new_uri(p->world->world, + SordNode* ui_ui_node = sord_new_uri(plugin->world->world, (const uint8_t*)LV2_UI__ui); - SordNode* ui_binary_node = sord_new_uri(p->world->world, + SordNode* ui_binary_node = sord_new_uri(plugin->world->world, (const uint8_t*)LV2_UI__binary); LilvUIs* result = lilv_uis_new(); - SordIter* uis = lilv_world_query_internal(p->world, - p->plugin_uri->node, + SordIter* uis = lilv_world_query_internal(plugin->world, + plugin->plugin_uri->node, ui_ui_node, NULL); FOREACH_MATCH(uis) { const SordNode* ui = sord_iter_get_node(uis, SORD_OBJECT); - LilvNode* type = lilv_plugin_get_unique(p, ui, p->world->uris.rdf_a); - LilvNode* binary = lilv_plugin_get_one(p, ui, p->world->uris.lv2_binary); + LilvNode* type = lilv_plugin_get_unique(plugin, ui, plugin->world->uris.rdf_a); + LilvNode* binary = lilv_plugin_get_one(plugin, ui, plugin->world->uris.lv2_binary); if (!binary) { - binary = lilv_plugin_get_unique(p, ui, ui_binary_node); + binary = lilv_plugin_get_unique(plugin, ui, ui_binary_node); } if (sord_node_get_type(ui) != SORD_URI @@ -976,8 +977,8 @@ lilv_plugin_get_uis(const LilvPlugin* p) } LilvUI* lilv_ui = lilv_ui_new( - p->world, - lilv_node_new_from_node(p->world, ui), + plugin->world, + lilv_node_new_from_node(plugin->world, ui), type, binary); @@ -985,8 +986,8 @@ lilv_plugin_get_uis(const LilvPlugin* p) } sord_iter_free(uis); - sord_node_free(p->world->world, ui_binary_node); - sord_node_free(p->world->world, ui_ui_node); + sord_node_free(plugin->world->world, ui_binary_node); + sord_node_free(plugin->world->world, ui_ui_node); if (lilv_uis_size(result) > 0) { return result; @@ -65,30 +65,30 @@ lilv_port_is_a(const LilvPlugin* plugin, } LILV_API bool -lilv_port_has_property(const LilvPlugin* p, +lilv_port_has_property(const LilvPlugin* plugin, const LilvPort* port, const LilvNode* property) { - return lilv_world_ask_internal(p->world, + return lilv_world_ask_internal(plugin->world, port->node->node, - p->world->uris.lv2_portProperty, + plugin->world->uris.lv2_portProperty, property->node); } LILV_API bool -lilv_port_supports_event(const LilvPlugin* p, +lilv_port_supports_event(const LilvPlugin* plugin, const LilvPort* port, - const LilvNode* event) + const LilvNode* event_type) { const uint8_t* predicates[] = { (const uint8_t*)LV2_EVENT__supportsEvent, (const uint8_t*)LV2_ATOM__supports, NULL }; for (const uint8_t** pred = predicates; *pred; ++pred) { - if (lilv_world_ask_internal(p->world, + if (lilv_world_ask_internal(plugin->world, port->node->node, - sord_new_uri(p->world->world, *pred), - event->node)) { + sord_new_uri(plugin->world->world, *pred), + event_type->node)) { return true; } } @@ -96,11 +96,11 @@ lilv_port_supports_event(const LilvPlugin* p, } static LilvNodes* -lilv_port_get_value_by_node(const LilvPlugin* p, +lilv_port_get_value_by_node(const LilvPlugin* plugin, const LilvPort* port, const SordNode* predicate) { - return lilv_world_find_nodes_internal(p->world, + return lilv_world_find_nodes_internal(plugin->world, port->node->node, predicate, NULL); @@ -114,7 +114,7 @@ lilv_port_get_node(const LilvPlugin* plugin, } LILV_API LilvNodes* -lilv_port_get_value(const LilvPlugin* p, +lilv_port_get_value(const LilvPlugin* plugin, const LilvPort* port, const LilvNode* predicate) { @@ -124,15 +124,15 @@ lilv_port_get_value(const LilvPlugin* p, return NULL; } - return lilv_port_get_value_by_node(p, port, predicate->node); + return lilv_port_get_value_by_node(plugin, port, predicate->node); } LILV_API LilvNode* -lilv_port_get(const LilvPlugin* p, +lilv_port_get(const LilvPlugin* plugin, const LilvPort* port, const LilvNode* predicate) { - LilvNodes* values = lilv_port_get_value(p, port, predicate); + LilvNodes* values = lilv_port_get_value(plugin, port, predicate); LilvNode* value = lilv_node_duplicate( values ? lilv_nodes_get_first(values) : NULL); @@ -142,25 +142,25 @@ lilv_port_get(const LilvPlugin* p, } LILV_API uint32_t -lilv_port_get_index(const LilvPlugin* p, +lilv_port_get_index(const LilvPlugin* plugin, const LilvPort* port) { return port->index; } LILV_API const LilvNode* -lilv_port_get_symbol(const LilvPlugin* p, +lilv_port_get_symbol(const LilvPlugin* plugin, const LilvPort* port) { return port->symbol; } LILV_API LilvNode* -lilv_port_get_name(const LilvPlugin* p, +lilv_port_get_name(const LilvPlugin* plugin, const LilvPort* port) { LilvNodes* results = lilv_port_get_value_by_node( - p, port, p->world->uris.lv2_name); + plugin, port, plugin->world->uris.lv2_name); LilvNode* ret = NULL; if (results) { @@ -173,21 +173,21 @@ lilv_port_get_name(const LilvPlugin* p, if (!ret) { LILV_WARNF("Plugin <%s> port has no (mandatory) doap:name\n", - lilv_node_as_string(lilv_plugin_get_uri(p))); + lilv_node_as_string(lilv_plugin_get_uri(plugin))); } return ret; } LILV_API const LilvNodes* -lilv_port_get_classes(const LilvPlugin* p, +lilv_port_get_classes(const LilvPlugin* plugin, const LilvPort* port) { return port->classes; } LILV_API void -lilv_port_get_range(const LilvPlugin* p, +lilv_port_get_range(const LilvPlugin* plugin, const LilvPort* port, LilvNode** def, LilvNode** min, @@ -195,7 +195,7 @@ lilv_port_get_range(const LilvPlugin* p, { if (def) { LilvNodes* defaults = lilv_port_get_value_by_node( - p, port, p->world->uris.lv2_default); + plugin, port, plugin->world->uris.lv2_default); *def = defaults ? lilv_node_duplicate(lilv_nodes_get_first(defaults)) : NULL; @@ -203,7 +203,7 @@ lilv_port_get_range(const LilvPlugin* p, } if (min) { LilvNodes* minimums = lilv_port_get_value_by_node( - p, port, p->world->uris.lv2_minimum); + plugin, port, plugin->world->uris.lv2_minimum); *min = minimums ? lilv_node_duplicate(lilv_nodes_get_first(minimums)) : NULL; @@ -211,7 +211,7 @@ lilv_port_get_range(const LilvPlugin* p, } if (max) { LilvNodes* maximums = lilv_port_get_value_by_node( - p, port, p->world->uris.lv2_maximum); + plugin, port, plugin->world->uris.lv2_maximum); *max = maximums ? lilv_node_duplicate(lilv_nodes_get_first(maximums)) : NULL; @@ -220,13 +220,13 @@ lilv_port_get_range(const LilvPlugin* p, } LILV_API LilvScalePoints* -lilv_port_get_scale_points(const LilvPlugin* p, +lilv_port_get_scale_points(const LilvPlugin* plugin, const LilvPort* port) { SordIter* points = lilv_world_query_internal( - p->world, + plugin->world, port->node->node, - sord_new_uri(p->world->world, (const uint8_t*)LV2_CORE__scalePoint), + sord_new_uri(plugin->world->world, (const uint8_t*)LV2_CORE__scalePoint), NULL); LilvScalePoints* ret = NULL; @@ -237,13 +237,13 @@ lilv_port_get_scale_points(const LilvPlugin* p, FOREACH_MATCH(points) { const SordNode* point = sord_iter_get_node(points, SORD_OBJECT); - LilvNode* value = lilv_plugin_get_unique(p, + LilvNode* value = lilv_plugin_get_unique(plugin, point, - p->world->uris.rdf_value); + plugin->world->uris.rdf_value); - LilvNode* label = lilv_plugin_get_unique(p, + LilvNode* label = lilv_plugin_get_unique(plugin, point, - p->world->uris.rdfs_label); + plugin->world->uris.rdfs_label); if (value && label) { zix_tree_insert( @@ -257,12 +257,12 @@ lilv_port_get_scale_points(const LilvPlugin* p, } LILV_API LilvNodes* -lilv_port_get_properties(const LilvPlugin* p, +lilv_port_get_properties(const LilvPlugin* plugin, const LilvPort* port) { LilvNode* pred = lilv_node_new_from_node( - p->world, p->world->uris.lv2_portProperty); - LilvNodes* ret = lilv_port_get_value(p, port, pred); + plugin->world, plugin->world->uris.lv2_portProperty); + LilvNodes* ret = lilv_port_get_value(plugin, port, pred); lilv_node_free(pred); return ret; } diff --git a/src/scalepoint.c b/src/scalepoint.c index 55c2315..349b2b3 100644 --- a/src/scalepoint.c +++ b/src/scalepoint.c @@ -37,13 +37,13 @@ lilv_scale_point_free(LilvScalePoint* point) } LILV_API const LilvNode* -lilv_scale_point_get_value(const LilvScalePoint* p) +lilv_scale_point_get_value(const LilvScalePoint* point) { - return p->value; + return point->value; } LILV_API const LilvNode* -lilv_scale_point_get_label(const LilvScalePoint* p) +lilv_scale_point_get_label(const LilvScalePoint* point) { - return p->label; + return point->label; } @@ -93,9 +93,9 @@ lilv_ui_get_classes(const LilvUI* ui) } LILV_API bool -lilv_ui_is_a(const LilvUI* ui, const LilvNode* ui_class_uri) +lilv_ui_is_a(const LilvUI* ui, const LilvNode* class_uri) { - return lilv_nodes_contains(ui->classes, ui_class_uri); + return lilv_nodes_contains(ui->classes, class_uri); } LILV_API const LilvNode* diff --git a/src/world.c b/src/world.c index b755724..1858569 100644 --- a/src/world.c +++ b/src/world.c @@ -168,21 +168,21 @@ lilv_world_free(LilvWorld* world) LILV_API void lilv_world_set_option(LilvWorld* world, - const char* option, + const char* uri, const LilvNode* value) { - if (!strcmp(option, LILV_OPTION_DYN_MANIFEST)) { + if (!strcmp(uri, LILV_OPTION_DYN_MANIFEST)) { if (lilv_node_is_bool(value)) { world->opt.dyn_manifest = lilv_node_as_bool(value); return; } - } else if (!strcmp(option, LILV_OPTION_FILTER_LANG)) { + } else if (!strcmp(uri, LILV_OPTION_FILTER_LANG)) { if (lilv_node_is_bool(value)) { world->opt.filter_language = lilv_node_as_bool(value); return; } } - LILV_WARNF("Unrecognized or invalid option `%s'\n", option); + LILV_WARNF("Unrecognized or invalid option `%s'\n", uri); } LILV_API LilvNodes* |