summaryrefslogtreecommitdiffstats
path: root/src/java/com/sun
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2010-03-29 04:24:20 +0200
committerSven Gothel <[email protected]>2010-03-29 04:24:20 +0200
commit2138fc787c1e497be7f373aa68b3f751c955008f (patch)
treed4b1a1dc63602bef8073e70d709faa2821b5dddd /src/java/com/sun
parentca2ccb29bd3cd4d9c73ca96ce02402888ac9e9af (diff)
New Int64Buffer type, which is being used for gluegen 'long *'
Diffstat (limited to 'src/java/com/sun')
-rw-r--r--src/java/com/sun/gluegen/JavaEmitter.java22
-rw-r--r--src/java/com/sun/gluegen/JavaMethodBindingEmitter.java2
-rw-r--r--src/java/com/sun/gluegen/JavaType.java14
3 files changed, 26 insertions, 12 deletions
diff --git a/src/java/com/sun/gluegen/JavaEmitter.java b/src/java/com/sun/gluegen/JavaEmitter.java
index 6658a16..e283fcb 100644
--- a/src/java/com/sun/gluegen/JavaEmitter.java
+++ b/src/java/com/sun/gluegen/JavaEmitter.java
@@ -695,12 +695,12 @@ public class JavaEmitter implements GlueEmitter {
//
// boolean arg_direct = arg != null && BufferFactory.isDirect(arg);
//
- // fooMethod0(arg_direct?arg:BufferFactory.getArray(arg),
+ // fooMethod1(arg_direct?arg:BufferFactory.getArray(arg),
// arg_direct?BufferFactory.getDirectBufferByteOffset(arg):BufferFactory.getIndirectBufferByteOffset(arg),
// arg_direct,
// ... );
// }
- // private native void fooMethod0(Object arg, int arg_byte_offset, boolean arg_is_direct, ...);
+ // private native void fooMethod1(Object arg, int arg_byte_offset, boolean arg_is_direct, ...);
//
// Method taking primitive array argument:
// Interface class:
@@ -713,13 +713,15 @@ public class JavaEmitter implements GlueEmitter {
// }
// public void fooMethod(IntBuffer arg) {
// ... bounds checks, etc. ...
- // if (arg.isDirect()) {
- // fooMethod0(arg, computeDirectBufferByteOffset(arg));
- // } else {
- // fooMethod1(getIndirectBufferArray(arg), computeIndirectBufferByteOffset(arg));
- // }
+ //
+ // boolean arg_direct = BufferFactory.isDirect(arg);
+ //
+ // fooMethod1(arg_direct?arg:BufferFactory.getArray(arg),
+ // arg_direct?BufferFactory.getDirectBufferByteOffset(arg):BufferFactory.getIndirectBufferByteOffset(arg),
+ // arg_direct,
+ // ... );
// }
- // private native void fooMethod0(Object arg, int arg_byte_offset, boolean arg_is_direct, ...);
+ // private native void fooMethod1(Object arg, int arg_byte_offset, boolean arg_is_direct, ...);
//
// Note in particular that the public entry point taking an
// array is merely a special case of the indirect buffer case.
@@ -1794,7 +1796,7 @@ public class JavaEmitter implements GlueEmitter {
if (convertToArrays) {
result = result.replaceJavaArgumentType(i, javaType(ArrayTypes.longArrayClass));
} else {
- result = result.replaceJavaArgumentType(i, JavaType.forNIOPointerBufferClass());
+ result = result.replaceJavaArgumentType(i, JavaType.forNIOInt64BufferClass());
}
} else if (t.isCFloatPointerType()) {
arrayPossible = true;
@@ -1828,7 +1830,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.forNIOPointerBufferClass());
+ result = result.replaceJavaArgumentType(-1, JavaType.forNIOInt64BufferClass());
} else if (t.isCFloatPointerType()) {
result = result.replaceJavaArgumentType(-1, JavaType.forNIOFloatBufferClass());
} else if (t.isCDoublePointerType()) {
diff --git a/src/java/com/sun/gluegen/JavaMethodBindingEmitter.java b/src/java/com/sun/gluegen/JavaMethodBindingEmitter.java
index da5484b..b992fcc 100644
--- a/src/java/com/sun/gluegen/JavaMethodBindingEmitter.java
+++ b/src/java/com/sun/gluegen/JavaMethodBindingEmitter.java
@@ -589,7 +589,7 @@ public class JavaMethodBindingEmitter extends FunctionEmitter
}
if (type.isNIOBuffer()) {
- if(type.isNIOPointerBuffer()) {
+ if(type.isNIOInt64Buffer() || type.isNIOPointerBuffer()) {
if (directNIOOnly) {
writer.print( getArgumentName(i)+ " != null ? " + getArgumentName(i) + ".getBuffer() : null");
} else {
diff --git a/src/java/com/sun/gluegen/JavaType.java b/src/java/com/sun/gluegen/JavaType.java
index 19ac945..23f48b2 100644
--- a/src/java/com/sun/gluegen/JavaType.java
+++ b/src/java/com/sun/gluegen/JavaType.java
@@ -71,6 +71,7 @@ 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,6 +195,12 @@ public class JavaType {
return nioLongBufferType;
}
+ public static JavaType forNIOInt64BufferClass() {
+ if(nioInt64BufferType == null)
+ nioInt64BufferType = createForClass(com.jogamp.gluegen.runtime.Int64Buffer.class);
+ return nioInt64BufferType;
+ }
+
public static JavaType forNIOPointerBufferClass() {
if(nioPointerBufferType == null)
nioPointerBufferType = createForClass(com.jogamp.gluegen.runtime.PointerBuffer.class);
@@ -333,7 +340,8 @@ public class JavaType {
public boolean isNIOBuffer() {
return clazz != null && ( (java.nio.Buffer.class).isAssignableFrom(clazz) ||
- (com.jogamp.gluegen.runtime.PointerBuffer.class).isAssignableFrom(clazz) ) ;
+ (com.jogamp.gluegen.runtime.PointerBuffer.class).isAssignableFrom(clazz) ||
+ (com.jogamp.gluegen.runtime.Int64Buffer.class).isAssignableFrom(clazz) ) ;
}
public boolean isNIOByteBuffer() {
@@ -353,6 +361,10 @@ public class JavaType {
return (clazz == java.nio.LongBuffer.class);
}
+ public boolean isNIOInt64Buffer() {
+ return (clazz == com.jogamp.gluegen.runtime.Int64Buffer.class);
+ }
+
public boolean isNIOPointerBuffer() {
return (clazz == com.jogamp.gluegen.runtime.PointerBuffer.class);
}