aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/com/sun/gluegen
diff options
context:
space:
mode:
authorMichael Bien <[email protected]>2010-04-24 18:13:36 +0200
committerMichael Bien <[email protected]>2010-04-24 18:13:36 +0200
commit64b0148972c410a8f76c5f55ed866060886849a7 (patch)
tree2c4b83305268df4a1c9a2d4556c3bf1cb21ed6d2 /src/java/com/sun/gluegen
parent734a341e4703870dc5d562099bd267aa41e850f2 (diff)
Refactored ProcAddressTable generation.
- ProcAddressTable is now the common superclass for all tables - Removed ProcAddressHelpers and added FunctionAddressResolver extension mechanism
Diffstat (limited to 'src/java/com/sun/gluegen')
-rw-r--r--src/java/com/sun/gluegen/opengl/GLEmitter.java10
-rwxr-xr-xsrc/java/com/sun/gluegen/procaddress/ProcAddressEmitter.java15
2 files changed, 16 insertions, 9 deletions
diff --git a/src/java/com/sun/gluegen/opengl/GLEmitter.java b/src/java/com/sun/gluegen/opengl/GLEmitter.java
index 006287e..b5df6ff 100644
--- a/src/java/com/sun/gluegen/opengl/GLEmitter.java
+++ b/src/java/com/sun/gluegen/opengl/GLEmitter.java
@@ -419,17 +419,17 @@ public class GLEmitter extends ProcAddressEmitter {
w.println(" * it was statically linked.");
w.println(" */");
w.println(" public long getAddressFor(String functionNameUsr) {");
- w.println(" String functionNameBase = com.jogamp.gluegen.runtime.opengl.GLExtensionNames.normalizeVEN(com.jogamp.gluegen.runtime.opengl.GLExtensionNames.normalizeARB(functionNameUsr, true), true);");
- w.println(" String addressFieldNameBase = " + getProcAddressConfig().gluegenRuntimePackage() + ".ProcAddressHelper.PROCADDRESS_VAR_PREFIX + functionNameBase;");
+ w.println(" String functionNameBase = "+GLExtensionNames.class.getName()+".normalizeVEN(com.jogamp.gluegen.runtime.opengl.GLExtensionNames.normalizeARB(functionNameUsr, true), true);");
+ w.println(" String addressFieldNameBase = PROCADDRESS_VAR_PREFIX + functionNameBase;");
w.println(" java.lang.reflect.Field addressField = null;");
- w.println(" int funcNamePermNum = com.jogamp.gluegen.runtime.opengl.GLExtensionNames.getFuncNamePermutationNumber(functionNameBase);");
+ w.println(" int funcNamePermNum = "+GLExtensionNames.class.getName()+".getFuncNamePermutationNumber(functionNameBase);");
w.println(" for(int i = 0; null==addressField && i < funcNamePermNum; i++) {");
- w.println(" String addressFieldName = com.jogamp.gluegen.runtime.opengl.GLExtensionNames.getFuncNamePermutation(addressFieldNameBase, i);");
+ w.println(" String addressFieldName = "+GLExtensionNames.class.getName()+".getFuncNamePermutation(addressFieldNameBase, i);");
w.println(" try {");
w.println(" addressField = getClass().getField(addressFieldName);");
w.println(" } catch (Exception e) { }");
w.println(" }");
- w.println("");
+ w.println();
w.println(" if(null==addressField) {");
w.println(" // The user is calling a bogus function or one which is not");
w.println(" // runtime linked");
diff --git a/src/java/com/sun/gluegen/procaddress/ProcAddressEmitter.java b/src/java/com/sun/gluegen/procaddress/ProcAddressEmitter.java
index c49e239..aa71495 100755
--- a/src/java/com/sun/gluegen/procaddress/ProcAddressEmitter.java
+++ b/src/java/com/sun/gluegen/procaddress/ProcAddressEmitter.java
@@ -52,7 +52,7 @@ import com.jogamp.gluegen.runtime.*;
*/
public class ProcAddressEmitter extends JavaEmitter {
- public static final String PROCADDRESS_VAR_PREFIX = ProcAddressHelper.PROCADDRESS_VAR_PREFIX;
+ public static final String PROCADDRESS_VAR_PREFIX = ProcAddressTable.PROCADDRESS_VAR_PREFIX;
protected static final String WRAP_PREFIX = "dispatch_";
private TypeDictionary typedefDictionary;
protected PrintWriter tableWriter;
@@ -320,12 +320,19 @@ public class ProcAddressEmitter extends JavaEmitter {
tableWriter.println(" * pointer is 0, the function is considered to be unavailable and can");
tableWriter.println(" * not be called.");
tableWriter.println(" */");
- tableWriter.println("public class " + tableClassName + " implements com.jogamp.gluegen.runtime.ProcAddressTable");
- tableWriter.println("{");
+ tableWriter.println("public class " + tableClassName + " extends "+ ProcAddressTable.class.getName() + " {");
+ tableWriter.println();
for (String string : getProcAddressConfig().getForceProcAddressGen()) {
emitProcAddressTableEntryForString(string);
}
+
+ tableWriter.println();
+ tableWriter.println(" public "+tableClassName+"(){ super(); }");
+ tableWriter.println();
+ tableWriter.println(" public "+tableClassName+"("+FunctionAddressResolver.class.getName()+" resolver){ super(resolver); }");
+ tableWriter.println();
+
}
protected void endProcAddressTable() throws Exception {
@@ -345,7 +352,7 @@ public class ProcAddressEmitter extends JavaEmitter {
w.println(" * it was statically linked.");
w.println(" */");
w.println(" public long getAddressFor(String functionName) {");
- w.println(" String addressFieldName = " + getProcAddressConfig().gluegenRuntimePackage() + ".ProcAddressHelper.PROCADDRESS_VAR_PREFIX + functionName;");
+ w.println(" String addressFieldName = PROCADDRESS_VAR_PREFIX + functionName;");
w.println(" try { ");
w.println(" java.lang.reflect.Field addressField = getClass().getField(addressFieldName);");
w.println(" return addressField.getLong(this);");