diff options
Diffstat (limited to 'src/jogl/classes/com/jogamp/gluegen/opengl/nativesig')
2 files changed, 50 insertions, 50 deletions
diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/nativesig/NativeSignatureEmitter.java b/src/jogl/classes/com/jogamp/gluegen/opengl/nativesig/NativeSignatureEmitter.java index 4ac9ae3f3..de9e3ed25 100644 --- a/src/jogl/classes/com/jogamp/gluegen/opengl/nativesig/NativeSignatureEmitter.java +++ b/src/jogl/classes/com/jogamp/gluegen/opengl/nativesig/NativeSignatureEmitter.java @@ -61,14 +61,14 @@ import java.util.Set; public class NativeSignatureEmitter extends GLEmitter { @Override - protected List<? extends FunctionEmitter> generateMethodBindingEmitters(Set<MethodBinding> methodBindingSet, FunctionSymbol sym) throws Exception { + protected List<? extends FunctionEmitter> generateMethodBindingEmitters(final Set<MethodBinding> methodBindingSet, final FunctionSymbol sym) throws Exception { // Allow superclass to do most of the work for us - List<? extends FunctionEmitter> res = super.generateMethodBindingEmitters(methodBindingSet, sym); + final List<? extends FunctionEmitter> res = super.generateMethodBindingEmitters(methodBindingSet, sym); // Filter out all non-JavaMethodBindingEmitters - for (Iterator<? extends FunctionEmitter> iter = res.iterator(); iter.hasNext();) { - FunctionEmitter emitter = iter.next(); + for (final Iterator<? extends FunctionEmitter> iter = res.iterator(); iter.hasNext();) { + final FunctionEmitter emitter = iter.next(); if (!(emitter instanceof JavaMethodBindingEmitter)) { iter.remove(); } @@ -78,13 +78,13 @@ public class NativeSignatureEmitter extends GLEmitter { return res; } - PrintWriter writer = (getConfig().allStatic() ? javaWriter() : javaImplWriter()); + final PrintWriter writer = (getConfig().allStatic() ? javaWriter() : javaImplWriter()); - List<FunctionEmitter> processed = new ArrayList<FunctionEmitter>(); + final List<FunctionEmitter> processed = new ArrayList<FunctionEmitter>(); // First, filter out all emitters going to the "other" (public) writer - for (Iterator<? extends FunctionEmitter> iter = res.iterator(); iter.hasNext();) { - FunctionEmitter emitter = iter.next(); + for (final Iterator<? extends FunctionEmitter> iter = res.iterator(); iter.hasNext();) { + final FunctionEmitter emitter = iter.next(); if (emitter.getDefaultOutput() != writer) { processed.add(emitter); iter.remove(); @@ -93,12 +93,12 @@ public class NativeSignatureEmitter extends GLEmitter { // Now process all of the remaining emitters sorted by MethodBinding while (!res.isEmpty()) { - List<JavaMethodBindingEmitter> emittersForBinding = new ArrayList<JavaMethodBindingEmitter>(); - JavaMethodBindingEmitter emitter = (JavaMethodBindingEmitter) res.remove(0); + final List<JavaMethodBindingEmitter> emittersForBinding = new ArrayList<JavaMethodBindingEmitter>(); + final JavaMethodBindingEmitter emitter = (JavaMethodBindingEmitter) res.remove(0); emittersForBinding.add(emitter); - MethodBinding binding = emitter.getBinding(); - for (Iterator<? extends FunctionEmitter> iter = res.iterator(); iter.hasNext();) { - JavaMethodBindingEmitter emitter2 = (JavaMethodBindingEmitter) iter.next(); + final MethodBinding binding = emitter.getBinding(); + for (final Iterator<? extends FunctionEmitter> iter = res.iterator(); iter.hasNext();) { + final JavaMethodBindingEmitter emitter2 = (JavaMethodBindingEmitter) iter.next(); if (emitter2.getBinding() == binding) { emittersForBinding.add(emitter2); iter.remove(); @@ -111,17 +111,17 @@ public class NativeSignatureEmitter extends GLEmitter { return processed; } - protected void generateNativeSignatureEmitters(MethodBinding binding, List<JavaMethodBindingEmitter> allEmitters) { + protected void generateNativeSignatureEmitters(final MethodBinding binding, final List<JavaMethodBindingEmitter> allEmitters) { if (allEmitters.isEmpty()) { return; } - PrintWriter writer = (getConfig().allStatic() ? javaWriter() : javaImplWriter()); + final PrintWriter writer = (getConfig().allStatic() ? javaWriter() : javaImplWriter()); // Give ourselves the chance to interpose on the generation of all code to keep things simple - List<JavaMethodBindingEmitter> newEmitters = new ArrayList<JavaMethodBindingEmitter>(); - for (JavaMethodBindingEmitter javaEmitter : allEmitters) { + final List<JavaMethodBindingEmitter> newEmitters = new ArrayList<JavaMethodBindingEmitter>(); + for (final JavaMethodBindingEmitter javaEmitter : allEmitters) { NativeSignatureJavaMethodBindingEmitter newEmitter = null; if (javaEmitter instanceof GLJavaMethodBindingEmitter) { newEmitter = new NativeSignatureJavaMethodBindingEmitter((GLJavaMethodBindingEmitter) javaEmitter); @@ -138,11 +138,11 @@ public class NativeSignatureEmitter extends GLEmitter { // been called with signatureOnly both true and false. if (signatureContainsStrings(binding) && !haveEmitterWithBody(allEmitters)) { // This basically handles glGetString but also any similar methods - NativeSignatureJavaMethodBindingEmitter javaEmitter = findEmitterWithWriter(allEmitters, writer); + final NativeSignatureJavaMethodBindingEmitter javaEmitter = findEmitterWithWriter(allEmitters, writer); // First, we need to clone this emitter to produce the native // entry point - NativeSignatureJavaMethodBindingEmitter emitter = new NativeSignatureJavaMethodBindingEmitter(javaEmitter); + final NativeSignatureJavaMethodBindingEmitter emitter = new NativeSignatureJavaMethodBindingEmitter(javaEmitter); emitter.removeModifier(JavaMethodBindingEmitter.PUBLIC); emitter.addModifier(JavaMethodBindingEmitter.PRIVATE); emitter.setForImplementingMethodCall(true); @@ -158,22 +158,22 @@ public class NativeSignatureEmitter extends GLEmitter { } } - protected boolean signatureContainsStrings(MethodBinding binding) { + protected boolean signatureContainsStrings(final MethodBinding binding) { for (int i = 0; i < binding.getNumArguments(); i++) { - JavaType type = binding.getJavaArgumentType(i); + final JavaType type = binding.getJavaArgumentType(i); if (type.isString() || type.isStringArray()) { return true; } } - JavaType retType = binding.getJavaReturnType(); + final JavaType retType = binding.getJavaReturnType(); if (retType.isString() || retType.isStringArray()) { return true; } return false; } - protected boolean haveEmitterWithBody(List<JavaMethodBindingEmitter> allEmitters) { - for (JavaMethodBindingEmitter emitter : allEmitters) { + protected boolean haveEmitterWithBody(final List<JavaMethodBindingEmitter> allEmitters) { + for (final JavaMethodBindingEmitter emitter : allEmitters) { if (!emitter.signatureOnly()) { return true; } @@ -181,9 +181,9 @@ public class NativeSignatureEmitter extends GLEmitter { return false; } - protected NativeSignatureJavaMethodBindingEmitter findEmitterWithWriter(List<JavaMethodBindingEmitter> allEmitters, PrintWriter writer) { - for (JavaMethodBindingEmitter jemitter : allEmitters) { - NativeSignatureJavaMethodBindingEmitter emitter = (NativeSignatureJavaMethodBindingEmitter)jemitter; + protected NativeSignatureJavaMethodBindingEmitter findEmitterWithWriter(final List<JavaMethodBindingEmitter> allEmitters, final PrintWriter writer) { + for (final JavaMethodBindingEmitter jemitter : allEmitters) { + final NativeSignatureJavaMethodBindingEmitter emitter = (NativeSignatureJavaMethodBindingEmitter)jemitter; if (emitter.getDefaultOutput() == writer) { return emitter; } diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/nativesig/NativeSignatureJavaMethodBindingEmitter.java b/src/jogl/classes/com/jogamp/gluegen/opengl/nativesig/NativeSignatureJavaMethodBindingEmitter.java index 6d9d6f2bb..86080d84f 100644 --- a/src/jogl/classes/com/jogamp/gluegen/opengl/nativesig/NativeSignatureJavaMethodBindingEmitter.java +++ b/src/jogl/classes/com/jogamp/gluegen/opengl/nativesig/NativeSignatureJavaMethodBindingEmitter.java @@ -53,31 +53,31 @@ import java.io.PrintWriter; /** Review: This Package/Class is not used and subject to be deleted. */ public class NativeSignatureJavaMethodBindingEmitter extends GLJavaMethodBindingEmitter { - public NativeSignatureJavaMethodBindingEmitter(GLJavaMethodBindingEmitter methodToWrap) { + public NativeSignatureJavaMethodBindingEmitter(final GLJavaMethodBindingEmitter methodToWrap) { super(methodToWrap); } - public NativeSignatureJavaMethodBindingEmitter(ProcAddressJavaMethodBindingEmitter methodToWrap, GLEmitter emitter, boolean bufferObjectVariant) { + public NativeSignatureJavaMethodBindingEmitter(final ProcAddressJavaMethodBindingEmitter methodToWrap, final GLEmitter emitter, final boolean bufferObjectVariant) { super(methodToWrap, emitter, bufferObjectVariant); } - public NativeSignatureJavaMethodBindingEmitter(JavaMethodBindingEmitter methodToWrap, NativeSignatureEmitter emitter) { + public NativeSignatureJavaMethodBindingEmitter(final JavaMethodBindingEmitter methodToWrap, final NativeSignatureEmitter emitter) { super(methodToWrap, false, null, false, false, emitter); } @Override - protected void emitSignature(PrintWriter writer) { + protected void emitSignature(final PrintWriter writer) { writer.print(getBaseIndentString()); emitNativeSignatureAnnotation(writer); super.emitSignature(writer); } - protected void emitNativeSignatureAnnotation(PrintWriter writer) { + protected void emitNativeSignatureAnnotation(final PrintWriter writer) { if (hasModifier(JavaMethodBindingEmitter.NATIVE)) { // Emit everything as a leaf for now // FIXME: make this configurable writer.print("@NativeSignature(\"l"); - MethodBinding binding = getBinding(); + final MethodBinding binding = getBinding(); if (callThroughProcAddress) { writer.print("p"); } @@ -94,7 +94,7 @@ public class NativeSignatureJavaMethodBindingEmitter extends GLJavaMethodBinding } } - protected void emitNativeSignatureElement(PrintWriter writer, JavaType type, Type cType, int index) { + protected void emitNativeSignatureElement(final PrintWriter writer, final JavaType type, final Type cType, final int index) { if (type.isVoid()) { if (index > 0) { throw new InternalError("Error parsing arguments -- void should not be seen aside from argument 0"); @@ -107,7 +107,7 @@ public class NativeSignatureJavaMethodBindingEmitter extends GLJavaMethodBinding } else if (type.isPrimitiveArray()) { writer.print("MO"); } else if (type.isPrimitive()) { - Class<?> clazz = type.getJavaClass(); + final Class<?> clazz = type.getJavaClass(); if (clazz == Byte.TYPE) { writer.print("B"); } else if (clazz == Character.TYPE) { writer.print("C"); } else if (clazz == Double.TYPE) { writer.print("D"); } @@ -132,9 +132,9 @@ public class NativeSignatureJavaMethodBindingEmitter extends GLJavaMethodBinding } @Override - protected String getReturnTypeString(boolean skipArray) { + protected String getReturnTypeString(final boolean skipArray) { if (isForImplementingMethodCall()) { - JavaType returnType = getBinding().getJavaReturnType(); + final JavaType returnType = getBinding().getJavaReturnType(); if (returnType.isString() || returnType.isNIOByteBuffer()) { // Treat these as addresses return "long"; @@ -144,10 +144,10 @@ public class NativeSignatureJavaMethodBindingEmitter extends GLJavaMethodBinding } @Override - protected void emitPreCallSetup(MethodBinding binding, PrintWriter writer) { + protected void emitPreCallSetup(final MethodBinding binding, final PrintWriter writer) { super.emitPreCallSetup(binding, writer); for (int i = 0; i < binding.getNumArguments(); i++) { - JavaType type = binding.getJavaArgumentType(i); + final JavaType type = binding.getJavaArgumentType(i); if (type.isNIOBuffer() && !useNIODirectOnly ) { // Emit declarations for variables holding primitive arrays as type Object // We don't know 100% sure we're going to use these at this point in the code, though @@ -160,12 +160,12 @@ public class NativeSignatureJavaMethodBindingEmitter extends GLJavaMethodBinding } } - protected String getNIOBufferArrayName(int argNumber) { + protected String getNIOBufferArrayName(final int argNumber) { return "__buffer_array_" + argNumber; } @Override - protected int emitArguments(PrintWriter writer) + protected int emitArguments(final PrintWriter writer) { boolean needComma = false; int numEmitted = 0; @@ -191,7 +191,7 @@ public class NativeSignatureJavaMethodBindingEmitter extends GLJavaMethodBinding } for (int i = 0; i < binding.getNumArguments(); i++) { - JavaType type = binding.getJavaArgumentType(i); + final JavaType type = binding.getJavaArgumentType(i); if (type.isVoid()) { // Make sure this is the only param to the method; if it isn't, // there's something wrong with our parsing of the headers. @@ -246,9 +246,9 @@ public class NativeSignatureJavaMethodBindingEmitter extends GLJavaMethodBinding } @Override - protected void emitReturnVariableSetupAndCall(MethodBinding binding, PrintWriter writer) { + protected void emitReturnVariableSetupAndCall(final MethodBinding binding, final PrintWriter writer) { writer.print(" "); - JavaType returnType = binding.getJavaReturnType(); + final JavaType returnType = binding.getJavaReturnType(); boolean needsResultAssignment = false; if (!returnType.isVoid()) { @@ -344,7 +344,7 @@ public class NativeSignatureJavaMethodBindingEmitter extends GLJavaMethodBinding } } - protected int emitCallArguments(MethodBinding binding, PrintWriter writer, boolean direct) { + protected int emitCallArguments(final MethodBinding binding, final PrintWriter writer, final boolean direct) { // Note that we override this completely because we both need to // move the potential location of the outgoing proc address as // well as change the way we pass out Buffers, arrays, Strings, etc. @@ -368,7 +368,7 @@ public class NativeSignatureJavaMethodBindingEmitter extends GLJavaMethodBinding ++numArgsEmitted; } for (int i = 0; i < binding.getNumArguments(); i++) { - JavaType type = binding.getJavaArgumentType(i); + final JavaType type = binding.getJavaArgumentType(i); if (type.isJNIEnv() || binding.isArgumentThisPointer(i)) { // Don't need to expose these at the Java level continue; @@ -460,9 +460,9 @@ public class NativeSignatureJavaMethodBindingEmitter extends GLJavaMethodBinding } @Override - protected void emitCallResultReturn(MethodBinding binding, PrintWriter writer) { + protected void emitCallResultReturn(final MethodBinding binding, final PrintWriter writer) { for (int i = 0; i < binding.getNumArguments(); i++) { - JavaType type = binding.getJavaArgumentType(i); + final JavaType type = binding.getJavaArgumentType(i); if (type.isString()) { writer.println(";"); writer.println(" BuffersInternal.freeCString(" + binding.getArgumentName(i) + "_c_str);"); @@ -475,14 +475,14 @@ public class NativeSignatureJavaMethodBindingEmitter extends GLJavaMethodBinding @Override public String getName() { - String res = super.getName(); + final String res = super.getName(); if (forImplementingMethodCall && bufferObjectVariant) { return res + "BufObj"; } return res; } - protected String getImplMethodName(boolean direct) { + protected String getImplMethodName(final boolean direct) { String name = null; if (direct) { name = binding.getName() + "$0"; |