summaryrefslogtreecommitdiffstats
path: root/src/java/com/sun/gluegen/pcpp
diff options
context:
space:
mode:
authorMichael Bien <[email protected]>2009-08-08 21:46:55 +0200
committerMichael Bien <[email protected]>2009-08-08 21:46:55 +0200
commit889b9574958b04988ab3acbabab109745fbc379a (patch)
tree5f3485268de0f59f113c9d524561fc49b50ad75f /src/java/com/sun/gluegen/pcpp
parenta07c223b8dbde8f81886b7b2bf602e26ab9531b3 (diff)
parent5f8e46324f245c99080d2c340cd4fb2ec9c4fa8d (diff)
Merge branch 'master' of ssh://[email protected]/gluegen~gluegen-git
Diffstat (limited to 'src/java/com/sun/gluegen/pcpp')
-rw-r--r--src/java/com/sun/gluegen/pcpp/PCPP.java26
1 files changed, 19 insertions, 7 deletions
diff --git a/src/java/com/sun/gluegen/pcpp/PCPP.java b/src/java/com/sun/gluegen/pcpp/PCPP.java
index 4523032..7303c04 100644
--- a/src/java/com/sun/gluegen/pcpp/PCPP.java
+++ b/src/java/com/sun/gluegen/pcpp/PCPP.java
@@ -436,8 +436,10 @@ public class PCPP {
System.err.println("WARNING: \"" + name + "\" redefined from \"" +
oldDef + "\" to \"" + value + "\"");
}
+ debugPrint(true, "#define " + name + " ["+oldDef+" ] -> "+value + " CONST");
//System.out.println("//---DEFINED: " + name + " to \"" + value + "\"");
} else {
+ debugPrint(true, "#define " + name + " -> "+value + " SYMB");
// Value is a symbolic constant like "#define FOO BAR".
// Try to look up the symbol's value
String newValue = resolveDefine(value, true);
@@ -501,15 +503,25 @@ public class PCPP {
}
private boolean checkHex(String s) {
- for (int i = 2; i < s.length(); i++) {
- char c = s.charAt(i);
+ char c='\0';
+ int i;
+ for (i = 2; i < s.length(); i++) {
+ c = s.charAt(i);
if (!((c >= '0' && c <= '9') ||
(c >= 'a' && c <= 'f') ||
(c >= 'A' && c <= 'F'))) {
- return false;
+ break;
}
}
- return true;
+ if(i==s.length()) {
+ return true;
+ } else if(i==s.length()-1) {
+ // Const qualifier ..
+ return c == 'l' || c == 'L' ||
+ c == 'f' || c == 'F' ||
+ c == 'u' || c == 'U' ;
+ }
+ return false;
}
private boolean checkDecimal(String s) {
@@ -553,7 +565,7 @@ public class PCPP {
String symbolName = nextWord();
debugPrint(true, (isIfdef ? "#ifdef " : "#ifndef ") + symbolName);
boolean symbolIsDefined = defineMap.get(symbolName) != null;
- //debugPrint(true, "HANDLE_IFDEF: ifdef(" + symbolName + ") = " + symbolIsDefined );
+ debugPrint(true, (isIfdef ? "#ifdef " : "#ifndef ") + symbolName + "(defined: "+symbolIsDefined+")");
pushEnableBit(enabled() && symbolIsDefined == isIfdef);
}
@@ -808,7 +820,7 @@ public class PCPP {
private void pushEnableBit(boolean enabled) {
enabledBits.add(new Boolean(enabled));
++debugPrintIndentLevel;
- //debugPrint(false, "PUSH_ENABLED, NOW: " + enabled());
+ debugPrint(false, "PUSH_ENABLED, NOW: " + enabled());
}
private void popEnableBit() {
@@ -818,7 +830,7 @@ public class PCPP {
}
enabledBits.remove(enabledBits.size() - 1);
--debugPrintIndentLevel;
- //debugPrint(false, "POP_ENABLED, NOW: " + enabled());
+ debugPrint(false, "POP_ENABLED, NOW: " + enabled());
}
private boolean enabled() {