diff options
Diffstat (limited to 'src/junit/com/jogamp')
18 files changed, 316 insertions, 29 deletions
diff --git a/src/junit/com/jogamp/common/nio/TestPointerBufferEndian.java b/src/junit/com/jogamp/common/nio/TestPointerBufferEndian.java index da232a2..e587acf 100644 --- a/src/junit/com/jogamp/common/nio/TestPointerBufferEndian.java +++ b/src/junit/com/jogamp/common/nio/TestPointerBufferEndian.java @@ -11,13 +11,11 @@ import static java.lang.System.*; public class TestPointerBufferEndian { protected void testImpl (boolean direct) { - int bitsPtr = Platform.getPointerSizeInBits(); + final MachineDescription machine = Platform.getMachineDescription(); + int bitsPtr = machine.pointerSizeInBytes() * 8; String bitsProp = System.getProperty("sun.arch.data.model"); - String os = System.getProperty("os.name"); - String cpu = System.getProperty("os.arch"); - out.println("OS: <"+os+"> CPU: <"+cpu+"> Bits: <"+bitsPtr+"/"+bitsProp+">"); - out.println("CPU is: "+ (Platform.is32Bit()?"32":"64") + " bit"); - out.println("Buffer is in: "+ (Platform.isLittleEndian()?"little":"big") + " endian"); + out.println("OS: <"+Platform.OS+"> CPU: <"+Platform.ARCH+"> Bits: <"+bitsPtr+"/"+bitsProp+">"); + out.println(machine.toString()); long[] valuesSource = { 0x0123456789ABCDEFL, 0x8877665544332211L, 0xAFFEDEADBEEFAFFEL }; long[] values32Bit = { 0x0000000089ABCDEFL, 0x0000000044332211L, 0x00000000BEEFAFFEL }; diff --git a/src/junit/com/jogamp/common/nio/TestStructAccessorEndian.java b/src/junit/com/jogamp/common/nio/TestStructAccessorEndian.java index 09781ec..8a20272 100644 --- a/src/junit/com/jogamp/common/nio/TestStructAccessorEndian.java +++ b/src/junit/com/jogamp/common/nio/TestStructAccessorEndian.java @@ -14,13 +14,12 @@ public class TestStructAccessorEndian { @Test public void testStructAccessorEndian1 () { - int bitsPtr = Platform.getPointerSizeInBits(); + final MachineDescription machine = Platform.getMachineDescription(); + int bitsPtr = machine.pointerSizeInBytes() * 8; String bitsProp = System.getProperty("sun.arch.data.model"); - String os = System.getProperty("os.name"); - String cpu = System.getProperty("os.arch"); - out.println("OS: <"+os+"> CPU: <"+cpu+"> Bits: <"+bitsPtr+"/"+bitsProp+">"); + out.println("OS: <"+Platform.OS+"> CPU: <"+Platform.ARCH+"> Bits: <"+bitsPtr+"/"+bitsProp+">"); out.println("CPU is: "+ (Platform.is32Bit()?"32":"64") + " bit"); - out.println("Buffer is in: "+ (Platform.isLittleEndian()?"little":"big") + " endian"); + out.println(machine.toString()); long[] valuesSource = { 0x0123456789ABCDEFL, 0x8877665544332211L, 0xAFFEDEADBEEFAFFEL }; ByteBuffer tst = Buffers.newDirectByteBuffer(Buffers.SIZEOF_LONG * valuesSource.length); diff --git a/src/junit/com/jogamp/common/util/IntIntHashMapTest.java b/src/junit/com/jogamp/common/util/IntIntHashMapTest.java index 04f2d67..09aff1c 100644 --- a/src/junit/com/jogamp/common/util/IntIntHashMapTest.java +++ b/src/junit/com/jogamp/common/util/IntIntHashMapTest.java @@ -37,6 +37,9 @@ import java.util.Iterator; import java.util.Map.Entry; import org.junit.BeforeClass; import org.junit.Test; + +import com.jogamp.common.os.Platform; + import static org.junit.Assert.*; import static java.lang.System.*; @@ -52,7 +55,7 @@ public class IntIntHashMapTest { @BeforeClass public static void init() { - iterations = 10000; + iterations = ( Platform.CPUType.ARM == Platform.CPU_TYPE ) ? 100 : 10000; pairs = new IntIntUniqueRndValues(iterations); } diff --git a/src/junit/com/jogamp/common/util/IntObjectHashMapTest.java b/src/junit/com/jogamp/common/util/IntObjectHashMapTest.java index 8c4d9c8..00de133 100644 --- a/src/junit/com/jogamp/common/util/IntObjectHashMapTest.java +++ b/src/junit/com/jogamp/common/util/IntObjectHashMapTest.java @@ -37,6 +37,9 @@ import java.util.Iterator; import java.util.Map.Entry; import org.junit.BeforeClass; import org.junit.Test; + +import com.jogamp.common.os.Platform; + import static org.junit.Assert.*; /** @@ -51,7 +54,7 @@ public class IntObjectHashMapTest { @BeforeClass public static void init() { - iterations = 10000; + iterations = ( Platform.getCPUType() == Platform.CPUType.ARM ) ? 100 : 10000; pairs = new IntIntObjUniqueRndValues(iterations); } diff --git a/src/junit/com/jogamp/common/util/LongIntHashMapTest.java b/src/junit/com/jogamp/common/util/LongIntHashMapTest.java index dccd8a3..239bef1 100644 --- a/src/junit/com/jogamp/common/util/LongIntHashMapTest.java +++ b/src/junit/com/jogamp/common/util/LongIntHashMapTest.java @@ -37,6 +37,9 @@ import java.util.HashMap; import java.util.Map.Entry; import org.junit.BeforeClass; import org.junit.Test; + +import com.jogamp.common.os.Platform; + import static org.junit.Assert.*; import static java.lang.System.*; @@ -52,7 +55,7 @@ public class LongIntHashMapTest { @BeforeClass public static void init() { - iterations = 10000; + iterations = ( Platform.getCPUType() == Platform.CPUType.ARM ) ? 100 : 10000; pairs = new LongIntUniqueRndValues(iterations); } diff --git a/src/junit/com/jogamp/common/util/TestIOUtil01.java b/src/junit/com/jogamp/common/util/TestIOUtil01.java index ad95213..fd95652 100644 --- a/src/junit/com/jogamp/common/util/TestIOUtil01.java +++ b/src/junit/com/jogamp/common/util/TestIOUtil01.java @@ -44,11 +44,13 @@ import org.junit.BeforeClass; import org.junit.AfterClass; import org.junit.Test; +import com.jogamp.common.os.MachineDescription; import com.jogamp.common.os.Platform; public class TestIOUtil01 { - static final int tsz = Platform.getPageSize() + Platform.getPageSize() / 2 ; + static final MachineDescription machine = Platform.getMachineDescription(); + static final int tsz = machine.pageSizeInBytes() + machine.pageSizeInBytes() / 2 ; static final byte[] orig = new byte[tsz]; static final String tfilename = "./test.bin" ; diff --git a/src/junit/com/jogamp/common/util/TestIteratorIndexCORE.java b/src/junit/com/jogamp/common/util/TestIteratorIndexCORE.java index 0a3bd31..da797dc 100644 --- a/src/junit/com/jogamp/common/util/TestIteratorIndexCORE.java +++ b/src/junit/com/jogamp/common/util/TestIteratorIndexCORE.java @@ -37,10 +37,12 @@ import org.junit.BeforeClass; import org.junit.AfterClass; import org.junit.Test; +import com.jogamp.common.os.Platform; + public class TestIteratorIndexCORE { static int elems = 10; - static int loop = 9999999; + static int loop = ( Platform.getCPUType() == Platform.CPUType.ARM ) ? 100 : 9999999; public void populate(List l, int len) { while(len>0) { diff --git a/src/junit/com/jogamp/common/util/TestPlatform01.java b/src/junit/com/jogamp/common/util/TestPlatform01.java index 544418a..1266c45 100644 --- a/src/junit/com/jogamp/common/util/TestPlatform01.java +++ b/src/junit/com/jogamp/common/util/TestPlatform01.java @@ -31,34 +31,36 @@ package com.jogamp.common.util; import org.junit.Assert; import org.junit.Test; +import com.jogamp.common.os.MachineDescription; import com.jogamp.common.os.Platform; public class TestPlatform01 { @Test public void testPageSize01() { - final int ps = Platform.getPageSize(); + final MachineDescription machine = Platform.getMachineDescription(); + final int ps = machine.pageSizeInBytes(); System.err.println("PageSize: "+ps); Assert.assertTrue("PageSize is 0", 0 < ps ); - final int ps_pages = Platform.getPageNumber(ps); + final int ps_pages = machine.pageCount(ps); Assert.assertTrue("PageNumber of PageSize is not 1, but "+ps_pages, 1 == ps_pages); final int sz0 = ps - 10; - final int sz0_pages = Platform.getPageNumber(sz0); + final int sz0_pages = machine.pageCount(sz0); Assert.assertTrue("PageNumber of PageSize-10 is not 1, but "+sz0_pages, 1 == sz0_pages); final int sz1 = ps + 10; - final int sz1_pages = Platform.getPageNumber(sz1); + final int sz1_pages = machine.pageCount(sz1); Assert.assertTrue("PageNumber of PageSize+10 is not 2, but "+sz1_pages, 2 == sz1_pages); - final int ps_psa = Platform.getPageAlignedSize(ps); + final int ps_psa = machine.pageAlignedSize(ps); Assert.assertTrue("PageAlignedSize of PageSize is not PageSize, but "+ps_psa, ps == ps_psa); - final int sz0_psa = Platform.getPageAlignedSize(sz0); + final int sz0_psa = machine.pageAlignedSize(sz0); Assert.assertTrue("PageAlignedSize of PageSize-10 is not PageSize, but "+sz0_psa, ps == sz0_psa); - final int sz1_psa = Platform.getPageAlignedSize(sz1); + final int sz1_psa = machine.pageAlignedSize(sz1); Assert.assertTrue("PageAlignedSize of PageSize+10 is not 2*PageSize, but "+sz1_psa, ps*2 == sz1_psa); } diff --git a/src/junit/com/jogamp/common/util/locks/TestRecursiveLock01.java b/src/junit/com/jogamp/common/util/locks/TestRecursiveLock01.java index c1cbb88..bee9b44 100644 --- a/src/junit/com/jogamp/common/util/locks/TestRecursiveLock01.java +++ b/src/junit/com/jogamp/common/util/locks/TestRecursiveLock01.java @@ -32,6 +32,8 @@ import java.io.IOException; import org.junit.Test; +import com.jogamp.common.os.Platform; + public class TestRecursiveLock01 { static final int YIELD_NONE = 0; @@ -210,28 +212,45 @@ public class TestRecursiveLock01 { // @Test public void testLockedObjectThreading2x10000() throws InterruptedException { System.err.println("++++ TestRecursiveLock01.testLockedObjectThreading2x10000"); - testLockedObjectImpl(2, 10000, 10000, YIELD_NONE); + if( Platform.getCPUType() == Platform.CPUType.ARM ) { + testLockedObjectImpl(2, 10, 10, YIELD_NONE); + } else { + testLockedObjectImpl(2, 10000, 10000, YIELD_NONE); + } System.err.println("---- TestRecursiveLock01.testLockedObjectThreading2x10000"); } @Test public void testLockedObjectThreading25x25Yield() throws InterruptedException { System.err.println("++++ TestRecursiveLock01.testLockedObjectThreading25x25-Yield"); - testLockedObjectImpl(25, 25, 100, YIELD_YIELD); + if( Platform.getCPUType() == Platform.CPUType.ARM ) { + testLockedObjectImpl(5, 25, 10, YIELD_YIELD); + } else { + testLockedObjectImpl(25, 25, 100, YIELD_YIELD); + } System.err.println("---- TestRecursiveLock01.testLockedObjectThreading25x25-Yield"); } // @Test public void testLockedObjectThreading25x25Sleep() throws InterruptedException { System.err.println("++++ TestRecursiveLock01.testLockedObjectThreading25x25-Sleep"); - testLockedObjectImpl(25, 25, 100, YIELD_SLEEP); + if( Platform.getCPUType() == Platform.CPUType.ARM ) { + testLockedObjectImpl(5, 25, 10, YIELD_SLEEP); + } else { + testLockedObjectImpl(25, 25, 100, YIELD_SLEEP); + } System.err.println("---- TestRecursiveLock01.testLockedObjectThreading25x25-Sleep"); } @Test public void testLockedObjectThreading25x25None() throws InterruptedException { System.err.println("++++ TestRecursiveLock01.testLockedObjectThreading25x25-None"); - testLockedObjectImpl(25, 25, 100, YIELD_NONE); + if( Platform.getCPUType() == Platform.CPUType.ARM ) { + testLockedObjectImpl(5, 25, 10, YIELD_NONE); + } else { + testLockedObjectImpl(25, 25, 100, YIELD_NONE); + } + System.err.println("---- TestRecursiveLock01.testLockedObjectThreading25x25-None"); } 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 c57a288..df3df83 100644 --- a/src/junit/com/jogamp/gluegen/test/junit/generation/BaseClass.java +++ b/src/junit/com/jogamp/gluegen/test/junit/generation/BaseClass.java @@ -532,5 +532,80 @@ public class BaseClass { i = binding.intArrayRead(iarray, 0, 3); Assert.assertTrue("Wrong result: "+i, 6==i); } + + void assertAPTR(final long expected, final long actual) { + System.err.println("0x"+Long.toHexString(expected)+" == 0x"+Long.toHexString(actual)); + if (Platform.is32Bit()) { + int exp32; + int act32; + // if(Platform.isLittleEndian()) { + exp32 = (int) ( expected ) ; + act32 = (int) ( actual ) ; + /* } else { + exp32 = (int) ( expected >> 32 ) ; + act32 = (int) ( actual >> 32 ) ; + } */ + System.err.println("0x"+Integer.toHexString(exp32)+" == 0x"+Integer.toHexString(act32)); + Assert.assertEquals(exp32, act32); + } else { + Assert.assertEquals(expected, actual); + } + } + + public void chapter09TestCompoundAndAlignment(Bindingtest1 binding) throws Exception { + TK_ComplicatedSuperSet cs = binding.createComplicatedSuperSet(); + Assert.assertEquals((byte)0xA0, cs.getBits1()); + + TK_ComplicatedSubSet sub1 = cs.getSub1(); + Assert.assertEquals((byte)0xA1, sub1.getBits1()); + Assert.assertEquals(0x12345678, sub1.getId()); + Assert.assertEquals((byte)0xA2, sub1.getBits2()); + Assert.assertEquals(0x123456789abcdef0L, sub1.getLong0()); + Assert.assertEquals((byte)0xA3, sub1.getBits3()); + Assert.assertEquals(3.1415926535897932384626433832795, sub1.getReal0(), 0.0); + Assert.assertEquals((byte)0xA4, sub1.getBits4()); + + Assert.assertEquals((byte)0xB0, cs.getBits2()); + + TK_ComplicatedSubSet sub2 = cs.getSub2(); + Assert.assertEquals((byte)0xB1, sub2.getBits1()); + Assert.assertEquals(0x12345678, sub2.getId()); + Assert.assertEquals((byte)0xB2, sub2.getBits2()); + Assert.assertEquals(0x123456789abcdef0L, sub2.getLong0()); + Assert.assertEquals((byte)0xB3, sub2.getBits3()); + Assert.assertEquals(3.1415926535897932384626433832795, sub2.getReal0(), 0.0); + Assert.assertEquals((byte)0xB4, sub2.getBits4()); + + Assert.assertEquals((byte)0xC0, cs.getBits3()); + + binding.destroyComplicatedSuperSet(cs); + + /********************************************************************************/ + + TK_Surface surface = binding.createSurface(); + + assertAPTR(0x123456789abcdef0L, surface.getCtx()); + + TK_Engine engine = surface.getEngine(); + assertAPTR(0x123456789abcdef0L, engine.getCtx()); + Assert.assertEquals(0x0111, engine.render(0x0100, 0x0010, 0x0001)); + + TK_Dimension dimension = surface.getBounds(); + Assert.assertEquals(0x11111111, dimension.getX()); + Assert.assertEquals(0x22222222, dimension.getY()); + Assert.assertEquals(0x33333333, dimension.getWidth()); + Assert.assertEquals(0x44444444, dimension.getHeight()); + + Assert.assertEquals(2, surface.getClipSize()); + + for(int i=0; i<surface.getClipSize(); i++) { + TK_Dimension clip = surface.getClip(i); + Assert.assertEquals(0x44444444 * (i+1) + 0x11111111, clip.getX()); + Assert.assertEquals(0x44444444 * (i+1) + 0x22222222, clip.getY()); + Assert.assertEquals(0x44444444 * (i+1) + 0x33333333, clip.getWidth()); + Assert.assertEquals(0x44444444 * (i+1) + 0x44444444, clip.getHeight()); + } + binding.destroySurface(surface); + } } diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/BuildEnvironment.java b/src/junit/com/jogamp/gluegen/test/junit/generation/BuildEnvironment.java index 73950eb..3b883aa 100644 --- a/src/junit/com/jogamp/gluegen/test/junit/generation/BuildEnvironment.java +++ b/src/junit/com/jogamp/gluegen/test/junit/generation/BuildEnvironment.java @@ -31,6 +31,8 @@ package com.jogamp.gluegen.test.junit.generation; import java.io.File; import java.net.URISyntaxException; +import com.jogamp.common.util.VersionUtil; + import static java.lang.System.*; /** @@ -46,7 +48,7 @@ public final class BuildEnvironment { static { out.println(" - - - System info - - - "); - out.println("OS: " + System.getProperty("os.name")); + out.println(VersionUtil.getPlatformInfo()); out.println("VM: " + System.getProperty("java.vm.name")); String rootrel_build_tmp = System.getProperty("rootrel.build"); diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p1JavaEmitter.java b/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p1JavaEmitter.java index 83faa9b..35907de 100644 --- a/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p1JavaEmitter.java +++ b/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p1JavaEmitter.java @@ -105,6 +105,14 @@ public class Test1p1JavaEmitter extends BaseClass { chapter05TestSomeFunctionsAllIndirect(new Bindingtest1p1Impl()); } + /** + * This covers compounds (structs) and data alignment + */ + @Test + public void chapter09TestCompoundAndAlignment() throws Exception { + chapter09TestCompoundAndAlignment(new Bindingtest1p1Impl()); + } + public static void main(String args[]) throws IOException { String tstname = Test1p1JavaEmitter.class.getName(); org.junit.runner.JUnitCore.main(tstname); diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p2ProcAddressEmitter.java b/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p2ProcAddressEmitter.java index 8fe4f86..cd6e85d 100644 --- a/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p2ProcAddressEmitter.java +++ b/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p2ProcAddressEmitter.java @@ -115,6 +115,14 @@ public class Test1p2ProcAddressEmitter extends BaseClass { chapter05TestSomeFunctionsAllIndirect(new Bindingtest1p2Impl()); } + /** + * This covers compounds (structs) and data alignment + */ + @Test + public void chapter09TestCompoundAndAlignment() throws Exception { + chapter09TestCompoundAndAlignment(new Bindingtest1p1Impl()); + } + public static void main(String args[]) throws IOException { String tstname = Test1p2ProcAddressEmitter.class.getName(); org.junit.runner.JUnitCore.main(tstname); 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 30cdd96..c6e5415 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 @@ -25,11 +25,31 @@ Opaque long MYAPIConfig CustomCCode #include "test1.h" +Opaque long TK_Context + +StructPackage TK_Surface com.jogamp.gluegen.test.junit.generation +EmitStruct TK_Surface +# Implements TK_Surface TḴ_??? + +StructPackage TK_ComplicatedSuperSet com.jogamp.gluegen.test.junit.generation +EmitStruct TK_ComplicatedSuperSet +# Implements TK_ComplicatedSuperSet TḴ_??? + +ReturnValueCapacity createSurface sizeof(TK_Surface) +ReturnValueCapacity getClip sizeof(TK_Dimension) + +ReturnValueCapacity createComplicatedSuperSet sizeof(TK_ComplicatedSuperSet) + # Imports needed by all glue code Import java.nio.* Import java.util.* Import com.jogamp.common.os.* Import com.jogamp.common.nio.* +Import com.jogamp.gluegen.test.junit.generation.TK_Surface +Import com.jogamp.gluegen.test.junit.generation.TK_Dimension +Import com.jogamp.gluegen.test.junit.generation.TK_Engine +Import com.jogamp.gluegen.test.junit.generation.TK_ComplicatedSuperSet +Import com.jogamp.gluegen.test.junit.generation.TK_ComplicatedSubSet diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/test1-gluegen.cfg b/src/junit/com/jogamp/gluegen/test/junit/generation/test1-gluegen.cfg index 197b081..bb5eb80 100644 --- a/src/junit/com/jogamp/gluegen/test/junit/generation/test1-gluegen.cfg +++ b/src/junit/com/jogamp/gluegen/test/junit/generation/test1-gluegen.cfg @@ -3,6 +3,7 @@ Style AllStatic JavaClass Bindingtest1 Style InterfaceOnly JavaOutputDir classes +NativeOutputDir native Include test1-common.cfg 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 05a9889..0876403 100644 --- a/src/junit/com/jogamp/gluegen/test/junit/generation/test1.c +++ b/src/junit/com/jogamp/gluegen/test/junit/generation/test1.c @@ -234,4 +234,85 @@ MYAPI uintptr_t MYAPIENTRY typeTestUIntPtrT(const uintptr_t ptr1, uintptr_t ptr2 return ptr1 + ptr2; } +static TK_Dimension * _TK_getClip(TK_Surface * surface, int idx) { + return & ( surface->clips[idx] ) ; +} + +static int32_t _TK_render (int x, int y, int ps) { + return x + y + ps ; +} + +MYAPI TK_Surface * MYAPIENTRY createSurface() { + TK_Surface * s = calloc(1, sizeof(TK_Surface)); + + s->getClip = _TK_getClip; + + s->ctx = (void *) 0x123456789abcdef0UL; + //s->engine = (TK_Engine *) calloc(1, sizeof(TK_Engine)); + //s->engine->ctx = (void *) 0x123456789abcdef0UL; + //s->engine->render = _TK_render; + s->engine.ctx = (void *) 0x123456789abcdef0UL; + s->engine.render = _TK_render; + + s->bounds.x = 0x11111111U; + s->bounds.y = 0x22222222U; + s->bounds.width = 0x33333333U; + s->bounds.height = 0x44444444U; + + s->clipSize = 2; + s->clips = (TK_Dimension *) calloc(2, sizeof(TK_Dimension)); + s->clips[0].x = 0x55555555U; + s->clips[0].y = 0x66666666U; + s->clips[0].width = 0x77777777U; + s->clips[0].height = 0x88888888U; + s->clips[1].x = 0x99999999U; + s->clips[1].y = 0xaaaaaaaaU; + s->clips[1].width = 0xbbbbbbbbU; + s->clips[1].height = 0xccccccccU; + + return s; +} + +MYAPI void MYAPIENTRY destroySurface(TK_Surface * surface) { + free(surface->clips); + // free(surface->engine); + free(surface); +} + +MYAPI TK_ComplicatedSuperSet * MYAPIENTRY createComplicatedSuperSet() { + TK_ComplicatedSuperSet * s = calloc(1, sizeof(TK_ComplicatedSuperSet)); + + s->bits1 = 0xA0U; + s->sub1.bits1 = 0xA1U; + s->sub1.id = 0x12345678U; + s->sub1.bits2 = 0xA2U; + s->sub1.long0 = 0x123456789abcdef0UL; + s->sub1.bits3 = 0xA3U; + s->sub1.real0 = 3.1415926535897932384626433832795L; + s->sub1.bits4 = 0xA4U; + s->bits2 = 0xB0U; + s->sub2.bits1 = 0xB1U; + s->sub2.id = 0x12345678U; + s->sub2.bits2 = 0xB2U; + s->sub2.long0 = 0x123456789abcdef0UL; + s->sub2.bits3 = 0xB3U; + s->sub2.real0 = 3.1415926535897932384626433832795L; + s->sub2.bits4 = 0xB4U; + s->bits3 = 0xC0U; + + fprintf(stderr, "TK_ComplicatedSubSet: sizeof(): %ld\n", (long) sizeof(TK_ComplicatedSubSet)); + fprintf(stderr, "TK_ComplicatedSubSet: bits2-s offset: %ld\n", (long) ((void *)(&s->sub1.bits2) - (void *)(&s->sub1)) ); + fprintf(stderr, "TK_ComplicatedSubSet: bits3-s offset: %ld\n", (long) ((void *)(&s->sub1.bits3) - (void *)(&s->sub1)) ); + fprintf(stderr, "TK_ComplicatedSubSet: bits4-s offset: %ld\n", (long) ((void *)(&s->sub1.bits4) - (void *)(&s->sub1)) ); + + fprintf(stderr, "TK_ComplicatedSuperSet: sizeof(): %ld\n", (long) sizeof(TK_ComplicatedSuperSet)); + fprintf(stderr, "TK_ComplicatedSuperSet: bits2-s offset: %ld\n", (long) ((void *)(&s->bits2) - (void *)(s)) ); + fprintf(stderr, "TK_ComplicatedSuperSet: bits3-s offset: %ld\n", (long) ((void *)(&s->bits3) - (void *)(s)) ); + + return s; +} + +MYAPI void MYAPIENTRY destroyComplicatedSuperSet(TK_ComplicatedSuperSet * s) { + free(s); +} 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 5b1c241..041a8d2 100644 --- a/src/junit/com/jogamp/gluegen/test/junit/generation/test1.h +++ b/src/junit/com/jogamp/gluegen/test/junit/generation/test1.h @@ -125,3 +125,65 @@ MYAPI uintptr_t MYAPIENTRY typeTestUIntPtrT(const uintptr_t ptr1, uintptr_t ptr2 #warning "Hello Native Compiler" #endif +typedef struct { + int32_t x; + int32_t y; + int32_t width; + int32_t height; +} TK_Dimension; + +typedef struct _TK_Context * TK_Context; // anonymous + +typedef struct { + TK_Context ctx; + int32_t (MYAPIENTRY *render) (int x, int y, int ps); +} TK_Engine; + +typedef struct tk_Surface { + TK_Context ctx; + // const TK_Engine * engine; + TK_Engine engine; + TK_Dimension bounds; + int32_t clipSize; + TK_Dimension * clips; + TK_Dimension * (MYAPIENTRY *getClip) (struct tk_Surface * ds, int idx); +} TK_Surface; + +typedef struct { + int8_t bits1; // +1 + // +3 (p64) + int32_t id; // +4 + int8_t bits2; // +1 + // +7 (p64) + int64_t long0; // +8 + int8_t bits3; // +1 + // +7 (p64) + double real0; // +8 + int8_t bits4; // +1 + // +7 (p64) (for next struct ..) + + // 24 net + + // 48 gross 64bit/linux +} TK_ComplicatedSubSet; + +typedef struct { + int8_t bits1; // + 1 + // + 7 (p64) + TK_ComplicatedSubSet sub1; // +48 (64bit) + int8_t bits2; // + 1 + // + 7 (p64) + TK_ComplicatedSubSet sub2; // +48 (64bit) + int8_t bits3; // + 1 + // + 7 (p64) + + // 51 net + + // 120 gross 64bit/linux +} TK_ComplicatedSuperSet; + +MYAPI TK_Surface * MYAPIENTRY createSurface(); +MYAPI void MYAPIENTRY destroySurface(TK_Surface * surface); + +MYAPI TK_ComplicatedSuperSet * MYAPIENTRY createComplicatedSuperSet(); +MYAPI void MYAPIENTRY destroyComplicatedSuperSet(TK_ComplicatedSuperSet * s); diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/test1p2-gluegen.cfg b/src/junit/com/jogamp/gluegen/test/junit/generation/test1p2-gluegen.cfg index 649499d..708bd26 100644 --- a/src/junit/com/jogamp/gluegen/test/junit/generation/test1p2-gluegen.cfg +++ b/src/junit/com/jogamp/gluegen/test/junit/generation/test1p2-gluegen.cfg @@ -22,7 +22,6 @@ ForceProcAddressGen __ALL__ LocalProcAddressCallingConvention __ALL__ MYAPIENTRY Include test1-common.cfg -Include ../../../../../../../../make/config/intptr.cfg Import com.jogamp.gluegen.test.junit.generation.Bindingtest1 Import com.jogamp.gluegen.test.junit.generation.Bindingtest1p2 |