diff options
author | Sven Gothel <[email protected]> | 2009-08-05 09:57:37 -0700 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2009-08-05 09:57:37 -0700 |
commit | 814050670c7b523d0cdd049c89abf657a230c866 (patch) | |
tree | 8a09e6b316d3b9842c2418437acfe62bc331bce1 | |
parent | 55cf5a4f224c87542b65d820b851f66d371c4062 (diff) |
Fix: Allow all constanst defined by enums; Add PFD_ defines.
-rw-r--r-- | src/java/com/sun/gluegen/ConstantDefinition.java | 5 | ||||
-rw-r--r-- | src/java/com/sun/gluegen/GlueGen.java | 4 | ||||
-rw-r--r-- | src/java/com/sun/gluegen/opengl/BuildStaticGLInfo.java | 2 | ||||
-rw-r--r-- | src/java/com/sun/gluegen/opengl/GLEmitter.java | 11 |
4 files changed, 18 insertions, 4 deletions
diff --git a/src/java/com/sun/gluegen/ConstantDefinition.java b/src/java/com/sun/gluegen/ConstantDefinition.java index 60f5cef..44ce8e0 100644 --- a/src/java/com/sun/gluegen/ConstantDefinition.java +++ b/src/java/com/sun/gluegen/ConstantDefinition.java @@ -42,15 +42,18 @@ public class ConstantDefinition { private HashSet aliasedNames; private String name; private String value; + private boolean isEnum; private String enumName; private Set/*<String>*/ aliases; public ConstantDefinition(String name, String value, + boolean isEnum, String enumName) { this.origName = name; this.name = name; this.value = value; + this.isEnum = isEnum; this.enumName = enumName; this.aliasedNames=new HashSet(); } @@ -104,6 +107,8 @@ public class ConstantDefinition { enumeration, or if the enum was anonymous. */ public String getEnumName() { return enumName; } + public boolean isEnum() { return isEnum; } + public Set/*<String>*/ getAliases() { return aliases; } diff --git a/src/java/com/sun/gluegen/GlueGen.java b/src/java/com/sun/gluegen/GlueGen.java index 9221c3a..3804795 100644 --- a/src/java/com/sun/gluegen/GlueGen.java +++ b/src/java/com/sun/gluegen/GlueGen.java @@ -227,12 +227,12 @@ public class GlueGen implements GlueEmitterControls { for (int i = 0; i < enumeration.getNumEnumerates(); ++i) { String enumElementName = enumeration.getEnumName(i); String value = String.valueOf(enumeration.getEnumValue(i)); - constants.add(new ConstantDefinition(enumElementName, value, enumName)); + constants.add(new ConstantDefinition(enumElementName, value, true, enumName)); } } for (Iterator iter = lexer.getDefines().iterator(); iter.hasNext(); ) { Define def = (Define) iter.next(); - constants.add(new ConstantDefinition(def.getName(), def.getValue(), null)); + constants.add(new ConstantDefinition(def.getName(), def.getValue(), false, null)); } functions = headerParser.getParsedFunctions(); diff --git a/src/java/com/sun/gluegen/opengl/BuildStaticGLInfo.java b/src/java/com/sun/gluegen/opengl/BuildStaticGLInfo.java index 0ede95e..a31a987 100644 --- a/src/java/com/sun/gluegen/opengl/BuildStaticGLInfo.java +++ b/src/java/com/sun/gluegen/opengl/BuildStaticGLInfo.java @@ -100,7 +100,7 @@ public class BuildStaticGLInfo protected static int defineIdentifierGroup = 1; protected static Pattern definePattern = - Pattern.compile("\\#define ([CEW]?GL[XU]?_[A-Za-z0-9_]+)\\s*([A-Za-z0-9_]+)\\s*"); + Pattern.compile("\\#define (([CEW]?GL[XU]?|PFD)_[A-Za-z0-9_]+)\\s*([A-Za-z0-9_]+)\\s*"); // 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/GLEmitter.java b/src/java/com/sun/gluegen/opengl/GLEmitter.java index 9e32026..935706b 100644 --- a/src/java/com/sun/gluegen/opengl/GLEmitter.java +++ b/src/java/com/sun/gluegen/opengl/GLEmitter.java @@ -320,7 +320,15 @@ public class GLEmitter extends ProcAddressEmitter StringBuffer newComment = new StringBuffer(); newComment.append("Part of <code>"); if(0==addExtensionsOfSymbols2Buffer(newComment, ", ", symbolRenamed, def.getAliasedNames())) { - // Note: All GL enums must be contained within an extension marker ! + if(def.isEnum()) { + String enumName = def.getEnumName(); + if(null!=enumName) { + newComment.append(enumName); + } else { + newComment.append("ENUM"); + } + } else { + // Note: All GL defines must be contained within an extension marker ! // #ifndef GL_EXT_lala // #define GL_EXT_lala 1 // ... @@ -331,6 +339,7 @@ public class GLEmitter extends ProcAddressEmitter System.err.println("Dropping marker: "+sb.toString()); } return; + } } newComment.append("</code>"); |