diff options
author | Sven Gothel <[email protected]> | 2015-03-05 08:14:19 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2015-03-05 08:14:19 +0100 |
commit | ea6df88075c44f6b6317920119d6b33d5d97b362 (patch) | |
tree | 099a24d889dfe5c0525e43541e1c297f3cbba9f8 | |
parent | 72d3635279ffc8ad88e47dff9bbe95d211226d11 (diff) |
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!
4 files changed, 24 insertions, 4 deletions
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. * <p> + * Inclusive {@link #getOrigName() original-name}, if {@link #rename(String) renamed}, + * </p> + * <p> * Exclusive {@link #getName() current-name}. * </p> * <p> @@ -71,8 +74,12 @@ public interface AliasedSymbol { */ Set<String> 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<String> aliasedNames; private String name; public AliasedSymbolImpl(final String origName) { + this.origName = origName; this.aliasedNames=new HashSet<String>(); 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;} <i>even</i> 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); |