summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--make/build-junit.xml28
-rw-r--r--src/java/com/jogamp/common/nio/AbstractBuffer.java114
-rw-r--r--src/java/com/jogamp/common/nio/AbstractLongBuffer.java144
-rw-r--r--src/java/com/jogamp/common/nio/Int64Buffer.java95
-rwxr-xr-xsrc/java/com/jogamp/common/nio/Int64BufferME_CDC_FP.java10
-rwxr-xr-xsrc/java/com/jogamp/common/nio/Int64BufferSE.java15
-rw-r--r--src/java/com/jogamp/common/nio/NativeBuffer.java33
-rw-r--r--src/java/com/jogamp/common/nio/PointerBuffer.java117
-rwxr-xr-xsrc/java/com/jogamp/common/nio/PointerBufferME_CDC_FP.java15
-rwxr-xr-xsrc/java/com/jogamp/common/nio/PointerBufferSE.java14
-rw-r--r--src/java/com/sun/gluegen/test/TestPointerBufferEndian.java41
-rw-r--r--src/java/com/sun/gluegen/test/TestStructAccessorEndian.java43
-rw-r--r--src/junit/com/jogamp/gluegen/test/junit/generation/BaseTest1.java (renamed from src/junit/com/jogamp/gluegen/test/junit/BaseTest1.java)10
-rw-r--r--src/junit/com/jogamp/gluegen/test/junit/generation/BuildEnvironment.java (renamed from src/junit/com/jogamp/gluegen/test/junit/BuildEnvironment.java)2
-rw-r--r--src/junit/com/jogamp/gluegen/test/junit/generation/Test1p1JavaEmitter.java (renamed from src/junit/com/jogamp/gluegen/test/junit/Test1p1JavaEmitter.java)6
-rw-r--r--src/junit/com/jogamp/gluegen/test/junit/generation/Test1p2ProcAddressEmitter.java (renamed from src/junit/com/jogamp/gluegen/test/junit/Test1p2ProcAddressEmitter.java)6
-rw-r--r--src/junit/com/jogamp/gluegen/test/junit/generation/test1-common.cfg (renamed from src/junit/com/jogamp/gluegen/test/junit/test1-common.cfg)0
-rw-r--r--src/junit/com/jogamp/gluegen/test/junit/generation/test1-gluegen.c (renamed from src/junit/com/jogamp/gluegen/test/junit/test1-gluegen.c)0
-rw-r--r--src/junit/com/jogamp/gluegen/test/junit/generation/test1-gluegen.cfg (renamed from src/junit/com/jogamp/gluegen/test/junit/test1-gluegen.cfg)2
-rw-r--r--src/junit/com/jogamp/gluegen/test/junit/generation/test1.c (renamed from src/junit/com/jogamp/gluegen/test/junit/test1.c)0
-rw-r--r--src/junit/com/jogamp/gluegen/test/junit/generation/test1.h (renamed from src/junit/com/jogamp/gluegen/test/junit/test1.h)0
-rw-r--r--src/junit/com/jogamp/gluegen/test/junit/generation/test1p1-gluegen.cfg14
-rw-r--r--src/junit/com/jogamp/gluegen/test/junit/generation/test1p2-gluegen.cfg (renamed from src/junit/com/jogamp/gluegen/test/junit/test1p2-gluegen.cfg)8
-rw-r--r--src/junit/com/jogamp/gluegen/test/junit/runtime/TestPointerBufferEndian.java54
-rw-r--r--src/junit/com/jogamp/gluegen/test/junit/runtime/TestStructAccessorEndian.java43
-rw-r--r--src/junit/com/jogamp/gluegen/test/junit/test1p1-gluegen.cfg14
26 files changed, 455 insertions, 373 deletions
diff --git a/make/build-junit.xml b/make/build-junit.xml
index c8e7b86..102a7ba 100644
--- a/make/build-junit.xml
+++ b/make/build-junit.xml
@@ -163,7 +163,7 @@
<sysincludepath path="${java.includes.dir}"/>
<sysincludepath path="${java.includes.dir.platform}"/>
<includepath path="${stub.includes.dir}/common"/>
- <includepath path="${test.junit.dir}"/>
+ <includepath path="${test.junit.dir}/generation"/>
<includepath path="${build_t.gen}/native"/>
</compiler>
@@ -205,7 +205,7 @@
<batchtest todir="${results}">
<fileset dir="${build_t.java}">
- <include name="${test.junit.rel}/Test*"/>
+ <include name="${test.junit.rel}/**/Test*"/>
</fileset>
<formatter usefile="false" type="brief"/>
<formatter usefile="true" type="xml"/>
@@ -234,32 +234,32 @@
<echo message=" - - - junit.test1.java.generate" />
<dirset id="stub.includes.fileset.test" dir=".">
- <include name="${test.junit.dir}/**"/>
+ <include name="${test.junit.dir}/generation/**"/>
<include name="${stub.includes.dir}/**" />
</dirset>
- <gluegen src="${test.junit.dir}/test1-gluegen.c"
+ <gluegen src="${test.junit.dir}/generation/test1-gluegen.c"
outputRootDir="${build_t.gen}"
- config="${test.junit.dir}/test1-gluegen.cfg"
- literalInclude="${test.junit.dir}"
+ config="${test.junit.dir}/generation/test1-gluegen.cfg"
+ literalInclude="${test.junit.dir}/generation"
includeRefid="stub.includes.fileset.test"
emitter="com.sun.gluegen.JavaEmitter">
<classpath refid="gluegen.classpath" />
</gluegen>
- <gluegen src="${test.junit.dir}/test1-gluegen.c"
+ <gluegen src="${test.junit.dir}/generation/test1-gluegen.c"
outputRootDir="${build_t.gen}"
- config="${test.junit.dir}/test1p1-gluegen.cfg"
- literalInclude="${test.junit.dir}"
+ config="${test.junit.dir}/generation/test1p1-gluegen.cfg"
+ literalInclude="${test.junit.dir}/generation"
includeRefid="stub.includes.fileset.test"
emitter="com.sun.gluegen.JavaEmitter">
<classpath refid="gluegen.classpath" />
</gluegen>
- <gluegen src="${test.junit.dir}/test1-gluegen.c"
+ <gluegen src="${test.junit.dir}/generation/test1-gluegen.c"
outputRootDir="${build_t.gen}"
- config="${test.junit.dir}/test1p2-gluegen.cfg"
- literalInclude="${test.junit.dir}"
+ config="${test.junit.dir}/generation/test1p2-gluegen.cfg"
+ literalInclude="${test.junit.dir}/generation"
includeRefid="stub.includes.fileset.test"
emitter="com.sun.gluegen.procaddress.ProcAddressEmitter">
<classpath refid="gluegen.classpath" />
@@ -270,7 +270,7 @@
<target name="junit.test1p1.c.build">
<patternset id="junit.test1p1.c.src.files">
- <include name="${test.junit.rootrel}/test1.c"/>
+ <include name="${test.junit.rootrel}/generation/test1.c"/>
<include name="${build_t.gen.rootrel}/native/BindingTest1p1Impl_JNI.c"/>
</patternset>
@@ -282,7 +282,7 @@
<target name="junit.test1p2.c.build">
<patternset id="junit.test1p2.c.src.files">
- <include name="${test.junit.rootrel}/test1.c"/>
+ <include name="${test.junit.rootrel}/generation/test1.c"/>
<include name="${build_t.gen.rootrel}/native/BindingTest1p2Impl_JNI.c"/>
</patternset>
diff --git a/src/java/com/jogamp/common/nio/AbstractBuffer.java b/src/java/com/jogamp/common/nio/AbstractBuffer.java
new file mode 100644
index 0000000..d76574b
--- /dev/null
+++ b/src/java/com/jogamp/common/nio/AbstractBuffer.java
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2010, Sven Gothel
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Sven Gothel nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Sven Gothel BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Created on Saturday, March 27 2010 11:55
+ */
+package com.jogamp.common.nio;
+
+import com.jogamp.common.os.*;
+
+import java.nio.ByteBuffer;
+import java.nio.Buffer;
+import java.util.HashMap;
+
+/**
+ * @author Michael Bien
+ * @author Sven Gothel
+ */
+public abstract class AbstractBuffer implements NativeBuffer {
+
+ protected final ByteBuffer bb;
+ protected int capacity;
+ protected int position;
+
+ static {
+ NativeLibrary.ensureNativeLibLoaded();
+ }
+
+ protected AbstractBuffer(ByteBuffer bb, int elementSize) {
+ this.bb = bb;
+
+ capacity = bb.capacity() / elementSize;
+ position = 0;
+ }
+
+ public final int limit() {
+ return capacity;
+ }
+
+ public final int capacity() {
+ return capacity;
+ }
+
+ public final int position() {
+ return position;
+ }
+
+ public final NativeBuffer position(int newPos) {
+ if (0 > newPos || newPos >= capacity) {
+ throw new IndexOutOfBoundsException("Sorry to interrupt, but the position "+newPos+" was out of bounds. " +
+ "My capacity is "+capacity()+".");
+ }
+ position = newPos;
+ return this;
+ }
+
+ public final int remaining() {
+ return capacity - position;
+ }
+
+ public final boolean hasRemaining() {
+ return position < capacity;
+ }
+
+ public final NativeBuffer rewind() {
+ position = 0;
+ return this;
+ }
+
+ public boolean hasArray() {
+ return false;
+ }
+
+ public int arrayOffset() {
+ return 0;
+ }
+
+ public final ByteBuffer getBuffer() {
+ return bb;
+ }
+
+ public final boolean isDirect() {
+ return bb.isDirect();
+ }
+
+ public String toString() {
+ return "AbstractBuffer[capacity "+capacity+", position "+position+", elementSize "+(bb.capacity()/capacity)+", ByteBuffer.capacity "+bb.capacity()+"]";
+ }
+
+}
diff --git a/src/java/com/jogamp/common/nio/AbstractLongBuffer.java b/src/java/com/jogamp/common/nio/AbstractLongBuffer.java
new file mode 100644
index 0000000..ad90ffc
--- /dev/null
+++ b/src/java/com/jogamp/common/nio/AbstractLongBuffer.java
@@ -0,0 +1,144 @@
+/*
+ * Copyright (c) 2010, Michael Bien
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Michael Bien nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Michael Bien BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Created on Saturday, March 27 2010 11:55
+ */
+package com.jogamp.common.nio;
+
+import com.jogamp.common.os.*;
+import java.nio.ByteBuffer;
+import java.nio.Buffer;
+import java.util.HashMap;
+
+/**
+ * Hardware independent container for native pointer arrays.
+ *
+ * The native values (NIO direct ByteBuffer) might be 32bit or 64bit wide,
+ * depending of the CPU pointer width.
+ *
+ * @author Michael Bien
+ * @author Sven Gothel
+ */
+public abstract class AbstractLongBuffer extends AbstractBuffer {
+
+ protected long[] backup;
+
+ protected HashMap/*<aptr, buffer>*/ dataMap = new HashMap();
+
+ static {
+ NativeLibrary.ensureNativeLibLoaded();
+ }
+
+ protected AbstractLongBuffer(ByteBuffer bb, int elementSize) {
+ super(bb, elementSize);
+
+ backup = new long[capacity];
+ }
+
+ final void updateBackup() {
+ for (int i = 0; i < capacity; i++) {
+ backup[i] = get(i);
+ }
+ }
+
+ public final boolean hasArray() {
+ return true;
+ }
+
+ public final long[] array() {
+ return backup;
+ }
+
+ /** Absolute get method. Get the pointer value at the given index */
+ public abstract long get(int idx);
+
+ /** Relative get method. Get the pointer value at the current position and increment the position by one. */
+ public final long get() {
+ long r = get(position);
+ position++;
+ return r;
+ }
+
+ /**
+ * Relative bulk get method. Copy the pointer values <code> [ position .. position+length [</code>
+ * to the destination array <code> [ dest[offset] .. dest[offset+length] [ </code>
+ * and increment the position by <code>length</code>. */
+ public final AbstractLongBuffer get(long[] dest, int offset, int length) {
+ if (dest.length<offset+length) {
+ throw new IndexOutOfBoundsException();
+ }
+ if (remaining() < length) {
+ throw new IndexOutOfBoundsException();
+ }
+ while(length>0) {
+ dest[offset++] = get(position++);
+ length--;
+ }
+ return this;
+ }
+
+ /** Absolute put method. Put the pointer value at the given index */
+ public abstract AbstractLongBuffer put(int index, long value);
+
+ /** Relative put method. Put the pointer value at the current position and increment the position by one. */
+ public final AbstractLongBuffer put(long value) {
+ put(position, value);
+ position++;
+ return this;
+ }
+
+ /**
+ * Relative bulk put method. Put the pointer values <code> [ src[offset] .. src[offset+length] [</code>
+ * at the current position and increment the position by <code>length</code>. */
+ public final AbstractLongBuffer put(long[] src, int offset, int length) {
+ if (src.length<offset+length) {
+ throw new IndexOutOfBoundsException();
+ }
+ if (remaining() < length) {
+ throw new IndexOutOfBoundsException();
+ }
+ while(length>0) {
+ put(position++, src[offset++]);
+ length--;
+ }
+ return this;
+ }
+
+ /**
+ * Relative bulk get method. Copy the source values <code> src[position .. capacity] [</code>
+ * to this buffer and increment the position by <code>capacity-position</code>. */
+ public AbstractLongBuffer put(AbstractLongBuffer src) {
+ if (remaining() < src.remaining()) {
+ throw new IndexOutOfBoundsException();
+ }
+ while (src.hasRemaining()) {
+ put(src.get());
+ }
+ return this;
+ }
+}
diff --git a/src/java/com/jogamp/common/nio/Int64Buffer.java b/src/java/com/jogamp/common/nio/Int64Buffer.java
index d1fafb6..6f0b7a3 100644
--- a/src/java/com/jogamp/common/nio/Int64Buffer.java
+++ b/src/java/com/jogamp/common/nio/Int64Buffer.java
@@ -27,7 +27,7 @@
package com.jogamp.common.nio;
-import com.jogamp.common.os.Platform;
+import com.jogamp.common.os.*;
import java.nio.ByteBuffer;
/**
@@ -38,15 +38,10 @@ import java.nio.ByteBuffer;
* @author Michael Bien
* @author Sven Gothel
*/
-public abstract class Int64Buffer implements NativeBuffer/*<PointerBuffer>*/ {
-
- protected final ByteBuffer bb;
- protected int capacity;
- protected int position;
- protected long[] backup;
+public abstract class Int64Buffer extends AbstractLongBuffer {
protected Int64Buffer(ByteBuffer bb) {
- this.bb = bb;
+ super(bb, elementSize());
}
public static Int64Buffer allocate(int size) {
@@ -77,94 +72,12 @@ public abstract class Int64Buffer implements NativeBuffer/*<PointerBuffer>*/ {
}
- void updateBackup() {
- for (int i = 0; i < capacity; i++) {
- backup[i] = get(i);
- }
- }
-
- int arrayOffset() {
- return 0;
- }
-
public static int elementSize() {
return Buffers.SIZEOF_LONG;
}
- public int limit() {
- return capacity;
- }
-
- public int capacity() {
- return capacity;
- }
-
- public int position() {
- return position;
- }
-
- public Int64Buffer position(int newPos) {
- if (0 > newPos || newPos >= capacity) {
- throw new IndexOutOfBoundsException("Sorry to interrupt, but the position "+newPos+" was out of bounds. " +
- "My capacity is "+capacity()+".");
- }
- position = newPos;
- return this;
- }
-
- public int remaining() {
- return capacity - position;
- }
-
- public boolean hasRemaining() {
- return position < capacity;
- }
-
- public Int64Buffer rewind() {
- position = 0;
- return this;
- }
-
- boolean hasArray() {
- return true;
- }
-
- public long[] array() {
- return backup;
- }
-
- public ByteBuffer getBuffer() {
- return bb;
- }
-
- public boolean isDirect() {
- return bb.isDirect();
- }
-
- public long get() {
- long r = get(position);
- position++;
- return r;
- }
-
- public abstract long get(int idx);
-
- public abstract Int64Buffer put(int index, long value);
-
- public abstract Int64Buffer put(long value);
-
- public Int64Buffer put(Int64Buffer src) {
- if (remaining() < src.remaining()) {
- throw new IndexOutOfBoundsException();
- }
- while (src.hasRemaining()) {
- put(src.get());
- }
- return this;
- }
-
public String toString() {
- return "Int64Buffer[capacity "+capacity+", position "+position+", elementSize "+elementSize()+", ByteBuffer.capacity "+bb.capacity()+"]";
+ return "Int64Buffer:"+super.toString();
}
}
diff --git a/src/java/com/jogamp/common/nio/Int64BufferME_CDC_FP.java b/src/java/com/jogamp/common/nio/Int64BufferME_CDC_FP.java
index 5cad3ef..9621677 100755
--- a/src/java/com/jogamp/common/nio/Int64BufferME_CDC_FP.java
+++ b/src/java/com/jogamp/common/nio/Int64BufferME_CDC_FP.java
@@ -56,7 +56,7 @@ final class Int64BufferME_CDC_FP extends Int64Buffer {
backup = new long[capacity];
}
- public long get(int idx) {
+ public final long get(int idx) {
if (0 > idx || idx >= capacity) {
throw new IndexOutOfBoundsException();
}
@@ -69,7 +69,7 @@ final class Int64BufferME_CDC_FP extends Int64Buffer {
return lo << 32 | hi;
}
- public Int64Buffer put(int idx, long v) {
+ public final AbstractLongBuffer put(int idx, long v) {
if (0 > idx || idx >= capacity) {
throw new IndexOutOfBoundsException();
}
@@ -86,10 +86,4 @@ final class Int64BufferME_CDC_FP extends Int64Buffer {
}
return this;
}
-
- public Int64Buffer put(long v) {
- put(position, v);
- position++;
- return this;
- }
}
diff --git a/src/java/com/jogamp/common/nio/Int64BufferSE.java b/src/java/com/jogamp/common/nio/Int64BufferSE.java
index 7387320..fc262fd 100755
--- a/src/java/com/jogamp/common/nio/Int64BufferSE.java
+++ b/src/java/com/jogamp/common/nio/Int64BufferSE.java
@@ -49,21 +49,16 @@ final class Int64BufferSE extends Int64Buffer {
super(bb);
this.pb = bb.asLongBuffer();
-
- capacity = bb.capacity() / elementSize();
-
- position = 0;
- backup = new long[capacity];
}
- public long get(int idx) {
+ public final long get(int idx) {
if (0 > idx || idx >= capacity) {
throw new IndexOutOfBoundsException();
}
return pb.get(idx);
}
- public Int64Buffer put(int idx, long v) {
+ public final AbstractLongBuffer put(int idx, long v) {
if (0 > idx || idx >= capacity) {
throw new IndexOutOfBoundsException();
}
@@ -71,10 +66,4 @@ final class Int64BufferSE extends Int64Buffer {
pb.put(idx, v);
return this;
}
-
- public Int64Buffer put(long v) {
- put(position, v);
- position++;
- return this;
- }
}
diff --git a/src/java/com/jogamp/common/nio/NativeBuffer.java b/src/java/com/jogamp/common/nio/NativeBuffer.java
index 170297a..99a5cbc 100644
--- a/src/java/com/jogamp/common/nio/NativeBuffer.java
+++ b/src/java/com/jogamp/common/nio/NativeBuffer.java
@@ -11,37 +11,44 @@ import java.nio.ByteBuffer;
* @author Michael Bien
* @author Sven Gothel
*/
-/*public*/ interface NativeBuffer/*<B extends NativeBuffer>*/ { // make public as soon we support generics
-
- public boolean hasRemaining();
-
- public boolean isDirect();
+public interface NativeBuffer/*<B extends NativeBuffer>*/ {
public int limit();
+ public int capacity();
+
public int position();
+ public NativeBuffer position(int newPos);
+
public int remaining();
- public long[] array();
+ public boolean hasRemaining();
+
+ public NativeBuffer rewind();
+
+ public boolean hasArray();
+
+ public int arrayOffset();
+
+ public ByteBuffer getBuffer();
+
+ public boolean isDirect();
- public int capacity();
/*
- public B rewind();
+ public long[] array();
- public B position(int newPos);
+ public B rewind();
public B put(int index, long value);
public B put(long value);
public B put(B src);
-*/
+
public long get();
public long get(int idx);
-
- public ByteBuffer getBuffer();
-
+*/
}
diff --git a/src/java/com/jogamp/common/nio/PointerBuffer.java b/src/java/com/jogamp/common/nio/PointerBuffer.java
index 9b7232f..26d2e7b 100644
--- a/src/java/com/jogamp/common/nio/PointerBuffer.java
+++ b/src/java/com/jogamp/common/nio/PointerBuffer.java
@@ -30,8 +30,7 @@
*/
package com.jogamp.common.nio;
-import com.jogamp.common.os.NativeLibrary;
-import com.jogamp.common.os.Platform;
+import com.jogamp.common.os.*;
import java.nio.ByteBuffer;
import java.nio.Buffer;
import java.util.HashMap;
@@ -45,12 +44,7 @@ import java.util.HashMap;
* @author Michael Bien
* @author Sven Gothel
*/
-public abstract class PointerBuffer implements NativeBuffer/*<PointerBuffer>*/ {
-
- protected final ByteBuffer bb;
- protected int capacity;
- protected int position;
- protected long[] backup;
+public abstract class PointerBuffer extends AbstractLongBuffer {
protected HashMap/*<aptr, buffer>*/ dataMap = new HashMap();
@@ -59,7 +53,7 @@ public abstract class PointerBuffer implements NativeBuffer/*<PointerBuffer>*/ {
}
protected PointerBuffer(ByteBuffer bb) {
- this.bb = bb;
+ super(bb, elementSize());
}
public static PointerBuffer allocate(int size) {
@@ -90,88 +84,33 @@ public abstract class PointerBuffer implements NativeBuffer/*<PointerBuffer>*/ {
}
- void updateBackup() {
- for (int i = 0; i < capacity; i++) {
- backup[i] = get(i);
- }
- }
-
- int arrayOffset() {
- return 0;
- }
-
public static int elementSize() {
return Platform.is32Bit() ? Buffers.SIZEOF_INT : Buffers.SIZEOF_LONG;
}
- public int limit() {
- return capacity;
- }
-
- public int capacity() {
- return capacity;
- }
-
- public int position() {
- return position;
- }
-
- public PointerBuffer position(int newPos) {
- if (0 > newPos || newPos >= capacity) {
- throw new IndexOutOfBoundsException("Sorry to interrupt, but the position "+newPos+" was out of bounds. " +
- "My capacity is "+capacity()+".");
+ public final PointerBuffer put(PointerBuffer src) {
+ if (remaining() < src.remaining()) {
+ throw new IndexOutOfBoundsException();
+ }
+ long addr;
+ while (src.hasRemaining()) {
+ addr = src.get();
+ put(addr);
+ Long addrL = new Long(addr);
+ Buffer bb = (Buffer) dataMap.get(addrL);
+ if(null!=bb) {
+ dataMap.put(addrL, bb);
+ } else {
+ dataMap.remove(addrL);
+ }
}
- position = newPos;
- return this;
- }
-
- public int remaining() {
- return capacity - position;
- }
-
- public boolean hasRemaining() {
- return position < capacity;
- }
-
- public PointerBuffer rewind() {
- position = 0;
return this;
}
- boolean hasArray() {
- return true;
- }
-
- public long[] array() {
- return backup;
- }
-
- public ByteBuffer getBuffer() {
- return bb;
- }
-
- public boolean isDirect() {
- return bb.isDirect();
- }
-
- public long get() {
- long r = get(position);
- position++;
- return r;
- }
-
- public abstract long get(int idx);
-
- /** put the pointer value at position index */
- public abstract PointerBuffer put(int index, long value);
-
- /** put the pointer value at the end */
- public abstract PointerBuffer put(long value);
-
/** Put the address of the given direct Buffer at the given position
of this pointer array.
Adding a reference of the given direct Buffer to this object. */
- public PointerBuffer referenceBuffer(int index, Buffer bb) {
+ public final PointerBuffer referenceBuffer(int index, Buffer bb) {
if(null==bb) {
throw new RuntimeException("Buffer is null");
}
@@ -191,18 +130,18 @@ public abstract class PointerBuffer implements NativeBuffer/*<PointerBuffer>*/ {
/** Put the address of the given direct Buffer at the end
of this pointer array.
Adding a reference of the given direct Buffer to this object. */
- public PointerBuffer referenceBuffer(Buffer bb) {
+ public final PointerBuffer referenceBuffer(Buffer bb) {
referenceBuffer(position, bb);
position++;
return this;
}
- public Buffer getReferencedBuffer(int index) {
+ public final Buffer getReferencedBuffer(int index) {
long addr = get(index);
return (Buffer) dataMap.get(new Long(addr));
}
- public Buffer getReferencedBuffer() {
+ public final Buffer getReferencedBuffer() {
Buffer bb = getReferencedBuffer(position);
position++;
return bb;
@@ -210,18 +149,8 @@ public abstract class PointerBuffer implements NativeBuffer/*<PointerBuffer>*/ {
private native long getDirectBufferAddressImpl(Object directBuffer);
- public PointerBuffer put(PointerBuffer src) {
- if (remaining() < src.remaining()) {
- throw new IndexOutOfBoundsException();
- }
- while (src.hasRemaining()) {
- put(src.get());
- }
- return this;
- }
-
public String toString() {
- return "PointerBuffer[capacity "+capacity+", position "+position+", elementSize "+elementSize()+", ByteBuffer.capacity "+bb.capacity()+"]";
+ return "PointerBuffer:"+super.toString();
}
}
diff --git a/src/java/com/jogamp/common/nio/PointerBufferME_CDC_FP.java b/src/java/com/jogamp/common/nio/PointerBufferME_CDC_FP.java
index 74c049b..6e2c7d9 100755
--- a/src/java/com/jogamp/common/nio/PointerBufferME_CDC_FP.java
+++ b/src/java/com/jogamp/common/nio/PointerBufferME_CDC_FP.java
@@ -49,14 +49,9 @@ final class PointerBufferME_CDC_FP extends PointerBuffer {
PointerBufferME_CDC_FP(ByteBuffer bb) {
super(bb);
this.pb = bb.asIntBuffer();
-
- capacity = bb.capacity() / elementSize();
-
- position = 0;
- backup = new long[capacity];
}
- public long get(int idx) {
+ public final long get(int idx) {
if (0 > idx || idx >= capacity) {
throw new IndexOutOfBoundsException();
}
@@ -73,7 +68,7 @@ final class PointerBufferME_CDC_FP extends PointerBuffer {
}
}
- public PointerBuffer put(int idx, long v) {
+ public final AbstractLongBuffer put(int idx, long v) {
if (0 > idx || idx >= capacity) {
throw new IndexOutOfBoundsException();
}
@@ -94,10 +89,4 @@ final class PointerBufferME_CDC_FP extends PointerBuffer {
}
return this;
}
-
- public PointerBuffer put(long v) {
- put(position, v);
- position++;
- return this;
- }
}
diff --git a/src/java/com/jogamp/common/nio/PointerBufferSE.java b/src/java/com/jogamp/common/nio/PointerBufferSE.java
index f750430..11dc629 100755
--- a/src/java/com/jogamp/common/nio/PointerBufferSE.java
+++ b/src/java/com/jogamp/common/nio/PointerBufferSE.java
@@ -54,14 +54,9 @@ final class PointerBufferSE extends PointerBuffer {
} else {
this.pb = bb.asLongBuffer();
}
-
- capacity = bb.capacity() / elementSize();
-
- position = 0;
- backup = new long[capacity];
}
- public long get(int idx) {
+ public final long get(int idx) {
if (0 > idx || idx >= capacity) {
throw new IndexOutOfBoundsException();
}
@@ -72,7 +67,7 @@ final class PointerBufferSE extends PointerBuffer {
}
}
- public PointerBuffer put(int idx, long v) {
+ public final AbstractLongBuffer put(int idx, long v) {
if (0 > idx || idx >= capacity) {
throw new IndexOutOfBoundsException();
}
@@ -85,9 +80,4 @@ final class PointerBufferSE extends PointerBuffer {
return this;
}
- public PointerBuffer put(long v) {
- put(position, v);
- position++;
- return this;
- }
}
diff --git a/src/java/com/sun/gluegen/test/TestPointerBufferEndian.java b/src/java/com/sun/gluegen/test/TestPointerBufferEndian.java
deleted file mode 100644
index e64de92..0000000
--- a/src/java/com/sun/gluegen/test/TestPointerBufferEndian.java
+++ /dev/null
@@ -1,41 +0,0 @@
-
-package com.sun.gluegen.test;
-
-import com.jogamp.common.os.Platform;
-import com.jogamp.common.nio.PointerBuffer;
-
-public class TestPointerBufferEndian {
- public static void main (String[] args) {
- boolean direct = args.length>0 && args[0].equals("-direct");
- boolean ok = true;
- int bitsPtr = Platform.getPointerSizeInBits();
- String bitsProp = System.getProperty("sun.arch.data.model");
- String os = System.getProperty("os.name");
- String cpu = System.getProperty("os.arch");
- System.out.println("OS: <"+os+"> CPU: <"+cpu+"> Bits: <"+bitsPtr+"/"+bitsProp+">");
- System.out.println("CPU is: "+ (Platform.is32Bit()?"32":"64") + " bit");
- System.out.println("Buffer is in: "+ (Platform.isLittleEndian()?"little":"big") + " endian");
- PointerBuffer ptr = direct ? PointerBuffer.allocateDirect(3) : PointerBuffer.allocate(3);
- ptr.put(0, 0x0123456789ABCDEFL);
- ptr.put(1, 0x8877665544332211L);
- ptr.put(2, 0xAFFEDEADBEEFAFFEL);
- long v = ptr.get(0);
- if( 0x0123456789ABCDEFL != v ) {
- System.out.println("Err[0] shall 0x0123456789ABCDEF, is: "+Long.toHexString(v));
- ok=false;
- }
- v = ptr.get(1);
- if( 0x8877665544332211L != v ) {
- System.out.println("Err[1] shall 0x8877665544332211, is: "+Long.toHexString(v));
- ok=false;
- }
- v = ptr.get(2);
- if( 0xAFFEDEADBEEFAFFEL != v ) {
- System.out.println("Err[2] shall 0xAFFEDEADBEEFAFFE, is: "+Long.toHexString(v));
- ok=false;
- }
- if(!ok) {
- throw new RuntimeException("Long conversion failure");
- }
- }
-}
diff --git a/src/java/com/sun/gluegen/test/TestStructAccessorEndian.java b/src/java/com/sun/gluegen/test/TestStructAccessorEndian.java
deleted file mode 100644
index 4fe4008..0000000
--- a/src/java/com/sun/gluegen/test/TestStructAccessorEndian.java
+++ /dev/null
@@ -1,43 +0,0 @@
-
-package com.sun.gluegen.test;
-
-import com.jogamp.common.os.Platform;
-import com.jogamp.common.nio.Buffers;
-import com.jogamp.common.nio.StructAccessor;
-import java.nio.*;
-
-public class TestStructAccessorEndian {
- public static void main (String args[]) {
- boolean ok = true;
- int bitsPtr = Platform.getPointerSizeInBits();
- String bitsProp = System.getProperty("sun.arch.data.model");
- String os = System.getProperty("os.name");
- String cpu = System.getProperty("os.arch");
- System.out.println("OS: <"+os+"> CPU: <"+cpu+"> Bits: <"+bitsPtr+"/"+bitsProp+">");
- System.out.println("CPU is: "+ (Platform.is32Bit()?"32":"64") + " bit");
- System.out.println("Buffer is in: "+ (Platform.isLittleEndian()?"little":"big") + " endian");
- ByteBuffer tst = Buffers.newDirectByteBuffer(Buffers.SIZEOF_LONG * 3);
- StructAccessor acc = new StructAccessor(tst);
- acc.setLongAt(0, 0x0123456789ABCDEFL);
- acc.setLongAt(1, 0x8877665544332211L);
- acc.setLongAt(2, 0xAFFEDEADBEEFAFFEL);
- long v = acc.getLongAt(0);
- if( 0x0123456789ABCDEFL != v ) {
- System.out.println("Err[0] shall 0x0123456789ABCDEF, is: "+Long.toHexString(v));
- ok=false;
- }
- v = acc.getLongAt(1);
- if( 0x8877665544332211L != v ) {
- System.out.println("Err[1] shall 0x8877665544332211, is: "+Long.toHexString(v));
- ok=false;
- }
- v = acc.getLongAt(2);
- if( 0xAFFEDEADBEEFAFFEL != v ) {
- System.out.println("Err[2] shall 0xAFFEDEADBEEFAFFE, is: "+Long.toHexString(v));
- ok=false;
- }
- if(!ok) {
- throw new RuntimeException("Long conversion failure");
- }
- }
-}
diff --git a/src/junit/com/jogamp/gluegen/test/junit/BaseTest1.java b/src/junit/com/jogamp/gluegen/test/junit/generation/BaseTest1.java
index b4f8536..b689e6d 100644
--- a/src/junit/com/jogamp/gluegen/test/junit/BaseTest1.java
+++ b/src/junit/com/jogamp/gluegen/test/junit/generation/BaseTest1.java
@@ -30,7 +30,7 @@
* SVEN GOTHEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
-package com.jogamp.gluegen.test.junit;
+package com.jogamp.gluegen.test.junit.generation;
import com.jogamp.common.nio.Buffers;
import com.jogamp.common.nio.PointerBuffer;
@@ -52,7 +52,7 @@ import org.junit.BeforeClass;
import org.junit.Test;
import static java.lang.System.*;
-import static com.jogamp.gluegen.test.junit.BuildEnvironment.*;
+import static com.jogamp.gluegen.test.junit.generation.BuildEnvironment.*;
/**
* @author Michael Bien
@@ -64,8 +64,8 @@ public class BaseTest1 {
* Verifies the existence and creation of the generated class.
*/
public void testClassExist(String name) throws Exception {
- String ifName = "com.jogamp.gluegen.test.junit.Binding"+name;
- String implName = "com.jogamp.gluegen.test.junit.impl.Binding"+name+"Impl";
+ String ifName = "com.jogamp.gluegen.test.junit.generation.Binding"+name;
+ String implName = "com.jogamp.gluegen.test.junit.generation.impl.Binding"+name+"Impl";
Class<?> clazzIf = Class.forName(ifName);
Class<?> clazzImpl = Class.forName(implName);
@@ -77,7 +77,7 @@ public class BaseTest1 {
Object obj = clazzImpl.newInstance();
Assert.assertTrue("Not of type "+ifName, clazzIf.isAssignableFrom(obj.getClass()));
- Assert.assertTrue("Not of type com.jogamp.gluegen.test.junit.BindingTest1", (obj instanceof com.jogamp.gluegen.test.junit.BindingTest1));
+ Assert.assertTrue("Not of type com.jogamp.gluegen.test.junit.generation.BindingTest1", (obj instanceof com.jogamp.gluegen.test.junit.generation.BindingTest1));
}
/**
diff --git a/src/junit/com/jogamp/gluegen/test/junit/BuildEnvironment.java b/src/junit/com/jogamp/gluegen/test/junit/generation/BuildEnvironment.java
index 16d5053..db5581d 100644
--- a/src/junit/com/jogamp/gluegen/test/junit/BuildEnvironment.java
+++ b/src/junit/com/jogamp/gluegen/test/junit/generation/BuildEnvironment.java
@@ -30,7 +30,7 @@
* SVEN GOTHEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
-package com.jogamp.gluegen.test.junit;
+package com.jogamp.gluegen.test.junit.generation;
import java.io.File;
import java.net.URISyntaxException;
diff --git a/src/junit/com/jogamp/gluegen/test/junit/Test1p1JavaEmitter.java b/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p1JavaEmitter.java
index c5ef4ad..6320f92 100644
--- a/src/junit/com/jogamp/gluegen/test/junit/Test1p1JavaEmitter.java
+++ b/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p1JavaEmitter.java
@@ -30,9 +30,9 @@
* SVEN GOTHEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
-package com.jogamp.gluegen.test.junit;
+package com.jogamp.gluegen.test.junit.generation;
-import com.jogamp.gluegen.test.junit.impl.BindingTest1p1Impl;
+import com.jogamp.gluegen.test.junit.generation.impl.BindingTest1p1Impl;
import com.jogamp.common.nio.Buffers;
import com.jogamp.common.nio.PointerBuffer;
@@ -52,7 +52,7 @@ import org.junit.BeforeClass;
import org.junit.Test;
import static java.lang.System.*;
-import static com.jogamp.gluegen.test.junit.BuildEnvironment.*;
+import static com.jogamp.gluegen.test.junit.generation.BuildEnvironment.*;
/**
* @author Michael Bien
diff --git a/src/junit/com/jogamp/gluegen/test/junit/Test1p2ProcAddressEmitter.java b/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p2ProcAddressEmitter.java
index 9096eca..83f20d1 100644
--- a/src/junit/com/jogamp/gluegen/test/junit/Test1p2ProcAddressEmitter.java
+++ b/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p2ProcAddressEmitter.java
@@ -30,9 +30,9 @@
* SVEN GOTHEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
-package com.jogamp.gluegen.test.junit;
+package com.jogamp.gluegen.test.junit.generation;
-import com.jogamp.gluegen.test.junit.impl.BindingTest1p2Impl;
+import com.jogamp.gluegen.test.junit.generation.impl.BindingTest1p2Impl;
import com.jogamp.common.nio.Buffers;
import com.jogamp.common.nio.PointerBuffer;
@@ -54,7 +54,7 @@ import org.junit.BeforeClass;
import org.junit.Test;
import static java.lang.System.*;
-import static com.jogamp.gluegen.test.junit.BuildEnvironment.*;
+import static com.jogamp.gluegen.test.junit.generation.BuildEnvironment.*;
/**
* @author Michael Bien
diff --git a/src/junit/com/jogamp/gluegen/test/junit/test1-common.cfg b/src/junit/com/jogamp/gluegen/test/junit/generation/test1-common.cfg
index 6ba4b78..6ba4b78 100644
--- a/src/junit/com/jogamp/gluegen/test/junit/test1-common.cfg
+++ b/src/junit/com/jogamp/gluegen/test/junit/generation/test1-common.cfg
diff --git a/src/junit/com/jogamp/gluegen/test/junit/test1-gluegen.c b/src/junit/com/jogamp/gluegen/test/junit/generation/test1-gluegen.c
index bf6ad97..bf6ad97 100644
--- a/src/junit/com/jogamp/gluegen/test/junit/test1-gluegen.c
+++ b/src/junit/com/jogamp/gluegen/test/junit/generation/test1-gluegen.c
diff --git a/src/junit/com/jogamp/gluegen/test/junit/test1-gluegen.cfg b/src/junit/com/jogamp/gluegen/test/junit/generation/test1-gluegen.cfg
index 9d0f856..971419e 100644
--- a/src/junit/com/jogamp/gluegen/test/junit/test1-gluegen.cfg
+++ b/src/junit/com/jogamp/gluegen/test/junit/generation/test1-gluegen.cfg
@@ -1,4 +1,4 @@
-Package com.jogamp.gluegen.test.junit
+Package com.jogamp.gluegen.test.junit.generation
JavaClass BindingTest1
Style InterfaceOnly
JavaOutputDir classes
diff --git a/src/junit/com/jogamp/gluegen/test/junit/test1.c b/src/junit/com/jogamp/gluegen/test/junit/generation/test1.c
index f654467..f654467 100644
--- a/src/junit/com/jogamp/gluegen/test/junit/test1.c
+++ b/src/junit/com/jogamp/gluegen/test/junit/generation/test1.c
diff --git a/src/junit/com/jogamp/gluegen/test/junit/test1.h b/src/junit/com/jogamp/gluegen/test/junit/generation/test1.h
index d0e50e5..d0e50e5 100644
--- a/src/junit/com/jogamp/gluegen/test/junit/test1.h
+++ b/src/junit/com/jogamp/gluegen/test/junit/generation/test1.h
diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/test1p1-gluegen.cfg b/src/junit/com/jogamp/gluegen/test/junit/generation/test1p1-gluegen.cfg
new file mode 100644
index 0000000..2062512
--- /dev/null
+++ b/src/junit/com/jogamp/gluegen/test/junit/generation/test1p1-gluegen.cfg
@@ -0,0 +1,14 @@
+Package com.jogamp.gluegen.test.junit.generation
+JavaClass BindingTest1p1
+Style InterfaceAndImpl
+JavaOutputDir classes
+NativeOutputDir native
+
+Extends BindingTest1p1 BindingTest1
+
+Include test1-common.cfg
+
+Import com.jogamp.gluegen.test.junit.generation.BindingTest1
+Import com.jogamp.gluegen.test.junit.generation.BindingTest1p1
+
+
diff --git a/src/junit/com/jogamp/gluegen/test/junit/test1p2-gluegen.cfg b/src/junit/com/jogamp/gluegen/test/junit/generation/test1p2-gluegen.cfg
index 651c93c..e5ace6e 100644
--- a/src/junit/com/jogamp/gluegen/test/junit/test1p2-gluegen.cfg
+++ b/src/junit/com/jogamp/gluegen/test/junit/generation/test1p2-gluegen.cfg
@@ -1,4 +1,4 @@
-Package com.jogamp.gluegen.test.junit
+Package com.jogamp.gluegen.test.junit.generation
JavaClass BindingTest1p2
Style InterfaceAndImpl
JavaOutputDir classes
@@ -22,10 +22,10 @@ ForceProcAddressGen __ALL__
LocalProcAddressCallingConvention __ALL__ MYAPIENTRY
Include test1-common.cfg
-Include ../../../../../../../make/config/intptr.cfg
+Include ../../../../../../../../make/config/intptr.cfg
-Import com.jogamp.gluegen.test.junit.BindingTest1
-Import com.jogamp.gluegen.test.junit.BindingTest1p2
+Import com.jogamp.gluegen.test.junit.generation.BindingTest1
+Import com.jogamp.gluegen.test.junit.generation.BindingTest1p2
CustomJavaCode BindingTest1p2Impl private static BindingTest1p2ProcAddressTable _table = new BindingTest1p2ProcAddressTable();
CustomJavaCode BindingTest1p2Impl public static void resetProcAddressTable(DynamicLookupHelper lookup) {
diff --git a/src/junit/com/jogamp/gluegen/test/junit/runtime/TestPointerBufferEndian.java b/src/junit/com/jogamp/gluegen/test/junit/runtime/TestPointerBufferEndian.java
new file mode 100644
index 0000000..a57fd22
--- /dev/null
+++ b/src/junit/com/jogamp/gluegen/test/junit/runtime/TestPointerBufferEndian.java
@@ -0,0 +1,54 @@
+
+package com.jogamp.gluegen.test.junit.runtime;
+
+import com.jogamp.common.nio.*;
+import com.jogamp.common.os.*;
+
+import java.nio.*;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import static java.lang.System.*;
+
+public class TestPointerBufferEndian {
+
+ protected void testImpl (boolean direct) {
+ int bitsPtr = Platform.getPointerSizeInBits();
+ String bitsProp = System.getProperty("sun.arch.data.model");
+ String os = System.getProperty("os.name");
+ String cpu = System.getProperty("os.arch");
+ System.out.println("OS: <"+os+"> CPU: <"+cpu+"> Bits: <"+bitsPtr+"/"+bitsProp+">");
+ System.out.println("CPU is: "+ (Platform.is32Bit()?"32":"64") + " bit");
+ System.out.println("Buffer is in: "+ (Platform.isLittleEndian()?"little":"big") + " endian");
+
+ long[] valuesSource = { 0x0123456789ABCDEFL, 0x8877665544332211L, 0xAFFEDEADBEEFAFFEL };
+ long[] values32Bit = { 0x0000000089ABCDEFL, 0x0000000044332211L, 0x00000000BEEFAFFEL };
+
+ PointerBuffer ptr = direct ? PointerBuffer.allocateDirect(3) : PointerBuffer.allocate(valuesSource.length);
+ ptr.put(valuesSource, 0, valuesSource.length);
+ ptr.rewind();
+
+ int i=0;
+ while(ptr.hasRemaining()) {
+ long mask = Platform.is32Bit() ? 0x00000000FFFFFFFFL : 0xFFFFFFFFFFFFFFFFL ;
+ long v = ptr.get() & mask;
+ long t = Platform.is32Bit() ? values32Bit[i] : valuesSource[i];
+ Assert.assertTrue("Value["+i+"] shall be 0x"+Long.toHexString(t)+", is: 0x"+Long.toHexString(v), t == v);
+ i++;
+ }
+ Assert.assertTrue("iterator "+i+" != "+valuesSource.length, i==valuesSource.length);
+ }
+
+ @Test
+ public void testDirect () {
+ testImpl (true);
+ }
+
+ @Test
+ public void testIndirect () {
+ testImpl (false);
+ }
+}
diff --git a/src/junit/com/jogamp/gluegen/test/junit/runtime/TestStructAccessorEndian.java b/src/junit/com/jogamp/gluegen/test/junit/runtime/TestStructAccessorEndian.java
new file mode 100644
index 0000000..264c86b
--- /dev/null
+++ b/src/junit/com/jogamp/gluegen/test/junit/runtime/TestStructAccessorEndian.java
@@ -0,0 +1,43 @@
+package com.jogamp.gluegen.test.junit.runtime;
+
+import com.jogamp.common.nio.*;
+import com.jogamp.common.os.*;
+
+import java.nio.*;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import static java.lang.System.*;
+
+public class TestStructAccessorEndian {
+
+ @Test
+ public void testStructAccessorEndian1 () {
+ int bitsPtr = Platform.getPointerSizeInBits();
+ String bitsProp = System.getProperty("sun.arch.data.model");
+ String os = System.getProperty("os.name");
+ String cpu = System.getProperty("os.arch");
+ System.out.println("OS: <"+os+"> CPU: <"+cpu+"> Bits: <"+bitsPtr+"/"+bitsProp+">");
+ System.out.println("CPU is: "+ (Platform.is32Bit()?"32":"64") + " bit");
+ System.out.println("Buffer is in: "+ (Platform.isLittleEndian()?"little":"big") + " endian");
+
+ long[] valuesSource = { 0x0123456789ABCDEFL, 0x8877665544332211L, 0xAFFEDEADBEEFAFFEL };
+ ByteBuffer tst = Buffers.newDirectByteBuffer(Buffers.SIZEOF_LONG * valuesSource.length);
+ StructAccessor acc = new StructAccessor(tst);
+
+ int i;
+
+ for(i=0; i<valuesSource.length; i++) {
+ acc.setLongAt(i, valuesSource[i]);
+ }
+
+ for(i=0; i<valuesSource.length; i++) {
+ long v = acc.getLongAt(i);
+ long t = valuesSource[i];
+ Assert.assertTrue("Value["+i+"] shall be 0x"+Long.toHexString(t)+", is: 0x"+Long.toHexString(v), t == v);
+ }
+ }
+}
diff --git a/src/junit/com/jogamp/gluegen/test/junit/test1p1-gluegen.cfg b/src/junit/com/jogamp/gluegen/test/junit/test1p1-gluegen.cfg
deleted file mode 100644
index 78e4d8a..0000000
--- a/src/junit/com/jogamp/gluegen/test/junit/test1p1-gluegen.cfg
+++ /dev/null
@@ -1,14 +0,0 @@
-Package com.jogamp.gluegen.test.junit
-JavaClass BindingTest1p1
-Style InterfaceAndImpl
-JavaOutputDir classes
-NativeOutputDir native
-
-Extends BindingTest1p1 BindingTest1
-
-Include test1-common.cfg
-
-Import com.jogamp.gluegen.test.junit.BindingTest1
-Import com.jogamp.gluegen.test.junit.BindingTest1p1
-
-