diff options
author | Michael Bien <[email protected]> | 2010-01-12 17:57:27 +0100 |
---|---|---|
committer | Michael Bien <[email protected]> | 2010-01-12 17:57:27 +0100 |
commit | b138169c1f85a7914304ae793efb9cabfbfd5da2 (patch) | |
tree | 065d968fe603a9a55c33208cdac8183bde8336a8 /src/java/com/sun/gluegen/JavaEmitter.java | |
parent | 266ab5707d5f6b9e1cf935e6258badd6ba9f2639 (diff) |
fixed emitted code for buffer-array mixing.
removed workaround in BufferFactory since it is no longer needed.
small code cleanup (generator java 5 migration).
Diffstat (limited to 'src/java/com/sun/gluegen/JavaEmitter.java')
-rw-r--r-- | src/java/com/sun/gluegen/JavaEmitter.java | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/java/com/sun/gluegen/JavaEmitter.java b/src/java/com/sun/gluegen/JavaEmitter.java index 0d118cf..79f2b4d 100644 --- a/src/java/com/sun/gluegen/JavaEmitter.java +++ b/src/java/com/sun/gluegen/JavaEmitter.java @@ -388,8 +388,7 @@ public class JavaEmitter implements GlueEmitter { // validateFunctionsToBind(funcsToBindSet); - ArrayList<FunctionSymbol> funcsToBind = new ArrayList<FunctionSymbol>(funcsToBindSet.size()); - funcsToBind.addAll(funcsToBindSet); + ArrayList<FunctionSymbol> funcsToBind = new ArrayList<FunctionSymbol>(funcsToBindSet); // sort functions to make them easier to find in native code Collections.sort( funcsToBind, @@ -408,16 +407,14 @@ public class JavaEmitter implements GlueEmitter { ArrayList<FunctionEmitter> methodBindingEmitters = new ArrayList<FunctionEmitter>(2*funcsToBind.size()); for (FunctionSymbol cFunc : funcsToBind) { // Check to see whether this function should be ignored - if (cfg.shouldIgnoreInImpl(cFunc.getName())) { - continue; // don't generate bindings for this symbol + if (!cfg.shouldIgnoreInImpl(cFunc.getName())) { + methodBindingEmitters.addAll(generateMethodBindingEmitters(methodBindingSet, cFunc)); } - methodBindingEmitters.addAll(generateMethodBindingEmitters(methodBindingSet, cFunc)); } // Emit all the methods - for (int i = 0; i < methodBindingEmitters.size(); ++i) { - FunctionEmitter emitter = methodBindingEmitters.get(i); + for (FunctionEmitter emitter : methodBindingEmitters) { try { if (!emitter.isInterface() || !cfg.shouldIgnoreInInterface(emitter.getName())) { emitter.emit(); @@ -1845,6 +1842,7 @@ public class JavaEmitter implements GlueEmitter { // multiple variants taking Java primitive arrays and NIO buffers, subject // to the per-function "NIO only" rule in the configuration file protected List<MethodBinding> expandMethodBinding(MethodBinding binding) { + List<MethodBinding> result = new ArrayList<MethodBinding>(); // Indicates whether it is possible to produce an array variant // Prevents e.g. char* -> String conversions from emitting two entry points @@ -1853,14 +1851,12 @@ public class JavaEmitter implements GlueEmitter { if (binding.signatureUsesCPrimitivePointers() || binding.signatureUsesCVoidPointers() || binding.signatureUsesCArrays()) { + result.add(lowerMethodBindingPointerTypes(binding, false, canProduceArrayVariant)); // FIXME: should add new configuration flag for this - if (canProduceArrayVariant[0] && - (binding.signatureUsesCPrimitivePointers() || - binding.signatureUsesCArrays()) && - !cfg.nioDirectOnly(binding.getName()) && - !cfg.nioOnly(binding.getName())) { + if (canProduceArrayVariant[0] && (binding.signatureUsesCPrimitivePointers() || binding.signatureUsesCArrays()) && + !cfg.nioDirectOnly(binding.getName()) && !cfg.nioOnly(binding.getName())) { result.add(lowerMethodBindingPointerTypes(binding, true, null)); } } else { |