From bb9028843b1e382180fd2663e5c98b86fc37718b Mon Sep 17 00:00:00 2001
From: Michael Bien <mbien@fh-landshut.de>
Date: Sat, 27 Mar 2010 02:26:27 +0100
Subject: renamed com.sun.gluegen.runtime -> com.jogamp.gluegen.runtime.

---
 .../runtime/BufferFactory.java.javame_cdc_fp       | 267 +++++++++++++
 .../gluegen/runtime/BufferFactory.java.javase      | 317 +++++++++++++++
 .../gluegen/runtime/BufferFactoryInternal.java     | 115 ++++++
 src/java/com/jogamp/gluegen/runtime/CPU.java       | 100 +++++
 .../com/jogamp/gluegen/runtime/DynamicLinker.java  |  50 +++
 .../gluegen/runtime/DynamicLookupHelper.java       |  53 +++
 .../gluegen/runtime/MacOSXDynamicLinkerImpl.java   |  60 +++
 .../jogamp/gluegen/runtime/NativeLibLoader.java    | 105 +++++
 .../com/jogamp/gluegen/runtime/NativeLibrary.java  | 425 +++++++++++++++++++++
 .../runtime/PointerBuffer.java.javame_cdc_fp       | 180 +++++++++
 .../gluegen/runtime/PointerBuffer.java.javase      | 169 ++++++++
 .../jogamp/gluegen/runtime/ProcAddressHelper.java  | 125 ++++++
 .../jogamp/gluegen/runtime/ProcAddressTable.java   |  41 ++
 .../runtime/StructAccessor.java.javame_cdc_fp      | 201 ++++++++++
 .../gluegen/runtime/StructAccessor.java.javase     | 256 +++++++++++++
 .../gluegen/runtime/UnixDynamicLinkerImpl.java     |  66 ++++
 .../gluegen/runtime/WindowsDynamicLinkerImpl.java  |  49 +++
 .../gluegen/runtime/opengl/GLExtensionNames.java   | 187 +++++++++
 .../runtime/opengl/GLProcAddressHelper.java        | 108 ++++++
 src/java/com/sun/gluegen/JavaConfiguration.java    |   6 +-
 src/java/com/sun/gluegen/JavaType.java             |  12 +-
 .../gluegen/opengl/BuildComposablePipeline.java    |   2 +-
 .../com/sun/gluegen/opengl/BuildStaticGLInfo.java  |   4 +-
 .../com/sun/gluegen/opengl/GLConfiguration.java    |   2 +-
 src/java/com/sun/gluegen/opengl/GLEmitter.java     |   8 +-
 .../gluegen/procaddress/ProcAddressEmitter.java    |   4 +-
 .../runtime/BufferFactory.java.javame_cdc_fp       | 267 -------------
 .../sun/gluegen/runtime/BufferFactory.java.javase  | 317 ---------------
 .../sun/gluegen/runtime/BufferFactoryInternal.java | 115 ------
 src/java/com/sun/gluegen/runtime/CPU.java          | 100 -----
 .../com/sun/gluegen/runtime/DynamicLinker.java     |  50 ---
 .../sun/gluegen/runtime/DynamicLookupHelper.java   |  53 ---
 .../gluegen/runtime/MacOSXDynamicLinkerImpl.java   |  60 ---
 .../com/sun/gluegen/runtime/NativeLibLoader.java   | 105 -----
 .../com/sun/gluegen/runtime/NativeLibrary.java     | 425 ---------------------
 .../runtime/PointerBuffer.java.javame_cdc_fp       | 180 ---------
 .../sun/gluegen/runtime/PointerBuffer.java.javase  | 169 --------
 .../com/sun/gluegen/runtime/ProcAddressHelper.java | 125 ------
 .../com/sun/gluegen/runtime/ProcAddressTable.java  |  41 --
 .../runtime/StructAccessor.java.javame_cdc_fp      | 201 ----------
 .../sun/gluegen/runtime/StructAccessor.java.javase | 256 -------------
 .../sun/gluegen/runtime/UnixDynamicLinkerImpl.java |  66 ----
 .../gluegen/runtime/WindowsDynamicLinkerImpl.java  |  49 ---
 .../gluegen/runtime/opengl/GLExtensionNames.java   | 187 ---------
 .../runtime/opengl/GLProcAddressHelper.java        | 110 ------
 .../sun/gluegen/test/TestPointerBufferEndian.java  |   2 +-
 .../sun/gluegen/test/TestStructAccessorEndian.java |   2 +-
 src/junit/com/jogamp/gluegen/test/junit/Test1.java |   4 +-
 src/native/common/CPU.c                            |   2 +-
 src/native/macosx/MacOSXDynamicLinkerImpl_JNI.c    |  16 +-
 src/native/unix/UnixDynamicLinkerImpl_JNI.c        |  16 +-
 src/native/windows/WindowsDynamicLinkerImpl_JNI.c  |  16 +-
 52 files changed, 2921 insertions(+), 2925 deletions(-)
 create mode 100755 src/java/com/jogamp/gluegen/runtime/BufferFactory.java.javame_cdc_fp
 create mode 100755 src/java/com/jogamp/gluegen/runtime/BufferFactory.java.javase
 create mode 100755 src/java/com/jogamp/gluegen/runtime/BufferFactoryInternal.java
 create mode 100755 src/java/com/jogamp/gluegen/runtime/CPU.java
 create mode 100755 src/java/com/jogamp/gluegen/runtime/DynamicLinker.java
 create mode 100755 src/java/com/jogamp/gluegen/runtime/DynamicLookupHelper.java
 create mode 100755 src/java/com/jogamp/gluegen/runtime/MacOSXDynamicLinkerImpl.java
 create mode 100755 src/java/com/jogamp/gluegen/runtime/NativeLibLoader.java
 create mode 100755 src/java/com/jogamp/gluegen/runtime/NativeLibrary.java
 create mode 100755 src/java/com/jogamp/gluegen/runtime/PointerBuffer.java.javame_cdc_fp
 create mode 100755 src/java/com/jogamp/gluegen/runtime/PointerBuffer.java.javase
 create mode 100644 src/java/com/jogamp/gluegen/runtime/ProcAddressHelper.java
 create mode 100644 src/java/com/jogamp/gluegen/runtime/ProcAddressTable.java
 create mode 100755 src/java/com/jogamp/gluegen/runtime/StructAccessor.java.javame_cdc_fp
 create mode 100755 src/java/com/jogamp/gluegen/runtime/StructAccessor.java.javase
 create mode 100755 src/java/com/jogamp/gluegen/runtime/UnixDynamicLinkerImpl.java
 create mode 100755 src/java/com/jogamp/gluegen/runtime/WindowsDynamicLinkerImpl.java
 create mode 100644 src/java/com/jogamp/gluegen/runtime/opengl/GLExtensionNames.java
 create mode 100644 src/java/com/jogamp/gluegen/runtime/opengl/GLProcAddressHelper.java
 delete mode 100755 src/java/com/sun/gluegen/runtime/BufferFactory.java.javame_cdc_fp
 delete mode 100755 src/java/com/sun/gluegen/runtime/BufferFactory.java.javase
 delete mode 100755 src/java/com/sun/gluegen/runtime/BufferFactoryInternal.java
 delete mode 100755 src/java/com/sun/gluegen/runtime/CPU.java
 delete mode 100755 src/java/com/sun/gluegen/runtime/DynamicLinker.java
 delete mode 100755 src/java/com/sun/gluegen/runtime/DynamicLookupHelper.java
 delete mode 100755 src/java/com/sun/gluegen/runtime/MacOSXDynamicLinkerImpl.java
 delete mode 100755 src/java/com/sun/gluegen/runtime/NativeLibLoader.java
 delete mode 100755 src/java/com/sun/gluegen/runtime/NativeLibrary.java
 delete mode 100755 src/java/com/sun/gluegen/runtime/PointerBuffer.java.javame_cdc_fp
 delete mode 100755 src/java/com/sun/gluegen/runtime/PointerBuffer.java.javase
 delete mode 100644 src/java/com/sun/gluegen/runtime/ProcAddressHelper.java
 delete mode 100644 src/java/com/sun/gluegen/runtime/ProcAddressTable.java
 delete mode 100755 src/java/com/sun/gluegen/runtime/StructAccessor.java.javame_cdc_fp
 delete mode 100755 src/java/com/sun/gluegen/runtime/StructAccessor.java.javase
 delete mode 100755 src/java/com/sun/gluegen/runtime/UnixDynamicLinkerImpl.java
 delete mode 100755 src/java/com/sun/gluegen/runtime/WindowsDynamicLinkerImpl.java
 delete mode 100644 src/java/com/sun/gluegen/runtime/opengl/GLExtensionNames.java
 delete mode 100644 src/java/com/sun/gluegen/runtime/opengl/GLProcAddressHelper.java

(limited to 'src')

