summaryrefslogtreecommitdiffstats
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
parent4669dce04c31e5fc2a32837099e5c47624d90fba (diff)
fixed JavaEmitter to support unsigned defines.
-rw-r--r--src/java/com/sun/gluegen/JavaEmitter.java10
-rw-r--r--test/junit/com/sun/gluegen/test.h1
2 files changed, 10 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 + ";");
}
}
diff --git a/test/junit/com/sun/gluegen/test.h b/test/junit/com/sun/gluegen/test.h
index b15b7e5..acac88e 100644
--- a/test/junit/com/sun/gluegen/test.h
+++ b/test/junit/com/sun/gluegen/test.h
@@ -1,3 +1,4 @@
+#define GL_INVALID_INDEX 0xFFFFFFFFu
typedef unsigned long foo;