aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/games/gluegen/JavaEmitter.java
diff options
context:
space:
mode:
authorKenneth Russel <[email protected]>2005-02-26 01:41:28 +0000
committerKenneth Russel <[email protected]>2005-02-26 01:41:28 +0000
commitb41b720c4366d4e2cdc1ba146123b87da966d724 (patch)
tree6c6c8196e9ac0ef57f068f394c1720ec034639c2 /src/net/java/games/gluegen/JavaEmitter.java
parent2bb02ad536c5404f008ff71c6d4ca013abaff683 (diff)
Merged with current JOGL trunk (tag JOGL_1_1_PRE_B10)
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JSR-231@245 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/net/java/games/gluegen/JavaEmitter.java')
-rw-r--r--src/net/java/games/gluegen/JavaEmitter.java24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/net/java/games/gluegen/JavaEmitter.java b/src/net/java/games/gluegen/JavaEmitter.java
index 00887c333..318c2ad73 100644
--- a/src/net/java/games/gluegen/JavaEmitter.java
+++ b/src/net/java/games/gluegen/JavaEmitter.java
@@ -264,10 +264,8 @@ public class JavaEmitter implements GlueEmitter {
continue; // don't generate bindings for this symbol
}
- Iterator allBindings = generateMethodBindingEmitters(cFunc);
- while (allBindings.hasNext()) {
- methodBindingEmitters.add(allBindings.next());
- }
+ List allBindings = generateMethodBindingEmitters(cFunc);
+ methodBindingEmitters.addAll(allBindings);
}
// Emit all the methods
@@ -305,7 +303,7 @@ public class JavaEmitter implements GlueEmitter {
* Generate all appropriate Java bindings for the specified C function
* symbols.
*/
- protected Iterator generateMethodBindingEmitters(FunctionSymbol sym) throws Exception {
+ protected List generateMethodBindingEmitters(FunctionSymbol sym) throws Exception {
ArrayList/*<FunctionEmitter>*/ allEmitters = new ArrayList(1);
@@ -375,7 +373,7 @@ public class JavaEmitter implements GlueEmitter {
if (cfg.allStatic()) {
entryPoint.addModifier(JavaMethodBindingEmitter.STATIC);
}
- if (!isUnimplemented && !binding.needsBody()) {
+ if (!isUnimplemented && !bindingNeedsBody(binding)) {
entryPoint.addModifier(JavaMethodBindingEmitter.NATIVE);
}
entryPoint.setReturnedArrayLengthExpression(cfg.returnedArrayLength(binding.getName()));
@@ -395,8 +393,8 @@ public class JavaEmitter implements GlueEmitter {
// If the user has stated that the function will be
// manually implemented, then don't auto-generate a function body.
if (!cfg.manuallyImplement(sym.getName()) && !isUnimplemented) {
- if (binding.needsBody()) {
- // Generate the method which calls the underlying function
+ if (bindingNeedsBody(binding)) {
+ // Generate the method which calls the underlying C function
// after unboxing has occurred
PrintWriter output = cfg.allStatic() ? javaWriter() : javaImplWriter();
JavaMethodBindingEmitter wrappedEntryPoint =
@@ -422,7 +420,7 @@ public class JavaEmitter implements GlueEmitter {
"Error while generating bindings for \"" + sym + "\"", e);
}
- return allEmitters.iterator();
+ return allEmitters;
}
@@ -571,7 +569,7 @@ public class JavaEmitter implements GlueEmitter {
JavaMethodBindingEmitter entryPoint = new JavaMethodBindingImplEmitter(binding, writer, cfg.runtimeExceptionType());
entryPoint.addModifier(JavaMethodBindingEmitter.PUBLIC);
- if (!binding.needsBody() && !binding.hasContainingType()) {
+ if (!bindingNeedsBody(binding) && !binding.hasContainingType()) {
entryPoint.addModifier(JavaMethodBindingEmitter.NATIVE);
}
entryPoint.emit();
@@ -676,6 +674,12 @@ public class JavaEmitter implements GlueEmitter {
// Internals only below this point
//
+ protected boolean bindingNeedsBody(MethodBinding binding) {
+ // We need to perform NIO checks and conversions and array length
+ // checks
+ return binding.signatureUsesNIO() || binding.signatureUsesCArrays();
+ }
+
private CMethodBindingEmitter makeCEmitter(MethodBinding binding,
boolean overloaded,
boolean doingImplRoutine,