From b41b720c4366d4e2cdc1ba146123b87da966d724 Mon Sep 17 00:00:00 2001 From: Kenneth Russel Date: Sat, 26 Feb 2005 01:41:28 +0000 Subject: 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 --- src/net/java/games/gluegen/JavaEmitter.java | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'src/net/java/games/gluegen/JavaEmitter.java') 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/**/ 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, -- cgit v1.2.3