diff options
author | Michael Bien <[email protected]> | 2009-08-08 21:46:55 +0200 |
---|---|---|
committer | Michael Bien <[email protected]> | 2009-08-08 21:46:55 +0200 |
commit | 889b9574958b04988ab3acbabab109745fbc379a (patch) | |
tree | 5f3485268de0f59f113c9d524561fc49b50ad75f /src/java/com/sun/gluegen/JavaConfiguration.java | |
parent | a07c223b8dbde8f81886b7b2bf602e26ab9531b3 (diff) | |
parent | 5f8e46324f245c99080d2c340cd4fb2ec9c4fa8d (diff) |
Merge branch 'master' of ssh://[email protected]/gluegen~gluegen-git
Diffstat (limited to 'src/java/com/sun/gluegen/JavaConfiguration.java')
-rw-r--r-- | src/java/com/sun/gluegen/JavaConfiguration.java | 46 |
1 files changed, 28 insertions, 18 deletions
diff --git a/src/java/com/sun/gluegen/JavaConfiguration.java b/src/java/com/sun/gluegen/JavaConfiguration.java index 5693150..636cef8 100644 --- a/src/java/com/sun/gluegen/JavaConfiguration.java +++ b/src/java/com/sun/gluegen/JavaConfiguration.java @@ -117,8 +117,8 @@ public class JavaConfiguration { * converted to String args; value is List of Integer argument indices */ private Map/*<String,List<Integer>>*/ argumentsAreString = new HashMap(); - private Set/*<String>*/ extendedIntfSymbols = new HashSet(); - private boolean extendedIntfSymbolsOnly=false; + private Set/*<String>*/ extendedIntfSymbolsIgnore = new HashSet(); + private Set/*<String>*/ extendedIntfSymbolsOnly = new HashSet(); private Set/*<Pattern>*/ ignores = new HashSet(); private Map/*<String,Pattern>*/ ignoreMap = new HashMap(); private Set/*<Pattern>*/ ignoreNots = new HashSet(); @@ -577,10 +577,6 @@ public class JavaConfiguration { return (String) parentClass.get(className); } - public boolean extendedIntfSymbolsOnly() { - return extendedIntfSymbolsOnly; - } - public static final boolean DEBUG_IGNORES = false; public static boolean dumpedIgnores = false; @@ -593,7 +589,7 @@ public class JavaConfiguration { public void dumpIgnores() { System.err.println("Extended Intf: "); - for (Iterator iter = extendedIntfSymbols.iterator(); iter.hasNext(); ) { + for (Iterator iter = extendedIntfSymbolsIgnore.iterator(); iter.hasNext(); ) { System.err.println("\t"+(String)iter.next()); } System.err.println("Ignores (All): "); @@ -602,14 +598,23 @@ public class JavaConfiguration { } } + public void dumpRenames() { + System.err.println("Symbol Renames: "); + for (Iterator iter = javaSymbolRenames.keySet().iterator(); iter.hasNext(); ) { + String key = (String)iter.next(); + System.err.println("\t"+key+" -> "+javaSymbolRenames.get(key)); + } + } + /** Returns true if this #define, function, struct, or field within a struct should be ignored during glue code generation. */ public boolean shouldIgnoreInInterface(String symbol) { if(DEBUG_IGNORES) { dumpIgnoresOnce(); } - // Simple case; the entire symbol is in the interface ignore table. - if (extendedIntfSymbols.contains(symbol)) { + // Simple case; the entire symbol (orig or renamed) is in the interface ignore table + if (extendedIntfSymbolsIgnore.contains(symbol) || + extendedIntfSymbolsIgnore.contains(getJavaSymbolRename(symbol))) { if(DEBUG_IGNORES) { System.err.println("Ignore Intf: "+symbol); } @@ -628,8 +633,9 @@ public class JavaConfiguration { dumpIgnoresOnce(); } - if (extendedIntfSymbolsOnly) { - if(!extendedIntfSymbols.contains(symbol)) { + if (!extendedIntfSymbolsOnly.isEmpty()) { + if(!extendedIntfSymbolsOnly.contains(symbol) && + !extendedIntfSymbolsOnly.contains(getJavaSymbolRename(symbol))) { if(DEBUG_IGNORES) { System.err.println("Ignore Impl !extended: " + symbol); } @@ -849,11 +855,10 @@ public class JavaConfiguration { // because ReturnedArrayLength changes them. } else if (cmd.equalsIgnoreCase("ArgumentIsString")) { readArgumentIsString(tok, filename, lineNo); - } else if (cmd.equalsIgnoreCase("ExtendedInterfaceSymbols")) { - readExtendedInterfaceSymbols(tok, filename, lineNo); + } else if (cmd.equalsIgnoreCase("ExtendedInterfaceSymbolsIgnore")) { + readExtendedInterfaceSymbols(tok, filename, lineNo, false); } else if (cmd.equalsIgnoreCase("ExtendedInterfaceSymbolsOnly")) { - extendedIntfSymbolsOnly=true; - readExtendedInterfaceSymbols(tok, filename, lineNo); + readExtendedInterfaceSymbols(tok, filename, lineNo, true); } else if (cmd.equalsIgnoreCase("Ignore")) { readIgnore(tok, filename, lineNo); } else if (cmd.equalsIgnoreCase("Unignore")) { @@ -1056,7 +1061,7 @@ public class JavaConfiguration { } } - protected void readExtendedInterfaceSymbols(StringTokenizer tok, String filename, int lineNo) { + protected void readExtendedInterfaceSymbols(StringTokenizer tok, String filename, int lineNo, boolean onlyList) { File javaFile; BufferedReader javaReader; try { @@ -1080,8 +1085,13 @@ public class JavaConfiguration { return; } - extendedIntfSymbols.addAll(parser.getParsedEnumNames()); - extendedIntfSymbols.addAll(parser.getParsedFunctionNames()); + if(onlyList) { + extendedIntfSymbolsOnly.addAll(parser.getParsedEnumNames()); + extendedIntfSymbolsOnly.addAll(parser.getParsedFunctionNames()); + } else { + extendedIntfSymbolsIgnore.addAll(parser.getParsedEnumNames()); + extendedIntfSymbolsIgnore.addAll(parser.getParsedFunctionNames()); + } } protected void readIgnore(StringTokenizer tok, String filename, int lineNo) { |