diff options
-rw-r--r-- | src/world.c | 4 | ||||
-rw-r--r-- | swig/Makefile.am | 4 | ||||
-rw-r--r-- | swig/lv2_list.scm | 13 | ||||
-rw-r--r-- | swig/slv2.i | 5 | ||||
-rw-r--r-- | swig/slv2.setup | 2 | ||||
-rw-r--r-- | utils/ladspa2lv2.c | 6 |
6 files changed, 27 insertions, 7 deletions
diff --git a/src/world.c b/src/world.c index 18eec53..9356579 100644 --- a/src/world.c +++ b/src/world.c @@ -43,6 +43,8 @@ slv2_world_new() librdf_world_open(world->world); + // Testing shows hashes to be faster here + //world->storage = librdf_new_storage(world->world, "memory", NULL, NULL); world->storage = librdf_new_storage(world->world, "hashes", NULL, "hash-type='memory'"); if (!world->storage) @@ -97,6 +99,8 @@ slv2_world_new_using_rdf_world(librdf_world* rdf_world) world->local_world = false; + // Testing shows hashes to be faster here + //world->storage = librdf_new_storage(world->world, "memory", NULL, NULL); world->storage = librdf_new_storage(world->world, "hashes", NULL, "hash-type='memory'"); if (!world->storage) diff --git a/swig/Makefile.am b/swig/Makefile.am index 9ac6d84..f98f84e 100644 --- a/swig/Makefile.am +++ b/swig/Makefile.am @@ -19,16 +19,16 @@ if WITH_MZSCHEME mzscheme: swig -DMZSCHEME -Wall -mzscheme -I.. -o slv2_mzscheme.c -oh slv2_mzscheme.h slv2.i gcc -fPIC -shared -Iplt \ - -I/usr/include/plt slv2_mzscheme.c ../src/.libs/libslv2.so -o libslv2_mzscheme.so + -I/usr/include/plt slv2_mzscheme.c -o libslv2_mzscheme.so endif # WITH_MZSCHEME if WITH_CHICKEN chicken: + rm -f slv2.scm slv2_wrap.c rm -rf eggs mkdir -p eggs swig -DCHICKEN -Wall -chicken -proxy -nounit -I.. -o slv2_wrap.c -oh slv2_wrap.h slv2.i tar -czf eggs/slv2.egg slv2.setup slv2.scm slv2_wrap.c - rm -f slv2.scm slv2_wrap.c endif # WITH_CHICKEN endif # WITH_SWIG diff --git a/swig/lv2_list.scm b/swig/lv2_list.scm new file mode 100644 index 0000000..cc23e0d --- /dev/null +++ b/swig/lv2_list.scm @@ -0,0 +1,13 @@ +; Least idiomatic scheme bindings ever. Work in progress... + +(require-extension slv2) + +(define world (slv2-world-new)) +(slv2-world-load-all world) + +(define plugins (slv2-world-get-all-plugins world)) + +(let ((p (slv2-plugins-get-at plugins 0))) + (display (slv2-value-as-string (slv2-plugin-get-uri p))) + (newline)) + diff --git a/swig/slv2.i b/swig/slv2.i index 210da6e..5bc9a5d 100644 --- a/swig/slv2.i +++ b/swig/slv2.i @@ -67,8 +67,8 @@ typedef struct { SLV2World world; SLV2Plugins me; } Plugins; } inline unsigned size() const { return slv2_plugins_size($self->me); } - inline unsigned __len__() const { return slv2_plugins_size($self->me); } +#ifdef PYTHON Plugin* __getitem__(unsigned i) { if (i < slv2_plugins_size($self->me)) return new_Plugin(slv2_plugins_get_at($self->me, i)); @@ -76,7 +76,8 @@ typedef struct { SLV2World world; SLV2Plugins me; } Plugins; return NULL; } -#ifdef PYTHON + inline unsigned __len__() const { return slv2_plugins_size($self->me); } + %pythoncode %{ def __iter__(self): class Iterator(object): diff --git a/swig/slv2.setup b/swig/slv2.setup index 4a8fbb4..ef15f6d 100644 --- a/swig/slv2.setup +++ b/swig/slv2.setup @@ -1,2 +1,2 @@ -(run (csc -s -o slv2.so slv2.scm slv2_wrap.c)) +(run (csc -s -o slv2.so slv2.scm slv2_wrap.c -lslv2)) (install-extension 'slv2 '("slv2.so")) diff --git a/utils/ladspa2lv2.c b/utils/ladspa2lv2.c index 576f66d..023c40d 100644 --- a/utils/ladspa2lv2.c +++ b/utils/ladspa2lv2.c @@ -256,8 +256,10 @@ add_port_range(LADSPA_Descriptor* plugin, void write_lv2_turtle(LADSPA_Descriptor* descriptor, const char* plugin_uri, const char* filename) { - librdf_storage* storage = librdf_new_storage(world, - "hashes", NULL, "hash-type='memory'"); + //librdf_storage* storage = librdf_new_storage(world, + // "hashes", NULL, "hash-type='memory'"); + librdf_storage* storage = librdf_new_storage(world, "memory", NULL, NULL); + librdf_model* model = librdf_new_model(world, storage, NULL); librdf_serializer* serializer = librdf_new_serializer(world, "turtle", NULL, NULL); |