You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mt...@apache.org on 2009/07/03 08:17:20 UTC

svn commit: r790799 - in /commons/sandbox/runtime/trunk/src: main/java/org/apache/commons/runtime/ main/native/shared/ test/org/apache/commons/runtime/

Author: mturk
Date: Fri Jul  3 06:17:19 2009
New Revision: 790799

URL: http://svn.apache.org/viewvc?rev=790799&view=rev
Log:
One more rename

Added:
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/VoidPointer.java
      - copied, changed from r790794, commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/AbstractPointer.java
Removed:
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/AbstractPointer.java
Modified:
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/DirectBuffer.java
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/DirectBuffer32.java
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/DirectBuffer64.java
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Memory.java
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer32.java
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer64.java
    commons/sandbox/runtime/trunk/src/main/native/shared/memory.c
    commons/sandbox/runtime/trunk/src/main/native/shared/pointer.c
    commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestMemory.java
    commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestPrivate.java

Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/DirectBuffer.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/DirectBuffer.java?rev=790799&r1=790798&r2=790799&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/DirectBuffer.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/DirectBuffer.java Fri Jul  3 06:17:19 2009
@@ -25,12 +25,6 @@
  */
 public interface DirectBuffer extends Pointer {
 
-	/**
-	 * Cast {@code this} buffer to {@link Pointer Pointer}.
-	 *
-	 * @return Pointer
-	 */
-	public Pointer asPointer();
 
 
 }

Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/DirectBuffer32.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/DirectBuffer32.java?rev=790799&r1=790798&r2=790799&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/DirectBuffer32.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/DirectBuffer32.java Fri Jul  3 06:17:19 2009
@@ -40,10 +40,5 @@
         PLENGTH = len;
     }
 
-    public Pointer asPointer()
-    {
-        return this;
-    }
-
 }
 

Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/DirectBuffer64.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/DirectBuffer64.java?rev=790799&r1=790798&r2=790799&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/DirectBuffer64.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/DirectBuffer64.java Fri Jul  3 06:17:19 2009
@@ -40,10 +40,5 @@
         PLENGTH = len;
     }
 
-    public Pointer asPointer()
-    {
-        return this;
-    }
-
 }
 

Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Memory.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Memory.java?rev=790799&r1=790798&r2=790799&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Memory.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Memory.java Fri Jul  3 06:17:19 2009
@@ -24,7 +24,46 @@
  * @see OS
  * @since Runtime 1.0
  */
