aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/com
diff options
context:
space:
mode:
Diffstat (limited to 'src/java/com')
-rwxr-xr-xsrc/java/com/jogamp/common/nio/Buffers.java8
-rwxr-xr-xsrc/java/com/jogamp/common/os/DynamicLinker.java1
-rwxr-xr-xsrc/java/com/jogamp/common/os/MacOSXDynamicLinkerImpl.java6
-rwxr-xr-xsrc/java/com/jogamp/common/os/NativeLibrary.java9
-rwxr-xr-xsrc/java/com/jogamp/common/os/UnixDynamicLinkerImpl.java5
-rwxr-xr-xsrc/java/com/jogamp/common/os/WindowsDynamicLinkerImpl.java4
-rw-r--r--src/java/com/jogamp/common/util/IntIntHashMap.java12
7 files changed, 45 insertions, 0 deletions
diff --git a/src/java/com/jogamp/common/nio/Buffers.java b/src/java/com/jogamp/common/nio/Buffers.java
index e3bea17..0c16b4d 100755
--- a/src/java/com/jogamp/common/nio/Buffers.java
+++ b/src/java/com/jogamp/common/nio/Buffers.java
@@ -505,6 +505,14 @@ public class Buffers {
//----------------------------------------------------------------------
// Conversion routines
//
+
+ public static float[] getFloatArray(double[] source) {
+ int i=source.length;
+ float[] dest = new float[i--];
+ while(i>=0) { dest[i]=(float)source[i]; i--; }
+ return dest;
+ }
+
public final static FloatBuffer getFloatBuffer(DoubleBuffer source) {
source.rewind();
FloatBuffer dest = newDirectFloatBuffer(source.limit());
diff --git a/src/java/com/jogamp/common/os/DynamicLinker.java b/src/java/com/jogamp/common/os/DynamicLinker.java
index ef5d5dc..d67a38f 100755
--- a/src/java/com/jogamp/common/os/DynamicLinker.java
+++ b/src/java/com/jogamp/common/os/DynamicLinker.java
@@ -46,5 +46,6 @@ interface DynamicLinker {
public long openLibraryGlobal(String pathname, boolean debug);
public long openLibraryLocal(String pathname, boolean debug);
public long lookupSymbol(long libraryHandle, String symbolName);
+ public long lookupSymbolGlobal(String symbolName);
public void closeLibrary(long libraryHandle);
}
diff --git a/src/java/com/jogamp/common/os/MacOSXDynamicLinkerImpl.java b/src/java/com/jogamp/common/os/MacOSXDynamicLinkerImpl.java
index 531bc5c..0e71d5d 100755
--- a/src/java/com/jogamp/common/os/MacOSXDynamicLinkerImpl.java
+++ b/src/java/com/jogamp/common/os/MacOSXDynamicLinkerImpl.java
@@ -5,6 +5,8 @@ package com.jogamp.common.os;
public class MacOSXDynamicLinkerImpl implements DynamicLinker {
+ public static final long RTLD_DEFAULT = -2;
+
public static final int RTLD_LAZY = 0x1;
public static final int RTLD_NOW = 0x2;
public static final int RTLD_LOCAL = 0x4;
@@ -50,6 +52,10 @@ public class MacOSXDynamicLinkerImpl implements DynamicLinker {
return dlsym(libraryHandle, symbolName);
}
+ public long lookupSymbolGlobal(String symbolName) {
+ return dlsym(RTLD_DEFAULT, symbolName);
+ }
+
public void closeLibrary(long libraryHandle) {
dlclose(libraryHandle);
}
diff --git a/src/java/com/jogamp/common/os/NativeLibrary.java b/src/java/com/jogamp/common/os/NativeLibrary.java
index 2de8bc9..897e240 100755
--- a/src/java/com/jogamp/common/os/NativeLibrary.java
+++ b/src/java/com/jogamp/common/os/NativeLibrary.java
@@ -122,6 +122,10 @@ public class NativeLibrary implements DynamicLookupHelper {
this.libraryPath = libraryPath;
}
+ public String toString() {
+ return "NativeLibrary[" + libraryPath + ", 0x" + Long.toHexString(libraryHandle) + "]";
+ }
+
/** 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
@@ -209,6 +213,11 @@ public class NativeLibrary implements DynamicLookupHelper {
return dynLink.lookupSymbol(libraryHandle, funcName);
}
+ /** Looks up the given function name in all loaded libraries. */
+ public static long dynamicLookupFunctionGlobal(String funcName) {
+ return dynLink.lookupSymbolGlobal(funcName);
+ }
+
/** 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(). */
diff --git a/src/java/com/jogamp/common/os/UnixDynamicLinkerImpl.java b/src/java/com/jogamp/common/os/UnixDynamicLinkerImpl.java
index 02bc828..d2970d6 100755
--- a/src/java/com/jogamp/common/os/UnixDynamicLinkerImpl.java
+++ b/src/java/com/jogamp/common/os/UnixDynamicLinkerImpl.java
@@ -5,6 +5,7 @@ package com.jogamp.common.os;
public class UnixDynamicLinkerImpl implements DynamicLinker {
+ public static final long RTLD_DEFAULT = 0;
public static final int RTLD_LAZY = 0x00001;
public static final int RTLD_NOW = 0x00002;
public static final int RTLD_NOLOAD = 0x00004;
@@ -55,6 +56,10 @@ public class UnixDynamicLinkerImpl implements DynamicLinker {
public long lookupSymbol(long libraryHandle, String symbolName) {
return dlsym(libraryHandle, symbolName);
}
+
+ public long lookupSymbolGlobal(String symbolName) {
+ return dlsym(RTLD_DEFAULT, symbolName);
+ }
public void closeLibrary(long libraryHandle) {
dlclose(libraryHandle);
diff --git a/src/java/com/jogamp/common/os/WindowsDynamicLinkerImpl.java b/src/java/com/jogamp/common/os/WindowsDynamicLinkerImpl.java
index 2858f74..935f386 100755
--- a/src/java/com/jogamp/common/os/WindowsDynamicLinkerImpl.java
+++ b/src/java/com/jogamp/common/os/WindowsDynamicLinkerImpl.java
@@ -65,6 +65,10 @@ public class WindowsDynamicLinkerImpl implements DynamicLinker {
return addr;
}
+ public long lookupSymbolGlobal(String symbolName) {
+ throw new RuntimeException("lookupSymbolGlobal: Not supported on Windows");
+ }
+
public void closeLibrary(long libraryHandle) {
FreeLibrary(libraryHandle);
}
diff --git a/src/java/com/jogamp/common/util/IntIntHashMap.java b/src/java/com/jogamp/common/util/IntIntHashMap.java
index aa739b4..9e2b3bc 100644
--- a/src/java/com/jogamp/common/util/IntIntHashMap.java
+++ b/src/java/com/jogamp/common/util/IntIntHashMap.java
@@ -177,6 +177,18 @@ public class /*name*/IntIntHashMap/*name*/ implements Iterable {
}
/**
+ * Copies all of the mappings from the specified map to this map.
+ */
+// @SuppressWarnings(value="cast")
+ public void putAll(/*name*/IntIntHashMap/*name*/ source) {
+ Iterator itr = source.iterator();
+ while(itr.hasNext()) {
+ Entry e = (Entry) itr.next();
+ put(e.key, e.value);
+ }
+ }
+
+ /**
* Removes the key-value mapping from this map.
* Returns the previously mapped value or {@link #getKeyNotFoundValue} if no such mapping exists.
*/