summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/java/com/sun/gluegen/ConstantDefinition.java8
-rw-r--r--src/java/com/sun/gluegen/JavaEmitter.java10
-rw-r--r--test/junit/com/sun/gluegen/BasicTest.java22
-rw-r--r--test/junit/com/sun/gluegen/test.h3
4 files changed, 30 insertions, 13 deletions
diff --git a/src/java/com/sun/gluegen/ConstantDefinition.java b/src/java/com/sun/gluegen/ConstantDefinition.java
index e4cb3f5..eee5781 100644
--- a/src/java/com/sun/gluegen/ConstantDefinition.java
+++ b/src/java/com/sun/gluegen/ConstantDefinition.java
@@ -121,4 +121,12 @@ public class ConstantDefinition {
}
aliases.add(alias);
}
+
+ @Override
+ public String toString() {
+ return "ConstantDefinition [name " + name + " origName " + origName + " value " + value
+ + " aliasedNames " + aliasedNames + " aliases " + aliases
+ + " enumName " + enumName + " isEnum " + isEnum + "]";
+ }
+
}
diff --git a/src/java/com/sun/gluegen/JavaEmitter.java b/src/java/com/sun/gluegen/JavaEmitter.java
index f6660d2..df98839 100644
--- a/src/java/com/sun/gluegen/JavaEmitter.java
+++ b/src/java/com/sun/gluegen/JavaEmitter.java
@@ -357,10 +357,12 @@ public class JavaEmitter implements GlueEmitter {
javaWriter().println(" /** " + optionalComment + " */");
}
String suffix = "";
- if (type.equals("float") && !value.endsWith("f")) {
- suffix = "f";
- }else if(value.endsWith("u") || value.endsWith("U")) {
- value = value.substring(0, value.length()-1);
+ if(!value.endsWith(")")) {
+ if (type.equals("float") && !value.endsWith("f")) {
+ suffix = "f";
+ }else if(value.endsWith("u") || value.endsWith("U")) {
+ value = value.substring(0, value.length()-1);
+ }
}
javaWriter().println(" public static final " + type + " " + name + " = " + value + suffix + ";");
diff --git a/test/junit/com/sun/gluegen/BasicTest.java b/test/junit/com/sun/gluegen/BasicTest.java
index dc6efb9..a43d3e5 100644
--- a/test/junit/com/sun/gluegen/BasicTest.java
+++ b/test/junit/com/sun/gluegen/BasicTest.java
@@ -2,12 +2,13 @@ package com.sun.gluegen;
import com.sun.gluegen.runtime.BufferFactory;
import com.sun.gluegen.runtime.PointerBuffer;
-import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import org.junit.AfterClass;
import org.junit.Test;
+import static org.junit.Assert.*;
import static java.lang.System.*;
import static com.sun.gluegen.BuildUtil.*;
@@ -40,14 +41,19 @@ public class BasicTest {
compileNatives();
}
-// @Test
- public void bindingTest() throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, ClassNotFoundException, InstantiationException {
+ @Test
+ public void bindingTest() throws Exception {
String nativesPath = gluegenRoot + "/build/test/build/natives";
System.load(nativesPath + "/librofl.so");
- Object bindingTest = Class.forName("test.BindingTest").newInstance();
+ Class<?> clazz = Class.forName("test.BindingTest");
+
+ assertEquals((long)0xFFFFFFFF, clazz.getDeclaredField("GL_INVALID_INDEX").get(null));
+ assertEquals(-0.5f, clazz.getDeclaredField("AL_FLANGER_DEFAULT_FEEDBACK").get(null));
+ // TODO fix Exception: ...Caused by: java.lang.UnsatisfiedLinkError: test.BindingTest.arrayTest0(JLjava/lang/Object;I)I
+ /*
// test values
ByteBuffer dbb = BufferFactory.newDirectByteBuffer(32);
ByteBuffer bb = ByteBuffer.allocate(32).order(ByteOrder.nativeOrder());
@@ -59,8 +65,10 @@ public class BasicTest {
int offset = 0;
long id = 42;
+
// invoke everything public
- Method[] methods = bindingTest.getClass().getDeclaredMethods();
+ Object bindingTest = clazz.newInstance();
+ Method[] methods = clazz.getDeclaredMethods();
for (Method method : methods) {
@@ -91,13 +99,11 @@ public class BasicTest {
out.print(param+", ");
out.println();
- // TODO fix Exception: ...Caused by: java.lang.UnsatisfiedLinkError: test.BindingTest.arrayTest0(JLjava/lang/Object;I)I
-
Object result = method.invoke(bindingTest, paramInstances);
out.println("result: "+result);
out.println("success");
}
-
+ */
}
@AfterClass
diff --git a/test/junit/com/sun/gluegen/test.h b/test/junit/com/sun/gluegen/test.h
index acac88e..10399a6 100644
--- a/test/junit/com/sun/gluegen/test.h
+++ b/test/junit/com/sun/gluegen/test.h
@@ -1,4 +1,5 @@
-#define GL_INVALID_INDEX 0xFFFFFFFFu
+#define GL_INVALID_INDEX 0xFFFFFFFFu
+#define AL_FLANGER_DEFAULT_FEEDBACK (-0.5f)
typedef unsigned long foo;