diff options
author | Sven Gothel <[email protected]> | 2015-04-01 15:51:04 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2015-04-01 15:51:04 +0200 |
commit | c6d5ee30e023d030697f14ae2c444ce7a5542e94 (patch) | |
tree | 0013fef29a228522b6791630385932d38a36a399 /src/java/com/jogamp/gluegen/GlueGen.java | |
parent | c156343fec33ceea7f238b9766a9f4985fb92687 (diff) |
Bug 1153 - GlueGen: Support [const] [native] expressions and conversion to java space, incl. [native] numbers
Rewrite ConstantDefinition:
Add sub-class CNumber:
- containing integer/float values and their original qualifiers
[long, double, unsigned]
- conversion to java number
ConstantDefinition:
- holds native expression
- optionally holds CNumber representing native expression,
if [only] a number
- can compute equivalent java expression
with result type (JavaExpr)
Add static native number reg-expression
for number detection and parsing.
Add static native number to CNumber conversion methods.
+++
Retrieve full LISP tree and convert to serialized expression
to be utilized for expressions used in enumerates.
Parse enumerates, allowing const native expressions:
- Utilize ConstantDefinition
either for definite CNumber or expression
- Simply add "+1" for new default values,
if previous is an expression
Diffstat (limited to 'src/java/com/jogamp/gluegen/GlueGen.java')
-rw-r--r-- | src/java/com/jogamp/gluegen/GlueGen.java | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/java/com/jogamp/gluegen/GlueGen.java b/src/java/com/jogamp/gluegen/GlueGen.java index d0ce9ed..6dee6f0 100644 --- a/src/java/com/jogamp/gluegen/GlueGen.java +++ b/src/java/com/jogamp/gluegen/GlueGen.java @@ -217,14 +217,17 @@ public class GlueGen implements GlueEmitterControls { } // iterate over all values in the enumeration for (int i = 0; i < enumeration.getNumEnumerates(); ++i) { - final String enumElementName = enumeration.getEnumName(i); - allConstants.add(new ConstantDefinition(enumElementName, enumeration.getEnumValue(i), - enumName, enumeration.getASTLocusTag())); + final EnumType.Enumerator enumerate = enumeration.getEnum(i); + final ConstantDefinition def = + new ConstantDefinition(enumerate.getName(), enumerate.getExpr(), + enumerate.getNumber(), + enumName, enumeration.getASTLocusTag()); + allConstants.add(def); } } for (final Object elem : lexer.getDefines()) { final Define def = (Define) elem; - allConstants.add(new ConstantDefinition(def.getName(), def.getValue(), def.getASTLocusTag())); + allConstants.add(new ConstantDefinition(def.getName(), def.getValue(), null, def.getASTLocusTag())); } allConstants.addAll(preprocessor.getConstantDefinitions()); |