diff options
Diffstat (limited to 'src/java/com/jogamp/gluegen/procaddress')
3 files changed, 19 insertions, 26 deletions
diff --git a/src/java/com/jogamp/gluegen/procaddress/ProcAddressCMethodBindingEmitter.java b/src/java/com/jogamp/gluegen/procaddress/ProcAddressCMethodBindingEmitter.java index 57a50cc..37a39e1 100644 --- a/src/java/com/jogamp/gluegen/procaddress/ProcAddressCMethodBindingEmitter.java +++ b/src/java/com/jogamp/gluegen/procaddress/ProcAddressCMethodBindingEmitter.java @@ -66,11 +66,11 @@ public class ProcAddressCMethodBindingEmitter extends CMethodBindingEmitter { super( new MethodBinding(methodToWrap.getBinding()) { @Override - public String getName() { + public String getImplName() { if (callThroughProcAddress) { - return ProcAddressEmitter.WRAP_PREFIX + super.getName(); + return ProcAddressEmitter.WRAP_PREFIX + super.getImplName(); } else { - return super.getName(); + return super.getImplName(); } } }, @@ -121,7 +121,7 @@ public class ProcAddressCMethodBindingEmitter extends CMethodBindingEmitter { if (callThroughProcAddress) { // create variable for the function pointer with the right type, and set // it to the value of the passed-in proc address - final FunctionSymbol cSym = getBinding().getCSymbol(); + final FunctionSymbol cSym = binding.getCSymbol(); // Always emit the local typedef, based on our parsing results. // In case we do have the public typedef from the original header, @@ -145,7 +145,7 @@ public class ProcAddressCMethodBindingEmitter extends CMethodBindingEmitter { writer.print(" "); writer.print(funcPointerTypedefName); // Uses public typedef if available! writer.print(" ptr_"); - writer.print(cSym.getName()); + writer.print(getNativeName()); writer.println(";"); } @@ -158,10 +158,8 @@ public class ProcAddressCMethodBindingEmitter extends CMethodBindingEmitter { if (callThroughProcAddress) { // set the function pointer to the value of the passed-in procAddress - final FunctionSymbol cSym = getBinding().getCSymbol(); - // See above notes in emitBodyVariableDeclarations(..)! - final String funcPointerTypedefBaseName = emitter.getFunctionPointerTypedefName(cSym); + final String funcPointerTypedefBaseName = emitter.getFunctionPointerTypedefName(binding.getCSymbol()); final String funcPointerTypedefLocalName = "_local_" + funcPointerTypedefBaseName; final String funcPointerTypedefName; if (hasProcAddrTypedef) { @@ -170,7 +168,7 @@ public class ProcAddressCMethodBindingEmitter extends CMethodBindingEmitter { funcPointerTypedefName = funcPointerTypedefLocalName; } - final String ptrVarName = "ptr_" + cSym.getName(); + final String ptrVarName = "ptr_" + getNativeName(); if (hasProcAddrTypedef) { writer.println(" // implicit type validation of "+funcPointerTypedefLocalName+" -> "+funcPointerTypedefName); @@ -214,7 +212,7 @@ public class ProcAddressCMethodBindingEmitter extends CMethodBindingEmitter { // call throught the run-time function pointer writer.print("(* ptr_"); - writer.print(mBinding.getCSymbol().getName()); // use renamed base-name + writer.print(getNativeName()); writer.print(") "); writer.print("("); emitBodyPassCArguments(writer); diff --git a/src/java/com/jogamp/gluegen/procaddress/ProcAddressEmitter.java b/src/java/com/jogamp/gluegen/procaddress/ProcAddressEmitter.java index 6418a53..25e5a66 100644 --- a/src/java/com/jogamp/gluegen/procaddress/ProcAddressEmitter.java +++ b/src/java/com/jogamp/gluegen/procaddress/ProcAddressEmitter.java @@ -204,16 +204,10 @@ public class ProcAddressEmitter extends JavaEmitter { // If this emitter doesn't have a body (i.e., is a direct native // call with no intervening argument processing), we need to force - // it to emit a body, and produce another one to act as the entry - // point - // FIXME: the negative test against the PRIVATE modifier is a - // nasty hack to prevent the ProcAddressJavaMethodBindingEmitter - // from incorrectly introducing method bodies to the private - // native implementing methods; want this to work at least for - // public and package-private methods + // it to emit a body, and produce another one to act as the entry point final boolean needsJavaWrapper = baseJavaEmitter.signatureOnly() && - !baseJavaEmitter.hasModifier(JavaMethodBindingEmitter.PRIVATE) && - baseJavaEmitter.hasModifier(JavaMethodBindingEmitter.NATIVE) && + baseJavaEmitter.isNativeMethod() && + !baseJavaEmitter.isPrivateNativeMethod() && callThroughProcAddress; @@ -221,7 +215,7 @@ public class ProcAddressEmitter extends JavaEmitter { final ProcAddressJavaMethodBindingEmitter emitter = new ProcAddressJavaMethodBindingEmitter(baseJavaEmitter, callThroughProcAddress, getProcAddressConfig().getProcAddressTableExpr(), - baseJavaEmitter.isForNativeMethod(), + baseJavaEmitter.isPrivateNativeMethod(), this); if( needsJavaWrapper ) { emitter.setEmitBody(true); @@ -238,7 +232,7 @@ public class ProcAddressEmitter extends JavaEmitter { getProcAddressConfig().getProcAddressTableExpr(), true, this); - emitter.setForImplementingMethodCall(true); + emitter.setPrivateNativeMethod(true); fixSecurityModifiers(emitter); emitters.add(emitter); } diff --git a/src/java/com/jogamp/gluegen/procaddress/ProcAddressJavaMethodBindingEmitter.java b/src/java/com/jogamp/gluegen/procaddress/ProcAddressJavaMethodBindingEmitter.java index f3cc8e9..3faf155 100644 --- a/src/java/com/jogamp/gluegen/procaddress/ProcAddressJavaMethodBindingEmitter.java +++ b/src/java/com/jogamp/gluegen/procaddress/ProcAddressJavaMethodBindingEmitter.java @@ -41,6 +41,7 @@ package com.jogamp.gluegen.procaddress; import com.jogamp.gluegen.MethodBinding; import com.jogamp.gluegen.FunctionEmitter; import com.jogamp.gluegen.JavaMethodBindingEmitter; + import java.io.*; /** A specialization of JavaMethodBindingEmitter with knowledge of how @@ -76,12 +77,12 @@ public class ProcAddressJavaMethodBindingEmitter extends JavaMethodBindingEmitte public ProcAddressJavaMethodBindingEmitter(final ProcAddressJavaMethodBindingEmitter methodToWrap) { this(methodToWrap, methodToWrap.callThroughProcAddress, methodToWrap.getProcAddressTableExpr, - methodToWrap.changeNameAndArguments, methodToWrap.emitter); + methodToWrap.changeNameAndArguments, methodToWrap.emitter); } @Override - public String getName() { - final String res = super.getName(); + public String getImplName() { + final String res = super.getImplName(); if (changeNameAndArguments) { return ProcAddressEmitter.WRAP_PREFIX + res; } @@ -106,8 +107,8 @@ public class ProcAddressJavaMethodBindingEmitter extends JavaMethodBindingEmitte } @Override - protected String getNativeMethodName() { - final String name = super.getNativeMethodName(); + protected String getNativeImplMethodName() { + final String name = super.getNativeImplMethodName(); if (callThroughProcAddress) { return ProcAddressEmitter.WRAP_PREFIX + name; } |