summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/java/com/jogamp/common/GlueGenVersion.java10
-rw-r--r--src/java/com/jogamp/common/JogampRuntimeException.java10
-rw-r--r--src/java/com/jogamp/common/jvm/JNILibLoaderBase.java96
-rw-r--r--src/java/com/jogamp/common/net/AssetURLConnection.java42
-rw-r--r--src/java/com/jogamp/common/net/AssetURLContext.java60
-rw-r--r--src/java/com/jogamp/common/net/AssetURLStreamHandler.java16
-rw-r--r--src/java/com/jogamp/common/net/GenericURLStreamHandlerFactory.java12
-rw-r--r--src/java/com/jogamp/common/net/PiggybackURLConnection.java26
-rw-r--r--src/java/com/jogamp/common/net/PiggybackURLContext.java10
-rw-r--r--src/java/com/jogamp/common/net/asset/Handler.java12
-rw-r--r--src/java/com/jogamp/common/nio/AbstractBuffer.java20
-rw-r--r--src/java/com/jogamp/common/nio/Buffers.java156
-rw-r--r--src/java/com/jogamp/common/nio/CachedBufferFactory.java54
-rw-r--r--src/java/com/jogamp/common/nio/NativeBuffer.java16
-rw-r--r--src/java/com/jogamp/common/nio/PointerBuffer.java44
-rw-r--r--src/java/com/jogamp/common/nio/StructAccessor.java50
-rw-r--r--src/java/com/jogamp/common/os/AndroidVersion.java28
-rw-r--r--src/java/com/jogamp/common/os/DynamicLibraryBundle.java58
-rw-r--r--src/java/com/jogamp/common/os/DynamicLibraryBundleInfo.java40
-rw-r--r--src/java/com/jogamp/common/os/DynamicLinker.java36
-rw-r--r--src/java/com/jogamp/common/os/DynamicLookupHelper.java20
-rw-r--r--src/java/com/jogamp/common/os/MachineDescription.java82
-rw-r--r--src/java/com/jogamp/common/os/NativeLibrary.java58
-rw-r--r--src/java/com/jogamp/common/os/Platform.java148
-rw-r--r--src/java/com/jogamp/common/util/ArrayHashSet.java14
-rw-r--r--src/java/com/jogamp/common/util/FloatStack.java60
-rw-r--r--src/java/com/jogamp/common/util/Function.java12
-rw-r--r--src/java/com/jogamp/common/util/FunctionTask.java28
-rw-r--r--src/java/com/jogamp/common/util/HashUtil.java20
-rw-r--r--src/java/com/jogamp/common/util/IOUtil.java346
-rw-r--r--src/java/com/jogamp/common/util/IntBitfield.java42
-rw-r--r--src/java/com/jogamp/common/util/IntIntHashMap.java90
-rw-r--r--src/java/com/jogamp/common/util/JarUtil.java178
-rw-r--r--src/java/com/jogamp/common/util/JogampVersion.java18
-rw-r--r--src/java/com/jogamp/common/util/LFRingbuffer.java100
-rw-r--r--src/java/com/jogamp/common/util/PrimitiveStack.java28
-rw-r--r--src/java/com/jogamp/common/util/PropertyAccess.java46
-rw-r--r--src/java/com/jogamp/common/util/ReflectionUtil.java54
-rw-r--r--src/java/com/jogamp/common/util/Ringbuffer.java58
-rw-r--r--src/java/com/jogamp/common/util/RunnableExecutor.java22
-rw-r--r--src/java/com/jogamp/common/util/RunnableTask.java30
-rw-r--r--src/java/com/jogamp/common/util/SecurityUtil.java44
-rw-r--r--src/java/com/jogamp/common/util/SyncedRingbuffer.java94
-rw-r--r--src/java/com/jogamp/common/util/TaskBase.java50
-rw-r--r--src/java/com/jogamp/common/util/ValueConv.java36
-rw-r--r--src/java/com/jogamp/common/util/VersionNumber.java76
-rw-r--r--src/java/com/jogamp/common/util/VersionNumberString.java20
-rw-r--r--src/java/com/jogamp/common/util/VersionUtil.java18
-rw-r--r--src/java/com/jogamp/common/util/awt/AWTEDTExecutor.java20
-rw-r--r--src/java/com/jogamp/common/util/cache/TempFileCache.java54
-rw-r--r--src/java/com/jogamp/common/util/cache/TempJarCache.java144
-rw-r--r--src/java/com/jogamp/common/util/locks/Lock.java6
-rw-r--r--src/java/com/jogamp/common/util/locks/LockFactory.java14
-rw-r--r--src/java/com/jogamp/common/util/locks/RecursiveLock.java2
-rw-r--r--src/java/com/jogamp/common/util/locks/RecursiveThreadGroupLock.java66
-rw-r--r--src/java/com/jogamp/common/util/locks/SingletonInstance.java20
-rw-r--r--src/java/com/jogamp/common/util/locks/ThreadLock.java14
-rw-r--r--src/java/com/jogamp/gluegen/ArrayTypes.java14
-rw-r--r--src/java/com/jogamp/gluegen/CMethodBindingEmitter.java130
-rw-r--r--src/java/com/jogamp/gluegen/CodeGenUtils.java14
-rw-r--r--src/java/com/jogamp/gluegen/CommentEmitter.java16
-rw-r--r--src/java/com/jogamp/gluegen/ConstantDefinition.java22
-rw-r--r--src/java/com/jogamp/gluegen/DebugEmitter.java20
-rw-r--r--src/java/com/jogamp/gluegen/FunctionEmitter.java38
-rw-r--r--src/java/com/jogamp/gluegen/GlueEmitter.java16
-rw-r--r--src/java/com/jogamp/gluegen/GlueEmitterControls.java14
-rw-r--r--src/java/com/jogamp/gluegen/GlueGen.java24
-rw-r--r--src/java/com/jogamp/gluegen/JavaConfiguration.java62
-rw-r--r--src/java/com/jogamp/gluegen/JavaEmitter.java48
-rw-r--r--src/java/com/jogamp/gluegen/JavaMethodBindingEmitter.java2
-rw-r--r--src/java/com/jogamp/gluegen/JavaType.java36
-rw-r--r--src/java/com/jogamp/gluegen/Logging.java14
-rw-r--r--src/java/com/jogamp/gluegen/ReferencedStructs.java16
-rw-r--r--src/java/com/jogamp/gluegen/SymbolFilter.java12
-rw-r--r--src/java/com/jogamp/gluegen/TypeInfo.java14
-rw-r--r--src/java/com/jogamp/gluegen/cgram/CSymbolTable.java12
-rw-r--r--src/java/com/jogamp/gluegen/cgram/CToken.java12
-rw-r--r--src/java/com/jogamp/gluegen/cgram/Define.java14
-rw-r--r--src/java/com/jogamp/gluegen/cgram/LineObject.java30
-rw-r--r--src/java/com/jogamp/gluegen/cgram/PreprocessorInfoChannel.java4
-rw-r--r--src/java/com/jogamp/gluegen/cgram/TNode.java104
-rw-r--r--src/java/com/jogamp/gluegen/cgram/TNodeFactory.java6
-rw-r--r--src/java/com/jogamp/gluegen/cgram/types/ArrayType.java16
-rw-r--r--src/java/com/jogamp/gluegen/cgram/types/BitType.java16
-rw-r--r--src/java/com/jogamp/gluegen/cgram/types/CVAttributes.java14
-rw-r--r--src/java/com/jogamp/gluegen/cgram/types/CompoundType.java20
-rw-r--r--src/java/com/jogamp/gluegen/cgram/types/CompoundTypeKind.java12
-rw-r--r--src/java/com/jogamp/gluegen/cgram/types/DoubleType.java14
-rw-r--r--src/java/com/jogamp/gluegen/cgram/types/EnumType.java14
-rw-r--r--src/java/com/jogamp/gluegen/cgram/types/Field.java14
-rw-r--r--src/java/com/jogamp/gluegen/cgram/types/FloatType.java14
-rw-r--r--src/java/com/jogamp/gluegen/cgram/types/FunctionSymbol.java20
-rw-r--r--src/java/com/jogamp/gluegen/cgram/types/FunctionType.java14
-rw-r--r--src/java/com/jogamp/gluegen/cgram/types/IntType.java14
-rw-r--r--src/java/com/jogamp/gluegen/cgram/types/MemoryLayoutType.java12
-rw-r--r--src/java/com/jogamp/gluegen/cgram/types/PointerType.java14
-rw-r--r--src/java/com/jogamp/gluegen/cgram/types/PrimitiveType.java14
-rw-r--r--src/java/com/jogamp/gluegen/cgram/types/SizeThunk.java38
-rw-r--r--src/java/com/jogamp/gluegen/cgram/types/StructLayout.java20
-rw-r--r--src/java/com/jogamp/gluegen/cgram/types/StructType.java14
-rw-r--r--src/java/com/jogamp/gluegen/cgram/types/TypeDictionary.java18
-rw-r--r--src/java/com/jogamp/gluegen/cgram/types/TypeVisitor.java14
-rw-r--r--src/java/com/jogamp/gluegen/cgram/types/UnionType.java16
-rw-r--r--src/java/com/jogamp/gluegen/cgram/types/VoidType.java14
-rw-r--r--src/java/com/jogamp/gluegen/jgram/Test.java6
-rw-r--r--src/java/com/jogamp/gluegen/pcpp/ConcatenatingReader.java14
-rw-r--r--src/java/com/jogamp/gluegen/procaddress/ProcAddressCMethodBindingEmitter.java16
-rw-r--r--src/java/com/jogamp/gluegen/procaddress/ProcAddressConfiguration.java14
-rw-r--r--src/java/com/jogamp/gluegen/procaddress/ProcAddressEmitter.java30
-rw-r--r--src/java/com/jogamp/gluegen/procaddress/ProcAddressJavaMethodBindingEmitter.java16
-rw-r--r--src/java/com/jogamp/gluegen/runtime/FunctionAddressResolver.java10
-rw-r--r--src/java/com/jogamp/gluegen/runtime/ProcAddressTable.java36
-rw-r--r--src/java/com/jogamp/gluegen/structgen/CStructAnnotationProcessor.java22
-rw-r--r--src/java/jogamp/common/Debug.java16
-rw-r--r--src/java/jogamp/common/jvm/JVMUtil.java14
-rw-r--r--src/java/jogamp/common/os/AndroidUtils.java28
-rw-r--r--src/java/jogamp/common/os/BionicDynamicLinkerImpl.java8
-rw-r--r--src/java/jogamp/common/os/DynamicLinkerImpl.java14
-rw-r--r--src/java/jogamp/common/os/MacOSXDynamicLinkerImpl.java6
-rw-r--r--src/java/jogamp/common/os/MachineDescriptionRuntime.java46
-rw-r--r--src/java/jogamp/common/os/PlatformPropsImpl.java104
-rw-r--r--src/java/jogamp/common/os/PosixDynamicLinkerImpl.java4
-rw-r--r--src/java/jogamp/common/os/UnixDynamicLinkerImpl.java12
-rw-r--r--src/java/jogamp/common/os/WindowsDynamicLinkerImpl.java8
-rw-r--r--src/java/jogamp/common/os/elf/ElfHeader.java148
-rw-r--r--src/java/jogamp/common/os/elf/IOUtils.java54
-rw-r--r--src/java/jogamp/common/os/elf/Section.java6
-rw-r--r--src/java/jogamp/common/os/elf/SectionArmAttributes.java100
-rw-r--r--src/java/jogamp/common/os/elf/SectionHeader.java32
-rw-r--r--src/java/jogamp/common/util/locks/LockDebugUtil.java4
-rw-r--r--src/java/jogamp/common/util/locks/RecursiveLockImpl01CompleteFair.java54
-rw-r--r--src/java/jogamp/common/util/locks/RecursiveLockImpl01Unfairish.java54
-rw-r--r--src/java/jogamp/common/util/locks/RecursiveLockImplJava5.java6
-rw-r--r--src/java/jogamp/common/util/locks/RecursiveThreadGroupLockImpl01Unfairish.java66
-rw-r--r--src/java/jogamp/common/util/locks/SingletonInstanceFileLock.java14
-rw-r--r--src/java/jogamp/common/util/locks/SingletonInstanceServerSocket.java76
136 files changed, 2508 insertions, 2508 deletions
diff --git a/src/java/com/jogamp/common/GlueGenVersion.java b/src/java/com/jogamp/common/GlueGenVersion.java
index 5ae3412..a20b153 100644
--- a/src/java/com/jogamp/common/GlueGenVersion.java
+++ b/src/java/com/jogamp/common/GlueGenVersion.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.common;
import com.jogamp.common.util.JogampVersion;
diff --git a/src/java/com/jogamp/common/JogampRuntimeException.java b/src/java/com/jogamp/common/JogampRuntimeException.java
index 1dd7519..7298812 100644
--- a/src/java/com/jogamp/common/JogampRuntimeException.java
+++ b/src/java/com/jogamp/common/JogampRuntimeException.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.common;
/** A generic exception for Jogamp errors used throughout the binding
diff --git a/src/java/com/jogamp/common/jvm/JNILibLoaderBase.java b/src/java/com/jogamp/common/jvm/JNILibLoaderBase.java
index 67cc05c..1b19d04 100644
--- a/src/java/com/jogamp/common/jvm/JNILibLoaderBase.java
+++ b/src/java/com/jogamp/common/jvm/JNILibLoaderBase.java
@@ -1,21 +1,21 @@
/*
* 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
@@ -28,11 +28,11 @@
* 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.
*/
@@ -62,14 +62,14 @@ import jogamp.common.Debug;
import jogamp.common.os.PlatformPropsImpl;
public class JNILibLoaderBase {
- public static final boolean DEBUG = Debug.debug("JNILibLoader");
+ public static final boolean DEBUG = Debug.debug("JNILibLoader");
public interface LoaderAction {
/**
* Loads the library specified by libname.<br>
* The implementation should ignore, if the library has been loaded already.<br>
* @param libname the library to load
- * @param ignoreError if true, errors during loading the library should be ignored
+ * @param ignoreError if true, errors during loading the library should be ignored
* @param cl optional ClassLoader, used to locate the library
* @return true if library loaded successful
*/
@@ -81,12 +81,12 @@ public class JNILibLoaderBase {
* The implementation should ignore, if any library has been loaded already.<br>
* @param libname the library to load
* @param preload the libraries to load before loading the main library if not null
- * @param preloadIgnoreError if true, errors during loading the preload-libraries should be ignored
+ * @param preloadIgnoreError if true, errors during loading the preload-libraries should be ignored
* @param cl optional ClassLoader, used to locate the library
*/
void loadLibrary(String libname, String[] preload, boolean preloadIgnoreError, ClassLoader cl);
}
-
+
private static class DefaultAction implements LoaderAction {
public boolean loadLibrary(String libname, boolean ignoreError, ClassLoader cl) {
boolean res = true;
@@ -143,13 +143,13 @@ public class JNILibLoaderBase {
public static void enableLoading() {
setLoadingAction(new DefaultAction());
}
-
+
public static synchronized void setLoadingAction(LoaderAction action) {
loaderAction = action;
}
/**
- *
+ *
* @param classFromJavaJar
* @param classJarURI
* @param jarBasename jar basename w/ suffix
@@ -170,16 +170,16 @@ public class JNILibLoaderBase {
if(TempJarCache.isInitialized()) {
final URI jarSubURI = JarUtil.getJarSubURI( classJarURI );
if(null == jarSubURI) {
- throw new IllegalArgumentException("JarSubURI is null of: "+classJarURI);
+ throw new IllegalArgumentException("JarSubURI is null of: "+classJarURI);
}
final String jarUriRoot_s = IOUtil.getURIDirname( jarSubURI.toString() );
msg.append("[ ").append(jarSubURI.toString()).append(" -> ").append(jarUriRoot_s).append(" ] + ");
-
+
final String nativeLibraryPath = "natives/"+PlatformPropsImpl.os_and_arch+"/";
final ClassLoader cl = classFromJavaJar.getClassLoader();
final URL nativeLibraryURI = cl.getResource(nativeLibraryPath);
if( null != nativeLibraryURI ) {
- // We probably have one big-fat jar file, containing java classes
+ // We probably have one big-fat jar file, containing java classes
// and all native platform libraries under 'natives/os.and.arch'!
final URI nativeJarURI = JarUtil.getJarFileURI(jarUriRoot_s+jarBasename);
if( TempJarCache.addNativeLibs(classFromJavaJar, nativeJarURI, nativeLibraryPath) ) {
@@ -188,7 +188,7 @@ public class JNILibLoaderBase {
}
}
if( !ok ) {
- // We assume one slim native jar file per 'os.and.arch'!
+ // We assume one slim native jar file per 'os.and.arch'!
final URI nativeJarURI = JarUtil.getJarFileURI(jarUriRoot_s+nativeJarBasename);
msg.append(nativeJarBasename).append(" -> slim: ").append(nativeJarURI);
ok = TempJarCache.addNativeLibs(classFromJavaJar, nativeJarURI, null /* nativeLibraryPath */);
@@ -201,22 +201,22 @@ public class JNILibLoaderBase {
}
return ok;
}
-
+
/**
* Loads and adds a JAR file's native library to the TempJarCache.<br>
* The native library JAR file's URI is derived as follows:
* <ul>
- * <li> [1] <code>GLProfile.class</code> -> </li>
+ * <li> [1] <code>GLProfile.class</code> -> </li>
* <li> [2] <code>http://lala/</code> -> </li>
* <li> [4] <code>http://lala/'nativeJarBaseName'-'os.and.arch'.jar</code> </li>
- * </ul>
+ * </ul>
* Where:
* <ul>
* <li> [1] is the <code>classFromJavaJar</code></li>
* <li> [2] is it's <i>URI path</i></li>
* <li> [4] is the derived native JAR filename</li>
* </ul>
- *
+ *
* @param classFromJavaJar GLProfile
* @param nativeJarBasename jogl-all
* @return true if the native JAR file loaded successful or were loaded already, false in case of an error
@@ -234,15 +234,15 @@ public class JNILibLoaderBase {
if(DEBUG) {
e0.printStackTrace();
}
- }
+ }
} else if(DEBUG) {
System.err.println("JNILibLoaderBase: addNativeJarLibs1: disabled due to uninitialized TempJarCache");
}
return false;
}
-
+
/**
- * Loads and adds a JAR file's native library to the TempJarCache,
+ * Loads and adds a JAR file's native library to the TempJarCache,
* calling {@link JNILibLoaderBase#addNativeJarLibs(Class[], String, String[])}
* with default JOGL deployment configuration:
* <pre>
@@ -258,7 +258,7 @@ public class JNILibLoaderBase {
* <li><i>ClassJar1</i>[-noawt,-mobile,-core,-android]?.jar to <i>ClassJar1</i>-natives-<i>os.and.arch</i>.jar</li>
* <li><i>ClassJar2</i>[-noawt,-mobile,-core,-android]?.jar to <i>ClassJar2</i>-natives-<i>os.and.arch</i>.jar</li>
* <li>..</li>
- * </ul>
+ * </ul>
*/
public static final boolean addNativeJarLibsJoglCfg(final Class<?>[] classesFromJavaJars) {
return addNativeJarLibs(classesFromJavaJars, "-all", joglDeployCfg);
@@ -269,11 +269,11 @@ public class JNILibLoaderBase {
* Loads and adds a JAR file's native library to the TempJarCache.<br>
* The native library JAR file's URI is derived as follows:
* <ul>
- * <li> [1] <code>GLProfile.class</code> -> </li>
+ * <li> [1] <code>GLProfile.class</code> -> </li>
* <li> [2] <code>http://lala/gluegen-rt.jar</code> -> </li>
* <li> [3] <code>http://lala/gluegen-rt</code> -> </li>
* <li> [4] <code>http://lala/gluegen-rt-natives-'os.and.arch'.jar</code> </li>
- * </ul>
+ * </ul>
* Where:
* <ul>
* <li> [1] is one of <code>classesFromJavaJars</code></li>
@@ -294,11 +294,11 @@ public class JNILibLoaderBase {
* <ul>
* <li><i>ClassJar-all</i>[-suff1,-suff2]?.jar to <i>ClassJar-all</i>-natives-<i>os.and.arch</i>.jar</li>
* </ul>
- * Otherwise the native JAR files will be resolved for each class's JAR file:
- * <ul>
+ * Otherwise the native JAR files will be resolved for each class's JAR file:
+ * <ul>
* <li><i>Class1Jar</i>[-suff1,-suff2]?.jar to <i>Class1Jar</i>-natives-<i>os.and.arch</i>.jar</li>
* <li><i>Class2Jar</i>[-suff1,-suff2]?.jar to <i>Class2Jar</i>-natives-<i>os.and.arch</i>.jar</li>
- * </ul>
+ * </ul>
* </p>
* <p>
* Examples:
@@ -309,7 +309,7 @@ public class JNILibLoaderBase {
// only: jocl.jar -> jocl-natives-<i>os.and.arch</i>.jar
addNativeJarLibs(new Class<?>[] { JOCLJNILibLoader.class }, null, null );
* </pre>
- *
+ *
* Newt Only:
* <pre>
// either: [jogl-all.jar, jogl-all-noawt.jar, jogl-all-mobile.jar, jogl-all-android.jar] -> jogl-all-natives-<i>os.and.arch</i>.jar
@@ -334,12 +334,12 @@ public class JNILibLoaderBase {
JNILibLoaderBase.addNativeJarLibs(classesFromJavaJars, "-all", new String[] { "-noawt", "-mobile", "-core", "-android" } );
* </pre>
* </p>
- *
+ *
* @param classesFromJavaJars For each given Class, load the native library JAR.
* @param singleJarMarker Optional string marker like "-all" to identify the single 'all-in-one' JAR file
* after which processing of the class array shall stop.
* @param stripBasenameSuffixes Optional substrings to be stripped of the <i>base URI</i>
- *
+ *
* @return true if either the 'all-in-one' native JAR or all native JARs loaded successful or were loaded already,
* false in case of an error
*/
@@ -351,7 +351,7 @@ public class JNILibLoaderBase {
if(TempJarCache.isInitialized()) {
final StringBuilder msg = new StringBuilder();
int count = 0;
- try {
+ try {
boolean done = false;
ok = true;
for(int i=0; !done && ok && i<classesFromJavaJars.length && null!=classesFromJavaJars[i]; i++) {
@@ -386,7 +386,7 @@ public class JNILibLoaderBase {
}
return ok;
}
-
+
private static final String stripName(String name, String[] suffixes) {
if(null != suffixes) {
for(int i=0; i<suffixes.length && null != suffixes[i]; i++) {
@@ -398,34 +398,34 @@ public class JNILibLoaderBase {
}
return name;
}
-
+
/**
* Loads the library specified by libname, using the {@link LoaderAction} set by {@link #setLoadingAction(LoaderAction)}.<br>
* The implementation should ignore, if the library has been loaded already.<br>
* @param libname the library to load
- * @param ignoreError if true, errors during loading the library should be ignored
+ * @param ignoreError if true, errors during loading the library should be ignored
* @param cl optional ClassLoader, used to locate the library
* @return true if library loaded successful
*/
protected static synchronized boolean loadLibrary(String libname, boolean ignoreError, ClassLoader cl) {
if (loaderAction != null) {
- return loaderAction.loadLibrary(libname, ignoreError, cl);
+ return loaderAction.loadLibrary(libname, ignoreError, cl);
}
return false;
}
-
+
/**
* Loads the library specified by libname, using the {@link LoaderAction} set by {@link #setLoadingAction(LoaderAction)}.<br>
* Optionally preloads the libraries specified by preload.<br>
* The implementation should ignore, if any library has been loaded already.<br>
* @param libname the library to load
* @param preload the libraries to load before loading the main library if not null
- * @param preloadIgnoreError if true, errors during loading the preload-libraries should be ignored
+ * @param preloadIgnoreError if true, errors during loading the preload-libraries should be ignored
* @param cl optional ClassLoader, used to locate the library
*/
protected static synchronized void loadLibrary(String libname, String[] preload, boolean preloadIgnoreError, ClassLoader cl) {
if (loaderAction != null) {
- loaderAction.loadLibrary(libname, preload, preloadIgnoreError, cl);
+ loaderAction.loadLibrary(libname, preload, preloadIgnoreError, cl);
}
}
@@ -435,20 +435,20 @@ public class JNILibLoaderBase {
static {
final String sunAppletLauncherProperty = "sun.jnlp.applet.launcher";
final String sunAppletLauncherClassName = "org.jdesktop.applet.util.JNLPAppletLauncher";
-
+
final Method loadLibraryMethod = AccessController.doPrivileged(new PrivilegedAction<Method>() {
public Method run() {
// FIXME: remove
- final boolean usingJNLPAppletLauncher = Debug.getBooleanProperty(sunAppletLauncherProperty, true);
-
+ final boolean usingJNLPAppletLauncher = Debug.getBooleanProperty(sunAppletLauncherProperty, true);
+
Class<?> launcherClass = null;
Method loadLibraryMethod = null;
-
+
if (usingJNLPAppletLauncher) {
try {
launcherClass = Class.forName(sunAppletLauncherClassName);
} catch (ClassNotFoundException cnfe) {
- // oops .. look like JNLPAppletLauncher doesn't exist, despite property
+ // oops .. look like JNLPAppletLauncher doesn't exist, despite property
// this may happen if a previous applet was using JNLPAppletLauncher in the same JVM
System.err.println("JNILibLoaderBase: <"+sunAppletLauncherClassName+"> not found, despite enabled property <"+sunAppletLauncherProperty+">, JNLPAppletLauncher was probably used before");
System.setProperty(sunAppletLauncherProperty, Boolean.FALSE.toString());
@@ -465,7 +465,7 @@ public class JNILibLoaderBase {
launcherClass = null;
}
}
- }
+ }
if(null==launcherClass) {
String launcherClassName = PropertyAccess.getProperty("jnlp.launcher.class", false);
if(null!=launcherClassName) {
@@ -490,7 +490,7 @@ public class JNILibLoaderBase {
}
private static void loadLibraryInternal(String libraryName, ClassLoader cl) {
- // Note: special-casing JAWT which is built in to the JDK
+ // Note: special-casing JAWT which is built in to the JDK
int mode = 0; // 1 - custom, 2 - System.load( TempJarCache ), 3 - System.loadLibrary( name ), 4 - System.load( enumLibNames )
if (null!=customLoadLibraryMethod && !libraryName.equals("jawt")) {
// FIXME: remove
diff --git a/src/java/com/jogamp/common/net/AssetURLConnection.java b/src/java/com/jogamp/common/net/AssetURLConnection.java
index f2a5a01..4f2a412 100644
--- a/src/java/com/jogamp/common/net/AssetURLConnection.java
+++ b/src/java/com/jogamp/common/net/AssetURLConnection.java
@@ -6,31 +6,31 @@ import java.net.URL;
/**
* See base class {@link PiggybackURLConnection} for motivation.
- *
+ *
* <p>
* <i>asset</i> resource location protocol connection.
* </p>
- *
+ *
* <p>
* See {@link AssetURLContext#resolve(String)} how resources are being resolved.
* </p>
*
* <h3>Example:</h3>
- *
+ *
* Assuming the plain <i>asset entry</i> <b><code>test/lala.txt</code></b> is being resolved by
* a class <code>test.LaLaTest</code>, ie. using the <i>asset aware</i> ClassLoader,
- * one would use the following <i>asset</i> aware filesystem layout:
- *
+ * one would use the following <i>asset</i> aware filesystem layout:
+ *
* <pre>
* test/LaLaTest.class
* assets/test/lala.txt
* </pre>
- *
- * The above maybe on a plain filesystem, or within a JAR or an APK file,
+ *
+ * The above maybe on a plain filesystem, or within a JAR or an APK file,
* e.g. <code>jogamp.test.apk</code>.
- *
+ *
* The above would result in the following possible URLs
- * reflecting the plain and resolved state of the <i>asset URL</i>:
+ * reflecting the plain and resolved state of the <i>asset URL</i>:
* <pre>
* 0 Entry test/lala.txt
* 1 Plain asset:test/lala.txt
@@ -38,16 +38,16 @@ import java.net.URL;
* </pre>
*
* <p>
- * The sub protocol URL of the resolved <i>asset</i>
+ * The sub protocol URL of the resolved <i>asset</i>
* <pre>
* 3 Sub-URL jar:file:/data/app/jogamp.test.apk!/assets/test/lala.txt
* </pre>
* can be retrieved using {@link #getSubProtocol()}.
* </p>
- *
+ *
* In all above cases, the <i>asset entry</i> is <b><code>test/lala.txt</code></b>,
* which can be retrieved via {@link #getEntryName()}.
- *
+ *
* <p>
* <h3>General Implementation Notes:</h3>
* An <i>asset</i> URL is resolved using {@link AssetURLContext#getClassLoader()}.{@link ClassLoader#getResource(String) getResource(String)},
@@ -56,43 +56,43 @@ import java.net.URL;
* </p>
* <p>
* <h3>Warning:</h3>
- * Since the <i>asset</i> protocol is currently not being implemented
+ * Since the <i>asset</i> protocol is currently not being implemented
* on all platform with an appropriate ClassLoader, a user shall not create the <i>asset</i> URL manually.<br>
* </p>
- *
+ *
* <h3>Android Implementation Notes:</h3>
* <p>
- * The Android ClassLoader {@link jogamp.android.launcher.AssetDexClassLoader}
+ * The Android ClassLoader {@link jogamp.android.launcher.AssetDexClassLoader}
* resolves the resource as an <i>asset</i> URL in it's {@link ClassLoader#findResource(String)} implementation.</p>
* <p>
- * Currently we attach our <i>asset</i> {@link java.net.URLStreamHandlerFactory}
+ * Currently we attach our <i>asset</i> {@link java.net.URLStreamHandlerFactory}
* to allow {@link java.net.URL} to handle <i>asset</i> URLs via our <i>asset</i> {@link java.net.URLStreamHandler} implementation.
* </p>
*/
public class AssetURLConnection extends PiggybackURLConnection<AssetURLContext> {
-
+
public AssetURLConnection(URL url, AssetURLContext implHelper) {
super(url, implHelper);
}
-
+
@Override
public String getEntryName() throws IOException {
if(!connected) {
throw new IOException("not connected");
}
-
+
final String urlPath ;
if(subConn instanceof JarURLConnection) {
urlPath = ((JarURLConnection)subConn).getEntryName();
} else {
urlPath = subConn.getURL().getPath();
}
-
+
if(urlPath.startsWith(AssetURLContext.assets_folder)) {
return urlPath.substring(AssetURLContext.assets_folder.length());
} else {
return urlPath;
}
}
-
+
}
diff --git a/src/java/com/jogamp/common/net/AssetURLContext.java b/src/java/com/jogamp/common/net/AssetURLContext.java
index 470530e..38691e8 100644
--- a/src/java/com/jogamp/common/net/AssetURLContext.java
+++ b/src/java/com/jogamp/common/net/AssetURLContext.java
@@ -17,14 +17,14 @@ import com.jogamp.common.util.IOUtil;
*/
public abstract class AssetURLContext implements PiggybackURLContext {
private static final boolean DEBUG = IOUtil.DEBUG;
-
+
/** The <i>asset URL</i> protocol name <code>asset</code> */
public static final String asset_protocol = "asset";
-
+
/** The <i>asset URL</i> protocol prefix <code>asset:</code> */
public static final String asset_protocol_prefix = "asset:";
-
- /**
+
+ /**
* The <i>optional</i> <i>asset</i> folder name with ending slash <code>assets/</code>.
* <p>
* Note that the <i>asset</i> folder is not used on all platforms using the <i>asset</i> protocol
@@ -41,11 +41,11 @@ public abstract class AssetURLContext implements PiggybackURLContext {
}
};
}
-
+
public static AssetURLStreamHandler createHandler(final ClassLoader cl) {
return new AssetURLStreamHandler(create(cl));
}
-
+
/**
* Create an <i>asset</i> URL, suitable even w/o the registered <i>asset</i> URLStreamHandler.
* <p>
@@ -62,7 +62,7 @@ public abstract class AssetURLContext implements PiggybackURLContext {
public static URL createURL(String path, ClassLoader cl) throws MalformedURLException {
return new URL(null, path.startsWith(asset_protocol_prefix) ? path : asset_protocol_prefix + path, createHandler(cl));
}
-
+
/**
* Create an <i>asset</i> URL, suitable only with the registered <i>asset</i> URLStreamHandler.
* <p>
@@ -78,20 +78,20 @@ public abstract class AssetURLContext implements PiggybackURLContext {
public static URL createURL(String path) throws MalformedURLException {
return new URL(path.startsWith(asset_protocol_prefix) ? path : asset_protocol_prefix + path);
}
-
+
/**
- * Returns the <i>asset</i> handler previously set via {@link #registerHandler(ClassLoader)},
+ * Returns the <i>asset</i> handler previously set via {@link #registerHandler(ClassLoader)},
* or null if none was set.
*/
public static URLStreamHandler getRegisteredHandler() {
final GenericURLStreamHandlerFactory f = GenericURLStreamHandlerFactory.register();
return ( null != f ) ? f.getHandler(asset_protocol) : null;
}
-
+
/**
- * Registers the generic URLStreamHandlerFactory via {@link GenericURLStreamHandlerFactory#register()}
+ * Registers the generic URLStreamHandlerFactory via {@link GenericURLStreamHandlerFactory#register()}
* and if successful sets the <i>asset</i> <code>handler</code> for the given ClassLoader <code>cl</code>.
- *
+ *
* @return true if successful, otherwise false
*/
public static boolean registerHandler(ClassLoader cl) {
@@ -103,11 +103,11 @@ public abstract class AssetURLContext implements PiggybackURLContext {
return false;
}
}
-
- /**
+
+ /**
* Returns an <i>asset</i> aware ClassLoader.
* <p>
- * The ClassLoader is required to find the <i>asset</i> resource
+ * The ClassLoader is required to find the <i>asset</i> resource
* via it's <code>URL findResource(String)</code> implementation.
* </p>
* <p>
@@ -123,33 +123,33 @@ public abstract class AssetURLContext implements PiggybackURLContext {
@Override
public String getImplementedProtocol() {
return asset_protocol;
- }
-
+ }
+
/**
* {@inheritDoc}
- * <p>
+ * <p>
* This implementation attempts to resolve <code>path</code> in the following order:
* <ol>
* <li> as a valid URL: <code>new URL(path)</code>, use sub-protocol if <i>asset</i> URL</li>
* <li> via ClassLoader: {@link #getClassLoader()}.{@link ClassLoader#getResource(String) getResource(path)}, use sub-protocol if <i>asset</i> URL </li>
* <li> as a File: <code>new File(path).toURI().toURL()</code>
* </ol>
- * </p>
+ * </p>
* <p>
* In case of using the ClassLoader (2) <b>and</b> if running on Android,
* the {@link #assets_folder} is being prepended to <code>path</code> if missing.
- * </p>
- **/
+ * </p>
+ **/
@Override
public URLConnection resolve(String path) throws IOException {
return resolve(path, getClassLoader());
}
-
+
public static URLConnection resolve(String path, ClassLoader cl) throws IOException {
URL url = null;
URLConnection conn = null;
int type = -1;
-
+
if(DEBUG) {
System.err.println("AssetURLContext.resolve: <"+path+">");
}
@@ -158,14 +158,14 @@ public abstract class AssetURLContext implements PiggybackURLContext {
} catch (URISyntaxException uriEx) {
throw new IOException(uriEx);
}
-
+
try {
// lookup as valid sub-protocol
url = new URL(path);
conn = open(url);
type = null != conn ? 1 : -1;
} catch(MalformedURLException e1) { if(DEBUG) { System.err.println("ERR(0): "+e1.getMessage()); } }
-
+
if(null == conn && null != cl) {
// lookup via ClassLoader .. cleanup leading '/'
String cpath = path;
@@ -179,7 +179,7 @@ public abstract class AssetURLContext implements PiggybackURLContext {
conn = open(url);
type = null != conn ? 2 : -1;
}
-
+
if(null == conn) {
// lookup as File
try {
@@ -191,7 +191,7 @@ public abstract class AssetURLContext implements PiggybackURLContext {
}
} catch (Throwable e) { if(DEBUG) { System.err.println("ERR(1): "+e.getMessage()); } }
}
-
+
if(DEBUG) {
System.err.println("AssetURLContext.resolve: type "+type+": url <"+url+">, conn <"+conn+">, connURL <"+(null!=conn?conn.getURL():null)+">");
}
@@ -200,7 +200,7 @@ public abstract class AssetURLContext implements PiggybackURLContext {
}
return conn;
}
-
+
private static URLConnection open(URL url) {
if(null==url) {
return null;
@@ -209,8 +209,8 @@ public abstract class AssetURLContext implements PiggybackURLContext {
final URLConnection c = url.openConnection();
c.connect(); // redundant
return c;
- } catch (IOException ioe) { if(DEBUG) { System.err.println("ERR: "+ioe.getMessage()); } }
+ } catch (IOException ioe) { if(DEBUG) { System.err.println("ERR: "+ioe.getMessage()); } }
return null;
}
-
+
}
diff --git a/src/java/com/jogamp/common/net/AssetURLStreamHandler.java b/src/java/com/jogamp/common/net/AssetURLStreamHandler.java
index 8d95b2d..6760646 100644
--- a/src/java/com/jogamp/common/net/AssetURLStreamHandler.java
+++ b/src/java/com/jogamp/common/net/AssetURLStreamHandler.java
@@ -7,31 +7,31 @@ import java.net.URLStreamHandler;
import com.jogamp.common.net.AssetURLConnection;
-/**
+/**
* {@link URLStreamHandler} to handle the asset protocol.
- *
+ *
* <p>
* This is the <i>asset</i> URLStreamHandler variation
- * for manual use.
+ * for manual use.
* </p>
* <p>
* It requires passing a valid {@link AssetURLContext}
* for construction, hence it's not suitable for the pkg factory model.
* </p>
*/
-public class AssetURLStreamHandler extends URLStreamHandler {
+public class AssetURLStreamHandler extends URLStreamHandler {
AssetURLContext ctx;
-
+
public AssetURLStreamHandler(AssetURLContext ctx) {
this.ctx = ctx;
}
-
+
@Override
protected URLConnection openConnection(URL u) throws IOException {
final AssetURLConnection c = new AssetURLConnection(u, ctx);
c.connect();
return c;
}
-
-
+
+
}
diff --git a/src/java/com/jogamp/common/net/GenericURLStreamHandlerFactory.java b/src/java/com/jogamp/common/net/GenericURLStreamHandlerFactory.java
index 79d7f71..4ec3f19 100644
--- a/src/java/com/jogamp/common/net/GenericURLStreamHandlerFactory.java
+++ b/src/java/com/jogamp/common/net/GenericURLStreamHandlerFactory.java
@@ -10,30 +10,30 @@ import java.util.Map;
public class GenericURLStreamHandlerFactory implements URLStreamHandlerFactory {
private static GenericURLStreamHandlerFactory factory = null;
-
+
private final Map<String, URLStreamHandler> protocolHandlers;
private GenericURLStreamHandlerFactory() {
protocolHandlers = new HashMap<String, URLStreamHandler>();
}
-
+
/**
* Sets the <code>handler</code> for <code>protocol</code>.
- *
+ *
* @return the previous set <code>handler</code>, or null if none was set.
*/
public synchronized final URLStreamHandler setHandler(String protocol, URLStreamHandler handler) {
return protocolHandlers.put(protocol, handler);
}
-
+
/**
- * Returns the <code>protocol</code> handler previously set via {@link #setHandler(String, URLStreamHandler)},
+ * Returns the <code>protocol</code> handler previously set via {@link #setHandler(String, URLStreamHandler)},
* or null if none was set.
*/
public synchronized final URLStreamHandler getHandler(String protocol) {
return protocolHandlers.get(protocol);
}
-
+
@Override
public synchronized final URLStreamHandler createURLStreamHandler(String protocol) {
return getHandler(protocol);
diff --git a/src/java/com/jogamp/common/net/PiggybackURLConnection.java b/src/java/com/jogamp/common/net/PiggybackURLConnection.java
index 39f1637..3b774e8 100644
--- a/src/java/com/jogamp/common/net/PiggybackURLConnection.java
+++ b/src/java/com/jogamp/common/net/PiggybackURLConnection.java
@@ -6,10 +6,10 @@ import java.net.URL;
import java.net.URLConnection;
/**
- * Generic resource location protocol connection,
+ * Generic resource location protocol connection,
* using another sub-protocol as the vehicle for a piggyback protocol.
* <p>
- * The details of the sub-protocol can be queried using {@link #getSubProtocol()}.
+ * The details of the sub-protocol can be queried using {@link #getSubProtocol()}.
* </p>
* <p>
* See example in {@link AssetURLConnection}.
@@ -19,7 +19,7 @@ public abstract class PiggybackURLConnection<I extends PiggybackURLContext> exte
protected URL subUrl;
protected URLConnection subConn;
protected I context;
-
+
/**
* @param url the specific URL for this instance
* @param context the piggyback context, defining state independent code and constants
@@ -34,18 +34,18 @@ public abstract class PiggybackURLConnection<I extends PiggybackURLContext> exte
* Resolves the URL via {@link PiggybackURLContext#resolve(String)},
* see {@link AssetURLContext#resolve(String)} for an example.
* </p>
- *
+ *
* {@inheritDoc}
*/
@Override
public synchronized void connect() throws IOException {
if(!connected) {
- subConn = context.resolve(url.getPath());
- subUrl = subConn.getURL();
+ subConn = context.resolve(url.getPath());
+ subUrl = subConn.getURL();
connected = true;
}
}
-
+
@Override
public InputStream getInputStream() throws IOException {
if(!connected) {
@@ -53,26 +53,26 @@ public abstract class PiggybackURLConnection<I extends PiggybackURLContext> exte
}
return subConn.getInputStream();
}
-
- /**
+
+ /**
* Returns the <i>entry name</i> of the asset.
* <pre>
* Plain asset:test/lala.txt
* Resolved asset:jar:file:/data/app/jogamp.test.apk!/assets/test/lala.txt
* Result test/lala.txt
- * </pre>
+ * </pre>
* @throws IOException is not connected
**/
public abstract String getEntryName() throws IOException;
-
- /**
+
+ /**
* Returns the resolved <i>sub protocol</i> of the asset or null, ie:
* <pre>
* Plain asset:test/lala.txt
* Resolved asset:jar:file:/data/app/jogamp.test.apk!/assets/test/lala.txt
* Result jar:file:/data/app/jogamp.test.apk!/assets/test/lala.txt
* </pre>
- *
+ *
* @throws IOException is not connected
*/
public URL getSubProtocol() throws IOException {
diff --git a/src/java/com/jogamp/common/net/PiggybackURLContext.java b/src/java/com/jogamp/common/net/PiggybackURLContext.java
index 2cb48b5..9e3db69 100644
--- a/src/java/com/jogamp/common/net/PiggybackURLContext.java
+++ b/src/java/com/jogamp/common/net/PiggybackURLContext.java
@@ -8,11 +8,11 @@ import java.net.URLConnection;
*/
public interface PiggybackURLContext {
- /** Returns the specific protocol, constant for this implementation. */
+ /** Returns the specific protocol, constant for this implementation. */
public String getImplementedProtocol();
-
- /**
- * Resolving path to a URL sub protocol and return it's open URLConnection
+
+ /**
+ * Resolving path to a URL sub protocol and return it's open URLConnection
**/
- public URLConnection resolve(String path) throws IOException;
+ public URLConnection resolve(String path) throws IOException;
}
diff --git a/src/java/com/jogamp/common/net/asset/Handler.java b/src/java/com/jogamp/common/net/asset/Handler.java
index 1063797..d622221 100644
--- a/src/java/com/jogamp/common/net/asset/Handler.java
+++ b/src/java/com/jogamp/common/net/asset/Handler.java
@@ -8,12 +8,12 @@ import java.net.URLStreamHandler;
import com.jogamp.common.net.AssetURLConnection;
import com.jogamp.common.net.AssetURLContext;
-/**
+/**
* {@link URLStreamHandler} to handle the asset protocol.
- *
+ *
* <p>
* This is the <i>asset</i> URLStreamHandler variation
- * using this class ClassLoader for the pkg factory model.
+ * using this class ClassLoader for the pkg factory model.
* </p>
*/
public class Handler extends URLStreamHandler {
@@ -23,16 +23,16 @@ public class Handler extends URLStreamHandler {
return Handler.class.getClassLoader();
}
};
-
+
public Handler() {
super();
}
-
+
@Override
protected URLConnection openConnection(URL u) throws IOException {
final AssetURLConnection c = new AssetURLConnection(u, localCL);
c.connect();
return c;
}
-
+
}
diff --git a/src/java/com/jogamp/common/nio/AbstractBuffer.java b/src/java/com/jogamp/common/nio/AbstractBuffer.java
index 4afff2a..4213a4d 100644
--- a/src/java/com/jogamp/common/nio/AbstractBuffer.java
+++ b/src/java/com/jogamp/common/nio/AbstractBuffer.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
/*
* Created on Saturday, March 27 2010 11:55
*/
@@ -51,7 +51,7 @@ public abstract class AbstractBuffer<B extends AbstractBuffer> implements Native
Platform.initSingleton(); // loads native gluegen-rt library
}
- /**
+ /**
* capacity and elementSize should be match the equation w/ target buffer type
* <pre>
* capacity = elementSizeInBytes(buffer) * buffer.capacity() ) / elementSize
@@ -64,14 +64,14 @@ public abstract class AbstractBuffer<B extends AbstractBuffer> implements Native
this.buffer = buffer;
this.elementSize = elementSize;
this.capacity = capacity;
-
+
this.position = 0;
}
public final int elementSize() {
return elementSize;
}
-
+
public final int limit() {
return capacity;
}
@@ -113,7 +113,7 @@ public abstract class AbstractBuffer<B extends AbstractBuffer> implements Native
public final boolean isDirect() {
return buffer.isDirect();
}
-
+
public final boolean hasArray() {
return buffer.hasArray();
}
@@ -129,7 +129,7 @@ public abstract class AbstractBuffer<B extends AbstractBuffer> implements Native
public Object array() throws UnsupportedOperationException {
return buffer.array();
}
-
+
@Override
public String toString() {
return "AbstractBuffer[direct "+isDirect()+", hasArray "+hasArray()+", capacity "+capacity+", position "+position+", elementSize "+elementSize+", buffer[capacity "+buffer.capacity()+", lim "+buffer.limit()+", pos "+buffer.position()+"]]";
diff --git a/src/java/com/jogamp/common/nio/Buffers.java b/src/java/com/jogamp/common/nio/Buffers.java
index 851aa69..c63a094 100644
--- a/src/java/com/jogamp/common/nio/Buffers.java
+++ b/src/java/com/jogamp/common/nio/Buffers.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -47,7 +47,7 @@ import com.jogamp.common.util.ValueConv;
/**
* Utility methods allowing easy {@link java.nio.Buffer} manipulations.
- *
+ *
* @author Kenneth Russel
* @author Sven Gothel
* @author Michael Bien
@@ -213,7 +213,7 @@ public class Buffers {
/**
* Calls slice on the specified buffer while maintaining the byteorder.
- * @see #slice(java.nio.Buffer, int, int)
+ * @see #slice(java.nio.Buffer, int, int)
*/
@SuppressWarnings("unchecked")
public static <B extends Buffer> B slice(B buffer) {
@@ -264,22 +264,22 @@ public class Buffers {
* The returned sliced buffer's start position is not necessarily zero,
* but the float position within the host ByteBuffer.
* </p>
- * <p>
+ * <p>
* The returned sliced buffer is {@link FloatBuffer#mark() marked} at it's starting position. Hence
- * {@link FloatBuffer#reset()} will rewind it to start after applying relative operations like {@link FloatBuffer#get()}.
+ * {@link FloatBuffer#reset()} will rewind it to start after applying relative operations like {@link FloatBuffer#get()}.
* </p>
- * <p>
- * Using a ByteBuffer as the source guarantees
- * keeping the source native order programmatically.
- * This works around <a href="http://code.google.com/p/android/issues/detail?id=16434">Honeycomb / Android 3.0 Issue 16434</a>.
+ * <p>
+ * Using a ByteBuffer as the source guarantees
+ * keeping the source native order programmatically.
+ * This works around <a href="http://code.google.com/p/android/issues/detail?id=16434">Honeycomb / Android 3.0 Issue 16434</a>.
* This bug is resolved at least in Android 3.2.
* </p>
- *
- * @param buf source Buffer, maybe ByteBuffer (recommended) or FloatBuffer or <code>null</code>.
+ *
+ * @param buf source Buffer, maybe ByteBuffer (recommended) or FloatBuffer or <code>null</code>.
* Buffer's position is ignored and floatPos is being used.
* @param backing source float array or <code>null</code>
* @param floatPos {@link Buffers#SIZEOF_FLOAT} position
- * @param floatSize {@link Buffers#SIZEOF_FLOAT} size
+ * @param floatSize {@link Buffers#SIZEOF_FLOAT} size
* @return FloatBuffer w/ native byte order as given ByteBuffer
*/
public static final FloatBuffer slice2Float(Buffer buf, float[] backing, int floatPos, int floatSize) {
@@ -318,7 +318,7 @@ public class Buffers {
return res;
}
-
+
/**
* Helper routine to set a ByteBuffer to the native byte order, if
* that operation is supported by the underlying NIO
@@ -329,7 +329,7 @@ public class Buffers {
}
/**
- * Returns the size of a single element of the given buffer in bytes
+ * Returns the size of a single element of the given buffer in bytes
* or <code>0</code> if the given buffer is <code>null</code>.
*/
public static int sizeOfBufferElem(Object buffer) {
@@ -358,7 +358,7 @@ public class Buffers {
/**
* Returns the number of remaining elements of the given anonymous <code>buffer</code>.
- *
+ *
* @param buffer Anonymous <i>Buffer</i> of type {@link NativeBuffer} or a derivation of {@link Buffer}.
* @return If <code>buffer</code> is null, returns <code>0<code>, otherwise the remaining size in elements.
* @throws IllegalArgumentException if <code>buffer</code> is of invalid type.
@@ -375,10 +375,10 @@ public class Buffers {
throw new IllegalArgumentException("Unsupported anonymous buffer type: "+buffer.getClass().getCanonicalName());
}
}
-
+
/**
* Returns the number of remaining bytes of the given anonymous <code>buffer</code>.
- *
+ *
* @param buffer Anonymous <i>Buffer</i> of type {@link NativeBuffer} or a derivation of {@link Buffer}.
* @return If <code>buffer</code> is null, returns <code>0<code>, otherwise the remaining size in bytes.
* @throws IllegalArgumentException if <code>buffer</code> is of invalid type.
@@ -434,11 +434,11 @@ public class Buffers {
if (buf instanceof ByteBuffer) {
return ((ByteBuffer) buf).isDirect();
} else if (buf instanceof IntBuffer) {
- return ((IntBuffer) buf).isDirect();
+ return ((IntBuffer) buf).isDirect();
} else if (buf instanceof ShortBuffer) {
- return ((ShortBuffer) buf).isDirect();
+ return ((ShortBuffer) buf).isDirect();
} else if (buf instanceof FloatBuffer) {
- return ((FloatBuffer) buf).isDirect();
+ return ((FloatBuffer) buf).isDirect();
} else if (buf instanceof DoubleBuffer) {
return ((DoubleBuffer) buf).isDirect();
} else if (buf instanceof LongBuffer) {
@@ -490,7 +490,7 @@ public class Buffers {
* Helper routine to return the array backing store reference from
* a Buffer object.
* @throws UnsupportedOperationException if the passed Object does not have an array backing store
- * @throws IllegalArgumentException if the passed Object is neither of type {@link java.nio.Buffer} or {@link NativeBuffer}.
+ * @throws IllegalArgumentException if the passed Object is neither of type {@link java.nio.Buffer} or {@link NativeBuffer}.
*/
public static Object getArray(Object buf) throws UnsupportedOperationException, IllegalArgumentException {
if (buf == null) {
@@ -557,7 +557,7 @@ public class Buffers {
ByteBuffer dest = newDirectByteBuffer(orig.remaining());
dest.put(orig);
dest.rewind();
- orig.position(op0);
+ orig.position(op0);
return dest;
}
@@ -752,8 +752,8 @@ public class Buffers {
//----------------------------------------------------------------------
// Convenient put methods with generic target Buffer w/o value range conversion, i.e. normalization
- //
-
+ //
+
@SuppressWarnings("unchecked")
public static <B extends Buffer> B put(B dest, Buffer src) {
if ((dest instanceof ByteBuffer) && (src instanceof ByteBuffer)) {
@@ -841,7 +841,7 @@ public class Buffers {
throw new IllegalArgumentException("Float doesn't match Buffer Class: " + dest);
}
}
-
+
@SuppressWarnings("unchecked")
public static <B extends Buffer> B putd(B dest, double v) {
if (dest instanceof FloatBuffer) {
@@ -855,15 +855,15 @@ public class Buffers {
// Convenient put methods with generic target Buffer and value range conversion, i.e. normalization
//
- /**
+ /**
* Store byte source value in given buffer after normalizing it to the destination value range
* considering signed and unsigned source and destination representation.
- *
+ *
* @param dest One of {@link ByteBuffer}, {@link ShortBuffer}, {@link IntBuffer}, {@link FloatBuffer}
* @param dSigned true if destination buffer holds signed values, false if destination buffer holds unsigned values
* @param v source byte value to be put in dest buffer
* @param sSigned true if source represents a signed value, false if source represents an unsigned value
- */
+ */
@SuppressWarnings("unchecked")
public static <B extends Buffer> B putNb(B dest, boolean dSigned, byte v, boolean sSigned) {
if (dest instanceof ByteBuffer) {
@@ -872,22 +872,22 @@ public class Buffers {
return (B) ((ShortBuffer) dest).put( ValueConv.byte_to_short(v, sSigned, dSigned) );
} else if (dest instanceof IntBuffer) {
return (B) ((IntBuffer) dest).put( ValueConv.byte_to_int(v, sSigned, dSigned) );
- } else if (dest instanceof FloatBuffer) {
+ } else if (dest instanceof FloatBuffer) {
return (B) ((FloatBuffer) dest).put( ValueConv.byte_to_float(v, sSigned) );
} else {
throw new IllegalArgumentException("Byte doesn't match Buffer Class: " + dest);
}
}
- /**
+ /**
* Store short source value in given buffer after normalizing it to the destination value range
* considering signed and unsigned source and destination representation.
- *
+ *
* @param dest One of {@link ByteBuffer}, {@link ShortBuffer}, {@link IntBuffer}, {@link FloatBuffer}
* @param dSigned true if destination buffer holds signed values, false if destination buffer holds unsigned values
* @param v source short value to be put in dest buffer
* @param sSigned true if source represents a signed value, false if source represents an unsigned value
- */
+ */
@SuppressWarnings("unchecked")
public static <B extends Buffer> B putNs(B dest, boolean dSigned, short v, boolean sSigned) {
if (dest instanceof ByteBuffer) {
@@ -896,22 +896,22 @@ public class Buffers {
return (B) ((ShortBuffer) dest).put( v );
} else if (dest instanceof IntBuffer) {
return (B) ((IntBuffer) dest).put( ValueConv.short_to_int(v, sSigned, dSigned) );
- } else if (dest instanceof FloatBuffer) {
+ } else if (dest instanceof FloatBuffer) {
return (B) ((FloatBuffer) dest).put( ValueConv.short_to_float(v, sSigned) );
} else {
throw new IllegalArgumentException("Byte doesn't match Buffer Class: " + dest);
}
}
-
- /**
+
+ /**
* Store short source value in given buffer after normalizing it to the destination value range
* considering signed and unsigned source and destination representation.
- *
+ *
* @param dest One of {@link ByteBuffer}, {@link ShortBuffer}, {@link IntBuffer}, {@link FloatBuffer}
* @param dSigned true if destination buffer holds signed values, false if destination buffer holds unsigned values
* @param v source short value to be put in dest buffer
* @param sSigned true if source represents a signed value, false if source represents an unsigned value
- */
+ */
@SuppressWarnings("unchecked")
public static <B extends Buffer> B putNi(B dest, boolean dSigned, int v, boolean sSigned) {
if (dest instanceof ByteBuffer) {
@@ -920,21 +920,21 @@ public class Buffers {
return (B) ((ShortBuffer) dest).put( ValueConv.int_to_short(v, sSigned, dSigned) );
} else if (dest instanceof IntBuffer) {
return (B) ((IntBuffer) dest).put( v );
- } else if (dest instanceof FloatBuffer) {
+ } else if (dest instanceof FloatBuffer) {
return (B) ((FloatBuffer) dest).put( ValueConv.int_to_float(v, sSigned) );
} else {
throw new IllegalArgumentException("Byte doesn't match Buffer Class: " + dest);
}
}
-
- /**
+
+ /**
* Store float source value in given buffer after normalizing it to the destination value range
* considering signed and unsigned destination representation.
- *
+ *
* @param dest One of {@link ByteBuffer}, {@link ShortBuffer}, {@link IntBuffer}, {@link FloatBuffer}
* @param dSigned true if destination buffer holds signed values, false if destination buffer holds unsigned values
* @param v source float value to be put in dest buffer
- */
+ */
@SuppressWarnings("unchecked")
public static <B extends Buffer> B putNf(B dest, boolean dSigned, float v) {
if (dest instanceof ByteBuffer) {
@@ -943,17 +943,17 @@ public class Buffers {
return (B) ((ShortBuffer) dest).put( ValueConv.float_to_short(v, dSigned) );
} else if (dest instanceof IntBuffer) {
return (B) ((IntBuffer) dest).put( ValueConv.float_to_int(v, dSigned) );
- } else if (dest instanceof FloatBuffer) {
+ } else if (dest instanceof FloatBuffer) {
return (B) ((FloatBuffer) dest).put( v );
} else {
throw new IllegalArgumentException("Byte doesn't match Buffer Class: " + dest);
}
}
-
+
//----------------------------------------------------------------------
- // Range check methods
+ // Range check methods
//
-
+
public static void rangeCheck(byte[] array, int offset, int minElementsRemaining) {
if (array == null) {
return;
@@ -1049,13 +1049,13 @@ public class Buffers {
throw new IndexOutOfBoundsException("Required " + minBytesRemaining + " remaining bytes in buffer, only had " + bytesRemaining);
}
}
-
+
/**
* Appends Buffer details inclusive data to a StringBuilder instance.
* @param sb optional pass through StringBuilder
- * @param f optional format string of one element, i.e. "%10.5f" for {@link FloatBuffer}, see {@link java.util.Formatter},
- * or <code>null</code> for unformatted output.
- * <b>Note:</b> Caller is responsible to match the format string w/ the data type as expected in the given buffer.
+ * @param f optional format string of one element, i.e. "%10.5f" for {@link FloatBuffer}, see {@link java.util.Formatter},
+ * or <code>null</code> for unformatted output.
+ * <b>Note:</b> Caller is responsible to match the format string w/ the data type as expected in the given buffer.
* @param buffer Any valid Buffer instance
* @return the modified StringBuilder containing the Buffer details
*/
@@ -1073,74 +1073,74 @@ public class Buffers {
for(int i=0; i<b.limit(); i++) {
if(0<i) { sb.append(", "); }
if(null == f) {
- sb.append(b.get(i));
+ sb.append(b.get(i));
} else {
- sb.append(String.format(f, b.get(i)));
- }
+ sb.append(String.format(f, b.get(i)));
+ }
}
} else if (buffer instanceof FloatBuffer) {
final FloatBuffer b = (FloatBuffer)buffer;
for(int i=0; i<b.limit(); i++) {
if(0<i) { sb.append(", "); }
if(null == f) {
- sb.append(b.get(i));
+ sb.append(b.get(i));
} else {
- sb.append(String.format(f, b.get(i)));
- }
+ sb.append(String.format(f, b.get(i)));
+ }
}
} else if (buffer instanceof IntBuffer) {
final IntBuffer b = (IntBuffer)buffer;
for(int i=0; i<b.limit(); i++) {
if(0<i) { sb.append(", "); }
if(null == f) {
- sb.append(b.get(i));
+ sb.append(b.get(i));
} else {
- sb.append(String.format(f, b.get(i)));
- }
+ sb.append(String.format(f, b.get(i)));
+ }
}
} else if (buffer instanceof ShortBuffer) {
final ShortBuffer b = (ShortBuffer)buffer;
for(int i=0; i<b.limit(); i++) {
if(0<i) { sb.append(", "); }
if(null == f) {
- sb.append(b.get(i));
+ sb.append(b.get(i));
} else {
- sb.append(String.format(f, b.get(i)));
- }
+ sb.append(String.format(f, b.get(i)));
+ }
}
} else if (buffer instanceof DoubleBuffer) {
final DoubleBuffer b = (DoubleBuffer)buffer;
for(int i=0; i<b.limit(); i++) {
if(0<i) { sb.append(", "); }
if(null == f) {
- sb.append(b.get(i));
+ sb.append(b.get(i));
} else {
- sb.append(String.format(f, b.get(i)));
- }
+ sb.append(String.format(f, b.get(i)));
+ }
}
} else if (buffer instanceof LongBuffer) {
final LongBuffer b = (LongBuffer)buffer;
for(int i=0; i<b.limit(); i++) {
if(0<i) { sb.append(", "); }
if(null == f) {
- sb.append(b.get(i));
+ sb.append(b.get(i));
} else {
- sb.append(String.format(f, b.get(i)));
- }
+ sb.append(String.format(f, b.get(i)));
+ }
}
} else if (buffer instanceof CharBuffer) {
final CharBuffer b = (CharBuffer)buffer;
for(int i=0; i<b.limit(); i++) {
if(0<i) { sb.append(", "); }
if(null == f) {
- sb.append(b.get(i));
+ sb.append(b.get(i));
} else {
- sb.append(String.format(f, b.get(i)));
- }
+ sb.append(String.format(f, b.get(i)));
+ }
}
}
sb.append("]");
return sb;
}
-
+
}
diff --git a/src/java/com/jogamp/common/nio/CachedBufferFactory.java b/src/java/com/jogamp/common/nio/CachedBufferFactory.java
index b9d75db..6ddff4a 100644
--- a/src/java/com/jogamp/common/nio/CachedBufferFactory.java
+++ b/src/java/com/jogamp/common/nio/CachedBufferFactory.java
@@ -4,14 +4,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -21,7 +21,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -58,7 +58,7 @@ import java.nio.ShortBuffer;
* <li>factories created with createSynchronized(...) are threadsafe</li>
* </ul>
* </p>
- *
+ *
* @author Michael Bien
*/
public class CachedBufferFactory {
@@ -67,20 +67,20 @@ public class CachedBufferFactory {
* default size for internal buffer allocation.
*/
public static final int DEFAULT_ALLOCATION_SIZE = 1024 * 1024;
-
+
private final int ALLOCATION_SIZE;
private ByteBuffer currentBuffer;
-
+
private CachedBufferFactory() {
this(DEFAULT_ALLOCATION_SIZE, DEFAULT_ALLOCATION_SIZE);
}
-
+
private CachedBufferFactory(int initialSize, int allocationSize) {
currentBuffer = Buffers.newDirectByteBuffer(initialSize);
ALLOCATION_SIZE = allocationSize;
}
-
-
+
+
/**
* Creates a factory with initial size and allocation size set to
* {@link #DEFAULT_ALLOCATION_SIZE}.
@@ -88,7 +88,7 @@ public class CachedBufferFactory {
public static CachedBufferFactory create() {
return new CachedBufferFactory();
}
-
+
/**
* Creates a factory with the specified initial size. The allocation size is set to
* {@link #DEFAULT_ALLOCATION_SIZE}.
@@ -96,7 +96,7 @@ public class CachedBufferFactory {
public static CachedBufferFactory create(int initialSize) {
return new CachedBufferFactory(initialSize, DEFAULT_ALLOCATION_SIZE);
}
-
+
/**
* Creates a factory with the specified initial size. The allocation size is set to
* {@link #DEFAULT_ALLOCATION_SIZE}.
@@ -106,43 +106,43 @@ public class CachedBufferFactory {
public static CachedBufferFactory create(int initialSize, boolean fixed) {
return new CachedBufferFactory(initialSize, fixed?-1:DEFAULT_ALLOCATION_SIZE);
}
-
+
/**
* Creates a factory with the specified initial size and allocation size.
*/
public static CachedBufferFactory create(int initialSize, int allocationSize) {
return new CachedBufferFactory(initialSize, allocationSize);
}
-
-
+
+
/**
* Synchronized version of {@link #create()}.
*/
public static CachedBufferFactory createSynchronized() {
return new SynchronizedCachedBufferFactory();
}
-
+
/**
* Synchronized version of {@link #create(int)}.
*/
public static CachedBufferFactory createSynchronized(int initialSize) {
return new SynchronizedCachedBufferFactory(initialSize, DEFAULT_ALLOCATION_SIZE);
}
-
+
/**
* Synchronized version of {@link #create(int, boolean)}.
*/
public static CachedBufferFactory createSynchronized(int initialSize, boolean fixed) {
return new SynchronizedCachedBufferFactory(initialSize, fixed?-1:DEFAULT_ALLOCATION_SIZE);
}
-
+
/**
* Synchronized version of {@link #create(int, int)}.
*/
public static CachedBufferFactory createSynchronized(int initialSize, int allocationSize) {
return new CachedBufferFactory(initialSize, allocationSize);
}
-
+
/**
* Returns true only if this factory does not allow to allocate more buffers
* as limited by the initial size.
@@ -150,7 +150,7 @@ public class CachedBufferFactory {
public boolean isFixed() {
return ALLOCATION_SIZE == -1;
}
-
+
/**
* Returns the allocation size used to create new internal buffers.
* 0 means that the buffer will not grows, see {@link #isFixed()}.
@@ -158,7 +158,7 @@ public class CachedBufferFactory {
public int getAllocationSize() {
return ALLOCATION_SIZE;
}
-
+
/**
* @return true if buffer cannot grow, otherwise false
*/
@@ -175,7 +175,7 @@ public class CachedBufferFactory {
}
}
public ByteBuffer newDirectByteBuffer(int size) {
-
+
// if large enough... just create it
if (size > currentBuffer.capacity()) {
checkIfFixed();
@@ -194,7 +194,7 @@ public class CachedBufferFactory {
currentBuffer.limit(currentBuffer.capacity());
return result;
}
-
+
public ByteBuffer newDirectByteBuffer(byte[] values, int offset, int lenght) {
return (ByteBuffer)newDirectByteBuffer(lenght).put(values, offset, lenght).rewind();
@@ -326,8 +326,8 @@ public class CachedBufferFactory {
public String toString() {
return getClass().getName()+"[static:"+isFixed()+" alloc size:"+getAllocationSize()+"]";
}
-
-
+
+
// nothing special, just synchronized
private static class SynchronizedCachedBufferFactory extends CachedBufferFactory {
@@ -338,12 +338,12 @@ public class CachedBufferFactory {
private SynchronizedCachedBufferFactory(int size, int step) {
super(size, step);
}
-
+
@Override
public synchronized ByteBuffer newDirectByteBuffer(int size) {
return super.newDirectByteBuffer(size);
}
-
+
}
}
diff --git a/src/java/com/jogamp/common/nio/NativeBuffer.java b/src/java/com/jogamp/common/nio/NativeBuffer.java
index 0273976..d81da9d 100644
--- a/src/java/com/jogamp/common/nio/NativeBuffer.java
+++ b/src/java/com/jogamp/common/nio/NativeBuffer.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
/*
* Created on Tuesday, March 30 2010 18:22
*/
@@ -43,7 +43,7 @@ import java.nio.Buffer;
public interface NativeBuffer<B extends NativeBuffer> {
public int elementSize();
-
+
public int limit();
public int capacity();
@@ -66,8 +66,8 @@ public interface NativeBuffer<B extends NativeBuffer> {
* otherwise 0.
*/
public int arrayOffset();
-
- /**
+
+ /**
* @return the primitive backup array of the buffer if {@link #hasArray()} is true,
* otherwise it throws {@link java.lang.UnsupportedOperationException}.
* The returned primitive array maybe of type <code>int[]</code> or <code>long[]</code>, etc ..
diff --git a/src/java/com/jogamp/common/nio/PointerBuffer.java b/src/java/com/jogamp/common/nio/PointerBuffer.java
index df1c4b1..4a479f0 100644
--- a/src/java/com/jogamp/common/nio/PointerBuffer.java
+++ b/src/java/com/jogamp/common/nio/PointerBuffer.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -60,22 +60,22 @@ public class PointerBuffer extends AbstractBuffer<PointerBuffer> {
static PointerBuffer create(ByteBuffer bb) {
return Platform.is32Bit() ? new PointerBuffer( bb.asIntBuffer() ) : new PointerBuffer( bb.asLongBuffer() );
}
-
+
/** supports backup array */
PointerBuffer(IntBuffer b) {
super(b, ELEMENT_SIZE, b.capacity());
}
-
+
/** supports backup array */
PointerBuffer(LongBuffer b) {
super(b, ELEMENT_SIZE, b.capacity());
}
-
+
private final void validateDataMap() {
if(null == dataMap) {
dataMap = new LongObjectHashMap();
- dataMap.setKeyNotFoundValue(null);
- }
+ dataMap.setKeyNotFoundValue(null);
+ }
}
/** Returns a non direct PointerBuffer in native order, having a backup array */
@@ -84,7 +84,7 @@ public class PointerBuffer extends AbstractBuffer<PointerBuffer> {
return new PointerBuffer(IntBuffer.wrap(new int[size]));
} else {
return new PointerBuffer(LongBuffer.wrap(new long[size]));
- }
+ }
}
/** Returns a direct PointerBuffer in native order, w/o backup array */
@@ -113,9 +113,9 @@ public class PointerBuffer extends AbstractBuffer<PointerBuffer> {
npb.position = position;
return npb;
}
-
- /**
- * Relative bulk get method. Copy the source values <code> src[position .. capacity] [</code>
+
+ /**
+ * Relative bulk get method. Copy the source values <code> src[position .. capacity] [</code>
* to this buffer and increment the position by <code>capacity-position</code>. */
public final PointerBuffer put(PointerBuffer src) {
if (remaining() < src.remaining()) {
@@ -145,7 +145,7 @@ public class PointerBuffer extends AbstractBuffer<PointerBuffer> {
}
return this;
}
-
+
/** Relative get method. Get the pointer value at the current position and increment the position by one. */
public final long get() {
long r = get(position);
@@ -164,9 +164,9 @@ public class PointerBuffer extends AbstractBuffer<PointerBuffer> {
return ((LongBuffer) buffer).get(idx);
}
}
-
- /**
- * Relative bulk get method. Copy the pointer values <code> [ position .. position+length [</code>
+
+ /**
+ * Relative bulk get method. Copy the pointer values <code> [ position .. position+length [</code>
* to the destination array <code> [ dest[offset] .. dest[offset+length] [ </code>
* and increment the position by <code>length</code>. */
public final PointerBuffer get(long[] dest, int offset, int length) {
@@ -203,8 +203,8 @@ public class PointerBuffer extends AbstractBuffer<PointerBuffer> {
return this;
}
- /**
- * Relative bulk put method. Put the pointer values <code> [ src[offset] .. src[offset+length] [</code>
+ /**
+ * Relative bulk put method. Put the pointer values <code> [ src[offset] .. src[offset+length] [</code>
* at the current position and increment the position by <code>length</code>. */
public final PointerBuffer put(long[] src, int offset, int length) {
if (src.length<offset+length) {
@@ -223,8 +223,8 @@ public class PointerBuffer extends AbstractBuffer<PointerBuffer> {
/** Put the address of the given direct Buffer at the given position
of this pointer array.
Adding a reference of the given direct Buffer to this object.
-
- @throws IllegalArgumentException if bb is null or not a direct buffer
+
+ @throws IllegalArgumentException if bb is null or not a direct buffer
*/
public final PointerBuffer referenceBuffer(int index, Buffer bb) {
if(null==bb) {
@@ -239,7 +239,7 @@ public class PointerBuffer extends AbstractBuffer<PointerBuffer> {
throw new RuntimeException("Couldn't determine native address of given Buffer: "+bb);
}
validateDataMap();
- put(index, bbAddr);
+ put(index, bbAddr);
dataMap.put(bbAddr, bb);
return this;
}
diff --git a/src/java/com/jogamp/common/nio/StructAccessor.java b/src/java/com/jogamp/common/nio/StructAccessor.java
index eef9dc5..d6df083 100644
--- a/src/java/com/jogamp/common/nio/StructAccessor.java
+++ b/src/java/com/jogamp/common/nio/StructAccessor.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -58,7 +58,7 @@ public class StructAccessor {
return bb;
}
- /**
+ /**
* Returns 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
@@ -116,11 +116,11 @@ public class StructAccessor {
/** Retrieves the int at the specified byteOffset. */
public final int getIntAt(int byteOffset, int nativeSizeInBytes) {
switch(nativeSizeInBytes) {
- case 2:
+ case 2:
return (int) bb.getShort(byteOffset) & 0x0000FFFF ;
- case 4:
+ case 4:
return bb.getInt(byteOffset);
- case 8:
+ case 8:
return (int) ( bb.getLong(byteOffset) & 0x00000000FFFFFFFFL ) ;
default:
throw new InternalError("invalid nativeSizeInBytes "+nativeSizeInBytes);
@@ -130,20 +130,20 @@ public class StructAccessor {
/** Puts a int at the specified byteOffset. */
public final void setIntAt(int byteOffset, int v, int nativeSizeInBytes) {
switch(nativeSizeInBytes) {
- case 2:
+ case 2:
bb.putShort(byteOffset, (short) ( v & 0x0000FFFF ) );
break;
- case 4:
+ case 4:
bb.putInt(byteOffset, v);
break;
- case 8:
+ case 8:
bb.putLong(byteOffset, (long)v & 0x00000000FFFFFFFFL );
break;
default:
throw new InternalError("invalid nativeSizeInBytes "+nativeSizeInBytes);
}
}
-
+
/** Retrieves the float at the specified byteOffset. */
public final float getFloatAt(int byteOffset) {
return bb.getFloat(byteOffset);
@@ -173,13 +173,13 @@ public class StructAccessor {
public final void setLongAt(int byteOffset, long v) {
bb.putLong(byteOffset, v);
}
-
+
/** Retrieves the long at the specified byteOffset. */
public final long getLongAt(int byteOffset, int nativeSizeInBytes) {
switch(nativeSizeInBytes) {
- case 4:
+ case 4:
return (long) bb.getInt(byteOffset) & 0x00000000FFFFFFFFL;
- case 8:
+ case 8:
return bb.getLong(byteOffset);
default:
throw new InternalError("invalid nativeSizeInBytes "+nativeSizeInBytes);
@@ -189,17 +189,17 @@ public class StructAccessor {
/** Puts a long at the specified byteOffset. */
public final void setLongAt(int byteOffset, long v, int nativeSizeInBytes) {
switch(nativeSizeInBytes) {
- case 4:
+ case 4:
bb.putInt(byteOffset, (int) ( v & 0x00000000FFFFFFFFL ) );
break;
- case 8:
+ case 8:
bb.putLong(byteOffset, v);
break;
default:
throw new InternalError("invalid nativeSizeInBytes "+nativeSizeInBytes);
}
}
-
+
public final void setBytesAt(int byteOffset, byte[] v) {
for (int i = 0; i < v.length; i++) {
bb.put(byteOffset++, v[i]);
@@ -225,18 +225,18 @@ public class StructAccessor {
}
return v;
}
-
+
public final void setShortsAt(int byteOffset, short[] v) {
for (int i = 0; i < v.length; i++, byteOffset+=2) {
bb.putShort(byteOffset, v[i]);
- }
+ }
}
-
+
public final short[] getShortsAt(int byteOffset, short[] v) {
for (int i = 0; i < v.length; i++, byteOffset+=2) {
v[i] = bb.getShort(byteOffset);
}
- return v;
+ return v;
}
public final void setIntsAt(int byteOffset, int[] v) {
diff --git a/src/java/com/jogamp/common/os/AndroidVersion.java b/src/java/com/jogamp/common/os/AndroidVersion.java
index d2afbbc..a710310 100644
--- a/src/java/com/jogamp/common/os/AndroidVersion.java
+++ b/src/java/com/jogamp/common/os/AndroidVersion.java
@@ -34,25 +34,25 @@ import com.jogamp.common.util.ReflectionUtil;
public class AndroidVersion {
public static final boolean isAvailable;
-
- /** Development codename, or the string "REL" for official release */
+
+ /** Development codename, or the string "REL" for official release */
public static final String CODENAME;
-
+
/** internal build value used by the underlying source control. */
public static final String INCREMENTAL;
-
+
/** official build version string */
public static final String RELEASE;
-
+
/** SDK Version number, key to VERSION_CODES */
public static final int SDK_INT;
/** SDK Version string */
public static final String SDK_NAME;
-
+
private static final String androidBuildVersion = "android.os.Build$VERSION";
private static final String androidBuildVersionCodes = "android.os.Build$VERSION_CODES";
-
+
static {
final ClassLoader cl = AndroidVersion.class.getClassLoader();
Class<?> abvClass = null;
@@ -65,7 +65,7 @@ public class AndroidVersion {
abvcClass = ReflectionUtil.getClass(androidBuildVersionCodes, true, cl);
abvcObject = abvcClass.newInstance();
} catch (Exception e) { /* n/a */ }
- isAvailable = null != abvObject;
+ isAvailable = null != abvObject;
if(isAvailable) {
CODENAME = getString(abvClass, abvObject, "CODENAME");
INCREMENTAL = getString(abvClass, abvObject, "INCREMENTAL");
@@ -73,16 +73,16 @@ public class AndroidVersion {
SDK_INT = getInt(abvClass, abvObject, "SDK_INT");
final IntObjectHashMap version_codes = getVersionCodes(abvcClass, abvcObject);
final String sdk_name = (String) version_codes.get(SDK_INT);
- SDK_NAME = ( null != sdk_name ) ? sdk_name : "SDK_"+SDK_INT ;
+ SDK_NAME = ( null != sdk_name ) ? sdk_name : "SDK_"+SDK_INT ;
} else {
CODENAME = null;
INCREMENTAL = null;
RELEASE = null;
- SDK_INT = -1;
+ SDK_INT = -1;
SDK_NAME = null;
}
}
-
+
private static final IntObjectHashMap getVersionCodes(Class<?> cls, Object obj) {
final Field[] fields = cls.getFields();
IntObjectHashMap map = new IntObjectHashMap( 3 * fields.length / 2, 0.75f );
@@ -93,10 +93,10 @@ public class AndroidVersion {
// System.err.println(i+": "+version+": "+version_name);
map.put(new Integer(version), version_name);
} catch (Exception e) { e.printStackTrace(); /* n/a */ }
- }
+ }
return map;
}
-
+
private static final String getString(Class<?> cls, Object obj, String name) {
try {
Field f = cls.getField(name);
@@ -112,6 +112,6 @@ public class AndroidVersion {
} catch (Exception e) { e.printStackTrace(); /* n/a */ }
return -1;
}
-
+
// android.os.Build.VERSION
}
diff --git a/src/java/com/jogamp/common/os/DynamicLibraryBundle.java b/src/java/com/jogamp/common/os/DynamicLibraryBundle.java
index 56387b6..a69fd7a 100644
--- a/src/java/com/jogamp/common/os/DynamicLibraryBundle.java
+++ b/src/java/com/jogamp/common/os/DynamicLibraryBundle.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.common.os;
import java.util.ArrayList;
@@ -43,7 +43,7 @@ import com.jogamp.common.util.RunnableExecutor;
* <li>The JNI glue-code native library, eg jogl_desktop.dll. From here on this is referred as the Glue</li>
* </ul>
* <p>
- * An {@link DynamicLibraryBundleInfo} instance is being passed in the constructor,
+ * An {@link DynamicLibraryBundleInfo} instance is being passed in the constructor,
* providing the required information about the tool and glue libraries.
* The ClassLoader of it's implementation is also being used to help locating the native libraries.
* </p>
@@ -65,7 +65,7 @@ public class DynamicLibraryBundle implements DynamicLookupHelper {
private final List<List<String>> toolLibNames;
private final List<String> glueLibNames;
private final boolean[] toolLibLoaded;
-
+
private int toolLibLoadedNumber;
private final boolean[] glueLibLoaded;
@@ -76,15 +76,15 @@ public class DynamicLibraryBundle implements DynamicLookupHelper {
private HashSet<String> toolGetProcAddressFuncNameSet;
private List<String> toolGetProcAddressFuncNameList;
- /** Returns an AWT-EDT {@link RunnableExecutor} implementation if AWT is available, otherwise {@link RunnableExecutor#currentThreadExecutor}. */
+ /** Returns an AWT-EDT {@link RunnableExecutor} implementation if AWT is available, otherwise {@link RunnableExecutor#currentThreadExecutor}. */
public static RunnableExecutor getDefaultRunnableExecutor() {
return RunnableExecutor.currentThreadExecutor;
}
-
- /**
+
+ /**
* Instantiates and loads all {@link NativeLibrary}s incl. JNI libraries.
* <p>
- * The ClassLoader of the {@link DynamicLibraryBundleInfo} implementation class
+ * The ClassLoader of the {@link DynamicLibraryBundleInfo} implementation class
* is being used to help locating the native libraries.
* </p>
*/
@@ -104,12 +104,12 @@ public class DynamicLibraryBundle implements DynamicLookupHelper {
if( toolLibNames.size() == 0 ) {
System.err.println("No Tool native library names given");
}
-
+
if( glueLibNames.size() == 0 ) {
System.err.println("No Glue native library names given");
}
}
-
+
for(int i=toolLibNames.size()-1; i>=0; i--) {
toolLibLoaded[i] = false;
}
@@ -117,17 +117,17 @@ public class DynamicLibraryBundle implements DynamicLookupHelper {
for(int i=glueLibNames.size()-1; i>=0; i--) {
glueLibLoaded[i] = false;
}
-
+
info.getLibLoaderExecutor().invoke(true, new Runnable() {
- public void run() {
+ public void run() {
loadLibraries();
- } } ) ;
-
+ } } ) ;
+
toolGetProcAddressFuncNameList = info.getToolGetProcAddressFuncNameList();
if( null != toolGetProcAddressFuncNameList ) {
toolGetProcAddressFuncNameSet = new HashSet<String>(toolGetProcAddressFuncNameList);
toolGetProcAddressHandle = getToolGetProcAddressHandle();
- toolGetProcAddressComplete = 0 != toolGetProcAddressHandle;
+ toolGetProcAddressComplete = 0 != toolGetProcAddressHandle;
} else {
toolGetProcAddressFuncNameSet = new HashSet<String>();
toolGetProcAddressHandle = 0;
@@ -144,7 +144,7 @@ public class DynamicLibraryBundle implements DynamicLookupHelper {
System.err.println(" LibLoaderExecutor: "+info.getLibLoaderExecutor().getClass().getName());
}
}
-
+
/** Unload all {@link NativeLibrary}s, and remove all references. */
public final void destroy() {
if(DEBUG) {
@@ -179,7 +179,7 @@ public class DynamicLibraryBundle implements DynamicLookupHelper {
/**
* @return true if all tool libraries are loaded,
* otherwise false.
- *
+ *
* @see DynamicLibraryBundleInfo#getToolLibNames()
*/
public final boolean isToolLibComplete() {
@@ -207,9 +207,9 @@ public class DynamicLibraryBundle implements DynamicLookupHelper {
/**
* @return true if the last entry has been loaded,
- * while ignoring the preload dependencies.
+ * while ignoring the preload dependencies.
* Otherwise false.
- *
+ *
* @see DynamicLibraryBundleInfo#getGlueLibNames()
*/
public final boolean isGlueLibComplete() {
@@ -241,7 +241,7 @@ public class DynamicLibraryBundle implements DynamicLookupHelper {
}
protected final NativeLibrary loadFirstAvailable(List<String> libNames, ClassLoader loader, boolean global) {
- for (int i=0; i < libNames.size(); i++) {
+ for (int i=0; i < libNames.size(); i++) {
final NativeLibrary lib = NativeLibrary.open(libNames.get(i), loader, global);
if (lib != null) {
return lib;
@@ -256,7 +256,7 @@ public class DynamicLibraryBundle implements DynamicLookupHelper {
final ClassLoader cl = info.getClass().getClassLoader();
NativeLibrary lib = null;
- for (i=0; i < toolLibNames.size(); i++) {
+ for (i=0; i < toolLibNames.size(); i++) {
final List<String> libNames = toolLibNames.get(i);
if( null != libNames && libNames.size() > 0 ) {
lib = loadFirstAvailable(libNames, cl, info.shallLinkGlobal());
@@ -282,7 +282,7 @@ public class DynamicLibraryBundle implements DynamicLookupHelper {
}
glueLibLoadedNumber = 0;
- for (i=0; i < glueLibNames.size(); i++) {
+ for (i=0; i < glueLibNames.size(); i++) {
final String libName = glueLibNames.get(i);
boolean ignoreError = true;
boolean res;
@@ -304,7 +304,7 @@ public class DynamicLibraryBundle implements DynamicLookupHelper {
}
}
}
-
+
private final long dynamicLookupFunctionOnLibs(String funcName) {
if(!isToolLibLoaded() || null==funcName) {
if(DEBUG_LOOKUP && !isToolLibLoaded()) {
@@ -347,7 +347,7 @@ public class DynamicLibraryBundle implements DynamicLookupHelper {
}
return 0;
}
-
+
@Override
public final long dynamicLookupFunction(String funcName) {
if(!isToolLibLoaded() || null==funcName) {
@@ -371,11 +371,11 @@ public class DynamicLibraryBundle implements DynamicLookupHelper {
addr = dynamicLookupFunctionOnLibs(funcName);
}
if(0==addr && !useToolGetProcAdressFirst) {
- addr = toolDynamicLookupFunction(funcName);
+ addr = toolDynamicLookupFunction(funcName);
}
return addr;
}
-
+
@Override
public final boolean isFunctionAvailable(String funcName) {
return 0 != dynamicLookupFunction(funcName);
diff --git a/src/java/com/jogamp/common/os/DynamicLibraryBundleInfo.java b/src/java/com/jogamp/common/os/DynamicLibraryBundleInfo.java
index ef44298..7be5f25 100644
--- a/src/java/com/jogamp/common/os/DynamicLibraryBundleInfo.java
+++ b/src/java/com/jogamp/common/os/DynamicLibraryBundleInfo.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.common.os;
import java.util.List;
@@ -36,10 +36,10 @@ import com.jogamp.common.util.RunnableExecutor;
public interface DynamicLibraryBundleInfo {
public static final boolean DEBUG = DynamicLibraryBundle.DEBUG;
- /**
+ /**
* If a {@link SecurityManager} is installed, user needs link permissions
* for the named libraries.
- *
+ *
* @return a list of Tool library names or alternative library name lists.<br>
* <ul>
* <li>GL/GLU example Unix: [ [ "libGL.so.1", "libGL.so", "GL" ], [ "libGLU.so", "GLU" ] ] </li>
@@ -49,10 +49,10 @@ public interface DynamicLibraryBundleInfo {
*/
public List<List<String>> getToolLibNames();
- /**
+ /**
* If a {@link SecurityManager} is installed, user needs link permissions
* for the named libraries.
- *
+ *
* @return a list of Glue library names.<br>
* <ul>
* <li>GL: [ "nativewindow_x11", "jogl_gl2es12", "jogl_desktop" ] </li>
@@ -64,15 +64,15 @@ public interface DynamicLibraryBundleInfo {
*/
public List<String> getGlueLibNames();
- /**
+ /**
* May return the native libraries <pre>GetProcAddressFunc</pre> names, the first found function is being used.<br>
* This could be eg: <pre> glXGetProcAddressARB, glXGetProcAddressARB </pre>.<br>
* If your Tool does not has this facility, just return null.
* @see #toolGetProcAddress(long, String)
*/
- public List<String> getToolGetProcAddressFuncNameList() ;
+ public List<String> getToolGetProcAddressFuncNameList() ;
- /**
+ /**
* May implement the lookup function using the Tools facility.<br>
* The actual function pointer is provided to allow proper bootstrapping of the ProcAddressTable,
* using one of the provided function names by {@link #getToolGetProcAddressFuncNameList()}.<br>
@@ -81,7 +81,7 @@ public interface DynamicLibraryBundleInfo {
/**
* @param funcName
- * @return true if {@link #toolGetProcAddress(long, String)} shall be tried before
+ * @return true if {@link #toolGetProcAddress(long, String)} shall be tried before
* the system loader for the given function lookup. Otherwise false.
* Default is <b>true</b>.
*/
@@ -90,20 +90,20 @@ public interface DynamicLibraryBundleInfo {
/** @return true if the native library symbols shall be made available for symbol resolution of subsequently loaded libraries. */
public boolean shallLinkGlobal();
- /**
+ /**
* If method returns <code>true</code> <i>and</i> if a {@link SecurityManager} is installed, user needs link permissions
* for <b>all</b> libraries, i.e. for <code>new RuntimePermission("loadLibrary.*");</code>!
- *
- * @return true if the dynamic symbol lookup shall happen system wide, over all loaded libraries.
- * Otherwise only the loaded native libraries are used for lookup, which shall be the default.
+ *
+ * @return true if the dynamic symbol lookup shall happen system wide, over all loaded libraries.
+ * Otherwise only the loaded native libraries are used for lookup, which shall be the default.
*/
public boolean shallLookupGlobal();
-
+
/**
- * Returns a suitable {@link RunnableExecutor} implementation, which is being used
+ * Returns a suitable {@link RunnableExecutor} implementation, which is being used
* to load the <code>tool</code> and <code>glue</code> native libraries.
* <p>
- * This allows the generic {@link DynamicLibraryBundle} implementation to
+ * This allows the generic {@link DynamicLibraryBundle} implementation to
* load the native libraries on a designated thread.
* </p>
* <p>
diff --git a/src/java/com/jogamp/common/os/DynamicLinker.java b/src/java/com/jogamp/common/os/DynamicLinker.java
index ed52413..3b1ec3f 100644
--- a/src/java/com/jogamp/common/os/DynamicLinker.java
+++ b/src/java/com/jogamp/common/os/DynamicLinker.java
@@ -39,10 +39,10 @@ public interface DynamicLinker {
* <p>
* Opens the named library, allowing system wide access for other <i>users</i>.
* </p>
- *
+ *
* @param pathname the full pathname for the library to open
* @param debug set to true to enable debugging
- * @return the library handle, maybe 0 if not found.
+ * @return the library handle, maybe 0 if not found.
* @throws SecurityException if user is not granted access for the named library.
*/
public long openLibraryGlobal(String pathname, boolean debug) throws SecurityException;
@@ -53,50 +53,50 @@ public interface DynamicLinker {
* <p>
* Opens the named library, restricting access to this process.
* </p>
- *
+ *
* @param pathname the full pathname for the library to open
* @param debug set to true to enable debugging
- * @return the library handle, maybe 0 if not found.
+ * @return the library handle, maybe 0 if not found.
* @throws SecurityException if user is not granted access for the named library.
*/
public long openLibraryLocal(String pathname, boolean debug) throws SecurityException;
-
+
/**
* If a {@link SecurityManager} is installed, user needs link permissions
* for <b>all</b> libraries, i.e. for <code>new RuntimePermission("loadLibrary.*");</code>!
- *
+ *
* @param symbolName global symbol name to lookup up system wide.
- * @return the library handle, maybe 0 if not found.
+ * @return the library handle, maybe 0 if not found.
* @throws SecurityException if user is not granted access for all libraries.
*/
public long lookupSymbolGlobal(String symbolName) throws SecurityException;
-
+
/**
- * Security checks are implicit by previous call of
+ * Security checks are implicit by previous call of
* {@link #openLibraryLocal(String, boolean)} or {@link #openLibraryGlobal(String, boolean)}
* retrieving the <code>librarHandle</code>.
- *
+ *
* @param libraryHandle a library handle previously retrieved via {@link #openLibraryLocal(String, boolean)} or {@link #openLibraryGlobal(String, boolean)}.
* @param symbolName global symbol name to lookup up system wide.
- * @return the library handle, maybe 0 if not found.
+ * @return the library handle, maybe 0 if not found.
* @throws IllegalArgumentException in case case <code>libraryHandle</code> is unknown.
*/
public long lookupSymbol(long libraryHandle, String symbolName) throws IllegalArgumentException;
-
+
/**
- * Security checks are implicit by previous call of
+ * Security checks are implicit by previous call of
* {@link #openLibraryLocal(String, boolean)} or {@link #openLibraryGlobal(String, boolean)}
* retrieving the <code>librarHandle</code>.
- *
+ *
* @param libraryHandle a library handle previously retrieved via {@link #openLibraryLocal(String, boolean)} or {@link #openLibraryGlobal(String, boolean)}.
* @throws IllegalArgumentException in case case <code>libraryHandle</code> is unknown.
*/
public void closeLibrary(long libraryHandle) throws IllegalArgumentException;
-
+
/**
- * Returns a string containing the last error.
- * Maybe called for debuging purposed if any method fails.
- * @return error string, maybe null. A null or non-null value has no semantics.
+ * Returns a string containing the last error.
+ * Maybe called for debuging purposed if any method fails.
+ * @return error string, maybe null. A null or non-null value has no semantics.
*/
public String getLastError();
}
diff --git a/src/java/com/jogamp/common/os/DynamicLookupHelper.java b/src/java/com/jogamp/common/os/DynamicLookupHelper.java
index 94a7e92..0f87351 100644
--- a/src/java/com/jogamp/common/os/DynamicLookupHelper.java
+++ b/src/java/com/jogamp/common/os/DynamicLookupHelper.java
@@ -1,21 +1,21 @@
/*
* 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
@@ -28,11 +28,11 @@
* 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.
*/
@@ -41,7 +41,7 @@ package com.jogamp.common.os;
import jogamp.common.Debug;
-/** Interface callers may use ProcAddressHelper's
+/** Interface callers may use ProcAddressHelper's
* {@link com.jogamp.gluegen.runtime.ProcAddressTable#reset(com.jogamp.common.os.DynamicLookupHelper) reset}
* helper method to install function pointers into a
* ProcAddressTable. This must typically be written with native
@@ -49,12 +49,12 @@ import jogamp.common.Debug;
public interface DynamicLookupHelper {
public static final boolean DEBUG = Debug.debug("NativeLibrary");
public static final boolean DEBUG_LOOKUP = Debug.debug("NativeLibrary.Lookup");
-
+
/**
* Returns the function handle for function 'funcName'.
*/
public long dynamicLookupFunction(String funcName);
-
+
/**
* Queries whether function 'funcName' is available.
*/
diff --git a/src/java/com/jogamp/common/os/MachineDescription.java b/src/java/com/jogamp/common/os/MachineDescription.java
index ab0885e..aea9de1 100644
--- a/src/java/com/jogamp/common/os/MachineDescription.java
+++ b/src/java/com/jogamp/common/os/MachineDescription.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -61,14 +61,14 @@ public class MachineDescription {
X86_64_WINDOWS(Platform.CPUType.X86_64),
/** {@link Platform.CPUType#SPARC_32} Big Endian Solaris */
SPARC_32_SUNOS(Platform.CPUType.SPARC_32);
-
+
public final Platform.CPUType cpu;
ID(Platform.CPUType cpu){
this.cpu = cpu;
}
- }
-
+ }
+
/* arch os int, long, float, doubl, ldoubl, ptr, page */
private final static int[] size_armeabi = { 4, 4, 4, 8, 8, 4, 4096 };
private final static int[] size_x86_32_unix = { 4, 4, 4, 8, 12, 4, 4096 };
@@ -78,7 +78,7 @@ public class MachineDescription {
private final static int[] size_x86_64_windows = { 4, 4, 4, 8, 16, 8, 4096 };
private final static int[] size_sparc_32_sunos = { 4, 4, 4, 8, 16, 4, 8192 };
- /* arch os i8, i16, i32, i64, int, long, float, doubl, ldoubl, ptr */
+ /* arch os i8, i16, i32, i64, int, long, float, doubl, ldoubl, ptr */
private final static int[] align_armeabi = { 1, 2, 4, 8, 4, 4, 4, 8, 8, 4 };
private final static int[] align_x86_32_unix = { 1, 2, 4, 4, 4, 4, 4, 4, 4, 4 };
private final static int[] align_x86_32_macos = { 1, 2, 4, 4, 4, 4, 4, 4, 16, 4 };
@@ -86,7 +86,7 @@ public class MachineDescription {
private final static int[] align_x86_64_unix = { 1, 2, 4, 8, 4, 8, 4, 8, 16, 8 };
private final static int[] align_x86_64_windows = { 1, 2, 4, 8, 4, 4, 4, 8, 16, 8 };
private final static int[] align_sparc_32_sunos = { 1, 2, 4, 8, 4, 4, 4, 8, 8, 4 };
-
+
public enum StaticConfig {
/** {@link MachineDescription.ID#ARMle_EABI } */
ARMle_EABI(ID.ARMle_EABI, true, size_armeabi, align_armeabi),
@@ -102,10 +102,10 @@ public class MachineDescription {
X86_64_WINDOWS(ID.X86_64_WINDOWS, true, size_x86_64_windows, align_x86_64_windows),
/** {@link MachineDescription.ID#SPARC_32_SUNOS } */
SPARC_32_SUNOS(ID.SPARC_32_SUNOS, false, size_sparc_32_sunos, align_sparc_32_sunos);
-
- public final ID id;
+
+ public final ID id;
public final MachineDescription md;
-
+
StaticConfig(ID id, boolean littleEndian, int[] sizes, int[] alignments) {
this.id = id;
int i=0, j=0;
@@ -128,7 +128,7 @@ public class MachineDescription {
alignments[j++],
alignments[j++]);
}
-
+
public StringBuilder toString(StringBuilder sb) {
if(null==sb) {
sb = new StringBuilder();
@@ -137,23 +137,23 @@ public class MachineDescription {
md.toString(sb);
return sb;
}
-
+
@Override
public String toString() {
return toString(null).toString();
}
}
-
+
final private boolean runtimeValidated;
-
+
final private boolean littleEndian;
-
+
final private int int8SizeInBytes = 1;
final private int int16SizeInBytes = 2;
final private int int32SizeInBytes = 4;
final private int int64SizeInBytes = 8;
-
+
final private int intSizeInBytes;
final private int longSizeInBytes;
final private int floatSizeInBytes;
@@ -162,7 +162,7 @@ public class MachineDescription {
final private int pointerSizeInBytes;
final private int pageSizeInBytes;
final private boolean is32Bit;
-
+
final private int int8AlignmentInBytes;
final private int int16AlignmentInBytes;
final private int int32AlignmentInBytes;
@@ -176,7 +176,7 @@ public class MachineDescription {
public MachineDescription(boolean runtimeValidated,
boolean littleEndian,
-
+
int intSizeInBytes,
int longSizeInBytes,
int floatSizeInBytes,
@@ -184,7 +184,7 @@ public class MachineDescription {
int ldoubleSizeInBytes,
int pointerSizeInBytes,
int pageSizeInBytes,
-
+
int int8AlignmentInBytes,
int int16AlignmentInBytes,
int int32AlignmentInBytes,
@@ -195,16 +195,16 @@ public class MachineDescription {
int doubleAlignmentInBytes,
int ldoubleAlignmentInBytes,
int pointerAlignmentInBytes) {
- this.runtimeValidated = runtimeValidated;
+ this.runtimeValidated = runtimeValidated;
this.littleEndian = littleEndian;
-
+
this.intSizeInBytes = intSizeInBytes;
this.longSizeInBytes = longSizeInBytes;
this.floatSizeInBytes = floatSizeInBytes;
this.doubleSizeInBytes = doubleSizeInBytes;
this.ldoubleSizeInBytes = ldoubleSizeInBytes;
this.pointerSizeInBytes = pointerSizeInBytes;
- this.pageSizeInBytes = pageSizeInBytes;
+ this.pageSizeInBytes = pageSizeInBytes;
this.is32Bit = 4 == pointerSizeInBytes;
this.int8AlignmentInBytes = int8AlignmentInBytes;
@@ -218,14 +218,14 @@ public class MachineDescription {
this.ldoubleAlignmentInBytes = ldoubleAlignmentInBytes;
this.pointerAlignmentInBytes = pointerAlignmentInBytes;
}
-
+
/**
* @return true if all values are validated at runtime, otherwise false (i.e. for static compilation w/ preset values)
*/
public final boolean isRuntimeValidated() {
return runtimeValidated;
}
-
+
/**
* Returns true only if this system uses little endian byte ordering.
*/
@@ -246,7 +246,7 @@ public class MachineDescription {
public final boolean is64Bit() {
return !is32Bit;
}
-
+
public final int intSizeInBytes() { return intSizeInBytes; }
public final int longSizeInBytes() { return longSizeInBytes; }
public final int int8SizeInBytes() { return int8SizeInBytes; }
@@ -258,7 +258,7 @@ public class MachineDescription {
public final int ldoubleSizeInBytes() { return ldoubleSizeInBytes; }
public final int pointerSizeInBytes() { return pointerSizeInBytes; }
public final int pageSizeInBytes() { return pageSizeInBytes; }
-
+
public final int intAlignmentInBytes() { return intAlignmentInBytes; }
public final int longAlignmentInBytes() { return longAlignmentInBytes; }
public final int int8AlignmentInBytes() { return int8AlignmentInBytes; }
@@ -269,20 +269,20 @@ public class MachineDescription {
public final int doubleAlignmentInBytes() { return doubleAlignmentInBytes; }
public final int ldoubleAlignmentInBytes() { return ldoubleAlignmentInBytes; }
public final int pointerAlignmentInBytes() { return pointerAlignmentInBytes; }
-
+
/**
* @return number of pages required for size in bytes
*/
public int pageCount(int size) {
return ( size + ( pageSizeInBytes - 1) ) / pageSizeInBytes ; // integer arithmetic
}
-
+
/**
* @return page aligned size in bytes
*/
public int pageAlignedSize(int size) {
return pageCount(size) * pageSizeInBytes;
- }
+ }
/**
* Checks whether two size objects are equal. Two instances
@@ -294,7 +294,7 @@ public class MachineDescription {
public final boolean equals(Object obj) {
if (this == obj) { return true; }
if ( !(obj instanceof MachineDescription) ) { return false; }
- final MachineDescription md = (MachineDescription) obj;
+ final MachineDescription md = (MachineDescription) obj;
return pageSizeInBytes == md.pageSizeInBytes &&
compatible(md);
@@ -309,7 +309,7 @@ public class MachineDescription {
*/
public final boolean compatible(MachineDescription md) {
return littleEndian == md.littleEndian &&
-
+
intSizeInBytes == md.intSizeInBytes &&
longSizeInBytes == md.longSizeInBytes &&
floatSizeInBytes == md.floatSizeInBytes &&
@@ -317,7 +317,7 @@ public class MachineDescription {
ldoubleSizeInBytes == md.ldoubleSizeInBytes &&
pointerSizeInBytes == md.pointerSizeInBytes &&
is32Bit == md.is32Bit &&
-
+
int8AlignmentInBytes == md.int8AlignmentInBytes &&
int16AlignmentInBytes == md.int16AlignmentInBytes &&
int32AlignmentInBytes == md.int32AlignmentInBytes &&
@@ -329,7 +329,7 @@ public class MachineDescription {
ldoubleAlignmentInBytes == md.ldoubleAlignmentInBytes &&
pointerAlignmentInBytes == md.pointerAlignmentInBytes ;
}
-
+
public StringBuilder toString(StringBuilder sb) {
if(null==sb) {
sb = new StringBuilder();
@@ -345,13 +345,13 @@ public class MachineDescription {
sb.append(", double ").append(doubleSizeInBytes) .append(" / ").append(doubleAlignmentInBytes);
sb.append(", ldouble ").append(ldoubleSizeInBytes).append(" / ").append(ldoubleAlignmentInBytes).append(Platform.getNewline());
sb.append(" pointer ").append(pointerSizeInBytes).append(" / ").append(pointerAlignmentInBytes);
- sb.append(", page ").append(pageSizeInBytes);
+ sb.append(", page ").append(pageSizeInBytes);
return sb;
}
-
+
@Override
public String toString() {
return toString(null).toString();
}
-
+
}
diff --git a/src/java/com/jogamp/common/os/NativeLibrary.java b/src/java/com/jogamp/common/os/NativeLibrary.java
index 3d81479..df59611 100644
--- a/src/java/com/jogamp/common/os/NativeLibrary.java
+++ b/src/java/com/jogamp/common/os/NativeLibrary.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2011 JogAmp Community. 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -72,7 +72,7 @@ import com.jogamp.common.util.cache.TempJarCache;
ProcAddressTable glue code generation style without additional
supporting code needed in the generated library. */
-public final class NativeLibrary implements DynamicLookupHelper {
+public final class NativeLibrary implements DynamicLookupHelper {
private static final DynamicLinker dynLink;
private static final String[] prefixes;
private static final String[] suffixes;
@@ -85,7 +85,7 @@ public final class NativeLibrary implements DynamicLookupHelper {
prefixes = new String[] { "" };
suffixes = new String[] { ".dll" };
break;
-
+
case MACOS:
dynLink = new MacOSXDynamicLinkerImpl();
prefixes = new String[] { "lib" };
@@ -97,12 +97,12 @@ public final class NativeLibrary implements DynamicLookupHelper {
prefixes = new String[] { "lib" };
suffixes = new String[] { ".so" };
break;
-
+
/*
case FREEBSD:
case SUNOS:
- case HPUX:
- case OPENKODE:
+ case HPUX:
+ case OPENKODE:
case LINUX: */
default:
dynLink = new PosixDynamicLinkerImpl();
@@ -119,7 +119,7 @@ public final class NativeLibrary implements DynamicLookupHelper {
// May as well keep around the path to the library we opened
private final String libraryPath;
-
+
private final boolean global;
// Private constructor to prevent arbitrary instances from floating around
@@ -218,7 +218,7 @@ public final class NativeLibrary implements DynamicLookupHelper {
if( null != t ) {
t.printStackTrace();
}
- }
+ }
}
if (DEBUG) {
@@ -290,10 +290,10 @@ public final class NativeLibrary implements DynamicLookupHelper {
/**
* Comparison of prefix and suffix of the given libName's basename
* is performed case insensitive <br>
- *
- * @param libName the full path library name with prefix and suffix
+ *
+ * @param libName the full path library name with prefix and suffix
* @param isLowerCaseAlready indicates if libName is already lower-case
- *
+ *
* @return basename of libName w/o path, ie. /usr/lib/libDrinkBeer.so -> DrinkBeer on Unix systems, but null on Windows.
*/
public static final String isValidNativeLibraryName(String libName, boolean isLowerCaseAlready) {
@@ -305,7 +305,7 @@ public final class NativeLibrary implements DynamicLookupHelper {
}
final String libBaseNameLC = isLowerCaseAlready ? libBaseName : libBaseName.toLowerCase();
int prefixIdx = -1;
- for(int i=0; i<prefixes.length && 0 > prefixIdx; i++) {
+ for(int i=0; i<prefixes.length && 0 > prefixIdx; i++) {
if (libBaseNameLC.startsWith(prefixes[i])) {
prefixIdx = i;
}
@@ -319,9 +319,9 @@ public final class NativeLibrary implements DynamicLookupHelper {
}
}
}
- return null;
+ return null;
}
-
+
/** 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. */
@@ -377,7 +377,7 @@ public final class NativeLibrary implements DynamicLookupHelper {
if (searchSystemPathFirst) {
if(null != sysPath) {
res[i++] = sysPath;
- }
+ }
}
if(null != usrPath) {
res[i++] = usrPath;
@@ -385,7 +385,7 @@ public final class NativeLibrary implements DynamicLookupHelper {
if (!searchSystemPathFirst) {
if(null != sysPath) {
res[i++] = sysPath;
- }
+ }
}
return res;
}
@@ -422,7 +422,7 @@ public final class NativeLibrary implements DynamicLookupHelper {
// Add current location
addPaths("/System/Library/Frameworks/" + libName + ".Framework", baseNames, paths);
}
-
+
return paths;
}
@@ -433,7 +433,7 @@ public final class NativeLibrary implements DynamicLookupHelper {
switch (PlatformPropsImpl.OS_TYPE) {
case WINDOWS:
return windowsLibName;
-
+
case MACOS:
return macOSXLibName;
@@ -441,8 +441,8 @@ public final class NativeLibrary implements DynamicLookupHelper {
case FREEBSD:
case DALVIK:
case SUNOS:
- case HPUX:
- case OPENKODE:
+ case HPUX:
+ case OPENKODE:
case LINUX: */
default:
return unixLibName;
@@ -459,9 +459,9 @@ public final class NativeLibrary implements DynamicLookupHelper {
} catch (URISyntaxException uriEx) {
throw new IllegalArgumentException(uriEx);
}
-
+
int prefixIdx = -1;
- for(int i=0; i<prefixes.length && 0 > prefixIdx; i++) {
+ for(int i=0; i<prefixes.length && 0 > prefixIdx; i++) {
if (libBaseNameLC.startsWith(prefixes[i])) {
prefixIdx = i;
}
@@ -494,7 +494,7 @@ public final class NativeLibrary implements DynamicLookupHelper {
}
}
- String[] res = new String[prefixes.length * suffixes.length +
+ String[] res = new String[prefixes.length * suffixes.length +
( PlatformPropsImpl.OS_TYPE == Platform.OSType.MACOS ? 1 : 0 )];
int idx = 0;
for (int i = 0; i < prefixes.length; i++) {
diff --git a/src/java/com/jogamp/common/os/Platform.java b/src/java/com/jogamp/common/os/Platform.java
index a01a4b4..896ea56 100644
--- a/src/java/com/jogamp/common/os/Platform.java
+++ b/src/java/com/jogamp/common/os/Platform.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.common.os;
import java.net.URI;
@@ -48,7 +48,7 @@ import jogamp.common.os.PlatformPropsImpl;
* Utility class for querying platform specific properties.
* <p>
* Some field declarations and it's static initialization has been delegated
- * to it's super class {@link PlatformPropsImpl} to solve
+ * to it's super class {@link PlatformPropsImpl} to solve
* static initialization interdependencies w/ the GlueGen native library loading
* and it's derived information {@link #getMachineDescription()}, {@link #is32Bit()}, ..<br>
* This mechanism is preferred in this case to avoid synchronization and locking
@@ -56,20 +56,20 @@ import jogamp.common.os.PlatformPropsImpl;
* </p>
*/
public class Platform extends PlatformPropsImpl {
-
+
public enum OSType {
- LINUX(0), FREEBSD(1), ANDROID(2), MACOS(3), SUNOS(4), HPUX(5), WINDOWS(6), OPENKODE(7);
-
+ LINUX(0), FREEBSD(1), ANDROID(2), MACOS(3), SUNOS(4), HPUX(5), WINDOWS(6), OPENKODE(7);
+
public final int id;
OSType(int id){
this.id = id;
}
}
-
+
public enum CPUFamily {
/** AMD/Intel */
- X86( 0x00000000),
+ X86( 0x00000000),
/** ARM */
ARM( 0x00010000),
/** Power PC */
@@ -79,17 +79,17 @@ public class Platform extends PlatformPropsImpl {
/** PA RISC */
PA_RISC(0xFFFF0000),
/** Itanium */
- IA64( 0xFFFF1000);
-
+ IA64( 0xFFFF1000);
+
public final int id;
CPUFamily(int id){
this.id = id;
}
}
-
+
public enum CPUType {
- /** X86 32bit */
+ /** X86 32bit */
X86_32( CPUFamily.X86, 0x0001),
/** X86 64bit */
X86_64( CPUFamily.X86, 0x0002),
@@ -111,72 +111,72 @@ public class Platform extends PlatformPropsImpl {
IA64( CPUFamily.IA64, 0x0000),
/** PA_RISC2_0 */
PA_RISC2_0(CPUFamily.PA_RISC, 0x0001);
-
+
public final int id;
public final CPUFamily family;
-
+
CPUType(CPUFamily type, int id){
this.family = type;
this.id = id;
}
-
+
public CPUFamily getFamily() { return family; }
- }
-
+ }
+
public enum ABIType {
- GENERIC_ABI ( 0x0000 ),
- /** ARM GNU-EABI ARMEL -mfloat-abi=softfp */
+ GENERIC_ABI ( 0x0000 ),
+ /** ARM GNU-EABI ARMEL -mfloat-abi=softfp */
EABI_GNU_ARMEL ( 0x0001 ),
- /** ARM GNU-EABI ARMHF -mfloat-abi=hard */
+ /** ARM GNU-EABI ARMHF -mfloat-abi=hard */
EABI_GNU_ARMHF ( 0x0002 );
-
+
public final int id;
-
+
ABIType(int id){
this.id = id;
- }
+ }
}
-
+
private static final String useTempJarCachePropName = "jogamp.gluegen.UseTempJarCache";
-
+
/** fixed basename of JAR file and native library */
- private static final String libBaseName = "gluegen-rt";
-
+ private static final String libBaseName = "gluegen-rt";
+
//
// static initialization order:
//
-
+
/**
- * System property: 'jogamp.gluegen.UseTempJarCache',
+ * System property: 'jogamp.gluegen.UseTempJarCache',
* defaults to true if {@link #OS_TYPE} is not {@link OSType#ANDROID}.
*/
public static final boolean USE_TEMP_JAR_CACHE;
-
+
//
// post loading native lib:
//
-
+
private static final MachineDescription machineDescription;
-
+
private static final boolean is32Bit;
-
+
/** <code>true</code> if AWT is available and not in headless mode, otherwise <code>false</code>. */
public static final boolean AWT_AVAILABLE;
-
+
private static final boolean isRunningFromJarURL;
-
+
static {
final boolean[] _isRunningFromJarURL = new boolean[] { false };
final boolean[] _USE_TEMP_JAR_CACHE = new boolean[] { false };
final boolean[] _AWT_AVAILABLE = new boolean[] { false };
-
- AccessController.doPrivileged(new PrivilegedAction<Object>() {
+
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
-
+
PlatformPropsImpl.initSingleton(); // documenting the order of static initialization
-
+
final ClassLoader cl = Platform.class.getClassLoader();
-
+
final URI platformClassJarURI;
{
URI _platformClassJarURI = null;
@@ -185,11 +185,11 @@ public class Platform extends PlatformPropsImpl {
} catch (Exception e) { }
platformClassJarURI = _platformClassJarURI;
}
- _isRunningFromJarURL[0] = null != platformClassJarURI;
-
+ _isRunningFromJarURL[0] = null != platformClassJarURI;
+
_USE_TEMP_JAR_CACHE[0] = ( OS_TYPE != OSType.ANDROID ) && ( null != platformClassJarURI ) &&
Debug.getBooleanProperty(useTempJarCachePropName, true, true);
-
+
// load GluegenRT native library
if(_USE_TEMP_JAR_CACHE[0] && TempJarCache.initSingleton()) {
try {
@@ -200,13 +200,13 @@ public class Platform extends PlatformPropsImpl {
}
}
DynamicLibraryBundle.GlueJNILibLoader.loadLibrary(libBaseName, false, cl);
-
+
// JVM bug workaround
JVMUtil.initSingleton(); // requires gluegen-rt, one-time init.
-
+
// AWT Headless determination
if( !Debug.getBooleanProperty("java.awt.headless", true) &&
- ReflectionUtil.isClassAvailable(ReflectionUtil.AWTNames.ComponentClass, cl) &&
+ ReflectionUtil.isClassAvailable(ReflectionUtil.AWTNames.ComponentClass, cl) &&
ReflectionUtil.isClassAvailable(ReflectionUtil.AWTNames.GraphicsEnvironmentClass, cl) ) {
try {
_AWT_AVAILABLE[0] = false == ((Boolean)ReflectionUtil.callStaticMethod(ReflectionUtil.AWTNames.GraphicsEnvironmentClass, ReflectionUtil.AWTNames.isHeadlessMethod, null, null, cl)).booleanValue();
@@ -217,7 +217,7 @@ public class Platform extends PlatformPropsImpl {
isRunningFromJarURL = _isRunningFromJarURL[0];
USE_TEMP_JAR_CACHE = _USE_TEMP_JAR_CACHE[0];
AWT_AVAILABLE = _AWT_AVAILABLE[0];
-
+
MachineDescription md = MachineDescriptionRuntime.getRuntime();
if(null == md) {
MachineDescription.StaticConfig smd = MachineDescriptionRuntime.getStatic();
@@ -232,7 +232,7 @@ public class Platform extends PlatformPropsImpl {
}
}
machineDescription = md;
- is32Bit = machineDescription.is32Bit();
+ is32Bit = machineDescription.is32Bit();
}
private Platform() {}
@@ -240,15 +240,15 @@ public class Platform extends PlatformPropsImpl {
/**
* @return true if we're running from a Jar URL, otherwise false
*/
- public static final boolean isRunningFromJarURL() {
+ public static final boolean isRunningFromJarURL() {
return isRunningFromJarURL;
}
-
+
/**
* kick off static initialization of <i>platform property information</i> and <i>native gluegen-rt lib loading</i>
*/
- public static void initSingleton() { }
-
+ public static void initSingleton() { }
+
/**
* Returns true only if having {@link java.nio.LongBuffer} and {@link java.nio.DoubleBuffer} available.
*/
@@ -263,12 +263,12 @@ public class Platform extends PlatformPropsImpl {
* </p>
* <p>
* <i>Note</i>: We claim Android is compatible.
- * </p>
+ * </p>
*/
public static boolean isJava6() {
return JAVA_6;
}
-
+
/**
* Returns true if this machine is little endian, otherwise false.
*/
@@ -283,7 +283,7 @@ public class Platform extends PlatformPropsImpl {
public static String getOSName() {
return OS;
}
-
+
/**
* Returns the OS version.
*/
@@ -312,38 +312,38 @@ public class Platform extends PlatformPropsImpl {
public static OSType getOSType() {
return OS_TYPE;
}
-
+
/**
* Returns the CPU type.
*/
public static CPUFamily getCPUFamily() {
return CPU_ARCH.getFamily();
}
-
+
/**
* Returns the CPU architecture.
*/
public static CPUType getCPUType() {
return CPU_ARCH;
}
-
+
/**
* Returns the (guessed) ABI.
*/
public static ABIType getABIType() {
return ABI_TYPE;
}
-
+
/**
* Returns the GlueGen common name for the currently running OSType and CPUType
* as implemented in the build system in 'gluegen-cpptasks-base.xml'.<br>
- *
+ *
* @see #getOSAndArch(OSType, CPUType)
*/
public static String getOSAndArch() {
return os_and_arch;
}
-
+
/**
* Returns the JAVA vendor.
*/
@@ -357,14 +357,14 @@ public class Platform extends PlatformPropsImpl {
public static String getJavaVMName() {
return JAVA_VM_NAME;
}
-
+
/**
* Returns the JAVA runtime name.
*/
public static String getJavaRuntimeName() {
return JAVA_RUNTIME_NAME;
}
-
+
/**
* Returns the JAVA vendor url.
*/
@@ -417,7 +417,7 @@ public class Platform extends PlatformPropsImpl {
public static MachineDescription getMachineDescription() {
return machineDescription;
}
-
+
/** Returns <code>true</code> if AWT is available and not in headless mode, otherwise <code>false</code>. */
public static boolean isAWTAvailable() {
return AWT_AVAILABLE;
@@ -426,23 +426,23 @@ public class Platform extends PlatformPropsImpl {
//
// time / jitter
//
-
- /**
+
+ /**
* Returns the unix based current time in milliseconds, based on <code>gettimeofday(..)</code>.
* <p>
* This is an alternative to {@link System#currentTimeMillis()} and {@link System#nanoTime()}.
- * While the named {@link System} methods do provide the required precision,
+ * While the named {@link System} methods do provide the required precision,
* <code>gettimeofday()</code> <i>also</i> guarantees time accuracy, i.e. update interval.
* </p>
* @see #currentTimeMicros()
*/
public static native long currentTimeMillis();
-
- /**
+
+ /**
* Returns the unix based current time in microseconds, based on <code>gettimeofday(..)</code>.
* <p>
* This is an alternative to {@link System#currentTimeMillis()} and {@link System#nanoTime()}.
- * While the named {@link System} methods do provide the required precision,
+ * While the named {@link System} methods do provide the required precision,
* <code>gettimeofday()</code> <i>also</i> guarantees time accuracy, i.e. update interval.
* </p>
* @see #currentTimeMillis()
@@ -458,7 +458,7 @@ public class Platform extends PlatformPropsImpl {
public static synchronized long getCurrentSleepJitter() {
getCurrentSleepJitterImpl(TimeUnit.MILLISECONDS.toNanos(10), 10); // warm-up
return getCurrentSleepJitterImpl(TimeUnit.MILLISECONDS.toNanos(10), 10);
- }
+ }
private static long getCurrentSleepJitterImpl(final long nsDuration, final int splitInLoops) {
final long nsPeriod = nsDuration / splitInLoops;
final long t0_ns = System.nanoTime();
diff --git a/src/java/com/jogamp/common/util/ArrayHashSet.java b/src/java/com/jogamp/common/util/ArrayHashSet.java
index ed3590a..a125580 100644
--- a/src/java/com/jogamp/common/util/ArrayHashSet.java
+++ b/src/java/com/jogamp/common/util/ArrayHashSet.java
@@ -35,7 +35,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
-/**
+/**
* Hashed ArrayList implementation of the List and Collection interface.
*
* Implementation properties are:
@@ -80,12 +80,12 @@ public class ArrayHashSet<E>
map = new HashMap<E,E>(initialCapacity);
data = new ArrayList<E>(initialCapacity);
}
-
+
public ArrayHashSet(int initialCapacity, float loadFactor) {
map = new HashMap<E,E>(initialCapacity, loadFactor);
data = new ArrayList<E>(initialCapacity);
}
-
+
//
// Cloneable
//
@@ -102,15 +102,15 @@ public class ArrayHashSet<E>
return newObj;
}
-
+
/** Returns this object ordered ArrayList. Use w/ care, it's not a copy. */
public final ArrayList<E> getData() { return data; }
/** Returns this object hash map. Use w/ care, it's not a copy. */
public final HashMap<E,E> getMap() { return map; }
-
+
@Override
public final String toString() { return data.toString(); }
-
+
//
// Collection
//
@@ -408,7 +408,7 @@ public class ArrayHashSet<E>
* Identity method allowing to get the identical object, using the internal hash map.
* <br>
* This is an O(1) operation.
- *
+ *
* @param key hash source to find the identical Object within this list
* @return object from this list, identical to the given <code>key</code> hash code,
* or null if not contained
diff --git a/src/java/com/jogamp/common/util/FloatStack.java b/src/java/com/jogamp/common/util/FloatStack.java
index 2addd76..725491c 100644
--- a/src/java/com/jogamp/common/util/FloatStack.java
+++ b/src/java/com/jogamp/common/util/FloatStack.java
@@ -44,69 +44,69 @@ public class /*name*/FloatStack/*name*/ implements PrimitiveStack {
private int position;
private /*value*/float/*value*/[] buffer;
private int growSize;
-
+
/**
* @param initialSize initial size, must be &gt; zero
* @param growSize grow size if {@link #position()} is reached, maybe <code>0</code>
- * in which case an {@link IndexOutOfBoundsException} is thrown.
+ * in which case an {@link IndexOutOfBoundsException} is thrown.
*/
public /*name*/FloatStack/*name*/(int initialSize, int growSize) {
this.position = 0;
this.growSize = growSize;
this.buffer = new /*value*/float/*value*/[initialSize];
}
-
+
@Override
public final int capacity() { return buffer.length; }
-
+
@Override
public final int position() { return position; }
-
+
@Override
public final void position(int newPosition) throws IndexOutOfBoundsException {
if( 0 > position || position >= buffer.length ) {
throw new IndexOutOfBoundsException("Invalid new position "+newPosition+", "+this.toString());
}
- position = newPosition;
+ position = newPosition;
}
-
+
@Override
public final int remaining() { return buffer.length - position; }
-
+
@Override
public final int getGrowSize() { return growSize; }
-
+
@Override
public final void setGrowSize(int newGrowSize) { growSize = newGrowSize; }
-
+
public final String toString() {
return "FloatStack[0..(pos "+position+").."+buffer.length+", remaining "+remaining()+"]";
}
-
+
public final /*value*/float/*value*/[] buffer() { return buffer; }
-
+
private final void growIfNecessary(int length) throws IndexOutOfBoundsException {
if( position + length > buffer.length ) {
if( 0 >= growSize ) {
throw new IndexOutOfBoundsException("Out of fixed stack size: "+this);
}
- /*value*/float/*value*/[] newBuffer =
+ /*value*/float/*value*/[] newBuffer =
new /*value*/float/*value*/[buffer.length + growSize];
System.arraycopy(buffer, 0, newBuffer, 0, position);
buffer = newBuffer;
- }
+ }
}
/**
* FILO put operation
- *
+ *
* @param src source buffer
- * @param srcOffset offset of src
- * @param length number of float elements to put from <code>src</code> on-top this stack
+ * @param srcOffset offset of src
+ * @param length number of float elements to put from <code>src</code> on-top this stack
* @return the src float[]
* @throws IndexOutOfBoundsException if stack cannot grow due to zero grow-size or offset+length exceeds src.
*/
- public final /*value*/float/*value*/[]
+ public final /*value*/float/*value*/[]
putOnTop(/*value*/float/*value*/[] src, int srcOffset, int length) throws IndexOutOfBoundsException {
growIfNecessary(length);
System.arraycopy(src, srcOffset, buffer, position, length);
@@ -116,47 +116,47 @@ public class /*name*/FloatStack/*name*/ implements PrimitiveStack {
/**
* FILO put operation
- *
+ *
* @param src source buffer, it's position is incremented by <code>length</code>
- * @param length number of float elements to put from <code>src</code> on-top this stack
+ * @param length number of float elements to put from <code>src</code> on-top this stack
* @return the src FloatBuffer
* @throws IndexOutOfBoundsException if stack cannot grow due to zero grow-size
* @throws BufferUnderflowException if <code>src</code> FloatBuffer has less remaining elements than <code>length</code>.
*/
- public final /*value2*/FloatBuffer/*value2*/
+ public final /*value2*/FloatBuffer/*value2*/
putOnTop(/*value2*/FloatBuffer/*value2*/ src, int length) throws IndexOutOfBoundsException, BufferUnderflowException {
- growIfNecessary(length);
+ growIfNecessary(length);
src.get(buffer, position, length);
position += length;
return src;
}
-
+
/**
* FILO get operation
- *
+ *
* @param dest destination buffer
- * @param destOffset offset of dest
- * @param length number of float elements to get from-top this stack to <code>dest</code>.
+ * @param destOffset offset of dest
+ * @param length number of float elements to get from-top this stack to <code>dest</code>.
* @return the dest float[]
* @throws IndexOutOfBoundsException if stack or <code>dest</code> has less elements than <code>length</code>.
*/
- public final /*value*/float/*value*/[]
+ public final /*value*/float/*value*/[]
getFromTop(/*value*/float/*value*/[] dest, int destOffset, int length) throws IndexOutOfBoundsException {
System.arraycopy(buffer, position-length, dest, destOffset, length);
position -= length;
return dest;
}
-
+
/**
* FILO get operation
- *
+ *
* @param dest destination buffer, it's position is incremented by <code>length</code>.
* @param length number of float elements to get from-top this stack to <code>dest</code>.
* @return the dest FloatBuffer
* @throws IndexOutOfBoundsException if stack has less elements than length
* @throws BufferOverflowException if <code>src</code> FloatBuffer has less remaining elements than <code>length</code>.
*/
- public final /*value2*/FloatBuffer/*value2*/
+ public final /*value2*/FloatBuffer/*value2*/
getFromTop(/*value2*/FloatBuffer/*value2*/ dest, int length) throws IndexOutOfBoundsException, BufferOverflowException {
dest.put(buffer, position-length, length);
position -= length;
diff --git a/src/java/com/jogamp/common/util/Function.java b/src/java/com/jogamp/common/util/Function.java
index 8bec99c..9b03ce6 100644
--- a/src/java/com/jogamp/common/util/Function.java
+++ b/src/java/com/jogamp/common/util/Function.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -41,9 +41,9 @@ public interface Function<R,A> {
/**
* Implementation may compute variable <code>args</code> list
* and returns a result.
- *
+ *
* @param args variable argument list, <code>A[]</code>, maybe null
* @return the result.
*/
R eval(A... args);
-}
+}
diff --git a/src/java/com/jogamp/common/util/FunctionTask.java b/src/java/com/jogamp/common/util/FunctionTask.java
index 01f85b1..b742d73 100644
--- a/src/java/com/jogamp/common/util/FunctionTask.java
+++ b/src/java/com/jogamp/common/util/FunctionTask.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.common.util;
import java.io.PrintStream;
@@ -41,7 +41,7 @@ public class FunctionTask<R,A> extends TaskBase implements Function<R,A> {
/**
* Invokes <code>func</code>.
- * @param waitUntilDone if <code>true</code>, waits until <code>func</code> execution is completed, otherwise returns immediately.
+ * @param waitUntilDone if <code>true</code>, waits until <code>func</code> execution is completed, otherwise returns immediately.
* @param func the {@link Function} to execute.
* @param args the {@link Function} arguments
* @return the {@link Function} return value
@@ -69,14 +69,14 @@ public class FunctionTask<R,A> extends TaskBase implements Function<R,A> {
}
return res;
}
-
+
/**
* Create a RunnableTask object w/ synchronization,
- * ie. suitable for <code>invokeAndWait()</code>.
- *
+ * ie. suitable for <code>invokeAndWait()</code>.
+ *
* @param runnable the user action
* @param syncObject the synchronization object the caller shall wait until <code>runnable</code> execution is completed,
- * or <code>null</code> if waiting is not desired.
+ * or <code>null</code> if waiting is not desired.
* @param catchExceptions Influence an occurring exception during <code>runnable</code> execution.
* If <code>true</code>, the exception is silenced and can be retrieved via {@link #getThrowable()},
* otherwise the exception is thrown.
@@ -96,12 +96,12 @@ public class FunctionTask<R,A> extends TaskBase implements Function<R,A> {
/**
* Sets the arguments for {@link #run()}.
- * They will be cleared after calling {@link #run()} or {@link #eval(Object...)}.
+ * They will be cleared after calling {@link #run()} or {@link #eval(Object...)}.
*/
public final void setArgs(A... args) {
this.args = args;
}
-
+
/**
* Retrieves the cached result of {@link #run()}
* and is cleared within this method.
@@ -111,7 +111,7 @@ public class FunctionTask<R,A> extends TaskBase implements Function<R,A> {
result = null;
return res;
}
-
+
/**
* {@inheritDoc}
* <p>
@@ -170,7 +170,7 @@ public class FunctionTask<R,A> extends TaskBase implements Function<R,A> {
@Override
public final R eval(A... args) {
this.args = args;
- run();
+ run();
final R res = result;
result = null;
return res;
diff --git a/src/java/com/jogamp/common/util/HashUtil.java b/src/java/com/jogamp/common/util/HashUtil.java
index c5a3bff..5ce2332 100644
--- a/src/java/com/jogamp/common/util/HashUtil.java
+++ b/src/java/com/jogamp/common/util/HashUtil.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -29,7 +29,7 @@ package com.jogamp.common.util;
public class HashUtil {
/**
- * Generates a 32bit equally distributed identity hash value
+ * Generates a 32bit equally distributed identity hash value
* from <code>addr</code> avoiding XOR collision.
*/
public static int getAddrHash32_EqualDist(long addr) {
@@ -38,9 +38,9 @@ public class HashUtil {
int hash = 31 + (int) addr ; // lo addr
return ((hash << 5) - hash) + (int) ( addr >>> 32 ) ; // hi addr
}
-
+
/**
- * Generates a 32bit equally distributed identity hash value
+ * Generates a 32bit equally distributed identity hash value
* from <code>addr</code> and <code>size</code> avoiding XOR collision.
*/
public static int getAddrSizeHash32_EqualDist(long addr, long size) {
@@ -51,9 +51,9 @@ public class HashUtil {
hash = ((hash << 5) - hash) + (int) size ; // lo size
return ((hash << 5) - hash) + (int) ( size >>> 32 ) ; // hi size
}
-
+
/**
- * Generates a 64bit equally distributed hash value
+ * Generates a 64bit equally distributed hash value
* from <code>addr</code> and <code>size</code> avoiding XOR collisions.
*/
public static long getHash64(long addr, long size) {
@@ -62,5 +62,5 @@ public class HashUtil {
return ((hash << 5) - hash) + size;
}
-
+
}
diff --git a/src/java/com/jogamp/common/util/IOUtil.java b/src/java/com/jogamp/common/util/IOUtil.java
index 242f300..16f191b 100644
--- a/src/java/com/jogamp/common/util/IOUtil.java
+++ b/src/java/com/jogamp/common/util/IOUtil.java
@@ -56,7 +56,7 @@ import com.jogamp.common.os.Platform;
public class IOUtil {
public static final boolean DEBUG = Debug.debug("IOUtil");
-
+
/** {@value} */
public static final String SCHEME_SEPARATOR = ":";
/** {@value} */
@@ -69,28 +69,28 @@ public class IOUtil {
public static final String JAR_SCHEME = "jar";
/** A JAR subprotocol is separeted from the JAR entry w/ this separator {@value}. Even if no class is specified '!/' must follow!. */
public static final String JAR_SCHEME_SEPARATOR = "!";
-
+
/** Std. temporary directory property key <code>java.io.tmpdir</code>. */
- private static final String java_io_tmpdir_propkey = "java.io.tmpdir";
+ private static final String java_io_tmpdir_propkey = "java.io.tmpdir";
private static final String user_home_propkey = "user.home";
private static final String XDG_CACHE_HOME_envkey = "XDG_CACHE_HOME";
- /** Subdirectory within platform's temporary root directory where all JogAmp related temp files are being stored: {@code jogamp} */
+ /** Subdirectory within platform's temporary root directory where all JogAmp related temp files are being stored: {@code jogamp} */
public static final String tmpSubDir = "jogamp";
-
+
private IOUtil() {}
-
- /**
+
+ /**
* Since usage of {@link java.io.FileOutputStream} is considered security critical,
* we need to check it's availability for each use.
* <p>
* In case a SecurityManager is installed, privileged access is required.
* </p>
- *
- * @return the constructor of {@link java.io.FileOutputStream} if available and
- * no SecurityManager is installed or privileged access is granted.
+ *
+ * @return the constructor of {@link java.io.FileOutputStream} if available and
+ * no SecurityManager is installed or privileged access is granted.
* Otherwise null.
- *
+ *
*/
private static final Constructor<?> getFOSCtor() {
Constructor<?> _fosCtor;
@@ -102,7 +102,7 @@ public class IOUtil {
_fosCtor = null;
_t = t;
}
- if(DEBUG) {
+ if(DEBUG) {
System.err.println("IOUtil: java.io.FileOutputStream available: "+(null != _fosCtor));
if(null!=_t) {
_t.printStackTrace();
@@ -110,24 +110,24 @@ public class IOUtil {
}
return _fosCtor;
}
-
+
/***
- *
+ *
* STREAM COPY STUFF
- *
+ *
*/
-
+
/**
* Copy the specified URL resource to the specified output file. The total
* number of bytes written is returned. Both streams are closed upon completion.
- *
- * @param conn the open URLConnection
+ *
+ * @param conn the open URLConnection
* @param outFile the destination
* @return
* @throws IOException
*/
public static int copyURLConn2File(URLConnection conn, File outFile) throws IOException {
- conn.connect(); // redundant
+ conn.connect(); // redundant
int totalNumBytes = 0;
InputStream in = new BufferedInputStream(conn.getInputStream());
@@ -142,10 +142,10 @@ public class IOUtil {
/**
* Copy the specified input stream to the specified output file. The total
* number of bytes written is returned. Both streams are closed upon completion.
- *
- * @param in the source
+ *
+ * @param in the source
* @param outFile the destination
- * @param totalNumBytes informal number of expected bytes, maybe used for user feedback while processing. -1 if unknown
+ * @param totalNumBytes informal number of expected bytes, maybe used for user feedback while processing. -1 if unknown
* @return
* @throws IOException
*/
@@ -162,10 +162,10 @@ public class IOUtil {
/**
* Copy the specified input stream to the specified output stream. The total
* number of bytes written is returned.
- *
- * @param in the source
+ *
+ * @param in the source
* @param out the destination
- * @param totalNumBytes informal number of expected bytes, maybe used for user feedback while processing. -1 if unknown
+ * @param totalNumBytes informal number of expected bytes, maybe used for user feedback while processing. -1 if unknown
* @return
* @throws IOException
*/
@@ -176,11 +176,11 @@ public class IOUtil {
/**
* Copy the specified input stream to the specified output stream. The total
* number of bytes written is returned.
- *
+ *
* @param bufferSize the intermediate buffer size, should be {@link MachineDescription#pageSizeInBytes()} for best performance.
- * @param in the source
+ * @param in the source
* @param out the destination
- * @param totalNumBytes informal number of expected bytes, maybe used for user feedback while processing. -1 if unknown
+ * @param totalNumBytes informal number of expected bytes, maybe used for user feedback while processing. -1 if unknown
* @return
* @throws IOException
*/
@@ -197,7 +197,7 @@ public class IOUtil {
}
return numBytes;
}
-
+
/**
* Copy the specified input stream to a byte array, which is being returned.
*/
@@ -235,17 +235,17 @@ public class IOUtil {
/**
* Copy the specified input stream to a NIO ByteBuffer w/ native byte order, which is being returned.
* <p>The implementation creates the ByteBuffer w/ {@link #copyStream2ByteArray(InputStream)}'s returned byte array.</p>
- *
+ *
* @param stream input stream, which will be wrapped into a BufferedInputStream, if not already done.
*/
public static ByteBuffer copyStream2ByteBuffer(InputStream stream) throws IOException {
- return copyStream2ByteBuffer(stream, -1);
+ return copyStream2ByteBuffer(stream, -1);
}
-
+
/**
* Copy the specified input stream to a NIO ByteBuffer w/ native byte order, which is being returned.
* <p>The implementation creates the ByteBuffer w/ {@link #copyStream2ByteArray(InputStream)}'s returned byte array.</p>
- *
+ *
* @param stream input stream, which will be wrapped into a BufferedInputStream, if not already done.
* @param initialCapacity initial buffer capacity in bytes, if &gt; available bytes
*/
@@ -257,7 +257,7 @@ public class IOUtil {
if( initialCapacity < avail ) {
initialCapacity = avail;
}
- final MachineDescription machine = Platform.getMachineDescription();
+ final MachineDescription machine = Platform.getMachineDescription();
ByteBuffer data = Buffers.newDirectByteBuffer( machine.pageAlignedSize( initialCapacity ) );
byte[] chunk = new byte[machine.pageSizeInBytes()];
int chunk2Read = Math.min(machine.pageSizeInBytes(), avail);
@@ -269,13 +269,13 @@ public class IOUtil {
newData.put(data);
data = newData;
}
-
+
numRead = stream.read(chunk, 0, chunk2Read);
if (numRead > 0) {
data.put(chunk, 0, numRead);
}
avail = stream.available();
- chunk2Read = Math.min(machine.pageSizeInBytes(), avail);
+ chunk2Read = Math.min(machine.pageSizeInBytes(), avail);
} while ( numRead > 0 ); // EOS: -1 == numRead, EOF maybe reached earlier w/ 0 == numRead
data.flip();
@@ -283,13 +283,13 @@ public class IOUtil {
}
/***
- *
+ *
* RESOURCE / FILE NAME STUFF
- *
+ *
*/
-
+
/**
- *
+ *
* @param path
* @param startWithSlash
* @param endWithSlash
@@ -297,7 +297,7 @@ public class IOUtil {
* @throws URISyntaxException if path is empty or has no parent directory available while resolving <code>../</code>
*/
public static String slashify(String path, boolean startWithSlash, boolean endWithSlash) throws URISyntaxException {
- String p = path.replace('\\', '/'); // unify file separator
+ String p = path.replace('\\', '/'); // unify file separator
if (startWithSlash && !p.startsWith("/")) {
p = "/" + p;
}
@@ -306,23 +306,23 @@ public class IOUtil {
}
return cleanPathString(p);
}
-
- /**
- * Using the simple conversion via File -> URI, assuming proper characters.
+
+ /**
+ * Using the simple conversion via File -> URI, assuming proper characters.
* @throws URISyntaxException if path is empty or has no parent directory available while resolving <code>../</code>
- * @throws URISyntaxException if the resulting string does not comply w/ an RFC 2396 URI
+ * @throws URISyntaxException if the resulting string does not comply w/ an RFC 2396 URI
*/
public static URI toURISimple(File file) throws URISyntaxException {
- return new URI(FILE_SCHEME, null, encodeToURI(slashify(file.getAbsolutePath(), true, file.isDirectory())), null);
+ return new URI(FILE_SCHEME, null, encodeToURI(slashify(file.getAbsolutePath(), true, file.isDirectory())), null);
}
-
- /**
- * Using the simple conversion via File -> URI, assuming proper characters.
+
+ /**
+ * Using the simple conversion via File -> URI, assuming proper characters.
* @throws URISyntaxException if path is empty or has no parent directory available while resolving <code>../</code>
- * @throws URISyntaxException if the resulting string does not comply w/ an RFC 2396 URI
+ * @throws URISyntaxException if the resulting string does not comply w/ an RFC 2396 URI
*/
public static URI toURISimple(String protocol, String file, boolean isDirectory) throws URISyntaxException {
- return new URI(protocol, null, encodeToURI(slashify(file, true, isDirectory)), null);
+ return new URI(protocol, null, encodeToURI(slashify(file, true, isDirectory)), null);
}
/**
@@ -364,14 +364,14 @@ public class IOUtil {
return arg.toLowerCase();
}
-
+
/***
* @param file
* @param allowOverwrite
* @return outputStream The resulting output stream
- * @throws IOException if the file already exists and <code>allowOverwrite</code> is false,
+ * @throws IOException if the file already exists and <code>allowOverwrite</code> is false,
* the class {@link java.io.FileOutputStream} is not accessible or
- * the user does not have sufficient rights to access the local filesystem.
+ * the user does not have sufficient rights to access the local filesystem.
*/
public static FileOutputStream getFileOutputStream(File file, boolean allowOverwrite) throws IOException {
final Constructor<?> fosCtor = getFOSCtor();
@@ -387,14 +387,14 @@ public class IOUtil {
throw new IOException("error opening " + file + " for write. ", e);
}
}
-
+
public static String getClassFileName(String clazzBinName) {
- // or return clazzBinName.replace('.', File.separatorChar) + ".class"; ?
- return clazzBinName.replace('.', '/') + ".class";
+ // or return clazzBinName.replace('.', File.separatorChar) + ".class"; ?
+ return clazzBinName.replace('.', '/') + ".class";
}
-
+
/**
- * @param clazzBinName com.jogamp.common.util.cache.TempJarCache
+ * @param clazzBinName com.jogamp.common.util.cache.TempJarCache
* @param cl ClassLoader to locate the JarFile
* @return jar:file:/usr/local/projects/JOGL/gluegen/build-x86_64/gluegen-rt.jar!/com/jogamp/common/util/cache/TempJarCache.class
* @throws IOException if the jar file could not been found by the ClassLoader
@@ -406,7 +406,7 @@ public class IOUtil {
}
return url;
}
-
+
/**
* Returns the basename of the given fname w/o directory part
* @throws URISyntaxException if path is empty or has no parent directory available while resolving <code>../</code>
@@ -419,7 +419,7 @@ public class IOUtil {
}
return fname;
}
-
+
/**
* Returns unified '/' dirname including the last '/'
* @throws URISyntaxException if path is empty or has no parent directory available while resolving <code>../</code>
@@ -432,22 +432,22 @@ public class IOUtil {
}
return fname;
}
-
+
/**
* The URI's <code><i>protocol</i>:/some/path/gluegen-rt.jar</code>
* parent dirname URI <code><i>protocol</i>:/some/path/</code> will be returned.
* <p>
* <i>protocol</i> may be "file", "http", etc..
* </p>
- *
+ *
* @param uri "<i>protocol</i>:/some/path/gluegen-rt.jar"
* @return "<i>protocol</i>:/some/path/"
* @throws IllegalArgumentException if the URI doesn't match the expected formatting, or is null
- * @throws URISyntaxException
+ * @throws URISyntaxException
*/
public static URI getURIDirname(URI uri) throws IllegalArgumentException, URISyntaxException {
if(null == uri) {
- throw new IllegalArgumentException("URI is null");
+ throw new IllegalArgumentException("URI is null");
}
String uriS = uri.toString();
if( DEBUG ) {
@@ -455,24 +455,24 @@ public class IOUtil {
}
return new URI( getURIDirname(uriS) );
}
-
+
/**
* The URI's <code><i>protocol</i>:/some/path/gluegen-rt.jar</code>
* parent dirname URI <code><i>protocol</i>:/some/path/</code> will be returned.
* <p>
* <i>protocol</i> may be "file", "http", etc..
* </p>
- *
+ *
* @param uri "<i>protocol</i>:/some/path/gluegen-rt.jar" (URI encoded)
* @return "<i>protocol</i>:/some/path/"
* @throws IllegalArgumentException if the URI doesn't match the expected formatting, or is null
- * @throws URISyntaxException
+ * @throws URISyntaxException
*/
public static String getURIDirname(String uriS) throws IllegalArgumentException, URISyntaxException {
if(null == uriS) {
- throw new IllegalArgumentException("uriS is null");
+ throw new IllegalArgumentException("uriS is null");
}
- // from
+ // from
// file:/some/path/gluegen-rt.jar _or_ rsrc:gluegen-rt.jar
// to
// file:/some/path/ _or_ rsrc:
@@ -484,15 +484,15 @@ public class IOUtil {
throw new IllegalArgumentException("URI does not contain protocol terminator ':', in <"+uriS+">");
}
}
- uriS = uriS.substring(0, idx+1); // exclude jar name, include terminal '/' or ':'
-
+ uriS = uriS.substring(0, idx+1); // exclude jar name, include terminal '/' or ':'
+
if( DEBUG ) {
System.out.println("getJarURIDirname res: "+uriS);
- }
+ }
return uriS;
}
-
- /**
+
+ /**
* Converts an {@link URI} to an {@link URL} while using a non encoded path
* for <i>file scheme</i>, i.e. <code>file:/</code>.
* Otherwise the default {@link URL} translation {@link URI#toURL()} is being used.
@@ -551,18 +551,18 @@ public class IOUtil {
}
return url;
}
-
+
/***
- *
+ *
* RESOURCE LOCATION STUFF
- *
+ *
*/
-
+
/**
* Locating a resource using {@link #getResource(String, ClassLoader)}:
* <ul>
- * <li><i>relative</i>: <code>context</code>'s package name-path plus <code>resourcePath</code> via <code>context</code>'s ClassLoader.
- * This allows locations relative to JAR- and other URLs.
+ * <li><i>relative</i>: <code>context</code>'s package name-path plus <code>resourcePath</code> via <code>context</code>'s ClassLoader.
+ * This allows locations relative to JAR- and other URLs.
* The <code>resourcePath</code> may start with <code>../</code> to navigate to parent folder.</li>
* <li><i>absolute</i>: <code>context</code>'s ClassLoader and the <code>resourcePath</code> as is (filesystem)</li>
* </ul>
@@ -570,7 +570,7 @@ public class IOUtil {
* <p>
* Returns the resolved and open URLConnection or null if not found.
* </p>
- *
+ *
* @see #getResource(String, ClassLoader)
* @see ClassLoader#getResource(String)
* @see ClassLoader#getSystemResource(String)
@@ -578,11 +578,11 @@ public class IOUtil {
public static URLConnection getResource(Class<?> context, String resourcePath) {
if(null == resourcePath) {
return null;
- }
+ }
ClassLoader contextCL = (null!=context)?context.getClassLoader():IOUtil.class.getClassLoader();
URLConnection conn = null;
if(null != context) {
- // scoping the path within the class's package
+ // scoping the path within the class's package
final String className = context.getName().replace('.', '/');
final int lastSlash = className.lastIndexOf('/');
if (lastSlash >= 0) {
@@ -647,7 +647,7 @@ public class IOUtil {
/**
* Generates a path for the 'relativeFile' relative to the 'baseLocation'.
- *
+ *
* @param baseLocation denotes a directory
* @param relativeFile denotes a relative file to the baseLocation
* @throws URISyntaxException if path is empty or has no parent directory available while resolving <code>../</code>
@@ -656,7 +656,7 @@ public class IOUtil {
if(null == relativeFile) {
return null;
}
-
+
if (baseLocation != null) {
final File file = new File(baseLocation, relativeFile);
// Handle things on Windows
@@ -668,14 +668,14 @@ public class IOUtil {
/**
* @param path assuming a slashified path beginning with "/" as it's root directory, either denotes a file or directory.
* @return parent of path
- * @throws URISyntaxException if path is empty or has no parent directory available
+ * @throws URISyntaxException if path is empty or has no parent directory available
*/
public static String getParentOf(String path) throws URISyntaxException {
final int pl = null!=path ? path.length() : 0;
if(pl == 0) {
throw new IllegalArgumentException("path is empty <"+path+">");
}
-
+
final int e = path.lastIndexOf("/");
if( e < 0 ) {
throw new URISyntaxException(path, "path contains no '/'");
@@ -688,7 +688,7 @@ public class IOUtil {
// path is file, return it's parent directory
return path.substring(0, e+1);
}
- final int j = path.lastIndexOf("!") + 1; // '!' Separates JARFile entry -> local start of path
+ final int j = path.lastIndexOf("!") + 1; // '!' Separates JARFile entry -> local start of path
// path is a directory ..
final int p = path.lastIndexOf("/", e-1);
if( p >= j) {
@@ -696,10 +696,10 @@ public class IOUtil {
}
throw new URISyntaxException(path, "parent of path contains no '/'");
}
-
+
/**
* @param path assuming a slashified path beginning with "/" as it's root directory, either denotes a file or directory.
- * @return clean path string where <code>../</code> and <code>./</code> is resolved.
+ * @return clean path string where <code>../</code> and <code>./</code> is resolved.
* @throws URISyntaxException if path is empty or has no parent directory available while resolving <code>../</code>
*/
public static String cleanPathString(String path) throws URISyntaxException {
@@ -712,47 +712,47 @@ public class IOUtil {
}
return path;
}
-
+
/**
* Generates a URI for the <i>relativePath</i> relative to the <i>baseURI</i>,
* hence the result is a absolute location.
* <p>
- * Impl. operates on the <i>scheme-specific-part</i>, and hence is sub-protocol savvy.
+ * Impl. operates on the <i>scheme-specific-part</i>, and hence is sub-protocol savvy.
* </p>
* <p>
- * In case <i>baseURI</i> is not a path ending w/ '/', it's a assumed to be a file and it's parent is being used.
+ * In case <i>baseURI</i> is not a path ending w/ '/', it's a assumed to be a file and it's parent is being used.
* </p>
- *
+ *
* @param baseURI denotes a URI to a directory ending w/ '/', or a file. In the latter case the file's directory is being used.
* @param relativePath denotes a relative file to the baseLocation's parent directory
* @throws URISyntaxException if path is empty or has no parent directory available while resolving <code>../</code>
*/
- public static URI getRelativeOf(URI baseURI, String relativePath) throws URISyntaxException {
+ public static URI getRelativeOf(URI baseURI, String relativePath) throws URISyntaxException {
return compose(baseURI.getScheme(), baseURI.getSchemeSpecificPart(), encodeToURI(relativePath), baseURI.getFragment());
}
-
+
/**
* Wraps {@link #getRelativeOf(URI, String)} for convenience.
* @throws IOException
*/
- public static URL getRelativeOf(URL baseURL, String relativePath) throws IOException {
+ public static URL getRelativeOf(URL baseURL, String relativePath) throws IOException {
try {
return getRelativeOf(baseURL.toURI(), relativePath).toURL();
} catch (URISyntaxException e) {
throw new IOException(e);
}
}
-
+
/**
* Generates a URI for the <i>relativePath</i> relative to the <i>schemeSpecificPart</i>,
* hence the result is a absolute location.
* <p>
- * <i>schemeSpecificPart</i>'s query, if exist is split to <i>path</i> and <i>query</i>.
+ * <i>schemeSpecificPart</i>'s query, if exist is split to <i>path</i> and <i>query</i>.
* </p>
* <p>
- * In case <i>path</i> is not a path ending w/ '/', it's a assumed to be a file and it's parent is being used.
+ * In case <i>path</i> is not a path ending w/ '/', it's a assumed to be a file and it's parent is being used.
* </p>
- *
+ *
* @param scheme scheme of the resulting URI
* @param schemeSpecificPart may include a query, which is separated while processing (URI encoded)
* @param relativePath denotes a relative file to the baseLocation's parent directory (URI encoded)
@@ -778,12 +778,12 @@ public class IOUtil {
}
schemeSpecificPart = cleanPathString( schemeSpecificPart );
return new URI(scheme, null == query ? schemeSpecificPart : schemeSpecificPart + "?" + query, fragment);
- }
-
+ }
+
private static final Pattern patternSpaceRaw = Pattern.compile(" ");
private static final Pattern patternSpaceEnc = Pattern.compile("%20");
-
- /**
+
+ /**
* Escapes characters not complying w/ RFC 2396 and the {@link URI#URI(String)} ctor.
* <ul>
* <li>SPACE -> %20</li>
@@ -792,21 +792,21 @@ public class IOUtil {
public static String encodeToURI(String s) {
return patternSpaceRaw.matcher(s).replaceAll("%20");
}
-
- /**
+
+ /**
* Reverses escaping of characters as performed via {@link #encodeToURI(String)}.
*/
public static String decodeFromURI(String s) {
return patternSpaceEnc.matcher(s).replaceAll(" ");
}
-
+
/**
* Returns the connected URLConnection, or null if not url is not available
*/
public static URLConnection openURL(URL url) {
return openURL(url, ".");
}
-
+
/**
* Returns the connected URLConnection, or null if not url is not available
*/
@@ -819,19 +819,19 @@ public class IOUtil {
System.err.println("IOUtil: urlExists("+url+") ["+dbgmsg+"] - true");
}
return c;
- } catch (IOException ioe) {
+ } catch (IOException ioe) {
if(DEBUG) {
System.err.println("IOUtil: urlExists("+url+") ["+dbgmsg+"] - false - "+ioe.getClass().getSimpleName()+": "+ioe.getMessage());
ioe.printStackTrace();
- }
+ }
}
} else if(DEBUG) {
System.err.println("IOUtil: no url - urlExists(null) ["+dbgmsg+"]");
- }
-
+ }
+
return null;
}
-
+
private static String getShellSuffix() {
switch(PlatformPropsImpl.OS_TYPE) {
case WINDOWS:
@@ -840,18 +840,18 @@ public class IOUtil {
return ".sh";
}
}
-
+
private static boolean getOSHasNoexecFS() {
switch(PlatformPropsImpl.OS_TYPE) {
case WINDOWS:
case OPENKODE:
return false;
-
+
default:
return true;
}
}
-
+
/**
* @see <a href="http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html">Free-Desktop - XDG Base Directory Specification</a>
*/
@@ -862,26 +862,26 @@ public class IOUtil {
case WINDOWS:
case OPENKODE:
return false;
-
+
default:
return true;
}
}
-
+
/**
* Test whether {@code file} exists and matches the given requirements
- *
+ *
* @param file
* @param shallBeDir
* @param shallBeWritable
* @return
*/
- public static boolean testFile(File file, boolean shallBeDir, boolean shallBeWritable) {
+ public static boolean testFile(File file, boolean shallBeDir, boolean shallBeWritable) {
if (!file.exists()) {
if(DEBUG) {
System.err.println("IOUtil.testFile: <"+file.getAbsolutePath()+">: does not exist");
}
- return false;
+ return false;
}
if (shallBeDir && !file.isDirectory()) {
if(DEBUG) {
@@ -893,7 +893,7 @@ public class IOUtil {
if(DEBUG) {
System.err.println("IOUtil.testFile: <"+file.getAbsolutePath()+">: is not writable");
}
- return false;
+ return false;
}
return true;
}
@@ -904,9 +904,9 @@ public class IOUtil {
* <li>exists, and</li>
* <li>is a directory, and</li>
* <li>is writeable, and</li>
- * <li>files can be executed from the directory</li>
+ * <li>files can be executed from the directory</li>
* </ol>
- *
+ *
* @throws SecurityException if file creation and process execution is not allowed within the current security context
* @param dir
*/
@@ -914,12 +914,12 @@ public class IOUtil {
throws SecurityException
{
if (!testFile(dir, true, true)) {
- return false;
+ return false;
}
if(!getOSHasNoexecFS()) {
return true;
}
-
+
File exetst;
try {
exetst = File.createTempFile("jogamp_exe_tst", getShellSuffix(), dir);
@@ -951,31 +951,31 @@ public class IOUtil {
return 0 == ok;
}
- private static File testDirImpl(File dir, boolean create, boolean executable)
+ private static File testDirImpl(File dir, boolean create, boolean executable)
throws SecurityException
{
if (create && !dir.exists()) {
- dir.mkdirs();
+ dir.mkdirs();
}
if( executable ) {
if(testDirExec(dir)) {
return dir;
}
} else if(testFile(dir, true, true)) {
- return dir;
+ return dir;
}
return null;
}
-
+
/**
* Returns the directory {@code dir}, which is processed and tested as described below.
* <ol>
* <li>If {@code create} is {@code true} and the directory does not exist yet, it is created incl. all sub-directories.</li>
* <li>If {@code dirName} exists, but is not a directory, {@code null} is being returned.</li>
* <li>If the directory does not exist or is not writeable, {@code null} is being returned.</li>
- * <li>If {@code executable} is {@code true} and files cannot be executed from the directory, {@code null} is being returned.</li>
+ * <li>If {@code executable} is {@code true} and files cannot be executed from the directory, {@code null} is being returned.</li>
* </ol>
- *
+ *
* @param dir the directory to process
* @param create true if the directory shall be created if not existing
* @param executable true if the user intents to launch executables from the temporary directory, otherwise false.
@@ -985,14 +985,14 @@ public class IOUtil {
throws SecurityException
{
return testDirImpl(dir, create, executable);
- }
-
- private static boolean isStringSet(String s) { return null != s && 0 < s.length(); }
-
+ }
+
+ private static boolean isStringSet(String s) { return null != s && 0 < s.length(); }
+
/**
* This methods finds [and creates] an available temporary sub-directory:
* <pre>
- File tmpBaseDir = null;
+ File tmpBaseDir = null;
if(null != testDir(tmpRoot, true, executable)) { // check tmpRoot first
for(int i = 0; null == tmpBaseDir && i<=9999; i++) {
final String tmpDirSuffix = String.format("_%04d", i); // 4 digits for iteration
@@ -1015,7 +1015,7 @@ public class IOUtil {
private static File getSubTempDir(File tmpRoot, String tmpSubDirPrefix, boolean executable)
throws SecurityException
{
- File tmpBaseDir = null;
+ File tmpBaseDir = null;
if(null != testDirImpl(tmpRoot, true /* create */, executable)) { // check tmpRoot first
for(int i = 0; null == tmpBaseDir && i<=9999; i++) {
final String tmpDirSuffix = String.format("_%04d", i); // 4 digits for iteration
@@ -1024,16 +1024,16 @@ public class IOUtil {
}
return tmpBaseDir;
}
-
+
/**
* Returns a platform independent writable directory for temporary files
- * consisting of the platform's {@code temp-root} + {@link #tmpSubDir},
- * e.g. {@code /tmp/jogamp_0000/}.
+ * consisting of the platform's {@code temp-root} + {@link #tmpSubDir},
+ * e.g. {@code /tmp/jogamp_0000/}.
* <p>
* On standard Java the {@code temp-root} folder is specified by <code>java.io.tempdir</code>.
- * </p>
+ * </p>
* <p>
- * On Android the {@code temp-root} folder is relative to the applications local folder
+ * On Android the {@code temp-root} folder is relative to the applications local folder
* (see {@link Context#getDir(String, int)}) is returned, if
* the Android application/activity has registered it's Application Context
* via {@link jogamp.common.os.android.StaticContext.StaticContext#init(Context, ClassLoader) StaticContext.init(..)}.
@@ -1042,12 +1042,12 @@ public class IOUtil {
* </p>
* <p>
* In case {@code temp-root} is the users home folder,
- * a dot is being prepended to {@link #tmpSubDir}, i.e.: {@code /home/user/.jogamp_0000/}.
+ * a dot is being prepended to {@link #tmpSubDir}, i.e.: {@code /home/user/.jogamp_0000/}.
* </p>
* @param executable true if the user intents to launch executables from the temporary directory, otherwise false.
* @throws RuntimeException if no temporary directory could be determined
* @throws SecurityException if access to <code>java.io.tmpdir</code> is not allowed within the current security context
- *
+ *
* @see PropertyAccess#getProperty(String, boolean)
* @see Context#getDir(String, int)
*/
@@ -1066,40 +1066,40 @@ public class IOUtil {
return tempRootExec;
}
}
-
+
final String java_io_tmpdir = PropertyAccess.getProperty(java_io_tmpdir_propkey, false);
final String user_home = PropertyAccess.getProperty(user_home_propkey, false);
-
+
final String xdg_cache_home;
{
String _xdg_cache_home;
- if( getOSHasFreeDesktopXDG() ) {
+ if( getOSHasFreeDesktopXDG() ) {
_xdg_cache_home = System.getenv(XDG_CACHE_HOME_envkey);
if( !isStringSet(_xdg_cache_home) && isStringSet(user_home) ) {
_xdg_cache_home = user_home + File.separator + ".cache" ; // default
- }
+ }
} else {
_xdg_cache_home = null;
}
xdg_cache_home = _xdg_cache_home;
}
-
+
// 1) java.io.tmpdir/jogamp
if( null == tempRootExec && isStringSet(java_io_tmpdir) ) {
tempRootExec = getSubTempDir(new File(java_io_tmpdir), tmpSubDir, true /* executable */);
}
-
+
// 2) $XDG_CACHE_HOME/jogamp
if(null == tempRootExec && isStringSet(xdg_cache_home)) {
- tempRootExec = getSubTempDir(new File(xdg_cache_home), tmpSubDir, true /* executable */);
+ tempRootExec = getSubTempDir(new File(xdg_cache_home), tmpSubDir, true /* executable */);
}
-
+
// 3) $HOME/.jogamp
- if(null == tempRootExec && isStringSet(user_home)) {
+ if(null == tempRootExec && isStringSet(user_home)) {
tempRootExec = getSubTempDir(new File(user_home), "." + tmpSubDir, true /* executable */);
- }
-
-
+ }
+
+
if(null != tempRootExec) {
tempRootNoexec = tempRootExec;
} else {
@@ -1107,18 +1107,18 @@ public class IOUtil {
if( null == tempRootNoexec && isStringSet(java_io_tmpdir) ) {
tempRootNoexec = getSubTempDir(new File(java_io_tmpdir), tmpSubDir, false /* executable */);
}
-
+
// 2) $XDG_CACHE_HOME/jogamp
if(null == tempRootNoexec && isStringSet(xdg_cache_home)) {
- tempRootNoexec = getSubTempDir(new File(xdg_cache_home), tmpSubDir, false /* executable */);
+ tempRootNoexec = getSubTempDir(new File(xdg_cache_home), tmpSubDir, false /* executable */);
}
-
+
// 3) $HOME/.jogamp
- if(null == tempRootNoexec && isStringSet(user_home)) {
+ if(null == tempRootNoexec && isStringSet(user_home)) {
tempRootNoexec = getSubTempDir(new File(user_home), "." + tmpSubDir, false /* executable */);
- }
+ }
}
-
+
if(DEBUG) {
System.err.println("IOUtil.getTempRoot(): temp dirs: exec: "+tempRootExec.getAbsolutePath()+", noexec: "+tempRootNoexec.getAbsolutePath());
}
@@ -1136,16 +1136,16 @@ public class IOUtil {
private static File tempRootExec = null; // writeable and executable
private static File tempRootNoexec = null; // writeable, maybe executable
private static volatile boolean tempRootSet = false;
-
+
/**
* Utilizing {@link File#createTempFile(String, String, File)} using
- * {@link #getTempDir(boolean)} as the directory parameter, ie. location
+ * {@link #getTempDir(boolean)} as the directory parameter, ie. location
* of the root temp folder.
- *
+ *
* @see File#createTempFile(String, String)
* @see File#createTempFile(String, String, File)
* @see #getTempDir(boolean)
- *
+ *
* @param prefix
* @param suffix
* @param executable true if the temporary root folder needs to hold executable files, otherwise false.
@@ -1154,9 +1154,9 @@ public class IOUtil {
* @throws IOException
* @throws SecurityException
*/
- public static File createTempFile(String prefix, String suffix, boolean executable)
- throws IllegalArgumentException, IOException, SecurityException
- {
+ public static File createTempFile(String prefix, String suffix, boolean executable)
+ throws IllegalArgumentException, IOException, SecurityException
+ {
return File.createTempFile( prefix, suffix, getTempDir(executable) );
}
@@ -1172,6 +1172,6 @@ public class IOUtil {
e.printStackTrace();
}
}
- }
+ }
}
}
diff --git a/src/java/com/jogamp/common/util/IntBitfield.java b/src/java/com/jogamp/common/util/IntBitfield.java
index ad27dff..07b24dc 100644
--- a/src/java/com/jogamp/common/util/IntBitfield.java
+++ b/src/java/com/jogamp/common/util/IntBitfield.java
@@ -29,24 +29,24 @@ package com.jogamp.common.util;
/**
* Simple bitfield holder class using an int[] storage.
- * <p>
+ * <p>
* IntBitfield allows convenient access of a wide field of transient bits using efficient storage in O(1).
* </p>
* <p>
* It can be used e.g. to map key-codes to pressed-state etc.
- * </p>
+ * </p>
*/
public class IntBitfield {
/** Unit size in bits, here 32 bits for one int unit. */
public static final int UNIT_SIZE = 32;
-
+
private static final long UNIT_SHIFT_L = 5L;
private static final int UNIT_SHIFT_I = 5;
-
+
private final int[] storage;
private final long bitsCountL;
private final int bitsCountI;
-
+
/**
* @param bitCount
*/
@@ -54,9 +54,9 @@ public class IntBitfield {
final int units = (int) ( ( bitCount + 7L ) >> UNIT_SHIFT_L );
this.storage = new int[units];
this.bitsCountL = (long)units << UNIT_SHIFT_L ;
- this.bitsCountI = bitsCountL > Integer.MAX_VALUE ? Integer.MAX_VALUE : (int)bitsCountL;
+ this.bitsCountI = bitsCountL > Integer.MAX_VALUE ? Integer.MAX_VALUE : (int)bitsCountL;
}
-
+
/**
* @param bitCount
*/
@@ -66,7 +66,7 @@ public class IntBitfield {
this.bitsCountI = units << UNIT_SHIFT_I;
this.bitsCountL = bitsCountI;
}
-
+
private final void check(long bitnum) {
if( 0 > bitnum || bitnum >= bitsCountL ) {
throw new ArrayIndexOutOfBoundsException("Bitnum should be within [0.."+(bitsCountL-1)+"], but is "+bitnum);
@@ -77,10 +77,10 @@ public class IntBitfield {
throw new ArrayIndexOutOfBoundsException("Bitnum should be within [0.."+(bitsCountI-1)+"], but is "+bitnum);
}
}
-
+
/** Return the capacity of this bit field, i.e. the number of bits stored int this field. */
public final long capacity() { return bitsCountL; }
-
+
/** Return <code>true</code> if the bit at position <code>bitnum</code> is set, otherwise <code>false</code>. */
public final boolean get(long bitnum) {
check(bitnum);
@@ -88,7 +88,7 @@ public class IntBitfield {
final int b = (int) ( bitnum - ( (long)u << UNIT_SHIFT_L ) );
return 0 != ( storage[u] & ( 1 << b ) ) ;
}
-
+
/** Return <code>true</code> if the bit at position <code>bitnum</code> is set, otherwise <code>false</code>. */
public final boolean get(int bitnum) {
check(bitnum);
@@ -96,12 +96,12 @@ public class IntBitfield {
final int b = bitnum - ( u << UNIT_SHIFT_I );
return 0 != ( storage[u] & ( 1 << b ) ) ;
}
-
- /**
+
+ /**
* Set or clear the bit at position <code>bitnum</code> according to <code>bit</code>
- * and return the previous value.
+ * and return the previous value.
*/
- public final boolean put(long bitnum, boolean bit) {
+ public final boolean put(long bitnum, boolean bit) {
check(bitnum);
final int u = (int) ( bitnum >> UNIT_SHIFT_L );
final int b = (int) ( bitnum - ( (long)u << UNIT_SHIFT_L ) );
@@ -116,12 +116,12 @@ public class IntBitfield {
}
return prev;
}
-
- /**
+
+ /**
* Set or clear the bit at position <code>bitnum</code> according to <code>bit</code>
- * and return the previous value.
+ * and return the previous value.
*/
- public final boolean put(int bitnum, boolean bit) {
+ public final boolean put(int bitnum, boolean bit) {
check(bitnum);
final int u = bitnum >> UNIT_SHIFT_I;
final int b = bitnum - ( u << UNIT_SHIFT_I );
@@ -151,8 +151,8 @@ public class IntBitfield {
c -= (n >> 2) & 011111111111;
return ( (c + ( c >> 3 ) ) & 030707070707 ) % 63;
}
-
- /**
+
+ /**
* Returns the number of set bits within this bitfield.
*/
public long getBitCount() {
diff --git a/src/java/com/jogamp/common/util/IntIntHashMap.java b/src/java/com/jogamp/common/util/IntIntHashMap.java
index 7909478..06b9a3f 100644
--- a/src/java/com/jogamp/common/util/IntIntHashMap.java
+++ b/src/java/com/jogamp/common/util/IntIntHashMap.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
/**
* Created on Sunday, March 28 2010 21:01
*/
@@ -52,14 +52,14 @@ import java.util.Iterator;
* @author Michael Bien
* @author Simon Goller
* @author Sven Gothel
- *
+ *
* @see IntObjectHashMap
* @see IntLongHashMap
* @see LongObjectHashMap
* @see LongLongHashMap
* @see LongIntHashMap
*/
-public class /*name*/IntIntHashMap/*name*/ implements Cloneable,
+public class /*name*/IntIntHashMap/*name*/ implements Cloneable,
Iterable< /*name*/IntIntHashMap/*name*/.Entry > {
private final float loadFactor;
@@ -70,34 +70,34 @@ public class /*name*/IntIntHashMap/*name*/ implements Cloneable,
private int capacity;
private int threshold;
private /*value*/int/*value*/ keyNotFoundValue = /*null*/-1/*null*/;
-
+
private static final boolean isPrimitive;
private static final Constructor</*name*/IntIntHashMap/*name*/.Entry> entryConstructor;
private static final Method equalsMethod;
-
+
static class EntryCM { EntryCM() { c = null; m1 = null; } Constructor<Entry> c; Method m1; };
-
+
static {
final Class<?> valueClazz = /*value*/int/*value*/.class;
final Class<?> keyClazz = /*key*/int/*key*/.class;
-
+
isPrimitive = valueClazz.isPrimitive();
-
+
if(!isPrimitive) {
final EntryCM cm = AccessController.doPrivileged(new PrivilegedAction<EntryCM>() {
@SuppressWarnings("unchecked")
public EntryCM run() {
EntryCM r = new EntryCM();
- r.c = (Constructor<Entry>)
- ReflectionUtil.getConstructor(Entry.class,
+ r.c = (Constructor<Entry>)
+ ReflectionUtil.getConstructor(Entry.class,
new Class[] { keyClazz, valueClazz, Entry.class } );
try {
r.m1 = valueClazz.getDeclaredMethod("equals", Object.class);
- } catch (NoSuchMethodException ex) {
+ } catch (NoSuchMethodException ex) {
throw new JogampRuntimeException("Class "+valueClazz+" doesn't support equals(Object)");
}
- return r;
- } } );
+ return r;
+ } } );
entryConstructor = cm.c;
equalsMethod = cm.m1;
} else {
@@ -105,7 +105,7 @@ public class /*name*/IntIntHashMap/*name*/ implements Cloneable,
equalsMethod = null;
}
}
-
+
public /*name*/IntIntHashMap/*name*/() {
this(16, 0.75f);
}
@@ -135,32 +135,32 @@ public class /*name*/IntIntHashMap/*name*/ implements Cloneable,
}
private /*name*/IntIntHashMap/*name*/(float loadFactor, int table_size, int size,
- int mask, int capacity, int threshold,
+ int mask, int capacity, int threshold,
/*value*/int/*value*/ keyNotFoundValue) {
this.loadFactor = loadFactor;
this.table = new Entry[table_size];
this.size = size;
-
+
this.mask = mask;
this.capacity = capacity;
this.threshold = threshold;
-
- this.keyNotFoundValue = keyNotFoundValue;
+
+ this.keyNotFoundValue = keyNotFoundValue;
}
-
+
/**
* Disclaimer: If the value type doesn't implement {@link Object#clone() clone()}, only the reference is copied.
* Note: Due to private fields we cannot implement a copy constructor, sorry.
- *
+ *
* @param source the primitive hash map to copy
*/
@Override
public Object clone() {
- /*name*/IntIntHashMap/*name*/ n =
- new /*name*/IntIntHashMap/*name*/(loadFactor, table.length, size,
- mask, capacity, threshold,
+ /*name*/IntIntHashMap/*name*/ n =
+ new /*name*/IntIntHashMap/*name*/(loadFactor, table.length, size,
+ mask, capacity, threshold,
keyNotFoundValue);
-
+
for(int i=table.length-1; i>=0; i--) {
// single linked list -> ArrayList
final ArrayList<Entry> entries = new ArrayList<Entry>();
@@ -182,10 +182,10 @@ public class /*name*/IntIntHashMap/*name*/ implements Cloneable,
}
// 1st elem of linked list is table entry
n.table[i] = de_next;
- }
+ }
return n;
}
-
+
public boolean containsValue(/*value*/int/*value*/ value) {
Entry[] t = this.table;
for (int i = t.length; i-- > 0;) {
@@ -196,9 +196,9 @@ public class /*name*/IntIntHashMap/*name*/ implements Cloneable,
}
} else {
final Boolean b = (Boolean) ReflectionUtil.callMethod(value, equalsMethod, e.value);
- if(b.booleanValue()) {
+ if(b.booleanValue()) {
return true;
- }
+ }
}
}
}
@@ -299,7 +299,7 @@ public class /*name*/IntIntHashMap/*name*/ implements Cloneable,
final int index = /*keyHash*/key/*keyHash*/ & mask;
Entry prev = t[index];
Entry e = prev;
-
+
while (e != null) {
Entry next = e.next;
if (e.key == key) {
@@ -355,7 +355,7 @@ public class /*name*/IntIntHashMap/*name*/ implements Cloneable,
*
* @return the previous key not found value
* @see #get
- * @see #put
+ * @see #put
*/
public /*value*/int/*value*/ setKeyNotFoundValue(/*value*/int/*value*/ newKeyNotFoundValue) {
/*value*/int/*value*/ t = keyNotFoundValue;
@@ -391,19 +391,19 @@ public class /*name*/IntIntHashMap/*name*/ implements Cloneable,
sb.append("}");
return sb;
}
-
+
@Override
public String toString() {
return toString(null).toString();
}
-
+
private final static class EntryIterator implements Iterator<Entry> {
private final Entry[] entries;
-
+
private int index;
private Entry next;
-
+
private EntryIterator(Entry[] entries){
this.entries = entries;
// load next
@@ -439,9 +439,9 @@ public class /*name*/IntIntHashMap/*name*/ implements Cloneable,
public void remove() {
throw new UnsupportedOperationException("Not supported yet.");
}
-
+
}
-
+
/**
* An entry mapping a key to a value.
*/
@@ -449,7 +449,7 @@ public class /*name*/IntIntHashMap/*name*/ implements Cloneable,
public final /*key*/int/*key*/ key;
public /*value*/int/*value*/ value;
-
+
private Entry next;
Entry(/*key*/int/*key*/ k, /*value*/int/*value*/ v, Entry n) {
@@ -457,7 +457,7 @@ public class /*name*/IntIntHashMap/*name*/ implements Cloneable,
value = v;
next = n;
}
-
+
/**
* Returns the key of this entry.
*/
@@ -490,21 +490,21 @@ public class /*name*/IntIntHashMap/*name*/ implements Cloneable,
sb.append("[").append(key).append(":").append(value).append("]");
return sb;
}
-
+
@Override
public String toString() {
return toString(null).toString();
}
}
-
+
private static Method getCloneMethod(Object obj) {
final Class<?> clazz = obj.getClass();
return AccessController.doPrivileged(new PrivilegedAction<Method>() {
public Method run() {
try {
return clazz.getDeclaredMethod("clone");
- } catch (NoSuchMethodException ex) {
+ } catch (NoSuchMethodException ex) {
throw new JogampRuntimeException("Class "+clazz+" doesn't support clone()", ex);
}
} } );
diff --git a/src/java/com/jogamp/common/util/JarUtil.java b/src/java/com/jogamp/common/util/JarUtil.java
index 29e7dc7..1689d54 100644
--- a/src/java/com/jogamp/common/util/JarUtil.java
+++ b/src/java/com/jogamp/common/util/JarUtil.java
@@ -54,17 +54,17 @@ public class JarUtil {
private static final boolean DEBUG = Debug.debug("JarUtil");
private static final int BUFFER_SIZE = 4096;
-
+
/**
* Interface allowing users to provide an URL resolver that will convert custom classloader
* URLs like Eclipse/OSGi <i>bundleresource:</i> URLs to normal <i>jar:</i> URLs.
- * <p>
+ * <p>
* This might be required for custom classloader where the URI protocol is unknown
- * to the standard runtime environment.
+ * to the standard runtime environment.
* </p>
* <p>
* Note: The provided resolver is only utilized if a given URI's protocol could not be resolved.
- * I.e. it will not be invoked for known protocols like <i>http</i>, <i>https</i>, <i>jar</i> or <i>file</i>.
+ * I.e. it will not be invoked for known protocols like <i>http</i>, <i>https</i>, <i>jar</i> or <i>file</i>.
* </p>
*/
public interface Resolver {
@@ -72,15 +72,15 @@ public class JarUtil {
}
private static Resolver resolver;
-
+
/**
* Setting a custom {@link Resolver} instance.
- *
+ *
* @param r {@link Resolver} to use after querying class file URLs from the classloader.
* @throws IllegalArgumentException if the passed resolver is <code>null</code>
* @throws IllegalStateException if the resolver has already been set.
* @throws SecurityException if the security manager doesn't have the setFactory
- * permission
+ * permission
*/
public static void setResolver(Resolver r) throws IllegalArgumentException, IllegalStateException, SecurityException {
if(r == null) {
@@ -101,13 +101,13 @@ public class JarUtil {
/**
* Returns <code>true</code> if the Class's <code>"com.jogamp.common.GlueGenVersion"</code>
- * is loaded from a JarFile and hence has a Jar URI like
+ * is loaded from a JarFile and hence has a Jar URI like
* URI <code>jar:<i>sub_protocol</i>:/some/path/gluegen-rt.jar!/com/jogamp/common/GlueGenVersion.class"</code>.
* <p>
* <i>sub_protocol</i> may be "file", "http", etc..
* </p>
- *
- * @param clazzBinName "com.jogamp.common.GlueGenVersion"
+ *
+ * @param clazzBinName "com.jogamp.common.GlueGenVersion"
* @param cl
* @return true if the class is loaded from a Jar file, otherwise false.
* @see {@link #getJarURI(String, ClassLoader)}
@@ -118,20 +118,20 @@ public class JarUtil {
} catch (Exception e) { /* ignore */ }
return false;
}
-
+
/**
- * The Class's <code>"com.jogamp.common.GlueGenVersion"</code>
+ * The Class's <code>"com.jogamp.common.GlueGenVersion"</code>
* URI <code>jar:<i>sub_protocol</i>:/some/path/gluegen-rt.jar!/com/jogamp/common/GlueGenVersion.class"</code>
* will be returned.
* <p>
* <i>sub_protocol</i> may be "file", "http", etc..
* </p>
- *
- * @param clazzBinName "com.jogamp.common.GlueGenVersion"
+ *
+ * @param clazzBinName "com.jogamp.common.GlueGenVersion"
* @param cl ClassLoader to locate the JarFile
* @return "jar:<i>sub_protocol</i>:/some/path/gluegen-rt.jar!/com/jogamp/common/GlueGenVersion.class"
* @throws IllegalArgumentException if the URI doesn't match the expected formatting or null arguments
- * @throws IOException if the class's Jar file could not been found by the ClassLoader
+ * @throws IOException if the class's Jar file could not been found by the ClassLoader
* @throws URISyntaxException if the URI could not be translated into a RFC 2396 URI
* @see {@link IOUtil#getClassURL(String, ClassLoader)}
*/
@@ -148,7 +148,7 @@ public class JarUtil {
!scheme.equals( IOUtil.JAR_SCHEME ) &&
!scheme.equals( IOUtil.FILE_SCHEME ) &&
!scheme.equals( IOUtil.HTTP_SCHEME ) &&
- !scheme.equals( IOUtil.HTTPS_SCHEME ) )
+ !scheme.equals( IOUtil.HTTPS_SCHEME ) )
{
final URL _url = resolver.resolve( url );
uri = _url.toURI();
@@ -171,19 +171,19 @@ public class JarUtil {
}
return uri;
}
-
-
+
+
/**
* The Class's Jar URI <code>jar:<i>sub_protocol</i>:/some/path/gluegen-rt.jar!/com/jogamp/common/GlueGenVersion.class</code>
* Jar basename <code>gluegen-rt.jar</code> will be returned.
* <p>
* <i>sub_protocol</i> may be "file", "http", etc..
* </p>
- *
- * @param classJarURI as retrieved w/ {@link #getJarURI(String, ClassLoader) getJarURI("com.jogamp.common.GlueGenVersion", cl).toURI()},
+ *
+ * @param classJarURI as retrieved w/ {@link #getJarURI(String, ClassLoader) getJarURI("com.jogamp.common.GlueGenVersion", cl).toURI()},
* i.e. <code>jar:<i>sub_protocol</i>:/some/path/gluegen-rt.jar!/com/jogamp/common/GlueGenVersion.class</code>
* @return <code>gluegen-rt.jar</code>
- * @throws IllegalArgumentException if the URI doesn't match the expected formatting or is null
+ * @throws IllegalArgumentException if the URI doesn't match the expected formatting or is null
* @see {@link IOUtil#getClassURL(String, ClassLoader)}
*/
public static String getJarBasename(URI classJarURI) throws IllegalArgumentException {
@@ -194,19 +194,19 @@ public class JarUtil {
throw new IllegalArgumentException("URI is not using scheme "+IOUtil.JAR_SCHEME+": <"+classJarURI+">");
}
String uriS = classJarURI.getSchemeSpecificPart();
-
- // from
+
+ // from
// file:/some/path/gluegen-rt.jar!/com/jogamp/common/util/cache/TempJarCache.class
// to
// file:/some/path/gluegen-rt.jar
int idx = uriS.lastIndexOf('!');
if (0 <= idx) {
- uriS = uriS.substring(0, idx); // exclude '!/'
+ uriS = uriS.substring(0, idx); // exclude '!/'
} else {
throw new IllegalArgumentException("JAR URI does not contain jar uri terminator '!', in <"+classJarURI+">");
}
-
- // from
+
+ // from
// file:/some/path/gluegen-rt.jar
// to
// gluegen-rt.jar
@@ -219,10 +219,10 @@ public class JarUtil {
}
}
uriS = uriS.substring(idx+1); // just the jar name
-
+
if(0 >= uriS.lastIndexOf(".jar")) {
throw new IllegalArgumentException("No Jar name in <"+classJarURI+">");
- }
+ }
if(DEBUG) {
System.out.println("getJarName res: "+uriS);
}
@@ -230,17 +230,17 @@ public class JarUtil {
}
/**
- * The Class's <code>com.jogamp.common.GlueGenVersion</code>
+ * The Class's <code>com.jogamp.common.GlueGenVersion</code>
* URI <code>jar:<i>sub_protocol</i>:/some/path/gluegen-rt.jar!/com/jogamp/common/GlueGenVersion.class</code>
* Jar basename <code>gluegen-rt.jar</code> will be returned.
* <p>
* <i>sub_protocol</i> may be "file", "http", etc..
* </p>
- *
+ *
* @param clazzBinName <code>com.jogamp.common.GlueGenVersion</code>
* @param cl
* @return <code>gluegen-rt.jar</code>
- * @throws IllegalArgumentException if the URI doesn't match the expected formatting
+ * @throws IllegalArgumentException if the URI doesn't match the expected formatting
* @throws IOException if the class's Jar file could not been found by the ClassLoader.
* @throws URISyntaxException if the URI could not be translated into a RFC 2396 URI
* @see {@link IOUtil#getClassURL(String, ClassLoader)}
@@ -248,34 +248,34 @@ public class JarUtil {
public static String getJarBasename(String clazzBinName, ClassLoader cl) throws IllegalArgumentException, IOException, URISyntaxException {
return getJarBasename( getJarURI(clazzBinName, cl) );
}
-
+
/**
* The Class's Jar URI <code>jar:<i>sub_protocol</i>:/some/path/gluegen-rt.jar!/com/jogamp/common/GlueGenVersion.class</code>
* Jar file's sub URI <code><i>sub_protocol</i>:/some/path/gluegen-rt.jar</code> will be returned.
* <p>
* <i>sub_protocol</i> may be "file", "http", etc..
* </p>
- *
- * @param classJarURI as retrieved w/ {@link #getJarURI(String, ClassLoader) getJarURI("com.jogamp.common.GlueGenVersion", cl).toURI()},
+ *
+ * @param classJarURI as retrieved w/ {@link #getJarURI(String, ClassLoader) getJarURI("com.jogamp.common.GlueGenVersion", cl).toURI()},
* i.e. <code>jar:<i>sub_protocol</i>:/some/path/gluegen-rt.jar!/com/jogamp/common/GlueGenVersion.class</code>
* @return <code><i>sub_protocol</i>:/some/path/gluegen-rt.jar</code>
- * @throws IllegalArgumentException if the URI doesn't match the expected formatting or is null
+ * @throws IllegalArgumentException if the URI doesn't match the expected formatting or is null
* @throws URISyntaxException if the URI could not be translated into a RFC 2396 URI
* @see {@link IOUtil#getClassURL(String, ClassLoader)}
*/
public static URI getJarSubURI(URI classJarURI) throws IllegalArgumentException, URISyntaxException {
if(null == classJarURI) {
- throw new IllegalArgumentException("URI is null");
+ throw new IllegalArgumentException("URI is null");
}
if( !classJarURI.getScheme().equals(IOUtil.JAR_SCHEME) ) {
throw new IllegalArgumentException("URI is not a using scheme "+IOUtil.JAR_SCHEME+": <"+classJarURI+">");
}
-
- // from
+
+ // from
// file:/some/path/gluegen-rt.jar!/com/jogamp/common/GlueGenVersion.class
// to
// file:/some/path/gluegen-rt.jar
- final String uriS0 = classJarURI.getSchemeSpecificPart();
+ final String uriS0 = classJarURI.getSchemeSpecificPart();
int idx = uriS0.lastIndexOf('!');
final String uriS1;
if (0 <= idx) {
@@ -292,26 +292,26 @@ public class JarUtil {
}
return new URI(uriS2);
}
-
+
/**
* The Class's Jar URI <code>jar:<i>sub_protocol</i>:/some/path/gluegen-rt.jar!/com/jogamp/common/GlueGenVersion.class</code>
* Jar file's entry <code>/com/jogamp/common/GlueGenVersion.class</code> will be returned.
- *
- * @param classJarURI as retrieved w/ {@link #getJarURI(String, ClassLoader) getJarURI("com.jogamp.common.GlueGenVersion", cl).toURI()},
+ *
+ * @param classJarURI as retrieved w/ {@link #getJarURI(String, ClassLoader) getJarURI("com.jogamp.common.GlueGenVersion", cl).toURI()},
* i.e. <code>jar:<i>sub_protocol</i>:/some/path/gluegen-rt.jar!/com/jogamp/common/GlueGenVersion.class</code>
* @return <code>/com/jogamp/common/GlueGenVersion.class</code>
* @see {@link IOUtil#getClassURL(String, ClassLoader)}
*/
public static String getJarEntry(URI classJarURI) {
if(null == classJarURI) {
- throw new IllegalArgumentException("URI is null");
+ throw new IllegalArgumentException("URI is null");
}
if( !classJarURI.getScheme().equals(IOUtil.JAR_SCHEME) ) {
throw new IllegalArgumentException("URI is not a using scheme "+IOUtil.JAR_SCHEME+": <"+classJarURI+">");
}
String uriS = classJarURI.getSchemeSpecificPart();
-
- // from
+
+ // from
// file:/some/path/gluegen-rt.jar!/com/jogamp/common/GlueGenVersion.class
// to
// file:/some/path/gluegen-rt.jar
@@ -324,18 +324,18 @@ public class JarUtil {
}
/**
- * The Class's <code>com.jogamp.common.GlueGenVersion</code>
+ * The Class's <code>com.jogamp.common.GlueGenVersion</code>
* URI <code>jar:<i>sub_protocol</i>:/some/path/gluegen-rt.jar!/com/jogamp/common/GlueGenVersion.class</code>
* Jar file's sub URI <code><i>sub_protocol</i>:/some/path/gluegen-rt.jar</code> will be returned.
* <p>
* <i>sub_protocol</i> may be "file", "http", etc..
* </p>
- *
+ *
* @param clazzBinName <code>com.jogamp.common.GlueGenVersion</code>
* @param cl
* @return <code><i>sub_protocol</i>:/some/path/gluegen-rt.jar</code>
- * @throws IllegalArgumentException if the URI doesn't match the expected formatting
- * @throws IOException if the class's Jar file could not been found by the ClassLoader
+ * @throws IllegalArgumentException if the URI doesn't match the expected formatting
+ * @throws IOException if the class's Jar file could not been found by the ClassLoader
* @throws URISyntaxException if the URI could not be translated into a RFC 2396 URI
* @see {@link IOUtil#getClassURL(String, ClassLoader)}
*/
@@ -344,18 +344,18 @@ public class JarUtil {
}
/**
- * The Class's <code>"com.jogamp.common.GlueGenVersion"</code>
+ * The Class's <code>"com.jogamp.common.GlueGenVersion"</code>
* URI <code>jar:<i>sub_protocol</i>:/some/path/gluegen-rt.jar!/com/jogamp/common/GlueGenVersion.class"</code>
* Jar file URI <code>jar:<i>sub_protocol</i>:/some/path/gluegen-rt.jar!/</code> will be returned.
* <p>
* <i>sub_protocol</i> may be "file", "http", etc..
* </p>
- *
- * @param clazzBinName "com.jogamp.common.GlueGenVersion"
+ *
+ * @param clazzBinName "com.jogamp.common.GlueGenVersion"
* @param cl
* @return "jar:<i>sub_protocol</i>:/some/path/gluegen-rt.jar!/"
- * @throws IllegalArgumentException if the URI doesn't match the expected formatting or null arguments
- * @throws IOException if the class's Jar file could not been found by the ClassLoader
+ * @throws IllegalArgumentException if the URI doesn't match the expected formatting or null arguments
+ * @throws IOException if the class's Jar file could not been found by the ClassLoader
* @throws URISyntaxException if the URI could not be translated into a RFC 2396 URI
* @see {@link IOUtil#getClassURL(String, ClassLoader)}
*/
@@ -374,7 +374,7 @@ public class JarUtil {
* @param baseUri file:/some/path/
* @param jarFileName gluegen-rt.jar
* @return jar:file:/some/path/gluegen-rt.jar!/
- * @throws URISyntaxException
+ * @throws URISyntaxException
* @throws IllegalArgumentException null arguments
*/
public static URI getJarFileURI(URI baseUri, String jarFileName) throws IllegalArgumentException, URISyntaxException {
@@ -383,12 +383,12 @@ public class JarUtil {
}
return new URI(IOUtil.JAR_SCHEME, baseUri.toString()+jarFileName+"!/", null);
}
-
+
/**
* @param jarSubUri file:/some/path/gluegen-rt.jar
* @return jar:file:/some/path/gluegen-rt.jar!/
* @throws IllegalArgumentException null arguments
- * @throws URISyntaxException
+ * @throws URISyntaxException
*/
public static URI getJarFileURI(URI jarSubUri) throws IllegalArgumentException, URISyntaxException {
if(null == jarSubUri) {
@@ -396,12 +396,12 @@ public class JarUtil {
}
return new URI(IOUtil.JAR_SCHEME, jarSubUri.toString()+"!/", null);
}
-
+
/**
* @param jarSubUriS file:/some/path/gluegen-rt.jar
* @return jar:file:/some/path/gluegen-rt.jar!/
* @throws IllegalArgumentException null arguments
- * @throws URISyntaxException
+ * @throws URISyntaxException
*/
public static URI getJarFileURI(String jarSubUriS) throws IllegalArgumentException, URISyntaxException {
if(null == jarSubUriS) {
@@ -409,13 +409,13 @@ public class JarUtil {
}
return new URI(IOUtil.JAR_SCHEME, jarSubUriS+"!/", null);
}
-
+
/**
* @param jarFileURI jar:file:/some/path/gluegen-rt.jar!/
* @param jarEntry com/jogamp/common/GlueGenVersion.class
* @return jar:file:/some/path/gluegen-rt.jar!/com/jogamp/common/GlueGenVersion.class
* @throws IllegalArgumentException null arguments
- * @throws URISyntaxException
+ * @throws URISyntaxException
*/
public static URI getJarEntryURI(URI jarFileURI, String jarEntry) throws IllegalArgumentException, URISyntaxException {
if(null == jarEntry) {
@@ -423,12 +423,12 @@ public class JarUtil {
}
return new URI(jarFileURI.toString()+jarEntry);
}
-
+
/**
- * @param clazzBinName com.jogamp.common.util.cache.TempJarCache
- * @param cl domain
+ * @param clazzBinName com.jogamp.common.util.cache.TempJarCache
+ * @param cl domain
* @return JarFile containing the named class within the given ClassLoader
- * @throws IOException if the class's Jar file could not been found by the ClassLoader
+ * @throws IOException if the class's Jar file could not been found by the ClassLoader
* @throws IllegalArgumentException null arguments
* @throws URISyntaxException if the URI could not be translated into a RFC 2396 URI
* @see {@link #getJarFileURI(String, ClassLoader)}
@@ -441,8 +441,8 @@ public class JarUtil {
* @param jarFileURI jar:file:/some/path/gluegen-rt.jar!/
* @return JarFile as named by URI within the given ClassLoader
* @throws IllegalArgumentException null arguments
- * @throws IOException if the Jar file could not been found
- * @throws URISyntaxException
+ * @throws IOException if the Jar file could not been found
+ * @throws URISyntaxException
*/
public static JarFile getJarFile(URI jarFileURI) throws IOException, IllegalArgumentException, URISyntaxException {
if(null == jarFileURI) {
@@ -452,22 +452,22 @@ public class JarUtil {
System.out.println("getJarFile: "+jarFileURI.toString());
}
final URL jarFileURL = IOUtil.toURL(jarFileURI);
- // final URL jarFileURL = jarFileURI.toURL(); // doesn't work due to encoded path even w/ file schema!
+ // final URL jarFileURL = jarFileURI.toURL(); // doesn't work due to encoded path even w/ file schema!
final URLConnection urlc = jarFileURL.openConnection();
if(urlc instanceof JarURLConnection) {
JarURLConnection jarConnection = (JarURLConnection)jarFileURL.openConnection();
JarFile jarFile = jarConnection.getJarFile();
if(DEBUG) {
System.out.println("getJarFile res: "+jarFile.getName());
- }
+ }
return jarFile;
}
if(DEBUG) {
System.out.println("getJarFile res: NULL");
- }
+ }
return null;
}
-
+
/**
* Return a map from native-lib-base-name to entry-name.
*/
@@ -478,12 +478,12 @@ public class JarUtil {
final Map<String,String> nameMap = new HashMap<String, String>();
final Enumeration<JarEntry> entries = jarFile.entries();
-
+
while (entries.hasMoreElements()) {
final JarEntry entry = entries.nextElement();
final String entryName = entry.getName();
final String baseName = NativeLibrary.isValidNativeLibraryName(entryName, false);
-
+
if(null != baseName) {
nameMap.put(baseName, entryName);
}
@@ -503,7 +503,7 @@ public class JarUtil {
* Root entries are favored over non root entries in case of naming collisions.<br>
* Example on a Unix like machine:<br>
* <pre>
- * mylib.jar!/sub1/libsour.so -> sour (mapped, unique name)
+ * mylib.jar!/sub1/libsour.so -> sour (mapped, unique name)
* mylib.jar!/sub1/libsweet.so (dropped, root entry favored)
* mylib.jar!/libsweet.so -> sweet (mapped, root entry favored)
* mylib.jar!/sweet.dll -> (dropped, not a unix library name)
@@ -515,11 +515,11 @@ public class JarUtil {
* In this case, set all flags to true <code>extractNativeLibraries </code>.
* <code>extractClassFiles</code>, <code>extractOtherFiles</code>.
* </p>
- *
+ *
* @param dest
* @param nativeLibMap
* @param jarFile
- * @param nativeLibraryPath if not null, only extracts native libraries within this path.
+ * @param nativeLibraryPath if not null, only extracts native libraries within this path.
* @param extractNativeLibraries
* @param extractClassFiles
* @param extractOtherFiles
@@ -527,7 +527,7 @@ public class JarUtil {
* @return
* @throws IOException
*/
- public static final int extract(File dest, Map<String, String> nativeLibMap,
+ public static final int extract(File dest, Map<String, String> nativeLibMap,
JarFile jarFile,
String nativeLibraryPath,
boolean extractNativeLibraries,
@@ -573,7 +573,7 @@ public class JarUtil {
}
}
}
-
+
final boolean isClassFile = entryName.endsWith(".class");
if(isClassFile && !extractClassFiles) {
if (DEBUG) {
@@ -581,7 +581,7 @@ public class JarUtil {
}
continue;
}
-
+
if(!isNativeLib && !isClassFile && !extractOtherFiles) {
if (DEBUG) {
System.err.println("JarUtil: JarEntry : " + entryName + " other-file skipped");
@@ -590,16 +590,16 @@ public class JarUtil {
}
final boolean isDir = entryName.endsWith("/");
-
- final boolean isRootEntry = entryName.indexOf('/') == -1 &&
+
+ final boolean isRootEntry = entryName.indexOf('/') == -1 &&
entryName.indexOf(File.separatorChar) == -1;
-
+
if (DEBUG) {
- System.err.println("JarUtil: JarEntry : isNativeLib " + isNativeLib +
+ System.err.println("JarUtil: JarEntry : isNativeLib " + isNativeLib +
", isClassFile " + isClassFile + ", isDir " + isDir +
", isRootEntry " + isRootEntry );
}
-
+
final File destFile = new File(dest, entryName);
if(isDir) {
if (DEBUG) {
@@ -611,12 +611,12 @@ public class JarUtil {
if(!destFolder.exists()) {
if (DEBUG) {
System.err.println("JarUtil: MKDIR (parent): " + entryName + " -> " + destFolder );
- }
+ }
destFolder.mkdirs();
}
final InputStream in = new BufferedInputStream(jarFile.getInputStream(entry));
final OutputStream out = new BufferedOutputStream(new FileOutputStream(destFile));
- int numBytes = -1;
+ int numBytes = -1;
try {
numBytes = IOUtil.copyStream2Stream(BUFFER_SIZE, in, out, -1);
} finally {
@@ -626,7 +626,7 @@ public class JarUtil {
boolean addedAsNativeLib = false;
if (numBytes>0) {
num++;
- if (isNativeLib && ( isRootEntry || !nativeLibMap.containsKey(libBaseName) ) ) {
+ if (isNativeLib && ( isRootEntry || !nativeLibMap.containsKey(libBaseName) ) ) {
nativeLibMap.put(libBaseName, destFile.getAbsolutePath());
addedAsNativeLib = true;
}
@@ -647,7 +647,7 @@ public class JarUtil {
getCodeSource().getCertificates();
</pre>
*/
- public static final void validateCertificates(Certificate[] rootCerts, JarFile jarFile)
+ public static final void validateCertificates(Certificate[] rootCerts, JarFile jarFile)
throws IOException, SecurityException {
if (DEBUG) {
@@ -673,7 +673,7 @@ public class JarUtil {
* Check the certificates with the ones in the jar file
* (all must match).
*/
- private static final void validateCertificate(Certificate[] rootCerts,
+ private static final void validateCertificate(Certificate[] rootCerts,
JarFile jar, JarEntry entry, byte[] buf) throws IOException, SecurityException {
if (DEBUG) {
diff --git a/src/java/com/jogamp/common/util/JogampVersion.java b/src/java/com/jogamp/common/util/JogampVersion.java
index 046f18c..2789de7 100644
--- a/src/java/com/jogamp/common/util/JogampVersion.java
+++ b/src/java/com/jogamp/common/util/JogampVersion.java
@@ -46,16 +46,16 @@ public class JogampVersion {
public static final Attributes.Name IMPLEMENTATION_BRANCH = new Attributes.Name("Implementation-Branch");
/** See {@link #getImplementationCommit()} */
public static final Attributes.Name IMPLEMENTATION_COMMIT = new Attributes.Name("Implementation-Commit");
-
+
private String packageName;
private Manifest mf;
private int hash;
private Attributes mainAttributes;
private Set<?>/*<Attributes.Name>*/ mainAttributeNames;
-
+
private final String androidPackageVersionName;
-
- protected JogampVersion(String packageName, Manifest mf) {
+
+ protected JogampVersion(String packageName, Manifest mf) {
this.packageName = packageName;
this.mf = ( null != mf ) ? mf : new Manifest();
this.hash = this.mf.hashCode();
@@ -104,7 +104,7 @@ public class JogampVersion {
}
/**
- * @return set of type {@link Attributes.Name}, disguised as anonymous
+ * @return set of type {@link Attributes.Name}, disguised as anonymous
*/
public final Set<?>/*<Attributes.Name>*/ getAttributeNames() {
return mainAttributeNames;
@@ -117,13 +117,13 @@ public class JogampVersion {
return this.getAttribute(Attributes.Name.EXTENSION_NAME);
}
- /**
+ /**
* Returns the implementation build number, e.g. <code>2.0-b456-20130328</code>.
*/
public final String getImplementationBuild() {
return this.getAttribute(GlueGenVersion.IMPLEMENTATION_BUILD);
}
-
+
/**
* Returns the SCM branch name
*/
@@ -168,7 +168,7 @@ public class JogampVersion {
public final String getAndroidPackageVersionName() {
return androidPackageVersionName;
}
-
+
public final String getSpecificationTitle() {
return this.getAttribute(Attributes.Name.SPECIFICATION_TITLE);
}
@@ -220,7 +220,7 @@ public class JogampVersion {
return sb;
}
-
+
@Override
public String toString() {
return toString(null).toString();
diff --git a/src/java/com/jogamp/common/util/LFRingbuffer.java b/src/java/com/jogamp/common/util/LFRingbuffer.java
index f704047..1ca1e20 100644
--- a/src/java/com/jogamp/common/util/LFRingbuffer.java
+++ b/src/java/com/jogamp/common/util/LFRingbuffer.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -31,7 +31,7 @@ package com.jogamp.common.util;
import java.io.PrintStream;
import java.lang.reflect.Array;
-/**
+/**
* Simple implementation of {@link Ringbuffer},
* exposing <i>lock-free</i>
* {@link #get() get*(..)} and {@link #put(Object) put*(..)} methods.
@@ -80,11 +80,11 @@ public class LFRingbuffer<T> implements Ringbuffer<T> {
private volatile int readPos;
private volatile int writePos;
private volatile int size;
-
+
public final String toString() {
return "LFRingbuffer<?>[filled "+size+" / "+(capacityPlusOne-1)+", writePos "+writePos+", readPos "+readPos+"]";
}
-
+
public final void dump(PrintStream stream, String prefix) {
stream.println(prefix+" "+toString()+" {");
for(int i=0; i<capacityPlusOne; i++) {
@@ -92,10 +92,10 @@ public class LFRingbuffer<T> implements Ringbuffer<T> {
}
stream.println("}");
}
-
- /**
+
+ /**
* Create a full ring buffer instance w/ the given array's net capacity and content.
- * <p>
+ * <p>
* Example for a 10 element Integer array:
* <pre>
* Integer[] source = new Integer[10];
@@ -111,7 +111,7 @@ public class LFRingbuffer<T> implements Ringbuffer<T> {
* and copy all elements from array <code>copyFrom</code> into the internal array.
* </p>
* @param copyFrom mandatory source array determining ring buffer's net {@link #capacity()} and initial content.
- * @throws IllegalArgumentException if <code>copyFrom</code> is <code>null</code>
+ * @throws IllegalArgumentException if <code>copyFrom</code> is <code>null</code>
*/
@SuppressWarnings("unchecked")
public LFRingbuffer(T[] copyFrom) throws IllegalArgumentException {
@@ -119,10 +119,10 @@ public class LFRingbuffer<T> implements Ringbuffer<T> {
array = (T[]) newArray(copyFrom.getClass(), capacityPlusOne);
resetImpl(true, copyFrom);
}
-
- /**
+
+ /**
* Create an empty ring buffer instance w/ the given net <code>capacity</code>.
- * <p>
+ * <p>
* Example for a 10 element Integer array:
* <pre>
* Ringbuffer<Integer> rb = new LFRingbuffer<Integer>(10, Integer[].class);
@@ -142,13 +142,13 @@ public class LFRingbuffer<T> implements Ringbuffer<T> {
array = (T[]) newArray(arrayType, capacityPlusOne);
resetImpl(false, null /* empty, nothing to copy */ );
}
-
+
@Override
public final T[] getInternalArray() { return array; }
-
+
@Override
public final int capacity() { return capacityPlusOne-1; }
-
+
@Override
public final void clear() {
synchronized ( syncGlobal ) {
@@ -158,12 +158,12 @@ public class LFRingbuffer<T> implements Ringbuffer<T> {
}
}
}
-
+
@Override
public final void resetFull(T[] copyFrom) throws IllegalArgumentException {
resetImpl(true, copyFrom);
}
-
+
private final void resetImpl(boolean full, T[] copyFrom) throws IllegalArgumentException {
synchronized ( syncGlobal ) {
if( null != copyFrom ) {
@@ -185,21 +185,21 @@ public class LFRingbuffer<T> implements Ringbuffer<T> {
}
}
}
-
+
@Override
public final int size() { return size; }
-
+
@Override
public final int getFreeSlots() { return capacityPlusOne - 1 - size; }
@Override
public final boolean isEmpty() { return 0 == size; }
-
+
@Override
public final boolean isFull() { return capacityPlusOne - 1 == size; }
-
+
/**
- * {@inheritDoc}
+ * {@inheritDoc}
* <p>
* Implementation advances the read position and returns the element at it, if not empty.
* </p>
@@ -212,7 +212,7 @@ public class LFRingbuffer<T> implements Ringbuffer<T> {
}
/**
- * {@inheritDoc}
+ * {@inheritDoc}
* <p>
* Implementation advances the read position and returns the element at it, if not empty.
* </p>
@@ -221,7 +221,7 @@ public class LFRingbuffer<T> implements Ringbuffer<T> {
public final T getBlocking() throws InterruptedException {
return getImpl(true, false);
}
-
+
@Override
public final T peek() {
try {
@@ -232,7 +232,7 @@ public class LFRingbuffer<T> implements Ringbuffer<T> {
public final T peekBlocking() throws InterruptedException {
return getImpl(true, true);
}
-
+
private final T getImpl(boolean blocking, boolean peek) throws InterruptedException {
int localReadPos = readPos;
if( localReadPos == writePos ) {
@@ -258,9 +258,9 @@ public class LFRingbuffer<T> implements Ringbuffer<T> {
}
return r;
}
-
+
/**
- * {@inheritDoc}
+ * {@inheritDoc}
* <p>
* Implementation advances the write position and stores the given element at it, if not full.
* </p>
@@ -271,9 +271,9 @@ public class LFRingbuffer<T> implements Ringbuffer<T> {
return putImpl(e, false, false);
} catch (InterruptedException ie) { throw new RuntimeException(ie); }
}
-
- /**
- * {@inheritDoc}
+
+ /**
+ * {@inheritDoc}
* <p>
* Implementation advances the write position and stores the given element at it, if not full.
* </p>
@@ -284,10 +284,10 @@ public class LFRingbuffer<T> implements Ringbuffer<T> {
throw new InternalError("Blocking put failed: "+this);
}
}
-
+
/**
* {@inheritDoc}
- * <p>
+ * <p>
* Implementation advances the write position and keeps the element at it, if not full.
* </p>
*/
@@ -295,7 +295,7 @@ public class LFRingbuffer<T> implements Ringbuffer<T> {
public final boolean putSame(boolean blocking) throws InterruptedException {
return putImpl(null, true, blocking);
}
-
+
private final boolean putImpl(T e, boolean sameRef, boolean blocking) throws InterruptedException {
int localWritePos = writePos;
localWritePos = (localWritePos + 1) % capacityPlusOne;
@@ -320,8 +320,8 @@ public class LFRingbuffer<T> implements Ringbuffer<T> {
}
return true;
}
-
-
+
+
@Override
public final void waitForFreeSlots(int count) throws InterruptedException {
synchronized ( syncRead ) {
@@ -332,10 +332,10 @@ public class LFRingbuffer<T> implements Ringbuffer<T> {
}
}
}
-
+
@Override
public final void growEmptyBuffer(final T[] newElements) throws IllegalStateException, IllegalArgumentException {
- synchronized( syncGlobal ) {
+ synchronized( syncGlobal ) {
if( null == newElements ) {
throw new IllegalArgumentException("newElements is null");
}
@@ -355,15 +355,15 @@ public class LFRingbuffer<T> implements Ringbuffer<T> {
if( readPos != writePos ) {
throw new InternalError("R/W pos not equal at empty: "+this);
}
-
+
final int growAmount = newElements.length;
final int newCapacity = capacityPlusOne + growAmount;
final T[] oldArray = array;
final T[] newArray = (T[]) newArray(arrayTypeInternal, newCapacity);
-
+
// writePos == readPos
writePos += growAmount; // warp writePos to the end of the new data location
-
+
if( readPos >= 0 ) {
System.arraycopy(oldArray, 0, newArray, 0, readPos+1);
}
@@ -374,13 +374,13 @@ public class LFRingbuffer<T> implements Ringbuffer<T> {
if( tail > 0 ) {
System.arraycopy(oldArray, readPos+1, newArray, writePos+1, tail);
}
- size = growAmount;
-
+ size = growAmount;
+
capacityPlusOne = newCapacity;
array = newArray;
}
}
-
+
@Override
public final void growFullBuffer(final int growAmount) throws IllegalStateException, IllegalArgumentException {
synchronized ( syncGlobal ) {
@@ -389,7 +389,7 @@ public class LFRingbuffer<T> implements Ringbuffer<T> {
}
if( capacityPlusOne-1 != size ) {
throw new IllegalStateException("Buffer is not full: "+this);
- }
+ }
final int wp1 = ( writePos + 1 ) % capacityPlusOne;
if( wp1 != readPos ) {
throw new InternalError("R != W+1 pos at full: "+this);
@@ -400,10 +400,10 @@ public class LFRingbuffer<T> implements Ringbuffer<T> {
final int newCapacity = capacityPlusOne + growAmount;
final T[] oldArray = array;
final T[] newArray = (T[]) newArray(arrayTypeInternal, newCapacity);
-
+
// writePos == readPos - 1
readPos = ( writePos + 1 + growAmount ) % newCapacity; // warp readPos to the end of the new data location
-
+
if(writePos >= 0) {
System.arraycopy(oldArray, 0, newArray, 0, writePos+1);
}
@@ -411,12 +411,12 @@ public class LFRingbuffer<T> implements Ringbuffer<T> {
if( tail > 0 ) {
System.arraycopy(oldArray, writePos+1, newArray, readPos, tail);
}
-
+
capacityPlusOne = newCapacity;
array = newArray;
}
}
-
+
@SuppressWarnings("unchecked")
private static <T> T[] newArray(Class<? extends T[]> arrayType, int length) {
return ((Object)arrayType == (Object)Object[].class)
diff --git a/src/java/com/jogamp/common/util/PrimitiveStack.java b/src/java/com/jogamp/common/util/PrimitiveStack.java
index 89ae72e..e357e4a 100644
--- a/src/java/com/jogamp/common/util/PrimitiveStack.java
+++ b/src/java/com/jogamp/common/util/PrimitiveStack.java
@@ -31,50 +31,50 @@ package com.jogamp.common.util;
* Simple primitive-type stack.
*/
public interface PrimitiveStack {
-
- /**
+
+ /**
* Returns this stack's current capacity.
* <p>
* The capacity may grow with a put operation w/ insufficient {@link #remaining()} elements left, if {@link #getGrowSize()} &gt; 0.
- * </p>
+ * </p>
*/
int capacity();
-
- /**
+
+ /**
* Returns the current position of this stack.
* <p>
- * Position is in the range: 0 &le; position &lt; {@link #capacity()}.
+ * Position is in the range: 0 &le; position &lt; {@link #capacity()}.
* </p>
* <p>
* The position equals to the number of elements stored.
* </p>
**/
int position();
-
+
/**
* Sets the position of this stack.
- *
+ *
* @param newPosition the new position
* @throws IndexOutOfBoundsException if <code>newPosition</code> is outside of range: 0 &le; position &lt; {@link #capacity()}.
*/
void position(int newPosition) throws IndexOutOfBoundsException;
-
- /**
+
+ /**
* Returns the remaining elements left before stack will grow about {@link #getGrowSize()}.
* <pre>
* remaining := capacity() - position();
* </pre>
- * <p>
+ * <p>
* 0 denotes a full stack.
- * </p>
+ * </p>
* @see #capacity()
* @see #position()
**/
int remaining();
-
+
/** Returns the grow size. A stack grows by this size in case a put operation exceeds it's {@link #capacity()}. */
int getGrowSize();
/** Set new {@link #growSize(). */
- void setGrowSize(int newGrowSize);
+ void setGrowSize(int newGrowSize);
}
diff --git a/src/java/com/jogamp/common/util/PropertyAccess.java b/src/java/com/jogamp/common/util/PropertyAccess.java
index fdb2665..5a8f082 100644
--- a/src/java/com/jogamp/common/util/PropertyAccess.java
+++ b/src/java/com/jogamp/common/util/PropertyAccess.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -38,32 +38,32 @@ public class PropertyAccess {
public static final String jnlp_prefix = "jnlp." ;
/** trusted build-in property prefix 'javaws.' */
public static final String javaws_prefix = "javaws.";
-
+
static final HashSet<String> trustedPrefixes;
static final HashSet<String> trusted;
-
+
static {
trustedPrefixes = new HashSet<String>();
trustedPrefixes.add(javaws_prefix);
trustedPrefixes.add(jnlp_prefix);
// 'jogamp.' and maybe other trusted prefixes will be added later via 'addTrustedPrefix()'
-
+
trusted = new HashSet<String>();
trusted.add("sun.java2d.opengl");
trusted.add("sun.java2d.noddraw");
trusted.add("sun.java2d.d3d");
trusted.add("sun.awt.noerasebackground");
}
-
+
/**
* @param prefix New prefix to be registered as trusted.
- * @throws AccessControlException as thrown by {@link SecurityUtil#checkAllPermissions()}.
+ * @throws AccessControlException as thrown by {@link SecurityUtil#checkAllPermissions()}.
*/
protected static final void addTrustedPrefix(String prefix) throws AccessControlException {
SecurityUtil.checkAllPermissions();
trustedPrefixes.add(prefix);
}
-
+
public static final boolean isTrusted(String propertyKey) {
final int dot1 = propertyKey.indexOf('.');
if(0<=dot1) {
@@ -72,7 +72,7 @@ public class PropertyAccess {
return false;
}
}
-
+
/** @see #getProperty(String, boolean) */
public static final int getIntProperty(final String property, final boolean jnlpAlias, int defaultValue) {
int i=defaultValue;
@@ -120,22 +120,22 @@ public class PropertyAccess {
* Query the property with the name <code>propertyKey</code>.
* <p>
* If <code>jnlpAlias</code> is <code>true</code> and the plain <code>propertyKey</code>
- * could not be resolved, an attempt to resolve the JNLP aliased <i>trusted property</i> is made.<br>
+ * could not be resolved, an attempt to resolve the JNLP aliased <i>trusted property</i> is made.<br>
* Example: For the propertyName <code>OneTwo</code>, the jnlp alias name is <code>jnlp.OneTwo</code>, which is considered trusted.<br>
* </p>
- *
- * @param propertyKey the property name to query.
+ *
+ * @param propertyKey the property name to query.
* @param jnlpAlias true if a fallback attempt to query the JNLP aliased <i>trusted property</i> shall be made,
* otherwise false.
* @return the property value if exists, or null
- *
+ *
* @throws NullPointerException if the property name is null
* @throws IllegalArgumentException if the property name is of length 0
* @throws SecurityException if access is not allowed to the given <code>propertyKey</code>
- *
+ *
* @see System#getProperty(String)
*/
- public static final String getProperty(final String propertyKey, final boolean jnlpAlias)
+ public static final String getProperty(final String propertyKey, final boolean jnlpAlias)
throws SecurityException, NullPointerException, IllegalArgumentException {
if(null == propertyKey) {
throw new NullPointerException("propertyKey is NULL");
@@ -144,14 +144,14 @@ public class PropertyAccess {
throw new IllegalArgumentException("propertyKey is empty");
}
String s=null;
-
+
if( isTrusted(propertyKey) ) {
// 'trusted' property (jnlp., javaws., jogamp., ..)
s = getTrustedPropKey(propertyKey);
} else {
// may throw SecurityException, AccessControlerException
s = System.getProperty(propertyKey);
- }
+ }
if( null == s && jnlpAlias ) {
// Try 'jnlp.' aliased property ..
if( !propertyKey.startsWith(jnlp_prefix) ) {
@@ -162,9 +162,9 @@ public class PropertyAccess {
}
return s;
}
-
+
/** See {@link #getProperty(String, boolean)}, additionally allows a <code>defaultValue</code> if property value is <code>null</code>. */
- public static final String getProperty(final String propertyKey, final boolean jnlpAlias, String defaultValue)
+ public static final String getProperty(final String propertyKey, final boolean jnlpAlias, String defaultValue)
throws SecurityException, NullPointerException, IllegalArgumentException {
final String s = PropertyAccess.getProperty(propertyKey, jnlpAlias);
if( null != s ) {
@@ -173,7 +173,7 @@ public class PropertyAccess {
return defaultValue;
}
}
-
+
private static final String getTrustedPropKey(final String propertyKey) {
return AccessController.doPrivileged(new PrivilegedAction<String>() {
public String run() {
@@ -183,6 +183,6 @@ public class PropertyAccess {
throw new SecurityException("Could not access trusted property '"+propertyKey+"'", se);
}
}
- });
+ });
}
}
diff --git a/src/java/com/jogamp/common/util/ReflectionUtil.java b/src/java/com/jogamp/common/util/ReflectionUtil.java
index 8b9476f..598b8b1 100644
--- a/src/java/com/jogamp/common/util/ReflectionUtil.java
+++ b/src/java/com/jogamp/common/util/ReflectionUtil.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. 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
@@ -29,7 +29,7 @@
* 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.
@@ -43,7 +43,7 @@ import com.jogamp.common.JogampRuntimeException;
import jogamp.common.Debug;
public final class ReflectionUtil {
-
+
public static final boolean DEBUG = Debug.debug("ReflectionUtil");
public static class AWTNames {
@@ -112,16 +112,16 @@ public final class ReflectionUtil {
* Returns a compatible constructor
* if available, otherwise throws an exception.
* <p>
- * It first attempts to get the specific Constructor
- * using the given <code>cstrArgTypes</code>.
+ * It first attempts to get the specific Constructor
+ * using the given <code>cstrArgTypes</code>.
* If this fails w/ <code>NoSuchMethodException</code>, a compatible
* Constructor is being looked-up w/ with parameter types assignable
* from the given <code>cstrArgs</code>.
- * </p>
- *
+ * </p>
+ *
* @throws JogampRuntimeException if the constructor can not be delivered.
*/
- public static final Constructor<?> getConstructor(Class<?> clazz, Class<?> ... cstrArgTypes)
+ public static final Constructor<?> getConstructor(Class<?> clazz, Class<?> ... cstrArgTypes)
throws JogampRuntimeException {
if(null == cstrArgTypes) {
cstrArgTypes = zeroTypes;
@@ -147,13 +147,13 @@ public final class ReflectionUtil {
if(types.length == j) {
cstr = c; // gotcha
}
- }
+ }
}
}
if(null == cstr) {
throw new JogampRuntimeException("Constructor: '" + clazz.getName() + "(" + asString(cstrArgTypes) + ")' not found");
}
- return cstr;
+ return cstr;
}
public static final Constructor<?> getConstructor(String clazzName, ClassLoader cl)
@@ -164,7 +164,7 @@ public final class ReflectionUtil {
/**
* @throws JogampRuntimeException if the instance can not be created.
*/
- public static final Object createInstance(Constructor<?> cstr, Object ... cstrArgs)
+ public static final Object createInstance(Constructor<?> cstr, Object ... cstrArgs)
throws JogampRuntimeException, RuntimeException
{
try {
@@ -183,17 +183,17 @@ public final class ReflectionUtil {
throw new JogampRuntimeException("can not create instance of "+cstr.getName(), t);
}
}
-
+
/**
* @throws JogampRuntimeException if the instance can not be created.
*/
- public static final Object createInstance(Class<?> clazz, Class<?>[] cstrArgTypes, Object ... cstrArgs)
+ public static final Object createInstance(Class<?> clazz, Class<?>[] cstrArgTypes, Object ... cstrArgs)
throws JogampRuntimeException, RuntimeException
{
return createInstance(getConstructor(clazz, cstrArgTypes), cstrArgs);
}
- public static final Object createInstance(Class<?> clazz, Object ... cstrArgs)
+ public static final Object createInstance(Class<?> clazz, Object ... cstrArgs)
throws JogampRuntimeException, RuntimeException
{
Class<?>[] cstrArgTypes = null;
@@ -206,7 +206,7 @@ public final class ReflectionUtil {
return createInstance(clazz, cstrArgTypes, cstrArgs);
}
- public static final Object createInstance(String clazzName, Class<?>[] cstrArgTypes, Object[] cstrArgs, ClassLoader cl)
+ public static final Object createInstance(String clazzName, Class<?>[] cstrArgTypes, Object[] cstrArgs, ClassLoader cl)
throws JogampRuntimeException, RuntimeException
{
try {
@@ -216,7 +216,7 @@ public final class ReflectionUtil {
}
}
- public static final Object createInstance(String clazzName, Object[] cstrArgs, ClassLoader cl)
+ public static final Object createInstance(String clazzName, Object[] cstrArgs, ClassLoader cl)
throws JogampRuntimeException, RuntimeException
{
Class<?>[] cstrArgTypes = null;
@@ -345,24 +345,24 @@ public final class ReflectionUtil {
}
/** Convenient Method access class */
- public static class MethodAccessor {
+ public static class MethodAccessor {
Method m = null;
-
+
/** Check {@link #available()} before using instance. */
public MethodAccessor(Class<?> clazz, String methodName, Class<?> ... argTypes) {
try {
m = ReflectionUtil.getMethod(clazz, methodName, argTypes);
} catch (JogampRuntimeException jre) { /* method n/a */ }
}
-
+
/** Returns true if method is available, otherwise false. */
public boolean available() {
return null != m;
}
-
- /**
+
+ /**
* Check {@link #available()} before calling to avoid throwing a JogampRuntimeException.
- * @throws JogampRuntimeException if method is not available
+ * @throws JogampRuntimeException if method is not available
*/
public Object callMethod(Object instance, Object ... args) {
if(null == m) {
@@ -371,6 +371,6 @@ public final class ReflectionUtil {
return ReflectionUtil.callMethod(instance, m, args);
}
}
-
+
}
diff --git a/src/java/com/jogamp/common/util/Ringbuffer.java b/src/java/com/jogamp/common/util/Ringbuffer.java
index e524768..7faf5dd 100644
--- a/src/java/com/jogamp/common/util/Ringbuffer.java
+++ b/src/java/com/jogamp/common/util/Ringbuffer.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -29,7 +29,7 @@ package com.jogamp.common.util;
import java.io.PrintStream;
-/**
+/**
* Ring buffer interface, a.k.a circular buffer.
* <p>
* Caller can chose whether to block until get / put is able to proceed or not.
@@ -39,26 +39,26 @@ import java.io.PrintStream;
* or using a preset array for circular access of same objects.
* </p>
* <p>
- * Synchronization and hence thread safety details belong to the implementation.
+ * Synchronization and hence thread safety details belong to the implementation.
* </p>
*/
public interface Ringbuffer<T> {
-
- /** Returns a short string representation incl. size/capacity and internal r/w index (impl. dependent). */
+
+ /** Returns a short string representation incl. size/capacity and internal r/w index (impl. dependent). */
public String toString();
/** Debug functionality - Dumps the contents of the internal array. */
public void dump(PrintStream stream, String prefix);
- /**
+ /**
* Returns the internal array as-is, i.e. w/o a copy.
* <p>
* The layout and size of the internal array is implementation dependent.
- * </p>
+ * </p>
* <p>
* Users shall not modify or rely on the returned array.
- * </p>
- * @deprecated This method should not be required
+ * </p>
+ * @deprecated This method should not be required
*/
public T[] getInternalArray();
@@ -66,7 +66,7 @@ public interface Ringbuffer<T> {
public int capacity();
/**
- * Resets the read and write position according to an empty ring buffer
+ * Resets the read and write position according to an empty ring buffer
* and set all ring buffer slots to <code>null</code>.
* <p>
* {@link #isEmpty()} will return <code>true</code> after calling this method.
@@ -75,14 +75,14 @@ public interface Ringbuffer<T> {
public void clear();
/**
- * Resets the read and write position according to a full ring buffer
+ * Resets the read and write position according to a full ring buffer
* and fill all slots w/ elements of array <code>copyFrom</code>.
* <p>
- * Array's <code>copyFrom</code> elements will be copied into the internal array,
+ * Array's <code>copyFrom</code> elements will be copied into the internal array,
* hence it's length must be equal to {@link #capacity()}.
* </p>
* @param copyFrom Mandatory array w/ length {@link #capacity()} to be copied into the internal array.
- * @throws IllegalArgumentException if <code>copyFrom</code> is <code>null</code>.
+ * @throws IllegalArgumentException if <code>copyFrom</code> is <code>null</code>.
* @throws IllegalArgumentException if <code>copyFrom</code>'s length is different from {@link #capacity()}.
*/
public void resetFull(T[] copyFrom) throws IllegalArgumentException;
@@ -108,7 +108,7 @@ public interface Ringbuffer<T> {
* <p>
* Method is non blocking and returns immediately;.
* </p>
- * @return the oldest put element if available, otherwise null.
+ * @return the oldest put element if available, otherwise null.
*/
public T get();
@@ -121,24 +121,24 @@ public interface Ringbuffer<T> {
* <p>
* Methods blocks until an element becomes available via put.
* </p>
- * @return the oldest put element
- * @throws InterruptedException
+ * @return the oldest put element
+ * @throws InterruptedException
*/
public T getBlocking() throws InterruptedException;
- /**
+ /**
* Peeks the next element at the read position w/o modifying pointer, nor blocking.
* @return <code>null</code> if empty, otherwise the element which would be read next.
*/
public T peek();
- /**
+ /**
* Peeks the next element at the read position w/o modifying pointer, but w/ blocking.
* @return <code>null</code> if empty, otherwise the element which would be read next.
*/
public T peekBlocking() throws InterruptedException;
- /**
+ /**
* Enqueues the given element.
* <p>
* Returns true if successful, otherwise false in case buffer is full.
@@ -149,16 +149,16 @@ public interface Ringbuffer<T> {
*/
public boolean put(T e);
- /**
+ /**
* Enqueues the given element.
* <p>
* Method blocks until a free slot becomes available via get.
* </p>
- * @throws InterruptedException
+ * @throws InterruptedException
*/
public void putBlocking(T e) throws InterruptedException;
- /**
+ /**
* Enqueues the same element at it's write position, if not full.
* <p>
* Returns true if successful, otherwise false in case buffer is full.
@@ -167,7 +167,7 @@ public interface Ringbuffer<T> {
* If <code>blocking</code> is true, method blocks until a free slot becomes available via get.
* </p>
* @param blocking if true, wait until a free slot becomes available via get.
- * @throws InterruptedException
+ * @throws InterruptedException
*/
public boolean putSame(boolean blocking) throws InterruptedException;
@@ -183,13 +183,13 @@ public interface Ringbuffer<T> {
* Growing an empty ring buffer increases it's size about the amount, i.e. renders it not empty.
* The new elements are inserted at the read position, able to be read out via {@link #get()} etc.
* </p>
- *
+ *
* @param newElements array of new full elements the empty buffer shall grow about.
* @throws IllegalStateException if buffer is not empty
* @throws IllegalArgumentException if newElements is null
*/
public void growEmptyBuffer(T[] newElements) throws IllegalStateException, IllegalArgumentException;
-
+
/**
* Grows a full ring buffer, increasing it's capacity about the amount.
* <p>
@@ -197,7 +197,7 @@ public interface Ringbuffer<T> {
* New <code>null</code> elements are inserted at the write position, able to be written to via {@link #put(Object)} etc.
* </p>
* @param amount the amount of elements the buffer shall grow about
- *
+ *
* @throws IllegalStateException if buffer is not full
* @throws IllegalArgumentException if amount is < 0
*/
diff --git a/src/java/com/jogamp/common/util/RunnableExecutor.java b/src/java/com/jogamp/common/util/RunnableExecutor.java
index 7bf9685..629bc8c 100644
--- a/src/java/com/jogamp/common/util/RunnableExecutor.java
+++ b/src/java/com/jogamp/common/util/RunnableExecutor.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -28,23 +28,23 @@
package com.jogamp.common.util;
public interface RunnableExecutor {
- /** This {@link RunnableExecutor} implementation simply invokes {@link Runnable#run()}
+ /** This {@link RunnableExecutor} implementation simply invokes {@link Runnable#run()}
* on the current thread.
*/
public static final RunnableExecutor currentThreadExecutor = new CurrentThreadExecutor();
-
+
/**
- * @param wait if true method waits until {@link Runnable#run()} is completed, otherwise don't wait.
+ * @param wait if true method waits until {@link Runnable#run()} is completed, otherwise don't wait.
* @param r the {@link Runnable} to be executed.
*/
void invoke(boolean wait, Runnable r);
-
+
static class CurrentThreadExecutor implements RunnableExecutor {
private CurrentThreadExecutor() {}
-
+
@Override
public void invoke(boolean wait, Runnable r) {
- r.run();
- }
+ r.run();
+ }
}
}
diff --git a/src/java/com/jogamp/common/util/RunnableTask.java b/src/java/com/jogamp/common/util/RunnableTask.java
index c18556b..1db4810 100644
--- a/src/java/com/jogamp/common/util/RunnableTask.java
+++ b/src/java/com/jogamp/common/util/RunnableTask.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.common.util;
import java.io.PrintStream;
@@ -39,13 +39,13 @@ public class RunnableTask extends TaskBase {
/**
* Invoks <code>runnable</code>.
- * @param waitUntilDone if <code>true</code>, waits until <code>runnable</code> execution is completed, otherwise returns immediately.
+ * @param waitUntilDone if <code>true</code>, waits until <code>runnable</code> execution is completed, otherwise returns immediately.
* @param runnable the {@link Runnable} to execute.
*/
public static void invoke(boolean waitUntilDone, Runnable runnable) {
Throwable throwable = null;
final Object sync = new Object();
- final RunnableTask rt = new RunnableTask( runnable, waitUntilDone ? sync : null, true, waitUntilDone ? null : System.err );
+ final RunnableTask rt = new RunnableTask( runnable, waitUntilDone ? sync : null, true, waitUntilDone ? null : System.err );
synchronized(sync) {
rt.run();
if( waitUntilDone ) {
@@ -63,14 +63,14 @@ public class RunnableTask extends TaskBase {
}
}
}
-
+
/**
* Create a RunnableTask object w/ synchronization,
- * ie. suitable for <code>invokeAndWait()</code>, i.e. {@link #invoke(boolean, Runnable) invoke(true, runnable)}.
- *
+ * ie. suitable for <code>invokeAndWait()</code>, i.e. {@link #invoke(boolean, Runnable) invoke(true, runnable)}.
+ *
* @param runnable The user action
* @param syncObject The synchronization object if caller wait until <code>runnable</code> execution is completed,
- * or <code>null</code> if waiting is not desired.
+ * or <code>null</code> if waiting is not desired.
* @param catchExceptions Influence an occurring exception during <code>runnable</code> execution.
* If <code>true</code>, the exception is silenced and can be retrieved via {@link #getThrowable()},
* otherwise the exception is thrown.
@@ -79,7 +79,7 @@ public class RunnableTask extends TaskBase {
public RunnableTask(Runnable runnable, Object syncObject, boolean catchExceptions, PrintStream exceptionOut) {
super(syncObject, catchExceptions, exceptionOut);
this.runnable = runnable ;
- }
+ }
/** Return the user action */
public final Runnable getRunnable() {
@@ -104,7 +104,7 @@ public class RunnableTask extends TaskBase {
throw new RuntimeException(runnableException);
}
} finally {
- tExecuted = System.currentTimeMillis();
+ tExecuted = System.currentTimeMillis();
}
} else {
synchronized (syncObject) {
@@ -125,7 +125,7 @@ public class RunnableTask extends TaskBase {
syncObject.notifyAll();
}
}
- }
- }
+ }
+ }
}
diff --git a/src/java/com/jogamp/common/util/SecurityUtil.java b/src/java/com/jogamp/common/util/SecurityUtil.java
index 6b35c9c..742de84 100644
--- a/src/java/com/jogamp/common/util/SecurityUtil.java
+++ b/src/java/com/jogamp/common/util/SecurityUtil.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -39,11 +39,11 @@ public class SecurityUtil {
private static final SecurityManager securityManager;
private static final Permission allPermissions;
private static final boolean DEBUG = false;
-
+
static {
allPermissions = new AllPermission();
securityManager = System.getSecurityManager();
-
+
if( DEBUG ) {
final boolean hasAllPermissions;
{
@@ -55,12 +55,12 @@ public class SecurityUtil {
try {
insecPD.implies(allPermissions);
_hasAllPermissions = true;
- } catch( SecurityException ace ) {
+ } catch( SecurityException ace ) {
_hasAllPermissions = false;
}
hasAllPermissions = _hasAllPermissions;
}
-
+
System.err.println("SecurityUtil: Has SecurityManager: "+ ( null != securityManager ) ) ;
System.err.println("SecurityUtil: Has AllPermissions: "+hasAllPermissions);
final Certificate[] certs = AccessController.doPrivileged(new PrivilegedAction<Certificate[]>() {
@@ -75,7 +75,7 @@ public class SecurityUtil {
}
}
}
-
+
/**
* Returns <code>true</code> if no {@link SecurityManager} has been installed
* or the installed {@link SecurityManager}'s <code>checkPermission(new AllPermission())</code>
@@ -84,7 +84,7 @@ public class SecurityUtil {
public static final boolean hasAllPermissions() {
return hasPermission(allPermissions);
}
-
+
/**
* Returns <code>true</code> if no {@link SecurityManager} has been installed
* or the installed {@link SecurityManager}'s <code>checkPermission(perm)</code>
@@ -94,11 +94,11 @@ public class SecurityUtil {
try {
checkPermission(perm);
return true;
- } catch( SecurityException ace ) {
+ } catch( SecurityException ace ) {
return false;
}
}
-
+
/**
* Throws an {@link SecurityException} if an installed {@link SecurityManager}
* does not permit the requested {@link AllPermission}.
@@ -106,7 +106,7 @@ public class SecurityUtil {
public static final void checkAllPermissions() throws SecurityException {
checkPermission(allPermissions);
}
-
+
/**
* Throws an {@link SecurityException} if an installed {@link SecurityManager}
* does not permit the requested {@link Permission}.
@@ -116,7 +116,7 @@ public class SecurityUtil {
securityManager.checkPermission(perm);
}
}
-
+
/**
* Returns <code>true</code> if no {@link SecurityManager} has been installed
* or the installed {@link SecurityManager}'s <code>checkLink(libName)</code>
@@ -126,11 +126,11 @@ public class SecurityUtil {
try {
checkLinkPermission(libName);
return true;
- } catch( SecurityException ace ) {
+ } catch( SecurityException ace ) {
return false;
}
}
-
+
/**
* Throws an {@link SecurityException} if an installed {@link SecurityManager}
* does not permit to dynamically link the given libName.
@@ -140,7 +140,7 @@ public class SecurityUtil {
securityManager.checkLink(libName);
}
}
-
+
/**
* Throws an {@link SecurityException} if an installed {@link SecurityManager}
* does not permit to dynamically link to all libraries.
@@ -151,7 +151,7 @@ public class SecurityUtil {
}
}
private static final RuntimePermission allLinkPermission = new RuntimePermission("loadLibrary.*");
-
+
/**
* @param clz
* @return
@@ -163,7 +163,7 @@ public class SecurityUtil {
final Certificate[] certs = (null != cs) ? cs.getCertificates() : null;
return (null != certs && certs.length>0) ? certs : null;
}
-
+
public static final boolean equals(Certificate[] a, Certificate[] b) {
if(a == b) {
return true;
@@ -174,11 +174,11 @@ public class SecurityUtil {
if(a.length != b.length) {
return false;
}
-
+
int i = 0;
while( i < a.length && a[i].equals(b[i]) ) {
i++;
- }
+ }
return i == a.length;
- }
+ }
}
diff --git a/src/java/com/jogamp/common/util/SyncedRingbuffer.java b/src/java/com/jogamp/common/util/SyncedRingbuffer.java
index 747629b..8ef2970 100644
--- a/src/java/com/jogamp/common/util/SyncedRingbuffer.java
+++ b/src/java/com/jogamp/common/util/SyncedRingbuffer.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -31,7 +31,7 @@ package com.jogamp.common.util;
import java.io.PrintStream;
import java.lang.reflect.Array;
-/**
+/**
* Simple synchronized implementation of {@link Ringbuffer}.
* <p>
* All methods utilize global synchronization.
@@ -56,12 +56,12 @@ public class SyncedRingbuffer<T> implements Ringbuffer<T> {
private int readPos;
private int writePos;
private int size;
-
+
@Override
public final String toString() {
return "SyncedRingbuffer<?>[filled "+size+" / "+capacity+", writePos "+writePos+", readPos "+readPos+"]";
}
-
+
@Override
public final void dump(PrintStream stream, String prefix) {
stream.println(prefix+" "+toString()+" {");
@@ -70,10 +70,10 @@ public class SyncedRingbuffer<T> implements Ringbuffer<T> {
}
stream.println("}");
}
-
- /**
+
+ /**
* Create a full ring buffer instance w/ the given array's net capacity and content.
- * <p>
+ * <p>
* Example for a 10 element Integer array:
* <pre>
* Integer[] source = new Integer[10];
@@ -89,7 +89,7 @@ public class SyncedRingbuffer<T> implements Ringbuffer<T> {
* and copy all elements from array <code>copyFrom</code> into the internal array.
* </p>
* @param copyFrom mandatory source array determining ring buffer's net {@link #capacity()} and initial content.
- * @throws IllegalArgumentException if <code>copyFrom</code> is <code>null</code>
+ * @throws IllegalArgumentException if <code>copyFrom</code> is <code>null</code>
*/
@SuppressWarnings("unchecked")
public SyncedRingbuffer(T[] copyFrom) throws IllegalArgumentException {
@@ -97,10 +97,10 @@ public class SyncedRingbuffer<T> implements Ringbuffer<T> {
array = (T[]) newArray(copyFrom.getClass(), capacity);
resetImpl(true, copyFrom);
}
-
- /**
+
+ /**
* Create an empty ring buffer instance w/ the given net <code>capacity</code>.
- * <p>
+ * <p>
* Example for a 10 element Integer array:
* <pre>
* Ringbuffer<Integer> rb = new SyncedRingbuffer<Integer>(10, Integer[].class);
@@ -120,13 +120,13 @@ public class SyncedRingbuffer<T> implements Ringbuffer<T> {
this.array = (T[]) newArray(arrayType, capacity);
resetImpl(false, null /* empty, nothing to copy */ );
}
-
+
@Override
public final T[] getInternalArray() { return array; }
-
+
@Override
public final int capacity() { return capacity; }
-
+
/**
* {@inheritDoc}
* <p>
@@ -142,12 +142,12 @@ public class SyncedRingbuffer<T> implements Ringbuffer<T> {
}
}
}
-
+
@Override
public final void resetFull(T[] copyFrom) throws IllegalArgumentException {
resetImpl(true, copyFrom);
}
-
+
private final void resetImpl(boolean full, T[] copyFrom) throws IllegalArgumentException {
synchronized ( syncGlobal ) {
if( null != copyFrom ) {
@@ -163,14 +163,14 @@ public class SyncedRingbuffer<T> implements Ringbuffer<T> {
size = full ? capacity : 0;
}
}
-
+
@Override
public final int size() {
synchronized ( syncGlobal ) {
return size;
}
}
-
+
@Override
public final int getFreeSlots() {
synchronized ( syncGlobal ) {
@@ -184,14 +184,14 @@ public class SyncedRingbuffer<T> implements Ringbuffer<T> {
return 0 == size;
}
}
-
+
@Override
public final boolean isFull() {
synchronized ( syncGlobal ) {
return capacity == size;
}
}
-
+
/**
* {@inheritDoc}
* <p>
@@ -215,7 +215,7 @@ public class SyncedRingbuffer<T> implements Ringbuffer<T> {
public final T getBlocking() throws InterruptedException {
return getImpl(true, false);
}
-
+
@Override
public final T peek() {
try {
@@ -226,9 +226,9 @@ public class SyncedRingbuffer<T> implements Ringbuffer<T> {
public final T peekBlocking() throws InterruptedException {
return getImpl(true, true);
}
-
+
private final T getImpl(boolean blocking, boolean peek) throws InterruptedException {
- synchronized( syncGlobal ) {
+ synchronized( syncGlobal ) {
if( 0 == size ) {
if( blocking ) {
while( 0 == size ) {
@@ -249,8 +249,8 @@ public class SyncedRingbuffer<T> implements Ringbuffer<T> {
return r;
}
}
-
- /**
+
+ /**
* {@inheritDoc}
* <p>
* Implementation stores the element at the current write position and advances it, if not full.
@@ -262,8 +262,8 @@ public class SyncedRingbuffer<T> implements Ringbuffer<T> {
return putImpl(e, false, false);
} catch (InterruptedException ie) { throw new RuntimeException(ie); }
}
-
- /**
+
+ /**
* {@inheritDoc}
* <p>
* Implementation stores the element at the current write position and advances it, if not full.
@@ -275,8 +275,8 @@ public class SyncedRingbuffer<T> implements Ringbuffer<T> {
throw new InternalError("Blocking put failed: "+this);
}
}
-
- /**
+
+ /**
* {@inheritDoc}
* <p>
* Implementation keeps the element at the current write position and advances it, if not full.
@@ -286,9 +286,9 @@ public class SyncedRingbuffer<T> implements Ringbuffer<T> {
public final boolean putSame(boolean blocking) throws InterruptedException {
return putImpl(null, true, blocking);
}
-
+
private final boolean putImpl(T e, boolean sameRef, boolean blocking) throws InterruptedException {
- synchronized( syncGlobal ) {
+ synchronized( syncGlobal ) {
if( capacity == size ) {
if( blocking ) {
while( capacity == size ) {
@@ -308,7 +308,7 @@ public class SyncedRingbuffer<T> implements Ringbuffer<T> {
return true;
}
}
-
+
@Override
public final void waitForFreeSlots(int count) throws InterruptedException {
synchronized ( syncGlobal ) {
@@ -319,8 +319,8 @@ public class SyncedRingbuffer<T> implements Ringbuffer<T> {
}
}
}
-
-
+
+
@Override
public final void growEmptyBuffer(final T[] newElements) throws IllegalStateException, IllegalArgumentException {
synchronized ( syncGlobal ) {
@@ -340,15 +340,15 @@ public class SyncedRingbuffer<T> implements Ringbuffer<T> {
if( readPos != writePos ) {
throw new InternalError("R/W pos not equal: "+this);
}
-
+
final int growAmount = newElements.length;
final int newCapacity = capacity + growAmount;
final T[] oldArray = array;
final T[] newArray = (T[]) newArray(arrayTypeInternal, newCapacity);
-
+
// writePos == readPos
writePos += growAmount; // warp writePos to the end of the new data location
-
+
if( readPos > 0 ) {
System.arraycopy(oldArray, 0, newArray, 0, readPos);
}
@@ -360,12 +360,12 @@ public class SyncedRingbuffer<T> implements Ringbuffer<T> {
System.arraycopy(oldArray, readPos, newArray, writePos, tail);
}
size = growAmount;
-
+
capacity = newCapacity;
array = newArray;
}
}
-
+
@Override
public final void growFullBuffer(final int growAmount) throws IllegalStateException, IllegalArgumentException {
synchronized ( syncGlobal ) {
@@ -374,7 +374,7 @@ public class SyncedRingbuffer<T> implements Ringbuffer<T> {
}
if( capacity != size ) {
throw new IllegalStateException("Buffer is not full: "+this);
- }
+ }
if( readPos != writePos ) {
throw new InternalError("R/W pos not equal: "+this);
}
@@ -384,10 +384,10 @@ public class SyncedRingbuffer<T> implements Ringbuffer<T> {
final int newCapacity = capacity + growAmount;
final T[] oldArray = array;
final T[] newArray = (T[]) newArray(arrayTypeInternal, newCapacity);
-
+
// writePos == readPos
readPos += growAmount; // warp readPos to the end of the new data location
-
+
if(writePos > 0) {
System.arraycopy(oldArray, 0, newArray, 0, writePos);
}
@@ -395,12 +395,12 @@ public class SyncedRingbuffer<T> implements Ringbuffer<T> {
if( tail > 0 ) {
System.arraycopy(oldArray, writePos, newArray, readPos, tail);
}
-
+
capacity = newCapacity;
array = newArray;
}
}
-
+
@SuppressWarnings("unchecked")
private static <T> T[] newArray(Class<? extends T[]> arrayType, int length) {
return ((Object)arrayType == (Object)Object[].class)
diff --git a/src/java/com/jogamp/common/util/TaskBase.java b/src/java/com/jogamp/common/util/TaskBase.java
index 35571e3..e76893d 100644
--- a/src/java/com/jogamp/common/util/TaskBase.java
+++ b/src/java/com/jogamp/common/util/TaskBase.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.common.util;
import java.io.PrintStream;
@@ -39,17 +39,17 @@ import jogamp.common.Debug;
public abstract class TaskBase implements Runnable {
/** Enable via the property <code>jogamp.debug.TaskBase.TraceSource</code> */
private static final boolean TRACE_SOURCE;
-
+
static {
Debug.initSingleton();
TRACE_SOURCE = Debug.isPropertyDefined("jogamp.debug.TaskBase.TraceSource", true);
}
-
+
protected final Object syncObject;
protected final boolean catchExceptions;
- protected final PrintStream exceptionOut;
+ protected final PrintStream exceptionOut;
protected final Throwable sourceStack;
-
+
protected Object attachment;
protected Throwable runnableException;
protected long tCreated, tStarted;
@@ -66,7 +66,7 @@ public abstract class TaskBase implements Runnable {
tExecuted = 0;
isFlushed = false;
}
-
+
protected final String getExceptionOutIntro() {
return catchExceptions ? "A catched" : "An uncatched";
}
@@ -76,25 +76,25 @@ public abstract class TaskBase implements Runnable {
}
}
- /**
+ /**
* Return the synchronization object if any.
- * @see #RunnableTask(Runnable, Object, boolean)
+ * @see #RunnableTask(Runnable, Object, boolean)
*/
public final Object getSyncObject() {
return syncObject;
}
-
- /**
- * Attach a custom object to this task.
- * Useful to piggybag further information, ie tag a task final.
+
+ /**
+ * Attach a custom object to this task.
+ * Useful to piggybag further information, ie tag a task final.
*/
public final void setAttachment(Object o) {
attachment = o;
}
- /**
+ /**
* Return the attachment object if any.
- * @see #setAttachment(Object)
+ * @see #setAttachment(Object)
*/
public final Object getAttachment() {
return attachment;
@@ -102,20 +102,20 @@ public abstract class TaskBase implements Runnable {
@Override
public abstract void run();
-
- /**
+
+ /**
* Simply flush this task and notify a waiting executor.
* The executor which might have been blocked until notified
* will be unblocked and the task removed from the queue.
- *
+ *
* @see #isFlushed()
* @see #isInQueue()
- */
+ */
public final void flush() {
if(!isExecuted() && hasWaiter()) {
synchronized (syncObject) {
isFlushed = true;
- syncObject.notifyAll();
+ syncObject.notifyAll();
}
}
}
@@ -124,7 +124,7 @@ public abstract class TaskBase implements Runnable {
* @return !{@link #isExecuted()} && !{@link #isFlushed()}
*/
public final boolean isInQueue() { return 0 != tExecuted && !isFlushed; }
-
+
/**
* @return True if executed, otherwise false;
*/
@@ -136,7 +136,7 @@ public abstract class TaskBase implements Runnable {
public final boolean isFlushed() { return isFlushed; }
/**
- * @return True if invoking thread waits until done,
+ * @return True if invoking thread waits until done,
* ie a <code>notifyObject</code> was passed, otherwise false;
*/
public final boolean hasWaiter() { return null != syncObject; }
diff --git a/src/java/com/jogamp/common/util/ValueConv.java b/src/java/com/jogamp/common/util/ValueConv.java
index fa49341..9a16b64 100644
--- a/src/java/com/jogamp/common/util/ValueConv.java
+++ b/src/java/com/jogamp/common/util/ValueConv.java
@@ -5,14 +5,14 @@ package com.jogamp.common.util;
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -22,7 +22,7 @@ package com.jogamp.common.util;
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -51,7 +51,7 @@ public class ValueConv {
} else {
return (short) ( v * 65535.0f );
}
- }
+ }
public static final int float_to_int(float v, boolean dSigned) {
// float significand 0x007fffff
// double significand 0x000fffffffffffffL
@@ -63,7 +63,7 @@ public class ValueConv {
return (int) (long) ( v * 4294967295.0 );
}
}
-
+
public static final byte double_to_byte(double v, boolean dSigned) {
// lossy
if( dSigned ) {
@@ -88,27 +88,27 @@ public class ValueConv {
return (int) (long) ( v * 4294967295.0 );
}
}
-
+
public static final float byte_to_float(byte v, boolean sSigned) {
if( sSigned ) {
return (v & 0xff) / ( v > 0 ? 127.0f : -128.0f ) ;
} else {
return (v & 0xff) / 255.0f ;
- }
+ }
}
public static final double byte_to_double(byte v, boolean sSigned) {
if( sSigned ) {
return (v & 0xff) / ( v > 0 ? 127.0 : -128.0 ) ;
} else {
return (v & 0xff) / 255.0 ;
- }
- }
+ }
+ }
public static final float short_to_float(short v, boolean sSigned) {
if( sSigned ) {
return (v & 0xffff) / ( v > 0 ? 32767.0f : -32768.0f ) ;
} else {
return (v & 0xffff) / 65535.0f ;
- }
+ }
}
public static final double short_to_double(short v, boolean sSigned) {
// lossy
@@ -116,8 +116,8 @@ public class ValueConv {
return (v & 0xffff) / ( v > 0 ? 32767.0 : -32768.0 ) ;
} else {
return (v & 0xffff) / 65535.0 ;
- }
- }
+ }
+ }
public static final float int_to_float(int v, boolean sSigned) {
// lossy
// float significand 0x007fffff
@@ -128,30 +128,30 @@ public class ValueConv {
return (float) ( v / ( v > 0 ? 2147483647.0 : 2147483648.0 ) );
} else {
return (float) ( ((long)v & 0xffffffffL) / 4294967295.0 );
- }
+ }
}
public static final double int_to_double(int v, boolean sSigned) {
if( sSigned ) {
return v / ( v > 0 ? 2147483647.0 : 2147483648.0 ) ;
} else {
return ((long)v & 0xffffffffL) / 4294967295.0 ;
- }
+ }
}
-
+
public static final short byte_to_short(byte v, boolean sSigned, boolean dSigned) {
return float_to_short(byte_to_float(v, sSigned), dSigned);
}
public static final int byte_to_int(byte v, boolean sSigned, boolean dSigned) {
return float_to_int(byte_to_float(v, sSigned), dSigned);
}
-
+
public static final byte short_to_byte(short v, boolean sSigned, boolean dSigned) {
return float_to_byte(short_to_float(v, sSigned), dSigned);
}
public static final int short_to_int(short v, boolean sSigned, boolean dSigned) {
return float_to_int(short_to_float(v, sSigned), dSigned);
}
-
+
public static final byte int_to_byte(int v, boolean sSigned, boolean dSigned) {
return float_to_byte(int_to_float(v, sSigned), dSigned);
}
diff --git a/src/java/com/jogamp/common/util/VersionNumber.java b/src/java/com/jogamp/common/util/VersionNumber.java
index b1d8963..addc879 100644
--- a/src/java/com/jogamp/common/util/VersionNumber.java
+++ b/src/java/com/jogamp/common/util/VersionNumber.java
@@ -33,7 +33,7 @@ import java.util.regex.Matcher;
/**
* Simple version number class containing a version number
* either being {@link #VersionNumber(int, int, int) defined explicit}
- * or {@link #VersionNumber(String, String) derived from a string}.
+ * or {@link #VersionNumber(String, String) derived from a string}.
* <p>
* For the latter case, you can query whether a component has been defined explicitly by the given <code>versionString</code>,
* via {@link #hasMajor()}, {@link #hasMinor()} and {@link #hasSub()}.
@@ -46,45 +46,45 @@ import java.util.regex.Matcher;
*/
public class VersionNumber implements Comparable<Object> {
- /**
- * A {@link #isZero() zero} version instance, w/o any component defined explicitly.
+ /**
+ * A {@link #isZero() zero} version instance, w/o any component defined explicitly.
* @see #hasMajor()
* @see #hasMinor()
- * @see #hasSub()
+ * @see #hasSub()
*/
public static final VersionNumber zeroVersion = new VersionNumber(0, 0, 0, -1, (short)0);
-
+
/**
- * Returns the {@link java.util.regex.Pattern pattern}
- * with Perl regular expression:
+ * Returns the {@link java.util.regex.Pattern pattern}
+ * with Perl regular expression:
* <pre>
* "\\D*(\\d+)[^\\"+delim+"\\s]*(?:\\"+delim+"\\D*(\\d+)[^\\"+delim+"\\s]*(?:\\"+delim+"\\D*(\\d+))?)?"
* </pre>
* </p>
* <p>
- * A whitespace within the version number will end the parser.
+ * A whitespace within the version number will end the parser.
* </p>
* <p>
* Capture groups represent the major (1), optional minor (2) and optional sub version number (3) component in this order.
* </p>
* <p>
- * Each capture group ignores any leading non-digit and uses only contiguous digits, i.e. ignores pending non-digits.
+ * Each capture group ignores any leading non-digit and uses only contiguous digits, i.e. ignores pending non-digits.
* </p>
* @param delim the delimiter, e.g. "."
*/
public static java.util.regex.Pattern getVersionNumberPattern(String delim) {
return java.util.regex.Pattern.compile("\\D*(\\d+)[^\\"+delim+"\\s]*(?:\\"+delim+"\\D*(\\d+)[^\\"+delim+"\\s]*(?:\\"+delim+"\\D*(\\d+))?)?");
}
-
+
/**
- * Returns the default {@link java.util.regex.Pattern pattern} using {@link #getVersionNumberPattern(String)}
+ * Returns the default {@link java.util.regex.Pattern pattern} using {@link #getVersionNumberPattern(String)}
* with delimiter "<b>.</b>".
* <p>
* Instance is cached.
- * </p>
- */
+ * </p>
+ */
public static java.util.regex.Pattern getDefaultVersionNumberPattern() {
- if( null == defPattern ) { // volatile dbl-checked-locking OK
+ if( null == defPattern ) { // volatile dbl-checked-locking OK
synchronized( VersionNumber.class ) {
if( null == defPattern ) {
defPattern = getVersionNumberPattern(".");
@@ -96,7 +96,7 @@ public class VersionNumber implements Comparable<Object> {
private static volatile java.util.regex.Pattern defPattern = null;
protected final int major, minor, sub, strEnd;
-
+
protected final short state;
protected final static short HAS_MAJOR = 1 << 0 ;
protected final static short HAS_MINOR = 1 << 1 ;
@@ -109,12 +109,12 @@ public class VersionNumber implements Comparable<Object> {
strEnd = _strEnd;
state = _state;
}
-
- /**
+
+ /**
* Explicit version number instantiation, with all components defined explicitly.
* @see #hasMajor()
* @see #hasMinor()
- * @see #hasSub()
+ * @see #hasSub()
*/
public VersionNumber(int majorRev, int minorRev, int subMinorRev) {
this(majorRev, minorRev, subMinorRev, -1, (short)(HAS_MAJOR | HAS_MINOR | HAS_SUB));
@@ -124,41 +124,41 @@ public class VersionNumber implements Comparable<Object> {
* String derived version number instantiation.
* <p>
* Utilizing the default {@link java.util.regex.Pattern pattern} parser with delimiter "<b>.</b>", see {@link #getDefaultVersionNumberPattern()}.
- * </p>
+ * </p>
* <p>
* You can query whether a component has been defined explicitly by the given <code>versionString</code>,
* via {@link #hasMajor()}, {@link #hasMinor()} and {@link #hasSub()}.
* </p>
* @param versionString should be given as [MAJOR[.MINOR[.SUB]]]
- *
+ *
* @see #hasMajor()
* @see #hasMinor()
- * @see #hasSub()
+ * @see #hasSub()
*/
public VersionNumber(final String versionString) {
this(versionString, getDefaultVersionNumberPattern());
}
-
+
/**
* String derived version number instantiation.
* <p>
* Utilizing {@link java.util.regex.Pattern pattern} parser created via {@link #getVersionNumberPattern(String)}.
- * </p>
+ * </p>
* <p>
* You can query whether a component has been defined explicitly by the given <code>versionString</code>,
* via {@link #hasMajor()}, {@link #hasMinor()} and {@link #hasSub()}.
* </p>
* @param versionString should be given as [MAJOR[.MINOR[.SUB]]]
* @param delim the delimiter, e.g. "."
- *
+ *
* @see #hasMajor()
* @see #hasMinor()
- * @see #hasSub()
+ * @see #hasSub()
*/
public VersionNumber(final String versionString, final String delim) {
this(versionString, getVersionNumberPattern(delim));
}
-
+
/**
* String derived version number instantiation.
* <p>
@@ -167,10 +167,10 @@ public class VersionNumber implements Comparable<Object> {
* </p>
* @param versionString should be given as [MAJOR[.MINOR[.SUB]]]
* @param versionPattern the {@link java.util.regex.Pattern pattern} parser, must be compatible w/ {@link #getVersionNumberPattern(String)}
- *
+ *
* @see #hasMajor()
* @see #hasMinor()
- * @see #hasSub()
+ * @see #hasSub()
*/
public VersionNumber(final String versionString, final java.util.regex.Pattern versionPattern) {
// group1: \d* == digits major
@@ -198,32 +198,32 @@ public class VersionNumber implements Comparable<Object> {
}
}
} catch (Exception e) { }
-
+
major = val[0];
minor = val[1];
sub = val[2];
strEnd = _strEnd;
state = _state;
}
-
- /** Returns <code>true</code>, if all version components are zero, otherwise <code>false</code>. */
+
+ /** Returns <code>true</code>, if all version components are zero, otherwise <code>false</code>. */
public final boolean isZero() {
return major == 0 && minor == 0 && sub == 0;
}
-
+
/** Returns <code>true</code>, if the major component is defined explicitly, otherwise <code>false</code>. Undefined components has the value <code>0</code>. */
- public final boolean hasMajor() { return 0 != ( HAS_MAJOR & state ); }
+ public final boolean hasMajor() { return 0 != ( HAS_MAJOR & state ); }
/** Returns <code>true</code>, if the optional minor component is defined explicitly, otherwise <code>false</code>. Undefined components has the value <code>0</code>. */
public final boolean hasMinor() { return 0 != ( HAS_MINOR & state ); }
/** Returns <code>true</code>, if the optional sub component is defined explicitly, otherwise <code>false</code>. Undefined components has the value <code>0</code>. */
public final boolean hasSub() { return 0 != ( HAS_SUB & state ); }
-
- /**
+
+ /**
* If constructed with <code>version-string</code>, returns the string offset <i>after</i> the last matching character,
* or <code>0</code> if none matched, or <code>-1</code> if not constructed with a string.
*/
public final int endOfStringMatch() { return strEnd; }
-
+
@Override
public final int hashCode() {
// 31 * x == (x << 5) - x
@@ -239,7 +239,7 @@ public class VersionNumber implements Comparable<Object> {
}
return false;
}
-
+
@Override
public final int compareTo(Object o) {
if ( ! ( o instanceof VersionNumber ) ) {
@@ -265,7 +265,7 @@ public class VersionNumber implements Comparable<Object> {
}
return 0;
}
-
+
public final int getMajor() {
return major;
}
diff --git a/src/java/com/jogamp/common/util/VersionNumberString.java b/src/java/com/jogamp/common/util/VersionNumberString.java
index 143d57c..e23300c 100644
--- a/src/java/com/jogamp/common/util/VersionNumberString.java
+++ b/src/java/com/jogamp/common/util/VersionNumberString.java
@@ -34,28 +34,28 @@ package com.jogamp.common.util;
*/
public class VersionNumberString extends VersionNumber {
- /**
- * A {@link #isZero() zero} version instance, w/o any component defined explicitly.
+ /**
+ * A {@link #isZero() zero} version instance, w/o any component defined explicitly.
* @see #hasMajor()
* @see #hasMinor()
- * @see #hasSub()
+ * @see #hasSub()
*/
public static final VersionNumberString zeroVersion = new VersionNumberString(0, 0, 0, -1, (short)0, "n/a");
-
+
protected final String strVal;
protected VersionNumberString(int majorRev, int minorRev, int subMinorRev, int strEnd, short _state, String versionString) {
super(majorRev, minorRev, subMinorRev, strEnd, _state);
strVal = versionString;
}
-
+
/**
* See {@link VersionNumber#VersionNumber(int, int, int)}.
*/
public VersionNumberString(int majorRev, int minorRev, int subMinorRev, String versionString) {
this(majorRev, minorRev, subMinorRev, -1, (short)(HAS_MAJOR | HAS_MINOR | HAS_SUB), versionString);
}
-
+
/**
* See {@link VersionNumber#VersionNumber(String)}.
*/
@@ -63,7 +63,7 @@ public class VersionNumberString extends VersionNumber {
super( versionString);
strVal = versionString;
}
-
+
/**
* See {@link VersionNumber#VersionNumber(String, String)}.
*/
@@ -71,7 +71,7 @@ public class VersionNumberString extends VersionNumber {
super( versionString, delim);
strVal = versionString;
}
-
+
/**
* See {@link VersionNumber#VersionNumber(String, java.util.regex.Pattern)}.
*/
@@ -79,10 +79,10 @@ public class VersionNumberString extends VersionNumber {
super( versionString, versionPattern);
strVal = versionString;
}
-
+
/** Returns the version string this version number is derived from. */
public final String getVersionString() { return strVal; }
-
+
@Override
public String toString() {
return super.toString() + " ("+strVal+")" ;
diff --git a/src/java/com/jogamp/common/util/VersionUtil.java b/src/java/com/jogamp/common/util/VersionUtil.java
index 8030e94..c4451ac 100644
--- a/src/java/com/jogamp/common/util/VersionUtil.java
+++ b/src/java/com/jogamp/common/util/VersionUtil.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.common.util;
import com.jogamp.common.os.AndroidVersion;
@@ -97,16 +97,16 @@ public class VersionUtil {
public static Manifest getManifest(ClassLoader cl, String extension) {
return getManifest(cl, new String[] { extension } );
}
-
+
/**
- * Returns the manifest of the jar which contains one of the specified extensions.
+ * Returns the manifest of the jar which contains one of the specified extensions.
* The provided ClassLoader is used for resource loading.
* @param cl A ClassLoader which should find the manifest.
* @param extensions The values of many 'Extension-Name's jar-manifest attribute; used to identify the manifest.
- * Matching is applied in decreasing order, i.e. first element is favored over the second, etc.
+ * Matching is applied in decreasing order, i.e. first element is favored over the second, etc.
* @return the requested manifest or null when not found.
*/
- public static Manifest getManifest(ClassLoader cl, String[] extensions) {
+ public static Manifest getManifest(ClassLoader cl, String[] extensions) {
final Manifest[] extManifests = new Manifest[extensions.length];
try {
Enumeration<URL> resources = cl.getResources("META-INF/MANIFEST.MF");
diff --git a/src/java/com/jogamp/common/util/awt/AWTEDTExecutor.java b/src/java/com/jogamp/common/util/awt/AWTEDTExecutor.java
index a43b738..e98478e 100644
--- a/src/java/com/jogamp/common/util/awt/AWTEDTExecutor.java
+++ b/src/java/com/jogamp/common/util/awt/AWTEDTExecutor.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -37,12 +37,12 @@ import com.jogamp.common.util.RunnableExecutor;
*/
public class AWTEDTExecutor implements RunnableExecutor {
/** {@link RunnableExecutor} implementation invoking {@link Runnable#run()}
- * on the AWT EDT.
+ * on the AWT EDT.
*/
public static final AWTEDTExecutor singleton = new AWTEDTExecutor();
private AWTEDTExecutor() {}
-
+
@Override
public void invoke(boolean wait, Runnable r) {
if(EventQueue.isDispatchThread()) {
@@ -76,12 +76,12 @@ public class AWTEDTExecutor implements RunnableExecutor {
* <p>
* Otherwise the runnable is not executed and <code>false</code> is returned.
* </p>
- *
+ *
* @param treeLock representing the AWT-tree-lock, i.e. {@link java.awt.Component#getTreeLock()}
* @param allowOnNonEDT allow execution on non AWT-EDT in case current thread is not AWT-EDT and the tree-lock is being hold
- * @param wait if true method waits until {@link Runnable#run()} is completed, otherwise don't wait.
+ * @param wait if true method waits until {@link Runnable#run()} is completed, otherwise don't wait.
* @param r the {@link Runnable} to be executed.
- * @return <code>true</code> if the {@link Runnable} has been issued for execution, otherwise <code>false</code>
+ * @return <code>true</code> if the {@link Runnable} has been issued for execution, otherwise <code>false</code>
*/
public boolean invoke(Object treeLock, boolean allowOnNonEDT, boolean wait, Runnable r) {
if( EventQueue.isDispatchThread() ) {
@@ -93,7 +93,7 @@ public class AWTEDTExecutor implements RunnableExecutor {
EventQueue.invokeAndWait(r);
} else {
EventQueue.invokeLater(r);
- }
+ }
} catch (InvocationTargetException e) {
throw new RuntimeException(e.getTargetException());
} catch (InterruptedException e) {
diff --git a/src/java/com/jogamp/common/util/cache/TempFileCache.java b/src/java/com/jogamp/common/util/cache/TempFileCache.java
index 32f5c2a..5898d50 100644
--- a/src/java/com/jogamp/common/util/cache/TempFileCache.java
+++ b/src/java/com/jogamp/common/util/cache/TempFileCache.java
@@ -43,9 +43,9 @@ public class TempFileCache {
// Flag indicating that we got a fatal error in the static initializer.
private static boolean staticInitError = false;
-
+
private static final String tmpDirPrefix = "file_cache";
-
+
// Lifecycle: For one user's JVMs, ClassLoader and time.
private static final File tmpBaseDir;
@@ -71,12 +71,12 @@ public class TempFileCache {
static {
// Global Lock !
- synchronized (System.out) {
+ synchronized (System.out) {
// Create / initialize the temp root directory, starting the Reaper
// thread to reclaim old installations if necessary. If we get an
// exception, set an error code.
File _tmpBaseDir = null;
- try {
+ try {
_tmpBaseDir = new File(IOUtil.getTempDir(true /* executable */), tmpDirPrefix);
_tmpBaseDir = IOUtil.testDir(_tmpBaseDir, true /* create */, false /* executable */); // executable already checked
} catch (Exception ex) {
@@ -85,12 +85,12 @@ public class TempFileCache {
staticInitError = true;
}
tmpBaseDir = _tmpBaseDir;
-
+
if (DEBUG) {
System.err.println("TempFileCache: Static Initialization ---------------------------------------------- OK: "+(!staticInitError));
System.err.println("TempFileCache: Thread: "+Thread.currentThread().getName()+", CL 0x"+Integer.toHexString(TempFileCache.class.getClassLoader().hashCode())+", tempBaseDir "+tmpBaseDir.getAbsolutePath());
}
-
+
if(!staticInitError) {
try {
initTmpRoot();
@@ -105,15 +105,15 @@ public class TempFileCache {
}
}
}
-
+
/**
* Documented way to kick off static initialization
* @return true is static initialization was successful
*/
public static boolean initSingleton() {
- return !staticInitError;
+ return !staticInitError;
}
-
+
/**
* This method is called by the static initializer to create / initialize
* the temp root directory that will hold the temp directories for this
@@ -197,7 +197,7 @@ public class TempFileCache {
System.clearProperty(tmpRootPropName);
}
}
-
+
if (tmpRootPropValue == null) {
// Create ${tmpbase}/jlnNNNN.tmp then lock the file
File tmpFile = File.createTempFile("jln", ".tmp", tmpBaseDir);
@@ -413,7 +413,7 @@ public class TempFileCache {
System.err.println("TempFileCache: new TempFileCache() --------------------- (static ok: "+(!staticInitError)+")");
System.err.println("TempFileCache: Thread: "+Thread.currentThread().getName()+", CL 0x"+Integer.toHexString(TempFileCache.class.getClassLoader().hashCode())+", this 0x"+Integer.toHexString(hashCode()));
}
- if(!staticInitError) {
+ if(!staticInitError) {
try {
createTmpDir();
} catch (Exception ex) {
@@ -424,16 +424,16 @@ public class TempFileCache {
if (DEBUG) {
System.err.println("TempFileCache: tempDir "+individualTmpDir+" (ok: "+(!initError)+")");
System.err.println("----------------------------------------------------------");
- }
+ }
}
-
+
/** Delete the <code>individualTmpDir</code> recursively and remove it's reference. */
public void destroy() {
if (DEBUG) {
System.err.println("TempFileCache: destroy() --------------------- (static ok: "+(!staticInitError)+")");
System.err.println("TempFileCache: Thread: "+Thread.currentThread().getName()+", CL 0x"+Integer.toHexString(TempFileCache.class.getClassLoader().hashCode())+", this 0x"+Integer.toHexString(hashCode()));
}
- if(!staticInitError) {
+ if(!staticInitError) {
try {
removeAll(individualTmpDir);
} catch (Exception ex) {
@@ -443,26 +443,26 @@ public class TempFileCache {
individualTmpDir = null;
if (DEBUG) {
System.err.println("TempFileCache: destroy() END");
- }
+ }
}
-
+
/**
* @return true is static and object initialization was successful
*/
public boolean isValid() { return !staticInitError && !initError; }
-
+
/**
* Base temp directory used by TempFileCache.
- *
- * <p>
+ *
+ * <p>
* Lifecycle: For one user's JVMs, ClassLoader and time.
* </p>
- *
+ *
* This is set to:
* <pre>
* ${java.io.tmpdir}/tmpDirPrefix
* </pre>
- *
+ *
* @return
*/
public File getBaseDir() { return tmpBaseDir; }
@@ -481,18 +481,18 @@ public class TempFileCache {
*
* <p>
* Use Case: Per ClassLoader files, eg. native libraries.
- * </p>
+ * </p>
*
* <p>
* Old temp directories are cleaned up the next time a JVM is launched that
* uses TempFileCache.
* </p>
*
- *
+ *
* @return
*/
public File getRootDir() { return tmpRootDir; }
-
+
/**
* Temporary directory for individual files (eg. native libraries of one ClassLoader instance).
* The directory name is:
@@ -508,12 +508,12 @@ public class TempFileCache {
* where jlnMMMMM is the unique filename created by File.createTempFile()
* without the ".tmp" extension.
*
- *
+ *
* @return
*/
public File getTempDir() { return individualTmpDir; }
-
-
+
+
/**
* Create the temp directory in tmpRootDir. To do this, we create a temp
* file with a ".tmp" extension, and then create a directory of the
diff --git a/src/java/com/jogamp/common/util/cache/TempJarCache.java b/src/java/com/jogamp/common/util/cache/TempJarCache.java
index ecf6e56..48d8081 100644
--- a/src/java/com/jogamp/common/util/cache/TempJarCache.java
+++ b/src/java/com/jogamp/common/util/cache/TempJarCache.java
@@ -45,7 +45,7 @@ import com.jogamp.common.util.SecurityUtil;
public class TempJarCache {
private static final boolean DEBUG = Debug.debug("TempJarCache");
-
+
// A HashMap of native libraries that can be loaded with System.load()
// The key is the string name of the library as passed into the loadLibrary
// call; it is the file name without the directory or the platform-dependent
@@ -55,8 +55,8 @@ public class TempJarCache {
public enum LoadState {
LOOKED_UP, LOADED;
-
- public boolean compliesWith(LoadState o2) {
+
+ public boolean compliesWith(LoadState o2) {
return null != o2 ? compareTo(o2) >= 0 : false;
}
}
@@ -66,20 +66,20 @@ public class TempJarCache {
}
return has.compliesWith(exp);
}
-
+
// Set of jar files added
private static Map<URI, LoadState> nativeLibJars;
private static Map<URI, LoadState> classFileJars;
private static Map<URI, LoadState> resourceFileJars;
private static TempFileCache tmpFileCache;
-
+
private static boolean staticInitError = false;
private static volatile boolean isInit = false;
-
+
/**
* Documented way to kick off static initialization.
- *
+ *
* @return true is static initialization was successful
*/
public static boolean initSingleton() {
@@ -88,12 +88,12 @@ public class TempJarCache {
if (!isInit) {
isInit = true;
staticInitError = !TempFileCache.initSingleton();
-
+
if(!staticInitError) {
tmpFileCache = new TempFileCache();
- staticInitError = !tmpFileCache.isValid();
+ staticInitError = !tmpFileCache.isValid();
}
-
+
if(!staticInitError) {
// Initialize the collections of resources
nativeLibMap = new HashMap<String, String>();
@@ -109,20 +109,20 @@ public class TempJarCache {
}
return !staticInitError;
}
-
+
/**
* This is <b>not recommended</b> since the JNI libraries may still be
* in use by the ClassLoader they are loaded via {@link System#load(String)}.
* </p>
* <p>
- * In JogAmp, JNI native libraries loaded and registered by {@link JNILibLoaderBase}
- * derivations, where the native JARs might be loaded via {@link JNILibLoaderBase#addNativeJarLibs(Class, String) }.
+ * In JogAmp, JNI native libraries loaded and registered by {@link JNILibLoaderBase}
+ * derivations, where the native JARs might be loaded via {@link JNILibLoaderBase#addNativeJarLibs(Class, String) }.
* </p>
* <p>
* The only valid use case to shutdown the TempJarCache is at bootstrapping,
* i.e. when no native library is guaranteed to be loaded. This could be useful
* if bootstrapping needs to find the proper native library type.
- * </p>
+ * </p>
*
public static void shutdown() {
if (isInit) { // volatile: ok
@@ -141,7 +141,7 @@ public class TempJarCache {
classFileJars = null;
resourceFileJars.clear();
resourceFileJars = null;
-
+
tmpFileCache.destroy();
tmpFileCache = null;
}
@@ -149,32 +149,32 @@ public class TempJarCache {
}
}
} */
-
+
/**
* @return true if this class has been properly initialized, ie. is in use, otherwise false.
*/
public static boolean isInitialized() {
return isInit && !staticInitError;
}
-
+
/* package */ static void checkInitialized() {
if(!isInit) {
throw new RuntimeException("initSingleton() has to be called first.");
}
}
-
+
public static TempFileCache getTempFileCache() {
checkInitialized();
return tmpFileCache;
}
-
+
public synchronized static boolean checkNativeLibs(URI jarURI, LoadState exp) throws IOException {
checkInitialized();
if(null == jarURI) {
throw new IllegalArgumentException("jarURI is null");
}
return testLoadState(nativeLibJars.get(jarURI), exp);
- }
+ }
public synchronized static boolean checkClasses(URI jarURI, LoadState exp) throws IOException {
checkInitialized();
@@ -182,7 +182,7 @@ public class TempJarCache {
throw new IllegalArgumentException("jarURI is null");
}
return testLoadState(classFileJars.get(jarURI), exp);
- }
+ }
public synchronized static boolean checkResources(URI jarURI, LoadState exp) throws IOException {
checkInitialized();
@@ -191,29 +191,29 @@ public class TempJarCache {
}
return testLoadState(resourceFileJars.get(jarURI), exp);
}
-
+
/**
* Adds native libraries, if not yet added.
- *
- * @param certClass if class is certified, the JarFile entries needs to have the same certificate
+ *
+ * @param certClass if class is certified, the JarFile entries needs to have the same certificate
* @param jarURI
* @param nativeLibraryPath if not null, only extracts native libraries within this path.
* @return true if native libraries were added or previously loaded from given jarURI, otherwise false
* @throws IOException if the <code>jarURI</code> could not be loaded or a previous load attempt failed
* @throws SecurityException
- * @throws URISyntaxException
- * @throws IllegalArgumentException
+ * @throws URISyntaxException
+ * @throws IllegalArgumentException
*/
- public synchronized static final boolean addNativeLibs(Class<?> certClass, URI jarURI, String nativeLibraryPath) throws IOException, SecurityException, IllegalArgumentException, URISyntaxException {
+ public synchronized static final boolean addNativeLibs(Class<?> certClass, URI jarURI, String nativeLibraryPath) throws IOException, SecurityException, IllegalArgumentException, URISyntaxException {
final LoadState nativeLibJarsLS = nativeLibJars.get(jarURI);
- if( !testLoadState(nativeLibJarsLS, LoadState.LOOKED_UP) ) {
+ if( !testLoadState(nativeLibJarsLS, LoadState.LOOKED_UP) ) {
nativeLibJars.put(jarURI, LoadState.LOOKED_UP);
final JarFile jarFile = JarUtil.getJarFile(jarURI);
if(DEBUG) {
System.err.println("TempJarCache: addNativeLibs: "+jarURI+": nativeJar "+jarFile.getName()+" (NEW)");
}
validateCertificates(certClass, jarFile);
- final int num = JarUtil.extract(tmpFileCache.getTempDir(), nativeLibMap, jarFile, nativeLibraryPath, true, false, false);
+ final int num = JarUtil.extract(tmpFileCache.getTempDir(), nativeLibMap, jarFile, nativeLibraryPath, true, false, false);
nativeLibJars.put(jarURI, LoadState.LOADED);
return num > 0;
} else if( testLoadState(nativeLibJarsLS, LoadState.LOADED) ) {
@@ -224,78 +224,78 @@ public class TempJarCache {
}
throw new IOException("TempJarCache: addNativeLibs: "+jarURI+", previous load attempt failed");
}
-
+
/**
* Adds native classes, if not yet added.
- *
+ *
* TODO class access pending
* needs Classloader.defineClass(..) access, ie. own derivation - will do when needed ..
- *
- * @param certClass if class is certified, the JarFile entries needs to have the same certificate
+ *
+ * @param certClass if class is certified, the JarFile entries needs to have the same certificate
* @param jarURI
* @throws IOException if the <code>jarURI</code> could not be loaded or a previous load attempt failed
* @throws SecurityException
- * @throws URISyntaxException
- * @throws IllegalArgumentException
+ * @throws URISyntaxException
+ * @throws IllegalArgumentException
*/
public synchronized static final void addClasses(Class<?> certClass, URI jarURI) throws IOException, SecurityException, IllegalArgumentException, URISyntaxException {
final LoadState classFileJarsLS = classFileJars.get(jarURI);
- if( !testLoadState(classFileJarsLS, LoadState.LOOKED_UP) ) {
+ if( !testLoadState(classFileJarsLS, LoadState.LOOKED_UP) ) {
classFileJars.put(jarURI, LoadState.LOOKED_UP);
final JarFile jarFile = JarUtil.getJarFile(jarURI);
if(DEBUG) {
System.err.println("TempJarCache: addClasses: "+jarURI+": nativeJar "+jarFile.getName());
}
validateCertificates(certClass, jarFile);
- JarUtil.extract(tmpFileCache.getTempDir(), null, jarFile,
- null /* nativeLibraryPath */, false, true, false);
+ JarUtil.extract(tmpFileCache.getTempDir(), null, jarFile,
+ null /* nativeLibraryPath */, false, true, false);
classFileJars.put(jarURI, LoadState.LOADED);
} else if( !testLoadState(classFileJarsLS, LoadState.LOADED) ) {
throw new IOException("TempJarCache: addClasses: "+jarURI+", previous load attempt failed");
}
}
-
+
/**
* Adds native resources, if not yet added.
- *
- * @param certClass if class is certified, the JarFile entries needs to have the same certificate
+ *
+ * @param certClass if class is certified, the JarFile entries needs to have the same certificate
* @param jarURI
* @return
* @throws IOException if the <code>jarURI</code> could not be loaded or a previous load attempt failed
* @throws SecurityException
- * @throws URISyntaxException
- * @throws IllegalArgumentException
+ * @throws URISyntaxException
+ * @throws IllegalArgumentException
*/
- public synchronized static final void addResources(Class<?> certClass, URI jarURI) throws IOException, SecurityException, IllegalArgumentException, URISyntaxException {
+ public synchronized static final void addResources(Class<?> certClass, URI jarURI) throws IOException, SecurityException, IllegalArgumentException, URISyntaxException {
final LoadState resourceFileJarsLS = resourceFileJars.get(jarURI);
- if( !testLoadState(resourceFileJarsLS, LoadState.LOOKED_UP) ) {
+ if( !testLoadState(resourceFileJarsLS, LoadState.LOOKED_UP) ) {
resourceFileJars.put(jarURI, LoadState.LOOKED_UP);
final JarFile jarFile = JarUtil.getJarFile(jarURI);
if(DEBUG) {
System.err.println("TempJarCache: addResources: "+jarURI+": nativeJar "+jarFile.getName());
}
validateCertificates(certClass, jarFile);
- JarUtil.extract(tmpFileCache.getTempDir(), null, jarFile,
- null /* nativeLibraryPath */, false, false, true);
+ JarUtil.extract(tmpFileCache.getTempDir(), null, jarFile,
+ null /* nativeLibraryPath */, false, false, true);
resourceFileJars.put(jarURI, LoadState.LOADED);
} else if( !testLoadState(resourceFileJarsLS, LoadState.LOADED) ) {
throw new IOException("TempJarCache: addResources: "+jarURI+", previous load attempt failed");
}
}
-
+
/**
* Adds all types, native libraries, class files and other files (resources)
* if not yet added.
- *
+ *
* TODO class access pending
* needs Classloader.defineClass(..) access, ie. own derivation - will do when needed ..
- *
- * @param certClass if class is certified, the JarFile entries needs to have the same certificate
+ *
+ * @param certClass if class is certified, the JarFile entries needs to have the same certificate
* @param jarURI
* @throws IOException if the <code>jarURI</code> could not be loaded or a previous load attempt failed
* @throws SecurityException
- * @throws URISyntaxException
- * @throws IllegalArgumentException
+ * @throws URISyntaxException
+ * @throws IllegalArgumentException
*/
public synchronized static final void addAll(Class<?> certClass, URI jarURI) throws IOException, SecurityException, IllegalArgumentException, URISyntaxException {
checkInitialized();
@@ -305,14 +305,14 @@ public class TempJarCache {
final LoadState nativeLibJarsLS = nativeLibJars.get(jarURI);
final LoadState classFileJarsLS = classFileJars.get(jarURI);
final LoadState resourceFileJarsLS = resourceFileJars.get(jarURI);
- if( !testLoadState(nativeLibJarsLS, LoadState.LOOKED_UP) ||
- !testLoadState(classFileJarsLS, LoadState.LOOKED_UP) ||
+ if( !testLoadState(nativeLibJarsLS, LoadState.LOOKED_UP) ||
+ !testLoadState(classFileJarsLS, LoadState.LOOKED_UP) ||
!testLoadState(resourceFileJarsLS, LoadState.LOOKED_UP) ) {
-
+
final boolean extractNativeLibraries = !testLoadState(nativeLibJarsLS, LoadState.LOADED);
final boolean extractClassFiles = !testLoadState(classFileJarsLS, LoadState.LOADED);
final boolean extractOtherFiles = !testLoadState(resourceFileJarsLS, LoadState.LOOKED_UP);
-
+
// mark looked-up (those who are not loaded)
if(extractNativeLibraries) {
nativeLibJars.put(jarURI, LoadState.LOOKED_UP);
@@ -323,15 +323,15 @@ public class TempJarCache {
if(extractOtherFiles) {
resourceFileJars.put(jarURI, LoadState.LOOKED_UP);
}
-
+
final JarFile jarFile = JarUtil.getJarFile(jarURI);
if(DEBUG) {
System.err.println("TempJarCache: addAll: "+jarURI+": nativeJar "+jarFile.getName());
}
validateCertificates(certClass, jarFile);
- JarUtil.extract(tmpFileCache.getTempDir(), nativeLibMap, jarFile,
+ JarUtil.extract(tmpFileCache.getTempDir(), nativeLibMap, jarFile,
null /* nativeLibraryPath */, extractNativeLibraries, extractClassFiles, extractOtherFiles);
-
+
// mark loaded (those were just loaded)
if(extractNativeLibraries) {
nativeLibJars.put(jarURI, LoadState.LOADED);
@@ -342,20 +342,20 @@ public class TempJarCache {
if(extractOtherFiles) {
resourceFileJars.put(jarURI, LoadState.LOADED);
}
- } else if( !testLoadState(nativeLibJarsLS, LoadState.LOADED) ||
- !testLoadState(classFileJarsLS, LoadState.LOADED) ||
+ } else if( !testLoadState(nativeLibJarsLS, LoadState.LOADED) ||
+ !testLoadState(classFileJarsLS, LoadState.LOADED) ||
!testLoadState(resourceFileJarsLS, LoadState.LOADED) ) {
- throw new IOException("TempJarCache: addAll: "+jarURI+", previous load attempt failed");
+ throw new IOException("TempJarCache: addAll: "+jarURI+", previous load attempt failed");
}
}
-
+
public synchronized static final String findLibrary(String libName) {
checkInitialized();
// try with mapped library basename first
String path = nativeLibMap.get(libName);
if(null == path) {
// if valid library name, try absolute path in temp-dir
- if(null != NativeLibrary.isValidNativeLibraryName(libName, false)) {
+ if(null != NativeLibrary.isValidNativeLibraryName(libName, false)) {
final File f = new File(tmpFileCache.getTempDir(), libName);
if(f.exists()) {
path = f.getAbsolutePath();
@@ -364,9 +364,9 @@ public class TempJarCache {
}
return path;
}
-
+
/** TODO class access pending
- * needs Classloader.defineClass(..) access, ie. own derivation - will do when needed ..
+ * needs Classloader.defineClass(..) access, ie. own derivation - will do when needed ..
public static Class<?> findClass(String name, ClassLoader cl) throws IOException, ClassFormatError {
checkInitialized();
final File f = new File(nativeTmpFileCache.getTempDir(), IOUtil.getClassFileName(name));
@@ -379,7 +379,7 @@ public class TempJarCache {
}
return null;
} */
-
+
public synchronized static final String findResource(String name) {
checkInitialized();
final File f = new File(tmpFileCache.getTempDir(), name);
@@ -388,7 +388,7 @@ public class TempJarCache {
}
return null;
}
-
+
public synchronized static final URI getResource(String name) throws URISyntaxException {
checkInitialized();
final File f = new File(tmpFileCache.getTempDir(), name);
@@ -397,7 +397,7 @@ public class TempJarCache {
}
return null;
}
-
+
private static void validateCertificates(Class<?> certClass, JarFile jarFile) throws IOException, SecurityException {
if(null == certClass) {
throw new IllegalArgumentException("certClass is null");
@@ -411,9 +411,9 @@ public class TempJarCache {
JarUtil.validateCertificates(rootCerts, jarFile);
if(DEBUG) {
System.err.println("TempJarCache: validateCertificates: OK - Matching rootCerts in given class "+certClass.getName()+", nativeJar "+jarFile.getName());
- }
+ }
} else if(DEBUG) {
System.err.println("TempJarCache: validateCertificates: OK - No rootCerts in given class "+certClass.getName()+", nativeJar "+jarFile.getName());
}
- }
+ }
}
diff --git a/src/java/com/jogamp/common/util/locks/Lock.java b/src/java/com/jogamp/common/util/locks/Lock.java
index df645ed..5130876 100644
--- a/src/java/com/jogamp/common/util/locks/Lock.java
+++ b/src/java/com/jogamp/common/util/locks/Lock.java
@@ -43,8 +43,8 @@ public interface Lock {
/** The default {@link #TIMEOUT} value, of {@value} ms */
public static final long DEFAULT_TIMEOUT = 5000; // 5s default timeout
-
- /**
+
+ /**
* The <code>TIMEOUT</code> for {@link #lock()} in ms,
* defaults to {@link #DEFAULT_TIMEOUT}.
* <p>
@@ -78,7 +78,7 @@ public interface Lock {
* @throws RuntimeException in case the lock is not acquired by this thread.
*/
void unlock() throws RuntimeException;
-
+
/** Query if locked */
boolean isLocked();
}
diff --git a/src/java/com/jogamp/common/util/locks/LockFactory.java b/src/java/com/jogamp/common/util/locks/LockFactory.java
index bb2d5f4..e1ec2d7 100644
--- a/src/java/com/jogamp/common/util/locks/LockFactory.java
+++ b/src/java/com/jogamp/common/util/locks/LockFactory.java
@@ -35,25 +35,25 @@ import jogamp.common.util.locks.RecursiveThreadGroupLockImpl01Unfairish;
public class LockFactory {
public enum ImplType {
- Int01(0), Java5(1), Int02ThreadGroup(2);
-
+ Int01(0), Java5(1), Int02ThreadGroup(2);
+
public final int id;
ImplType(int id){
this.id = id;
}
- }
-
+ }
+
/** default is ImplType.Int01, unfair'ish (fastest w/ least deviation) */
public static RecursiveLock createRecursiveLock() {
return new RecursiveLockImpl01Unfairish();
}
-
+
/** default is ImplType.Int02ThreadGroup, unfair'ish (fastest w/ least deviation) */
public static RecursiveThreadGroupLock createRecursiveThreadGroupLock() {
return new RecursiveThreadGroupLockImpl01Unfairish();
}
-
+
public static RecursiveLock createRecursiveLock(ImplType t, boolean fair) {
switch(t) {
case Int01:
@@ -65,5 +65,5 @@ public class LockFactory {
}
throw new InternalError("XXX");
}
-
+
}
diff --git a/src/java/com/jogamp/common/util/locks/RecursiveLock.java b/src/java/com/jogamp/common/util/locks/RecursiveLock.java
index 3e0a873..c56a5ef 100644
--- a/src/java/com/jogamp/common/util/locks/RecursiveLock.java
+++ b/src/java/com/jogamp/common/util/locks/RecursiveLock.java
@@ -32,7 +32,7 @@ package com.jogamp.common.util.locks;
* Reentrance capable locking toolkit.
*/
public interface RecursiveLock extends ThreadLock {
- /**
+ /**
* Return the number of locks issued to this lock by the same thread.
* <ul>
* <li>A hold count of 0 identifies this lock as unlocked.</li>
diff --git a/src/java/com/jogamp/common/util/locks/RecursiveThreadGroupLock.java b/src/java/com/jogamp/common/util/locks/RecursiveThreadGroupLock.java
index 626199f..a23c320 100644
--- a/src/java/com/jogamp/common/util/locks/RecursiveThreadGroupLock.java
+++ b/src/java/com/jogamp/common/util/locks/RecursiveThreadGroupLock.java
@@ -34,67 +34,67 @@ package com.jogamp.common.util.locks;
* </p>
*/
public interface RecursiveThreadGroupLock extends RecursiveLock {
- /**
- * Returns true if the current thread is the original lock owner, ie.
+ /**
+ * Returns true if the current thread is the original lock owner, ie.
* successfully claimed this lock the first time, ie. {@link #getHoldCount()} == 1.
*/
boolean isOriginalOwner();
-
- /**
- * Returns true if the passed thread is the original lock owner, ie.
+
+ /**
+ * Returns true if the passed thread is the original lock owner, ie.
* successfully claimed this lock the first time, ie. {@link #getHoldCount()} == 1.
*/
boolean isOriginalOwner(Thread thread);
-
- /**
+
+ /**
* Add a thread to the list of additional lock owners, which enables them to recursively claim this lock.
* <p>
* The caller must hold this lock and be the original lock owner, see {@link #isOriginalOwner()}.
* </p>
* <p>
- * If the original owner releases this lock via {@link #unlock()}
+ * If the original owner releases this lock via {@link #unlock()}
* all additional lock owners are released as well.
* This ensures consistency of spawn off additional lock owner threads and it's release.
- * </p>
+ * </p>
* Use case:
* <pre>
* Thread2 thread2 = new Thread2();
- *
+ *
* Thread1 {
- *
+ *
* // Claim this lock and become the original lock owner.
* lock.lock();
- *
+ *
* try {
- *
+ *
* // Allow Thread2 to claim the lock, ie. make thread2 an additional lock owner
* addOwner(thread2);
- *
+ *
* // Start thread2
* thread2.start();
- *
+ *
* // Wait until thread2 has finished requiring this lock, but keep thread2 running
- * while(!thread2.waitForResult()) sleep();
- *
+ * while(!thread2.waitForResult()) sleep();
+ *
* // Optional: Only if sure that this thread doesn't hold the lock anymore,
- * // otherwise just release the lock via unlock().
+ * // otherwise just release the lock via unlock().
* removeOwner(thread2);
- *
+ *
* } finally {
- *
+ *
* // Release this lock and remove all additional lock owners.
* // Implicit wait until thread2 gets off the lock.
* lock.unlock();
- *
+ *
* }
- *
+ *
* }.start();
* </pre>
- *
- * @param t the thread to be added to the list of additional owning threads
+ *
+ * @param t the thread to be added to the list of additional owning threads
* @throws RuntimeException if the current thread does not hold the lock.
* @throws IllegalArgumentException if the passed thread is the lock owner or already added.
- *
+ *
* @see #removeOwner(Thread)
* @see #unlock()
* @see #lock()
@@ -109,31 +109,31 @@ public interface RecursiveThreadGroupLock extends RecursiveLock {
* <p>
* Only use this method if sure that the thread doesn't hold the lock anymore.
* </p>
- *
- * @param t the thread to be removed from the list of additional owning threads
+ *
+ * @param t the thread to be removed from the list of additional owning threads
* @throws RuntimeException if the current thread does not hold the lock.
* @throws IllegalArgumentException if the passed thread is not added by {@link #addOwner(Thread)}
*/
void removeOwner(Thread t) throws RuntimeException, IllegalArgumentException;
-
+
/**
* <p>
* Wait's until all additional owners released this lock before releasing it.
* </p>
- *
+ *
* {@inheritDoc}
*/
@Override
void unlock() throws RuntimeException;
-
+
/**
* <p>
* Wait's until all additional owners released this lock before releasing it.
* </p>
- *
+ *
* {@inheritDoc}
*/
@Override
- void unlock(Runnable taskAfterUnlockBeforeNotify);
-
+ void unlock(Runnable taskAfterUnlockBeforeNotify);
+
}
diff --git a/src/java/com/jogamp/common/util/locks/SingletonInstance.java b/src/java/com/jogamp/common/util/locks/SingletonInstance.java
index 825098d..f016d4b 100644
--- a/src/java/com/jogamp/common/util/locks/SingletonInstance.java
+++ b/src/java/com/jogamp/common/util/locks/SingletonInstance.java
@@ -44,7 +44,7 @@ public abstract class SingletonInstance implements Lock {
public static SingletonInstance createFileLock(long poll_ms, File lockFile) {
return new SingletonInstanceFileLock(poll_ms, lockFile);
}
-
+
/**
* A user shall use <b>ephemeral ports</b>:
* <ul>
@@ -54,23 +54,23 @@ public abstract class SingletonInstance implements Lock {
* <li>FreeBSD < 4.6 and BSD use ports 1024 through 4999.</li>
* <li>Microsoft Windows operating systems through Server 2003 use the range 1025 to 5000</li>
* <li>Windows Vista, Windows 7, and Server 2008 use the IANA range.</li>
- * </ul>
+ * </ul>
* @param pollPeriod
- * @param portNumber to be used for this single instance server socket.
+ * @param portNumber to be used for this single instance server socket.
*/
public static SingletonInstance createServerSocket(long poll_ms, int portNumber) {
return new SingletonInstanceServerSocket(poll_ms, portNumber);
}
-
+
protected SingletonInstance(long poll_ms) {
this.poll_ms = Math.max(10, poll_ms);
}
-
+
public final long getPollPeriod() { return poll_ms; }
public abstract String getName();
@Override
public final String toString() { return getName(); }
-
+
@Override
public synchronized void lock() throws RuntimeException {
try {
@@ -99,7 +99,7 @@ public abstract class SingletonInstance implements Lock {
if( DEBUG ) {
final long t2 = System.currentTimeMillis();
System.err.println(infoPrefix(t2)+" +++ "+getName()+" - Locked within "+(t2-t0)+" ms, "+(i+1)+" attempts");
- }
+ }
return true;
}
if( DEBUG && 0==i ) {
@@ -118,9 +118,9 @@ public abstract class SingletonInstance implements Lock {
System.err.println(infoPrefix(t2)+" +++ EEE (2) "+getName()+" - couldn't get lock within "+(t2-t0)+" ms, "+i+" attempts");
}
return false;
- }
+ }
protected abstract boolean tryLockImpl();
-
+
@Override
public void unlock() throws RuntimeException {
final long t0 = System.currentTimeMillis();
@@ -145,7 +145,7 @@ public abstract class SingletonInstance implements Lock {
protected String infoPrefix() {
return infoPrefix(System.currentTimeMillis());
}
-
+
private final long poll_ms;
private boolean locked = false;
}
diff --git a/src/java/com/jogamp/common/util/locks/ThreadLock.java b/src/java/com/jogamp/common/util/locks/ThreadLock.java
index 65260bc..26e7475 100644
--- a/src/java/com/jogamp/common/util/locks/ThreadLock.java
+++ b/src/java/com/jogamp/common/util/locks/ThreadLock.java
@@ -33,27 +33,27 @@ package com.jogamp.common.util.locks;
*/
public interface ThreadLock extends Lock {
- /** Query whether the lock is hold by the a thread other than the current thread. */
+ /** Query whether the lock is hold by the a thread other than the current thread. */
boolean isLockedByOtherThread();
- /** Query whether the lock is hold by the given thread. */
+ /** Query whether the lock is hold by the given thread. */
boolean isOwner(Thread thread);
-
+
/**
* @return the Thread owning this lock if locked, otherwise null
*/
Thread getOwner();
/**
- * @throws RuntimeException if current thread does not hold the lock
+ * @throws RuntimeException if current thread does not hold the lock
*/
void validateLocked() throws RuntimeException;
-
+
/**
* Execute the {@link Runnable Runnable taskAfterUnlockBeforeNotify} while holding the exclusive lock.
* <p>
* Then release the lock.
- * </p>
+ * </p>
*/
- void unlock(Runnable taskAfterUnlockBeforeNotify);
+ void unlock(Runnable taskAfterUnlockBeforeNotify);
}
diff --git a/src/java/com/jogamp/gluegen/ArrayTypes.java b/src/java/com/jogamp/gluegen/ArrayTypes.java
index 78122f1..d15e170 100644
--- a/src/java/com/jogamp/gluegen/ArrayTypes.java
+++ b/src/java/com/jogamp/gluegen/ArrayTypes.java
@@ -1,21 +1,21 @@
/*
* 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
@@ -28,11 +28,11 @@
* 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.
*/
diff --git a/src/java/com/jogamp/gluegen/CMethodBindingEmitter.java b/src/java/com/jogamp/gluegen/CMethodBindingEmitter.java
index 022cf53..7ae3192 100644
--- a/src/java/com/jogamp/gluegen/CMethodBindingEmitter.java
+++ b/src/java/com/jogamp/gluegen/CMethodBindingEmitter.java
@@ -1,21 +1,21 @@
/*
* 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
@@ -28,11 +28,11 @@
* 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.
*/
@@ -57,7 +57,7 @@ public class CMethodBindingEmitter extends FunctionEmitter {
protected static final String arrayResLength = "_array_res_length";
protected static final String arrayRes = "_array_res";
protected static final String arrayIdx = "_array_idx";
-
+
protected MethodBinding binding;
/** Name of the package in which the corresponding Java method resides.*/
@@ -99,13 +99,13 @@ public class CMethodBindingEmitter extends FunctionEmitter {
* == false;
*/
private MessageFormat returnValueCapacityExpression = null;
-
+
/**
* Length of the returned array. Is ignored if
* binding.getJavaReturnType().isArray() is false.
*/
private MessageFormat returnValueLengthExpression = null;
-
+
protected static final String STRING_CHARS_PREFIX = "_strchars_";
// We need this in order to compute sizes of certain types
@@ -119,7 +119,7 @@ public class CMethodBindingEmitter extends FunctionEmitter {
public CMethodBindingEmitter(MethodBinding binding,
PrintWriter output,
String javaPackageName,
- String javaClassName,
+ String javaClassName,
boolean isOverloadedBinding,
boolean isJavaMethodStatic,
boolean forImplementingMethodCall,
@@ -131,7 +131,7 @@ public class CMethodBindingEmitter extends FunctionEmitter {
assert(binding != null);
assert(javaClassName != null);
assert(javaPackageName != null);
-
+
this.binding = binding;
this.packageName = javaPackageName;
this.className = javaClassName;
@@ -142,7 +142,7 @@ public class CMethodBindingEmitter extends FunctionEmitter {
this.forIndirectBufferAndArrayImplementation = forIndirectBufferAndArrayImplementation;
this.machDesc = machDesc;
- setCommentEmitter(defaultCommentEmitter);
+ setCommentEmitter(defaultCommentEmitter);
}
public final MethodBinding getBinding() { return binding; }
@@ -177,12 +177,12 @@ public class CMethodBindingEmitter extends FunctionEmitter {
*/
public final void setReturnValueCapacityExpression(MessageFormat expression) {
returnValueCapacityExpression = expression;
-
+
if (!binding.getJavaReturnType().isNIOBuffer() &&
!binding.getJavaReturnType().isCompoundTypeWrapper()) {
throw new IllegalArgumentException(
"Cannot specify return value capacity for a method that does not " +
- "return java.nio.Buffer or a compound type wrapper: \"" + binding + "\"");
+ "return java.nio.Buffer or a compound type wrapper: \"" + binding + "\"");
}
}
@@ -210,12 +210,12 @@ public class CMethodBindingEmitter extends FunctionEmitter {
*/
public final void setReturnValueLengthExpression(MessageFormat expression) {
returnValueLengthExpression = expression;
-
+
if (!binding.getJavaReturnType().isArray() &&
!binding.getJavaReturnType().isArrayOfCompoundTypeWrappers()) {
throw new IllegalArgumentException(
"Cannot specify return value length for a method that does not " +
- "return an array: \"" + binding + "\"");
+ "return an array: \"" + binding + "\"");
}
}
@@ -291,7 +291,7 @@ public class CMethodBindingEmitter extends FunctionEmitter {
public final MachineDescription getMachineDescription() { return machDesc; }
- protected void emitReturnType(PrintWriter writer) {
+ protected void emitReturnType(PrintWriter writer) {
writer.print("JNIEXPORT ");
writer.print(binding.getJavaReturnType().jniTypeName());
writer.print(" JNICALL");
@@ -336,7 +336,7 @@ public class CMethodBindingEmitter extends FunctionEmitter {
}
writer.print(" _unused");
++numEmitted;
-
+
if (binding.hasContainingType()) {
// "this" argument always comes down in argument 0 as direct buffer
writer.print(", jobject " + JavaMethodBindingEmitter.javaThisArgumentName());
@@ -349,7 +349,7 @@ public class CMethodBindingEmitter extends FunctionEmitter {
// there's something wrong with our parsing of the headers.
assert(binding.getNumArguments() == 1);
continue;
- }
+ }
if (javaArgType.isJNIEnv() || binding.isArgumentThisPointer(i)) {
continue;
}
@@ -366,21 +366,21 @@ public class CMethodBindingEmitter extends FunctionEmitter {
writer.print(", jboolean " + isNIOArgName(i));
}
} else if (javaArgType.isNIOBufferArray()) {
- writer.print(", jintArray " +
+ writer.print(", jintArray " +
byteOffsetArrayArgName(i));
}
}
return numEmitted;
}
-
- protected void emitBody(PrintWriter writer) {
+
+ protected void emitBody(PrintWriter writer) {
writer.println(" {");
// writer.println("printf(\" - - - - "+ getName() + getImplSuffix() +" - - - -\\n\");");
emitBodyVariableDeclarations(writer);
emitBodyUserVariableDeclarations(writer);
emitBodyVariablePreCallSetup(writer);
- emitBodyCallCFunction(writer);
+ emitBodyCallCFunction(writer);
emitBodyUserVariableAssignments(writer);
emitBodyVariablePostCallCleanup(writer);
emitBodyReturnResult(writer);
@@ -416,12 +416,12 @@ public class CMethodBindingEmitter extends FunctionEmitter {
convName, javaArgName);
if (needsDataCopy && !emittedDataCopyTemps) {
// emit loop counter and array length variables used during data
- // copy
+ // copy
writer.println(" jobject _tmpObj;");
writer.println(" int _copyIndex;");
writer.println(" jsize _tmpArrayLen;");
- // Pointer to the data in the Buffer, taking the offset into account
+ // Pointer to the data in the Buffer, taking the offset into account
writer.println(" int * _offsetHandle = NULL;");
emittedDataCopyTemps = true;
@@ -437,7 +437,7 @@ public class CMethodBindingEmitter extends FunctionEmitter {
writer.print(binding.getArgumentName(i));
writer.println(" = NULL;");
}
-
+
}
// Emit declaration for return value if necessary
@@ -467,7 +467,7 @@ public class CMethodBindingEmitter extends FunctionEmitter {
Class<?> componentType = javaReturnType.getJavaClass().getComponentType();
if (componentType.isArray()) {
- throw new RuntimeException("Multi-dimensional arrays not supported yet");
+ throw new RuntimeException("Multi-dimensional arrays not supported yet");
}
String javaTypeName = componentType.getName();
@@ -478,7 +478,7 @@ public class CMethodBindingEmitter extends FunctionEmitter {
writer.print(arrayRes);
writer.println(";");
}
- }
+ }
}
/** Emits the user-defined C variable declarations from the
@@ -563,7 +563,7 @@ public class CMethodBindingEmitter extends FunctionEmitter {
CMethodBindingEmitter.cThisArgumentName(),
null);
}
-
+
// Convert all arrays to pointers, and get UTF-8 versions of jstring args
for (int i = 0; i < binding.getNumArguments(); i++) {
JavaType javaArgType = binding.getJavaArgumentType(i);
@@ -598,9 +598,9 @@ public class CMethodBindingEmitter extends FunctionEmitter {
if (javaArgType.isStringArray()) {
// java-side type is String[]
cArgTypeName = "jstring *";
- }
+ }
writer.print(cArgTypeName);
- writer.print(") ( JNI_TRUE == " + isNIOArgName(i) + " ? ");
+ writer.print(") ( JNI_TRUE == " + isNIOArgName(i) + " ? ");
writer.print(" (*env)->GetDirectBufferAddress(env, " + javaArgName + ") : ");
writer.print(" (*env)->GetPrimitiveArrayCritical(env, " + javaArgName + ", NULL) );");
} else {
@@ -675,7 +675,7 @@ public class CMethodBindingEmitter extends FunctionEmitter {
writer.println(" /* get each element of the array argument \"" + javaArgName + "\" */");
writer.print(" _tmpObj = (*env)->GetObjectArrayElement(env, ");
writer.print(javaArgName);
- writer.println(", _copyIndex);");
+ writer.println(", _copyIndex);");
if (javaArgType.isStringArray()) {
writer.print(" ");
@@ -722,20 +722,20 @@ public class CMethodBindingEmitter extends FunctionEmitter {
throw new RuntimeException("Cannot yet handle type \"" + cArgType.getName() +
"\"; need to add support for copying ptr-to-ptr-to-primitiveType subarrays");
}
-
+
}
writer.println(" }");
if (javaArgType.isNIOBufferArray()) {
writer.println
- (" (*env)->ReleasePrimitiveArrayCritical(env, " +
- byteOffsetArrayArgName(i) +
+ (" (*env)->ReleasePrimitiveArrayCritical(env, " +
+ byteOffsetArrayArgName(i) +
", _offsetHandle, JNI_ABORT);");
}
writer.println();
} // end of data copy
-
+
writer.println(" }");
} else if (javaArgType.isString()) {
@@ -747,7 +747,7 @@ public class CMethodBindingEmitter extends FunctionEmitter {
}
}
-
+
/**
* Code to clean up any variables that were declared in
* emitBodyVariableDeclarations(), AFTER calling the actual C function.
@@ -775,7 +775,7 @@ public class CMethodBindingEmitter extends FunctionEmitter {
writer.println(" if ( JNI_FALSE == " + isNIOArgName(i) + " && NULL != " + javaArgName + " ) {");
// Release array
- final String modeFlag = isConstPtr(cArgType) || isConstPtrPtr(cArgType) ? "JNI_ABORT" : "0" ;
+ final String modeFlag = isConstPtr(cArgType) || isConstPtrPtr(cArgType) ? "JNI_ABORT" : "0" ;
writer.print(" (*env)->ReleasePrimitiveArrayCritical(env, " + javaArgName + ", " + convName + ", "+modeFlag+");");
} else {
writer.println(" if ( NULL != " + javaArgName + " ) {");
@@ -790,7 +790,7 @@ public class CMethodBindingEmitter extends FunctionEmitter {
// FIXME: handle any cleanup from treatment of non-const args,
// assuming they were treated differently in
// emitBodyVariablePreCallSetup() (see the similar section in that
- // method for details).
+ // method for details).
if (javaArgType.isArrayOfCompoundTypeWrappers()) {
// This is the only form of cleanup we handle right now
writer.println(" _tmpArrayLen = (*env)->GetArrayLength(env, " + javaArgName + ");");
@@ -839,26 +839,26 @@ public class CMethodBindingEmitter extends FunctionEmitter {
"Could not copy data for type \"" + cArgType +
"\"; currently only pointer types supported.");
}
-
+
// process each element in the array
writer.println(" for (_copyIndex = 0; _copyIndex < " + arrayLenName +"; ++_copyIndex) {");
// get each array element
- writer.println(" /* free each element of " +convName +"_copy */");
+ writer.println(" /* free each element of " +convName +"_copy */");
writer.print(" _tmpObj = (*env)->GetObjectArrayElement(env, ");
writer.print(javaArgName);
- writer.println(", _copyIndex);");
+ writer.println(", _copyIndex);");
if (javaArgType.isStringArray()) {
writer.print(" (*env)->ReleaseStringUTFChars(env, ");
writer.print("(jstring) _tmpObj");
writer.print(", ");
writer.print(convName+"_copy[_copyIndex]");
- writer.println(");");
+ writer.println(");");
} else {
if (true) throw new RuntimeException(
"Cannot yet handle type \"" + cArgType.getName() +
- "\"; need to add support for cleaning up copied ptr-to-ptr-to-primitiveType subarrays");
+ "\"; need to add support for cleaning up copied ptr-to-ptr-to-primitiveType subarrays");
}
writer.println(" }");
}
@@ -903,20 +903,20 @@ public class CMethodBindingEmitter extends FunctionEmitter {
// there's something wrong with our parsing of the headers.
assert(binding.getNumArguments() == 1);
continue;
- }
+ }
if (javaArgType.isJNIEnv()) {
writer.print("env");
} else if (binding.isArgumentThisPointer(i)) {
writer.print(CMethodBindingEmitter.cThisArgumentName());
} else {
- writer.print("(");
+ writer.print("(");
Type cArgType = binding.getCArgumentType(i);
boolean needsDataCopy = javaArgTypeNeedsDataCopy(javaArgType);
boolean needsArrayOffset = !needsDataCopy && (
javaArgType.isArray() ||
javaArgType.isArrayOfCompoundTypeWrappers() ||
- ( javaArgType.isNIOBuffer() && forIndirectBufferAndArrayImplementation ) );
+ ( javaArgType.isNIOBuffer() && forIndirectBufferAndArrayImplementation ) );
if (isConstPtrPtr(cArgType)) {
writer.print("const ");
}
@@ -939,7 +939,7 @@ public class CMethodBindingEmitter extends FunctionEmitter {
}
} else {
if (javaArgType.isString()) { writer.print(STRING_CHARS_PREFIX); }
- writer.print(binding.getArgumentName(i));
+ writer.print(binding.getArgumentName(i));
}
}
}
@@ -967,7 +967,7 @@ public class CMethodBindingEmitter extends FunctionEmitter {
emitBodyPassCArguments(writer);
writer.println(");");
}
-
+
/** Emits the user-defined C variable assignments from the
TemporaryCVariableAssignments directive in the .cfg file. */
protected void emitBodyUserVariableAssignments(PrintWriter writer) {
@@ -1088,12 +1088,12 @@ public class CMethodBindingEmitter extends FunctionEmitter {
throw new RuntimeException("Unhandled return type");
}
}
- }
+ }
protected static String cThisArgumentName() {
return "this0";
}
-
+
// Mangle a class, package or function name
protected String jniMangle(String name) {
return name.replaceAll("_", "_1").replace('.', '_');
@@ -1123,7 +1123,7 @@ public class CMethodBindingEmitter extends FunctionEmitter {
Class<?> c = type.getJavaClass();
if (c != null) {
jniMangle(c, buf, false);
- // If Buffer offset arguments were added, we need to mangle the JNI for the
+ // If Buffer offset arguments were added, we need to mangle the JNI for the
// extra arguments
if (type.isNIOBuffer()) {
jniMangle(Integer.TYPE, buf, false);
@@ -1132,7 +1132,7 @@ public class CMethodBindingEmitter extends FunctionEmitter {
}
} else if (type.isNIOBufferArray()) {
int[] intArrayType = new int[0];
- c = intArrayType.getClass();
+ c = intArrayType.getClass();
jniMangle(c , buf, true);
}
if (type.isPrimitiveArray()) {
@@ -1235,7 +1235,7 @@ public class CMethodBindingEmitter extends FunctionEmitter {
writer.print(elementTypeString);
writer.print(" *) malloc(");
writer.print(numElementsExpression);
- writer.print(" * sizeof(");
+ writer.print(" * sizeof(");
writer.print(elementTypeString);
writer.println("));");
// Catch memory allocation failure
@@ -1274,7 +1274,7 @@ public class CMethodBindingEmitter extends FunctionEmitter {
writer.print(sourceVarName);
writer.println(", (jboolean*)NULL);");
// Catch memory allocation failure in the event that the VM didn't pin
- // the String and failed to allocate a copy
+ // the String and failed to allocate a copy
emitOutOfMemoryCheck( writer, receivingVarName, "Failed to get UTF-8 chars for argument \\\""+sourceVarName+"\\\"");
} else {
// The UTF-16 case is basically Windows specific. Unix platforms
@@ -1301,7 +1301,7 @@ public class CMethodBindingEmitter extends FunctionEmitter {
} else {
writer.println();
}
- }
+ }
private void emitGetDirectBufferAddress(PrintWriter writer,
String sourceVarName,
@@ -1332,7 +1332,7 @@ public class CMethodBindingEmitter extends FunctionEmitter {
writer.println();
}
}
-
+
// Note: if the data in the Type needs to be converted from the Java memory
// model to the C memory model prior to calling any C-side functions, then
// an extra variable named XXX_copy (where XXX is the value of the
@@ -1367,12 +1367,12 @@ public class CMethodBindingEmitter extends FunctionEmitter {
} else {
// type is pointer to pointer of some type we don't support (maybe
// it's an array of pointers to structs?)
- throw new RuntimeException("Unsupported pointer type: \"" + cType.getName() + "\"");
+ throw new RuntimeException("Unsupported pointer type: \"" + cType.getName() + "\"");
}
} else {
// type is pointer to pointer of some type we don't support (maybe
// it's an array of pointers to structs?)
- throw new RuntimeException("Unsupported pointer type: \"" + cType.getName() + "\"");
+ throw new RuntimeException("Unsupported pointer type: \"" + cType.getName() + "\"");
}
}
} else {
@@ -1431,7 +1431,7 @@ public class CMethodBindingEmitter extends FunctionEmitter {
emitGetDirectBufferAddress(writer,
incomingArgumentName,
cType.getName(),
- cVariableName,
+ cVariableName,
byteOffsetVarName,
false);
}
@@ -1443,7 +1443,7 @@ public class CMethodBindingEmitter extends FunctionEmitter {
protected String byteOffsetArgName(String s) {
return s + "_byte_offset";
}
-
+
protected String isNIOArgName(int i) {
return isNIOArgName(binding.getArgumentName(i));
}
@@ -1451,11 +1451,11 @@ public class CMethodBindingEmitter extends FunctionEmitter {
protected String isNIOArgName(String s) {
return s + "_is_nio";
}
-
+
protected String byteOffsetArrayArgName(int i) {
return binding.getArgumentName(i) + "_byte_offset_array";
}
-
+
protected String[] argumentNameArray() {
String[] argumentNames = new String[binding.getNumArguments()];
for (int i = 0; i < binding.getNumArguments(); i++) {
@@ -1478,7 +1478,7 @@ public class CMethodBindingEmitter extends FunctionEmitter {
* emitter java method.
*/
protected static class DefaultCommentEmitter implements CommentEmitter {
- public void emit(FunctionEmitter emitter, PrintWriter writer) {
+ public void emit(FunctionEmitter emitter, PrintWriter writer) {
emitBeginning((CMethodBindingEmitter)emitter, writer);
emitEnding((CMethodBindingEmitter)emitter, writer);
}
diff --git a/src/java/com/jogamp/gluegen/CodeGenUtils.java b/src/java/com/jogamp/gluegen/CodeGenUtils.java
index 1b28eb8..4c96915 100644
--- a/src/java/com/jogamp/gluegen/CodeGenUtils.java
+++ b/src/java/com/jogamp/gluegen/CodeGenUtils.java
@@ -1,21 +1,21 @@
/*
* 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
@@ -28,11 +28,11 @@
* 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.
*/
diff --git a/src/java/com/jogamp/gluegen/CommentEmitter.java b/src/java/com/jogamp/gluegen/CommentEmitter.java
index 89db474..7968909 100644
--- a/src/java/com/jogamp/gluegen/CommentEmitter.java
+++ b/src/java/com/jogamp/gluegen/CommentEmitter.java
@@ -1,21 +1,21 @@
/*
* 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
@@ -28,11 +28,11 @@
* 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.
*/
@@ -46,6 +46,6 @@ public interface CommentEmitter {
* Emit the body of a comment for the specified function; do NOT emit the
* open (e.g., comment "/*") or close (e.g., "*\/") characters.
*/
- public void emit(FunctionEmitter funcEmitter, PrintWriter output);
+ public void emit(FunctionEmitter funcEmitter, PrintWriter output);
}
diff --git a/src/java/com/jogamp/gluegen/ConstantDefinition.java b/src/java/com/jogamp/gluegen/ConstantDefinition.java
index 4971eda..9edb827 100644
--- a/src/java/com/jogamp/gluegen/ConstantDefinition.java
+++ b/src/java/com/jogamp/gluegen/ConstantDefinition.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2008 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
@@ -28,7 +28,7 @@
* 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.
- *
+ *
*/
package com.jogamp.gluegen;
@@ -96,12 +96,12 @@ public class ConstantDefinition {
return aliasedNames;
}
- public String getOrigName() {
- return origName;
+ public String getOrigName() {
+ return origName;
}
- public String getName() {
- return name;
+ public String getName() {
+ return name;
}
public String getValue() { return value; }
@@ -128,5 +128,5 @@ public class ConstantDefinition {
+ " aliasedNames " + aliasedNames + " aliases " + aliases
+ " enumName " + enumName + " isEnum " + isEnum + "]";
}
-
+
}
diff --git a/src/java/com/jogamp/gluegen/DebugEmitter.java b/src/java/com/jogamp/gluegen/DebugEmitter.java
index 336cc8b..d5fab6e 100644
--- a/src/java/com/jogamp/gluegen/DebugEmitter.java
+++ b/src/java/com/jogamp/gluegen/DebugEmitter.java
@@ -1,21 +1,21 @@
/*
* 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
@@ -28,11 +28,11 @@
* 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.
*/
@@ -54,7 +54,7 @@ public class DebugEmitter implements GlueEmitter {
System.out.println("----- BEGIN EMISSION OF GLUE CODE -----");
}
- public void endEmission() {
+ public void endEmission() {
System.out.println("----- END EMISSION OF GLUE CODE -----");
}
@@ -67,7 +67,7 @@ public class DebugEmitter implements GlueEmitter {
(optionalComment != null ? ("// " + optionalComment) : ""));
}
public void endDefines() {}
-
+
public void beginFunctions(TypeDictionary typedefDictionary,
TypeDictionary structDictionary,
Map<Type, Type> canonMap) {
@@ -77,7 +77,7 @@ public class DebugEmitter implements GlueEmitter {
System.out.println("typedef " + value + " " + key + ";");
}
}
-
+
public Iterator<FunctionSymbol> emitFunctions(List<FunctionSymbol> originalCFunctions) throws Exception {
for (FunctionSymbol sym : originalCFunctions) {
emitSingleFunction(sym);
diff --git a/src/java/com/jogamp/gluegen/FunctionEmitter.java b/src/java/com/jogamp/gluegen/FunctionEmitter.java
index f9fbd21..8bb2ca5 100644
--- a/src/java/com/jogamp/gluegen/FunctionEmitter.java
+++ b/src/java/com/jogamp/gluegen/FunctionEmitter.java
@@ -1,21 +1,21 @@
/*
* 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
@@ -28,11 +28,11 @@
* 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.
*/
@@ -59,7 +59,7 @@ public abstract class FunctionEmitter {
this.defaultOutput = defaultOutput;
this.isInterfaceVal = isInterface;
}
-
+
/**
* Makes this FunctionEmitter a copy of the passed one.
*/
@@ -133,7 +133,7 @@ public abstract class FunctionEmitter {
* null, in which case no comment emitter has been set.
*/
public CommentEmitter getCommentEmitter() { return commentEmitter; }
-
+
protected void emitDocComment(PrintWriter writer) {
if (commentEmitter != null) {
@@ -144,13 +144,13 @@ public abstract class FunctionEmitter {
commentEmitter.emit(this, writer);
writer.print(getBaseIndentString()); //indent
-
+
writer.println(getCommentEndString());
}
}
-
+
protected void emitSignature(PrintWriter writer) {
-
+
writer.print(getBaseIndentString()); // indent method
int numEmitted = emitModifiers(writer);
@@ -182,21 +182,21 @@ public abstract class FunctionEmitter {
}
protected String getBaseIndentString() { return ""; }
-
+
protected String getCommentStartString() { return "/* "; }
protected String getCommentEndString() { return " */"; }
-
+
protected abstract void emitReturnType(PrintWriter writer);
- protected abstract void emitName(PrintWriter writer);
+ protected abstract void emitName(PrintWriter writer);
/** Returns the number of arguments emitted. */
- protected abstract int emitArguments(PrintWriter writer);
+ protected abstract int emitArguments(PrintWriter writer);
protected abstract void emitBody(PrintWriter writer);
-
+
public static class EmissionModifier {
@Override
public final String toString() { return emittedForm; }
-
+
private String emittedForm;
@Override
@@ -213,7 +213,7 @@ public abstract class FunctionEmitter {
return emittedForm.equals(((EmissionModifier) arg).emittedForm);
}
- protected EmissionModifier(String emittedForm) { this.emittedForm = emittedForm; }
+ protected EmissionModifier(String emittedForm) { this.emittedForm = emittedForm; }
}
}
diff --git a/src/java/com/jogamp/gluegen/GlueEmitter.java b/src/java/com/jogamp/gluegen/GlueEmitter.java
index c574d2e..bd5a7f3 100644
--- a/src/java/com/jogamp/gluegen/GlueEmitter.java
+++ b/src/java/com/jogamp/gluegen/GlueEmitter.java
@@ -1,21 +1,21 @@
/*
* 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
@@ -28,11 +28,11 @@
* 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.
*/
@@ -72,7 +72,7 @@ public interface GlueEmitter {
*/
public void emitDefine(ConstantDefinition def, String optionalComment) throws Exception;
public void endDefines() throws Exception;
-
+
public void beginFunctions(TypeDictionary typedefDictionary,
TypeDictionary structDictionary,
Map<Type, Type> canonMap) throws Exception;
diff --git a/src/java/com/jogamp/gluegen/GlueEmitterControls.java b/src/java/com/jogamp/gluegen/GlueEmitterControls.java
index 07b370d..e4d80b0 100644
--- a/src/java/com/jogamp/gluegen/GlueEmitterControls.java
+++ b/src/java/com/jogamp/gluegen/GlueEmitterControls.java
@@ -1,21 +1,21 @@
/*
* 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
@@ -28,11 +28,11 @@
* 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.
*/
diff --git a/src/java/com/jogamp/gluegen/GlueGen.java b/src/java/com/jogamp/gluegen/GlueGen.java
index bc75be5..76eda1f 100644
--- a/src/java/com/jogamp/gluegen/GlueGen.java
+++ b/src/java/com/jogamp/gluegen/GlueGen.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -51,7 +51,7 @@ import com.jogamp.gluegen.pcpp.*;
import static java.lang.System.*;
-/**
+/**
* Glue code generator for C functions and data structures.<br>
*/
public class GlueGen implements GlueEmitterControls {
@@ -62,15 +62,15 @@ public class GlueGen implements GlueEmitterControls {
private List<String> forcedStructNames = new ArrayList<String>();
private PCPP preprocessor;
-
+
// State for SymbolFilters
private List<ConstantDefinition> constants;
private List<FunctionSymbol> functions;
-
+
private static boolean debug = false;
public static boolean debug() { return debug; }
-
+
public void forceStructEmission(String typedefName) {
forcedStructNames.add(typedefName);
}
@@ -91,7 +91,7 @@ public class GlueGen implements GlueEmitterControls {
}
}
-
+
@SuppressWarnings("unchecked")
public void run(final Reader reader, final String filename, Class<?> emitterClass, List<String> includePaths, List<String> cfgFiles, String outputRootDir, boolean copyPCPPOutput2Stderr) {
diff --git a/src/java/com/jogamp/gluegen/JavaConfiguration.java b/src/java/com/jogamp/gluegen/JavaConfiguration.java
index c3e2346..23db7b4 100644
--- a/src/java/com/jogamp/gluegen/JavaConfiguration.java
+++ b/src/java/com/jogamp/gluegen/JavaConfiguration.java
@@ -5,18 +5,18 @@
* 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -64,7 +64,7 @@ public class JavaConfiguration {
public static final boolean DEBUG_IGNORES = GlueGen.debug() || false;
public static final boolean DEBUG_RENAMES = GlueGen.debug() || false;
-
+
private int nestedReads;
private String packageName;
private String implPackageName;
@@ -72,7 +72,7 @@ public class JavaConfiguration {
private String implClassName;
protected static final Logger LOG = Logger.getLogger(JavaConfiguration.class.getPackage().getName());
-
+
/**
* Root directory for the hierarchy of generated java classes. Default is
* working directory.
@@ -178,7 +178,7 @@ public class JavaConfiguration {
public final void read(String filename) throws IOException {
read(filename, null);
}
-
+
/** Reads the specified file, treating each line as if it started with the
specified string.
@param filename path to file that should be read
@@ -209,7 +209,7 @@ public class JavaConfiguration {
// comment line
continue;
}
-
+
StringTokenizer tok = new StringTokenizer(line);
if (tok.hasMoreTokens()) {
// always reset delimiters in case of CustomJavaCode, etc.
@@ -466,7 +466,7 @@ public class JavaConfiguration {
else if (c == Float.TYPE) jt = JavaType.createForCFloatPointer();
else if (c == Double.TYPE) jt = JavaType.createForCDoublePointer();
- if (jt != null)
+ if (jt != null)
return new TypeInfo(info.name(), pd + numPointersStripped, jt);
}
@@ -474,7 +474,7 @@ public class JavaConfiguration {
c = Array.newInstance(c, 0).getClass();
--diff;
}
-
+
return new TypeInfo(info.name(),
numPointersStripped,
JavaType.createForClass(c));
@@ -522,7 +522,7 @@ public class JavaConfiguration {
/** Returns true if the given function should only create a java.nio
variant, and no array variants, for <code>void*</code> and other
C primitive pointers. NIO direct only does only allow direct Buffers.
- Implies useNIOOnly !
+ Implies useNIOOnly !
*/
public boolean useNIODirectOnly(String functionName) {
return forceUseNIODirectOnly4All || useNIODirectOnly.contains(functionName);
@@ -671,20 +671,20 @@ public class JavaConfiguration {
}
}
private static boolean dumpedRenames = false;
-
+
public void dumpRenames() {
System.err.println("Symbol Renames: ");
for (String key : javaSymbolRenames.keySet()) {
System.err.println("\t"+key+" -> "+javaSymbolRenames.get(key));
}
-
+
System.err.println("Symbol Aliasing (through renaming): ");
for(String newName : javaSymbolRenames.values()) {
Set<String> origNames = javaRenamedSymbols.get(newName);
if(null!=origNames) {
System.err.println("\t"+newName+" <- "+origNames);
}
- }
+ }
}
/** Returns true if this #define, function, struct, or field within
@@ -762,7 +762,7 @@ public class JavaConfiguration {
for (Pattern regexp : ignoreNots) {
Matcher matcher = regexp.matcher(symbol);
if (!matcher.matches()) {
- // Special case as this is most often likely to be the case.
+ // Special case as this is most often likely to be the case.
// Unignores are not used very often.
if(unignores.isEmpty()) {
if(DEBUG_IGNORES) {
@@ -770,7 +770,7 @@ public class JavaConfiguration {
}
return true;
}
-
+
boolean unignoreFound = false;
for (Pattern unignoreRegexp : unignores) {
Matcher unignoreMatcher = unignoreRegexp.matcher(symbol);
@@ -779,7 +779,7 @@ public class JavaConfiguration {
break;
}
}
-
+
if (!unignoreFound)
if(DEBUG_IGNORES) {
System.err.println("Ignore Impl !unignore: "+symbol);
@@ -836,7 +836,7 @@ public class JavaConfiguration {
public Set<String> getRenamedJavaSymbols(String aliasedName) {
return javaRenamedSymbols.get(aliasedName);
}
-
+
/** Programmatically adds a rename directive for the given symbol. */
public void addJavaSymbolRename(String origName, String newName) {
if(DEBUG_RENAMES) {
@@ -850,13 +850,13 @@ public class JavaConfiguration {
if(DEBUG_RENAMES) {
System.err.println();
}
-
+
Set<String> origNames = javaRenamedSymbols.get(newName);
if(null == origNames) {
origNames = new HashSet<String>();
javaRenamedSymbols.put(newName, origNames);
}
- origNames.add(origName);
+ origNames.add(origName);
}
/** Returns true if the emission style is AllStatic. */
@@ -907,7 +907,7 @@ public class JavaConfiguration {
//
protected void dispatch(String cmd, StringTokenizer tok, File file, String filename, int lineNo) throws IOException {
- //System.err.println("read cmd = [" + cmd + "]");
+ //System.err.println("read cmd = [" + cmd + "]");
if (cmd.equalsIgnoreCase("Package")) {
packageName = readString("package", tok, filename, lineNo);
} else if (cmd.equalsIgnoreCase("GlueGenRuntimePackage")) {
@@ -1172,7 +1172,7 @@ public class JavaConfiguration {
final Set<String> parsedEnumNames = parser.getParsedEnumNames();
final Set<String> parsedFuncNames = parser.getParsedFunctionNames();
-
+
if(forInterface) {
if(onlyList) {
extendedIntfSymbolsOnly.addAll(parsedEnumNames);
@@ -1181,7 +1181,7 @@ public class JavaConfiguration {
extendedIntfSymbolsIgnore.addAll(parsedEnumNames);
extendedIntfSymbolsIgnore.addAll(parsedFuncNames);
}
- }
+ }
if(forImplementation) {
if(onlyList) {
extendedImplSymbolsOnly.addAll(parsedEnumNames);
@@ -1213,12 +1213,12 @@ public class JavaConfiguration {
ignoreMap.remove(regex);
ignores.remove(pattern);
- // If the pattern wasn't registered before, then make sure we have a
+ // If the pattern wasn't registered before, then make sure we have a
// valid pattern instance to put into the unignores set.
if(pattern == null)
pattern = Pattern.compile(regex);
unignores.add(pattern);
-
+
//System.err.println("UN-IGNORING " + regex + " / " + ignores.get(regex));
} catch (NoSuchElementException e) {
throw new RuntimeException("Error parsing \"Unignore\" command at line " + lineNo +
@@ -1329,7 +1329,7 @@ public class JavaConfiguration {
* <pre>
* public abstract void FuncName(byte[] ugh, int bar, byte[] foo, byte[] goop);
* </pre>
- *
+ *
* However, if you supplied the following directive:
*
* <pre>
@@ -1363,7 +1363,7 @@ public class JavaConfiguration {
" in file \"" + filename + "\"", e);
}
}
-
+
protected void readStructPackage(StringTokenizer tok, String filename, int lineNo) {
try {
String struct = tok.nextToken();
@@ -1453,7 +1453,7 @@ public class JavaConfiguration {
while (tok.countTokens() > 1)
{
linePrefix.append(tok.nextToken());
- linePrefix.append(" ");
+ linePrefix.append(" ");
}
// last token is filename
String includedFilename = tok.nextToken();
@@ -1538,7 +1538,7 @@ public class JavaConfiguration {
}
addJavaPrologueOrEpilogue(methodName, restOfLine, prologue);
} catch (NoSuchElementException e) {
- throw new RuntimeException("Error parsing \"" +
+ throw new RuntimeException("Error parsing \"" +
(prologue ? "JavaPrologue" : "JavaEpilogue") +
"\" command at line " + lineNo +
" in file \"" + filename + "\"", e);
diff --git a/src/java/com/jogamp/gluegen/JavaEmitter.java b/src/java/com/jogamp/gluegen/JavaEmitter.java
index 914f5a8..33b089a 100644
--- a/src/java/com/jogamp/gluegen/JavaEmitter.java
+++ b/src/java/com/jogamp/gluegen/JavaEmitter.java
@@ -86,11 +86,11 @@ public class JavaEmitter implements GlueEmitter {
/**
* Access control for emitted Java methods.
*/
- public enum MethodAccess {
+ public enum MethodAccess {
PUBLIC("public"), PROTECTED("protected"), PRIVATE("private"), PACKAGE_PRIVATE("/* pp */"), PUBLIC_ABSTRACT("abstract");
-
+
public final String getJavaName() { return javaName; }
-
+
MethodAccess(String javaName) {
this.javaName = javaName;
}
@@ -102,7 +102,7 @@ public class JavaEmitter implements GlueEmitter {
private PrintWriter cWriter;
private final MachineDescription machDescJava = MachineDescription.StaticConfig.X86_64_UNIX.md;
private final MachineDescription.StaticConfig[] machDescTargetConfigs = MachineDescription.StaticConfig.values();
-
+
protected final static Logger LOG = Logger.getLogger(JavaEmitter.class.getPackage().getName());
public void readConfigurationFile(String filename) throws Exception {
@@ -615,7 +615,7 @@ public class JavaEmitter implements GlueEmitter {
}
}
- protected void prepCEmitter(MethodBinding binding, CMethodBindingEmitter cEmitter)
+ protected void prepCEmitter(MethodBinding binding, CMethodBindingEmitter cEmitter)
{
// See whether we need an expression to help calculate the
// length of any return type
@@ -786,14 +786,14 @@ public class JavaEmitter implements GlueEmitter {
String containingTypeName = containingType.getName();
// machDescJava global MachineDescription is the one used to determine
- // the sizes of the primitive types seen in the public API in Java.
+ // the sizes of the primitive types seen in the public API in Java.
// For example, if a C long is an element of a struct, it is the size
// of a Java int on a 32-bit machine but the size of a Java long
// on a 64-bit machine. To support both of these sizes with the
// same API, the abstract base class must take and return a Java
// long from the setter and getter for this field. However the
// implementation on a 32-bit platform must downcast this to an
- // int and set only an int's worth of data in the struct.
+ // int and set only an int's worth of data in the struct.
//
// The machDescTarget MachineDescription is the one used to determine how
// much data to set in or get from the struct and exactly from
@@ -872,10 +872,10 @@ public class JavaEmitter implements GlueEmitter {
writer.println();
writer.println(" StructAccessor accessor;");
writer.println();
- writer.println(" private static final int mdIdx = MachineDescriptionRuntime.getStatic().ordinal();");
+ writer.println(" private static final int mdIdx = MachineDescriptionRuntime.getStatic().ordinal();");
writer.println();
// generate all offset and size arrays
- generateOffsetAndSizeArrays(writer, containingTypeName, structType, null); /* w/o offset */
+ generateOffsetAndSizeArrays(writer, containingTypeName, structType, null); /* w/o offset */
for (int i = 0; i < structType.getNumFields(); i++) {
final Field field = structType.getField(i);
final Type fieldType = field.getType();
@@ -922,7 +922,7 @@ public class JavaEmitter implements GlueEmitter {
}
}
}
- }
+ }
writer.println();
writer.println(" public static int size() {");
@@ -1061,7 +1061,7 @@ public class JavaEmitter implements GlueEmitter {
writer.println(" }");
} else {
JavaType javaType = null;
-
+
try {
javaType = typeToJavaType(fieldType, false, machDescJava);
} catch (Exception e) {
@@ -1071,7 +1071,7 @@ public class JavaEmitter implements GlueEmitter {
}
if (javaType.isPrimitive()) {
// Primitive type
- final boolean fieldTypeNativeSizeFixed = fieldType.getSize().hasFixedNativeSize();
+ final boolean fieldTypeNativeSizeFixed = fieldType.getSize().hasFixedNativeSize();
final String javaTypeName;
if ( isOpaque(fieldType) ) {
javaTypeName = compatiblePrimitiveJavaTypeName(fieldType, javaType, machDescJava);
@@ -1079,15 +1079,15 @@ public class JavaEmitter implements GlueEmitter {
javaTypeName = javaType.getName();
}
final String capJavaTypeName = capitalizeString(javaTypeName);
- final String capFieldName = capitalizeString(fieldName);
+ final String capFieldName = capitalizeString(fieldName);
final String sizeDenominator = fieldType.isPointer() ? "pointer" : javaTypeName ;
-
+
if(GlueGen.debug()) {
System.err.println("Java.StructEmitter.Primitive: "+field.getName()+", "+fieldType.getName(true)+", "+javaTypeName+", "+
", fixedSize "+fieldTypeNativeSizeFixed+", opaque "+isOpaque(fieldType)+", isPointer "+fieldType.isPointer()+", isCompound "+fieldType.isCompound()+
", sizeDenominator "+sizeDenominator);
}
-
+
writer.println();
// Setter
generateSetterSignature(writer, false, containingTypeName, capFieldName, javaTypeName);
@@ -1100,16 +1100,16 @@ public class JavaEmitter implements GlueEmitter {
writer.println(" return this;");
writer.println(" }");
writer.println();
-
+
// Getter
generateGetterSignature(writer, false, javaTypeName, capFieldName);
writer.println(" {");
- writer.print (" return ");
+ writer.print (" return ");
if( fieldTypeNativeSizeFixed ) {
writer.println("accessor.get" + capJavaTypeName + "At(" + fieldName+"_offset[mdIdx]);");
} else {
writer.println("accessor.get" + capJavaTypeName + "At(" + fieldName+"_offset[mdIdx], MachineDescriptionRuntime.getStatic().md."+sizeDenominator+"SizeInBytes());");
- }
+ }
writer.println(" }");
}
}
@@ -1162,9 +1162,9 @@ public class JavaEmitter implements GlueEmitter {
writer.print(" public " + (abstractMethod ? "abstract " : "") + returnTypeName + " set" + capitalizedFieldName + "(" + paramTypeName + " val)");
}
- private void generateOffsetAndSizeArrays(PrintWriter writer, String fieldName, Type fieldType, Field field) {
+ private void generateOffsetAndSizeArrays(PrintWriter writer, String fieldName, Type fieldType, Field field) {
if(null != field) {
- writer.print(" private static final int[] "+fieldName+"_offset = new int[] { ");
+ writer.print(" private static final int[] "+fieldName+"_offset = new int[] { ");
for( int i=0; i < machDescTargetConfigs.length; i++ ) {
if(0<i) {
writer.print(", ");
@@ -1175,7 +1175,7 @@ public class JavaEmitter implements GlueEmitter {
writer.println(" };");
}
if(null!=fieldType) {
- writer.print(" private static final int[] "+fieldName+"_size = new int[] { ");
+ writer.print(" private static final int[] "+fieldName+"_size = new int[] { ");
for( int i=0; i < machDescTargetConfigs.length; i++ ) {
if(0<i) {
writer.print(", ");
@@ -1186,7 +1186,7 @@ public class JavaEmitter implements GlueEmitter {
writer.println(" };");
}
}
-
+
private JavaType typeToJavaType(Type cType, boolean outgoingArgument, MachineDescription curMachDesc) {
// Recognize JNIEnv* case up front
PointerType opt = cType.asPointer();
@@ -1254,7 +1254,7 @@ public class JavaEmitter implements GlueEmitter {
// t is <type>[], we need to get <type>
targetType = t.asArray().getElementType();
}
-
+
// Handle Types of form pointer-to-type or array-of-type, like
// char* or int[]; these are expanded out into Java primitive
// arrays, NIO buffers, or both in expandMethodBinding
@@ -1263,7 +1263,7 @@ public class JavaEmitter implements GlueEmitter {
return JavaType.createForCVoidPointer();
} else if (targetType.isInt()) {
final SizeThunk targetSizeThunk = targetType.getSize();
- if( null != targetSizeThunk && SizeThunk.POINTER == targetSizeThunk ) {
+ if( null != targetSizeThunk && SizeThunk.POINTER == targetSizeThunk ) {
// Map intptr_t*, uintptr_t*, ptrdiff_t* and size_t* to PointerBuffer, since referenced memory-size is arch dependent
return JavaType.forNIOPointerBufferClass();
}
diff --git a/src/java/com/jogamp/gluegen/JavaMethodBindingEmitter.java b/src/java/com/jogamp/gluegen/JavaMethodBindingEmitter.java
index bd99486..81188a5 100644
--- a/src/java/com/jogamp/gluegen/JavaMethodBindingEmitter.java
+++ b/src/java/com/jogamp/gluegen/JavaMethodBindingEmitter.java
@@ -54,7 +54,7 @@ import java.util.List;
* An emitter that emits only the interface for a Java<->C JNI binding.
*/
public class JavaMethodBindingEmitter extends FunctionEmitter {
-
+
public static final EmissionModifier PUBLIC = new EmissionModifier("public");
public static final EmissionModifier PROTECTED = new EmissionModifier("protected");
public static final EmissionModifier PRIVATE = new EmissionModifier("private");
diff --git a/src/java/com/jogamp/gluegen/JavaType.java b/src/java/com/jogamp/gluegen/JavaType.java
index a6cf890..8a79559 100644
--- a/src/java/com/jogamp/gluegen/JavaType.java
+++ b/src/java/com/jogamp/gluegen/JavaType.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -50,8 +50,8 @@ import com.jogamp.gluegen.cgram.types.*;
* contains some utility methods for creating common types.
*/
public class JavaType {
-
- /*
+
+ /*
* Represents C arrays that will / can be represented
* with NIO buffers (resolved down to another JavaType later in processing)
*/
@@ -309,13 +309,13 @@ public class JavaType {
if (elementType.isArray()) {
// Type is array-of-arrays-of-something
-
- if (elementType.getComponentType().isPrimitive()) {
- // Type is an array-of-arrays-of-primitive
+
+ if (elementType.getComponentType().isPrimitive()) {
+ // Type is an array-of-arrays-of-primitive
return "jobjectArray /* elements are " + elementType.getComponentType() + "[]*/";
//return "jobjectArray";
} else {
- throw new RuntimeException("Multi-dimensional arrays of types that are not primitives or Strings are not supported.");
+ throw new RuntimeException("Multi-dimensional arrays of types that are not primitives or Strings are not supported.");
}
}
@@ -431,12 +431,12 @@ public class JavaType {
public boolean isCompoundTypeWrapper() {
return (clazz == null && name != null && !isJNIEnv());
}
-
+
public boolean isArrayOfCompoundTypeWrappers() {
return elementType != null;
}
-
-
+
+
public boolean isCPrimitivePointerType() {
return primitivePointerType != null;
}
@@ -482,7 +482,7 @@ public class JavaType {
public String toString() {
return getName();
}
-
+
//----------------------------------------------------------------------
// Internals only below this point
//
@@ -537,7 +537,7 @@ public class JavaType {
this.name = name;
this.elementType = elementType;
}
-
+
private String arrayName(Class<?> clazz) {
StringBuilder buf = new StringBuilder();
int arrayCount = 0;
diff --git a/src/java/com/jogamp/gluegen/Logging.java b/src/java/com/jogamp/gluegen/Logging.java
index d8c1b5a..4ed4dba 100644
--- a/src/java/com/jogamp/gluegen/Logging.java
+++ b/src/java/com/jogamp/gluegen/Logging.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
/*
* Created on Wednesday, March 31 2010 13:30
*/
@@ -46,8 +46,8 @@ import com.jogamp.common.util.PropertyAccess;
public class Logging {
static void init() {
- final String packageName = Logging.class.getPackage().getName();
- final String property = PropertyAccess.getProperty(packageName+".level", true);
+ final String packageName = Logging.class.getPackage().getName();
+ final String property = PropertyAccess.getProperty(packageName+".level", true);
Level level;
if(property != null) {
level = Level.parse(property);
diff --git a/src/java/com/jogamp/gluegen/ReferencedStructs.java b/src/java/com/jogamp/gluegen/ReferencedStructs.java
index b8a176f..f88594e 100644
--- a/src/java/com/jogamp/gluegen/ReferencedStructs.java
+++ b/src/java/com/jogamp/gluegen/ReferencedStructs.java
@@ -1,21 +1,21 @@
/*
* 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
@@ -28,11 +28,11 @@
* 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.
*/
@@ -49,7 +49,7 @@ public class ReferencedStructs implements TypeVisitor {
public void clear() {
results.clear();
}
-
+
public Iterator<Type> results() {
return results.iterator();
}
diff --git a/src/java/com/jogamp/gluegen/SymbolFilter.java b/src/java/com/jogamp/gluegen/SymbolFilter.java
index 724ff40..cf34067 100644
--- a/src/java/com/jogamp/gluegen/SymbolFilter.java
+++ b/src/java/com/jogamp/gluegen/SymbolFilter.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2008 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
@@ -28,7 +28,7 @@
* 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.
- *
+ *
*/
package com.jogamp.gluegen;
diff --git a/src/java/com/jogamp/gluegen/TypeInfo.java b/src/java/com/jogamp/gluegen/TypeInfo.java
index e480571..f5db353 100644
--- a/src/java/com/jogamp/gluegen/TypeInfo.java
+++ b/src/java/com/jogamp/gluegen/TypeInfo.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. 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
@@ -29,11 +29,11 @@
* 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.
*/
diff --git a/src/java/com/jogamp/gluegen/cgram/CSymbolTable.java b/src/java/com/jogamp/gluegen/cgram/CSymbolTable.java
index 318543b..69ec0ed 100644
--- a/src/java/com/jogamp/gluegen/cgram/CSymbolTable.java
+++ b/src/java/com/jogamp/gluegen/cgram/CSymbolTable.java
@@ -35,14 +35,14 @@ public class CSymbolTable {
scopeStack.removeElementAt(size - 1);
}
- /** return the current scope as a string
+ /** return the current scope as a string
*/
public String currentScopeAsString() {
StringBuilder buf = new StringBuilder(100);
boolean first = true;
Enumeration<String> e = scopeStack.elements();
while(e.hasMoreElements()) {
- if(first)
+ if(first)
first = false;
else
buf.append("::");
@@ -51,7 +51,7 @@ public class CSymbolTable {
return buf.toString();
}
- /** given a name for a type, append it with the
+ /** given a name for a type, append it with the
current scope.
*/
public String addCurrentScopeToName(String name) {
@@ -59,7 +59,7 @@ public class CSymbolTable {
return addScopeToName(currScope, name);
}
- /** given a name for a type, append it with the
+ /** given a name for a type, append it with the
given scope. MBZ
*/
public String addScopeToName(String scope, String name) {
@@ -80,7 +80,7 @@ public class CSymbolTable {
}
return null;
}
-
+
/** add a node to the table with it's key as
the current scope and the name */
public TNode add(String name, TNode node) {
@@ -116,7 +116,7 @@ public class CSymbolTable {
/** convert this table to a string */
public String toString() {
StringBuilder buff = new StringBuilder(300);
- buff.append("CSymbolTable { \nCurrentScope: " + currentScopeAsString() +
+ buff.append("CSymbolTable { \nCurrentScope: " + currentScopeAsString() +
"\nDefinedSymbols:\n");
Enumeration<String> ke = symTable.keys();
Enumeration<TNode> ve = symTable.elements();
diff --git a/src/java/com/jogamp/gluegen/cgram/CToken.java b/src/java/com/jogamp/gluegen/cgram/CToken.java
index f6bbf51..7bd48ad 100644
--- a/src/java/com/jogamp/gluegen/cgram/CToken.java
+++ b/src/java/com/jogamp/gluegen/cgram/CToken.java
@@ -6,22 +6,22 @@ public class CToken extends antlr.CommonToken {
String source = "";
int tokenNumber;
- public String getSource()
- {
+ public String getSource()
+ {
return source;
}
- public void setSource(String src)
+ public void setSource(String src)
{
source = src;
}
- public int getTokenNumber()
- {
+ public int getTokenNumber()
+ {
return tokenNumber;
}
- public void setTokenNumber(int i)
+ public void setTokenNumber(int i)
{
tokenNumber = i;
}
diff --git a/src/java/com/jogamp/gluegen/cgram/Define.java b/src/java/com/jogamp/gluegen/cgram/Define.java
index c2510df..1b23346 100644
--- a/src/java/com/jogamp/gluegen/cgram/Define.java
+++ b/src/java/com/jogamp/gluegen/cgram/Define.java
@@ -1,21 +1,21 @@
/*
* 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
@@ -28,11 +28,11 @@
* 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.
*/
diff --git a/src/java/com/jogamp/gluegen/cgram/LineObject.java b/src/java/com/jogamp/gluegen/cgram/LineObject.java
index 5104497..4914759 100644
--- a/src/java/com/jogamp/gluegen/cgram/LineObject.java
+++ b/src/java/com/jogamp/gluegen/cgram/LineObject.java
@@ -9,7 +9,7 @@ class LineObject {
boolean systemHeader = false;
boolean treatAsC = false;
- public LineObject()
+ public LineObject()
{
super();
}
@@ -25,27 +25,27 @@ class LineObject {
treatAsC = lobj.getTreatAsC();
}
- public LineObject( String src)
+ public LineObject( String src)
{
source = src;
}
- public void setSource(String src)
+ public void setSource(String src)
{
source = src;
}
- public String getSource()
+ public String getSource()
{
return source;
}
- public void setParent(LineObject par)
+ public void setParent(LineObject par)
{
parent = par;
}
- public LineObject getParent()
+ public LineObject getParent()
{
return parent;
}
@@ -55,7 +55,7 @@ class LineObject {
line = l;
}
- public int getLine()
+ public int getLine()
{
return line;
}
@@ -65,42 +65,42 @@ class LineObject {
line++;
}
- public void setEnteringFile(boolean v)
+ public void setEnteringFile(boolean v)
{
enteringFile = v;
}
- public boolean getEnteringFile()
+ public boolean getEnteringFile()
{
return enteringFile;
}
- public void setReturningToFile(boolean v)
+ public void setReturningToFile(boolean v)
{
returningToFile = v;
}
- public boolean getReturningToFile()
+ public boolean getReturningToFile()
{
return returningToFile;
}
- public void setSystemHeader(boolean v)
+ public void setSystemHeader(boolean v)
{
systemHeader = v;
}
- public boolean getSystemHeader()
+ public boolean getSystemHeader()
{
return systemHeader;
}
- public void setTreatAsC(boolean v)
+ public void setTreatAsC(boolean v)
{
treatAsC = v;
}
- public boolean getTreatAsC()
+ public boolean getTreatAsC()
{
return treatAsC;
}
diff --git a/src/java/com/jogamp/gluegen/cgram/PreprocessorInfoChannel.java b/src/java/com/jogamp/gluegen/cgram/PreprocessorInfoChannel.java
index 5281ab1..7cf64b0 100644
--- a/src/java/com/jogamp/gluegen/cgram/PreprocessorInfoChannel.java
+++ b/src/java/com/jogamp/gluegen/cgram/PreprocessorInfoChannel.java
@@ -28,11 +28,11 @@ public class PreprocessorInfoChannel
{
return maxTokenNumber;
}
-
+
public Vector<Object> extractLinesPrecedingTokenNumber( Integer toknum )
{
Vector<Object> lines = new Vector<Object>();
- if (toknum == null) return lines;
+ if (toknum == null) return lines;
for (int i = firstValidTokenNumber; i < toknum.intValue(); i++){
Integer inti = new Integer(i);
if ( lineLists.containsKey( inti ) ) {
diff --git a/src/java/com/jogamp/gluegen/cgram/TNode.java b/src/java/com/jogamp/gluegen/cgram/TNode.java
index 01ef626..00c4ffa 100644
--- a/src/java/com/jogamp/gluegen/cgram/TNode.java
+++ b/src/java/com/jogamp/gluegen/cgram/TNode.java
@@ -7,13 +7,13 @@ import java.lang.reflect.*;
import java.util.Hashtable;
import java.util.Enumeration;
-/**
+/**
Class TNode is an implementation of the AST interface
and adds many useful features:
It is double-linked for reverse searching.
(this is currently incomplete, in that method doubleLink() must
- be called after any changes to the tree to maintain the
+ be called after any changes to the tree to maintain the
reverse links).
It can store a definition node (defNode), so that nodes such
@@ -38,8 +38,8 @@ public class TNode extends CommonAST {
protected TNode left;
protected boolean marker = false;
protected Hashtable<String, Object> attributes = null;
- static String tokenVocabulary;
-
+ static String tokenVocabulary;
+
@@ -50,7 +50,7 @@ public class TNode extends CommonAST {
tokenVocabulary = s;
}
-
+
public void initialize(Token token) {
CToken tok = (CToken) token;
setText(tok.getText());
@@ -58,7 +58,7 @@ public void initialize(Token token) {
setLineNum(tok.getLine());
setAttribute("source", tok.getSource());
setAttribute("tokenNumber", new Integer(tok.getTokenNumber()));
-}
+}
public void initialize(AST tr) {
TNode t = (TNode) tr;
setText(t.getText());
@@ -66,31 +66,31 @@ public void initialize(AST tr) {
setLineNum(t.getLineNum());
setDefNode(t.getDefNode());
this.attributes = t.getAttributesTable();
-}
+}
/** Get the token type for this node */
public int getType() { return ttype; }
-
+
/** Set the token type for this node */
- public void setType(int ttype_) {
- ttype = ttype_;
+ public void setType(int ttype_) {
+ ttype = ttype_;
}
-
+
/** Get the marker value for this node.
This member is a general-use marker.
*/
public boolean getMarker() { return marker; }
-
+
/** Set the marker value for this node.
This property is a general-use boolean marker.
*/
- public void setMarker(boolean marker_) {
- marker = marker_;
+ public void setMarker(boolean marker_) {
+ marker = marker_;
}
/** get the hashtable that holds attribute values.
- */
+ */
public Hashtable<String, Object> getAttributesTable() {
if(attributes == null)
attributes = new Hashtable<String, Object>(7);
@@ -117,42 +117,42 @@ public void initialize(AST tr) {
/** Get the line number for this node.
If the line number is 0, search for a non-zero line num among children */
- public int getLineNum() {
+ public int getLineNum() {
if(lineNum != 0)
- return lineNum;
+ return lineNum;
else
if(down == null)
- return lineNum;
+ return lineNum;
else
return ((TNode)down).getLocalLineNum();
}
-
- public int getLocalLineNum() {
+
+ public int getLocalLineNum() {
if(lineNum != 0)
- return lineNum;
+ return lineNum;
else
if(down == null)
if(right == null)
- return lineNum;
+ return lineNum;
else
return ((TNode)right).getLocalLineNum();
else
return ((TNode)down).getLocalLineNum();
}
-
+
/** Set the line number for this node */
- public void setLineNum(int lineNum_) {
- lineNum = lineNum_;
+ public void setLineNum(int lineNum_) {
+ lineNum = lineNum_;
}
-
+
/** Get the token text for this node */
public String getText() { return text; }
-
+
/** Set the token text for this node */
- public void setText(String text_) {
- text = text_;
+ public void setText(String text_) {
+ text = text_;
}
-
+
/** Returns the text for this node and all children */
public String getAllChildrenText() {
StringBuilder buf = new StringBuilder();
@@ -167,12 +167,12 @@ public void initialize(AST tr) {
public TNode getLastChild() {
TNode down = (TNode)getFirstChild();
if(down != null)
- return down.getLastSibling();
- else
+ return down.getLastSibling();
+ else
return null;
}
- /** return the last sibling of this node, which is
+ /** return the last sibling of this node, which is
this if the next sibling is null */
public TNode getLastSibling() {
TNode next = (TNode)getNextSibling();
@@ -182,7 +182,7 @@ public void initialize(AST tr) {
return this;
}
- /** return the first sibling of this node, which is
+ /** return the first sibling of this node, which is
this if the prev sibling is null */
public TNode getFirstSibling() {
TNode prev = left;
@@ -201,7 +201,7 @@ public void initialize(AST tr) {
/** add the new node as a new sibling, inserting it ahead of any
existing next sibling. This method maintains double-linking.
- if node is null, nothing happens. If the node has siblings,
+ if node is null, nothing happens. If the node has siblings,
then they are added in as well.
*/
public void addSibling(AST node) {
@@ -215,7 +215,7 @@ public void initialize(AST tr) {
next.left = nodeLastSib;
}
-
+
/** return the number of children of this node */
public int numberOfChildren() {
int count = 0;
@@ -234,15 +234,15 @@ public void initialize(AST tr) {
TNode parent = up;
TNode prev = left;
TNode next = (TNode)right;
-
- if(parent != null) {
+
+ if(parent != null) {
parent.down = next;
if(next != null) {
next.up = parent;
next.left = prev; // which should be null
}
- }
- else {
+ }
+ else {
if(prev != null)
prev.right = next;
if(next != null)
@@ -255,7 +255,7 @@ public void initialize(AST tr) {
public TNode getDefNode() {
return defNode;
}
-
+
/** set the def node for this node */
public void setDefNode(TNode n) {
defNode = n;
@@ -307,7 +307,7 @@ public void initialize(AST tr) {
StringBuilder str = new StringBuilder( getNameForType(getType()) +
"[" + getText() + ", " + "]");
- if(this.getLineNum() != 0)
+ if(this.getLineNum() != 0)
str.append(" line:" + (this.getLineNum() ) );
Enumeration<String> keys = (this.getAttributesTable().keys());
@@ -331,23 +331,23 @@ public void initialize(AST tr) {
/** protected method that does the work of printing */
protected static void printASTNode(AST t, int indent) {
AST child1, next;
- child1 = t.getFirstChild();
+ child1 = t.getFirstChild();
System.out.print("\n");
- for(int i = 0; i < indent; i++)
+ for(int i = 0; i < indent; i++)
System.out.print(" ");
- if(child1 != null)
+ if(child1 != null)
System.out.print("(");
String s = t.getText();
if(s != null && s.length() > 0) {
System.out.print(getNameForType(t.getType()));
System.out.print(": \"" + s + "\"");
- }
+ }
else
System.out.print(getNameForType(t.getType()));
- if(((TNode)t).getLineNum() != 0)
+ if(((TNode)t).getLineNum() != 0)
System.out.print(" line:" + ((TNode)t).getLineNum() );
Enumeration<String> keys = ((TNode)t).getAttributesTable().keys();
@@ -364,7 +364,7 @@ public void initialize(AST tr) {
printASTNode(child1,indent + 1);
System.out.print("\n");
- for(int i = 0; i < indent; i++)
+ for(int i = 0; i < indent; i++)
System.out.print(" ");
System.out.print(")");
}
@@ -418,22 +418,22 @@ public void initialize(AST tr) {
return up.parentOfType(type);
}
- /** find the first child of the node
+ /** find the first child of the node
of the given type, return null on failure */
public TNode firstChildOfType(int type) {
TNode down = (TNode)getFirstChild();
- if(down == null)
+ if(down == null)
return null;
if(down.getType() == type)
return down;
return down.firstSiblingOfType(type);
}
- /** find the first sibling of the node
+ /** find the first sibling of the node
of the given type, return null on failure */
public TNode firstSiblingOfType(int type) {
TNode right = (TNode)getNextSibling();
- if(right == null)
+ if(right == null)
return null;
if(right.getType() == type)
return right;
diff --git a/src/java/com/jogamp/gluegen/cgram/TNodeFactory.java b/src/java/com/jogamp/gluegen/cgram/TNodeFactory.java
index 0a3fbcb..2984a84 100644
--- a/src/java/com/jogamp/gluegen/cgram/TNodeFactory.java
+++ b/src/java/com/jogamp/gluegen/cgram/TNodeFactory.java
@@ -9,8 +9,8 @@ import antlr.collections.AST;
public class TNodeFactory extends ASTFactory {
/** Create a new ampty AST node */
- public AST create() {
- return new TNode();
+ public AST create() {
+ return new TNode();
}
/** Create a new AST node from type and text */
@@ -29,5 +29,5 @@ public class TNodeFactory extends ASTFactory {
return newast;
}
-
+
}
diff --git a/src/java/com/jogamp/gluegen/cgram/types/ArrayType.java b/src/java/com/jogamp/gluegen/cgram/types/ArrayType.java
index 7bd7d42..bad63db 100644
--- a/src/java/com/jogamp/gluegen/cgram/types/ArrayType.java
+++ b/src/java/com/jogamp/gluegen/cgram/types/ArrayType.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -131,5 +131,5 @@ public class ArrayType extends MemoryLayoutType implements Cloneable {
Type newCVVariant(int cvAttributes) {
return new ArrayType(elementType, getSize(), length, cvAttributes);
- }
+ }
}
diff --git a/src/java/com/jogamp/gluegen/cgram/types/BitType.java b/src/java/com/jogamp/gluegen/cgram/types/BitType.java
index a7a1f55..4862749 100644
--- a/src/java/com/jogamp/gluegen/cgram/types/BitType.java
+++ b/src/java/com/jogamp/gluegen/cgram/types/BitType.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -88,5 +88,5 @@ public class BitType extends IntType implements Cloneable {
@Override
Type newCVVariant(int cvAttributes) {
return new BitType(underlyingType, sizeInBits, offset, cvAttributes);
- }
+ }
}
diff --git a/src/java/com/jogamp/gluegen/cgram/types/CVAttributes.java b/src/java/com/jogamp/gluegen/cgram/types/CVAttributes.java
index 34b703e..f8a6095 100644
--- a/src/java/com/jogamp/gluegen/cgram/types/CVAttributes.java
+++ b/src/java/com/jogamp/gluegen/cgram/types/CVAttributes.java
@@ -1,21 +1,21 @@
/*
* 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
@@ -28,11 +28,11 @@
* 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.
*/
diff --git a/src/java/com/jogamp/gluegen/cgram/types/CompoundType.java b/src/java/com/jogamp/gluegen/cgram/types/CompoundType.java
index 746212d..4582a81 100644
--- a/src/java/com/jogamp/gluegen/cgram/types/CompoundType.java
+++ b/src/java/com/jogamp/gluegen/cgram/types/CompoundType.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -70,7 +70,7 @@ public abstract class CompoundType extends MemoryLayoutType implements Cloneable
throw new RuntimeException("OO relation "+kind+" / Compount not yet supported");
}
}
-
+
public Object clone() {
CompoundType n = (CompoundType) super.clone();
if(null!=this.fields) {
@@ -115,7 +115,7 @@ public abstract class CompoundType extends MemoryLayoutType implements Cloneable
public String getStructName() {
return structName;
}
-
+
/** Sets the struct name of this CompoundType, i.e. the "foo" in the
construct "struct foo { ... };". */
public void setStructName(String structName) {
@@ -132,7 +132,7 @@ public abstract class CompoundType extends MemoryLayoutType implements Cloneable
ArrayList<Field> getFields() { return fields; }
void setFields(ArrayList<Field> fields) { this.fields = fields; }
-
+
/** Returns the number of fields in this type. */
public int getNumFields() {
return ((fields == null) ? 0 : fields.size());
diff --git a/src/java/com/jogamp/gluegen/cgram/types/CompoundTypeKind.java b/src/java/com/jogamp/gluegen/cgram/types/CompoundTypeKind.java
index 37b813c..62d8d42 100644
--- a/src/java/com/jogamp/gluegen/cgram/types/CompoundTypeKind.java
+++ b/src/java/com/jogamp/gluegen/cgram/types/CompoundTypeKind.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -32,9 +32,9 @@ package com.jogamp.gluegen.cgram.types;
represented as compound types. Used while syntax parsing. */
public enum CompoundTypeKind {
STRUCT(0), UNION(1);
-
+
public final int id;
-
+
CompoundTypeKind(int id){
this.id = id;
}
diff --git a/src/java/com/jogamp/gluegen/cgram/types/DoubleType.java b/src/java/com/jogamp/gluegen/cgram/types/DoubleType.java
index 280485a..e95ffb9 100644
--- a/src/java/com/jogamp/gluegen/cgram/types/DoubleType.java
+++ b/src/java/com/jogamp/gluegen/cgram/types/DoubleType.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. 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
@@ -29,11 +29,11 @@
* 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.
*/
diff --git a/src/java/com/jogamp/gluegen/cgram/types/EnumType.java b/src/java/com/jogamp/gluegen/cgram/types/EnumType.java
index d21774f..9e142bd 100644
--- a/src/java/com/jogamp/gluegen/cgram/types/EnumType.java
+++ b/src/java/com/jogamp/gluegen/cgram/types/EnumType.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. 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
@@ -29,11 +29,11 @@
* 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.
*/
diff --git a/src/java/com/jogamp/gluegen/cgram/types/Field.java b/src/java/com/jogamp/gluegen/cgram/types/Field.java
index 891bb27..1c4b4fa 100644
--- a/src/java/com/jogamp/gluegen/cgram/types/Field.java
+++ b/src/java/com/jogamp/gluegen/cgram/types/Field.java
@@ -1,21 +1,21 @@
/*
* 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
@@ -28,11 +28,11 @@
* 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.
*/
diff --git a/src/java/com/jogamp/gluegen/cgram/types/FloatType.java b/src/java/com/jogamp/gluegen/cgram/types/FloatType.java
index 7766b8c..dff7a00 100644
--- a/src/java/com/jogamp/gluegen/cgram/types/FloatType.java
+++ b/src/java/com/jogamp/gluegen/cgram/types/FloatType.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. 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
@@ -29,11 +29,11 @@
* 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.
*/
diff --git a/src/java/com/jogamp/gluegen/cgram/types/FunctionSymbol.java b/src/java/com/jogamp/gluegen/cgram/types/FunctionSymbol.java
index f730c0e..c4802e7 100644
--- a/src/java/com/jogamp/gluegen/cgram/types/FunctionSymbol.java
+++ b/src/java/com/jogamp/gluegen/cgram/types/FunctionSymbol.java
@@ -1,21 +1,21 @@
/*
* 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
@@ -28,18 +28,18 @@
* 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.cgram.types;
-/**
+/**
* Describes a function symbol, which includes the name and
* type. Since we are currently only concerned with processing
* functions this is the only symbol type, though plausibly more
@@ -48,7 +48,7 @@ package com.jogamp.gluegen.cgram.types;
* Note: Since C does not support method-overloading polymorphism like C++ or Java,
* we ignore the {@link FunctionType} attribute in {@link #equals(Object)} and {@link #hashCode()}.<br/>
* Hence we assume all method occurrences w/ same name are of equal or compatible type. <br/>
- * Deep comparison can be performed via {@link #isCompletelyEqual(Object o)};
+ * Deep comparison can be performed via {@link #isCompletelyEqual(Object o)};
* </p>
**/
public class FunctionSymbol {
@@ -135,7 +135,7 @@ public class FunctionSymbol {
}
/**
- * Compares the function type as well, since {@link #equals(Object)}
+ * Compares the function type as well, since {@link #equals(Object)}
* and {@link #hashCode()} won't.
*/
public boolean isCompletelyEqual(Object arg) {
diff --git a/src/java/com/jogamp/gluegen/cgram/types/FunctionType.java b/src/java/com/jogamp/gluegen/cgram/types/FunctionType.java
index fcaf97b..c32d184 100644
--- a/src/java/com/jogamp/gluegen/cgram/types/FunctionType.java
+++ b/src/java/com/jogamp/gluegen/cgram/types/FunctionType.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. 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
@@ -29,11 +29,11 @@
* 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.
*/
diff --git a/src/java/com/jogamp/gluegen/cgram/types/IntType.java b/src/java/com/jogamp/gluegen/cgram/types/IntType.java
index b85c7fc..b37e741 100644
--- a/src/java/com/jogamp/gluegen/cgram/types/IntType.java
+++ b/src/java/com/jogamp/gluegen/cgram/types/IntType.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. 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
@@ -29,11 +29,11 @@
* 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.
*/
diff --git a/src/java/com/jogamp/gluegen/cgram/types/MemoryLayoutType.java b/src/java/com/jogamp/gluegen/cgram/types/MemoryLayoutType.java
index f8f83d3..df0d23e 100644
--- a/src/java/com/jogamp/gluegen/cgram/types/MemoryLayoutType.java
+++ b/src/java/com/jogamp/gluegen/cgram/types/MemoryLayoutType.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -32,10 +32,10 @@ public abstract class MemoryLayoutType extends Type {
protected MemoryLayoutType(String name, SizeThunk size, int cvAttributes) {
super(name, size, cvAttributes);
- isLayouted = false;
+ isLayouted = false;
}
public boolean isLayouted() { return isLayouted; }
public void setLayouted() { isLayouted = true; }
-
+
}
diff --git a/src/java/com/jogamp/gluegen/cgram/types/PointerType.java b/src/java/com/jogamp/gluegen/cgram/types/PointerType.java
index 4666e48..92544c5 100644
--- a/src/java/com/jogamp/gluegen/cgram/types/PointerType.java
+++ b/src/java/com/jogamp/gluegen/cgram/types/PointerType.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. 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
@@ -29,11 +29,11 @@
* 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.
*/
diff --git a/src/java/com/jogamp/gluegen/cgram/types/PrimitiveType.java b/src/java/com/jogamp/gluegen/cgram/types/PrimitiveType.java
index 1eea9a4..9d108df 100644
--- a/src/java/com/jogamp/gluegen/cgram/types/PrimitiveType.java
+++ b/src/java/com/jogamp/gluegen/cgram/types/PrimitiveType.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. 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
@@ -29,11 +29,11 @@
* 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.
*/
diff --git a/src/java/com/jogamp/gluegen/cgram/types/SizeThunk.java b/src/java/com/jogamp/gluegen/cgram/types/SizeThunk.java
index 33b17cc..b40d4f3 100644
--- a/src/java/com/jogamp/gluegen/cgram/types/SizeThunk.java
+++ b/src/java/com/jogamp/gluegen/cgram/types/SizeThunk.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2005 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -48,8 +48,8 @@ import com.jogamp.common.os.MachineDescription;
32-bit and 64-bit) from the same internal representation of the
various types involved. */
public abstract class SizeThunk implements Cloneable {
- private boolean fixedNativeSize;
-
+ private boolean fixedNativeSize;
+
// Private constructor because there are only a few of these
private SizeThunk(boolean fixedNativeSize) { this.fixedNativeSize = fixedNativeSize; }
@@ -60,7 +60,7 @@ public abstract class SizeThunk implements Cloneable {
throw new InternalError();
}
}
-
+
public final boolean hasFixedNativeSize() { return fixedNativeSize; }
public abstract long computeSize(MachineDescription machDesc);
@@ -156,7 +156,7 @@ public abstract class SizeThunk implements Cloneable {
return thunk1.computeSize(machDesc) + thunk2.computeSize(machDesc);
}
public long computeAlignment(MachineDescription machDesc) {
- final long thunk1A = thunk1.computeAlignment(machDesc);
+ final long thunk1A = thunk1.computeAlignment(machDesc);
final long thunk2A = thunk2.computeAlignment(machDesc);
return ( thunk1A > thunk2A ) ? thunk1A : thunk2A ;
}
@@ -170,7 +170,7 @@ public abstract class SizeThunk implements Cloneable {
return thunk1.computeSize(machDesc) * thunk2.computeSize(machDesc);
}
public long computeAlignment(MachineDescription machDesc) {
- final long thunk1A = thunk1.computeAlignment(machDesc);
+ final long thunk1A = thunk1.computeAlignment(machDesc);
final long thunk2A = thunk2.computeAlignment(machDesc);
return ( thunk1A > thunk2A ) ? thunk1A : thunk2A ;
}
@@ -185,17 +185,17 @@ public abstract class SizeThunk implements Cloneable {
// remainder = net_size & ( alignment - 1 )
// padding = alignment - remainder ;
// aligned_size = net_size + padding ;
-
+
final long size = offsetThunk.computeSize(machDesc);
final long alignment = alignmentThunk.computeAlignment(machDesc);
-
+
final long remainder = size & ( alignment - 1 ) ;
final long padding = (remainder > 0) ? alignment - remainder : 0;
return size + padding;
}
-
+
public long computeAlignment(MachineDescription machDesc) {
- final long thunk1A = offsetThunk.computeAlignment(machDesc);
+ final long thunk1A = offsetThunk.computeAlignment(machDesc);
final long thunk2A = alignmentThunk.computeAlignment(machDesc);
return ( thunk1A > thunk2A ) ? thunk1A : thunk2A ;
}
@@ -209,7 +209,7 @@ public abstract class SizeThunk implements Cloneable {
return Math.max(thunk1.computeSize(machDesc), thunk2.computeSize(machDesc));
}
public long computeAlignment(MachineDescription machDesc) {
- final long thunk1A = thunk1.computeAlignment(machDesc);
+ final long thunk1A = thunk1.computeAlignment(machDesc);
final long thunk2A = thunk2.computeAlignment(machDesc);
return ( thunk1A > thunk2A ) ? thunk1A : thunk2A ;
}
@@ -222,8 +222,8 @@ public abstract class SizeThunk implements Cloneable {
return constant;
}
public long computeAlignment(MachineDescription machDesc) {
- return 1; // no alignment for constants
- }
+ return 1; // no alignment for constants
+ }
};
}
}
diff --git a/src/java/com/jogamp/gluegen/cgram/types/StructLayout.java b/src/java/com/jogamp/gluegen/cgram/types/StructLayout.java
index 60284b9..11501e1 100644
--- a/src/java/com/jogamp/gluegen/cgram/types/StructLayout.java
+++ b/src/java/com/jogamp/gluegen/cgram/types/StructLayout.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -56,7 +56,7 @@ public class StructLayout {
public void layout(CompoundType t) {
/**
- * - 1) align offset for the new data type,
+ * - 1) align offset for the new data type,
* - 2) add the aligned size of the new data type
* - 3) add trailing padding (largest element size)
*/
@@ -123,7 +123,7 @@ public class StructLayout {
curOffset = SizeThunk.align(curOffset, curOffset);
t.setSize(curOffset);
}
- t.setLayouted();
+ t.setLayouted();
}
public static StructLayout create(int baseOffset) {
@@ -132,5 +132,5 @@ public class StructLayout {
public static void layout(int baseOffset, CompoundType t) {
create(baseOffset).layout(t);
- }
+ }
}
diff --git a/src/java/com/jogamp/gluegen/cgram/types/StructType.java b/src/java/com/jogamp/gluegen/cgram/types/StructType.java
index cade91c..74fca7c 100644
--- a/src/java/com/jogamp/gluegen/cgram/types/StructType.java
+++ b/src/java/com/jogamp/gluegen/cgram/types/StructType.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -32,7 +32,7 @@ public class StructType extends CompoundType {
public StructType(String name, SizeThunk size, int cvAttributes) {
this(name, size, cvAttributes, null);
}
-
+
StructType(String name, SizeThunk size, int cvAttributes, String structName) {
super (name, size, cvAttributes, structName);
}
@@ -47,11 +47,11 @@ public class StructType extends CompoundType {
public final boolean isStruct() { return true; }
public final boolean isUnion() { return false; }
-
+
Type newCVVariant(int cvAttributes) {
StructType t = new StructType(getName(), getSize(), cvAttributes, getStructName());
t.setFields(getFields());
return t;
}
-
+
}
diff --git a/src/java/com/jogamp/gluegen/cgram/types/TypeDictionary.java b/src/java/com/jogamp/gluegen/cgram/types/TypeDictionary.java
index be2adb4..3994c12 100644
--- a/src/java/com/jogamp/gluegen/cgram/types/TypeDictionary.java
+++ b/src/java/com/jogamp/gluegen/cgram/types/TypeDictionary.java
@@ -1,21 +1,21 @@
/*
* 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
@@ -28,11 +28,11 @@
* 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.
*/
@@ -92,7 +92,7 @@ public class TypeDictionary {
return map.remove(name);
}
- /** Get all the names that map to Types.
+ /** Get all the names that map to Types.
* @return a Set of Strings that are the typedef names that map to Types in the dictionary.
*/
public Set<String> keySet() {
@@ -106,7 +106,7 @@ public class TypeDictionary {
public boolean containsKey(String key) {
return map.containsKey(key);
}
-
+
public boolean containsValue(Type value) {
return map.containsValue(value);
}
diff --git a/src/java/com/jogamp/gluegen/cgram/types/TypeVisitor.java b/src/java/com/jogamp/gluegen/cgram/types/TypeVisitor.java
index 0889681..89c014b 100644
--- a/src/java/com/jogamp/gluegen/cgram/types/TypeVisitor.java
+++ b/src/java/com/jogamp/gluegen/cgram/types/TypeVisitor.java
@@ -1,21 +1,21 @@
/*
* 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
@@ -28,11 +28,11 @@
* 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.
*/
diff --git a/src/java/com/jogamp/gluegen/cgram/types/UnionType.java b/src/java/com/jogamp/gluegen/cgram/types/UnionType.java
index 4de10da..857507c 100644
--- a/src/java/com/jogamp/gluegen/cgram/types/UnionType.java
+++ b/src/java/com/jogamp/gluegen/cgram/types/UnionType.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -32,11 +32,11 @@ public class UnionType extends CompoundType {
public UnionType(String name, SizeThunk size, int cvAttributes) {
this(name, size, cvAttributes, null);
}
-
+
UnionType(String name, SizeThunk size, int cvAttributes, String structName) {
super (name, size, cvAttributes, structName);
}
-
+
@Override
public boolean equals(Object arg) {
if (arg == null || !(arg instanceof UnionType)) {
@@ -44,7 +44,7 @@ public class UnionType extends CompoundType {
}
return super.equals(arg);
}
-
+
public final boolean isStruct() { return false; }
public final boolean isUnion() { return true; }
@@ -53,5 +53,5 @@ public class UnionType extends CompoundType {
t.setFields(getFields());
return t;
}
-
+
}
diff --git a/src/java/com/jogamp/gluegen/cgram/types/VoidType.java b/src/java/com/jogamp/gluegen/cgram/types/VoidType.java
index fa098e7..1f76e70 100644
--- a/src/java/com/jogamp/gluegen/cgram/types/VoidType.java
+++ b/src/java/com/jogamp/gluegen/cgram/types/VoidType.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. 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
@@ -29,11 +29,11 @@
* 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.
*/
diff --git a/src/java/com/jogamp/gluegen/jgram/Test.java b/src/java/com/jogamp/gluegen/jgram/Test.java
index c890f67..8baff02 100644
--- a/src/java/com/jogamp/gluegen/jgram/Test.java
+++ b/src/java/com/jogamp/gluegen/jgram/Test.java
@@ -86,16 +86,16 @@ class Test {
String s = (String) iter.next();
System.out.println(s);
}
-
+
// do something with the tree
//doTreeAction(f, parser.getAST(), parser.getTokenNames());
}
catch (Exception e) {
System.err.println("parser exception: "+e);
- e.printStackTrace(); // so we can get stack trace
+ e.printStackTrace(); // so we can get stack trace
}
}
-
+
/*
public static void doTreeAction(String f, AST t, String[] tokenNames) {
if ( t==null ) return;
diff --git a/src/java/com/jogamp/gluegen/pcpp/ConcatenatingReader.java b/src/java/com/jogamp/gluegen/pcpp/ConcatenatingReader.java
index 1eea281..c7e3635 100644
--- a/src/java/com/jogamp/gluegen/pcpp/ConcatenatingReader.java
+++ b/src/java/com/jogamp/gluegen/pcpp/ConcatenatingReader.java
@@ -1,21 +1,21 @@
/*
* 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
@@ -28,11 +28,11 @@
* 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.
*/
diff --git a/src/java/com/jogamp/gluegen/procaddress/ProcAddressCMethodBindingEmitter.java b/src/java/com/jogamp/gluegen/procaddress/ProcAddressCMethodBindingEmitter.java
index aecb079..49ff4fc 100644
--- a/src/java/com/jogamp/gluegen/procaddress/ProcAddressCMethodBindingEmitter.java
+++ b/src/java/com/jogamp/gluegen/procaddress/ProcAddressCMethodBindingEmitter.java
@@ -1,21 +1,21 @@
/*
* 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
@@ -28,11 +28,11 @@
* 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.
*/
@@ -57,7 +57,7 @@ public class ProcAddressCMethodBindingEmitter extends CMethodBindingEmitter {
public ProcAddressCMethodBindingEmitter(CMethodBindingEmitter methodToWrap, final boolean callThroughProcAddress,
boolean needsLocalTypedef, String localTypedefCallingConvention, ProcAddressEmitter emitter) {
-
+
super(
new MethodBinding(methodToWrap.getBinding()) {
@Override
diff --git a/src/java/com/jogamp/gluegen/procaddress/ProcAddressConfiguration.java b/src/java/com/jogamp/gluegen/procaddress/ProcAddressConfiguration.java
index 7bd9241..14b15d2 100644
--- a/src/java/com/jogamp/gluegen/procaddress/ProcAddressConfiguration.java
+++ b/src/java/com/jogamp/gluegen/procaddress/ProcAddressConfiguration.java
@@ -1,21 +1,21 @@
/*
* 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
@@ -28,11 +28,11 @@
* 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.
*/
diff --git a/src/java/com/jogamp/gluegen/procaddress/ProcAddressEmitter.java b/src/java/com/jogamp/gluegen/procaddress/ProcAddressEmitter.java
index 57b29e9..afaf7d1 100644
--- a/src/java/com/jogamp/gluegen/procaddress/ProcAddressEmitter.java
+++ b/src/java/com/jogamp/gluegen/procaddress/ProcAddressEmitter.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003-2005 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2013 JogAmp Community. 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -69,7 +69,7 @@ import com.jogamp.gluegen.runtime.ProcAddressTable;
public class ProcAddressEmitter extends JavaEmitter {
/** Must be synchronized w/ ProcAddressTable.PROCADDRESS_VAR_PREFIX !!! */
- public static final String PROCADDRESS_VAR_PREFIX = "_addressof_";
+ public static final String PROCADDRESS_VAR_PREFIX = "_addressof_";
protected static final String WRAP_PREFIX = "dispatch_";
private TypeDictionary typedefDictionary;
protected PrintWriter tableWriter;
@@ -182,8 +182,8 @@ public class ProcAddressEmitter extends JavaEmitter {
/** If 'native', enforce 'private native' modifiers. */
protected void fixSecurityModifiers(JavaMethodBindingEmitter javaEmitter) {
- if( javaEmitter.hasModifier(JavaMethodBindingEmitter.NATIVE) &&
- !javaEmitter.hasModifier(JavaMethodBindingEmitter.PRIVATE) )
+ if( javaEmitter.hasModifier(JavaMethodBindingEmitter.NATIVE) &&
+ !javaEmitter.hasModifier(JavaMethodBindingEmitter.PRIVATE) )
{
javaEmitter.removeModifier(JavaMethodBindingEmitter.PUBLIC);
javaEmitter.removeModifier(JavaMethodBindingEmitter.PROTECTED);
@@ -192,7 +192,7 @@ public class ProcAddressEmitter extends JavaEmitter {
javaEmitter.addModifier(JavaMethodBindingEmitter.NATIVE);
}
}
-
+
protected void generateModifiedEmitters(JavaMethodBindingEmitter baseJavaEmitter, List<FunctionEmitter> emitters) {
// See whether we need a proc address entry for this one
boolean callThroughProcAddress = needsProcAddressWrapper(baseJavaEmitter.getBinding().getCSymbol());
@@ -210,8 +210,8 @@ public class ProcAddressEmitter extends JavaEmitter {
!baseJavaEmitter.hasModifier(JavaMethodBindingEmitter.PRIVATE) &&
baseJavaEmitter.hasModifier(JavaMethodBindingEmitter.NATIVE) &&
callThroughProcAddress;
-
-
+
+
{
final ProcAddressJavaMethodBindingEmitter emitter = new ProcAddressJavaMethodBindingEmitter(baseJavaEmitter,
callThroughProcAddress,
@@ -219,7 +219,7 @@ public class ProcAddressEmitter extends JavaEmitter {
baseJavaEmitter.isForImplementingMethodCall(),
this);
if( needsJavaWrapper ) {
- emitter.setEmitBody(true);
+ emitter.setEmitBody(true);
emitter.removeModifier(JavaMethodBindingEmitter.NATIVE);
} else if ( callThroughProcAddress ) {
fixSecurityModifiers(emitter);
@@ -310,7 +310,7 @@ public class ProcAddressEmitter extends JavaEmitter {
}
final String fullTableClassName = implPackageName + "." + tableClassName;
final MethodAccess tableClassAccess = cfg.accessControl(fullTableClassName);
-
+
final String jImplRoot = getJavaOutputDir() + File.separator + CodeGenUtils.packageAsPath(implPackageName);
tableWriter = openFile(jImplRoot + File.separator + tableClassName + ".java", tableClassName);
diff --git a/src/java/com/jogamp/gluegen/procaddress/ProcAddressJavaMethodBindingEmitter.java b/src/java/com/jogamp/gluegen/procaddress/ProcAddressJavaMethodBindingEmitter.java
index 443c1d8..407d58f 100644
--- a/src/java/com/jogamp/gluegen/procaddress/ProcAddressJavaMethodBindingEmitter.java
+++ b/src/java/com/jogamp/gluegen/procaddress/ProcAddressJavaMethodBindingEmitter.java
@@ -1,21 +1,21 @@
/*
* 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
@@ -28,11 +28,11 @@
* 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.
*/
@@ -50,7 +50,7 @@ public class ProcAddressJavaMethodBindingEmitter extends JavaMethodBindingEmitte
protected boolean callThroughProcAddress;
protected boolean changeNameAndArguments;
-
+
protected String getProcAddressTableExpr;
protected ProcAddressEmitter emitter;
diff --git a/src/java/com/jogamp/gluegen/runtime/FunctionAddressResolver.java b/src/java/com/jogamp/gluegen/runtime/FunctionAddressResolver.java
index 6db52d1..4fc40a4 100644
--- a/src/java/com/jogamp/gluegen/runtime/FunctionAddressResolver.java
+++ b/src/java/com/jogamp/gluegen/runtime/FunctionAddressResolver.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -43,5 +43,5 @@ public interface FunctionAddressResolver {
* Resolves the name of the function bound to the method and returns the address.
*/
public long resolve(String name, DynamicLookupHelper lookup);
-
+
}
diff --git a/src/java/com/jogamp/gluegen/runtime/ProcAddressTable.java b/src/java/com/jogamp/gluegen/runtime/ProcAddressTable.java
index d331187..f54d5db 100644
--- a/src/java/com/jogamp/gluegen/runtime/ProcAddressTable.java
+++ b/src/java/com/jogamp/gluegen/runtime/ProcAddressTable.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003-2005 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2013 JogAmp Community. 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
@@ -29,7 +29,7 @@
* 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.
@@ -119,13 +119,13 @@ public abstract class ProcAddressTable {
*/
public void reset(DynamicLookupHelper lookup) throws SecurityException, RuntimeException {
SecurityUtil.checkAllLinkPermission();
-
+
if(null==lookup) {
throw new RuntimeException("Passed null DynamicLookupHelper");
}
final Field[] fields = getClass().getDeclaredFields();
-
+
final PrintStream dout;
if (DEBUG) {
dout = getDebugOutStream();
@@ -133,10 +133,10 @@ public abstract class ProcAddressTable {
} else {
dout = null;
}
-
+
// All at once - performance.
AccessibleObject.setAccessible(fields, true);
-
+
for (int i = 0; i < fields.length; ++i) {
final String fieldName = fields[i].getName();
if ( isAddressField(fieldName) ) {
@@ -173,7 +173,7 @@ public abstract class ProcAddressTable {
private final void setEntry(final Field addressField, final String funcName, final DynamicLookupHelper lookup) throws SecurityException {
try {
assert (addressField.getType() == Long.TYPE);
- final long newProcAddress = resolver.resolve(funcName, lookup);
+ final long newProcAddress = resolver.resolve(funcName, lookup);
addressField.setLong(this, newProcAddress);
if (DEBUG) {
getDebugOutStream().println(" " + addressField.getName() + " -> 0x" + Long.toHexString(newProcAddress));
@@ -195,14 +195,14 @@ public abstract class ProcAddressTable {
throw new IllegalArgumentException(getClass().getName() +" has no entry for the function '"+name+"'.", ex);
}
}
-
- /**
+
+ /**
* Warning: Returns an accessible probably protected field!
* <p>
* Caller should have checked link permissions
* for <b>all</b> libraries, i.e. for <code>new RuntimePermission("loadLibrary.*");</code>
* <i>if</i> exposing the field or address!
- * </p>
+ * </p>
*/
private final Field fieldForFunctionInSec(final String name) throws IllegalArgumentException {
return AccessController.doPrivileged(new PrivilegedAction<Field>() {
@@ -243,7 +243,7 @@ public abstract class ProcAddressTable {
/**
* Returns this table as map with the function name as key and the address as value.
*/
- private final Map<String, Long> toMap() {
+ private final Map<String, Long> toMap() {
final SortedMap<String, Long> map = new TreeMap<String, Long>();
final Field[] fields = getClass().getFields();
@@ -259,7 +259,7 @@ public abstract class ProcAddressTable {
} catch (IllegalAccessException ex) {
throw new RuntimeException(ex);
}
-
+
return map;
}
@@ -292,7 +292,7 @@ public abstract class ProcAddressTable {
throw new RuntimeException(ex);
}
}
-
+
/**
* This is a convenience method to query the native function handle by name.
* <p>
@@ -317,7 +317,7 @@ public abstract class ProcAddressTable {
throw new RuntimeException(ex);
}
}
-
+
/**
* Returns all functions pointing to null.
*/
diff --git a/src/java/com/jogamp/gluegen/structgen/CStructAnnotationProcessor.java b/src/java/com/jogamp/gluegen/structgen/CStructAnnotationProcessor.java
index 841fa1d..1eda788 100644
--- a/src/java/com/jogamp/gluegen/structgen/CStructAnnotationProcessor.java
+++ b/src/java/com/jogamp/gluegen/structgen/CStructAnnotationProcessor.java
@@ -73,7 +73,7 @@ import jogamp.common.Debug;
* <p>
* User can enable DEBUG while defining property <code>jogamp.gluegen.structgen.debug</code>.
* </p>
- *
+ *
* @author Michael Bien
* @author Sven Gothel, et.al.
*/
@@ -82,15 +82,15 @@ import jogamp.common.Debug;
public class CStructAnnotationProcessor extends AbstractProcessor {
private static final String DEFAULT = "_default_";
private static final boolean DEBUG;
-
+
static {
Debug.initSingleton();
DEBUG = Debug.isPropertyDefined("jogamp.gluegen.structgen.debug", true);
}
-
+
private static final String STRUCTGENOUTPUT_OPTION = "structgen.output";
private static final String STRUCTGENOUTPUT = PropertyAccess.getProperty("jogamp.gluegen."+STRUCTGENOUTPUT_OPTION, true, "gensrc");
-
+
private Filer filer;
private Messager messager;
private Elements eltUtils;
@@ -113,7 +113,7 @@ public class CStructAnnotationProcessor extends AbstractProcessor {
private File locateSource(String packageName, String relativeName) {
try {
- if( DEBUG ) {
+ if( DEBUG ) {
System.err.println("CStruct.locateSource.0: p "+packageName+", r "+relativeName);
}
final FileObject h = filer.getResource(StandardLocation.SOURCE_PATH, packageName, relativeName);
@@ -127,7 +127,7 @@ public class CStructAnnotationProcessor extends AbstractProcessor {
} catch (IOException e) { if(DEBUG) { System.err.println("Catched "+e.getClass().getSimpleName()+": "+e.getMessage()); /* e.printStackTrace(); */ } }
return null;
}
-
+
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment env) {
final String user_dir = System.getProperty("user.dir");
@@ -142,14 +142,14 @@ public class CStructAnnotationProcessor extends AbstractProcessor {
final CStruct struct = element.getAnnotation(CStruct.class);
final String headerRelPath = struct.header();
final Element enclElement = element.getEnclosingElement();
-
- System.err.println("CStruct: "+struct+", package "+packageName+", header "+headerRelPath);
+
+ System.err.println("CStruct: "+struct+", package "+packageName+", header "+headerRelPath);
if(DEBUG) {
System.err.println("CStruct.0: user.dir: "+user_dir);
System.err.println("CStruct.0: element: "+element+", .simpleName "+element.getSimpleName());
- System.err.println("CStruct.0: enclElement: "+enclElement+", .simpleName "+enclElement.getSimpleName()+", .package "+eltUtils.getPackageOf(enclElement).toString());
+ System.err.println("CStruct.0: enclElement: "+enclElement+", .simpleName "+enclElement.getSimpleName()+", .package "+eltUtils.getPackageOf(enclElement).toString());
}
-
+
final File headerFile;
{
File f = locateSource(packageName, headerRelPath);
@@ -162,7 +162,7 @@ public class CStructAnnotationProcessor extends AbstractProcessor {
}
headerFile = f;
}
-
+
final String root;
{
String root0 = headerFile.getAbsolutePath();
diff --git a/src/java/jogamp/common/Debug.java b/src/java/jogamp/common/Debug.java
index b826a06..460106b 100644
--- a/src/java/jogamp/common/Debug.java
+++ b/src/java/jogamp/common/Debug.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -51,7 +51,7 @@ public class Debug extends PropertyAccess {
// Some common properties
private static final boolean verbose;
private static final boolean debugAll;
-
+
static {
AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
diff --git a/src/java/jogamp/common/jvm/JVMUtil.java b/src/java/jogamp/common/jvm/JVMUtil.java
index af74f08..e655654 100644
--- a/src/java/jogamp/common/jvm/JVMUtil.java
+++ b/src/java/jogamp/common/jvm/JVMUtil.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2008 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
@@ -64,9 +64,9 @@ public class JVMUtil {
}
}
- /** Kicks of one-time static initialization of this class. See {@link JVMUtil}. */
+ /** Kicks of one-time static initialization of this class. See {@link JVMUtil}. */
public static void initSingleton() { }
-
+
private JVMUtil() {}
private static native boolean initialize(java.nio.ByteBuffer buffer);
diff --git a/src/java/jogamp/common/os/AndroidUtils.java b/src/java/jogamp/common/os/AndroidUtils.java
index c6d5819..bb09ba9 100644
--- a/src/java/jogamp/common/os/AndroidUtils.java
+++ b/src/java/jogamp/common/os/AndroidUtils.java
@@ -38,7 +38,7 @@ public class AndroidUtils {
private static final Method androidGetPackageInfoVersionNameMethod;
private static final Method androidGetPackageInfoVersionCodeMethod;
private static final Method androidGetTempRootMethod;
-
+
static {
if(AndroidVersion.isAvailable) {
final ClassLoader cl = AndroidUtils.class.getClassLoader();
@@ -52,10 +52,10 @@ public class AndroidUtils {
androidGetTempRootMethod = null;
}
}
-
+
/**
- * @return null if platform is not Android or no Android Context is registered
- * via {@link jogamp.common.os.android.StaticContext#init(android.content.Context) StaticContext.init(..)},
+ * @return null if platform is not Android or no Android Context is registered
+ * via {@link jogamp.common.os.android.StaticContext#init(android.content.Context) StaticContext.init(..)},
* otherwise the found package version code of <code>packageName</code> is returned.
*/
public static final int getPackageInfoVersionCode(String packageName) {
@@ -64,10 +64,10 @@ public class AndroidUtils {
}
return -1;
}
-
+
/**
- * @return null if platform is not Android or no Android Context is registered
- * via {@link jogamp.common.os.android.StaticContext#init(android.content.Context) StaticContext.init(..)},
+ * @return null if platform is not Android or no Android Context is registered
+ * via {@link jogamp.common.os.android.StaticContext#init(android.content.Context) StaticContext.init(..)},
* otherwise the found package version name of <code>packageName</code> is returned.
*/
public static final String getPackageInfoVersionName(String packageName) {
@@ -76,18 +76,18 @@ public class AndroidUtils {
}
return null;
}
-
+
/**
- * @return null if platform is not Android or no Android Context is registered
- * via {@link jogamp.common.os.android.StaticContext#init(android.content.Context) StaticContext.init(..)},
- * otherwise the context relative world readable <code>temp</code> directory returned.
+ * @return null if platform is not Android or no Android Context is registered
+ * via {@link jogamp.common.os.android.StaticContext#init(android.content.Context) StaticContext.init(..)},
+ * otherwise the context relative world readable <code>temp</code> directory returned.
*/
public static File getTempRoot()
throws RuntimeException {
if(null != androidGetTempRootMethod) {
return (File) ReflectionUtil.callMethod(null, androidGetTempRootMethod);
}
- return null;
- }
-
+ return null;
+ }
+
}
diff --git a/src/java/jogamp/common/os/BionicDynamicLinkerImpl.java b/src/java/jogamp/common/os/BionicDynamicLinkerImpl.java
index 453f200..09057f8 100644
--- a/src/java/jogamp/common/os/BionicDynamicLinkerImpl.java
+++ b/src/java/jogamp/common/os/BionicDynamicLinkerImpl.java
@@ -37,7 +37,7 @@ package jogamp.common.os;
public final class BionicDynamicLinkerImpl extends UnixDynamicLinkerImpl {
private static final long RTLD_DEFAULT = 0xffffffffL;
// static final long RTLD_NEXT = 0xfffffffeL;
-
+
private static final int RTLD_LAZY = 0x00001;
// static final int RTLD_NOW = 0x00000;
private static final int RTLD_LOCAL = 0x00000;
@@ -52,10 +52,10 @@ public final class BionicDynamicLinkerImpl extends UnixDynamicLinkerImpl {
public final long openLibraryGlobal(String pathname, boolean debug) throws SecurityException {
return this.openLibraryImpl(pathname, RTLD_LAZY | RTLD_GLOBAL, debug);
}
-
+
@Override
- public final long lookupSymbolGlobal(String symbolName) throws SecurityException {
+ public final long lookupSymbolGlobal(String symbolName) throws SecurityException {
return this.lookupSymbolGlobalImpl(RTLD_DEFAULT, symbolName);
}
-
+
}
diff --git a/src/java/jogamp/common/os/DynamicLinkerImpl.java b/src/java/jogamp/common/os/DynamicLinkerImpl.java
index 4686cd2..39c112e 100644
--- a/src/java/jogamp/common/os/DynamicLinkerImpl.java
+++ b/src/java/jogamp/common/os/DynamicLinkerImpl.java
@@ -37,9 +37,9 @@ import com.jogamp.common.util.LongObjectHashMap;
// and sealed jogamp.common.* package definition
// ensuring no abuse via subclassing.
//
-
+
private final LongObjectHashMap libHandle2Name = new LongObjectHashMap( 16 /* initialCapacity */ );
-
+
protected static final class LibRef {
public LibRef(String name) {
this.name = name;
@@ -48,18 +48,18 @@ import com.jogamp.common.util.LongObjectHashMap;
public final int incrRefCount() { return ++refCount; }
public final int decrRefCount() { return --refCount; }
public final int getRefCount() { return refCount; }
-
+
public final String getName() { return name; }
public final String toString() { return "LibRef["+name+", refCount "+refCount+"]"; }
-
+
private final String name;
private int refCount;
}
-
+
protected final synchronized LibRef getLibRef(long handle) {
return (LibRef) libHandle2Name.get(handle);
}
-
+
protected final synchronized LibRef incrLibRefCount(long handle, String libName) {
LibRef libRef = getLibRef(handle);
if( null == libRef ) {
@@ -73,7 +73,7 @@ import com.jogamp.common.util.LongObjectHashMap;
}
return libRef;
}
-
+
protected final synchronized LibRef decrLibRefCount(long handle) {
LibRef libRef = getLibRef(handle);
if( null != libRef ) {
diff --git a/src/java/jogamp/common/os/MacOSXDynamicLinkerImpl.java b/src/java/jogamp/common/os/MacOSXDynamicLinkerImpl.java
index 18dcf97..b2f0f31 100644
--- a/src/java/jogamp/common/os/MacOSXDynamicLinkerImpl.java
+++ b/src/java/jogamp/common/os/MacOSXDynamicLinkerImpl.java
@@ -45,15 +45,15 @@ public final class MacOSXDynamicLinkerImpl extends UnixDynamicLinkerImpl {
public final long openLibraryLocal(String pathname, boolean debug) throws SecurityException {
return this.openLibraryImpl(pathname, RTLD_LAZY | RTLD_LOCAL, debug);
}
-
+
@Override
public final long openLibraryGlobal(String pathname, boolean debug) throws SecurityException {
return this.openLibraryImpl(pathname, RTLD_LAZY | RTLD_GLOBAL, debug);
}
-
+
@Override
public final long lookupSymbolGlobal(String symbolName) throws SecurityException {
return this.lookupSymbolGlobalImpl(RTLD_DEFAULT, symbolName);
}
-
+
}
diff --git a/src/java/jogamp/common/os/MachineDescriptionRuntime.java b/src/java/jogamp/common/os/MachineDescriptionRuntime.java
index a58accd..01559b9 100644
--- a/src/java/jogamp/common/os/MachineDescriptionRuntime.java
+++ b/src/java/jogamp/common/os/MachineDescriptionRuntime.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package jogamp.common.os;
import com.jogamp.common.os.MachineDescription;
@@ -39,7 +39,7 @@ public class MachineDescriptionRuntime {
static volatile boolean smdQueried = false;
static MachineDescription.StaticConfig smd = null;
-
+
public static MachineDescription.StaticConfig getStatic() {
if(!smdQueried) {
synchronized(MachineDescription.class) { // volatile dbl-checked-locking OK
@@ -50,8 +50,8 @@ public class MachineDescriptionRuntime {
}
}
return smd;
- }
-
+ }
+
private static boolean isCPUArch32Bit() throws RuntimeException {
switch( PlatformPropsImpl.CPU_ARCH ) {
case X86_32:
@@ -71,7 +71,7 @@ public class MachineDescriptionRuntime {
throw new RuntimeException("Please port CPU detection (32/64 bit) to your platform (" + PlatformPropsImpl.OS_lower + "/" + PlatformPropsImpl.ARCH_lower + "("+PlatformPropsImpl.CPU_ARCH+"))");
}
}
-
+
private static MachineDescription.StaticConfig getStaticImpl() {
if(isCPUArch32Bit()) {
if(PlatformPropsImpl.CPU_ARCH.getFamily() == Platform.CPUFamily.ARM && PlatformPropsImpl.LITTLE_ENDIAN) {
@@ -94,7 +94,7 @@ public class MachineDescriptionRuntime {
return StaticConfig.X86_64_UNIX;
}
}
-
+
static volatile boolean rmdQueried = false;
static MachineDescription rmd = null;
@@ -108,14 +108,14 @@ public class MachineDescriptionRuntime {
}
}
return rmd;
- }
+ }
private static MachineDescription getRuntimeImpl() {
try {
Platform.initSingleton(); // loads native gluegen-rt library
} catch (UnsatisfiedLinkError err) {
return null;
}
-
+
int pointerSizeInBytes = getPointerSizeInBytesImpl();
switch(pointerSizeInBytes) {
case 4:
@@ -129,25 +129,25 @@ public class MachineDescriptionRuntime {
if(Integer.MAX_VALUE < pageSizeL) {
throw new InternalError("PageSize exceeds integer value: " + pageSizeL);
}
-
+
// size: int, long, float, double, pointer, pageSize
// alignment: int8, int16, int32, int64, int, long, float, double, pointer
- return new MachineDescription(
+ return new MachineDescription(
true /* runtime validated */, PlatformPropsImpl.LITTLE_ENDIAN,
-
+
getSizeOfIntImpl(), getSizeOfLongImpl(),
- getSizeOfFloatImpl(), getSizeOfDoubleImpl(), getSizeOfLongDoubleImpl(),
+ getSizeOfFloatImpl(), getSizeOfDoubleImpl(), getSizeOfLongDoubleImpl(),
pointerSizeInBytes, (int)pageSizeL,
-
+
getAlignmentInt8Impl(), getAlignmentInt16Impl(), getAlignmentInt32Impl(), getAlignmentInt64Impl(),
- getAlignmentIntImpl(), getAlignmentLongImpl(),
- getAlignmentFloatImpl(), getAlignmentDoubleImpl(), getAlignmentLongDoubleImpl(),
- getAlignmentPointerImpl());
+ getAlignmentIntImpl(), getAlignmentLongImpl(),
+ getAlignmentFloatImpl(), getAlignmentDoubleImpl(), getAlignmentLongDoubleImpl(),
+ getAlignmentPointerImpl());
}
private static native int getPointerSizeInBytesImpl();
private static native long getPageSizeInBytesImpl();
-
+
private static native int getAlignmentInt8Impl();
private static native int getAlignmentInt16Impl();
private static native int getAlignmentInt32Impl();
@@ -162,7 +162,7 @@ public class MachineDescriptionRuntime {
private static native int getSizeOfLongImpl();
private static native int getSizeOfPointerImpl();
private static native int getSizeOfFloatImpl();
- private static native int getSizeOfDoubleImpl();
- private static native int getSizeOfLongDoubleImpl();
+ private static native int getSizeOfDoubleImpl();
+ private static native int getSizeOfLongDoubleImpl();
}
diff --git a/src/java/jogamp/common/os/PlatformPropsImpl.java b/src/java/jogamp/common/os/PlatformPropsImpl.java
index 819fe9c..e632647 100644
--- a/src/java/jogamp/common/os/PlatformPropsImpl.java
+++ b/src/java/jogamp/common/os/PlatformPropsImpl.java
@@ -37,16 +37,16 @@ import com.jogamp.common.util.VersionNumber;
*/
public abstract class PlatformPropsImpl {
static final boolean DEBUG = Debug.debug("Platform");
-
+
//
// static initialization order:
//
-
+
/** Version 1.6. As a JVM version, it enables certain JVM 1. features. */
public static final VersionNumber Version16;
/** Version 1.7. As a JVM version, it enables certain JVM 1.7 features. */
public static final VersionNumber Version17;
-
+
public static final String OS;
public static final String OS_lower;
public static final String OS_VERSION;
@@ -62,17 +62,17 @@ public abstract class PlatformPropsImpl {
public static final String JAVA_RUNTIME_NAME;
/** True if having {@link java.nio.LongBuffer} and {@link java.nio.DoubleBuffer} available. */
public static final boolean JAVA_SE;
- /** True if being compatible w/ language level 6, e.g. JRE 1.6. Implies {@link #JAVA_SE}. <i>Note</i>: We claim Android is compatible. */
+ /** True if being compatible w/ language level 6, e.g. JRE 1.6. Implies {@link #JAVA_SE}. <i>Note</i>: We claim Android is compatible. */
public static final boolean JAVA_6;
-
+
public static final String NEWLINE;
public static final boolean LITTLE_ENDIAN;
-
+
public static final CPUType CPU_ARCH;
public static final ABIType ABI_TYPE;
public static final OSType OS_TYPE;
public static final String os_and_arch;
-
+
static {
Version16 = new VersionNumber(1, 6, 0);
Version17 = new VersionNumber(1, 7, 0);
@@ -103,10 +103,10 @@ public abstract class PlatformPropsImpl {
JAVA_RUNTIME_NAME = getJavaRuntimeNameImpl();
JAVA_SE = initIsJavaSE();
JAVA_6 = JAVA_SE && ( AndroidVersion.isAvailable || JAVA_VERSION_NUMBER.compareTo(Version16) >= 0 ) ;
-
+
NEWLINE = System.getProperty("line.separator");
LITTLE_ENDIAN = queryIsLittleEndianImpl();
-
+
CPU_ARCH = getCPUTypeImpl(ARCH_lower);
OS_TYPE = getOSTypeImpl();
ABI_TYPE = queryABITypeImpl(OS_TYPE, CPU_ARCH);
@@ -114,7 +114,7 @@ public abstract class PlatformPropsImpl {
}
protected PlatformPropsImpl() {}
-
+
private static final String getJavaRuntimeNameImpl() {
// the fast path, check property Java SE instead of traversing through the ClassLoader
return AccessController.doPrivileged(new PrivilegedAction<String>() {
@@ -123,7 +123,7 @@ public abstract class PlatformPropsImpl {
}
});
}
-
+
private static final boolean initIsJavaSE() {
if( null != JAVA_RUNTIME_NAME && JAVA_RUNTIME_NAME.indexOf("Java SE") != -1) {
return true;
@@ -148,7 +148,7 @@ public abstract class PlatformPropsImpl {
tst_i.put(0, 0x0A0B0C0D);
return 0x0C0D == tst_s.get(0);
}
-
+
private static final CPUType getCPUTypeImpl(String archLower) {
if( archLower.equals("x86") ||
archLower.equals("i386") ||
@@ -181,10 +181,10 @@ public abstract class PlatformPropsImpl {
throw new RuntimeException("Please port CPU detection to your platform (" + OS_lower + "/" + archLower + ")");
}
}
-
+
@SuppressWarnings("unused")
private static final boolean contains(String data, String[] search) {
- if(null != data && null != search) {
+ if(null != data && null != search) {
for(int i=0; i<search.length; i++) {
if(data.indexOf(search[i]) >= 0) {
return true;
@@ -193,7 +193,7 @@ public abstract class PlatformPropsImpl {
}
return false;
}
-
+
/**
* Returns the {@link ABIType} of the current platform using given {@link CPUType cpuType}
* and {@link OSType osType} as a hint.
@@ -201,33 +201,33 @@ public abstract class PlatformPropsImpl {
* Note the following queries are performed:
* <ul>
* <li> not {@link CPUFamily#ARM} -> {@link ABIType#GENERIC_ABI} </li>
- * <li> else
- * <ul>
+ * <li> else
+ * <ul>
* <li> {@link OSType#ANDROID} -> {@link ABIType#EABI_GNU_ARMEL} (due to EACCES, Permission denied)</li>
- * <li> else
- * <ul>
+ * <li> else
+ * <ul>
* <li> Elf ARM Tags -> {@link ABIType#EABI_GNU_ARMEL}, {@link ABIType#EABI_GNU_ARMHF}</li>
* <li> On Error -> {@link ABIType#EABI_GNU_ARMEL}</li>
* </ul></li>
- * </ul></li>
+ * </ul></li>
* </ul>
* </p>
* <p>
- * For Elf parsing either the current executable is used (Linux) or a found java/jvm native library.
+ * For Elf parsing either the current executable is used (Linux) or a found java/jvm native library.
* </p>
* <p>
* Elf ARM Tags are read using {@link ElfHeader}, .. and {@link SectionArmAttributes#abiVFPArgsAcceptsVFPVariant(byte)}.
* </p>
* @param osType
* @param cpuType
- *
+ *
* @return
*/
private static final ABIType queryABITypeImpl(final OSType osType, final CPUType cpuType) {
if( CPUFamily.ARM != cpuType.family ) {
return ABIType.GENERIC_ABI;
}
- if( OSType.ANDROID == osType ) { // EACCES (Permission denied) - We assume a not rooted device!
+ if( OSType.ANDROID == osType ) { // EACCES (Permission denied) - We assume a not rooted device!
return ABIType.EABI_GNU_ARMEL;
}
return AccessController.doPrivileged(new PrivilegedAction<ABIType>() {
@@ -250,7 +250,7 @@ public abstract class PlatformPropsImpl {
if( null == file ) {
file = findSysLib("jvm");
}
- if( null != file ) {
+ if( null != file ) {
in = new RandomAccessFile(file, "r");
final ElfHeader eh = ElfHeader.read(in);
if(DEBUG) {
@@ -290,7 +290,7 @@ public abstract class PlatformPropsImpl {
res = abiVFPArgsAcceptsVFPVariant ? ABIType.EABI_GNU_ARMHF : ABIType.EABI_GNU_ARMEL;
} else {
res = ABIType.GENERIC_ABI;
- }
+ }
if(DEBUG) {
System.err.println("ELF: abiARM "+abiARM+", abiVFPArgsAcceptsVFPVariant "+abiVFPArgsAcceptsVFPVariant+" -> "+res);
}
@@ -302,7 +302,7 @@ public abstract class PlatformPropsImpl {
return file.isFile() && file.canRead();
} catch (Throwable t) { }
return false;
- }
+ }
private static File findSysLib(String libName) {
ClassLoader cl = PlatformPropsImpl.class.getClassLoader();
final List<String> possibleLibPaths = NativeLibrary.enumerateLibraryPaths(libName, libName, libName, true, cl);
@@ -321,29 +321,29 @@ public abstract class PlatformPropsImpl {
}
return null;
}
-
+
private static final OSType getOSTypeImpl() throws RuntimeException {
if ( AndroidVersion.isAvailable ) {
return OSType.ANDROID;
}
if ( OS_lower.startsWith("linux") ) {
- return OSType.LINUX;
+ return OSType.LINUX;
}
if ( OS_lower.startsWith("freebsd") ) {
- return OSType.FREEBSD;
+ return OSType.FREEBSD;
}
if ( OS_lower.startsWith("android") ) {
- return OSType.ANDROID;
+ return OSType.ANDROID;
}
if ( OS_lower.startsWith("mac os x") ||
OS_lower.startsWith("darwin") ) {
- return OSType.MACOS;
+ return OSType.MACOS;
}
if ( OS_lower.startsWith("sunos") ) {
- return OSType.SUNOS;
+ return OSType.SUNOS;
}
if ( OS_lower.startsWith("hp-ux") ) {
- return OSType.HPUX;
+ return OSType.HPUX;
}
if ( OS_lower.startsWith("windows") ) {
return OSType.WINDOWS;
@@ -351,18 +351,18 @@ public abstract class PlatformPropsImpl {
if ( OS_lower.startsWith("kd") ) {
return OSType.OPENKODE;
}
- throw new RuntimeException("Please port OS detection to your platform (" + OS_lower + "/" + ARCH_lower + ")");
+ throw new RuntimeException("Please port OS detection to your platform (" + OS_lower + "/" + ARCH_lower + ")");
}
/**
* kick off static initialization of <i>platform property information</i>
*/
- public static void initSingleton() { }
-
+ public static void initSingleton() { }
+
/**
* Returns the GlueGen common name for the given OSType and CPUType
* as implemented in the build system in 'gluegen-cpptasks-base.xml'.<br>
- *
+ *
* A list of currently supported <code>os.and.arch</code> strings:
* <ul>
* <li>freebsd-i586</li>
@@ -386,7 +386,7 @@ public abstract class PlatformPropsImpl {
*/
public static final String getOSAndArch(OSType osType, CPUType cpuType, ABIType abiType) {
String _os_and_arch;
-
+
switch( cpuType ) {
case X86_32:
_os_and_arch = "i586";
@@ -398,7 +398,7 @@ public abstract class PlatformPropsImpl {
_os_and_arch = "armv6"; // TODO: sync with gluegen-cpptasks-base.xml
break;
case SPARC_32:
- _os_and_arch = "sparc";
+ _os_and_arch = "sparc";
break;
case PPC:
_os_and_arch = "ppc"; // TODO: sync with gluegen-cpptasks-base.xml
@@ -410,10 +410,10 @@ public abstract class PlatformPropsImpl {
_os_and_arch = "ia64";
break;
case SPARCV9_64:
- _os_and_arch = "sparcv9";
+ _os_and_arch = "sparcv9";
break;
case PA_RISC2_0:
- _os_and_arch = "risc2.0"; // TODO: sync with gluegen-cpptasks-base.xml
+ _os_and_arch = "risc2.0"; // TODO: sync with gluegen-cpptasks-base.xml
break;
default:
throw new InternalError("Complete case block");
@@ -423,33 +423,33 @@ public abstract class PlatformPropsImpl {
}
switch( osType ) {
case ANDROID:
- _os_and_arch = "android-" + _os_and_arch;
+ _os_and_arch = "android-" + _os_and_arch;
break;
case MACOS:
- _os_and_arch = "macosx-universal";
+ _os_and_arch = "macosx-universal";
break;
case WINDOWS:
- _os_and_arch = "windows-" + _os_and_arch;
+ _os_and_arch = "windows-" + _os_and_arch;
break;
case OPENKODE:
- _os_and_arch = "openkode-" + _os_and_arch; // TODO: think about that
- break;
+ _os_and_arch = "openkode-" + _os_and_arch; // TODO: think about that
+ break;
case LINUX:
- _os_and_arch = "linux-" + _os_and_arch;
+ _os_and_arch = "linux-" + _os_and_arch;
break;
case FREEBSD:
- _os_and_arch = "freebsd-" + _os_and_arch;
+ _os_and_arch = "freebsd-" + _os_and_arch;
break;
case SUNOS:
- _os_and_arch = "solaris-" + _os_and_arch;
+ _os_and_arch = "solaris-" + _os_and_arch;
break;
case HPUX:
_os_and_arch = "hpux-hppa"; // TODO: really only hppa ?
- break;
+ break;
default:
throw new InternalError("Complete case block");
}
- return _os_and_arch;
+ return _os_and_arch;
}
-
+
}
diff --git a/src/java/jogamp/common/os/PosixDynamicLinkerImpl.java b/src/java/jogamp/common/os/PosixDynamicLinkerImpl.java
index fced97f..f0f366c 100644
--- a/src/java/jogamp/common/os/PosixDynamicLinkerImpl.java
+++ b/src/java/jogamp/common/os/PosixDynamicLinkerImpl.java
@@ -31,7 +31,7 @@ public final class PosixDynamicLinkerImpl extends UnixDynamicLinkerImpl {
private static final long RTLD_DEFAULT = 0;
// static final long RTLD_NEXT = -1L;
-
+
private static final int RTLD_LAZY = 0x00001;
// static final int RTLD_NOW = 0x00002;
private static final int RTLD_LOCAL = 0x00000;
@@ -46,7 +46,7 @@ public final class PosixDynamicLinkerImpl extends UnixDynamicLinkerImpl {
public final long openLibraryGlobal(String pathname, boolean debug) throws SecurityException {
return this.openLibraryImpl(pathname, RTLD_LAZY | RTLD_GLOBAL, debug);
}
-
+
@Override
public final long lookupSymbolGlobal(String symbolName) throws SecurityException {
return this.lookupSymbolGlobalImpl(RTLD_DEFAULT, symbolName);
diff --git a/src/java/jogamp/common/os/UnixDynamicLinkerImpl.java b/src/java/jogamp/common/os/UnixDynamicLinkerImpl.java
index 7f10d8a..7a0e3b0 100644
--- a/src/java/jogamp/common/os/UnixDynamicLinkerImpl.java
+++ b/src/java/jogamp/common/os/UnixDynamicLinkerImpl.java
@@ -36,7 +36,7 @@ import com.jogamp.common.util.SecurityUtil;
// and sealed jogamp.common.* package definition
// ensuring no abuse via subclassing.
//
-
+
/** Interface to C language function: <br> <code> int dlclose(void * ); </code> */
protected static native int dlclose(long arg0);
@@ -59,16 +59,16 @@ import com.jogamp.common.util.SecurityUtil;
}
return handle;
}
-
+
protected final long lookupSymbolGlobalImpl(long dlSymGlobalFlag, String symbolName) throws SecurityException {
SecurityUtil.checkAllLinkPermission();
final long addr = dlsym(dlSymGlobalFlag, symbolName);
if(DEBUG_LOOKUP) {
System.err.println("DynamicLinkerImpl.lookupSymbolGlobal("+symbolName+") -> 0x"+Long.toHexString(addr));
}
- return addr;
+ return addr;
}
-
+
@Override
public final long lookupSymbol(long libraryHandle, String symbolName) throws IllegalArgumentException {
if( null == getLibRef( libraryHandle ) ) {
@@ -78,7 +78,7 @@ import com.jogamp.common.util.SecurityUtil;
if(DEBUG_LOOKUP) {
System.err.println("DynamicLinkerImpl.lookupSymbol(0x"+Long.toHexString(libraryHandle)+", "+symbolName+") -> 0x"+Long.toHexString(addr));
}
- return addr;
+ return addr;
}
@Override
@@ -88,7 +88,7 @@ import com.jogamp.common.util.SecurityUtil;
}
dlclose(libraryHandle);
}
-
+
@Override
public final String getLastError() {
return dlerror();
diff --git a/src/java/jogamp/common/os/WindowsDynamicLinkerImpl.java b/src/java/jogamp/common/os/WindowsDynamicLinkerImpl.java
index adb2492..76bb2f8 100644
--- a/src/java/jogamp/common/os/WindowsDynamicLinkerImpl.java
+++ b/src/java/jogamp/common/os/WindowsDynamicLinkerImpl.java
@@ -49,7 +49,7 @@ public final class WindowsDynamicLinkerImpl extends DynamicLinkerImpl {
// Don't know .. so it's an alias for the time being
return openLibraryGlobal(libraryName, debug);
}
-
+
@Override
public final long openLibraryGlobal(String libraryName, boolean debug) throws SecurityException {
SecurityUtil.checkLinkPermission(libraryName);
@@ -62,7 +62,7 @@ public final class WindowsDynamicLinkerImpl extends DynamicLinkerImpl {
}
return handle;
}
-
+
@Override
public final long lookupSymbolGlobal(String symbolName) throws SecurityException {
SecurityUtil.checkAllLinkPermission();
@@ -95,7 +95,7 @@ public final class WindowsDynamicLinkerImpl extends DynamicLinkerImpl {
}
return addr;
}
-
+
@Override
public final void closeLibrary(long libraryHandle) throws IllegalArgumentException {
if( null == decrLibRefCount( libraryHandle ) ) {
@@ -109,5 +109,5 @@ public final class WindowsDynamicLinkerImpl extends DynamicLinkerImpl {
final int err = GetLastError();
return "Last error: 0x"+Integer.toHexString(err)+" ("+err+")";
}
-
+
}
diff --git a/src/java/jogamp/common/os/elf/ElfHeader.java b/src/java/jogamp/common/os/elf/ElfHeader.java
index 88562cf..d76dbab 100644
--- a/src/java/jogamp/common/os/elf/ElfHeader.java
+++ b/src/java/jogamp/common/os/elf/ElfHeader.java
@@ -53,7 +53,7 @@ import static jogamp.common.os.elf.IOUtils.toHexString;
public class ElfHeader {
/** Size of e_ident array - {@value} */
public static int EI_NIDENT = 16;
-
+
/** ident byte #0 - {@value} */
public static final byte ELFMAG0 = 0x7f;
/** ident byte #1 - {@value} */
@@ -62,13 +62,13 @@ public class ElfHeader {
public static final byte ELFMAG2 = 'L';
/** ident byte #3 - {@value} */
public static final byte ELFMAG3 = 'F';
-
+
/** ident byte #4 */
public static final int EI_CLASS = 4;
public static final byte ELFCLASSNONE = 0;
public static final byte ELFCLASS32 = 1;
public static final byte ELFCLASS64 = 2;
-
+
/** ident byte #5 */
public static final int EI_DATA = 5;
public static final byte ELFDATANONE = 0;
@@ -79,7 +79,7 @@ public class ElfHeader {
public static final int EI_VERSION = 6;
public static final byte EV_NONE = 0;
public static final byte EV_CURRENT = 1;
-
+
/** ident byte #7 */
public static final int EI_OSABI = 7;
/** Unix System V ABI - {@value} */
@@ -114,29 +114,29 @@ public class ElfHeader {
/** Amiga Research OS ABI - {@value} **/
public static final byte ELFOSABI_AROS = 15;
/** The FenixOS highly scalable multi-core OS 64-255 Architecture-specific value range - {@value} */
- public static final byte ELFOSABI_FENIXOS = 16;
-
+ public static final byte ELFOSABI_FENIXOS = 16;
+
/** ident byte #8
* <p>
- * This byte identifies the version of the ABI to which the object is targeted.
- * This field is used to distinguish among incompatible versions of an ABI.
- * The interpretation of this version number is dependent on the ABI identified by the EI_OSABI field.
+ * This byte identifies the version of the ABI to which the object is targeted.
+ * This field is used to distinguish among incompatible versions of an ABI.
+ * The interpretation of this version number is dependent on the ABI identified by the EI_OSABI field.
* Applications conforming to this specification use the value 0.
- * </p>
+ * </p>
*/
public static final int EI_ABIVERSION = 8;
-
+
/**
* ident byte #9 .. ?
* <p>
- * Start of padding.
- * These bytes are reserved and set to zero.
- * Programs which read them should ignore them.
+ * Start of padding.
+ * These bytes are reserved and set to zero.
+ * Programs which read them should ignore them.
* The value for EI_PAD will change in the future if currently unused bytes are given meanings.
* </p>
*/
public static final int EI_PAD = 9;
-
+
/**
* This masks an 8-bit version number, the version of the ABI to which this
* ELF file conforms. This ABI is version 5. A value of 0 denotes unknown conformance.
@@ -144,27 +144,27 @@ public class ElfHeader {
*/
public static final int EF_ARM_ABIMASK = 0xFF000000;
public static final int EF_ARM_ABISHIFT = 24;
-
+
/**
* ARM ABI version 5.
* {@value}
*/
public static final int EF_ARM_ABI5 = 0x05000000;
-
+
/**
* The ELF file contains BE-8 code, suitable for execution on an ARM
* Architecture v6 processor. This flag must only be set on an executable file.
* {@value}
*/
public static final int EF_ARM_BE8 = 0x00800000;
-
+
/**
* Legacy code (ABI version 4 and earlier) generated by gcc-arm-xxx might
* use these bits.
* {@value}
*/
public static final int EF_ARM_GCCMASK = 0x00400FFF;
-
+
/**
* Set in executable file headers (e_type = ET_EXEC or ET_DYN) to note that
* the executable file was built to conform to the hardware floating-point
@@ -173,28 +173,28 @@ public class ElfHeader {
* Compatible with legacy (pre version 5) gcc use as EF_ARM_VFP_FLOAT.
* </p>
* <p>
- * Note: This is not used (anymore)
- * </p>
+ * Note: This is not used (anymore)
+ * </p>
* {@value}
*/
public static final int EF_ARM_ABI_FLOAT_HARD = 0x00000400;
-
+
/**
* Set in executable file headers (e_type = ET_EXEC or ET_DYN) to note
* explicitly that the executable file was built to conform to the software
* floating-point procedure-call standard (the base standard). If both
- * {@link #EF_ARM_ABI_FLOAT_HARD} and {@link #EF_ARM_ABI_FLOAT_SOFT} are clear,
+ * {@link #EF_ARM_ABI_FLOAT_HARD} and {@link #EF_ARM_ABI_FLOAT_SOFT} are clear,
* conformance to the base procedure-call standard is implied.
* <p>
* Compatible with legacy (pre version 5) gcc use as EF_ARM_SOFT_FLOAT.
* </p>
* <p>
- * Note: This is not used (anymore)
- * </p>
+ * Note: This is not used (anymore)
+ * </p>
* {@value}
*/
public static final int EF_ARM_ABI_FLOAT_SOFT = 0x00000200;
-
+
/** An unknown type - {@value} */
public static final short ET_NONE = 0;
/** A relocatable file - {@value} */
@@ -205,7 +205,7 @@ public class ElfHeader {
public static final short ET_DYN = 3;
/** A core file - {@value} */
public static final short ET_CORE = 4;
-
+
public static final short EM_NONE = 0;
public static final short EM_M32 = 1;
public static final short EM_SPARC = 2;
@@ -357,34 +357,34 @@ public class ElfHeader {
public static final short EM_TILEPRO = 188;
public static final short EM_MICROBLAZE = 189;
public static final short EM_CUDA = 190;
-
+
public static final boolean isIdentityValid(byte[] ident) {
return ELFMAG0 == ident[0] &&
ELFMAG1 == ident[1] &&
ELFMAG2 == ident[2] &&
ELFMAG3 == ident[3] ;
}
-
+
/** Public access to the raw elf header */
public final Ehdr d;
-
+
/** Public access to the {@link SectionHeader} */
- public final SectionHeader[] sht;
-
+ public final SectionHeader[] sht;
+
private final String string;
-
+
/**
* Note: The input stream shall stay untouch to be able to read sections!
- *
+ *
* @param in input stream of a binary file at position zero
* @return
- * @throws IOException if reading from the given input stream fails or less then ELF Header size bytes
+ * @throws IOException if reading from the given input stream fails or less then ELF Header size bytes
* @throws IllegalArgumentException if the given input stream does not represent an ELF Header
*/
public static ElfHeader read(RandomAccessFile in) throws IOException, IllegalArgumentException {
final int eh_sz = Ehdr.size();
final byte[] buf = new byte[eh_sz];
- readBytes (in, buf, 0, eh_sz);
+ readBytes (in, buf, 0, eh_sz);
final ElfHeader eh = new ElfHeader(ByteBuffer.wrap(buf, 0, buf.length), in);
return eh;
}
@@ -392,7 +392,7 @@ public class ElfHeader {
/**
* @param buf ELF Header bytes
* @throws IllegalArgumentException if the given buffer does not represent an ELF Header
- * @throws IOException
+ * @throws IOException
*/
ElfHeader(java.nio.ByteBuffer buf, RandomAccessFile in) throws IllegalArgumentException, IOException {
d = Ehdr.create(buf);
@@ -404,11 +404,11 @@ public class ElfHeader {
}
public final short getSize() { return d.getE_ehsize(); }
-
- /**
- * Returns the architecture class in bits,
- * 32 for {@link #ELFCLASS32}, 64 for {@link #ELFCLASS64}
- * and 0 for {@link #ELFCLASSNONE}.
+
+ /**
+ * Returns the architecture class in bits,
+ * 32 for {@link #ELFCLASS32}, 64 for {@link #ELFCLASS64}
+ * and 0 for {@link #ELFCLASSNONE}.
*/
public final int getArchClassBits() {
switch( d.getE_ident()[EI_CLASS] ) {
@@ -417,48 +417,48 @@ public class ElfHeader {
default: return 0;
}
}
-
- /**
- * Returns the processor's data encoding, i.e.
- * {@link #ELFDATA2LSB}, {@link #ELFDATA2MSB} or {@link #ELFDATANONE};
+
+ /**
+ * Returns the processor's data encoding, i.e.
+ * {@link #ELFDATA2LSB}, {@link #ELFDATA2MSB} or {@link #ELFDATANONE};
*/
public final byte getDataEncodingMode() {
return d.getE_ident()[EI_DATA];
}
-
+
/** Returns the ELF file version, should be {@link #EV_CURRENT}. */
public final byte getVersion() {
return d.getE_ident()[EI_VERSION];
}
-
+
/** Returns the operating system and ABI for this file, 3 == Linux. Note: Often not used. */
public final byte getOSABI() {
return d.getE_ident()[EI_OSABI];
}
-
+
/** Returns the version of the {@link #getOSABI() OSABI} for this file. */
public final byte getOSABIVersion() {
return d.getE_ident()[EI_ABIVERSION];
}
- /** Returns the object file type, e.g. {@link #ET_EXEC}, .. */
+ /** Returns the object file type, e.g. {@link #ET_EXEC}, .. */
public final short getType() {
return d.getE_type();
}
- /** Returns the required architecture for the file, e.g. {@link #EM_386}, .. */
+ /** Returns the required architecture for the file, e.g. {@link #EM_386}, .. */
public final short getMachine() {
- return d.getE_machine();
+ return d.getE_machine();
}
-
- /**
+
+ /**
* Returns true if {@link #getMachine() machine} is a 32 or 64 bit ARM CPU
* of type {@link #EM_ARM}. */
public final boolean isArm() {
return getMachine() == EM_ARM;
}
-
- /**
+
+ /**
* Returns true if {@link #getMachine() machine} is a 32 or 64 bit Intel CPU
* of type {@link #EM_386}, {@link #EM_486} or {@link #EM_X86_64}. */
public final boolean isIntel() {
@@ -467,30 +467,30 @@ public class ElfHeader {
EM_486 == m ||
EM_X86_64 == m;
}
-
+
/** Returns the processor-specific flags associated with the file. */
public final int getFlags() {
return d.getE_flags();
}
-
+
/** Returns the ARM EABI version from {@link #getFlags() flags}, maybe 0 if not an ARM EABI. */
public byte getArmABI() {
- return (byte) ( ( ( EF_ARM_ABIMASK & d.getE_flags() ) >> EF_ARM_ABISHIFT ) & 0xff );
+ return (byte) ( ( ( EF_ARM_ABIMASK & d.getE_flags() ) >> EF_ARM_ABISHIFT ) & 0xff );
}
-
+
/** Returns the ARM EABI legacy GCC {@link #getFlags() flags}, maybe 0 if not an ARM EABI or not having legacy GCC flags. */
public int getArmLegacyGCCFlags() {
final int f = d.getE_flags();
- return 0 != ( EF_ARM_ABIMASK & f ) ? ( EF_ARM_GCCMASK & f ) : 0;
+ return 0 != ( EF_ARM_ABIMASK & f ) ? ( EF_ARM_GCCMASK & f ) : 0;
}
-
- /**
+
+ /**
* Returns the ARM EABI float mode from {@link #getFlags() flags},
* i.e. 1 for {@link #EF_ARM_ABI_FLOAT_SOFT}, 2 for {@link #EF_ARM_ABI_FLOAT_HARD}
* or 0 for none.
* <p>
- * Note: This is not used (anymore)
- * </p>
+ * Note: This is not used (anymore)
+ * </p>
*/
public byte getArmFloatMode() {
final int f = d.getE_flags();
@@ -515,7 +515,7 @@ public class ElfHeader {
}
return null;
}
-
+
/** Returns the 1st occurence of matching SectionHeader {@link SectionHeader#getName() name}, or null if not exists. */
public final SectionHeader getSectionHeader(String name) {
for(int i=0; i<sht.length; i++) {
@@ -526,11 +526,11 @@ public class ElfHeader {
}
return null;
}
-
+
public final String toString() {
return string;
}
-
+
private final String toStringImpl() {
final String machineS;
if( isArm() ) {
@@ -553,13 +553,13 @@ public class ElfHeader {
armFlagsS=", arm[abi "+armABI+", lGCC "+getArmLegacyGCCFlags()+", float "+getArmFloatMode()+"]";
} else {
armFlagsS="";
- }
+ }
return "ElfHeader[vers "+getVersion()+", machine["+getMachine()+machineS+"], bits "+getArchClassBits()+", enc "+encS+
", abi[os "+getOSABI()+", vers "+getOSABIVersion()+"], flags["+toHexString(getFlags())+armFlagsS+"], type "+getType()+", sh-num "+sht.length+"]";
}
-
+
final SectionHeader[] readSectionHeaderTable(RandomAccessFile in) throws IOException, IllegalArgumentException {
- // positioning
+ // positioning
{
final long off = d.getE_shoff(); // absolute offset
if( 0 == off ) {
@@ -572,7 +572,7 @@ public class ElfHeader {
final int size = d.getE_shentsize();
final int num;
int i;
- if( 0 == d.getE_shnum() ) {
+ if( 0 == d.getE_shnum() ) {
// Read 1st table 1st and use it's sh_size
final byte[] buf0 = new byte[size];
readBytes(in, buf0, 0, size);
@@ -608,7 +608,7 @@ public class ElfHeader {
sht[i].initName(strS, sht[i].d.getSh_name());
}
}
-
+
return sht;
- }
+ }
}
diff --git a/src/java/jogamp/common/os/elf/IOUtils.java b/src/java/jogamp/common/os/elf/IOUtils.java
index 8308463..8c7bfd1 100644
--- a/src/java/jogamp/common/os/elf/IOUtils.java
+++ b/src/java/jogamp/common/os/elf/IOUtils.java
@@ -34,15 +34,15 @@ import java.nio.ByteOrder;
class IOUtils {
static final long MAX_INT_VALUE = ( (long) Integer.MAX_VALUE & 0xffffffffL ) ;
-
+
static String toHexString(int i) { return "0x"+Integer.toHexString(i); }
-
+
static String toHexString(long i) { return "0x"+Long.toHexString(i); }
-
+
static int shortToInt(short s) {
return (int)s & 0x0000ffff;
}
-
+
static int long2Int(final long v) {
if( MAX_INT_VALUE < v ) {
throw new IllegalArgumentException("Read uint32 value "+toHexString(v)+" > int32-max "+toHexString(MAX_INT_VALUE));
@@ -53,46 +53,46 @@ class IOUtils {
static void checkBounds(final byte[] sb, final int offset, final int remaining) {
if( offset + remaining > sb.length ) {
throw new IndexOutOfBoundsException("Buffer of size "+sb.length+" cannot hold offset "+offset+" + remaining "+remaining);
- }
+ }
}
-
- static void readBytes(final RandomAccessFile in, final byte[] out, final int offset, final int len)
- throws IOException, IllegalArgumentException
- {
+
+ static void readBytes(final RandomAccessFile in, final byte[] out, final int offset, final int len)
+ throws IOException, IllegalArgumentException
+ {
in.readFully(out, offset, len);
}
-
+
static void seek(final RandomAccessFile in, long newPos) throws IOException {
in.seek(newPos);
}
-
+
static int readUInt32(final byte[] in, final int offset) {
final int v = readInt32(in, offset);
if( 0 > v ) {
- throw new IllegalArgumentException("Read uint32 value "+toHexString(v)+" > int32-max "+toHexString(MAX_INT_VALUE));
+ throw new IllegalArgumentException("Read uint32 value "+toHexString(v)+" > int32-max "+toHexString(MAX_INT_VALUE));
}
return v;
/** Need to fix endian for below path ..
checkBounds(in, offset, 4);
- final byte[] uint = new byte[] { 0, 0, 0, 0, in[offset+0], in[offset+1], in[offset+2], in[offset+3] };
+ final byte[] uint = new byte[] { 0, 0, 0, 0, in[offset+0], in[offset+1], in[offset+2], in[offset+3] };
final ByteBuffer b = ByteBuffer.wrap(uint, 0, 8).order(ByteOrder.nativeOrder());
return b.asLongBuffer().get(0); */
}
-
+
static int readInt32(final byte[] in, final int offset) {
checkBounds(in, offset, 4);
final ByteBuffer b = ByteBuffer.wrap(in, offset, 4).order(ByteOrder.nativeOrder());
return b.asIntBuffer().get(0);
}
-
+
/**
* @param sb byte source buffer to parse
* @param offset offset within byte source buffer to start parsing
- * @param remaining remaining numbers of bytes to parse beginning w/ <code>sb_off</code>,
+ * @param remaining remaining numbers of bytes to parse beginning w/ <code>sb_off</code>,
* which shall not exceed <code>sb.length - offset</code>.
* @param offset_post optional integer array holding offset post parsing
* @return the parsed string
- * @throws IndexOutOfBoundsException if <code>offset + remaining > sb.length</code>.
+ * @throws IndexOutOfBoundsException if <code>offset + remaining > sb.length</code>.
*/
static String getString(final byte[] sb, final int offset, final int remaining, int[] offset_post) throws IndexOutOfBoundsException {
checkBounds(sb, offset, remaining);
@@ -104,14 +104,14 @@ class IOUtils {
}
return s;
}
-
+
/**
* @param sb byte source buffer to parse
* @param offset offset within byte source buffer to start parsing
- * @param remaining remaining numbers of bytes to parse beginning w/ <code>sb_off</code>,
+ * @param remaining remaining numbers of bytes to parse beginning w/ <code>sb_off</code>,
* which shall not exceed <code>sb.length - offset</code>.
* @return the number of parsed strings
- * @throws IndexOutOfBoundsException if <code>offset + remaining > sb.length</code>.
+ * @throws IndexOutOfBoundsException if <code>offset + remaining > sb.length</code>.
*/
static int getStringCount(final byte[] sb, int offset, final int remaining) throws IndexOutOfBoundsException {
checkBounds(sb, offset, remaining);
@@ -120,21 +120,21 @@ class IOUtils {
for(; i < remaining && sb[i + offset] != 0; i++) { }
strnum++;
}
- return strnum;
+ return strnum;
}
-
+
/**
* @param sb byte source buffer to parse
* @param offset offset within byte source buffer to start parsing
- * @param remaining remaining numbers of bytes to parse beginning w/ <code>sb_off</code>,
+ * @param remaining remaining numbers of bytes to parse beginning w/ <code>sb_off</code>,
* which shall not exceed <code>sb.length - offset</code>.
* @return the parsed strings
- * @throws IndexOutOfBoundsException if <code>offset + remaining > sb.length</code>.
+ * @throws IndexOutOfBoundsException if <code>offset + remaining > sb.length</code>.
*/
public static String[] getStrings(final byte[] sb, int offset, final int remaining) throws IndexOutOfBoundsException {
final int strnum = getStringCount(sb, offset, remaining);
// System.err.println("XXX: strnum "+strnum+", sb_off "+sb_off+", sb_len "+sb_len);
-
+
final String[] sa = new String[strnum];
final int[] io_off = new int[] { offset };
for(int i=0; i < strnum; i++) {
@@ -142,7 +142,7 @@ class IOUtils {
sa[i] = getString(sb, io_off[0], remaining - io_off[0], io_off);
// System.err.println(".. "+io_off[0]+"[ "+sa[i]);
}
- return sa;
+ return sa;
}
-
+
}
diff --git a/src/java/jogamp/common/os/elf/Section.java b/src/java/jogamp/common/os/elf/Section.java
index 99c762c..a653668 100644
--- a/src/java/jogamp/common/os/elf/Section.java
+++ b/src/java/jogamp/common/os/elf/Section.java
@@ -32,19 +32,19 @@ public class Section {
public byte[] data;
public int offset;
public int length;
-
+
Section(SectionHeader sh, byte[] data, int offset, int length) {
this.sh = sh;
this.data = data;
this.offset = offset;
this.length = length;
}
-
+
public String toString() {
return "Section["+toSubString()+"]";
}
String toSubString() {
return sh+", data[off "+offset+", len "+length+"/"+data.length+"]";
}
-
+
}
diff --git a/src/java/jogamp/common/os/elf/SectionArmAttributes.java b/src/java/jogamp/common/os/elf/SectionArmAttributes.java
index 7b85bb9..413250a 100644
--- a/src/java/jogamp/common/os/elf/SectionArmAttributes.java
+++ b/src/java/jogamp/common/os/elf/SectionArmAttributes.java
@@ -23,17 +23,17 @@ import java.util.List;
*/
public class SectionArmAttributes extends Section {
public static final byte FORMAT_VERSION_A = 0x41; // 'A';
-
+
public static enum Type {
/** No Value */
- None,
+ None,
/** A Sub-Section - following the 4 byte sub section total size (tag + size + content) - byte order of the ELF file */
SubSection,
/** Null Terminated Byte-String */
NTBS,
ULEB128,
}
-
+
/** ULEB128 Value for {@link Tag#ABI_VFP_args}: FP parameter/result passing conforms to AAPCS, BASE variant. */
public static final byte ABI_VFP_ARGS_IS_BASE_VARIANT = 0;
/** ULEB128 Value for {@link Tag#ABI_VFP_args}: FP parameter/result passing conforms to AAPCS, VFP variant. */
@@ -41,18 +41,18 @@ public class SectionArmAttributes extends Section {
/** ULEB128 Value for {@link Tag#ABI_VFP_args}: FP parameter/result passing conforms to custom toolchain. */
public static final byte ABI_VFP_ARGS_IS_CUSTOM_VARIANT = 2;
/** ULEB128 Value for {@link Tag#ABI_VFP_args}: FP parameter/result passing conforms to both , BASE and VFP variant. */
- public static final byte ABI_VFP_ARGS_IS_BOTH_BASE_AND_VFP_VARIANT = 3;
-
- /**
+ public static final byte ABI_VFP_ARGS_IS_BOTH_BASE_AND_VFP_VARIANT = 3;
+
+ /**
* Returns true if value is either {@link #ABI_VFP_ARGS_IS_VFP_VARIANT} or {@link #ABI_VFP_ARGS_IS_BOTH_BASE_AND_VFP_VARIANT}
* @param v ULEB128 Value from {@link Tag#ABI_VFP_args} attribute
*/
public static final boolean abiVFPArgsAcceptsVFPVariant(byte v) {
return ABI_VFP_ARGS_IS_VFP_VARIANT == v || ABI_VFP_ARGS_IS_BOTH_BASE_AND_VFP_VARIANT == v;
}
-
+
public static enum Tag {
- None(0, Type.None),
+ None(0, Type.None),
File(1, Type.SubSection), Section(2, Type.SubSection), Symbol(3, Type.SubSection),
CPU_raw_name( 4, Type.NTBS ),
CPU_name( 5, Type.NTBS ),
@@ -96,10 +96,10 @@ public class SectionArmAttributes extends Section {
undefined69( 69, Type.None ),
MPextension_use_legacy( 70, Type.ULEB128 )
;
-
+
public final int id;
- public final Type type;
-
+ public final Type type;
+
/** Slow O(n) transition of a native tag value to a Tag. */
public static Tag get(final int id) {
final Tag[] tags = Tag.values();
@@ -117,16 +117,16 @@ public class SectionArmAttributes extends Section {
this.type = type;
}
}
-
+
public static class Attribute {
public final Tag tag;
private final Object value;
-
+
Attribute(Tag tag, Object value) {
this.tag = tag;
this.value = value;
}
-
+
public final boolean isNTBS() {
return Type.NTBS == tag.type;
}
@@ -136,7 +136,7 @@ public class SectionArmAttributes extends Section {
}
throw new IllegalArgumentException("Not NTBS but "+tag.type);
}
-
+
public final boolean isULEB128() {
return Type.ULEB128 == tag.type;
}
@@ -146,41 +146,41 @@ public class SectionArmAttributes extends Section {
}
throw new IllegalArgumentException("Not ULEB128 but "+tag.type);
}
-
+
public String toString() {
return tag+" = "+value;
}
}
-
+
public static class VendorAttributes {
public final String vendor;
public final List<Attribute> attributes;
-
+
VendorAttributes(String vendor, List<Attribute> attributes) {
this.vendor = vendor;
- this.attributes = attributes;
+ this.attributes = attributes;
}
-
+
public String toString() {
return vendor + attributes.toString();
}
}
public final List<VendorAttributes> vendorAttributesList;
-
+
SectionArmAttributes(SectionHeader sh, byte[] data, int offset, int length) throws IndexOutOfBoundsException, IllegalArgumentException {
super(sh, data, offset, length);
this.vendorAttributesList = parse(data, offset, length);
}
-
+
public String toString() {
return "SectionArmAttributes["+super.toSubString()+", "+vendorAttributesList.toString()+"]";
}
-
+
public final Attribute get(Tag tag) {
for(int i=0; i<vendorAttributesList.size(); i++) {
final List<Attribute> attributes = vendorAttributesList.get(i).attributes;
for(int j=0; j<attributes.size(); j++) {
- final Attribute a = attributes.get(j);
+ final Attribute a = attributes.get(j);
if( a.tag == tag ) {
return a;
}
@@ -188,11 +188,11 @@ public class SectionArmAttributes extends Section {
}
return null;
}
-
+
public final List<Attribute> get(String vendor) {
return get(vendorAttributesList, vendor);
}
-
+
static final List<Attribute> get(final List<VendorAttributes> vendorAttributesList, String vendor) {
for(int i=0; i<vendorAttributesList.size(); i++) {
final VendorAttributes vas = vendorAttributesList.get(i);
@@ -202,14 +202,14 @@ public class SectionArmAttributes extends Section {
}
return null;
}
-
+
/**
* @param in byte source buffer to parse
* @param offset offset within byte source buffer to start parsing
- * @param remaining remaining numbers of bytes to parse beginning w/ <code>sb_off</code>,
+ * @param remaining remaining numbers of bytes to parse beginning w/ <code>sb_off</code>,
* which shall not exceed <code>sb.length - offset</code>.
- * @throws IndexOutOfBoundsException if <code>offset + remaining > sb.length</code>.
- * @throws IllegalArgumentException if section parsing failed, i.e. incompatible version or data.
+ * @throws IndexOutOfBoundsException if <code>offset + remaining > sb.length</code>.
+ * @throws IllegalArgumentException if section parsing failed, i.e. incompatible version or data.
*/
static List<VendorAttributes> parse(final byte[] in, final int offset, final int remaining) throws IndexOutOfBoundsException, IllegalArgumentException {
checkBounds(in, offset, remaining);
@@ -218,33 +218,33 @@ public class SectionArmAttributes extends Section {
throw new IllegalArgumentException("ShArmAttr: Not version A, but: "+toHexString(in[i]));
}
i++;
-
+
final List<VendorAttributes> vendorAttributesList = new ArrayList<VendorAttributes>();
-
+
while(i < remaining) {
- final int i_pre = i;
+ final int i_pre = i;
final int secLen = readUInt32(in, i); /* total section size: 4 + string + content, i.e. offset to next section */
i+=4;
-
+
final String vendor;
{
- int[] i_post = new int[] { 0 };
+ int[] i_post = new int[] { 0 };
vendor = getString(in, i, secLen - 4, i_post);
i = i_post[0];
}
-
+
final List<Attribute> attributes = new ArrayList<Attribute>();
-
+
while(i < secLen) {
- int[] i_post = new int[] { 0 };
- parseSub(in, i, secLen - i, i_post, attributes);
+ int[] i_post = new int[] { 0 };
+ parseSub(in, i, secLen - i, i_post, attributes);
i = i_post[0];
}
-
+
if( i_pre + secLen != i ) {
throw new IllegalArgumentException("ShArmAttr: Section length count mismatch, expected "+(i_pre + secLen)+", has "+i);
}
-
+
final List<Attribute> mergeAttribs = get(vendorAttributesList, vendor);
if( null != mergeAttribs ) {
mergeAttribs.addAll(attributes);
@@ -252,21 +252,21 @@ public class SectionArmAttributes extends Section {
vendorAttributesList.add(new VendorAttributes(vendor, attributes));
}
}
-
+
return vendorAttributesList;
}
-
+
/**
* @param in byte source buffer to parse
* @param offset offset within byte source buffer to start parsing
- * @param remaining remaining numbers of bytes to parse beginning w/ <code>sb_off</code>,
+ * @param remaining remaining numbers of bytes to parse beginning w/ <code>sb_off</code>,
* which shall not exceed <code>sb.length - offset</code>.
- * @throws IndexOutOfBoundsException if <code>offset + remaining > sb.length</code>.
- * @throws IllegalArgumentException if section parsing failed, i.e. incompatible version or data.
+ * @throws IndexOutOfBoundsException if <code>offset + remaining > sb.length</code>.
+ * @throws IllegalArgumentException if section parsing failed, i.e. incompatible version or data.
*/
static void parseSub(final byte[] in, final int offset, final int remaining, int[] offset_post, List<Attribute> attributes) throws IndexOutOfBoundsException, IllegalArgumentException {
checkBounds(in, offset, remaining);
-
+
// Starts w/ sub-section Tag
int i = offset;
final int i_sTag = in[i++];
@@ -274,7 +274,7 @@ public class SectionArmAttributes extends Section {
if( null == sTag ) {
throw new IllegalArgumentException("ShArmAttr: Invalid Sub-Section tag (NaT): "+i_sTag);
}
- final int subSecLen; // sub section total size (tag + size + content)
+ final int subSecLen; // sub section total size (tag + size + content)
switch(sTag) {
case File:
case Section:
@@ -295,7 +295,7 @@ public class SectionArmAttributes extends Section {
switch(tag.type) {
case NTBS:
{
- int[] i_post = new int[] { 0 };
+ int[] i_post = new int[] { 0 };
final String value = getString(in, i, subSecLen + offset - i, i_post);
attributes.add(new Attribute(tag, value));
i = i_post[0];
@@ -313,5 +313,5 @@ public class SectionArmAttributes extends Section {
}
}
offset_post[0] = offset + subSecLen;
- }
+ }
}
diff --git a/src/java/jogamp/common/os/elf/SectionHeader.java b/src/java/jogamp/common/os/elf/SectionHeader.java
index 18a3293..fd28d2a 100644
--- a/src/java/jogamp/common/os/elf/SectionHeader.java
+++ b/src/java/jogamp/common/os/elf/SectionHeader.java
@@ -120,7 +120,7 @@ public class SectionHeader {
* {@value}
*/
public static final int SHT_HIUSER = 0xffffffff;
-
+
/**
* {@value}
*/
@@ -141,7 +141,7 @@ public class SectionHeader {
* {@value}
*/
public static final int SHT_ARM_OVERLAYSECTION = 0x70000005;
-
+
/**
* {@value}
*/
@@ -169,14 +169,14 @@ public class SectionHeader {
/**
* {@value}
*/
- public static final short SHN_HIRESERVE = (short)0xffff;
-
+ public static final short SHN_HIRESERVE = (short)0xffff;
+
/** Public access to the raw elf section header */
public final Shdr d;
-
+
private int idx;
private String name;
-
+
SectionHeader(byte[] buf, int offset, int length, int sectionIdx) {
this( ByteBuffer.wrap(buf, 0, buf.length), sectionIdx );
}
@@ -185,11 +185,11 @@ public class SectionHeader {
this.idx = idx;
name = null;
}
-
+
public String toString() {
return "SectionHeader[idx "+idx+", name "+name+", type "+toHexString(getType())+", link "+d.getSh_link()+", info "+toHexString(d.getSh_info())+", flags "+toHexString(getFlags())+"]";
}
-
+
/**
* @param strS the {@link SectionHeader#SHT_STRTAB} section containing all strings
* @param nameOffset name offset within strS
@@ -202,7 +202,7 @@ public class SectionHeader {
public int getIndex() {
return idx;
}
-
+
/** Returns the type of this section. */
public int getType() {
return d.getSh_type();
@@ -212,7 +212,7 @@ public class SectionHeader {
public long getFlags() {
return d.getSh_flags();
}
-
+
/** Returns the size of this section. */
public long getSize() {
return d.getSh_size();
@@ -222,10 +222,10 @@ public class SectionHeader {
public String getName() {
return name;
}
-
+
/**
* Returns the Section referenced w/ this section header
- *
+ *
* @param in file owning the section
* @throws IOException if read error occurs
* @throws IllegalArgumentException if section offset or size mismatch including size &gt; {@link Integer#MAX_VALUE}
@@ -238,10 +238,10 @@ public class SectionHeader {
final byte[] s_buf = new byte[s_size];
return readSectionImpl(in, s_buf, 0, s_size);
}
-
+
/**
* Returns the Section referenced w/ this section header using given byte array.
- *
+ *
* @param in file owning the section
* @param b destination buffer
* @param b_off offset in destination buffer
@@ -260,7 +260,7 @@ public class SectionHeader {
}
return readSectionImpl(in, b, b_off, r_len);
}
-
+
Section readSectionImpl(RandomAccessFile in, byte[] b, int b_off, int r_len) throws IOException, IllegalArgumentException {
final long s_off = d.getSh_offset();
seek(in, s_off);
@@ -270,5 +270,5 @@ public class SectionHeader {
} else {
return new Section(this, b, b_off, r_len);
}
- }
+ }
}
diff --git a/src/java/jogamp/common/util/locks/LockDebugUtil.java b/src/java/jogamp/common/util/locks/LockDebugUtil.java
index 480b143..ee0a8e8 100644
--- a/src/java/jogamp/common/util/locks/LockDebugUtil.java
+++ b/src/java/jogamp/common/util/locks/LockDebugUtil.java
@@ -50,7 +50,7 @@ public class LockDebugUtil {
dummy = new ArrayList<Throwable>(0);
}
}
-
+
public static List<Throwable> getRecursiveLockTrace() {
if(Lock.DEBUG) {
ArrayList<Throwable> ls = tlsLockedStacks.get();
@@ -63,7 +63,7 @@ public class LockDebugUtil {
return dummy;
}
}
-
+
public static void dumpRecursiveLockTrace(PrintStream out) {
if(Lock.DEBUG) {
List<Throwable> ls = getRecursiveLockTrace();
diff --git a/src/java/jogamp/common/util/locks/RecursiveLockImpl01CompleteFair.java b/src/java/jogamp/common/util/locks/RecursiveLockImpl01CompleteFair.java
index 986a7fc..f49e406 100644
--- a/src/java/jogamp/common/util/locks/RecursiveLockImpl01CompleteFair.java
+++ b/src/java/jogamp/common/util/locks/RecursiveLockImpl01CompleteFair.java
@@ -36,7 +36,7 @@ import com.jogamp.common.util.locks.RecursiveLock;
/**
* Reentrance locking toolkit, impl a complete fair FIFO scheduler
- *
+ *
* <p>
* Sync object extends {@link AbstractOwnableSynchronizer}, hence monitoring is possible.</p>
*/
@@ -50,7 +50,7 @@ public class RecursiveLockImpl01CompleteFair implements RecursiveLock {
final Thread thread;
boolean signaledByUnlock; // if true, it's also removed from queue
}
-
+
@SuppressWarnings("serial")
private static class Sync extends AbstractOwnableSynchronizer {
private Sync() {
@@ -68,7 +68,7 @@ public class RecursiveLockImpl01CompleteFair implements RecursiveLock {
ls.remove(lockedStack);
} else {
ls.add(s);
- }
+ }
lockedStack = s;
}
/** lock count by same thread */
@@ -79,7 +79,7 @@ public class RecursiveLockImpl01CompleteFair implements RecursiveLock {
private Throwable lockedStack = null;
}
private Sync sync = new Sync();
-
+
public RecursiveLockImpl01CompleteFair() {
}
@@ -119,7 +119,7 @@ public class RecursiveLockImpl01CompleteFair implements RecursiveLock {
public final boolean isLockedByOtherThread() {
synchronized(sync) {
final Thread o = sync.getOwner();
- return null != o && Thread.currentThread() != o ;
+ return null != o && Thread.currentThread() != o ;
}
}
@@ -175,9 +175,9 @@ public class RecursiveLockImpl01CompleteFair implements RecursiveLock {
}
return true;
}
-
+
if ( sync.getOwner() != null || ( 0<timeout && 0<sync.queue.size() ) ) {
-
+
if ( 0 >= timeout ) {
// locked by other thread and no waiting requested
if(TRACE_LOCK) {
@@ -185,7 +185,7 @@ public class RecursiveLockImpl01CompleteFair implements RecursiveLock {
}
return false;
}
-
+
// enqueue at the start
WaitingThread wCur = new WaitingThread(cur);
sync.queue.add(0, wCur);
@@ -198,24 +198,24 @@ public class RecursiveLockImpl01CompleteFair implements RecursiveLock {
if( !wCur.signaledByUnlock ) {
sync.queue.remove(wCur); // O(n)
throw e; // propagate interruption not send by unlock
- } else if( cur != sync.getOwner() ) {
+ } else if( cur != sync.getOwner() ) {
// Issued by unlock, but still locked by other thread
//
timeout -= System.currentTimeMillis() - t0;
-
+
if(TRACE_LOCK) {
System.err.println("+++ LOCK 1 "+toString()+", cur "+threadName(cur)+", left "+timeout+" ms, signaled: "+wCur.signaledByUnlock);
}
-
+
if(0 < timeout) {
// not timed out, re-enque - lock was 'stolen'
wCur.signaledByUnlock = false;
sync.queue.add(sync.queue.size(), wCur);
}
- } // else: Issued by unlock, owning lock .. expected!
+ } // else: Issued by unlock, owning lock .. expected!
}
} while ( cur != sync.getOwner() && 0 < timeout ) ;
-
+
if( 0 >= timeout && cur != sync.getOwner() ) {
// timed out
if(!wCur.signaledByUnlock) {
@@ -226,7 +226,7 @@ public class RecursiveLockImpl01CompleteFair implements RecursiveLock {
}
return false;
}
-
+
++sync.holdCount;
if(TRACE_LOCK) {
System.err.println("+++ LOCK X1 "+toString()+", cur "+threadName(cur)+", left "+timeout+" ms");
@@ -237,7 +237,7 @@ public class RecursiveLockImpl01CompleteFair implements RecursiveLock {
System.err.println("+++ LOCK X0 "+toString()+", cur "+threadName(cur));
}
}
-
+
sync.setOwner(cur);
if(DEBUG) {
sync.setLockedStack(new Throwable("Previously locked by "+toString()));
@@ -245,7 +245,7 @@ public class RecursiveLockImpl01CompleteFair implements RecursiveLock {
return true;
}
}
-
+
@Override
public final void unlock() {
@@ -259,33 +259,33 @@ public class RecursiveLockImpl01CompleteFair implements RecursiveLock {
synchronized(sync) {
validateLocked();
final Thread cur = Thread.currentThread();
-
+
--sync.holdCount;
-
+
if (sync.holdCount > 0) {
if(TRACE_LOCK) {
System.err.println("--- LOCK XR "+toString()+", cur "+threadName(cur));
}
return;
}
-
+
if(DEBUG) {
sync.setLockedStack(null);
}
if(null!=taskAfterUnlockBeforeNotify) {
taskAfterUnlockBeforeNotify.run();
}
-
+
if(sync.queue.size() > 0) {
// fair, wakeup the oldest one ..
// final WaitingThread oldest = queue.removeLast();
final WaitingThread oldest = sync.queue.remove(sync.queue.size()-1);
- sync.setOwner(oldest.thread);
-
+ sync.setOwner(oldest.thread);
+
if(TRACE_LOCK) {
System.err.println("--- LOCK X1 "+toString()+", cur "+threadName(cur)+", signal: "+threadName(oldest.thread));
}
-
+
oldest.signaledByUnlock = true;
oldest.thread.interrupt(); // Propagate SecurityException if it happens
} else {
@@ -293,24 +293,24 @@ public class RecursiveLockImpl01CompleteFair implements RecursiveLock {
if(TRACE_LOCK) {
System.err.println("--- LOCK X0 "+toString()+", cur "+threadName(cur)+", signal any");
}
- sync.notify();
+ sync.notify();
}
}
}
-
+
@Override
public final int getQueueLength() {
synchronized(sync) {
return sync.queue.size();
}
}
-
+
@Override
public String toString() {
return syncName()+"[count "+sync.holdCount+
", qsz "+sync.queue.size()+", owner "+threadName(sync.getOwner())+"]";
}
-
+
private final String syncName() {
return "<"+Integer.toHexString(this.hashCode())+", "+Integer.toHexString(sync.hashCode())+">";
}
diff --git a/src/java/jogamp/common/util/locks/RecursiveLockImpl01Unfairish.java b/src/java/jogamp/common/util/locks/RecursiveLockImpl01Unfairish.java
index e8fecb1..8c9f720 100644
--- a/src/java/jogamp/common/util/locks/RecursiveLockImpl01Unfairish.java
+++ b/src/java/jogamp/common/util/locks/RecursiveLockImpl01Unfairish.java
@@ -37,9 +37,9 @@ import com.jogamp.common.util.locks.RecursiveLock;
* Reentrance locking toolkit, impl a non-complete fair FIFO scheduler.
* <p>
* Fair scheduling is not guaranteed due to the usage of {@link Object#notify()},
- * however new lock-applicants will wait if queue is not empty for {@link #lock()}
+ * however new lock-applicants will wait if queue is not empty for {@link #lock()}
* and {@link #tryLock(long) tryLock}(timeout>0).</p>
- *
+ *
* <p>
* Sync object extends {@link AbstractOwnableSynchronizer}, hence monitoring is possible.</p>
*/
@@ -49,19 +49,19 @@ public class RecursiveLockImpl01Unfairish implements RecursiveLock {
Thread getOwner();
boolean isOwner(Thread t);
void setOwner(Thread t);
-
+
Throwable getLockedStack();
void setLockedStack(Throwable s);
-
+
int getHoldCount();
void incrHoldCount(Thread t);
void decrHoldCount(Thread t);
-
+
int getQSz();
void incrQSz();
void decrQSz();
}
-
+
@SuppressWarnings("serial")
/* package */ static class SingleThreadSync extends AbstractOwnableSynchronizer implements Sync {
/* package */ SingleThreadSync() {
@@ -90,7 +90,7 @@ public class RecursiveLockImpl01Unfairish implements RecursiveLock {
ls.remove(lockedStack);
} else {
ls.add(s);
- }
+ }
lockedStack = s;
}
@Override
@@ -99,14 +99,14 @@ public class RecursiveLockImpl01Unfairish implements RecursiveLock {
public void incrHoldCount(Thread t) { holdCount++; }
@Override
public void decrHoldCount(Thread t) { holdCount--; }
-
+
@Override
public final int getQSz() { return qsz; }
@Override
public final void incrQSz() { qsz++; }
@Override
public final void decrQSz() { qsz--; }
-
+
/** lock count by same thread */
private int holdCount = 0;
/** queue size of waiting threads */
@@ -114,13 +114,13 @@ public class RecursiveLockImpl01Unfairish implements RecursiveLock {
/** stack trace of the lock, only used if DEBUG */
private Throwable lockedStack = null;
}
-
+
protected final Sync sync;
-
+
public RecursiveLockImpl01Unfairish(Sync sync) {
this.sync = sync;
}
-
+
public RecursiveLockImpl01Unfairish() {
this(new SingleThreadSync());
}
@@ -217,9 +217,9 @@ public class RecursiveLockImpl01Unfairish implements RecursiveLock {
}
return true;
}
-
+
if ( sync.getOwner() != null || ( 0<timeout && 0<sync.getQSz() ) ) {
-
+
if ( 0 >= timeout ) {
// locked by other thread and no waiting requested
if(TRACE_LOCK) {
@@ -227,7 +227,7 @@ public class RecursiveLockImpl01Unfairish implements RecursiveLock {
}
return false;
}
-
+
sync.incrQSz();
do {
final long t0 = System.currentTimeMillis();
@@ -235,7 +235,7 @@ public class RecursiveLockImpl01Unfairish implements RecursiveLock {
timeout -= System.currentTimeMillis() - t0;
} while (null != sync.getOwner() && 0 < timeout) ;
sync.decrQSz();
-
+
if( 0 >= timeout && sync.getOwner() != null ) {
// timed out
if(TRACE_LOCK) {
@@ -243,24 +243,24 @@ public class RecursiveLockImpl01Unfairish implements RecursiveLock {
}
return false;
}
-
+
if(TRACE_LOCK) {
System.err.println("+++ LOCK X1 "+toString()+", cur "+threadName(cur)+", left "+timeout+" ms");
}
} else if(TRACE_LOCK) {
System.err.println("+++ LOCK X0 "+toString()+", cur "+threadName(cur));
}
-
+
sync.setOwner(cur);
sync.incrHoldCount(cur);
-
+
if(DEBUG) {
sync.setLockedStack(new Throwable("Previously locked by "+toString()));
}
return true;
}
}
-
+
@Override
public final void unlock() {
@@ -274,16 +274,16 @@ public class RecursiveLockImpl01Unfairish implements RecursiveLock {
synchronized(sync) {
validateLocked();
final Thread cur = Thread.currentThread();
-
+
sync.decrHoldCount(cur);
-
+
if (sync.getHoldCount() > 0) {
if(TRACE_LOCK) {
System.err.println("--- LOCK XR "+toString()+", cur "+threadName(cur));
}
return;
}
-
+
sync.setOwner(null);
if(DEBUG) {
sync.setLockedStack(null);
@@ -291,27 +291,27 @@ public class RecursiveLockImpl01Unfairish implements RecursiveLock {
if(null!=taskAfterUnlockBeforeNotify) {
taskAfterUnlockBeforeNotify.run();
}
-
+
if(TRACE_LOCK) {
System.err.println("--- LOCK X0 "+toString()+", cur "+threadName(cur)+", signal any");
}
sync.notify();
}
}
-
+
@Override
public final int getQueueLength() {
synchronized(sync) {
return sync.getQSz();
}
}
-
+
@Override
public String toString() {
return syncName()+"[count "+sync.getHoldCount()+
", qsz "+sync.getQSz()+", owner "+threadName(sync.getOwner())+"]";
}
-
+
/* package */ final String syncName() {
return "<"+Integer.toHexString(this.hashCode())+", "+Integer.toHexString(sync.hashCode())+">";
}
diff --git a/src/java/jogamp/common/util/locks/RecursiveLockImplJava5.java b/src/java/jogamp/common/util/locks/RecursiveLockImplJava5.java
index d9bc3df..f3dfa42 100644
--- a/src/java/jogamp/common/util/locks/RecursiveLockImplJava5.java
+++ b/src/java/jogamp/common/util/locks/RecursiveLockImplJava5.java
@@ -9,11 +9,11 @@ public class RecursiveLockImplJava5 implements RecursiveLock {
volatile Thread owner = null;
ReentrantLock lock;
-
+
public RecursiveLockImplJava5(boolean fair) {
lock = new ReentrantLock(fair);
}
-
+
@Override
public void lock() {
try {
@@ -49,7 +49,7 @@ public class RecursiveLockImplJava5 implements RecursiveLock {
}
lock.unlock();
}
-
+
@Override
public boolean isLocked() {
return lock.isLocked();
diff --git a/src/java/jogamp/common/util/locks/RecursiveThreadGroupLockImpl01Unfairish.java b/src/java/jogamp/common/util/locks/RecursiveThreadGroupLockImpl01Unfairish.java
index 6c43580..7a386d6 100644
--- a/src/java/jogamp/common/util/locks/RecursiveThreadGroupLockImpl01Unfairish.java
+++ b/src/java/jogamp/common/util/locks/RecursiveThreadGroupLockImpl01Unfairish.java
@@ -31,12 +31,12 @@ import java.util.Arrays;
import com.jogamp.common.util.locks.RecursiveThreadGroupLock;
-public class RecursiveThreadGroupLockImpl01Unfairish
- extends RecursiveLockImpl01Unfairish
- implements RecursiveThreadGroupLock
+public class RecursiveThreadGroupLockImpl01Unfairish
+ extends RecursiveLockImpl01Unfairish
+ implements RecursiveThreadGroupLock
{
/* package */ @SuppressWarnings("serial")
- static class ThreadGroupSync extends SingleThreadSync {
+ static class ThreadGroupSync extends SingleThreadSync {
/* package */ ThreadGroupSync() {
super();
threadNum = 0;
@@ -44,23 +44,23 @@ public class RecursiveThreadGroupLockImpl01Unfairish
holdCountAdditionOwner = 0;
}
@Override
- public final void incrHoldCount(Thread t) {
- super.incrHoldCount(t);
- if(!isOriginalOwner(t)) {
- holdCountAdditionOwner++;
- }
+ public final void incrHoldCount(Thread t) {
+ super.incrHoldCount(t);
+ if(!isOriginalOwner(t)) {
+ holdCountAdditionOwner++;
+ }
}
@Override
- public final void decrHoldCount(Thread t) {
- super.decrHoldCount(t);
- if(!isOriginalOwner(t)) {
- holdCountAdditionOwner--;
- }
+ public final void decrHoldCount(Thread t) {
+ super.decrHoldCount(t);
+ if(!isOriginalOwner(t)) {
+ holdCountAdditionOwner--;
+ }
}
public final int getAdditionalOwnerHoldCount() {
return holdCountAdditionOwner;
}
-
+
public final boolean isOriginalOwner(Thread t) {
return super.isOwner(t);
}
@@ -76,11 +76,11 @@ public class RecursiveThreadGroupLockImpl01Unfairish
}
return false;
}
-
+
public final int getAddOwnerCount() {
return threadNum;
}
- public final void addOwner(Thread t) throws IllegalArgumentException {
+ public final void addOwner(Thread t) throws IllegalArgumentException {
if(null == threads) {
if(threadNum>0) {
throw new InternalError("XXX");
@@ -98,15 +98,15 @@ public class RecursiveThreadGroupLockImpl01Unfairish
threads[threadNum] = t;
threadNum++;
}
-
+
public final void removeAllOwners() {
for(int i=threadNum-1; 0<=i; i--) {
threads[i]=null;
}
- threadNum=0;
+ threadNum=0;
}
-
- public final void removeOwner(Thread t) throws IllegalArgumentException {
+
+ public final void removeOwner(Thread t) throws IllegalArgumentException {
for (int i = 0 ; i < threadNum ; i++) {
if (threads[i] == t) {
threadNum--;
@@ -117,7 +117,7 @@ public class RecursiveThreadGroupLockImpl01Unfairish
}
throw new IllegalArgumentException("Not an owner: "+t);
}
-
+
String addOwnerToString() {
StringBuilder sb = new StringBuilder();
for(int i=0; i<threadNum; i++) {
@@ -126,19 +126,19 @@ public class RecursiveThreadGroupLockImpl01Unfairish
}
sb.append(threads[i].getName());
}
- return sb.toString();
+ return sb.toString();
}
-
+
// lock count by addition owner threads
- private int holdCountAdditionOwner;
+ private int holdCountAdditionOwner;
private Thread[] threads;
private int threadNum;
}
-
+
public RecursiveThreadGroupLockImpl01Unfairish() {
super(new ThreadGroupSync());
}
-
+
@Override
public final boolean isOriginalOwner() {
return isOriginalOwner(Thread.currentThread());
@@ -164,13 +164,13 @@ public class RecursiveThreadGroupLockImpl01Unfairish
}
tgSync.addOwner(t);
}
-
+
@Override
public final void unlock(Runnable taskAfterUnlockBeforeNotify) {
synchronized(sync) {
final Thread cur = Thread.currentThread();
final ThreadGroupSync tgSync = (ThreadGroupSync)sync;
-
+
if( tgSync.getAddOwnerCount()>0 ) {
if(TRACE_LOCK) {
System.err.println("--- LOCK XR (tg) "+toString()+", cur "+threadName(cur)+" -> owner...");
@@ -193,23 +193,23 @@ public class RecursiveThreadGroupLockImpl01Unfairish
final Thread originalOwner = tgSync.getOwner();
if(originalOwner.getState() == Thread.State.WAITING) {
originalOwner.interrupt();
- }
+ }
}
}
if(TRACE_LOCK) {
System.err.println("++ unlock(X): currentThread "+cur.getName()+", lock: "+this.toString());
System.err.println("--- LOCK X0 (tg) "+toString()+", cur "+threadName(cur)+" -> unlock!");
}
- super.unlock(taskAfterUnlockBeforeNotify);
+ super.unlock(taskAfterUnlockBeforeNotify);
}
}
-
+
@Override
public final void removeOwner(Thread t) throws RuntimeException, IllegalArgumentException {
validateLocked();
((ThreadGroupSync)sync).removeOwner(t);
}
-
+
@Override
public String toString() {
final ThreadGroupSync tgSync = (ThreadGroupSync)sync;
diff --git a/src/java/jogamp/common/util/locks/SingletonInstanceFileLock.java b/src/java/jogamp/common/util/locks/SingletonInstanceFileLock.java
index 42d125a..a3d3ac9 100644
--- a/src/java/jogamp/common/util/locks/SingletonInstanceFileLock.java
+++ b/src/java/jogamp/common/util/locks/SingletonInstanceFileLock.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package jogamp.common.util.locks;
import java.io.File;
@@ -73,7 +73,7 @@ public class SingletonInstanceFileLock extends SingletonInstance {
@Override
public final String getName() { return file.getPath(); }
-
+
private void setupFileCleanup() {
file.deleteOnExit();
Runtime.getRuntime().addShutdownHook(new Thread() {
@@ -84,7 +84,7 @@ public class SingletonInstanceFileLock extends SingletonInstance {
}
unlock();
}
- });
+ });
}
@Override
diff --git a/src/java/jogamp/common/util/locks/SingletonInstanceServerSocket.java b/src/java/jogamp/common/util/locks/SingletonInstanceServerSocket.java
index c4f9564..a1ca2ff 100644
--- a/src/java/jogamp/common/util/locks/SingletonInstanceServerSocket.java
+++ b/src/java/jogamp/common/util/locks/SingletonInstanceServerSocket.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package jogamp.common.util.locks;
import java.io.IOException;
@@ -39,11 +39,11 @@ public class SingletonInstanceServerSocket extends SingletonInstance {
private final Server singletonServer;
private final String fullName;
-
+
public SingletonInstanceServerSocket(long poll_ms, int portNumber) {
super(poll_ms);
-
- // Gather the local InetAddress, loopback is prioritized
+
+ // Gather the local InetAddress, loopback is prioritized
InetAddress ilh = null;
try {
ilh = InetAddress.getByName(null); // loopback
@@ -56,10 +56,10 @@ public class SingletonInstanceServerSocket extends SingletonInstance {
}
if(null == ilh) {
try {
- ilh = InetAddress.getByAddress(new byte[] { 127, 0, 0, 1 } );
+ ilh = InetAddress.getByAddress(new byte[] { 127, 0, 0, 1 } );
if(null!=ilh && !ilh.isLoopbackAddress()) { ilh = null; }
} catch (UnknownHostException e) { }
- }
+ }
if(null == ilh) {
try {
ilh = InetAddress.getLocalHost();
@@ -68,15 +68,15 @@ public class SingletonInstanceServerSocket extends SingletonInstance {
if(null == ilh) {
throw new RuntimeException(infoPrefix()+" EEE Could not determine local InetAddress");
}
-
+
fullName = ilh.toString()+":"+portNumber;
- singletonServer = new Server(ilh, portNumber);
+ singletonServer = new Server(ilh, portNumber);
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
singletonServer.kill();
}
- });
+ });
}
public final InetAddress getLocalInetAddress() {
@@ -89,13 +89,13 @@ public class SingletonInstanceServerSocket extends SingletonInstance {
@Override
public final String getName() { return fullName; }
-
+
@Override
protected boolean tryLockImpl() {
if( singletonServer.isRunning() ) {
return false; // same JVM .. server socket already installed !
}
-
+
// check if other JVM's locked the server socket ..
Socket clientSocket = singletonServer.connect();
if(null != clientSocket) {
@@ -104,11 +104,11 @@ public class SingletonInstanceServerSocket extends SingletonInstance {
} catch (IOException e) { }
return false;
}
-
+
if( !singletonServer.start() ) {
return false;
}
-
+
return true;
}
@@ -119,26 +119,26 @@ public class SingletonInstanceServerSocket extends SingletonInstance {
public class Server implements Runnable {
private final InetAddress localInetAddress;
- private final int portNumber;
-
- private volatile boolean shallQuit = false;
+ private final int portNumber;
+
+ private volatile boolean shallQuit = false;
private volatile boolean alive = false;
-
+
private Object syncOnStartStop = new Object();
private ServerSocket serverSocket = null;
private Thread serverThread = null; // allowing kill() to force-stop last server-thread
-
+
public Server(InetAddress localInetAddress, int portNumber) {
this.localInetAddress = localInetAddress;
this.portNumber = portNumber;
}
-
+
public final InetAddress getLocalInetAddress() { return localInetAddress; }
public final int getPortNumber() { return portNumber; }
-
+
public final boolean start() {
if(alive) return true;
-
+
synchronized (syncOnStartStop) {
serverThread = new Thread(this);
serverThread.setDaemon(true); // be a daemon, don't keep the JVM running
@@ -147,7 +147,7 @@ public class SingletonInstanceServerSocket extends SingletonInstance {
syncOnStartStop.wait();
} catch (InterruptedException ie) {
ie.printStackTrace();
- }
+ }
}
boolean ok = isBound();
if(!ok) {
@@ -155,10 +155,10 @@ public class SingletonInstanceServerSocket extends SingletonInstance {
}
return ok;
}
-
+
public final boolean shutdown() {
if(!alive) return true;
-
+
synchronized (syncOnStartStop) {
shallQuit = true;
connect();
@@ -166,7 +166,7 @@ public class SingletonInstanceServerSocket extends SingletonInstance {
syncOnStartStop.wait();
} catch (InterruptedException ie) {
ie.printStackTrace();
- }
+ }
}
if(alive) {
System.err.println(infoPrefix()+" EEE "+getName()+" - Unable to remove lock: ServerThread still alive ?");
@@ -175,7 +175,7 @@ public class SingletonInstanceServerSocket extends SingletonInstance {
return true;
}
- /**
+ /**
* Brutally kill server thread and close socket regardless.
* This is out last chance for JVM shutdown.
*/
@@ -196,11 +196,11 @@ public class SingletonInstanceServerSocket extends SingletonInstance {
serverSocket = null;
ss.close();
} catch (Throwable t) { }
- }
+ }
}
-
+
public final boolean isRunning() { return alive; }
-
+
public final boolean isBound() {
return alive && null != serverSocket && serverSocket.isBound() ;
}
@@ -211,14 +211,14 @@ public class SingletonInstanceServerSocket extends SingletonInstance {
} catch (Exception e) { }
return null;
}
-
+
@Override
public void run() {
{
final Thread currentThread = Thread.currentThread();
currentThread.setName(currentThread.getName() + " - SISock: "+getName());
if(DEBUG) {
- System.err.println(currentThread.getName()+" - started");
+ System.err.println(currentThread.getName()+" - started");
}
}
alive = false;
@@ -231,10 +231,10 @@ public class SingletonInstanceServerSocket extends SingletonInstance {
System.err.println(infoPrefix()+" III - Unable to install ServerSocket: "+e.getMessage());
shallQuit = true;
} finally {
- syncOnStartStop.notifyAll();
+ syncOnStartStop.notifyAll();
}
}
-
+
while (!shallQuit) {
try {
final Socket clientSocket = serverSocket.accept();
@@ -243,7 +243,7 @@ public class SingletonInstanceServerSocket extends SingletonInstance {
System.err.println(infoPrefix()+" EEE - Exception during accept: " + ioe.getMessage());
}
}
-
+
synchronized (syncOnStartStop) {
try {
if(null != serverSocket) {