summaryrefslogtreecommitdiffstats
path: root/src/java/com/sun
diff options
context:
space:
mode:
authorMichael Bien <[email protected]>2010-03-12 00:18:42 +0100
committerMichael Bien <[email protected]>2010-03-12 00:18:42 +0100
commit1c70efef6c5d6b195ec29f3a19c096b0898ebfe0 (patch)
treeed5e8cc783a9b51af65e65dd94a23333794ca76e /src/java/com/sun
parent4669dce04c31e5fc2a32837099e5c47624d90fba (diff)
fixed JavaEmitter to support unsigned defines.
Diffstat (limited to 'src/java/com/sun')
-rw-r--r--src/java/com/sun/gluegen/JavaEmitter.java10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/java/com/sun/gluegen/JavaEmitter.java b/src/java/com/sun/gluegen/JavaEmitter.java
index 1371112..f6660d2 100644
--- a/src/java/com/sun/gluegen/JavaEmitter.java
+++ b/src/java/com/sun/gluegen/JavaEmitter.java
@@ -264,7 +264,7 @@ public class JavaEmitter implements GlueEmitter {
// "1.0d or 2759L", because parseXXX() methods don't allow the type
// specifier character in the string.
//
- //char lastChar = value.charAt(value.length()-1);
+ char lastChar = value.charAt(value.length()-1);
try {
// see if it's a long or int
@@ -284,6 +284,10 @@ public class JavaEmitter implements GlueEmitter {
radix = 10;
parseValue = value;
}
+ if(lastChar == 'u' || lastChar == 'U') {
+ parseValue = parseValue.substring(0, parseValue.length()-1);
+ }
+
//System.err.println("parsing " + value + " as long w/ radix " + radix);
long longVal = Long.parseLong(parseValue, radix);
// if constant is small enough, store it as an int instead of a long
@@ -346,6 +350,7 @@ public class JavaEmitter implements GlueEmitter {
String name = def.getName();
String value = def.getValue();
+
if (!cfg.shouldIgnoreInInterface(name)) {
String type = getJavaType(name, value);
if (optionalComment != null && optionalComment.length() != 0) {
@@ -354,7 +359,10 @@ public class JavaEmitter implements GlueEmitter {
String suffix = "";
if (type.equals("float") && !value.endsWith("f")) {
suffix = "f";
+ }else if(value.endsWith("u") || value.endsWith("U")) {
+ value = value.substring(0, value.length()-1);
}
+
javaWriter().println(" public static final " + type + " " + name + " = " + value + suffix + ";");
}
}