-public final class Memory {
+public final class Memory
+{
+
+    /**
+     * Default pointer alignment.
+     */
+    public static final int DEFAULT_ALIGNMENT = 8;
+
+    /** Alignment to {@code boundary} function.
+     * @return {@code int} aligned to the {@code boundary}.
+     */
+    public static final int align(int size, int boundary)
+    {
+        return ((size + (boundary - 1)) & ~(boundary - 1));
+    }
+
+    /** Alignment to default {@code boundary} function.
+     * @return {@code int} aligned to {@code 8} bytes.
+     */
+    public static final int align(int size)
+    {
+        return align(size, DEFAULT_ALIGNMENT);
+    }
+
+    /** Alignment to {@code boundary} function.
+     * @return {@code long} aligned to the {@code boundary}.
+     */
+    public static final long align(long size, int boundary)
+    {
+        return ((size + (boundary - 1)) & ~(boundary - 1));
+    }
+
+    /** Alignment to default {@code boundary} function.
+     * @return {@code long} aligned to {@code 8} bytes.
+     */
+    public static final long align(long size)
+    {
+        return align(size, DEFAULT_ALIGNMENT);
+    }
+
 
     private Memory()
     {

Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer32.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer32.java?rev=790799&r1=790798&r2=790799&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer32.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer32.java Fri Jul  3 06:17:19 2009
@@ -24,7 +24,7 @@
  * </p>
  * @since Runtime 1.0
  */
-class Pointer32 extends AbstractPointer {
+class Pointer32 extends VoidPointer {
 
     protected int     CLEANUP;
     protected int     POINTER;

Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer64.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer64.java?rev=790799&r1=790798&r2=790799&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer64.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer64.java Fri Jul  3 06:17:19 2009
@@ -24,7 +24,7 @@
  * </p>
  * @since Runtime 1.0
  */
-class Pointer64 extends AbstractPointer {
+class Pointer64 extends VoidPointer {
 
     protected long    CLEANUP;
     protected long    POINTER;

Copied: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/VoidPointer.java (from r790794, commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/AbstractPointer.java)
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/VoidPointer.java?p2=commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/VoidPointer.java&p1=commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/AbstractPointer.java&r1=790794&r2=790799&rev=790799&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/AbstractPointer.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/VoidPointer.java Fri Jul  3 06:17:19 2009
@@ -22,15 +22,10 @@
  * </p>
  * @since Runtime 1.0
  */
-abstract class AbstractPointer implements Pointer
+public abstract class VoidPointer implements Pointer
 {
 
     /**
-     * Default pointer alignment.
-     */
-    public static final int DEFAULT_ALIGNMENT = 8;
-
-    /**
      * Create new {@code null} {@link Pointer} instance.
      * <p>
      * Depending on the platform the created {@code Pointer}
@@ -51,7 +46,7 @@
      * Pointer can only be created from the native code.
      * Suppress any instantiation except from internal classes.
      */
-    protected AbstractPointer()
+    protected VoidPointer()
     {
         // No Instance
     }
@@ -76,38 +71,6 @@
         NULL = nullp0();
     }
 
-    /** Alignment to {@code boundary} function.
-     * @return {@code int} aligned to the {@code boundary}.
-     */
-    public static final int align(int size, int boundary)
-    {
-        return ((size + (boundary - 1)) & ~(boundary - 1));
-    }
-
-    /** Alignment to default {@code boundary} function.
-     * @return {@code int} aligned to {@code 8} bytes.
-     */
-    public static final int align(int size)
-    {
-        return align(size, DEFAULT_ALIGNMENT);
-    }
-
-    /** Alignment to {@code boundary} function.
-     * @return {@code long} aligned to the {@code boundary}.
-     */
-    public static final long align(long size, int boundary)
-    {
-        return ((size + (boundary - 1)) & ~(boundary - 1));
-    }
-
-    /** Alignment to default {@code boundary} function.
-     * @return {@code long} aligned to {@code 8} bytes.
-     */
-    public static final long align(long size)
-    {
-        return align(size, DEFAULT_ALIGNMENT);
-    }
-
     /**
      * Address of the internal pointer.
      * <p>

Modified: commons/sandbox/runtime/trunk/src/main/native/shared/memory.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/memory.c?rev=790799&r1=790798&r2=790799&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/shared/memory.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/memory.c Fri Jul  3 06:17:19 2009
@@ -251,7 +251,7 @@
 ACR_JNI_EXPORT_DECLARE(jobject, Memory, nullp0)(ACR_JNISTDARGS)
 {
     UNREFERENCED_O;
-    return ACR_PointerCreate(_E, NULL, 0, memory_pointer_cleanup);
+    return ACR_PointerCreate(_E, 0, 0, memory_pointer_cleanup);
 }
 
 ACR_JNI_EXPORT_DECLARE(jobject, Memory, malloc)(ACR_JNISTDARGS, jlong siz)

Modified: commons/sandbox/runtime/trunk/src/main/native/shared/pointer.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/pointer.c?rev=790799&r1=790798&r2=790799&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/shared/pointer.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/pointer.c Fri Jul  3 06:17:19 2009
@@ -123,7 +123,7 @@
 }
 #endif
 
-ACR_JNI_EXPORT_DECLARE(jobject, Pointer, nullp0)(ACR_JNISTDARGS)
+ACR_JNI_EXPORT_DECLARE(jobject, VoidPointer, nullp0)(ACR_JNISTDARGS)
 {
     UNREFERENCED_O;
     if (!_clazzn.i) {
@@ -132,7 +132,7 @@
     return ACR_PointerCreate(_E, 0, 0, NULL);
 }
 
-ACR_JNI_EXPORT_DECLARE(void, Pointer, cleanup0)(ACR_JNISTDARGS)
+ACR_JNI_EXPORT_DECLARE(void, VoidPointer, cleanup0)(ACR_JNISTDARGS)
 {
     if (_clazzn.i && J4MID(0000)) {
         acr_pointer_cleanup_fn_t *cleanup;
@@ -157,7 +157,7 @@
 
 }
 
-ACR_JNI_EXPORT_DECLARE(void, Pointer, cleanup1)(ACR_JNISTDARGS)
+ACR_JNI_EXPORT_DECLARE(void, VoidPointer, cleanup1)(ACR_JNISTDARGS)
 {
     if (_clazzn.i && J4MID(0000)) {
         acr_pointer_cleanup_fn_t *cleanup;

Modified: commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestMemory.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestMemory.java?rev=790799&r1=790798&r2=790799&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestMemory.java (original)
+++ commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestMemory.java Fri Jul  3 06:17:19 2009
@@ -45,12 +45,12 @@
     public void testAlign()
         throws Exception
     {
-        assertEquals("Align",  4,  Pointer.align(3, 4));
-        assertEquals("Align",  8,  Pointer.align(3));
-        assertEquals("Align",  0,  Pointer.align(0));
-        assertEquals("Align",  0,  Pointer.align(-3));
-        assertEquals("Align", -8,  Pointer.align(-8));
-        assertEquals("Align", 16L,  Pointer.align(1L, 16));
+        assertEquals("Align",  4,  Memory.align(3, 4));
+        assertEquals("Align",  8,  Memory.align(3));
+        assertEquals("Align",  0,  Memory.align(0));
+        assertEquals("Align",  0,  Memory.align(-3));
+        assertEquals("Align", -8,  Memory.align(-8));
+        assertEquals("Align", 16L,  Memory.align(1L, 16));
     }
 
     public void testNull()
@@ -310,7 +310,7 @@
     public void testPointerNull()
         throws Throwable
     {
-        assertTrue("Not null", Pointer.NULL.IsNull());
+        assertTrue("Not null", VoidPointer.NULL.IsNull());
 
     }
 

Modified: commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestPrivate.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestPrivate.java?rev=790799&r1=790798&r2=790799&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestPrivate.java (original)
+++ commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestPrivate.java Fri Jul  3 06:17:19 2009
@@ -315,7 +315,7 @@
     {
         Pointer p = test017(0xdeadbeef);
         assertNotNull("Pointer", p);
-        String ph = Pointer.SIZEOF == 4 ? "0xdeadbeef" : "0x00000000deadbeef";
+        String ph = Platform.SIZEOF_POINTER == 4 ? "0xdeadbeef" : "0x00000000deadbeef";
         assertEquals("Pointer string ", ph, p.toString());
         p = null;
         System.gc();
@@ -367,10 +367,10 @@
     {
         DirectBuffer b = test038(0xcafebabe);
         assertNotNull("Buffer", b);
-        int r = test019(b.asPointer());
+        int r = test019(b);
         assertEquals("Result ", 1, r);
         b.free();
-        int c = test019(b.asPointer());
+        int c = test019(b);
         // Second call must return NULL
         assertEquals("Result ", 0, c);
 
@@ -389,7 +389,7 @@
         DirectBuffer b = test038(0);
         assertNotNull("Buffer", b);
 
-		int r = a.compareTo((Pointer)b);
+		int r = a.compareTo(b);
         assertEquals("Compare", -1, r);
         a.free();
         b.free();