diff --git a/src/java/com/jogamp/gluegen/runtime/BufferFactory.java.javame_cdc_fp b/src/java/com/jogamp/gluegen/runtime/BufferFactory.java.javame_cdc_fp
new file mode 100755
index 0000000..de09ef3
--- /dev/null
+++ b/src/java/com/jogamp/gluegen/runtime/BufferFactory.java.javame_cdc_fp
@@ -0,0 +1,267 @@
+/*
+ * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * 
+ * - Redistribution of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * 
+ * - Redistribution 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 Sun Microsystems, Inc. or the names of
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * 
+ * This software is provided "AS IS," without a warranty of any kind. ALL
+ * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
+ * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
+ * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+ * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
+ * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
+ * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
+ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+ * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
+ * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ * 
+ * You acknowledge that this software is not designed or intended for use
+ * in the design, construction, operation or maintenance of any nuclear
+ * facility.
+ * 
+ * Sun gratefully acknowledges that this software was originally authored
+ * and developed by Kenneth Bradley Russell and Christopher John Kline.
+ */
+
+package com.jogamp.gluegen.runtime;
+
+import java.nio.*;
+
+public class BufferFactory {
+  public static final int SIZEOF_BYTE = 1;
+  public static final int SIZEOF_SHORT = 2;
+  public static final int SIZEOF_CHAR = 2;
+  public static final int SIZEOF_INT = 4;
+  public static final int SIZEOF_FLOAT = 4;
+  public static final int SIZEOF_LONG = 8;
+  public static final int SIZEOF_DOUBLE = 8;
+
+  private static final boolean isLittleEndian;
+
+  static {
+    ByteBuffer tst_b = BufferFactory.newDirectByteBuffer(BufferFactory.SIZEOF_INT); // 32bit in native order
+    IntBuffer tst_i = tst_b.asIntBuffer();
+    ShortBuffer tst_s = tst_b.asShortBuffer();
+    tst_i.put(0, 0x0A0B0C0D);
+    isLittleEndian = 0x0C0D == tst_s.get(0) ;
+  }
+
+  public static boolean isLittleEndian() {
+    return isLittleEndian;
+  }
+
+  /** Helper routine to create a direct ByteBuffer with native order */
+  public static ByteBuffer newDirectByteBuffer(int size) {
+    return nativeOrder(ByteBuffer.allocateDirect(size));
+  }
+
+  /** Helper routine to set a ByteBuffer to the native byte order, if
+      that operation is supported by the underlying NIO
+      implementation. */
+  public static ByteBuffer nativeOrder(ByteBuffer buf) {
+    // JSR 239 does not support the ByteOrder class or the order methods. The initial order of a byte buffer is the platform byte order.
+    return buf;
+  }
+
+  /** Helper routine to tell whether a buffer is direct or not. Null
+      pointers are considered NOT direct. isDirect() should really be
+      public in Buffer and not replicated in all subclasses. */
+  public static boolean isDirect(Object buf) {
+    if (buf == null) {
+      return true;
+    }
+    if (buf instanceof ByteBuffer) {
+      return ((ByteBuffer) buf).isDirect();
+    } else if (buf instanceof FloatBuffer) {
+      return ((FloatBuffer) buf).isDirect();
+    } else if (buf instanceof ShortBuffer) {
+      return ((ShortBuffer) buf).isDirect();
+    } else if (buf instanceof IntBuffer) {
+      return ((IntBuffer) buf).isDirect();
+    } else if (buf instanceof PointerBuffer) {
+      return ((PointerBuffer) buf).isDirect();
+    }
+    throw new RuntimeException("Unexpected buffer type " + buf.getClass().getName());
+  }
+
+
+  /** Helper routine to get the Buffer byte offset by taking into
+      account the Buffer position and the underlying type.  This is
+      the total offset for Direct Buffers.  */
+
+  public static int getDirectBufferByteOffset(Object buf) {
+    if(buf == null) {
+      return 0;
+    }
+    if(buf instanceof Buffer) {
+        int pos = ((Buffer)buf).position();
+        if(buf instanceof ByteBuffer) {
+          return pos;
+        } else if (buf instanceof FloatBuffer) {
+          return pos * SIZEOF_FLOAT;
+        } else if (buf instanceof IntBuffer) {
+          return pos * SIZEOF_INT;
+        } else if (buf instanceof ShortBuffer) {
+          return pos * SIZEOF_SHORT;
+        }
+    } else if (buf instanceof PointerBuffer) {
+      return (((PointerBuffer)buf).position() * SIZEOF_LONG);
+    } 
+
+    throw new RuntimeException("Disallowed array backing store type in buffer "
+                               + buf.getClass().getName());
+  }
+
+
+  /** Helper routine to return the array backing store reference from
+      a Buffer object.  */
+
+   public static Object getArray(Object buf) {
+     if (buf == null) {
+       return null;
+     }
+     if(buf instanceof ByteBuffer) {
+       return ((ByteBuffer) buf).array();
+     } else if (buf instanceof FloatBuffer) {
+       return ((FloatBuffer) buf).array();
+     } else if (buf instanceof IntBuffer) {
+       return ((IntBuffer) buf).array();
+     } else if (buf instanceof ShortBuffer) { 
+       return ((ShortBuffer) buf).array();
+     } else if (buf instanceof ShortBuffer) { 
+       return ((ShortBuffer) buf).array();
+     } else if (buf instanceof PointerBuffer) { 
+       return ((PointerBuffer) buf).array();
+     }
+
+     throw new RuntimeException("Disallowed array backing store type in buffer "
+                                + buf.getClass().getName());
+   } 
+
+
+  /** Helper routine to get the full byte offset from the beginning of
+      the array that is the storage for the indirect Buffer
+      object.  The array offset also includes the position offset 
+      within the buffer, in addition to any array offset. */
+
+  public static int getIndirectBufferByteOffset(Object buf) {
+    if(buf == null) {
+      return 0;
+    }
+    if(buf instanceof Buffer) {
+        int pos = ((Buffer)buf).position();
+        if(buf instanceof ByteBuffer) {
+          return (((ByteBuffer)buf).arrayOffset() + pos);
+        } else if(buf instanceof FloatBuffer) {
+          return (SIZEOF_FLOAT*(((FloatBuffer)buf).arrayOffset() + pos));
+        } else if(buf instanceof IntBuffer) {
+          return (SIZEOF_INT*(((IntBuffer)buf).arrayOffset() + pos));
+        } else if(buf instanceof ShortBuffer) {
+          return (SIZEOF_SHORT*(((ShortBuffer)buf).arrayOffset() + pos));
+        }
+    } else if(buf instanceof PointerBuffer) {
+        return (SIZEOF_LONG*(((PointerBuffer)buf).arrayOffset() + ((PointerBuffer)buf).position()));
+    }
+
+    throw new RuntimeException("Unknown buffer type " + buf.getClass().getName());
+  }
+
+  public static void rangeCheck(byte[] array, int offset, int minElementsRemaining) {
+    if (array == null) {
+      return;
+    }
+
+    if (array.length < offset + minElementsRemaining) {
+      throw new ArrayIndexOutOfBoundsException("Required " + minElementsRemaining + " elements in array, only had " + (array.length - offset));
+    }
+  }
+
+  public static void rangeCheck(char[] array, int offset, int minElementsRemaining) {
+    if (array == null) {
+      return;
+    }
+
+    if (array.length < offset + minElementsRemaining) {
+      throw new ArrayIndexOutOfBoundsException("Required " + minElementsRemaining + " elements in array, only had " + (array.length - offset));
+    }
+  }
+
+  public static void rangeCheck(short[] array, int offset, int minElementsRemaining) {
+    if (array == null) {
+      return;
+    }
+
+    if (array.length < offset + minElementsRemaining) {
+      throw new ArrayIndexOutOfBoundsException("Required " + minElementsRemaining + " elements in array, only had " + (array.length - offset));
+    }
+  }
+
+  public static void rangeCheck(int[] array, int offset, int minElementsRemaining) {
+    if (array == null) {
+      return;
+    }
+
+    if (array.length < offset + minElementsRemaining) {
+      throw new ArrayIndexOutOfBoundsException("Required " + minElementsRemaining + " elements in array, only had " + (array.length - offset));
+    }
+  }
+
+  public static void rangeCheck(float[] array, int offset, int minElementsRemaining) {
+    if (array == null) {
+      return;
+    }
+
+    if (array.length < offset + minElementsRemaining) {
+      throw new ArrayIndexOutOfBoundsException("Required " + minElementsRemaining + " elements in array, only had " + (array.length - offset));
+    }
+  }
+
+  public static void rangeCheck(Buffer buffer, int minElementsRemaining) {
+    if (buffer == null) {
+      return;
+    }
+
+    if (buffer.remaining() < minElementsRemaining) {
+      throw new IndexOutOfBoundsException("Required " + minElementsRemaining + " remaining elements in buffer, only had " + buffer.remaining());
+    }
+  }
+
+  public static void rangeCheckBytes(Object buffer, int minBytesRemaining) {
+    if (buffer == null) {
+      return;
+    }
+
+    int bytesRemaining = 0;
+    if (buffer instanceof Buffer) {
+        int elementsRemaining = ((Buffer)buffer).remaining();
+        if (buffer instanceof ByteBuffer) {
+          bytesRemaining = elementsRemaining;
+        } else if (buffer instanceof FloatBuffer) {
+          bytesRemaining = elementsRemaining * SIZEOF_FLOAT;
+        } else if (buffer instanceof IntBuffer) {
+          bytesRemaining = elementsRemaining * SIZEOF_INT;
+        } else if (buffer instanceof ShortBuffer) {
+          bytesRemaining = elementsRemaining * SIZEOF_SHORT;
+        }
+    } else if (buffer instanceof PointerBuffer) {
+      bytesRemaining = ((PointerBuffer)buffer).remaining() * SIZEOF_LONG;
+    }
+    if (bytesRemaining < minBytesRemaining) {
+      throw new IndexOutOfBoundsException("Required " + minBytesRemaining + " remaining bytes in buffer, only had " + bytesRemaining);
+    }
+  }
+}
diff --git a/src/java/com/jogamp/gluegen/runtime/BufferFactory.java.javase b/src/java/com/jogamp/gluegen/runtime/BufferFactory.java.javase
new file mode 100755
index 0000000..24d842c
--- /dev/null
+++ b/src/java/com/jogamp/gluegen/runtime/BufferFactory.java.javase
@@ -0,0 +1,317 @@
+/*
+ * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * 
+ * - Redistribution of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * 
+ * - Redistribution 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 Sun Microsystems, Inc. or the names of
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * 
+ * This software is provided "AS IS," without a warranty of any kind. ALL
+ * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
+ * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
+ * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+ * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
+ * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
+ * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
+ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+ * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
+ * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ * 
+ * You acknowledge that this software is not designed or intended for use
+ * in the design, construction, operation or maintenance of any nuclear
+ * facility.
+ * 
+ * Sun gratefully acknowledges that this software was originally authored
+ * and developed by Kenneth Bradley Russell and Christopher John Kline.
+ */
+
+package com.jogamp.gluegen.runtime;
+
+import java.nio.*;
+
+public class BufferFactory {
+  public static final int SIZEOF_BYTE = 1;
+  public static final int SIZEOF_SHORT = 2;
+  public static final int SIZEOF_CHAR = 2;
+  public static final int SIZEOF_INT = 4;
+  public static final int SIZEOF_FLOAT = 4;
+  public static final int SIZEOF_LONG = 8;
+  public static final int SIZEOF_DOUBLE = 8;
+
+  private static final boolean isLittleEndian;
+
+  static {
+    ByteBuffer tst_b = BufferFactory.newDirectByteBuffer(BufferFactory.SIZEOF_INT); // 32bit in native order
+    IntBuffer tst_i = tst_b.asIntBuffer();
+    ShortBuffer tst_s = tst_b.asShortBuffer();
+    tst_i.put(0, 0x0A0B0C0D);
+    isLittleEndian = 0x0C0D == tst_s.get(0) ;
+  }
+
+  public static boolean isLittleEndian() {
+    return isLittleEndian;
+  }
+
+  /** Helper routine to create a direct ByteBuffer with native order */
+  public static ByteBuffer newDirectByteBuffer(int size) {
+    return nativeOrder(ByteBuffer.allocateDirect(size));
+  }
+
+  /** Helper routine to set a ByteBuffer to the native byte order, if
+      that operation is supported by the underlying NIO
+      implementation. */
+  public static ByteBuffer nativeOrder(ByteBuffer buf) {
+    return buf.order(ByteOrder.nativeOrder());
+  }
+
+  /** Helper routine to tell whether a buffer is direct or not. Null
+      pointers are considered NOT direct. isDirect() should really be
+      public in Buffer and not replicated in all subclasses. */
+  public static boolean isDirect(Object buf) {
+    if (buf == null) {
+      return true;
+    }
+    if (buf instanceof ByteBuffer) {
+      return ((ByteBuffer) buf).isDirect();
+    } else if (buf instanceof FloatBuffer) {
+      return ((FloatBuffer) buf).isDirect();
+    } else if (buf instanceof DoubleBuffer) {
+      return ((DoubleBuffer) buf).isDirect();
+    } else if (buf instanceof CharBuffer) {
+      return ((CharBuffer) buf).isDirect();
+    } else if (buf instanceof ShortBuffer) {
+      return ((ShortBuffer) buf).isDirect();
+    } else if (buf instanceof IntBuffer) {
+      return ((IntBuffer) buf).isDirect();
+    } else if (buf instanceof LongBuffer) {
+      return ((LongBuffer) buf).isDirect();
+    } else if (buf instanceof PointerBuffer) {
+      return ((PointerBuffer) buf).isDirect();
+    }
+    throw new RuntimeException("Unexpected buffer type " + buf.getClass().getName());
+  }
+
+
+  /** Helper routine to get the Buffer byte offset by taking into
+      account the Buffer position and the underlying type.  This is
+      the total offset for Direct Buffers.  */
+
+  public static int getDirectBufferByteOffset(Object buf) {
+    if(buf == null) {
+      return 0;
+    }
+    if(buf instanceof Buffer) {
+        int pos = ((Buffer)buf).position();
+        if(buf instanceof ByteBuffer) {
+          return pos;
+        } else if (buf instanceof FloatBuffer) {
+          return pos * SIZEOF_FLOAT;
+        } else if (buf instanceof IntBuffer) {
+          return pos * SIZEOF_INT;
+        } else if (buf instanceof ShortBuffer) {
+          return pos * SIZEOF_SHORT;
+        } else if (buf instanceof DoubleBuffer) {
+          return pos * SIZEOF_DOUBLE;
+        } else if (buf instanceof LongBuffer) {
+          return pos * SIZEOF_LONG;
+        } else if (buf instanceof CharBuffer) {
+          return pos * SIZEOF_CHAR;
+        }
+    } else if (buf instanceof PointerBuffer) {
+      PointerBuffer pb = (PointerBuffer)buf;
+      return pb.position() * pb.elementSize();
+    } 
+
+    throw new RuntimeException("Disallowed array backing store type in buffer "
+                               + buf.getClass().getName());
+  }
+
+
+  /** Helper routine to return the array backing store reference from
+      a Buffer object.  */
+
+   public static Object getArray(Object buf) {
+     if (buf == null) {
+       return null;
+     }
+     if(buf instanceof ByteBuffer) {
+       return ((ByteBuffer) buf).array();
+     } else if (buf instanceof FloatBuffer) {
+       return ((FloatBuffer) buf).array();
+     } else if (buf instanceof IntBuffer) {
+       return ((IntBuffer) buf).array();
+     } else if (buf instanceof ShortBuffer) { 
+       return ((ShortBuffer) buf).array();
+     } else if (buf instanceof DoubleBuffer) {
+       return ((DoubleBuffer) buf).array();
+     } else if (buf instanceof LongBuffer) {
+       return ((LongBuffer) buf).array();
+     } else if (buf instanceof CharBuffer) { 
+       return ((CharBuffer) buf).array();
+     } else if (buf instanceof PointerBuffer) { 
+       return ((PointerBuffer) buf).array();
+     }
+
+     throw new RuntimeException("Disallowed array backing store type in buffer "
+                                + buf.getClass().getName());
+   } 
+
+
+  /** Helper routine to get the full byte offset from the beginning of
+      the array that is the storage for the indirect Buffer
+      object.  The array offset also includes the position offset 
+      within the buffer, in addition to any array offset. */
+
+  public static int getIndirectBufferByteOffset(Object buf) {
+    if(buf == null) {
+      return 0;
+    }
+    if (buf instanceof Buffer) {
+        int pos = ((Buffer)buf).position();
+        if(buf instanceof ByteBuffer) {
+          return (((ByteBuffer)buf).arrayOffset() + pos);
+        } else if(buf instanceof FloatBuffer) {
+          return (SIZEOF_FLOAT*(((FloatBuffer)buf).arrayOffset() + pos));
+        } else if(buf instanceof IntBuffer) {
+          return (SIZEOF_INT*(((IntBuffer)buf).arrayOffset() + pos));
+        } else if(buf instanceof ShortBuffer) {
+          return (SIZEOF_SHORT*(((ShortBuffer)buf).arrayOffset() + pos));
+        } else if(buf instanceof DoubleBuffer) {
+          return (SIZEOF_DOUBLE*(((DoubleBuffer)buf).arrayOffset() + pos));
+        } else if(buf instanceof LongBuffer) {
+          return (SIZEOF_LONG*(((LongBuffer)buf).arrayOffset() + pos));
+        } else if(buf instanceof CharBuffer) {
+          return (SIZEOF_CHAR*(((CharBuffer)buf).arrayOffset() + pos));
+        }
+    } else if(buf instanceof PointerBuffer) {
+        PointerBuffer pb = (PointerBuffer)buf;
+        return pb.elementSize()*(pb.arrayOffset() + pb.position());
+    }
+
+    throw new RuntimeException("Unknown buffer type " + buf.getClass().getName());
+  }
+
+  public static void rangeCheck(byte[] array, int offset, int minElementsRemaining) {
+    if (array == null) {
+      return;
+    }
+
+    if (array.length < offset + minElementsRemaining) {
+      throw new ArrayIndexOutOfBoundsException("Required " + minElementsRemaining + " elements in array, only had " + (array.length - offset));
+    }
+  }
+
+  public static void rangeCheck(char[] array, int offset, int minElementsRemaining) {
+    if (array == null) {
+      return;
+    }
+
+    if (array.length < offset + minElementsRemaining) {
+      throw new ArrayIndexOutOfBoundsException("Required " + minElementsRemaining + " elements in array, only had " + (array.length - offset));
+    }
+  }
+
+  public static void rangeCheck(short[] array, int offset, int minElementsRemaining) {
+    if (array == null) {
+      return;
+    }
+
+    if (array.length < offset + minElementsRemaining) {
+      throw new ArrayIndexOutOfBoundsException("Required " + minElementsRemaining + " elements in array, only had " + (array.length - offset));
+    }
+  }
+
+  public static void rangeCheck(int[] array, int offset, int minElementsRemaining) {
+    if (array == null) {
+      return;
+    }
+
+    if (array.length < offset + minElementsRemaining) {
+      throw new ArrayIndexOutOfBoundsException("Required " + minElementsRemaining + " elements in array, only had " + (array.length - offset));
+    }
+  }
+
+  public static void rangeCheck(long[] array, int offset, int minElementsRemaining) {
+    if (array == null) {
+      return;
+    }
+    
+    if (array.length < offset + minElementsRemaining) {
+      throw new ArrayIndexOutOfBoundsException("Required " + minElementsRemaining + " elements in array, only had " + (array.length - offset));
+    }
+  }
+
+  public static void rangeCheck(float[] array, int offset, int minElementsRemaining) {
+    if (array == null) {
+      return;
+    }
+
+    if (array.length < offset + minElementsRemaining) {
+      throw new ArrayIndexOutOfBoundsException("Required " + minElementsRemaining + " elements in array, only had " + (array.length - offset));
+    }
+  }
+
+  public static void rangeCheck(double[] array, int offset, int minElementsRemaining) {
+    if (array == null) {
+      return;
+    }
+    
+    if (array.length < offset + minElementsRemaining) {
+      throw new ArrayIndexOutOfBoundsException("Required " + minElementsRemaining + " elements in array, only had " + (array.length - offset));
+    }
+  }
+
+  public static void rangeCheck(Buffer buffer, int minElementsRemaining) {
+    if (buffer == null) {
+      return;
+    }
+
+    if (buffer.remaining() < minElementsRemaining) {
+      throw new IndexOutOfBoundsException("Required " + minElementsRemaining + " remaining elements in buffer, only had " + buffer.remaining());
+    }
+  }
+
+  public static void rangeCheckBytes(Object buffer, int minBytesRemaining) {
+    if (buffer == null) {
+      return;
+    }
+
+    int bytesRemaining = 0;
+    if (buffer instanceof Buffer) {
+        int elementsRemaining = ((Buffer)buffer).remaining();
+        if (buffer instanceof ByteBuffer) {
+          bytesRemaining = elementsRemaining;
+        } else if (buffer instanceof FloatBuffer) {
+          bytesRemaining = elementsRemaining * SIZEOF_FLOAT;
+        } else if (buffer instanceof IntBuffer) {
+          bytesRemaining = elementsRemaining * SIZEOF_INT;
+        } else if (buffer instanceof ShortBuffer) {
+          bytesRemaining = elementsRemaining * SIZEOF_SHORT;
+        } else if (buffer instanceof DoubleBuffer) {
+          bytesRemaining = elementsRemaining * SIZEOF_DOUBLE;
+        } else if (buffer instanceof LongBuffer) {
+          bytesRemaining = elementsRemaining * SIZEOF_LONG;
+        } else if (buffer instanceof CharBuffer) {
+          bytesRemaining = elementsRemaining * SIZEOF_CHAR;
+        }
+    } else if (buffer instanceof PointerBuffer) {
+      PointerBuffer pb = (PointerBuffer)buffer;
+      bytesRemaining = pb.remaining() * pb.elementSize();
+    }
+    if (bytesRemaining < minBytesRemaining) {
+      throw new IndexOutOfBoundsException("Required " + minBytesRemaining + " remaining bytes in buffer, only had " + bytesRemaining);
+    }
+  }
+}
diff --git a/src/java/com/jogamp/gluegen/runtime/BufferFactoryInternal.java b/src/java/com/jogamp/gluegen/runtime/BufferFactoryInternal.java
new file mode 100755
index 0000000..e99fba6
--- /dev/null
+++ b/src/java/com/jogamp/gluegen/runtime/BufferFactoryInternal.java
@@ -0,0 +1,115 @@
+/*
+
+ * Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * 
+ * - Redistribution of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * 
+ * - Redistribution 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 Sun Microsystems, Inc. or the names of
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * 
+ * This software is provided "AS IS," without a warranty of any kind. ALL
+ * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
+ * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
+ * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+ * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
+ * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
+ * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
+ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+ * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
+ * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ * 
+ * You acknowledge that this software is not designed or intended for use
+ * in the design, construction, operation or maintenance of any nuclear
+ * facility.
+ * 
+ * Sun gratefully acknowledges that this software was originally authored
+ * and developed by Kenneth Bradley Russell and Christopher John Kline.
+ */
+
+package com.jogamp.gluegen.runtime;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.nio.*;
+import sun.misc.Unsafe;
+
+public class BufferFactoryInternal {
+  private static final long        addressFieldOffset;
+  private static final Constructor directByteBufferConstructor;
+
+  static {
+    try {
+      Field f = Buffer.class.getDeclaredField("address");
+      addressFieldOffset = UnsafeAccess.getUnsafe().objectFieldOffset(f);
+
+      Class directByteBufferClass = Class.forName("java.nio.DirectByteBuffer");
+      directByteBufferConstructor = directByteBufferClass.getDeclaredConstructor(new Class[] { Long.TYPE, Integer.TYPE });
+      directByteBufferConstructor.setAccessible(true);
+    } catch (Exception e) {
+      throw new RuntimeException(e);
+    }
+  }
+
+  public static long getDirectBufferAddress(Buffer buf) {
+    return ((buf == null) ? 0 : UnsafeAccess.getUnsafe().getLong(buf, addressFieldOffset));
+  }
+
+  public static ByteBuffer newDirectByteBuffer(long address, int capacity) {
+    try {
+      if (address == 0) {
+        return null;
+      }
+      return (ByteBuffer) directByteBufferConstructor.newInstance(new Object[] { new Long(address), new Integer(capacity) });
+    } catch (Exception e) {
+      throw new RuntimeException(e);
+    }
+  }
+
+  public static long newCString(String str) {
+    byte[] strBytes = str.getBytes();
+    long   strBlock = UnsafeAccess.getUnsafe().allocateMemory(strBytes.length+1);
+    for (int i = 0; i < strBytes.length; i++) {
+      UnsafeAccess.getUnsafe().putByte(strBlock+i, strBytes[i]);
+    }
+    UnsafeAccess.getUnsafe().putByte(strBlock+strBytes.length, (byte)0); // null termination
+    return strBlock;
+  }
+
+  public static void freeCString(long cStr) {
+    UnsafeAccess.getUnsafe().freeMemory(cStr);
+  }
+
+  public static String newJavaString(long cStr) {
+    if (cStr == 0) {
+      return null;
+    }
+    int numChars = 0;
+    while (UnsafeAccess.getUnsafe().getByte(cStr + numChars) != 0) {
+      ++numChars;
+    }
+    byte[] bytes = new byte[numChars];
+    for (int i = 0; i < numChars; i++) {
+      bytes[i] = UnsafeAccess.getUnsafe().getByte(cStr + i);
+    }
+    return new String(bytes);
+  }
+
+  public static int arrayBaseOffset(Object array) {
+    return UnsafeAccess.getUnsafe().arrayBaseOffset(array.getClass());
+  }
+  public static int arrayIndexScale(Object array) {
+    return UnsafeAccess.getUnsafe().arrayIndexScale(array.getClass());
+  }
+}
diff --git a/src/java/com/jogamp/gluegen/runtime/CPU.java b/src/java/com/jogamp/gluegen/runtime/CPU.java
new file mode 100755
index 0000000..027b602
--- /dev/null
+++ b/src/java/com/jogamp/gluegen/runtime/CPU.java
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2005 Sun Microsystems, Inc. All Rights Reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * 
+ * - Redistribution of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * 
+ * - Redistribution 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 Sun Microsystems, Inc. or the names of
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * 
+ * This software is provided "AS IS," without a warranty of any kind. ALL
+ * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
+ * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
+ * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+ * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
+ * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
+ * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
+ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+ * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
+ * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ * 
+ * You acknowledge that this software is not designed or intended for use
+ * in the design, construction, operation or maintenance of any nuclear
+ * facility.
+ * 
+ * Sun gratefully acknowledges that this software was originally authored
+ * and developed by Kenneth Bradley Russell and Christopher John Kline.
+ */
+
+package com.jogamp.gluegen.runtime;
+
+/** Provides information to autogenerated struct accessors about what
+    kind of data model (32- or 64-bit) is being used by the currently
+    running process. */
+
+public class CPU {
+
+  private final static boolean is32Bit;
+
+  static {
+
+    NativeLibrary.ensureNativeLibLoaded();
+
+    // Try to use Sun's sun.arch.data.model first ..
+    int bits = getPointerSizeInBits();
+    if ( 32 == bits || 64 == bits ) {
+        is32Bit = ( 32 == bits );
+    }else {
+        // We don't seem to need an AccessController.doPrivileged() block
+        // here as these system properties are visible even to unsigned
+        // applets
+        // Note: this code is replicated in StructLayout.java
+        String os = System.getProperty("os.name").toLowerCase();
+        String cpu = System.getProperty("os.arch").toLowerCase();
+
+        if ((os.startsWith("windows") && cpu.equals("x86")) ||
+            (os.startsWith("windows") && cpu.equals("arm")) ||
+            (os.startsWith("linux") && cpu.equals("i386")) ||
+            (os.startsWith("linux") && cpu.equals("x86")) ||
+            (os.startsWith("mac os") && cpu.equals("ppc")) ||
+            (os.startsWith("mac os") && cpu.equals("i386")) ||
+            (os.startsWith("darwin") && cpu.equals("ppc")) ||
+            (os.startsWith("darwin") && cpu.equals("i386")) ||
+            (os.startsWith("sunos") && cpu.equals("sparc")) ||
+            (os.startsWith("sunos") && cpu.equals("x86")) ||
+            (os.startsWith("freebsd") && cpu.equals("i386")) ||
+            (os.startsWith("hp-ux") && cpu.equals("pa_risc2.0"))) {
+          is32Bit = true;
+        }else if ((os.startsWith("windows") && cpu.equals("amd64")) ||
+                  (os.startsWith("linux") && cpu.equals("amd64")) ||
+                  (os.startsWith("linux") && cpu.equals("x86_64")) ||
+                  (os.startsWith("linux") && cpu.equals("ia64")) ||
+                  (os.startsWith("mac os") && cpu.equals("x86_64")) ||
+                  (os.startsWith("darwin") && cpu.equals("x86_64")) ||
+                  (os.startsWith("sunos") && cpu.equals("sparcv9")) ||
+                  (os.startsWith("sunos") && cpu.equals("amd64"))) {
+          is32Bit = false;
+        }else{
+          throw new RuntimeException("Please port CPU detection (32/64 bit) to your platform (" + os + "/" + cpu + ")");
+        }
+    }
+  }
+
+  public static boolean is32Bit() {
+    return is32Bit;
+  }
+
+  public static native int getPointerSizeInBits();
+
+}
diff --git a/src/java/com/jogamp/gluegen/runtime/DynamicLinker.java b/src/java/com/jogamp/gluegen/runtime/DynamicLinker.java
new file mode 100755
index 0000000..f3cfcfd
--- /dev/null
+++ b/src/java/com/jogamp/gluegen/runtime/DynamicLinker.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * 
+ * - Redistribution of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * 
+ * - Redistribution 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 Sun Microsystems, Inc. or the names of
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * 
+ * This software is provided "AS IS," without a warranty of any kind. ALL
+ * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
+ * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
+ * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+ * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
+ * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
+ * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
+ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+ * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
+ * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ * 
+ * You acknowledge that this software is not designed or intended for use
+ * in the design, construction, operation or maintenance of any nuclear
+ * facility.
+ * 
+ * Sun gratefully acknowledges that this software was originally authored
+ * and developed by Kenneth Bradley Russell and Christopher John Kline.
+ */
+
+package com.jogamp.gluegen.runtime;
+
+/** Provides an abstract interface to the OS's low-level dynamic
+    linking functionality. */
+
+interface DynamicLinker {
+  public long openLibraryGlobal(String pathname, boolean debug);
+  public long openLibraryLocal(String pathname, boolean debug);
+  public long lookupSymbol(long libraryHandle, String symbolName);
+  public void closeLibrary(long libraryHandle);
+}
diff --git a/src/java/com/jogamp/gluegen/runtime/DynamicLookupHelper.java b/src/java/com/jogamp/gluegen/runtime/DynamicLookupHelper.java
new file mode 100755
index 0000000..bc29732
--- /dev/null
+++ b/src/java/com/jogamp/gluegen/runtime/DynamicLookupHelper.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2003-2005 Sun Microsystems, Inc. All Rights Reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * 
+ * - Redistribution of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * 
+ * - Redistribution 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 Sun Microsystems, Inc. or the names of
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * 
+ * This software is provided "AS IS," without a warranty of any kind. ALL
+ * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
+ * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
+ * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+ * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
+ * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
+ * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
+ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+ * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
+ * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ * 
+ * You acknowledge that this software is not designed or intended for use
+ * in the design, construction, operation or maintenance of any nuclear
+ * facility.
+ * 
+ * Sun gratefully acknowledges that this software was originally authored
+ * and developed by Kenneth Bradley Russell and Christopher John Kline.
+ */
+
+package com.jogamp.gluegen.runtime;
+
+/** Interface callers may use to use the ProcAddressHelper's {@link
+    ProcAddressHelper#resetProcAddressTable resetProcAddressTable}
+    helper method to install function pointers into a
+    ProcAddressTable. This must typically be written with native
+    code. */
+
+public interface DynamicLookupHelper {
+  /**
+   * Try to fetch the function pointer for function 'funcName'.
+   */
+  public long dynamicLookupFunction(String funcName);
+}
diff --git a/src/java/com/jogamp/gluegen/runtime/MacOSXDynamicLinkerImpl.java b/src/java/com/jogamp/gluegen/runtime/MacOSXDynamicLinkerImpl.java
new file mode 100755
index 0000000..8abbd4e
--- /dev/null
+++ b/src/java/com/jogamp/gluegen/runtime/MacOSXDynamicLinkerImpl.java
@@ -0,0 +1,60 @@
+/* !---- DO NOT EDIT: This file autogenerated by com\sun\gluegen\JavaEmitter.java on Mon Jul 31 16:27:00 PDT 2006 ----! */
+
+package com.jogamp.gluegen.runtime;
+
+import com.jogamp.gluegen.runtime.*;
+
+public class MacOSXDynamicLinkerImpl implements DynamicLinker
+{
+
+  public static final int RTLD_LAZY = 0x1;
+  public static final int RTLD_NOW = 0x2;
+  public static final int RTLD_LOCAL = 0x4;
+  public static final int RTLD_GLOBAL = 0x8;
+
+  /** Interface to C language function: <br> <code> int dlclose(void *  __handle); </code>    */
+  private static native int dlclose(long __handle);
+
+  /** Interface to C language function: <br> <code> char *  dlerror(void); </code>    */
+  private static native java.lang.String dlerror();
+
+  /** Interface to C language function: <br> <code> void *  dlopen(const char *  __path, int __mode); </code>    */
+  private static native long dlopen(java.lang.String __path, int __mode);
+
+  /** Interface to C language function: <br> <code> void *  dlsym(void *  __handle, const char *  __symbol); </code>    */
+  private static native long dlsym(long __handle, java.lang.String __symbol);
+
+
+  // --- Begin CustomJavaCode .cfg declarations
+  public long openLibraryLocal(String pathname, boolean debug) {
+    // Note we use RTLD_LOCAL visibility to _NOT_ allow this functionality to
+    // be used to pre-resolve dependent libraries of JNI code without
+    // requiring that all references to symbols in those libraries be
+    // looked up dynamically via the ProcAddressTable mechanism; in
+    // other words, one can actually link against the library instead of
+    // having to dlsym all entry points. System.loadLibrary() uses
+    // RTLD_LOCAL visibility so can't be used for this purpose.
+    return dlopen(pathname, RTLD_LAZY | RTLD_LOCAL);
+  }
+  
+  public long openLibraryGlobal(String pathname, boolean debug) {
+    // Note we use RTLD_GLOBAL visibility to allow this functionality to
+    // be used to pre-resolve dependent libraries of JNI code without
+    // requiring that all references to symbols in those libraries be
+    // looked up dynamically via the ProcAddressTable mechanism; in
+    // other words, one can actually link against the library instead of
+    // having to dlsym all entry points. System.loadLibrary() uses
+    // RTLD_LOCAL visibility so can't be used for this purpose.
+    return dlopen(pathname, RTLD_LAZY | RTLD_GLOBAL);
+  }
+  
+  public long lookupSymbol(long libraryHandle, String symbolName) {
+    return dlsym(libraryHandle, symbolName);
+  }
+  
+  public void closeLibrary(long libraryHandle) {
+    dlclose(libraryHandle);
+  }
+  // ---- End CustomJavaCode .cfg declarations
+
+} // end of class MacOSXDynamicLinkerImpl
diff --git a/src/java/com/jogamp/gluegen/runtime/NativeLibLoader.java b/src/java/com/jogamp/gluegen/runtime/NativeLibLoader.java
new file mode 100755
index 0000000..662a059
--- /dev/null
+++ b/src/java/com/jogamp/gluegen/runtime/NativeLibLoader.java
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * 
+ * - Redistribution of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * 
+ * - Redistribution 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 Sun Microsystems, Inc. or the names of
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * 
+ * This software is provided "AS IS," without a warranty of any kind. ALL
+ * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
+ * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
+ * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+ * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
+ * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
+ * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
+ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+ * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
+ * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ * 
+ * You acknowledge that this software is not designed or intended for use
+ * in the design, construction, operation or maintenance of any nuclear
+ * facility.
+ * 
+ * Sun gratefully acknowledges that this software was originally authored
+ * and developed by Kenneth Bradley Russell and Christopher John Kline.
+ */
+
+package com.jogamp.gluegen.runtime;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.security.*;
+
+/** Class providing control over whether GlueGen loads the native code
+    associated with the NativeLibrary implementation. Alternative app
+    launchers such as those running within applets may want to disable
+    this default loading behavior and load the native code via another
+    (manual) mechanism. */
+public class NativeLibLoader {
+  private static volatile boolean loadingEnabled = true;
+  private static volatile boolean didLoading;
+
+  public static void disableLoading() {
+    loadingEnabled = false;
+  }
+
+  public static void enableLoading() {
+    loadingEnabled = true;
+  }
+  
+  public static void loadGlueGenRT() {
+    if (!didLoading && loadingEnabled) {
+      synchronized (NativeLibLoader.class) {
+        if (!didLoading && loadingEnabled) {
+          didLoading = true;
+          AccessController.doPrivileged(new PrivilegedAction() {
+              public Object run() {
+                loadLibraryInternal("gluegen-rt");
+                return null;
+              }
+            });
+        }
+      }
+    }
+  }
+
+  private static void loadLibraryInternal(String libraryName) {
+    String sunAppletLauncher = System.getProperty("sun.jnlp.applet.launcher");
+    boolean usingJNLPAppletLauncher = Boolean.valueOf(sunAppletLauncher).booleanValue();
+
+    if (usingJNLPAppletLauncher) {
+        try {
+          Class jnlpAppletLauncherClass = Class.forName("org.jdesktop.applet.util.JNLPAppletLauncher");
+          Method jnlpLoadLibraryMethod = jnlpAppletLauncherClass.getDeclaredMethod("loadLibrary", new Class[] { String.class });
+          jnlpLoadLibraryMethod.invoke(null, new Object[] { libraryName });
+        } catch (Exception e) {
+          Throwable t = e;
+          if (t instanceof InvocationTargetException) {
+            t = ((InvocationTargetException) t).getTargetException();
+          }
+          if (t instanceof Error)
+            throw (Error) t;
+          if (t instanceof RuntimeException) {
+            throw (RuntimeException) t;
+          }
+          // Throw UnsatisfiedLinkError for best compatibility with System.loadLibrary()
+          throw (UnsatisfiedLinkError) new UnsatisfiedLinkError().initCause(e);
+        }
+    } else {
+      System.loadLibrary(libraryName);
+    }
+  }
+}
diff --git a/src/java/com/jogamp/gluegen/runtime/NativeLibrary.java b/src/java/com/jogamp/gluegen/runtime/NativeLibrary.java
new file mode 100755
index 0000000..c48cf89
--- /dev/null
+++ b/src/java/com/jogamp/gluegen/runtime/NativeLibrary.java
@@ -0,0 +1,425 @@
+/*
+ * Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * 
+ * - Redistribution of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * 
+ * - Redistribution 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 Sun Microsystems, Inc. or the names of
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * 
+ * This software is provided "AS IS," without a warranty of any kind. ALL
+ * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
+ * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
+ * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+ * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
+ * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
+ * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
+ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+ * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
+ * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ * 
+ * You acknowledge that this software is not designed or intended for use
+ * in the design, construction, operation or maintenance of any nuclear
+ * facility.
+ * 
+ * Sun gratefully acknowledges that this software was originally authored
+ * and developed by Kenneth Bradley Russell and Christopher John Kline.
+ */
+
+package com.jogamp.gluegen.runtime;
+
+import java.io.*;
+import java.lang.reflect.*;
+import java.security.*;
+import java.util.*;
+
+/** Provides low-level, relatively platform-independent access to
+    shared ("native") libraries. The core library routines
+    <code>System.load()</code> and <code>System.loadLibrary()</code>
+    in general provide suitable functionality for applications using
+    native code, but are not flexible enough to support certain kinds
+    of glue code generation and deployment strategies. This class
+    supports direct linking of native libraries to other shared
+    objects not necessarily installed on the system (in particular,
+    via the use of dlopen(RTLD_GLOBAL) on Unix platforms) as well as
+    manual lookup of function names to support e.g. GlueGen's
+    ProcAddressTable glue code generation style without additional
+    supporting code needed in the generated library. */
+
+public class NativeLibrary {
+  private static final int WINDOWS = 1;
+  private static final int UNIX    = 2;
+  private static final int MACOSX  = 3;
+  private static boolean DEBUG;
+  private static int platform;
+  private static DynamicLinker dynLink;
+  private static String[] prefixes;
+  private static String[] suffixes;
+
+  static {
+    // Determine platform we're running on
+    AccessController.doPrivileged(new PrivilegedAction() {
+        public Object run() {
+          String osName = System.getProperty("os.name").toLowerCase();
+          if (osName.startsWith("wind")) {
+            platform = WINDOWS;
+          } else if (osName.startsWith("mac os x")) {
+            platform = MACOSX;
+          } else {
+            platform = UNIX;
+          }
+
+          DEBUG = (System.getProperty("gluegen.debug.NativeLibrary") != null);
+
+          return null;
+        }
+      });
+    // Instantiate dynamic linker implementation
+    switch (platform) {
+      case WINDOWS:
+        dynLink = new WindowsDynamicLinkerImpl();
+        prefixes = new String[] { "" };
+        suffixes = new String[] { ".dll" };
+        break;
+      case UNIX:
+        dynLink = new UnixDynamicLinkerImpl();
+        prefixes = new String[] { "lib" };
+        suffixes = new String[] { ".so" };
+        break;
+      case MACOSX:
+        dynLink = new MacOSXDynamicLinkerImpl();
+        prefixes = new String[] { "lib", "" };
+        suffixes = new String[] { ".dylib", ".jnilib", "" };
+        break;
+      default:
+        throw new InternalError("Platform not initialized properly");
+    }
+  }
+
+  // Platform-specific representation for the handle to the open
+  // library. This is an HMODULE on Windows and a void* (the result of
+  // a dlopen() call) on Unix and Mac OS X platforms.
+  private long libraryHandle;
+
+  // May as well keep around the path to the library we opened
+  private String libraryPath;
+
+  // Private constructor to prevent arbitrary instances from floating around
+  private NativeLibrary(long libraryHandle, String libraryPath) {
+    this.libraryHandle = libraryHandle;
+    this.libraryPath   = libraryPath;
+  }
+
+  /** Opens the given native library, assuming it has the same base
+      name on all platforms, looking first in the system's search
+      path, and in the context of the specified ClassLoader, which is
+      used to help find the library in the case of e.g. Java Web Start. */
+  public static NativeLibrary open(String libName, ClassLoader loader) {
+    return open(libName, libName, libName, true, loader, true);
+  }
+
+  /** Opens the given native library, assuming it has the same base
+      name on all platforms, looking first in the system's search
+      path, and in the context of the specified ClassLoader, which is
+      used to help find the library in the case of e.g. Java Web Start. */
+  public static NativeLibrary open(String libName, ClassLoader loader, boolean global) {
+    return open(libName, libName, libName, true, loader, global);
+  }
+
+  /** Opens the given native library, assuming it has the given base
+      names (no "lib" prefix or ".dll/.so/.dylib" suffix) on the
+      Windows, Unix and Mac OS X platforms, respectively, and in the
+      context of the specified ClassLoader, which is used to help find
+      the library in the case of e.g. Java Web Start. The
+      searchSystemPathFirst argument changes the behavior to first
+      search the default system path rather than searching it last.
+      Note that we do not currently handle DSO versioning on Unix.
+      Experience with JOAL and OpenAL has shown that it is extremely
+      problematic to rely on a specific .so version (for one thing,
+      ClassLoader.findLibrary on Unix doesn't work with files not
+      ending in .so, for example .so.0), and in general if this
+      dynamic loading facility is used correctly the version number
+      will be irrelevant.
+  */
+  public static NativeLibrary open(String windowsLibName,
+                                   String unixLibName,
+                                   String macOSXLibName,
+                                   boolean searchSystemPathFirst,
+                                   ClassLoader loader) {
+    return open(windowsLibName, unixLibName, macOSXLibName, searchSystemPathFirst, loader, true);
+  }
+
+  public static NativeLibrary open(String windowsLibName,
+                                   String unixLibName,
+                                   String macOSXLibName,
+                                   boolean searchSystemPathFirst,
+                                   ClassLoader loader, boolean global) {
+    List possiblePaths = enumerateLibraryPaths(windowsLibName,
+                                               unixLibName,
+                                               macOSXLibName,
+                                               searchSystemPathFirst,
+                                               loader);
+    // Iterate down these and see which one if any we can actually find.
+    for (Iterator iter = possiblePaths.iterator(); iter.hasNext(); ) {
+      String path = (String) iter.next();
+      if (DEBUG) {
+        System.out.println("Trying to load " + path);
+      }
+      ensureNativeLibLoaded();
+      long res;
+      if(global) {
+          res = dynLink.openLibraryGlobal(path, DEBUG);
+      } else {
+          res = dynLink.openLibraryLocal(path, DEBUG);
+      }
+      if (res != 0) {
+        if (DEBUG) {
+          System.out.println("Successfully loaded " + path + ": res = 0x" + Long.toHexString(res));
+        }
+        return new NativeLibrary(res, path);
+      }
+    }
+
+    if (DEBUG) {
+      System.out.println("Did not succeed in loading (" + windowsLibName + ", " + unixLibName + ", " + macOSXLibName + ")");
+    }
+
+    // For now, just return null to indicate the open operation didn't
+    // succeed (could also throw an exception if we could tell which
+    // of the openLibrary operations actually failed)
+    return null;
+  }
+
+  /** Looks up the given function name in this native library. */
+  public long lookupFunction(String functionName) {
+    if (libraryHandle == 0)
+      throw new RuntimeException("Library is not open");
+    return dynLink.lookupSymbol(libraryHandle, functionName);
+  }
+
+  /** Retrieves the low-level library handle from this NativeLibrary
+      object. On the Windows platform this is an HMODULE, and on Unix
+      and Mac OS X platforms the void* result of calling dlopen(). */
+  public long getLibraryHandle() {
+    return libraryHandle;
+  }
+
+  /** Retrieves the path under which this library was opened. */
+  public String getLibraryPath() {
+    return libraryPath;
+  }
+
+  /** Closes this native library. Further lookup operations are not
+      allowed after calling this method. */
+  public void close() {
+    if (libraryHandle == 0)
+      throw new RuntimeException("Library already closed");
+    long handle = libraryHandle;
+    libraryHandle = 0;
+    dynLink.closeLibrary(handle);
+  }
+
+  /** Given the base library names (no prefixes/suffixes) for the
+      various platforms, enumerate the possible locations and names of
+      the indicated native library on the system. */
+  private static List enumerateLibraryPaths(String windowsLibName,
+                                            String unixLibName,
+                                            String macOSXLibName,
+                                            boolean searchSystemPathFirst,
+                                            ClassLoader loader) {
+    List paths = new ArrayList();
+    String libName = selectName(windowsLibName, unixLibName, macOSXLibName);
+    if (libName == null)
+      return paths;
+
+    // Allow user's full path specification to override our building of paths
+    File file = new File(libName);
+    if (file.isAbsolute()) {
+	paths.add(libName);
+	return paths;
+    }
+
+    String[] baseNames = buildNames(libName);
+
+    if (searchSystemPathFirst) {
+      // Add just the library names to use the OS's search algorithm
+      for (int i = 0; i < baseNames.length; i++) {
+        paths.add(baseNames[i]);
+      }
+    }
+
+    // The idea to ask the ClassLoader to find the library is borrowed
+    // from the LWJGL library
+    String clPath = getPathFromClassLoader(libName, loader);
+    if (DEBUG) {
+      System.out.println("Class loader path to " + libName + ": " + clPath);
+    }
+    if (clPath != null) {
+      paths.add(clPath);
+    }
+
+    // Add entries from java.library.path
+    String javaLibraryPath =
+      (String) AccessController.doPrivileged(new PrivilegedAction() {
+          public Object run() {
+            return System.getProperty("java.library.path");
+          }
+        });
+    if (javaLibraryPath != null) {
+      StringTokenizer tokenizer = new StringTokenizer(javaLibraryPath, File.pathSeparator);
+      while (tokenizer.hasMoreTokens()) {
+        addPaths(tokenizer.nextToken(), baseNames, paths);
+      }
+    }
+
+    // Add current working directory
+    String userDir =
+      (String) AccessController.doPrivileged(new PrivilegedAction() {
+          public Object run() {
+            return System.getProperty("user.dir");
+          }
+        });
+    addPaths(userDir, baseNames, paths);
+
+    // Add probable Mac OS X-specific paths
+    if (platform == MACOSX) {
+      // Add historical location
+      addPaths("/Library/Frameworks/" + libName + ".Framework", baseNames, paths);
+      // Add current location
+      addPaths("/System/Library/Frameworks/" + libName + ".Framework", baseNames, paths);
+    }
+
+    if (!searchSystemPathFirst) {
+      // Add just the library names to use the OS's search algorithm
+      for (int i = 0; i < baseNames.length; i++) {
+        paths.add(baseNames[i]);
+      }
+    }
+
+    return paths;
+  }
+
+
+  private static String selectName(String windowsLibName,
+                                   String unixLibName,
+                                   String macOSXLibName) {
+    switch (platform) {
+      case WINDOWS:
+        return windowsLibName;
+      case UNIX:
+        return unixLibName;
+      case MACOSX:
+        return macOSXLibName;
+      default:
+        throw new InternalError();
+    }
+  }
+
+  private static String[] buildNames(String libName) {
+    // If the library name already has the prefix / suffix added
+    // (principally because we want to force a version number on Unix
+    // operating systems) then just return the library name.
+    if (libName.startsWith(prefixes[0])) {
+      if (libName.endsWith(suffixes[0])) {
+        return new String[] { libName };
+      }
+
+      int idx = libName.indexOf(suffixes[0]);
+      boolean ok = true;
+      if (idx >= 0) {
+        // Check to see if everything after it is a Unix version number
+        for (int i = idx + suffixes[0].length();
+             i < libName.length();
+             i++) {
+          char c = libName.charAt(i);
+          if (!(c == '.' || (c >= '0' && c <= '9'))) {
+            ok = false;
+            break;
+          }
+        }
+        if (ok) {
+          return new String[] { libName };
+        }
+      }
+    }
+
+    String[] res = new String[prefixes.length * suffixes.length];
+    int idx = 0;
+    for (int i = 0; i < prefixes.length; i++) {
+      for (int j = 0; j < suffixes.length; j++) {
+        res[idx++] = prefixes[i] + libName + suffixes[j];
+      }
+    }
+    return res;
+  }
+
+  private static void addPaths(String path, String[] baseNames, List paths) {
+    for (int j = 0; j < baseNames.length; j++) {
+      paths.add(path + File.separator + baseNames[j]);
+    }
+  }
+
+  private static boolean initializedFindLibraryMethod = false;
+  private static Method  findLibraryMethod = null;
+  private static String getPathFromClassLoader(final String libName, final ClassLoader loader) {
+    if (loader == null)
+      return null;
+    if (!initializedFindLibraryMethod) {
+      AccessController.doPrivileged(new PrivilegedAction() {
+          public Object run() {
+            try {
+              findLibraryMethod = ClassLoader.class.getDeclaredMethod("findLibrary",
+                                                                      new Class[] { String.class });
+              findLibraryMethod.setAccessible(true);
+            } catch (Exception e) {
+              // Fail silently disabling this functionality
+            }
+            initializedFindLibraryMethod = true;
+            return null;
+          }
+        });
+    }
+    if (findLibraryMethod != null) {
+      try {
+        return (String) AccessController.doPrivileged(new PrivilegedAction() {
+            public Object run() {
+              try {
+                return findLibraryMethod.invoke(loader, new Object[] { libName });
+              } catch (Exception e) {
+                throw new RuntimeException(e);
+              }
+            }
+          });
+      } catch (Exception e) {
+        if (DEBUG) {
+          e.printStackTrace();
+        }
+        // Fail silently and continue with other search algorithms
+      }
+    }
+    return null;
+  }
+
+  private static volatile boolean loadedDynLinkNativeLib;
+  static void ensureNativeLibLoaded() {
+    if (!loadedDynLinkNativeLib) {
+      synchronized (NativeLibrary.class) {
+        if (!loadedDynLinkNativeLib) {
+          loadedDynLinkNativeLib = true;
+          NativeLibLoader.loadGlueGenRT();
+        }
+      }
+    }
+  }
+}
diff --git a/src/java/com/jogamp/gluegen/runtime/PointerBuffer.java.javame_cdc_fp b/src/java/com/jogamp/gluegen/runtime/PointerBuffer.java.javame_cdc_fp
new file mode 100755
index 0000000..20a70c1
--- /dev/null
+++ b/src/java/com/jogamp/gluegen/runtime/PointerBuffer.java.javame_cdc_fp
@@ -0,0 +1,180 @@
+/*
+ * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * 
+ * - Redistribution of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * 
+ * - Redistribution 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 Sun Microsystems, Inc. or the names of
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * 
+ * This software is provided "AS IS," without a warranty of any kind. ALL
+ * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
+ * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
+ * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+ * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
+ * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
+ * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
+ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+ * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
+ * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ * 
+ * You acknowledge that this software is not designed or intended for use
+ * in the design, construction, operation or maintenance of any nuclear
+ * facility.
+ */
+
+package com.jogamp.gluegen.runtime;
+
+import java.nio.*;
+
+public class PointerBuffer {
+  private ByteBuffer   bb;
+  private IntBuffer    ib;
+  private int capacity, position;
+  private long[] backup;
+
+  private PointerBuffer(ByteBuffer bb) {
+    this.bb = bb;
+    this.ib = bb.asIntBuffer();
+
+    capacity = bb.capacity() / elementSize();
+
+    position=0;
+    backup = new long[capacity];
+  }
+
+  public final int limit() {
+    return capacity;
+  }
+  public final int capacity() {
+    return capacity;
+  }
+
+  public final int position() {
+    return position;
+  }
+
+  public final PointerBuffer position(int newPos) {
+    if(0>newPos || newPos>=capacity) {
+        throw new IndexOutOfBoundsException();
+    }
+    position = newPos;
+    return this;
+  }
+
+  public final int remaining() {
+    return capacity - position;
+  }
+
+  public final boolean hasRemaining() {
+    return position < capacity;
+  }
+
+  public final PointerBuffer rewind() {
+    position=0;
+    return this;
+  }
+
+  int   arrayOffset() { return 0; }
+
+  boolean   hasArray() { return true; }
+
+  public long[] array() {
+    return backup;
+  }
+
+  public static PointerBuffer allocate(int size) {
+      return new PointerBuffer(ByteBuffer.wrap(new byte[elementSize()* size]));
+  }
+
+  public static PointerBuffer allocateDirect(int size) {
+      return new PointerBuffer(BufferFactory.newDirectByteBuffer(elementSize() * size));
+  }
+
+  public static PointerBuffer wrap(ByteBuffer src) {
+    PointerBuffer res =  new PointerBuffer(src);
+    res.updateBackup();
+    return res;
+  }
+
+  public ByteBuffer getBuffer() {
+    return bb;
+  }
+
+  public boolean isDirect() {
+    return bb.isDirect();
+  }
+
+  public long get(int idx) {
+    if(0>idx || idx>=capacity) {
+        throw new IndexOutOfBoundsException();
+    }
+    if(CPU.is32Bit()) {
+        return ib.get(idx);
+    } else {
+        idx = idx << 1 ; // 8-byte to 4-byte offset
+        long lo = 0x00000000FFFFFFFFL & ( (long) ib.get(idx)   );
+        long hi = 0x00000000FFFFFFFFL & ( (long) ib.get(idx+1) );
+        if(BufferFactory.isLittleEndian()) {
+            return hi << 32 | lo ;
+        }
+        return lo << 32 | hi ;
+    }
+  }
+
+  public long get() {
+    long r = get(position);
+    position++;
+    return r;
+  }
+
+  public PointerBuffer put(int idx, long v) {
+    if(0>idx || idx>=capacity) {
+        throw new IndexOutOfBoundsException();
+    }
+    backup[idx] = v;
+    if(CPU.is32Bit()) {
+        ib.put(idx, (int)v);
+    } else {
+        idx = idx << 1 ; // 8-byte to 4-byte offset
+        int lo = (int) ( ( v       ) & 0x00000000FFFFFFFFL ) ;
+        int hi = (int) ( ( v >> 32 ) & 0x00000000FFFFFFFFL ) ;
+        if(BufferFactory.isLittleEndian()) {
+            ib.put(idx, lo);
+            ib.put(idx+1, hi);
+        } else {
+            ib.put(idx, hi);
+            ib.put(idx+1, lo);
+        }
+    }
+    return this;
+  }
+
+  public PointerBuffer put(long v) {
+    put(position, v);
+    position++;
+    return this;
+  }
+
+  private void updateBackup() {
+    for (int i = 0; i < capacity; i++) {
+      backup[i] = get(i);
+    }
+  }
+
+  public static int elementSize() {
+    return CPU.is32Bit() ? BufferFactory.SIZEOF_INT : BufferFactory.SIZEOF_LONG;
+  }
+
+}
diff --git a/src/java/com/jogamp/gluegen/runtime/PointerBuffer.java.javase b/src/java/com/jogamp/gluegen/runtime/PointerBuffer.java.javase
new file mode 100755
index 0000000..09ca2db
--- /dev/null
+++ b/src/java/com/jogamp/gluegen/runtime/PointerBuffer.java.javase
@@ -0,0 +1,169 @@
+/*
+ * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * - Redistribution of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistribution 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 Sun Microsystems, Inc. or the names of
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * This software is provided "AS IS," without a warranty of any kind. ALL
+ * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
+ * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
+ * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+ * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
+ * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
+ * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
+ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+ * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
+ * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ *
+ * You acknowledge that this software is not designed or intended for use
+ * in the design, construction, operation or maintenance of any nuclear
+ * facility.
+ */
+
+package com.jogamp.gluegen.runtime;
+
+import java.nio.*;
+
+public class PointerBuffer {
+  private ByteBuffer   bb;
+  private Buffer       pb;
+  private int capacity, position;
+  private long[] backup;
+
+  private PointerBuffer(ByteBuffer bb) {
+    this.bb = bb;
+
+    if(CPU.is32Bit()) {
+       this.pb = bb.asIntBuffer();
+    }else{
+       this.pb = bb.asLongBuffer();
+    }
+
+    capacity = bb.capacity() / elementSize();
+
+    position=0;
+    backup = new long[capacity];
+  }
+
+  public final int limit() {
+    return capacity;
+  }
+  public final int capacity() {
+    return capacity;
+  }
+
+  public final int position() {
+    return position;
+  }
+
+  public final PointerBuffer position(int newPos) {
+    if(0>newPos || newPos>=capacity) {
+        throw new IndexOutOfBoundsException();
+    }
+    position = newPos;
+    return this;
+  }
+
+  public final int remaining() {
+    return capacity - position;
+  }
+
+  public final boolean hasRemaining() {
+    return position < capacity;
+  }
+
+  public final PointerBuffer rewind() {
+    position=0;
+    return this;
+  }
+
+  int   arrayOffset() { return 0; }
+
+  boolean   hasArray() { return true; }
+
+  public long[] array() {
+    return backup;
+  }
+
+  public static PointerBuffer allocate(int size) {
+      return new PointerBuffer(ByteBuffer.wrap(new byte[elementSize()* size]));
+  }
+
+  public static PointerBuffer allocateDirect(int size) {
+      return new PointerBuffer(BufferFactory.newDirectByteBuffer(elementSize() * size));
+  }
+
+  public static PointerBuffer wrap(ByteBuffer src) {
+    PointerBuffer res =  new PointerBuffer(src);
+    res.updateBackup();
+    return res;
+  }
+
+  public ByteBuffer getBuffer() {
+    return bb;
+  }
+
+  public boolean isDirect() {
+    return bb.isDirect();
+  }
+
+  public long get(int idx) {
+    if(0>idx || idx>=capacity) {
+        throw new IndexOutOfBoundsException();
+    }
+    if(CPU.is32Bit()) {
+        return ((IntBuffer)pb).get(idx);
+    } else {
+        return ((LongBuffer)pb).get(idx);
+    }
+  }
+
+  public long get() {
+    long r = get(position);
+    position++;
+    return r;
+  }
+
+  public PointerBuffer put(int idx, long v) {
+    if(0>idx || idx>=capacity) {
+        throw new IndexOutOfBoundsException();
+    }
+    backup[idx] = v;
+    if(CPU.is32Bit()) {
+        ((IntBuffer)pb).put(idx, (int)v);
+    } else {
+        ((LongBuffer)pb).put(idx, v);
+    }
+    return this;
+  }
+
+  public PointerBuffer put(long v) {
+    put(position, v);
+    position++;
+    return this;
+  }
+
+  private void updateBackup() {
+    for (int i = 0; i < capacity; i++) {
+      backup[i] = get(i);
+    }
+  }
+
+  public static int elementSize() {
+    return CPU.is32Bit() ? BufferFactory.SIZEOF_INT : BufferFactory.SIZEOF_LONG;
+  }
+}
diff --git a/src/java/com/jogamp/gluegen/runtime/ProcAddressHelper.java b/src/java/com/jogamp/gluegen/runtime/ProcAddressHelper.java
new file mode 100644
index 0000000..1b7f9d6
--- /dev/null
+++ b/src/java/com/jogamp/gluegen/runtime/ProcAddressHelper.java
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2003-2005 Sun Microsystems, Inc. All Rights Reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * 
+ * - Redistribution of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * 
+ * - Redistribution 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 Sun Microsystems, Inc. or the names of
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * 
+ * This software is provided "AS IS," without a warranty of any kind. ALL
+ * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
+ * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
+ * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+ * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
+ * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
+ * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
+ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+ * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
+ * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ * 
+ * You acknowledge that this software is not designed or intended for use
+ * in the design, construction, operation or maintenance of any nuclear
+ * facility.
+ * 
+ * Sun gratefully acknowledges that this software was originally authored
+ * and developed by Kenneth Bradley Russell and Christopher John Kline.
+ */
+
+package com.jogamp.gluegen.runtime;
+
+import java.security.*;
+
+// Debugging only
+import java.io.*;
+
+/** Helper class containing constants and methods to assist with the
+    manipulation of auto-generated ProcAddressTables. */
+
+public class ProcAddressHelper {
+  public static final String PROCADDRESS_VAR_PREFIX = "_addressof_";
+  protected static boolean DEBUG;
+  protected static String DEBUG_PREFIX;
+  protected static int debugNum;
+
+  static {
+    AccessController.doPrivileged(new PrivilegedAction() {
+        public Object run() {
+          DEBUG = (System.getProperty("gluegen.debug.ProcAddressHelper") != null);
+          if (DEBUG) {
+            DEBUG_PREFIX = System.getProperty("gluegen.debug.ProcAddressHelper.prefix");
+          }
+          return null;
+        }
+      });
+  }
+
+  protected static PrintStream getDebugOutStream() {
+    PrintStream out = null;
+    if (DEBUG) {
+      if (DEBUG_PREFIX != null) {
+        try {
+          out = new PrintStream(new BufferedOutputStream(new FileOutputStream(DEBUG_PREFIX + File.separatorChar +
+                                                                              "procaddresshelper-" + (++debugNum) + ".txt")));
+        } catch (IOException e) {
+          e.printStackTrace();
+          out = System.err;
+        }
+      } else {
+        out = System.err;
+      }
+    }
+    return out;
+  }
+
+  public static void resetProcAddressTable(Object table,
+                                           DynamicLookupHelper lookup) throws RuntimeException {
+    Class tableClass = table.getClass();
+    java.lang.reflect.Field[] fields = tableClass.getFields();
+    PrintStream dout = getDebugOutStream();
+    
+    if (DEBUG) {
+      dout.println("ProcAddressHelper.resetProcAddressTable(" + table.getClass().getName() + ")");
+    }
+    for (int i = 0; i < fields.length; ++i) {
+      String addressFieldName = fields[i].getName();
+      if (!addressFieldName.startsWith(ProcAddressHelper.PROCADDRESS_VAR_PREFIX)) {
+        // not a proc address variable
+        continue;
+      }
+      int startOfMethodName = ProcAddressHelper.PROCADDRESS_VAR_PREFIX.length();
+      String funcName = addressFieldName.substring(startOfMethodName);
+      try {
+        java.lang.reflect.Field addressField = fields[i];
+        assert(addressField.getType() == Long.TYPE);
+        long newProcAddress = lookup.dynamicLookupFunction(funcName);
+        // set the current value of the proc address variable in the table object
+        addressField.setLong(table, newProcAddress); 
+        if (DEBUG) {
+          dout.println("  " + addressField.getName() + " -> 0x" + Long.toHexString(newProcAddress));
+        }
+      } catch (Exception e) {
+        throw new RuntimeException("Can not get proc address for method \"" +
+                                   funcName + "\": Couldn't set value of field \"" + addressFieldName +
+                                   "\" in class " + tableClass.getName(), e);
+      }
+    }
+    if (DEBUG) {
+      dout.flush();
+      if (DEBUG_PREFIX != null) {
+        dout.close();
+      }
+    }
+  }
+}
diff --git a/src/java/com/jogamp/gluegen/runtime/ProcAddressTable.java b/src/java/com/jogamp/gluegen/runtime/ProcAddressTable.java
new file mode 100644
index 0000000..1e7d34b
--- /dev/null
+++ b/src/java/com/jogamp/gluegen/runtime/ProcAddressTable.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2003-2005 Sun Microsystems, Inc. All Rights Reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * 
+ * - Redistribution of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * 
+ * - Redistribution 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 Sun Microsystems, Inc. or the names of
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * 
+ * This software is provided "AS IS," without a warranty of any kind. ALL
+ * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
+ * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
+ * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+ * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
+ * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
+ * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
+ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+ * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
+ * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ * 
+ * You acknowledge that this software is not designed or intended for use
+ * in the design, construction, operation or maintenance of any nuclear
+ * facility.
+ */
+
+package com.jogamp.gluegen.runtime;
+
+public interface ProcAddressTable {
+  public long getAddressFor(String functionName);
+}
diff --git a/src/java/com/jogamp/gluegen/runtime/StructAccessor.java.javame_cdc_fp b/src/java/com/jogamp/gluegen/runtime/StructAccessor.java.javame_cdc_fp
new file mode 100755
index 0000000..28a8339
--- /dev/null
+++ b/src/java/com/jogamp/gluegen/runtime/StructAccessor.java.javame_cdc_fp
@@ -0,0 +1,201 @@
+/*
+ * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * 
+ * - Redistribution of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * 
+ * - Redistribution 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 Sun Microsystems, Inc. or the names of
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * 
+ * This software is provided "AS IS," without a warranty of any kind. ALL
+ * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
+ * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
+ * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+ * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
+ * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
+ * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
+ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+ * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
+ * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ * 
+ * You acknowledge that this software is not designed or intended for use
+ * in the design, construction, operation or maintenance of any nuclear
+ * facility.
+ * 
+ * Sun gratefully acknowledges that this software was originally authored
+ * and developed by Kenneth Bradley Russell and Christopher John Kline.
+ */
+
+package com.jogamp.gluegen.runtime;
+
+import java.nio.*;
+
+public class StructAccessor {
+  private ByteBuffer   bb;
+  private FloatBuffer  fb;
+  private IntBuffer    ib;
+  private ShortBuffer  sb;
+
+  public StructAccessor(ByteBuffer bb) {
+    this.bb = bb;
+  }
+
+  public ByteBuffer getBuffer() {
+    return bb;
+  }
+
+  /** Return a slice of the current ByteBuffer starting at the
+      specified byte offset and extending the specified number of
+      bytes. Note that this method is not thread-safe with respect to
+      the other methods in this class. */
+  public ByteBuffer slice(int byteOffset, int byteLength) {
+    bb.position(byteOffset);
+    bb.limit(byteOffset + byteLength);
+    ByteBuffer newBuf = bb.slice();
+    bb.position(0);
+    bb.limit(bb.capacity());
+    return newBuf;
+  }
+
+  /** Retrieves the byte at the specified slot (byte offset). */
+  public byte getByteAt(int slot) {
+    return bb.get(slot);
+  }
+
+  /** Puts a byte at the specified slot (byte offset). */
+  public void setByteAt(int slot, byte v) {
+    bb.put(slot, v);
+  }
+
+  /** Retrieves the float at the specified slot (4-byte offset). */
+  public float getFloatAt(int slot) {
+    return floatBuffer().get(slot);
+  }
+
+  /** Puts a float at the specified slot (4-byte offset). */
+  public void setFloatAt(int slot, float v) {
+    floatBuffer().put(slot, v);
+  }
+
+  /** Retrieves the int at the specified slot (4-byte offset). */
+  public int getIntAt(int slot) {
+    return intBuffer().get(slot);
+  }
+
+  /** Puts a int at the specified slot (4-byte offset). */
+  public void setIntAt(int slot, int v) {
+    intBuffer().put(slot, v);
+  }
+
+  public void setBytesAt(int slot, byte[] v) {
+      for (int i = 0; i < v.length; i++) {
+        bb.put(slot++, v[i]);
+      }
+  }
+
+  public byte[] getBytesAt(int slot, byte[] v) {
+      for (int i = 0; i < v.length; i++) {
+        v[i] = bb.get(slot++);
+      }
+      return v;
+  }
+
+  public void setIntsAt(int slot, int[] v) {
+      for (int i = 0; i < v.length; i++) {
+        intBuffer().put(slot++, v[i]);
+      }
+  }
+
+  public int[] getIntsAt(int slot, int[] v) {
+      for (int i = 0; i < v.length; i++) {
+        v[i] = intBuffer().get(slot++);
+      }
+      return v;
+  }
+
+  public void setFloatsAt(int slot, float[] v) {
+      for (int i = 0; i < v.length; i++) {
+        floatBuffer().put(slot++, v[i]);
+      }
+  }
+
+  public float[] getFloatsAt(int slot, float[] v) {
+      for (int i = 0; i < v.length; i++) {
+        v[i] = floatBuffer().get(slot++);
+      }
+      return v;
+  }
+
+  /** Retrieves the long at the specified slot (8-byte offset). */
+  public long getLongAt(int slot) {
+    slot = slot << 1 ; // 8-byte to 4-byte offset
+    IntBuffer intBuffer = intBuffer();
+    long lo = 0x00000000FFFFFFFFL & ( (long) intBuffer.get(slot)   );
+    long hi = 0x00000000FFFFFFFFL & ( (long) intBuffer.get(slot+1) );
+    if(BufferFactory.isLittleEndian()) {
+        return hi << 32 | lo ;
+    }
+    return lo << 32 | hi ;
+  }
+
+  /** Puts a long at the specified slot (8-byte offset). */
+  public void setLongAt(int slot, long v) {
+    slot = slot << 1 ; // 8-byte to 4-byte offset
+    IntBuffer intBuffer = intBuffer();
+    int lo = (int) ( ( v       ) & 0x00000000FFFFFFFFL ) ;
+    int hi = (int) ( ( v >> 32 ) & 0x00000000FFFFFFFFL ) ;
+    if(BufferFactory.isLittleEndian()) {
+        intBuffer.put(slot, lo);
+        intBuffer.put(slot+1, hi);
+    } else {
+        intBuffer.put(slot, hi);
+        intBuffer.put(slot+1, lo);
+    }
+  }
+
+  /** Retrieves the short at the specified slot (2-byte offset). */
+  public short getShortAt(int slot) {
+    return shortBuffer().get(slot);
+  }
+
+  /** Puts a short at the specified slot (2-byte offset). */
+  public void setShortAt(int slot, short v) {
+    shortBuffer().put(slot, v);
+  }
+
+  //----------------------------------------------------------------------
+  // Internals only below this point
+  //
+
+  private FloatBuffer floatBuffer() {
+    if (fb == null) {
+      fb = bb.asFloatBuffer();
+    }
+    return fb;
+  }
+
+  private IntBuffer intBuffer() {
+    if (ib == null) {
+      ib = bb.asIntBuffer();
+    }
+    return ib;
+  }
+
+  private ShortBuffer shortBuffer() {
+    if (sb == null) {
+      sb = bb.asShortBuffer();
+    }
+    return sb;
+  }
+}
diff --git a/src/java/com/jogamp/gluegen/runtime/StructAccessor.java.javase b/src/java/com/jogamp/gluegen/runtime/StructAccessor.java.javase
new file mode 100755
index 0000000..4101571
--- /dev/null
+++ b/src/java/com/jogamp/gluegen/runtime/StructAccessor.java.javase
@@ -0,0 +1,256 @@
+/*
+ * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * 
+ * - Redistribution of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * 
+ * - Redistribution 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 Sun Microsystems, Inc. or the names of
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * 
+ * This software is provided "AS IS," without a warranty of any kind. ALL
+ * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
+ * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
+ * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+ * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
+ * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
+ * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
+ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+ * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
+ * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ * 
+ * You acknowledge that this software is not designed or intended for use
+ * in the design, construction, operation or maintenance of any nuclear
+ * facility.
+ * 
+ * Sun gratefully acknowledges that this software was originally authored
+ * and developed by Kenneth Bradley Russell and Christopher John Kline.
+ */
+
+package com.jogamp.gluegen.runtime;
+
+import java.nio.*;
+
+public class StructAccessor {
+  private ByteBuffer   bb;
+  private CharBuffer   cb;
+  private DoubleBuffer db;
+  private FloatBuffer  fb;
+  private IntBuffer    ib;
+  private LongBuffer   lb;
+  private ShortBuffer  sb;
+
+  public StructAccessor(ByteBuffer bb) {
+    // Setting of byte order is concession to native code which needs
+    // to instantiate these
+    this.bb = bb.order(ByteOrder.nativeOrder());
+  }
+
+  public ByteBuffer getBuffer() {
+    return bb;
+  }
+
+  /** Return a slice of the current ByteBuffer starting at the
+      specified byte offset and extending the specified number of
+      bytes. Note that this method is not thread-safe with respect to
+      the other methods in this class. */
+  public ByteBuffer slice(int byteOffset, int byteLength) {
+    bb.position(byteOffset);
+    bb.limit(byteOffset + byteLength);
+    ByteBuffer newBuf = bb.slice();
+    bb.position(0);
+    bb.limit(bb.capacity());
+    return newBuf;
+  }
+
+  /** Retrieves the byte at the specified slot (byte offset). */
+  public byte getByteAt(int slot) {
+    return bb.get(slot);
+  }
+
+  /** Puts a byte at the specified slot (byte offset). */
+  public void setByteAt(int slot, byte v) {
+    bb.put(slot, v);
+  }
+
+  /** Retrieves the char at the specified slot (2-byte offset). */
+  public char getCharAt(int slot) {
+    return charBuffer().get(slot);
+  }
+
+  /** Puts a char at the specified slot (2-byte offset). */
+  public void setCharAt(int slot, char v) {
+    charBuffer().put(slot, v);
+  }
+
+  /** Retrieves the double at the specified slot (8-byte offset). */
+  public double getDoubleAt(int slot) {
+    return doubleBuffer().get(slot);
+  }
+
+  /** Puts a double at the specified slot (8-byte offset). */
+  public void setDoubleAt(int slot, double v) {
+    doubleBuffer().put(slot, v);
+  }
+
+  /** Retrieves the float at the specified slot (4-byte offset). */
+  public float getFloatAt(int slot) {
+    return floatBuffer().get(slot);
+  }
+
+  /** Puts a float at the specified slot (4-byte offset). */
+  public void setFloatAt(int slot, float v) {
+    floatBuffer().put(slot, v);
+  }
+
+  /** Retrieves the int at the specified slot (4-byte offset). */
+  public int getIntAt(int slot) {
+    return intBuffer().get(slot);
+  }
+
+  /** Puts a int at the specified slot (4-byte offset). */
+  public void setIntAt(int slot, int v) {
+    intBuffer().put(slot, v);
+  }
+
+  /** Retrieves the long at the specified slot (8-byte offset). */
+  public long getLongAt(int slot) {
+    return longBuffer().get(slot);
+  }
+
+  /** Puts a long at the specified slot (8-byte offset). */
+  public void setLongAt(int slot, long v) {
+    longBuffer().put(slot, v);
+  }
+
+  /** Retrieves the short at the specified slot (2-byte offset). */
+  public short getShortAt(int slot) {
+    return shortBuffer().get(slot);
+  }
+
+  /** Puts a short at the specified slot (2-byte offset). */
+  public void setShortAt(int slot, short v) {
+    shortBuffer().put(slot, v);
+  }
+
+  public void setBytesAt(int slot, byte[] v) {
+      for (int i = 0; i < v.length; i++) {
+        bb.put(slot++, v[i]);
+      }
+  }
+
+  public byte[] getBytesAt(int slot, byte[] v) {
+      for (int i = 0; i < v.length; i++) {
+        v[i] = bb.get(slot++);
+      }
+      return v;
+  }
+
+  public void setCharsAt(int slot, char[] v) {
+      for (int i = 0; i < v.length; i++) {
+        charBuffer().put(slot++, v[i]);
+      }
+  }
+
+  public char[] getCharsAt(int slot, char[] v) {
+      for (int i = 0; i < v.length; i++) {
+        v[i] = charBuffer().get(slot++);
+      }
+      return v;
+  }
+
+  public void setIntsAt(int slot, int[] v) {
+      for (int i = 0; i < v.length; i++) {
+        intBuffer().put(slot++, v[i]);
+      }
+  }
+
+  public int[] getIntsAt(int slot, int[] v) {
+      for (int i = 0; i < v.length; i++) {
+        v[i] = intBuffer().get(slot++);
+      }
+      return v;
+  }
+
+  public void setFloatsAt(int slot, float[] v) {
+      for (int i = 0; i < v.length; i++) {
+        floatBuffer().put(slot++, v[i]);
+      }
+  }
+
+  public float[] getFloatsAt(int slot, float[] v) {
+      for (int i = 0; i < v.length; i++) {
+        v[i] = floatBuffer().get(slot++);
+      }
+      return v;
+  }
+
+  public void setDoublesAt(int slot, double[] v) {
+      for (int i = 0; i < v.length; i++) {
+        doubleBuffer().put(slot++, v[i]);
+      }
+  }
+
+  public double[] getDoublesAt(int slot, double[] v) {
+      for (int i = 0; i < v.length; i++) {
+        v[i] = doubleBuffer().get(slot++);
+      }
+      return v;
+  }
+
+  //----------------------------------------------------------------------
+  // Internals only below this point
+  //
+
+  private CharBuffer charBuffer() {
+    if (cb == null) {
+      cb = bb.asCharBuffer();
+    }
+    return cb;
+  }
+
+  private DoubleBuffer doubleBuffer() {
+    if (db == null) {
+      db = bb.asDoubleBuffer();
+    }
+    return db;
+  }
+
+  private FloatBuffer floatBuffer() {
+    if (fb == null) {
+      fb = bb.asFloatBuffer();
+    }
+    return fb;
+  }
+
+  private IntBuffer intBuffer() {
+    if (ib == null) {
+      ib = bb.asIntBuffer();
+    }
+    return ib;
+  }
+
+  private LongBuffer longBuffer() {
+    if (lb == null) {
+      lb = bb.asLongBuffer();
+    }
+    return lb;
+  }
+
+  private ShortBuffer shortBuffer() {
+    if (sb == null) {
+      sb = bb.asShortBuffer();
+    }
+    return sb;
+  }
+}
diff --git a/src/java/com/jogamp/gluegen/runtime/UnixDynamicLinkerImpl.java b/src/java/com/jogamp/gluegen/runtime/UnixDynamicLinkerImpl.java
new file mode 100755
index 0000000..018f31b
--- /dev/null
+++ b/src/java/com/jogamp/gluegen/runtime/UnixDynamicLinkerImpl.java
@@ -0,0 +1,66 @@
+/* !---- DO NOT EDIT: This file autogenerated by com\sun\gluegen\JavaEmitter.java on Mon Jul 31 16:26:59 PDT 2006 ----! */
+
+package com.jogamp.gluegen.runtime;
+
+import com.jogamp.gluegen.runtime.*;
+
+public class UnixDynamicLinkerImpl implements DynamicLinker
+{
+
+  public static final int RTLD_LAZY = 0x00001;
+  public static final int RTLD_NOW = 0x00002;
+  public static final int RTLD_NOLOAD = 0x00004;
+  public static final int RTLD_GLOBAL = 0x00100;
+  public static final int RTLD_LOCAL = 0x00000;
+  public static final int RTLD_PARENT = 0x00200;
+  public static final int RTLD_GROUP = 0x00400;
+  public static final int RTLD_WORLD = 0x00800;
+  public static final int RTLD_NODELETE = 0x01000;
+  public static final int RTLD_FIRST = 0x02000;
+
+  /** Interface to C language function: <br> <code> int dlclose(void * ); </code>    */
+  private static native int dlclose(long arg0);
+
+  /** Interface to C language function: <br> <code> char *  dlerror(void); </code>    */
+  private static native java.lang.String dlerror();
+
+  /** Interface to C language function: <br> <code> void *  dlopen(const char * , int); </code>    */
+  private static native long dlopen(java.lang.String arg0, int arg1);
+
+  /** Interface to C language function: <br> <code> void *  dlsym(void * , const char * ); </code>    */
+  private static native long dlsym(long arg0, java.lang.String arg1);
+
+
+  // --- Begin CustomJavaCode .cfg declarations
+  public long openLibraryLocal(String pathname, boolean debug) {
+    // Note we use RTLD_GLOBAL visibility to _NOT_ allow this functionality to
+    // be used to pre-resolve dependent libraries of JNI code without
+    // requiring that all references to symbols in those libraries be
+    // looked up dynamically via the ProcAddressTable mechanism; in
+    // other words, one can actually link against the library instead of
+    // having to dlsym all entry points. System.loadLibrary() uses
+    // RTLD_LOCAL visibility so can't be used for this purpose.
+    return dlopen(pathname, RTLD_LAZY | RTLD_LOCAL);
+  }
+
+  public long openLibraryGlobal(String pathname, boolean debug) {
+    // Note we use RTLD_GLOBAL visibility to allow this functionality to
+    // be used to pre-resolve dependent libraries of JNI code without
+    // requiring that all references to symbols in those libraries be
+    // looked up dynamically via the ProcAddressTable mechanism; in
+    // other words, one can actually link against the library instead of
+    // having to dlsym all entry points. System.loadLibrary() uses
+    // RTLD_LOCAL visibility so can't be used for this purpose.
+    return dlopen(pathname, RTLD_LAZY | RTLD_GLOBAL);
+  }
+  
+  public long lookupSymbol(long libraryHandle, String symbolName) {
+    return dlsym(libraryHandle, symbolName);
+  }
+  
+  public void closeLibrary(long libraryHandle) {
+    dlclose(libraryHandle);
+  }
+  // ---- End CustomJavaCode .cfg declarations
+
+} // end of class UnixDynamicLinkerImpl
diff --git a/src/java/com/jogamp/gluegen/runtime/WindowsDynamicLinkerImpl.java b/src/java/com/jogamp/gluegen/runtime/WindowsDynamicLinkerImpl.java
new file mode 100755
index 0000000..87b9a37
--- /dev/null
+++ b/src/java/com/jogamp/gluegen/runtime/WindowsDynamicLinkerImpl.java
@@ -0,0 +1,49 @@
+/* !---- DO NOT EDIT: This file autogenerated by com\sun\gluegen\JavaEmitter.java on Tue May 27 02:37:55 PDT 2008 ----! */
+
+package com.jogamp.gluegen.runtime;
+
+import com.jogamp.gluegen.runtime.*;
+
+public class WindowsDynamicLinkerImpl implements DynamicLinker
+{
+
+
+  /** Interface to C language function: <br> <code> BOOL FreeLibrary(HANDLE hLibModule); </code>    */
+  private static native int FreeLibrary(long hLibModule);
+
+  /** Interface to C language function: <br> <code> DWORD GetLastError(void); </code>    */
+  private static native int GetLastError();
+
+  /** Interface to C language function: <br> <code> PROC GetProcAddressA(HANDLE hModule, LPCSTR lpProcName); </code>    */
+  private static native long GetProcAddressA(long hModule, java.lang.String lpProcName);
+
+  /** Interface to C language function: <br> <code> HANDLE LoadLibraryW(LPCWSTR lpLibFileName); </code>    */
+  private static native long LoadLibraryW(java.lang.String lpLibFileName);
+
+
+  // --- Begin CustomJavaCode .cfg declarations
+  public long openLibraryLocal(String libraryName, boolean debug) {
+    // How does that work under Windows ?
+    // Don't know .. so it's an alias for the time being
+    return openLibraryGlobal(libraryName, debug);
+  }
+  
+  public long openLibraryGlobal(String libraryName, boolean debug) {
+    long handle = LoadLibraryW(libraryName);
+    if(0==handle && debug) {
+        int err = GetLastError();
+        System.err.println("LoadLibraryW \""+libraryName+"\" failed, error code: 0x"+Integer.toHexString(err)+", "+err);
+    }
+    return handle;
+  }
+  
+  public long lookupSymbol(long libraryHandle, String symbolName) {
+    return GetProcAddressA(libraryHandle, symbolName);
+  }
+  
+  public void closeLibrary(long libraryHandle) {
+    FreeLibrary(libraryHandle);
+  }
+  // ---- End CustomJavaCode .cfg declarations
+
+} // end of class WindowsDynamicLinkerImpl
diff --git a/src/java/com/jogamp/gluegen/runtime/opengl/GLExtensionNames.java b/src/java/com/jogamp/gluegen/runtime/opengl/GLExtensionNames.java
new file mode 100644
index 0000000..b07a96f
--- /dev/null
+++ b/src/java/com/jogamp/gluegen/runtime/opengl/GLExtensionNames.java
@@ -0,0 +1,187 @@
+/*
+ * Copyright (c) 2003-2005 Sun Microsystems, Inc. All Rights Reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * 
+ * - Redistribution of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * 
+ * - Redistribution 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 Sun Microsystems, Inc. or the names of
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * 
+ * This software is provided "AS IS," without a warranty of any kind. ALL
+ * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
+ * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
+ * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+ * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
+ * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
+ * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
+ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+ * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
+ * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ * 
+ * You acknowledge that this software is not designed or intended for use
+ * in the design, construction, operation or maintenance of any nuclear
+ * facility.
+ * 
+ */
+
+package com.jogamp.gluegen.runtime.opengl;
+
+import java.util.*;
+import com.jogamp.gluegen.runtime.*;
+
+public class GLExtensionNames {
+    //GL_XYZ : GL_XYZ, GL_XYZ_GL2, GL_XYZ_ARB, GL_XYZ_OES, GL_XYZ_OML
+    //GL_XYZ : GL_XYZ, GL_GL2_XYZ, GL_ARB_XYZ, GL_OES_XYZ, GL_OML_XYZ
+    //
+    // Pass-1 Unify ARB extensions with the same value
+    // Pass-2 Unify vendor extensions, 
+    //        if exist as an ARB extension with the same value.
+    // Pass-3 Emit
+
+    public static final String[] extensionsARB = { "ARB", "GL2", "OES", "KHR", "OML" };
+    public static final String[] extensionsVEN = { "3DFX", 
+                                                   "AMD",
+                                                   "APPLE",
+                                                   "ATI",
+                                                   "EXT",
+                                                   "HP",
+                                                   "IBM",
+                                                   "MESA",
+                                                   "MESAX",
+                                                   "NV",
+                                                   "SGI",
+                                                   "SGIS",
+                                                   "SGIX",
+                                                   "SUN",
+                                                   "WIN"
+                                                   };
+
+
+    public static final boolean isGLFunction(String str) {
+        return str.startsWith("gl")  || /* str.startsWith("glu") || str.startsWith("glX") || */
+               str.startsWith("egl") || str.startsWith("wgl") || str.startsWith("agl") ||
+               str.startsWith("cgl") ;
+    }
+
+    public static final boolean isGLEnumeration(String str) {
+        return str.startsWith("GL_")  || str.startsWith("GLU_") || str.startsWith("GLX_") ||
+               str.startsWith("EGL_") || str.startsWith("WGL_") || str.startsWith("AGL_") ||
+               str.startsWith("CGL_") ;
+    }
+
+    public static final int getExtensionIdx(String[] extensions, String str, boolean isGLFunc) {
+        if(isGLFunc) {
+            for(int i = extensions.length - 1 ; i>=0 ; i--) {
+                if( str.endsWith(extensions[i]) ) {
+                    return i;
+                }
+            }
+        } else {
+            for(int i = extensions.length - 1 ; i>=0 ; i--) {
+                if( str.endsWith("_"+extensions[i]) ) {
+                    return i;
+                }
+            }
+        }
+        return -1;
+    }
+
+    public static final boolean isExtension(String[] extensions, String str, boolean isGLFunc) {
+        return getExtensionIdx(extensions, str, isGLFunc)>=0;
+    }
+
+    public static final String getExtensionSuffix(String str, boolean isGLFunc) {
+        int idx = getExtensionIdx(extensionsARB, str, isGLFunc);
+        if(idx>=0) {
+            return extensionsARB[idx];
+        }
+        idx = getExtensionIdx(extensionsVEN, str, isGLFunc);
+        if(idx>=0) {
+            return extensionsVEN[idx];
+        }
+        return null;
+    }
+
+    public static final String normalize(String[] extensions, String str, boolean isGLFunc) {
+        boolean touched = false;
+        for(int i = extensions.length - 1 ; !touched && i>=0 ; i--) {
+            if(isGLFunc) {
+                if(str.endsWith(extensions[i])) {
+                    // functions
+                    str = str.substring(0, str.length()-extensions[i].length());
+                    touched=true;
+                }
+            } else {
+                if(str.endsWith("_"+extensions[i])) {
+                    // enums
+                    str = str.substring(0, str.length()-1-extensions[i].length());
+                    touched=true;
+                }
+            }
+        }
+        return str;
+    }
+    public static final String normalizeARB(String str, boolean isGLFunc) {
+        return normalize(extensionsARB, str, isGLFunc);
+    }
+    public static final boolean isExtensionARB(String str, boolean isGLFunc) {
+        return isExtension(extensionsARB, str, isGLFunc);
+    }
+    public static final String normalizeVEN(String str, boolean isGLFunc) {
+        return normalize(extensionsVEN, str, isGLFunc);
+    }
+    public static final boolean isExtensionVEN(String str, boolean isGLFunc) {
+        return isExtension(extensionsVEN, str, isGLFunc);
+    }
+    public static final String normalize(String str, boolean isGLFunc) {
+        if (isExtensionARB(str, isGLFunc)) {
+            return normalizeARB(str, isGLFunc);
+        }
+        if (isExtensionVEN(str, isGLFunc)) {
+            return normalizeVEN(str, isGLFunc);
+        }
+        return str;
+    }
+    public static final boolean isExtension(String str, boolean isGLFunc) {
+        return isExtension(extensionsARB, str, isGLFunc) || 
+               isExtension(extensionsVEN, str, isGLFunc);
+    }
+
+    public static final int getFuncNamePermutationNumber(String name) {
+        if(isExtensionARB(name, true) || isExtensionVEN(name, true)) {
+            // no name permutation, if it's already a known extension
+            return 1;
+        }
+        return 1 + extensionsARB.length + extensionsVEN.length;
+    }
+
+    public static final String getFuncNamePermutation(String name, int i) {
+        // identity
+        if(i==0) {
+            return name;
+        }
+        if(0>i || i>=(1+extensionsARB.length + extensionsVEN.length)) {
+            throw new RuntimeException("Index out of range [0.."+(1+extensionsARB.length+extensionsVEN.length-1)+"]: "+i);
+        }
+        // ARB
+        i-=1;
+        if(i<extensionsARB.length) {
+            return name+extensionsARB[i];
+        }
+        // VEN
+        i-=extensionsARB.length;
+        return name+extensionsVEN[i];
+    }
+}
+
diff --git a/src/java/com/jogamp/gluegen/runtime/opengl/GLProcAddressHelper.java b/src/java/com/jogamp/gluegen/runtime/opengl/GLProcAddressHelper.java
new file mode 100644
index 0000000..7470c46
--- /dev/null
+++ b/src/java/com/jogamp/gluegen/runtime/opengl/GLProcAddressHelper.java
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2003-2005 Sun Microsystems, Inc. All Rights Reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * 
+ * - Redistribution of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * 
+ * - Redistribution 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 Sun Microsystems, Inc. or the names of
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * 
+ * This software is provided "AS IS," without a warranty of any kind. ALL
+ * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
+ * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
+ * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+ * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
+ * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
+ * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
+ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+ * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
+ * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ * 
+ * You acknowledge that this software is not designed or intended for use
+ * in the design, construction, operation or maintenance of any nuclear
+ * facility.
+ */
+
+package com.jogamp.gluegen.runtime.opengl;
+
+import com.jogamp.gluegen.runtime.*;
+
+// Debugging only
+import java.io.PrintStream;
+
+/** Helper class containing constants and methods to assist with the
+    manipulation of auto-generated ProcAddressTables. */
+
+public class GLProcAddressHelper extends ProcAddressHelper {
+
+  public static void resetProcAddressTable(Object table,
+                                           DynamicLookupHelper lookup) throws RuntimeException {
+    Class tableClass = table.getClass();
+    java.lang.reflect.Field[] fields = tableClass.getFields();
+    PrintStream dout = getDebugOutStream();
+    
+    if (DEBUG) {
+      dout.println("ProcAddressHelper.resetProcAddressTable(" + table.getClass().getName() + ")");
+    }
+    for (int i = 0; i < fields.length; ++i) {
+      String addressFieldName = fields[i].getName();
+      if (!addressFieldName.startsWith(ProcAddressHelper.PROCADDRESS_VAR_PREFIX)) {
+        // not a proc address variable
+        continue;
+      }
+      int startOfMethodName = ProcAddressHelper.PROCADDRESS_VAR_PREFIX.length();
+      String funcNameBase = addressFieldName.substring(startOfMethodName);
+      java.lang.reflect.Field addressField;
+      try {
+        addressField = fields[i];
+        assert(addressField.getType() == Long.TYPE);
+      } catch (Exception e) {
+        throw new RuntimeException("Can not get proper proc address field for method \"" +
+                                   funcNameBase + "\": Couldn't get field \"" + addressFieldName +
+                                   "\" in class " + tableClass.getName(), e);
+      }
+      long newProcAddress = 0;
+      int  funcNamePermNum = GLExtensionNames.getFuncNamePermutationNumber(funcNameBase);
+      String funcName = null;
+      for(int j = 0; 0==newProcAddress && j < funcNamePermNum; j++) {
+          funcName = GLExtensionNames.getFuncNamePermutation(funcNameBase, j);
+          try {
+            newProcAddress = lookup.dynamicLookupFunction(funcName);
+          } catch (Exception e) { 
+            if (DEBUG) {
+              dout.println(e);
+              e.printStackTrace();
+            }
+          }
+      } 
+      try {
+        // set the current value of the proc address variable in the table object
+        addressField.setLong(table, newProcAddress); 
+        if (DEBUG) {
+          dout.println("  " + addressField.getName() + " "+funcName+" -> 0x" + Long.toHexString(newProcAddress));
+        }
+      } catch (Exception e) {
+        throw new RuntimeException("Can not set proc address field for method \"" +
+                                   funcNameBase + "\": Couldn't set field \"" + addressFieldName +
+                                   "\" in class " + tableClass.getName(), e);
+      }
+    }
+    if (DEBUG) {
+      dout.flush();
+      if (DEBUG_PREFIX != null) {
+        dout.close();
+      }
+    }
+  }
+}
diff --git a/src/java/com/sun/gluegen/JavaConfiguration.java b/src/java/com/sun/gluegen/JavaConfiguration.java
index d5e71e2..3683e29 100644
--- a/src/java/com/sun/gluegen/JavaConfiguration.java
+++ b/src/java/com/sun/gluegen/JavaConfiguration.java
@@ -105,9 +105,9 @@ public class JavaConfiguration {
     /**
      * The package in which the generated glue code expects to find its
      * run-time helper classes (BufferFactory, CPU,
-     * StructAccessor). Defaults to "com.sun.gluegen.runtime".
+     * StructAccessor). Defaults to "com.jogamp.gluegen.runtime".
      */
-    private String gluegenRuntimePackage = "com.sun.gluegen.runtime";
+    private String gluegenRuntimePackage = "com.jogamp.gluegen.runtime";
 
     /**
      * The kind of exception raised by the generated code if run-time
@@ -309,7 +309,7 @@ public class JavaConfiguration {
 
     /** Returns the package in which the generated glue code expects to
     find its run-time helper classes (BufferFactory, CPU,
-    StructAccessor). Defaults to "com.sun.gluegen.runtime". */
+    StructAccessor). Defaults to "com.jogamp.gluegen.runtime". */
     public String gluegenRuntimePackage() {
         return gluegenRuntimePackage;
     }
