diff options
author | Kenneth Russel <[email protected]> | 2005-02-02 00:23:09 +0000 |
---|---|---|
committer | Kenneth Russel <[email protected]> | 2005-02-02 00:23:09 +0000 |
commit | 944a1c9ff172c5187f8d489b9f687417bb6af953 (patch) | |
tree | 32d5e96e0f923b9ac8a598b92cbfa5a2b44b1891 /src/net/java/games/gluegen/JavaEmitter.java | |
parent | df6b1b78a80fbf95e6c6e8c946bc899b75312153 (diff) |
Merged in changes from Blackbird branch: refactoring and rewriting of
portions of GlueGen for more flexibility. Also fixed source-level
problems associated with making GLCapabilities' clone() not throw
CloneNotSupportedException.
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@202 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/net/java/games/gluegen/JavaEmitter.java')
-rw-r--r-- | src/net/java/games/gluegen/JavaEmitter.java | 24 |
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, |