summaryrefslogtreecommitdiffstats
path: root/src/java/com/sun/gluegen/procaddress/ProcAddressEmitter.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/java/com/sun/gluegen/procaddress/ProcAddressEmitter.java')
-rwxr-xr-xsrc/java/com/sun/gluegen/procaddress/ProcAddressEmitter.java17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/java/com/sun/gluegen/procaddress/ProcAddressEmitter.java b/src/java/com/sun/gluegen/procaddress/ProcAddressEmitter.java
index 75fb59c..19d4fe3 100755
--- a/src/java/com/sun/gluegen/procaddress/ProcAddressEmitter.java
+++ b/src/java/com/sun/gluegen/procaddress/ProcAddressEmitter.java
@@ -58,6 +58,7 @@ public class ProcAddressEmitter extends JavaEmitter
protected static final String WRAP_PREFIX = "dispatch_";
private TypeDictionary typedefDictionary;
private PrintWriter tableWriter;
+ private Set emittedTableEntries;
private String tableClassPackage;
private String tableClassName;
@@ -219,6 +220,7 @@ public class ProcAddressEmitter extends JavaEmitter
{
// See whether we need a proc address entry for this one
boolean callThroughProcAddress = needsProcAddressWrapper(baseCEmitter.getBinding().getCSymbol());
+ boolean forceProcAddress = getProcAddressConfig().forceProcAddressGen(baseCEmitter.getBinding().getCSymbol().getName());
// Note that we don't care much about the naming of the C argument
// variables so to keep things simple we ignore the buffer object
// property for the binding
@@ -226,7 +228,10 @@ public class ProcAddressEmitter extends JavaEmitter
// The C-side JNI binding for this particular function will have an
// extra final argument, which is the address (the OpenGL procedure
// address) of the function it needs to call
- ProcAddressCMethodBindingEmitter res = new ProcAddressCMethodBindingEmitter(baseCEmitter, callThroughProcAddress, this);
+ ProcAddressCMethodBindingEmitter res = new ProcAddressCMethodBindingEmitter(baseCEmitter,
+ callThroughProcAddress,
+ forceProcAddress,
+ this);
MessageFormat exp = baseCEmitter.getReturnValueCapacityExpression();
if (exp != null) {
res.setReturnValueCapacityExpression(exp);
@@ -250,6 +255,10 @@ public class ProcAddressEmitter extends JavaEmitter
shouldWrap = false;
}
+ if (config.forceProcAddressGen(symName)) {
+ shouldWrap = true;
+ }
+
if (shouldWrap)
{
// Hoist argument names from function pointer if not supplied in prototype
@@ -281,6 +290,7 @@ public class ProcAddressEmitter extends JavaEmitter
CodeGenUtils.packageAsPath(implPackageName);
tableWriter = openFile(jImplRoot + File.separator + tableClassName + ".java");
+ emittedTableEntries = new HashSet();
CodeGenUtils.emitAutogeneratedWarning(tableWriter, this);
@@ -358,6 +368,11 @@ public class ProcAddressEmitter extends JavaEmitter
protected void emitProcAddressTableEntryForString(String str)
{
+ // Deal gracefully with forced proc address generation in the face
+ // of having the function pointer typedef in the header file too
+ if (emittedTableEntries.contains(str))
+ return;
+ emittedTableEntries.add(str);
tableWriter.print(" public long ");
tableWriter.print(PROCADDRESS_VAR_PREFIX);
tableWriter.print(str);