summaryrefslogtreecommitdiffstats
path: root/src/java/com/jogamp/gluegen/JavaEmitter.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-06-17 08:26:36 +0200
committerSven Gothel <[email protected]>2014-06-17 08:26:36 +0200
commitf4e753ff1f39be381307ffdb0fb6bb7a2d323eff (patch)
tree156e7c1bdad95420754098fb3fe9522b4cf38edd /src/java/com/jogamp/gluegen/JavaEmitter.java
parenta75276408c9bcff77f568cf72b6c71e421a07552 (diff)
GlueGen: Add support for 'compound array call-by-value'
Completing commit c3054a01990e55ab35756ea23ab7d7c05f24dd37 by allowing passing compound arrays via 'call-by-value. - Creating linear temp heap, copying NIO values into it and passing to C function. Copy-back if not 'const', see below. - Respect 'const' qualifier to skip write-back of temp heap passed to C function - See tag: // FIXME: Compound and Compound-Arrays for code changes and validation of completeness - triggers for compound arrays are: - javaType.isArrayOfCompoundTypeWrappers() - type.isArray() - simplified const query by c-type: FunctionEmitter.isBaseTypeConst(ctype) +++ Tests: Added call-by-value to test1.[ch] binding test!
Diffstat (limited to 'src/java/com/jogamp/gluegen/JavaEmitter.java')
-rw-r--r--src/java/com/jogamp/gluegen/JavaEmitter.java18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/java/com/jogamp/gluegen/JavaEmitter.java b/src/java/com/jogamp/gluegen/JavaEmitter.java
index 66e9b24..9a5c2af 100644
--- a/src/java/com/jogamp/gluegen/JavaEmitter.java
+++ b/src/java/com/jogamp/gluegen/JavaEmitter.java
@@ -524,7 +524,7 @@ public class JavaEmitter implements GlueEmitter {
cfg.unsupportedExceptionType(),
!signatureOnly && needsBody,
cfg.tagNativeBinding(),
- false,
+ false, // eraseBufferAndArrayTypes
cfg.useNIOOnly(binding.getName()),
cfg.useNIODirectOnly(binding.getName()),
false,
@@ -575,14 +575,14 @@ public class JavaEmitter implements GlueEmitter {
// method, don't emit another one
if (!cfg.isUnimplemented(binding.getName()) &&
(binding.needsNIOWrappingOrUnwrapping() ||
- binding.signatureUsesJavaPrimitiveArrays() ||
+ // binding.signatureUsesJavaPrimitiveArrays() /* excluded below */ ||
hasPrologueOrEpilogue)) {
PrintWriter writer = (cfg.allStatic() ? javaWriter() : javaImplWriter());
// If the binding uses primitive arrays, we are going to emit
// the private native entry point for it along with the version
// taking only NIO buffers
- if (!binding.signatureUsesJavaPrimitiveArrays()) {
+ if ( !binding.signatureUsesJavaPrimitiveArrays() ) {
// (Always) emit the entry point taking only direct buffers
JavaMethodBindingEmitter emitter =
new JavaMethodBindingEmitter(binding,
@@ -591,7 +591,7 @@ public class JavaEmitter implements GlueEmitter {
cfg.unsupportedExceptionType(),
false,
cfg.tagNativeBinding(),
- true,
+ true, // eraseBufferAndArrayTypes
cfg.useNIOOnly(binding.getName()),
cfg.useNIODirectOnly(binding.getName()),
true,
@@ -1012,7 +1012,7 @@ public class JavaEmitter implements GlueEmitter {
cfg.unsupportedExceptionType(),
true,
cfg.tagNativeBinding(),
- false,
+ false, // eraseBufferAndArrayTypes
true, // FIXME: should unify this with the general emission code
true, // FIXME: should unify this with the general emission code
false,
@@ -1255,7 +1255,7 @@ public class JavaEmitter implements GlueEmitter {
targetType = t.asPointer().getTargetType();
} else {
// t is <type>[], we need to get <type>
- targetType = t.asArray().getElementType();
+ targetType = t.asArray().getBaseElementType();
}
if (t.pointerDepth() == 2 || t.arrayDimension() == 2) {
// Get the target type of the target type (targetType was computer earlier
@@ -1297,7 +1297,7 @@ public class JavaEmitter implements GlueEmitter {
targetType = t.asPointer().getTargetType();
} else {
// t is <type>[], we need to get <type>
- targetType = t.asArray().getElementType();
+ targetType = t.asArray().getBaseElementType();
}
// Handle Types of form pointer-to-type or array-of-type, like
@@ -1326,7 +1326,7 @@ public class JavaEmitter implements GlueEmitter {
return JavaType.createForCDoublePointer();
} else if (targetType.isCompound()) {
if (t.isArray()) { // FIXME: Compound and Compound-Arrays
- throw new RuntimeException("Arrays of compound types not handled yet");
+ return JavaType.createForCArray(targetType);
}
// Special cases for known JNI types (in particular for converting jawt.h)
if (t.getName() != null &&
@@ -1361,7 +1361,7 @@ public class JavaEmitter implements GlueEmitter {
return JavaType.forNIOPointerBufferClass();
} else {
// t is<type>[][], targetType is <type>[], we need to get <type>
- bottomType = targetType.asArray().getElementType();
+ bottomType = targetType.asArray().getBaseElementType();
LOG.log(WARNING, "typeToJavaType(ptr-ptr): {0}, targetType: {1}, bottomType: {2} -> Unhandled!", new Object[]{t, targetType, bottomType});
}