aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHarvey Harrison <[email protected]>2014-05-31 15:08:41 -0700
committerHarvey Harrison <[email protected]>2014-05-31 15:08:41 -0700
commit5d802fb8dd4004039d4597253712d24fffb90a36 (patch)
treea3271dd695bcd95d891036723e3eff02fd0d28b1 /src
parentd6a5fa9169cc3f7abdb7a23068ddd76f632eec26 (diff)
gluegen: update HeaderParser grammar to annotation EnumType map and functions list
Signed-off-by: Harvey Harrison <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/java/com/jogamp/gluegen/GlueGen.java3
-rw-r--r--src/main/antlr/com/jogamp/gluegen/cgram/HeaderParser.g20
2 files changed, 11 insertions, 12 deletions
diff --git a/src/java/com/jogamp/gluegen/GlueGen.java b/src/java/com/jogamp/gluegen/GlueGen.java
index 54e510d..891878b 100644
--- a/src/java/com/jogamp/gluegen/GlueGen.java
+++ b/src/java/com/jogamp/gluegen/GlueGen.java
@@ -190,8 +190,7 @@ public class GlueGen implements GlueEmitterControls {
// Repackage the enum and #define statements from the parser into a common format
// so that SymbolFilters can operate upon both identically
constants = new ArrayList<ConstantDefinition>();
- for (Object elem : headerParser.getEnums()) {
- EnumType enumeration = (EnumType) elem;
+ for (EnumType enumeration : headerParser.getEnums()) {
String enumName = enumeration.getName();
if (enumName.equals("<anonymous>")) {
enumName = null;
diff --git a/src/main/antlr/com/jogamp/gluegen/cgram/HeaderParser.g b/src/main/antlr/com/jogamp/gluegen/cgram/HeaderParser.g
index 0b4d5ec..75cf413 100644
--- a/src/main/antlr/com/jogamp/gluegen/cgram/HeaderParser.g
+++ b/src/main/antlr/com/jogamp/gluegen/cgram/HeaderParser.g
@@ -100,7 +100,7 @@ options {
/** Pre-define the list of EnumTypes for this HeaderParser. Must be
done before parsing. */
- public void setEnums(List/*<EnumType>*/ enumTypes) {
+ public void setEnums(List<EnumType> enumTypes) {
// FIXME: Need to take the input set of EnumTypes, extract all
// the enumerates from each EnumType, and fill in the enumHash
// so that each enumerate maps to the enumType to which it
@@ -109,8 +109,8 @@ options {
}
/** Returns the EnumTypes this HeaderParser processed. */
- public List/*<EnumType>*/ getEnums() {
- return new ArrayList(enumHash.values());
+ public List<EnumType> getEnums() {
+ return new ArrayList<EnumType>(enumHash.values());
}
/** Clears the list of functions this HeaderParser has parsed.
@@ -121,7 +121,7 @@ options {
}
/** Returns the list of FunctionSymbols this HeaderParser has parsed. */
- public List getParsedFunctions() {
+ public List<FunctionSymbol> getParsedFunctions() {
return functions;
}
@@ -241,9 +241,9 @@ options {
private List parameters;
private TypeDictionary typedefDictionary;
private TypeDictionary structDictionary;
- private List/*<FunctionSymbol>*/ functions = new ArrayList();
+ private List<FunctionSymbol> functions = new ArrayList<FunctionSymbol>();
// hash from name of an enumerated value to the EnumType to which it belongs
- private HashMap/*<String,EnumType>*/ enumHash = new HashMap();
+ private HashMap<String, EnumType> enumHash = new HashMap<String, EnumType>();
// Storage class specifiers
private static final int AUTO = 1 << 0;
@@ -317,9 +317,9 @@ options {
returns an existing one if it has already been created. */
private EnumType getEnumType(String enumTypeName) {
EnumType enumType = null;
- Iterator it = enumHash.values().iterator();
+ Iterator<EnumType> it = enumHash.values().iterator();
while (it.hasNext()) {
- EnumType potentialMatch = (EnumType)it.next();
+ EnumType potentialMatch = it.next();
if (potentialMatch.getName().equals(enumTypeName)) {
enumType = potentialMatch;
break;
@@ -652,7 +652,7 @@ enumerator[EnumType enumeration, long defaultValue] returns [long newDefaultValu
if (eVal != null) {
String vTxt = eVal.getAllChildrenText();
if (enumHash.containsKey(vTxt)) {
- EnumType oldEnumType = (EnumType) enumHash.get(vTxt);
+ EnumType oldEnumType = enumHash.get(vTxt);
value = oldEnumType.getEnumValue(vTxt);
} else {
try {
@@ -669,7 +669,7 @@ enumerator[EnumType enumeration, long defaultValue] returns [long newDefaultValu
newDefaultValue = value+1;
String eTxt = eName.getText();
if (enumHash.containsKey(eTxt)) {
- EnumType oldEnumType = (EnumType) enumHash.get(eTxt);
+ EnumType oldEnumType = enumHash.get(eTxt);
long oldValue = oldEnumType.getEnumValue(eTxt);
System.err.println("WARNING: redefinition of enumerated value '" + eTxt + "';" +
" existing definition is in enumeration '" + oldEnumType.getName() +