diff options
Diffstat (limited to 'src/java/com/sun/gluegen/procaddress/ProcAddressConfiguration.java')
-rwxr-xr-x | src/java/com/sun/gluegen/procaddress/ProcAddressConfiguration.java | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/java/com/sun/gluegen/procaddress/ProcAddressConfiguration.java b/src/java/com/sun/gluegen/procaddress/ProcAddressConfiguration.java index de4000c..7099745 100755 --- a/src/java/com/sun/gluegen/procaddress/ProcAddressConfiguration.java +++ b/src/java/com/sun/gluegen/procaddress/ProcAddressConfiguration.java @@ -55,6 +55,10 @@ public class ProcAddressConfiguration extends JavaConfiguration private Set/*<String>*/ forceProcAddressGenSet = new HashSet(); private String getProcAddressTableExpr; private ConvNode procAddressNameConverter; + // This is needed only on Windows. Ideally we would modify the + // HeaderParser and PCPP to automatically pick up the calling + // convention from the headers + private Map/*<String,String>*/ localProcAddressCallingConventionMap = new HashMap(); protected void dispatch(String cmd, StringTokenizer tok, File file, String filename, int lineNo) throws IOException { if (cmd.equalsIgnoreCase("EmitProcAddressTable")) @@ -87,6 +91,10 @@ public class ProcAddressConfiguration extends JavaConfiguration { readProcAddressNameExpr(tok, filename, lineNo); } + else if (cmd.equalsIgnoreCase("LocalProcAddressCallingConvention")) + { + readLocalProcAddressCallingConvention(tok, filename, lineNo); + } else { super.dispatch(cmd,tok,file,filename,lineNo); @@ -134,6 +142,17 @@ public class ProcAddressConfiguration extends JavaConfiguration } } + protected void readLocalProcAddressCallingConvention(StringTokenizer tok, String filename, int lineNo) throws IOException { + try { + String functionName = tok.nextToken(); + String callingConvention = tok.nextToken(); + localProcAddressCallingConventionMap.put(functionName, callingConvention); + } catch (NoSuchElementException e) { + throw new RuntimeException("Error parsing \"LocalProcAddressCallingConvention\" command at line " + lineNo + + " in file \"" + filename + "\"", e); + } + } + private static ConvNode makeConverter(Iterator/*<String>*/ iter) { List/*<ConvNode>*/ result = new ArrayList/*<ConvNode>*/(); while (iter.hasNext()) { @@ -261,4 +280,12 @@ public class ProcAddressConfiguration extends JavaConfiguration forceProcAddressGen.add(funcName); forceProcAddressGenSet.add(funcName); } + + public void addLocalProcAddressCallingConvention(String funcName, String callingConvention) { + localProcAddressCallingConventionMap.put(funcName, callingConvention); + } + + public String getLocalProcAddressCallingConvention(String funcName) { + return (String) localProcAddressCallingConventionMap.get(funcName); + } } |