From aac675e3ae8be73d3e498cc8f1062a20839f8482 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Wed, 5 Aug 2009 07:31:49 -0700 Subject: Cleanup for a better OpenGL 3.2 integration, for subsuming extensions: - Allow RenameExtensionIntoCore generate duplicate names, ie those will not be generated. - Add proper comment showing the extension of the symbol. - Fail if no 'GLHeader' is specified, but we are processing a GL/ProcAddress config - Fail if a GL function is not part of an extension MethodBinding, ConstantDefinition cleanup: - getName() returns the renamed name - getOrigName() returns the original - getAliasedNames() returns the aliased ones MethodBinding: - Change: equals() operates on renamed name - Add: hashCode() function - same criteria as equals() Impact: - All config options etc shall trigger with the renamed name, but ignore, rename etc. - Generated Java impl. uses the renamed base name as well Change: emitDefine() uses the ConstantDefinition Add: JavaConfiguration: dumpRenames() Change JavaConfiguration.shouldIgnoreInInterface/Impl(): - respect the renamed symbol name as well Change JavaEmitter.emitFunctions(): - only emit a generated MethodBinding once, therefor store emitted method bindings in a HashSet Fix BuildStaticGLInfo: - Allow white space at the end of #ifndef and #define - Trim strings - Allow 'const' qualifier in function pattern Fix GLEmitter: - Fail if no 'GLHeader' is specified, but a RenameIntoCore option .. - Don't emit marker defines, marking an extension (ie not part of an extension) Fix GLJavaMethodBindingEmitter: - Fail if a GL function is not part of an extension Fix PCPP: - Pass constant type qualifiers for hex-constants: 'l' 'L' ... Fix ProcAddressEmitter: - Operate on the aliased/renamed name for querying ProcAddress usage and generating code. --- src/java/com/sun/gluegen/ConstantDefinition.java | 28 +++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'src/java/com/sun/gluegen/ConstantDefinition.java') diff --git a/src/java/com/sun/gluegen/ConstantDefinition.java b/src/java/com/sun/gluegen/ConstantDefinition.java index e06903b..60f5cef 100644 --- a/src/java/com/sun/gluegen/ConstantDefinition.java +++ b/src/java/com/sun/gluegen/ConstantDefinition.java @@ -38,6 +38,8 @@ import java.util.*; /** Represents the definition of a constant which was provided either via a #define statement or through an enum definition. */ public class ConstantDefinition { + private String origName; + private HashSet aliasedNames; private String name; private String value; private String enumName; @@ -46,9 +48,11 @@ public class ConstantDefinition { public ConstantDefinition(String name, String value, String enumName) { + this.origName = name; this.name = name; this.value = value; this.enumName = enumName; + this.aliasedNames=new HashSet(); } public boolean equals(ConstantDefinition other) { @@ -72,7 +76,29 @@ public class ConstantDefinition { return name.hashCode(); } - public String getName() { return name; } + /** Supports renaming in Java binding. */ + public void rename(String name) { + if(null!=name) { + this.name = name; + aliasedNames.add(origName); + } + } + + public void addAliasedName(String name) { + aliasedNames.add(name); + } + public Collection getAliasedNames() { + return aliasedNames; + } + + public String getOrigName() { + return origName; + } + + public String getName() { + return name; + } + public String getValue() { return value; } /** Returns null if this definition was not part of an enumeration, or if the enum was anonymous. */ -- cgit v1.2.3