summaryrefslogtreecommitdiffstats
path: root/src/java/com/jogamp/gluegen
diff options
context:
space:
mode:
authorMichael Bien <[email protected]>2011-04-26 22:20:46 +0200
committerSven Gothel <[email protected]>2011-04-26 22:20:46 +0200
commita07892f07f15c96ca248fc12133748be7058241f (patch)
treecf5747dd3df05ffcc75cda349d8fa38fc4b5958c /src/java/com/jogamp/gluegen
parent245bd152c3f328e5df69d60da975697431fa923b (diff)
refactoring in common.nio public api - removed Int64Buffer
- removed Int64Buffer since it is no longer needed for LongBuffer emulation Signed-off-by: Sven Gothel <[email protected]>
Diffstat (limited to 'src/java/com/jogamp/gluegen')
-rw-r--r--src/java/com/jogamp/gluegen/JavaEmitter.java4
-rw-r--r--src/java/com/jogamp/gluegen/JavaMethodBindingEmitter.java26
-rw-r--r--src/java/com/jogamp/gluegen/JavaType.java16
3 files changed, 18 insertions, 28 deletions
diff --git a/src/java/com/jogamp/gluegen/JavaEmitter.java b/src/java/com/jogamp/gluegen/JavaEmitter.java
index 250da79..745176a 100644
--- a/src/java/com/jogamp/gluegen/JavaEmitter.java
+++ b/src/java/com/jogamp/gluegen/JavaEmitter.java
@@ -1844,7 +1844,7 @@ public class JavaEmitter implements GlueEmitter {
if (convertToArrays) {
result = result.replaceJavaArgumentType(i, javaType(ArrayTypes.longArrayClass));
} else {
- result = result.replaceJavaArgumentType(i, JavaType.forNIOInt64BufferClass());
+ result = result.replaceJavaArgumentType(i, JavaType.forNIOLongBufferClass());
}
} else if (t.isCFloatPointerType()) {
arrayPossible = true;
@@ -1880,7 +1880,7 @@ public class JavaEmitter implements GlueEmitter {
} else if (t.isCInt32PointerType()) {
result = result.replaceJavaArgumentType(-1, JavaType.forNIOIntBufferClass());
} else if (t.isCInt64PointerType()) {
- result = result.replaceJavaArgumentType(-1, JavaType.forNIOInt64BufferClass());
+ result = result.replaceJavaArgumentType(-1, JavaType.forNIOLongBufferClass());
} else if (t.isCFloatPointerType()) {
result = result.replaceJavaArgumentType(-1, JavaType.forNIOFloatBufferClass());
} else if (t.isCDoublePointerType()) {
diff --git a/src/java/com/jogamp/gluegen/JavaMethodBindingEmitter.java b/src/java/com/jogamp/gluegen/JavaMethodBindingEmitter.java
index 3bf3dc1..ce1acc2 100644
--- a/src/java/com/jogamp/gluegen/JavaMethodBindingEmitter.java
+++ b/src/java/com/jogamp/gluegen/JavaMethodBindingEmitter.java
@@ -39,12 +39,15 @@
package com.jogamp.gluegen;
-import java.io.*;
-import java.util.*;
+import com.jogamp.gluegen.cgram.HeaderParser;
+import com.jogamp.gluegen.cgram.types.ArrayType;
+import com.jogamp.gluegen.cgram.types.CompoundType;
+import com.jogamp.gluegen.cgram.types.EnumType;
+import com.jogamp.gluegen.cgram.types.PointerType;
+import com.jogamp.gluegen.cgram.types.Type;
+import java.io.PrintWriter;
import java.text.MessageFormat;
-
-import com.jogamp.gluegen.cgram.types.*;
-import com.jogamp.gluegen.cgram.*;
+import java.util.List;
/**
* An emitter that emits only the interface for a Java<->C JNI binding.
@@ -592,7 +595,7 @@ public class JavaMethodBindingEmitter extends FunctionEmitter {
}
if (type.isNIOBuffer()) {
- if(type.isNIOInt64Buffer() || type.isNIOPointerBuffer()) {
+ if(type.isNIOPointerBuffer()) {
if (directNIOOnly) {
writer.print( getArgumentName(i)+ " != null ? " + getArgumentName(i) + ".getBuffer() : null");
} else {
@@ -735,15 +738,14 @@ public class JavaMethodBindingEmitter extends FunctionEmitter {
if (getBinding().getCReturnType().pointerDepth() >= 2) {
if (returnType.isNIOPointerBuffer()) {
writer.println(" return PointerBuffer.wrap(_res);");
- } else if (returnType.isNIOInt64Buffer()) {
- writer.println(" return Int64Buffer.wrap(_res);");
+ } else if (returnType.isNIOLongBuffer()) {
+ writer.println(" return _res.asLongBuffer();");
} else {
throw new RuntimeException("While emitting glue code for " + getName() +
- ": can not legally make pointers opaque to anything but PointerBuffer or Int64Buffer/long");
+ ": can not legally make pointers opaque to anything but PointerBuffer or LongBuffer/long");
}
- } else if (getBinding().getCReturnType().pointerDepth() == 1 &&
- returnType.isNIOInt64Buffer()) {
- writer.println(" return Int64Buffer.wrap(_res);");
+ } else if (getBinding().getCReturnType().pointerDepth() == 1 && returnType.isNIOLongBuffer()) {
+ writer.println(" return _res.asLongBuffer();");
} else {
String returnTypeName = returnType.getName().substring("java.nio.".length());
writer.println(" return _res.as" + returnTypeName + "();");
diff --git a/src/java/com/jogamp/gluegen/JavaType.java b/src/java/com/jogamp/gluegen/JavaType.java
index 9a89203..04d14de 100644
--- a/src/java/com/jogamp/gluegen/JavaType.java
+++ b/src/java/com/jogamp/gluegen/JavaType.java
@@ -70,7 +70,6 @@ public class JavaType {
private static JavaType nioIntBufferType;
private static JavaType nioLongBufferType;
private static JavaType nioPointerBufferType;
- private static JavaType nioInt64BufferType;
private static JavaType nioFloatBufferType;
private static JavaType nioDoubleBufferType;
private static JavaType nioByteBufferArrayType;
@@ -194,12 +193,6 @@ public class JavaType {
return nioLongBufferType;
}
- public static JavaType forNIOInt64BufferClass() {
- if(nioInt64BufferType == null)
- nioInt64BufferType = createForClass(com.jogamp.common.nio.Int64Buffer.class);
- return nioInt64BufferType;
- }
-
public static JavaType forNIOPointerBufferClass() {
if(nioPointerBufferType == null)
nioPointerBufferType = createForClass(com.jogamp.common.nio.PointerBuffer.class);
@@ -338,9 +331,8 @@ public class JavaType {
}
public boolean isNIOBuffer() {
- return clazz != null && ( (java.nio.Buffer.class).isAssignableFrom(clazz) ||
- (com.jogamp.common.nio.PointerBuffer.class).isAssignableFrom(clazz) ||
- (com.jogamp.common.nio.Int64Buffer.class).isAssignableFrom(clazz) ) ;
+ return clazz != null && ( java.nio.Buffer.class.isAssignableFrom(clazz) ||
+ com.jogamp.common.nio.NativeBuffer.class.isAssignableFrom(clazz)) ;
}
public boolean isNIOByteBuffer() {
@@ -359,10 +351,6 @@ public class JavaType {
return (clazz == java.nio.LongBuffer.class);
}
- public boolean isNIOInt64Buffer() {
- return (clazz == com.jogamp.common.nio.Int64Buffer.class);
- }
-
public boolean isNIOPointerBuffer() {
return (clazz == com.jogamp.common.nio.PointerBuffer.class);
}