summaryrefslogtreecommitdiffstats
path: root/swig
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-02-17 01:42:50 +0000
committerDavid Robillard <d@drobilla.net>2008-02-17 01:42:50 +0000
commit8528011e19f061258f1723645d7202305b529f0e (patch)
tree6cd67c50642e64f6aac453dd39706d1210f53327 /swig
parent454fa2352be82f42f7131924dafa50e7fcf7d219 (diff)
downloadlilv-8528011e19f061258f1723645d7202305b529f0e.tar.gz
lilv-8528011e19f061258f1723645d7202305b529f0e.tar.bz2
lilv-8528011e19f061258f1723645d7202305b529f0e.zip
Update Swig/Python bindings.
git-svn-id: http://svn.drobilla.net/lad/slv2@1145 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'swig')
-rw-r--r--swig/Makefile.am10
-rw-r--r--swig/slv2.i22
2 files changed, 26 insertions, 6 deletions
diff --git a/swig/Makefile.am b/swig/Makefile.am
index 17a9e68..b6c5564 100644
--- a/swig/Makefile.am
+++ b/swig/Makefile.am
@@ -1,10 +1,16 @@
EXTRA_DIST = slv2.i lv2_list.py
if WITH_SWIG
+
+if WITH_PYTHON
all:
swig -Wall -python slv2.i
- gcc -fPIC -shared -I/usr/include/python2.4 slv2_wrap.c ../src/.libs/libslv2.so -o _slv2.so
-endif
+ gcc -fPIC -shared $(PYTHON_CPPFLAGS) $(PYTHON_EXTRA_LDFLAGS) \
+ $(PYTHON_EXTRA_LIBS) $(PYTHON_EXTRA_LDFLAGS) \
+ -I/usr/include/python2.4 slv2_wrap.c ../src/.libs/libslv2.so -o _slv2.so
+endif # WITH_PYTHON
+
+endif # WITH_SWIG
clean-local:
rm -f *.cxx
diff --git a/swig/slv2.i b/swig/slv2.i
index 5020767..593411e 100644
--- a/swig/slv2.i
+++ b/swig/slv2.i
@@ -41,8 +41,15 @@ typedef struct { SLV2Plugin me; } Plugin;
free($self);
}
- char* name() { return slv2_plugin_get_name($self->me); }
- const char* uri() { return slv2_plugin_get_uri($self->me); }
+ char* name() {
+ SLV2Value nm = slv2_plugin_get_name($self->me);
+ char* ret = nm ? strdup((char*)slv2_value_as_string(nm)) : strdup("");
+ slv2_value_free(nm);
+ return ret;
+ }
+ const char* uri() {
+ return strdup((char*)slv2_value_as_string(slv2_plugin_get_uri($self->me)));
+ }
};
typedef struct { SLV2World world; SLV2Plugins me; } Plugins;
@@ -101,8 +108,15 @@ typedef struct { SLV2World me; } World;
}
void load_all() { slv2_world_load_all($self->me); }
- void load_bundle(const char* path) { slv2_world_load_bundle($self->me, path); }
- Plugins* get_all_plugins() { return new_Plugins($self->me, slv2_world_get_all_plugins($self->me)); }
+ void load_bundle(const char* uri) {
+ SLV2Value bundle_uri = slv2_value_new_uri($self->me, (const unsigned char*)uri);
+ slv2_world_load_bundle($self->me, bundle_uri);
+ slv2_value_free(bundle_uri);
+ }
+
+ Plugins* get_all_plugins() {
+ return new_Plugins($self->me, slv2_world_get_all_plugins($self->me));
+ }
};