diff --git a/src/java/com/sun/gluegen/JavaType.java b/src/java/com/sun/gluegen/JavaType.java
index 30f30a2..19ac945 100644
--- a/src/java/com/sun/gluegen/JavaType.java
+++ b/src/java/com/sun/gluegen/JavaType.java
@@ -194,10 +194,9 @@ public class JavaType {
     return nioLongBufferType;
   }
 
-  public static JavaType forNIOPointerBufferClass()
-  {
+  public static JavaType forNIOPointerBufferClass()  {
     if(nioPointerBufferType == null)
-        nioPointerBufferType = createForClass(com.sun.gluegen.runtime.PointerBuffer.class);
+        nioPointerBufferType = createForClass(com.jogamp.gluegen.runtime.PointerBuffer.class);
     return nioPointerBufferType;
   }
 
@@ -334,7 +333,7 @@ public class JavaType {
 
   public boolean isNIOBuffer() {
     return clazz != null && ( (java.nio.Buffer.class).isAssignableFrom(clazz) ||
-                              (com.sun.gluegen.runtime.PointerBuffer.class).isAssignableFrom(clazz) ) ;
+                              (com.jogamp.gluegen.runtime.PointerBuffer.class).isAssignableFrom(clazz) ) ;
   }
 
   public boolean isNIOByteBuffer() {
@@ -354,9 +353,8 @@ public class JavaType {
     return (clazz == java.nio.LongBuffer.class);
   }
 
-  public boolean isNIOPointerBuffer()
-  {
-    return (clazz == com.sun.gluegen.runtime.PointerBuffer.class);
+  public boolean isNIOPointerBuffer()  {
+    return (clazz == com.jogamp.gluegen.runtime.PointerBuffer.class);
   }
 
   public boolean isString() {
diff --git a/src/java/com/sun/gluegen/opengl/BuildComposablePipeline.java b/src/java/com/sun/gluegen/opengl/BuildComposablePipeline.java
index e83b43c..16accfe 100644
--- a/src/java/com/sun/gluegen/opengl/BuildComposablePipeline.java
+++ b/src/java/com/sun/gluegen/opengl/BuildComposablePipeline.java
@@ -374,7 +374,7 @@ public class BuildComposablePipeline
       CodeGenUtils.emitJavaHeaders(output, 
                   outputPackage,
                   outputClassName,
-                  "com.sun.gluegen.runtime", // FIXME: should make configurable
+                  "com.jogamp.gluegen.runtime", // FIXME: should make configurable
                   true,
                   importNames,
                   new String[] { "public" },
diff --git a/src/java/com/sun/gluegen/opengl/BuildStaticGLInfo.java b/src/java/com/sun/gluegen/opengl/BuildStaticGLInfo.java
index 8653b07..f7a7fe0 100644
--- a/src/java/com/sun/gluegen/opengl/BuildStaticGLInfo.java
+++ b/src/java/com/sun/gluegen/opengl/BuildStaticGLInfo.java
@@ -282,9 +282,9 @@ public class BuildStaticGLInfo
     output.println("  public static String getFunctionAssociation(String glFunctionName)");
     output.println("  {");
     output.println("    String mappedName = null;");
-    output.println("    int  funcNamePermNum = com.sun.gluegen.runtime.opengl.GLExtensionNames.getFuncNamePermutationNumber(glFunctionName);");
+    output.println("    int  funcNamePermNum = com.jogamp.gluegen.runtime.opengl.GLExtensionNames.getFuncNamePermutationNumber(glFunctionName);");
     output.println("    for(int i = 0; null==mappedName && i < funcNamePermNum; i++) {");
-    output.println("        String tmp = com.sun.gluegen.runtime.opengl.GLExtensionNames.getFuncNamePermutation(glFunctionName, i);");
+    output.println("        String tmp = com.jogamp.gluegen.runtime.opengl.GLExtensionNames.getFuncNamePermutation(glFunctionName, i);");
     output.println("        try {");
     output.println("          mappedName = (String)funcToAssocMap.get(tmp);");
     output.println("        } catch (Exception e) { }");
diff --git a/src/java/com/sun/gluegen/opengl/GLConfiguration.java b/src/java/com/sun/gluegen/opengl/GLConfiguration.java
index 5e7ef7a..19cf85a 100755
--- a/src/java/com/sun/gluegen/opengl/GLConfiguration.java
+++ b/src/java/com/sun/gluegen/opengl/GLConfiguration.java
@@ -44,7 +44,7 @@ import java.util.*;
 
 import com.sun.gluegen.*;
 import com.sun.gluegen.procaddress.*;
-import com.sun.gluegen.runtime.opengl.GLExtensionNames;
+import com.jogamp.gluegen.runtime.opengl.GLExtensionNames;
 
 public class GLConfiguration extends ProcAddressConfiguration {
   // The following data members support ignoring an entire extension at a time
diff --git a/src/java/com/sun/gluegen/opengl/GLEmitter.java b/src/java/com/sun/gluegen/opengl/GLEmitter.java
index ff307c4..e9ae750 100644
--- a/src/java/com/sun/gluegen/opengl/GLEmitter.java
+++ b/src/java/com/sun/gluegen/opengl/GLEmitter.java
@@ -45,7 +45,7 @@ import java.util.*;
 import com.sun.gluegen.*;
 import com.sun.gluegen.cgram.types.*;
 import com.sun.gluegen.procaddress.*;
-import com.sun.gluegen.runtime.opengl.GLExtensionNames;
+import com.jogamp.gluegen.runtime.opengl.GLExtensionNames;
 
 /**
  * A subclass of ProcAddressEmitter with special OpenGL-specific
@@ -433,12 +433,12 @@ public class GLEmitter extends ProcAddressEmitter {
     w.println("   *   it was statically linked.");
     w.println("   */");
     w.println("  public long getAddressFor(String functionNameUsr) {");
-    w.println("    String functionNameBase = com.sun.gluegen.runtime.opengl.GLExtensionNames.normalizeVEN(com.sun.gluegen.runtime.opengl.GLExtensionNames.normalizeARB(functionNameUsr, true), true);");
+    w.println("    String functionNameBase = com.jogamp.gluegen.runtime.opengl.GLExtensionNames.normalizeVEN(com.jogamp.gluegen.runtime.opengl.GLExtensionNames.normalizeARB(functionNameUsr, true), true);");
     w.println("    String addressFieldNameBase = " + getProcAddressConfig().gluegenRuntimePackage() + ".ProcAddressHelper.PROCADDRESS_VAR_PREFIX + functionNameBase;");
     w.println("    java.lang.reflect.Field addressField = null;");
-    w.println("    int  funcNamePermNum = com.sun.gluegen.runtime.opengl.GLExtensionNames.getFuncNamePermutationNumber(functionNameBase);");
+    w.println("    int  funcNamePermNum = com.jogamp.gluegen.runtime.opengl.GLExtensionNames.getFuncNamePermutationNumber(functionNameBase);");
     w.println("    for(int i = 0; null==addressField && i < funcNamePermNum; i++) {");
-    w.println("        String addressFieldName = com.sun.gluegen.runtime.opengl.GLExtensionNames.getFuncNamePermutation(addressFieldNameBase, i);");
+    w.println("        String addressFieldName = com.jogamp.gluegen.runtime.opengl.GLExtensionNames.getFuncNamePermutation(addressFieldNameBase, i);");
     w.println("        try {");
     w.println("          addressField = getClass().getField(addressFieldName);");
     w.println("        } catch (Exception e) { }");
diff --git a/src/java/com/sun/gluegen/procaddress/ProcAddressEmitter.java b/src/java/com/sun/gluegen/procaddress/ProcAddressEmitter.java
index 871dc5e..98ff860 100755
--- a/src/java/com/sun/gluegen/procaddress/ProcAddressEmitter.java
+++ b/src/java/com/sun/gluegen/procaddress/ProcAddressEmitter.java
@@ -44,7 +44,7 @@ import java.text.MessageFormat;
 import java.util.*;
 import com.sun.gluegen.*;
 import com.sun.gluegen.cgram.types.*;
-import com.sun.gluegen.runtime.*;
+import com.jogamp.gluegen.runtime.*;
 
 /**
  * A subclass of JavaEmitter that modifies the normal emission of C
@@ -337,7 +337,7 @@ public class ProcAddressEmitter extends JavaEmitter
     tableWriter.println(" * pointer is 0, the function is considered to be unavailable and can");
     tableWriter.println(" * not be called.");
     tableWriter.println(" */");
-    tableWriter.println("public class " + tableClassName + " implements com.sun.gluegen.runtime.ProcAddressTable");
+    tableWriter.println("public class " + tableClassName + " implements com.jogamp.gluegen.runtime.ProcAddressTable");
     tableWriter.println("{");
 
     for (Iterator iter = getProcAddressConfig().getForceProcAddressGen().iterator(); iter.hasNext(); ) {
diff --git a/src/java/com/sun/gluegen/runtime/BufferFactory.java.javame_cdc_fp b/src/java/com/sun/gluegen/runtime/BufferFactory.java.javame_cdc_fp
deleted file mode 100755
index 822d62d..0000000
--- a/src/java/com/sun/gluegen/runtime/BufferFactory.java.javame_cdc_fp
+++ /dev/null
@@ -1,267 +0,0 @@
-/*
- * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- * 
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * 
- * - Redistribution of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * 
- * - Redistribution 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 Sun Microsystems, Inc. or the names of
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * 
- * This software is provided "AS IS," without a warranty of any kind. ALL
- * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
- * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
- * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
- * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
- * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
- * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
- * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
- * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
- * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
- * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- * 
- * You acknowledge that this software is not designed or intended for use
- * in the design, construction, operation or maintenance of any nuclear
- * facility.
- * 
- * Sun gratefully acknowledges that this software was originally authored
- * and developed by Kenneth Bradley Russell and Christopher John Kline.
- */
-
-package com.sun.gluegen.runtime;
-
-import java.nio.*;
-
-public class BufferFactory {
-  public static final int SIZEOF_BYTE = 1;
-  public static final int SIZEOF_SHORT = 2;
-  public static final int SIZEOF_CHAR = 2;
-  public static final int SIZEOF_INT = 4;
-  public static final int SIZEOF_FLOAT = 4;
-  public static final int SIZEOF_LONG = 8;
-  public static final int SIZEOF_DOUBLE = 8;
-
-  private static final boolean isLittleEndian;
-
-  static {
-    ByteBuffer tst_b = BufferFactory.newDirectByteBuffer(BufferFactory.SIZEOF_INT); // 32bit in native order
-    IntBuffer tst_i = tst_b.asIntBuffer();
-    ShortBuffer tst_s = tst_b.asShortBuffer();
-    tst_i.put(0, 0x0A0B0C0D);
-    isLittleEndian = 0x0C0D == tst_s.get(0) ;
-  }
-
-  public static boolean isLittleEndian() {
-    return isLittleEndian;
-  }
-
-  /** Helper routine to create a direct ByteBuffer with native order */
-  public static ByteBuffer newDirectByteBuffer(int size) {
-    return nativeOrder(ByteBuffer.allocateDirect(size));
-  }
-
-  /** Helper routine to set a ByteBuffer to the native byte order, if
-      that operation is supported by the underlying NIO
-      implementation. */
-  public static ByteBuffer nativeOrder(ByteBuffer buf) {
-    // JSR 239 does not support the ByteOrder class or the order methods. The initial order of a byte buffer is the platform byte order.
-    return buf;
-  }
-
-  /** Helper routine to tell whether a buffer is direct or not. Null
-      pointers are considered NOT direct. isDirect() should really be
-      public in Buffer and not replicated in all subclasses. */
-  public static boolean isDirect(Object buf) {
-    if (buf == null) {
-      return true;
-    }
-    if (buf instanceof ByteBuffer) {
-      return ((ByteBuffer) buf).isDirect();
-    } else if (buf instanceof FloatBuffer) {
-      return ((FloatBuffer) buf).isDirect();
-    } else if (buf instanceof ShortBuffer) {
-      return ((ShortBuffer) buf).isDirect();
-    } else if (buf instanceof IntBuffer) {
-      return ((IntBuffer) buf).isDirect();
-    } else if (buf instanceof PointerBuffer) {
-      return ((PointerBuffer) buf).isDirect();
-    }
-    throw new RuntimeException("Unexpected buffer type " + buf.getClass().getName());
-  }
-
-
-  /** Helper routine to get the Buffer byte offset by taking into
-      account the Buffer position and the underlying type.  This is
-      the total offset for Direct Buffers.  */
-
-  public static int getDirectBufferByteOffset(Object buf) {
-    if(buf == null) {
-      return 0;
-    }
-    if(buf instanceof Buffer) {
-        int pos = ((Buffer)buf).position();
-        if(buf instanceof ByteBuffer) {
-          return pos;
-        } else if (buf instanceof FloatBuffer) {
-          return pos * SIZEOF_FLOAT;
-        } else if (buf instanceof IntBuffer) {
-          return pos * SIZEOF_INT;
-        } else if (buf instanceof ShortBuffer) {
-          return pos * SIZEOF_SHORT;
-        }
-    } else if (buf instanceof PointerBuffer) {
-      return (((PointerBuffer)buf).position() * SIZEOF_LONG);
-    } 
-
-    throw new RuntimeException("Disallowed array backing store type in buffer "
-                               + buf.getClass().getName());
-  }
-
-
-  /** Helper routine to return the array backing store reference from
-      a Buffer object.  */
-
-   public static Object getArray(Object buf) {
-     if (buf == null) {
-       return null;
-     }
-     if(buf instanceof ByteBuffer) {
-       return ((ByteBuffer) buf).array();
-     } else if (buf instanceof FloatBuffer) {
-       return ((FloatBuffer) buf).array();
-     } else if (buf instanceof IntBuffer) {
-       return ((IntBuffer) buf).array();
-     } else if (buf instanceof ShortBuffer) { 
-       return ((ShortBuffer) buf).array();
-     } else if (buf instanceof ShortBuffer) { 
-       return ((ShortBuffer) buf).array();
-     } else if (buf instanceof PointerBuffer) { 
-       return ((PointerBuffer) buf).array();
-     }
-
-     throw new RuntimeException("Disallowed array backing store type in buffer "
-                                + buf.getClass().getName());
-   } 
-
-
-  /** Helper routine to get the full byte offset from the beginning of
-      the array that is the storage for the indirect Buffer
-      object.  The array offset also includes the position offset 
-      within the buffer, in addition to any array offset. */
-
-  public static int getIndirectBufferByteOffset(Object buf) {
-    if(buf == null) {
-      return 0;
-    }
-    if(buf instanceof Buffer) {
-        int pos = ((Buffer)buf).position();
-        if(buf instanceof ByteBuffer) {
-          return (((ByteBuffer)buf).arrayOffset() + pos);
-        } else if(buf instanceof FloatBuffer) {
-          return (SIZEOF_FLOAT*(((FloatBuffer)buf).arrayOffset() + pos));
-        } else if(buf instanceof IntBuffer) {
-          return (SIZEOF_INT*(((IntBuffer)buf).arrayOffset() + pos));
-        } else if(buf instanceof ShortBuffer) {
-          return (SIZEOF_SHORT*(((ShortBuffer)buf).arrayOffset() + pos));
-        }
-    } else if(buf instanceof PointerBuffer) {
-        return (SIZEOF_LONG*(((PointerBuffer)buf).arrayOffset() + ((PointerBuffer)buf).position()));
-    }
-
-    throw new RuntimeException("Unknown buffer type " + buf.getClass().getName());
-  }
-
-  public static void rangeCheck(byte[] array, int offset, int minElementsRemaining) {
-    if (array == null) {
-      return;
-    }
-
-    if (array.length < offset + minElementsRemaining) {
-      throw new ArrayIndexOutOfBoundsException("Required " + minElementsRemaining + " elements in array, only had " + (array.length - offset));
-    }
-  }
-
-  public static void rangeCheck(char[] array, int offset, int minElementsRemaining) {
-    if (array == null) {
-      return;
-    }
-
-    if (array.length < offset + minElementsRemaining) {
-      throw new ArrayIndexOutOfBoundsException("Required " + minElementsRemaining + " elements in array, only had " + (array.length - offset));
-    }
-  }
-
-  public static void rangeCheck(short[] array, int offset, int minElementsRemaining) {
-    if (array == null) {
-      return;
-    }
-
-    if (array.length < offset + minElementsRemaining) {
-      throw new ArrayIndexOutOfBoundsException("Required " + minElementsRemaining + " elements in array, only had " + (array.length - offset));
-    }
-  }
-
-  public static void rangeCheck(int[] array, int offset, int minElementsRemaining) {
-    if (array == null) {
-      return;
-    }
-
-    if (array.length < offset + minElementsRemaining) {
-      throw new ArrayIndexOutOfBoundsException("Required " + minElementsRemaining + " elements in array, only had " + (array.length - offset));
-    }
-  }
-
-  public static void rangeCheck(float[] array, int offset, int minElementsRemaining) {
-    if (array == null) {
-      return;
-    }
-
-    if (array.length < offset + minElementsRemaining) {
-      throw new ArrayIndexOutOfBoundsException("Required " + minElementsRemaining + " elements in array, only had " + (array.length - offset));
-    }
-  }
-
-  public static void rangeCheck(Buffer buffer, int minElementsRemaining) {
-    if (buffer == null) {
-      return;
-    }
-
-    if (buffer.remaining() < minElementsRemaining) {
-      throw new IndexOutOfBoundsException("Required " + minElementsRemaining + " remaining elements in buffer, only had " + buffer.remaining());
-    }
-  }
-
-  public static void rangeCheckBytes(Object buffer, int minBytesRemaining) {
-    if (buffer == null) {
-      return;
-    }
-
-    int bytesRemaining = 0;
-    if (buffer instanceof Buffer) {
-        int elementsRemaining = ((Buffer)buffer).remaining();
-        if (buffer instanceof ByteBuffer) {
-          bytesRemaining = elementsRemaining;
-        } else if (buffer instanceof FloatBuffer) {
-          bytesRemaining = elementsRemaining * SIZEOF_FLOAT;
-        } else if (buffer instanceof IntBuffer) {
-          bytesRemaining = elementsRemaining * SIZEOF_INT;
-        } else if (buffer instanceof ShortBuffer) {
-          bytesRemaining = elementsRemaining * SIZEOF_SHORT;
-        }
-    } else if (buffer instanceof PointerBuffer) {
-      bytesRemaining = ((PointerBuffer)buffer).remaining() * SIZEOF_LONG;
-    }
-    if (bytesRemaining < minBytesRemaining) {
-      throw new IndexOutOfBoundsException("Required " + minBytesRemaining + " remaining bytes in buffer, only had " + bytesRemaining);
-    }
-  }
-}
diff --git a/src/java/com/sun/gluegen/runtime/BufferFactory.java.javase b/src/java/com/sun/gluegen/runtime/BufferFactory.java.javase
deleted file mode 100755
index 60a79c3..0000000
--- a/src/java/com/sun/gluegen/runtime/BufferFactory.java.javase
+++ /dev/null
@@ -1,317 +0,0 @@
-/*
- * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- * 
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * 
- * - Redistribution of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * 
- * - Redistribution 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 Sun Microsystems, Inc. or the names of
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * 
- * This software is provided "AS IS," without a warranty of any kind. ALL
- * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
- * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
- * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
- * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
- * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
- * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
- * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
- * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
- * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
- * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- * 
- * You acknowledge that this software is not designed or intended for use
- * in the design, construction, operation or maintenance of any nuclear
- * facility.
- * 
- * Sun gratefully acknowledges that this software was originally authored
- * and developed by Kenneth Bradley Russell and Christopher John Kline.
- */
-
-package com.sun.gluegen.runtime;
-
-import java.nio.*;
-
-public class BufferFactory {
-  public static final int SIZEOF_BYTE = 1;
-  public static final int SIZEOF_SHORT = 2;
-  public static final int SIZEOF_CHAR = 2;
-  public static final int SIZEOF_INT = 4;
-  public static final int SIZEOF_FLOAT = 4;
-  public static final int SIZEOF_LONG = 8;
-  public static final int SIZEOF_DOUBLE = 8;
-
-  private static final boolean isLittleEndian;
-
-  static {
-    ByteBuffer tst_b = BufferFactory.newDirectByteBuffer(BufferFactory.SIZEOF_INT); // 32bit in native order
-    IntBuffer tst_i = tst_b.asIntBuffer();
-    ShortBuffer tst_s = tst_b.asShortBuffer();
-    tst_i.put(0, 0x0A0B0C0D);
-    isLittleEndian = 0x0C0D == tst_s.get(0) ;
-  }
-
-  public static boolean isLittleEndian() {
-    return isLittleEndian;
-  }
-
-  /** Helper routine to create a direct ByteBuffer with native order */
-  public static ByteBuffer newDirectByteBuffer(int size) {
-    return nativeOrder(ByteBuffer.allocateDirect(size));
-  }
-
-  /** Helper routine to set a ByteBuffer to the native byte order, if
-      that operation is supported by the underlying NIO
-      implementation. */
-  public static ByteBuffer nativeOrder(ByteBuffer buf) {
-    return buf.order(ByteOrder.nativeOrder());
-  }
-
-  /** Helper routine to tell whether a buffer is direct or not. Null
-      pointers are considered NOT direct. isDirect() should really be
-      public in Buffer and not replicated in all subclasses. */
-  public static boolean isDirect(Object buf) {
-    if (buf == null) {
-      return true;
-    }
-    if (buf instanceof ByteBuffer) {
-      return ((ByteBuffer) buf).isDirect();
-    } else if (buf instanceof FloatBuffer) {
-      return ((FloatBuffer) buf).isDirect();
-    } else if (buf instanceof DoubleBuffer) {
-      return ((DoubleBuffer) buf).isDirect();
-    } else if (buf instanceof CharBuffer) {
-      return ((CharBuffer) buf).isDirect();
-    } else if (buf instanceof ShortBuffer) {
-      return ((ShortBuffer) buf).isDirect();
-    } else if (buf instanceof IntBuffer) {
-      return ((IntBuffer) buf).isDirect();
-    } else if (buf instanceof LongBuffer) {
-      return ((LongBuffer) buf).isDirect();
-    } else if (buf instanceof PointerBuffer) {
-      return ((PointerBuffer) buf).isDirect();
-    }
-    throw new RuntimeException("Unexpected buffer type " + buf.getClass().getName());
-  }
-
-
-  /** Helper routine to get the Buffer byte offset by taking into
-      account the Buffer position and the underlying type.  This is
-      the total offset for Direct Buffers.  */
-
-  public static int getDirectBufferByteOffset(Object buf) {
-    if(buf == null) {
-      return 0;
-    }
-    if(buf instanceof Buffer) {
-        int pos = ((Buffer)buf).position();
-        if(buf instanceof ByteBuffer) {
-          return pos;
-        } else if (buf instanceof FloatBuffer) {
-          return pos * SIZEOF_FLOAT;
-        } else if (buf instanceof IntBuffer) {
-          return pos * SIZEOF_INT;
-        } else if (buf instanceof ShortBuffer) {
-          return pos * SIZEOF_SHORT;
-        } else if (buf instanceof DoubleBuffer) {
-          return pos * SIZEOF_DOUBLE;
-        } else if (buf instanceof LongBuffer) {
-          return pos * SIZEOF_LONG;
-        } else if (buf instanceof CharBuffer) {
-          return pos * SIZEOF_CHAR;
-        }
-    } else if (buf instanceof PointerBuffer) {
-      PointerBuffer pb = (PointerBuffer)buf;
-      return pb.position() * pb.elementSize();
-    } 
-
-    throw new RuntimeException("Disallowed array backing store type in buffer "
-                               + buf.getClass().getName());
-  }
-
-
-  /** Helper routine to return the array backing store reference from
-      a Buffer object.  */
-
-   public static Object getArray(Object buf) {
-     if (buf == null) {
-       return null;
-     }
-     if(buf instanceof ByteBuffer) {
-       return ((ByteBuffer) buf).array();
-     } else if (buf instanceof FloatBuffer) {
-       return ((FloatBuffer) buf).array();
-     } else if (buf instanceof IntBuffer) {
-       return ((IntBuffer) buf).array();
-     } else if (buf instanceof ShortBuffer) { 
-       return ((ShortBuffer) buf).array();
-     } else if (buf instanceof DoubleBuffer) {
-       return ((DoubleBuffer) buf).array();
-     } else if (buf instanceof LongBuffer) {
-       return ((LongBuffer) buf).array();
-     } else if (buf instanceof CharBuffer) { 
-       return ((CharBuffer) buf).array();
-     } else if (buf instanceof PointerBuffer) { 
-       return ((PointerBuffer) buf).array();
-     }
-
-     throw new RuntimeException("Disallowed array backing store type in buffer "
-                                + buf.getClass().getName());
-   } 
-
-
-  /** Helper routine to get the full byte offset from the beginning of
-      the array that is the storage for the indirect Buffer
-      object.  The array offset also includes the position offset 
-      within the buffer, in addition to any array offset. */
-
-  public static int getIndirectBufferByteOffset(Object buf) {
-    if(buf == null) {
-      return 0;
-    }
-    if (buf instanceof Buffer) {
-        int pos = ((Buffer)buf).position();
-        if(buf instanceof ByteBuffer) {
-          return (((ByteBuffer)buf).arrayOffset() + pos);
-        } else if(buf instanceof FloatBuffer) {
-          return (SIZEOF_FLOAT*(((FloatBuffer)buf).arrayOffset() + pos));
-        } else if(buf instanceof IntBuffer) {
-          return (SIZEOF_INT*(((IntBuffer)buf).arrayOffset() + pos));
-        } else if(buf instanceof ShortBuffer) {
-          return (SIZEOF_SHORT*(((ShortBuffer)buf).arrayOffset() + pos));
-        } else if(buf instanceof DoubleBuffer) {
-          return (SIZEOF_DOUBLE*(((DoubleBuffer)buf).arrayOffset() + pos));
-        } else if(buf instanceof LongBuffer) {
-          return (SIZEOF_LONG*(((LongBuffer)buf).arrayOffset() + pos));
-        } else if(buf instanceof CharBuffer) {
-          return (SIZEOF_CHAR*(((CharBuffer)buf).arrayOffset() + pos));
-        }
-    } else if(buf instanceof PointerBuffer) {
-        PointerBuffer pb = (PointerBuffer)buf;
-        return pb.elementSize()*(pb.arrayOffset() + pb.position());
-    }
-
-    throw new RuntimeException("Unknown buffer type " + buf.getClass().getName());
-  }
-
-  public static void rangeCheck(byte[] array, int offset, int minElementsRemaining) {
-    if (array == null) {
-      return;
-    }
-
-    if (array.length < offset + minElementsRemaining) {
-      throw new ArrayIndexOutOfBoundsException("Required " + minElementsRemaining + " elements in array, only had " + (array.length - offset));
-    }
-  }
-
-  public static void rangeCheck(char[] array, int offset, int minElementsRemaining) {
-    if (array == null) {
-      return;
-    }
-
-    if (array.length < offset + minElementsRemaining) {
-      throw new ArrayIndexOutOfBoundsException("Required " + minElementsRemaining + " elements in array, only had " + (array.length - offset));
-    }
-  }
-
-  public static void rangeCheck(short[] array, int offset, int minElementsRemaining) {
-    if (array == null) {
-      return;
-    }
-
-    if (array.length < offset + minElementsRemaining) {
-      throw new ArrayIndexOutOfBoundsException("Required " + minElementsRemaining + " elements in array, only had " + (array.length - offset));
-    }
-  }
-
-  public static void rangeCheck(int[] array, int offset, int minElementsRemaining) {
-    if (array == null) {
-      return;
-    }
-
-    if (array.length < offset + minElementsRemaining) {
-      throw new ArrayIndexOutOfBoundsException("Required " + minElementsRemaining + " elements in array, only had " + (array.length - offset));
-    }
-  }
-
-  public static void rangeCheck(long[] array, int offset, int minElementsRemaining) {
-    if (array == null) {
-      return;
-    }
-    
-    if (array.length < offset + minElementsRemaining) {
-      throw new ArrayIndexOutOfBoundsException("Required " + minElementsRemaining + " elements in array, only had " + (array.length - offset));
-    }
-  }
-
-  public static void rangeCheck(float[] array, int offset, int minElementsRemaining) {
-    if (array == null) {
-      return;
-    }
-
-    if (array.length < offset + minElementsRemaining) {
-      throw new ArrayIndexOutOfBoundsException("Required " + minElementsRemaining + " elements in array, only had " + (array.length - offset));
-    }
-  }
-
-  public static void rangeCheck(double[] array, int offset, int minElementsRemaining) {
-    if (array == null) {
-      return;
-    }
-    
-    if (array.length < offset + minElementsRemaining) {
-      throw new ArrayIndexOutOfBoundsException("Required " + minElementsRemaining + " elements in array, only had " + (array.length - offset));
-    }
-  }
-
-  public static void rangeCheck(Buffer buffer, int minElementsRemaining) {
-    if (buffer == null) {
-      return;
-    }
-
-    if (buffer.remaining() < minElementsRemaining) {
-      throw new IndexOutOfBoundsException("Required " + minElementsRemaining + " remaining elements in buffer, only had " + buffer.remaining());
-    }
-  }
-
-  public static void rangeCheckBytes(Object buffer, int minBytesRemaining) {
-    if (buffer == null) {
-      return;
-    }
-
-    int bytesRemaining = 0;
-    if (buffer instanceof Buffer) {
-        int elementsRemaining = ((Buffer)buffer).remaining();
-        if (buffer instanceof ByteBuffer) {
-          bytesRemaining = elementsRemaining;
-        } else if (buffer instanceof FloatBuffer) {
-          bytesRemaining = elementsRemaining * SIZEOF_FLOAT;
-        } else if (buffer instanceof IntBuffer) {
-          bytesRemaining = elementsRemaining * SIZEOF_INT;
-        } else if (buffer instanceof ShortBuffer) {
-          bytesRemaining = elementsRemaining * SIZEOF_SHORT;
-        } else if (buffer instanceof DoubleBuffer) {
-          bytesRemaining = elementsRemaining * SIZEOF_DOUBLE;
-        } else if (buffer instanceof LongBuffer) {
-          bytesRemaining = elementsRemaining * SIZEOF_LONG;
-        } else if (buffer instanceof CharBuffer) {
-          bytesRemaining = elementsRemaining * SIZEOF_CHAR;
-        }
-    } else if (buffer instanceof PointerBuffer) {
-      PointerBuffer pb = (PointerBuffer)buffer;
-      bytesRemaining = pb.remaining() * pb.elementSize();
-    }
-    if (bytesRemaining < minBytesRemaining) {
-      throw new IndexOutOfBoundsException("Required " + minBytesRemaining + " remaining bytes in buffer, only had " + bytesRemaining);
-    }
-  }
-}
diff --git a/src/java/com/sun/gluegen/runtime/BufferFactoryInternal.java b/src/java/com/sun/gluegen/runtime/BufferFactoryInternal.java
deleted file mode 100755
index 7a0e6a8..0000000
--- a/src/java/com/sun/gluegen/runtime/BufferFactoryInternal.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
-
- * Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
- * 
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * 
- * - Redistribution of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * 
- * - Redistribution 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 Sun Microsystems, Inc. or the names of
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * 
- * This software is provided "AS IS," without a warranty of any kind. ALL
- * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
- * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
- * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
- * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
- * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
- * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
- * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
- * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
- * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
- * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- * 
- * You acknowledge that this software is not designed or intended for use
- * in the design, construction, operation or maintenance of any nuclear
- * facility.
- * 
- * Sun gratefully acknowledges that this software was originally authored
- * and developed by Kenneth Bradley Russell and Christopher John Kline.
- */
-
-package com.sun.gluegen.runtime;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.nio.*;
-import sun.misc.Unsafe;
-
-public class BufferFactoryInternal {
-  private static final long        addressFieldOffset;
-  private static final Constructor directByteBufferConstructor;
-
-  static {
-    try {
-      Field f = Buffer.class.getDeclaredField("address");
-      addressFieldOffset = UnsafeAccess.getUnsafe().objectFieldOffset(f);
-
-      Class directByteBufferClass = Class.forName("java.nio.DirectByteBuffer");
-      directByteBufferConstructor = directByteBufferClass.getDeclaredConstructor(new Class[] { Long.TYPE, Integer.TYPE });
-      directByteBufferConstructor.setAccessible(true);
-    } catch (Exception e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  public static long getDirectBufferAddress(Buffer buf) {
-    return ((buf == null) ? 0 : UnsafeAccess.getUnsafe().getLong(buf, addressFieldOffset));
-  }
-
-  public static ByteBuffer newDirectByteBuffer(long address, int capacity) {
-    try {
-      if (address == 0) {
-        return null;
-      }
-      return (ByteBuffer) directByteBufferConstructor.newInstance(new Object[] { new Long(address), new Integer(capacity) });
-    } catch (Exception e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  public static long newCString(String str) {
-    byte[] strBytes = str.getBytes();
-    long   strBlock = UnsafeAccess.getUnsafe().allocateMemory(strBytes.length+1);
-    for (int i = 0; i < strBytes.length; i++) {
-      UnsafeAccess.getUnsafe().putByte(strBlock+i, strBytes[i]);
-    }
-    UnsafeAccess.getUnsafe().putByte(strBlock+strBytes.length, (byte)0); // null termination
-    return strBlock;
-  }
-
-  public static void freeCString(long cStr) {
-    UnsafeAccess.getUnsafe().freeMemory(cStr);
-  }
-
-  public static String newJavaString(long cStr) {
-    if (cStr == 0) {
-      return null;
-    }
-    int numChars = 0;
-    while (UnsafeAccess.getUnsafe().getByte(cStr + numChars) != 0) {
-      ++numChars;
-    }
-    byte[] bytes = new byte[numChars];
-    for (int i = 0; i < numChars; i++) {
-      bytes[i] = UnsafeAccess.getUnsafe().getByte(cStr + i);
-    }
-    return new String(bytes);
-  }
-
-  public static int arrayBaseOffset(Object array) {
-    return UnsafeAccess.getUnsafe().arrayBaseOffset(array.getClass());
-  }
-  public static int arrayIndexScale(Object array) {
-    return UnsafeAccess.getUnsafe().arrayIndexScale(array.getClass());
-  }
-}
diff --git a/src/java/com/sun/gluegen/runtime/CPU.java b/src/java/com/sun/gluegen/runtime/CPU.java
deleted file mode 100755
index 8c6d500..0000000
--- a/src/java/com/sun/gluegen/runtime/CPU.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright (c) 2005 Sun Microsystems, Inc. All Rights Reserved.
- * 
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * 
- * - Redistribution of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * 
- * - Redistribution 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 Sun Microsystems, Inc. or the names of
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * 
- * This software is provided "AS IS," without a warranty of any kind. ALL
- * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
- * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
- * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
- * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
- * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
- * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
- * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
- * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
- * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
- * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- * 
- * You acknowledge that this software is not designed or intended for use
- * in the design, construction, operation or maintenance of any nuclear
- * facility.
- * 
- * Sun gratefully acknowledges that this software was originally authored
- * and developed by Kenneth Bradley Russell and Christopher John Kline.
- */
-
-package com.sun.gluegen.runtime;
-
-/** Provides information to autogenerated struct accessors about what
-    kind of data model (32- or 64-bit) is being used by the currently
-    running process. */
-
-public class CPU {
-
-  private final static boolean is32Bit;
-
-  static {
-
-    NativeLibrary.ensureNativeLibLoaded();
-
-    // Try to use Sun's sun.arch.data.model first ..
-    int bits = getPointerSizeInBits();
-    if ( 32 == bits || 64 == bits ) {
-        is32Bit = ( 32 == bits );
-    }else {
-        // We don't seem to need an AccessController.doPrivileged() block
-        // here as these system properties are visible even to unsigned
-        // applets
-        // Note: this code is replicated in StructLayout.java
-        String os = System.getProperty("os.name").toLowerCase();
-        String cpu = System.getProperty("os.arch").toLowerCase();
-
-        if ((os.startsWith("windows") && cpu.equals("x86")) ||
-            (os.startsWith("windows") && cpu.equals("arm")) ||
-            (os.startsWith("linux") && cpu.equals("i386")) ||
-            (os.startsWith("linux") && cpu.equals("x86")) ||
-            (os.startsWith("mac os") && cpu.equals("ppc")) ||
-            (os.startsWith("mac os") && cpu.equals("i386")) ||
-            (os.startsWith("darwin") && cpu.equals("ppc")) ||
-            (os.startsWith("darwin") && cpu.equals("i386")) ||
-            (os.startsWith("sunos") && cpu.equals("sparc")) ||
-            (os.startsWith("sunos") && cpu.equals("x86")) ||
-            (os.startsWith("freebsd") && cpu.equals("i386")) ||
-            (os.startsWith("hp-ux") && cpu.equals("pa_risc2.0"))) {
-          is32Bit = true;
-        }else if ((os.startsWith("windows") && cpu.equals("amd64")) ||
-                  (os.startsWith("linux") && cpu.equals("amd64")) ||
-                  (os.startsWith("linux") && cpu.equals("x86_64")) ||
-                  (os.startsWith("linux") && cpu.equals("ia64")) ||
-                  (os.startsWith("mac os") && cpu.equals("x86_64")) ||
-                  (os.startsWith("darwin") && cpu.equals("x86_64")) ||
-                  (os.startsWith("sunos") && cpu.equals("sparcv9")) ||
-                  (os.startsWith("sunos") && cpu.equals("amd64"))) {
-          is32Bit = false;
-        }else{
-          throw new RuntimeException("Please port CPU detection (32/64 bit) to your platform (" + os + "/" + cpu + ")");
-        }
-    }
-  }
-
-  public static boolean is32Bit() {
-    return is32Bit;
-  }
-
-  public static native int getPointerSizeInBits();
-
-}
diff --git a/src/java/com/sun/gluegen/runtime/DynamicLinker.java b/src/java/com/sun/gluegen/runtime/DynamicLinker.java
deleted file mode 100755
index 871be04..0000000
--- a/src/java/com/sun/gluegen/runtime/DynamicLinker.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
- * 
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * 
- * - Redistribution of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * 
- * - Redistribution 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 Sun Microsystems, Inc. or the names of
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * 
- * This software is provided "AS IS," without a warranty of any kind. ALL
- * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
- * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
- * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
- * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
- * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
- * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
- * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
- * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
- * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
- * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- * 
- * You acknowledge that this software is not designed or intended for use
- * in the design, construction, operation or maintenance of any nuclear
- * facility.
- * 
- * Sun gratefully acknowledges that this software was originally authored
- * and developed by Kenneth Bradley Russell and Christopher John Kline.
- */
-
-package com.sun.gluegen.runtime;
-
-/** Provides an abstract interface to the OS's low-level dynamic
-    linking functionality. */
-
-interface DynamicLinker {
-  public long openLibraryGlobal(String pathname, boolean debug);
-  public long openLibraryLocal(String pathname, boolean debug);
-  public long lookupSymbol(long libraryHandle, String symbolName);
-  public void closeLibrary(long libraryHandle);
-}
diff --git a/src/java/com/sun/gluegen/runtime/DynamicLookupHelper.java b/src/java/com/sun/gluegen/runtime/DynamicLookupHelper.java
deleted file mode 100755
index ad3de7f..0000000
--- a/src/java/com/sun/gluegen/runtime/DynamicLookupHelper.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2003-2005 Sun Microsystems, Inc. All Rights Reserved.
- * 
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * 
- * - Redistribution of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * 
- * - Redistribution 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 Sun Microsystems, Inc. or the names of
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * 
- * This software is provided "AS IS," without a warranty of any kind. ALL
- * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
- * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
- * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
- * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
- * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
- * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
- * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
- * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
- * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
- * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- * 
- * You acknowledge that this software is not designed or intended for use
- * in the design, construction, operation or maintenance of any nuclear
- * facility.
- * 
- * Sun gratefully acknowledges that this software was originally authored
- * and developed by Kenneth Bradley Russell and Christopher John Kline.
- */
-
-package com.sun.gluegen.runtime;
-
-/** Interface callers may use to use the ProcAddressHelper's {@link
-    ProcAddressHelper#resetProcAddressTable resetProcAddressTable}
-    helper method to install function pointers into a
-    ProcAddressTable. This must typically be written with native
-    code. */
-
-public interface DynamicLookupHelper {
-  /**
-   * Try to fetch the function pointer for function 'funcName'.
-   */
-  public long dynamicLookupFunction(String funcName);
-}
diff --git a/src/java/com/sun/gluegen/runtime/MacOSXDynamicLinkerImpl.java b/src/java/com/sun/gluegen/runtime/MacOSXDynamicLinkerImpl.java
deleted file mode 100755
index 83ebd7a..0000000
--- a/src/java/com/sun/gluegen/runtime/MacOSXDynamicLinkerImpl.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/* !---- DO NOT EDIT: This file autogenerated by com\sun\gluegen\JavaEmitter.java on Mon Jul 31 16:27:00 PDT 2006 ----! */
-
-package com.sun.gluegen.runtime;
-
-import com.sun.gluegen.runtime.*;
-
-public class MacOSXDynamicLinkerImpl implements DynamicLinker
-{
-
-  public static final int RTLD_LAZY = 0x1;
-  public static final int RTLD_NOW = 0x2;
-  public static final int RTLD_LOCAL = 0x4;
-  public static final int RTLD_GLOBAL = 0x8;
-
-  /** Interface to C language function: <br> <code> int dlclose(void *  __handle); </code>    */
-  private static native int dlclose(long __handle);
-
-  /** Interface to C language function: <br> <code> char *  dlerror(void); </code>    */
-  private static native java.lang.String dlerror();
-
-  /** Interface to C language function: <br> <code> void *  dlopen(const char *  __path, int __mode); </code>    */
-  private static native long dlopen(java.lang.String __path, int __mode);
-
-  /** Interface to C language function: <br> <code> void *  dlsym(void *  __handle, const char *  __symbol); </code>    */
-  private static native long dlsym(long __handle, java.lang.String __symbol);
-
-
-  // --- Begin CustomJavaCode .cfg declarations
-  public long openLibraryLocal(String pathname, boolean debug) {
-    // Note we use RTLD_LOCAL visibility to _NOT_ allow this functionality to
-    // be used to pre-resolve dependent libraries of JNI code without
-    // requiring that all references to symbols in those libraries be
-    // looked up dynamically via the ProcAddressTable mechanism; in
-    // other words, one can actually link against the library instead of
-    // having to dlsym all entry points. System.loadLibrary() uses
-    // RTLD_LOCAL visibility so can't be used for this purpose.
-    return dlopen(pathname, RTLD_LAZY | RTLD_LOCAL);
-  }
-  
-  public long openLibraryGlobal(String pathname, boolean debug) {
-    // Note we use RTLD_GLOBAL visibility to allow this functionality to
-    // be used to pre-resolve dependent libraries of JNI code without
-    // requiring that all references to symbols in those libraries be
-    // looked up dynamically via the ProcAddressTable mechanism; in
-    // other words, one can actually link against the library instead of
-    // having to dlsym all entry points. System.loadLibrary() uses
-    // RTLD_LOCAL visibility so can't be used for this purpose.
-    return dlopen(pathname, RTLD_LAZY | RTLD_GLOBAL);
-  }
-  
-  public long lookupSymbol(long libraryHandle, String symbolName) {
-    return dlsym(libraryHandle, symbolName);
-  }
-  
-  public void closeLibrary(long libraryHandle) {
-    dlclose(libraryHandle);
-  }
-  // ---- End CustomJavaCode .cfg declarations
-
-} // end of class MacOSXDynamicLinkerImpl
diff --git a/src/java/com/sun/gluegen/runtime/NativeLibLoader.java b/src/java/com/sun/gluegen/runtime/NativeLibLoader.java
deleted file mode 100755
index 0e6e3da..0000000
--- a/src/java/com/sun/gluegen/runtime/NativeLibLoader.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
- * 
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * 
- * - Redistribution of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * 
- * - Redistribution 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 Sun Microsystems, Inc. or the names of
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * 
- * This software is provided "AS IS," without a warranty of any kind. ALL
- * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
- * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
- * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
- * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
- * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
- * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
- * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
- * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
- * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
- * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- * 
- * You acknowledge that this software is not designed or intended for use
- * in the design, construction, operation or maintenance of any nuclear
- * facility.
- * 
- * Sun gratefully acknowledges that this software was originally authored
- * and developed by Kenneth Bradley Russell and Christopher John Kline.
- */
-
-package com.sun.gluegen.runtime;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.security.*;
-
-/** Class providing control over whether GlueGen loads the native code
-    associated with the NativeLibrary implementation. Alternative app
-    launchers such as those running within applets may want to disable
-    this default loading behavior and load the native code via another
-    (manual) mechanism. */
-public class NativeLibLoader {
-  private static volatile boolean loadingEnabled = true;
-  private static volatile boolean didLoading;
-
-  public static void disableLoading() {
-    loadingEnabled = false;
-  }
-
-  public static void enableLoading() {
-    loadingEnabled = true;
-  }
-  
-  public static void loadGlueGenRT() {
-    if (!didLoading && loadingEnabled) {
-      synchronized (NativeLibLoader.class) {
-        if (!didLoading && loadingEnabled) {
-          didLoading = true;
-          AccessController.doPrivileged(new PrivilegedAction() {
-              public Object run() {
-                loadLibraryInternal("gluegen-rt");
-                return null;
-              }
-            });
-        }
-      }
-    }
-  }
-
-  private static void loadLibraryInternal(String libraryName) {
-    String sunAppletLauncher = System.getProperty("sun.jnlp.applet.launcher");
-    boolean usingJNLPAppletLauncher = Boolean.valueOf(sunAppletLauncher).booleanValue();
-
-    if (usingJNLPAppletLauncher) {
-        try {
-          Class jnlpAppletLauncherClass = Class.forName("org.jdesktop.applet.util.JNLPAppletLauncher");
-          Method jnlpLoadLibraryMethod = jnlpAppletLauncherClass.getDeclaredMethod("loadLibrary", new Class[] { String.class });
-          jnlpLoadLibraryMethod.invoke(null, new Object[] { libraryName });
-        } catch (Exception e) {
-          Throwable t = e;
-          if (t instanceof InvocationTargetException) {
-            t = ((InvocationTargetException) t).getTargetException();
-          }
-          if (t instanceof Error)
-            throw (Error) t;
-          if (t instanceof RuntimeException) {
-            throw (RuntimeException) t;
-          }
-          // Throw UnsatisfiedLinkError for best compatibility with System.loadLibrary()
-          throw (UnsatisfiedLinkError) new UnsatisfiedLinkError().initCause(e);
-        }
-    } else {
-      System.loadLibrary(libraryName);
-    }
-  }
-}
diff --git a/src/java/com/sun/gluegen/runtime/NativeLibrary.java b/src/java/com/sun/gluegen/runtime/NativeLibrary.java
deleted file mode 100755
index c4c9f25..0000000
--- a/src/java/com/sun/gluegen/runtime/NativeLibrary.java
+++ /dev/null
@@ -1,425 +0,0 @@
-/*
- * Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
- * 
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * 
- * - Redistribution of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * 
- * - Redistribution 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 Sun Microsystems, Inc. or the names of
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * 
- * This software is provided "AS IS," without a warranty of any kind. ALL
- * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
- * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
- * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
- * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
- * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
- * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
- * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
- * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
- * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
- * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- * 
- * You acknowledge that this software is not designed or intended for use
- * in the design, construction, operation or maintenance of any nuclear
- * facility.
- * 
- * Sun gratefully acknowledges that this software was originally authored
- * and developed by Kenneth Bradley Russell and Christopher John Kline.
- */
-
-package com.sun.gluegen.runtime;
-
-import java.io.*;
-import java.lang.reflect.*;
-import java.security.*;
-import java.util.*;
-
-/** Provides low-level, relatively platform-independent access to
-    shared ("native") libraries. The core library routines
-    <code>System.load()</code> and <code>System.loadLibrary()</code>
-    in general provide suitable functionality for applications using
-    native code, but are not flexible enough to support certain kinds
-    of glue code generation and deployment strategies. This class
-    supports direct linking of native libraries to other shared
-    objects not necessarily installed on the system (in particular,
-    via the use of dlopen(RTLD_GLOBAL) on Unix platforms) as well as
-    manual lookup of function names to support e.g. GlueGen's
-    ProcAddressTable glue code generation style without additional
-    supporting code needed in the generated library. */
-
-public class NativeLibrary {
-  private static final int WINDOWS = 1;
-  private static final int UNIX    = 2;
-  private static final int MACOSX  = 3;
-  private static boolean DEBUG;
-  private static int platform;
-  private static DynamicLinker dynLink;
-  private static String[] prefixes;
-  private static String[] suffixes;
-
-  static {
-    // Determine platform we're running on
-    AccessController.doPrivileged(new PrivilegedAction() {
-        public Object run() {
-          String osName = System.getProperty("os.name").toLowerCase();
-          if (osName.startsWith("wind")) {
-            platform = WINDOWS;
-          } else if (osName.startsWith("mac os x")) {
-            platform = MACOSX;
-          } else {
-            platform = UNIX;
-          }
-
-          DEBUG = (System.getProperty("gluegen.debug.NativeLibrary") != null);
-
-          return null;
-        }
-      });
-    // Instantiate dynamic linker implementation
-    switch (platform) {
-      case WINDOWS:
-        dynLink = new WindowsDynamicLinkerImpl();
-        prefixes = new String[] { "" };
-        suffixes = new String[] { ".dll" };
-        break;
-      case UNIX:
-        dynLink = new UnixDynamicLinkerImpl();
-        prefixes = new String[] { "lib" };
-        suffixes = new String[] { ".so" };
-        break;
-      case MACOSX:
-        dynLink = new MacOSXDynamicLinkerImpl();
-        prefixes = new String[] { "lib", "" };
-        suffixes = new String[] { ".dylib", ".jnilib", "" };
-        break;
-      default:
-        throw new InternalError("Platform not initialized properly");
-    }
-  }
-
-  // Platform-specific representation for the handle to the open
-  // library. This is an HMODULE on Windows and a void* (the result of
-  // a dlopen() call) on Unix and Mac OS X platforms.
-  private long libraryHandle;
-
-  // May as well keep around the path to the library we opened
-  private String libraryPath;
-
-  // Private constructor to prevent arbitrary instances from floating around
-  private NativeLibrary(long libraryHandle, String libraryPath) {
-    this.libraryHandle = libraryHandle;
-    this.libraryPath   = libraryPath;
-  }
-
-  /** Opens the given native library, assuming it has the same base
-      name on all platforms, looking first in the system's search
-      path, and in the context of the specified ClassLoader, which is
-      used to help find the library in the case of e.g. Java Web Start. */
-  public static NativeLibrary open(String libName, ClassLoader loader) {
-    return open(libName, libName, libName, true, loader, true);
-  }
-
-  /** Opens the given native library, assuming it has the same base
-      name on all platforms, looking first in the system's search
-      path, and in the context of the specified ClassLoader, which is
-      used to help find the library in the case of e.g. Java Web Start. */
-  public static NativeLibrary open(String libName, ClassLoader loader, boolean global) {
-    return open(libName, libName, libName, true, loader, global);
-  }
-
-  /** Opens the given native library, assuming it has the given base
-      names (no "lib" prefix or ".dll/.so/.dylib" suffix) on the
-      Windows, Unix and Mac OS X platforms, respectively, and in the
-      context of the specified ClassLoader, which is used to help find
-      the library in the case of e.g. Java Web Start. The
-      searchSystemPathFirst argument changes the behavior to first
-      search the default system path rather than searching it last.
-      Note that we do not currently handle DSO versioning on Unix.
-      Experience with JOAL and OpenAL has shown that it is extremely
-      problematic to rely on a specific .so version (for one thing,
-      ClassLoader.findLibrary on Unix doesn't work with files not
-      ending in .so, for example .so.0), and in general if this
-      dynamic loading facility is used correctly the version number
-      will be irrelevant.
-  */
-  public static NativeLibrary open(String windowsLibName,
-                                   String unixLibName,
-                                   String macOSXLibName,
-                                   boolean searchSystemPathFirst,
-                                   ClassLoader loader) {
-    return open(windowsLibName, unixLibName, macOSXLibName, searchSystemPathFirst, loader, true);
-  }
-
-  public static NativeLibrary open(String windowsLibName,
-                                   String unixLibName,
-                                   String macOSXLibName,
-                                   boolean searchSystemPathFirst,
-                                   ClassLoader loader, boolean global) {
-    List possiblePaths = enumerateLibraryPaths(windowsLibName,
-                                               unixLibName,
-                                               macOSXLibName,
-                                               searchSystemPathFirst,
-                                               loader);
-    // Iterate down these and see which one if any we can actually find.
-    for (Iterator iter = possiblePaths.iterator(); iter.hasNext(); ) {
-      String path = (String) iter.next();
-      if (DEBUG) {
-        System.out.println("Trying to load " + path);
-      }
-      ensureNativeLibLoaded();
-      long res;
-      if(global) {
-          res = dynLink.openLibraryGlobal(path, DEBUG);
-      } else {
-          res = dynLink.openLibraryLocal(path, DEBUG);
-      }
-      if (res != 0) {
-        if (DEBUG) {
-          System.out.println("Successfully loaded " + path + ": res = 0x" + Long.toHexString(res));
-        }
-        return new NativeLibrary(res, path);
-      }
-    }
-
-    if (DEBUG) {
-      System.out.println("Did not succeed in loading (" + windowsLibName + ", " + unixLibName + ", " + macOSXLibName + ")");
-    }
-
-    // For now, just return null to indicate the open operation didn't
-    // succeed (could also throw an exception if we could tell which
-    // of the openLibrary operations actually failed)
-    return null;
-  }
-
-  /** Looks up the given function name in this native library. */
-  public long lookupFunction(String functionName) {
-    if (libraryHandle == 0)
-      throw new RuntimeException("Library is not open");
-    return dynLink.lookupSymbol(libraryHandle, functionName);
-  }
-
-  /** Retrieves the low-level library handle from this NativeLibrary
-      object. On the Windows platform this is an HMODULE, and on Unix
-      and Mac OS X platforms the void* result of calling dlopen(). */
-  public long getLibraryHandle() {
-    return libraryHandle;
-  }
-
-  /** Retrieves the path under which this library was opened. */
-  public String getLibraryPath() {
-    return libraryPath;
-  }
-
-  /** Closes this native library. Further lookup operations are not
-      allowed after calling this method. */
-  public void close() {
-    if (libraryHandle == 0)
-      throw new RuntimeException("Library already closed");
-    long handle = libraryHandle;
-    libraryHandle = 0;
-    dynLink.closeLibrary(handle);
-  }
-
-  /** Given the base library names (no prefixes/suffixes) for the
-      various platforms, enumerate the possible locations and names of
-      the indicated native library on the system. */
-  private static List enumerateLibraryPaths(String windowsLibName,
-                                            String unixLibName,
-                                            String macOSXLibName,
-                                            boolean searchSystemPathFirst,
-                                            ClassLoader loader) {
-    List paths = new ArrayList();
-    String libName = selectName(windowsLibName, unixLibName, macOSXLibName);
-    if (libName == null)
-      return paths;
-
-    // Allow user's full path specification to override our building of paths
-    File file = new File(libName);
-    if (file.isAbsolute()) {
-	paths.add(libName);
-	return paths;
-    }
-
-    String[] baseNames = buildNames(libName);
-
-    if (searchSystemPathFirst) {
-      // Add just the library names to use the OS's search algorithm
-      for (int i = 0; i < baseNames.length; i++) {
-        paths.add(baseNames[i]);
-      }
-    }
-
-    // The idea to ask the ClassLoader to find the library is borrowed
-    // from the LWJGL library
-    String clPath = getPathFromClassLoader(libName, loader);
-    if (DEBUG) {
-      System.out.println("Class loader path to " + libName + ": " + clPath);
-    }
-    if (clPath != null) {
-      paths.add(clPath);
-    }
-
-    // Add entries from java.library.path
-    String javaLibraryPath =
-      (String) AccessController.doPrivileged(new PrivilegedAction() {
-          public Object run() {
-            return System.getProperty("java.library.path");
-          }
-        });
-    if (javaLibraryPath != null) {
-      StringTokenizer tokenizer = new StringTokenizer(javaLibraryPath, File.pathSeparator);
-      while (tokenizer.hasMoreTokens()) {
-        addPaths(tokenizer.nextToken(), baseNames, paths);
-      }
-    }
-
-    // Add current working directory
-    String userDir =
-      (String) AccessController.doPrivileged(new PrivilegedAction() {
-          public Object run() {
-            return System.getProperty("user.dir");
-          }
-        });
-    addPaths(userDir, baseNames, paths);
-
-    // Add probable Mac OS X-specific paths
-    if (platform == MACOSX) {
-      // Add historical location
-      addPaths("/Library/Frameworks/" + libName + ".Framework", baseNames, paths);
-      // Add current location
-      addPaths("/System/Library/Frameworks/" + libName + ".Framework", baseNames, paths);
-    }
-
-    if (!searchSystemPathFirst) {
-      // Add just the library names to use the OS's search algorithm
-      for (int i = 0; i < baseNames.length; i++) {
-        paths.add(baseNames[i]);
-      }
-    }
-
-    return paths;
-  }
-
-
-  private static String selectName(String windowsLibName,
-                                   String unixLibName,
-                                   String macOSXLibName) {
-    switch (platform) {
-      case WINDOWS:
-        return windowsLibName;
-      case UNIX:
-        return unixLibName;
-      case MACOSX:
-        return macOSXLibName;
-      default:
-        throw new InternalError();
-    }
-  }
-
-  private static String[] buildNames(String libName) {
-    // If the library name already has the prefix / suffix added
-    // (principally because we want to force a version number on Unix
-    // operating systems) then just return the library name.
-    if (libName.startsWith(prefixes[0])) {
-      if (libName.endsWith(suffixes[0])) {
-        return new String[] { libName };
-      }
-
-      int idx = libName.indexOf(suffixes[0]);
-      boolean ok = true;
-      if (idx >= 0) {
-        // Check to see if everything after it is a Unix version number
-        for (int i = idx + suffixes[0].length();
-             i < libName.length();
-             i++) {
-          char c = libName.charAt(i);
-          if (!(c == '.' || (c >= '0' && c <= '9'))) {
-            ok = false;
-            break;
-          }
-        }
-        if (ok) {
-          return new String[] { libName };
-        }
-      }
-    }
-
-    String[] res = new String[prefixes.length * suffixes.length];
-    int idx = 0;
-    for (int i = 0; i < prefixes.length; i++) {
-      for (int j = 0; j < suffixes.length; j++) {
-        res[idx++] = prefixes[i] + libName + suffixes[j];
-      }
-    }
-    return res;
-  }
-
-  private static void addPaths(String path, String[] baseNames, List paths) {
-    for (int j = 0; j < baseNames.length; j++) {
-      paths.add(path + File.separator + baseNames[j]);
-    }
-  }
-
-  private static boolean initializedFindLibraryMethod = false;
-  private static Method  findLibraryMethod = null;
-  private static String getPathFromClassLoader(final String libName, final ClassLoader loader) {
-    if (loader == null)
-      return null;
-    if (!initializedFindLibraryMethod) {
-      AccessController.doPrivileged(new PrivilegedAction() {
-          public Object run() {
-            try {
-              findLibraryMethod = ClassLoader.class.getDeclaredMethod("findLibrary",
-                                                                      new Class[] { String.class });
-              findLibraryMethod.setAccessible(true);
-            } catch (Exception e) {
-              // Fail silently disabling this functionality
-            }
-            initializedFindLibraryMethod = true;
-            return null;
-          }
-        });
-    }
-    if (findLibraryMethod != null) {
-      try {
-        return (String) AccessController.doPrivileged(new PrivilegedAction() {
-            public Object run() {
-              try {
-                return findLibraryMethod.invoke(loader, new Object[] { libName });
-              } catch (Exception e) {
-                throw new RuntimeException(e);
-              }
-            }
-          });
-      } catch (Exception e) {
-        if (DEBUG) {
-          e.printStackTrace();
-        }
-        // Fail silently and continue with other search algorithms
-      }
-    }
-    return null;
-  }
-
-  private static volatile boolean loadedDynLinkNativeLib;
-  static void ensureNativeLibLoaded() {
-    if (!loadedDynLinkNativeLib) {
-      synchronized (NativeLibrary.class) {
-        if (!loadedDynLinkNativeLib) {
-          loadedDynLinkNativeLib = true;
-          NativeLibLoader.loadGlueGenRT();
-        }
-      }
-    }
-  }
-}
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
deleted file mode 100755
index 7e9142c..0000000
--- a/src/java/com/sun/gluegen/runtime/PointerBuffer.java.javame_cdc_fp
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- * 
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * 
- * - Redistribution of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * 
- * - Redistribution 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 Sun Microsystems, Inc. or the names of
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * 
- * This software is provided "AS IS," without a warranty of any kind. ALL
- * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
- * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
- * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
- * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
- * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
- * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
- * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
- * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
- * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
- * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- * 
- * You acknowledge that this software is not designed or intended for use
- * in the design, construction, operation or maintenance of any nuclear
- * facility.
- */
-
-package com.sun.gluegen.runtime;
-
-import java.nio.*;
-
-public class PointerBuffer {
-  private ByteBuffer   bb;
-  private IntBuffer    ib;
-  private int capacity, position;
-  private long[] backup;
-
-  private PointerBuffer(ByteBuffer bb) {
-    this.bb = bb;
-    this.ib = bb.asIntBuffer();
-
-    capacity = bb.capacity() / elementSize();
-
-    position=0;
-    backup = new long[capacity];
-  }
-
-  public final int limit() {
-    return capacity;
-  }
-  public final int capacity() {
-    return capacity;
-  }
-
-  public final int position() {
-    return position;
-  }
-
-  public final PointerBuffer position(int newPos) {
-    if(0>newPos || newPos>=capacity) {
-        throw new IndexOutOfBoundsException();
-    }
-    position = newPos;
-    return this;
-  }
-
-  public final int remaining() {
-    return capacity - position;
-  }
-
-  public final boolean hasRemaining() {
-    return position < capacity;
-  }
-
-  public final PointerBuffer rewind() {
-    position=0;
-    return this;
-  }
-
-  int   arrayOffset() { return 0; }
-
-  boolean   hasArray() { return true; }
-
-  public long[] array() {
-    return backup;
-  }
-
-  public static PointerBuffer allocate(int size) {
-      return new PointerBuffer(ByteBuffer.wrap(new byte[elementSize()* size]));
-  }
-
-  public static PointerBuffer allocateDirect(int size) {
-      return new PointerBuffer(BufferFactory.newDirectByteBuffer(elementSize() * size));
-  }
-
-  public static PointerBuffer wrap(ByteBuffer src) {
-    PointerBuffer res =  new PointerBuffer(src);
-    res.updateBackup();
-    return res;
-  }
-
-  public ByteBuffer getBuffer() {
-    return bb;
-  }
-
-  public boolean isDirect() {
-    return bb.isDirect();
-  }
-
-  public long get(int idx) {
-    if(0>idx || idx>=capacity) {
-        throw new IndexOutOfBoundsException();
-    }
-    if(CPU.is32Bit()) {
-        return ib.get(idx);
-    } else {
-        idx = idx << 1 ; // 8-byte to 4-byte offset
-        long lo = 0x00000000FFFFFFFFL & ( (long) ib.get(idx)   );
-        long hi = 0x00000000FFFFFFFFL & ( (long) ib.get(idx+1) );
-        if(BufferFactory.isLittleEndian()) {
-            return hi << 32 | lo ;
-        }
-        return lo << 32 | hi ;
-    }
-  }
-
-  public long get() {
-    long r = get(position);
-    position++;
-    return r;
-  }
-
-  public PointerBuffer put(int idx, long v) {
-    if(0>idx || idx>=capacity) {
-        throw new IndexOutOfBoundsException();
-    }
-    backup[idx] = v;
-    if(CPU.is32Bit()) {
-        ib.put(idx, (int)v);
-    } else {
-        idx = idx << 1 ; // 8-byte to 4-byte offset
-        int lo = (int) ( ( v       ) & 0x00000000FFFFFFFFL ) ;
-        int hi = (int) ( ( v >> 32 ) & 0x00000000FFFFFFFFL ) ;
-        if(BufferFactory.isLittleEndian()) {
-            ib.put(idx, lo);
-            ib.put(idx+1, hi);
-        } else {
-            ib.put(idx, hi);
-            ib.put(idx+1, lo);
-        }
-    }
-    return this;
-  }
-
-  public PointerBuffer put(long v) {
-    put(position, v);
-    position++;
-    return this;
-  }
-
-  private void updateBackup() {
-    for (int i = 0; i < capacity; i++) {
-      backup[i] = get(i);
-    }
-  }
-
-  public static int elementSize() {
-    return CPU.is32Bit() ? BufferFactory.SIZEOF_INT : BufferFactory.SIZEOF_LONG;
-  }
-
-}
diff --git a/src/java/com/sun/gluegen/runtime/PointerBuffer.java.javase b/src/java/com/sun/gluegen/runtime/PointerBuffer.java.javase
deleted file mode 100755
index 851c400..0000000
--- a/src/java/com/sun/gluegen/runtime/PointerBuffer.java.javase
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * - Redistribution of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- *
- * - Redistribution 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 Sun Microsystems, Inc. or the names of
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * This software is provided "AS IS," without a warranty of any kind. ALL
- * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
- * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
- * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
- * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
- * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
- * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
- * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
- * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
- * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
- * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
- * You acknowledge that this software is not designed or intended for use
- * in the design, construction, operation or maintenance of any nuclear
- * facility.
- */
-
-package com.sun.gluegen.runtime;
-
-import java.nio.*;
-
-public class PointerBuffer {
-  private ByteBuffer   bb;
-  private Buffer       pb;
-  private int capacity, position;
-  private long[] backup;
-
-  private PointerBuffer(ByteBuffer bb) {
-    this.bb = bb;
-
-    if(CPU.is32Bit()) {
-       this.pb = bb.asIntBuffer();
-    }else{
-       this.pb = bb.asLongBuffer();
-    }
-
-    capacity = bb.capacity() / elementSize();
-
-    position=0;
-    backup = new long[capacity];
-  }
-
-  public final int limit() {
-    return capacity;
-  }
-  public final int capacity() {
-    return capacity;
-  }
-
-  public final int position() {
-    return position;
-  }
-
-  public final PointerBuffer position(int newPos) {
-    if(0>newPos || newPos>=capacity) {
-        throw new IndexOutOfBoundsException();
-    }
-    position = newPos;
-    return this;
-  }
-
-  public final int remaining() {
-    return capacity - position;
-  }
-
-  public final boolean hasRemaining() {
-    return position < capacity;
-  }
-
-  public final PointerBuffer rewind() {
-    position=0;
-    return this;
-  }
-
-  int   arrayOffset() { return 0; }
-
-  boolean   hasArray() { return true; }
-
-  public long[] array() {
-    return backup;
-  }
-
-  public static PointerBuffer allocate(int size) {
-      return new PointerBuffer(ByteBuffer.wrap(new byte[elementSize()* size]));
-  }
-
-  public static PointerBuffer allocateDirect(int size) {
-      return new PointerBuffer(BufferFactory.newDirectByteBuffer(elementSize() * size));
-  }
-
-  public static PointerBuffer wrap(ByteBuffer src) {
-    PointerBuffer res =  new PointerBuffer(src);
-    res.updateBackup();
-    return res;
-  }
-
-  public ByteBuffer getBuffer() {
-    return bb;
-  }
-
-  public boolean isDirect() {
-    return bb.isDirect();
-  }
-
-  public long get(int idx) {
-    if(0>idx || idx>=capacity) {
-        throw new IndexOutOfBoundsException();
-    }
-    if(CPU.is32Bit()) {
-        return ((IntBuffer)pb).get(idx);
-    } else {
-        return ((LongBuffer)pb).get(idx);
-    }
-  }
-
-  public long get() {
-    long r = get(position);
-    position++;
-    return r;
-  }
-
-  public PointerBuffer put(int idx, long v) {
-    if(0>idx || idx>=capacity) {
-        throw new IndexOutOfBoundsException();
-    }
-    backup[idx] = v;
-    if(CPU.is32Bit()) {
-        ((IntBuffer)pb).put(idx, (int)v);
-    } else {
-        ((LongBuffer)pb).put(idx, v);
-    }
-    return this;
-  }
-
-  public PointerBuffer put(long v) {
-    put(position, v);
-    position++;
-    return this;
-  }
-
-  private void updateBackup() {
-    for (int i = 0; i < capacity; i++) {
-      backup[i] = get(i);
-    }
-  }
-
-  public static int elementSize() {
-    return CPU.is32Bit() ? BufferFactory.SIZEOF_INT : BufferFactory.SIZEOF_LONG;
-  }
-}
diff --git a/src/java/com/sun/gluegen/runtime/ProcAddressHelper.java b/src/java/com/sun/gluegen/runtime/ProcAddressHelper.java
deleted file mode 100644
index f0dbe8b..0000000
--- a/src/java/com/sun/gluegen/runtime/ProcAddressHelper.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright (c) 2003-2005 Sun Microsystems, Inc. All Rights Reserved.
- * 
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * 
- * - Redistribution of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * 
- * - Redistribution 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 Sun Microsystems, Inc. or the names of
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * 
- * This software is provided "AS IS," without a warranty of any kind. ALL
- * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
- * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
- * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
- * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
- * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
- * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
- * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
- * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
- * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
- * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- * 
- * You acknowledge that this software is not designed or intended for use
- * in the design, construction, operation or maintenance of any nuclear
- * facility.
- * 
- * Sun gratefully acknowledges that this software was originally authored
- * and developed by Kenneth Bradley Russell and Christopher John Kline.
- */
-
-package com.sun.gluegen.runtime;
-
-import java.security.*;
-
-// Debugging only
-import java.io.*;
-
-/** Helper class containing constants and methods to assist with the
-    manipulation of auto-generated ProcAddressTables. */
-
-public class ProcAddressHelper {
-  public static final String PROCADDRESS_VAR_PREFIX = "_addressof_";
-  protected static boolean DEBUG;
-  protected static String DEBUG_PREFIX;
-  protected static int debugNum;
-
-  static {
-    AccessController.doPrivileged(new PrivilegedAction() {
-        public Object run() {
-          DEBUG = (System.getProperty("gluegen.debug.ProcAddressHelper") != null);
-          if (DEBUG) {
-            DEBUG_PREFIX = System.getProperty("gluegen.debug.ProcAddressHelper.prefix");
-          }
-          return null;
-        }
-      });
-  }
-
-  protected static PrintStream getDebugOutStream() {
-    PrintStream out = null;
-    if (DEBUG) {
-      if (DEBUG_PREFIX != null) {
-        try {
-          out = new PrintStream(new BufferedOutputStream(new FileOutputStream(DEBUG_PREFIX + File.separatorChar +
-                                                                              "procaddresshelper-" + (++debugNum) + ".txt")));
-        } catch (IOException e) {
-          e.printStackTrace();
-          out = System.err;
-        }
-      } else {
-        out = System.err;
-      }
-    }
-    return out;
-  }
-
-  public static void resetProcAddressTable(Object table,
-                                           DynamicLookupHelper lookup) throws RuntimeException {
-    Class tableClass = table.getClass();
-    java.lang.reflect.Field[] fields = tableClass.getFields();
-    PrintStream dout = getDebugOutStream();
-    
-    if (DEBUG) {
-      dout.println("ProcAddressHelper.resetProcAddressTable(" + table.getClass().getName() + ")");
-    }
-    for (int i = 0; i < fields.length; ++i) {
-      String addressFieldName = fields[i].getName();
-      if (!addressFieldName.startsWith(ProcAddressHelper.PROCADDRESS_VAR_PREFIX)) {
-        // not a proc address variable
-        continue;
-      }
-      int startOfMethodName = ProcAddressHelper.PROCADDRESS_VAR_PREFIX.length();
-      String funcName = addressFieldName.substring(startOfMethodName);
-      try {
-        java.lang.reflect.Field addressField = fields[i];
-        assert(addressField.getType() == Long.TYPE);
-        long newProcAddress = lookup.dynamicLookupFunction(funcName);
-        // set the current value of the proc address variable in the table object
-        addressField.setLong(table, newProcAddress); 
-        if (DEBUG) {
-          dout.println("  " + addressField.getName() + " -> 0x" + Long.toHexString(newProcAddress));
-        }
-      } catch (Exception e) {
-        throw new RuntimeException("Can not get proc address for method \"" +
-                                   funcName + "\": Couldn't set value of field \"" + addressFieldName +
-                                   "\" in class " + tableClass.getName(), e);
-      }
-    }
-    if (DEBUG) {
-      dout.flush();
-      if (DEBUG_PREFIX != null) {
-        dout.close();
-      }
-    }
-  }
-}
diff --git a/src/java/com/sun/gluegen/runtime/ProcAddressTable.java b/src/java/com/sun/gluegen/runtime/ProcAddressTable.java
deleted file mode 100644
index 4271a8c..0000000
--- a/src/java/com/sun/gluegen/runtime/ProcAddressTable.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2003-2005 Sun Microsystems, Inc. All Rights Reserved.
- * 
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * 
- * - Redistribution of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * 
- * - Redistribution 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 Sun Microsystems, Inc. or the names of
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * 
- * This software is provided "AS IS," without a warranty of any kind. ALL
- * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
- * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
- * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
- * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
- * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
- * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
- * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
- * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
- * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
- * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- * 
- * You acknowledge that this software is not designed or intended for use
- * in the design, construction, operation or maintenance of any nuclear
- * facility.
- */
-
-package com.sun.gluegen.runtime;
-
-public interface ProcAddressTable {
-  public long getAddressFor(String functionName);
-}
diff --git a/src/java/com/sun/gluegen/runtime/StructAccessor.java.javame_cdc_fp b/src/java/com/sun/gluegen/runtime/StructAccessor.java.javame_cdc_fp
deleted file mode 100755
index d97d2a0..0000000
--- a/src/java/com/sun/gluegen/runtime/StructAccessor.java.javame_cdc_fp
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- * 
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * 
- * - Redistribution of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * 
- * - Redistribution 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 Sun Microsystems, Inc. or the names of
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * 
- * This software is provided "AS IS," without a warranty of any kind. ALL
- * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
- * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
- * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
- * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
- * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
- * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
- * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
- * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
- * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
- * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- * 
- * You acknowledge that this software is not designed or intended for use
- * in the design, construction, operation or maintenance of any nuclear
- * facility.
- * 
- * Sun gratefully acknowledges that this software was originally authored
- * and developed by Kenneth Bradley Russell and Christopher John Kline.
- */
-
-package com.sun.gluegen.runtime;
-
-import java.nio.*;
-
-public class StructAccessor {
-  private ByteBuffer   bb;
-  private FloatBuffer  fb;
-  private IntBuffer    ib;
-  private ShortBuffer  sb;
-
-  public StructAccessor(ByteBuffer bb) {
-    this.bb = bb;
-  }
-
-  public ByteBuffer getBuffer() {
-    return bb;
-  }
-
-  /** Return a slice of the current ByteBuffer starting at the
-      specified byte offset and extending the specified number of
-      bytes. Note that this method is not thread-safe with respect to
-      the other methods in this class. */
-  public ByteBuffer slice(int byteOffset, int byteLength) {
-    bb.position(byteOffset);
-    bb.limit(byteOffset + byteLength);
-    ByteBuffer newBuf = bb.slice();
-    bb.position(0);
-    bb.limit(bb.capacity());
-    return newBuf;
-  }
-
-  /** Retrieves the byte at the specified slot (byte offset). */
-  public byte getByteAt(int slot) {
-    return bb.get(slot);
-  }
-
-  /** Puts a byte at the specified slot (byte offset). */
-  public void setByteAt(int slot, byte v) {
-    bb.put(slot, v);
-  }
-
-  /** Retrieves the float at the specified slot (4-byte offset). */
-  public float getFloatAt(int slot) {
-    return floatBuffer().get(slot);
-  }
-
-  /** Puts a float at the specified slot (4-byte offset). */
-  public void setFloatAt(int slot, float v) {
-    floatBuffer().put(slot, v);
-  }
-
-  /** Retrieves the int at the specified slot (4-byte offset). */
-  public int getIntAt(int slot) {
-    return intBuffer().get(slot);
-  }
-
-  /** Puts a int at the specified slot (4-byte offset). */
-  public void setIntAt(int slot, int v) {
-    intBuffer().put(slot, v);
-  }
-
-  public void setBytesAt(int slot, byte[] v) {
-      for (int i = 0; i < v.length; i++) {
-        bb.put(slot++, v[i]);
-      }
-  }
-
-  public byte[] getBytesAt(int slot, byte[] v) {
-      for (int i = 0; i < v.length; i++) {
-        v[i] = bb.get(slot++);
-      }
-      return v;
-  }
-
-  public void setIntsAt(int slot, int[] v) {
-      for (int i = 0; i < v.length; i++) {
-        intBuffer().put(slot++, v[i]);
-      }
-  }
-
-  public int[] getIntsAt(int slot, int[] v) {
-      for (int i = 0; i < v.length; i++) {
-        v[i] = intBuffer().get(slot++);
-      }
-      return v;
-  }
-
-  public void setFloatsAt(int slot, float[] v) {
-      for (int i = 0; i < v.length; i++) {
-        floatBuffer().put(slot++, v[i]);
-      }
-  }
-
-  public float[] getFloatsAt(int slot, float[] v) {
-      for (int i = 0; i < v.length; i++) {
-        v[i] = floatBuffer().get(slot++);
-      }
-      return v;
-  }
-
-  /** Retrieves the long at the specified slot (8-byte offset). */
-  public long getLongAt(int slot) {
-    slot = slot << 1 ; // 8-byte to 4-byte offset
-    IntBuffer intBuffer = intBuffer();
-    long lo = 0x00000000FFFFFFFFL & ( (long) intBuffer.get(slot)   );
-    long hi = 0x00000000FFFFFFFFL & ( (long) intBuffer.get(slot+1) );
-    if(BufferFactory.isLittleEndian()) {
-        return hi << 32 | lo ;
-    }
-    return lo << 32 | hi ;
-  }
-
-  /** Puts a long at the specified slot (8-byte offset). */
-  public void setLongAt(int slot, long v) {
-    slot = slot << 1 ; // 8-byte to 4-byte offset
-    IntBuffer intBuffer = intBuffer();
-    int lo = (int) ( ( v       ) & 0x00000000FFFFFFFFL ) ;
-    int hi = (int) ( ( v >> 32 ) & 0x00000000FFFFFFFFL ) ;
-    if(BufferFactory.isLittleEndian()) {
-        intBuffer.put(slot, lo);
-        intBuffer.put(slot+1, hi);
-    } else {
-        intBuffer.put(slot, hi);
-        intBuffer.put(slot+1, lo);
-    }
-  }
-
-  /** Retrieves the short at the specified slot (2-byte offset). */
-  public short getShortAt(int slot) {
-    return shortBuffer().get(slot);
-  }
-
-  /** Puts a short at the specified slot (2-byte offset). */
-  public void setShortAt(int slot, short v) {
-    shortBuffer().put(slot, v);
-  }
-
-  //----------------------------------------------------------------------
-  // Internals only below this point
-  //
-
-  private FloatBuffer floatBuffer() {
-    if (fb == null) {
-      fb = bb.asFloatBuffer();
-    }
-    return fb;
-  }
-
-  private IntBuffer intBuffer() {
-    if (ib == null) {
-      ib = bb.asIntBuffer();
-    }
-    return ib;
-  }
-
-  private ShortBuffer shortBuffer() {
-    if (sb == null) {
-      sb = bb.asShortBuffer();
-    }
-    return sb;
-  }
-}
diff --git a/src/java/com/sun/gluegen/runtime/StructAccessor.java.javase b/src/java/com/sun/gluegen/runtime/StructAccessor.java.javase
deleted file mode 100755
index 9113859..0000000
--- a/src/java/com/sun/gluegen/runtime/StructAccessor.java.javase
+++ /dev/null
@@ -1,256 +0,0 @@
-/*
- * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- * 
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * 
- * - Redistribution of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * 
- * - Redistribution 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 Sun Microsystems, Inc. or the names of
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * 
- * This software is provided "AS IS," without a warranty of any kind. ALL
- * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
- * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
- * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
- * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
- * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
- * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
- * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
- * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
- * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
- * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- * 
- * You acknowledge that this software is not designed or intended for use
- * in the design, construction, operation or maintenance of any nuclear
- * facility.
- * 
- * Sun gratefully acknowledges that this software was originally authored
- * and developed by Kenneth Bradley Russell and Christopher John Kline.
- */
-
-package com.sun.gluegen.runtime;
-
-import java.nio.*;
-
-public class StructAccessor {
-  private ByteBuffer   bb;
-  private CharBuffer   cb;
-  private DoubleBuffer db;
-  private FloatBuffer  fb;
-  private IntBuffer    ib;
-  private LongBuffer   lb;
-  private ShortBuffer  sb;
-
-  public StructAccessor(ByteBuffer bb) {
-    // Setting of byte order is concession to native code which needs
-    // to instantiate these
-    this.bb = bb.order(ByteOrder.nativeOrder());
-  }
-
-  public ByteBuffer getBuffer() {
-    return bb;
-  }
-
-  /** Return a slice of the current ByteBuffer starting at the
-      specified byte offset and extending the specified number of
-      bytes. Note that this method is not thread-safe with respect to
-      the other methods in this class. */
-  public ByteBuffer slice(int byteOffset, int byteLength) {
-    bb.position(byteOffset);
-    bb.limit(byteOffset + byteLength);
-    ByteBuffer newBuf = bb.slice();
-    bb.position(0);
-    bb.limit(bb.capacity());
-    return newBuf;
-  }
-
-  /** Retrieves the byte at the specified slot (byte offset). */
-  public byte getByteAt(int slot) {
-    return bb.get(slot);
-  }
-
-  /** Puts a byte at the specified slot (byte offset). */
-  public void setByteAt(int slot, byte v) {
-    bb.put(slot, v);
-  }
-
-  /** Retrieves the char at the specified slot (2-byte offset). */
-  public char getCharAt(int slot) {
-    return charBuffer().get(slot);
-  }
-
-  /** Puts a char at the specified slot (2-byte offset). */
-  public void setCharAt(int slot, char v) {
-    charBuffer().put(slot, v);
-  }
-
-  /** Retrieves the double at the specified slot (8-byte offset). */
-  public double getDoubleAt(int slot) {
-    return doubleBuffer().get(slot);
-  }
-
-  /** Puts a double at the specified slot (8-byte offset). */
-  public void setDoubleAt(int slot, double v) {
-    doubleBuffer().put(slot, v);
-  }
-
-  /** Retrieves the float at the specified slot (4-byte offset). */
-  public float getFloatAt(int slot) {
-    return floatBuffer().get(slot);
-  }
-
-  /** Puts a float at the specified slot (4-byte offset). */
-  public void setFloatAt(int slot, float v) {
-    floatBuffer().put(slot, v);
-  }
-
-  /** Retrieves the int at the specified slot (4-byte offset). */
-  public int getIntAt(int slot) {
-    return intBuffer().get(slot);
-  }
-
-  /** Puts a int at the specified slot (4-byte offset). */
-  public void setIntAt(int slot, int v) {
-    intBuffer().put(slot, v);
-  }
-
-  /** Retrieves the long at the specified slot (8-byte offset). */
-  public long getLongAt(int slot) {
-    return longBuffer().get(slot);
-  }
-
-  /** Puts a long at the specified slot (8-byte offset). */
-  public void setLongAt(int slot, long v) {
-    longBuffer().put(slot, v);
-  }
-
-  /** Retrieves the short at the specified slot (2-byte offset). */
-  public short getShortAt(int slot) {
-    return shortBuffer().get(slot);
-  }
-
-  /** Puts a short at the specified slot (2-byte offset). */
-  public void setShortAt(int slot, short v) {
-    shortBuffer().put(slot, v);
-  }
-
-  public void setBytesAt(int slot, byte[] v) {
-      for (int i = 0; i < v.length; i++) {
-        bb.put(slot++, v[i]);
-      }
-  }
-
-  public byte[] getBytesAt(int slot, byte[] v) {
-      for (int i = 0; i < v.length; i++) {
-        v[i] = bb.get(slot++);
-      }
-      return v;
-  }
-
-  public void setCharsAt(int slot, char[] v) {
-      for (int i = 0; i < v.length; i++) {
-        charBuffer().put(slot++, v[i]);
-      }
-  }
-
-  public char[] getCharsAt(int slot, char[] v) {
-      for (int i = 0; i < v.length; i++) {
-        v[i] = charBuffer().get(slot++);
-      }
-      return v;
-  }
-
-  public void setIntsAt(int slot, int[] v) {
-      for (int i = 0; i < v.length; i++) {
-        intBuffer().put(slot++, v[i]);
-      }
-  }
-
-  public int[] getIntsAt(int slot, int[] v) {
-      for (int i = 0; i < v.length; i++) {
-        v[i] = intBuffer().get(slot++);
-      }
-      return v;
-  }
-
-  public void setFloatsAt(int slot, float[] v) {
-      for (int i = 0; i < v.length; i++) {
-        floatBuffer().put(slot++, v[i]);
-      }
-  }
-
-  public float[] getFloatsAt(int slot, float[] v) {
-      for (int i = 0; i < v.length; i++) {
-        v[i] = floatBuffer().get(slot++);
-      }
-      return v;
-  }
-
-  public void setDoublesAt(int slot, double[] v) {
-      for (int i = 0; i < v.length; i++) {
-        doubleBuffer().put(slot++, v[i]);
-      }
-  }
-
-  public double[] getDoublesAt(int slot, double[] v) {
-      for (int i = 0; i < v.length; i++) {
-        v[i] = doubleBuffer().get(slot++);
-      }
-      return v;
-  }
-
-  //----------------------------------------------------------------------
-  // Internals only below this point
-  //
-
-  private CharBuffer charBuffer() {
-    if (cb == null) {
-      cb = bb.asCharBuffer();
-    }
-    return cb;
-  }
-
-  private DoubleBuffer doubleBuffer() {
-    if (db == null) {
-      db = bb.asDoubleBuffer();
-    }
-    return db;
-  }
-
-  private FloatBuffer floatBuffer() {
-    if (fb == null) {
-      fb = bb.asFloatBuffer();
-    }
-    return fb;
-  }
-
-  private IntBuffer intBuffer() {
-    if (ib == null) {
-      ib = bb.asIntBuffer();
-    }
-    return ib;
-  }
-
-  private LongBuffer longBuffer() {
-    if (lb == null) {
-      lb = bb.asLongBuffer();
-    }
-    return lb;
-  }
-
-  private ShortBuffer shortBuffer() {
-    if (sb == null) {
-      sb = bb.asShortBuffer();
-    }
-    return sb;
-  }
-}
diff --git a/src/java/com/sun/gluegen/runtime/UnixDynamicLinkerImpl.java b/src/java/com/sun/gluegen/runtime/UnixDynamicLinkerImpl.java
deleted file mode 100755
index 773d832..0000000
--- a/src/java/com/sun/gluegen/runtime/UnixDynamicLinkerImpl.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/* !---- DO NOT EDIT: This file autogenerated by com\sun\gluegen\JavaEmitter.java on Mon Jul 31 16:26:59 PDT 2006 ----! */
-
-package com.sun.gluegen.runtime;
-
-import com.sun.gluegen.runtime.*;
-
-public class UnixDynamicLinkerImpl implements DynamicLinker
-{
-
-  public static final int RTLD_LAZY = 0x00001;
-  public static final int RTLD_NOW = 0x00002;
-  public static final int RTLD_NOLOAD = 0x00004;
-  public static final int RTLD_GLOBAL = 0x00100;
-  public static final int RTLD_LOCAL = 0x00000;
-  public static final int RTLD_PARENT = 0x00200;
-  public static final int RTLD_GROUP = 0x00400;
-  public static final int RTLD_WORLD = 0x00800;
-  public static final int RTLD_NODELETE = 0x01000;
-  public static final int RTLD_FIRST = 0x02000;
-
-  /** Interface to C language function: <br> <code> int dlclose(void * ); </code>    */
-  private static native int dlclose(long arg0);
-
-  /** Interface to C language function: <br> <code> char *  dlerror(void); </code>    */
-  private static native java.lang.String dlerror();
-
-  /** Interface to C language function: <br> <code> void *  dlopen(const char * , int); </code>    */
-  private static native long dlopen(java.lang.String arg0, int arg1);
-
-  /** Interface to C language function: <br> <code> void *  dlsym(void * , const char * ); </code>    */
-  private static native long dlsym(long arg0, java.lang.String arg1);
-
-
-  // --- Begin CustomJavaCode .cfg declarations
-  public long openLibraryLocal(String pathname, boolean debug) {
-    // Note we use RTLD_GLOBAL visibility to _NOT_ allow this functionality to
-    // be used to pre-resolve dependent libraries of JNI code without
-    // requiring that all references to symbols in those libraries be
-    // looked up dynamically via the ProcAddressTable mechanism; in
-    // other words, one can actually link against the library instead of
-    // having to dlsym all entry points. System.loadLibrary() uses
-    // RTLD_LOCAL visibility so can't be used for this purpose.
-    return dlopen(pathname, RTLD_LAZY | RTLD_LOCAL);
-  }
-
-  public long openLibraryGlobal(String pathname, boolean debug) {
-    // Note we use RTLD_GLOBAL visibility to allow this functionality to
-    // be used to pre-resolve dependent libraries of JNI code without
-    // requiring that all references to symbols in those libraries be
-    // looked up dynamically via the ProcAddressTable mechanism; in
-    // other words, one can actually link against the library instead of
-    // having to dlsym all entry points. System.loadLibrary() uses
-    // RTLD_LOCAL visibility so can't be used for this purpose.
-    return dlopen(pathname, RTLD_LAZY | RTLD_GLOBAL);
-  }
-  
-  public long lookupSymbol(long libraryHandle, String symbolName) {
-    return dlsym(libraryHandle, symbolName);
-  }
-  
-  public void closeLibrary(long libraryHandle) {
-    dlclose(libraryHandle);
-  }
-  // ---- End CustomJavaCode .cfg declarations
-
-} // end of class UnixDynamicLinkerImpl
diff --git a/src/java/com/sun/gluegen/runtime/WindowsDynamicLinkerImpl.java b/src/java/com/sun/gluegen/runtime/WindowsDynamicLinkerImpl.java
deleted file mode 100755
index 325078b..0000000
--- a/src/java/com/sun/gluegen/runtime/WindowsDynamicLinkerImpl.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/* !---- DO NOT EDIT: This file autogenerated by com\sun\gluegen\JavaEmitter.java on Tue May 27 02:37:55 PDT 2008 ----! */
-
-package com.sun.gluegen.runtime;
-
-import com.sun.gluegen.runtime.*;
-
-public class WindowsDynamicLinkerImpl implements DynamicLinker
-{
-
-
-  /** Interface to C language function: <br> <code> BOOL FreeLibrary(HANDLE hLibModule); </code>    */
-  private static native int FreeLibrary(long hLibModule);
-
-  /** Interface to C language function: <br> <code> DWORD GetLastError(void); </code>    */
-  private static native int GetLastError();
-
-  /** Interface to C language function: <br> <code> PROC GetProcAddressA(HANDLE hModule, LPCSTR lpProcName); </code>    */
-  private static native long GetProcAddressA(long hModule, java.lang.String lpProcName);
-
-  /** Interface to C language function: <br> <code> HANDLE LoadLibraryW(LPCWSTR lpLibFileName); </code>    */
-  private static native long LoadLibraryW(java.lang.String lpLibFileName);
-
-
-  // --- Begin CustomJavaCode .cfg declarations
-  public long openLibraryLocal(String libraryName, boolean debug) {
-    // How does that work under Windows ?
-    // Don't know .. so it's an alias for the time being
-    return openLibraryGlobal(libraryName, debug);
-  }
-  
-  public long openLibraryGlobal(String libraryName, boolean debug) {
-    long handle = LoadLibraryW(libraryName);
-    if(0==handle && debug) {
-        int err = GetLastError();
-        System.err.println("LoadLibraryW \""+libraryName+"\" failed, error code: 0x"+Integer.toHexString(err)+", "+err);
-    }
-    return handle;
-  }
-  
-  public long lookupSymbol(long libraryHandle, String symbolName) {
-    return GetProcAddressA(libraryHandle, symbolName);
-  }
-  
-  public void closeLibrary(long libraryHandle) {
-    FreeLibrary(libraryHandle);
-  }
-  // ---- End CustomJavaCode .cfg declarations
-
-} // end of class WindowsDynamicLinkerImpl
diff --git a/src/java/com/sun/gluegen/runtime/opengl/GLExtensionNames.java b/src/java/com/sun/gluegen/runtime/opengl/GLExtensionNames.java
deleted file mode 100644
index 3c6f600..0000000
--- a/src/java/com/sun/gluegen/runtime/opengl/GLExtensionNames.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * Copyright (c) 2003-2005 Sun Microsystems, Inc. All Rights Reserved.
- * 
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * 
- * - Redistribution of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * 
- * - Redistribution 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 Sun Microsystems, Inc. or the names of
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * 
- * This software is provided "AS IS," without a warranty of any kind. ALL
- * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
- * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
- * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
- * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
- * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
- * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
- * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
- * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
- * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
- * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- * 
- * You acknowledge that this software is not designed or intended for use
- * in the design, construction, operation or maintenance of any nuclear
- * facility.
- * 
- */
-
-package com.sun.gluegen.runtime.opengl;
-
-import java.util.*;
-import com.sun.gluegen.runtime.*;
-
-public class GLExtensionNames {
-    //GL_XYZ : GL_XYZ, GL_XYZ_GL2, GL_XYZ_ARB, GL_XYZ_OES, GL_XYZ_OML
-    //GL_XYZ : GL_XYZ, GL_GL2_XYZ, GL_ARB_XYZ, GL_OES_XYZ, GL_OML_XYZ
-    //
-    // Pass-1 Unify ARB extensions with the same value
-    // Pass-2 Unify vendor extensions, 
-    //        if exist as an ARB extension with the same value.
-    // Pass-3 Emit
-
-    public static final String[] extensionsARB = { "ARB", "GL2", "OES", "KHR", "OML" };
-    public static final String[] extensionsVEN = { "3DFX", 
-                                                   "AMD",
-                                                   "APPLE",
-                                                   "ATI",
-                                                   "EXT",
-                                                   "HP",
-                                                   "IBM",
-                                                   "MESA",
-                                                   "MESAX",
-                                                   "NV",
-                                                   "SGI",
-                                                   "SGIS",
-                                                   "SGIX",
-                                                   "SUN",
-                                                   "WIN"
-                                                   };
-
-
-    public static final boolean isGLFunction(String str) {
-        return str.startsWith("gl")  || /* str.startsWith("glu") || str.startsWith("glX") || */
-               str.startsWith("egl") || str.startsWith("wgl") || str.startsWith("agl") ||
-               str.startsWith("cgl") ;
-    }
-
-    public static final boolean isGLEnumeration(String str) {
-        return str.startsWith("GL_")  || str.startsWith("GLU_") || str.startsWith("GLX_") ||
-               str.startsWith("EGL_") || str.startsWith("WGL_") || str.startsWith("AGL_") ||
-               str.startsWith("CGL_") ;
-    }
-
-    public static final int getExtensionIdx(String[] extensions, String str, boolean isGLFunc) {
-        if(isGLFunc) {
-            for(int i = extensions.length - 1 ; i>=0 ; i--) {
-                if( str.endsWith(extensions[i]) ) {
-                    return i;
-                }
-            }
-        } else {
-            for(int i = extensions.length - 1 ; i>=0 ; i--) {
-                if( str.endsWith("_"+extensions[i]) ) {
-                    return i;
-                }
-            }
-        }
-        return -1;
-    }
-
-    public static final boolean isExtension(String[] extensions, String str, boolean isGLFunc) {
-        return getExtensionIdx(extensions, str, isGLFunc)>=0;
-    }
-
-    public static final String getExtensionSuffix(String str, boolean isGLFunc) {
-        int idx = getExtensionIdx(extensionsARB, str, isGLFunc);
-        if(idx>=0) {
-            return extensionsARB[idx];
-        }
-        idx = getExtensionIdx(extensionsVEN, str, isGLFunc);
-        if(idx>=0) {
-            return extensionsVEN[idx];
-        }
-        return null;
-    }
-
-    public static final String normalize(String[] extensions, String str, boolean isGLFunc) {
-        boolean touched = false;
-        for(int i = extensions.length - 1 ; !touched && i>=0 ; i--) {
-            if(isGLFunc) {
-                if(str.endsWith(extensions[i])) {
-                    // functions
-                    str = str.substring(0, str.length()-extensions[i].length());
-                    touched=true;
-                }
-            } else {
-                if(str.endsWith("_"+extensions[i])) {
-                    // enums
-                    str = str.substring(0, str.length()-1-extensions[i].length());
-                    touched=true;
-                }
-            }
-        }
-        return str;
-    }
-    public static final String normalizeARB(String str, boolean isGLFunc) {
-        return normalize(extensionsARB, str, isGLFunc);
-    }
-    public static final boolean isExtensionARB(String str, boolean isGLFunc) {
-        return isExtension(extensionsARB, str, isGLFunc);
-    }
-    public static final String normalizeVEN(String str, boolean isGLFunc) {
-        return normalize(extensionsVEN, str, isGLFunc);
-    }
-    public static final boolean isExtensionVEN(String str, boolean isGLFunc) {
-        return isExtension(extensionsVEN, str, isGLFunc);
-    }
-    public static final String normalize(String str, boolean isGLFunc) {
-        if (isExtensionARB(str, isGLFunc)) {
-            return normalizeARB(str, isGLFunc);
-        }
-        if (isExtensionVEN(str, isGLFunc)) {
-            return normalizeVEN(str, isGLFunc);
-        }
-        return str;
-    }
-    public static final boolean isExtension(String str, boolean isGLFunc) {
-        return isExtension(extensionsARB, str, isGLFunc) || 
-               isExtension(extensionsVEN, str, isGLFunc);
-    }
-
-    public static final int getFuncNamePermutationNumber(String name) {
-        if(isExtensionARB(name, true) || isExtensionVEN(name, true)) {
-            // no name permutation, if it's already a known extension
-            return 1;
-        }
-        return 1 + extensionsARB.length + extensionsVEN.length;
-    }
-
-    public static final String getFuncNamePermutation(String name, int i) {
-        // identity
-        if(i==0) {
-            return name;
-        }
-        if(0>i || i>=(1+extensionsARB.length + extensionsVEN.length)) {
-            throw new RuntimeException("Index out of range [0.."+(1+extensionsARB.length+extensionsVEN.length-1)+"]: "+i);
-        }
-        // ARB
-        i-=1;
-        if(i<extensionsARB.length) {
-            return name+extensionsARB[i];
-        }
-        // VEN
-        i-=extensionsARB.length;
-        return name+extensionsVEN[i];
-    }
-}
-
diff --git a/src/java/com/sun/gluegen/runtime/opengl/GLProcAddressHelper.java b/src/java/com/sun/gluegen/runtime/opengl/GLProcAddressHelper.java
deleted file mode 100644
index 4110b6f..0000000
--- a/src/java/com/sun/gluegen/runtime/opengl/GLProcAddressHelper.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (c) 2003-2005 Sun Microsystems, Inc. All Rights Reserved.
- * 
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * 
- * - Redistribution of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * 
- * - Redistribution 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 Sun Microsystems, Inc. or the names of
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * 
- * This software is provided "AS IS," without a warranty of any kind. ALL
- * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
- * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
- * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
- * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
- * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
- * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
- * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
- * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
- * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
- * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- * 
- * You acknowledge that this software is not designed or intended for use
- * in the design, construction, operation or maintenance of any nuclear
- * facility.
- */
-
-package com.sun.gluegen.runtime.opengl;
-
-import com.sun.gluegen.runtime.*;
-
-import java.security.*;
-
-// Debugging only
-import java.io.PrintStream;
-
-/** Helper class containing constants and methods to assist with the
-    manipulation of auto-generated ProcAddressTables. */
-
-public class GLProcAddressHelper extends ProcAddressHelper {
-
-  public static void resetProcAddressTable(Object table,
-                                           DynamicLookupHelper lookup) throws RuntimeException {
-    Class tableClass = table.getClass();
-    java.lang.reflect.Field[] fields = tableClass.getFields();
-    PrintStream dout = getDebugOutStream();
-    
-    if (DEBUG) {
-      dout.println("ProcAddressHelper.resetProcAddressTable(" + table.getClass().getName() + ")");
-    }
-    for (int i = 0; i < fields.length; ++i) {
-      String addressFieldName = fields[i].getName();
-      if (!addressFieldName.startsWith(ProcAddressHelper.PROCADDRESS_VAR_PREFIX)) {
-        // not a proc address variable
-        continue;
-      }
-      int startOfMethodName = ProcAddressHelper.PROCADDRESS_VAR_PREFIX.length();
-      String funcNameBase = addressFieldName.substring(startOfMethodName);
-      java.lang.reflect.Field addressField;
-      try {
-        addressField = fields[i];
-        assert(addressField.getType() == Long.TYPE);
-      } catch (Exception e) {
-        throw new RuntimeException("Can not get proper proc address field for method \"" +
-                                   funcNameBase + "\": Couldn't get field \"" + addressFieldName +
-                                   "\" in class " + tableClass.getName(), e);
-      }
-      long newProcAddress = 0;
-      int  funcNamePermNum = GLExtensionNames.getFuncNamePermutationNumber(funcNameBase);
-      String funcName = null;
-      for(int j = 0; 0==newProcAddress && j < funcNamePermNum; j++) {
-          funcName = GLExtensionNames.getFuncNamePermutation(funcNameBase, j);
-          try {
-            newProcAddress = lookup.dynamicLookupFunction(funcName);
-          } catch (Exception e) { 
-            if (DEBUG) {
-              dout.println(e);
-              e.printStackTrace();
-            }
-          }
-      } 
-      try {
-        // set the current value of the proc address variable in the table object
-        addressField.setLong(table, newProcAddress); 
-        if (DEBUG) {
-          dout.println("  " + addressField.getName() + " "+funcName+" -> 0x" + Long.toHexString(newProcAddress));
-        }
-      } catch (Exception e) {
-        throw new RuntimeException("Can not set proc address field for method \"" +
-                                   funcNameBase + "\": Couldn't set field \"" + addressFieldName +
-                                   "\" in class " + tableClass.getName(), e);
-      }
-    }
-    if (DEBUG) {
-      dout.flush();
-      if (DEBUG_PREFIX != null) {
-        dout.close();
-      }
-    }
-  }
-}
diff --git a/src/java/com/sun/gluegen/test/TestPointerBufferEndian.java b/src/java/com/sun/gluegen/test/TestPointerBufferEndian.java
index ba77eed..cd9e0cc 100644
--- a/src/java/com/sun/gluegen/test/TestPointerBufferEndian.java
+++ b/src/java/com/sun/gluegen/test/TestPointerBufferEndian.java
@@ -1,7 +1,7 @@
 
 package com.sun.gluegen.test;
 
-import com.sun.gluegen.runtime.*;
+import com.jogamp.gluegen.runtime.*;
 import java.nio.*;
 
 public class TestPointerBufferEndian {
diff --git a/src/java/com/sun/gluegen/test/TestStructAccessorEndian.java b/src/java/com/sun/gluegen/test/TestStructAccessorEndian.java
index dc53a10..53ff0ef 100644
--- a/src/java/com/sun/gluegen/test/TestStructAccessorEndian.java
+++ b/src/java/com/sun/gluegen/test/TestStructAccessorEndian.java
@@ -1,7 +1,7 @@
 
 package com.sun.gluegen.test;
 
-import com.sun.gluegen.runtime.*;
+import com.jogamp.gluegen.runtime.*;
 import java.nio.*;
 
 public class TestStructAccessorEndian {
diff --git a/src/junit/com/jogamp/gluegen/test/junit/Test1.java b/src/junit/com/jogamp/gluegen/test/junit/Test1.java
index 258256a..07bd971 100644
--- a/src/junit/com/jogamp/gluegen/test/junit/Test1.java
+++ b/src/junit/com/jogamp/gluegen/test/junit/Test1.java
@@ -32,8 +32,8 @@
 
 package com.jogamp.gluegen.test.junit;
 
-import com.sun.gluegen.runtime.BufferFactory;
-import com.sun.gluegen.runtime.PointerBuffer;
+import com.jogamp.gluegen.runtime.BufferFactory;
+import com.jogamp.gluegen.runtime.PointerBuffer;
 import java.io.File;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
diff --git a/src/native/common/CPU.c b/src/native/common/CPU.c
index 8c4135c..cde2732 100644
--- a/src/native/common/CPU.c
+++ b/src/native/common/CPU.c
@@ -4,7 +4,7 @@
 #include <assert.h>
 
 JNIEXPORT jint JNICALL 
-Java_com_sun_gluegen_runtime_CPU_getPointerSizeInBits(JNIEnv *env, jclass _unused) {
+Java_com_jogamp_gluegen_runtime_CPU_getPointerSizeInBits(JNIEnv *env, jclass _unused) {
     return sizeof(void *) * 8;
 }
 
diff --git a/src/native/macosx/MacOSXDynamicLinkerImpl_JNI.c b/src/native/macosx/MacOSXDynamicLinkerImpl_JNI.c
index 2b0a2a7..e6017d7 100755
--- a/src/native/macosx/MacOSXDynamicLinkerImpl_JNI.c
+++ b/src/native/macosx/MacOSXDynamicLinkerImpl_JNI.c
@@ -8,12 +8,12 @@
  #include </usr/include/machine/types.h>
 
 /*   Java->C glue code:
- *   Java package: com.sun.gluegen.runtime.MacOSXDynamicLinkerImpl
+ *   Java package: com.jogamp.gluegen.runtime.MacOSXDynamicLinkerImpl
  *    Java method: int dlclose(long __handle)
  *     C function: int dlclose(void *  __handle);
  */
 JNIEXPORT jint JNICALL 
-Java_com_sun_gluegen_runtime_MacOSXDynamicLinkerImpl_dlclose__J(JNIEnv *env, jclass _unused, jlong __handle) {
+Java_com_jogamp_gluegen_runtime_MacOSXDynamicLinkerImpl_dlclose__J(JNIEnv *env, jclass _unused, jlong __handle) {
   int _res;
   _res = dlclose((void *) (intptr_t) __handle);
   return _res;
@@ -21,12 +21,12 @@ Java_com_sun_gluegen_runtime_MacOSXDynamicLinkerImpl_dlclose__J(JNIEnv *env, jcl
 
 
 /*   Java->C glue code:
- *   Java package: com.sun.gluegen.runtime.MacOSXDynamicLinkerImpl
+ *   Java package: com.jogamp.gluegen.runtime.MacOSXDynamicLinkerImpl
  *    Java method: java.lang.String dlerror()
  *     C function: char *  dlerror(void);
  */
 JNIEXPORT jstring JNICALL 
-Java_com_sun_gluegen_runtime_MacOSXDynamicLinkerImpl_dlerror__(JNIEnv *env, jclass _unused) {
+Java_com_jogamp_gluegen_runtime_MacOSXDynamicLinkerImpl_dlerror__(JNIEnv *env, jclass _unused) {
   char *  _res;
   _res = dlerror();
   if (_res == NULL) return NULL;  return (*env)->NewStringUTF(env, _res);
@@ -34,12 +34,12 @@ Java_com_sun_gluegen_runtime_MacOSXDynamicLinkerImpl_dlerror__(JNIEnv *env, jcla
 
 
 /*   Java->C glue code:
- *   Java package: com.sun.gluegen.runtime.MacOSXDynamicLinkerImpl
+ *   Java package: com.jogamp.gluegen.runtime.MacOSXDynamicLinkerImpl
  *    Java method: long dlopen(java.lang.String __path, int __mode)
  *     C function: void *  dlopen(const char *  __path, int __mode);
  */
 JNIEXPORT jlong JNICALL 
-Java_com_sun_gluegen_runtime_MacOSXDynamicLinkerImpl_dlopen__Ljava_lang_String_2I(JNIEnv *env, jclass _unused, jstring __path, jint __mode) {
+Java_com_jogamp_gluegen_runtime_MacOSXDynamicLinkerImpl_dlopen__Ljava_lang_String_2I(JNIEnv *env, jclass _unused, jstring __path, jint __mode) {
   const char* _UTF8__path = NULL;
   void *  _res;
   if (__path != NULL) {
@@ -61,12 +61,12 @@ Java_com_sun_gluegen_runtime_MacOSXDynamicLinkerImpl_dlopen__Ljava_lang_String_2
 
 
 /*   Java->C glue code:
- *   Java package: com.sun.gluegen.runtime.MacOSXDynamicLinkerImpl
+ *   Java package: com.jogamp.gluegen.runtime.MacOSXDynamicLinkerImpl
  *    Java method: long dlsym(long __handle, java.lang.String __symbol)
  *     C function: void *  dlsym(void *  __handle, const char *  __symbol);
  */
 JNIEXPORT jlong JNICALL 
-Java_com_sun_gluegen_runtime_MacOSXDynamicLinkerImpl_dlsym__JLjava_lang_String_2(JNIEnv *env, jclass _unused, jlong __handle, jstring __symbol) {
+Java_com_jogamp_gluegen_runtime_MacOSXDynamicLinkerImpl_dlsym__JLjava_lang_String_2(JNIEnv *env, jclass _unused, jlong __handle, jstring __symbol) {
   const char* _UTF8__symbol = NULL;
   void *  _res;
   if (__symbol != NULL) {
diff --git a/src/native/unix/UnixDynamicLinkerImpl_JNI.c b/src/native/unix/UnixDynamicLinkerImpl_JNI.c
index 6d72646..937c71c 100755
--- a/src/native/unix/UnixDynamicLinkerImpl_JNI.c
+++ b/src/native/unix/UnixDynamicLinkerImpl_JNI.c
@@ -8,12 +8,12 @@
  #include <inttypes.h>
 
 /*   Java->C glue code:
- *   Java package: com.sun.gluegen.runtime.UnixDynamicLinkerImpl
+ *   Java package: com.jogamp.gluegen.runtime.UnixDynamicLinkerImpl
  *    Java method: int dlclose(long arg0)
  *     C function: int dlclose(void * );
  */
 JNIEXPORT jint JNICALL 
-Java_com_sun_gluegen_runtime_UnixDynamicLinkerImpl_dlclose__J(JNIEnv *env, jclass _unused, jlong arg0) {
+Java_com_jogamp_gluegen_runtime_UnixDynamicLinkerImpl_dlclose__J(JNIEnv *env, jclass _unused, jlong arg0) {
   int _res;
   _res = dlclose((void *) (intptr_t) arg0);
   return _res;
@@ -21,12 +21,12 @@ Java_com_sun_gluegen_runtime_UnixDynamicLinkerImpl_dlclose__J(JNIEnv *env, jclas
 
 
 /*   Java->C glue code:
- *   Java package: com.sun.gluegen.runtime.UnixDynamicLinkerImpl
+ *   Java package: com.jogamp.gluegen.runtime.UnixDynamicLinkerImpl
  *    Java method: java.lang.String dlerror()
  *     C function: char *  dlerror(void);
  */
 JNIEXPORT jstring JNICALL 
-Java_com_sun_gluegen_runtime_UnixDynamicLinkerImpl_dlerror__(JNIEnv *env, jclass _unused) {
+Java_com_jogamp_gluegen_runtime_UnixDynamicLinkerImpl_dlerror__(JNIEnv *env, jclass _unused) {
   char *  _res;
   _res = dlerror();
   if (_res == NULL) return NULL;  return (*env)->NewStringUTF(env, _res);
@@ -34,12 +34,12 @@ Java_com_sun_gluegen_runtime_UnixDynamicLinkerImpl_dlerror__(JNIEnv *env, jclass
 
 
 /*   Java->C glue code:
- *   Java package: com.sun.gluegen.runtime.UnixDynamicLinkerImpl
+ *   Java package: com.jogamp.gluegen.runtime.UnixDynamicLinkerImpl
  *    Java method: long dlopen(java.lang.String arg0, int arg1)
  *     C function: void *  dlopen(const char * , int);
  */
 JNIEXPORT jlong JNICALL 
-Java_com_sun_gluegen_runtime_UnixDynamicLinkerImpl_dlopen__Ljava_lang_String_2I(JNIEnv *env, jclass _unused, jstring arg0, jint arg1) {
+Java_com_jogamp_gluegen_runtime_UnixDynamicLinkerImpl_dlopen__Ljava_lang_String_2I(JNIEnv *env, jclass _unused, jstring arg0, jint arg1) {
   const char* _UTF8arg0 = NULL;
   void *  _res;
   if (arg0 != NULL) {
@@ -61,12 +61,12 @@ Java_com_sun_gluegen_runtime_UnixDynamicLinkerImpl_dlopen__Ljava_lang_String_2I(
 
 
 /*   Java->C glue code:
- *   Java package: com.sun.gluegen.runtime.UnixDynamicLinkerImpl
+ *   Java package: com.jogamp.gluegen.runtime.UnixDynamicLinkerImpl
  *    Java method: long dlsym(long arg0, java.lang.String arg1)
  *     C function: void *  dlsym(void * , const char * );
  */
 JNIEXPORT jlong JNICALL 
-Java_com_sun_gluegen_runtime_UnixDynamicLinkerImpl_dlsym__JLjava_lang_String_2(JNIEnv *env, jclass _unused, jlong arg0, jstring arg1) {
+Java_com_jogamp_gluegen_runtime_UnixDynamicLinkerImpl_dlsym__JLjava_lang_String_2(JNIEnv *env, jclass _unused, jlong arg0, jstring arg1) {
   const char* _UTF8arg1 = NULL;
   void *  _res;
   if (arg1 != NULL) {
diff --git a/src/native/windows/WindowsDynamicLinkerImpl_JNI.c b/src/native/windows/WindowsDynamicLinkerImpl_JNI.c
index 63afd99..35ea742 100755
--- a/src/native/windows/WindowsDynamicLinkerImpl_JNI.c
+++ b/src/native/windows/WindowsDynamicLinkerImpl_JNI.c
@@ -17,12 +17,12 @@
  #endif
 
 /*   Java->C glue code:
- *   Java package: com.sun.gluegen.runtime.WindowsDynamicLinkerImpl
+ *   Java package: com.jogamp.gluegen.runtime.WindowsDynamicLinkerImpl
  *    Java method: int FreeLibrary(long hLibModule)
  *     C function: BOOL FreeLibrary(HANDLE hLibModule);
  */
 JNIEXPORT jint JNICALL 
-Java_com_sun_gluegen_runtime_WindowsDynamicLinkerImpl_FreeLibrary__J(JNIEnv *env, jclass _unused, jlong hLibModule) {
+Java_com_jogamp_gluegen_runtime_WindowsDynamicLinkerImpl_FreeLibrary__J(JNIEnv *env, jclass _unused, jlong hLibModule) {
   BOOL _res;
   _res = FreeLibrary((HANDLE) (intptr_t) hLibModule);
   return _res;
@@ -30,12 +30,12 @@ Java_com_sun_gluegen_runtime_WindowsDynamicLinkerImpl_FreeLibrary__J(JNIEnv *env
 
 
 /*   Java->C glue code:
- *   Java package: com.sun.gluegen.runtime.WindowsDynamicLinkerImpl
+ *   Java package: com.jogamp.gluegen.runtime.WindowsDynamicLinkerImpl
  *    Java method: int GetLastError()
  *     C function: DWORD GetLastError(void);
  */
 JNIEXPORT jint JNICALL 
-Java_com_sun_gluegen_runtime_WindowsDynamicLinkerImpl_GetLastError__(JNIEnv *env, jclass _unused) {
+Java_com_jogamp_gluegen_runtime_WindowsDynamicLinkerImpl_GetLastError__(JNIEnv *env, jclass _unused) {
   DWORD _res;
   _res = GetLastError();
   return _res;
@@ -43,12 +43,12 @@ Java_com_sun_gluegen_runtime_WindowsDynamicLinkerImpl_GetLastError__(JNIEnv *env
 
 
 /*   Java->C glue code:
- *   Java package: com.sun.gluegen.runtime.WindowsDynamicLinkerImpl
+ *   Java package: com.jogamp.gluegen.runtime.WindowsDynamicLinkerImpl
  *    Java method: long GetProcAddressA(long hModule, java.lang.String lpProcName)
  *     C function: PROC GetProcAddressA(HANDLE hModule, LPCSTR lpProcName);
  */
 JNIEXPORT jlong JNICALL 
-Java_com_sun_gluegen_runtime_WindowsDynamicLinkerImpl_GetProcAddressA__JLjava_lang_String_2(JNIEnv *env, jclass _unused, jlong hModule, jstring lpProcName) {
+Java_com_jogamp_gluegen_runtime_WindowsDynamicLinkerImpl_GetProcAddressA__JLjava_lang_String_2(JNIEnv *env, jclass _unused, jlong hModule, jstring lpProcName) {
   const char* _strchars_lpProcName = NULL;
   PROC _res;
   if (lpProcName != NULL) {
@@ -68,12 +68,12 @@ Java_com_sun_gluegen_runtime_WindowsDynamicLinkerImpl_GetProcAddressA__JLjava_la
 
 
 /*   Java->C glue code:
- *   Java package: com.sun.gluegen.runtime.WindowsDynamicLinkerImpl
+ *   Java package: com.jogamp.gluegen.runtime.WindowsDynamicLinkerImpl
  *    Java method: long LoadLibraryW(java.lang.String lpLibFileName)
  *     C function: HANDLE LoadLibraryW(LPCWSTR lpLibFileName);
  */
 JNIEXPORT jlong JNICALL 
-Java_com_sun_gluegen_runtime_WindowsDynamicLinkerImpl_LoadLibraryW__Ljava_lang_String_2(JNIEnv *env, jclass _unused, jstring lpLibFileName) {
+Java_com_jogamp_gluegen_runtime_WindowsDynamicLinkerImpl_LoadLibraryW__Ljava_lang_String_2(JNIEnv *env, jclass _unused, jstring lpLibFileName) {
   jchar* _strchars_lpLibFileName = NULL;
   HANDLE _res;
   if (lpLibFileName != NULL) {
-- 
cgit v1.2.3