diff options
author | Jamie Bullock <jamie@jamiebullock.com> | 2014-11-07 23:58:26 +0000 |
---|---|---|
committer | Jamie Bullock <jamie@jamiebullock.com> | 2014-11-07 23:58:26 +0000 |
commit | 56d30a86198b3d063b11d7d465a356a4ffbb03a0 (patch) | |
tree | 21cc6fa4da40e469760a7905b22a0a0305773bde | |
parent | 254bc42e4b1093419754da4a82281653025f52b4 (diff) | |
download | LibXtract-56d30a86198b3d063b11d7d465a356a4ffbb03a0.tar.gz LibXtract-56d30a86198b3d063b11d7d465a356a4ffbb03a0.tar.bz2 LibXtract-56d30a86198b3d063b11d7d465a356a4ffbb03a0.zip |
Remove Java bindings
-rw-r--r-- | swig/java/jxtract.i | 73 | ||||
-rw-r--r-- | swig/java/test.java | 36 |
2 files changed, 0 insertions, 109 deletions
diff --git a/swig/java/jxtract.i b/swig/java/jxtract.i deleted file mode 100644 index 5c8c1db..0000000 --- a/swig/java/jxtract.i +++ /dev/null @@ -1,73 +0,0 @@ - -%include "../xtract.i" -%include "arrays_java.i" - -%apply double[] {const double *data}; -%apply double *OUTPUT { double *result }; -%typemap(in,numinputs=0) JNIEnv *env "$1 = jenv;" - -%javamethodmodifiers arr2voidd "private"; -%javamethodmodifiers arr2voidi "private"; -%javamethodmodifiers freearrd "private"; -%javamethodmodifiers freearri "private"; - -%inline %{ -jlong arr2voidd(JNIEnv *env, jdoubleArray arr) { - void *ptr = (*env)->GetFloatArrayElements(env, arr, NULL); - return (intptr_t)ptr; -} - -void freearrd(JNIEnv *env, jdoubleArray arr, jlong map) { - void *ptr = 0; - ptr = *(void **)↦ - (*env)->ReleaseFloatArrayElements(env, arr, ptr, JNI_ABORT); -} - -jlong arr2voidi(JNIEnv *env, jintArray arr) { - void *ptr = (*env)->GetIntArrayElements(env, arr, NULL); - return (intptr_t)ptr; -} - -void freearri(JNIEnv *env, jintArray arr, jlong map) { - void *ptr = 0; - ptr = *(void **)↦ - (*env)->ReleaseIntArrayElements(env, arr, ptr, JNI_ABORT); -} -%} - - -%pragma(java) modulecode=%{ - private static long arrPtr(Object o) { - if (o instanceof double[]) { - return arr2voidd((double[])o); - } - else if (o instanceof int[]) { - return arr2voidi((int[])o); - } - else if (o == null) { - return 0L; - } - throw new IllegalArgumentException(); - } - - private static void freeArrPtr(Object o, long addr) { - if (o instanceof double[]) { - freearrd((double[])o, addr); - return; - } - else if (o instanceof int[]) { - freearri((int[])o, addr); - return; - } - else if (o == null) { - return; - } - throw new IllegalArgumentException(); - } -%} - -%typemap(jstype) void *argv "Object" -%typemap(javain,pre=" long tmp$javainput = arrPtr($javainput);",post=" freeArrPtr($javainput, tmp$javainput);") void *argv "tmp$javainput" - -%include xtract_redeclare.i - diff --git a/swig/java/test.java b/swig/java/test.java deleted file mode 100644 index 82dd768..0000000 --- a/swig/java/test.java +++ /dev/null @@ -1,36 +0,0 @@ - -import xtract.core.*; -import java.util.Arrays; - -public class test { - public static void main(String argv[]) { - - try { - System.loadLibrary("jxtract"); - } - catch (UnsatisfiedLinkError e) { - System.out.println("Failed to load the library \"jxtract\""); - System.out.println(e.toString()); - System.exit(0); - } - - System.out.println("\nRunning libxtract Java bindings test...\n"); - - int len = 5; - int retval = 0; - double mean[] = new double[1]; - double variance[] = new double[1]; - double data[] = new double[len]; - - for (int i = 0; i < len; i++){ - System.out.print(i * 3 + ", "); - data[i] = i * 3; - } - - retval = xtract.xtract_mean(data, len, null, mean); - retval = xtract.xtract_variance(data, len, mean, variance); - - System.out.print("The mean of: " + Arrays.toString(data) + " is " - + mean[0] + "\nThe variance is: " + variance[0] + "\n"); - } -} |