From 1c70efef6c5d6b195ec29f3a19c096b0898ebfe0 Mon Sep 17 00:00:00 2001 From: Michael Bien Date: Fri, 12 Mar 2010 00:18:42 +0100 Subject: fixed JavaEmitter to support unsigned defines. --- src/java/com/sun/gluegen/JavaEmitter.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/java') 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 + ";"); } } -- cgit v1.2.3