diff options
author | Jamie Bullock <jamie@postlude.co.uk> | 2007-09-05 14:32:17 +0000 |
---|---|---|
committer | Jamie Bullock <jamie@postlude.co.uk> | 2007-09-05 14:32:17 +0000 |
commit | 801d1fff596e07a747b1558d85eaab9bcf01f982 (patch) | |
tree | 8dcde81047f79a92223243c17d0ed101d30cc7b5 /swig/python | |
parent | 280bf6f6ba2c6ad6d4f470573ca23d72541813c1 (diff) | |
download | LibXtract-801d1fff596e07a747b1558d85eaab9bcf01f982.tar.gz LibXtract-801d1fff596e07a747b1558d85eaab9bcf01f982.tar.bz2 LibXtract-801d1fff596e07a747b1558d85eaab9bcf01f982.zip |
Added java bindings. Everything seems to work OK, except test.java won't compile. Some kind of path error, but I can't work out how to fix it.
Diffstat (limited to 'swig/python')
-rw-r--r-- | swig/python/Makefile.am | 18 | ||||
-rw-r--r-- | swig/python/test.py | 15 | ||||
-rw-r--r-- | swig/python/xtract.i | 12 |
3 files changed, 45 insertions, 0 deletions
diff --git a/swig/python/Makefile.am b/swig/python/Makefile.am new file mode 100644 index 0000000..e9b6747 --- /dev/null +++ b/swig/python/Makefile.am @@ -0,0 +1,18 @@ +MAINTAINERCLEANFILES = xtract.py xtract_wrap.c Makefile.in _xtract.so + +BUILT_SOURCES = $(srcdir)/xtract_wrap.c +SWIG_SOURCES = ../xtract.i + +pkgpython_PYTHON = xtract.py +pkgpyexec_LTLIBRARIES = _xtract.la +_xtract_la_SOURCES = $(srcdir)/xtract_wrap.c $(SWIG_SOURCES) +_xtract_la_CFLAGS = $(SWIG_PYTHON_CPPFLAGS) -I$(top_srcdir)/src +_xtract_la_LDFLAGS = -module -lxtract +_xtract_la_LIBADD = $(top_srcdir)/src/libxtract.la + +xtract_wrap.c : $(SWIG_SOURCES) + $(SWIG) $(SWIG_PYTHON_OPT) -I$(top_srcdir) -o $@ $< + +clean-local: + -rm -f _xtract.so xtract.py xtract_wrap.c xtract.pyc + diff --git a/swig/python/test.py b/swig/python/test.py new file mode 100644 index 0000000..f491a39 --- /dev/null +++ b/swig/python/test.py @@ -0,0 +1,15 @@ +#!/usr/bin/python + +import xtract + +len = 5 + +a = xtract.floatArray(len) + +for i in range(0, len): + a[i] = 2 * i + +retval,result = xtract.xtract_mean(a,len,None) + +print result + diff --git a/swig/python/xtract.i b/swig/python/xtract.i new file mode 100644 index 0000000..b363f2e --- /dev/null +++ b/swig/python/xtract.i @@ -0,0 +1,12 @@ +%module xtract +%include carrays.i +%include typemaps.i + +%{ +#include "xtract/xtract_scalar.h" +%} + +%array_functions(float, floatArray); +%apply float *OUTPUT { float *result }; + +%include "xtract/xtract_scalar.h" |