aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Bien <[email protected]>2010-05-28 18:35:58 +0200
committerMichael Bien <[email protected]>2010-05-28 18:35:58 +0200
commit16711b7a6c97017476a3f00f2ec87f127cbfda6c (patch)
tree087cb8bfb46ebd65ee82983141d84716740fbf39
parentb2f881256addba8c997e5da471fbf552484f3d4b (diff)
parentc0fd63416e2160f3d35d13d52a8d1fdcf7f7ffbf (diff)
Merge branch 'master' of github.com:sgothel/gluegen
-rw-r--r--jnlp-files/gluegen-rt.jnlp4
-rw-r--r--src/java/com/sun/gluegen/CMethodBindingEmitter.java2
-rw-r--r--src/java/com/sun/gluegen/JavaEmitter.java47
3 files changed, 25 insertions, 28 deletions
diff --git a/jnlp-files/gluegen-rt.jnlp b/jnlp-files/gluegen-rt.jnlp
index 8f4453e..1d3ad5f 100644
--- a/jnlp-files/gluegen-rt.jnlp
+++ b/jnlp-files/gluegen-rt.jnlp
@@ -3,8 +3,8 @@
href="gluegen-rt.jnlp">
<information>
<title>GlueGen Runtime v2</title>
- <vendor>Sun Microsystems, Inc.</vendor>
- <homepage href="http://gluegen.dev.java.net/"/>
+ <vendor>JogAmp Community</vendor>
+ <homepage href="http://jogamp.org/"/>
<description>GlueGen Runtime Library</description>
<description kind="short">Run-time support classes and native code for applications and libraries built using the GlueGen tool.</description>
<offline-allowed/>
diff --git a/src/java/com/sun/gluegen/CMethodBindingEmitter.java b/src/java/com/sun/gluegen/CMethodBindingEmitter.java
index ef5d0e9..d37caaf 100644
--- a/src/java/com/sun/gluegen/CMethodBindingEmitter.java
+++ b/src/java/com/sun/gluegen/CMethodBindingEmitter.java
@@ -1011,7 +1011,7 @@ public class CMethodBindingEmitter extends FunctionEmitter {
writer.print("sizeof(" + cReturnType.getName() + ")");
LOG.warning(
"No capacity specified for java.nio.Buffer return " +
- "value for function \"" + binding + "\";" +
+ "value for function \"" + binding.getName() + "\"" +
" assuming size of equivalent C return type (sizeof(" + cReturnType.getName() + ")): " + binding);
/**
throw new RuntimeException(
diff --git a/src/java/com/sun/gluegen/JavaEmitter.java b/src/java/com/sun/gluegen/JavaEmitter.java
index ec7d951..f25c738 100644
--- a/src/java/com/sun/gluegen/JavaEmitter.java
+++ b/src/java/com/sun/gluegen/JavaEmitter.java
@@ -593,17 +593,34 @@ public class JavaEmitter implements GlueEmitter {
// variant taking only NIO Buffers.
if (!cfg.isUnimplemented(binding.getName()) &&
!binding.signatureUsesJavaPrimitiveArrays()) {
+ CMethodBindingEmitter cEmitter;
+ // Generate a binding without mixed access (NIO-direct, -indirect, array)
+ cEmitter =
+ new CMethodBindingEmitter(binding,
+ cWriter(),
+ cfg.implPackageName(),
+ cfg.implClassName(),
+ true, // NOTE: we always disambiguate with a suffix now, so this is optional
+ cfg.allStatic(),
+ (binding.needsNIOWrappingOrUnwrapping() || hasPrologueOrEpilogue),
+ !cfg.nioDirectOnly(binding.getName()),
+ machDesc64);
+ prepCEmitter(binding, cEmitter);
+ allEmitters.add(cEmitter);
+ }
+ }
+
+ protected void prepCEmitter(MethodBinding binding, CMethodBindingEmitter cEmitter)
+ {
// See whether we need an expression to help calculate the
// length of any return type
- MessageFormat returnValueCapacityFormat = null;
- MessageFormat returnValueLengthFormat = null;
JavaType javaReturnType = binding.getJavaReturnType();
if (javaReturnType.isNIOBuffer() ||
javaReturnType.isCompoundTypeWrapper()) {
// See whether capacity has been specified
String capacity = cfg.returnValueCapacity(binding.getName());
if (capacity != null) {
- returnValueCapacityFormat = new MessageFormat(capacity);
+ cEmitter.setReturnValueCapacityExpression( new MessageFormat(capacity) );
}
} else if (javaReturnType.isArray() ||
javaReturnType.isArrayOfCompoundTypeWrappers()) {
@@ -618,32 +635,11 @@ public class JavaEmitter implements GlueEmitter {
// See whether length has been specified
String len = cfg.returnValueLength(binding.getName());
if (len != null) {
- returnValueLengthFormat = new MessageFormat(len);
+ cEmitter.setReturnValueLengthExpression( new MessageFormat(len) );
}
}
-
- CMethodBindingEmitter cEmitter;
- // Generate a binding without mixed access (NIO-direct, -indirect, array)
- cEmitter =
- new CMethodBindingEmitter(binding,
- cWriter(),
- cfg.implPackageName(),
- cfg.implClassName(),
- true, // NOTE: we always disambiguate with a suffix now, so this is optional
- cfg.allStatic(),
- (binding.needsNIOWrappingOrUnwrapping() || hasPrologueOrEpilogue),
- !cfg.nioDirectOnly(binding.getName()),
- machDesc64);
- if (returnValueCapacityFormat != null) {
- cEmitter.setReturnValueCapacityExpression(returnValueCapacityFormat);
- }
- if (returnValueLengthFormat != null) {
- cEmitter.setReturnValueLengthExpression(returnValueLengthFormat);
- }
cEmitter.setTemporaryCVariableDeclarations(cfg.temporaryCVariableDeclarations(binding.getName()));
cEmitter.setTemporaryCVariableAssignments(cfg.temporaryCVariableAssignments(binding.getName()));
- allEmitters.add(cEmitter);
- }
}
/**
@@ -1018,6 +1014,7 @@ public class JavaEmitter implements GlueEmitter {
true,
false, // FIXME: should unify this with the general emission code
machDesc64);
+ prepCEmitter(binding, cEmitter);
cEmitter.emit();
} catch (Exception e) {
System.err.println("While processing field " + field + " of type " + name + ":");