diff options
author | Sven Gothel <[email protected]> | 2008-07-06 04:56:49 +0000 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2008-07-06 04:56:49 +0000 |
commit | 921b8c98a3447b1930d0cae5428f32da315547da (patch) | |
tree | ca8daa6e3494b607e29cc586ca66af5d7ba1f621 /src/java/com/sun | |
parent | 9df128e4eae30352d2ff440554ef067eef3ca793 (diff) |
Simplifying ForceProcAddressGen and LocalProcAddressCallingConvention,
while adding the generic function name '__ALL__'.
This action applies to all generated functions then,
hence it lowers the maintenance of the gluegen cfg files.
Example:
ForceProcAddressGen __ALL__
LocalProcAddressCallingConvention __ALL__ GL_APIENTRY
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/gluegen/branches/JOGL_2_SANDBOX@97 a78bb65f-1512-4460-ba86-f6dc96a7bf27
Diffstat (limited to 'src/java/com/sun')
4 files changed, 50 insertions, 3 deletions
diff --git a/src/java/com/sun/gluegen/opengl/GLConfiguration.java b/src/java/com/sun/gluegen/opengl/GLConfiguration.java index 4538fae..c99f649 100755 --- a/src/java/com/sun/gluegen/opengl/GLConfiguration.java +++ b/src/java/com/sun/gluegen/opengl/GLConfiguration.java @@ -53,6 +53,7 @@ public class GLConfiguration extends ProcAddressConfiguration { // Maps function names to the kind of buffer object it deals with private Map/*<String,GLEmitter.BufferObjectKind>*/ bufferObjectKinds = new HashMap(); private GLEmitter emitter; + private boolean dropUniqVendorExtensions = false; public GLConfiguration(GLEmitter emitter) { super(); @@ -79,6 +80,10 @@ public class GLConfiguration extends ProcAddressConfiguration { { readBufferObjectKind(tok, filename, lineNo); } + else if (cmd.equalsIgnoreCase("DropUniqVendorExtensions")) + { + dropUniqVendorExtensions = true; + } else { super.dispatch(cmd,tok,file,filename,lineNo); @@ -199,6 +204,10 @@ public class GLConfiguration extends ProcAddressConfiguration { return super.shouldIgnore(symbol); } + public boolean getDropUniqVendorExtensions() { + return dropUniqVendorExtensions; + } + /** Returns the kind of buffer object this function deals with, or null if none. */ public GLEmitter.BufferObjectKind getBufferObjectKind(String name) { diff --git a/src/java/com/sun/gluegen/opengl/GLEmitter.java b/src/java/com/sun/gluegen/opengl/GLEmitter.java index ae4d5ec..66c9ccc 100644 --- a/src/java/com/sun/gluegen/opengl/GLEmitter.java +++ b/src/java/com/sun/gluegen/opengl/GLEmitter.java @@ -331,6 +331,12 @@ public class GLEmitter extends ProcAddressEmitter } protected void validateFunctionsToBind(Set/*FunctionSymbol*/ funcsSet) { + super.validateFunctionsToBind(funcsSet); + + String localCallingConvention = ((GLConfiguration)cfg).getLocalProcAddressCallingConvention4All(); + if(null==localCallingConvention) { + localCallingConvention="GL_APIENTRY"; + } ArrayList newUniFuncs = new ArrayList(); HashSet origFuncNames = new HashSet(); for (Iterator iter = funcsSet.iterator(); iter.hasNext(); ) { @@ -362,7 +368,7 @@ public class GLEmitter extends ProcAddressEmitter ((GLConfiguration)cfg).addForceProcAddressGen(uniName.getUni()); // Make sure we produce the right calling convention for // the typedefed function pointers on Windows - ((GLConfiguration)cfg).addLocalProcAddressCallingConvention(uniName.getUni(), "GL_APIENTRY"); + ((GLConfiguration)cfg).addLocalProcAddressCallingConvention(uniName.getUni(), localCallingConvention); } } } diff --git a/src/java/com/sun/gluegen/procaddress/ProcAddressConfiguration.java b/src/java/com/sun/gluegen/procaddress/ProcAddressConfiguration.java index 7099745..e05fb0a 100755 --- a/src/java/com/sun/gluegen/procaddress/ProcAddressConfiguration.java +++ b/src/java/com/sun/gluegen/procaddress/ProcAddressConfiguration.java @@ -53,12 +53,14 @@ public class ProcAddressConfiguration extends JavaConfiguration private Set/*<String>*/ skipProcAddressGen = new HashSet(); private List/*<String>*/ forceProcAddressGen = new ArrayList(); private Set/*<String>*/ forceProcAddressGenSet = new HashSet(); + private boolean forceProcAddressGen4All=false; 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(); + private String localProcAddressCallingConvention4All=null; protected void dispatch(String cmd, StringTokenizer tok, File file, String filename, int lineNo) throws IOException { if (cmd.equalsIgnoreCase("EmitProcAddressTable")) @@ -81,7 +83,12 @@ public class ProcAddressConfiguration extends JavaConfiguration } else if (cmd.equalsIgnoreCase("ForceProcAddressGen")) { - addForceProcAddressGen( readString("ForceProcAddressGen", tok, filename, lineNo) ); + String funcName = readString("ForceProcAddressGen", tok, filename, lineNo); + if(funcName.equals("__ALL__")) { + forceProcAddressGen4All=true; + } else { + addForceProcAddressGen( readString("ForceProcAddressGen", tok, filename, lineNo) ); + } } else if (cmd.equalsIgnoreCase("GetProcAddressTableExpr")) { @@ -146,7 +153,11 @@ public class ProcAddressConfiguration extends JavaConfiguration try { String functionName = tok.nextToken(); String callingConvention = tok.nextToken(); - localProcAddressCallingConventionMap.put(functionName, callingConvention); + if(functionName.equals("__ALL__")) { + localProcAddressCallingConvention4All=callingConvention; + } else { + localProcAddressCallingConventionMap.put(functionName, callingConvention); + } } catch (NoSuchElementException e) { throw new RuntimeException("Error parsing \"LocalProcAddressCallingConvention\" command at line " + lineNo + " in file \"" + filename + "\"", e); @@ -258,6 +269,7 @@ public class ProcAddressConfiguration extends JavaConfiguration public String tableClassPackage() { return tableClassPackage; } public String tableClassName() { return tableClassName; } public boolean skipProcAddressGen (String name) { return skipProcAddressGen.contains(name); } + public boolean isForceProcAddressGen4All() { return forceProcAddressGen4All; } public List getForceProcAddressGen() { return forceProcAddressGen; } public String getProcAddressTableExpr() { if (getProcAddressTableExpr == null) { @@ -288,4 +300,6 @@ public class ProcAddressConfiguration extends JavaConfiguration public String getLocalProcAddressCallingConvention(String funcName) { return (String) localProcAddressCallingConventionMap.get(funcName); } + public boolean isLocalProcAddressCallingConvention4All() { return localProcAddressCallingConvention4All!=null; } + public String getLocalProcAddressCallingConvention4All() { return localProcAddressCallingConvention4All; } } diff --git a/src/java/com/sun/gluegen/procaddress/ProcAddressEmitter.java b/src/java/com/sun/gluegen/procaddress/ProcAddressEmitter.java index 288ffa9..98340a9 100755 --- a/src/java/com/sun/gluegen/procaddress/ProcAddressEmitter.java +++ b/src/java/com/sun/gluegen/procaddress/ProcAddressEmitter.java @@ -177,6 +177,24 @@ public class ProcAddressEmitter extends JavaEmitter // Internals only below this point // + protected void validateFunctionsToBind(Set/*FunctionSymbol*/ funcsSet) { + if(!((ProcAddressConfiguration)cfg).isForceProcAddressGen4All() && + !((ProcAddressConfiguration)cfg).isLocalProcAddressCallingConvention4All()) { + return; // bail out, nothing todo .. + } + + for (Iterator iter = funcsSet.iterator(); iter.hasNext(); ) { + FunctionSymbol fsOrig = (FunctionSymbol) iter.next(); + if(((ProcAddressConfiguration)cfg).isForceProcAddressGen4All()) { + ((ProcAddressConfiguration)cfg).addForceProcAddressGen(fsOrig.getName()); + } + if(((ProcAddressConfiguration)cfg).isLocalProcAddressCallingConvention4All()) { + ((ProcAddressConfiguration)cfg).addLocalProcAddressCallingConvention(fsOrig.getName(), + ((ProcAddressConfiguration)cfg).getLocalProcAddressCallingConvention4All()); + } + } + } + protected void generateModifiedEmitters(JavaMethodBindingEmitter baseJavaEmitter, List emitters) { if (getConfig().manuallyImplement(baseJavaEmitter.getName())) { // User will provide Java-side implementation of this routine; |