From 3d21babb395d4caa5fefff966c824e27411f3fa5 Mon Sep 17 00:00:00 2001 From: Michael Bien Date: Wed, 2 Dec 2009 00:14:46 +0100 Subject: continued with code cleanup in com.sun.gluegen.cgram and com.sun.gluegen.opengl packages. --- .../com/sun/gluegen/opengl/GLConfiguration.java | 104 +++++++++------------ 1 file changed, 45 insertions(+), 59 deletions(-) (limited to 'src/java/com/sun/gluegen/opengl/GLConfiguration.java') diff --git a/src/java/com/sun/gluegen/opengl/GLConfiguration.java b/src/java/com/sun/gluegen/opengl/GLConfiguration.java index 9352bcb..5e7ef7a 100755 --- a/src/java/com/sun/gluegen/opengl/GLConfiguration.java +++ b/src/java/com/sun/gluegen/opengl/GLConfiguration.java @@ -48,14 +48,14 @@ import com.sun.gluegen.runtime.opengl.GLExtensionNames; public class GLConfiguration extends ProcAddressConfiguration { // The following data members support ignoring an entire extension at a time - private List/**/ glHeaders = new ArrayList(); - private Set/**/ ignoredExtensions = new HashSet(); - private Set/**/ extensionsRenamedIntoCore = new HashSet(); + private List glHeaders = new ArrayList(); + private Set ignoredExtensions = new HashSet(); + private Set extensionsRenamedIntoCore = new HashSet(); private BuildStaticGLInfo glInfo; // Maps function names to the kind of buffer object it deals with - private Map/**/ bufferObjectKinds = new HashMap(); + private Map bufferObjectKinds = new HashMap(); private GLEmitter emitter; - private Set/*String*/ dropUniqVendorExtensions = new HashSet(); + private Set dropUniqVendorExtensions = new HashSet(); // This directive is off by default but can help automatically // indicate which extensions have been folded into the core OpenGL // namespace, and if not, then why not @@ -72,44 +72,30 @@ public class GLConfiguration extends ProcAddressConfiguration { } } - protected void dispatch(String cmd, StringTokenizer tok, File file, String filename, int lineNo) throws IOException { - if (cmd.equalsIgnoreCase("IgnoreExtension")) - { - String sym = readString("IgnoreExtension", tok, filename, lineNo); - ignoredExtensions.add(sym); - } - else if (cmd.equalsIgnoreCase("RenameExtensionIntoCore")) - { - String sym = readString("RenameExtensionIntoCore", tok, filename, lineNo); - extensionsRenamedIntoCore.add(sym); - } - else if (cmd.equalsIgnoreCase("AllowNonGLExtensions")) - { - allowNonGLExtensions = readBoolean("AllowNonGLExtensions", tok, filename, lineNo).booleanValue(); - } - else if (cmd.equalsIgnoreCase("AutoUnifyExtensions")) - { - autoUnifyExtensions = readBoolean("AutoUnifyExtensions", tok, filename, lineNo).booleanValue(); - } - else if (cmd.equalsIgnoreCase("GLHeader")) - { - String sym = readString("GLHeader", tok, filename, lineNo); - glHeaders.add(sym); - } - else if (cmd.equalsIgnoreCase("BufferObjectKind")) - { - readBufferObjectKind(tok, filename, lineNo); - } - else if (cmd.equalsIgnoreCase("DropUniqVendorExtensions")) - { - String sym = readString("DropUniqVendorExtensions", tok, filename, lineNo); - dropUniqVendorExtensions.add(sym); - } - else - { - super.dispatch(cmd,tok,file,filename,lineNo); - } - } + @Override + protected void dispatch(String cmd, StringTokenizer tok, File file, String filename, int lineNo) throws IOException { + if (cmd.equalsIgnoreCase("IgnoreExtension")) { + String sym = readString("IgnoreExtension", tok, filename, lineNo); + ignoredExtensions.add(sym); + } else if (cmd.equalsIgnoreCase("RenameExtensionIntoCore")) { + String sym = readString("RenameExtensionIntoCore", tok, filename, lineNo); + extensionsRenamedIntoCore.add(sym); + } else if (cmd.equalsIgnoreCase("AllowNonGLExtensions")) { + allowNonGLExtensions = readBoolean("AllowNonGLExtensions", tok, filename, lineNo).booleanValue(); + } else if (cmd.equalsIgnoreCase("AutoUnifyExtensions")) { + autoUnifyExtensions = readBoolean("AutoUnifyExtensions", tok, filename, lineNo).booleanValue(); + } else if (cmd.equalsIgnoreCase("GLHeader")) { + String sym = readString("GLHeader", tok, filename, lineNo); + glHeaders.add(sym); + } else if (cmd.equalsIgnoreCase("BufferObjectKind")) { + readBufferObjectKind(tok, filename, lineNo); + } else if (cmd.equalsIgnoreCase("DropUniqVendorExtensions")) { + String sym = readString("DropUniqVendorExtensions", tok, filename, lineNo); + dropUniqVendorExtensions.add(sym); + } else { + super.dispatch(cmd, tok, file, filename, lineNo); + } + } protected void readBufferObjectKind(StringTokenizer tok, String filename, int lineNo) { try { @@ -140,12 +126,10 @@ public class GLConfiguration extends ProcAddressConfiguration { /** Overrides javaPrologueForMethod in superclass and automatically generates prologue code for functions associated with buffer objects. */ - public List/**/ javaPrologueForMethod(MethodBinding binding, - boolean forImplementingMethodCall, - boolean eraseBufferAndArrayTypes) { - List/**/ res = super.javaPrologueForMethod(binding, - forImplementingMethodCall, - eraseBufferAndArrayTypes); + @Override + public List javaPrologueForMethod(MethodBinding binding, boolean forImplementingMethodCall, boolean eraseBufferAndArrayTypes) { + + List res = super.javaPrologueForMethod(binding, forImplementingMethodCall, eraseBufferAndArrayTypes); GLEmitter.BufferObjectKind kind = getBufferObjectKind(binding.getName()); if (kind != null) { // Need to generate appropriate prologue based on both buffer @@ -154,7 +138,7 @@ public class GLConfiguration extends ProcAddressConfiguration { // // NOTE we MUST NOT mutate the array returned from the super // call! - ArrayList res2 = new ArrayList(); + ArrayList res2 = new ArrayList(); if (res != null) { res2.addAll(res); } @@ -187,8 +171,8 @@ public class GLConfiguration extends ProcAddressConfiguration { // Must also filter out bogus rangeCheck directives for VBO/PBO // variants if (emitter.isBufferObjectMethodBinding(binding)) { - for (Iterator iter = res.iterator(); iter.hasNext(); ) { - String line = (String) iter.next(); + for (Iterator iter = res.iterator(); iter.hasNext(); ) { + String line = iter.next(); if (line.indexOf("BufferFactory.rangeCheck") >= 0) { iter.remove(); } @@ -199,10 +183,11 @@ public class GLConfiguration extends ProcAddressConfiguration { return res; } + @Override public void dumpIgnores() { System.err.println("GL Ignored extensions: "); - for (Iterator iter = ignoredExtensions.iterator(); iter.hasNext(); ) { - System.err.println("\t"+(String)iter.next()); + for (String str : ignoredExtensions) { + System.err.println("\t"+str); } super.dumpIgnores(); } @@ -231,6 +216,7 @@ public class GLConfiguration extends ProcAddressConfiguration { return false; } + @Override public boolean shouldIgnoreInInterface(String symbol) { return shouldIgnoreInInterface(symbol, true); } @@ -239,6 +225,7 @@ public class GLConfiguration extends ProcAddressConfiguration { return shouldIgnoreExtension(symbol, checkEXT) || super.shouldIgnoreInInterface(symbol); } + @Override public boolean shouldIgnoreInImpl(String symbol) { return shouldIgnoreInImpl(symbol, true); } @@ -268,8 +255,8 @@ public class GLConfiguration extends ProcAddressConfiguration { /** Returns the kind of buffer object this function deals with, or null if none. */ - public GLEmitter.BufferObjectKind getBufferObjectKind(String name) { - return (GLEmitter.BufferObjectKind) bufferObjectKinds.get(name); + GLEmitter.BufferObjectKind getBufferObjectKind(String name) { + return bufferObjectKinds.get(name); } public boolean isBufferObjectFunction(String name) { @@ -281,8 +268,7 @@ public class GLConfiguration extends ProcAddressConfiguration { public void parseGLHeaders(GlueEmitterControls controls) throws IOException { if (!glHeaders.isEmpty()) { glInfo = new BuildStaticGLInfo(); - for (Iterator iter = glHeaders.iterator(); iter.hasNext(); ) { - String file = (String) iter.next(); + for (String file : glHeaders) { String fullPath = controls.findHeaderFile(file); if (fullPath == null) { throw new IOException("Unable to locate header file \"" + file + "\""); @@ -303,7 +289,7 @@ public class GLConfiguration extends ProcAddressConfiguration { constant definitions and functions renamed into the core namespace; for example, glGenFramebuffersEXT to glGenFramebuffers and GL_FRAMEBUFFER_EXT to GL_FRAMEBUFFER. */ - public Set/**/ getExtensionsRenamedIntoCore() { + public Set getExtensionsRenamedIntoCore() { return extensionsRenamedIntoCore; } } -- cgit v1.2.3