From ea6df88075c44f6b6317920119d6b33d5d97b362 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 5 Mar 2015 08:14:19 +0100 Subject: Bug 1134 - Fix regression: Static C-Function call must use original API name - Regression of commit 72d3635279ffc8ad88e47dff9bbe95d211226d11 CMethodBindingEmitter emits statically linked function calls, hence needs to use the original name of AliasedSymbol. AliasedSymbol: Add 'getOrigName()' at creation! --- .../com/jogamp/gluegen/CMethodBindingEmitter.java | 2 +- .../com/jogamp/gluegen/cgram/types/AliasedSymbol.java | 19 ++++++++++++++++++- .../com/jogamp/gluegen/cgram/types/CompoundType.java | 5 ++++- .../procaddress/ProcAddressCMethodBindingEmitter.java | 2 +- 4 files changed, 24 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/java/com/jogamp/gluegen/CMethodBindingEmitter.java b/src/java/com/jogamp/gluegen/CMethodBindingEmitter.java index 734f536..1b1f2fa 100644 --- a/src/java/com/jogamp/gluegen/CMethodBindingEmitter.java +++ b/src/java/com/jogamp/gluegen/CMethodBindingEmitter.java @@ -989,7 +989,7 @@ public class CMethodBindingEmitter extends FunctionEmitter { // Call through function pointer writer.print(CMethodBindingEmitter.cThisArgumentName() + "->"); } - writer.print(binding.getCSymbol().getName()); + writer.print(binding.getCSymbol().getOrigName()); // use original API name writer.print("("); emitBodyPassCArguments(writer); writer.println(");"); diff --git a/src/java/com/jogamp/gluegen/cgram/types/AliasedSymbol.java b/src/java/com/jogamp/gluegen/cgram/types/AliasedSymbol.java index a924876..18477c1 100644 --- a/src/java/com/jogamp/gluegen/cgram/types/AliasedSymbol.java +++ b/src/java/com/jogamp/gluegen/cgram/types/AliasedSymbol.java @@ -63,6 +63,9 @@ public interface AliasedSymbol { /** * Return all aliases for this symbol, i.e. original names, for this symbol. *

+ * Inclusive {@link #getOrigName() original-name}, if {@link #rename(String) renamed}, + *

+ *

* Exclusive {@link #getName() current-name}. *

*

@@ -70,9 +73,13 @@ public interface AliasedSymbol { *

*/ Set getAliasedNames(); + /** + * Return the original-name as set at creation. + */ + String getOrigName(); /** * Return the current-name, which is the last {@link #rename(String) renamed-name} if issued, - * or the original-name. + * or the {@link #getOrigName() original-name}. */ String getName(); /** @@ -82,10 +89,12 @@ public interface AliasedSymbol { String getAliasedString(); public static class AliasedSymbolImpl implements AliasedSymbol { + private final String origName; private final HashSet aliasedNames; private String name; public AliasedSymbolImpl(final String origName) { + this.origName = origName; this.aliasedNames=new HashSet(); this.name = origName; } @@ -112,6 +121,10 @@ public interface AliasedSymbol { return aliasedNames; } @Override + public String getOrigName() { + return origName; + } + @Override public String getName() { return name; } @@ -143,6 +156,10 @@ public interface AliasedSymbol { return null; } @Override + public String getOrigName() { + return name; + } + @Override public String getName() { return name; } diff --git a/src/java/com/jogamp/gluegen/cgram/types/CompoundType.java b/src/java/com/jogamp/gluegen/cgram/types/CompoundType.java index c3aca40..c9c4223 100644 --- a/src/java/com/jogamp/gluegen/cgram/types/CompoundType.java +++ b/src/java/com/jogamp/gluegen/cgram/types/CompoundType.java @@ -84,7 +84,10 @@ public abstract class CompoundType extends MemoryLayoutType implements Cloneable public String getAliasedString() { return toString(); } - + @Override + public String getOrigName() { + return getName(); + } /** * @param structName struct name of this CompoundType, i.e. the "foo" in the construct {@code struct foo { int a, ... };} or {@code struct foo;} even for anonymous structs. diff --git a/src/java/com/jogamp/gluegen/procaddress/ProcAddressCMethodBindingEmitter.java b/src/java/com/jogamp/gluegen/procaddress/ProcAddressCMethodBindingEmitter.java index abbe521..81aa96b 100644 --- a/src/java/com/jogamp/gluegen/procaddress/ProcAddressCMethodBindingEmitter.java +++ b/src/java/com/jogamp/gluegen/procaddress/ProcAddressCMethodBindingEmitter.java @@ -198,7 +198,7 @@ public class ProcAddressCMethodBindingEmitter extends CMethodBindingEmitter { // call throught the run-time function pointer writer.print("(* ptr_"); - writer.print(mBinding.getCSymbol().getName()); + writer.print(mBinding.getCSymbol().getName()); // use renamed base-name writer.print(") "); writer.print("("); emitBodyPassCArguments(writer); -- cgit v1.2.3