summaryrefslogtreecommitdiffstats
path: root/src/java/com/sun/gluegen
diff options
context:
space:
mode:
authorKenneth Russel <[email protected]>2008-08-08 22:47:18 +0000
committerKenneth Russel <[email protected]>2008-08-08 22:47:18 +0000
commitc4e636dd43da8f327f726a5a508e033197d2ab80 (patch)
tree05ae935b7c495d86edf10f9e936f59b52cec4503 /src/java/com/sun/gluegen
parent07cb91616016c745708c4e7b1e7504f1c4001c95 (diff)
Fixed bug in handling of ignores of ARB extensions caused by
canonicalization of names, which was exposed by trying to ignore WGL_OML_sync_control. Made static uniqNameMap from JavaConfiguration an instance variable and propagated this throughout the code. git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/gluegen/branches/JOGL_2_SANDBOX@107 a78bb65f-1512-4460-ba86-f6dc96a7bf27
Diffstat (limited to 'src/java/com/sun/gluegen')
-rw-r--r--src/java/com/sun/gluegen/JavaConfiguration.java4
-rw-r--r--src/java/com/sun/gluegen/JavaEmitter.java15
-rw-r--r--src/java/com/sun/gluegen/JavaMethodBindingEmitter.java10
-rw-r--r--src/java/com/sun/gluegen/opengl/GLEmitter.java47
4 files changed, 46 insertions, 30 deletions
diff --git a/src/java/com/sun/gluegen/JavaConfiguration.java b/src/java/com/sun/gluegen/JavaConfiguration.java
index f0511b5..dafa131 100644
--- a/src/java/com/sun/gluegen/JavaConfiguration.java
+++ b/src/java/com/sun/gluegen/JavaConfiguration.java
@@ -139,8 +139,8 @@ public class JavaConfiguration {
private Map/*<String,String>*/ javaMethodRenames = new HashMap();
private Map/*<String,List<String>>*/ javaPrologues = new HashMap();
private Map/*<String,List<String>>*/ javaEpilogues = new HashMap();
- protected static Map/*<FuncName>,<UnifiedName>*/ uniqNameMap = new HashMap();
- public static Map/*<UnifiedName>*/ getUniqNameMap() { return uniqNameMap; }
+ protected Map/*<String, UnifiedName>*/ uniqNameMap = new HashMap();
+ public Map/*<String, UnifiedName>*/ getUniqNameMap() { return uniqNameMap; }
/** Reads the configuration file.
diff --git a/src/java/com/sun/gluegen/JavaEmitter.java b/src/java/com/sun/gluegen/JavaEmitter.java
index 313a4dd..0bf9702 100644
--- a/src/java/com/sun/gluegen/JavaEmitter.java
+++ b/src/java/com/sun/gluegen/JavaEmitter.java
@@ -431,7 +431,8 @@ public class JavaEmitter implements GlueEmitter {
false,
false,
isUnimplemented,
- signatureOnly);
+ signatureOnly,
+ cfg);
switch (accessControl) {
case ACC_PUBLIC: emitter.addModifier(JavaMethodBindingEmitter.PUBLIC); break;
case ACC_PROTECTED: emitter.addModifier(JavaMethodBindingEmitter.PROTECTED); break;
@@ -496,7 +497,8 @@ public class JavaEmitter implements GlueEmitter {
true,
false,
false,
- false);
+ false,
+ cfg);
emitter.addModifier(JavaMethodBindingEmitter.PRIVATE);
if (cfg.allStatic()) {
emitter.addModifier(JavaMethodBindingEmitter.STATIC);
@@ -523,7 +525,8 @@ public class JavaEmitter implements GlueEmitter {
false,
true,
false,
- false);
+ false,
+ cfg);
emitter.addModifier(JavaMethodBindingEmitter.PRIVATE);
if (cfg.allStatic()) {
@@ -958,7 +961,8 @@ public class JavaEmitter implements GlueEmitter {
false, // FIXME: should unify this with the general emission code
false, // FIXME: should unify this with the general emission code
false, // FIXME: should unify this with the general emission code
- false);
+ false,
+ cfg);
emitter.addModifier(JavaMethodBindingEmitter.PUBLIC);
emitter.emit();
@@ -976,7 +980,8 @@ public class JavaEmitter implements GlueEmitter {
true, // FIXME: should unify this with the general emission code
false, // FIXME: should unify this with the general emission code
false, // FIXME: should unify this with the general emission code
- false);
+ false,
+ cfg);
emitter.addModifier(JavaMethodBindingEmitter.PRIVATE);
emitter.addModifier(JavaMethodBindingEmitter.NATIVE);
emitter.emit();
diff --git a/src/java/com/sun/gluegen/JavaMethodBindingEmitter.java b/src/java/com/sun/gluegen/JavaMethodBindingEmitter.java
index 0b33110..525ff52 100644
--- a/src/java/com/sun/gluegen/JavaMethodBindingEmitter.java
+++ b/src/java/com/sun/gluegen/JavaMethodBindingEmitter.java
@@ -93,6 +93,9 @@ public class JavaMethodBindingEmitter extends FunctionEmitter
// represent an array of compound type wrappers
private static final String COMPOUND_ARRAY_SUFFIX = "_buf_array_copy";
+ // Only present to provide more clear comments
+ private JavaConfiguration cfg;
+
public JavaMethodBindingEmitter(MethodBinding binding,
PrintWriter output,
String runtimeExceptionType,
@@ -105,7 +108,8 @@ public class JavaMethodBindingEmitter extends FunctionEmitter
boolean forDirectBufferImplementation,
boolean forIndirectBufferAndArrayImplementation,
boolean isUnimplemented,
- boolean isInterface)
+ boolean isInterface,
+ JavaConfiguration configuration)
{
super(output, isInterface);
this.binding = binding;
@@ -124,6 +128,7 @@ public class JavaMethodBindingEmitter extends FunctionEmitter
} else {
setCommentEmitter(defaultInterfaceCommentEmitter);
}
+ cfg = configuration;
}
public JavaMethodBindingEmitter(JavaMethodBindingEmitter arg) {
@@ -142,6 +147,7 @@ public class JavaMethodBindingEmitter extends FunctionEmitter
prologue = arg.prologue;
epilogue = arg.epilogue;
returnedArrayLengthExpression = arg.returnedArrayLengthExpression;
+ cfg = arg.cfg;
}
public final MethodBinding getBinding() { return binding; }
@@ -784,7 +790,7 @@ public class JavaMethodBindingEmitter extends FunctionEmitter
writer.print("Entry point to C language function: ");
}
protected void emitBindingCSignature(MethodBinding binding, PrintWriter writer) {
- UnifiedName uniName = (UnifiedName) JavaConfiguration.getUniqNameMap().get(binding.getCSymbol().getName());
+ UnifiedName uniName = (UnifiedName) cfg.getUniqNameMap().get(binding.getCSymbol().getName());
if(null!=uniName) {
writer.print("- Alias for: <br> <code> ");
writer.print(binding.getCSymbol().getType().toString(uniName.getOrigStringList(", "), tagNativeBinding));
diff --git a/src/java/com/sun/gluegen/opengl/GLEmitter.java b/src/java/com/sun/gluegen/opengl/GLEmitter.java
index 5fbb269..a385d75 100644
--- a/src/java/com/sun/gluegen/opengl/GLEmitter.java
+++ b/src/java/com/sun/gluegen/opengl/GLEmitter.java
@@ -73,7 +73,7 @@ public class GLEmitter extends ProcAddressEmitter
super.beginEmission(controls);
}
- static class DefineEntry implements Cloneable {
+ class DefineEntry implements Cloneable {
public DefineEntry(String namestr, String valuestr, String optionalComment) {
this.name=new GLUnifiedName(namestr);
this.value=getJavaValue(namestr, valuestr);
@@ -140,7 +140,7 @@ public class GLEmitter extends ProcAddressEmitter
name.normalizeVEN();
}
public boolean shouldIgnoreInInterface(GLConfiguration cfg) {
- return GLEmitter.shouldIgnoreInInterface(name, cfg);
+ return GLEmitter.this.shouldIgnoreInInterface(name, cfg);
}
protected GLUnifiedName name;
@@ -150,7 +150,7 @@ public class GLEmitter extends ProcAddressEmitter
protected String optionalComment;
}
- protected static boolean shouldIgnoreInInterface(GLUnifiedName name, GLConfiguration cfg) {
+ protected boolean shouldIgnoreInInterface(GLUnifiedName name, GLConfiguration cfg) {
boolean res = cfg.shouldIgnoreInInterface(name.getUni(), name.isUnique());
if(JavaConfiguration.DEBUG_IGNORES) {
if(res) {
@@ -169,7 +169,7 @@ public class GLEmitter extends ProcAddressEmitter
return res;
}
- protected static boolean shouldIgnoreInImpl(GLUnifiedName name, GLConfiguration cfg) {
+ protected boolean shouldIgnoreInImpl(GLUnifiedName name, GLConfiguration cfg) {
boolean res = cfg.shouldIgnoreInImpl(name.getUni(), name.isUnique());
if(JavaConfiguration.DEBUG_IGNORES) {
if(res) {
@@ -393,24 +393,29 @@ public class GLEmitter extends ProcAddressEmitter
if(GLExtensionNames.isExtensionARB(fname, true)) {
if(!((GLConfiguration)cfg).skipProcAddressGen(fname)) {
- FunctionSymbol fsUni = new FunctionSymbol(uniName.getUni(), fsOrig.getType());
- if(!funcsSet.contains(fsUni)) {
- newUniFuncs.add(fsUni); // add new uni name
- System.err.println("INFO: New ARB Normalized Function:"+
- "\n\tARB: "+fsOrig+
- "\n\tUNI: "+fsUni);
- } else {
- System.err.println("INFO: Dub ARB Normalized Function:"+
- "\n\tARB: "+fsOrig+
- "\n\tDUB: "+fsUni);
- }
+ // Do not process ignored functions with this logic
+ // because if we do then we will not be able to later
+ // tell that the function should be ignored
+ if (!((GLConfiguration)cfg).shouldIgnoreInImpl(fname)) {
+ FunctionSymbol fsUni = new FunctionSymbol(uniName.getUni(), fsOrig.getType());
+ if(!funcsSet.contains(fsUni)) {
+ newUniFuncs.add(fsUni); // add new uni name
+ System.err.println("INFO: New ARB Normalized Function:"+
+ "\n\tARB: "+fsOrig+
+ "\n\tUNI: "+fsUni);
+ } else {
+ System.err.println("INFO: Dub ARB Normalized Function:"+
+ "\n\tARB: "+fsOrig+
+ "\n\tDUB: "+fsUni);
+ }
- iter.remove(); // remove ARB function
- // make the function being dynamical fetched, due to it's dynamic naming scheme
- ((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(), localCallingConvention);
+ iter.remove(); // remove ARB function
+ // make the function being dynamical fetched, due to it's dynamic naming scheme
+ ((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(), localCallingConvention);
+ }
}
}
if(JavaConfiguration.DEBUG_IGNORES) {