diff options
author | David Robillard <d@drobilla.net> | 2018-05-26 15:29:48 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2021-03-24 11:04:04 -0400 |
commit | 247affdf0f48edcae95188e96ddad0f80ee09617 (patch) | |
tree | 0a3c9aaa5a16a4b8b41cf675734c7f3ef36107b7 /src/lilv_internal.h | |
parent | 18ce03173dc8663b3f88c7010693641bad42eac4 (diff) | |
download | lilv-247affdf0f48edcae95188e96ddad0f80ee09617.tar.gz lilv-247affdf0f48edcae95188e96ddad0f80ee09617.tar.bz2 lilv-247affdf0f48edcae95188e96ddad0f80ee09617.zip |
WIP: Port to serd1
Diffstat (limited to 'src/lilv_internal.h')
-rw-r--r-- | src/lilv_internal.h | 197 |
1 files changed, 93 insertions, 104 deletions
diff --git a/src/lilv_internal.h b/src/lilv_internal.h index 12b56de..89ba122 100644 --- a/src/lilv_internal.h +++ b/src/lilv_internal.h @@ -26,7 +26,6 @@ extern "C" { #include "lilv/lilv.h" #include "lv2/core/lv2.h" #include "serd/serd.h" -#include "sord/sord.h" #include "zix/tree.h" #include <stdbool.h> @@ -64,6 +63,24 @@ dlerror(void) # include "lv2/dynmanifest/dynmanifest.h" #endif +#define LILV_READER_STACK_SIZE 65536 + +#ifndef PAGE_SIZE +# define PAGE_SIZE 4096 +#endif + +#define FOREACH_MATCH(statement_name_, range) \ + for (const SerdStatement* statement_name_ = NULL; \ + !serd_range_empty(range) && \ + (statement_name_ = serd_range_front(range)); \ + serd_range_next(range)) + +#define FOREACH_PAT(name_, model_, s_, p_, o_, g_) \ + for (SerdRange* r_ = serd_model_range(model_, s_, p_, o_, g_); \ + !serd_range_empty(r_) || (serd_range_free(r_), false); \ + serd_range_next(r_)) \ + for (const SerdStatement* name_ = serd_range_front(r_); name_; name_ = NULL) + /* * * Types @@ -80,8 +97,8 @@ struct LilvPortImpl { }; typedef struct LilvSpecImpl { - SordNode* spec; - SordNode* bundle; + SerdNode* spec; + SerdNode* bundle; LilvNodes* data_uris; struct LilvSpecImpl* next; } LilvSpec; @@ -151,8 +168,8 @@ typedef struct { } LilvOptions; struct LilvWorldImpl { - SordWorld* world; - SordModel* model; + SerdWorld* world; + SerdModel* model; SerdReader* reader; unsigned n_read_files; LilvPluginClass* lv2_plugin_class; @@ -163,44 +180,48 @@ struct LilvWorldImpl { LilvNodes* loaded_files; ZixTree* libs; struct { - SordNode* dc_replaces; - SordNode* dman_DynManifest; - SordNode* doap_name; - SordNode* lv2_Plugin; - SordNode* lv2_Specification; - SordNode* lv2_appliesTo; - SordNode* lv2_binary; - SordNode* lv2_default; - SordNode* lv2_designation; - SordNode* lv2_extensionData; - SordNode* lv2_index; - SordNode* lv2_latency; - SordNode* lv2_maximum; - SordNode* lv2_microVersion; - SordNode* lv2_minimum; - SordNode* lv2_minorVersion; - SordNode* lv2_name; - SordNode* lv2_optionalFeature; - SordNode* lv2_port; - SordNode* lv2_portProperty; - SordNode* lv2_reportsLatency; - SordNode* lv2_requiredFeature; - SordNode* lv2_symbol; - SordNode* lv2_prototype; - SordNode* owl_Ontology; - SordNode* pset_value; - SordNode* rdf_a; - SordNode* rdf_value; - SordNode* rdfs_Class; - SordNode* rdfs_label; - SordNode* rdfs_seeAlso; - SordNode* rdfs_subClassOf; - SordNode* xsd_base64Binary; - SordNode* xsd_boolean; - SordNode* xsd_decimal; - SordNode* xsd_double; - SordNode* xsd_integer; - SordNode* null_uri; + SerdNode* dc_replaces; + SerdNode* dman_DynManifest; + SerdNode* doap_name; + SerdNode* lv2_Plugin; + SerdNode* lv2_Specification; + SerdNode* lv2_appliesTo; + SerdNode* lv2_binary; + SerdNode* lv2_default; + SerdNode* lv2_designation; + SerdNode* lv2_extensionData; + SerdNode* lv2_index; + SerdNode* lv2_latency; + SerdNode* lv2_maximum; + SerdNode* lv2_microVersion; + SerdNode* lv2_minimum; + SerdNode* lv2_minorVersion; + SerdNode* lv2_name; + SerdNode* lv2_optionalFeature; + SerdNode* lv2_port; + SerdNode* lv2_portProperty; + SerdNode* lv2_reportsLatency; + SerdNode* lv2_requiredFeature; + SerdNode* lv2_symbol; + SerdNode* lv2_project; + SerdNode* lv2_prototype; + SerdNode* owl_Ontology; + SerdNode* pset_Preset; + SerdNode* pset_value; + SerdNode* rdf_a; + SerdNode* rdf_value; + SerdNode* rdfs_Class; + SerdNode* rdfs_label; + SerdNode* rdfs_seeAlso; + SerdNode* rdfs_subClassOf; + SerdNode* state_state; + SerdNode* xsd_base64Binary; + SerdNode* xsd_boolean; + SerdNode* xsd_decimal; + SerdNode* xsd_double; + SerdNode* xsd_int; + SerdNode* xsd_integer; + SerdNode* null_uri; } uris; LilvOptions opt; }; @@ -215,17 +236,6 @@ typedef enum { LILV_VALUE_BLOB } LilvNodeType; -struct LilvNodeImpl { - LilvWorld* world; - SordNode* node; - LilvNodeType type; - union { - int int_val; - float float_val; - bool bool_val; - } val; -}; - struct LilvScalePointImpl { LilvNode* value; LilvNode* label; @@ -251,46 +261,39 @@ typedef struct LilvVersion { */ LilvPort* -lilv_port_new(LilvWorld* world, - const SordNode* node, - uint32_t index, - const char* symbol); +lilv_port_new(const SerdNode* node, uint32_t index, const char* symbol); void lilv_port_free(const LilvPlugin* plugin, LilvPort* port); LilvPlugin* -lilv_plugin_new(LilvWorld* world, LilvNode* uri, LilvNode* bundle_uri); +lilv_plugin_new(LilvWorld* world, + const LilvNode* uri, + const LilvNode* bundle_uri); void -lilv_plugin_clear(LilvPlugin* plugin, LilvNode* bundle_uri); - +lilv_plugin_clear(LilvPlugin* plugin, const LilvNode* bundle_uri); void lilv_plugin_load_if_necessary(const LilvPlugin* plugin); - void lilv_plugin_free(LilvPlugin* plugin); - LilvNode* lilv_plugin_get_unique(const LilvPlugin* plugin, - const SordNode* subject, - const SordNode* predicate); + const SerdNode* subject, + const SerdNode* predicate); void lilv_collection_free(LilvCollection* collection); - unsigned lilv_collection_size(const LilvCollection* collection); - LilvIter* lilv_collection_begin(const LilvCollection* collection); - void* lilv_collection_get(const LilvCollection* collection, const LilvIter* i); LilvPluginClass* lilv_plugin_class_new(LilvWorld* world, - const SordNode* parent_node, - const SordNode* uri, + const SerdNode* parent_node, + const SerdNode* uri, const char* label); void @@ -324,16 +327,24 @@ LilvUIs* lilv_uis_new(void); LilvNode* +lilv_world_get_manifest_node(LilvWorld* world, const LilvNode* bundle_uri); + +char* +lilv_world_get_manifest_path(LilvWorld* world, const LilvNode* bundle_uri); + +LilvNode* lilv_world_get_manifest_uri(LilvWorld* world, const LilvNode* bundle_uri); -const uint8_t* +const char* lilv_world_blank_node_prefix(LilvWorld* world); SerdStatus lilv_world_load_file(LilvWorld* world, SerdReader* reader, const LilvNode* uri); SerdStatus -lilv_world_load_graph(LilvWorld* world, SordNode* graph, const LilvNode* uri); +lilv_world_load_graph(LilvWorld* world, + const SerdNode* graph, + const LilvNode* uri); LilvUI* lilv_ui_new(LilvWorld* world, @@ -344,12 +355,6 @@ lilv_ui_new(LilvWorld* world, void lilv_ui_free(LilvUI* ui); -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, const void* user_data); @@ -385,38 +390,22 @@ lilv_scale_point_new(LilvNode* value, LilvNode* label); void lilv_scale_point_free(LilvScalePoint* point); -SordIter* -lilv_world_query_internal(LilvWorld* world, - const SordNode* subject, - const SordNode* predicate, - const SordNode* object); - -bool -lilv_world_ask_internal(LilvWorld* world, - const SordNode* subject, - const SordNode* predicate, - const SordNode* object); - LilvNodes* lilv_world_find_nodes_internal(LilvWorld* world, - const SordNode* subject, - const SordNode* predicate, - const SordNode* object); + const SerdNode* subject, + const SerdNode* predicate, + const SerdNode* object); -SordModel* +SerdModel* lilv_world_filter_model(LilvWorld* world, - SordModel* model, - const SordNode* subject, - const SordNode* predicate, - const SordNode* object, - const SordNode* graph); - -#define FOREACH_MATCH(iter) for (; !sord_iter_end(iter); sord_iter_next(iter)) + SerdModel* model, + const SerdNode* subject, + const SerdNode* predicate, + const SerdNode* object, + const SerdNode* graph); LilvNodes* -lilv_nodes_from_stream_objects(LilvWorld* world, - SordIter* stream, - SordQuadIndex field); +lilv_nodes_from_range(LilvWorld* world, SerdRange* range, SerdField field); char* lilv_strjoin(const char* first, ...); |