diff options
author | Sven Gothel <[email protected]> | 2014-06-17 08:26:36 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-06-17 08:26:36 +0200 |
commit | f4e753ff1f39be381307ffdb0fb6bb7a2d323eff (patch) | |
tree | 156e7c1bdad95420754098fb3fe9522b4cf38edd /src/java/com/jogamp/gluegen/JavaMethodBindingEmitter.java | |
parent | a75276408c9bcff77f568cf72b6c71e421a07552 (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/JavaMethodBindingEmitter.java')
-rw-r--r-- | src/java/com/jogamp/gluegen/JavaMethodBindingEmitter.java | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/java/com/jogamp/gluegen/JavaMethodBindingEmitter.java b/src/java/com/jogamp/gluegen/JavaMethodBindingEmitter.java index 5dc5eda..23a8005 100644 --- a/src/java/com/jogamp/gluegen/JavaMethodBindingEmitter.java +++ b/src/java/com/jogamp/gluegen/JavaMethodBindingEmitter.java @@ -454,15 +454,13 @@ public class JavaMethodBindingEmitter extends FunctionEmitter { // Check lengths of any incoming arrays if necessary for (int i = 0; i < binding.getNumArguments(); i++) { Type type = binding.getCArgumentType(i); - if (type.isArray()) { + if (type.isArray()) { // FIXME: Compound and Compound-Arrays ArrayType arrayType = type.asArray(); writer.println(" if (" + getArgumentName(i) + ".length < " + arrayType.getLength() + ")"); writer.println(" throw new " + getRuntimeExceptionType() + "(\"Length of array \\\"" + getArgumentName(i) + "\\\" was less than the required " + arrayType.getLength() + "\");"); - // FIXME: What is this ??? Until resolved - throw an exception ! - throw new RuntimeException("????? "+binding+": binding.getCArgumentType("+i+").isArray(): "+type); // FIXME: Compound and Compound-Arrays } else { JavaType javaType = binding.getJavaArgumentType(i); if (javaType.isNIOBuffer()) { @@ -686,7 +684,7 @@ public class JavaMethodBindingEmitter extends FunctionEmitter { // ByteBuffers back into the wrapper types for (int i = 0; i < binding.getNumArguments(); i++) { JavaType javaArgType = binding.getJavaArgumentType(i); - if (javaArgType.isArrayOfCompoundTypeWrappers()) { + if ( javaArgType.isArrayOfCompoundTypeWrappers() && !isBaseTypeConst(javaArgType.getElementCType()) ) { String argName = binding.getArgumentName(i); writer.println(" for (int _ctr = 0; _ctr < " + argName + ".length; _ctr++) {"); writer.println(" if ((" + argName + "[_ctr] == null && " + argName + COMPOUND_ARRAY_SUFFIX + "[_ctr] == null) ||"); |