aboutsummaryrefslogtreecommitdiffstats
path: root/src/junit
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2023-06-16 02:16:20 +0200
committerSven Gothel <[email protected]>2023-06-16 02:16:20 +0200
commit8b127c4c1dd26fcb1756805ddb83729203161f78 (patch)
treef8563a0e39d293bc070ef01e457cfe08ee44096d /src/junit
parentaeadfab9572e4b441b1bc1f0708cf4c72dfe181e (diff)
GlueGen Struct [5]: Revised Struct Mapping + Documentation
GlueGen Revised Struct Mapping (esp pointer to array or single element), Struct String Charset, .. and Documentation - Documentation: - Added README.md Let's have a proper face for the git repo - Added doc/GlueGen_Mapping.md (and its html conversion doc/GlueGen_Mapping.html) Created a new document covering application and implementation details suitable for users/devs. - Added doc/JogAmpMacOSVersions.md conversion to doc/JogAmpMacOSVersions.html - Updated www/index.html - Use *CodeUnit instead of PrintWriter, representing a Java or C code unit covering a set of functions and structs. The CCodeUnit also handles common code shared by its unit across functions etc. - Dropping 'static initializer', as its no more required due to simplified `JVMUtil_NewDirectByteBufferCopy()` variant. - Revised Struct Mapping: - Pure Java implementation to map primitive and struct fields within a struct by utilizing ElementBuffer. Only 'Function Pointer' fields within a struct require native code. Exposes `static boolean usesNativeCode()` to query whether native code is used/required. - Transparent native memory address API Expose `long getDirectBufferAddress()` and `static TK_Struct derefPointer(long addr)`, allowing to - pass the native struct-pointer with native code - reconstruct the struct from a native struct-pointer - have a fully functional `TK_Struct.derefPointer(struct.getDirectBufferAddress())` cycle. - Add 'boolean is<Val>Null() to query whether a pointer (array) is NULL - *Changed* array get/set method for more flexibility alike `System.arraycopy(src, srcPos, dest, destPos, len)`, where 'src' is being dropped for the getter and 'dest' is being dropped for the setter as both objects are reflected by the struct instance. - *Changed* `get<Val>ArrayLength()` -> `get<Val>ElemCount()` for clarity - Considering all ConstElemCount values with config 'ReturnedArrayLength <int>' to be owned by native code -> NativeOwnership -> Not changing the underlying memory region! JavaOwnership is considered for all pointer-arrays not of NativeOwnership. Hence any setter on a NativeOwnership pointer-array will fail with non-matching elem-count. - Add 'release<Val>()' for JavaOwnership pointer-arrays, allowing to release the Java owned native memory incl. null-ing pointer and set<Val>ElemCount(0). - Support setter for 'const <type>*' w/ JavaOwnership, i.e. pointer to const value of a primitive or struct, setter and getter using pointer to array or single element in general. - Added Config `ImmutableAccess symbol` to disable all setter for whole struct or a field - Added Config `MaxOneElement symbol` to restrict a pointer to maximum one element and unset initial value (zero elements) - Added Config `ReturnsStringOnly symbol` to restrict mapping only to a Java String, dropping the ByteBuffer variant for 'char' - String mapping default is UTF-8 and can be read and set via [get|set]Charset(..) per class. - Dynamic string length retrieval in case no `ReturnedArrayLength` has been configured has changed from `strlen()` to `strnlen(aptr, max_len)` to be on the safe site. The maximum length default is 8192 bytes and can be read and set via [get|set]MaxStrnlen(..) per class. FIXME: strnlen(..) using EOS byte non-functional for non 8-bit codecs like UTF-8, US-ASCII. This is due to e.g. UTF-16 doesn't use an EOS byte, but interprets it as part of a code point. - TODO: Perhaps a few more unit tests - TODO: Allow plain 'int' to be mapped in structs IFF their size is same for all MachineDescriptions used. Currently this is the case -> 4 bytes like int32_t.
Diffstat (limited to 'src/junit')
-rw-r--r--src/junit/com/jogamp/gluegen/test/junit/generation/BaseClass.java1080
-rw-r--r--src/junit/com/jogamp/gluegen/test/junit/generation/Test1p1JavaEmitter.java17
-rw-r--r--src/junit/com/jogamp/gluegen/test/junit/generation/Test1p2DynamicLibraryBundle.java18
-rw-r--r--src/junit/com/jogamp/gluegen/test/junit/generation/Test1p2ProcAddressEmitter.java17
-rw-r--r--src/junit/com/jogamp/gluegen/test/junit/generation/test1-common.cfg333
-rw-r--r--src/junit/com/jogamp/gluegen/test/junit/generation/test1.c486
-rw-r--r--src/junit/com/jogamp/gluegen/test/junit/generation/test1.h357
-rw-r--r--src/junit/com/jogamp/gluegen/test/junit/generation/test2.c20
-rw-r--r--src/junit/com/jogamp/gluegen/test/junit/generation/test2.cfg52
-rw-r--r--src/junit/com/jogamp/gluegen/test/junit/generation/test2.h37
10 files changed, 1897 insertions, 520 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 34cd925..ed23f54 100644
--- a/src/junit/com/jogamp/gluegen/test/junit/generation/BaseClass.java
+++ b/src/junit/com/jogamp/gluegen/test/junit/generation/BaseClass.java
@@ -40,6 +40,7 @@ import java.nio.ByteOrder;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import java.nio.LongBuffer;
+import java.nio.charset.Charset;
import java.util.Arrays;
import jogamp.common.os.MachineDataInfoRuntime;
@@ -1252,7 +1253,7 @@ public class BaseClass extends SingletonJunitCase {
Assert.assertEquals(2, surface.getClipSize());
- final TK_Dimension[] allclips = surface.getClips(0, new TK_Dimension[surface.getClipSize()]);
+ final TK_Dimension[] allclips = surface.getClips(0, new TK_Dimension[surface.getClipSize()], 0, surface.getClipSize());
for(int i=0; i<surface.getClipSize(); i++) {
final TK_Dimension clip0 = surface.getClip(i);
@@ -1262,7 +1263,7 @@ public class BaseClass extends SingletonJunitCase {
Assert.assertEquals(0x44444444 * (i+1) + 0x44444444, clip0.getHeight());
final TK_Dimension[] clip1 = new TK_Dimension[1];
- surface.getClips(i, clip1);
+ surface.getClips(i, clip1, 0, 1);
Assert.assertEquals(0x44444444 * (i+1) + 0x11111111, clip1[0].getX());
Assert.assertEquals(0x44444444 * (i+1) + 0x22222222, clip1[0].getY());
Assert.assertEquals(0x44444444 * (i+1) + 0x33333333, clip1[0].getWidth());
@@ -1317,10 +1318,10 @@ public class BaseClass extends SingletonJunitCase {
}
final TK_DimensionPair dimPair = TK_DimensionPair.create();
- dimPair.setPair(0, sumands);
+ dimPair.setPair(sumands, 0, 0, sumands.length);
{
sub++;
- final TK_Dimension[] dimsGet = dimPair.getPair(0, new TK_Dimension[2]);
+ final TK_Dimension[] dimsGet = dimPair.getPair(0, new TK_Dimension[2], 0, 2);
assertDim("ch11."+sub+": dimsGet[0] ", 11, 22, 33, 44, dimsGet[0]);
assertDim("ch11."+sub+": dimsGet[1] ", 1, 2, 3, 4, dimsGet[1]);
}
@@ -1388,430 +1389,865 @@ public class BaseClass extends SingletonJunitCase {
}
}
- /** Test array and pointer bindings of structs */
- public void chapter12TestStructArrayModelConst(final Bindingtest1 binding) throws Exception {
- final TK_ModelConst model = binding.createModelConst();
+ /** Primitive.ConstValue.int32.Pointer - read access */
+ private void chapter12_03aTestTKFieldConstValueInt32ReadAccess(final TK_Field model) {
+ // Primitive.ConstValue.int32.Array - read only
+ Assert.assertEquals(88, model.getConstInt32ArrayConstOneElem());
+ Assert.assertEquals(3, TK_Field.getConstInt32ArrayConstLenElemCount());
+ {
+ final int size = TK_Field.getConstInt32ArrayConstLenElemCount();
+ Assert.assertEquals(3, size);
+ final int[] all = model.getConstInt32ArrayConstLen(0, new int[size], 0, size);
+ final IntBuffer allB = model.getConstInt32ArrayConstLen();
+ Assert.assertEquals(size, all.length);
+ Assert.assertEquals(size, allB.limit());
+ for(int i=0; i<size; i++) {
+ Assert.assertEquals(1 + i, all[i]);
+ Assert.assertEquals(1 + i, allB.get(i));
+ final int[] s = model.getConstInt32ArrayConstLen(i /* srcPos */, new int[3] /* dest */, 1 /* destPos */, 1 /* length */);
+ Assert.assertEquals(1 + i, s[1]);
+ }
+ }
+
+ // Primitive.ConstValue.int32.Pointer - read
+ Assert.assertEquals(1, TK_Field.getConstInt32PointerConstOneElemElemCount());
+ Assert.assertEquals(false, model.isConstInt32PointerConstOneElemNull());
+ Assert.assertEquals(10, model.getConstInt32PointerConstOneElem());
- Assert.assertEquals(3, model.getIntxxPointerCustomLenVal());
- Assert.assertEquals(3, model.getInt32PointerCustomLenVal());
- Assert.assertEquals(3, TK_ModelConst.getInt32ArrayFixedLenArrayLength());
- Assert.assertEquals(3, TK_ModelConst.getStructArrayFixedLenArrayLength());
- Assert.assertEquals(3, model.getStructPointerCustomLenVal());
+ Assert.assertEquals(0, model.getConstInt32PointerMaxOneElemElemCount());
+ Assert.assertEquals(true, model.isConstInt32PointerMaxOneElemNull());
+ {
+ Exception e = null;
+ try {
+ @SuppressWarnings("unused")
+ final int i = model.getConstInt32PointerMaxOneElem(); // NULL -> exception
+ } catch(final Exception _e) { e = _e; }
+ Assert.assertNotNull(e);
+ System.err.println("Expected exception: "+e);
+ }
- // field: int32ArrayFixedLen
- // CType['int32_t *', size [fixed false, lnx64 12], [array*1]], with array length of 3
+ Assert.assertEquals(3, TK_Field.getConstInt32PointerConstLenElemCount());
+ Assert.assertEquals(false, model.isConstInt32PointerConstLenNull());
{
- final int size = TK_ModelConst.getInt32ArrayFixedLenArrayLength();
- final int[] all = model.getInt32ArrayFixedLen(0, new int[size]);
- final IntBuffer allB = model.getInt32ArrayFixedLen();
+ final int size = TK_Field.getConstInt32PointerConstLenElemCount();
+ Assert.assertEquals(3, size);
+ final int[] all = model.getConstInt32PointerConstLen(0, new int[size], 0, size);
+ final IntBuffer allB = model.getConstInt32PointerConstLen();
+ Assert.assertEquals(size, all.length);
Assert.assertEquals(size, allB.limit());
for(int i=0; i<size; i++) {
Assert.assertEquals(21 + i, all[i]);
Assert.assertEquals(21 + i, allB.get(i));
- final int[] s = model.getInt32ArrayFixedLen(i, new int[1]);
- Assert.assertEquals(21 + i, s[0]);
+ final int[] s = model.getConstInt32PointerConstLen(i /* srcPos */, new int[3] /* dest */, 2 /* destPos */, 1 /* length */);
+ Assert.assertEquals(21 + i, s[2]);
}
}
- // field: int32ArrayOneElem
- // CType['int32_t *', size [fixed false, lnx64 4], [array*1]], with array length of 1
+ Assert.assertEquals(0, model.getConstInt32PointerVariaLenElemCount());
+ Assert.assertEquals(true, model.isConstInt32PointerVariaLenNull());
{
- Assert.assertEquals(30, model.getInt32ArrayOneElem());
+ Exception e1 = null;
+ try {
+ @SuppressWarnings("unused")
+ final IntBuffer ib = model.getConstInt32PointerVariaLen(); // NULL -> exception
+ } catch(final Exception _e) { e1 = _e; }
+ Assert.assertNotNull(e1);
+ System.err.println("Expected exception-1: "+e1);
+
+ Exception e2 = null;
+ try {
+ @SuppressWarnings("unused")
+ final int[] ia = model.getConstInt32PointerVariaLen(0, new int[0], 0, 0); // NULL -> exception
+ } catch(final Exception _e) { e2 = _e; }
+ Assert.assertNotNull(e2);
+ System.err.println("Expected exception-2: "+e2);
}
- // field: int32PointerCustomLen
- // field: CType['int32_t *', size [fixed false, lnx64 8], [pointer*1]], with array length of getInt32PointerCustomLenVal()
{
- final int size = model.getInt32PointerCustomLenVal();
- final IntBuffer all = model.getInt32PointerCustomLen();
- Assert.assertEquals(size, all.limit());
+ final int size = model.getConstInt32PointerCustomLenElemCount();
+ Assert.assertEquals(4, size);
+ Assert.assertEquals(false, model.isConstInt32PointerCustomLenNull());
+ final int[] all = model.getConstInt32PointerCustomLen(0, new int[size], 0, size);
+ final IntBuffer allB = model.getConstInt32PointerCustomLen();
+ Assert.assertEquals(size, all.length);
+ Assert.assertEquals(size, allB.limit());
for(int i=0; i<size; i++) {
- Assert.assertEquals(31 + i, all.get(i));
+ Assert.assertEquals(31 + i, all[i]);
+ Assert.assertEquals(31 + i, allB.get(i));
+ final int[] s = model.getConstInt32PointerCustomLen(i /* srcPos */, new int[1] /* dest */, 0 /* destPos */, 1 /* length */);
+ Assert.assertEquals(31 + i, s[0]);
}
}
+ }
- // field: int32PointerOneElem
- // CType['int32_t *', size [fixed false, lnx64 8], [pointer*1]], with array length of 1
- {
- final IntBuffer all = model.getInt32PointerOneElem();
- Assert.assertEquals(1, all.limit());
- Assert.assertEquals(41, all.get(0));
- }
-
- // field: mat4x4
- // CType['float * *', size [fixed false, lnx64 64], [array*2]], with array length of <code>4*4</code> */
+ /** Primitive.ConstValue.int32.Pointer - write access */
+ @SuppressWarnings("unused")
+ private void chapter12_03bTestTKFieldConstValueInt32WriteAccess(final TK_Field model) {
+ Assert.assertEquals(0, model.getConstInt32PointerMaxOneElemElemCount());
+ Assert.assertEquals(true, model.isConstInt32PointerMaxOneElemNull());
+ model.setConstInt32PointerMaxOneElem(110);
+ Assert.assertEquals(1, model.getConstInt32PointerMaxOneElemElemCount());
+ Assert.assertEquals(false, model.isConstInt32PointerMaxOneElemNull());
+ Assert.assertEquals(110, model.getConstInt32PointerMaxOneElem());
+ model.releaseConstInt32PointerMaxOneElem();
+ Assert.assertEquals(0, model.getConstInt32PointerMaxOneElemElemCount());
+ Assert.assertEquals(true, model.isConstInt32PointerMaxOneElemNull());
+
+ Assert.assertEquals(3, TK_Field.getConstInt32PointerConstLenElemCount());
+ Assert.assertEquals(false, model.isConstInt32PointerConstLenNull());
{
- Assert.assertEquals(4*4, TK_ModelConst.getMat4x4ArrayLength());
- final FloatBuffer mat4x4 = model.getMat4x4();
- Assert.assertEquals(4*4, mat4x4.limit());
- for(int i=0; i<4; i++) {
- final float[] vec4 = model.getMat4x4(i*4, new float[4]);
- for(int j=0; j<4; j++) {
- Assert.assertEquals(i*4+j, mat4x4.get(i*4+j), EPSILON);
- Assert.assertEquals(i*4+j, vec4[j], EPSILON);
+ // write 1 via IntBuffer reference get
+ // FIXME: Sort of violates the contract
+ {
+ final IntBuffer ib = model.getConstInt32PointerConstLen();
+ Assert.assertEquals(3, ib.limit());
+ for(int i=0; i<3; ++i) {
+ ib.put(i, 120+i);
+ }
+ }
+ // verify 1
+ {
+ final int size = TK_Field.getConstInt32PointerConstLenElemCount();
+ Assert.assertEquals(3, size);
+ final int[] all = model.getConstInt32PointerConstLen(0, new int[size], 0, size);
+ final IntBuffer allB = model.getConstInt32PointerConstLen();
+ Assert.assertEquals(size, all.length);
+ Assert.assertEquals(size, allB.limit());
+ for(int i=0; i<size; i++) {
+ Assert.assertEquals(120 + i, all[i]);
+ Assert.assertEquals(120 + i, allB.get(i));
+ final int[] s = model.getConstInt32PointerConstLen(i, new int[1], 0, 1);
+ Assert.assertEquals(120 + i, s[0]);
}
}
}
- // field: structArrayFixedLen
- // field: CType['TK_Dimension *', size [fixed false, lnx64 48], [array*1]], with array length of 3
+ Assert.assertEquals(0, model.getConstInt32PointerVariaLenElemCount());
+ Assert.assertEquals(true, model.isConstInt32PointerVariaLenNull());
{
- final int size = TK_ModelConst.getStructArrayFixedLenArrayLength();
- final TK_Dimension[] all = model.getStructArrayFixedLen(0, new TK_Dimension[size]);
- for(int i=0; i<size; i++) {
- Assert.assertEquals(51 + i * 10, all[i].getX());
- Assert.assertEquals(52 + i * 10, all[i].getY());
- Assert.assertEquals(53 + i * 10, all[i].getWidth());
- Assert.assertEquals(54 + i * 10, all[i].getHeight());
+ Exception e1 = null;
+ try {
+ @SuppressWarnings("unused")
+ final IntBuffer ib = model.getConstInt32PointerVariaLen(); // NULL -> exception
+ } catch(final Exception _e) { e1 = _e; }
+ Assert.assertNotNull(e1);
+ System.err.println("Expected exception-1: "+e1);
+
+ Exception e2 = null;
+ try {
+ @SuppressWarnings("unused")
+ final int[] ia = model.getConstInt32PointerVariaLen(0, new int[0], 0, 0); // NULL -> exception
+ } catch(final Exception _e) { e2 = _e; }
+ Assert.assertNotNull(e2);
+ System.err.println("Expected exception-2: "+e2);
+ }
+ {
+ // write 1 via int[] set, also actually allocating initial memory
+ {
+ final int[] ia = { 220, 221, 222, 223, 224 };
+ model.setConstInt32PointerVariaLen(ia, 0, 0, ia.length);
+ }
+ // verify 1
+ {
+ final int size = model.getConstInt32PointerVariaLenElemCount();
+ Assert.assertEquals(5, size);
+ final int[] all = model.getConstInt32PointerVariaLen(0, new int[size], 0, size);
+ final IntBuffer allB = model.getConstInt32PointerVariaLen();
+ Assert.assertEquals(size, all.length);
+ Assert.assertEquals(size, allB.limit());
+ for(int i=0; i<size; i++) {
+ Assert.assertEquals(220 + i, all[i]);
+ Assert.assertEquals(220 + i, allB.get(i));
+ final int[] s = model.getConstInt32PointerVariaLen(i, new int[1], 0, 1);
+ Assert.assertEquals(220 + i, s[0]);
+ }
}
+ // write 2 via IntBuffer reference get
+ {
+ final IntBuffer ib = model.getConstInt32PointerVariaLen();
+ Assert.assertEquals(5, ib.limit());
+ for(int i=0; i<5; ++i) {
+ ib.put(i, 120+i);
+ }
+ }
+ // verify 2
+ {
+ final int size = model.getConstInt32PointerVariaLenElemCount();
+ Assert.assertEquals(5, size);
+ final int[] all = model.getConstInt32PointerVariaLen(0, new int[size], 0, size);
+ final IntBuffer allB = model.getConstInt32PointerVariaLen();
+ Assert.assertEquals(size, all.length);
+ Assert.assertEquals(size, allB.limit());
+ for(int i=0; i<size; i++) {
+ Assert.assertEquals(120 + i, all[i]);
+ Assert.assertEquals(120 + i, allB.get(i));
+ final int[] s = model.getConstInt32PointerVariaLen(i, new int[1], 0, 1);
+ Assert.assertEquals(120 + i, s[0]);
+ }
+ }
+ model.releaseConstInt32PointerVariaLen();
+ Assert.assertEquals(0, model.getConstInt32PointerVariaLenElemCount());
+ Assert.assertEquals(true, model.isConstInt32PointerVariaLenNull());
}
- // field: structArrayOneElem
- // CType['TK_Dimension *', size [fixed false, lnx64 16], [array*1]], with array length of 1
{
- final TK_Dimension all = model.getStructArrayOneElem();
- Assert.assertEquals(81, all.getX());
- Assert.assertEquals(82, all.getY());
- Assert.assertEquals(83, all.getWidth());
- Assert.assertEquals(84, all.getHeight());
+ // write 1 via IntBuffer reference get
+ {
+ final int size = model.getConstInt32PointerCustomLenElemCount();
+ Assert.assertEquals(4, size);
+ Assert.assertEquals(false, model.isConstInt32PointerCustomLenNull());
+ final IntBuffer ib = model.getConstInt32PointerCustomLen();
+ Assert.assertEquals(size, ib.limit());
+ for(int i=0; i<size; ++i) {
+ ib.put(i, 120+i);
+ }
+ }
+ // verify 1
+ {
+ final int size = model.getConstInt32PointerCustomLenElemCount();
+ Assert.assertEquals(4, size);
+ final int[] all = model.getConstInt32PointerCustomLen(0, new int[size], 0, size);
+ final IntBuffer allB = model.getConstInt32PointerCustomLen();
+ Assert.assertEquals(size, all.length);
+ Assert.assertEquals(size, allB.limit());
+ for(int i=0; i<size; i++) {
+ Assert.assertEquals(120 + i, all[i]);
+ Assert.assertEquals(120 + i, allB.get(i));
+ final int[] s = model.getConstInt32PointerCustomLen(i, new int[1], 0, 1);
+ Assert.assertEquals(120 + i, s[0]);
+ }
+ }
+ // write 2 via int[] set
+ {
+ final int[] ia = { 0, 220, 221, 222, 223, 224, 0 };
+ model.setConstInt32PointerCustomLen(ia, 1 /* srcPos */, 0 /* destPos */, ia.length-2);
+ }
+ // verify 2
+ {
+ final int size = model.getConstInt32PointerCustomLenElemCount();
+ Assert.assertEquals(5, size);
+ final int[] all = model.getConstInt32PointerCustomLen(0, new int[size], 0, size);
+ final IntBuffer allB = model.getConstInt32PointerCustomLen();
+ Assert.assertEquals(size, all.length);
+ Assert.assertEquals(size, allB.limit());
+ for(int i=0; i<size; i++) {
+ Assert.assertEquals(220 + i, all[i]);
+ Assert.assertEquals(220 + i, allB.get(i));
+ final int[] s = model.getConstInt32PointerCustomLen(i, new int[1], 0, 1);
+ Assert.assertEquals(220 + i, s[0]);
+ }
+ }
+ model.releaseConstInt32PointerCustomLen(); // FIXME: Ownership is ambiguous, may leak native allocated memory, not free'ed!
+ Assert.assertEquals(0, model.getConstInt32PointerCustomLenElemCount());
+ Assert.assertEquals(true, model.isConstInt32PointerCustomLenNull());
}
+ }
- // field: structPointerCustomLen
- // CType['TK_Dimension *', size [fixed false, lnx64 8], [pointer*1]], with array length of getStructPointerCustomLenVal()
+ /** Primitive.VariaValue.int32.Pointer - read access */
+ private void chapter12_04aTestTKFieldVariaValueInt32ReadAccess(final TK_Field model) {
+ // Primitive.ConstValue.int32.Array - read only
+ Assert.assertEquals(88, model.getVariaInt32ArrayConstOneElem());
+ Assert.assertEquals(3, TK_Field.getVariaInt32ArrayConstLenElemCount());
{
- final int size = model.getStructPointerCustomLenVal();
- final TK_Dimension[] all = model.getStructPointerCustomLen(0, new TK_Dimension[size]);
+ final int size = TK_Field.getVariaInt32ArrayConstLenElemCount();
+ Assert.assertEquals(3, size);
+ final int[] all = model.getVariaInt32ArrayConstLen(0, new int[size], 0, size);
+ final IntBuffer allB = model.getVariaInt32ArrayConstLen();
+ Assert.assertEquals(size, all.length);
+ Assert.assertEquals(size, allB.limit());
for(int i=0; i<size; i++) {
- Assert.assertEquals(91 + i * 10, all[i].getX());
- Assert.assertEquals(92 + i * 10, all[i].getY());
- Assert.assertEquals(93 + i * 10, all[i].getWidth());
- Assert.assertEquals(94 + i * 10, all[i].getHeight());
+ Assert.assertEquals(1 + i, all[i]);
+ Assert.assertEquals(1 + i, allB.get(i));
+ final int[] s = model.getVariaInt32ArrayConstLen(i /* srcPos */, new int[3] /* dest */, 1 /* destPos */, 1 /* length */);
+ Assert.assertEquals(1 + i, s[1]);
}
}
- // field: structPointerOneElem
- // CType['TK_Dimension *', size [fixed false, lnx64 8], [pointer*1]], with array length of 1
- {
- final TK_Dimension all = model.getStructPointerOneElem();
- Assert.assertEquals(121, all.getX());
- Assert.assertEquals(122, all.getY());
- Assert.assertEquals(123, all.getWidth());
- Assert.assertEquals(124, all.getHeight());
+ // Primitive.ConstValue.int32.Pointer - read
+ Assert.assertEquals(1, TK_Field.getVariaInt32PointerConstOneElemElemCount());
+ Assert.assertEquals(false, model.isVariaInt32PointerConstOneElemNull());
+ Assert.assertEquals(10, model.getVariaInt32PointerConstOneElem());
+ Assert.assertEquals(0, model.getVariaInt32PointerMaxOneElemElemCount());
+ Assert.assertEquals(true, model.isVariaInt32PointerMaxOneElemNull());
+ {
+ Exception e = null;
+ try {
+ @SuppressWarnings("unused")
+ final int i = model.getVariaInt32PointerMaxOneElem(); // NULL -> exception
+ } catch(final Exception _e) { e = _e; }
+ Assert.assertNotNull(e);
+ System.err.println("Expected exception: "+e);
}
- final long surfaceContext = model.getCtx();
- assertAPTR(0x123456789abcdef0L, surfaceContext);
-
- model.setCtx(surfaceContext);
- assertAPTR(surfaceContext, model.getCtx());
-
+ Assert.assertEquals(3, TK_Field.getVariaInt32PointerConstLenElemCount());
+ Assert.assertEquals(false, model.isVariaInt32PointerConstLenNull());
{
- Assert.assertEquals(12, TK_ModelConst.getModelNameArrayFixedLenArrayLength());
-
- final ByteBuffer bb = model.getModelNameArrayFixedLen();
- Assert.assertEquals(12, bb.limit());
-
- final String exp = "Hello Array";
- final String has = model.getModelNameArrayFixedLenAsString();
- // System.err.println("exp '"+exp+"'");
- System.err.println("has '"+has+"'");
- // dumpStringChars("exp", exp);
- dumpStringChars("has", has);
- Assert.assertEquals(11, has.length()); // w/o EOS
- Assert.assertEquals(exp, has);
+ final int size = TK_Field.getVariaInt32PointerConstLenElemCount();
+ Assert.assertEquals(3, size);
+ final int[] all = model.getVariaInt32PointerConstLen(0, new int[size], 0, size);
+ final IntBuffer allB = model.getVariaInt32PointerConstLen();
+ Assert.assertEquals(size, all.length);
+ Assert.assertEquals(size, allB.limit());
+ for(int i=0; i<size; i++) {
+ Assert.assertEquals(21 + i, all[i]);
+ Assert.assertEquals(21 + i, allB.get(i));
+ final int[] s = model.getVariaInt32PointerConstLen(i /* srcPos */, new int[3] /* dest */, 2 /* destPos */, 1 /* length */);
+ Assert.assertEquals(21 + i, s[2]);
+ }
}
- {
- Assert.assertEquals(14, model.getModelNamePointerCStringArrayLength());
- final ByteBuffer bb = model.getModelNamePointerCString();
- Assert.assertEquals(14, bb.limit());
-
- final String exp = "Hello CString";
- final String has = model.getModelNamePointerCStringAsString();
- // System.err.println("exp '"+exp+"'");
- System.err.println("has '"+has+"'");
- // dumpStringChars("exp", exp);
- dumpStringChars("has", has);
- Assert.assertEquals(13, has.length()); // w/o EOS
- Assert.assertEquals(exp, has);
- }
+ Assert.assertEquals(0, model.getVariaInt32PointerVariaLenElemCount());
+ Assert.assertEquals(true, model.isVariaInt32PointerVariaLenNull());
{
- Assert.assertEquals(14, model.getModelNamePointerCustomLenVal());
-
- final ByteBuffer bb = model.getModelNamePointerCustomLen();
- Assert.assertEquals(14, bb.limit());
-
- final String exp = "Hello Pointer";
- final String has = model.getModelNamePointerCustomLenAsString();
- // System.err.println("exp '"+exp+"'");
- System.err.println("has '"+has+"'");
- // dumpStringChars("exp", exp);
- dumpStringChars("has", has);
- Assert.assertEquals(13, has.length()); // w/o EOS
- Assert.assertEquals(exp, has);
+ Exception e1 = null;
+ try {
+ @SuppressWarnings("unused")
+ final IntBuffer ib = model.getVariaInt32PointerVariaLen(); // NULL -> exception
+ } catch(final Exception _e) { e1 = _e; }
+ Assert.assertNotNull(e1);
+ System.err.println("Expected exception-1: "+e1);
+
+ Exception e2 = null;
+ try {
+ @SuppressWarnings("unused")
+ final int[] ia = model.getVariaInt32PointerVariaLen(0, new int[0], 0, 0); // NULL -> exception
+ } catch(final Exception _e) { e2 = _e; }
+ Assert.assertNotNull(e2);
+ System.err.println("Expected exception-2: "+e2);
}
- binding.destroyModelConst(model);
- }
- private void dumpStringChars(final String prefix, final String s) {
- final int len = s.length();
- for(int i=0; i<len; i++) {
- final char c = s.charAt(i);
- System.err.printf("%s %3d: 0x%X %c%n", prefix, i, (int)c, c);
+ {
+ final int size = model.getVariaInt32PointerCustomLenElemCount();
+ Assert.assertEquals(4, size);
+ Assert.assertEquals(false, model.isVariaInt32PointerCustomLenNull());
+ final int[] all = model.getVariaInt32PointerCustomLen(0, new int[size], 0, size);
+ final IntBuffer allB = model.getVariaInt32PointerCustomLen();
+ Assert.assertEquals(size, all.length);
+ Assert.assertEquals(size, allB.limit());
+ for(int i=0; i<size; i++) {
+ Assert.assertEquals(31 + i, all[i]);
+ Assert.assertEquals(31 + i, allB.get(i));
+ final int[] s = model.getVariaInt32PointerCustomLen(i /* srcPos */, new int[1] /* dest */, 0 /* destPos */, 1 /* length */);
+ Assert.assertEquals(31 + i, s[0]);
+ }
}
}
- public void chapter13TestStructArrayModelMutable(final Bindingtest1 binding) throws Exception {
- final TK_ModelMutable model = binding.createModelMutable();
-
- Assert.assertEquals(3, model.getIntxxPointerCustomLenVal());
- Assert.assertEquals(3, model.getInt32PointerCustomLenVal());
- Assert.assertEquals(3, TK_ModelMutable.getInt32ArrayFixedLenArrayLength());
- Assert.assertEquals(3, TK_ModelMutable.getStructArrayFixedLenArrayLength());
- Assert.assertEquals(3, model.getStructPointerCustomLenVal());
-
- // field: int32ArrayFixedLen
- // CType['int32_t *', size [fixed false, lnx64 12], [array*1]], with array length of 3
+ /** Primitive.VariaValue.int32.Pointer - write access */
+ @SuppressWarnings("unused")
+ private void chapter12_04bTestTKFieldVariaValueInt32WriteAccess(final TK_Field model) {
+ Assert.assertEquals(1, TK_Field.getVariaInt32PointerConstOneElemElemCount());
+ Assert.assertEquals(false, model.isVariaInt32PointerConstOneElemNull());
+ model.setVariaInt32PointerConstOneElem(109);
+ Assert.assertEquals(109, model.getVariaInt32PointerConstOneElem());
+
+ Assert.assertEquals(0, model.getVariaInt32PointerMaxOneElemElemCount());
+ Assert.assertEquals(true, model.isVariaInt32PointerMaxOneElemNull());
+ model.setVariaInt32PointerMaxOneElem(110);
+ Assert.assertEquals(1, model.getVariaInt32PointerMaxOneElemElemCount());
+ Assert.assertEquals(false, model.isVariaInt32PointerMaxOneElemNull());
+ Assert.assertEquals(110, model.getVariaInt32PointerMaxOneElem());
+ model.releaseVariaInt32PointerMaxOneElem();
+ Assert.assertEquals(0, model.getVariaInt32PointerMaxOneElemElemCount());
+ Assert.assertEquals(true, model.isVariaInt32PointerMaxOneElemNull());
+
+ Assert.assertEquals(3, TK_Field.getVariaInt32PointerConstLenElemCount());
+ Assert.assertEquals(false, model.isVariaInt32PointerConstLenNull());
{
- final int size = TK_ModelMutable.getInt32ArrayFixedLenArrayLength();
+ // write 1 via IntBuffer reference get
{
- final int[] values = new int[] { 1, 2, 3 };
- model.setInt32ArrayFixedLen(0, values);
-
- final int[] all = model.getInt32ArrayFixedLen(0, new int[size]);
- final IntBuffer allB = model.getInt32ArrayFixedLen();
+ final IntBuffer ib = model.getVariaInt32PointerConstLen();
+ Assert.assertEquals(3, ib.limit());
+ for(int i=0; i<3; ++i) {
+ ib.put(i, 120+i);
+ }
+ }
+ // verify 1
+ {
+ final int size = TK_Field.getVariaInt32PointerConstLenElemCount();
+ Assert.assertEquals(3, size);
+ final int[] all = model.getVariaInt32PointerConstLen(0, new int[size], 0, size);
+ final IntBuffer allB = model.getVariaInt32PointerConstLen();
+ Assert.assertEquals(size, all.length);
Assert.assertEquals(size, allB.limit());
for(int i=0; i<size; i++) {
- Assert.assertEquals(1 + i, all[i]);
- Assert.assertEquals(1 + i, allB.get(i));
- final int[] s = model.getInt32ArrayFixedLen(i, new int[1]);
- Assert.assertEquals(1 + i, s[0]);
+ Assert.assertEquals(120 + i, all[i]);
+ Assert.assertEquals(120 + i, allB.get(i));
+ final int[] s = model.getVariaInt32PointerConstLen(i, new int[1], 0, 1);
+ Assert.assertEquals(120 + i, s[0]);
}
}
+ // write 2 via int[] set
+ {
+ final int[] ia = { 220, 221, 222 };
+ model.setVariaInt32PointerConstLen(ia, 0, 0, ia.length);
+ }
+ // verify 2
{
+ final int size = TK_Field.getVariaInt32PointerConstLenElemCount();
+ Assert.assertEquals(3, size);
+ final int[] all = model.getVariaInt32PointerConstLen(0, new int[size], 0, size);
+ final IntBuffer allB = model.getVariaInt32PointerConstLen();
+ Assert.assertEquals(size, all.length);
+ Assert.assertEquals(size, allB.limit());
for(int i=0; i<size; i++) {
- final int[] ia = new int[] { 4 + i };
- model.setInt32ArrayFixedLen(i, ia);
+ System.err.printf("%d/%d: A %d, B %d%n", i, size, all[i], allB.get(i));
}
-
- final int[] all = model.getInt32ArrayFixedLen(0, new int[size]);
- final IntBuffer allB = model.getInt32ArrayFixedLen();
- Assert.assertEquals(size, allB.limit());
for(int i=0; i<size; i++) {
- Assert.assertEquals(4 + i, all[i]);
- Assert.assertEquals(4 + i, allB.get(i));
- final int[] s = model.getInt32ArrayFixedLen(i, new int[1]);
- Assert.assertEquals(4 + i, s[0]);
+ Assert.assertEquals(220 + i, all[i]);
+ Assert.assertEquals(220 + i, allB.get(i));
+ final int[] s = model.getVariaInt32PointerConstLen(i, new int[1], 0, 1);
+ Assert.assertEquals(220 + i, s[0]);
}
}
- }
-
- // field: int32ArrayOneElem
- // CType['int32_t *', size [fixed false, lnx64 4], [array*1]], with array length of 1
- {
- model.setInt32ArrayOneElem(1);
- Assert.assertEquals(1, model.getInt32ArrayOneElem());
- }
-
- // field: int32PointerCustomLen
- // field: CType['int32_t *', size [fixed false, lnx64 8], [pointer*1]], with array length of getInt32PointerCustomLenVal()
- {
- final int size = model.getInt32PointerCustomLenVal();
{
- final IntBuffer all0 = model.getInt32PointerCustomLen();
- Assert.assertEquals(size, all0.limit());
- for(int i=0; i<size; i++) {
- all0.put(i, 1+i);
+ }
+ // write 3 via int[] single set @ offset
+ if( false ) {
+ {
+ final int[] ia = { 0, 320, 321, 322 };
+ for(int i=0; i<3; i++) {
+ model.setVariaInt32PointerConstLen(ia, i+1, i, 3-i);
}
-
- final IntBuffer all1 = model.getInt32PointerCustomLen();
- Assert.assertEquals(size, all1.limit());
+ model.setVariaInt32PointerConstLen(new int[]{ 0, 320, 0, 0 }, 0+1 /* srcPos */, 0 /* destPos */, 3);
+ model.setVariaInt32PointerConstLen(new int[]{ 0, 0, 321, 0 }, 1+1 /* srcPos */, 1 /* destPos */, 2);
+ model.setVariaInt32PointerConstLen(new int[]{ 0, 0, 0, 322 }, 2+1 /* srcPos */, 2 /* destPos */, 1);
+ }
+ // verify 3
+ {
+ final int size = TK_Field.getVariaInt32PointerConstLenElemCount();
+ Assert.assertEquals(3, size);
+ final int[] all = model.getVariaInt32PointerConstLen(0, new int[size], 0, size);
+ final IntBuffer allB = model.getVariaInt32PointerConstLen();
+ Assert.assertEquals(size, all.length);
+ Assert.assertEquals(size, allB.limit());
for(int i=0; i<size; i++) {
- Assert.assertEquals(1 + i, all1.get(i));
+ Assert.assertEquals(320 + i, all[i]);
+ Assert.assertEquals(320 + i, allB.get(i));
+ final int[] s = model.getVariaInt32PointerConstLen(i, new int[1], 0, 1);
+ Assert.assertEquals(320 + i, s[0]);
}
}
- }
-
- // field: int32PointerOneElem
- // CType['int32_t *', size [fixed false, lnx64 8], [pointer*1]], with array length of 1
- {
- {
- final IntBuffer one0 = model.getInt32PointerOneElem();
- Assert.assertEquals(1, one0.limit());
- one0.put(0, 1);
-
- final IntBuffer one1 = model.getInt32PointerOneElem();
- Assert.assertEquals(1, one1.limit());
- Assert.assertEquals(1, one1.get(0));
}
}
-
- // field: mat4x4
- // CType['float * *', size [fixed false, lnx64 64], [array*2]], with array length of <code>4*4</code> */
+ Assert.assertEquals(0, model.getVariaInt32PointerVariaLenElemCount());
+ Assert.assertEquals(true, model.isVariaInt32PointerVariaLenNull());
{
- model.setMat4x4(0*4, new float[] { 11, 12, 13, 14 } );
- model.setMat4x4(1*4, new float[] { 21, 22, 23, 24 } );
- model.setMat4x4(2*4, new float[] { 31, 32, 33, 34 } );
- model.setMat4x4(3*4, new float[] { 41, 42, 43, 44 } );
-
- Assert.assertEquals(4*4, TK_ModelMutable.getMat4x4ArrayLength());
- final FloatBuffer mat4x4 = model.getMat4x4();
- Assert.assertEquals(4*4, mat4x4.limit());
- for(int i=0; i<4; i++) {
- final float[] vec4 = model.getMat4x4(i*4, new float[4]);
- for(int j=0; j<4; j++) {
- Assert.assertEquals((i+1)*10+(j+1), mat4x4.get(i*4+j), EPSILON);
- Assert.assertEquals((i+1)*10+(j+1), vec4[j], EPSILON);
- }
- }
+ Exception e1 = null;
+ try {
+ @SuppressWarnings("unused")
+ final IntBuffer ib = model.getVariaInt32PointerVariaLen(); // NULL -> exception
+ } catch(final Exception _e) { e1 = _e; }
+ Assert.assertNotNull(e1);
+ System.err.println("Expected exception-1: "+e1);
+
+ Exception e2 = null;
+ try {
+ @SuppressWarnings("unused")
+ final int[] ia = model.getVariaInt32PointerVariaLen(0, new int[0], 0, 0); // NULL -> exception
+ } catch(final Exception _e) { e2 = _e; }
+ Assert.assertNotNull(e2);
+ System.err.println("Expected exception-2: "+e2);
}
-
- // field: structArrayFixedLen
- // field: CType['TK_Dimension *', size [fixed false, lnx64 48], [array*1]], with array length of 3
{
- final int size = TK_ModelMutable.getStructArrayFixedLenArrayLength();
+ // write 1 via int[] set, also actually allocating initial memory
+ {
+ final int[] ia = { 220, 221, 222, 223, 224 };
+ model.setVariaInt32PointerVariaLen(ia, 0, 0, ia.length);
+ }
+ // verify 1
{
+ final int size = model.getVariaInt32PointerVariaLenElemCount();
+ Assert.assertEquals(5, size);
+ final int[] all = model.getVariaInt32PointerVariaLen(0, new int[size], 0, size);
+ final IntBuffer allB = model.getVariaInt32PointerVariaLen();
+ Assert.assertEquals(size, all.length);
+ Assert.assertEquals(size, allB.limit());
for(int i=0; i<size; i++) {
- final TK_Dimension d = TK_Dimension.create();
- d.setX(1+i*10);
- d.setY(2+i*10);
- d.setWidth(3+i*10);
- d.setHeight(4+i*10);
- model.setStructArrayFixedLen(i, d);
+ Assert.assertEquals(220 + i, all[i]);
+ Assert.assertEquals(220 + i, allB.get(i));
+ final int[] s = model.getVariaInt32PointerVariaLen(i, new int[1], 0, 1);
+ Assert.assertEquals(220 + i, s[0]);
}
- final TK_Dimension[] all = model.getStructArrayFixedLen(0, new TK_Dimension[size]);
- for(int i=0; i<size; i++) {
- Assert.assertEquals(1 + i * 10, all[i].getX());
- Assert.assertEquals(2 + i * 10, all[i].getY());
- Assert.assertEquals(3 + i * 10, all[i].getWidth());
- Assert.assertEquals(4 + i * 10, all[i].getHeight());
- final TK_Dimension[] one = model.getStructArrayFixedLen(i, new TK_Dimension[1]);
- Assert.assertEquals(1 + i * 10, one[0].getX());
- Assert.assertEquals(2 + i * 10, one[0].getY());
- Assert.assertEquals(3 + i * 10, one[0].getWidth());
- Assert.assertEquals(4 + i * 10, one[0].getHeight());
+ }
+ // write 2 via IntBuffer reference get
+ {
+ final IntBuffer ib = model.getVariaInt32PointerVariaLen();
+ Assert.assertEquals(5, ib.limit());
+ for(int i=0; i<5; ++i) {
+ ib.put(i, 120+i);
}
}
+ // verify 2
{
- final TK_Dimension[] da = new TK_Dimension[size];
+ final int size = model.getVariaInt32PointerVariaLenElemCount();
+ Assert.assertEquals(5, size);
+ final int[] all = model.getVariaInt32PointerVariaLen(0, new int[size], 0, size);
+ final IntBuffer allB = model.getVariaInt32PointerVariaLen();
+ Assert.assertEquals(size, all.length);
+ Assert.assertEquals(size, allB.limit());
for(int i=0; i<size; i++) {
- final TK_Dimension d = TK_Dimension.create();
- d.setX(5+i*10);
- d.setY(6+i*10);
- d.setWidth(7+i*10);
- d.setHeight(8+i*10);
- da[i] = d;
+ Assert.assertEquals(120 + i, all[i]);
+ Assert.assertEquals(120 + i, allB.get(i));
+ final int[] s = model.getVariaInt32PointerVariaLen(i, new int[1], 0, 1);
+ Assert.assertEquals(120 + i, s[0]);
}
- model.setStructArrayFixedLen(0, da);
+ }
+ model.releaseVariaInt32PointerVariaLen();
+ Assert.assertEquals(0, model.getVariaInt32PointerVariaLenElemCount());
+ Assert.assertEquals(true, model.isVariaInt32PointerVariaLenNull());
+ }
- final TK_Dimension[] all = model.getStructArrayFixedLen(0, new TK_Dimension[size]);
- for(int i=0; i<size; i++) {
- Assert.assertEquals(5 + i * 10, all[i].getX());
- Assert.assertEquals(6 + i * 10, all[i].getY());
- Assert.assertEquals(7 + i * 10, all[i].getWidth());
- Assert.assertEquals(8 + i * 10, all[i].getHeight());
- final TK_Dimension[] one = model.getStructArrayFixedLen(i, new TK_Dimension[1]);
- Assert.assertEquals(5 + i * 10, one[0].getX());
- Assert.assertEquals(6 + i * 10, one[0].getY());
- Assert.assertEquals(7 + i * 10, one[0].getWidth());
- Assert.assertEquals(8 + i * 10, one[0].getHeight());
+ {
+ // write 1 via IntBuffer reference get
+ {
+ final int size = model.getVariaInt32PointerCustomLenElemCount();
+ Assert.assertEquals(4, size);
+ Assert.assertEquals(false, model.isVariaInt32PointerCustomLenNull());
+ final IntBuffer ib = model.getVariaInt32PointerCustomLen();
+ Assert.assertEquals(size, ib.limit());
+ for(int i=0; i<size; ++i) {
+ ib.put(i, 120+i);
}
}
+ // verify 1
{
+ final int size = model.getVariaInt32PointerCustomLenElemCount();
+ Assert.assertEquals(4, size);
+ final int[] all = model.getVariaInt32PointerCustomLen(0, new int[size], 0, size);
+ final IntBuffer allB = model.getVariaInt32PointerCustomLen();
+ Assert.assertEquals(size, all.length);
+ Assert.assertEquals(size, allB.limit());
for(int i=0; i<size; i++) {
- final TK_Dimension d = TK_Dimension.create();
- d.setX(1+i*10);
- d.setY(3+i*10);
- d.setWidth(5+i*10);
- d.setHeight(7+i*10);
- model.setStructArrayFixedLen(i, new TK_Dimension[] { d });
+ Assert.assertEquals(120 + i, all[i]);
+ Assert.assertEquals(120 + i, allB.get(i));
+ final int[] s = model.getVariaInt32PointerCustomLen(i, new int[1], 0, 1);
+ Assert.assertEquals(120 + i, s[0]);
}
-
- final TK_Dimension[] all = model.getStructArrayFixedLen(0, new TK_Dimension[size]);
+ }
+ // write 2 via int[] set
+ {
+ final int[] ia = { 0, 220, 221, 222, 223, 224, 0 };
+ model.setVariaInt32PointerCustomLen(ia, 1 /* srcPos */, 0 /* destPos */, ia.length-2);
+ }
+ // verify 2
+ {
+ final int size = model.getVariaInt32PointerCustomLenElemCount();
+ Assert.assertEquals(5, size);
+ final int[] all = model.getVariaInt32PointerCustomLen(0, new int[size], 0, size);
+ final IntBuffer allB = model.getVariaInt32PointerCustomLen();
+ Assert.assertEquals(size, all.length);
+ Assert.assertEquals(size, allB.limit());
for(int i=0; i<size; i++) {
- Assert.assertEquals(1 + i * 10, all[i].getX());
- Assert.assertEquals(3 + i * 10, all[i].getY());
- Assert.assertEquals(5 + i * 10, all[i].getWidth());
- Assert.assertEquals(7 + i * 10, all[i].getHeight());
- final TK_Dimension[] one = model.getStructArrayFixedLen(i, new TK_Dimension[1]);
- Assert.assertEquals(1 + i * 10, one[0].getX());
- Assert.assertEquals(3 + i * 10, one[0].getY());
- Assert.assertEquals(5 + i * 10, one[0].getWidth());
- Assert.assertEquals(7 + i * 10, one[0].getHeight());
+ Assert.assertEquals(220 + i, all[i]);
+ Assert.assertEquals(220 + i, allB.get(i));
+ final int[] s = model.getVariaInt32PointerCustomLen(i, new int[1], 0, 1);
+ Assert.assertEquals(220 + i, s[0]);
}
}
+ model.releaseVariaInt32PointerCustomLen(); // FIXME: Ownership is ambiguous, may leak native allocated memory, not free'ed!
+ Assert.assertEquals(0, model.getVariaInt32PointerCustomLenElemCount());
+ Assert.assertEquals(true, model.isVariaInt32PointerCustomLenNull());
}
+ }
+
+ /** Struct */
+ private void chapter12_05aTestTKFieldStruct(final TK_Field model) {
// field: structArrayOneElem
// CType['TK_Dimension *', size [fixed false, lnx64 16], [array*1]], with array length of 1
{
- {
- final TK_Dimension d = TK_Dimension.create();
- d.setX(1);
- d.setY(2);
- d.setWidth(3);
- d.setHeight(4);
- model.setStructArrayOneElem(d);
- }
- {
- final TK_Dimension one = model.getStructArrayOneElem();
- Assert.assertEquals(1, one.getX());
- Assert.assertEquals(2, one.getY());
- Assert.assertEquals(3, one.getWidth());
- Assert.assertEquals(4, one.getHeight());
- }
+ final TK_Dimension all = model.getConstStructArrayConstOneElem();
+ Assert.assertEquals(51, all.getX());
+ Assert.assertEquals(52, all.getY());
+ Assert.assertEquals(53, all.getWidth());
+ Assert.assertEquals(54, all.getHeight());
}
// field: structPointerCustomLen
// CType['TK_Dimension *', size [fixed false, lnx64 8], [pointer*1]], with array length of getStructPointerCustomLenVal()
{
- final int size = model.getStructPointerCustomLenVal();
- {
- final TK_Dimension[] all = model.getStructPointerCustomLen(0, new TK_Dimension[size]);
- for(int i=0; i<size; i++) {
- final TK_Dimension d = all[i];
- d.setX(1+i*10);
- d.setY(2+i*10);
- d.setWidth(3+i*10);
- d.setHeight(4+i*10);
- }
- }
- {
- final TK_Dimension[] all = model.getStructPointerCustomLen(0, new TK_Dimension[size]);
- for(int i=0; i<size; i++) {
- Assert.assertEquals(1 + i * 10, all[i].getX());
- Assert.assertEquals(2 + i * 10, all[i].getY());
- Assert.assertEquals(3 + i * 10, all[i].getWidth());
- Assert.assertEquals(4 + i * 10, all[i].getHeight());
- final TK_Dimension[] one = model.getStructPointerCustomLen(i, new TK_Dimension[1]);
- Assert.assertEquals(1 + i * 10, one[0].getX());
- Assert.assertEquals(2 + i * 10, one[0].getY());
- Assert.assertEquals(3 + i * 10, one[0].getWidth());
- Assert.assertEquals(4 + i * 10, one[0].getHeight());
- }
+ final int size = model.getConstStructPointerCustomLenElemCount();
+ Assert.assertEquals(4, size);
+ final TK_Dimension[] all = model.getConstStructPointerCustomLen(0, new TK_Dimension[size], 0, size);
+ for(int i=0; i<size; i++) {
+ Assert.assertEquals(131 + i * 10, all[i].getX());
+ Assert.assertEquals(132 + i * 10, all[i].getY());
+ Assert.assertEquals(133 + i * 10, all[i].getWidth());
+ Assert.assertEquals(134 + i * 10, all[i].getHeight());
}
}
// field: structPointerOneElem
// CType['TK_Dimension *', size [fixed false, lnx64 8], [pointer*1]], with array length of 1
{
+ final TK_Dimension all = model.getConstStructPointerConstOneElem();
+ Assert.assertEquals(91, all.getX());
+ Assert.assertEquals(92, all.getY());
+ Assert.assertEquals(93, all.getWidth());
+ Assert.assertEquals(94, all.getHeight());
+
+ }
+ }
+
+ private static ByteBuffer toEOSByteBuffer(final String val, final Charset cs) {
+ final byte[] ba = val.getBytes( cs );
+ final ByteBuffer bb = Buffers.newDirectByteBuffer( ba.length + 1 );
+ bb.put(ba);
+ bb.put((byte)0);
+ bb.rewind();
+ return bb;
+ }
+
+ /** String - Read Access */
+ private void chapter12_10aTestTKFieldConstStringReadAccess(final TK_Field model) {
+ {
+ final int expStrLen = 12; // w/o EOS
+ final String exp = "Hello Array1";
+ final ByteBuffer expBB = toEOSByteBuffer( exp, TK_Field.getCharset() );
+ Assert.assertEquals(expStrLen, exp.length());
+ Assert.assertEquals(expStrLen+1, expBB.limit());
+ Assert.assertEquals(expStrLen+1, TK_Field.getConstCharArrayConstLenElemCount());
+
+ final ByteBuffer hasBB = model.getConstCharArrayConstLen();
+ Assert.assertEquals(expStrLen+1, hasBB.limit());
+ Assert.assertEquals(expBB, hasBB);
+
+ final String has = model.getConstCharArrayConstLenAsString();
+ System.err.println("has '"+has+"'");
+ // dumpStringChars("has", has);
+ Assert.assertEquals(expStrLen, has.length()); // w/o EOS
+ Assert.assertEquals(exp, has);
+ }
+ {
+ final int expStrLen = 14; // w/o EOS
+ final String exp = "Hello CString1";
+ final ByteBuffer expBB = toEOSByteBuffer( exp, TK_Field.getCharset() );
+ Assert.assertEquals(expStrLen, exp.length());
+ Assert.assertEquals(expStrLen+1, expBB.limit());
+ Assert.assertEquals(expStrLen+1, TK_Field.getConstCharPointerConstLenElemCount());
+ Assert.assertEquals(false, model.isConstCharPointerConstLenNull());
+
+ final ByteBuffer hasBB = model.getConstCharPointerConstLen();
+ Assert.assertEquals(expStrLen+1, hasBB.limit());
+ Assert.assertEquals(expBB, hasBB);
+
+ final String has = model.getConstCharPointerConstLenAsString();
+ System.err.println("has '"+has+"'");
+ // dumpStringChars("has", has);
+ Assert.assertEquals(expStrLen, has.length()); // w/o EOS
+ Assert.assertEquals(exp, has);
+ }
+ {
+ Assert.assertEquals(0, model.getConstCharPointerVariaLenElemCount());
+ Assert.assertEquals(true, model.isConstCharPointerVariaLenNull());
+ }
+ {
+ final int expStrLen = 14; // w/o EOS
+ final String exp = "Hello CString3";
+ final ByteBuffer expBB = toEOSByteBuffer( exp, TK_Field.getCharset() );
+ Assert.assertEquals(expStrLen, exp.length());
+ Assert.assertEquals(expStrLen+1, expBB.limit());
+ Assert.assertEquals(expStrLen+1, model.getConstCharPointerCustomLenElemCount());
+ Assert.assertEquals(false, model.isConstCharPointerCustomLenNull());
+
+ final ByteBuffer hasBB = model.getConstCharPointerCustomLen();
+ Assert.assertEquals(expStrLen+1, hasBB.limit());
+ Assert.assertEquals(expBB, hasBB);
+
+ final String has = model.getConstCharPointerCustomLenAsString();
+ System.err.println("has '"+has+"'");
+ // dumpStringChars("has", has);
+ Assert.assertEquals(expStrLen, has.length()); // w/o EOS
+ Assert.assertEquals(exp, has);
+ }
+ }
+
+ /** String - Read Access */
+ private void chapter12_11aTestTKFieldConstStringOnlyReadAccess(final TK_Field model) {
+ {
+ final int expStrLen = 12; // w/o EOS
+ final String exp = "Hello Array1";
+ Assert.assertEquals(expStrLen, exp.length());
+ Assert.assertEquals(expStrLen+1, TK_Field.getConstStringOnlyArrayConstLenElemCount());
+
+ final String has = model.getConstStringOnlyArrayConstLen();
+ System.err.println("has '"+has+"'");
+ // dumpStringChars("has", has);
+ Assert.assertEquals(expStrLen, has.length()); // w/o EOS
+ Assert.assertEquals(exp, has);
+ }
+ {
+ final int expStrLen = 14; // w/o EOS
+ final String exp = "Hello CString1";
+ Assert.assertEquals(expStrLen, exp.length());
+ Assert.assertEquals(expStrLen+1, TK_Field.getConstStringOnlyPointerConstLenElemCount());
+ Assert.assertEquals(false, model.isConstStringOnlyPointerConstLenNull());
+
+ final String has = model.getConstStringOnlyPointerConstLen();
+ System.err.println("has '"+has+"'");
+ // dumpStringChars("has", has);
+ Assert.assertEquals(expStrLen, has.length()); // w/o EOS
+ Assert.assertEquals(exp, has);
+ }
+ {
+ Assert.assertEquals(0, model.getConstStringOnlyPointerVariaLenElemCount());
+ Assert.assertEquals(true, model.isConstStringOnlyPointerVariaLenNull());
+ }
+ {
+ final int expStrLen = 14; // w/o EOS
+ final String exp = "Hello CString3";
+ Assert.assertEquals(expStrLen, exp.length());
+ Assert.assertEquals(expStrLen+1, model.getConstStringOnlyPointerCustomLenElemCount());
+ Assert.assertEquals(false, model.isConstStringOnlyPointerCustomLenNull());
+
+ final String has = model.getConstStringOnlyPointerCustomLen();
+ System.err.println("has '"+has+"'");
+ // dumpStringChars("has", has);
+ Assert.assertEquals(expStrLen, has.length()); // w/o EOS
+ Assert.assertEquals(exp, has);
+ }
+ }
+
+ /** String - Write Access */
+ private void chapter12_11bTestTKFieldConstStringOnlyWriteAccess(final TK_Field model) {
+ {
+ Assert.assertEquals(0, model.getConstStringOnlyPointerVariaLenElemCount());
+ Assert.assertEquals(true, model.isConstStringOnlyPointerVariaLenNull());
+
+ final int expStrLen = 15; // w/o EOS
+ final String exp = "Hello World2222";
+ Assert.assertEquals(expStrLen, exp.length());
+
+ model.setConstStringOnlyPointerVariaLen(exp);
+ Assert.assertEquals(expStrLen+1, model.getConstStringOnlyPointerVariaLenElemCount());
+ Assert.assertEquals(false, model.isConstStringOnlyPointerVariaLenNull());
+
+ final String has = model.getConstStringOnlyPointerVariaLen();
+ System.err.println("has '"+has+"'");
+ // dumpStringChars("has", has);
+ Assert.assertEquals(expStrLen, has.length()); // w/o EOS
+ Assert.assertEquals(exp, has);
+
+ model.releaseConstStringOnlyPointerVariaLen();
+ Assert.assertEquals(0, model.getConstStringOnlyPointerVariaLenElemCount());
+ Assert.assertEquals(true, model.isConstStringOnlyPointerVariaLenNull());
+ }
+ {
+ final int expStrLen = 15; // w/o EOS
+ final String exp = "Hello World4444";
+ Assert.assertEquals(expStrLen, exp.length());
+ Assert.assertEquals(false, model.isConstStringOnlyPointerCustomLenNull());
+
+ model.setConstStringOnlyPointerCustomLen(exp);
+ Assert.assertEquals(expStrLen+1, model.getConstStringOnlyPointerCustomLenElemCount());
+ Assert.assertEquals(false, model.isConstStringOnlyPointerCustomLenNull());
+
+ final String has = model.getConstStringOnlyPointerCustomLen();
+ System.err.println("has '"+has+"'");
+ // dumpStringChars("has", has);
+ Assert.assertEquals(expStrLen, has.length()); // w/o EOS
+ Assert.assertEquals(exp, has);
+
+ model.releaseConstStringOnlyPointerCustomLen(); // FIXME: Ownership is ambiguous, may leak native allocated memory, not free'ed!
+ Assert.assertEquals(0, model.getConstStringOnlyPointerCustomLenElemCount());
+ Assert.assertEquals(true, model.isConstStringOnlyPointerCustomLenNull());
+ }
+ }
+
+ /** Test array and pointer bindings of structs */
+ public void chapter12TestTKField(final Bindingtest1 binding) throws Exception {
+ Assert.assertEquals(false, TK_Field.usesNativeCode());
+ Assert.assertNotEquals(0, TK_Field.size());
+
+ final TK_Field model0 = binding.createTKField();
+ {
+ // Fetch native memory
+ final ByteBuffer bb0 = model0.getBuffer();
+ Assert.assertNotNull(bb0);
+ Assert.assertEquals(TK_Field.size(), bb0.limit());
+
+ final long addr0 = model0.getDirectBufferAddress();
+ Assert.assertNotEquals(0, addr0);
+
+ // Compare a reference by memory address -> identical!
{
- final TK_Dimension d = model.getStructPointerOneElem();
- d.setX(1);
- d.setY(2);
- d.setWidth(3);
- d.setHeight(4);
+ final TK_Field model1 = TK_Field.derefPointer(addr0);
+ final ByteBuffer bb1 = model1.getBuffer();
+ Assert.assertNotNull(bb1);
+ Assert.assertEquals(TK_Field.size(), bb1.limit());
+
+ final long addr1 = model1.getDirectBufferAddress();
+ Assert.assertNotEquals(0, addr1);
}
- {
- final TK_Dimension one = model.getStructPointerOneElem();
- Assert.assertEquals(1, one.getX());
- Assert.assertEquals(2, one.getY());
- Assert.assertEquals(3, one.getWidth());
- Assert.assertEquals(4, one.getHeight());
+ }
+
+ chapter12_03aTestTKFieldConstValueInt32ReadAccess(model0);
+ chapter12_03bTestTKFieldConstValueInt32WriteAccess(model0);
+ chapter12_04aTestTKFieldVariaValueInt32ReadAccess(model0);
+ chapter12_04bTestTKFieldVariaValueInt32WriteAccess(model0);
+ chapter12_05aTestTKFieldStruct(model0);
+ chapter12_10aTestTKFieldConstStringReadAccess(model0);
+ chapter12_11aTestTKFieldConstStringOnlyReadAccess(model0);
+ chapter12_11bTestTKFieldConstStringOnlyWriteAccess(model0);
+
+ binding.destroyTKField(model0);
+ }
+ @SuppressWarnings("unused")
+ private void dumpStringChars(final String prefix, final String s) {
+ final int len = s.length();
+ for(int i=0; i<len; i++) {
+ final char c = s.charAt(i);
+ System.err.printf("%s %3d: 0x%X %c%n", prefix, i, (int)c, c);
+ }
+ }
+
+ public void chapter13TestTKFieldImmutable(final Bindingtest1 binding) throws Exception {
+ Assert.assertEquals(false, TK_FieldImmutable.usesNativeCode());
+
+ final TK_FieldImmutable model = binding.createTKFieldImmutable();
+
+ binding.destroyTKFieldImmutable(model);
+ }
+
+ public void chapter15TestTKMixed(final Bindingtest1 binding) throws Exception {
+ Assert.assertEquals(false, TK_ModelMixed.usesNativeCode());
+
+ final TK_ModelMixed model = binding.createTKModelMixed();
+
+ Assert.assertEquals(4*4, TK_ModelMixed.getMat4x4ElemCount());
+ {
+ final FloatBuffer mat4x4 = model.getMat4x4();
+ Assert.assertEquals(4*4, mat4x4.limit());
+ for(int i=0; i<4; i++) {
+ final float[] vec4 = model.getMat4x4(i*4, new float[4], 0, 4);
+ for(int j=0; j<4; j++) {
+ Assert.assertEquals(i*4+j, mat4x4.get(i*4+j), EPSILON);
+ Assert.assertEquals(i*4+j, vec4[j], EPSILON);
+ }
}
+ }
+ {
+ final float[] data = { 11, 12, 13, 14,
+ 21, 22, 23, 24,
+ 31, 32, 33, 34,
+ 41, 42, 43, 44 };
+ model.setMat4x4(data, 0*4, 0*4, 4);
+ model.setMat4x4(data, 1*4, 1*4, 4);
+ model.setMat4x4(data, 2*4, 2*4, 4);
+ model.setMat4x4(data, 3*4, 3*4, 4);
+ final FloatBuffer mat4x4 = model.getMat4x4();
+ Assert.assertEquals(4*4, mat4x4.limit());
+ for(int i=0; i<4; i++) {
+ final float[] vec4 = model.getMat4x4(i*4, new float[4], 0, 4);
+ for(int j=0; j<4; j++) {
+ Assert.assertEquals((i+1)*10+(j+1), mat4x4.get(i*4+j), EPSILON);
+ Assert.assertEquals((i+1)*10+(j+1), vec4[j], EPSILON);
+ }
+ }
}
final long surfaceContext = model.getCtx();
@@ -1819,7 +2255,5 @@ public class BaseClass extends SingletonJunitCase {
model.setCtx(surfaceContext);
assertAPTR(surfaceContext, model.getCtx());
-
- binding.destroyModelMutable(model);
}
}
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 5809acf..3e19232 100644
--- a/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p1JavaEmitter.java
+++ b/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p1JavaEmitter.java
@@ -145,19 +145,24 @@ public class Test1p1JavaEmitter extends BaseClass {
}
/**
- * Test compound access read-only
+ * Test compound access read-write
*/
@Test
- public void chapter12TestStructArrayModelConst() throws Exception {
- chapter12TestStructArrayModelConst(new Bindingtest1p1Impl());
+ public void chapter12TestTKField() throws Exception {
+ chapter12TestTKField(new Bindingtest1p1Impl());
}
/**
- * Test compound access read-write
+ * Test compound access read-only
*/
@Test
- public void chapter13TestStructArrayModelMutable() throws Exception {
- chapter13TestStructArrayModelMutable(new Bindingtest1p1Impl());
+ public void chapter13TestTKFieldImmutable() throws Exception {
+ chapter13TestTKFieldImmutable(new Bindingtest1p1Impl());
+ }
+
+ @Test
+ public void chapter15TestTKMixed() throws Exception {
+ chapter15TestTKMixed(new Bindingtest1p1Impl());
}
public static void main(final String args[]) throws IOException {
diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p2DynamicLibraryBundle.java b/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p2DynamicLibraryBundle.java
index c063d15..def7655 100644
--- a/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p2DynamicLibraryBundle.java
+++ b/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p2DynamicLibraryBundle.java
@@ -28,6 +28,7 @@
package com.jogamp.gluegen.test.junit.generation;
+import com.jogamp.gluegen.test.junit.generation.impl.Bindingtest1p1Impl;
import com.jogamp.gluegen.test.junit.generation.impl.Bindingtest1p2Impl;
import com.jogamp.common.os.DynamicLibraryBundle;
import com.jogamp.common.os.DynamicLibraryBundleInfo;
@@ -152,19 +153,24 @@ public class Test1p2DynamicLibraryBundle extends BaseClass {
}
/**
- * Test compound access read-only
+ * Test compound access read-write
*/
@Test
- public void chapter12TestStructArrayModelConst() throws Exception {
- chapter12TestStructArrayModelConst(new Bindingtest1p2Impl());
+ public void chapter12TestTKField() throws Exception {
+ chapter12TestTKField(new Bindingtest1p2Impl());
}
/**
- * Test compound access read-write
+ * Test compound access read-only
*/
@Test
- public void chapter13TestStructArrayModelMutable() throws Exception {
- chapter13TestStructArrayModelMutable(new Bindingtest1p2Impl());
+ public void chapter13TestTKFieldImmutable() throws Exception {
+ chapter13TestTKFieldImmutable(new Bindingtest1p2Impl());
+ }
+
+ @Test
+ public void chapter15TestTKMixed() throws Exception {
+ chapter15TestTKMixed(new Bindingtest1p2Impl());
}
/**
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 fa99915..711f218 100644
--- a/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p2ProcAddressEmitter.java
+++ b/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p2ProcAddressEmitter.java
@@ -154,19 +154,24 @@ public class Test1p2ProcAddressEmitter extends BaseClass {
}
/**
- * Test compound access read-only
+ * Test compound access read-write
*/
@Test
- public void chapter12TestStructArrayModelConst() throws Exception {
- chapter12TestStructArrayModelConst(new Bindingtest1p2Impl());
+ public void chapter12TestTKField() throws Exception {
+ chapter12TestTKField(new Bindingtest1p2Impl());
}
/**
- * Test compound access read-write
+ * Test compound access read-only
*/
@Test
- public void chapter13TestStructArrayModelMutable() throws Exception {
- chapter13TestStructArrayModelMutable(new Bindingtest1p2Impl());
+ public void chapter13TestTKFieldImmutable() throws Exception {
+ chapter13TestTKFieldImmutable(new Bindingtest1p2Impl());
+ }
+
+ @Test
+ public void chapter15TestTKMixed() throws Exception {
+ chapter15TestTKMixed(new Bindingtest1p2Impl());
}
/**
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 6c516c2..7e9ba4a 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
@@ -71,39 +71,300 @@ ReturnValueCapacity TK_Surface.getClip sizeof(TK_Dimension)
ReturnValueCapacity createComplicatedSuperSet sizeof(TK_ComplicatedSuperSet)
-EmitStruct TK_ModelConst
-StructPackage TK_ModelConst com.jogamp.gluegen.test.junit.generation
-ReturnedArrayLength TK_ModelConst.intxxArrayCustomLen getIntxxArrayCustomLenVal()
-ReturnedArrayLength TK_ModelConst.intxxPointerCustomLen getIntxxPointerCustomLenVal()
-ReturnedArrayLength TK_ModelConst.int32ArrayCustomLen getInt32ArrayCustomLenVal()
-ReturnedArrayLength TK_ModelConst.int32PointerCustomLen getInt32PointerCustomLenVal()
-ReturnedArrayLength TK_ModelConst.structArrayCustomLen getStructArrayCustomLenVal()
-ReturnedArrayLength TK_ModelConst.structPointerCustomLen getStructPointerCustomLenVal()
-ReturnedArrayLength TK_ModelConst.int32PointerOneElem 1
-ReturnValueCapacity TK_ModelConst.int32PointerOneElem 1 * sizeof(int32_t) /* overridden by ReturnValueCapacity */
-ReturnedArrayLength TK_ModelConst.structPointerOneElem 1
-ReturnsString TK_ModelConst.modelNameArrayFixedLen
-ReturnsString TK_ModelConst.modelNamePointerCString
-ReturnsString TK_ModelConst.modelNamePointerCustomLen
-ReturnedArrayLength TK_ModelConst.modelNamePointerCustomLen getModelNamePointerCustomLenVal()
-
-EmitStruct TK_ModelMutable
-StructPackage TK_ModelMutable com.jogamp.gluegen.test.junit.generation
-ReturnedArrayLength TK_ModelMutable.intxxArrayCustomLen getIntxxArrayCustomLenVal()
-ReturnedArrayLength TK_ModelMutable.intxxPointerCustomLen getIntxxPointerCustomLenVal()
-ReturnedArrayLength TK_ModelMutable.int32ArrayCustomLen getInt32ArrayCustomLenVal()
-ReturnedArrayLength TK_ModelMutable.int32PointerCustomLen getInt32PointerCustomLenVal()
-ReturnedArrayLength TK_ModelMutable.structArrayCustomLen getStructArrayCustomLenVal()
-ReturnedArrayLength TK_ModelMutable.structPointerCustomLen getStructPointerCustomLenVal()
-ReturnedArrayLength TK_ModelMutable.int32PointerOneElem 1
-ReturnedArrayLength TK_ModelMutable.structPointerOneElem 1
-ReturnsString TK_ModelMutable.modelNameArrayFixedLen
-ReturnsString TK_ModelMutable.modelNamePointerCString
-ReturnsString TK_ModelMutable.modelNamePointerCustomLen
-ReturnedArrayLength TK_ModelMutable.modelNamePointerCustomLen getModelNamePointerCustomLenVal()
-
-ReturnValueCapacity createModelConst sizeof(TK_ModelConst)
-ReturnValueCapacity createModelMutable sizeof(TK_ModelMutable)
+#
+# TK_FieldImmutable
+#
+
+EmitStruct TK_FieldImmutable
+StructPackage TK_FieldImmutable com.jogamp.gluegen.test.junit.generation
+
+# TK_FieldImmutable Primitive.ConstValue.intxx
+ImmutableAccess TK_FieldImmutable.constIntxxArrayConstOneElem
+ImmutableAccess TK_FieldImmutable.constIntxxArrayConstLen
+ImmutableAccess TK_FieldImmutable.constIntxxPointerConstOneElem
+ReturnedArrayLength TK_FieldImmutable.constIntxxPointerConstOneElem 1
+ImmutableAccess TK_FieldImmutable.constIntxxPointerMaxOneElem
+MaxOneElement TK_FieldImmutable.constIntxxPointerMaxOneElem
+ImmutableAccess TK_FieldImmutable.constIntxxPointerConstLen
+ReturnedArrayLength TK_FieldImmutable.constIntxxPointerConstLen 3
+ImmutableAccess TK_FieldImmutable.constIntxxPointerVariaLen
+ImmutableAccess TK_FieldImmutable.constIntxxPointerCustomLen
+ReturnedArrayLength TK_FieldImmutable.constIntxxPointerCustomLen getConstIntxxPointerCustomLenElemCount()
+
+# TK_FieldImmutable Primitive.VariaValue.intxx
+ImmutableAccess TK_FieldImmutable.variaIntxxArrayConstOneElem
+ImmutableAccess TK_FieldImmutable.variaIntxxArrayConstLen
+ImmutableAccess TK_FieldImmutable.variaIntxxPointerConstOneElem
+ReturnedArrayLength TK_FieldImmutable.variaIntxxPointerConstOneElem 1
+ImmutableAccess TK_FieldImmutable.variaIntxxPointerMaxOneElem
+MaxOneElement TK_FieldImmutable.variaIntxxPointerMaxOneElem
+ImmutableAccess TK_FieldImmutable.variaIntxxPointerConstLen
+ReturnedArrayLength TK_FieldImmutable.variaIntxxPointerConstLen 3
+ImmutableAccess TK_FieldImmutable.variaIntxxPointerVariaLen
+ImmutableAccess TK_FieldImmutable.variaIntxxPointerCustomLen
+ReturnedArrayLength TK_FieldImmutable.variaIntxxPointerCustomLen getVariaIntxxPointerCustomLenElemCount()
+
+# TK_FieldImmutable Primitive.ConstValue.int32
+ImmutableAccess TK_FieldImmutable.constInt32ArrayConstOneElem
+ImmutableAccess TK_FieldImmutable.constInt32ArrayConstLen
+ImmutableAccess TK_FieldImmutable.constInt32PointerConstOneElem
+ReturnedArrayLength TK_FieldImmutable.constInt32PointerConstOneElem 1
+ImmutableAccess TK_FieldImmutable.constInt32PointerMaxOneElem
+MaxOneElement TK_FieldImmutable.constInt32PointerMaxOneElem
+ImmutableAccess TK_FieldImmutable.constInt32PointerConstLen
+ReturnedArrayLength TK_FieldImmutable.constInt32PointerConstLen 3
+ImmutableAccess TK_FieldImmutable.constInt32PointerVariaLen
+ImmutableAccess TK_FieldImmutable.constInt32PointerCustomLen
+ReturnedArrayLength TK_FieldImmutable.constInt32PointerCustomLen getConstInt32PointerCustomLenElemCount()
+
+# TK_FieldImmutable Primitive.VariaValue.int32
+ImmutableAccess TK_FieldImmutable.variaInt32ArrayConstOneElem
+ImmutableAccess TK_FieldImmutable.variaInt32ArrayConstLen
+ImmutableAccess TK_FieldImmutable.variaInt32PointerConstOneElem
+ReturnedArrayLength TK_FieldImmutable.variaInt32PointerConstOneElem 1
+ImmutableAccess TK_FieldImmutable.variaInt32PointerMaxOneElem
+MaxOneElement TK_FieldImmutable.variaInt32PointerMaxOneElem
+ImmutableAccess TK_FieldImmutable.variaInt32PointerConstLen
+ReturnedArrayLength TK_FieldImmutable.variaInt32PointerConstLen 3
+ImmutableAccess TK_FieldImmutable.variaInt32PointerVariaLen
+ImmutableAccess TK_FieldImmutable.variaInt32PointerCustomLen
+ReturnedArrayLength TK_FieldImmutable.variaInt32PointerCustomLen getVariaInt32PointerCustomLenElemCount()
+
+# TK_FieldImmutable Struct.ConstValue.TK_Dimension
+ImmutableAccess TK_FieldImmutable.constStructArrayConstOneElem
+ImmutableAccess TK_FieldImmutable.constStructArrayConstLen
+ImmutableAccess TK_FieldImmutable.constStructPointerConstOneElem
+ReturnedArrayLength TK_FieldImmutable.constStructPointerConstOneElem 1
+ImmutableAccess TK_FieldImmutable.constStructPointerMaxOneElem
+MaxOneElement TK_FieldImmutable.constStructPointerMaxOneElem
+ImmutableAccess TK_FieldImmutable.constStructPointerConstLen
+ReturnedArrayLength TK_FieldImmutable.constStructPointerConstLen 3
+ImmutableAccess TK_FieldImmutable.constStructPointerVariaLen
+ImmutableAccess TK_FieldImmutable.constStructPointerCustomLen
+ReturnedArrayLength TK_FieldImmutable.constStructPointerCustomLen getConstStructPointerCustomLenElemCount()
+
+# TK_FieldImmutable Struct.VariaValue.TK_Dimension
+ImmutableAccess TK_FieldImmutable.variaStructArrayConstOneElem
+ImmutableAccess TK_FieldImmutable.variaStructArrayConstLen
+ImmutableAccess TK_FieldImmutable.variaStructPointerConstOneElem
+ReturnedArrayLength TK_FieldImmutable.variaStructPointerConstOneElem 1
+ImmutableAccess TK_FieldImmutable.variaStructPointerMaxOneElem
+MaxOneElement TK_FieldImmutable.variaStructPointerMaxOneElem
+ImmutableAccess TK_FieldImmutable.variaStructPointerConstLen
+ReturnedArrayLength TK_FieldImmutable.variaStructPointerConstLen 3
+ImmutableAccess TK_FieldImmutable.variaStructPointerVariaLen
+ImmutableAccess TK_FieldImmutable.variaStructPointerCustomLen
+ReturnedArrayLength TK_FieldImmutable.variaStructPointerCustomLen getVariaStructPointerCustomLenElemCount()
+
+# TK_FieldImmutable String.ConstValue 1A + 3P = 4
+ImmutableAccess TK_FieldImmutable.constCharArrayConstLen
+ReturnsString TK_FieldImmutable.constCharArrayConstLen
+ImmutableAccess TK_FieldImmutable.constCharPointerConstLen
+ReturnsString TK_FieldImmutable.constCharPointerConstLen
+ReturnedArrayLength TK_FieldImmutable.constCharPointerConstLen 15
+ImmutableAccess TK_FieldImmutable.constCharPointerVariaLen
+ReturnsString TK_FieldImmutable.constCharPointerVariaLen
+ImmutableAccess TK_FieldImmutable.constCharPointerCustomLen
+ReturnsString TK_FieldImmutable.constCharPointerCustomLen
+ReturnedArrayLength TK_FieldImmutable.constCharPointerCustomLen getConstCharPointerCustomLenElemCount()
+
+# TK_FieldImmutable String.VariaValue 1A + 3P = 4
+ImmutableAccess TK_FieldImmutable.variaCharArrayConstLen
+ReturnsString TK_FieldImmutable.variaCharArrayConstLen
+ImmutableAccess TK_FieldImmutable.variaCharPointerConstLen
+ReturnsString TK_FieldImmutable.variaCharPointerConstLen
+ReturnedArrayLength TK_FieldImmutable.variaCharPointerConstLen 15
+ImmutableAccess TK_FieldImmutable.variaCharPointerVariaLen
+ReturnsString TK_FieldImmutable.variaCharPointerVariaLen
+ImmutableAccess TK_FieldImmutable.variaCharPointerCustomLen
+ReturnsString TK_FieldImmutable.variaCharPointerCustomLen
+ReturnedArrayLength TK_FieldImmutable.variaCharPointerCustomLen getVariaCharPointerCustomLenElemCount()
+
+# TK_FieldImmutable StringOnly.ConstValue 1A + 3P = 4
+ImmutableAccess TK_FieldImmutable.constStringOnlyArrayConstLen
+ReturnsStringOnly TK_FieldImmutable.constStringOnlyArrayConstLen
+ImmutableAccess TK_FieldImmutable.constStringOnlyPointerConstLen
+ReturnsStringOnly TK_FieldImmutable.constStringOnlyPointerConstLen
+ReturnedArrayLength TK_FieldImmutable.constStringOnlyPointerConstLen 15
+ImmutableAccess TK_FieldImmutable.constStringOnlyPointerVariaLen
+ReturnsStringOnly TK_FieldImmutable.constStringOnlyPointerVariaLen
+ImmutableAccess TK_FieldImmutable.constStringOnlyPointerCustomLen
+ReturnsStringOnly TK_FieldImmutable.constStringOnlyPointerCustomLen
+ReturnedArrayLength TK_FieldImmutable.constStringOnlyPointerCustomLen getConstStringOnlyPointerCustomLenElemCount()
+
+# TK_FieldImmutable StringOnly.VariaValue 1A + 3P = 4
+ImmutableAccess TK_FieldImmutable.variaStringOnlyArrayConstLen
+ReturnsStringOnly TK_FieldImmutable.variaStringOnlyArrayConstLen
+ImmutableAccess TK_FieldImmutable.variaStringOnlyPointerConstLen
+ReturnsStringOnly TK_FieldImmutable.variaStringOnlyPointerConstLen
+ReturnedArrayLength TK_FieldImmutable.variaStringOnlyPointerConstLen 15
+ImmutableAccess TK_FieldImmutable.variaStringOnlyPointerVariaLen
+ReturnsStringOnly TK_FieldImmutable.variaStringOnlyPointerVariaLen
+ImmutableAccess TK_FieldImmutable.variaStringOnlyPointerCustomLen
+ReturnsStringOnly TK_FieldImmutable.variaStringOnlyPointerCustomLen
+ReturnedArrayLength TK_FieldImmutable.variaStringOnlyPointerCustomLen getVariaStringOnlyPointerCustomLenElemCount()
+
+
+#
+# TK_StructImmutable
+#
+
+EmitStruct TK_StructImmutable
+StructPackage TK_StructImmutable com.jogamp.gluegen.test.junit.generation
+
+ImmutableAccess TK_StructImmutable
+
+# TK_StructImmutable Primitive.ConstValue.intxx
+ReturnedArrayLength TK_StructImmutable.constIntxxPointerConstOneElem 1
+MaxOneElement TK_StructImmutable.constIntxxPointerMaxOneElem
+ReturnedArrayLength TK_StructImmutable.constIntxxPointerConstLen 3
+ReturnedArrayLength TK_StructImmutable.constIntxxPointerCustomLen getConstIntxxPointerCustomLenElemCount()
+
+# TK_StructImmutable Primitive.VariaValue.intxx
+ReturnedArrayLength TK_StructImmutable.variaIntxxPointerConstOneElem 1
+MaxOneElement TK_StructImmutable.variaIntxxPointerMaxOneElem
+ReturnedArrayLength TK_StructImmutable.variaIntxxPointerConstLen 3
+ReturnedArrayLength TK_StructImmutable.variaIntxxPointerCustomLen getVariaIntxxPointerCustomLenElemCount()
+
+# TK_StructImmutable Primitive.ConstValue.int32
+ReturnedArrayLength TK_StructImmutable.constInt32PointerConstOneElem 1
+MaxOneElement TK_StructImmutable.constInt32PointerMaxOneElem
+ReturnedArrayLength TK_StructImmutable.constInt32PointerConstLen 3
+ReturnedArrayLength TK_StructImmutable.constInt32PointerCustomLen getConstInt32PointerCustomLenElemCount()
+
+# TK_StructImmutable Primitive.VariaValue.int32
+ReturnedArrayLength TK_StructImmutable.variaInt32PointerConstOneElem 1
+MaxOneElement TK_StructImmutable.variaInt32PointerMaxOneElem
+ReturnedArrayLength TK_StructImmutable.variaInt32PointerConstLen 3
+ReturnedArrayLength TK_StructImmutable.variaInt32PointerCustomLen getVariaInt32PointerCustomLenElemCount()
+
+# TK_StructImmutable Struct.ConstValue.TK_Dimension
+ReturnedArrayLength TK_StructImmutable.constStructPointerConstOneElem 1
+MaxOneElement TK_StructImmutable.constStructPointerMaxOneElem
+ReturnedArrayLength TK_StructImmutable.constStructPointerConstLen 3
+ReturnedArrayLength TK_StructImmutable.constStructPointerCustomLen getConstStructPointerCustomLenElemCount()
+
+# TK_StructImmutable Struct.VariaValue.TK_Dimension
+ReturnedArrayLength TK_StructImmutable.variaStructPointerConstOneElem 1
+MaxOneElement TK_StructImmutable.variaStructPointerMaxOneElem
+ReturnedArrayLength TK_StructImmutable.variaStructPointerConstLen 3
+ReturnedArrayLength TK_StructImmutable.variaStructPointerCustomLen getVariaStructPointerCustomLenElemCount()
+
+# TK_StructImmutable String.ConstValue 1A + 3P = 4
+ReturnsString TK_StructImmutable.constCharArrayConstLen
+ReturnsString TK_StructImmutable.constCharPointerConstLen
+ReturnedArrayLength TK_StructImmutable.constCharPointerConstLen 15
+ReturnsString TK_StructImmutable.constCharPointerVariaLen
+ReturnsString TK_StructImmutable.constCharPointerCustomLen
+ReturnedArrayLength TK_StructImmutable.constCharPointerCustomLen getConstCharPointerCustomLenElemCount()
+
+# TK_StructImmutable String.VariaValue 1A + 3P = 4
+ReturnsString TK_StructImmutable.variaCharArrayConstLen
+ReturnsString TK_StructImmutable.variaCharPointerConstLen
+ReturnedArrayLength TK_StructImmutable.variaCharPointerConstLen 15
+ReturnsString TK_StructImmutable.variaCharPointerVariaLen
+ReturnsString TK_StructImmutable.variaCharPointerCustomLen
+ReturnedArrayLength TK_StructImmutable.variaCharPointerCustomLen getVariaCharPointerCustomLenElemCount()
+
+# TK_StructImmutable StringOnly.ConstValue 1A + 3P = 4
+ReturnsStringOnly TK_StructImmutable.constStringOnlyArrayConstLen
+ReturnsStringOnly TK_StructImmutable.constStringOnlyPointerConstLen
+ReturnedArrayLength TK_StructImmutable.constStringOnlyPointerConstLen 15
+ReturnsStringOnly TK_StructImmutable.constStringOnlyPointerVariaLen
+ReturnsStringOnly TK_StructImmutable.constStringOnlyPointerCustomLen
+ReturnedArrayLength TK_StructImmutable.constStringOnlyPointerCustomLen getConstStringOnlyPointerCustomLenElemCount()
+
+# TK_StructImmutable StringOnly.VariaValue 1A + 3P = 4
+ReturnsStringOnly TK_StructImmutable.variaStringOnlyArrayConstLen
+ReturnsStringOnly TK_StructImmutable.variaStringOnlyPointerConstLen
+ReturnedArrayLength TK_StructImmutable.variaStringOnlyPointerConstLen 15
+ReturnsStringOnly TK_StructImmutable.variaStringOnlyPointerVariaLen
+ReturnsStringOnly TK_StructImmutable.variaStringOnlyPointerCustomLen
+ReturnedArrayLength TK_StructImmutable.variaStringOnlyPointerCustomLen getVariaStringOnlyPointerCustomLenElemCount()
+
+#
+# TK_Field
+#
+
+EmitStruct TK_Field
+StructPackage TK_Field com.jogamp.gluegen.test.junit.generation
+
+# TK_Field Primitive.ConstValue.intxx
+ReturnedArrayLength TK_Field.constIntxxPointerConstOneElem 1
+MaxOneElement TK_Field.constIntxxPointerMaxOneElem
+ReturnedArrayLength TK_Field.constIntxxPointerConstLen 3
+ReturnedArrayLength TK_Field.constIntxxPointerCustomLen getConstIntxxPointerCustomLenElemCount()
+
+# TK_Field Primitive.VariaValue.intxx
+ReturnedArrayLength TK_Field.variaIntxxPointerConstOneElem 1
+MaxOneElement TK_Field.variaIntxxPointerMaxOneElem
+ReturnedArrayLength TK_Field.variaIntxxPointerConstLen 3
+ReturnedArrayLength TK_Field.variaIntxxPointerCustomLen getVariaIntxxPointerCustomLenElemCount()
+
+# TK_Field Primitive.ConstValue.int32
+ReturnedArrayLength TK_Field.constInt32PointerConstOneElem 1
+MaxOneElement TK_Field.constInt32PointerMaxOneElem
+ReturnedArrayLength TK_Field.constInt32PointerConstLen 3
+ReturnedArrayLength TK_Field.constInt32PointerCustomLen getConstInt32PointerCustomLenElemCount()
+
+# TK_Field Primitive.VariaValue.int32
+ReturnedArrayLength TK_Field.variaInt32PointerConstOneElem 1
+MaxOneElement TK_Field.variaInt32PointerMaxOneElem
+ReturnedArrayLength TK_Field.variaInt32PointerConstLen 3
+ReturnedArrayLength TK_Field.variaInt32PointerCustomLen getVariaInt32PointerCustomLenElemCount()
+
+# TK_Field Struct.ConstValue.TK_Dimension
+ReturnedArrayLength TK_Field.constStructPointerConstOneElem 1
+MaxOneElement TK_Field.constStructPointerMaxOneElem
+ReturnedArrayLength TK_Field.constStructPointerConstLen 3
+ReturnedArrayLength TK_Field.constStructPointerCustomLen getConstStructPointerCustomLenElemCount()
+
+# TK_Field Struct.VariaValue.TK_Dimension
+ReturnedArrayLength TK_Field.variaStructPointerConstOneElem 1
+MaxOneElement TK_Field.variaStructPointerMaxOneElem
+ReturnedArrayLength TK_Field.variaStructPointerConstLen 3
+ReturnedArrayLength TK_Field.variaStructPointerCustomLen getVariaStructPointerCustomLenElemCount()
+
+# TK_Field String.ConstValue 1A + 3P = 4
+ReturnsString TK_Field.constCharArrayConstLen
+ReturnsString TK_Field.constCharPointerConstLen
+ReturnedArrayLength TK_Field.constCharPointerConstLen 15
+ReturnsString TK_Field.constCharPointerVariaLen
+ReturnsString TK_Field.constCharPointerCustomLen
+ReturnedArrayLength TK_Field.constCharPointerCustomLen getConstCharPointerCustomLenElemCount()
+
+# TK_Field String.VariaValue 1A + 3P = 4
+ReturnsString TK_Field.variaCharArrayConstLen
+ReturnsString TK_Field.variaCharPointerConstLen
+ReturnedArrayLength TK_Field.variaCharPointerConstLen 15
+ReturnsString TK_Field.variaCharPointerVariaLen
+ReturnsString TK_Field.variaCharPointerCustomLen
+ReturnedArrayLength TK_Field.variaCharPointerCustomLen getVariaCharPointerCustomLenElemCount()
+
+# TK_Field StringOnly.ConstValue 1A + 3P = 4
+ReturnsStringOnly TK_Field.constStringOnlyArrayConstLen
+ReturnsStringOnly TK_Field.constStringOnlyPointerConstLen
+ReturnedArrayLength TK_Field.constStringOnlyPointerConstLen 15
+ReturnsStringOnly TK_Field.constStringOnlyPointerVariaLen
+ReturnsStringOnly TK_Field.constStringOnlyPointerCustomLen
+ReturnedArrayLength TK_Field.constStringOnlyPointerCustomLen getConstStringOnlyPointerCustomLenElemCount()
+
+# TK_Field StringOnly.VariaValue 1A + 3P = 4
+ReturnsStringOnly TK_Field.variaStringOnlyArrayConstLen
+ReturnsStringOnly TK_Field.variaStringOnlyPointerConstLen
+ReturnedArrayLength TK_Field.variaStringOnlyPointerConstLen 15
+ReturnsStringOnly TK_Field.variaStringOnlyPointerVariaLen
+ReturnsStringOnly TK_Field.variaStringOnlyPointerCustomLen
+ReturnedArrayLength TK_Field.variaStringOnlyPointerCustomLen getVariaStringOnlyPointerCustomLenElemCount()
+
+#
+#
+#
+
+ReturnValueCapacity createTKFieldImmutable sizeof(TK_FieldImmutable)
+ReturnValueCapacity createTKStructImmutable sizeof(TK_StructImmutable)
+ReturnValueCapacity createTKField sizeof(TK_Field)
+ReturnValueCapacity createTKModelMixed sizeof(TK_ModelMixed)
# Imports needed by all glue code
Import java.nio.*
@@ -119,8 +380,10 @@ Import com.jogamp.gluegen.test.junit.generation.TK_DimensionPair
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
-Import com.jogamp.gluegen.test.junit.generation.TK_ModelConst
-Import com.jogamp.gluegen.test.junit.generation.TK_ModelMutable
+Import com.jogamp.gluegen.test.junit.generation.TK_FieldImmutable
+Import com.jogamp.gluegen.test.junit.generation.TK_StructImmutable
+Import com.jogamp.gluegen.test.junit.generation.TK_Field
+Import com.jogamp.gluegen.test.junit.generation.TK_ModelMixed
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 0683600..b74a171 100644
--- a/src/junit/com/jogamp/gluegen/test/junit/generation/test1.c
+++ b/src/junit/com/jogamp/gluegen/test/junit/generation/test1.c
@@ -636,112 +636,418 @@ MYAPI void MYAPIENTRY addByte(const char summands[2], char result[1]) {
result[0] = summands[0] + summands[1];
}
-MYAPI TK_ModelMutable * MYAPIENTRY createModelMutable() {
- int i, j;
- TK_ModelMutable * s = calloc(1, sizeof(TK_ModelMutable));
+typedef struct {
+ // Primitive.ConstValue.intxx 2A + 5P = 7
+ int constIntxxArrayConstOneElem[1];
+ int constIntxxArrayConstLen[3]; // [3]
+ int* constIntxxPointerConstOneElem; //
+ int* constIntxxPointerMaxOneElem; //
+ int* constIntxxPointerConstLen; // [3]
+ int* constIntxxPointerVariaLen;
+ int* constIntxxPointerCustomLen;
+ int constIntxxPointerCustomLenElemCount;
+
+ // Primitive.VariaValue.intxx 2A + 5P = 7
+ int variaIntxxArrayConstOneElem[1];
+ int variaIntxxArrayConstLen[3]; // [3]
+ int* variaIntxxPointerConstOneElem; //
+ int* variaIntxxPointerMaxOneElem; //
+ int* variaIntxxPointerConstLen; // [3]
+ int* variaIntxxPointerVariaLen;
+ int* variaIntxxPointerCustomLen;
+ int variaIntxxPointerCustomLenElemCount;
+
+ int32_t constInt32Element;
+ int32_t variaInt32Element;
+
+ // Primitive.ConstValue 2A + 5P = 7
+ int32_t constInt32ArrayConstOneElem[1];
+ int32_t constInt32ArrayConstLen[3];
+ int32_t* constInt32PointerConstOneElem;
+ int32_t* constInt32PointerMaxOneElem;
+ int32_t* constInt32PointerConstLen;
+ int32_t* constInt32PointerVariaLen;
+ int32_t* constInt32PointerCustomLen;
+ int32_t constInt32PointerCustomLenElemCount;
+
+ // Primitive.VariaValue 2A + 5P = 7
+ int32_t variaInt32ArrayConstOneElem[1];
+ int32_t variaInt32ArrayConstLen[3];
+ int32_t* variaInt32PointerConstOneElem;
+ int32_t* variaInt32PointerMaxOneElem;
+ int32_t* variaInt32PointerConstLen;
+ int32_t* variaInt32PointerVariaLen;
+ int32_t* variaInt32PointerCustomLen;
+ int32_t variaInt32PointerCustomLenElemCount;
+
+ // Struct.ConstValue 2A + 5P = 7
+ TK_Dimension constStructArrayConstOneElem[1];
+ TK_Dimension constStructArrayConstLen[3];
+ TK_Dimension* constStructPointerConstOneElem;
+ TK_Dimension* constStructPointerMaxOneElem;
+ TK_Dimension* constStructPointerConstLen;
+ TK_Dimension* constStructPointerVariaLen;
+ TK_Dimension* constStructPointerCustomLen;
+ int32_t constStructPointerCustomLenElemCount;
+
+ // Struct.VariaValue 2A + 5P = 7
+ TK_Dimension variaStructArrayConstOneElem[1];
+ TK_Dimension variaStructArrayConstLen[3];
+ TK_Dimension* variaStructPointerConstOneElem;
+ TK_Dimension* variaStructPointerMaxOneElem;
+ TK_Dimension* variaStructPointerConstLen;
+ TK_Dimension* variaStructPointerVariaLen;
+ TK_Dimension* variaStructPointerCustomLen;
+ int32_t variaStructPointerCustomLenElemCount;
+
+ // String.ConstValue 1A + 3P = 4
+ char constCharArrayConstLen[13]; /* 'Hello Array1' len=12+1 */
+ char* constCharPointerConstLen; /* 'Hello CString1' len=14+1 */
+ char* constCharPointerVariaLen; /* 'Hello CString2' len=14+1 */
+ char* constCharPointerCustomLen; /* 'Hello CString3' len=14+1 */
+ int constCharPointerCustomLenElemCount;
+
+ // String.VariaValue 1A + 3P = 4
+ char variaCharArrayConstLen[13]; /* 'Hello Array1' len=12+1 */
+ char* variaCharPointerConstLen; /* 'Hello CString1' len=14+1 */
+ char* variaCharPointerVariaLen; /* 'Hello CString2' len=14+1 */
+ char* variaCharPointerCustomLen; /* 'Hello CString3' len=14+1 */
+ int variaCharPointerCustomLenElemCount;
+
+ // StringOnly.ConstValue 1A + 3P = 4
+ char constStringOnlyArrayConstLen[13]; /* 'Hello Array1' len=12+1 */
+ char* constStringOnlyPointerConstLen; /* 'Hello CString1' len=14+1 */
+ char* constStringOnlyPointerVariaLen; /* 'Hello CString2' len=14+1 */
+ char* constStringOnlyPointerCustomLen; /* 'Hello CString3' len=14+1 */
+ int constStringOnlyPointerCustomLenElemCount;
+
+ // StringOnly.VariaValue 1A + 3P = 4
+ char variaStringOnlyArrayConstLen[13]; /* 'Hello Array1' len=12+1 */
+ char* variaStringOnlyPointerConstLen; /* 'Hello CString1' len=14+1 */
+ char* variaStringOnlyPointerVariaLen; /* 'Hello CString2' len=14+1 */
+ char* variaStringOnlyPointerCustomLen; /* 'Hello CString3' len=14+1 */
+ int variaStringOnlyPointerCustomLenElemCount;
+
+} TK_FieldMutable;
+
+
+static TK_FieldMutable * createTKFieldMutable() {
+ TK_FieldMutable * s = calloc(1, sizeof(TK_FieldMutable));
+
+ // Primitive.ConstValue.intxx 2A + 5P = 7
+ s->constIntxxArrayConstOneElem[0] = 88;
+ s->constIntxxArrayConstLen[0] = 1;
+ s->constIntxxArrayConstLen[1] = 2;
+ s->constIntxxArrayConstLen[2] = 3;
+ s->constIntxxPointerConstOneElem = calloc(1, sizeof(int));
+ s->constIntxxPointerConstOneElem[0] = 10;
+ s->constIntxxPointerMaxOneElem = NULL;
+ s->constIntxxPointerConstLen = calloc(3, sizeof(int));
+ s->constIntxxPointerConstLen[0] = 21;
+ s->constIntxxPointerConstLen[1] = 22;
+ s->constIntxxPointerConstLen[2] = 23;
+ s->constIntxxPointerVariaLen = NULL;
+ s->constIntxxPointerCustomLen = calloc(4, sizeof(int));
+ s->constIntxxPointerCustomLen[0] = 31;
+ s->constIntxxPointerCustomLen[1] = 32;
+ s->constIntxxPointerCustomLen[2] = 33;
+ s->constIntxxPointerCustomLen[3] = 34;
+ s->constIntxxPointerCustomLenElemCount = 4;
+
+ // Primitive.VariaValue.intxx 2A + 5P = 7
+ s->variaIntxxArrayConstOneElem[0] = 88;
+ s->variaIntxxArrayConstLen[0] = 1;
+ s->variaIntxxArrayConstLen[1] = 2;
+ s->variaIntxxArrayConstLen[2] = 3;
+ s->variaIntxxPointerConstOneElem = calloc(1, sizeof(int));
+ s->variaIntxxPointerConstOneElem[0] = 10;
+ s->variaIntxxPointerMaxOneElem = NULL;
+ s->variaIntxxPointerConstLen = calloc(3, sizeof(int));
+ s->variaIntxxPointerConstLen[0] = 21;
+ s->variaIntxxPointerConstLen[1] = 22;
+ s->variaIntxxPointerConstLen[2] = 23;
+ s->variaIntxxPointerVariaLen = NULL;
+ s->variaIntxxPointerCustomLen = calloc(4, sizeof(int));
+ s->variaIntxxPointerCustomLen[0] = 31;
+ s->variaIntxxPointerCustomLen[1] = 32;
+ s->variaIntxxPointerCustomLen[2] = 33;
+ s->variaIntxxPointerCustomLen[3] = 34;
+ s->variaIntxxPointerCustomLenElemCount = 4;
+
+ // Primitive.ConstValue.int32 2A + 5P = 7
+ s->constInt32ArrayConstOneElem[0] = 88;
+ s->constInt32ArrayConstLen[0] = 1;
+ s->constInt32ArrayConstLen[1] = 2;
+ s->constInt32ArrayConstLen[2] = 3;
+ s->constInt32PointerConstOneElem = calloc(1, sizeof(int32_t));
+ s->constInt32PointerConstOneElem[0] = 10;
+ s->constInt32PointerMaxOneElem = NULL;
+ s->constInt32PointerConstLen = calloc(3, sizeof(int32_t));
+ s->constInt32PointerConstLen[0] = 21;
+ s->constInt32PointerConstLen[1] = 22;
+ s->constInt32PointerConstLen[2] = 23;
+ s->constInt32PointerVariaLen = NULL;
+ s->constInt32PointerCustomLen = calloc(4, sizeof(int32_t));
+ s->constInt32PointerCustomLen[0] = 31;
+ s->constInt32PointerCustomLen[1] = 32;
+ s->constInt32PointerCustomLen[2] = 33;
+ s->constInt32PointerCustomLen[3] = 34;
+ s->constInt32PointerCustomLenElemCount = 4;
+
+ // Primitive.VariaValue.int32 2A + 5P = 7
+ s->variaInt32ArrayConstOneElem[0] = 88;
+ s->variaInt32ArrayConstLen[0] = 1;
+ s->variaInt32ArrayConstLen[1] = 2;
+ s->variaInt32ArrayConstLen[2] = 3;
+ s->variaInt32PointerConstOneElem = calloc(1, sizeof(int32_t));
+ s->variaInt32PointerConstOneElem[0] = 10;
+ s->variaInt32PointerMaxOneElem = NULL;
+ s->variaInt32PointerConstLen = calloc(3, sizeof(int32_t));
+ s->variaInt32PointerConstLen[0] = 21;
+ s->variaInt32PointerConstLen[1] = 22;
+ s->variaInt32PointerConstLen[2] = 23;
+ s->variaInt32PointerVariaLen = NULL;
+ s->variaInt32PointerCustomLen = calloc(4, sizeof(int32_t));
+ s->variaInt32PointerCustomLen[0] = 31;
+ s->variaInt32PointerCustomLen[1] = 32;
+ s->variaInt32PointerCustomLen[2] = 33;
+ s->variaInt32PointerCustomLen[3] = 34;
+ s->variaInt32PointerCustomLenElemCount = 4;
+
+ // Struct.ConstValue.TK_Dimension 2A + 5P = 7
+ s->constStructArrayConstOneElem[0].x = 51;
+ s->constStructArrayConstOneElem[0].y = 52;
+ s->constStructArrayConstOneElem[0].width = 53;
+ s->constStructArrayConstOneElem[0].height = 54;
+ s->constStructArrayConstLen[0].x = 61;
+ s->constStructArrayConstLen[0].y = 62;
+ s->constStructArrayConstLen[0].width = 63;
+ s->constStructArrayConstLen[0].height = 64;
+ s->constStructArrayConstLen[1].x = 71;
+ s->constStructArrayConstLen[1].y = 72;
+ s->constStructArrayConstLen[1].width = 73;
+ s->constStructArrayConstLen[1].height = 74;
+ s->constStructArrayConstLen[2].x = 81;
+ s->constStructArrayConstLen[2].y = 82;
+ s->constStructArrayConstLen[2].width = 83;
+ s->constStructArrayConstLen[2].height = 84;
+ s->constStructPointerConstOneElem = calloc(1, sizeof(TK_Dimension));
+ s->constStructPointerConstOneElem[0].x = 91;
+ s->constStructPointerConstOneElem[0].y = 92;
+ s->constStructPointerConstOneElem[0].width = 93;
+ s->constStructPointerConstOneElem[0].height = 94;
+ s->constStructPointerMaxOneElem = NULL;
+ s->constStructPointerConstLen = calloc(3, sizeof(TK_Dimension));
+ s->constStructPointerConstLen[0].x = 101;
+ s->constStructPointerConstLen[0].y = 102;
+ s->constStructPointerConstLen[0].width = 103;
+ s->constStructPointerConstLen[0].height = 104;
+ s->constStructPointerConstLen[1].x = 111;
+ s->constStructPointerConstLen[1].y = 112;
+ s->constStructPointerConstLen[1].width = 113;
+ s->constStructPointerConstLen[1].height = 114;
+ s->constStructPointerConstLen[2].x = 121;
+ s->constStructPointerConstLen[2].y = 123;
+ s->constStructPointerConstLen[2].width = 124;
+ s->constStructPointerConstLen[2].height = 125;
+ s->constStructPointerVariaLen = NULL;
+ s->constStructPointerCustomLen = calloc(4, sizeof(TK_Dimension));
+ s->constStructPointerCustomLen[0].x = 131;
+ s->constStructPointerCustomLen[0].y = 132;
+ s->constStructPointerCustomLen[0].width = 133;
+ s->constStructPointerCustomLen[0].height = 134;
+ s->constStructPointerCustomLen[1].x = 141;
+ s->constStructPointerCustomLen[1].y = 142;
+ s->constStructPointerCustomLen[1].width = 143;
+ s->constStructPointerCustomLen[1].height = 144;
+ s->constStructPointerCustomLen[2].x = 151;
+ s->constStructPointerCustomLen[2].y = 152;
+ s->constStructPointerCustomLen[2].width = 153;
+ s->constStructPointerCustomLen[2].height = 154;
+ s->constStructPointerCustomLen[3].x = 161;
+ s->constStructPointerCustomLen[3].y = 162;
+ s->constStructPointerCustomLen[3].width = 163;
+ s->constStructPointerCustomLen[3].height = 164;
+ s->constStructPointerCustomLenElemCount = 4;
+
+ // Struct.VariaValue.TK_Dimension 2A + 5P = 7
+ s->variaStructArrayConstOneElem[0].x = 51;
+ s->variaStructArrayConstOneElem[0].y = 52;
+ s->variaStructArrayConstOneElem[0].width = 53;
+ s->variaStructArrayConstOneElem[0].height = 54;
+ s->variaStructArrayConstLen[0].x = 61;
+ s->variaStructArrayConstLen[0].y = 62;
+ s->variaStructArrayConstLen[0].width = 63;
+ s->variaStructArrayConstLen[0].height = 64;
+ s->variaStructArrayConstLen[1].x = 71;
+ s->variaStructArrayConstLen[1].y = 72;
+ s->variaStructArrayConstLen[1].width = 73;
+ s->variaStructArrayConstLen[1].height = 74;
+ s->variaStructArrayConstLen[2].x = 81;
+ s->variaStructArrayConstLen[2].y = 82;
+ s->variaStructArrayConstLen[2].width = 83;
+ s->variaStructArrayConstLen[2].height = 84;
+ s->variaStructPointerConstOneElem = calloc(1, sizeof(TK_Dimension));
+ s->variaStructPointerConstOneElem[0].x = 91;
+ s->variaStructPointerConstOneElem[0].y = 92;
+ s->variaStructPointerConstOneElem[0].width = 93;
+ s->variaStructPointerConstOneElem[0].height = 94;
+ s->variaStructPointerMaxOneElem = NULL;
+ s->variaStructPointerConstLen = calloc(3, sizeof(TK_Dimension));
+ s->variaStructPointerConstLen[0].x = 101;
+ s->variaStructPointerConstLen[0].y = 102;
+ s->variaStructPointerConstLen[0].width = 103;
+ s->variaStructPointerConstLen[0].height = 104;
+ s->variaStructPointerConstLen[1].x = 111;
+ s->variaStructPointerConstLen[1].y = 112;
+ s->variaStructPointerConstLen[1].width = 113;
+ s->variaStructPointerConstLen[1].height = 114;
+ s->variaStructPointerConstLen[2].x = 121;
+ s->variaStructPointerConstLen[2].y = 123;
+ s->variaStructPointerConstLen[2].width = 124;
+ s->variaStructPointerConstLen[2].height = 125;
+ s->variaStructPointerVariaLen = NULL;
+ s->variaStructPointerCustomLen = calloc(4, sizeof(TK_Dimension));
+ s->variaStructPointerCustomLen[0].x = 131;
+ s->variaStructPointerCustomLen[0].y = 132;
+ s->variaStructPointerCustomLen[0].width = 133;
+ s->variaStructPointerCustomLen[0].height = 134;
+ s->variaStructPointerCustomLen[1].x = 141;
+ s->variaStructPointerCustomLen[1].y = 142;
+ s->variaStructPointerCustomLen[1].width = 143;
+ s->variaStructPointerCustomLen[1].height = 144;
+ s->variaStructPointerCustomLen[2].x = 151;
+ s->variaStructPointerCustomLen[2].y = 152;
+ s->variaStructPointerCustomLen[2].width = 153;
+ s->variaStructPointerCustomLen[2].height = 154;
+ s->variaStructPointerCustomLen[3].x = 161;
+ s->variaStructPointerCustomLen[3].y = 162;
+ s->variaStructPointerCustomLen[3].width = 163;
+ s->variaStructPointerCustomLen[3].height = 164;
+ s->variaStructPointerCustomLenElemCount = 4;
+
+ // String.ConstValue 1A + 3P = 4
+ strncpy(s->constCharArrayConstLen, "Hello Array1", sizeof(s->constCharArrayConstLen));
+ s->constCharPointerConstLen = calloc(14+1, sizeof(char));
+ strncpy(s->constCharPointerConstLen, "Hello CString1", 14+1);
+ s->constCharPointerVariaLen = NULL;
+ s->constCharPointerCustomLen = calloc(14+1, sizeof(char));
+ strncpy(s->constCharPointerCustomLen, "Hello CString3", 14+1);
+ s->constCharPointerCustomLenElemCount = 14+1;
+
+ // String.VariaValue 1A + 3P = 4
+ strncpy(s->variaCharArrayConstLen, "Hello Array1", sizeof(s->variaCharArrayConstLen));
+ s->variaCharPointerConstLen = calloc(14+1, sizeof(char));
+ strncpy(s->variaCharPointerConstLen, "Hello CString1", 14+1);
+ s->variaCharPointerVariaLen = NULL;
+ s->variaCharPointerCustomLen = calloc(14+1, sizeof(char));
+ strncpy(s->variaCharPointerCustomLen, "Hello CString3", 14+1);
+ s->variaCharPointerCustomLenElemCount = 14+1;
+
+ // StringOnly.ConstValue 1A + 3P = 4
+ strncpy(s->constStringOnlyArrayConstLen, "Hello Array1", sizeof(s->constStringOnlyArrayConstLen));
+ s->constStringOnlyPointerConstLen = calloc(14+1, sizeof(char));
+ strncpy(s->constStringOnlyPointerConstLen, "Hello CString1", 14+1);
+ s->constStringOnlyPointerVariaLen = NULL;
+ s->constStringOnlyPointerCustomLen = calloc(14+1, sizeof(char));
+ strncpy(s->constStringOnlyPointerCustomLen, "Hello CString3", 14+1);
+ s->constStringOnlyPointerCustomLenElemCount = 14+1;
+
+ // StringOnly.VariaValue 1A + 3P = 4
+ strncpy(s->variaStringOnlyArrayConstLen, "Hello Array1", sizeof(s->variaStringOnlyArrayConstLen));
+ s->variaStringOnlyPointerConstLen = calloc(14+1, sizeof(char));
+ strncpy(s->variaStringOnlyPointerConstLen, "Hello CString1", 14+1);
+ s->variaStringOnlyPointerVariaLen = NULL;
+ s->variaStringOnlyPointerCustomLen = calloc(14+1, sizeof(char));
+ strncpy(s->variaStringOnlyPointerCustomLen, "Hello CString3", 14+1);
+ s->variaStringOnlyPointerCustomLenElemCount = 14+1;
- s->intxxArrayFixedLen[0]=1;
- s->intxxArrayFixedLen[1]=2;
- s->intxxArrayFixedLen[2]=3;
-
- s->intxxPointerCustomLen = calloc(3, sizeof(int));
- s->intxxPointerCustomLen[0] = 11;
- s->intxxPointerCustomLen[1] = 12;
- s->intxxPointerCustomLen[2] = 13;
- s->intxxPointerCustomLenVal=3;
+ return s;
+}
- s->int32ArrayFixedLen[0] = 21;
- s->int32ArrayFixedLen[1] = 22;
- s->int32ArrayFixedLen[2] = 23;
+static void destroyTKFieldMutable(TK_FieldMutable * s) {
+ assert(NULL!=s);
- s->int32ArrayOneElem[0] = 30;
+ assert(NULL!=s->constIntxxPointerConstOneElem);
+ free(s->constIntxxPointerConstOneElem);
+ assert(NULL!=s->constIntxxPointerConstLen);
+ free(s->constIntxxPointerConstLen);
+ if( 0 < s->constIntxxPointerCustomLenElemCount && NULL!=s->constIntxxPointerCustomLen ) {
+ // NOTE Ownership is ambiguous
+ free(s->constIntxxPointerCustomLen);
+ }
- s->int32PointerCustomLen = calloc(3, sizeof(int));
- s->int32PointerCustomLen[0] = 31;
- s->int32PointerCustomLen[1] = 32;
- s->int32PointerCustomLen[2] = 33;
- s->int32PointerCustomLenVal=3;
-
- s->int32PointerOneElem = calloc(1, sizeof(int));
- s->int32PointerOneElem[0] = 41;
+ assert(NULL!=s->constInt32PointerConstOneElem);
+ free(s->constInt32PointerConstOneElem);
+ assert(NULL!=s->constInt32PointerConstLen);
+ free(s->constInt32PointerConstLen);
+ if( 0 < s->constInt32PointerCustomLenElemCount && NULL!=s->constInt32PointerCustomLen ) {
+ // NOTE Ownership is ambiguous
+ free(s->constInt32PointerCustomLen);
+ }
+
+ assert(NULL!=s->constStructPointerConstOneElem);
+ free(s->constStructPointerConstOneElem);
+ assert(NULL!=s->constStructPointerConstLen);
+ free(s->constStructPointerConstLen);
+ if( 0 < s->constStructPointerCustomLenElemCount && NULL!=s->constStructPointerCustomLen ) {
+ // NOTE Ownership is ambiguous
+ free(s->constStructPointerCustomLen);
+ }
+
+ assert(NULL!=s->constCharPointerConstLen);
+ free(s->constCharPointerConstLen);
+ if( 0 < s->constCharPointerCustomLenElemCount && NULL!=s->constCharPointerCustomLen ) {
+ // NOTE Ownership is ambiguous
+ free(s->constCharPointerCustomLen);
+ }
- for(i=0; i<4; i++) {
- for(j=0; j<4; j++) {
- s->mat4x4[i][j] = i*4 + j;
- }
+ assert(NULL!=s->constStringOnlyPointerConstLen);
+ free(s->constStringOnlyPointerConstLen);
+ if( 0 < s->constStringOnlyPointerCustomLenElemCount && NULL!=s->constStringOnlyPointerCustomLen ) {
+ // NOTE Ownership is ambiguous
+ free(s->constStringOnlyPointerCustomLen);
}
- s->structArrayFixedLen[0].x = 51;
- s->structArrayFixedLen[0].y = 52;
- s->structArrayFixedLen[0].width = 53;
- s->structArrayFixedLen[0].height = 54;
- s->structArrayFixedLen[1].x = 61;
- s->structArrayFixedLen[1].y = 62;
- s->structArrayFixedLen[1].width = 63;
- s->structArrayFixedLen[1].height = 64;
- s->structArrayFixedLen[2].x = 71;
- s->structArrayFixedLen[2].y = 72;
- s->structArrayFixedLen[2].width = 73;
- s->structArrayFixedLen[2].height = 74;
-
- s->structArrayOneElem[0].x = 81;
- s->structArrayOneElem[0].y = 82;
- s->structArrayOneElem[0].width = 83;
- s->structArrayOneElem[0].height = 84;
-
- s->structPointerCustomLen = (TK_Dimension *) calloc(3, sizeof(TK_Dimension));
- s->structPointerCustomLen[0].x = 91;
- s->structPointerCustomLen[0].y = 92;
- s->structPointerCustomLen[0].width = 93;
- s->structPointerCustomLen[0].height = 94;
- s->structPointerCustomLen[1].x = 101;
- s->structPointerCustomLen[1].y = 102;
- s->structPointerCustomLen[1].width = 103;
- s->structPointerCustomLen[1].height = 104;
- s->structPointerCustomLen[2].x = 111;
- s->structPointerCustomLen[2].y = 112;
- s->structPointerCustomLen[2].width = 113;
- s->structPointerCustomLen[2].height = 114;
- s->structPointerCustomLenVal = 3;
-
- s->structPointerOneElem = (TK_Dimension *) calloc(1, sizeof(TK_Dimension));
- s->structPointerOneElem[0].x = 121;
- s->structPointerOneElem[0].y = 122;
- s->structPointerOneElem[0].width = 123;
- s->structPointerOneElem[0].height = 124;
+ free(s);
+}
- s->ctx = (void *) 0x123456789abcdef0UL;
+MYAPI TK_FieldImmutable * MYAPIENTRY createTKFieldImmutable() {
+ return (TK_FieldImmutable*) createTKFieldMutable();
+}
+MYAPI void MYAPIENTRY destroyTKFieldImmutable(TK_FieldImmutable * s) {
+ destroyTKFieldMutable((TK_FieldMutable*) s);
+}
- strncpy(s->modelNameArrayFixedLen, "Hello Array", sizeof(s->modelNameArrayFixedLen));
+MYAPI TK_StructImmutable * MYAPIENTRY createTKStructImmutable() {
+ return (TK_StructImmutable*) createTKFieldMutable();
+}
+MYAPI void MYAPIENTRY destroyTKStructImmutable(TK_StructImmutable * s) {
+ destroyTKFieldMutable((TK_FieldMutable*) s);
+}
- s->modelNamePointerCString = calloc(13+1, sizeof(char));
- strncpy(s->modelNamePointerCString, "Hello CString", 13+1);
+MYAPI TK_Field * MYAPIENTRY createTKField() {
+ return (TK_Field*) createTKFieldMutable();
+}
+MYAPI void MYAPIENTRY destroyTKField(TK_Field * s) {
+ destroyTKFieldMutable((TK_FieldMutable*) s);
+}
- s->modelNamePointerCustomLen = calloc(13+1, sizeof(char));
- strncpy(s->modelNamePointerCustomLen, "Hello Pointer", 13+1);
- s->modelNamePointerCustomLenVal = 13+1;
+MYAPI TK_ModelMixed* MYAPIENTRY createTKModelMixed() {
+ int i, j;
+ TK_ModelMixed * s = calloc(1, sizeof(TK_ModelMixed));
+ for(i=0; i<4; i++) {
+ for(j=0; j<4; j++) {
+ s->mat4x4[i][j] = i*4 + j;
+ }
+ }
+ s->ctx = (void *) 0x123456789abcdef0UL;
return s;
}
-MYAPI void MYAPIENTRY destroyModelMutable(TK_ModelMutable * s) {
+MYAPI void MYAPIENTRY destroyTKModelMixed(TK_ModelMixed * s) {
assert(NULL!=s);
- assert(NULL!=s->intxxPointerCustomLen);
- assert(NULL!=s->int32PointerCustomLen);
- assert(NULL!=s->int32PointerOneElem);
- assert(NULL!=s->structPointerCustomLen);
- free(s->intxxPointerCustomLen);
- free(s->int32PointerCustomLen);
- free(s->int32PointerOneElem);
- free(s->structPointerCustomLen);
- free(s->modelNamePointerCString);
- free(s->modelNamePointerCustomLen);
free(s);
}
-MYAPI TK_ModelConst * MYAPIENTRY createModelConst() {
- return (TK_ModelConst *)createModelMutable();
-}
-MYAPI void MYAPIENTRY destroyModelConst(TK_ModelConst * s) {
- destroyModelMutable((TK_ModelMutable *)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 9465cd9..89848d7 100644
--- a/src/junit/com/jogamp/gluegen/test/junit/generation/test1.h
+++ b/src/junit/com/jogamp/gluegen/test/junit/generation/test1.h
@@ -437,71 +437,320 @@ MYAPI void MYAPIENTRY intToRgba(int irgba, char rgbaSink[4]);
MYAPI void MYAPIENTRY addInt(const int summands[2], int result[1]);
MYAPI void MYAPIENTRY addByte(const char summands[2], char result[1]);
-typedef struct {
- const int intxxArrayFixedLen[3];
-
- const int * intxxPointerCustomLen;
- const int intxxPointerCustomLenVal;
-
- const int32_t int32ArrayFixedLen[3];
- const int32_t int32ArrayOneElem[1];
-
- const int32_t * int32PointerCustomLen;
- const int32_t int32PointerCustomLenVal;
-
- const int32_t * int32PointerOneElem;
-
- const float mat4x4[4][4];
+//
+// TK_FieldImmutable
+//
- const TK_Dimension structArrayFixedLen[3];
- const TK_Dimension structArrayOneElem[1];
-
- const TK_Dimension * structPointerCustomLen;
- const int32_t structPointerCustomLenVal;
- const TK_Dimension * structPointerOneElem;
+typedef struct {
+ // Primitive.ConstValue.intxx 2A + 5P = 7
+ const int constIntxxArrayConstOneElem[1];
+ const int constIntxxArrayConstLen[3]; // [3]
+ const int* constIntxxPointerConstOneElem; // [1]
+ const int* constIntxxPointerMaxOneElem; // null
+ const int* constIntxxPointerConstLen; // [3]
+ const int* constIntxxPointerVariaLen; // null
+ const int* constIntxxPointerCustomLen; // [4]
+ int constIntxxPointerCustomLenElemCount;
+
+ // Primitive.VariaValue.intxx 2A + 5P = 7
+ int variaIntxxArrayConstOneElem[1];
+ int variaIntxxArrayConstLen[3]; // [3]
+ int* variaIntxxPointerConstOneElem; // [1]
+ int* variaIntxxPointerMaxOneElem; // null
+ int* variaIntxxPointerConstLen; // [3]
+ int* variaIntxxPointerVariaLen; // null
+ int* variaIntxxPointerCustomLen; // [4]
+ int variaIntxxPointerCustomLenElemCount;
+
+ const int32_t constInt32Element;
+ int32_t variaInt32Element;
+
+ // Primitive.ConstValue.int32 2A + 5P = 7
+ const int32_t constInt32ArrayConstOneElem[1];
+ const int32_t constInt32ArrayConstLen[3];
+ const int32_t* constInt32PointerConstOneElem;
+ const int32_t* constInt32PointerMaxOneElem;
+ const int32_t* constInt32PointerConstLen;
+ const int32_t* constInt32PointerVariaLen;
+ const int32_t* constInt32PointerCustomLen;
+ int32_t constInt32PointerCustomLenElemCount;
+
+ // Primitive.VariaValue.int32 2A + 5P = 7
+ int32_t variaInt32ArrayConstOneElem[1];
+ int32_t variaInt32ArrayConstLen[3];
+ int32_t* variaInt32PointerConstOneElem;
+ int32_t* variaInt32PointerMaxOneElem;
+ int32_t* variaInt32PointerConstLen;
+ int32_t* variaInt32PointerVariaLen;
+ int32_t* variaInt32PointerCustomLen;
+ int32_t variaInt32PointerCustomLenElemCount;
+
+ // Struct.ConstValue.TK_Dimension 2A + 5P = 7
+ const TK_Dimension constStructArrayConstOneElem[1];
+ const TK_Dimension constStructArrayConstLen[3];
+ const TK_Dimension* constStructPointerConstOneElem;
+ const TK_Dimension* constStructPointerMaxOneElem;
+ const TK_Dimension* constStructPointerConstLen;
+ const TK_Dimension* constStructPointerVariaLen;
+ const TK_Dimension* constStructPointerCustomLen;
+ int32_t constStructPointerCustomLenElemCount;
+
+ // Struct.VariaValue 2A + 5P = 7
+ TK_Dimension variaStructArrayConstOneElem[1];
+ TK_Dimension variaStructArrayConstLen[3];
+ TK_Dimension* variaStructPointerConstOneElem;
+ TK_Dimension* variaStructPointerMaxOneElem;
+ TK_Dimension* variaStructPointerConstLen;
+ TK_Dimension* variaStructPointerVariaLen;
+ TK_Dimension* variaStructPointerCustomLen;
+ int32_t variaStructPointerCustomLenElemCount;
+
+ // String.ConstValue 1A + 3P = 4
+ const char constCharArrayConstLen[13]; /* 'Hello Array1' len=12+1 */
+ const char* constCharPointerConstLen; /* 'Hello CString1' len=14+1 */
+ const char* constCharPointerVariaLen; // null
+ const char* constCharPointerCustomLen; /* 'Hello CString3' len=14+1 */
+ int constCharPointerCustomLenElemCount;
+
+ // String.VariaValue 1A + 3P = 4
+ char variaCharArrayConstLen[13]; /* 'Hello Array1' len=12+1 */
+ char* variaCharPointerConstLen; /* 'Hello CString1' len=14+1 */
+ char* variaCharPointerVariaLen; /* 'Hello CString2' len=14+1 */
+ char* variaCharPointerCustomLen; /* 'Hello CString3' len=14+1 */
+ int variaCharPointerCustomLenElemCount;
+
+ // StringOnly.ConstValue 1A + 3P = 4
+ const char constStringOnlyArrayConstLen[13]; /* 'Hello Array1' len=12+1 */
+ const char* constStringOnlyPointerConstLen; /* 'Hello CString1' len=14+1 */
+ const char* constStringOnlyPointerVariaLen; /* 'Hello CString2' len=14+1 */
+ const char* constStringOnlyPointerCustomLen; /* 'Hello CString3' len=14+1 */
+ int constStringOnlyPointerCustomLenElemCount;
+
+ // StringOnly.VariaValue 1A + 3P = 4
+ char variaStringOnlyArrayConstLen[13]; /* 'Hello Array1' len=12+1 */
+ char* variaStringOnlyPointerConstLen; /* 'Hello CString1' len=14+1 */
+ char* variaStringOnlyPointerVariaLen; /* 'Hello CString2' len=14+1 */
+ char* variaStringOnlyPointerCustomLen; /* 'Hello CString3' len=14+1 */
+ int variaStringOnlyPointerCustomLenElemCount;
+
+} TK_FieldImmutable;
+
+MYAPI TK_FieldImmutable * MYAPIENTRY createTKFieldImmutable();
+MYAPI void MYAPIENTRY destroyTKFieldImmutable(TK_FieldImmutable * s);
- TK_Context ctx;
+//
+// TK_StructImmutable
+//
- char modelNameArrayFixedLen[12]; /* 'Hello Array' len=11+1 */
- char * modelNamePointerCString; /* 'Hello CString' len=13+1 */
- const char * modelNamePointerCustomLen; /* 'Hello Pointer' len=13+1 */
- const int modelNamePointerCustomLenVal; /* 13+1 */
+typedef struct {
+ // Primitive.ConstValue.intxx 2A + 5P = 7
+ const int constIntxxArrayConstOneElem[1];
+ const int constIntxxArrayConstLen[3]; // [3]
+ const int* constIntxxPointerConstOneElem; //
+ const int* constIntxxPointerMaxOneElem; //
+ const int* constIntxxPointerConstLen; // [3]
+ const int* constIntxxPointerVariaLen;
+ const int* constIntxxPointerCustomLen;
+ int constIntxxPointerCustomLenElemCount;
+
+ // Primitive.VariaValue.intxx 2A + 5P = 7
+ int variaIntxxArrayConstOneElem[1];
+ int variaIntxxArrayConstLen[3]; // [3]
+ int* variaIntxxPointerConstOneElem; //
+ int* variaIntxxPointerMaxOneElem; //
+ int* variaIntxxPointerConstLen; // [3]
+ int* variaIntxxPointerVariaLen;
+ int* variaIntxxPointerCustomLen;
+ int variaIntxxPointerCustomLenElemCount;
+
+ const int32_t constInt32Element;
+ int32_t variaInt32Element;
+
+ // Primitive.ConstValue 2A + 5P = 7
+ const int32_t constInt32ArrayConstOneElem[1];
+ const int32_t constInt32ArrayConstLen[3];
+ const int32_t* constInt32PointerConstOneElem;
+ const int32_t* constInt32PointerMaxOneElem;
+ const int32_t* constInt32PointerConstLen;
+ const int32_t* constInt32PointerVariaLen;
+ const int32_t* constInt32PointerCustomLen;
+ int32_t constInt32PointerCustomLenElemCount;
+
+ // Primitive.VariaValue 2A + 5P = 7
+ int32_t variaInt32ArrayConstOneElem[1];
+ int32_t variaInt32ArrayConstLen[3];
+ int32_t* variaInt32PointerConstOneElem;
+ int32_t* variaInt32PointerMaxOneElem;
+ int32_t* variaInt32PointerConstLen;
+ int32_t* variaInt32PointerVariaLen;
+ int32_t* variaInt32PointerCustomLen;
+ int32_t variaInt32PointerCustomLenElemCount;
+
+ // Struct.ConstValue 2A + 5P = 7
+ const TK_Dimension constStructArrayConstOneElem[1];
+ const TK_Dimension constStructArrayConstLen[3];
+ const TK_Dimension* constStructPointerConstOneElem;
+ const TK_Dimension* constStructPointerMaxOneElem;
+ const TK_Dimension* constStructPointerConstLen;
+ const TK_Dimension* constStructPointerVariaLen;
+ const TK_Dimension* constStructPointerCustomLen;
+ int32_t constStructPointerCustomLenElemCount;
+
+ // Struct.VariaValue 2A + 5P = 7
+ TK_Dimension variaStructArrayConstOneElem[1];
+ TK_Dimension variaStructArrayConstLen[3];
+ TK_Dimension* variaStructPointerConstOneElem;
+ TK_Dimension* variaStructPointerMaxOneElem;
+ TK_Dimension* variaStructPointerConstLen;
+ TK_Dimension* variaStructPointerVariaLen;
+ TK_Dimension* variaStructPointerCustomLen;
+ int32_t variaStructPointerCustomLenElemCount;
+
+ // String.ConstValue 1A + 3P = 4
+ const char constCharArrayConstLen[13]; /* 'Hello Array1' len=12+1 */
+ const char* constCharPointerConstLen; /* 'Hello CString1' len=14+1 */
+ const char* constCharPointerVariaLen; /* 'Hello CString2' len=14+1 */
+ const char* constCharPointerCustomLen; /* 'Hello CString3' len=14+1 */
+ int constCharPointerCustomLenElemCount;
+
+ // String.VariaValue 1A + 3P = 4
+ char variaCharArrayConstLen[13]; /* 'Hello Array1' len=12+1 */
+ char* variaCharPointerConstLen; /* 'Hello CString1' len=14+1 */
+ char* variaCharPointerVariaLen; /* 'Hello CString2' len=14+1 */
+ char* variaCharPointerCustomLen; /* 'Hello CString3' len=14+1 */
+ int variaCharPointerCustomLenElemCount;
+
+ // StringOnly.ConstValue 1A + 3P = 4
+ const char constStringOnlyArrayConstLen[13]; /* 'Hello Array1' len=12+1 */
+ const char* constStringOnlyPointerConstLen; /* 'Hello CString1' len=14+1 */
+ const char* constStringOnlyPointerVariaLen; /* 'Hello CString2' len=14+1 */
+ const char* constStringOnlyPointerCustomLen; /* 'Hello CString3' len=14+1 */
+ int constStringOnlyPointerCustomLenElemCount;
+
+ // StringOnly.VariaValue 1A + 3P = 4
+ char variaStringOnlyArrayConstLen[13]; /* 'Hello Array1' len=12+1 */
+ char* variaStringOnlyPointerConstLen; /* 'Hello CString1' len=14+1 */
+ char* variaStringOnlyPointerVariaLen; /* 'Hello CString2' len=14+1 */
+ char* variaStringOnlyPointerCustomLen; /* 'Hello CString3' len=14+1 */
+ int variaStringOnlyPointerCustomLenElemCount;
+
+} TK_StructImmutable;
+
+MYAPI TK_StructImmutable * MYAPIENTRY createTKStructImmutable();
+MYAPI void MYAPIENTRY destroyTKStructImmutable(TK_StructImmutable * s);
-} TK_ModelConst;
+//
+// TK_Field
+//
typedef struct {
- int intxxArrayFixedLen[3];
-
- int * intxxPointerCustomLen;
- int intxxPointerCustomLenVal;
+ // Primitive.ConstValue.intxx 2A + 5P = 7
+ const int constIntxxArrayConstOneElem[1];
+ const int constIntxxArrayConstLen[3]; // [3]
+ const int* constIntxxPointerConstOneElem; //
+ const int* constIntxxPointerMaxOneElem; //
+ const int* constIntxxPointerConstLen; // [3]
+ const int* constIntxxPointerVariaLen;
+ const int* constIntxxPointerCustomLen;
+ int constIntxxPointerCustomLenElemCount;
+
+ // Primitive.VariaValue.intxx 2A + 5P = 7
+ int variaIntxxArrayConstOneElem[1];
+ int variaIntxxArrayConstLen[3]; // [3]
+ int* variaIntxxPointerConstOneElem; //
+ int* variaIntxxPointerMaxOneElem; //
+ int* variaIntxxPointerConstLen; // [3]
+ int* variaIntxxPointerVariaLen;
+ int* variaIntxxPointerCustomLen;
+ int variaIntxxPointerCustomLenElemCount;
+
+ const int32_t constInt32Element;
+ int32_t variaInt32Element;
+
+ // Primitive.ConstValue 2A + 5P = 7
+ const int32_t constInt32ArrayConstOneElem[1];
+ const int32_t constInt32ArrayConstLen[3];
+ const int32_t* constInt32PointerConstOneElem;
+ const int32_t* constInt32PointerMaxOneElem;
+ const int32_t* constInt32PointerConstLen;
+ const int32_t* constInt32PointerVariaLen;
+ const int32_t* constInt32PointerCustomLen;
+ int32_t constInt32PointerCustomLenElemCount;
+
+ // Primitive.VariaValue 2A + 5P = 7
+ int32_t variaInt32ArrayConstOneElem[1];
+ int32_t variaInt32ArrayConstLen[3];
+ int32_t* variaInt32PointerConstOneElem;
+ int32_t* variaInt32PointerMaxOneElem;
+ int32_t* variaInt32PointerConstLen;
+ int32_t* variaInt32PointerVariaLen;
+ int32_t* variaInt32PointerCustomLen;
+ int32_t variaInt32PointerCustomLenElemCount;
+
+ // Struct.ConstValue 2A + 5P = 7
+ const TK_Dimension constStructArrayConstOneElem[1];
+ const TK_Dimension constStructArrayConstLen[3];
+ const TK_Dimension* constStructPointerConstOneElem;
+ const TK_Dimension* constStructPointerMaxOneElem;
+ const TK_Dimension* constStructPointerConstLen;
+ const TK_Dimension* constStructPointerVariaLen;
+ const TK_Dimension* constStructPointerCustomLen;
+ int32_t constStructPointerCustomLenElemCount;
+
+ // Struct.VariaValue 2A + 5P = 7
+ TK_Dimension variaStructArrayConstOneElem[1];
+ TK_Dimension variaStructArrayConstLen[3];
+ TK_Dimension* variaStructPointerConstOneElem;
+ TK_Dimension* variaStructPointerMaxOneElem;
+ TK_Dimension* variaStructPointerConstLen;
+ TK_Dimension* variaStructPointerVariaLen;
+ TK_Dimension* variaStructPointerCustomLen;
+ int32_t variaStructPointerCustomLenElemCount;
+
+ // String.ConstValue 1A + 3P = 4
+ const char constCharArrayConstLen[13]; /* 'Hello Array1' len=12+1 */
+ const char* constCharPointerConstLen; /* 'Hello CString1' len=14+1 */
+ const char* constCharPointerVariaLen; /* 'Hello CString2' len=14+1 */
+ const char* constCharPointerCustomLen; /* 'Hello CString3' len=14+1 */
+ int constCharPointerCustomLenElemCount;
+
+ // String.VariaValue 1A + 3P = 4
+ char variaCharArrayConstLen[13]; /* 'Hello Array1' len=12+1 */
+ char* variaCharPointerConstLen; /* 'Hello CString1' len=14+1 */
+ char* variaCharPointerVariaLen; /* 'Hello CString2' len=14+1 */
+ char* variaCharPointerCustomLen; /* 'Hello CString3' len=14+1 */
+ int variaCharPointerCustomLenElemCount;
+
+ // StringOnly.ConstValue 1A + 3P = 4
+ const char constStringOnlyArrayConstLen[13]; /* 'Hello Array1' len=12+1 */
+ const char* constStringOnlyPointerConstLen; /* 'Hello CString1' len=14+1 */
+ const char* constStringOnlyPointerVariaLen; /* 'Hello CString2' len=14+1 */
+ const char* constStringOnlyPointerCustomLen; /* 'Hello CString3' len=14+1 */
+ int constStringOnlyPointerCustomLenElemCount;
+
+ // StringOnly.VariaValue 1A + 3P = 4
+ char variaStringOnlyArrayConstLen[13]; /* 'Hello Array1' len=12+1 */
+ char* variaStringOnlyPointerConstLen; /* 'Hello CString1' len=14+1 */
+ char* variaStringOnlyPointerVariaLen; /* 'Hello CString2' len=14+1 */
+ char* variaStringOnlyPointerCustomLen; /* 'Hello CString3' len=14+1 */
+ int variaStringOnlyPointerCustomLenElemCount;
+
+} TK_Field;
+
+MYAPI TK_Field * MYAPIENTRY createTKField();
+MYAPI void MYAPIENTRY destroyTKField(TK_Field * s);
- int32_t int32ArrayFixedLen[3];
- int32_t int32ArrayOneElem[1];
-
- int32_t * int32PointerCustomLen;
- int32_t int32PointerCustomLenVal;
-
- int32_t * int32PointerOneElem;
+//
+//
+//
+typedef struct {
float mat4x4[4][4];
- TK_Dimension structArrayFixedLen[3];
- TK_Dimension structArrayOneElem[1];
-
- TK_Dimension * structPointerCustomLen;
- int32_t structPointerCustomLenVal;
- TK_Dimension * structPointerOneElem;
-
TK_Context ctx;
- char modelNameArrayFixedLen[12]; /* 'Hello Array' len=11+1 */
- char * modelNamePointerCString; /* 'Hello CString' len=13+1 */
- char * modelNamePointerCustomLen; /* 'Hello Pointer' len=13+1 */
- int modelNamePointerCustomLenVal; /* 13+1 */
+} TK_ModelMixed;
-} TK_ModelMutable;
+MYAPI TK_ModelMixed* MYAPIENTRY createTKModelMixed();
+MYAPI void MYAPIENTRY destroyTKModelMixed(TK_ModelMixed* s);
-MYAPI TK_ModelConst * MYAPIENTRY createModelConst();
-MYAPI void MYAPIENTRY destroyModelConst(TK_ModelConst * s);
-MYAPI TK_ModelMutable * MYAPIENTRY createModelMutable();
-MYAPI void MYAPIENTRY destroyModelMutable(TK_ModelMutable * s);
diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/test2.c b/src/junit/com/jogamp/gluegen/test/junit/generation/test2.c
new file mode 100644
index 0000000..3fff02c
--- /dev/null
+++ b/src/junit/com/jogamp/gluegen/test/junit/generation/test2.c
@@ -0,0 +1,20 @@
+#include "test2.h"
+
+#include <stdio.h>
+
+int Initialize(const T2_InitializeOptions* Options) {
+ fprintf(stderr, "T2 Initialize API 0x%X, product %s, version %s\n",
+ Options->ApiVersion,
+ Options->ProductName,
+ Options->ProductVersion);
+ fprintf(stderr, "- MemFuncs: alloc %p, realloc %p, release %p\n",
+ Options->AllocateMemoryFunction,
+ Options->ReallocateMemoryFunction,
+ Options->ReleaseMemoryFunction);
+ return 0;
+}
+
+int Shutdown() {
+ return 0;
+}
+
diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/test2.cfg b/src/junit/com/jogamp/gluegen/test/junit/generation/test2.cfg
new file mode 100644
index 0000000..3b68598
--- /dev/null
+++ b/src/junit/com/jogamp/gluegen/test/junit/generation/test2.cfg
@@ -0,0 +1,52 @@
+Package com.jogamp.gluegen.test.junit.generation
+JavaClass BindingtestT2
+Style InterfaceAndImpl
+JavaOutputDir classes
+NativeOutputDir native
+
+# Use a ProcAddressTable so we dynamically look up the routines
+EmitProcAddressTable true
+ProcAddressTableClassName BindingtestT2ProcAddressTable
+GetProcAddressTableExpr _table
+ProcAddressNameExpr PFN $UPPERCASE({0}) PROC
+
+# Force all of the methods to be emitted using dynamic linking so we
+# don't need to link against any emulation library on the desktop or
+# depend on the presence of an import library for a particular device
+ForceProcAddressGen __ALL__
+
+# Also force the calling conventions of the locally generated function
+# pointer typedefs for these routines to MYAPIENTRY
+# LocalProcAddressCallingConvention __ALL__ MYAPIENTRY
+
+Opaque long T2_AllocateMemoryFunc
+Opaque long T2_ReallocateMemoryFunc
+Opaque long T2_ReleaseMemoryFunc
+
+EmitStruct T2_ThreadAffinity
+StructPackage T2_ThreadAffinity com.jogamp.gluegen.test.junit.generation
+
+EmitStruct T2_InitializeOptions
+StructPackage T2_InitializeOptions com.jogamp.gluegen.test.junit.generation
+ReturnsStringOnly T2_InitializeOptions.ProductName
+ReturnsStringOnly T2_InitializeOptions.ProductVersion
+Opaque long T2_InitializeOptions.Reserved
+ImmutableAccess long T2_InitializeOptions.Reserved
+# ReturnedArrayLength T2_InitializeOptions.OverrideThreadAffinity 1
+MaxOneElement T2_InitializeOptions.OverrideThreadAffinity
+
+ReturnsOpaque long T2_InitializeOptions.AllocateMemoryFunction
+ReturnsOpaque long T2_InitializeOptions.ReallocateMemoryFunc
+ReturnsOpaque long T2_InitializeOptions.ReleaseMemoryFunc
+
+CustomCCode #include "test2.h"
+
+Import com.jogamp.gluegen.test.junit.generation.BindingtestT2
+Import com.jogamp.gluegen.test.junit.generation.T2_InitializeOptions
+Import com.jogamp.gluegen.test.junit.generation.T2_ThreadAffinity
+
+CustomJavaCode BindingtestT2Impl private static BindingtestT2ProcAddressTable _table = new BindingtestT2ProcAddressTable();
+CustomJavaCode BindingtestT2Impl public static void resetProcAddressTable(DynamicLookupHelper lookup) {
+CustomJavaCode BindingtestT2Impl _table.reset(lookup);
+CustomJavaCode BindingtestT2Impl }
+
diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/test2.h b/src/junit/com/jogamp/gluegen/test/junit/generation/test2.h
new file mode 100644
index 0000000..e27e9aa
--- /dev/null
+++ b/src/junit/com/jogamp/gluegen/test/junit/generation/test2.h
@@ -0,0 +1,37 @@
+
+#include <gluegen_stdint.h>
+#include <gluegen_stddef.h>
+
+typedef void* ( * T2_AllocateMemoryFunc)(size_t SizeInBytes, size_t Alignment);
+
+typedef void* ( * T2_ReallocateMemoryFunc)(void* Pointer, size_t SizeInBytes, size_t Alignment);
+
+typedef void ( * T2_ReleaseMemoryFunc)(void* Pointer);
+
+typedef struct {
+ int32_t ApiVersion;
+ uint64_t NetworkWork;
+ uint64_t StorageIo;
+ uint64_t WebSocketIo;
+ uint64_t P2PIo;
+ uint64_t HttpRequestIo;
+ uint64_t RTCIo;
+} T2_ThreadAffinity;
+
+typedef struct {
+ int32_t ApiVersion;
+ T2_AllocateMemoryFunc AllocateMemoryFunction;
+ T2_ReallocateMemoryFunc ReallocateMemoryFunction;
+ T2_ReleaseMemoryFunc ReleaseMemoryFunction;
+
+ const char* ProductName;
+
+ const char* ProductVersion;
+
+ void* Reserved;
+
+ T2_ThreadAffinity* OverrideThreadAffinity;
+} T2_InitializeOptions;
+
+extern int Initialize(const T2_InitializeOptions* Options);
+extern int Shutdown();