From 86744e74db26492056bbe74d82997852e14fea8a Mon Sep 17 00:00:00 2001 From: sg215889 Date: Wed, 15 Jul 2009 05:30:40 -0700 Subject: Build CDC named JARs for CVM in default build, no more specialized build necessary. Fix PointerBuffer allocateDirect() --- make/Manifest-rt-cdc | 3 ++ make/build.xml | 25 ++++++++++------ .../runtime/PointerBuffer.java.javame_cdc_fp | 2 +- .../sun/gluegen/runtime/PointerBuffer.java.javase | 2 +- .../sun/gluegen/test/TestPointerBufferEndian.java | 35 ++++++++++++++++++++++ .../sun/gluegen/test/TestStructAccessorEndian.java | 35 ++++++++++++++++++++++ test/TestPointerBufferEndian.java | 33 -------------------- test/TestStructAccessorEndian.java | 33 -------------------- 8 files changed, 91 insertions(+), 77 deletions(-) create mode 100755 make/Manifest-rt-cdc create mode 100644 src/java/com/sun/gluegen/test/TestPointerBufferEndian.java create mode 100644 src/java/com/sun/gluegen/test/TestStructAccessorEndian.java delete mode 100644 test/TestPointerBufferEndian.java delete mode 100644 test/TestStructAccessorEndian.java diff --git a/make/Manifest-rt-cdc b/make/Manifest-rt-cdc new file mode 100755 index 0000000..72095c0 --- /dev/null +++ b/make/Manifest-rt-cdc @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Implementation-Title: GlueGen Run-Time CDC +Implementation-Version: @BASEVERSION@ diff --git a/make/build.xml b/make/build.xml index 90319d6..0c56729 100755 --- a/make/build.xml +++ b/make/build.xml @@ -50,9 +50,9 @@ - - - + + + @@ -66,9 +66,8 @@ - - + @@ -79,11 +78,11 @@ - + - + @@ -427,7 +426,7 @@ excludes="${gluegen.excludes}" bootclasspath="${javac.bootclasspath-cdc.jar}"> - + @@ -511,6 +510,14 @@ + + + + + + @@ -528,7 +535,7 @@ - + diff --git a/src/java/com/sun/gluegen/runtime/PointerBuffer.java.javame_cdc_fp b/src/java/com/sun/gluegen/runtime/PointerBuffer.java.javame_cdc_fp index 14a3d34..4ab666c 100755 --- a/src/java/com/sun/gluegen/runtime/PointerBuffer.java.javame_cdc_fp +++ b/src/java/com/sun/gluegen/runtime/PointerBuffer.java.javame_cdc_fp @@ -88,7 +88,7 @@ public class PointerBuffer { } public static PointerBuffer allocateDirect(int size) { - return new PointerBuffer(BufferFactory.newDirectByteBuffer(size)); + return new PointerBuffer(BufferFactory.newDirectByteBuffer(BufferFactory.SIZEOF_LONG * size)); } public static PointerBuffer wrap(ByteBuffer src) { diff --git a/src/java/com/sun/gluegen/runtime/PointerBuffer.java.javase b/src/java/com/sun/gluegen/runtime/PointerBuffer.java.javase index 88531e8..4957b17 100755 --- a/src/java/com/sun/gluegen/runtime/PointerBuffer.java.javase +++ b/src/java/com/sun/gluegen/runtime/PointerBuffer.java.javase @@ -88,7 +88,7 @@ public class PointerBuffer { } public static PointerBuffer allocateDirect(int size) { - return new PointerBuffer(BufferFactory.newDirectByteBuffer(size)); + return new PointerBuffer(BufferFactory.newDirectByteBuffer(BufferFactory.SIZEOF_LONG * size)); } public static PointerBuffer wrap(ByteBuffer src) { diff --git a/src/java/com/sun/gluegen/test/TestPointerBufferEndian.java b/src/java/com/sun/gluegen/test/TestPointerBufferEndian.java new file mode 100644 index 0000000..973c89d --- /dev/null +++ b/src/java/com/sun/gluegen/test/TestPointerBufferEndian.java @@ -0,0 +1,35 @@ + +package com.sun.gluegen.test; + +import com.sun.gluegen.runtime.*; +import java.nio.*; + +public class TestPointerBufferEndian { + public static void main (String[] args) { + boolean direct = args.length>0 && args[0].equals("-direct"); + boolean ok = true; + System.out.println("Buffer is in: "+ (BufferFactory.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 new file mode 100644 index 0000000..13d7afb --- /dev/null +++ b/src/java/com/sun/gluegen/test/TestStructAccessorEndian.java @@ -0,0 +1,35 @@ + +package com.sun.gluegen.test; + +import com.sun.gluegen.runtime.*; +import java.nio.*; + +public class TestStructAccessorEndian { + public static void main (String args[]) { + boolean ok = true; + System.out.println("CPU is : "+ (BufferFactory.isLittleEndian()?"little":"big") + " endian"); + ByteBuffer tst = BufferFactory.newDirectByteBuffer(BufferFactory.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/test/TestPointerBufferEndian.java b/test/TestPointerBufferEndian.java deleted file mode 100644 index 43eda84..0000000 --- a/test/TestPointerBufferEndian.java +++ /dev/null @@ -1,33 +0,0 @@ - -import com.sun.gluegen.runtime.*; -import java.nio.*; - -public class TestPointerBufferEndian { - public static void main (String[] args) { - boolean direct = args.length>0 && args[0].equals("-direct"); - boolean ok = true; - System.out.println("Buffer is in: "+ (BufferFactory.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/test/TestStructAccessorEndian.java b/test/TestStructAccessorEndian.java deleted file mode 100644 index 9d294ed..0000000 --- a/test/TestStructAccessorEndian.java +++ /dev/null @@ -1,33 +0,0 @@ - -import com.sun.gluegen.runtime.*; -import java.nio.*; - -public class TestStructAccessorEndian { - public static void main (String args[]) { - boolean ok = true; - System.out.println("CPU is : "+ (CPU.isLittleEndian()?"little":"big") + " endian"); - ByteBuffer tst = BufferFactory.newDirectByteBuffer(BufferFactory.SIZEOF_LONG * 3); - StructAccessor acc = new StructAccessor(tst); - acc.setLongAt(0, 0x0123456789ABCDEF); - acc.setLongAt(1, 0x8877665544332211); - acc.setLongAt(2, 0xAFFEDEADBEEFAFFE); - long v = acc.getLongAt(0); - if( 0x0123456789ABCDEF != v ) { - System.out.println("Err[0] shall 0x0123456789ABCDEF, is: "+Long.toHexString(v)); - ok=false; - } - v = acc.getLongAt(1); - if( 0x8877665544332211 != v ) { - System.out.println("Err[1] shall 0x8877665544332211, is: "+Long.toHexString(v)); - ok=false; - } - v = acc.getLongAt(2); - if( 0xAFFEDEADBEEFAFFE != v ) { - System.out.println("Err[2] shall 0xAFFEDEADBEEFAFFE, is: "+Long.toHexString(v)); - ok=false; - } - if(!ok) { - throw new RuntimeException("Long conversion failure"); - } - } -} -- cgit v1.2.3