diff options
author | Sven Gothel <[email protected]> | 2015-03-11 08:48:36 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2015-03-11 08:48:36 +0100 |
commit | 405512e1c8a2e24834b0d057f0b020b4a0f4c25b (patch) | |
tree | ea933c02fa486c034f8d490ddc59a2afd95a4d3e /src/junit/com/jogamp | |
parent | f664f7e950ff60d73e488801cf7f37878588203d (diff) |
Bug 1144 - Add 'DelegateImplementation', manually impl. may delegate to renamed original
'DelegateImplementation' is a variation of 'ManuallyImplement'.
'ManuallyImplement' emits the interface method, but suppresses
the Java and native-code implementation.
The latter shall be implemented manually by the user.
'DelegateImplementation' emits the interface method,
and the _private_ renamed Java and native-code implementation.
Both can be called from the manual user implementation,
hence delegation.
Configuration:
DelegateImplementation <ORIG-SYMBOL> <RENAMED-IMPL-SYMBOL>
I.e. delegation model shall apply to <ORIG-SYMBOL>
and the Java and native-code implementation renamed to <RENAMED-IMPL-SYMBOL>.
The user manual implementation of <ORIG-SYMBOL>
may delegate to <RENAMED-IMPL-SYMBOL>.
Diffstat (limited to 'src/junit/com/jogamp')
4 files changed, 18 insertions, 1 deletions
diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/BaseClass.java b/src/junit/com/jogamp/gluegen/test/junit/generation/BaseClass.java index 92015dd..75ef808 100644 --- a/src/junit/com/jogamp/gluegen/test/junit/generation/BaseClass.java +++ b/src/junit/com/jogamp/gluegen/test/junit/generation/BaseClass.java @@ -77,7 +77,7 @@ public class BaseClass extends SingletonJunitCase { * ie a compilation only coverage test without functional tests. */ public void chapter__TestCoverageSignature(final Bindingtest1 binding) throws Exception { - int i; + int i = 0; final long context = 0; LongBuffer lb=null; ByteBuffer bb=null; @@ -119,6 +119,8 @@ public class BaseClass extends SingletonJunitCase { lb = binding.testFooPtr(larray, 0); lb = binding.testFooPtr(lb); + + i = binding.testDelegate(i); } { @@ -712,6 +714,11 @@ public class BaseClass extends SingletonJunitCase { Assert.assertEquals(fooLB, foo2Out); } + { + i=41; + final int iRes = binding.testDelegate(i); + Assert.assertEquals(i+1, iRes); + } } public void chapter04TestPointerBuffer(final Bindingtest1 binding) throws Exception { diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/test1-common.cfg b/src/junit/com/jogamp/gluegen/test/junit/generation/test1-common.cfg index 29c13fa..6c516c2 100644 --- a/src/junit/com/jogamp/gluegen/test/junit/generation/test1-common.cfg +++ b/src/junit/com/jogamp/gluegen/test/junit/generation/test1-common.cfg @@ -46,6 +46,10 @@ Opaque long TK_Context RenameJavaSymbol DEFINE_01_EXT DEFINE_01 RenameJavaSymbol testXID_EXT testXID +DelegateImplementation testDelegate testDelegateOrigImpl +IncludeAs CustomJavaCode Bindingtest1p1Impl test1-CustomJavaCode.cfg +IncludeAs CustomJavaCode Bindingtest1p2Impl test1-CustomJavaCode.cfg + StructPackage TK_Dimension com.jogamp.gluegen.test.junit.generation EmitStruct TK_Dimension StructPackage TK_DimensionPair com.jogamp.gluegen.test.junit.generation diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/test1.c b/src/junit/com/jogamp/gluegen/test/junit/generation/test1.c index 316603b..0683600 100644 --- a/src/junit/com/jogamp/gluegen/test/junit/generation/test1.c +++ b/src/junit/com/jogamp/gluegen/test/junit/generation/test1.c @@ -65,6 +65,10 @@ MYAPI foo MYAPIENTRY nopTest() { return 42; } +MYAPI int32_t MYAPIENTRY testDelegate(int32_t v) { + return v; +} + /** * new blob sizeof(void*) filled w/ 0xDEADBEEF */ diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/test1.h b/src/junit/com/jogamp/gluegen/test/junit/generation/test1.h index b176f3a..6e826c5 100644 --- a/src/junit/com/jogamp/gluegen/test/junit/generation/test1.h +++ b/src/junit/com/jogamp/gluegen/test/junit/generation/test1.h @@ -111,6 +111,8 @@ MYAPI foo_ptr MYAPIENTRY testFooPtr(foo_ptr v); /** Returns 42 */ MYAPI foo MYAPIENTRY nopTest(); +MYAPI int32_t MYAPIENTRY testDelegate(int32_t v); + // // Different pointer type tests .. // |