aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/com/sun/gluegen/procaddress/ProcAddressConfiguration.java
diff options
context:
space:
mode:
authorKenneth Russel <[email protected]>2008-07-06 01:03:35 +0000
committerKenneth Russel <[email protected]>2008-07-06 01:03:35 +0000
commit9df128e4eae30352d2ff440554ef067eef3ca793 (patch)
tree6e5b65a30e81998c5e76bf81a75314c4c6adae15 /src/java/com/sun/gluegen/procaddress/ProcAddressConfiguration.java
parent649888422631e3bec8fa0f60afa99bc690992d71 (diff)
Fixed Windows-specific problem with locally generated function pointer
typedefs where the calling convention was not specified. Provided new LocalProcAddressCallingConvention directive to allow developer to specify the calling convention on a per-function basis; used this in gl-es1.cfg and gl-es2.cfg. Changed GLEmitter to force the calling convention of the locally typedefed function pointers for OpenGL function name unification to GL_APIENTRY, compatible with OpenGL ES 1 and OpenGL ES 2. Changed generated native glue code to #define GL_APIENTRY appropriately on the desktop. Refactored custom C code. git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/gluegen/branches/JOGL_2_SANDBOX@96 a78bb65f-1512-4460-ba86-f6dc96a7bf27
Diffstat (limited to 'src/java/com/sun/gluegen/procaddress/ProcAddressConfiguration.java')
-rwxr-xr-xsrc/java/com/sun/gluegen/procaddress/ProcAddressConfiguration.java27
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);
+ }
}