diff options
author | Sven Gothel <[email protected]> | 2009-08-05 10:29:26 -0700 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2009-08-05 10:29:26 -0700 |
commit | a3ce5e8e3bfae850a638c0b40679ed885bceea82 (patch) | |
tree | 0c472ac41dc94ac248131a59fc7f714c87198bcc | |
parent | 47319dab5b769a5a685bc329c8e5a37a710e1687 (diff) |
Fix: Remove PFD_ defines. Add GL Option: AllowNonGLExtensions <bool> to allow non GL extensions to be passed. Allow ifndef/define pattern to have any characters at the end
4 files changed, 41 insertions, 21 deletions
diff --git a/src/java/com/sun/gluegen/opengl/BuildStaticGLInfo.java b/src/java/com/sun/gluegen/opengl/BuildStaticGLInfo.java index a31a98760..a6c0cfc97 100644 --- a/src/java/com/sun/gluegen/opengl/BuildStaticGLInfo.java +++ b/src/java/com/sun/gluegen/opengl/BuildStaticGLInfo.java @@ -96,11 +96,11 @@ public class BuildStaticGLInfo Pattern.compile("^(GLAPI|GL_API|GL_APICALL|EGLAPI|extern)?(\\s*)((unsigned|const)\\s+)?(\\w+)(\\s*\\*)?(\\s+)(GLAPIENTRY|GL_APIENTRY|APIENTRY|EGLAPIENTRY|WINAPI)?(\\s*)([ew]?gl\\w+)\\s?(\\(.*)"); protected static Pattern associationPattern = - Pattern.compile("\\#ifndef ([CEW]?GL[XU]?_[A-Za-z0-9_]+)\\s*"); + Pattern.compile("\\#ifndef ([CEW]?GL[XU]?_[A-Za-z0-9_]+)(.*)"); protected static int defineIdentifierGroup = 1; protected static Pattern definePattern = - Pattern.compile("\\#define (([CEW]?GL[XU]?|PFD)_[A-Za-z0-9_]+)\\s*([A-Za-z0-9_]+)\\s*"); + Pattern.compile("\\#define ([CEW]?GL[XU]?_[A-Za-z0-9_]+)\\s*([A-Za-z0-9_]+)(.*)"); // Maps function / #define names to the names of the extensions they're declared in protected Map declarationToExtensionMap = new HashMap(); diff --git a/src/java/com/sun/gluegen/opengl/GLConfiguration.java b/src/java/com/sun/gluegen/opengl/GLConfiguration.java index 4e8c0c369..9352bcba2 100755 --- a/src/java/com/sun/gluegen/opengl/GLConfiguration.java +++ b/src/java/com/sun/gluegen/opengl/GLConfiguration.java @@ -59,7 +59,8 @@ public class GLConfiguration extends ProcAddressConfiguration { // 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 - private boolean autoUnifyExtensions; + private boolean autoUnifyExtensions=false; + private boolean allowNonGLExtensions=false; public GLConfiguration(GLEmitter emitter) { super(); @@ -82,6 +83,10 @@ public class GLConfiguration extends ProcAddressConfiguration { 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(); @@ -249,6 +254,13 @@ public class GLConfiguration extends ProcAddressConfiguration { return autoUnifyExtensions; } + /** If true, accept all non encapsulated defines and functions, + * as it is mandatory for GL declarations. */ + public boolean getAllowNonGLExtensions() { + return allowNonGLExtensions; + } + + /** shall the non unified (uniq) vendor extensions be dropped ? */ public boolean getDropUniqVendorExtensions(String extName) { return dropUniqVendorExtensions.contains(extName); diff --git a/src/java/com/sun/gluegen/opengl/GLEmitter.java b/src/java/com/sun/gluegen/opengl/GLEmitter.java index 935706bd2..ffe1ed61c 100644 --- a/src/java/com/sun/gluegen/opengl/GLEmitter.java +++ b/src/java/com/sun/gluegen/opengl/GLEmitter.java @@ -325,20 +325,24 @@ public class GLEmitter extends ProcAddressEmitter if(null!=enumName) { newComment.append(enumName); } else { - newComment.append("ENUM"); + newComment.append("CORE ENUM"); } } else { - // Note: All GL defines must be contained within an extension marker ! - // #ifndef GL_EXT_lala - // #define GL_EXT_lala 1 - // ... - // #endif - if(JavaConfiguration.DEBUG_IGNORES) { - StringBuffer sb = new StringBuffer(); - JavaEmitter.addStrings2Buffer(sb, ", ", symbolRenamed, def.getAliasedNames()); - System.err.println("Dropping marker: "+sb.toString()); + if(getGLConfig().getAllowNonGLExtensions()) { + newComment.append("CORE DEF"); + } else { + // Note: All GL defines must be contained within an extension marker ! + // #ifndef GL_EXT_lala + // #define GL_EXT_lala 1 + // ... + // #endif + if(JavaConfiguration.DEBUG_IGNORES) { + StringBuffer sb = new StringBuffer(); + JavaEmitter.addStrings2Buffer(sb, ", ", symbolRenamed, def.getAliasedNames()); + System.err.println("Dropping marker: "+sb.toString()); + } + return; } - return; } } newComment.append("</code>"); diff --git a/src/java/com/sun/gluegen/opengl/GLJavaMethodBindingEmitter.java b/src/java/com/sun/gluegen/opengl/GLJavaMethodBindingEmitter.java index 5e8bada0d..8f5258e0b 100755 --- a/src/java/com/sun/gluegen/opengl/GLJavaMethodBindingEmitter.java +++ b/src/java/com/sun/gluegen/opengl/GLJavaMethodBindingEmitter.java @@ -114,13 +114,17 @@ public class GLJavaMethodBindingEmitter extends ProcAddressJavaMethodBindingEmit StringBuffer newComment = new StringBuffer(); newComment.append("Part of <code>"); if(0==glEmitter.addExtensionsOfSymbols2Buffer(newComment, ", ", symbolRenamed, binding.getAliasedNames())) { - StringBuffer sb = new StringBuffer(); - JavaEmitter.addStrings2Buffer(sb, ", ", symbolRenamed, binding.getAliasedNames()); - RuntimeException ex = new RuntimeException("Couldn't find extension to: "+binding+" ; "+sb.toString()); - ex.printStackTrace(); - glEmitter.getGLConfig().getGLInfo().dump(); - // glEmitter.getGLConfig().dumpRenames(); - throw ex; + if(glEmitter.getGLConfig().getAllowNonGLExtensions()) { + newComment.append("CORE FUNC"); + } else { + StringBuffer sb = new StringBuffer(); + JavaEmitter.addStrings2Buffer(sb, ", ", symbolRenamed, binding.getAliasedNames()); + RuntimeException ex = new RuntimeException("Couldn't find extension to: "+binding+" ; "+sb.toString()); + ex.printStackTrace(); + glEmitter.getGLConfig().getGLInfo().dump(); + // glEmitter.getGLConfig().dumpRenames(); + throw ex; + } } newComment.append("</code>"); writer.print(newComment.toString()); |