+ Note-1: The GlueGen source must be fetched using -recurse-submodules,
+ which imports JCPP, now used as the default C preprocessor.
+
+
+
+
Unset your CLASSPATH environment variable:
+ The Ant build requires that the JOGL jars not be visible on the classpath. On Unix, type
+ unsetenv CLASSPATH into a csh or tcsh shell, or unset CLASSPATH
+ into a Bourne shell. On Windows, type set CLASSPATH= into a command prompt.
+
+
+
OptionalCopy and edit gluegen.properties:
+ To specify different basic options for components and compilers,
+ copy gluegen/make/gluegen.properties into your home directory (pointed to by the Java system property user.home).
+
+
Build the source tree:
+ Open a command shell in the "gluegen/make" directory of the source tree and type "ant".
+
+
+
Test your build: Stay in your command shell in the "gluegen/make" directory of the source tree and type "ant junit.run".
+
+
Build Javadoc: Stay in your command shell in the "gluegen/make" directory of the source tree and type "ant javadoc".
+ This will produce the end-user documentation for JOGL along with some auxiliary utility packages.
+
+
+
+ Note that there might be a few warnings produced by ANTLR about the
+ C grammar and our modifications to some of the signatures of the
+ productions; the C grammar warnings have been documented by the
+ author of the grammar as having been investigated completely and
+ harmless, and the warnings about our modifications are also
+ harmless.
+
+
Common build problems
+
+
+
+
+ Your CLASSPATH environment variable appears to be set (some GlueGen classes are currently visible to the build.), and $CLASSPATH isn't set.
+ An older version of GlueGen was installed into the extension directory of the JDK you're using to build the
+ current GlueGen. On Windows and Linux, delete any ANTLR jars from jre/lib/ext, and on Mac OS X, delete them from
+ /Library/Java/Extensions. It is generally not a good idea to drop GlueGen directly into the extensions directory,
+ as this can interfere with upgrades via Java Web Start.
+
+
+
+ CharScanner; panic: ClassNotFoundException: com.sun.gluegen.cgram.CToken
+
+ This occurs because ANTLR was dropped into the Extensions
+ directory of the JRE/JDK. On Windows and Linux, delete any ANTLR jars from jre/lib/ext,
+ and on Mac OS X, delete them from /Library/Java/Extensions. Use the antlr.jar property in the build.xml
+ to point to a JRE-external location of this jar file.
+
+
+
+
+
+
+ - Christopher Kline and Kenneth Russell, June 2003 (revised November 2006)
+ - Sven Gothel and Michael Bien, May 2010
+ - Sven Gothel, March 2010 (Extracted version from JOGL)
+
+
+
+
+
+
+
+
diff -Nru gluegen2-2.2.4/doc/Implementation/IOUtil.testDirExe/linux-noexec-file_attribs.log gluegen2-2.3.2/doc/Implementation/IOUtil.testDirExe/linux-noexec-file_attribs.log
--- gluegen2-2.2.4/doc/Implementation/IOUtil.testDirExe/linux-noexec-file_attribs.log 1970-01-01 00:00:00.000000000 +0000
+++ gluegen2-2.3.2/doc/Implementation/IOUtil.testDirExe/linux-noexec-file_attribs.log 2015-10-09 04:18:28.000000000 +0000
@@ -0,0 +1,119 @@
+LD_LIBRARY_PATH ../build-x86_64/test/build/natives:
+USE_CLASSPATH lib/junit.jar:/opt-share/apache-ant/lib/ant.jar:/opt-share/apache-ant/lib/ant-junit.jar:/opt-share/apache-ant/lib/ant-launcher.jar:lib/semantic-versioning/semver.jar:../build-x86_64/../make/lib/TestJarsInJar.jar:../build-x86_64/gluegen-rt.jar:../build-x86_64/gluegen.jar:../build-x86_64/gluegen-test-util.jar:../build-x86_64/test/build/gluegen-test.jar:../build-x86_64/gluegen-rt-natives.jar
+/opt-linux-x86_64/jre8/bin/java
+java -cp lib/junit.jar:/opt-share/apache-ant/lib/ant.jar:/opt-share/apache-ant/lib/ant-junit.jar:/opt-share/apache-ant/lib/ant-launcher.jar:lib/semantic-versioning/semver.jar:../build-x86_64/../make/lib/TestJarsInJar.jar:../build-x86_64/gluegen-rt.jar:../build-x86_64/gluegen.jar:../build-x86_64/gluegen-test-util.jar:../build-x86_64/test/build/gluegen-test.jar:../build-x86_64/gluegen-rt-natives.jar -Drootrel.build=build-x86_64 -Dgluegen.root=.. -Djogamp.debug.IOUtil -Djogamp.debug.IOUtil.Exe -Djogamp.debug.IOUtil.Exe.NoStream com.jogamp.common.util.TestPlatform01
+JUnit version 4.11
+++++ Test Singleton.ctor()
+++++ Test Singleton.lock()
+SLOCK [T SingletonServerSocket1-localhost/127.0.0.1:59999 @ 1442811548011 ms III - Start
+SLOCK [T main @ 1442811548012 ms +++ localhost/127.0.0.1:59999 - Locked within 5 ms, 1 attempts
+.++++ TestCase.setUp: com.jogamp.common.util.TestPlatform01 - testInfo00
+
+IOUtil.getTempRoot(): tempX1 , used true
+IOUtil.getTempRoot(): tempX3 , used false
+IOUtil.getTempRoot(): tempX4 , used true
+IOUtil.getTempRoot(): tempX2 , used true
+IOUtil.testDirExec: : Caught IOException: Cannot run program "/tmp/jogamp_exe_tst.sh": error=13, Permission denied
+java.io.IOException: Cannot run program "/tmp/jogamp_exe_tst.sh": error=13, Permission denied
+ at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
+ at java.lang.Runtime.exec(Runtime.java:620)
+ at com.jogamp.common.util.IOUtil.testDirExec(IOUtil.java:948)
+ at com.jogamp.common.util.IOUtil.testDirImpl(IOUtil.java:986)
+ at com.jogamp.common.util.IOUtil.getSubTempDir(IOUtil.java:1046)
+ at com.jogamp.common.util.IOUtil.getTempDir(IOUtil.java:1161)
+ at com.jogamp.common.util.cache.TempFileCache.(TempFileCache.java:81)
+ at com.jogamp.common.util.cache.TempJarCache.initSingleton(TempJarCache.java:88)
+ at com.jogamp.common.os.Platform$1.run(Platform.java:309)
+ at java.security.AccessController.doPrivileged(Native Method)
+ at com.jogamp.common.os.Platform.(Platform.java:287)
+ at com.jogamp.common.util.TestPlatform01.testInfo00(TestPlatform01.java:47)
+ at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
+ at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
+ at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
+ at java.lang.reflect.Method.invoke(Method.java:497)
+ at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
+ at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
+ at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
+ at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
+ at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
+ at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
+ at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
+ at org.junit.rules.RunRules.evaluate(RunRules.java:20)
+ at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
+ at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
+ at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
+ at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
+ at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
+ at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
+ at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
+ at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
+ at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
+ at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
+ at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
+ at org.junit.runners.Suite.runChild(Suite.java:127)
+ at org.junit.runners.Suite.runChild(Suite.java:26)
+ at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
+ at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
+ at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
+ at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
+ at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
+ at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
+ at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
+ at org.junit.runner.JUnitCore.run(JUnitCore.java:138)
+ at org.junit.runner.JUnitCore.run(JUnitCore.java:117)
+ at org.junit.runner.JUnitCore.runMain(JUnitCore.java:96)
+ at org.junit.runner.JUnitCore.runMainAndExit(JUnitCore.java:47)
+ at org.junit.runner.JUnitCore.main(JUnitCore.java:40)
+ at com.jogamp.common.util.TestPlatform01.main(TestPlatform01.java:93)
+Caused by: java.io.IOException: error=13, Permission denied
+ at java.lang.UNIXProcess.forkAndExec(Native Method)
+ at java.lang.UNIXProcess.(UNIXProcess.java:248)
+ at java.lang.ProcessImpl.start(ProcessImpl.java:134)
+ at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
+ ... 49 more
+IOUtil.testDirExec(): test-exe , existingFile true, returned -1
+IOUtil.testDirExec(): abs-path : res -2 -> false
+IOUtil.testDirExec(): total 72ms, create 0ms, execute 72ms
+IOUtil.testDirImpl(tempX1): , create true, exec true: false
+IOUtil.testDirExec(): test-exe , existingFile false, returned 0
+IOUtil.testDirExec(): abs-path : res 0 -> true
+IOUtil.testDirExec(): total 17ms, create 13ms, execute 4ms
+IOUtil.testDirImpl(tempX2): , create true, exec true: true
+IOUtil.testDirExec(): test-exe , existingFile false, returned 0
+IOUtil.testDirExec(): abs-path : res 0 -> true
+IOUtil.testDirExec(): total 2ms, create 0ms, execute 2ms
+IOUtil.testDirImpl(tempX2): , create true, exec true: true
+IOUtil.getTempRoot(): temp dirs: exec: /home/sven/.cache/jogamp_0000, noexec: /home/sven/.cache/jogamp_0000
+IOUtil.testDirImpl(testDir): , create true, exec false: true
+
+OS name/type: Linux, LINUX
+OS version: 4.1.6-x64-k10-nlb-jau01, 4.1.6
+
+Arch, CPU: amd64, X86_64/X86
+OS/Arch: linux-amd64
+
+Java runtime: Java(TM) SE Runtime Environment
+Java vendor[name/url]: Oracle Corporation/http://java.oracle.com/
+Java version, vm: 1.8.0_60, Java HotSpot(TM) 64-Bit Server VM
+
+MD: MachineDataInfo: runtimeValidated true, 32Bit false, primitive size / alignment:
+ int8 1 / 1, int16 2 / 2
+ int 4 / 4, long 8 / 8
+ int32 4 / 4, int64 8 / 8
+ float 4 / 4, double 8 / 8, ldouble 16 / 16
+ pointer 8 / 8, page 4096
+
+
+++++ TestCase.tearDown: com.jogamp.common.util.TestPlatform01 - testInfo00
+.++++ TestCase.setUp: com.jogamp.common.util.TestPlatform01 - testPageSize01
+PageSize: 4096
+++++ TestCase.tearDown: com.jogamp.common.util.TestPlatform01 - testPageSize01
+++++ Test Singleton.unlock()
+SLOCK [T SingletonServerSocket1-localhost/127.0.0.1:59999 @ 1442811548171 ms III - Stopping: alive true, shallQuit true, hasSocket true
+SLOCK [T main @ 1442811548171 ms --- localhost/127.0.0.1:59999 - Unlock ok within 1 ms
+
+Time: 0.693
+
+OK (2 tests)
+
+
diff -Nru gluegen2-2.2.4/doc/Implementation/IOUtil.testDirExe/win32-noexec-invalid_executable.log gluegen2-2.3.2/doc/Implementation/IOUtil.testDirExe/win32-noexec-invalid_executable.log
--- gluegen2-2.2.4/doc/Implementation/IOUtil.testDirExe/win32-noexec-invalid_executable.log 1970-01-01 00:00:00.000000000 +0000
+++ gluegen2-2.3.2/doc/Implementation/IOUtil.testDirExe/win32-noexec-invalid_executable.log 2015-10-09 04:18:28.000000000 +0000
@@ -0,0 +1,118 @@
+JUnit version 4.11
+++++ Test Singleton.ctor()
+++++ Test Singleton.lock()
+SLOCK [T SingletonServerSocket1-localhost/127.0.0.1:59999 @ 1442717359736 ms III - Start
+SLOCK [T main @ 1442717359736 ms +++ localhost/127.0.0.1:59999 - Locked within 1047 ms, 1 attempts
+.++++ TestCase.setUp: com.jogamp.common.util.TestPlatform01 - testInfo00
+
+IOUtil.getTempRoot(): tempX1 , used true
+IOUtil.getTempRoot(): tempX3 , used false
+IOUtil.getTempRoot(): tempX4 , used true
+IOUtil.getTempRoot(): tempX2 , used false
+IOUtil.testDirExec: : Caught IOException: Cannot run program "C:\cygwin\tmp\jogamp_exe_tst.exe": CreateProcess error=216, This version of %1 is not compatible with the version of Windows you're running. Check your computer's system information to see whether you need a x86 (32-bit) or x64 (64-bit) version of the program, and then contact the software publisher
+java.io.IOException: Cannot run program "C:\cygwin\tmp\jogamp_exe_tst.exe": CreateProcess error=216, This version of %1 is not compatible with the version of Windows you're running. Check your computer's system information to see whether you need a x86 (32-bit) or x64 (64-bit) version of the program, and then contact the software publisher
+ at java.lang.ProcessBuilder.start(Unknown Source)
+ at java.lang.Runtime.exec(Unknown Source)
+ at com.jogamp.common.util.IOUtil.testDirExec(IOUtil.java:948)
+ at com.jogamp.common.util.IOUtil.testDirImpl(IOUtil.java:990)
+ at com.jogamp.common.util.IOUtil.getSubTempDir(IOUtil.java:1050)
+ at com.jogamp.common.util.IOUtil.getTempDir(IOUtil.java:1165)
+ at com.jogamp.common.util.cache.TempFileCache.(TempFileCache.java:81)
+ at com.jogamp.common.util.cache.TempJarCache.initSingleton(TempJarCache.java:88)
+ at com.jogamp.common.os.Platform$1.run(Platform.java:309)
+ at java.security.AccessController.doPrivileged(Native Method)
+ at com.jogamp.common.os.Platform.(Platform.java:287)
+ at com.jogamp.common.util.TestPlatform01.testInfo00(TestPlatform01.java:47)
+ at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
+ at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
+ at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
+ at java.lang.reflect.Method.invoke(Unknown Source)
+ at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
+ at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
+ at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
+ at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
+ at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
+ at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
+ at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
+ at org.junit.rules.RunRules.evaluate(RunRules.java:20)
+ at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
+ at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
+ at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
+ at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
+ at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
+ at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
+ at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
+ at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
+ at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
+ at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
+ at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
+ at org.junit.runners.Suite.runChild(Suite.java:127)
+ at org.junit.runners.Suite.runChild(Suite.java:26)
+ at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
+ at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
+ at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
+ at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
+ at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
+ at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
+ at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
+ at org.junit.runner.JUnitCore.run(JUnitCore.java:138)
+ at org.junit.runner.JUnitCore.run(JUnitCore.java:117)
+ at org.junit.runner.JUnitCore.runMain(JUnitCore.java:96)
+ at org.junit.runner.JUnitCore.runMainAndExit(JUnitCore.java:47)
+ at org.junit.runner.JUnitCore.main(JUnitCore.java:40)
+ at com.jogamp.common.util.TestPlatform01.main(TestPlatform01.java:93)
+Caused by: java.io.IOException: CreateProcess error=216, This version of %1 is not compatible with the version of Windows you're running. Check your computer's system information to see whether you need a x86 (32-bit) or x64 (64-bit) version of the program, and then contact the software publisher
+ at java.lang.ProcessImpl.create(Native Method)
+ at java.lang.ProcessImpl.(Unknown Source)
+ at java.lang.ProcessImpl.start(Unknown Source)
+ ... 50 more
+IOUtil.testDirExec(): test-exe , existingFile true
+IOUtil.testDirExec(): abs-path : res -2 -> false
+IOUtil.testDirExec(): total 63ms, create 0ms, execute 63ms
+IOUtil.testDirImpl(tempX1): , create true, exec true: false
+IOUtil: locating , has cl: true
+AssetURLContext.resolve:
+ERR(0): no protocol: com/jogamp/common/util/bin/exe-windows-i386-2048b.bin.316b.gz
+AssetURLContext.resolve: type 2: url , conn , connURL
+IOUtil: found within class package of given class : true
+IOUtil.testDirExec(): test-exe , existingFile false
+IOUtil.testDirExec(): abs-path : res 0 -> true
+IOUtil.testDirExec(): total 578ms, create 94ms, execute 484ms
+IOUtil.testDirImpl(tempX4): , create true, exec true: true
+IOUtil.testDirExec(): test-exe , existingFile false
+IOUtil.testDirExec(): abs-path : res 0 -> true
+IOUtil.testDirExec(): total 16ms, create 0ms, execute 16ms
+IOUtil.testDirImpl(tempX4): , create true, exec true: true
+IOUtil.getTempRoot(): temp dirs: exec: C:\Users\sven\.jogamp_0000, noexec: C:\Users\sven\.jogamp_0000
+IOUtil.testDirImpl(testDir): , create true, exec false: true
+
+OS name/type: Windows 7, WINDOWS
+OS version: 6.1, 6.1.0
+
+Arch, CPU: amd64, X86_64/X86
+OS/Arch: windows-amd64
+
+Java runtime: Java(TM) SE Runtime Environment
+Java vendor[name/url]: Oracle Corporation/http://java.oracle.com/
+Java version, vm: 1.8.0_60, Java HotSpot(TM) 64-Bit Server VM
+
+MD: MachineDataInfo: runtimeValidated true, 32Bit false, primitive size / alignment:
+ int8 1 / 1, int16 2 / 2
+ int 4 / 4, long 4 / 4
+ int32 4 / 4, int64 8 / 8
+ float 4 / 4, double 8 / 8, ldouble 16 / 16
+ pointer 8 / 8, page 4096
+
+
+++++ TestCase.tearDown: com.jogamp.common.util.TestPlatform01 - testInfo00
+.++++ TestCase.setUp: com.jogamp.common.util.TestPlatform01 - testPageSize01
+PageSize: 4096
+++++ TestCase.tearDown: com.jogamp.common.util.TestPlatform01 - testPageSize01
+++++ Test Singleton.unlock()
+SLOCK [T SingletonServerSocket1-localhost/127.0.0.1:59999 @ 1442717360611 ms III - Stopping: alive true, shallQuit true, hasSocket true
+SLOCK [T main @ 1442717360611 ms --- localhost/127.0.0.1:59999 - Unlock ok within 0 ms
+
+Time: 2.437
+
+OK (2 tests)
+
diff -Nru gluegen2-2.2.4/doc/Implementation/IOUtil.testDirExe/win32-noexec-ntfs_attribs_deny_execute_file.log gluegen2-2.3.2/doc/Implementation/IOUtil.testDirExe/win32-noexec-ntfs_attribs_deny_execute_file.log
--- gluegen2-2.2.4/doc/Implementation/IOUtil.testDirExe/win32-noexec-ntfs_attribs_deny_execute_file.log 1970-01-01 00:00:00.000000000 +0000
+++ gluegen2-2.3.2/doc/Implementation/IOUtil.testDirExe/win32-noexec-ntfs_attribs_deny_execute_file.log 2015-10-09 04:18:28.000000000 +0000
@@ -0,0 +1,118 @@
+JUnit version 4.11
+++++ Test Singleton.ctor()
+++++ Test Singleton.lock()
+SLOCK [T SingletonServerSocket1-localhost/127.0.0.1:59999 @ 1442716830836 ms III - Start
+SLOCK [T main @ 1442716830836 ms +++ localhost/127.0.0.1:59999 - Locked within 1032 ms, 1 attempts
+.++++ TestCase.setUp: com.jogamp.common.util.TestPlatform01 - testInfo00
+
+IOUtil.getTempRoot(): tempX1 , used true
+IOUtil.getTempRoot(): tempX3 , used false
+IOUtil.getTempRoot(): tempX4 , used true
+IOUtil.getTempRoot(): tempX2 , used false
+IOUtil: locating , has cl: true
+AssetURLContext.resolve:
+ERR(0): no protocol: com/jogamp/common/util/bin/exe-windows-i386-2048b.bin.316b.gz
+AssetURLContext.resolve: type 2: url , conn , connURL
+IOUtil: found within class package of given class : true
+IOUtil.testDirExec: : Caught IOException: Cannot run program "C:\cygwin\tmp\jogamp_exe_tst.exe": CreateProcess error=5, Access is denied
+java.io.IOException: Cannot run program "C:\cygwin\tmp\jogamp_exe_tst.exe": CreateProcess error=5, Access is denied
+ at java.lang.ProcessBuilder.start(Unknown Source)
+ at java.lang.Runtime.exec(Unknown Source)
+ at com.jogamp.common.util.IOUtil.testDirExec(IOUtil.java:943)
+ at com.jogamp.common.util.IOUtil.testDirImpl(IOUtil.java:985)
+ at com.jogamp.common.util.IOUtil.getSubTempDir(IOUtil.java:1045)
+ at com.jogamp.common.util.IOUtil.getTempDir(IOUtil.java:1160)
+ at com.jogamp.common.util.cache.TempFileCache.(TempFileCache.java:81)
+ at com.jogamp.common.util.cache.TempJarCache.initSingleton(TempJarCache.java:88)
+ at com.jogamp.common.os.Platform$1.run(Platform.java:309)
+ at java.security.AccessController.doPrivileged(Native Method)
+ at com.jogamp.common.os.Platform.(Platform.java:287)
+ at com.jogamp.common.util.TestPlatform01.testInfo00(TestPlatform01.java:47)
+ at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
+ at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
+ at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
+ at java.lang.reflect.Method.invoke(Unknown Source)
+ at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
+ at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
+ at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
+ at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
+ at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
+ at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
+ at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
+ at org.junit.rules.RunRules.evaluate(RunRules.java:20)
+ at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
+ at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
+ at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
+ at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
+ at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
+ at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
+ at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
+ at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
+ at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
+ at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
+ at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
+ at org.junit.runners.Suite.runChild(Suite.java:127)
+ at org.junit.runners.Suite.runChild(Suite.java:26)
+ at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
+ at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
+ at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
+ at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
+ at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
+ at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
+ at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
+ at org.junit.runner.JUnitCore.run(JUnitCore.java:138)
+ at org.junit.runner.JUnitCore.run(JUnitCore.java:117)
+ at org.junit.runner.JUnitCore.runMain(JUnitCore.java:96)
+ at org.junit.runner.JUnitCore.runMainAndExit(JUnitCore.java:47)
+ at org.junit.runner.JUnitCore.main(JUnitCore.java:40)
+ at com.jogamp.common.util.TestPlatform01.main(TestPlatform01.java:93)
+Caused by: java.io.IOException: CreateProcess error=5, Access is denied
+ at java.lang.ProcessImpl.create(Native Method)
+ at java.lang.ProcessImpl.(Unknown Source)
+ at java.lang.ProcessImpl.start(Unknown Source)
+ ... 50 more
+IOUtil.testDirExec(): test-exe
+IOUtil.testDirExec(): abs-path : res -2 -> false
+IOUtil.testDirExec(): total 125ms, create 0ms, execute 125ms
+IOUtil.testDirImpl(tempX1): , create true, exec true: false
+IOUtil.testDirExec(): test-exe
+IOUtil.testDirExec(): abs-path : res 0 -> true
+IOUtil.testDirExec(): total 156ms, create 78ms, execute 78ms
+IOUtil.testDirImpl(tempX4): , create true, exec true: true
+IOUtil.testDirExec(): test-exe
+IOUtil.testDirExec(): abs-path : res 0 -> true
+IOUtil.testDirExec(): total 47ms, create 0ms, execute 47ms
+IOUtil.testDirImpl(tempX4): , create true, exec true: true
+IOUtil.getTempRoot(): temp dirs: exec: C:\Users\sven\.jogamp_0000, noexec: C:\Users\sven\.jogamp_0000
+IOUtil.testDirImpl(testDir): , create true, exec false: true
+
+OS name/type: Windows 7, WINDOWS
+OS version: 6.1, 6.1.0
+
+Arch, CPU: amd64, X86_64/X86
+OS/Arch: windows-amd64
+
+Java runtime: Java(TM) SE Runtime Environment
+Java vendor[name/url]: Oracle Corporation/http://java.oracle.com/
+Java version, vm: 1.8.0_60, Java HotSpot(TM) 64-Bit Server VM
+
+MD: MachineDataInfo: runtimeValidated true, 32Bit false, primitive size / alignment:
+ int8 1 / 1, int16 2 / 2
+ int 4 / 4, long 4 / 4
+ int32 4 / 4, int64 8 / 8
+ float 4 / 4, double 8 / 8, ldouble 16 / 16
+ pointer 8 / 8, page 4096
+
+
+++++ TestCase.tearDown: com.jogamp.common.util.TestPlatform01 - testInfo00
+.++++ TestCase.setUp: com.jogamp.common.util.TestPlatform01 - testPageSize01
+PageSize: 4096
+++++ TestCase.tearDown: com.jogamp.common.util.TestPlatform01 - testPageSize01
+++++ Test Singleton.unlock()
+SLOCK [T SingletonServerSocket1-localhost/127.0.0.1:59999 @ 1442716831367 ms III - Stopping: alive true, shallQuit true, hasSocket true
+SLOCK [T main @ 1442716831367 ms --- localhost/127.0.0.1:59999 - Unlock ok within 0 ms
+
+Time: 2.078
+
+OK (2 tests)
+
diff -Nru gluegen2-2.2.4/doc/Implementation/IOUtil.testDirExe/win32-noexec-SoftwareRestrictionPolicies.log gluegen2-2.3.2/doc/Implementation/IOUtil.testDirExe/win32-noexec-SoftwareRestrictionPolicies.log
--- gluegen2-2.2.4/doc/Implementation/IOUtil.testDirExe/win32-noexec-SoftwareRestrictionPolicies.log 1970-01-01 00:00:00.000000000 +0000
+++ gluegen2-2.3.2/doc/Implementation/IOUtil.testDirExe/win32-noexec-SoftwareRestrictionPolicies.log 2015-10-09 04:18:28.000000000 +0000
@@ -0,0 +1,118 @@
+JUnit version 4.11
+++++ Test Singleton.ctor()
+++++ Test Singleton.lock()
+SLOCK [T SingletonServerSocket1-localhost/127.0.0.1:59999 @ 1442715964261 ms III - Start
+SLOCK [T main @ 1442715964261 ms +++ localhost/127.0.0.1:59999 - Locked within 1032 ms, 1 attempts
+.++++ TestCase.setUp: com.jogamp.common.util.TestPlatform01 - testInfo00
+
+IOUtil.getTempRoot(): tempX1 , used true
+IOUtil.getTempRoot(): tempX3 , used false
+IOUtil.getTempRoot(): tempX4 , used true
+IOUtil.getTempRoot(): tempX2 , used false
+IOUtil: locating , has cl: true
+AssetURLContext.resolve:
+ERR(0): no protocol: com/jogamp/common/util/bin/exe-windows-i386-2048b.bin.316b.gz
+AssetURLContext.resolve: type 2: url , conn , connURL
+IOUtil: found within class package of given class : true
+IOUtil.testDirExec: : Caught IOException: Cannot run program "C:\cygwin\tmp\jogamp_exe_tst2114409495120940481.exe": CreateProcess error=1260, This program is blocked by group policy. For more information, contact your system administrator
+java.io.IOException: Cannot run program "C:\cygwin\tmp\jogamp_exe_tst2114409495120940481.exe": CreateProcess error=1260, This program is blocked by group policy. For more information, contact your system administrator
+ at java.lang.ProcessBuilder.start(Unknown Source)
+ at java.lang.Runtime.exec(Unknown Source)
+ at com.jogamp.common.util.IOUtil.testDirExec(IOUtil.java:938)
+ at com.jogamp.common.util.IOUtil.testDirImpl(IOUtil.java:980)
+ at com.jogamp.common.util.IOUtil.getSubTempDir(IOUtil.java:1040)
+ at com.jogamp.common.util.IOUtil.getTempDir(IOUtil.java:1155)
+ at com.jogamp.common.util.cache.TempFileCache.(TempFileCache.java:81)
+ at com.jogamp.common.util.cache.TempJarCache.initSingleton(TempJarCache.java:88)
+ at com.jogamp.common.os.Platform$1.run(Platform.java:309)
+ at java.security.AccessController.doPrivileged(Native Method)
+ at com.jogamp.common.os.Platform.(Platform.java:287)
+ at com.jogamp.common.util.TestPlatform01.testInfo00(TestPlatform01.java:47)
+ at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
+ at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
+ at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
+ at java.lang.reflect.Method.invoke(Unknown Source)
+ at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
+ at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
+ at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
+ at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
+ at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
+ at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
+ at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
+ at org.junit.rules.RunRules.evaluate(RunRules.java:20)
+ at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
+ at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
+ at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
+ at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
+ at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
+ at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
+ at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
+ at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
+ at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
+ at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
+ at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
+ at org.junit.runners.Suite.runChild(Suite.java:127)
+ at org.junit.runners.Suite.runChild(Suite.java:26)
+ at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
+ at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
+ at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
+ at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
+ at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
+ at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
+ at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
+ at org.junit.runner.JUnitCore.run(JUnitCore.java:138)
+ at org.junit.runner.JUnitCore.run(JUnitCore.java:117)
+ at org.junit.runner.JUnitCore.runMain(JUnitCore.java:96)
+ at org.junit.runner.JUnitCore.runMainAndExit(JUnitCore.java:47)
+ at org.junit.runner.JUnitCore.main(JUnitCore.java:40)
+ at com.jogamp.common.util.TestPlatform01.main(TestPlatform01.java:93)
+Caused by: java.io.IOException: CreateProcess error=1260, This program is blocked by group policy. For more information, contact your system administrator
+ at java.lang.ProcessImpl.create(Native Method)
+ at java.lang.ProcessImpl.(Unknown Source)
+ at java.lang.ProcessImpl.start(Unknown Source)
+ ... 50 more
+IOUtil.testDirExec(): test-exe
+IOUtil.testDirExec(): abs-path : res -2 -> false
+IOUtil.testDirExec(): total 172ms, create 78ms, execute 94ms
+IOUtil.testDirImpl(tempX1): , create true, exec true: false
+IOUtil.testDirExec(): test-exe
+IOUtil.testDirExec(): abs-path : res 0 -> true
+IOUtil.testDirExec(): total 78ms, create 0ms, execute 78ms
+IOUtil.testDirImpl(tempX4): , create true, exec true: true
+IOUtil.testDirExec(): test-exe
+IOUtil.testDirExec(): abs-path : res 0 -> true
+IOUtil.testDirExec(): total 16ms, create 0ms, execute 16ms
+IOUtil.testDirImpl(tempX4): , create true, exec true: true
+IOUtil.getTempRoot(): temp dirs: exec: C:\Users\sven\.jogamp_0000, noexec: C:\Users\sven\.jogamp_0000
+IOUtil.testDirImpl(testDir): , create true, exec false: true
+
+OS name/type: Windows 7, WINDOWS
+OS version: 6.1, 6.1.0
+
+Arch, CPU: amd64, X86_64/X86
+OS/Arch: windows-amd64
+
+Java runtime: Java(TM) SE Runtime Environment
+Java vendor[name/url]: Oracle Corporation/http://java.oracle.com/
+Java version, vm: 1.8.0_60, Java HotSpot(TM) 64-Bit Server VM
+
+MD: MachineDataInfo: runtimeValidated true, 32Bit false, primitive size / alignment:
+ int8 1 / 1, int16 2 / 2
+ int 4 / 4, long 4 / 4
+ int32 4 / 4, int64 8 / 8
+ float 4 / 4, double 8 / 8, ldouble 16 / 16
+ pointer 8 / 8, page 4096
+
+
+++++ TestCase.tearDown: com.jogamp.common.util.TestPlatform01 - testInfo00
+.++++ TestCase.setUp: com.jogamp.common.util.TestPlatform01 - testPageSize01
+PageSize: 4096
+++++ TestCase.tearDown: com.jogamp.common.util.TestPlatform01 - testPageSize01
+++++ Test Singleton.unlock()
+SLOCK [T SingletonServerSocket1-localhost/127.0.0.1:59999 @ 1442715964729 ms III - Stopping: alive true, shallQuit true, hasSocket true
+SLOCK [T main @ 1442715964729 ms --- localhost/127.0.0.1:59999 - Unlock ok within 0 ms
+
+Time: 2.015
+
+OK (2 tests)
+
diff -Nru gluegen2-2.2.4/doc/licenses/Apache.LICENSE-2.0 gluegen2-2.3.2/doc/licenses/Apache.LICENSE-2.0
--- gluegen2-2.2.4/doc/licenses/Apache.LICENSE-2.0 1970-01-01 00:00:00.000000000 +0000
+++ gluegen2-2.3.2/doc/licenses/Apache.LICENSE-2.0 2015-10-09 04:18:28.000000000 +0000
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff -Nru gluegen2-2.2.4/doc/manual/index.html gluegen2-2.3.2/doc/manual/index.html
--- gluegen2-2.2.4/doc/manual/index.html 2014-10-10 13:20:51.000000000 +0000
+++ gluegen2-2.3.2/doc/manual/index.html 2015-10-09 04:18:28.000000000 +0000
@@ -280,7 +280,7 @@
supports binding C and C++ libraries to a variety of scripting
languages; JNIWrapper, a
commercial tool automating the binding of C APIs to Java; and NoodleGlue,
+ href="http://web.archive.org/web/20070419183658/http://www.noodleglue.org/noodleglue/noodleglue.html">NoodleGlue,
a recently-released tool automating the binding of C++ APIs to
Java. Other language-specific tools such as Perl's XS, Boost.Python
and many others exist.
@@ -350,7 +350,7 @@
The source code for GlueGen may be obtained by cloning the Git repository:
To build GlueGen, cd into the gluegen/make folder and invoke ant.
@@ -450,8 +450,8 @@
</gluegen>
- Please see the JOGL and JOAL build.xml files for
+ Please see the JOGL and JOAL build.xml files for
concrete, though non-trivial, examples of how to invoke GlueGen via
Ant.
diff -Nru gluegen2-2.2.4/.gitmodules gluegen2-2.3.2/.gitmodules
--- gluegen2-2.2.4/.gitmodules 1970-01-01 00:00:00.000000000 +0000
+++ gluegen2-2.3.2/.gitmodules 2015-10-09 04:18:28.000000000 +0000
@@ -0,0 +1,3 @@
+[submodule "jcpp"]
+ path = jcpp
+ url = ../jcpp
diff -Nru gluegen2-2.2.4/jcpp/.gitignore gluegen2-2.3.2/jcpp/.gitignore
--- gluegen2-2.2.4/jcpp/.gitignore 1970-01-01 00:00:00.000000000 +0000
+++ gluegen2-2.3.2/jcpp/.gitignore 2015-04-01 13:52:14.000000000 +0000
@@ -0,0 +1,4 @@
+build
+.*.swp
+.gradle
+.nb-gradle
diff -Nru gluegen2-2.2.4/jcpp/LICENSE gluegen2-2.3.2/jcpp/LICENSE
--- gluegen2-2.2.4/jcpp/LICENSE 1970-01-01 00:00:00.000000000 +0000
+++ gluegen2-2.3.2/jcpp/LICENSE 2015-04-01 13:52:14.000000000 +0000
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+Copyright [yyyy] [name of copyright owner]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
diff -Nru gluegen2-2.2.4/jcpp/README.md gluegen2-2.3.2/jcpp/README.md
--- gluegen2-2.2.4/jcpp/README.md 1970-01-01 00:00:00.000000000 +0000
+++ gluegen2-2.3.2/jcpp/README.md 2015-04-01 13:52:14.000000000 +0000
@@ -0,0 +1,31 @@
+# Introduction
+
+The C Preprocessor is an interesting standard. It appears to be
+derived from the de-facto behaviour of the first preprocessors, and
+has evolved over the years. Implementation is therefore difficult.
+
+JCPP is a complete, compliant, standalone, pure Java implementation
+of the C preprocessor. It is intended to be of use to people writing
+C-style compilers in Java using tools like sablecc, antlr, JLex,
+CUP and so forth (although if you aren't using sablecc, you need your
+head examined).
+
+This project has has been used to successfully preprocess much of
+the source code of the GNU C library. As of version 1.2.5, it can
+also preprocess the Apple Objective C library.
+
+# JogAmp Branch
+
+This branch is modified for JogAmp
+to supply [GlueGen](http://jogamp.org/gluegen/www/) with JCPP.
+
+This branch is only intended as a submodule for GlueGen
+and hence must be [build from within GlueGen](http://jogamp.org/gluegen/doc/HowToBuild.html).
+
+# Original JCPP Version
+* [Homepage](http://www.anarres.org/projects/jcpp/)
+* [GitHub](https://github.com/shevek/jcpp.git)
+
+# Documentation
+
+* [JavaDoc API](http://jogamp.org/deployment/jogamp-next/javadoc/gluegen/javadoc/)
diff -Nru gluegen2-2.2.4/jcpp/src/main/java/com/jogamp/gluegen/jcpp/Argument.java gluegen2-2.3.2/jcpp/src/main/java/com/jogamp/gluegen/jcpp/Argument.java
--- gluegen2-2.2.4/jcpp/src/main/java/com/jogamp/gluegen/jcpp/Argument.java 1970-01-01 00:00:00.000000000 +0000
+++ gluegen2-2.3.2/jcpp/src/main/java/com/jogamp/gluegen/jcpp/Argument.java 2015-04-01 13:52:14.000000000 +0000
@@ -0,0 +1,75 @@
+/*
+ * Anarres C Preprocessor
+ * Copyright (c) 2007-2008, Shevek
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package com.jogamp.gluegen.jcpp;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import javax.annotation.Nonnull;
+
+/**
+ * A macro argument.
+ *
+ * This encapsulates a raw and preprocessed token stream.
+ */
+/* pp */ class Argument extends ArrayList {
+
+ private List expansion;
+
+ public Argument() {
+ this.expansion = null;
+ }
+
+ public void addToken(@Nonnull Token tok) {
+ add(tok);
+ }
+
+ /* pp */ void expand(@Nonnull Preprocessor p)
+ throws IOException,
+ LexerException {
+ /* Cache expansion. */
+ if (expansion == null) {
+ this.expansion = p.expand(this);
+ // System.out.println("Expanded arg " + this);
+ }
+ }
+
+ @Nonnull
+ public Iterator expansion() {
+ return expansion.iterator();
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder buf = new StringBuilder();
+ buf.append("Argument(");
+ // buf.append(super.toString());
+ buf.append("raw=[ ");
+ for (int i = 0; i < size(); i++)
+ buf.append(get(i).getText());
+ buf.append(" ];expansion=[ ");
+ if (expansion == null)
+ buf.append("null");
+ else
+ for (Token token : expansion)
+ buf.append(token.getText());
+ buf.append(" ])");
+ return buf.toString();
+ }
+
+}
diff -Nru gluegen2-2.2.4/jcpp/src/main/java/com/jogamp/gluegen/jcpp/ChrootFileSystem.java gluegen2-2.3.2/jcpp/src/main/java/com/jogamp/gluegen/jcpp/ChrootFileSystem.java
--- gluegen2-2.2.4/jcpp/src/main/java/com/jogamp/gluegen/jcpp/ChrootFileSystem.java 1970-01-01 00:00:00.000000000 +0000
+++ gluegen2-2.3.2/jcpp/src/main/java/com/jogamp/gluegen/jcpp/ChrootFileSystem.java 2015-04-01 13:52:14.000000000 +0000
@@ -0,0 +1,84 @@
+/*
+ * Anarres C Preprocessor
+ * Copyright (c) 2007-2008, Shevek
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package com.jogamp.gluegen.jcpp;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * A virtual filesystem implementation using java.io in a virtual
+ * chroot.
+ */
+public class ChrootFileSystem implements VirtualFileSystem {
+
+ private File root;
+
+ public ChrootFileSystem(File root) {
+ this.root = root;
+ }
+
+ @Override
+ public VirtualFile getFile(String path) {
+ return new ChrootFile(path);
+ }
+
+ @Override
+ public VirtualFile getFile(String dir, String name) {
+ return new ChrootFile(dir, name);
+ }
+
+ private class ChrootFile extends File implements VirtualFile {
+
+ private File rfile;
+
+ public ChrootFile(String path) {
+ super(path);
+ }
+
+ public ChrootFile(String dir, String name) {
+ super(dir, name);
+ }
+
+ /* private */
+ public ChrootFile(File dir, String name) {
+ super(dir, name);
+ }
+
+ @Override
+ public ChrootFile getParentFile() {
+ return new ChrootFile(getParent());
+ }
+
+ @Override
+ public ChrootFile getChildFile(String name) {
+ return new ChrootFile(this, name);
+ }
+
+ @Override
+ public boolean isFile() {
+ File real = new File(root, getPath());
+ return real.isFile();
+ }
+
+ @Override
+ public Source getSource() throws IOException {
+ return new FileLexerSource(new File(root, getPath()),
+ getPath());
+ }
+ }
+
+}
diff -Nru gluegen2-2.2.4/jcpp/src/main/java/com/jogamp/gluegen/jcpp/CppReader.java gluegen2-2.3.2/jcpp/src/main/java/com/jogamp/gluegen/jcpp/CppReader.java
--- gluegen2-2.2.4/jcpp/src/main/java/com/jogamp/gluegen/jcpp/CppReader.java 1970-01-01 00:00:00.000000000 +0000
+++ gluegen2-2.3.2/jcpp/src/main/java/com/jogamp/gluegen/jcpp/CppReader.java 2015-04-01 13:52:14.000000000 +0000
@@ -0,0 +1,149 @@
+/*
+ * Anarres C Preprocessor
+ * Copyright (c) 2007-2008, Shevek
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package com.jogamp.gluegen.jcpp;
+
+import java.io.Closeable;
+import java.io.IOException;
+import java.io.Reader;
+
+import javax.annotation.Nonnull;
+
+import static com.jogamp.gluegen.jcpp.Token.CCOMMENT;
+import static com.jogamp.gluegen.jcpp.Token.CPPCOMMENT;
+import static com.jogamp.gluegen.jcpp.Token.EOF;
+
+/**
+ * A Reader wrapper around the Preprocessor.
+ *
+ * This is a utility class to provide a transparent {@link Reader}
+ * which preprocesses the input text.
+ *
+ * @see Preprocessor
+ * @see Reader
+ */
+public class CppReader extends Reader implements Closeable {
+
+ private final Preprocessor cpp;
+ private String token;
+ private int idx;
+
+ public CppReader(@Nonnull final Reader r) {
+ cpp = new Preprocessor(new LexerSource(r, true) {
+ @Override
+ public String getName() {
+ return "";
+ }
+ });
+ token = "";
+ idx = 0;
+ }
+
+ public CppReader(@Nonnull Preprocessor p) {
+ cpp = p;
+ token = "";
+ idx = 0;
+ }
+
+ /**
+ * Returns the Preprocessor used by this CppReader.
+ */
+ @Nonnull
+ public Preprocessor getPreprocessor() {
+ return cpp;
+ }
+
+ /**
+ * Defines the given name as a macro.
+ *
+ * This is a convnience method.
+ */
+ public void addMacro(@Nonnull String name)
+ throws LexerException {
+ cpp.addMacro(name);
+ }
+
+ /**
+ * Defines the given name as a macro.
+ *
+ * This is a convnience method.
+ */
+ public void addMacro(@Nonnull String name, @Nonnull String value)
+ throws LexerException {
+ cpp.addMacro(name, value);
+ }
+
+ private boolean refill()
+ throws IOException {
+ try {
+ assert cpp != null : "cpp is null : was it closed?";
+ if (token == null)
+ return false;
+ while (idx >= token.length()) {
+ Token tok = cpp.token();
+ switch (tok.getType()) {
+ case EOF:
+ token = null;
+ return false;
+ case CCOMMENT:
+ case CPPCOMMENT:
+ if (!cpp.getFeature(Feature.KEEPCOMMENTS)) {
+ token = " ";
+ break;
+ }
+ default:
+ token = tok.getText();
+ break;
+ }
+ idx = 0;
+ }
+ return true;
+ } catch (LexerException e) {
+ throw new IOException(String.valueOf(e), e);
+ }
+ }
+
+ @Override
+ public int read()
+ throws IOException {
+ if (!refill())
+ return -1;
+ return token.charAt(idx++);
+ }
+
+ /* XXX Very slow and inefficient. */
+ public int read(char cbuf[], int off, int len)
+ throws IOException {
+ if (token == null)
+ return -1;
+ for (int i = 0; i < len; i++) {
+ int ch = read();
+ if (ch == -1)
+ return i;
+ cbuf[off + i] = (char) ch;
+ }
+ return len;
+ }
+
+ @Override
+ public void close()
+ throws IOException {
+ cpp.close();
+ token = null;
+ }
+
+}
diff -Nru gluegen2-2.2.4/jcpp/src/main/java/com/jogamp/gluegen/jcpp/CppTask.java gluegen2-2.3.2/jcpp/src/main/java/com/jogamp/gluegen/jcpp/CppTask.java
--- gluegen2-2.2.4/jcpp/src/main/java/com/jogamp/gluegen/jcpp/CppTask.java 1970-01-01 00:00:00.000000000 +0000
+++ gluegen2-2.3.2/jcpp/src/main/java/com/jogamp/gluegen/jcpp/CppTask.java 2015-04-01 13:52:14.000000000 +0000
@@ -0,0 +1,215 @@
+/*
+ * Anarres C Preprocessor
+ * Copyright (c) 2007-2008, Shevek
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package com.jogamp.gluegen.jcpp;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Enumeration;
+import java.util.List;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.taskdefs.Copy;
+import org.apache.tools.ant.types.FilterSet;
+import org.apache.tools.ant.types.FilterSetCollection;
+import org.apache.tools.ant.types.Path;
+
+/**
+ * An ant task for jcpp.
+ */
+public class CppTask extends Copy {
+
+ private class Listener extends DefaultPreprocessorListener {
+
+ @Override
+ protected void print(String msg) {
+ log(msg);
+ }
+ }
+
+ public static class Macro {
+
+ private String name;
+ private String value;
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public String getValue() {
+ return value;
+ }
+ }
+
+ private final Listener listener = new Listener();
+ private final List macros = new ArrayList();
+ private Path systemincludepath;
+ private Path localincludepath;
+
+ public void addMacro(Macro macro) {
+ macros.add(macro);
+ }
+
+ public void addSystemincludepath(Path path) {
+ if (systemincludepath == null)
+ systemincludepath = new Path(getProject());
+ systemincludepath.add(path);
+ }
+
+ public void addLocalincludepath(Path path) {
+ if (localincludepath == null)
+ localincludepath = new Path(getProject());
+ localincludepath.add(path);
+ }
+
+ /*
+ public void execute() {
+ FileWriter writer = null;
+ try {
+ if (input == null)
+ throw new BuildException("Input not specified");
+ if (output == null)
+ throw new BuildException("Output not specified");
+ cpp.addInput(this.input);
+ writer = new FileWriter(this.output);
+ for (;;) {
+ Token tok = cpp.token();
+ if (tok != null && tok.getType() == Token.EOF)
+ break;
+ writer.write(tok.getText());
+ }
+ }
+ catch (Exception e) {
+ throw new BuildException(e);
+ }
+ finally {
+ if (writer != null) {
+ try {
+ writer.close();
+ }
+ catch (IOException e) {
+ }
+ }
+ }
+ }
+ */
+ private void preprocess(File input, File output) throws Exception {
+ Preprocessor cpp = new Preprocessor();
+ cpp.setListener(listener);
+ for (Macro macro : macros)
+ cpp.addMacro(macro.getName(), macro.getValue());
+ if (systemincludepath != null)
+ cpp.setSystemIncludePath(Arrays.asList(systemincludepath.list()));
+ if (localincludepath != null)
+ cpp.setQuoteIncludePath(Arrays.asList(localincludepath.list()));
+
+ File dir = output.getParentFile();
+ if (!dir.exists()) {
+ if (!dir.mkdirs())
+ throw new BuildException("Failed to make parent directory " + dir);
+ } else if (!dir.isDirectory()) {
+ throw new BuildException("Parent directory of output file " + output + " exists, but is not a directory.");
+ }
+ FileWriter writer = null;
+ try {
+ if (input == null)
+ throw new BuildException("Input not specified");
+ if (output == null)
+ throw new BuildException("Output not specified");
+ cpp.addInput(input);
+ writer = new FileWriter(output);
+ for (;;) {
+ Token tok = cpp.token();
+ if (tok == null)
+ break;
+ if (tok.getType() == Token.EOF)
+ break;
+ writer.write(tok.getText());
+ }
+ } finally {
+ if (writer != null) {
+ try {
+ writer.close();
+ } catch (IOException e) {
+ }
+ }
+ }
+ }
+
+ @Override
+ protected void doFileOperations() {
+ if (fileCopyMap.size() > 0) {
+ log("Copying " + fileCopyMap.size()
+ + " file" + (fileCopyMap.size() == 1 ? "" : "s")
+ + " to " + destDir.getAbsolutePath());
+
+ Enumeration e = fileCopyMap.keys();
+
+ while (e.hasMoreElements()) {
+ String fromFile = e.nextElement();
+ String[] toFiles = (String[]) fileCopyMap.get(fromFile);
+
+ for (String toFile : toFiles) {
+ if (fromFile.equals(toFile)) {
+ log("Skipping self-copy of " + fromFile, verbosity);
+ continue;
+ }
+
+ try {
+ log("Copying " + fromFile + " to " + toFile, verbosity);
+
+ FilterSetCollection executionFilters
+ = new FilterSetCollection();
+ if (filtering) {
+ executionFilters
+ .addFilterSet(getProject().getGlobalFilterSet());
+ }
+ for (Enumeration filterEnum = getFilterSets().elements();
+ filterEnum.hasMoreElements();) {
+ executionFilters
+ .addFilterSet((FilterSet) filterEnum.nextElement());
+ }
+
+ File srcFile = new File(fromFile);
+ File dstFile = new File(toFile);
+ preprocess(srcFile, dstFile);
+ } catch (Exception ioe) {
+ // ioe.printStackTrace();
+ String msg = "Failed to copy " + fromFile + " to " + toFile
+ + " due to " + ioe.getMessage();
+ File targetFile = new File(toFile);
+ if (targetFile.exists() && !targetFile.delete()) {
+ msg += " and I couldn't delete the corrupt " + toFile;
+ }
+ throw new BuildException(msg, ioe, getLocation());
+ }
+ }
+ }
+ }
+
+ }
+
+}
diff -Nru gluegen2-2.2.4/jcpp/src/main/java/com/jogamp/gluegen/jcpp/DefaultPreprocessorListener.java gluegen2-2.3.2/jcpp/src/main/java/com/jogamp/gluegen/jcpp/DefaultPreprocessorListener.java
--- gluegen2-2.2.4/jcpp/src/main/java/com/jogamp/gluegen/jcpp/DefaultPreprocessorListener.java 1970-01-01 00:00:00.000000000 +0000
+++ gluegen2-2.3.2/jcpp/src/main/java/com/jogamp/gluegen/jcpp/DefaultPreprocessorListener.java 2015-04-01 13:52:14.000000000 +0000
@@ -0,0 +1,99 @@
+package com.jogamp.gluegen.jcpp;
+
+/*
+ * Anarres C Preprocessor
+ * Copyright (c) 2007-2008, Shevek
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+import javax.annotation.Nonnegative;
+import javax.annotation.Nonnull;
+
+import com.jogamp.gluegen.Logging;
+import com.jogamp.gluegen.Logging.LoggerIf;
+
+/**
+ * A handler for preprocessor events, primarily errors and warnings.
+ *
+ * If no PreprocessorListener is installed in a Preprocessor, all
+ * error and warning events will throw an exception. Installing a
+ * listener allows more intelligent handling of these events.
+ */
+public class DefaultPreprocessorListener implements PreprocessorListener {
+
+ private final LoggerIf LOG;
+
+ private int errors;
+ private int warnings;
+
+ public DefaultPreprocessorListener() {
+ LOG = Logging.getLogger(DefaultPreprocessorListener.class);
+ clear();
+ }
+
+ public void clear() {
+ errors = 0;
+ warnings = 0;
+ }
+
+ @Nonnegative
+ public int getErrors() {
+ return errors;
+ }
+
+ @Nonnegative
+ public int getWarnings() {
+ return warnings;
+ }
+
+ protected void print(@Nonnull final String msg) {
+ LOG.info(msg);
+ }
+
+ /**
+ * Handles a warning.
+ *
+ * The behaviour of this method is defined by the
+ * implementation. It may simply record the error message, or
+ * it may throw an exception.
+ */
+ @Override
+ public void handleWarning(final Source source, final int line, final int column,
+ final String msg)
+ throws LexerException {
+ warnings++;
+ print(source.getName() + ":" + line + ":" + column
+ + ": warning: " + msg);
+ }
+
+ /**
+ * Handles an error.
+ *
+ * The behaviour of this method is defined by the
+ * implementation. It may simply record the error message, or
+ * it may throw an exception.
+ */
+ @Override
+ public void handleError(final Source source, final int line, final int column,
+ final String msg)
+ throws LexerException {
+ errors++;
+ print(source.getName() + ":" + line + ":" + column
+ + ": error: " + msg);
+ }
+
+ @Override
+ public void handleSourceChange(final Source source, final SourceChangeEvent event) {
+ }
+
+}
diff -Nru gluegen2-2.2.4/jcpp/src/main/java/com/jogamp/gluegen/jcpp/Feature.java gluegen2-2.3.2/jcpp/src/main/java/com/jogamp/gluegen/jcpp/Feature.java
--- gluegen2-2.2.4/jcpp/src/main/java/com/jogamp/gluegen/jcpp/Feature.java 1970-01-01 00:00:00.000000000 +0000
+++ gluegen2-2.3.2/jcpp/src/main/java/com/jogamp/gluegen/jcpp/Feature.java 2015-04-01 13:52:14.000000000 +0000
@@ -0,0 +1,42 @@
+/*
+ * Anarres C Preprocessor
+ * Copyright (c) 2007-2008, Shevek
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package com.jogamp.gluegen.jcpp;
+
+/**
+ * Features of the Preprocessor, which may be enabled or disabled.
+ */
+public enum Feature {
+
+ /** Supports ANSI digraphs. */
+ DIGRAPHS,
+ /** Supports ANSI trigraphs. */
+ TRIGRAPHS,
+ /** Outputs linemarker tokens. */
+ LINEMARKERS,
+ /** Reports tokens of type INVALID as errors. */
+ CSYNTAX,
+ /** Preserves comments in the lexed output. */
+ KEEPCOMMENTS,
+ /** Preserves comments in the lexed output, even when inactive. */
+ KEEPALLCOMMENTS,
+ DEBUG,
+ /** Supports lexing of objective-C. */
+ OBJCSYNTAX,
+ INCLUDENEXT,
+ /** Random extensions. */
+ PRAGMA_ONCE
+}
diff -Nru gluegen2-2.2.4/jcpp/src/main/java/com/jogamp/gluegen/jcpp/FileLexerSource.java gluegen2-2.3.2/jcpp/src/main/java/com/jogamp/gluegen/jcpp/FileLexerSource.java
--- gluegen2-2.2.4/jcpp/src/main/java/com/jogamp/gluegen/jcpp/FileLexerSource.java 1970-01-01 00:00:00.000000000 +0000
+++ gluegen2-2.3.2/jcpp/src/main/java/com/jogamp/gluegen/jcpp/FileLexerSource.java 2015-04-01 13:52:14.000000000 +0000
@@ -0,0 +1,89 @@
+/*
+ * Anarres C Preprocessor
+ * Copyright (c) 2007-2008, Shevek
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package com.jogamp.gluegen.jcpp;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import javax.annotation.Nonnull;
+
+/**
+ * A {@link Source} which lexes a file.
+ *
+ * The input is buffered.
+ *
+ * @see Source
+ */
+public class FileLexerSource extends LexerSource {
+
+ private final String path;
+ private final File file;
+
+ /**
+ * Creates a new Source for lexing the given File.
+ *
+ * Preprocessor directives are honoured within the file.
+ */
+ public FileLexerSource(@Nonnull File file, String path)
+ throws IOException {
+ super(
+ new BufferedReader(
+ new FileReader(
+ file
+ )
+ ),
+ true
+ );
+
+ this.file = file;
+ this.path = path;
+ }
+
+ public FileLexerSource(@Nonnull File file)
+ throws IOException {
+ this(file, file.getPath());
+ }
+
+ public FileLexerSource(@Nonnull String path)
+ throws IOException {
+ this(new File(path), path);
+ }
+
+ @Nonnull
+ public File getFile() {
+ return file;
+ }
+
+ /**
+ * This is not necessarily the same as getFile().getPath() in case we are in a chroot.
+ */
+ @Override
+ public String getPath() {
+ return path;
+ }
+
+ @Override
+ public String getName() {
+ return getPath();
+ }
+
+ @Override
+ public String toString() {
+ return "file " + getPath();
+ }
+}
diff -Nru gluegen2-2.2.4/jcpp/src/main/java/com/jogamp/gluegen/jcpp/FixedTokenSource.java gluegen2-2.3.2/jcpp/src/main/java/com/jogamp/gluegen/jcpp/FixedTokenSource.java
--- gluegen2-2.2.4/jcpp/src/main/java/com/jogamp/gluegen/jcpp/FixedTokenSource.java 1970-01-01 00:00:00.000000000 +0000
+++ gluegen2-2.3.2/jcpp/src/main/java/com/jogamp/gluegen/jcpp/FixedTokenSource.java 2015-04-01 13:52:14.000000000 +0000
@@ -0,0 +1,59 @@
+/*
+ * Anarres C Preprocessor
+ * Copyright (c) 2007-2008, Shevek
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package com.jogamp.gluegen.jcpp;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+
+/* pp */ class FixedTokenSource extends Source {
+
+ private static final Token EOF
+ = new Token(Token.EOF, "");
+
+ private final List tokens;
+ private int idx;
+
+ /* pp */ FixedTokenSource(Token... tokens) {
+ this.tokens = Arrays.asList(tokens);
+ this.idx = 0;
+ }
+
+ /* pp */ FixedTokenSource(List tokens) {
+ this.tokens = tokens;
+ this.idx = 0;
+ }
+
+ @Override
+ public Token token()
+ throws IOException,
+ LexerException {
+ if (idx >= tokens.size())
+ return EOF;
+ return tokens.get(idx++);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder buf = new StringBuilder();
+ buf.append("constant token stream ").append(tokens);
+ Source parent = getParent();
+ if (parent != null)
+ buf.append(" in ").append(String.valueOf(parent));
+ return buf.toString();
+ }
+}
diff -Nru gluegen2-2.2.4/jcpp/src/main/java/com/jogamp/gluegen/jcpp/InputLexerSource.java gluegen2-2.3.2/jcpp/src/main/java/com/jogamp/gluegen/jcpp/InputLexerSource.java
--- gluegen2-2.2.4/jcpp/src/main/java/com/jogamp/gluegen/jcpp/InputLexerSource.java 1970-01-01 00:00:00.000000000 +0000
+++ gluegen2-2.3.2/jcpp/src/main/java/com/jogamp/gluegen/jcpp/InputLexerSource.java 2015-04-01 13:52:14.000000000 +0000
@@ -0,0 +1,64 @@
+/*
+ * Anarres C Preprocessor
+ * Copyright (c) 2007-2008, Shevek
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package com.jogamp.gluegen.jcpp;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+/**
+ * A {@link Source} which lexes a file.
+ *
+ * The input is buffered.
+ *
+ * @see Source
+ */
+public class InputLexerSource extends LexerSource {
+
+ /**
+ * Creates a new Source for lexing the given Reader.
+ *
+ * Preprocessor directives are honoured within the file.
+ */
+ public InputLexerSource(InputStream input)
+ throws IOException {
+ super(
+ new BufferedReader(
+ new InputStreamReader(
+ input
+ )
+ ),
+ true
+ );
+ }
+
+ @Override
+ public String getPath() {
+ return "";
+ }
+
+ @Override
+ public String getName() {
+ return "standard input";
+ }
+
+ @Override
+ public String toString() {
+ return String.valueOf(getPath());
+ }
+}
diff -Nru gluegen2-2.2.4/jcpp/src/main/java/com/jogamp/gluegen/jcpp/InternalException.java gluegen2-2.3.2/jcpp/src/main/java/com/jogamp/gluegen/jcpp/InternalException.java
--- gluegen2-2.2.4/jcpp/src/main/java/com/jogamp/gluegen/jcpp/InternalException.java 1970-01-01 00:00:00.000000000 +0000
+++ gluegen2-2.3.2/jcpp/src/main/java/com/jogamp/gluegen/jcpp/InternalException.java 2015-04-01 13:52:14.000000000 +0000
@@ -0,0 +1,31 @@
+/*
+ * Anarres C Preprocessor
+ * Copyright (c) 2007-2008, Shevek
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package com.jogamp.gluegen.jcpp;
+
+/**
+ * An internal exception.
+ *
+ * This exception is thrown when an internal state violation is
+ * encountered. This should never happen. If it ever happens, please
+ * report it as a bug.
+ */
+public class InternalException extends RuntimeException {
+
+ public InternalException(String msg) {
+ super(msg);
+ }
+}
diff -Nru gluegen2-2.2.4/jcpp/src/main/java/com/jogamp/gluegen/jcpp/JavaFileSystem.java gluegen2-2.3.2/jcpp/src/main/java/com/jogamp/gluegen/jcpp/JavaFileSystem.java
--- gluegen2-2.2.4/jcpp/src/main/java/com/jogamp/gluegen/jcpp/JavaFileSystem.java 1970-01-01 00:00:00.000000000 +0000
+++ gluegen2-2.3.2/jcpp/src/main/java/com/jogamp/gluegen/jcpp/JavaFileSystem.java 2015-04-01 13:52:14.000000000 +0000
@@ -0,0 +1,84 @@
+/*
+ * Anarres C Preprocessor
+ * Copyright (c) 2007-2008, Shevek
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package com.jogamp.gluegen.jcpp;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * A virtual filesystem implementation using java.io.
+ */
+public class JavaFileSystem implements VirtualFileSystem {
+
+ @Override
+ public VirtualFile getFile(String path) {
+ return new JavaFile(path);
+ }
+
+ @Override
+ public VirtualFile getFile(String dir, String name) {
+ return new JavaFile(dir, name);
+ }
+
+ private class JavaFile extends File implements VirtualFile {
+
+ public JavaFile(String path) {
+ super(path);
+ }
+
+ public JavaFile(String dir, String name) {
+ super(dir, name);
+ }
+
+ /* private */
+ public JavaFile(File dir, String name) {
+ super(dir, name);
+ }
+
+ /*
+ @Override
+ public String getPath() {
+ return getCanonicalPath();
+ }
+ */
+ @Override
+ public JavaFile getParentFile() {
+ String parent = getParent();
+ if (parent != null)
+ return new JavaFile(parent);
+ File absolute = getAbsoluteFile();
+ parent = absolute.getParent();
+ /*
+ if (parent == null)
+ return null;
+ */
+ return new JavaFile(parent);
+ }
+
+ @Override
+ public JavaFile getChildFile(String name) {
+ return new JavaFile(this, name);
+ }
+
+ @Override
+ public Source getSource() throws IOException {
+ return new FileLexerSource(this);
+ }
+
+ }
+
+}
diff -Nru gluegen2-2.2.4/jcpp/src/main/java/com/jogamp/gluegen/jcpp/JCPP.java gluegen2-2.3.2/jcpp/src/main/java/com/jogamp/gluegen/jcpp/JCPP.java
--- gluegen2-2.2.4/jcpp/src/main/java/com/jogamp/gluegen/jcpp/JCPP.java 1970-01-01 00:00:00.000000000 +0000
+++ gluegen2-2.3.2/jcpp/src/main/java/com/jogamp/gluegen/jcpp/JCPP.java 2015-04-01 13:52:14.000000000 +0000
@@ -0,0 +1,189 @@
+/**
+ * Copyright 2015 JogAmp Community. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * 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.gluegen.jcpp;
+
+import java.io.File;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.io.Reader;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Level;
+
+import com.jogamp.gluegen.ASTLocusTag;
+import com.jogamp.gluegen.ConstantDefinition;
+import com.jogamp.gluegen.GenericCPP;
+import com.jogamp.gluegen.GlueGen;
+import com.jogamp.gluegen.GlueGenException;
+import com.jogamp.gluegen.Logging;
+import com.jogamp.gluegen.Logging.LoggerIf;
+
+public class JCPP implements GenericCPP {
+ private final LoggerIf LOG;
+
+ public final Preprocessor cpp;
+ private OutputStream out;
+ private final List includePaths;
+ private final boolean enableCopyOutput2Stderr;
+
+ public JCPP(final List includePaths, final boolean debug, final boolean copyOutput2Stderr) {
+ LOG = Logging.getLogger(JCPP.class);
+ setOut(System.out);
+ this.includePaths = includePaths;
+ this.enableCopyOutput2Stderr = copyOutput2Stderr;
+
+ cpp = new Preprocessor();
+ cpp.addFeature(Feature.DIGRAPHS);
+ cpp.addFeature(Feature.TRIGRAPHS);
+ cpp.addFeature(Feature.LINEMARKERS);
+ cpp.addFeature(Feature.CSYNTAX);
+ cpp.addFeature(Feature.KEEPCOMMENTS);
+ cpp.addWarning(Warning.IMPORT);
+ cpp.setListener(new DefaultPreprocessorListener() {
+ @Override
+ public void handleError(final Source source, final int line, final int column,
+ final String msg) throws LexerException {
+ super.handleError(source, line, column, msg);
+ throw new GlueGenException(msg, new ASTLocusTag(source.getPath(), line, column, null));
+ }
+ });
+ if (debug) {
+ cpp.addFeature(Feature.DEBUG);
+ }
+ cpp.setSystemIncludePath(includePaths);
+ cpp.setQuoteIncludePath(includePaths);
+
+ if (cpp.getFeature(Feature.DEBUG)) {
+ LOG.info("#" + "include \"...\" search starts here:");
+ for (final String dir : cpp.getQuoteIncludePath())
+ LOG.info(" " + dir);
+ LOG.info("#" + "include <...> search starts here:");
+ for (final String dir : cpp.getSystemIncludePath())
+ LOG.info(" " + dir);
+ LOG.info("End of search list.");
+ }
+ }
+
+ @Override
+ public void addDefine(final String name, final String value) throws LexerException {
+ cpp.addMacro(name, value);
+ }
+
+ @Override
+ public List getConstantDefinitions() throws GlueGenException {
+ final List constants = new ArrayList();
+ final List macros;
+ try {
+ macros = cpp.getMacros(true);
+ } catch (final Throwable t) {
+ throw new GlueGenException(t);
+ }
+ final int count = macros.size();
+ for(int i=0; i",
+ null != source ? source.getLine() : -1,
+ null != source ? source.getColumn() : -1,
+ macro.toString());
+ final ConstantDefinition c = new ConstantDefinition(macro.getName(), value, null, locus);
+ constants.add(c);
+ }
+ }
+ }
+ }
+ return constants;
+ }
+
+ @Override
+ public String findFile(final String filename) {
+ final String sep = File.separator;
+ for (final String inclPath : includePaths) {
+ final String fullPath = inclPath + sep + filename;
+ final File file = new File(fullPath);
+ if (file.exists()) {
+ return fullPath;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public OutputStream out() {
+ return out;
+ }
+ @Override
+ public void setOut(final OutputStream out) {
+ this.out = out;
+ }
+
+ @Override
+ public void run(final Reader reader, final String filename) throws GlueGenException {
+ final PrintWriter writer = new PrintWriter(out);
+ cpp.addInput(new LexerSource(reader, true) {
+ @Override
+ public String getPath() { return filename; }
+ @Override
+ public String getName() { return filename; }
+ @Override
+ public String toString() { return "file " + filename; }
+ } );
+ try {
+ for (;;) {
+ final Token tok = cpp.token();
+ if (tok == null)
+ break;
+ if (tok.getType() == Token.EOF)
+ break;
+ final String s = tok.getText();
+ writer.print(s);
+ if (enableCopyOutput2Stderr) {
+ System.err.print(s);
+ System.err.flush();
+ }
+ }
+ writer.flush();
+ } catch (final Exception e) {
+ final StringBuilder buf = new StringBuilder("Preprocessor failed:\n");
+ Source s = cpp.getSource();
+ while (s != null) {
+ buf.append(" -> ").append(s).append("\n");
+ s = s.getParent();
+ }
+ buf.append(" : {0}\n");
+ LOG.log(Level.SEVERE, buf.toString(), e);
+ if( e instanceof GlueGenException ) {
+ throw (GlueGenException)e;
+ } else {
+ throw new GlueGenException("Preprocessor failed",
+ new ASTLocusTag(null != s ? s.getPath() : "n/a",
+ null != s ? s.getLine() : -1,
+ null != s ? s.getColumn() : -1, null), e);
+ }
+ }
+ }
+
+}
diff -Nru gluegen2-2.2.4/jcpp/src/main/java/com/jogamp/gluegen/jcpp/JoinReader.java gluegen2-2.3.2/jcpp/src/main/java/com/jogamp/gluegen/jcpp/JoinReader.java
--- gluegen2-2.2.4/jcpp/src/main/java/com/jogamp/gluegen/jcpp/JoinReader.java 1970-01-01 00:00:00.000000000 +0000
+++ gluegen2-2.3.2/jcpp/src/main/java/com/jogamp/gluegen/jcpp/JoinReader.java 2015-04-01 13:52:14.000000000 +0000
@@ -0,0 +1,218 @@
+/*
+ * Anarres C Preprocessor
+ * Copyright (c) 2007-2008, Shevek
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package com.jogamp.gluegen.jcpp;
+
+import java.io.Closeable;
+import java.io.IOException;
+import java.io.Reader;
+
+/* pp */ class JoinReader /* extends Reader */ implements Closeable {
+
+ private final Reader in;
+
+ private PreprocessorListener listener;
+ private LexerSource source;
+ private boolean trigraphs;
+ private boolean warnings;
+
+ private int newlines;
+ private boolean flushnl;
+ private int[] unget;
+ private int uptr;
+
+ public JoinReader(Reader in, boolean trigraphs) {
+ this.in = in;
+ this.trigraphs = trigraphs;
+ this.newlines = 0;
+ this.flushnl = false;
+ this.unget = new int[2];
+ this.uptr = 0;
+ }
+
+ public JoinReader(Reader in) {
+ this(in, false);
+ }
+
+ public void setTrigraphs(boolean enable, boolean warnings) {
+ this.trigraphs = enable;
+ this.warnings = warnings;
+ }
+
+ /* pp */ void init(Preprocessor pp, LexerSource s) {
+ this.listener = pp.getListener();
+ this.source = s;
+ setTrigraphs(pp.getFeature(Feature.TRIGRAPHS),
+ pp.getWarning(Warning.TRIGRAPHS));
+ }
+
+ private int __read() throws IOException {
+ if (uptr > 0)
+ return unget[--uptr];
+ return in.read();
+ }
+
+ private void _unread(int c) {
+ if (c != -1)
+ unget[uptr++] = c;
+ assert uptr <= unget.length :
+ "JoinReader ungets too many characters";
+ }
+
+ protected void warning(String msg)
+ throws LexerException {
+ if (source != null)
+ source.warning(msg);
+ else
+ throw new LexerException(msg);
+ }
+
+ private char trigraph(char raw, char repl)
+ throws IOException, LexerException {
+ if (trigraphs) {
+ if (warnings)
+ warning("trigraph ??" + raw + " converted to " + repl);
+ return repl;
+ } else {
+ if (warnings)
+ warning("trigraph ??" + raw + " ignored");
+ _unread(raw);
+ _unread('?');
+ return '?';
+ }
+ }
+
+ private int _read()
+ throws IOException, LexerException {
+ int c = __read();
+ if (c == '?' && (trigraphs || warnings)) {
+ int d = __read();
+ if (d == '?') {
+ int e = __read();
+ switch (e) {
+ case '(':
+ return trigraph('(', '[');
+ case ')':
+ return trigraph(')', ']');
+ case '<':
+ return trigraph('<', '{');
+ case '>':
+ return trigraph('>', '}');
+ case '=':
+ return trigraph('=', '#');
+ case '/':
+ return trigraph('/', '\\');
+ case '\'':
+ return trigraph('\'', '^');
+ case '!':
+ return trigraph('!', '|');
+ case '-':
+ return trigraph('-', '~');
+ }
+ _unread(e);
+ }
+ _unread(d);
+ }
+ return c;
+ }
+
+ public int read()
+ throws IOException, LexerException {
+ if (flushnl) {
+ if (newlines > 0) {
+ newlines--;
+ return '\n';
+ }
+ flushnl = false;
+ }
+
+ for (;;) {
+ int c = _read();
+ switch (c) {
+ case '\\':
+ int d = _read();
+ switch (d) {
+ case '\n':
+ newlines++;
+ continue;
+ case '\r':
+ newlines++;
+ int e = _read();
+ if (e != '\n')
+ _unread(e);
+ continue;
+ default:
+ _unread(d);
+ return c;
+ }
+ case '\r':
+ case '\n':
+ case '\u2028':
+ case '\u2029':
+ case '\u000B':
+ case '\u000C':
+ case '\u0085':
+ flushnl = true;
+ return c;
+ case -1:
+ if (newlines > 0) {
+ newlines--;
+ return '\n';
+ }
+ default:
+ return c;
+ }
+ }
+ }
+
+ public int read(char cbuf[], int off, int len)
+ throws IOException, LexerException {
+ for (int i = 0; i < len; i++) {
+ int ch = read();
+ if (ch == -1)
+ return i;
+ cbuf[off + i] = (char) ch;
+ }
+ return len;
+ }
+
+ @Override
+ public void close()
+ throws IOException {
+ in.close();
+ }
+
+ @Override
+ public String toString() {
+ return "JoinReader(nl=" + newlines + ")";
+ }
+
+ /*
+ public static void main(String[] args) throws IOException {
+ FileReader f = new FileReader(new File(args[0]));
+ BufferedReader b = new BufferedReader(f);
+ JoinReader r = new JoinReader(b);
+ BufferedWriter w = new BufferedWriter(
+ new java.io.OutputStreamWriter(System.out)
+ );
+ int c;
+ while ((c = r.read()) != -1) {
+ w.write((char)c);
+ }
+ w.close();
+ }
+ */
+}
diff -Nru gluegen2-2.2.4/jcpp/src/main/java/com/jogamp/gluegen/jcpp/LexerException.java gluegen2-2.3.2/jcpp/src/main/java/com/jogamp/gluegen/jcpp/LexerException.java
--- gluegen2-2.2.4/jcpp/src/main/java/com/jogamp/gluegen/jcpp/LexerException.java 1970-01-01 00:00:00.000000000 +0000
+++ gluegen2-2.3.2/jcpp/src/main/java/com/jogamp/gluegen/jcpp/LexerException.java 2015-04-01 13:52:14.000000000 +0000
@@ -0,0 +1,33 @@
+/*
+ * Anarres C Preprocessor
+ * Copyright (c) 2007-2008, Shevek
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package com.jogamp.gluegen.jcpp;
+
+/**
+ * A preprocessor exception.
+ *
+ * Note to users: I don't really like the name of this class. S.
+ */
+public class LexerException extends Exception {
+
+ public LexerException(String msg) {
+ super(msg);
+ }
+
+ public LexerException(Throwable cause) {
+ super(cause);
+ }
+}
diff -Nru gluegen2-2.2.4/jcpp/src/main/java/com/jogamp/gluegen/jcpp/LexerSource.java gluegen2-2.3.2/jcpp/src/main/java/com/jogamp/gluegen/jcpp/LexerSource.java
--- gluegen2-2.2.4/jcpp/src/main/java/com/jogamp/gluegen/jcpp/LexerSource.java 1970-01-01 00:00:00.000000000 +0000
+++ gluegen2-2.3.2/jcpp/src/main/java/com/jogamp/gluegen/jcpp/LexerSource.java 2015-04-01 13:52:14.000000000 +0000
@@ -0,0 +1,987 @@
+/*
+ * Anarres C Preprocessor
+ * Copyright (c) 2007-2008, Shevek
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package com.jogamp.gluegen.jcpp;
+
+import java.io.IOException;
+import java.io.Reader;
+
+import javax.annotation.Nonnull;
+
+import static com.jogamp.gluegen.jcpp.Token.*;
+
+/** Does not handle digraphs. */
+public class LexerSource extends Source {
+
+ private static final boolean DEBUG = false;
+
+ private JoinReader reader;
+ private final boolean ppvalid;
+ private boolean bol;
+ private boolean include;
+
+ private boolean digraphs;
+
+ /* Unread. */
+ private int u0, u1;
+ private int ucount;
+
+ private int line;
+ private int column;
+ private int lastcolumn;
+ private boolean cr;
+
+ /* ppvalid is:
+ * false in StringLexerSource,
+ * true in FileLexerSource */
+ public LexerSource(Reader r, boolean ppvalid) {
+ this.reader = new JoinReader(r);
+ this.ppvalid = ppvalid;
+ this.bol = true;
+ this.include = false;
+
+ this.digraphs = true;
+
+ this.ucount = 0;
+
+ this.line = 1;
+ this.column = 0;
+ this.lastcolumn = -1;
+ this.cr = false;
+ }
+
+ @Override
+ /* pp */ void init(Preprocessor pp) {
+ super.init(pp);
+ this.digraphs = pp.getFeature(Feature.DIGRAPHS);
+ this.reader.init(pp, this);
+ }
+
+ @Override
+ public int getLine() {
+ return line;
+ }
+
+ @Override
+ public int getColumn() {
+ return column;
+ }
+
+ @Override
+ /* pp */ boolean isNumbered() {
+ return true;
+ }
+
+ /* Error handling. */
+ private void _error(String msg, boolean error)
+ throws LexerException {
+ int _l = line;
+ int _c = column;
+ if (_c == 0) {
+ _c = lastcolumn;
+ _l--;
+ } else {
+ _c--;
+ }
+ if (error)
+ super.error(_l, _c, msg);
+ else
+ super.warning(_l, _c, msg);
+ }
+
+ /* Allow JoinReader to call this. */
+ /* pp */ final void error(String msg)
+ throws LexerException {
+ _error(msg, true);
+ }
+
+ /* Allow JoinReader to call this. */
+ /* pp */ final void warning(String msg)
+ throws LexerException {
+ _error(msg, false);
+ }
+
+ /* A flag for string handling. */
+
+ /* pp */ void setInclude(boolean b) {
+ this.include = b;
+ }
+
+ /*
+ * private boolean _isLineSeparator(int c) {
+ * return Character.getType(c) == Character.LINE_SEPARATOR
+ * || c == -1;
+ * }
+ */
+
+ /* XXX Move to JoinReader and canonicalise newlines. */
+ private static boolean isLineSeparator(int c) {
+ switch ((char) c) {
+ case '\r':
+ case '\n':
+ case '\u2028':
+ case '\u2029':
+ case '\u000B':
+ case '\u000C':
+ case '\u0085':
+ return true;
+ default:
+ return (c == -1);
+ }
+ }
+
+ private int read()
+ throws IOException,
+ LexerException {
+ int c;
+ assert ucount <= 2 : "Illegal ucount: " + ucount;
+ switch (ucount) {
+ case 2:
+ ucount = 1;
+ c = u1;
+ break;
+ case 1:
+ ucount = 0;
+ c = u0;
+ break;
+ default:
+ if (reader == null)
+ c = -1;
+ else
+ c = reader.read();
+ break;
+ }
+
+ switch (c) {
+ case '\r':
+ cr = true;
+ line++;
+ lastcolumn = column;
+ column = 0;
+ break;
+ case '\n':
+ if (cr) {
+ cr = false;
+ break;
+ }
+ /* fallthrough */
+ case '\u2028':
+ case '\u2029':
+ case '\u000B':
+ case '\u000C':
+ case '\u0085':
+ cr = false;
+ line++;
+ lastcolumn = column;
+ column = 0;
+ break;
+ case -1:
+ cr = false;
+ break;
+ default:
+ cr = false;
+ column++;
+ break;
+ }
+
+ /*
+ * if (isLineSeparator(c)) {
+ * line++;
+ * lastcolumn = column;
+ * column = 0;
+ * }
+ * else {
+ * column++;
+ * }
+ */
+ return c;
+ }
+
+ /* You can unget AT MOST one newline. */
+ private void unread(int c)
+ throws IOException {
+ /* XXX Must unread newlines. */
+ if (c != -1) {
+ if (isLineSeparator(c)) {
+ line--;
+ column = lastcolumn;
+ cr = false;
+ } else {
+ column--;
+ }
+ switch (ucount) {
+ case 0:
+ u0 = c;
+ ucount = 1;
+ break;
+ case 1:
+ u1 = c;
+ ucount = 2;
+ break;
+ default:
+ throw new IllegalStateException(
+ "Cannot unget another character!"
+ );
+ }
+ // reader.unread(c);
+ }
+ }
+
+ /* Consumes the rest of the current line into an invalid. */
+ @Nonnull
+ private Token invalid(StringBuilder text, String reason)
+ throws IOException,
+ LexerException {
+ int d = read();
+ while (!isLineSeparator(d)) {
+ text.append((char) d);
+ d = read();
+ }
+ unread(d);
+ return new Token(INVALID, text.toString(), reason);
+ }
+
+ @Nonnull
+ private Token ccomment()
+ throws IOException,
+ LexerException {
+ StringBuilder text = new StringBuilder("/*");
+ int d;
+ do {
+ do {
+ d = read();
+ if (d == -1)
+ return new Token(INVALID, text.toString(),
+ "Unterminated comment");
+ text.append((char) d);
+ } while (d != '*');
+ do {
+ d = read();
+ if (d == -1)
+ return new Token(INVALID, text.toString(),
+ "Unterminated comment");
+ text.append((char) d);
+ } while (d == '*');
+ } while (d != '/');
+ return new Token(CCOMMENT, text.toString());
+ }
+
+ @Nonnull
+ private Token cppcomment()
+ throws IOException,
+ LexerException {
+ StringBuilder text = new StringBuilder("//");
+ int d = read();
+ while (!isLineSeparator(d)) {
+ text.append((char) d);
+ d = read();
+ }
+ unread(d);
+ return new Token(CPPCOMMENT, text.toString());
+ }
+
+ private int escape(StringBuilder text)
+ throws IOException,
+ LexerException {
+ int d = read();
+ switch (d) {
+ case 'a':
+ text.append('a');
+ return 0x07;
+ case 'b':
+ text.append('b');
+ return '\b';
+ case 'f':
+ text.append('f');
+ return '\f';
+ case 'n':
+ text.append('n');
+ return '\n';
+ case 'r':
+ text.append('r');
+ return '\r';
+ case 't':
+ text.append('t');
+ return '\t';
+ case 'v':
+ text.append('v');
+ return 0x0b;
+ case '\\':
+ text.append('\\');
+ return '\\';
+
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ int len = 0;
+ int val = 0;
+ do {
+ val = (val << 3) + Character.digit(d, 8);
+ text.append((char) d);
+ d = read();
+ } while (++len < 3 && Character.digit(d, 8) != -1);
+ unread(d);
+ return val;
+
+ case 'x':
+ text.append((char) d);
+ len = 0;
+ val = 0;
+ while (len++ < 2) {
+ d = read();
+ if (Character.digit(d, 16) == -1) {
+ unread(d);
+ break;
+ }
+ val = (val << 4) + Character.digit(d, 16);
+ text.append((char) d);
+ }
+ return val;
+
+ /* Exclude two cases from the warning. */
+ case '"':
+ text.append('"');
+ return '"';
+ case '\'':
+ text.append('\'');
+ return '\'';
+
+ default:
+ warning("Unnecessary escape character " + (char) d);
+ text.append((char) d);
+ return d;
+ }
+ }
+
+ @Nonnull
+ private Token character()
+ throws IOException,
+ LexerException {
+ StringBuilder text = new StringBuilder("'");
+ int d = read();
+ if (d == '\\') {
+ text.append('\\');
+ d = escape(text);
+ } else if (isLineSeparator(d)) {
+ unread(d);
+ return new Token(INVALID, text.toString(),
+ "Unterminated character literal");
+ } else if (d == '\'') {
+ text.append('\'');
+ return new Token(INVALID, text.toString(),
+ "Empty character literal");
+ } else if (!Character.isDefined(d)) {
+ text.append('?');
+ return invalid(text, "Illegal unicode character literal");
+ } else {
+ text.append((char) d);
+ }
+
+ int e = read();
+ if (e != '\'') {
+ // error("Illegal character constant");
+ /* We consume up to the next ' or the rest of the line. */
+ for (;;) {
+ if (isLineSeparator(e)) {
+ unread(e);
+ break;
+ }
+ text.append((char) e);
+ if (e == '\'')
+ break;
+ e = read();
+ }
+ return new Token(INVALID, text.toString(),
+ "Illegal character constant " + text);
+ }
+ text.append('\'');
+ /* XXX It this a bad cast? */
+ return new Token(CHARACTER,
+ text.toString(), Character.valueOf((char) d));
+ }
+
+ @Nonnull
+ private Token string(char open, char close)
+ throws IOException,
+ LexerException {
+ StringBuilder text = new StringBuilder();
+ text.append(open);
+
+ StringBuilder buf = new StringBuilder();
+
+ for (;;) {
+ int c = read();
+ if (c == close) {
+ break;
+ } else if (c == '\\') {
+ text.append('\\');
+ if (!include) {
+ char d = (char) escape(text);
+ buf.append(d);
+ }
+ } else if (c == -1) {
+ unread(c);
+ // error("End of file in string literal after " + buf);
+ return new Token(INVALID, text.toString(),
+ "End of file in string literal after " + buf);
+ } else if (isLineSeparator(c)) {
+ unread(c);
+ // error("Unterminated string literal after " + buf);
+ return new Token(INVALID, text.toString(),
+ "Unterminated string literal after " + buf);
+ } else {
+ text.append((char) c);
+ buf.append((char) c);
+ }
+ }
+ text.append(close);
+ switch (close) {
+ case '"':
+ return new Token(STRING,
+ text.toString(), buf.toString());
+ case '>':
+ return new Token(HEADER,
+ text.toString(), buf.toString());
+ case '\'':
+ if (buf.length() == 1)
+ return new Token(CHARACTER,
+ text.toString(), buf.toString());
+ return new Token(SQSTRING,
+ text.toString(), buf.toString());
+ default:
+ throw new IllegalStateException(
+ "Unknown closing character " + String.valueOf(close));
+ }
+ }
+
+ @Nonnull
+ private Token _number_suffix(StringBuilder text, NumericValue value, int d)
+ throws IOException,
+ LexerException {
+ int flags = 0; // U, I, L, LL, F, D, MSB
+ for (;;) {
+ if (d == 'U' || d == 'u') {
+ if ((flags & NumericValue.F_UNSIGNED) != 0)
+ warning("Duplicate unsigned suffix " + d);
+ flags |= NumericValue.F_UNSIGNED;
+ text.append((char) d);
+ d = read();
+ } else if (d == 'L' || d == 'l') {
+ if ((flags & NumericValue.FF_SIZE) != 0)
+ warning("Multiple length suffixes after " + text);
+ text.append((char) d);
+ int e = read();
+ if (e == d) { // Case must match. Ll is Welsh.
+ flags |= NumericValue.F_LONGLONG;
+ text.append((char) e);
+ d = read();
+ } else {
+ flags |= NumericValue.F_LONG;
+ d = e;
+ }
+ } else if (d == 'I' || d == 'i') {
+ if ((flags & NumericValue.FF_SIZE) != 0)
+ warning("Multiple length suffixes after " + text);
+ flags |= NumericValue.F_INT;
+ text.append((char) d);
+ d = read();
+ } else if (d == 'F' || d == 'f') {
+ if ((flags & NumericValue.FF_SIZE) != 0)
+ warning("Multiple length suffixes after " + text);
+ flags |= NumericValue.F_FLOAT;
+ text.append((char) d);
+ d = read();
+ } else if (d == 'D' || d == 'd') {
+ if ((flags & NumericValue.FF_SIZE) != 0)
+ warning("Multiple length suffixes after " + text);
+ flags |= NumericValue.F_DOUBLE;
+ text.append((char) d);
+ d = read();
+ }
+ else if (Character.isUnicodeIdentifierPart(d)) {
+ String reason = "Invalid suffix \"" + (char) d + "\" on numeric constant";
+ // We've encountered something initially identified as a number.
+ // Read in the rest of this token as an identifer but return it as an invalid.
+ while (Character.isUnicodeIdentifierPart(d)) {
+ text.append((char) d);
+ d = read();
+ }
+ unread(d);
+ return new Token(INVALID, text.toString(), reason);
+ } else {
+ unread(d);
+ value.setFlags(flags);
+ return new Token(NUMBER,
+ text.toString(), value);
+ }
+ }
+ }
+
+ /* Either a decimal part, or a hex exponent. */
+ @Nonnull
+ private String _number_part(StringBuilder text, int base, boolean sign)
+ throws IOException,
+ LexerException {
+ StringBuilder part = new StringBuilder();
+ int d = read();
+ if (sign && d == '-') {
+ text.append((char) d);
+ part.append((char) d);
+ d = read();
+ }
+ while (Character.digit(d, base) != -1) {
+ text.append((char) d);
+ part.append((char) d);
+ d = read();
+ }
+ unread(d);
+ return part.toString();
+ }
+
+ /* We do not know whether know the first digit is valid. */
+ @Nonnull
+ private Token number_hex(char x)
+ throws IOException,
+ LexerException {
+ StringBuilder text = new StringBuilder("0");
+ text.append(x);
+ String integer = _number_part(text, 16, false);
+ NumericValue value = new NumericValue(16, integer);
+ int d = read();
+ if (d == '.') {
+ text.append((char) d);
+ String fraction = _number_part(text, 16, false);
+ value.setFractionalPart(fraction);
+ d = read();
+ }
+ if (d == 'P' || d == 'p') {
+ text.append((char) d);
+ String exponent = _number_part(text, 10, true);
+ value.setExponent(2, exponent);
+ d = read();
+ }
+ // XXX Make sure it's got enough parts
+ return _number_suffix(text, value, d);
+ }
+
+ private static boolean is_octal(@Nonnull String text) {
+ if (!text.startsWith("0"))
+ return false;
+ for (int i = 0; i < text.length(); i++)
+ if (Character.digit(text.charAt(i), 8) == -1)
+ return false;
+ return true;
+ }
+
+ /* We know we have at least one valid digit, but empty is not
+ * fine. */
+ @Nonnull
+ private Token number_decimal()
+ throws IOException,
+ LexerException {
+ StringBuilder text = new StringBuilder();
+ String integer = _number_part(text, 10, false);
+ String fraction = null;
+ String exponent = null;
+ int d = read();
+ if (d == '.') {
+ text.append((char) d);
+ fraction = _number_part(text, 10, false);
+ d = read();
+ }
+ if (d == 'E' || d == 'e') {
+ text.append((char) d);
+ exponent = _number_part(text, 10, true);
+ d = read();
+ }
+ int base = 10;
+ if (fraction == null && exponent == null && integer.startsWith("0")) {
+ if (!is_octal(integer))
+ warning("Decimal constant starts with 0, but not octal: " + integer);
+ else
+ base = 8;
+ }
+ NumericValue value = new NumericValue(base, integer);
+ if (fraction != null)
+ value.setFractionalPart(fraction);
+ if (exponent != null)
+ value.setExponent(10, exponent);
+ // XXX Make sure it's got enough parts
+ return _number_suffix(text, value, d);
+ }
+
+ /**
+ * Section 6.4.4.1 of C99
+ *
+ * (Not pasted here, but says that the initial negation is a separate token.)
+ *
+ * Section 6.4.4.2 of C99
+ *
+ * A floating constant has a significand part that may be followed
+ * by an exponent part and a suffix that specifies its type. The
+ * components of the significand part may include a digit sequence
+ * representing the whole-number part, followed by a period (.),
+ * followed by a digit sequence representing the fraction part.
+ *
+ * The components of the exponent part are an e, E, p, or P
+ * followed by an exponent consisting of an optionally signed digit
+ * sequence. Either the whole-number part or the fraction part has to
+ * be present; for decimal floating constants, either the period or
+ * the exponent part has to be present.
+ *
+ * The significand part is interpreted as a (decimal or hexadecimal)
+ * rational number; the digit sequence in the exponent part is
+ * interpreted as a decimal integer. For decimal floating constants,
+ * the exponent indicates the power of 10 by which the significand
+ * part is to be scaled. For hexadecimal floating constants, the
+ * exponent indicates the power of 2 by which the significand part is
+ * to be scaled.
+ *
+ * For decimal floating constants, and also for hexadecimal
+ * floating constants when FLT_RADIX is not a power of 2, the result
+ * is either the nearest representable value, or the larger or smaller
+ * representable value immediately adjacent to the nearest representable
+ * value, chosen in an implementation-defined manner. For hexadecimal
+ * floating constants when FLT_RADIX is a power of 2, the result is
+ * correctly rounded.
+ */
+ @Nonnull
+ private Token number()
+ throws IOException,
+ LexerException {
+ Token tok;
+ int c = read();
+ if (c == '0') {
+ int d = read();
+ if (d == 'x' || d == 'X') {
+ tok = number_hex((char) d);
+ } else {
+ unread(d);
+ unread(c);
+ tok = number_decimal();
+ }
+ } else if (Character.isDigit(c) || c == '.') {
+ unread(c);
+ tok = number_decimal();
+ } else {
+ throw new LexerException("Asked to parse something as a number which isn't: " + (char) c);
+ }
+ return tok;
+ }
+
+ @Nonnull
+ private Token identifier(int c)
+ throws IOException,
+ LexerException {
+ StringBuilder text = new StringBuilder();
+ int d;
+ text.append((char) c);
+ for (;;) {
+ d = read();
+ if (Character.isIdentifierIgnorable(d))
+ ; else if (Character.isJavaIdentifierPart(d))
+ text.append((char) d);
+ else
+ break;
+ }
+ unread(d);
+ return new Token(IDENTIFIER, text.toString());
+ }
+
+ @Nonnull
+ private Token whitespace(int c)
+ throws IOException,
+ LexerException {
+ StringBuilder text = new StringBuilder();
+ int d;
+ text.append((char) c);
+ for (;;) {
+ d = read();
+ if (ppvalid && isLineSeparator(d)) /* XXX Ugly. */
+
+ break;
+ if (Character.isWhitespace(d))
+ text.append((char) d);
+ else
+ break;
+ }
+ unread(d);
+ return new Token(WHITESPACE, text.toString());
+ }
+
+ /* No token processed by cond() contains a newline. */
+ @Nonnull
+ private Token cond(char c, int yes, int no)
+ throws IOException,
+ LexerException {
+ int d = read();
+ if (c == d)
+ return new Token(yes);
+ unread(d);
+ return new Token(no);
+ }
+
+ @Override
+ public Token token()
+ throws IOException,
+ LexerException {
+ Token tok = null;
+
+ int _l = line;
+ int _c = column;
+
+ int c = read();
+ int d;
+
+ switch (c) {
+ case '\n':
+ if (ppvalid) {
+ bol = true;
+ if (include) {
+ tok = new Token(NL, _l, _c, "\n");
+ } else {
+ int nls = 0;
+ do {
+ nls++;
+ d = read();
+ } while (d == '\n');
+ unread(d);
+ char[] text = new char[nls];
+ for (int i = 0; i < text.length; i++)
+ text[i] = '\n';
+ // Skip the bol = false below.
+ tok = new Token(NL, _l, _c, new String(text));
+ }
+ if (DEBUG)
+ System.out.println("lx: Returning NL: " + tok);
+ return tok;
+ }
+ /* Let it be handled as whitespace. */
+ break;
+
+ case '!':
+ tok = cond('=', NE, '!');
+ break;
+
+ case '#':
+ if (bol)
+ tok = new Token(HASH);
+ else
+ tok = cond('#', PASTE, '#');
+ break;
+
+ case '+':
+ d = read();
+ if (d == '+')
+ tok = new Token(INC);
+ else if (d == '=')
+ tok = new Token(PLUS_EQ);
+ else
+ unread(d);
+ break;
+ case '-':
+ d = read();
+ if (d == '-')
+ tok = new Token(DEC);
+ else if (d == '=')
+ tok = new Token(SUB_EQ);
+ else if (d == '>')
+ tok = new Token(ARROW);
+ else
+ unread(d);
+ break;
+
+ case '*':
+ tok = cond('=', MULT_EQ, '*');
+ break;
+ case '/':
+ d = read();
+ if (d == '*')
+ tok = ccomment();
+ else if (d == '/')
+ tok = cppcomment();
+ else if (d == '=')
+ tok = new Token(DIV_EQ);
+ else
+ unread(d);
+ break;
+
+ case '%':
+ d = read();
+ if (d == '=')
+ tok = new Token(MOD_EQ);
+ else if (digraphs && d == '>')
+ tok = new Token('}'); // digraph
+ else if (digraphs && d == ':')
+ PASTE:
+ {
+ d = read();
+ if (d != '%') {
+ unread(d);
+ tok = new Token('#'); // digraph
+ break PASTE;
+ }
+ d = read();
+ if (d != ':') {
+ unread(d); // Unread 2 chars here.
+ unread('%');
+ tok = new Token('#'); // digraph
+ break PASTE;
+ }
+ tok = new Token(PASTE); // digraph
+ }
+ else
+ unread(d);
+ break;
+
+ case ':':
+ /* :: */
+ d = read();
+ if (digraphs && d == '>')
+ tok = new Token(']'); // digraph
+ else
+ unread(d);
+ break;
+
+ case '<':
+ if (include) {
+ tok = string('<', '>');
+ } else {
+ d = read();
+ if (d == '=')
+ tok = new Token(LE);
+ else if (d == '<')
+ tok = cond('=', LSH_EQ, LSH);
+ else if (digraphs && d == ':')
+ tok = new Token('['); // digraph
+ else if (digraphs && d == '%')
+ tok = new Token('{'); // digraph
+ else
+ unread(d);
+ }
+ break;
+
+ case '=':
+ tok = cond('=', EQ, '=');
+ break;
+
+ case '>':
+ d = read();
+ if (d == '=')
+ tok = new Token(GE);
+ else if (d == '>')
+ tok = cond('=', RSH_EQ, RSH);
+ else
+ unread(d);
+ break;
+
+ case '^':
+ tok = cond('=', XOR_EQ, '^');
+ break;
+
+ case '|':
+ d = read();
+ if (d == '=')
+ tok = new Token(OR_EQ);
+ else if (d == '|')
+ tok = cond('=', LOR_EQ, LOR);
+ else
+ unread(d);
+ break;
+ case '&':
+ d = read();
+ if (d == '&')
+ tok = cond('=', LAND_EQ, LAND);
+ else if (d == '=')
+ tok = new Token(AND_EQ);
+ else
+ unread(d);
+ break;
+
+ case '.':
+ d = read();
+ if (d == '.')
+ tok = cond('.', ELLIPSIS, RANGE);
+ else
+ unread(d);
+ if (Character.isDigit(d)) {
+ unread('.');
+ tok = number();
+ }
+ /* XXX decimal fraction */
+ break;
+
+ case '\'':
+ tok = string('\'', '\'');
+ break;
+
+ case '"':
+ tok = string('"', '"');
+ break;
+
+ case -1:
+ close();
+ tok = new Token(EOF, _l, _c, "");
+ break;
+ }
+
+ if (tok == null) {
+ if (Character.isWhitespace(c)) {
+ tok = whitespace(c);
+ } else if (Character.isDigit(c)) {
+ unread(c);
+ tok = number();
+ } else if (Character.isJavaIdentifierStart(c)) {
+ tok = identifier(c);
+ } else {
+ tok = new Token(c);
+ }
+ }
+
+ if (bol) {
+ switch (tok.getType()) {
+ case WHITESPACE:
+ case CCOMMENT:
+ break;
+ default:
+ bol = false;
+ break;
+ }
+ }
+
+ tok.setLocation(_l, _c);
+ if (DEBUG)
+ System.out.println("lx: Returning " + tok);
+ // (new Exception("here")).printStackTrace(System.out);
+ return tok;
+ }
+
+ @Override
+ public void close()
+ throws IOException {
+ if (reader != null) {
+ reader.close();
+ reader = null;
+ }
+ super.close();
+ }
+
+}
diff -Nru gluegen2-2.2.4/jcpp/src/main/java/com/jogamp/gluegen/jcpp/Macro.java gluegen2-2.3.2/jcpp/src/main/java/com/jogamp/gluegen/jcpp/Macro.java
--- gluegen2-2.2.4/jcpp/src/main/java/com/jogamp/gluegen/jcpp/Macro.java 1970-01-01 00:00:00.000000000 +0000
+++ gluegen2-2.3.2/jcpp/src/main/java/com/jogamp/gluegen/jcpp/Macro.java 2015-04-01 13:52:14.000000000 +0000
@@ -0,0 +1,212 @@
+/*
+ * Anarres C Preprocessor
+ * Copyright (c) 2007-2008, Shevek
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package com.jogamp.gluegen.jcpp;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * A macro object.
+ *
+ * This encapsulates a name, an argument count, and a token stream
+ * for replacement. The replacement token stream may contain the
+ * extra tokens {@link Token#M_ARG} and {@link Token#M_STRING}.
+ */
+public class Macro {
+
+ private final Source source;
+ private final String name;
+ /* It's an explicit decision to keep these around here. We don't
+ * need to; the argument token type is M_ARG and the value
+ * is the index. The strings themselves are only used in
+ * stringification of the macro, for debugging. */
+ private List args;
+ private boolean variadic;
+ private boolean hasPaste;
+ private List tokens;
+
+ public Macro(final Source source, final String name) {
+ this.source = source;
+ this.name = name;
+ this.args = null;
+ this.variadic = false;
+ this.hasPaste = false;
+ this.tokens = new ArrayList();
+ }
+ public Macro(final Macro o) {
+ this(o, o.tokens, true);
+ }
+ public Macro(final Macro o, final List tokens) {
+ this(o, tokens, false);
+ }
+ private Macro(final Macro o, final List tokens, final boolean copyTokens) {
+ this.source = o.source;
+ this.name = o.name;
+ if(null != o.args) {
+ this.args = new ArrayList(o.args);
+ } else {
+ this.args = null;
+ }
+ this.variadic = o.variadic;
+ this.hasPaste = o.hasPaste;
+ if(null != tokens) {
+ this.tokens = copyTokens ? new ArrayList(tokens) : tokens;
+ } else {
+ this.tokens = new ArrayList();
+ }
+ }
+
+ public Macro(final String name) {
+ this(null, name);
+ }
+
+ /**
+ * Returns the Source from which this macro was parsed.
+ *
+ * This method may return null if the macro was not parsed
+ * from a regular file.
+ */
+ public Source getSource() {
+ return source;
+ }
+
+ /**
+ * Returns the name of this macro.
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Sets the arguments to this macro.
+ */
+ /* pp */ void setArgs(final List args) {
+ this.args = args;
+ }
+
+ /**
+ * Returns true if this is a function-like macro.
+ */
+ public boolean isFunctionLike() {
+ return args != null;
+ }
+
+ /**
+ * Returns the number of arguments to this macro.
+ */
+ public int getArgs() {
+ return args.size();
+ }
+
+ /**
+ * Sets the variadic flag on this Macro.
+ */
+ public void setVariadic(final boolean b) {
+ this.variadic = b;
+ }
+
+ /**
+ * Returns true if this is a variadic function-like macro.
+ */
+ public boolean isVariadic() {
+ return variadic;
+ }
+
+ /**
+ * Returns true if this macro contains a "paste" operator.
+ */
+ public boolean hasPaste() {
+ return hasPaste;
+ }
+
+ /**
+ * Adds a token to the expansion of this macro.
+ */
+ public void addToken(final Token tok) {
+ this.tokens.add(tok);
+ }
+
+ /**
+ * Adds a "paste" operator to the expansion of this macro.
+ *
+ * A paste operator causes the next token added to be pasted
+ * to the previous token when the macro is expanded.
+ * It is an error for a macro to end with a paste token.
+ */
+ public void addPaste(final Token tok) {
+ /*
+ * Given: tok0 ## tok1
+ * We generate: M_PASTE, tok0, tok1
+ * This extends as per a stack language:
+ * tok0 ## tok1 ## tok2 ->
+ * M_PASTE, tok0, M_PASTE, tok1, tok2
+ */
+ this.tokens.add(tokens.size() - 1, tok);
+ this.hasPaste = true;
+ }
+
+ /* pp */ List getTokens() {
+ return tokens;
+ }
+
+ /* Paste tokens are inserted before the first of the two pasted
+ * tokens, so it's a kind of bytecode notation. This method
+ * swaps them around again. We know that there will never be two
+ * sequential paste tokens, so a boolean is sufficient. */
+ public String getText() {
+ final StringBuilder buf = new StringBuilder();
+ boolean paste = false;
+ for (final Token tok : tokens) {
+ if (tok.getType() == Token.M_PASTE) {
+ assert paste == false : "Two sequential pastes.";
+ paste = true;
+ continue;
+ } else {
+ buf.append(tok.getText());
+ }
+ if (paste) {
+ buf.append(" #" + "# ");
+ paste = false;
+ }
+ // buf.append(tokens.get(i));
+ }
+ return buf.toString();
+ }
+
+ @Override
+ public String toString() {
+ final StringBuilder buf = new StringBuilder(name);
+ if (args != null) {
+ buf.append('(');
+ final Iterator it = args.iterator();
+ while (it.hasNext()) {
+ buf.append(it.next());
+ if (it.hasNext())
+ buf.append(", ");
+ else if (isVariadic())
+ buf.append("...");
+ }
+ buf.append(')');
+ }
+ if (!tokens.isEmpty()) {
+ buf.append(" => ").append(getText());
+ }
+ return buf.toString();
+ }
+
+}
diff -Nru gluegen2-2.2.4/jcpp/src/main/java/com/jogamp/gluegen/jcpp/MacroTokenSource.java gluegen2-2.3.2/jcpp/src/main/java/com/jogamp/gluegen/jcpp/MacroTokenSource.java
--- gluegen2-2.2.4/jcpp/src/main/java/com/jogamp/gluegen/jcpp/MacroTokenSource.java 1970-01-01 00:00:00.000000000 +0000
+++ gluegen2-2.3.2/jcpp/src/main/java/com/jogamp/gluegen/jcpp/MacroTokenSource.java 2015-04-01 13:52:14.000000000 +0000
@@ -0,0 +1,209 @@
+/*
+ * Anarres C Preprocessor
+ * Copyright (c) 2007-2008, Shevek
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package com.jogamp.gluegen.jcpp;
+
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.annotation.Nonnull;
+
+import static com.jogamp.gluegen.jcpp.Token.*;
+
+/* This source should always be active, since we don't expand macros
+ * in any inactive context. */
+/* pp */ class MacroTokenSource extends Source {
+
+ private final Macro macro;
+ private final Iterator tokens; /* Pointer into the macro. */
+
+ private final List args; /* { unexpanded, expanded } */
+
+ private Iterator arg; /* "current expansion" */
+
+ /* pp */ MacroTokenSource(@Nonnull Macro m, @Nonnull List args) {
+ this.macro = m;
+ this.tokens = m.getTokens().iterator();
+ this.args = args;
+ this.arg = null;
+ }
+
+ @Override
+ /* pp */ boolean isExpanding(@Nonnull Macro m) {
+ /* When we are expanding an arg, 'this' macro is not
+ * being expanded, and thus we may re-expand it. */
+ if (/* XXX this.arg == null && */this.macro == m)
+ return true;
+ return super.isExpanding(m);
+ }
+
+ /* XXX Called from Preprocessor [ugly]. */
+ /* pp */ static void escape(@Nonnull StringBuilder buf, @Nonnull CharSequence cs) {
+ if (buf == null)
+ throw new NullPointerException("Buffer was null.");
+ if (cs == null)
+ throw new NullPointerException("CharSequence was null.");
+ for (int i = 0; i < cs.length(); i++) {
+ char c = cs.charAt(i);
+ switch (c) {
+ case '\\':
+ buf.append("\\\\");
+ break;
+ case '"':
+ buf.append("\\\"");
+ break;
+ case '\n':
+ buf.append("\\n");
+ break;
+ case '\r':
+ buf.append("\\r");
+ break;
+ default:
+ buf.append(c);
+ }
+ }
+ }
+
+ private void concat(@Nonnull StringBuilder buf, @Nonnull Argument arg) {
+ for (Token tok : arg) {
+ buf.append(tok.getText());
+ }
+ }
+
+ @Nonnull
+ private Token stringify(@Nonnull Token pos, @Nonnull Argument arg) {
+ StringBuilder buf = new StringBuilder();
+ concat(buf, arg);
+ // System.out.println("Concat: " + arg + " -> " + buf);
+ StringBuilder str = new StringBuilder("\"");
+ escape(str, buf);
+ str.append("\"");
+ // System.out.println("Escape: " + buf + " -> " + str);
+ return new Token(STRING,
+ pos.getLine(), pos.getColumn(),
+ str.toString(), buf.toString());
+ }
+
+
+ /* At this point, we have consumed the first M_PASTE.
+ * @see Macro#addPaste(Token) */
+ private void paste(@Nonnull Token ptok)
+ throws IOException,
+ LexerException {
+ StringBuilder buf = new StringBuilder();
+ // Token err = null;
+ /* We know here that arg is null or expired,
+ * since we cannot paste an expanded arg. */
+
+ int count = 2;
+ for (int i = 0; i < count; i++) {
+ if (!tokens.hasNext()) {
+ /* XXX This one really should throw. */
+ error(ptok.getLine(), ptok.getColumn(),
+ "Paste at end of expansion");
+ buf.append(' ').append(ptok.getText());
+ break;
+ }
+ Token tok = tokens.next();
+ // System.out.println("Paste " + tok);
+ switch (tok.getType()) {
+ case M_PASTE:
+ /* One extra to paste, plus one because the
+ * paste token didn't count. */
+ count += 2;
+ ptok = tok;
+ break;
+ case M_ARG:
+ int idx = ((Integer) tok.getValue()).intValue();
+ concat(buf, args.get(idx));
+ break;
+ /* XXX Test this. */
+ case CCOMMENT:
+ case CPPCOMMENT:
+ break;
+ default:
+ buf.append(tok.getText());
+ break;
+ }
+ }
+
+ /* Push and re-lex. */
+ /*
+ StringBuilder src = new StringBuilder();
+ escape(src, buf);
+ StringLexerSource sl = new StringLexerSource(src.toString());
+ */
+ StringLexerSource sl = new StringLexerSource(buf.toString());
+
+ /* XXX Check that concatenation produces a valid token. */
+ arg = new SourceIterator(sl);
+ }
+
+ @Override
+ public Token token()
+ throws IOException,
+ LexerException {
+ for (;;) {
+ /* Deal with lexed tokens first. */
+
+ if (arg != null) {
+ if (arg.hasNext()) {
+ Token tok = arg.next();
+ /* XXX PASTE -> INVALID. */
+ assert tok.getType() != M_PASTE :
+ "Unexpected paste token";
+ return tok;
+ }
+ arg = null;
+ }
+
+ if (!tokens.hasNext())
+ return new Token(EOF, -1, -1, ""); /* End of macro. */
+
+ Token tok = tokens.next();
+ int idx;
+ switch (tok.getType()) {
+ case M_STRING:
+ /* Use the nonexpanded arg. */
+ idx = ((Integer) tok.getValue()).intValue();
+ return stringify(tok, args.get(idx));
+ case M_ARG:
+ /* Expand the arg. */
+ idx = ((Integer) tok.getValue()).intValue();
+ // System.out.println("Pushing arg " + args.get(idx));
+ arg = args.get(idx).expansion();
+ break;
+ case M_PASTE:
+ paste(tok);
+ break;
+ default:
+ return tok;
+ }
+ } /* for */
+
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder buf = new StringBuilder();
+ buf.append("expansion of ").append(macro.getName());
+ Source parent = getParent();
+ if (parent != null)
+ buf.append(" in ").append(String.valueOf(parent));
+ return buf.toString();
+ }
+}
diff -Nru gluegen2-2.2.4/jcpp/src/main/java/com/jogamp/gluegen/jcpp/NumericValue.java gluegen2-2.3.2/jcpp/src/main/java/com/jogamp/gluegen/jcpp/NumericValue.java
--- gluegen2-2.2.4/jcpp/src/main/java/com/jogamp/gluegen/jcpp/NumericValue.java 1970-01-01 00:00:00.000000000 +0000
+++ gluegen2-2.3.2/jcpp/src/main/java/com/jogamp/gluegen/jcpp/NumericValue.java 2015-04-01 13:52:14.000000000 +0000
@@ -0,0 +1,215 @@
+/*
+ * Anarres C Preprocessor
+ * Copyright (c) 2007-2008, Shevek
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package com.jogamp.gluegen.jcpp;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import javax.annotation.CheckForNull;
+import javax.annotation.CheckForSigned;
+import javax.annotation.Nonnegative;
+import javax.annotation.Nonnull;
+
+public class NumericValue extends Number {
+
+ public static final int F_UNSIGNED = 1;
+ public static final int F_INT = 2;
+ public static final int F_LONG = 4;
+ public static final int F_LONGLONG = 8;
+ public static final int F_FLOAT = 16;
+ public static final int F_DOUBLE = 32;
+
+ public static final int FF_SIZE = F_INT | F_LONG | F_LONGLONG | F_FLOAT | F_DOUBLE;
+
+ private final int base;
+ private final String integer;
+ private String fraction;
+ private int expbase = 0;
+ private String exponent;
+ private int flags;
+
+ public NumericValue(int base, String integer) {
+ this.base = base;
+ this.integer = integer;
+ }
+
+ @Nonnegative
+ public int getBase() {
+ return base;
+ }
+
+ @Nonnull
+ public String getIntegerPart() {
+ return integer;
+ }
+
+ @CheckForNull
+ public String getFractionalPart() {
+ return fraction;
+ }
+
+ /* pp */ void setFractionalPart(String fraction) {
+ this.fraction = fraction;
+ }
+
+ @CheckForSigned
+ public int getExponentBase() {
+ return expbase;
+ }
+
+ @CheckForNull
+ public String getExponent() {
+ return exponent;
+ }
+
+ /* pp */ void setExponent(int expbase, String exponent) {
+ this.expbase = expbase;
+ this.exponent = exponent;
+ }
+
+ public int getFlags() {
+ return flags;
+ }
+
+ /* pp */ void setFlags(int flags) {
+ this.flags = flags;
+ }
+
+ /**
+ * So, it turns out that parsing arbitrary bases into arbitrary
+ * precision numbers is nontrivial, and this routine gets it wrong
+ * in many important cases.
+ */
+ @Nonnull
+ public BigDecimal toBigDecimal() {
+ int scale = 0;
+ String text = getIntegerPart();
+ String t_fraction = getFractionalPart();
+ if (t_fraction != null) {
+ text += getFractionalPart();
+ // XXX Wrong for anything but base 10.
+ scale += t_fraction.length();
+ }
+ String t_exponent = getExponent();
+ if (t_exponent != null)
+ scale -= Integer.parseInt(t_exponent);
+ BigInteger unscaled = new BigInteger(text, getBase());
+ return new BigDecimal(unscaled, scale);
+ }
+
+ @Nonnull
+ public Number toJavaLangNumber() {
+ int flags = getFlags();
+ if ((flags & F_DOUBLE) != 0)
+ return doubleValue();
+ else if ((flags & F_FLOAT) != 0)
+ return floatValue();
+ else if ((flags & (F_LONG | F_LONGLONG)) != 0)
+ return longValue();
+ else if ((flags & F_INT) != 0)
+ return intValue();
+ else if (getFractionalPart() != null)
+ return doubleValue(); // .1 is a double in Java.
+ else if (getExponent() != null)
+ return doubleValue();
+ else
+ return intValue();
+ }
+
+ private int exponentValue() {
+ return Integer.parseInt(exponent, 10);
+ }
+
+ @Override
+ public int intValue() {
+ int v = integer.isEmpty() ? 0 : Integer.parseInt(integer, base);
+ if (expbase == 2)
+ v = v << exponentValue();
+ else if (expbase != 0)
+ v = (int) (v * Math.pow(expbase, exponentValue()));
+ return v;
+ }
+
+ @Override
+ public long longValue() {
+ long v = integer.isEmpty() ? 0 : Long.parseLong(integer, base);
+ if (expbase == 2)
+ v = v << exponentValue();
+ else if (expbase != 0)
+ v = (long) (v * Math.pow(expbase, exponentValue()));
+ return v;
+ }
+
+ @Override
+ public float floatValue() {
+ if (getBase() != 10)
+ return longValue();
+ return Float.parseFloat(toString());
+ }
+
+ @Override
+ public double doubleValue() {
+ if (getBase() != 10)
+ return longValue();
+ return Double.parseDouble(toString());
+ }
+
+ private boolean appendFlags(StringBuilder buf, String suffix, int flag) {
+ if ((getFlags() & flag) != flag)
+ return false;
+ buf.append(suffix);
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder buf = new StringBuilder();
+ switch (base) {
+ case 8:
+ buf.append('0');
+ break;
+ case 10:
+ break;
+ case 16:
+ buf.append("0x");
+ break;
+ case 2:
+ buf.append('b');
+ break;
+ default:
+ buf.append("[base-").append(base).append("]");
+ break;
+ }
+ buf.append(getIntegerPart());
+ if (getFractionalPart() != null)
+ buf.append('.').append(getFractionalPart());
+ if (getExponent() != null) {
+ buf.append(base > 10 ? 'p' : 'e');
+ buf.append(getExponent());
+ }
+ /*
+ if (appendFlags(buf, "ui", F_UNSIGNED | F_INT));
+ else if (appendFlags(buf, "ul", F_UNSIGNED | F_LONG));
+ else if (appendFlags(buf, "ull", F_UNSIGNED | F_LONGLONG));
+ else if (appendFlags(buf, "i", F_INT));
+ else if (appendFlags(buf, "l", F_LONG));
+ else if (appendFlags(buf, "ll", F_LONGLONG));
+ else if (appendFlags(buf, "f", F_FLOAT));
+ else if (appendFlags(buf, "d", F_DOUBLE));
+ */
+ return buf.toString();
+ }
+}
diff -Nru gluegen2-2.2.4/jcpp/src/main/java/com/jogamp/gluegen/jcpp/PreprocessorCommand.java gluegen2-2.3.2/jcpp/src/main/java/com/jogamp/gluegen/jcpp/PreprocessorCommand.java
--- gluegen2-2.2.4/jcpp/src/main/java/com/jogamp/gluegen/jcpp/PreprocessorCommand.java 1970-01-01 00:00:00.000000000 +0000
+++ gluegen2-2.3.2/jcpp/src/main/java/com/jogamp/gluegen/jcpp/PreprocessorCommand.java 2015-04-01 13:52:14.000000000 +0000
@@ -0,0 +1,44 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.jogamp.gluegen.jcpp;
+
+import javax.annotation.CheckForNull;
+import javax.annotation.Nonnull;
+
+/**
+ *
+ * @author shevek
+ */
+public enum PreprocessorCommand {
+
+ PP_DEFINE("define"),
+ PP_ELIF("elif"),
+ PP_ELSE("else"),
+ PP_ENDIF("endif"),
+ PP_ERROR("error"),
+ PP_IF("if"),
+ PP_IFDEF("ifdef"),
+ PP_IFNDEF("ifndef"),
+ PP_INCLUDE("include"),
+ PP_LINE("line"),
+ PP_PRAGMA("pragma"),
+ PP_UNDEF("undef"),
+ PP_WARNING("warning"),
+ PP_INCLUDE_NEXT("include_next"),
+ PP_IMPORT("import");
+ private final String text;
+ /* pp */ PreprocessorCommand(String text) {
+ this.text = text;
+ }
+
+ @CheckForNull
+ public static PreprocessorCommand forText(@Nonnull String text) {
+ for (PreprocessorCommand ppcmd : PreprocessorCommand.values())
+ if (ppcmd.text.equals(text))
+ return ppcmd;
+ return null;
+ }
+}
diff -Nru gluegen2-2.2.4/jcpp/src/main/java/com/jogamp/gluegen/jcpp/Preprocessor.java gluegen2-2.3.2/jcpp/src/main/java/com/jogamp/gluegen/jcpp/Preprocessor.java
--- gluegen2-2.2.4/jcpp/src/main/java/com/jogamp/gluegen/jcpp/Preprocessor.java 1970-01-01 00:00:00.000000000 +0000
+++ gluegen2-2.3.2/jcpp/src/main/java/com/jogamp/gluegen/jcpp/Preprocessor.java 2015-04-01 13:52:14.000000000 +0000
@@ -0,0 +1,2177 @@
+/*
+ * Anarres C Preprocessor
+ * Copyright (c) 2007-2008, Shevek
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package com.jogamp.gluegen.jcpp;
+
+import java.io.Closeable;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.Stack;
+import java.util.TreeMap;
+
+import javax.annotation.CheckForNull;
+import javax.annotation.Nonnull;
+
+import static com.jogamp.gluegen.jcpp.PreprocessorCommand.*;
+import static com.jogamp.gluegen.jcpp.Token.*;
+
+import com.jogamp.gluegen.Logging;
+import com.jogamp.gluegen.Logging.LoggerIf;
+import com.jogamp.gluegen.jcpp.PreprocessorListener.SourceChangeEvent;
+
+/**
+ * A C Preprocessor.
+ * The Preprocessor outputs a token stream which does not need
+ * re-lexing for C or C++. Alternatively, the output text may be
+ * reconstructed by concatenating the {@link Token#getText() text}
+ * values of the returned {@link Token Tokens}. (See
+ * {@link CppReader}, which does this.)
+ */
+/*
+ * Source file name and line number information is conveyed by lines of the form
+ *
+ * # linenum filename flags
+ *
+ * These are called linemarkers. They are inserted as needed into
+ * the output (but never within a string or character constant). They
+ * mean that the following line originated in file filename at line
+ * linenum. filename will never contain any non-printing characters;
+ * they are replaced with octal escape sequences.
+ *
+ * After the file name comes zero or more flags, which are `1', `2',
+ * `3', or `4'. If there are multiple flags, spaces separate them. Here
+ * is what the flags mean:
+ *
+ * `1'
+ * This indicates the start of a new file.
+ * `2'
+ * This indicates returning to a file (after having included another
+ * file).
+ * `3'
+ * This indicates that the following text comes from a system header
+ * file, so certain warnings should be suppressed.
+ * `4'
+ * This indicates that the following text should be treated as being
+ * wrapped in an implicit extern "C" block.
+ */
+public class Preprocessor implements Closeable {
+
+ private final LoggerIf LOG;
+
+ private static final Source INTERNAL = new Source() {
+ @Override
+ public Token token()
+ throws IOException,
+ LexerException {
+ throw new LexerException("Cannot read from " + getName());
+ }
+
+ @Override
+ public String getPath() {
+ return "";
+ }
+
+ @Override
+ public String getName() {
+ return "internal data";
+ }
+ };
+ private static final Macro __LINE__ = new Macro(INTERNAL, "__LINE__");
+ private static final Macro __FILE__ = new Macro(INTERNAL, "__FILE__");
+ private static final Macro __COUNTER__ = new Macro(INTERNAL, "__COUNTER__");
+
+ private final List
+
+
+
+
+
+
@@ -59,6 +60,8 @@
+
+
@@ -138,8 +141,10 @@
+
+
@@ -245,7 +250,6 @@
-
@@ -322,7 +326,6 @@
-
@@ -349,7 +352,6 @@
-
@@ -375,7 +377,6 @@
-
@@ -383,7 +384,6 @@
-
@@ -426,7 +426,7 @@
-
+
@@ -602,6 +602,7 @@
+
@@ -609,6 +610,7 @@
+
@@ -718,6 +720,13 @@
+
+
+
+
+
+
@@ -629,6 +659,10 @@
+
+
+
+
@@ -669,7 +703,11 @@
-
+
+
+
+
+
@@ -884,7 +922,6 @@
-
@@ -892,15 +929,11 @@
value="${java.home}/..">
-
-
-
-
+
@@ -950,6 +983,8 @@
+
+
@@ -977,6 +1012,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1055,6 +1106,8 @@
+
+
@@ -1165,16 +1218,19 @@
+
+
+
@@ -1257,6 +1325,7 @@
+
@@ -1266,6 +1335,7 @@
+
@@ -1273,6 +1343,7 @@
+
@@ -1281,6 +1352,7 @@
+
@@ -1289,6 +1361,7 @@
+
@@ -1390,6 +1463,13 @@
+
+
+
+
+
+
+
@@ -1446,8 +1526,8 @@
-
-
+
+
@@ -1469,7 +1549,7 @@
-
+
@@ -1477,25 +1557,13 @@
-
-
-
-
-
+
-
-
-
@@ -1513,19 +1581,22 @@
-
+
-
+
-
+
+
+
+
@@ -1584,7 +1655,9 @@
-
+
+
+
diff -Nru gluegen2-2.2.4/make/jogamp-androidtasks.xml gluegen2-2.3.2/make/jogamp-androidtasks.xml
--- gluegen2-2.2.4/make/jogamp-androidtasks.xml 2014-10-10 13:20:51.000000000 +0000
+++ gluegen2-2.3.2/make/jogamp-androidtasks.xml 2015-10-09 04:18:28.000000000 +0000
@@ -7,6 +7,22 @@
+
+
+
+
+
+
+
+
+ val: ${jarbasename}
+ ___: ${m.aapt.apkbasename0}
+ res: ${m.aapt.apkbasename1}
+
+
+
+
+
+
+
+
-
+
-
-
-
+
+
+
@@ -105,7 +140,7 @@
- aapt.signed @{jarbasename}: generating Android R.java from the resources...
+ aapt.signed ${m.aapt.apkbasename}: generating Android R.java from the resources...
@@ -121,7 +156,7 @@
- aapt.signed @{jarbasename}: compiling R.java...
+ aapt.signed ${m.aapt.apkbasename}: compiling R.java...
- aapt.signed @{jarbasename}: dex'ing
+ aapt.signed ${m.aapt.apkbasename}: dex'ing
@@ -153,7 +188,7 @@
- aapt.signed @{jarbasename}: packaging
+ aapt.signed ${m.aapt.apkbasename}: packaging
@@ -182,7 +217,7 @@
- aapt.signed @{jarbasename}: gen temp keystore @{keystore.alias} @ ${m.aapt.build.apk}/debug.keystore
+ aapt.signed ${m.aapt.apkbasename}: gen temp keystore @{keystore.alias} @ ${m.aapt.build.apk}/debug.keystore
@@ -211,7 +246,7 @@
- aapt.signed @{jarbasename}: signing w/ key @{keystore.alias} @ ${m.aapt.keystore.file}
+ aapt.signed ${m.aapt.apkbasename}: signing w/ key @{keystore.alias} @ ${m.aapt.keystore.file}
@@ -225,6 +236,9 @@
+
+
+
@@ -236,6 +250,9 @@
+
+
+
diff -Nru gluegen2-2.2.4/make/jogamp-fat.mf gluegen2-2.3.2/make/jogamp-fat.mf
--- gluegen2-2.2.4/make/jogamp-fat.mf 1970-01-01 00:00:00.000000000 +0000
+++ gluegen2-2.3.2/make/jogamp-fat.mf 2015-10-09 04:18:28.000000000 +0000
@@ -0,0 +1,26 @@
+Manifest-Version: 1.0
+Application-Name: JogAmp Java Bindings
+Specification-Title: JogAmp Java Bindings Specification
+Specification-Version: @BASEVERSION@
+Specification-Vendor: JogAmp Community
+Implementation-Title: JogAmp Java Bindings Fat Jar
+Implementation-Version: @VERSION@
+Implementation-Build: @BUILD_VERSION@
+Implementation-Branch: @SCM_BRANCH@
+Implementation-Commit: @SCM_COMMIT@
+Implementation-Vendor: JogAmp Community
+Implementation-URL: http://jogamp.org/
+Extension-Name: com.jogamp
+Implementation-Vendor-Id: com.jogamp
+Main-Class: jogamp.opengl.awt.VersionApplet
+Trusted-Library: true
+Permissions: all-permissions
+Application-Library-Allowable-Codebase: *
+@JAR_CODEBASE_TAG@
+
+Name: jogamp/common/
+Sealed: true
+
+Name: com/jogamp/common/
+Sealed: true
+
diff -Nru gluegen2-2.2.4/make/jogamp-fat-test.mf gluegen2-2.3.2/make/jogamp-fat-test.mf
--- gluegen2-2.2.4/make/jogamp-fat-test.mf 1970-01-01 00:00:00.000000000 +0000
+++ gluegen2-2.3.2/make/jogamp-fat-test.mf 2015-10-09 04:18:28.000000000 +0000
@@ -0,0 +1,20 @@
+Manifest-Version: 1.0
+Application-Name: JogAmp Java Bindings Test
+Specification-Title: JogAmp Java Bindings Specification Test
+Specification-Version: @BASEVERSION@
+Specification-Vendor: JogAmp Community
+Implementation-Title: JogAmp Java Bindings Fat Test Jar
+Implementation-Version: @VERSION@
+Implementation-Build: @BUILD_VERSION@
+Implementation-Branch: @SCM_BRANCH@
+Implementation-Commit: @SCM_COMMIT@
+Implementation-Vendor: JogAmp Community
+Implementation-URL: http://jogamp.org/
+Extension-Name: com.jogamp
+Implementation-Vendor-Id: com.jogamp
+Main-Class: com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2SimpleNEWT
+Class-Path: jogamp-fat.jar
+Permissions: sandbox
+Application-Library-Allowable-Codebase: *
+@JAR_CODEBASE_TAG@
+
diff -Nru gluegen2-2.2.4/make/scripts/adb-install-all-aarch64.sh gluegen2-2.3.2/make/scripts/adb-install-all-aarch64.sh
--- gluegen2-2.2.4/make/scripts/adb-install-all-aarch64.sh 1970-01-01 00:00:00.000000000 +0000
+++ gluegen2-2.3.2/make/scripts/adb-install-all-aarch64.sh 2015-10-09 04:18:28.000000000 +0000
@@ -0,0 +1,2 @@
+adb $* install ../build-android-aarch64/jogamp-android-launcher.apk
+adb $* install ../build-android-aarch64/gluegen-rt-android-aarch64.apk
diff -Nru gluegen2-2.2.4/make/scripts/adb-install-all-armv6.sh gluegen2-2.3.2/make/scripts/adb-install-all-armv6.sh
--- gluegen2-2.2.4/make/scripts/adb-install-all-armv6.sh 2014-10-10 13:20:51.000000000 +0000
+++ gluegen2-2.3.2/make/scripts/adb-install-all-armv6.sh 2015-10-09 04:18:28.000000000 +0000
@@ -1,2 +1,2 @@
adb $* install ../build-android-armv6/jogamp-android-launcher.apk
-adb $* install ../build-android-armv6/gluegen-rt-android-armeabi.apk
+adb $* install ../build-android-armv6/gluegen-rt-android-armv6.apk
diff -Nru gluegen2-2.2.4/make/scripts/adb-install-all-armv7.sh gluegen2-2.3.2/make/scripts/adb-install-all-armv7.sh
--- gluegen2-2.2.4/make/scripts/adb-install-all-armv7.sh 2014-10-10 13:20:51.000000000 +0000
+++ gluegen2-2.3.2/make/scripts/adb-install-all-armv7.sh 1970-01-01 00:00:00.000000000 +0000
@@ -1,2 +0,0 @@
-adb $* install ../build-android-armv7/jogamp-android-launcher.apk
-adb $* install ../build-android-armv7/gluegen-rt-android-armeabi-v7a.apk
diff -Nru gluegen2-2.2.4/make/scripts/adb-reinstall-all-aarch64.sh gluegen2-2.3.2/make/scripts/adb-reinstall-all-aarch64.sh
--- gluegen2-2.2.4/make/scripts/adb-reinstall-all-aarch64.sh 1970-01-01 00:00:00.000000000 +0000
+++ gluegen2-2.3.2/make/scripts/adb-reinstall-all-aarch64.sh 2015-10-09 04:18:28.000000000 +0000
@@ -0,0 +1,5 @@
+sdir=`dirname $0`
+
+$sdir/adb-uninstall-all.sh $*
+$sdir/adb-install-all-aarch64.sh $*
+
diff -Nru gluegen2-2.2.4/make/scripts/adb-reinstall-all-armv7.sh gluegen2-2.3.2/make/scripts/adb-reinstall-all-armv7.sh
--- gluegen2-2.2.4/make/scripts/adb-reinstall-all-armv7.sh 2014-10-10 13:20:51.000000000 +0000
+++ gluegen2-2.3.2/make/scripts/adb-reinstall-all-armv7.sh 1970-01-01 00:00:00.000000000 +0000
@@ -1,5 +0,0 @@
-sdir=`dirname $0`
-
-$sdir/adb-uninstall-all.sh $*
-$sdir/adb-install-all-armv7.sh $*
-
diff -Nru gluegen2-2.2.4/make/scripts/crosstest-junit-android-armv7-rel.sh gluegen2-2.3.2/make/scripts/crosstest-junit-android-armv7-rel.sh
--- gluegen2-2.2.4/make/scripts/crosstest-junit-android-armv7-rel.sh 2014-10-10 13:20:51.000000000 +0000
+++ gluegen2-2.3.2/make/scripts/crosstest-junit-android-armv7-rel.sh 1970-01-01 00:00:00.000000000 +0000
@@ -1,69 +0,0 @@
-#! /bin/bash
-
-export HOST_UID=sven
-export HOST_IP=192.168.0.52
-export HOST_RSYNC_ROOT=PROJECTS/JOGL
-
-export TARGET_UID=jogamp
-export TARGET_IP=beagle02
-export TARGET_ROOT=/projects
-
-export BUILD_DIR=../build-android-armv7
-
-if [ -e /opt-linux-x86/android-sdk-linux_x86 ] ; then
- export ANDROID_HOME=/opt-linux-x86/android-sdk-linux_x86
- export PATH=$ANDROID_HOME/platform-tools:$PATH
-fi
-
-#
-# orig android:
-# export LD_LIBRARY_PATH /system/lib
-# export BOOTCLASSPATH /system/framework/core.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/android.policy.jar:/system/framework/services.jar:/system/framework/core-junit.jar
-#
-
-#TSTCLASS=com.jogamp.gluegen.test.junit.generation.Test1p1JavaEmitter
-TSTCLASS=com.jogamp.gluegen.test.junit.generation.Test1p2ProcAddressEmitter
-
-LOGFILE=`basename $0 .sh`.log
-
-# -Djava.class.path=lib/junit.jar:/usr/share/ant/lib/ant.jar:/usr/share/ant/lib/ant-junit.jar:$BUILD_DIR/gluegen.jar:$BUILD_DIR/test/build/gluegen-test.jar \
-# -Djava.class.path=lib/ant-junit-all.apk:$BUILD_DIR/gluegen-rt.apk \
-# -Djava.library.path=/system/lib:$TARGET_ROOT/gluegen/make/$BUILD_DIR/obj:$BUILD_DIR/test/build/natives \
-
-RSYNC_EXCLUDES="--exclude 'build-x86*/' --exclude 'build-linux*/' --exclude 'build-win*/' --exclude 'build-mac*/' \
- --exclude 'classes/' --exclude 'src/' --exclude '.git/' --exclude 'gluegen-java-src.zip' \
- --delete-excluded"
-
-echo "#! /system/bin/sh" > $BUILD_DIR/targetcommand.sh
-
-echo "\
-rsync -av --delete --delete-after $RSYNC_EXCLUDES $HOST_UID@$HOST_IP::$HOST_RSYNC_ROOT/gluegen $TARGET_ROOT ; \
-cd $TARGET_ROOT/gluegen/make ; \
-export LD_LIBRARY_PATH=/system/lib:$TARGET_ROOT/gluegen/make/$BUILD_DIR/obj:$TARGET_ROOT/gluegen/make/$BUILD_DIR/test/build/natives ; \
-export BOOTCLASSPATH=/system/framework/core.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/android.policy.jar:/system/framework/services.jar ; \
-dalvikvm \
- -Xjnigreflimit:2000 \
- -cp ../make/lib/ant-junit-all.apk:../build-android-armv7/gluegen.apk:../build-android-armv7/test/build/gluegen-test.apk \
- -Djogamp.debug.JNILibLoader=true \
- -Djogamp.debug.NativeLibrary=true \
- -Djogamp.debug.NativeLibrary.Lookup=true \
- -Djogamp.debug.ProcAddressHelper=true \
- com.android.internal.util.WithFramework \
- org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner \
- $TSTCLASS \
- filtertrace=true \
- haltOnError=false \
- haltOnFailure=false \
- showoutput=true \
- outputtoformatters=true \
- logfailedtests=true \
- logtestlistenerevents=true \
- formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter \
- formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,./TEST-result.xml \
-" >> $BUILD_DIR/targetcommand.sh
-
-chmod ugo+x $BUILD_DIR/targetcommand.sh
-adb push $BUILD_DIR/targetcommand.sh $TARGET_ROOT/targetcommand.sh
-adb shell $TARGET_ROOT/targetcommand.sh 2>&1 | tee $LOGFILE
-adb pull $TARGET_ROOT/gluegen/make/TEST-result.xml TEST-result.xml
-
diff -Nru gluegen2-2.2.4/make/scripts/java-win32.bat gluegen2-2.3.2/make/scripts/java-win32.bat
--- gluegen2-2.2.4/make/scripts/java-win32.bat 2014-10-10 13:20:51.000000000 +0000
+++ gluegen2-2.3.2/make/scripts/java-win32.bat 2015-10-09 04:18:28.000000000 +0000
@@ -1,21 +1,24 @@
set BLD_SUB=build-win32
-set J2RE_HOME=c:\jre1.7.0_67_x32
-set JAVA_HOME=c:\jdk1.7.0_67_x32
+set J2RE_HOME=c:\jre1.8.0_60_x32
+set JAVA_HOME=c:\jdk1.8.0_60_x32
set ANT_PATH=C:\apache-ant-1.9.4
set BLD_DIR=..\%BLD_SUB%
REM set LIB_DIR=..\%BLD_SUB%\obj;..\%BLD_SUB%\test\build\natives
-set LIB_DIR=..\%BLD_SUB%\test\build\natives
+REM set LIB_DIR=..\%BLD_SUB%\test\build\natives
-set PATH=%JAVA_HOME%\bin;%ANT_PATH%\bin;c:\mingw\bin;%LIB_DIR%;%PATH%
+REM set PATH=%JAVA_HOME%\bin;%ANT_PATH%\bin;c:\mingw\bin;%LIB_DIR%;%PATH%
+set PATH=%JAVA_HOME%\bin;%ANT_PATH%\bin;c:\mingw\bin;%PATH%
set CP_ALL=.;lib\junit.jar;%ANT_PATH%\lib\ant.jar;%ANT_PATH%\lib\ant-junit.jar;lib/semantic-versioning/semver.jar;%BLD_DIR%\gluegen-rt.jar;%BLD_DIR%\gluegen.jar;%BLD_DIR%\gluegen-test-util.jar;%BLD_DIR%\test\build\gluegen-test.jar
echo CP_ALL %CP_ALL%
-set D_ARGS="-Djogamp.debug.Platform" "-Djogamp.debug.NativeLibrary"
-REM set D_ARGS="-Djogamp.debug.IOUtil"
+set X_ARGS="-Drootrel.build=%BLD_SUB%" "-Dgluegen.root=.."
+REM set D_ARGS="-Djogamp.debug.Platform" "-Djogamp.debug.NativeLibrary"
+set D_ARGS="-Djogamp.debug.IOUtil" "-Djogamp.debug.IOUtil.Exe"
REM set D_ARGS="-Djogamp.debug=all"
-%J2RE_HOME%\bin\java -classpath %CP_ALL% %D_ARGS% "-Djava.library.path=%LIB_DIR%" "-Dsun.java2d.noddraw=true" "-Dsun.awt.noerasebackground=true" %1 %2 %3 %4 %5 %6 %7 %8 %9 > java-win32.log 2>&1
+REM %J2RE_HOME%\bin\java -classpath %CP_ALL% %X_ARGS% %D_ARGS% "-Djava.library.path=%LIB_DIR%" "-Dsun.java2d.noddraw=true" "-Dsun.awt.noerasebackground=true" %1 %2 %3 %4 %5 %6 %7 %8 %9 > java-win32.log 2>&1
+%J2RE_HOME%\bin\java -classpath %CP_ALL% %X_ARGS% %D_ARGS% "-Dsun.java2d.noddraw=true" "-Dsun.awt.noerasebackground=true" %1 %2 %3 %4 %5 %6 %7 %8 %9 > java-win32.log 2>&1
diff -Nru gluegen2-2.2.4/make/scripts/java-win64.bat gluegen2-2.3.2/make/scripts/java-win64.bat
--- gluegen2-2.2.4/make/scripts/java-win64.bat 2014-10-10 13:20:51.000000000 +0000
+++ gluegen2-2.3.2/make/scripts/java-win64.bat 2015-10-09 04:18:28.000000000 +0000
@@ -1,23 +1,26 @@
set BLD_SUB=build-win64
-set J2RE_HOME=c:\jre1.7.0_67_x64
-set JAVA_HOME=c:\jdk1.7.0_67_x64
+set J2RE_HOME=c:\jre1.8.0_60_x64
+set JAVA_HOME=c:\jdk1.8.0_60_x64
set ANT_PATH=C:\apache-ant-1.9.4
set BLD_DIR=..\%BLD_SUB%
REM set LIB_DIR=..\%BLD_SUB%\obj;..\%BLD_SUB%\test\build\natives
-set LIB_DIR=..\%BLD_SUB%\test\build\natives
+REM set LIB_DIR=..\%BLD_SUB%\test\build\natives
-set PATH=%JAVA_HOME%\bin;%ANT_PATH%\bin;c:\mingw\bin;%LIB_DIR%;%PATH%
+REM set PATH=%JAVA_HOME%\bin;%ANT_PATH%\bin;c:\mingw\bin;%LIB_DIR%;%PATH%
+set PATH=%JAVA_HOME%\bin;%ANT_PATH%\bin;c:\mingw\bin;%PATH%
-set CP_ALL=.;lib\junit.jar;%ANT_PATH%\lib\ant.jar;%ANT_PATH%\lib\ant-junit.jar;lib/semantic-versioning/semver.jar;%BLD_DIR%\gluegen-rt.jar;%BLD_DIR%\gluegen.jar;%BLD_DIR%\gluegen-test-util.jar;%BLD_DIR%\test\build\gluegen-test.jar
+set CP_ALL=.;lib\junit.jar;%ANT_PATH%\lib\ant.jar;%ANT_PATH%\lib\ant-junit.jar;lib/semantic-versioning/semver.jar;lib\TestJarsInJar.jar;%BLD_DIR%\gluegen-rt.jar;%BLD_DIR%\gluegen.jar;%BLD_DIR%\gluegen-test-util.jar;%BLD_DIR%\test\build\gluegen-test.jar
echo CP_ALL %CP_ALL%
-set D_ARGS="-Djogamp.debug.IOUtil" "-Djogamp.debug.JNILibLoader" "-Djogamp.debug.TempFileCache" "-Djogamp.debug.JarUtil" "-Djogamp.debug.TempJarCache"
+set X_ARGS="-Drootrel.build=%BLD_SUB%" "-Dgluegen.root=.."
+REM set D_ARGS="-Djogamp.debug.IOUtil" "-Djogamp.debug.JNILibLoader" "-Djogamp.debug.TempFileCache" "-Djogamp.debug.JarUtil" "-Djogamp.debug.TempJarCache"
REM set D_ARGS="-Djogamp.debug.Platform" "-Djogamp.debug.NativeLibrary" "-Djogamp.debug.IOUtil"
-REM set D_ARGS="-Djogamp.debug.IOUtil"
+set D_ARGS="-Djogamp.debug.IOUtil" "-Djogamp.debug.IOUtil.Exe" "-Djogamp.debug.IOUtil.Exe.NoStream"
REM set D_ARGS="-Djogamp.debug=all"
-%J2RE_HOME%\bin\java -classpath %CP_ALL% %D_ARGS% "-Djava.library.path=%LIB_DIR%" "-Dsun.java2d.noddraw=true" "-Dsun.awt.noerasebackground=true" %1 %2 %3 %4 %5 %6 %7 %8 %9 > java-win64.log 2>&1
+REM %J2RE_HOME%\bin\java -classpath %CP_ALL% %X_ARGS% %D_ARGS% "-Djava.library.path=%LIB_DIR%" "-Dsun.java2d.noddraw=true" "-Dsun.awt.noerasebackground=true" %1 %2 %3 %4 %5 %6 %7 %8 %9 > java-win64.log 2>&1
+%J2RE_HOME%\bin\java -classpath %CP_ALL% %X_ARGS% %D_ARGS% "-Dsun.java2d.noddraw=true" "-Dsun.awt.noerasebackground=true" %1 %2 %3 %4 %5 %6 %7 %8 %9 > java-win64.log 2>&1
diff -Nru gluegen2-2.2.4/make/scripts/make.gluegen.all.android-aarch64-cross.sh gluegen2-2.3.2/make/scripts/make.gluegen.all.android-aarch64-cross.sh
--- gluegen2-2.2.4/make/scripts/make.gluegen.all.android-aarch64-cross.sh 1970-01-01 00:00:00.000000000 +0000
+++ gluegen2-2.3.2/make/scripts/make.gluegen.all.android-aarch64-cross.sh 2015-10-09 04:18:28.000000000 +0000
@@ -0,0 +1,62 @@
+#! /bin/sh
+
+SDIR=`dirname $0`
+
+if [ -e $SDIR/setenv-build-jogl-x86_64.sh ] ; then
+ . $SDIR/setenv-build-jogl-x86_64.sh
+fi
+
+if [ -e $SDIR/setenv-android-tools.sh ] ; then
+ . $SDIR/setenv-android-tools.sh
+fi
+
+export NODE_LABEL=.
+
+export HOST_UID=jogamp
+# jogamp02 - 10.1.0.122
+export HOST_IP=10.1.0.122
+export HOST_RSYNC_ROOT=PROJECTS/JOGL
+
+export TARGET_UID=jogamp
+export TARGET_IP=panda02
+#export TARGET_IP=jautab03
+#export TARGET_IP=jauphone04
+export TARGET_ADB_PORT=5555
+# needs executable bit (probably su)
+export TARGET_ROOT=/data/projects
+export TARGET_ANT_HOME=/usr/share/ant
+
+export ANDROID_VERSION=21
+export SOURCE_LEVEL=1.6
+export TARGET_LEVEL=1.6
+export TARGET_RT_JAR=/opt-share/jre1.6.0_30/lib/rt.jar
+
+#export GCC_VERSION=4.4.3
+export GCC_VERSION=4.9
+HOST_ARCH=linux-x86_64
+export TARGET_TRIPLE=aarch64-linux-android
+
+export NDK_TOOLCHAIN_ROOT=$NDK_ROOT/toolchains/${TARGET_TRIPLE}-${GCC_VERSION}/prebuilt/${HOST_ARCH}
+export TARGET_PLATFORM_ROOT=${NDK_ROOT}/platforms/android-${ANDROID_VERSION}/arch-arm64
+
+# Need to add toolchain bins to the PATH.
+# May need to create symbolic links within $NDK_TOOLCHAIN_ROOT/$TARGET_TRIPLE/bin
+# cd $NDK_TOOLCHAIN_ROOT/$TARGET_TRIPLE/bin
+# ln -s ../../bin/aarch64-linux-android-gcc gcc
+export PATH="$NDK_TOOLCHAIN_ROOT/$TARGET_TRIPLE/bin:$ANDROID_HOME/platform-tools:$ANDROID_HOME/build-tools/$ANDROID_BUILD_TOOLS_VERSION:$PATH"
+
+export GLUEGEN_CPPTASKS_FILE="lib/gluegen-cpptasks-android-aarch64.xml"
+
+#export JUNIT_DISABLED="true"
+#export JUNIT_RUN_ARG0="-Dnewt.test.Screen.disableScreenMode"
+
+echo PATH $PATH 2>&1 | tee make.gluegen.all.android-aarch64-cross.log
+echo gcc `which gcc` 2>&1 | tee -a make.gluegen.all.android-aarch64-cross.log
+
+#export JOGAMP_JAR_CODEBASE="Codebase: *.jogamp.org"
+export JOGAMP_JAR_CODEBASE="Codebase: *.goethel.localnet"
+
+#BUILD_ARCHIVE=true \
+ant \
+ -Drootrel.build=build-android-aarch64 \
+ $* 2>&1 | tee -a make.gluegen.all.android-aarch64-cross.log
diff -Nru gluegen2-2.2.4/make/scripts/make.gluegen.all.android-armv6-cross.sh gluegen2-2.3.2/make/scripts/make.gluegen.all.android-armv6-cross.sh
--- gluegen2-2.2.4/make/scripts/make.gluegen.all.android-armv6-cross.sh 2014-10-10 13:20:51.000000000 +0000
+++ gluegen2-2.3.2/make/scripts/make.gluegen.all.android-armv6-cross.sh 2015-10-09 04:18:28.000000000 +0000
@@ -6,6 +6,10 @@
. $SDIR/setenv-build-jogl-x86_64.sh
fi
+if [ -e $SDIR/setenv-android-tools.sh ] ; then
+ . $SDIR/setenv-android-tools.sh
+fi
+
export NODE_LABEL=.
export HOST_UID=jogamp
@@ -22,70 +26,21 @@
export TARGET_ROOT=/data/projects
export TARGET_ANT_HOME=/usr/share/ant
-echo ANDROID_HOME $ANDROID_HOME
-echo NDK_ROOT $NDK_ROOT
-
-if [ -z "$NDK_ROOT" ] ; then
- #
- # Generic android-ndk
- #
- if [ -e /usr/local/android-ndk ] ; then
- NDK_ROOT=/usr/local/android-ndk
- elif [ -e /opt-linux-x86/android-ndk ] ; then
- NDK_ROOT=/opt-linux-x86/android-ndk
- elif [ -e /opt/android-ndk ] ; then
- NDK_ROOT=/opt/android-ndk
- #
- # Specific android-ndk-r8d
- #
- elif [ -e /usr/local/android-ndk-r8d ] ; then
- NDK_ROOT=/usr/local/android-ndk-r8d
- elif [ -e /opt-linux-x86/android-ndk-r8d ] ; then
- NDK_ROOT=/opt-linux-x86/android-ndk-r8d
- elif [ -e /opt/android-ndk-r8d ] ; then
- NDK_ROOT=/opt/android-ndk-r8d
- else
- echo NDK_ROOT is not specified and does not exist in default locations
- exit 1
- fi
-elif [ ! -e $NDK_ROOT ] ; then
- echo NDK_ROOT $NDK_ROOT does not exist
- exit 1
-fi
-export NDK_ROOT
-
-if [ -z "$ANDROID_HOME" ] ; then
- if [ -e /usr/local/android-sdk-linux_x86 ] ; then
- ANDROID_HOME=/usr/local/android-sdk-linux_x86
- elif [ -e /opt-linux-x86/android-sdk-linux_x86 ] ; then
- ANDROID_HOME=/opt-linux-x86/android-sdk-linux_x86
- elif [ -e /opt/android-sdk-linux_x86 ] ; then
- ANDROID_HOME=/opt/android-sdk-linux_x86
- else
- echo ANDROID_HOME is not specified and does not exist in default locations
- exit 1
- fi
-elif [ ! -e $ANDROID_HOME ] ; then
- echo ANDROID_HOME $ANDROID_HOME does not exist
- exit 1
-fi
-export ANDROID_HOME
-
export ANDROID_VERSION=9
export SOURCE_LEVEL=1.6
export TARGET_LEVEL=1.6
export TARGET_RT_JAR=/opt-share/jre1.6.0_30/lib/rt.jar
#export GCC_VERSION=4.4.3
-export GCC_VERSION=4.7
-HOST_ARCH=linux-x86
+export GCC_VERSION=4.8
+HOST_ARCH=linux-x86_64
export TARGET_TRIPLE=arm-linux-androideabi
export NDK_TOOLCHAIN_ROOT=$NDK_ROOT/toolchains/${TARGET_TRIPLE}-${GCC_VERSION}/prebuilt/${HOST_ARCH}
export TARGET_PLATFORM_ROOT=${NDK_ROOT}/platforms/android-${ANDROID_VERSION}/arch-arm
# Need to add toolchain bins to the PATH.
-export PATH="$NDK_TOOLCHAIN_ROOT/$TARGET_TRIPLE/bin:$ANDROID_HOME/platform-tools:$ANDROID_HOME/build-tools/17.0.0:$PATH"
+export PATH="$NDK_TOOLCHAIN_ROOT/$TARGET_TRIPLE/bin:$ANDROID_HOME/platform-tools:$ANDROID_HOME/build-tools/$ANDROID_BUILD_TOOLS_VERSION:$PATH"
export GLUEGEN_CPPTASKS_FILE="lib/gluegen-cpptasks-android-armv6.xml"
diff -Nru gluegen2-2.2.4/make/scripts/make.gluegen.all.android-armv7-cross.sh gluegen2-2.3.2/make/scripts/make.gluegen.all.android-armv7-cross.sh
--- gluegen2-2.2.4/make/scripts/make.gluegen.all.android-armv7-cross.sh 2014-10-10 13:20:51.000000000 +0000
+++ gluegen2-2.3.2/make/scripts/make.gluegen.all.android-armv7-cross.sh 1970-01-01 00:00:00.000000000 +0000
@@ -1,101 +0,0 @@
-#! /bin/sh
-
-if [ -e $SDIR/setenv-build-jogl-x86_64.sh ] ; then
- . $SDIR/setenv-build-jogl-x86_64.sh
-fi
-
-export NODE_LABEL=.
-
-export HOST_UID=jogamp
-# jogamp02 - 10.1.0.122
-export HOST_IP=10.1.0.122
-export HOST_RSYNC_ROOT=PROJECTS/JOGL
-
-export TARGET_UID=jogamp
-export TARGET_IP=panda02
-#export TARGET_IP=jautab03
-#export TARGET_IP=jauphone04
-export TARGET_ADB_PORT=5555
-# needs executable bit (probably su)
-export TARGET_ROOT=/data/projects
-export TARGET_ANT_HOME=/usr/share/ant
-
-echo ANDROID_HOME $ANDROID_HOME
-echo NDK_ROOT $NDK_ROOT
-
-if [ -z "$NDK_ROOT" ] ; then
- #
- # Generic android-ndk
- #
- if [ -e /usr/local/android-ndk ] ; then
- NDK_ROOT=/usr/local/android-ndk
- elif [ -e /opt-linux-x86/android-ndk ] ; then
- NDK_ROOT=/opt-linux-x86/android-ndk
- elif [ -e /opt/android-ndk ] ; then
- NDK_ROOT=/opt/android-ndk
- #
- # Specific android-ndk-r8d
- #
- elif [ -e /usr/local/android-ndk-r8d ] ; then
- NDK_ROOT=/usr/local/android-ndk-r8d
- elif [ -e /opt-linux-x86/android-ndk-r8d ] ; then
- NDK_ROOT=/opt-linux-x86/android-ndk-r8d
- elif [ -e /opt/android-ndk-r8d ] ; then
- NDK_ROOT=/opt/android-ndk-r8d
- else
- echo NDK_ROOT is not specified and does not exist in default locations
- exit 1
- fi
-elif [ ! -e $NDK_ROOT ] ; then
- echo NDK_ROOT $NDK_ROOT does not exist
- exit 1
-fi
-export NDK_ROOT
-
-if [ -z "$ANDROID_HOME" ] ; then
- if [ -e /usr/local/android-sdk-linux_x86 ] ; then
- ANDROID_HOME=/usr/local/android-sdk-linux_x86
- elif [ -e /opt-linux-x86/android-sdk-linux_x86 ] ; then
- ANDROID_HOME=/opt-linux-x86/android-sdk-linux_x86
- elif [ -e /opt/android-sdk-linux_x86 ] ; then
- ANDROID_HOME=/opt/android-sdk-linux_x86
- else
- echo ANDROID_HOME is not specified and does not exist in default locations
- exit 1
- fi
-elif [ ! -e $ANDROID_HOME ] ; then
- echo ANDROID_HOME $ANDROID_HOME does not exist
- exit 1
-fi
-export ANDROID_HOME
-
-export ANDROID_VERSION=9
-export SOURCE_LEVEL=1.6
-export TARGET_LEVEL=1.6
-export TARGET_RT_JAR=/opt-share/jre1.6.0_30/lib/rt.jar
-
-#export GCC_VERSION=4.4.3
-export GCC_VERSION=4.7
-HOST_ARCH=linux-x86
-export TARGET_TRIPLE=arm-linux-androideabi
-
-export NDK_TOOLCHAIN_ROOT=$NDK_ROOT/toolchains/${TARGET_TRIPLE}-${GCC_VERSION}/prebuilt/${HOST_ARCH}
-export TARGET_PLATFORM_ROOT=${NDK_ROOT}/platforms/android-${ANDROID_VERSION}/arch-arm
-
-# Need to add toolchain bins to the PATH.
-export PATH="$NDK_TOOLCHAIN_ROOT/$TARGET_TRIPLE/bin:$ANDROID_HOME/platform-tools:$PATH"
-
-export GLUEGEN_CPPTASKS_FILE="lib/gluegen-cpptasks-android-armv7.xml"
-
-#export JUNIT_DISABLED="true"
-#export JUNIT_RUN_ARG0="-Dnewt.test.Screen.disableScreenMode"
-
-which gcc 2>&1 | tee make.gluegen.all.android-armv7-cross.log
-
-#export JOGAMP_JAR_CODEBASE="Codebase: *.jogamp.org"
-export JOGAMP_JAR_CODEBASE="Codebase: *.goethel.localnet"
-
-#BUILD_ARCHIVE=true \
-ant \
- -Drootrel.build=build-android-armv7 \
- $* 2>&1 | tee -a make.gluegen.all.android-armv7-cross.log
diff -Nru gluegen2-2.2.4/make/scripts/make.gluegen.all.macosx-java6.sh gluegen2-2.3.2/make/scripts/make.gluegen.all.macosx-java6.sh
--- gluegen2-2.2.4/make/scripts/make.gluegen.all.macosx-java6.sh 1970-01-01 00:00:00.000000000 +0000
+++ gluegen2-2.3.2/make/scripts/make.gluegen.all.macosx-java6.sh 2015-10-09 04:18:28.000000000 +0000
@@ -0,0 +1,29 @@
+#! /bin/sh
+
+if [ -e /opt-share/etc/profile.ant ] ; then
+ . /opt-share/etc/profile.ant
+fi
+
+# -Dc.compiler.debug=true
+#
+# -Dtarget.sourcelevel=1.6 \
+# -Dtarget.targetlevel=1.6 \
+# -Dtarget.rt.jar=/opt-share/jre1.6.0_30/lib/rt.jar \
+
+# Force OSX SDK 10.6, if desired
+# export SDKROOT=macosx10.6
+
+JAVA_HOME=`/usr/libexec/java_home -version 1.6`
+PATH=$JAVA_HOME/bin:$PATH
+export JAVA_HOME PATH
+
+export SOURCE_LEVEL=1.6
+export TARGET_LEVEL=1.6
+export TARGET_RT_JAR=/opt-share/jre1.6.0_30/lib/rt.jar
+
+#export JOGAMP_JAR_CODEBASE="Codebase: *.jogamp.org"
+export JOGAMP_JAR_CODEBASE="Codebase: *.goethel.localnet"
+
+ant \
+ -Drootrel.build=build-macosx-java6 \
+ $* 2>&1 | tee make.gluegen.all.macosx-java6.log
diff -Nru gluegen2-2.2.4/make/scripts/make.gluegen.all.macosx-java7.sh gluegen2-2.3.2/make/scripts/make.gluegen.all.macosx-java7.sh
--- gluegen2-2.2.4/make/scripts/make.gluegen.all.macosx-java7.sh 2014-10-10 13:20:51.000000000 +0000
+++ gluegen2-2.3.2/make/scripts/make.gluegen.all.macosx-java7.sh 1970-01-01 00:00:00.000000000 +0000
@@ -1,22 +0,0 @@
-#! /bin/sh
-
-if [ -e /opt-share/etc/profile.ant ] ; then
- . /opt-share/etc/profile.ant
-fi
-
-# -Dc.compiler.debug=true
-#
-# -Dtarget.sourcelevel=1.6 \
-# -Dtarget.targetlevel=1.6 \
-# -Dtarget.rt.jar=/opt-share/jre1.6.0_30/lib/rt.jar \
-
-JAVA_HOME=`/usr/libexec/java_home -version 1.7`
-PATH=$JAVA_HOME/bin:$PATH
-export JAVA_HOME PATH
-
-#export JOGAMP_JAR_CODEBASE="Codebase: *.jogamp.org"
-export JOGAMP_JAR_CODEBASE="Codebase: *.goethel.localnet"
-
-ant \
- -Drootrel.build=build-macosx-java7 \
- $* 2>&1 | tee make.gluegen.all.macosx-java7.log
diff -Nru gluegen2-2.2.4/make/scripts/make.gluegen.all.macosx.sh gluegen2-2.3.2/make/scripts/make.gluegen.all.macosx.sh
--- gluegen2-2.2.4/make/scripts/make.gluegen.all.macosx.sh 2014-10-10 13:20:51.000000000 +0000
+++ gluegen2-2.3.2/make/scripts/make.gluegen.all.macosx.sh 2015-10-09 04:18:28.000000000 +0000
@@ -10,7 +10,10 @@
# -Dtarget.targetlevel=1.6 \
# -Dtarget.rt.jar=/opt-share/jre1.6.0_30/lib/rt.jar \
-JAVA_HOME=`/usr/libexec/java_home -version 1.7`
+# Force OSX SDK 10.6, if desired
+# export SDKROOT=macosx10.6
+
+JAVA_HOME=`/usr/libexec/java_home -version 1.8`
PATH=$JAVA_HOME/bin:$PATH
export JAVA_HOME PATH
diff -Nru gluegen2-2.2.4/make/scripts/make.gluegen.all.win32.bat gluegen2-2.3.2/make/scripts/make.gluegen.all.win32.bat
--- gluegen2-2.2.4/make/scripts/make.gluegen.all.win32.bat 2014-10-10 13:20:51.000000000 +0000
+++ gluegen2-2.3.2/make/scripts/make.gluegen.all.win32.bat 2015-10-09 04:18:28.000000000 +0000
@@ -1,7 +1,7 @@
set THISDIR="C:\JOGL"
-set J2RE_HOME=c:\jre1.8.0_20_x32
-set JAVA_HOME=c:\jdk1.8.0_20_x32
+set J2RE_HOME=c:\jre1.8.0_60_x32
+set JAVA_HOME=c:\jdk1.8.0_60_x32
set ANT_PATH=C:\apache-ant-1.9.4
set PATH=%JAVA_HOME%\bin;%ANT_PATH%\bin;c:\mingw\bin;%PATH%
diff -Nru gluegen2-2.2.4/make/scripts/make.gluegen.all.win64.bat gluegen2-2.3.2/make/scripts/make.gluegen.all.win64.bat
--- gluegen2-2.2.4/make/scripts/make.gluegen.all.win64.bat 2014-10-10 13:20:51.000000000 +0000
+++ gluegen2-2.3.2/make/scripts/make.gluegen.all.win64.bat 2015-10-09 04:18:28.000000000 +0000
@@ -1,7 +1,7 @@
set THISDIR="C:\JOGL"
-set J2RE_HOME=c:\jre1.8.0_20_x64
-set JAVA_HOME=c:\jdk1.8.0_20_x64
+set J2RE_HOME=c:\jre1.8.0_60_x64
+set JAVA_HOME=c:\jdk1.8.0_60_x64
set ANT_PATH=C:\apache-ant-1.9.4
set PATH=%JAVA_HOME%\bin;%ANT_PATH%\bin;c:\mingw64\bin;c:\mingw\bin;%PATH%
diff -Nru gluegen2-2.2.4/make/scripts/runtest.sh gluegen2-2.3.2/make/scripts/runtest.sh
--- gluegen2-2.2.4/make/scripts/runtest.sh 2014-10-10 13:20:51.000000000 +0000
+++ gluegen2-2.3.2/make/scripts/runtest.sh 2015-10-09 04:18:28.000000000 +0000
@@ -39,6 +39,10 @@
LOG=runtest.log
rm -f $LOG
+GLUEGEN_ROOT=`dirname $builddir`
+ROOTREL_BUILD=`basename $builddir`
+
+X_ARGS="-Drootrel.build=$ROOTREL_BUILD -Dgluegen.root=$GLUEGEN_ROOT"
#D_ARGS="-Djogamp.debug.ProcAddressHelper -Djogamp.debug.NativeLibrary -Djogamp.debug.NativeLibrary.Lookup"
#D_ARGS="-Djogamp.debug.TraceLock"
#D_ARGS="-Djogamp.debug.Platform -Djogamp.debug.NativeLibrary"
@@ -46,16 +50,22 @@
#D_ARGS="-Djogamp.debug.TempJarCache"
#D_ARGS="-Djogamp.debug.TempFileCache"
#D_ARGS="-Djogamp.debug.IOUtil -Djogamp.debug.JNILibLoader -Djogamp.debug.TempFileCache -Djogamp.debug.JarUtil -Djava.io.tmpdir=/run/tmp"
-D_ARGS="-Djogamp.debug.IOUtil -Djogamp.debug.JNILibLoader -Djogamp.debug.TempFileCache -Djogamp.debug.JarUtil -Djogamp.debug.TempJarCache"
+#D_ARGS="-Djogamp.debug.IOUtil -Djogamp.debug.JNILibLoader -Djogamp.debug.TempFileCache -Djogamp.debug.JarUtil -Djogamp.debug.TempJarCache"
+#D_ARGS="-Djogamp.debug.IOUtil -Djogamp.debug.JarUtil -Djogamp.debug.TempJarCache -Djogamp.debug.Uri -Djogamp.debug.Uri.ShowFix"
+#D_ARGS="-Djogamp.debug.Uri -Djogamp.debug.Uri.ShowFix"
#D_ARGS="-Djogamp.debug.JNILibLoader -Djogamp.gluegen.UseTempJarCache=false"
#D_ARGS="-Djogamp.debug.JNILibLoader -Djogamp.debug.TempJarCache"
#D_ARGS="-Djogamp.debug.JNILibLoader"
+#D_ARGS="-Djogamp.debug.JNILibLoader.Perf"
#D_ARGS="-Djogamp.debug.Lock"
#D_ARGS="-Djogamp.debug.Lock -Djogamp.debug.Lock.TraceLock"
#D_ARGS="-Djogamp.debug.Lock.TraceLock"
-#D_ARGS="-Djogamp.debug.IOUtil"
+#D_ARGS="-Djogamp.debug.IOUtil -Djogamp.debug.IOUtil.Exe -Djogamp.debug.IOUtil.Exe.NoStream"
+#D_ARGS="-Djogamp.debug.IOUtil -Djogamp.debug.IOUtil.Exe"
+#D_ARGS="-Djogamp.debug.ByteBufferInputStream"
#D_ARGS="-Djogamp.debug.Bitstream"
#D_ARGS="-Djogamp.debug=all"
+#D_ARGS="-Djogamp.debug.Logging"
function onetest() {
#USE_CLASSPATH=lib/junit.jar:$ANT_JARS:lib/semantic-versioning/semver.jar:"$builddir"/../make/lib/TestJarsInJar.jar:"$builddir"/gluegen-rt.jar:"$builddir"/gluegen.jar:"$builddir"/gluegen-test-util.jar:"$builddir"/test/build/gluegen-test.jar
@@ -70,11 +80,11 @@
echo LD_LIBRARY_PATH $LD_LIBRARY_PATH
echo USE_CLASSPATH $USE_CLASSPATH
which java
- #echo java -cp $USE_CLASSPATH $D_ARGS -Djava.library.path=$libspath $*
- #java -cp $USE_CLASSPATH $D_ARGS -Djava.library.path="$libspath" $*
- echo java -cp "$USE_CLASSPATH" $D_ARGS $*
- java -cp "$USE_CLASSPATH" $D_ARGS $*
- #j3 -cp "$USE_CLASSPATH" $D_ARGS $*
+ #echo java -cp $USE_CLASSPATH $X_ARGS $D_ARGS -Djava.library.path=$libspath $*
+ #java -cp $USE_CLASSPATH $X_ARGS $D_ARGS -Djava.library.path="$libspath" $*
+ echo java -cp "$USE_CLASSPATH" $X_ARGS $D_ARGS $*
+ java -cp "$USE_CLASSPATH" $X_ARGS $D_ARGS $*
+ #j3 -cp "$USE_CLASSPATH" $X_ARGS $D_ARGS $*
echo
}
#
@@ -92,35 +102,49 @@
#onetest com.jogamp.common.util.TestFloatStack01 2>&1 | tee -a $LOG
#onetest com.jogamp.common.util.TestIntegerStack01 2>&1 | tee -a $LOG
#onetest com.jogamp.common.util.TestArrayHashSet01 2>&1 | tee -a $LOG
+#onetest com.jogamp.common.util.TestArrayHashMap01 2>&1 | tee -a $LOG
#onetest com.jogamp.common.util.IntIntHashMapTest 2>&1 | tee -a $LOG
#onetest com.jogamp.common.util.IntObjectHashMapTest 2>&1 | tee -a $LOG
#onetest com.jogamp.common.util.LongIntHashMapTest 2>&1 | tee -a $LOG
#onetest com.jogamp.common.util.TestPlatform01 2>&1 | tee -a $LOG
#onetest com.jogamp.common.util.TestRunnableTask01 2>&1 | tee -a $LOG
-#onetest com.jogamp.common.util.TestIOUtil01 2>&1 | tee -a $LOG
-#onetest com.jogamp.common.util.TestIOUtilURICompose 2>&1 | tee -a $LOG
-#onetest com.jogamp.common.util.TestIOUtilURIHandling 2>&1 | tee -a $LOG
+onetest com.jogamp.common.util.TestIOUtil01 2>&1 | tee -a $LOG
#onetest com.jogamp.common.util.TestTempJarCache 2>&1 | tee -a $LOG
#onetest com.jogamp.common.util.TestJarUtil 2>&1 | tee -a $LOG
#onetest com.jogamp.common.util.TestValueConversion 2>&1 | tee -a $LOG
#onetest com.jogamp.common.util.TestSyncRingBuffer01 $*
#onetest com.jogamp.common.util.TestLFRingBuffer01 $*
+#onetest com.jogamp.common.util.TestBitfield00 2>&1 | tee -a $LOG
#onetest com.jogamp.common.util.TestBitstream00 2>&1 | tee -a $LOG
#onetest com.jogamp.common.util.TestBitstream01 2>&1 | tee -a $LOG
#onetest com.jogamp.common.util.TestBitstream02 2>&1 | tee -a $LOG
#onetest com.jogamp.common.util.TestBitstream03 2>&1 | tee -a $LOG
#onetest com.jogamp.common.util.TestBitstream04 2>&1 | tee -a $LOG
#onetest com.jogamp.common.net.TestUrisWithAssetHandler 2>&1 | tee -a $LOG
-#onetest com.jogamp.common.net.TestURIQueryProps 2>&1 | tee -a $LOG
+#onetest com.jogamp.common.net.TestUriQueryProps 2>&1 | tee -a $LOG
+#onetest com.jogamp.common.net.TestUri01 2>&1 | tee -a $LOG
+#onetest com.jogamp.common.net.TestUri02Composing 2>&1 | tee -a $LOG
+#onetest com.jogamp.common.net.TestUri03Resolving 2>&1 | tee -a $LOG
+#onetest com.jogamp.common.net.TestUri99LaunchOnReservedCharPathBug908 2>&1 | tee -a $LOG
#onetest com.jogamp.common.net.AssetURLConnectionUnregisteredTest 2>&1 | tee -a $LOG
#onetest com.jogamp.common.net.AssetURLConnectionRegisteredTest 2>&1 | tee -a $LOG
-onetest com.jogamp.common.net.TestNetIOURIReservedCharsBug908 2>&1 | tee -a $LOG
#onetest com.jogamp.junit.sec.TestSecIOUtil01 2>&1 | tee -a $LOG
+#onetest com.jogamp.common.nio.BuffersTest 2>&1 | tee -a $LOG
#onetest com.jogamp.common.nio.TestBuffersFloatDoubleConversion 2>&1 | tee -a $LOG
#onetest com.jogamp.common.nio.TestPointerBufferEndian 2>&1 | tee -a $LOG
#onetest com.jogamp.common.nio.TestStructAccessorEndian 2>&1 | tee -a $LOG
-#onetest com.jogamp.common.os.TestElfReader01 2>&1 | tee -a $LOG
-#onetest com.jogamp.gluegen.PCPPTest 2>&1 | tee -a $LOG
+#onetest com.jogamp.common.nio.TestByteBufferInputStream 2>&1 | tee -a $LOG
+#onetest com.jogamp.common.nio.TestByteBufferOutputStream 2>&1 | tee -a $LOG
+#onetest com.jogamp.common.nio.TestByteBufferCopyStream 2>&1 | tee -a $LOG
+#onetest com.jogamp.common.os.TestElfReader01 $* 2>&1 | tee -a $LOG
+#onetest com.jogamp.gluegen.test.junit.internals.TestType 2>&1 | tee -a $LOG
+
+#onetest com.jogamp.gluegen.test.junit.generation.PCPPTest 2>&1 | tee -a $LOG
+#onetest com.jogamp.gluegen.jcpp.IncludeAbsoluteTest 2>&1 | tee -a $LOG
+#onetest com.jogamp.gluegen.jcpp.CppReaderTest 2>&1 | tee -a $LOG
+#onetest com.jogamp.gluegen.jcpp.TokenPastingWhitespaceTest 2>&1 | tee -a $LOG
+#onetest com.jogamp.gluegen.jcpp.PreprocessorTest 2>&1 | tee -a $LOG
+
#onetest com.jogamp.gluegen.test.junit.generation.Test1p1JavaEmitter 2>&1 | tee -a $LOG
#onetest com.jogamp.gluegen.test.junit.generation.Test1p2ProcAddressEmitter 2>&1 | tee -a $LOG
#onetest com.jogamp.gluegen.test.junit.generation.Test1p2LoadJNIAndImplLib 2>&1 | tee -a $LOG
diff -Nru gluegen2-2.2.4/make/scripts/runtest-x32.bat gluegen2-2.3.2/make/scripts/runtest-x32.bat
--- gluegen2-2.2.4/make/scripts/runtest-x32.bat 2014-10-10 13:20:51.000000000 +0000
+++ gluegen2-2.3.2/make/scripts/runtest-x32.bat 2015-10-09 04:18:28.000000000 +0000
@@ -1,8 +1,16 @@
+REM set TEMP=C:\Documents and Settings\jogamp\temp-exec
+REM set TMP=C:\Documents and Settings\jogamp\temp-exec
+REM set TEMP=C:\Users\jogamp\temp-exec
+REM set TMP=C:\Users\jogamp\temp-exec
+
REM scripts\java-win32.bat com.jogamp.common.GlueGenVersion
REM scripts\java-win32.bat com.jogamp.common.util.TestVersionInfo
REM scripts\java-win32.bat com.jogamp.gluegen.test.junit.generation.Test1p1JavaEmitter
REM scripts\java-win32.bat com.jogamp.gluegen.test.junit.generation.Test1p2ProcAddressEmitter
-scripts\java-win32.bat com.jogamp.common.util.TestTempJarCache
+REM scripts\java-win32.bat com.jogamp.common.util.TestTempJarCache
+scripts\java-win32.bat com.jogamp.common.util.TestPlatform01
REM scripts\java-win32.bat com.jogamp.common.os.TestElfReader01
REM scripts\java-win32.bat com.jogamp.common.util.TestIOUtilURIHandling
+REM scripts\java-win32.bat com.jogamp.common.nio.TestByteBufferInputStream
+REM scripts\java-win32.bat com.jogamp.common.nio.TestByteBufferOutputStream
diff -Nru gluegen2-2.2.4/make/scripts/runtest-x64.bat gluegen2-2.3.2/make/scripts/runtest-x64.bat
--- gluegen2-2.2.4/make/scripts/runtest-x64.bat 2014-10-10 13:20:51.000000000 +0000
+++ gluegen2-2.3.2/make/scripts/runtest-x64.bat 2015-10-09 04:18:28.000000000 +0000
@@ -1,15 +1,27 @@
+REM set TEMP=C:\Documents and Settings\jogamp\temp-exec
+REM set TMP=C:\Documents and Settings\jogamp\temp-exec
+REM set TEMP=C:\Users\jogamp\temp-exec
+REM set TMP=C:\Users\jogamp\temp-exec
+
REM scripts\java-win64.bat com.jogamp.common.GlueGenVersion
REM scripts\java-win64.bat com.jogamp.common.util.TestVersionInfo
+
+REM scripts\java-win64.bat com.jogamp.gluegen.jcpp.IncludeAbsoluteTest
+
REM scripts\java-win64.bat com.jogamp.gluegen.test.junit.generation.Test1p1JavaEmitter
REM scripts\java-win64.bat com.jogamp.gluegen.test.junit.generation.Test1p2ProcAddressEmitter
REM scripts\java-win64.bat com.jogamp.common.util.TestTempJarCache
REM scripts\java-win64.bat com.jogamp.common.os.TestElfReader01
+scripts\java-win64.bat com.jogamp.common.util.TestPlatform01
REM scripts\java-win64.bat com.jogamp.common.util.TestIOUtil01
-REM scripts\java-win64.bat com.jogamp.common.util.TestIOUtilURICompose
-REM scripts\java-win64.bat com.jogamp.common.util.TestIOUtilURIHandling
+REM scripts\java-win64.bat com.jogamp.common.util.TestJarUtil
REM scripts\java-win64.bat com.jogamp.common.net.TestUrisWithAssetHandler
REM scripts\java-win64.bat com.jogamp.common.net.TestURIQueryProps
-scripts\java-win64.bat com.jogamp.common.net.TestNetIOURIReservedCharsBug908
-REM scripts\java-win64.bat com.jogamp.common.util.TestIOUtilURIHandling
+REM scripts\java-win64.bat com.jogamp.common.net.TestUri01
+REM scripts\java-win64.bat com.jogamp.common.net.TestUri02Composing
+REM scripts\java-win64.bat com.jogamp.common.net.TestUri03Resolving
+REM scripts\java-win64.bat com.jogamp.common.net.TestUri99LaunchOnReservedCharPathBug908
+REM scripts\java-win64.bat com.jogamp.common.nio.TestByteBufferInputStream
+REM scripts\java-win64.bat com.jogamp.common.nio.TestByteBufferOutputStream
diff -Nru gluegen2-2.2.4/make/scripts/setenv-android-tools.sh gluegen2-2.3.2/make/scripts/setenv-android-tools.sh
--- gluegen2-2.2.4/make/scripts/setenv-android-tools.sh 1970-01-01 00:00:00.000000000 +0000
+++ gluegen2-2.3.2/make/scripts/setenv-android-tools.sh 2015-10-09 04:18:28.000000000 +0000
@@ -0,0 +1,79 @@
+#! /bin/sh
+
+echo $0
+
+echo Presets
+echo NDK_ROOT $NDK_ROOT
+echo ANDROID_HOME $ANDROID_HOME
+echo ANDROID_BUILD_TOOLS_VERSION $ANDROID_BUILD_TOOLS_VERSION
+
+if [ -z "$NDK_ROOT" ] ; then
+ #
+ # Generic android-ndk
+ #
+ if [ -e /usr/local/android-ndk ] ; then
+ NDK_ROOT=/usr/local/android-ndk
+ elif [ -e /opt-linux-x86_64/android-ndk ] ; then
+ NDK_ROOT=/opt-linux-x86_64/android-ndk
+ elif [ -e /opt-linux-x86/android-ndk ] ; then
+ NDK_ROOT=/opt-linux-x86/android-ndk
+ elif [ -e /opt/android-ndk ] ; then
+ NDK_ROOT=/opt/android-ndk
+ #
+ # Specific android-ndk-r10d
+ #
+ elif [ -e /usr/local/android-ndk-r10d ] ; then
+ NDK_ROOT=/usr/local/android-ndk-r10d
+ elif [ -e /opt-linux-x86_64/android-ndk-r10d ] ; then
+ NDK_ROOT=/opt-linux-x86_64/android-ndk-r10d
+ elif [ -e /opt-linux-x86/android-ndk-r10d ] ; then
+ NDK_ROOT=/opt-linux-x86/android-ndk-r10d
+ elif [ -e /opt/android-ndk-r10d ] ; then
+ NDK_ROOT=/opt/android-ndk-r10d
+ else
+ echo NDK_ROOT is not specified and does not exist in default locations
+ exit 1
+ fi
+elif [ ! -e $NDK_ROOT ] ; then
+ echo NDK_ROOT $NDK_ROOT does not exist
+ exit 1
+fi
+export NDK_ROOT
+
+if [ -z "$ANDROID_HOME" ] ; then
+ if [ -e /usr/local/android-sdk-linux_x86 ] ; then
+ ANDROID_HOME=/usr/local/android-sdk-linux_x86
+ elif [ -e /opt-linux-x86/android-sdk-linux_x86 ] ; then
+ ANDROID_HOME=/opt-linux-x86/android-sdk-linux_x86
+ elif [ -e /opt/android-sdk-linux_x86 ] ; then
+ ANDROID_HOME=/opt/android-sdk-linux_x86
+ else
+ echo ANDROID_HOME is not specified and does not exist in default locations
+ exit 1
+ fi
+elif [ ! -e $ANDROID_HOME ] ; then
+ echo ANDROID_HOME $ANDROID_HOME does not exist
+ exit 1
+fi
+export ANDROID_HOME
+
+if [ -z "$ANDROID_BUILD_TOOLS_VERSION" ] ; then
+ if [ -e $ANDROID_HOME/build-tools/21.1.2/zipalign ] ; then
+ ANDROID_BUILD_TOOLS_VERSION=21.1.2
+ elif [ -e $ANDROID_HOME/build-tools/20.0.0/zipalign ] ; then
+ ANDROID_BUILD_TOOLS_VERSION=20.0.0
+ else
+ echo ANDROID_BUILD_TOOLS_VERSION $ANDROID_HOME/build-tools/ANDROID_BUILD_TOOLS_VERSION/zipalign does not exist in default locations
+ exit 1
+ fi
+elif [ ! -e $ANDROID_HOME/build-tools/$ANDROID_BUILD_TOOLS_VERSION/zipalign ] ; then
+ echo ANDROID_BUILD_TOOLS_VERSION $ANDROID_HOME/build-tools/$ANDROID_BUILD_TOOLS_VERSION/zipalign does not exist
+ exit 1
+fi
+export ANDROID_BUILD_TOOLS_VERSION
+
+echo Set
+echo NDK_ROOT $NDK_ROOT
+echo ANDROID_HOME $ANDROID_HOME
+echo ANDROID_BUILD_TOOLS_VERSION $ANDROID_BUILD_TOOLS_VERSION
+
diff -Nru gluegen2-2.2.4/make/scripts/setenv-build-jogl-x86_64.sh gluegen2-2.3.2/make/scripts/setenv-build-jogl-x86_64.sh
--- gluegen2-2.2.4/make/scripts/setenv-build-jogl-x86_64.sh 2014-10-10 13:20:51.000000000 +0000
+++ gluegen2-2.3.2/make/scripts/setenv-build-jogl-x86_64.sh 2015-10-09 04:18:28.000000000 +0000
@@ -15,13 +15,6 @@
fi
fi
if [ -z "$ANT_PATH" ] ; then
- if [ -e /usr/share/ant/bin/ant -a -e /usr/share/ant/lib/ant.jar ] ; then
- ANT_PATH=/usr/share/ant
- export ANT_PATH
- echo autosetting ANT_PATH to $ANT_PATH
- fi
-fi
-if [ -z "$ANT_PATH" ] ; then
echo ANT_PATH does not exist, set it
exit
fi
diff -Nru gluegen2-2.2.4/make/scripts/test-win32-smb_share.bat gluegen2-2.3.2/make/scripts/test-win32-smb_share.bat
--- gluegen2-2.2.4/make/scripts/test-win32-smb_share.bat 2014-10-10 13:20:51.000000000 +0000
+++ gluegen2-2.3.2/make/scripts/test-win32-smb_share.bat 2015-10-09 04:18:28.000000000 +0000
@@ -2,9 +2,9 @@
set SMB_ROOT=\\risa.goethel.localnet\deployment\test\jogamp
set BLD_SUB=build-win32
-set J2RE_HOME=c:\jre1.7.0_45_x32
-set JAVA_HOME=c:\jdk1.7.0_45_x32
-set ANT_PATH=C:\apache-ant-1.8.2
+set J2RE_HOME=c:\jre1.8.0_60_x32
+set JAVA_HOME=c:\jdk1.8.0_60_x32
+set ANT_PATH=C:\apache-ant-1.9.4
set PROJECT_ROOT=%SMB_ROOT%\gluegen
set BLD_DIR=%PROJECT_ROOT%\%BLD_SUB%
diff -Nru gluegen2-2.2.4/make/stub_includes/gluegen/stdio.h gluegen2-2.3.2/make/stub_includes/gluegen/stdio.h
--- gluegen2-2.2.4/make/stub_includes/gluegen/stdio.h 1970-01-01 00:00:00.000000000 +0000
+++ gluegen2-2.3.2/make/stub_includes/gluegen/stdio.h 2015-10-09 04:18:28.000000000 +0000
@@ -0,0 +1,7 @@
+#ifndef __stdio_h
+#define __stdio_h
+
+#include
+
+#endif /* __stdio_h */
+
diff -Nru gluegen2-2.2.4/make/stub_includes/jni/jawt.h gluegen2-2.3.2/make/stub_includes/jni/jawt.h
--- gluegen2-2.2.4/make/stub_includes/jni/jawt.h 1970-01-01 00:00:00.000000000 +0000
+++ gluegen2-2.3.2/make/stub_includes/jni/jawt.h 2015-10-09 04:18:28.000000000 +0000
@@ -0,0 +1,106 @@
+/*
+ * @(#)jawt.h 1.11 05/11/17
+ *
+ * This C header file is derived from Sun Microsystem's Java SDK provided C header file
+ * with the following copyright notice:
+ *
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ *
+ * This version has complex comments removed and does not contain inlined algorithms etc, if any existed.
+ *
+ * The original C header file was included to JOGL on Sat Jun 21 02:10:30 2008
+ * (commit cbc45e816f4ee81031bffce19a99550681462a24) by Sun Microsystem's staff and were approved.
+ *
+ * This C header file is included due to ensure compatibility with - and invocation of the JAWT protocol.
+ * They are processed by GlueGen to create a Java binding for JAWT invocation only.
+ *
+ * http://ftp.resource.org/courts.gov/c/F3/387/387.F3d.522.03-5400.html (36)
+ * "Atari Games Corp. v. Nintendo of Am., Inc., Nos. 88-4805 & 89-0027, 1993 WL 207548, at *1 (N.D.Cal. May 18, 1993) ("Atari III")
+ * ("Program code that is strictly necessary to achieve current compatibility presents a merger problem, almost by definition,
+ * and is thus excluded from the scope of any copyright.")."
+ *
+ * http://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=OJ:L:2009:111:0016:0022:EN:PDF
+ * L 111/17 (10) and (15)
+ */
+
+#ifndef _JAVASOFT_JAWT_H_
+#define _JAVASOFT_JAWT_H_
+
+#include "jni.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * AWT native interface (new in JDK 1.3)
+ */
+
+typedef struct jawt_Rectangle {
+ jint x;
+ jint y;
+ jint width;
+ jint height;
+} JAWT_Rectangle;
+
+struct jawt_DrawingSurface;
+
+typedef struct jawt_DrawingSurfaceInfo {
+ void* platformInfo;
+ struct jawt_DrawingSurface* ds;
+ JAWT_Rectangle bounds;
+ jint clipSize;
+ JAWT_Rectangle* clip;
+} JAWT_DrawingSurfaceInfo;
+
+#define JAWT_LOCK_ERROR 0x00000001
+#define JAWT_LOCK_CLIP_CHANGED 0x00000002
+#define JAWT_LOCK_BOUNDS_CHANGED 0x00000004
+#define JAWT_LOCK_SURFACE_CHANGED 0x00000008
+
+typedef struct jawt_DrawingSurface {
+ JNIEnv* env;
+ jobject target;
+ jint (JNICALL *Lock)
+ (struct jawt_DrawingSurface* ds);
+ JAWT_DrawingSurfaceInfo* (JNICALL *GetDrawingSurfaceInfo)
+ (struct jawt_DrawingSurface* ds);
+ void (JNICALL *FreeDrawingSurfaceInfo)
+ (JAWT_DrawingSurfaceInfo* dsi);
+ void (JNICALL *Unlock)
+ (struct jawt_DrawingSurface* ds);
+} JAWT_DrawingSurface;
+
+typedef struct jawt {
+ jint version;
+ JAWT_DrawingSurface* (JNICALL *GetDrawingSurface)
+ (JNIEnv* env, jobject target);
+ void (JNICALL *FreeDrawingSurface)
+ (JAWT_DrawingSurface* ds);
+ /*
+ * Since 1.4
+ */
+ void (JNICALL *Lock)(JNIEnv* env);
+ /*
+ * Since 1.4
+ */
+ void (JNICALL *Unlock)(JNIEnv* env);
+ /*
+ * Since 1.4
+ */
+ jobject (JNICALL *GetComponent)(JNIEnv* env, void* platformInfo);
+
+} JAWT;
+
+_JNI_IMPORT_OR_EXPORT_
+jboolean JNICALL JAWT_GetAWT(JNIEnv* env, JAWT* awt);
+
+#define JAWT_VERSION_1_3 0x00010003
+#define JAWT_VERSION_1_4 0x00010004
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* !_JAVASOFT_JAWT_H_ */
diff -Nru gluegen2-2.2.4/make/stub_includes/jni/jni.h gluegen2-2.3.2/make/stub_includes/jni/jni.h
--- gluegen2-2.2.4/make/stub_includes/jni/jni.h 1970-01-01 00:00:00.000000000 +0000
+++ gluegen2-2.3.2/make/stub_includes/jni/jni.h 2015-10-09 04:18:28.000000000 +0000
@@ -0,0 +1,1934 @@
+/*
+ * @(#)jni.h 1.62 06/02/02
+ *
+ * This C header file is derived from Sun Microsystem's Java SDK provided C header file
+ * with the following copyright notice:
+ *
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ *
+ * This version has complex comments removed and does not contain inlined algorithms etc, if any existed.
+ *
+ * The original C header file was included to JOGL on Sat Jun 21 02:10:30 2008
+ * (commit cbc45e816f4ee81031bffce19a99550681462a24) by Sun Microsystem's staff and were approved.
+ *
+ * This C header file is included due to ensure compatibility with - and invocation of the JAWT protocol.
+ * They are processed by GlueGen to create a Java binding for JAWT invocation only.
+ *
+ * http://ftp.resource.org/courts.gov/c/F3/387/387.F3d.522.03-5400.html (36)
+ * "Atari Games Corp. v. Nintendo of Am., Inc., Nos. 88-4805 & 89-0027, 1993 WL 207548, at *1 (N.D.Cal. May 18, 1993) ("Atari III")
+ * ("Program code that is strictly necessary to achieve current compatibility presents a merger problem, almost by definition,
+ * and is thus excluded from the scope of any copyright.")."
+ *
+ * http://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=OJ:L:2009:111:0016:0022:EN:PDF
+ * L 111/17 (10) and (15)
+ */
+
+/*
+ * We used part of Netscape's Java Runtime Interface (JRI) as the starting
+ * point of our design and implementation.
+ */
+
+/******************************************************************************
+ * Java Runtime Interface
+ * Copyright (c) 1996 Netscape Communications Corporation. All rights reserved.
+ *****************************************************************************/
+
+#ifndef _JAVASOFT_JNI_H_
+#define _JAVASOFT_JNI_H_
+
+#include
+#include
+#include
+
+#include "jni_md.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef JNI_TYPES_ALREADY_DEFINED_IN_JNI_MD_H
+
+typedef uint8_t jboolean;
+typedef uint16_t jchar;
+typedef int16_t jshort;
+typedef float jfloat;
+typedef double jdouble;
+
+typedef jint jsize;
+
+#ifdef __cplusplus
+
+class _jobject {};
+class _jclass : public _jobject {};
+class _jthrowable : public _jobject {};
+class _jstring : public _jobject {};
+class _jarray : public _jobject {};
+class _jbooleanArray : public _jarray {};
+class _jbyteArray : public _jarray {};
+class _jcharArray : public _jarray {};
+class _jshortArray : public _jarray {};
+class _jintArray : public _jarray {};
+class _jlongArray : public _jarray {};
+class _jfloatArray : public _jarray {};
+class _jdoubleArray : public _jarray {};
+class _jobjectArray : public _jarray {};
+
+typedef _jobject *jobject;
+typedef _jclass *jclass;
+typedef _jthrowable *jthrowable;
+typedef _jstring *jstring;
+typedef _jarray *jarray;
+typedef _jbooleanArray *jbooleanArray;
+typedef _jbyteArray *jbyteArray;
+typedef _jcharArray *jcharArray;
+typedef _jshortArray *jshortArray;
+typedef _jintArray *jintArray;
+typedef _jlongArray *jlongArray;
+typedef _jfloatArray *jfloatArray;
+typedef _jdoubleArray *jdoubleArray;
+typedef _jobjectArray *jobjectArray;
+
+#else
+
+struct _jobject;
+
+typedef struct _jobject *jobject;
+typedef jobject jclass;
+typedef jobject jthrowable;
+typedef jobject jstring;
+typedef jobject jarray;
+typedef jarray jbooleanArray;
+typedef jarray jbyteArray;
+typedef jarray jcharArray;
+typedef jarray jshortArray;
+typedef jarray jintArray;
+typedef jarray jlongArray;
+typedef jarray jfloatArray;
+typedef jarray jdoubleArray;
+typedef jarray jobjectArray;
+
+#endif
+
+typedef jobject jweak;
+
+typedef union jvalue {
+ jboolean z;
+ jbyte b;
+ jchar c;
+ jshort s;
+ jint i;
+ jlong j;
+ jfloat f;
+ jdouble d;
+ jobject l;
+} jvalue;
+
+struct _jfieldID;
+typedef struct _jfieldID *jfieldID;
+
+struct _jmethodID;
+typedef struct _jmethodID *jmethodID;
+
+typedef enum _jobjectType {
+ JNIInvalidRefType = 0,
+ JNILocalRefType = 1,
+ JNIGlobalRefType = 2,
+ JNIWeakGlobalRefType = 3
+} jobjectRefType;
+
+
+#endif /* JNI_TYPES_ALREADY_DEFINED_IN_JNI_MD_H */
+
+#define JNI_FALSE 0
+#define JNI_TRUE 1
+
+#define JNI_OK 0 /* success */
+#define JNI_ERR (-1) /* unknown error */
+#define JNI_EDETACHED (-2) /* thread detached from the VM */
+#define JNI_EVERSION (-3) /* JNI version error */
+#define JNI_ENOMEM (-4) /* not enough memory */
+#define JNI_EEXIST (-5) /* VM already created */
+#define JNI_EINVAL (-6) /* invalid arguments */
+
+#define JNI_COMMIT 1
+#define JNI_ABORT 2
+
+#ifdef __GLUEGEN__
+
+// GlueGen 'shortcut': We don't want to create bindings for JNI invocations!
+// Hence dropping the JNI details, use-case: jawt.h
+
+/** Special opaque GlueGen handling of JNIEnv */
+typedef long JNIEnv;
+
+#define JDK1_2
+#define JDK1_4
+
+#define _JNI_IMPORT_OR_EXPORT_ JNIIMPORT
+
+#define JNI_VERSION_1_1 0x00010001
+#define JNI_VERSION_1_2 0x00010002
+#define JNI_VERSION_1_4 0x00010004
+#define JNI_VERSION_1_6 0x00010006
+
+#else /* __GLUEGEN__ */
+
+typedef struct {
+ char *name;
+ char *signature;
+ void *fnPtr;
+} JNINativeMethod;
+
+struct JNINativeInterface_;
+
+struct JNIEnv_;
+
+#ifdef __cplusplus
+typedef JNIEnv_ JNIEnv;
+#else
+typedef const struct JNINativeInterface_ *JNIEnv;
+#endif
+
+struct JNIInvokeInterface_;
+
+struct JavaVM_;
+
+#ifdef __cplusplus
+typedef JavaVM_ JavaVM;
+#else
+typedef const struct JNIInvokeInterface_ *JavaVM;
+#endif
+
+struct JNINativeInterface_ {
+ void *reserved0;
+ void *reserved1;
+ void *reserved2;
+
+ void *reserved3;
+ jint (JNICALL *GetVersion)(JNIEnv *env);
+
+ jclass (JNICALL *DefineClass)
+ (JNIEnv *env, const char *name, jobject loader, const jbyte *buf,
+ jsize len);
+ jclass (JNICALL *FindClass)
+ (JNIEnv *env, const char *name);
+
+ jmethodID (JNICALL *FromReflectedMethod)
+ (JNIEnv *env, jobject method);
+ jfieldID (JNICALL *FromReflectedField)
+ (JNIEnv *env, jobject field);
+
+ jobject (JNICALL *ToReflectedMethod)
+ (JNIEnv *env, jclass cls, jmethodID methodID, jboolean isStatic);
+
+ jclass (JNICALL *GetSuperclass)
+ (JNIEnv *env, jclass sub);
+ jboolean (JNICALL *IsAssignableFrom)
+ (JNIEnv *env, jclass sub, jclass sup);
+
+ jobject (JNICALL *ToReflectedField)
+ (JNIEnv *env, jclass cls, jfieldID fieldID, jboolean isStatic);
+
+ jint (JNICALL *Throw)
+ (JNIEnv *env, jthrowable obj);
+ jint (JNICALL *ThrowNew)
+ (JNIEnv *env, jclass clazz, const char *msg);
+ jthrowable (JNICALL *ExceptionOccurred)
+ (JNIEnv *env);
+ void (JNICALL *ExceptionDescribe)
+ (JNIEnv *env);
+ void (JNICALL *ExceptionClear)
+ (JNIEnv *env);
+ void (JNICALL *FatalError)
+ (JNIEnv *env, const char *msg);
+
+ jint (JNICALL *PushLocalFrame)
+ (JNIEnv *env, jint capacity);
+ jobject (JNICALL *PopLocalFrame)
+ (JNIEnv *env, jobject result);
+
+ jobject (JNICALL *NewGlobalRef)
+ (JNIEnv *env, jobject lobj);
+ void (JNICALL *DeleteGlobalRef)
+ (JNIEnv *env, jobject gref);
+ void (JNICALL *DeleteLocalRef)
+ (JNIEnv *env, jobject obj);
+ jboolean (JNICALL *IsSameObject)
+ (JNIEnv *env, jobject obj1, jobject obj2);
+ jobject (JNICALL *NewLocalRef)
+ (JNIEnv *env, jobject ref);
+ jint (JNICALL *EnsureLocalCapacity)
+ (JNIEnv *env, jint capacity);
+
+ jobject (JNICALL *AllocObject)
+ (JNIEnv *env, jclass clazz);
+ jobject (JNICALL *NewObject)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, ...);
+ jobject (JNICALL *NewObjectV)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
+ jobject (JNICALL *NewObjectA)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args);
+
+ jclass (JNICALL *GetObjectClass)
+ (JNIEnv *env, jobject obj);
+ jboolean (JNICALL *IsInstanceOf)
+ (JNIEnv *env, jobject obj, jclass clazz);
+
+ jmethodID (JNICALL *GetMethodID)
+ (JNIEnv *env, jclass clazz, const char *name, const char *sig);
+
+ jobject (JNICALL *CallObjectMethod)
+ (JNIEnv *env, jobject obj, jmethodID methodID, ...);
+ jobject (JNICALL *CallObjectMethodV)
+ (JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
+ jobject (JNICALL *CallObjectMethodA)
+ (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue * args);
+
+ jboolean (JNICALL *CallBooleanMethod)
+ (JNIEnv *env, jobject obj, jmethodID methodID, ...);
+ jboolean (JNICALL *CallBooleanMethodV)
+ (JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
+ jboolean (JNICALL *CallBooleanMethodA)
+ (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue * args);
+
+ jbyte (JNICALL *CallByteMethod)
+ (JNIEnv *env, jobject obj, jmethodID methodID, ...);
+ jbyte (JNICALL *CallByteMethodV)
+ (JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
+ jbyte (JNICALL *CallByteMethodA)
+ (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args);
+
+ jchar (JNICALL *CallCharMethod)
+ (JNIEnv *env, jobject obj, jmethodID methodID, ...);
+ jchar (JNICALL *CallCharMethodV)
+ (JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
+ jchar (JNICALL *CallCharMethodA)
+ (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args);
+
+ jshort (JNICALL *CallShortMethod)
+ (JNIEnv *env, jobject obj, jmethodID methodID, ...);
+ jshort (JNICALL *CallShortMethodV)
+ (JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
+ jshort (JNICALL *CallShortMethodA)
+ (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args);
+
+ jint (JNICALL *CallIntMethod)
+ (JNIEnv *env, jobject obj, jmethodID methodID, ...);
+ jint (JNICALL *CallIntMethodV)
+ (JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
+ jint (JNICALL *CallIntMethodA)
+ (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args);
+
+ jlong (JNICALL *CallLongMethod)
+ (JNIEnv *env, jobject obj, jmethodID methodID, ...);
+ jlong (JNICALL *CallLongMethodV)
+ (JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
+ jlong (JNICALL *CallLongMethodA)
+ (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args);
+
+ jfloat (JNICALL *CallFloatMethod)
+ (JNIEnv *env, jobject obj, jmethodID methodID, ...);
+ jfloat (JNICALL *CallFloatMethodV)
+ (JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
+ jfloat (JNICALL *CallFloatMethodA)
+ (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args);
+
+ jdouble (JNICALL *CallDoubleMethod)
+ (JNIEnv *env, jobject obj, jmethodID methodID, ...);
+ jdouble (JNICALL *CallDoubleMethodV)
+ (JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
+ jdouble (JNICALL *CallDoubleMethodA)
+ (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args);
+
+ void (JNICALL *CallVoidMethod)
+ (JNIEnv *env, jobject obj, jmethodID methodID, ...);
+ void (JNICALL *CallVoidMethodV)
+ (JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
+ void (JNICALL *CallVoidMethodA)
+ (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue * args);
+
+ jobject (JNICALL *CallNonvirtualObjectMethod)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...);
+ jobject (JNICALL *CallNonvirtualObjectMethodV)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+ va_list args);
+ jobject (JNICALL *CallNonvirtualObjectMethodA)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+ const jvalue * args);
+
+ jboolean (JNICALL *CallNonvirtualBooleanMethod)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...);
+ jboolean (JNICALL *CallNonvirtualBooleanMethodV)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+ va_list args);
+ jboolean (JNICALL *CallNonvirtualBooleanMethodA)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+ const jvalue * args);
+
+ jbyte (JNICALL *CallNonvirtualByteMethod)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...);
+ jbyte (JNICALL *CallNonvirtualByteMethodV)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+ va_list args);
+ jbyte (JNICALL *CallNonvirtualByteMethodA)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+ const jvalue *args);
+
+ jchar (JNICALL *CallNonvirtualCharMethod)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...);
+ jchar (JNICALL *CallNonvirtualCharMethodV)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+ va_list args);
+ jchar (JNICALL *CallNonvirtualCharMethodA)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+ const jvalue *args);
+
+ jshort (JNICALL *CallNonvirtualShortMethod)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...);
+ jshort (JNICALL *CallNonvirtualShortMethodV)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+ va_list args);
+ jshort (JNICALL *CallNonvirtualShortMethodA)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+ const jvalue *args);
+
+ jint (JNICALL *CallNonvirtualIntMethod)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...);
+ jint (JNICALL *CallNonvirtualIntMethodV)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+ va_list args);
+ jint (JNICALL *CallNonvirtualIntMethodA)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+ const jvalue *args);
+
+ jlong (JNICALL *CallNonvirtualLongMethod)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...);
+ jlong (JNICALL *CallNonvirtualLongMethodV)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+ va_list args);
+ jlong (JNICALL *CallNonvirtualLongMethodA)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+ const jvalue *args);
+
+ jfloat (JNICALL *CallNonvirtualFloatMethod)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...);
+ jfloat (JNICALL *CallNonvirtualFloatMethodV)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+ va_list args);
+ jfloat (JNICALL *CallNonvirtualFloatMethodA)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+ const jvalue *args);
+
+ jdouble (JNICALL *CallNonvirtualDoubleMethod)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...);
+ jdouble (JNICALL *CallNonvirtualDoubleMethodV)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+ va_list args);
+ jdouble (JNICALL *CallNonvirtualDoubleMethodA)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+ const jvalue *args);
+
+ void (JNICALL *CallNonvirtualVoidMethod)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...);
+ void (JNICALL *CallNonvirtualVoidMethodV)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+ va_list args);
+ void (JNICALL *CallNonvirtualVoidMethodA)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+ const jvalue * args);
+
+ jfieldID (JNICALL *GetFieldID)
+ (JNIEnv *env, jclass clazz, const char *name, const char *sig);
+
+ jobject (JNICALL *GetObjectField)
+ (JNIEnv *env, jobject obj, jfieldID fieldID);
+ jboolean (JNICALL *GetBooleanField)
+ (JNIEnv *env, jobject obj, jfieldID fieldID);
+ jbyte (JNICALL *GetByteField)
+ (JNIEnv *env, jobject obj, jfieldID fieldID);
+ jchar (JNICALL *GetCharField)
+ (JNIEnv *env, jobject obj, jfieldID fieldID);
+ jshort (JNICALL *GetShortField)
+ (JNIEnv *env, jobject obj, jfieldID fieldID);
+ jint (JNICALL *GetIntField)
+ (JNIEnv *env, jobject obj, jfieldID fieldID);
+ jlong (JNICALL *GetLongField)
+ (JNIEnv *env, jobject obj, jfieldID fieldID);
+ jfloat (JNICALL *GetFloatField)
+ (JNIEnv *env, jobject obj, jfieldID fieldID);
+ jdouble (JNICALL *GetDoubleField)
+ (JNIEnv *env, jobject obj, jfieldID fieldID);
+
+ void (JNICALL *SetObjectField)
+ (JNIEnv *env, jobject obj, jfieldID fieldID, jobject val);
+ void (JNICALL *SetBooleanField)
+ (JNIEnv *env, jobject obj, jfieldID fieldID, jboolean val);
+ void (JNICALL *SetByteField)
+ (JNIEnv *env, jobject obj, jfieldID fieldID, jbyte val);
+ void (JNICALL *SetCharField)
+ (JNIEnv *env, jobject obj, jfieldID fieldID, jchar val);
+ void (JNICALL *SetShortField)
+ (JNIEnv *env, jobject obj, jfieldID fieldID, jshort val);
+ void (JNICALL *SetIntField)
+ (JNIEnv *env, jobject obj, jfieldID fieldID, jint val);
+ void (JNICALL *SetLongField)
+ (JNIEnv *env, jobject obj, jfieldID fieldID, jlong val);
+ void (JNICALL *SetFloatField)
+ (JNIEnv *env, jobject obj, jfieldID fieldID, jfloat val);
+ void (JNICALL *SetDoubleField)
+ (JNIEnv *env, jobject obj, jfieldID fieldID, jdouble val);
+
+ jmethodID (JNICALL *GetStaticMethodID)
+ (JNIEnv *env, jclass clazz, const char *name, const char *sig);
+
+ jobject (JNICALL *CallStaticObjectMethod)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, ...);
+ jobject (JNICALL *CallStaticObjectMethodV)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
+ jobject (JNICALL *CallStaticObjectMethodA)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args);
+
+ jboolean (JNICALL *CallStaticBooleanMethod)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, ...);
+ jboolean (JNICALL *CallStaticBooleanMethodV)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
+ jboolean (JNICALL *CallStaticBooleanMethodA)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args);
+
+ jbyte (JNICALL *CallStaticByteMethod)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, ...);
+ jbyte (JNICALL *CallStaticByteMethodV)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
+ jbyte (JNICALL *CallStaticByteMethodA)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args);
+
+ jchar (JNICALL *CallStaticCharMethod)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, ...);
+ jchar (JNICALL *CallStaticCharMethodV)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
+ jchar (JNICALL *CallStaticCharMethodA)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args);
+
+ jshort (JNICALL *CallStaticShortMethod)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, ...);
+ jshort (JNICALL *CallStaticShortMethodV)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
+ jshort (JNICALL *CallStaticShortMethodA)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args);
+
+ jint (JNICALL *CallStaticIntMethod)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, ...);
+ jint (JNICALL *CallStaticIntMethodV)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
+ jint (JNICALL *CallStaticIntMethodA)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args);
+
+ jlong (JNICALL *CallStaticLongMethod)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, ...);
+ jlong (JNICALL *CallStaticLongMethodV)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
+ jlong (JNICALL *CallStaticLongMethodA)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args);
+
+ jfloat (JNICALL *CallStaticFloatMethod)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, ...);
+ jfloat (JNICALL *CallStaticFloatMethodV)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
+ jfloat (JNICALL *CallStaticFloatMethodA)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args);
+
+ jdouble (JNICALL *CallStaticDoubleMethod)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, ...);
+ jdouble (JNICALL *CallStaticDoubleMethodV)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
+ jdouble (JNICALL *CallStaticDoubleMethodA)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args);
+
+ void (JNICALL *CallStaticVoidMethod)
+ (JNIEnv *env, jclass cls, jmethodID methodID, ...);
+ void (JNICALL *CallStaticVoidMethodV)
+ (JNIEnv *env, jclass cls, jmethodID methodID, va_list args);
+ void (JNICALL *CallStaticVoidMethodA)
+ (JNIEnv *env, jclass cls, jmethodID methodID, const jvalue * args);
+
+ jfieldID (JNICALL *GetStaticFieldID)
+ (JNIEnv *env, jclass clazz, const char *name, const char *sig);
+ jobject (JNICALL *GetStaticObjectField)
+ (JNIEnv *env, jclass clazz, jfieldID fieldID);
+ jboolean (JNICALL *GetStaticBooleanField)
+ (JNIEnv *env, jclass clazz, jfieldID fieldID);
+ jbyte (JNICALL *GetStaticByteField)
+ (JNIEnv *env, jclass clazz, jfieldID fieldID);
+ jchar (JNICALL *GetStaticCharField)
+ (JNIEnv *env, jclass clazz, jfieldID fieldID);
+ jshort (JNICALL *GetStaticShortField)
+ (JNIEnv *env, jclass clazz, jfieldID fieldID);
+ jint (JNICALL *GetStaticIntField)
+ (JNIEnv *env, jclass clazz, jfieldID fieldID);
+ jlong (JNICALL *GetStaticLongField)
+ (JNIEnv *env, jclass clazz, jfieldID fieldID);
+ jfloat (JNICALL *GetStaticFloatField)
+ (JNIEnv *env, jclass clazz, jfieldID fieldID);
+ jdouble (JNICALL *GetStaticDoubleField)
+ (JNIEnv *env, jclass clazz, jfieldID fieldID);
+
+ void (JNICALL *SetStaticObjectField)
+ (JNIEnv *env, jclass clazz, jfieldID fieldID, jobject value);
+ void (JNICALL *SetStaticBooleanField)
+ (JNIEnv *env, jclass clazz, jfieldID fieldID, jboolean value);
+ void (JNICALL *SetStaticByteField)
+ (JNIEnv *env, jclass clazz, jfieldID fieldID, jbyte value);
+ void (JNICALL *SetStaticCharField)
+ (JNIEnv *env, jclass clazz, jfieldID fieldID, jchar value);
+ void (JNICALL *SetStaticShortField)
+ (JNIEnv *env, jclass clazz, jfieldID fieldID, jshort value);
+ void (JNICALL *SetStaticIntField)
+ (JNIEnv *env, jclass clazz, jfieldID fieldID, jint value);
+ void (JNICALL *SetStaticLongField)
+ (JNIEnv *env, jclass clazz, jfieldID fieldID, jlong value);
+ void (JNICALL *SetStaticFloatField)
+ (JNIEnv *env, jclass clazz, jfieldID fieldID, jfloat value);
+ void (JNICALL *SetStaticDoubleField)
+ (JNIEnv *env, jclass clazz, jfieldID fieldID, jdouble value);
+
+ jstring (JNICALL *NewString)
+ (JNIEnv *env, const jchar *unicode, jsize len);
+ jsize (JNICALL *GetStringLength)
+ (JNIEnv *env, jstring str);
+ const jchar *(JNICALL *GetStringChars)
+ (JNIEnv *env, jstring str, jboolean *isCopy);
+ void (JNICALL *ReleaseStringChars)
+ (JNIEnv *env, jstring str, const jchar *chars);
+
+ jstring (JNICALL *NewStringUTF)
+ (JNIEnv *env, const char *utf);
+ jsize (JNICALL *GetStringUTFLength)
+ (JNIEnv *env, jstring str);
+ const char* (JNICALL *GetStringUTFChars)
+ (JNIEnv *env, jstring str, jboolean *isCopy);
+ void (JNICALL *ReleaseStringUTFChars)
+ (JNIEnv *env, jstring str, const char* chars);
+
+
+ jsize (JNICALL *GetArrayLength)
+ (JNIEnv *env, jarray array);
+
+ jobjectArray (JNICALL *NewObjectArray)
+ (JNIEnv *env, jsize len, jclass clazz, jobject init);
+ jobject (JNICALL *GetObjectArrayElement)
+ (JNIEnv *env, jobjectArray array, jsize index);
+ void (JNICALL *SetObjectArrayElement)
+ (JNIEnv *env, jobjectArray array, jsize index, jobject val);
+
+ jbooleanArray (JNICALL *NewBooleanArray)
+ (JNIEnv *env, jsize len);
+ jbyteArray (JNICALL *NewByteArray)
+ (JNIEnv *env, jsize len);
+ jcharArray (JNICALL *NewCharArray)
+ (JNIEnv *env, jsize len);
+ jshortArray (JNICALL *NewShortArray)
+ (JNIEnv *env, jsize len);
+ jintArray (JNICALL *NewIntArray)
+ (JNIEnv *env, jsize len);
+ jlongArray (JNICALL *NewLongArray)
+ (JNIEnv *env, jsize len);
+ jfloatArray (JNICALL *NewFloatArray)
+ (JNIEnv *env, jsize len);
+ jdoubleArray (JNICALL *NewDoubleArray)
+ (JNIEnv *env, jsize len);
+
+ jboolean * (JNICALL *GetBooleanArrayElements)
+ (JNIEnv *env, jbooleanArray array, jboolean *isCopy);
+ jbyte * (JNICALL *GetByteArrayElements)
+ (JNIEnv *env, jbyteArray array, jboolean *isCopy);
+ jchar * (JNICALL *GetCharArrayElements)
+ (JNIEnv *env, jcharArray array, jboolean *isCopy);
+ jshort * (JNICALL *GetShortArrayElements)
+ (JNIEnv *env, jshortArray array, jboolean *isCopy);
+ jint * (JNICALL *GetIntArrayElements)
+ (JNIEnv *env, jintArray array, jboolean *isCopy);
+ jlong * (JNICALL *GetLongArrayElements)
+ (JNIEnv *env, jlongArray array, jboolean *isCopy);
+ jfloat * (JNICALL *GetFloatArrayElements)
+ (JNIEnv *env, jfloatArray array, jboolean *isCopy);
+ jdouble * (JNICALL *GetDoubleArrayElements)
+ (JNIEnv *env, jdoubleArray array, jboolean *isCopy);
+
+ void (JNICALL *ReleaseBooleanArrayElements)
+ (JNIEnv *env, jbooleanArray array, jboolean *elems, jint mode);
+ void (JNICALL *ReleaseByteArrayElements)
+ (JNIEnv *env, jbyteArray array, jbyte *elems, jint mode);
+ void (JNICALL *ReleaseCharArrayElements)
+ (JNIEnv *env, jcharArray array, jchar *elems, jint mode);
+ void (JNICALL *ReleaseShortArrayElements)
+ (JNIEnv *env, jshortArray array, jshort *elems, jint mode);
+ void (JNICALL *ReleaseIntArrayElements)
+ (JNIEnv *env, jintArray array, jint *elems, jint mode);
+ void (JNICALL *ReleaseLongArrayElements)
+ (JNIEnv *env, jlongArray array, jlong *elems, jint mode);
+ void (JNICALL *ReleaseFloatArrayElements)
+ (JNIEnv *env, jfloatArray array, jfloat *elems, jint mode);
+ void (JNICALL *ReleaseDoubleArrayElements)
+ (JNIEnv *env, jdoubleArray array, jdouble *elems, jint mode);
+
+ void (JNICALL *GetBooleanArrayRegion)
+ (JNIEnv *env, jbooleanArray array, jsize start, jsize l, jboolean *buf);
+ void (JNICALL *GetByteArrayRegion)
+ (JNIEnv *env, jbyteArray array, jsize start, jsize len, jbyte *buf);
+ void (JNICALL *GetCharArrayRegion)
+ (JNIEnv *env, jcharArray array, jsize start, jsize len, jchar *buf);
+ void (JNICALL *GetShortArrayRegion)
+ (JNIEnv *env, jshortArray array, jsize start, jsize len, jshort *buf);
+ void (JNICALL *GetIntArrayRegion)
+ (JNIEnv *env, jintArray array, jsize start, jsize len, jint *buf);
+ void (JNICALL *GetLongArrayRegion)
+ (JNIEnv *env, jlongArray array, jsize start, jsize len, jlong *buf);
+ void (JNICALL *GetFloatArrayRegion)
+ (JNIEnv *env, jfloatArray array, jsize start, jsize len, jfloat *buf);
+ void (JNICALL *GetDoubleArrayRegion)
+ (JNIEnv *env, jdoubleArray array, jsize start, jsize len, jdouble *buf);
+
+ void (JNICALL *SetBooleanArrayRegion)
+ (JNIEnv *env, jbooleanArray array, jsize start, jsize l, const jboolean *buf);
+ void (JNICALL *SetByteArrayRegion)
+ (JNIEnv *env, jbyteArray array, jsize start, jsize len, const jbyte *buf);
+ void (JNICALL *SetCharArrayRegion)
+ (JNIEnv *env, jcharArray array, jsize start, jsize len, const jchar *buf);
+ void (JNICALL *SetShortArrayRegion)
+ (JNIEnv *env, jshortArray array, jsize start, jsize len, const jshort *buf);
+ void (JNICALL *SetIntArrayRegion)
+ (JNIEnv *env, jintArray array, jsize start, jsize len, const jint *buf);
+ void (JNICALL *SetLongArrayRegion)
+ (JNIEnv *env, jlongArray array, jsize start, jsize len, const jlong *buf);
+ void (JNICALL *SetFloatArrayRegion)
+ (JNIEnv *env, jfloatArray array, jsize start, jsize len, const jfloat *buf);
+ void (JNICALL *SetDoubleArrayRegion)
+ (JNIEnv *env, jdoubleArray array, jsize start, jsize len, const jdouble *buf);
+
+ jint (JNICALL *RegisterNatives)
+ (JNIEnv *env, jclass clazz, const JNINativeMethod *methods,
+ jint nMethods);
+ jint (JNICALL *UnregisterNatives)
+ (JNIEnv *env, jclass clazz);
+
+ jint (JNICALL *MonitorEnter)
+ (JNIEnv *env, jobject obj);
+ jint (JNICALL *MonitorExit)
+ (JNIEnv *env, jobject obj);
+
+ jint (JNICALL *GetJavaVM)
+ (JNIEnv *env, JavaVM **vm);
+
+ void (JNICALL *GetStringRegion)
+ (JNIEnv *env, jstring str, jsize start, jsize len, jchar *buf);
+ void (JNICALL *GetStringUTFRegion)
+ (JNIEnv *env, jstring str, jsize start, jsize len, char *buf);
+
+ void * (JNICALL *GetPrimitiveArrayCritical)
+ (JNIEnv *env, jarray array, jboolean *isCopy);
+ void (JNICALL *ReleasePrimitiveArrayCritical)
+ (JNIEnv *env, jarray array, void *carray, jint mode);
+
+ const jchar * (JNICALL *GetStringCritical)
+ (JNIEnv *env, jstring string, jboolean *isCopy);
+ void (JNICALL *ReleaseStringCritical)
+ (JNIEnv *env, jstring string, const jchar *cstring);
+
+ jweak (JNICALL *NewWeakGlobalRef)
+ (JNIEnv *env, jobject obj);
+ void (JNICALL *DeleteWeakGlobalRef)
+ (JNIEnv *env, jweak ref);
+
+ jboolean (JNICALL *ExceptionCheck)
+ (JNIEnv *env);
+
+ jobject (JNICALL *NewDirectByteBuffer)
+ (JNIEnv* env, void* address, jlong capacity);
+ void* (JNICALL *GetDirectBufferAddress)
+ (JNIEnv* env, jobject buf);
+ jlong (JNICALL *GetDirectBufferCapacity)
+ (JNIEnv* env, jobject buf);
+
+ /* New JNI 1.6 Features */
+
+ jobjectRefType (JNICALL *GetObjectRefType)
+ (JNIEnv* env, jobject obj);
+};
+
+struct JNIEnv_ {
+ const struct JNINativeInterface_ *functions;
+#ifdef __cplusplus
+
+ jint GetVersion() {
+ return functions->GetVersion(this);
+ }
+ jclass DefineClass(const char *name, jobject loader, const jbyte *buf,
+ jsize len) {
+ return functions->DefineClass(this, name, loader, buf, len);
+ }
+ jclass FindClass(const char *name) {
+ return functions->FindClass(this, name);
+ }
+ jmethodID FromReflectedMethod(jobject method) {
+ return functions->FromReflectedMethod(this,method);
+ }
+ jfieldID FromReflectedField(jobject field) {
+ return functions->FromReflectedField(this,field);
+ }
+
+ jobject ToReflectedMethod(jclass cls, jmethodID methodID, jboolean isStatic) {
+ return functions->ToReflectedMethod(this, cls, methodID, isStatic);
+ }
+
+ jclass GetSuperclass(jclass sub) {
+ return functions->GetSuperclass(this, sub);
+ }
+ jboolean IsAssignableFrom(jclass sub, jclass sup) {
+ return functions->IsAssignableFrom(this, sub, sup);
+ }
+
+ jobject ToReflectedField(jclass cls, jfieldID fieldID, jboolean isStatic) {
+ return functions->ToReflectedField(this,cls,fieldID,isStatic);
+ }
+
+ jint Throw(jthrowable obj) {
+ return functions->Throw(this, obj);
+ }
+ jint ThrowNew(jclass clazz, const char *msg) {
+ return functions->ThrowNew(this, clazz, msg);
+ }
+ jthrowable ExceptionOccurred() {
+ return functions->ExceptionOccurred(this);
+ }
+ void ExceptionDescribe() {
+ functions->ExceptionDescribe(this);
+ }
+ void ExceptionClear() {
+ functions->ExceptionClear(this);
+ }
+ void FatalError(const char *msg) {
+ functions->FatalError(this, msg);
+ }
+
+ jint PushLocalFrame(jint capacity) {
+ return functions->PushLocalFrame(this,capacity);
+ }
+ jobject PopLocalFrame(jobject result) {
+ return functions->PopLocalFrame(this,result);
+ }
+
+ jobject NewGlobalRef(jobject lobj) {
+ return functions->NewGlobalRef(this,lobj);
+ }
+ void DeleteGlobalRef(jobject gref) {
+ functions->DeleteGlobalRef(this,gref);
+ }
+ void DeleteLocalRef(jobject obj) {
+ functions->DeleteLocalRef(this, obj);
+ }
+
+ jboolean IsSameObject(jobject obj1, jobject obj2) {
+ return functions->IsSameObject(this,obj1,obj2);
+ }
+
+ jobject NewLocalRef(jobject ref) {
+ return functions->NewLocalRef(this,ref);
+ }
+ jint EnsureLocalCapacity(jint capacity) {
+ return functions->EnsureLocalCapacity(this,capacity);
+ }
+
+ jobject AllocObject(jclass clazz) {
+ return functions->AllocObject(this,clazz);
+ }
+ jobject NewObject(jclass clazz, jmethodID methodID, ...) {
+ va_list args;
+ jobject result;
+ va_start(args, methodID);
+ result = functions->NewObjectV(this,clazz,methodID,args);
+ va_end(args);
+ return result;
+ }
+ jobject NewObjectV(jclass clazz, jmethodID methodID,
+ va_list args) {
+ return functions->NewObjectV(this,clazz,methodID,args);
+ }
+ jobject NewObjectA(jclass clazz, jmethodID methodID,
+ const jvalue *args) {
+ return functions->NewObjectA(this,clazz,methodID,args);
+ }
+
+ jclass GetObjectClass(jobject obj) {
+ return functions->GetObjectClass(this,obj);
+ }
+ jboolean IsInstanceOf(jobject obj, jclass clazz) {
+ return functions->IsInstanceOf(this,obj,clazz);
+ }
+
+ jmethodID GetMethodID(jclass clazz, const char *name,
+ const char *sig) {
+ return functions->GetMethodID(this,clazz,name,sig);
+ }
+
+ jobject CallObjectMethod(jobject obj, jmethodID methodID, ...) {
+ va_list args;
+ jobject result;
+ va_start(args,methodID);
+ result = functions->CallObjectMethodV(this,obj,methodID,args);
+ va_end(args);
+ return result;
+ }
+ jobject CallObjectMethodV(jobject obj, jmethodID methodID,
+ va_list args) {
+ return functions->CallObjectMethodV(this,obj,methodID,args);
+ }
+ jobject CallObjectMethodA(jobject obj, jmethodID methodID,
+ const jvalue * args) {
+ return functions->CallObjectMethodA(this,obj,methodID,args);
+ }
+
+ jboolean CallBooleanMethod(jobject obj,
+ jmethodID methodID, ...) {
+ va_list args;
+ jboolean result;
+ va_start(args,methodID);
+ result = functions->CallBooleanMethodV(this,obj,methodID,args);
+ va_end(args);
+ return result;
+ }
+ jboolean CallBooleanMethodV(jobject obj, jmethodID methodID,
+ va_list args) {
+ return functions->CallBooleanMethodV(this,obj,methodID,args);
+ }
+ jboolean CallBooleanMethodA(jobject obj, jmethodID methodID,
+ const jvalue * args) {
+ return functions->CallBooleanMethodA(this,obj,methodID, args);
+ }
+
+ jbyte CallByteMethod(jobject obj, jmethodID methodID, ...) {
+ va_list args;
+ jbyte result;
+ va_start(args,methodID);
+ result = functions->CallByteMethodV(this,obj,methodID,args);
+ va_end(args);
+ return result;
+ }
+ jbyte CallByteMethodV(jobject obj, jmethodID methodID,
+ va_list args) {
+ return functions->CallByteMethodV(this,obj,methodID,args);
+ }
+ jbyte CallByteMethodA(jobject obj, jmethodID methodID,
+ const jvalue * args) {
+ return functions->CallByteMethodA(this,obj,methodID,args);
+ }
+
+ jchar CallCharMethod(jobject obj, jmethodID methodID, ...) {
+ va_list args;
+ jchar result;
+ va_start(args,methodID);
+ result = functions->CallCharMethodV(this,obj,methodID,args);
+ va_end(args);
+ return result;
+ }
+ jchar CallCharMethodV(jobject obj, jmethodID methodID,
+ va_list args) {
+ return functions->CallCharMethodV(this,obj,methodID,args);
+ }
+ jchar CallCharMethodA(jobject obj, jmethodID methodID,
+ const jvalue * args) {
+ return functions->CallCharMethodA(this,obj,methodID,args);
+ }
+
+ jshort CallShortMethod(jobject obj, jmethodID methodID, ...) {
+ va_list args;
+ jshort result;
+ va_start(args,methodID);
+ result = functions->CallShortMethodV(this,obj,methodID,args);
+ va_end(args);
+ return result;
+ }
+ jshort CallShortMethodV(jobject obj, jmethodID methodID,
+ va_list args) {
+ return functions->CallShortMethodV(this,obj,methodID,args);
+ }
+ jshort CallShortMethodA(jobject obj, jmethodID methodID,
+ const jvalue * args) {
+ return functions->CallShortMethodA(this,obj,methodID,args);
+ }
+
+ jint CallIntMethod(jobject obj, jmethodID methodID, ...) {
+ va_list args;
+ jint result;
+ va_start(args,methodID);
+ result = functions->CallIntMethodV(this,obj,methodID,args);
+ va_end(args);
+ return result;
+ }
+ jint CallIntMethodV(jobject obj, jmethodID methodID,
+ va_list args) {
+ return functions->CallIntMethodV(this,obj,methodID,args);
+ }
+ jint CallIntMethodA(jobject obj, jmethodID methodID,
+ const jvalue * args) {
+ return functions->CallIntMethodA(this,obj,methodID,args);
+ }
+
+ jlong CallLongMethod(jobject obj, jmethodID methodID, ...) {
+ va_list args;
+ jlong result;
+ va_start(args,methodID);
+ result = functions->CallLongMethodV(this,obj,methodID,args);
+ va_end(args);
+ return result;
+ }
+ jlong CallLongMethodV(jobject obj, jmethodID methodID,
+ va_list args) {
+ return functions->CallLongMethodV(this,obj,methodID,args);
+ }
+ jlong CallLongMethodA(jobject obj, jmethodID methodID,
+ const jvalue * args) {
+ return functions->CallLongMethodA(this,obj,methodID,args);
+ }
+
+ jfloat CallFloatMethod(jobject obj, jmethodID methodID, ...) {
+ va_list args;
+ jfloat result;
+ va_start(args,methodID);
+ result = functions->CallFloatMethodV(this,obj,methodID,args);
+ va_end(args);
+ return result;
+ }
+ jfloat CallFloatMethodV(jobject obj, jmethodID methodID,
+ va_list args) {
+ return functions->CallFloatMethodV(this,obj,methodID,args);
+ }
+ jfloat CallFloatMethodA(jobject obj, jmethodID methodID,
+ const jvalue * args) {
+ return functions->CallFloatMethodA(this,obj,methodID,args);
+ }
+
+ jdouble CallDoubleMethod(jobject obj, jmethodID methodID, ...) {
+ va_list args;
+ jdouble result;
+ va_start(args,methodID);
+ result = functions->CallDoubleMethodV(this,obj,methodID,args);
+ va_end(args);
+ return result;
+ }
+ jdouble CallDoubleMethodV(jobject obj, jmethodID methodID,
+ va_list args) {
+ return functions->CallDoubleMethodV(this,obj,methodID,args);
+ }
+ jdouble CallDoubleMethodA(jobject obj, jmethodID methodID,
+ const jvalue * args) {
+ return functions->CallDoubleMethodA(this,obj,methodID,args);
+ }
+
+ void CallVoidMethod(jobject obj, jmethodID methodID, ...) {
+ va_list args;
+ va_start(args,methodID);
+ functions->CallVoidMethodV(this,obj,methodID,args);
+ va_end(args);
+ }
+ void CallVoidMethodV(jobject obj, jmethodID methodID,
+ va_list args) {
+ functions->CallVoidMethodV(this,obj,methodID,args);
+ }
+ void CallVoidMethodA(jobject obj, jmethodID methodID,
+ const jvalue * args) {
+ functions->CallVoidMethodA(this,obj,methodID,args);
+ }
+
+ jobject CallNonvirtualObjectMethod(jobject obj, jclass clazz,
+ jmethodID methodID, ...) {
+ va_list args;
+ jobject result;
+ va_start(args,methodID);
+ result = functions->CallNonvirtualObjectMethodV(this,obj,clazz,
+ methodID,args);
+ va_end(args);
+ return result;
+ }
+ jobject CallNonvirtualObjectMethodV(jobject obj, jclass clazz,
+ jmethodID methodID, va_list args) {
+ return functions->CallNonvirtualObjectMethodV(this,obj,clazz,
+ methodID,args);
+ }
+ jobject CallNonvirtualObjectMethodA(jobject obj, jclass clazz,
+ jmethodID methodID, const jvalue * args) {
+ return functions->CallNonvirtualObjectMethodA(this,obj,clazz,
+ methodID,args);
+ }
+
+ jboolean CallNonvirtualBooleanMethod(jobject obj, jclass clazz,
+ jmethodID methodID, ...) {
+ va_list args;
+ jboolean result;
+ va_start(args,methodID);
+ result = functions->CallNonvirtualBooleanMethodV(this,obj,clazz,
+ methodID,args);
+ va_end(args);
+ return result;
+ }
+ jboolean CallNonvirtualBooleanMethodV(jobject obj, jclass clazz,
+ jmethodID methodID, va_list args) {
+ return functions->CallNonvirtualBooleanMethodV(this,obj,clazz,
+ methodID,args);
+ }
+ jboolean CallNonvirtualBooleanMethodA(jobject obj, jclass clazz,
+ jmethodID methodID, const jvalue * args) {
+ return functions->CallNonvirtualBooleanMethodA(this,obj,clazz,
+ methodID, args);
+ }
+
+ jbyte CallNonvirtualByteMethod(jobject obj, jclass clazz,
+ jmethodID methodID, ...) {
+ va_list args;
+ jbyte result;
+ va_start(args,methodID);
+ result = functions->CallNonvirtualByteMethodV(this,obj,clazz,
+ methodID,args);
+ va_end(args);
+ return result;
+ }
+ jbyte CallNonvirtualByteMethodV(jobject obj, jclass clazz,
+ jmethodID methodID, va_list args) {
+ return functions->CallNonvirtualByteMethodV(this,obj,clazz,
+ methodID,args);
+ }
+ jbyte CallNonvirtualByteMethodA(jobject obj, jclass clazz,
+ jmethodID methodID, const jvalue * args) {
+ return functions->CallNonvirtualByteMethodA(this,obj,clazz,
+ methodID,args);
+ }
+
+ jchar CallNonvirtualCharMethod(jobject obj, jclass clazz,
+ jmethodID methodID, ...) {
+ va_list args;
+ jchar result;
+ va_start(args,methodID);
+ result = functions->CallNonvirtualCharMethodV(this,obj,clazz,
+ methodID,args);
+ va_end(args);
+ return result;
+ }
+ jchar CallNonvirtualCharMethodV(jobject obj, jclass clazz,
+ jmethodID methodID, va_list args) {
+ return functions->CallNonvirtualCharMethodV(this,obj,clazz,
+ methodID,args);
+ }
+ jchar CallNonvirtualCharMethodA(jobject obj, jclass clazz,
+ jmethodID methodID, const jvalue * args) {
+ return functions->CallNonvirtualCharMethodA(this,obj,clazz,
+ methodID,args);
+ }
+
+ jshort CallNonvirtualShortMethod(jobject obj, jclass clazz,
+ jmethodID methodID, ...) {
+ va_list args;
+ jshort result;
+ va_start(args,methodID);
+ result = functions->CallNonvirtualShortMethodV(this,obj,clazz,
+ methodID,args);
+ va_end(args);
+ return result;
+ }
+ jshort CallNonvirtualShortMethodV(jobject obj, jclass clazz,
+ jmethodID methodID, va_list args) {
+ return functions->CallNonvirtualShortMethodV(this,obj,clazz,
+ methodID,args);
+ }
+ jshort CallNonvirtualShortMethodA(jobject obj, jclass clazz,
+ jmethodID methodID, const jvalue * args) {
+ return functions->CallNonvirtualShortMethodA(this,obj,clazz,
+ methodID,args);
+ }
+
+ jint CallNonvirtualIntMethod(jobject obj, jclass clazz,
+ jmethodID methodID, ...) {
+ va_list args;
+ jint result;
+ va_start(args,methodID);
+ result = functions->CallNonvirtualIntMethodV(this,obj,clazz,
+ methodID,args);
+ va_end(args);
+ return result;
+ }
+ jint CallNonvirtualIntMethodV(jobject obj, jclass clazz,
+ jmethodID methodID, va_list args) {
+ return functions->CallNonvirtualIntMethodV(this,obj,clazz,
+ methodID,args);
+ }
+ jint CallNonvirtualIntMethodA(jobject obj, jclass clazz,
+ jmethodID methodID, const jvalue * args) {
+ return functions->CallNonvirtualIntMethodA(this,obj,clazz,
+ methodID,args);
+ }
+
+ jlong CallNonvirtualLongMethod(jobject obj, jclass clazz,
+ jmethodID methodID, ...) {
+ va_list args;
+ jlong result;
+ va_start(args,methodID);
+ result = functions->CallNonvirtualLongMethodV(this,obj,clazz,
+ methodID,args);
+ va_end(args);
+ return result;
+ }
+ jlong CallNonvirtualLongMethodV(jobject obj, jclass clazz,
+ jmethodID methodID, va_list args) {
+ return functions->CallNonvirtualLongMethodV(this,obj,clazz,
+ methodID,args);
+ }
+ jlong CallNonvirtualLongMethodA(jobject obj, jclass clazz,
+ jmethodID methodID, const jvalue * args) {
+ return functions->CallNonvirtualLongMethodA(this,obj,clazz,
+ methodID,args);
+ }
+
+ jfloat CallNonvirtualFloatMethod(jobject obj, jclass clazz,
+ jmethodID methodID, ...) {
+ va_list args;
+ jfloat result;
+ va_start(args,methodID);
+ result = functions->CallNonvirtualFloatMethodV(this,obj,clazz,
+ methodID,args);
+ va_end(args);
+ return result;
+ }
+ jfloat CallNonvirtualFloatMethodV(jobject obj, jclass clazz,
+ jmethodID methodID,
+ va_list args) {
+ return functions->CallNonvirtualFloatMethodV(this,obj,clazz,
+ methodID,args);
+ }
+ jfloat CallNonvirtualFloatMethodA(jobject obj, jclass clazz,
+ jmethodID methodID,
+ const jvalue * args) {
+ return functions->CallNonvirtualFloatMethodA(this,obj,clazz,
+ methodID,args);
+ }
+
+ jdouble CallNonvirtualDoubleMethod(jobject obj, jclass clazz,
+ jmethodID methodID, ...) {
+ va_list args;
+ jdouble result;
+ va_start(args,methodID);
+ result = functions->CallNonvirtualDoubleMethodV(this,obj,clazz,
+ methodID,args);
+ va_end(args);
+ return result;
+ }
+ jdouble CallNonvirtualDoubleMethodV(jobject obj, jclass clazz,
+ jmethodID methodID,
+ va_list args) {
+ return functions->CallNonvirtualDoubleMethodV(this,obj,clazz,
+ methodID,args);
+ }
+ jdouble CallNonvirtualDoubleMethodA(jobject obj, jclass clazz,
+ jmethodID methodID,
+ const jvalue * args) {
+ return functions->CallNonvirtualDoubleMethodA(this,obj,clazz,
+ methodID,args);
+ }
+
+ void CallNonvirtualVoidMethod(jobject obj, jclass clazz,
+ jmethodID methodID, ...) {
+ va_list args;
+ va_start(args,methodID);
+ functions->CallNonvirtualVoidMethodV(this,obj,clazz,methodID,args);
+ va_end(args);
+ }
+ void CallNonvirtualVoidMethodV(jobject obj, jclass clazz,
+ jmethodID methodID,
+ va_list args) {
+ functions->CallNonvirtualVoidMethodV(this,obj,clazz,methodID,args);
+ }
+ void CallNonvirtualVoidMethodA(jobject obj, jclass clazz,
+ jmethodID methodID,
+ const jvalue * args) {
+ functions->CallNonvirtualVoidMethodA(this,obj,clazz,methodID,args);
+ }
+
+ jfieldID GetFieldID(jclass clazz, const char *name,
+ const char *sig) {
+ return functions->GetFieldID(this,clazz,name,sig);
+ }
+
+ jobject GetObjectField(jobject obj, jfieldID fieldID) {
+ return functions->GetObjectField(this,obj,fieldID);
+ }
+ jboolean GetBooleanField(jobject obj, jfieldID fieldID) {
+ return functions->GetBooleanField(this,obj,fieldID);
+ }
+ jbyte GetByteField(jobject obj, jfieldID fieldID) {
+ return functions->GetByteField(this,obj,fieldID);
+ }
+ jchar GetCharField(jobject obj, jfieldID fieldID) {
+ return functions->GetCharField(this,obj,fieldID);
+ }
+ jshort GetShortField(jobject obj, jfieldID fieldID) {
+ return functions->GetShortField(this,obj,fieldID);
+ }
+ jint GetIntField(jobject obj, jfieldID fieldID) {
+ return functions->GetIntField(this,obj,fieldID);
+ }
+ jlong GetLongField(jobject obj, jfieldID fieldID) {
+ return functions->GetLongField(this,obj,fieldID);
+ }
+ jfloat GetFloatField(jobject obj, jfieldID fieldID) {
+ return functions->GetFloatField(this,obj,fieldID);
+ }
+ jdouble GetDoubleField(jobject obj, jfieldID fieldID) {
+ return functions->GetDoubleField(this,obj,fieldID);
+ }
+
+ void SetObjectField(jobject obj, jfieldID fieldID, jobject val) {
+ functions->SetObjectField(this,obj,fieldID,val);
+ }
+ void SetBooleanField(jobject obj, jfieldID fieldID,
+ jboolean val) {
+ functions->SetBooleanField(this,obj,fieldID,val);
+ }
+ void SetByteField(jobject obj, jfieldID fieldID,
+ jbyte val) {
+ functions->SetByteField(this,obj,fieldID,val);
+ }
+ void SetCharField(jobject obj, jfieldID fieldID,
+ jchar val) {
+ functions->SetCharField(this,obj,fieldID,val);
+ }
+ void SetShortField(jobject obj, jfieldID fieldID,
+ jshort val) {
+ functions->SetShortField(this,obj,fieldID,val);
+ }
+ void SetIntField(jobject obj, jfieldID fieldID,
+ jint val) {
+ functions->SetIntField(this,obj,fieldID,val);
+ }
+ void SetLongField(jobject obj, jfieldID fieldID,
+ jlong val) {
+ functions->SetLongField(this,obj,fieldID,val);
+ }
+ void SetFloatField(jobject obj, jfieldID fieldID,
+ jfloat val) {
+ functions->SetFloatField(this,obj,fieldID,val);
+ }
+ void SetDoubleField(jobject obj, jfieldID fieldID,
+ jdouble val) {
+ functions->SetDoubleField(this,obj,fieldID,val);
+ }
+
+ jmethodID GetStaticMethodID(jclass clazz, const char *name,
+ const char *sig) {
+ return functions->GetStaticMethodID(this,clazz,name,sig);
+ }
+
+ jobject CallStaticObjectMethod(jclass clazz, jmethodID methodID,
+ ...) {
+ va_list args;
+ jobject result;
+ va_start(args,methodID);
+ result = functions->CallStaticObjectMethodV(this,clazz,methodID,args);
+ va_end(args);
+ return result;
+ }
+ jobject CallStaticObjectMethodV(jclass clazz, jmethodID methodID,
+ va_list args) {
+ return functions->CallStaticObjectMethodV(this,clazz,methodID,args);
+ }
+ jobject CallStaticObjectMethodA(jclass clazz, jmethodID methodID,
+ const jvalue *args) {
+ return functions->CallStaticObjectMethodA(this,clazz,methodID,args);
+ }
+
+ jboolean CallStaticBooleanMethod(jclass clazz,
+ jmethodID methodID, ...) {
+ va_list args;
+ jboolean result;
+ va_start(args,methodID);
+ result = functions->CallStaticBooleanMethodV(this,clazz,methodID,args);
+ va_end(args);
+ return result;
+ }
+ jboolean CallStaticBooleanMethodV(jclass clazz,
+ jmethodID methodID, va_list args) {
+ return functions->CallStaticBooleanMethodV(this,clazz,methodID,args);
+ }
+ jboolean CallStaticBooleanMethodA(jclass clazz,
+ jmethodID methodID, const jvalue *args) {
+ return functions->CallStaticBooleanMethodA(this,clazz,methodID,args);
+ }
+
+ jbyte CallStaticByteMethod(jclass clazz,
+ jmethodID methodID, ...) {
+ va_list args;
+ jbyte result;
+ va_start(args,methodID);
+ result = functions->CallStaticByteMethodV(this,clazz,methodID,args);
+ va_end(args);
+ return result;
+ }
+ jbyte CallStaticByteMethodV(jclass clazz,
+ jmethodID methodID, va_list args) {
+ return functions->CallStaticByteMethodV(this,clazz,methodID,args);
+ }
+ jbyte CallStaticByteMethodA(jclass clazz,
+ jmethodID methodID, const jvalue *args) {
+ return functions->CallStaticByteMethodA(this,clazz,methodID,args);
+ }
+
+ jchar CallStaticCharMethod(jclass clazz,
+ jmethodID methodID, ...) {
+ va_list args;
+ jchar result;
+ va_start(args,methodID);
+ result = functions->CallStaticCharMethodV(this,clazz,methodID,args);
+ va_end(args);
+ return result;
+ }
+ jchar CallStaticCharMethodV(jclass clazz,
+ jmethodID methodID, va_list args) {
+ return functions->CallStaticCharMethodV(this,clazz,methodID,args);
+ }
+ jchar CallStaticCharMethodA(jclass clazz,
+ jmethodID methodID, const jvalue *args) {
+ return functions->CallStaticCharMethodA(this,clazz,methodID,args);
+ }
+
+ jshort CallStaticShortMethod(jclass clazz,
+ jmethodID methodID, ...) {
+ va_list args;
+ jshort result;
+ va_start(args,methodID);
+ result = functions->CallStaticShortMethodV(this,clazz,methodID,args);
+ va_end(args);
+ return result;
+ }
+ jshort CallStaticShortMethodV(jclass clazz,
+ jmethodID methodID, va_list args) {
+ return functions->CallStaticShortMethodV(this,clazz,methodID,args);
+ }
+ jshort CallStaticShortMethodA(jclass clazz,
+ jmethodID methodID, const jvalue *args) {
+ return functions->CallStaticShortMethodA(this,clazz,methodID,args);
+ }
+
+ jint CallStaticIntMethod(jclass clazz,
+ jmethodID methodID, ...) {
+ va_list args;
+ jint result;
+ va_start(args,methodID);
+ result = functions->CallStaticIntMethodV(this,clazz,methodID,args);
+ va_end(args);
+ return result;
+ }
+ jint CallStaticIntMethodV(jclass clazz,
+ jmethodID methodID, va_list args) {
+ return functions->CallStaticIntMethodV(this,clazz,methodID,args);
+ }
+ jint CallStaticIntMethodA(jclass clazz,
+ jmethodID methodID, const jvalue *args) {
+ return functions->CallStaticIntMethodA(this,clazz,methodID,args);
+ }
+
+ jlong CallStaticLongMethod(jclass clazz,
+ jmethodID methodID, ...) {
+ va_list args;
+ jlong result;
+ va_start(args,methodID);
+ result = functions->CallStaticLongMethodV(this,clazz,methodID,args);
+ va_end(args);
+ return result;
+ }
+ jlong CallStaticLongMethodV(jclass clazz,
+ jmethodID methodID, va_list args) {
+ return functions->CallStaticLongMethodV(this,clazz,methodID,args);
+ }
+ jlong CallStaticLongMethodA(jclass clazz,
+ jmethodID methodID, const jvalue *args) {
+ return functions->CallStaticLongMethodA(this,clazz,methodID,args);
+ }
+
+ jfloat CallStaticFloatMethod(jclass clazz,
+ jmethodID methodID, ...) {
+ va_list args;
+ jfloat result;
+ va_start(args,methodID);
+ result = functions->CallStaticFloatMethodV(this,clazz,methodID,args);
+ va_end(args);
+ return result;
+ }
+ jfloat CallStaticFloatMethodV(jclass clazz,
+ jmethodID methodID, va_list args) {
+ return functions->CallStaticFloatMethodV(this,clazz,methodID,args);
+ }
+ jfloat CallStaticFloatMethodA(jclass clazz,
+ jmethodID methodID, const jvalue *args) {
+ return functions->CallStaticFloatMethodA(this,clazz,methodID,args);
+ }
+
+ jdouble CallStaticDoubleMethod(jclass clazz,
+ jmethodID methodID, ...) {
+ va_list args;
+ jdouble result;
+ va_start(args,methodID);
+ result = functions->CallStaticDoubleMethodV(this,clazz,methodID,args);
+ va_end(args);
+ return result;
+ }
+ jdouble CallStaticDoubleMethodV(jclass clazz,
+ jmethodID methodID, va_list args) {
+ return functions->CallStaticDoubleMethodV(this,clazz,methodID,args);
+ }
+ jdouble CallStaticDoubleMethodA(jclass clazz,
+ jmethodID methodID, const jvalue *args) {
+ return functions->CallStaticDoubleMethodA(this,clazz,methodID,args);
+ }
+
+ void CallStaticVoidMethod(jclass cls, jmethodID methodID, ...) {
+ va_list args;
+ va_start(args,methodID);
+ functions->CallStaticVoidMethodV(this,cls,methodID,args);
+ va_end(args);
+ }
+ void CallStaticVoidMethodV(jclass cls, jmethodID methodID,
+ va_list args) {
+ functions->CallStaticVoidMethodV(this,cls,methodID,args);
+ }
+ void CallStaticVoidMethodA(jclass cls, jmethodID methodID,
+ const jvalue * args) {
+ functions->CallStaticVoidMethodA(this,cls,methodID,args);
+ }
+
+ jfieldID GetStaticFieldID(jclass clazz, const char *name,
+ const char *sig) {
+ return functions->GetStaticFieldID(this,clazz,name,sig);
+ }
+ jobject GetStaticObjectField(jclass clazz, jfieldID fieldID) {
+ return functions->GetStaticObjectField(this,clazz,fieldID);
+ }
+ jboolean GetStaticBooleanField(jclass clazz, jfieldID fieldID) {
+ return functions->GetStaticBooleanField(this,clazz,fieldID);
+ }
+ jbyte GetStaticByteField(jclass clazz, jfieldID fieldID) {
+ return functions->GetStaticByteField(this,clazz,fieldID);
+ }
+ jchar GetStaticCharField(jclass clazz, jfieldID fieldID) {
+ return functions->GetStaticCharField(this,clazz,fieldID);
+ }
+ jshort GetStaticShortField(jclass clazz, jfieldID fieldID) {
+ return functions->GetStaticShortField(this,clazz,fieldID);
+ }
+ jint GetStaticIntField(jclass clazz, jfieldID fieldID) {
+ return functions->GetStaticIntField(this,clazz,fieldID);
+ }
+ jlong GetStaticLongField(jclass clazz, jfieldID fieldID) {
+ return functions->GetStaticLongField(this,clazz,fieldID);
+ }
+ jfloat GetStaticFloatField(jclass clazz, jfieldID fieldID) {
+ return functions->GetStaticFloatField(this,clazz,fieldID);
+ }
+ jdouble GetStaticDoubleField(jclass clazz, jfieldID fieldID) {
+ return functions->GetStaticDoubleField(this,clazz,fieldID);
+ }
+
+ void SetStaticObjectField(jclass clazz, jfieldID fieldID,
+ jobject value) {
+ functions->SetStaticObjectField(this,clazz,fieldID,value);
+ }
+ void SetStaticBooleanField(jclass clazz, jfieldID fieldID,
+ jboolean value) {
+ functions->SetStaticBooleanField(this,clazz,fieldID,value);
+ }
+ void SetStaticByteField(jclass clazz, jfieldID fieldID,
+ jbyte value) {
+ functions->SetStaticByteField(this,clazz,fieldID,value);
+ }
+ void SetStaticCharField(jclass clazz, jfieldID fieldID,
+ jchar value) {
+ functions->SetStaticCharField(this,clazz,fieldID,value);
+ }
+ void SetStaticShortField(jclass clazz, jfieldID fieldID,
+ jshort value) {
+ functions->SetStaticShortField(this,clazz,fieldID,value);
+ }
+ void SetStaticIntField(jclass clazz, jfieldID fieldID,
+ jint value) {
+ functions->SetStaticIntField(this,clazz,fieldID,value);
+ }
+ void SetStaticLongField(jclass clazz, jfieldID fieldID,
+ jlong value) {
+ functions->SetStaticLongField(this,clazz,fieldID,value);
+ }
+ void SetStaticFloatField(jclass clazz, jfieldID fieldID,
+ jfloat value) {
+ functions->SetStaticFloatField(this,clazz,fieldID,value);
+ }
+ void SetStaticDoubleField(jclass clazz, jfieldID fieldID,
+ jdouble value) {
+ functions->SetStaticDoubleField(this,clazz,fieldID,value);
+ }
+
+ jstring NewString(const jchar *unicode, jsize len) {
+ return functions->NewString(this,unicode,len);
+ }
+ jsize GetStringLength(jstring str) {
+ return functions->GetStringLength(this,str);
+ }
+ const jchar *GetStringChars(jstring str, jboolean *isCopy) {
+ return functions->GetStringChars(this,str,isCopy);
+ }
+ void ReleaseStringChars(jstring str, const jchar *chars) {
+ functions->ReleaseStringChars(this,str,chars);
+ }
+
+ jstring NewStringUTF(const char *utf) {
+ return functions->NewStringUTF(this,utf);
+ }
+ jsize GetStringUTFLength(jstring str) {
+ return functions->GetStringUTFLength(this,str);
+ }
+ const char* GetStringUTFChars(jstring str, jboolean *isCopy) {
+ return functions->GetStringUTFChars(this,str,isCopy);
+ }
+ void ReleaseStringUTFChars(jstring str, const char* chars) {
+ functions->ReleaseStringUTFChars(this,str,chars);
+ }
+
+ jsize GetArrayLength(jarray array) {
+ return functions->GetArrayLength(this,array);
+ }
+
+ jobjectArray NewObjectArray(jsize len, jclass clazz,
+ jobject init) {
+ return functions->NewObjectArray(this,len,clazz,init);
+ }
+ jobject GetObjectArrayElement(jobjectArray array, jsize index) {
+ return functions->GetObjectArrayElement(this,array,index);
+ }
+ void SetObjectArrayElement(jobjectArray array, jsize index,
+ jobject val) {
+ functions->SetObjectArrayElement(this,array,index,val);
+ }
+
+ jbooleanArray NewBooleanArray(jsize len) {
+ return functions->NewBooleanArray(this,len);
+ }
+ jbyteArray NewByteArray(jsize len) {
+ return functions->NewByteArray(this,len);
+ }
+ jcharArray NewCharArray(jsize len) {
+ return functions->NewCharArray(this,len);
+ }
+ jshortArray NewShortArray(jsize len) {
+ return functions->NewShortArray(this,len);
+ }
+ jintArray NewIntArray(jsize len) {
+ return functions->NewIntArray(this,len);
+ }
+ jlongArray NewLongArray(jsize len) {
+ return functions->NewLongArray(this,len);
+ }
+ jfloatArray NewFloatArray(jsize len) {
+ return functions->NewFloatArray(this,len);
+ }
+ jdoubleArray NewDoubleArray(jsize len) {
+ return functions->NewDoubleArray(this,len);
+ }
+
+ jboolean * GetBooleanArrayElements(jbooleanArray array, jboolean *isCopy) {
+ return functions->GetBooleanArrayElements(this,array,isCopy);
+ }
+ jbyte * GetByteArrayElements(jbyteArray array, jboolean *isCopy) {
+ return functions->GetByteArrayElements(this,array,isCopy);
+ }
+ jchar * GetCharArrayElements(jcharArray array, jboolean *isCopy) {
+ return functions->GetCharArrayElements(this,array,isCopy);
+ }
+ jshort * GetShortArrayElements(jshortArray array, jboolean *isCopy) {
+ return functions->GetShortArrayElements(this,array,isCopy);
+ }
+ jint * GetIntArrayElements(jintArray array, jboolean *isCopy) {
+ return functions->GetIntArrayElements(this,array,isCopy);
+ }
+ jlong * GetLongArrayElements(jlongArray array, jboolean *isCopy) {
+ return functions->GetLongArrayElements(this,array,isCopy);
+ }
+ jfloat * GetFloatArrayElements(jfloatArray array, jboolean *isCopy) {
+ return functions->GetFloatArrayElements(this,array,isCopy);
+ }
+ jdouble * GetDoubleArrayElements(jdoubleArray array, jboolean *isCopy) {
+ return functions->GetDoubleArrayElements(this,array,isCopy);
+ }
+
+ void ReleaseBooleanArrayElements(jbooleanArray array,
+ jboolean *elems,
+ jint mode) {
+ functions->ReleaseBooleanArrayElements(this,array,elems,mode);
+ }
+ void ReleaseByteArrayElements(jbyteArray array,
+ jbyte *elems,
+ jint mode) {
+ functions->ReleaseByteArrayElements(this,array,elems,mode);
+ }
+ void ReleaseCharArrayElements(jcharArray array,
+ jchar *elems,
+ jint mode) {
+ functions->ReleaseCharArrayElements(this,array,elems,mode);
+ }
+ void ReleaseShortArrayElements(jshortArray array,
+ jshort *elems,
+ jint mode) {
+ functions->ReleaseShortArrayElements(this,array,elems,mode);
+ }
+ void ReleaseIntArrayElements(jintArray array,
+ jint *elems,
+ jint mode) {
+ functions->ReleaseIntArrayElements(this,array,elems,mode);
+ }
+ void ReleaseLongArrayElements(jlongArray array,
+ jlong *elems,
+ jint mode) {
+ functions->ReleaseLongArrayElements(this,array,elems,mode);
+ }
+ void ReleaseFloatArrayElements(jfloatArray array,
+ jfloat *elems,
+ jint mode) {
+ functions->ReleaseFloatArrayElements(this,array,elems,mode);
+ }
+ void ReleaseDoubleArrayElements(jdoubleArray array,
+ jdouble *elems,
+ jint mode) {
+ functions->ReleaseDoubleArrayElements(this,array,elems,mode);
+ }
+
+ void GetBooleanArrayRegion(jbooleanArray array,
+ jsize start, jsize len, jboolean *buf) {
+ functions->GetBooleanArrayRegion(this,array,start,len,buf);
+ }
+ void GetByteArrayRegion(jbyteArray array,
+ jsize start, jsize len, jbyte *buf) {
+ functions->GetByteArrayRegion(this,array,start,len,buf);
+ }
+ void GetCharArrayRegion(jcharArray array,
+ jsize start, jsize len, jchar *buf) {
+ functions->GetCharArrayRegion(this,array,start,len,buf);
+ }
+ void GetShortArrayRegion(jshortArray array,
+ jsize start, jsize len, jshort *buf) {
+ functions->GetShortArrayRegion(this,array,start,len,buf);
+ }
+ void GetIntArrayRegion(jintArray array,
+ jsize start, jsize len, jint *buf) {
+ functions->GetIntArrayRegion(this,array,start,len,buf);
+ }
+ void GetLongArrayRegion(jlongArray array,
+ jsize start, jsize len, jlong *buf) {
+ functions->GetLongArrayRegion(this,array,start,len,buf);
+ }
+ void GetFloatArrayRegion(jfloatArray array,
+ jsize start, jsize len, jfloat *buf) {
+ functions->GetFloatArrayRegion(this,array,start,len,buf);
+ }
+ void GetDoubleArrayRegion(jdoubleArray array,
+ jsize start, jsize len, jdouble *buf) {
+ functions->GetDoubleArrayRegion(this,array,start,len,buf);
+ }
+
+ void SetBooleanArrayRegion(jbooleanArray array, jsize start, jsize len,
+ const jboolean *buf) {
+ functions->SetBooleanArrayRegion(this,array,start,len,buf);
+ }
+ void SetByteArrayRegion(jbyteArray array, jsize start, jsize len,
+ const jbyte *buf) {
+ functions->SetByteArrayRegion(this,array,start,len,buf);
+ }
+ void SetCharArrayRegion(jcharArray array, jsize start, jsize len,
+ const jchar *buf) {
+ functions->SetCharArrayRegion(this,array,start,len,buf);
+ }
+ void SetShortArrayRegion(jshortArray array, jsize start, jsize len,
+ const jshort *buf) {
+ functions->SetShortArrayRegion(this,array,start,len,buf);
+ }
+ void SetIntArrayRegion(jintArray array, jsize start, jsize len,
+ const jint *buf) {
+ functions->SetIntArrayRegion(this,array,start,len,buf);
+ }
+ void SetLongArrayRegion(jlongArray array, jsize start, jsize len,
+ const jlong *buf) {
+ functions->SetLongArrayRegion(this,array,start,len,buf);
+ }
+ void SetFloatArrayRegion(jfloatArray array, jsize start, jsize len,
+ const jfloat *buf) {
+ functions->SetFloatArrayRegion(this,array,start,len,buf);
+ }
+ void SetDoubleArrayRegion(jdoubleArray array, jsize start, jsize len,
+ const jdouble *buf) {
+ functions->SetDoubleArrayRegion(this,array,start,len,buf);
+ }
+
+ jint RegisterNatives(jclass clazz, const JNINativeMethod *methods,
+ jint nMethods) {
+ return functions->RegisterNatives(this,clazz,methods,nMethods);
+ }
+ jint UnregisterNatives(jclass clazz) {
+ return functions->UnregisterNatives(this,clazz);
+ }
+
+ jint MonitorEnter(jobject obj) {
+ return functions->MonitorEnter(this,obj);
+ }
+ jint MonitorExit(jobject obj) {
+ return functions->MonitorExit(this,obj);
+ }
+
+ jint GetJavaVM(JavaVM **vm) {
+ return functions->GetJavaVM(this,vm);
+ }
+
+ void GetStringRegion(jstring str, jsize start, jsize len, jchar *buf) {
+ functions->GetStringRegion(this,str,start,len,buf);
+ }
+ void GetStringUTFRegion(jstring str, jsize start, jsize len, char *buf) {
+ functions->GetStringUTFRegion(this,str,start,len,buf);
+ }
+
+ void * GetPrimitiveArrayCritical(jarray array, jboolean *isCopy) {
+ return functions->GetPrimitiveArrayCritical(this,array,isCopy);
+ }
+ void ReleasePrimitiveArrayCritical(jarray array, void *carray, jint mode) {
+ functions->ReleasePrimitiveArrayCritical(this,array,carray,mode);
+ }
+
+ const jchar * GetStringCritical(jstring string, jboolean *isCopy) {
+ return functions->GetStringCritical(this,string,isCopy);
+ }
+ void ReleaseStringCritical(jstring string, const jchar *cstring) {
+ functions->ReleaseStringCritical(this,string,cstring);
+ }
+
+ jweak NewWeakGlobalRef(jobject obj) {
+ return functions->NewWeakGlobalRef(this,obj);
+ }
+ void DeleteWeakGlobalRef(jweak ref) {
+ functions->DeleteWeakGlobalRef(this,ref);
+ }
+
+ jboolean ExceptionCheck() {
+ return functions->ExceptionCheck(this);
+ }
+
+ jobject NewDirectByteBuffer(void* address, jlong capacity) {
+ return functions->NewDirectByteBuffer(this, address, capacity);
+ }
+ void* GetDirectBufferAddress(jobject buf) {
+ return functions->GetDirectBufferAddress(this, buf);
+ }
+ jlong GetDirectBufferCapacity(jobject buf) {
+ return functions->GetDirectBufferCapacity(this, buf);
+ }
+ jobjectRefType GetObjectRefType(jobject obj) {
+ return functions->GetObjectRefType(this, obj);
+ }
+
+#endif /* __cplusplus */
+};
+
+typedef struct JavaVMOption {
+ char *optionString;
+ void *extraInfo;
+} JavaVMOption;
+
+typedef struct JavaVMInitArgs {
+ jint version;
+
+ jint nOptions;
+ JavaVMOption *options;
+ jboolean ignoreUnrecognized;
+} JavaVMInitArgs;
+
+typedef struct JavaVMAttachArgs {
+ jint version;
+
+ char *name;
+ jobject group;
+} JavaVMAttachArgs;
+
+#define JDK1_2
+#define JDK1_4
+
+struct JNIInvokeInterface_ {
+ void *reserved0;
+ void *reserved1;
+ void *reserved2;
+
+ jint (JNICALL *DestroyJavaVM)(JavaVM *vm);
+
+ jint (JNICALL *AttachCurrentThread)(JavaVM *vm, void **penv, void *args);
+
+ jint (JNICALL *DetachCurrentThread)(JavaVM *vm);
+
+ jint (JNICALL *GetEnv)(JavaVM *vm, void **penv, jint version);
+
+ jint (JNICALL *AttachCurrentThreadAsDaemon)(JavaVM *vm, void **penv, void *args);
+};
+
+struct JavaVM_ {
+ const struct JNIInvokeInterface_ *functions;
+#ifdef __cplusplus
+
+ jint DestroyJavaVM() {
+ return functions->DestroyJavaVM(this);
+ }
+ jint AttachCurrentThread(void **penv, void *args) {
+ return functions->AttachCurrentThread(this, penv, args);
+ }
+ jint DetachCurrentThread() {
+ return functions->DetachCurrentThread(this);
+ }
+
+ jint GetEnv(void **penv, jint version) {
+ return functions->GetEnv(this, penv, version);
+ }
+ jint AttachCurrentThreadAsDaemon(void **penv, void *args) {
+ return functions->AttachCurrentThreadAsDaemon(this, penv, args);
+ }
+#endif
+};
+
+#ifdef _JNI_IMPLEMENTATION_
+#define _JNI_IMPORT_OR_EXPORT_ JNIEXPORT
+#else
+#define _JNI_IMPORT_OR_EXPORT_ JNIIMPORT
+#endif
+_JNI_IMPORT_OR_EXPORT_ jint JNICALL
+JNI_GetDefaultJavaVMInitArgs(void *args);
+
+_JNI_IMPORT_OR_EXPORT_ jint JNICALL
+JNI_CreateJavaVM(JavaVM **pvm, void **penv, void *args);
+
+_JNI_IMPORT_OR_EXPORT_ jint JNICALL
+JNI_GetCreatedJavaVMs(JavaVM **, jsize, jsize *);
+
+JNIEXPORT jint JNICALL
+JNI_OnLoad(JavaVM *vm, void *reserved);
+
+JNIEXPORT void JNICALL
+JNI_OnUnload(JavaVM *vm, void *reserved);
+
+#define JNI_VERSION_1_1 0x00010001
+#define JNI_VERSION_1_2 0x00010002
+#define JNI_VERSION_1_4 0x00010004
+#define JNI_VERSION_1_6 0x00010006
+
+#endif /* __GLUEGEN__ */
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
+
+#endif /* !_JAVASOFT_JNI_H_ */
+
diff -Nru gluegen2-2.2.4/make/stub_includes/jni/macosx/jawt_md.h gluegen2-2.3.2/make/stub_includes/jni/macosx/jawt_md.h
--- gluegen2-2.2.4/make/stub_includes/jni/macosx/jawt_md.h 2014-10-10 13:20:51.000000000 +0000
+++ gluegen2-2.3.2/make/stub_includes/jni/macosx/jawt_md.h 2015-10-09 04:18:28.000000000 +0000
@@ -1,9 +1,4 @@
/**
- * Temporary workaround!
- *
- * Provided darwin/jawt_md.h from Oracle for OSX / Java7
- * has X11 dependencies and does not define JAWT_SurfaceLayers.
- *
* This C header file is derived from Apple's Java SDK provided C header file
* with the following copyright notice:
*
diff -Nru gluegen2-2.2.4/make/stub_includes/jni/macosx/jni_md.h gluegen2-2.3.2/make/stub_includes/jni/macosx/jni_md.h
--- gluegen2-2.2.4/make/stub_includes/jni/macosx/jni_md.h 2014-10-10 13:20:51.000000000 +0000
+++ gluegen2-2.3.2/make/stub_includes/jni/macosx/jni_md.h 2015-10-09 04:18:28.000000000 +0000
@@ -1,9 +1,4 @@
/*
- * Temporary workaround!
- *
- * Provided darwin/jawt_md.h from Oracle for OSX / Java7
- * has X11 dependencies and does not define JAWT_SurfaceLayers.
- *
* @(#)jni_md.h 1.18 03/12/19
*
* This C header file is derived from Sun Microsystem's Java SDK provided C header file
@@ -32,16 +27,20 @@
#ifndef _JAVASOFT_JNI_MD_H_
#define _JAVASOFT_JNI_MD_H_
-#define JNIEXPORT __attribute__((visibility("default")))
-#define JNIIMPORT
-#define JNICALL
+#include
+
+#ifdef __GLUEGEN__
+ #define JNIEXPORT
+ #define JNIIMPORT
+ #define JNICALL
+#else /* __GLUEGEN__ */
+ #define JNIEXPORT __attribute__((visibility("default")))
+ #define JNIIMPORT __attribute__((visibility("default")))
+ #define JNICALL
+#endif /* __GLUEGEN__ */
-#if __LP64__
-typedef int jint;
-#else
-typedef long jint;
-#endif
-typedef long long jlong;
-typedef signed char jbyte;
+typedef int8_t jbyte;
+typedef int32_t jint;
+typedef int64_t jlong;
#endif /* !_JAVASOFT_JNI_MD_H_ */
diff -Nru gluegen2-2.2.4/make/stub_includes/jni/win32/jawt_md.h gluegen2-2.3.2/make/stub_includes/jni/win32/jawt_md.h
--- gluegen2-2.2.4/make/stub_includes/jni/win32/jawt_md.h 1970-01-01 00:00:00.000000000 +0000
+++ gluegen2-2.3.2/make/stub_includes/jni/win32/jawt_md.h 2015-10-09 04:18:28.000000000 +0000
@@ -0,0 +1,54 @@
+/*
+ * @(#)jawt_md.h 1.8 05/11/17
+ *
+ * This C header file is derived from Sun Microsystem's Java SDK provided C header file
+ * with the following copyright notice:
+ *
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ *
+ * This version has complex comments removed and does not contain inlined algorithms etc, if any existed.
+ *
+ * The original C header file was included to JOGL on Sat Jun 21 02:10:30 2008
+ * (commit cbc45e816f4ee81031bffce19a99550681462a24) by Sun Microsystem's staff and were approved.
+ *
+ * This C header file is included due to ensure compatibility with - and invocation of the JAWT protocol.
+ * They are processed by GlueGen to create a Java binding for JAWT invocation only.
+ *
+ * http://ftp.resource.org/courts.gov/c/F3/387/387.F3d.522.03-5400.html (36)
+ * "Atari Games Corp. v. Nintendo of Am., Inc., Nos. 88-4805 & 89-0027, 1993 WL 207548, at *1 (N.D.Cal. May 18, 1993) ("Atari III")
+ * ("Program code that is strictly necessary to achieve current compatibility presents a merger problem, almost by definition,
+ * and is thus excluded from the scope of any copyright.")."
+ *
+ * http://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=OJ:L:2009:111:0016:0022:EN:PDF
+ * L 111/17 (10) and (15)
+ */
+
+#ifndef _JAVASOFT_JAWT_MD_H_
+#define _JAVASOFT_JAWT_MD_H_
+
+#include
+#include "jawt.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct jawt_Win32DrawingSurfaceInfo {
+ /**
+ union {
+ HWND hwnd;
+ HBITMAP hbitmap;
+ void* pbits;
+ }; */
+ HWND handle;
+
+ HDC hdc;
+ HPALETTE hpalette;
+} JAWT_Win32DrawingSurfaceInfo;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_JAVASOFT_JAWT_MD_H_ */
diff -Nru gluegen2-2.2.4/make/stub_includes/jni/win32/jni_md.h gluegen2-2.3.2/make/stub_includes/jni/win32/jni_md.h
--- gluegen2-2.2.4/make/stub_includes/jni/win32/jni_md.h 1970-01-01 00:00:00.000000000 +0000
+++ gluegen2-2.3.2/make/stub_includes/jni/win32/jni_md.h 2015-10-09 04:18:28.000000000 +0000
@@ -0,0 +1,46 @@
+/*
+ * @(#)jni_md.h 1.15 05/11/17
+ *
+ * This C header file is derived from Sun Microsystem's Java SDK provided C header file
+ * with the following copyright notice:
+ *
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ *
+ * This version has complex comments removed and does not contain inlined algorithms etc, if any existed.
+ *
+ * The original C header file was included to JOGL on Sat Jun 21 02:10:30 2008
+ * (commit cbc45e816f4ee81031bffce19a99550681462a24) by Sun Microsystem's staff and were approved.
+ *
+ * This C header file is included due to ensure compatibility with - and invocation of the JAWT protocol.
+ * They are processed by GlueGen to create a Java binding for JAWT invocation only.
+ *
+ * http://ftp.resource.org/courts.gov/c/F3/387/387.F3d.522.03-5400.html (36)
+ * "Atari Games Corp. v. Nintendo of Am., Inc., Nos. 88-4805 & 89-0027, 1993 WL 207548, at *1 (N.D.Cal. May 18, 1993) ("Atari III")
+ * ("Program code that is strictly necessary to achieve current compatibility presents a merger problem, almost by definition,
+ * and is thus excluded from the scope of any copyright.")."
+ *
+ * http://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=OJ:L:2009:111:0016:0022:EN:PDF
+ * L 111/17 (10) and (15)
+ */
+
+#ifndef _JAVASOFT_JNI_MD_H_
+#define _JAVASOFT_JNI_MD_H_
+
+#include
+
+#ifdef __GLUEGEN__
+ #define JNIEXPORT
+ #define JNIIMPORT
+ #define JNICALL
+#else /* __GLUEGEN__ */
+ #define JNIEXPORT __declspec(dllexport)
+ #define JNIIMPORT __declspec(dllimport)
+ #define JNICALL __stdcall
+#endif /* __GLUEGEN__ */
+
+typedef int8_t jbyte;
+typedef int32_t jint;
+typedef int64_t jlong;
+
+#endif /* !_JAVASOFT_JNI_MD_H_ */
diff -Nru gluegen2-2.2.4/make/stub_includes/jni/x11/jawt_md.h gluegen2-2.3.2/make/stub_includes/jni/x11/jawt_md.h
--- gluegen2-2.2.4/make/stub_includes/jni/x11/jawt_md.h 1970-01-01 00:00:00.000000000 +0000
+++ gluegen2-2.3.2/make/stub_includes/jni/x11/jawt_md.h 2015-10-09 04:18:28.000000000 +0000
@@ -0,0 +1,56 @@
+/*
+ * @(#)jawt_md.h 1.12 05/11/17
+ *
+ * This C header file is derived from Sun Microsystem's Java SDK provided C header file
+ * with the following copyright notice:
+ *
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ *
+ * This version has complex comments removed and does not contain inlined algorithms etc, if any existed.
+ *
+ * The original C header file was included to JOGL on Sat Jun 21 02:10:30 2008
+ * (commit cbc45e816f4ee81031bffce19a99550681462a24) by Sun Microsystem's staff and were approved.
+ *
+ * This C header file is included due to ensure compatibility with - and invocation of the JAWT protocol.
+ * They are processed by GlueGen to create a Java binding for JAWT invocation only.
+ *
+ * http://ftp.resource.org/courts.gov/c/F3/387/387.F3d.522.03-5400.html (36)
+ * "Atari Games Corp. v. Nintendo of Am., Inc., Nos. 88-4805 & 89-0027, 1993 WL 207548, at *1 (N.D.Cal. May 18, 1993) ("Atari III")
+ * ("Program code that is strictly necessary to achieve current compatibility presents a merger problem, almost by definition,
+ * and is thus excluded from the scope of any copyright.")."
+ *
+ * http://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=OJ:L:2009:111:0016:0022:EN:PDF
+ * L 111/17 (10) and (15)
+ */
+
+#ifndef _JAVASOFT_JAWT_MD_H_
+#define _JAVASOFT_JAWT_MD_H_
+
+#include
+#include
+#include
+#include "jawt.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct jawt_X11DrawingSurfaceInfo {
+ Drawable drawable;
+ Display* display;
+ VisualID visualID;
+ Colormap colormapID;
+ int depth;
+ /*
+ * Since 1.4
+ */
+ int (JNICALL *GetAWTColor)(JAWT_DrawingSurface* ds,
+ int r, int g, int b);
+} JAWT_X11DrawingSurfaceInfo;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_JAVASOFT_JAWT_MD_H_ */
diff -Nru gluegen2-2.2.4/make/stub_includes/jni/x11/jni_md.h gluegen2-2.3.2/make/stub_includes/jni/x11/jni_md.h
--- gluegen2-2.2.4/make/stub_includes/jni/x11/jni_md.h 1970-01-01 00:00:00.000000000 +0000
+++ gluegen2-2.3.2/make/stub_includes/jni/x11/jni_md.h 2015-10-09 04:18:28.000000000 +0000
@@ -0,0 +1,40 @@
+/*
+ * @(#)jni_md.h 1.19 05/11/17
+ *
+ * This C header file is derived from Sun Microsystem's Java SDK provided C header file
+ * with the following copyright notice:
+ *
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ *
+ * This version has complex comments removed and does not contain inlined algorithms etc, if any existed.
+ *
+ * The original C header file was included to JOGL on Sat Jun 21 02:10:30 2008
+ * (commit cbc45e816f4ee81031bffce19a99550681462a24) by Sun Microsystem's staff and were approved.
+ *
+ * This C header file is included due to ensure compatibility with - and invocation of the JAWT protocol.
+ * They are processed by GlueGen to create a Java binding for JAWT invocation only.
+ *
+ * http://ftp.resource.org/courts.gov/c/F3/387/387.F3d.522.03-5400.html (36)
+ * "Atari Games Corp. v. Nintendo of Am., Inc., Nos. 88-4805 & 89-0027, 1993 WL 207548, at *1 (N.D.Cal. May 18, 1993) ("Atari III")
+ * ("Program code that is strictly necessary to achieve current compatibility presents a merger problem, almost by definition,
+ * and is thus excluded from the scope of any copyright.")."
+ *
+ * http://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=OJ:L:2009:111:0016:0022:EN:PDF
+ * L 111/17 (10) and (15)
+ */
+
+#ifndef _JAVASOFT_JNI_MD_H_
+#define _JAVASOFT_JNI_MD_H_
+
+#include
+
+#define JNIEXPORT
+#define JNIIMPORT
+#define JNICALL
+
+typedef int8_t jbyte;
+typedef int32_t jint;
+typedef int64_t jlong;
+
+#endif /* !_JAVASOFT_JNI_MD_H_ */
diff -Nru gluegen2-2.2.4/make/stub_includes/os/elf_header.h gluegen2-2.3.2/make/stub_includes/os/elf_header.h
--- gluegen2-2.2.4/make/stub_includes/os/elf_header.h 2014-10-10 13:20:51.000000000 +0000
+++ gluegen2-2.3.2/make/stub_includes/os/elf_header.h 2015-10-09 04:18:28.000000000 +0000
@@ -15,6 +15,9 @@
uint16_t e_type;
uint16_t e_machine;
uint32_t e_version;
+} Ehdr_p1;
+
+typedef struct {
ElfN_Addr e_entry;
ElfN_Off e_phoff;
ElfN_Off e_shoff;
@@ -25,7 +28,7 @@
uint16_t e_shentsize;
uint16_t e_shnum;
uint16_t e_shstrndx;
-} Ehdr;
+} Ehdr_p2;
typedef struct {
uint32_t sh_name;
diff -Nru gluegen2-2.2.4/make/stub_includes/platform/glibc-compat-symbols.h gluegen2-2.3.2/make/stub_includes/platform/glibc-compat-symbols.h
--- gluegen2-2.2.4/make/stub_includes/platform/glibc-compat-symbols.h 2014-10-10 13:20:51.000000000 +0000
+++ gluegen2-2.3.2/make/stub_includes/platform/glibc-compat-symbols.h 2015-10-09 04:18:28.000000000 +0000
@@ -17,7 +17,9 @@
*/
#if defined(__linux__) /* Actually we like to test whether we link against GLIBC .. */
#if defined(__GNUC__)
- #if defined(__arm__)
+ #if defined(__aarch64__)
+ #define GLIBC_COMPAT_SYMBOL(FFF) __asm__(".symver " #FFF "," #FFF "@GLIBC_2.4");
+ #elif defined(__arm__)
#define GLIBC_COMPAT_SYMBOL(FFF) __asm__(".symver " #FFF "," #FFF "@GLIBC_2.4");
#elif defined(__amd64__)
#define GLIBC_COMPAT_SYMBOL(FFF) __asm__(".symver " #FFF "," #FFF "@GLIBC_2.2.5");
@@ -25,7 +27,9 @@
#define GLIBC_COMPAT_SYMBOL(FFF) __asm__(".symver " #FFF "," #FFF "@GLIBC_2.0");
#endif /*__amd64__*/
#elif defined(__clang__)
- #if defined(__arm__)
+ #if defined(__aarch64__)
+ #define GLIBC_COMPAT_SYMBOL(FFF) asm(".symver " #FFF "," #FFF "@GLIBC_2.4");
+ #elif defined(__arm__)
#define GLIBC_COMPAT_SYMBOL(FFF) asm(".symver " #FFF "," #FFF "@GLIBC_2.4");
#elif defined(__amd64__)
#define GLIBC_COMPAT_SYMBOL(FFF) asm(".symver " #FFF "," #FFF "@GLIBC_2.2.5");
diff -Nru gluegen2-2.2.4/make/stub_includes/platform/gluegen_stddef.h gluegen2-2.3.2/make/stub_includes/platform/gluegen_stddef.h
--- gluegen2-2.2.4/make/stub_includes/platform/gluegen_stddef.h 2014-10-10 13:20:51.000000000 +0000
+++ gluegen2-2.3.2/make/stub_includes/platform/gluegen_stddef.h 2015-10-09 04:18:28.000000000 +0000
@@ -15,7 +15,7 @@
#elif defined(_WIN32)
typedef __int32 ptrdiff_t;
typedef unsigned __int32 size_t;
-#elif defined(__ia64__) || defined(__x86_64__)
+#elif defined(__LP64__) || defined(__ia64__) || defined(__x86_64__) || defined(__aarch64__)
typedef long ptrdiff_t;
typedef unsigned long size_t;
#else
diff -Nru gluegen2-2.2.4/make/stub_includes/platform/gluegen_stdint.h gluegen2-2.3.2/make/stub_includes/platform/gluegen_stdint.h
--- gluegen2-2.2.4/make/stub_includes/platform/gluegen_stdint.h 2014-10-10 13:20:51.000000000 +0000
+++ gluegen2-2.3.2/make/stub_includes/platform/gluegen_stdint.h 2015-10-09 04:18:28.000000000 +0000
@@ -33,7 +33,7 @@
typedef __int32 intptr_t;
typedef unsigned __int32 uintptr_t;
-#elif defined(__ia64__) || defined(__x86_64__)
+#elif defined(__LP64__) || defined(__ia64__) || defined(__x86_64__) || defined(__aarch64__)
typedef signed char int8_t;
typedef unsigned char uint8_t;
typedef signed short int16_t;
diff -Nru gluegen2-2.2.4/src/antlr/com/jogamp/gluegen/cgram/GnuCParser.g gluegen2-2.3.2/src/antlr/com/jogamp/gluegen/cgram/GnuCParser.g
--- gluegen2-2.2.4/src/antlr/com/jogamp/gluegen/cgram/GnuCParser.g 2014-10-10 13:20:51.000000000 +0000
+++ gluegen2-2.3.2/src/antlr/com/jogamp/gluegen/cgram/GnuCParser.g 2015-10-09 04:18:28.000000000 +0000
@@ -23,6 +23,7 @@
import antlr.CommonAST;
import antlr.DumpASTVisitor;
+ import com.jogamp.gluegen.ASTLocusTag;
}
@@ -715,7 +716,7 @@
public void addDefine(String name, String value)
{
- defines.add(new Define(name, value));
+ defines.add(new Define(name, value, new ASTLocusTag(lineObject.getSource(), lineObject.getLine()+deferredLineCount, -1, name)));
}
/** Returns a list of Define objects corresponding to the
diff -Nru gluegen2-2.2.4/src/antlr/com/jogamp/gluegen/cgram/HeaderParser.g gluegen2-2.3.2/src/antlr/com/jogamp/gluegen/cgram/HeaderParser.g
--- gluegen2-2.2.4/src/antlr/com/jogamp/gluegen/cgram/HeaderParser.g 2014-10-10 13:20:51.000000000 +0000
+++ gluegen2-2.3.2/src/antlr/com/jogamp/gluegen/cgram/HeaderParser.g 2015-10-09 04:18:28.000000000 +0000
@@ -45,7 +45,14 @@
import java.util.*;
import antlr.CommonAST;
+ import com.jogamp.gluegen.ASTLocusTag;
+ import com.jogamp.gluegen.ConstantDefinition;
+ import com.jogamp.gluegen.ConstantDefinition.CNumber;
+ import com.jogamp.gluegen.GlueGenException;
+ import com.jogamp.gluegen.JavaConfiguration;
import com.jogamp.gluegen.cgram.types.*;
+ import com.jogamp.gluegen.cgram.types.EnumType;
+ import com.jogamp.gluegen.cgram.types.EnumType.Enumerator;
}
class HeaderParser extends GnuCTreeParser;
@@ -67,6 +74,12 @@
this.debug = debug;
}
+ /** Set the configuration for this
+ HeaderParser. Must be done before parsing. */
+ public void setJavaConfiguration(JavaConfiguration cfg) {
+ this.cfg = cfg;
+ }
+
/** Set the dictionary mapping typedef names to types for this
HeaderParser. Must be done before parsing. */
public void setTypedefDictionary(TypeDictionary dict) {
@@ -105,7 +118,7 @@
// the enumerates from each EnumType, and fill in the enumHash
// so that each enumerate maps to the enumType to which it
// belongs.
- throw new RuntimeException("setEnums is Unimplemented!");
+ throw new RuntimeException("setEnums is Unimplemented!");
}
/** Returns the EnumTypes this HeaderParser processed. */
@@ -125,22 +138,25 @@
return functions;
}
- private CompoundType lookupInStructDictionary(String typeName,
+ private CompoundType lookupInStructDictionary(String structName,
CompoundTypeKind kind,
- int cvAttrs) {
- CompoundType t = (CompoundType) structDictionary.get(typeName);
+ int cvAttrs, final ASTLocusTag locusTag)
+ {
+ CompoundType t = (CompoundType) structDictionary.get(structName);
if (t == null) {
- t = CompoundType.create(null, null, kind, cvAttrs);
- t.setStructName(typeName);
- structDictionary.put(typeName, t);
+ t = CompoundType.create(structName, null, kind, cvAttrs, locusTag);
+ structDictionary.put(structName, t);
+ debugPrintln("Adding compound mapping: [" + structName + "] -> "+getDebugTypeString(t)+" @ "+locusTag);
+ debugPrintln(t.getStructString());
}
return t;
}
- private Type lookupInTypedefDictionary(String typeName) {
+ private Type lookupInTypedefDictionary(final AST _t, String typeName) {
Type t = typedefDictionary.get(typeName);
if (t == null) {
- throw new RuntimeException("Undefined reference to typedef name " + typeName);
+ throwGlueGenException(_t,
+ "Undefined reference to typedef name " + typeName);
}
return t;
}
@@ -153,8 +169,10 @@
this.id = id;
this.type = type;
}
- String id() { return id; }
- Type type() { return type; }
+ String id() { return id; }
+ Type type() { return type; }
+ void setType(final Type t) { type = t; }
+ public String toString() { return "ParamDecl["+id+": "+type.getDebugString()+"]"; }
}
// A box for a Type. Allows type to be passed down to be modified by recursive rules.
@@ -207,22 +225,27 @@
}
}
+ private String getDebugTypeString(Type t) {
+ if(debug) {
+ return getTypeString(t);
+ } else {
+ return null;
+ }
+ }
private String getTypeString(Type t) {
StringBuilder sb = new StringBuilder();
sb.append("[");
- sb.append(t);
- sb.append(", size: ");
if(null!=t) {
- SizeThunk st = t.getSize();
- if(null!=st) {
- sb.append(st.getClass().getName());
- } else {
- sb.append("undef");
- }
+ sb.append(t.getDebugString());
+ sb.append(", opaque ").append(isOpaque(t)).append("]");
+ } else {
+ sb.append("nil]");
}
- sb.append("]");
return sb.toString();
}
+ private boolean isOpaque(final Type type) {
+ return (cfg.typeInfo(type) != null);
+ }
private void debugPrintln(String msg) {
if(debug) {
@@ -236,14 +259,13 @@
}
}
- private boolean doDeclaration; // Used to only process function typedefs
- private String declId;
- private List parameters;
+ private JavaConfiguration cfg;
private TypeDictionary typedefDictionary;
private TypeDictionary structDictionary;
private List functions = new ArrayList();
// hash from name of an enumerated value to the EnumType to which it belongs
private HashMap enumHash = new HashMap();
+ private HashMap enumMap = new HashMap();
// Storage class specifiers
private static final int AUTO = 1 << 0;
@@ -259,25 +281,41 @@
private static final int SIGNED = 1 << 8;
private static final int UNSIGNED = 1 << 9;
- private void initDeclaration() {
- doDeclaration = false;
- declId = null;
- }
-
- private void doDeclaration() {
- doDeclaration = true;
+ private boolean isFuncDeclaration; // Used to only process function typedefs
+ private String funcDeclName;
+ private List funcDeclParams;
+ private ASTLocusTag funcLocusTag;
+
+ private void resetFuncDeclaration() {
+ isFuncDeclaration = false;
+ funcDeclName = null;
+ funcDeclParams = null;
+ funcLocusTag = null;
+ }
+ private void setFuncDeclaration(final String name, final List p, final ASTLocusTag locusTag) {
+ isFuncDeclaration = true;
+ funcDeclName = name;
+ funcDeclParams = p;
+ funcLocusTag = locusTag;
}
private void processDeclaration(Type returnType) {
- if (doDeclaration) {
- FunctionSymbol sym = new FunctionSymbol(declId, new FunctionType(null, null, returnType, 0));
- if (parameters != null) { // handle funcs w/ empty parameter lists (e.g., "foo()")
- for (Iterator iter = parameters.iterator(); iter.hasNext(); ) {
- ParameterDeclaration pd = (ParameterDeclaration) iter.next();
+ if (isFuncDeclaration) {
+ final FunctionSymbol sym = new FunctionSymbol(funcDeclName,
+ new FunctionType(null, null, returnType, 0, funcLocusTag),
+ funcLocusTag);
+ debugPrintln("Function ... "+sym.toString()+" @ "+funcLocusTag);
+ if (funcDeclParams != null) { // handle funcs w/ empty parameter lists (e.g., "foo()")
+ for (Iterator iter = funcDeclParams.iterator(); iter.hasNext(); ) {
+ ParameterDeclaration pd = iter.next();
+ pd.setType(pd.type());
+ debugPrintln(" add "+pd.toString());
sym.addArgument(pd.type(), pd.id());
}
- }
+ }
+ debugPrintln("Function Added "+sym.toString());
functions.add(sym);
+ resetFuncDeclaration();
}
}
@@ -294,19 +332,18 @@
/** Helper routine which handles creating a pointer or array type
for [] expressions */
- private void handleArrayExpr(TypeBox tb, AST t) {
+ private void handleArrayExpr(TypeBox tb, AST t, ASTLocusTag locusTag) {
if (t != null) {
try {
final int len = parseIntConstExpr(t);
- tb.setType(canonicalize(new ArrayType(tb.type(), SizeThunk.mul(SizeThunk.constant(len), tb.type().getSize()), len, 0)));
+ tb.setType(canonicalize(new ArrayType(tb.type(), SizeThunk.mul(SizeThunk.constant(len), tb.type().getSize()), len, 0, locusTag)));
return;
} catch (RecognitionException e) {
// Fall through
}
}
tb.setType(canonicalize(new PointerType(SizeThunk.POINTER,
- tb.type(),
- 0)));
+ tb.type(), 0, locusTag)));
}
private int parseIntConstExpr(AST t) throws RecognitionException {
@@ -315,49 +352,104 @@
/** Utility function: creates a new EnumType with the given name, or
returns an existing one if it has already been created. */
- private EnumType getEnumType(String enumTypeName) {
+ private EnumType getEnumType(String enumTypeName, ASTLocusTag locusTag) {
EnumType enumType = null;
Iterator it = enumHash.values().iterator();
while (it.hasNext()) {
EnumType potentialMatch = it.next();
if (potentialMatch.getName().equals(enumTypeName)) {
- enumType = potentialMatch;
- break;
+ enumType = potentialMatch;
+ break;
}
}
if (enumType == null) {
- // This isn't quite correct. In theory the enum should expand to
- // the size of the largest element, so if there were a long long
- // entry the enum should expand to e.g. int64. However, using
- // "long" here (which is what used to be the case) was
- // definitely incorrect and caused problems.
- enumType = new EnumType(enumTypeName, SizeThunk.INT32);
+ // This isn't quite correct. In theory the enum should expand to
+ // the size of the largest element, so if there were a long long
+ // entry the enum should expand to e.g. int64. However, using
+ // "long" here (which is what used to be the case) was
+ // definitely incorrect and caused problems.
+ enumType = new EnumType(enumTypeName, SizeThunk.INT32, locusTag);
}
return enumType;
- }
+ }
// Map used to canonicalize types. For example, we may typedef
// struct foo { ... } *pfoo; subsequent references to struct foo* should
// point to the same PointerType object that had its name set to "pfoo".
- private Map canonMap = new HashMap();
+ // Opaque canonical types are excluded.
+ private Map canonMap = new HashMap();
private Type canonicalize(Type t) {
Type res = (Type) canonMap.get(t);
if (res != null) {
return res;
+ } else {
+ canonMap.put(t, t);
+ return t;
+ }
+ }
+
+ private void throwGlueGenException(final AST t, final String message) throws GlueGenException {
+ // dumpASTTree("XXX", t);
+ throw new GlueGenException(message, findASTLocusTag(t));
+ }
+ private void throwGlueGenException(final ASTLocusTag locusTag, final String message) throws GlueGenException {
+ // dumpASTTree("XXX", t);
+ throw new GlueGenException(message, locusTag);
+ }
+
+ /**
+ * Return ASTLocusTag in tree, or null if not found.
+ */
+ private ASTLocusTag findASTLocusTag(final AST astIn) {
+ AST ast = astIn;
+ while(null != ast) {
+ if( ast instanceof TNode ) {
+ final TNode tn = (TNode) ast;
+ final ASTLocusTag tag = tn.getASTLocusTag();
+ if( null != tag ) {
+ return tag;
+ }
+ }
+ ast = ast.getFirstChild();
+ }
+ return null;
+ }
+ private void dumpASTTree(final String pre, final AST t) {
+ int i=0;
+ AST it = t;
+ while( null != it ) {
+ it = dumpAST(pre+"."+i, it);
+ i++;
+ }
+ }
+ private AST dumpAST(final String pre, final AST ast) {
+ if( null == ast ) {
+ System.err.println(pre+".0: AST NULL");
+ return null;
+ } else {
+ System.err.println(pre+".0: AST Type: "+ast.getClass().getName());
+ System.err.println(pre+".1: line:col "+ast.getLine()+":"+ast.getColumn()+" -> "+ast.getText());
+ if( ast instanceof TNode ) {
+ final TNode tn = (TNode) ast;
+ final ASTLocusTag tag = tn.getASTLocusTag();
+ System.err.println(pre+".TN.1: "+tag);
+ final Hashtable attributes = tn.getAttributesTable();
+ System.err.println(pre+".TN.2: "+attributes);
+ }
+ return ast.getFirstChild();
}
- canonMap.put(t, t);
- return t;
}
}
declarator[TypeBox tb] returns [String s] {
- initDeclaration();
+ resetFuncDeclaration();
s = null;
- List params = null;
+ List params = null;
String funcPointerName = null;
TypeBox dummyTypeBox = null;
+ final ASTLocusTag locusTag = findASTLocusTag(declarator_AST_in);
}
: #( NDeclarator
( pointerGroup[tb] )?
@@ -374,32 +466,29 @@
RPAREN
) {
if (id != null) {
- declId = id.getText();
- parameters = params; // FIXME: Ken, why are we setting this class member here?
- doDeclaration();
+ setFuncDeclaration(id.getText(), params, locusTag);
} else if ( funcPointerName != null ) {
/* TypeBox becomes function pointer in this case */
- FunctionType ft = new FunctionType(null, null, tb.type(), 0);
+ final FunctionType ft = new FunctionType(null, null, tb.type(), 0, locusTag);
if (params == null) {
- // If the function pointer has no declared parameters, it's a
- // void function. I'm not sure if the parameter name is
- // ever referenced anywhere when the type is VoidType, so
+ // If the function pointer has no declared parameters, it's a
+ // void function. I'm not sure if the parameter name is
+ // ever referenced anywhere when the type is VoidType, so
// just in case I'll set it to a comment string so it will
- // still compile if written out to code anywhere.
- ft.addArgument(new VoidType(0), "/*unnamed-void*/");
- } else {
- for (Iterator iter = params.iterator(); iter.hasNext(); ) {
- ParameterDeclaration pd = (ParameterDeclaration) iter.next();
- ft.addArgument(pd.type(), pd.id());
- }
+ // still compile if written out to code anywhere.
+ ft.addArgument(new VoidType(0, locusTag), "/*unnamed-void*/");
+ } else {
+ for (Iterator iter = params.iterator(); iter.hasNext(); ) {
+ ParameterDeclaration pd = (ParameterDeclaration) iter.next();
+ ft.addArgument(pd.type(), pd.id());
+ }
}
tb.setType(canonicalize(new PointerType(SizeThunk.POINTER,
- ft,
- 0)));
+ ft, 0, locusTag)));
s = funcPointerName;
}
}
- | LBRACKET ( e:expr )? RBRACKET { handleArrayExpr(tb, e); }
+ | LBRACKET ( e:expr )? RBRACKET { handleArrayExpr(tb, e, locusTag); }
)*
)
;
@@ -422,8 +511,8 @@
) { processDeclaration(tb.type()); }
;
-parameterTypeList returns [List l] { l = new ArrayList(); ParameterDeclaration decl = null; }
- : ( decl = parameterDeclaration { if (decl != null) l.add(decl); } ( COMMA | SEMI )? )+ ( VARARGS )?
+parameterTypeList returns [List l] { l = new ArrayList(); ParameterDeclaration decl = null; }
+ : ( decl = parameterDeclaration { if (decl != null) { l.add(decl); } } ( COMMA | SEMI )? )+ ( VARARGS )?
;
parameterDeclaration returns [ParameterDeclaration pd] {
@@ -435,7 +524,13 @@
: #( NParameterDeclaration
tb = declSpecifiers
(decl = declarator[tb] | nonemptyAbstractDeclarator[tb])?
- ) { pd = new ParameterDeclaration(decl, tb.type()); }
+ ) {
+ if( null == tb ) {
+ throwGlueGenException(parameterDeclaration_AST_in,
+ String.format("Undefined type for declaration '%s'", decl));
+ }
+ pd = new ParameterDeclaration(decl, tb.type());
+ }
;
functionDef {
@@ -462,7 +557,10 @@
{
if (t == null &&
(x & (SIGNED | UNSIGNED)) != 0) {
- t = new IntType("int", SizeThunk.INTxx, ((x & UNSIGNED) != 0), attrs2CVAttrs(x));
+ t = new IntType("int", SizeThunk.INTxx,
+ ((x & UNSIGNED) != 0),
+ attrs2CVAttrs(x),
+ findASTLocusTag(declSpecifiers_AST_in));
}
tb = new TypeBox(t, ((x & TYPEDEF) != 0));
}
@@ -493,30 +591,35 @@
typeSpecifier[int attributes] returns [Type t] {
t = null;
int cvAttrs = attrs2CVAttrs(attributes);
- boolean unsigned = ((attributes & UNSIGNED) != 0);
+ boolean unsig = ((attributes & UNSIGNED) != 0);
+ final ASTLocusTag locusTag = findASTLocusTag(typeSpecifier_AST_in);
}
- : "void" { t = new VoidType(cvAttrs); }
- | "char" { t = new IntType("char" , SizeThunk.INT8, unsigned, cvAttrs); }
- | "short" { t = new IntType("short", SizeThunk.INT16, unsigned, cvAttrs); }
- | "int" { t = new IntType("int" , SizeThunk.INTxx, unsigned, cvAttrs); }
- | "long" { t = new IntType("long" , SizeThunk.LONG, unsigned, cvAttrs); }
- | "float" { t = new FloatType("float", SizeThunk.FLOAT, cvAttrs); }
- | "double" { t = new DoubleType("double", SizeThunk.DOUBLE, cvAttrs); }
- | "__int32" { t = new IntType("__int32", SizeThunk.INT32, unsigned, cvAttrs); }
- | "__int64" { t = new IntType("__int64", SizeThunk.INT64, unsigned, cvAttrs); }
- | "int8_t" { t = new IntType("int8_t", SizeThunk.INT8, false, cvAttrs); /* TS: always signed */ }
- | "uint8_t" { t = new IntType("uint8_t", SizeThunk.INT8, true, cvAttrs); /* TS: always unsigned */ }
- | "int16_t" { t = new IntType("int16_t", SizeThunk.INT16, false, cvAttrs); /* TS: always signed */ }
- | "uint16_t" { t = new IntType("uint16_t", SizeThunk.INT16, true, cvAttrs); /* TS: always unsigned */ }
- | "int32_t" { t = new IntType("int32_t", SizeThunk.INT32, false, cvAttrs); /* TS: always signed */ }
- | "wchar_t" { t = new IntType("wchar_t", SizeThunk.INT32, false, cvAttrs); /* TS: always signed */ }
- | "uint32_t" { t = new IntType("uint32_t", SizeThunk.INT32, true, cvAttrs, true); /* TS: always unsigned */ }
- | "int64_t" { t = new IntType("int64_t", SizeThunk.INT64, false, cvAttrs); /* TS: always signed */ }
- | "uint64_t" { t = new IntType("uint64_t", SizeThunk.INT64, true, cvAttrs, true); /* TS: always unsigned */ }
- | "ptrdiff_t" { t = new IntType("ptrdiff_t", SizeThunk.POINTER, false, cvAttrs); /* TS: always signed */ }
- | "intptr_t" { t = new IntType("intptr_t", SizeThunk.POINTER, false, cvAttrs); /* TS: always signed */ }
- | "size_t" { t = new IntType("size_t", SizeThunk.POINTER, true, cvAttrs, true); /* TS: always unsigned */ }
- | "uintptr_t" { t = new IntType("uintptr_t", SizeThunk.POINTER, true, cvAttrs, true); /* TS: always unsigned */ }
+ // TYPEDEF
+ // | TYPEDEF-UNSIGNED
+ // UNSIGNED | |
+ // TOKEN TYPE NAME SIZE | ATTRIBS | | LOCUS
+ : "void" { t = new VoidType( cvAttrs, locusTag); }
+ | "char" { t = new IntType("char" , SizeThunk.INT8, unsig, cvAttrs, false, false, locusTag); }
+ | "short" { t = new IntType("short", SizeThunk.INT16, unsig, cvAttrs, false, false, locusTag); }
+ | "int" { t = new IntType("int" , SizeThunk.INTxx, unsig, cvAttrs, false, false, locusTag); }
+ | "long" { t = new IntType("long" , SizeThunk.LONG, unsig, cvAttrs, false, false, locusTag); }
+ | "float" { t = new FloatType("float", SizeThunk.FLOAT, cvAttrs, locusTag); }
+ | "double" { t = new DoubleType("double", SizeThunk.DOUBLE, cvAttrs, locusTag); }
+ | "__int32" { t = new IntType("__int32", SizeThunk.INT32, unsig, cvAttrs, true, false, locusTag); } /* TD: signed */
+ | "__int64" { t = new IntType("__int64", SizeThunk.INT64, unsig, cvAttrs, true, false, locusTag); } /* TD: signed */
+ | "int8_t" { t = new IntType("int8_t", SizeThunk.INT8, unsig, cvAttrs, true, false, locusTag); } /* TD: signed */
+ | "uint8_t" { t = new IntType("uint8_t", SizeThunk.INT8, unsig, cvAttrs, true, true, locusTag); } /* TD: unsigned */
+ | "int16_t" { t = new IntType("int16_t", SizeThunk.INT16, unsig, cvAttrs, true, false, locusTag); } /* TD: signed */
+ | "uint16_t" { t = new IntType("uint16_t", SizeThunk.INT16, unsig, cvAttrs, true, true, locusTag); } /* TD: unsigned */
+ | "int32_t" { t = new IntType("int32_t", SizeThunk.INT32, unsig, cvAttrs, true, false, locusTag); } /* TD: signed */
+ | "wchar_t" { t = new IntType("wchar_t", SizeThunk.INT32, unsig, cvAttrs, true, false, locusTag); } /* TD: signed */
+ | "uint32_t" { t = new IntType("uint32_t", SizeThunk.INT32, unsig, cvAttrs, true, true, locusTag); } /* TS: unsigned */
+ | "int64_t" { t = new IntType("int64_t", SizeThunk.INT64, unsig, cvAttrs, true, false, locusTag); } /* TD: signed */
+ | "uint64_t" { t = new IntType("uint64_t", SizeThunk.INT64, unsig, cvAttrs, true, true, locusTag); } /* TD: unsigned */
+ | "ptrdiff_t" { t = new IntType("ptrdiff_t", SizeThunk.POINTER, unsig, cvAttrs, true, false, locusTag); } /* TD: signed */
+ | "intptr_t" { t = new IntType("intptr_t", SizeThunk.POINTER, unsig, cvAttrs, true, false, locusTag); } /* TD: signed */
+ | "size_t" { t = new IntType("size_t", SizeThunk.POINTER, unsig, cvAttrs, true, true, locusTag); } /* TD: unsigned */
+ | "uintptr_t" { t = new IntType("uintptr_t", SizeThunk.POINTER, unsig, cvAttrs, true, true, locusTag); } /* TD: unsigned */
| t = structSpecifier[cvAttrs] ( attributeDecl )*
| t = unionSpecifier [cvAttrs] ( attributeDecl )*
| t = enumSpecifier [cvAttrs]
@@ -533,9 +636,12 @@
typedefName[int cvAttrs] returns [Type t] { t = null; }
: #(NTypedefName id : ID)
{
- Type tdict = lookupInTypedefDictionary(id.getText());
- t = canonicalize(tdict.getCVVariant(cvAttrs));
- debugPrintln("Adding typedef canon : [" + id.getText() + "] -> [" + tdict + "] -> "+getTypeString(t));
+ final Type t0 = lookupInTypedefDictionary(typedefName_AST_in, id.getText());
+ debugPrint("Adding typedef lookup: [" + id.getText() + "] -> "+getDebugTypeString(t0));
+ final Type t1 = t0.newCVVariant(cvAttrs);
+ debugPrintln(" - cvvar -> "+getDebugTypeString(t1));
+ t = canonicalize(t1);
+ debugPrintln(" - canon -> "+getDebugTypeString(t));
}
;
@@ -549,31 +655,50 @@
structOrUnionBody[CompoundTypeKind kind, int cvAttrs] returns [CompoundType t] {
t = null;
+ boolean addedAny = false;
+ final ASTLocusTag locusTag = findASTLocusTag(structOrUnionBody_AST_in);
}
: ( (ID LCURLY) => id:ID LCURLY {
- t = (CompoundType) canonicalize(lookupInStructDictionary(id.getText(), kind, cvAttrs));
- } ( structDeclarationList[t] )?
+ // fully declared struct, i.e. not anonymous
+ t = (CompoundType) canonicalize(lookupInStructDictionary(id.getText(), kind, cvAttrs, locusTag));
+ } ( addedAny = structDeclarationList[t] )?
RCURLY { t.setBodyParsed(); }
- | LCURLY { t = CompoundType.create(null, null, kind, cvAttrs); }
- ( structDeclarationList[t] )?
+ | LCURLY {
+ // anonymous declared struct
+ t = CompoundType.create(null, null, kind, cvAttrs, locusTag);
+ } ( structDeclarationList[t] )?
RCURLY { t.setBodyParsed(); }
- | id2:ID { t = (CompoundType) canonicalize(lookupInStructDictionary(id2.getText(), kind, cvAttrs)); }
- )
+ | id2:ID {
+ // anonymous struct
+ t = (CompoundType) canonicalize(lookupInStructDictionary(id2.getText(), kind, cvAttrs, locusTag));
+ }
+ ) {
+ debugPrintln("Adding compound body: [" + t.getName() + "] -> "+getDebugTypeString(t)+" @ "+locusTag);
+ debugPrintln(t.getStructString());
+ }
;
-structDeclarationList[CompoundType t]
- : ( structDeclaration[t] )+
+structDeclarationList[CompoundType t] returns [boolean addedAny] {
+ addedAny = false;
+ boolean addedOne = false;
+}
+ : ( addedOne = structDeclaration[t] { addedAny |= addedOne; } )+
;
-structDeclaration[CompoundType containingType] {
+structDeclaration[CompoundType containingType] returns [boolean addedAny] {
+ addedAny = false;
Type t = null;
- boolean addedAny = false;
}
: t = specifierQualifierList addedAny = structDeclaratorList[containingType, t] {
if (!addedAny) {
if (t != null) {
CompoundType ct = t.asCompound();
- if (ct.isUnion()) {
+ if( null == ct ) {
+ throwGlueGenException(structDeclaration_AST_in,
+ String.format("Anonymous compound, w/ NULL type:%n containing '%s'",
+ getTypeString(containingType)));
+ }
+ if ( ct.isUnion() ) {
// Anonymous union
containingType.addField(new Field(null, t, null));
}
@@ -591,7 +716,8 @@
)+ {
if (t == null &&
(x & (SIGNED | UNSIGNED)) != 0) {
- t = new IntType("int", SizeThunk.INTxx, ((x & UNSIGNED) != 0), attrs2CVAttrs(x));
+ t = new IntType("int", SizeThunk.INTxx, ((x & UNSIGNED) != 0), attrs2CVAttrs(x),
+ findASTLocusTag(specifierQualifierList_AST_in));
}
}
;
@@ -616,7 +742,7 @@
)
;
-// FIXME: this will not correctly set the name of the enumeration when
+// This will not correctly set the name of the enumeration when
// encountering a declaration like this:
//
// typedef enum { } enumName;
@@ -625,65 +751,88 @@
// incorrectly return HeaderParser.ANONYMOUS_ENUM_NAME instead of
// "enumName"
//
-// I haven't implemented it yet because I'm not sure how to get the
-// "enumName" *before* executing the enumList rule.
+// The followup typedef, see 'initDecl', will alias this name,
+// hence correct the issue!
enumSpecifier [int cvAttrs] returns [Type t] {
t = null;
+ EnumType e = null;
+ ASTLocusTag locusTag = findASTLocusTag(enumSpecifier_AST_in);
}
: #( "enum"
- ( ( ID LCURLY )=> i:ID LCURLY enumList[(EnumType)(t = getEnumType(i.getText()))] RCURLY
- | LCURLY enumList[(EnumType)(t = getEnumType(ANONYMOUS_ENUM_NAME))] RCURLY
- | ID { t = getEnumType(i.getText()); }
- )
- )
+ ( ( ID LCURLY )=> i:ID LCURLY enumList[(EnumType)(e = getEnumType(i.getText(), locusTag))] RCURLY
+ | LCURLY enumList[(EnumType)(e = getEnumType(ANONYMOUS_ENUM_NAME, locusTag))] RCURLY
+ | ID { e = getEnumType(i.getText(), locusTag); }
+ ) {
+ debugPrintln("Adding enum mapping: "+getDebugTypeString(e));
+ if( null != e ) {
+ final String eName = e.getName();
+ if( null != eName && !eName.equals(ANONYMOUS_ENUM_NAME) ) { // validate only non-anonymous enum
+ final EnumType dupE = enumMap.get(eName);
+ if( null != dupE && !dupE.equalSemantics(e) ) {
+ throwGlueGenException(enumSpecifier_AST_in,
+ String.format("Duplicate enum w/ incompatible type:%n this '%s',%n have '%s',%n %s: previous definition is here",
+ getTypeString(e), getTypeString(dupE), dupE.getASTLocusTag().toString(new StringBuilder(), "note", true)));
+ }
+ enumMap.put(eName, (EnumType)e.clone(locusTag));
+ }
+ }
+ t = e; // return val
+ }
+ )
;
enumList[EnumType enumeration] {
- long defaultEnumerantValue = 0;
+ ConstantDefinition defEnumerant = new ConstantDefinition("def", "0", new CNumber(true, false, 0), findASTLocusTag(enumList_AST_in));
}
- : ( defaultEnumerantValue = enumerator[enumeration, defaultEnumerantValue] )+
+ : ( defEnumerant = enumerator[enumeration, defEnumerant] )+
;
-enumerator[EnumType enumeration, long defaultValue] returns [long newDefaultValue] {
+enumerator[EnumType enumeration, ConstantDefinition defaultValue] returns [ConstantDefinition newDefaultValue] {
newDefaultValue = defaultValue;
}
: eName:ID ( ASSIGN eVal:expr )? {
- long value = 0;
+ final String eTxt = eName.getText();
+ final Enumerator newEnum;
if (eVal != null) {
- String vTxt = eVal.getAllChildrenText();
+ String vTxt = eVal.getAllChildrenText(eTxt);
if (enumHash.containsKey(vTxt)) {
EnumType oldEnumType = enumHash.get(vTxt);
- value = oldEnumType.getEnumValue(vTxt);
+ Enumerator oldEnum = oldEnumType.getEnum(vTxt);
+ newEnum = oldEnum;
} else {
- try {
- value = Long.decode(vTxt).longValue();
- } catch (NumberFormatException e) {
- System.err.println("NumberFormatException: ID[" + eName.getText() + "], VALUE=[" + vTxt + "]");
- throw e;
- }
+ newEnum = new Enumerator(eTxt, vTxt);
}
+ } else if( defaultValue.hasNumber() ) {
+ newEnum = new Enumerator(eTxt, defaultValue.getNumber());
} else {
- value = defaultValue;
+ newEnum = new Enumerator(eTxt, defaultValue.getNativeExpr());
}
-
- newDefaultValue = value+1;
- String eTxt = eName.getText();
- if (enumHash.containsKey(eTxt)) {
- EnumType oldEnumType = enumHash.get(eTxt);
- long oldValue = oldEnumType.getEnumValue(eTxt);
- System.err.println("WARNING: redefinition of enumerated value '" + eTxt + "';" +
- " existing definition is in enumeration '" + oldEnumType.getName() +
- "' with value " + oldValue + " and new definition is in enumeration '" +
- enumeration.getName() + "' with value " + value);
- // remove old definition
- oldEnumType.removeEnumerate(eTxt);
- }
- // insert new definition
- enumeration.addEnum(eTxt, value);
- enumHash.put(eTxt, enumeration);
- debugPrintln("ENUM [" + enumeration.getName() + "]: " + eTxt + " = " + enumeration.getEnumValue(eTxt) +
- " (new default = " + newDefaultValue + ")");
- }
+ final ASTLocusTag locus = findASTLocusTag(enumerator_AST_in);
+ final CNumber newEnumNum = newEnum.getNumber();
+ if( null != newEnumNum && newEnumNum.isInteger ) {
+ final long n = newEnumNum.i+1;
+ newDefaultValue = new ConstantDefinition("def", String.valueOf(n), new CNumber(newEnumNum.isLong, newEnumNum.isUnsigned, n), locus);
+ } else {
+ newDefaultValue = new ConstantDefinition("def", "("+newEnum.getExpr()+")+1", null, locus);
+ }
+ if (enumHash.containsKey(eTxt)) {
+ EnumType oldEnumType = enumHash.get(eTxt);
+ final Enumerator oldEnum = oldEnumType.getEnum(eTxt);
+ final String oldExpr = oldEnum.getExpr();
+ if( !oldExpr.equals(newEnum.getExpr()) ) {
+ throwGlueGenException(enumerator_AST_in,
+ String.format("Duplicate enum value '%s.%s' w/ diff value:%n this %s,%n have %s",
+ oldEnumType.getName(), eTxt, newEnum, oldEnum));
+ }
+ // remove old definition
+ oldEnumType.removeEnumerate(eTxt);
+ }
+ // insert new definition
+ enumeration.addEnum(eTxt, newEnum);
+ enumHash.put(eTxt, enumeration);
+ debugPrintln("ENUM [" + enumeration.getName() + "]: " + eTxt + " = " + newEnum +
+ " (new default = " + newDefaultValue + ")");
+ }
;
initDeclList[TypeBox tb]
@@ -692,6 +841,7 @@
initDecl[TypeBox tb] {
String declName = null;
+ final ASTLocusTag locusTag = findASTLocusTag(initDecl_AST_in);
}
: #( NInitDecl
declName = declarator[tb] {
@@ -705,23 +855,99 @@
{
if ((declName != null) && (tb != null) && tb.isTypedef()) {
Type t = tb.type();
- debugPrint("Adding typedef mapping: [" + declName + "] -> "+getTypeString(t));
- if (!t.hasTypedefName()) {
- t.setName(declName);
- debugPrint(" - declName -> "+getTypeString(t));
+ debugPrintln("Adding typedef mapping: [" + declName + "] -> "+getDebugTypeString(t));
+ final Type tg;
+ if( t.isPointer() ) {
+ tg = t.getTargetType();
+ debugPrintln(" - has target: "+getDebugTypeString(tg));
} else {
- // copy type to preserve declName !
- t = (Type) t.clone();
- t.setName(declName);
- debugPrint(" - copy -> "+getTypeString(t));
+ tg = null;
+ }
+ // NOTE: Struct Name Resolution (JavaEmitter, HeaderParser)
+ // Also see NOTE below.
+ if (!t.isTypedef()) {
+ if( t.isCompound() || t.isEnum() ) {
+ // This aliases '_a' -> 'A' for 'typedef struct _a { } A;' in-place
+ // This aliases '_a' -> 'A' for 'typedef enum _a { } A;' in-place
+ t.setTypedefName(declName);
+ debugPrintln(" - alias.11 -> "+getDebugTypeString(t));
+ } else {
+ // Use new typedef, using a copy to preserve canonicalized base type
+ t = t.clone(locusTag);
+ t.setTypedefName(declName);
+ debugPrintln(" - newdefine.12 -> "+getDebugTypeString(t));
+ }
+ } else {
+ // Adds typeInfo alias w/ t's typeInfo, if exists
+ cfg.addTypeInfo(declName, t);
+ final Type alias;
+ if( t.isCompound() ) {
+ // This aliases 'D' -> 'A' for 'typedef struct _a { } A, D;' in-place
+ debugPrintln(" - alias.21 -> "+getDebugTypeString(t));
+ } else {
+ // copy to preserve canonicalized base type
+ t = t.clone(locusTag);
+ t.setTypedefName(declName);
+ debugPrintln(" - copy.22 -> "+getDebugTypeString(t));
+ }
+ }
+ final Type dupT = typedefDictionary.get(declName);
+ if( null != dupT && !dupT.equalSemantics(t) ) {
+ throwGlueGenException(locusTag,
+ String.format("Duplicate typedef w/ incompatible type:%n this '%s',%n have '%s',%n %s: previous definition is here",
+ getTypeString(t), getTypeString(dupT), dupT.getASTLocusTag().toString(new StringBuilder(), "note", true)));
}
t = canonicalize(t);
- debugPrintln(" - canon -> "+getTypeString(t));
+ debugPrintln(" - canon -> "+getDebugTypeString(t));
typedefDictionary.put(declName, t);
// Clear out PointerGroup effects in case another typedef variant follows
tb.reset();
}
}
+ /*
+ // Below just shows a different handling using copying
+ // and enforcing aliased names, which is not desired.
+ // Keeping it in here for documentation.
+ // NOTE: Struct Name Resolution (JavaEmitter, HeaderParser)
+ if ( !t.isTypedef() ) {
+ if( t.isCompound() ) {
+ // This aliases '_a' -> 'A' for 'typedef struct _a { } A;'
+ t.setTypedefName(declName);
+ debugPrintln(" - alias.10 -> "+getDebugTypeString(t));
+ } else if( null != tg && tg.isCompound() ) {
+ if( !tg.isTypedef() ) {
+ // This aliases '_a *' -> 'A*' for 'typedef struct _a { } *A;'
+ t.setTypedefName(declName);
+ debugPrintln(" - alias.11 -> "+getDebugTypeString(t));
+ } else {
+ // This aliases 'B' -> 'A*' for 'typedef struct _a { } A, *B;' and 'typedef A * B;'
+ t = new PointerType(SizeThunk.POINTER, tg, 0, locusTag); // name: 'A*'
+ t.setTypedefName(t.getName()); // make typedef
+ debugPrintln(" - alias.12 -> "+getDebugTypeString(t));
+ }
+ } else {
+ // Use new typedef, using a copy to preserve canonicalized base type
+ t = t.clone(locusTag);
+ t.setTypedefName(declName);
+ debugPrintln(" - newdefine.13 -> "+getDebugTypeString(t));
+ }
+ } else {
+ // Adds typeInfo alias w/ t's typeInfo, if exists
+ cfg.addTypeInfo(declName, t);
+ if( t.isCompound() ) {
+ // This aliases 'D' -> 'A' for 'typedef struct _a { } A, D;'
+ debugPrintln(" - alias.20 -> "+getDebugTypeString(t));
+ } else if( null != tg && tg.isCompound() ) {
+ // This aliases 'B' -> 'A' for 'typedef A B;', where A is pointer to compound
+ debugPrintln(" - alias.21 -> "+getDebugTypeString(t));
+ } else {
+ // copy to preserve canonicalized base type
+ t = t.clone(locusTag);
+ t.setTypedefName(declName);
+ debugPrintln(" - copy.22 -> "+getDebugTypeString(t));
+ }
+ }
+*/
;
pointerGroup[TypeBox tb] { int x = 0; int y = 0; }
@@ -731,7 +957,8 @@
if (tb != null) {
tb.setType(canonicalize(new PointerType(SizeThunk.POINTER,
tb.type(),
- attrs2CVAttrs(x))));
+ attrs2CVAttrs(x),
+ findASTLocusTag(pointerGroup_AST_in))));
}
}
)+ )
@@ -756,7 +983,9 @@
/* FIXME: the handling of types in this rule has not been well thought
out and is known to be incomplete. Currently it is only used to handle
pointerGroups for unnamed parameters. */
-nonemptyAbstractDeclarator[TypeBox tb]
+nonemptyAbstractDeclarator[TypeBox tb] {
+ final ASTLocusTag locusTag = findASTLocusTag(nonemptyAbstractDeclarator_AST_in);
+}
: #( NNonemptyAbstractDeclarator
( pointerGroup[tb]
( (LPAREN
@@ -764,7 +993,7 @@
| parameterTypeList
)?
RPAREN)
- | (LBRACKET (e1:expr)? RBRACKET) { handleArrayExpr(tb, e1); }
+ | (LBRACKET (e1:expr)? RBRACKET) { handleArrayExpr(tb, e1, locusTag); }
)*
| ( (LPAREN
@@ -772,7 +1001,7 @@
| parameterTypeList
)?
RPAREN)
- | (LBRACKET (e2:expr)? RBRACKET) { handleArrayExpr(tb, e2); }
+ | (LBRACKET (e2:expr)? RBRACKET) { handleArrayExpr(tb, e2, locusTag); }
)+
)
)
@@ -786,13 +1015,17 @@
final String enumName = e.getText();
final EnumType enumType = enumHash.get(enumName);
if( null == enumType ) {
- throw new IllegalArgumentException("Error: intConstExpr ID "+enumName+" recognized, but no containing enum-type found");
+ throwGlueGenException(intConstExpr_AST_in,
+ "Error: intConstExpr ID "+enumName+" recognized, but no containing enum-type found");
}
- final long enumValue = enumType.getEnumValue(enumName);
- System.err.println("INFO: intConstExpr: enum[Type "+enumType.getName()+", name "+enumName+", value "+enumValue+"]");
- if( (long)Integer.MIN_VALUE > enumValue || (long)Integer.MAX_VALUE < enumValue ) {
- throw new IndexOutOfBoundsException("Error: intConstExpr ID "+enumName+" enum-value "+enumValue+" out of int range");
+ final Enumerator enumerator = enumType.getEnum(enumName);
+ final CNumber number = enumerator.getNumber();
+ if( null != number && number.isInteger && !number.isLong ) {
+ debugPrintln("INFO: intConstExpr: enum[Type "+enumType.getName()+", "+enumerator+"]");
+ } else {
+ throwGlueGenException(intConstExpr_AST_in,
+ "Error: intConstExpr ID "+enumName+" enum "+enumerator+" not an int32_t");
}
- return (int)enumValue;
+ return (int)number.i;
}
;
diff -Nru gluegen2-2.2.4/src/antlr/com/jogamp/gluegen/cgram/StdCParser.g gluegen2-2.3.2/src/antlr/com/jogamp/gluegen/cgram/StdCParser.g
--- gluegen2-2.2.4/src/antlr/com/jogamp/gluegen/cgram/StdCParser.g 2014-10-10 13:20:51.000000000 +0000
+++ gluegen2-2.3.2/src/antlr/com/jogamp/gluegen/cgram/StdCParser.g 2015-10-09 04:18:28.000000000 +0000
@@ -1131,11 +1131,12 @@
nw:NonWhitespace
("\r\n" | "\r" | "\n") ) {
if (n != null) {
- //System.out.println("addDefine: #define " + i.getText() + " " + n.getText());
+ // System.out.println("addDefine: #define " + i.getText() + " " + n.getText()+" @ "+lineObject.getSource()+":"+(lineObject.line+deferredLineCount));
addDefine(i.getText(), n.getText());
} else {
setPreprocessingDirective("#define " + i.getText() + " " + nw.getText());
}
+ deferredNewline();
}
| (~'\n')* { setPreprocessingDirective(getText()); }
)
@@ -1165,15 +1166,19 @@
}
:
{
- lineObject = new LineObject();
- deferredLineCount = 0;
+ lineObject = new LineObject();
+ deferredLineCount = 0;
}
("line")? //this would be for if the directive started "#line", but not there for GNU directives
(Space)+
- n:Number { lineObject.setLine(Integer.parseInt(n.getText())); }
+ n:Number {
+ lineObject.setLine(Integer.parseInt(n.getText()));
+ }
(Space)+
( fn:StringLiteral { try {
- lineObject.setSource(fn.getText().substring(1,fn.getText().length()-1));
+ final String newSource = fn.getText().substring(1,fn.getText().length()-1);
+ // System.out.println("line: "+lineObject.getSource()+" -> "+newSource+", line "+(lineObject.line+deferredLineCount));
+ lineObject.setSource(newSource);
}
catch (StringIndexOutOfBoundsException e) { /*not possible*/ }
}
diff -Nru gluegen2-2.2.4/src/antlr/com/jogamp/gluegen/jgram/JavaParser.g gluegen2-2.3.2/src/antlr/com/jogamp/gluegen/jgram/JavaParser.g
--- gluegen2-2.2.4/src/antlr/com/jogamp/gluegen/jgram/JavaParser.g 2014-10-10 13:20:51.000000000 +0000
+++ gluegen2-2.3.2/src/antlr/com/jogamp/gluegen/jgram/JavaParser.g 2015-10-09 04:18:28.000000000 +0000
@@ -8,105 +8,105 @@
* Run 'java Main '
*
* Contributing authors:
- * John Mitchell johnm@non.net
- * Terence Parr parrt@magelang.com
- * John Lilley jlilley@empathy.com
- * Scott Stanchfield thetick@magelang.com
- * Markus Mohnen mohnen@informatik.rwth-aachen.de
+ * John Mitchell johnm@non.net
+ * Terence Parr parrt@magelang.com
+ * John Lilley jlilley@empathy.com
+ * Scott Stanchfield thetick@magelang.com
+ * Markus Mohnen mohnen@informatik.rwth-aachen.de
* Peter Williams pete.williams@sun.com
* Allan Jacobs Allan.Jacobs@eng.sun.com
* Steve Messick messick@redhills.com
- * John Pybus john@pybus.org
+ * John Pybus john@pybus.org
*
* Version 1.00 December 9, 1997 -- initial release
* Version 1.01 December 10, 1997
- * fixed bug in octal def (0..7 not 0..8)
+ * fixed bug in octal def (0..7 not 0..8)
* Version 1.10 August 1998 (parrt)
- * added tree construction
- * fixed definition of WS,comments for mac,pc,unix newlines
- * added unary plus
+ * added tree construction
+ * fixed definition of WS,comments for mac,pc,unix newlines
+ * added unary plus
* Version 1.11 (Nov 20, 1998)
- * Added "shutup" option to turn off last ambig warning.
- * Fixed inner class def to allow named class defs as statements
- * synchronized requires compound not simple statement
- * add [] after builtInType DOT class in primaryExpression
- * "const" is reserved but not valid..removed from modifiers
+ * Added "shutup" option to turn off last ambig warning.
+ * Fixed inner class def to allow named class defs as statements
+ * synchronized requires compound not simple statement
+ * add [] after builtInType DOT class in primaryExpression
+ * "const" is reserved but not valid..removed from modifiers
* Version 1.12 (Feb 2, 1999)
- * Changed LITERAL_xxx to xxx in tree grammar.
- * Updated java.g to use tokens {...} now for 2.6.0 (new feature).
+ * Changed LITERAL_xxx to xxx in tree grammar.
+ * Updated java.g to use tokens {...} now for 2.6.0 (new feature).
*
* Version 1.13 (Apr 23, 1999)
- * Didn't have (stat)? for else clause in tree parser.
- * Didn't gen ASTs for interface extends. Updated tree parser too.
- * Updated to 2.6.0.
+ * Didn't have (stat)? for else clause in tree parser.
+ * Didn't gen ASTs for interface extends. Updated tree parser too.
+ * Updated to 2.6.0.
* Version 1.14 (Jun 20, 1999)
- * Allowed final/abstract on local classes.
- * Removed local interfaces from methods
- * Put instanceof precedence where it belongs...in relationalExpr
- * It also had expr not type as arg; fixed it.
- * Missing ! on SEMI in classBlock
- * fixed: (expr) + "string" was parsed incorrectly (+ as unary plus).
- * fixed: didn't like Object[].class in parser or tree parser
+ * Allowed final/abstract on local classes.
+ * Removed local interfaces from methods
+ * Put instanceof precedence where it belongs...in relationalExpr
+ * It also had expr not type as arg; fixed it.
+ * Missing ! on SEMI in classBlock
+ * fixed: (expr) + "string" was parsed incorrectly (+ as unary plus).
+ * fixed: didn't like Object[].class in parser or tree parser
* Version 1.15 (Jun 26, 1999)
- * Screwed up rule with instanceof in it. :( Fixed.
- * Tree parser didn't like (expr).something; fixed.
- * Allowed multiple inheritance in tree grammar. oops.
+ * Screwed up rule with instanceof in it. :( Fixed.
+ * Tree parser didn't like (expr).something; fixed.
+ * Allowed multiple inheritance in tree grammar. oops.
* Version 1.16 (August 22, 1999)
- * Extending an interface built a wacky tree: had extra EXTENDS.
- * Tree grammar didn't allow multiple superinterfaces.
- * Tree grammar didn't allow empty var initializer: {}
+ * Extending an interface built a wacky tree: had extra EXTENDS.
+ * Tree grammar didn't allow multiple superinterfaces.
+ * Tree grammar didn't allow empty var initializer: {}
* Version 1.17 (October 12, 1999)
- * ESC lexer rule allowed 399 max not 377 max.
- * java.tree.g didn't handle the expression of synchronized
- * statements.
+ * ESC lexer rule allowed 399 max not 377 max.
+ * java.tree.g didn't handle the expression of synchronized
+ * statements.
* Version 1.18 (August 12, 2001)
- * Terence updated to Java 2 Version 1.3 by
- * observing/combining work of Allan Jacobs and Steve
- * Messick. Handles 1.3 src. Summary:
- * o primary didn't include boolean.class kind of thing
- * o constructor calls parsed explicitly now:
- * see explicitConstructorInvocation
- * o add strictfp modifier
- * o missing objBlock after new expression in tree grammar
- * o merged local class definition alternatives, moved after declaration
- * o fixed problem with ClassName.super.field
- * o reordered some alternatives to make things more efficient
- * o long and double constants were not differentiated from int/float
- * o whitespace rule was inefficient: matched only one char
- * o add an examples directory with some nasty 1.3 cases
- * o made Main.java use buffered IO and a Reader for Unicode support
- * o supports UNICODE?
- * Using Unicode charVocabulay makes code file big, but only
- * in the bitsets at the end. I need to make ANTLR generate
- * unicode bitsets more efficiently.
+ * Terence updated to Java 2 Version 1.3 by
+ * observing/combining work of Allan Jacobs and Steve
+ * Messick. Handles 1.3 src. Summary:
+ * o primary didn't include boolean.class kind of thing
+ * o constructor calls parsed explicitly now:
+ * see explicitConstructorInvocation
+ * o add strictfp modifier
+ * o missing objBlock after new expression in tree grammar
+ * o merged local class definition alternatives, moved after declaration
+ * o fixed problem with ClassName.super.field
+ * o reordered some alternatives to make things more efficient
+ * o long and double constants were not differentiated from int/float
+ * o whitespace rule was inefficient: matched only one char
+ * o add an examples directory with some nasty 1.3 cases
+ * o made Main.java use buffered IO and a Reader for Unicode support
+ * o supports UNICODE?
+ * Using Unicode charVocabulay makes code file big, but only
+ * in the bitsets at the end. I need to make ANTLR generate
+ * unicode bitsets more efficiently.
* Version 1.19 (April 25, 2002)
- * Terence added in nice fixes by John Pybus concerning floating
- * constants and problems with super() calls. John did a nice
- * reorg of the primary/postfix expression stuff to read better
- * and makes f.g.super() parse properly (it was METHOD_CALL not
- * a SUPER_CTOR_CALL). Also:
- *
- * o "finally" clause was a root...made it a child of "try"
- * o Added stuff for asserts too for Java 1.4, but *commented out*
- * as it is not backward compatible.
+ * Terence added in nice fixes by John Pybus concerning floating
+ * constants and problems with super() calls. John did a nice
+ * reorg of the primary/postfix expression stuff to read better
+ * and makes f.g.super() parse properly (it was METHOD_CALL not
+ * a SUPER_CTOR_CALL). Also:
+ *
+ * o "finally" clause was a root...made it a child of "try"
+ * o Added stuff for asserts too for Java 1.4, but *commented out*
+ * as it is not backward compatible.
*
* Version 1.20 (October 27, 2002)
*
* Terence ended up reorging John Pybus' stuff to
* remove some nondeterminisms and some syntactic predicates.
* Note that the grammar is stricter now; e.g., this(...) must
- * be the first statement.
+ * be the first statement.
*
* Trinary ?: operator wasn't working as array name:
* (isBig ? bigDigits : digits)[i];
*
* Checked parser/tree parser on source for
* Resin-2.0.5, jive-2.1.1, jdk 1.3.1, Lucene, antlr 2.7.2a4,
- * and the 110k-line jGuru server source.
+ * and the 110k-line jGuru server source.
*
* Version 1.21 (October 17, 2003)
- * Fixed lots of problems including:
- * Ray Waldin: add typeDefinition to interfaceBlock in java.tree.g
+ * Fixed lots of problems including:
+ * Ray Waldin: add typeDefinition to interfaceBlock in java.tree.g
* He found a problem/fix with floating point that start with 0
* Ray also fixed problem that (int.class) was not recognized.
* Thorsten van Ellen noticed that \n are allowed incorrectly in strings.
@@ -129,24 +129,24 @@
class JavaParser extends Parser;
options {
- k = 2; // two token lookahead
- exportVocab=Java; // Call its vocabulary "Java"
- codeGenMakeSwitchThreshold = 2; // Some optimizations
- codeGenBitsetTestThreshold = 3;
- defaultErrorHandler = false; // Don't generate parser error handlers
- buildAST = true;
- //buildAST = false;
+ k = 2; // two token lookahead
+ exportVocab=Java; // Call its vocabulary "Java"
+ codeGenMakeSwitchThreshold = 2; // Some optimizations
+ codeGenBitsetTestThreshold = 3;
+ defaultErrorHandler = false; // Don't generate parser error handlers
+ buildAST = true;
+ //buildAST = false;
}
tokens {
- BLOCK; MODIFIERS; OBJBLOCK; SLIST; CTOR_DEF; METHOD_DEF; VARIABLE_DEF;
- INSTANCE_INIT; STATIC_INIT; TYPE; CLASS_DEF; INTERFACE_DEF;
- PACKAGE_DEF; ARRAY_DECLARATOR; EXTENDS_CLAUSE; IMPLEMENTS_CLAUSE;
- PARAMETERS; PARAMETER_DEF; LABELED_STAT; TYPECAST; INDEX_OP;
- POST_INC; POST_DEC; METHOD_CALL; EXPR; ARRAY_INIT;
- IMPORT; UNARY_MINUS; UNARY_PLUS; CASE_GROUP; ELIST; FOR_INIT; FOR_CONDITION;
- FOR_ITERATOR; EMPTY_STAT; FINAL="final"; ABSTRACT="abstract";
- STRICTFP="strictfp"; SUPER_CTOR_CALL; CTOR_CALL;
+ BLOCK; MODIFIERS; OBJBLOCK; SLIST; CTOR_DEF; METHOD_DEF; VARIABLE_DEF;
+ INSTANCE_INIT; STATIC_INIT; TYPE; CLASS_DEF; INTERFACE_DEF;
+ PACKAGE_DEF; ARRAY_DECLARATOR; EXTENDS_CLAUSE; IMPLEMENTS_CLAUSE;
+ PARAMETERS; PARAMETER_DEF; LABELED_STAT; TYPECAST; INDEX_OP;
+ POST_INC; POST_DEC; METHOD_CALL; EXPR; ARRAY_INIT;
+ IMPORT; UNARY_MINUS; UNARY_PLUS; CASE_GROUP; ELIST; FOR_INIT; FOR_CONDITION;
+ FOR_ITERATOR; EMPTY_STAT; FINAL="final"; ABSTRACT="abstract";
+ STRICTFP="strictfp"; SUPER_CTOR_CALL; CTOR_CALL;
}
{
@@ -181,250 +181,250 @@
// Compilation Unit: In Java, this is a single file. This is the start
// rule for this parser
compilationUnit
- : // A compilation unit starts with an optional package definition
- ( packageDefinition
- | /* nothing */
- )
-
- // Next we have a series of zero or more import statements
- ( importDefinition )*
-
- // Wrapping things up with any number of class or interface
- // definitions
- ( typeDefinition )*
+ : // A compilation unit starts with an optional package definition
+ ( packageDefinition
+ | /* nothing */
+ )
+
+ // Next we have a series of zero or more import statements
+ ( importDefinition )*
+
+ // Wrapping things up with any number of class or interface
+ // definitions
+ ( typeDefinition )*
- EOF!
- ;
+ EOF!
+ ;
// Package statement: "package" followed by an identifier.
packageDefinition
- options {defaultErrorHandler = true;} // let ANTLR handle errors
- : p:"package"^ {#p.setType(PACKAGE_DEF);} identifier SEMI!
- ;
+ options {defaultErrorHandler = true;} // let ANTLR handle errors
+ : p:"package"^ {#p.setType(PACKAGE_DEF);} identifier SEMI!
+ ;
// Import statement: import followed by a package or class name
importDefinition
- options {defaultErrorHandler = true;}
- : i:"import"^ {#i.setType(IMPORT);} identifierStar SEMI!
- ;
+ options {defaultErrorHandler = true;}
+ : i:"import"^ {#i.setType(IMPORT);} identifierStar SEMI!
+ ;
// A type definition in a file is either a class or interface definition.
typeDefinition
- options {defaultErrorHandler = true;}
- : m:modifiers!
- ( classDefinition[#m]
- | interfaceDefinition[#m]
- )
- | SEMI!
- ;
+ options {defaultErrorHandler = true;}
+ : m:modifiers!
+ ( classDefinition[#m]
+ | interfaceDefinition[#m]
+ )
+ | SEMI!
+ ;
/** A declaration is the creation of a reference or primitive-type variable
* Create a separate Type/Var tree for each var in the var list.
*/
declaration!
- : m:modifiers t:typeSpec[false] v:variableDefinitions[#m,#t]
- {#declaration = #v;}
- ;
+ : m:modifiers t:typeSpec[false] v:variableDefinitions[#m,#t]
+ {#declaration = #v;}
+ ;
// A type specification is a type name with possible brackets afterwards
// (which would make it an array type).
typeSpec[boolean addImagNode]
- : classTypeSpec[addImagNode]
- | builtInTypeSpec[addImagNode]
- ;
+ : classTypeSpec[addImagNode]
+ | builtInTypeSpec[addImagNode]
+ ;
// A class type specification is a class type with possible brackets afterwards
// (which would make it an array type).
classTypeSpec[boolean addImagNode]
- : identifier (lb:LBRACK^ {#lb.setType(ARRAY_DECLARATOR);} RBRACK!)*
- {
- if ( addImagNode ) {
- #classTypeSpec = #(#[TYPE,"TYPE"], #classTypeSpec);
- }
- }
- ;
+ : identifier (lb:LBRACK^ {#lb.setType(ARRAY_DECLARATOR);} RBRACK!)*
+ {
+ if ( addImagNode ) {
+ #classTypeSpec = #(#[TYPE,"TYPE"], #classTypeSpec);
+ }
+ }
+ ;
// A builtin type specification is a builtin type with possible brackets
// afterwards (which would make it an array type).
builtInTypeSpec[boolean addImagNode]
- : builtInType (lb:LBRACK^ {#lb.setType(ARRAY_DECLARATOR);} RBRACK!)*
- {
- if ( addImagNode ) {
- #builtInTypeSpec = #(#[TYPE,"TYPE"], #builtInTypeSpec);
- }
- }
- ;
+ : builtInType (lb:LBRACK^ {#lb.setType(ARRAY_DECLARATOR);} RBRACK!)*
+ {
+ if ( addImagNode ) {
+ #builtInTypeSpec = #(#[TYPE,"TYPE"], #builtInTypeSpec);
+ }
+ }
+ ;
// A type name. which is either a (possibly qualified) class name or
// a primitive (builtin) type
type
- : identifier
- | builtInType
- ;
+ : identifier
+ | builtInType
+ ;
// The primitive types.
builtInType
- : "void"
- | "boolean"
- | "byte"
- | "char"
- | "short"
- | "int"
- | "float"
- | "long"
- | "double"
- ;
+ : "void"
+ | "boolean"
+ | "byte"
+ | "char"
+ | "short"
+ | "int"
+ | "float"
+ | "long"
+ | "double"
+ ;
// A (possibly-qualified) java identifier. We start with the first IDENT
// and expand its name by adding dots and following IDENTS
identifier
- : IDENT ( DOT^ IDENT )*
- ;
+ : IDENT ( DOT^ IDENT )*
+ ;
identifierStar
- : IDENT
- ( DOT^ IDENT )*
- ( DOT^ STAR )?
- ;
+ : IDENT
+ ( DOT^ IDENT )*
+ ( DOT^ STAR )?
+ ;
// A list of zero or more modifiers. We could have used (modifier)* in
// place of a call to modifiers, but I thought it was a good idea to keep
// this rule separate so they can easily be collected in a Vector if
// someone so desires
modifiers
- : ( modifier )*
- {#modifiers = #([MODIFIERS, "MODIFIERS"], #modifiers);}
- ;
+ : ( modifier )*
+ {#modifiers = #([MODIFIERS, "MODIFIERS"], #modifiers);}
+ ;
// modifiers for Java classes, interfaces, class/instance vars and methods
modifier
- : "private"
- | "public"
- | "protected"
- | "static"
- | "transient"
- | "final"
- | "abstract"
- | "native"
- | "threadsafe"
- | "synchronized"
-// | "const" // reserved word, but not valid
- | "volatile"
- | "strictfp"
- ;
+ : "private"
+ | "public"
+ | "protected"
+ | "static"
+ | "transient"
+ | "final"
+ | "abstract"
+ | "native"
+ | "threadsafe"
+ | "synchronized"
+// | "const" // reserved word, but not valid
+ | "volatile"
+ | "strictfp"
+ ;
// Definition of a Java class
classDefinition![AST modifiers]
- : "class" IDENT
- // it _might_ have a superclass...
- sc:superClassClause
- // it might implement some interfaces...
- ic:implementsClause
- // now parse the body of the class
- cb:classBlock
- {#classDefinition = #(#[CLASS_DEF,"CLASS_DEF"],
- modifiers,IDENT,sc,ic,cb);}
- ;
+ : "class" IDENT
+ // it _might_ have a superclass...
+ sc:superClassClause
+ // it might implement some interfaces...
+ ic:implementsClause
+ // now parse the body of the class
+ cb:classBlock
+ {#classDefinition = #(#[CLASS_DEF,"CLASS_DEF"],
+ modifiers,IDENT,sc,ic,cb);}
+ ;
superClassClause!
- : ( "extends" id:identifier )?
- {#superClassClause = #(#[EXTENDS_CLAUSE,"EXTENDS_CLAUSE"],id);}
- ;
+ : ( "extends" id:identifier )?
+ {#superClassClause = #(#[EXTENDS_CLAUSE,"EXTENDS_CLAUSE"],id);}
+ ;
// Definition of a Java Interface
interfaceDefinition![AST modifiers]
- : "interface" IDENT
- // it might extend some other interfaces
- ie:interfaceExtends
- // now parse the body of the interface (looks like a class...)
- cb:classBlock
- {#interfaceDefinition = #(#[INTERFACE_DEF,"INTERFACE_DEF"],
- modifiers,IDENT,ie,cb);}
- ;
+ : "interface" IDENT
+ // it might extend some other interfaces
+ ie:interfaceExtends
+ // now parse the body of the interface (looks like a class...)
+ cb:classBlock
+ {#interfaceDefinition = #(#[INTERFACE_DEF,"INTERFACE_DEF"],
+ modifiers,IDENT,ie,cb);}
+ ;
// This is the body of a class. You can have fields and extra semicolons,
// That's about it (until you see what a field is...)
classBlock
- : LCURLY! { blockDepth++; }
- ( field | SEMI! )*
- RCURLY! { blockDepth--; }
- {#classBlock = #([OBJBLOCK, "OBJBLOCK"], #classBlock);}
- ;
+ : LCURLY! { blockDepth++; }
+ ( field | SEMI! )*
+ RCURLY! { blockDepth--; }
+ {#classBlock = #([OBJBLOCK, "OBJBLOCK"], #classBlock);}
+ ;
// An interface can extend several other interfaces...
interfaceExtends
- : (
- e:"extends"!
- identifier ( COMMA! identifier )*
- )?
- {#interfaceExtends = #(#[EXTENDS_CLAUSE,"EXTENDS_CLAUSE"],
- #interfaceExtends);}
- ;
+ : (
+ e:"extends"!
+ identifier ( COMMA! identifier )*
+ )?
+ {#interfaceExtends = #(#[EXTENDS_CLAUSE,"EXTENDS_CLAUSE"],
+ #interfaceExtends);}
+ ;
// A class can implement several interfaces...
implementsClause
- : (
- i:"implements"! identifier ( COMMA! identifier )*
- )?
- {#implementsClause = #(#[IMPLEMENTS_CLAUSE,"IMPLEMENTS_CLAUSE"],
- #implementsClause);}
- ;
+ : (
+ i:"implements"! identifier ( COMMA! identifier )*
+ )?
+ {#implementsClause = #(#[IMPLEMENTS_CLAUSE,"IMPLEMENTS_CLAUSE"],
+ #implementsClause);}
+ ;
// Now the various things that can be defined inside a class or interface...
// Note that not all of these are really valid in an interface (constructors,
// for example), and if this grammar were used for a compiler there would
// need to be some semantic checks to make sure we're doing the right thing...
field!
- : // method, constructor, or variable declaration
- mods:modifiers
- ( h:ctorHead s:constructorBody // constructor
- {#field = #(#[CTOR_DEF,"CTOR_DEF"], mods, h, s);}
-
- | cd:classDefinition[#mods] // inner class
- {#field = #cd;}
-
- | id:interfaceDefinition[#mods] // inner interface
- {#field = #id;}
-
- | t:typeSpec[false] // method or variable declaration(s)
- ( fn:IDENT // the name of the method
-
- // parse the formal parameter declarations.
- LPAREN! param:parameterDeclarationList RPAREN!
-
- rt:declaratorBrackets[#t]
-
- // get the list of exceptions that this method is
- // declared to throw
- (tc:throwsClause)?
-
- ( s2:compoundStatement | SEMI )
- {#field = #(#[METHOD_DEF,"METHOD_DEF"],
- mods,
- #(#[TYPE,"TYPE"],rt),
- fn,
- param,
- tc,
- s2);
+ : // method, constructor, or variable declaration
+ mods:modifiers
+ ( h:ctorHead s:constructorBody // constructor
+ {#field = #(#[CTOR_DEF,"CTOR_DEF"], mods, h, s);}
+
+ | cd:classDefinition[#mods] // inner class
+ {#field = #cd;}
+
+ | id:interfaceDefinition[#mods] // inner interface
+ {#field = #id;}
+
+ | t:typeSpec[false] // method or variable declaration(s)
+ ( fn:IDENT // the name of the method
+
+ // parse the formal parameter declarations.
+ LPAREN! param:parameterDeclarationList RPAREN!
+
+ rt:declaratorBrackets[#t]
+
+ // get the list of exceptions that this method is
+ // declared to throw
+ (tc:throwsClause)?
+
+ ( s2:compoundStatement | SEMI )
+ {#field = #(#[METHOD_DEF,"METHOD_DEF"],
+ mods,
+ #(#[TYPE,"TYPE"],rt),
+ fn,
+ param,
+ tc,
+ s2);
if(blockDepth==1) {
functionNames.add(fn.getText()); } }
- | v:variableDefinitions[#mods,#t] SEMI
-// {#field = #(#[VARIABLE_DEF,"VARIABLE_DEF"], v);}
- {#field = #v;}
- )
- )
+ | v:variableDefinitions[#mods,#t] SEMI
+// {#field = #(#[VARIABLE_DEF,"VARIABLE_DEF"], v);}
+ {#field = #v;}
+ )
+ )
// "static { ... }" class initializer
- | "static" s3:compoundStatement
- {#field = #(#[STATIC_INIT,"STATIC_INIT"], s3);}
+ | "static" s3:compoundStatement
+ {#field = #(#[STATIC_INIT,"STATIC_INIT"], s3);}
// "{ ... }" instance initializer
- | s4:compoundStatement
- {#field = #(#[INSTANCE_INIT,"INSTANCE_INIT"], s4);}
- ;
+ | s4:compoundStatement
+ {#field = #(#[INSTANCE_INIT,"INSTANCE_INIT"], s4);}
+ ;
constructorBody
: lc:LCURLY^ {#lc.setType(SLIST); blockDepth++; }
@@ -436,108 +436,108 @@
/** Catch obvious constructor calls, but not the expr.super(...) calls */
explicitConstructorInvocation
: "this"! lp1:LPAREN^ argList RPAREN! SEMI!
- {#lp1.setType(CTOR_CALL);}
+ {#lp1.setType(CTOR_CALL);}
| "super"! lp2:LPAREN^ argList RPAREN! SEMI!
- {#lp2.setType(SUPER_CTOR_CALL);}
+ {#lp2.setType(SUPER_CTOR_CALL);}
;
variableDefinitions[AST mods, AST t]
- : variableDeclarator[getASTFactory().dupTree(mods),
- getASTFactory().dupTree(t)]
- ( COMMA!
- variableDeclarator[getASTFactory().dupTree(mods),
- getASTFactory().dupTree(t)]
- )*
- ;
+ : variableDeclarator[getASTFactory().dupTree(mods),
+ getASTFactory().dupTree(t)]
+ ( COMMA!
+ variableDeclarator[getASTFactory().dupTree(mods),
+ getASTFactory().dupTree(t)]
+ )*
+ ;
/** Declaration of a variable. This can be a class/instance variable,
* or a local variable in a method
* It can also include possible initialization.
*/
variableDeclarator![AST mods, AST t]
- : id:IDENT d:declaratorBrackets[t] v:varInitializer
- {#variableDeclarator = #(#[VARIABLE_DEF,"VARIABLE_DEF"], mods, #(#[TYPE,"TYPE"],d), id, v);
+ : id:IDENT d:declaratorBrackets[t] v:varInitializer
+ {#variableDeclarator = #(#[VARIABLE_DEF,"VARIABLE_DEF"], mods, #(#[TYPE,"TYPE"],d), id, v);
if(blockDepth==1) {
enumNames.add(id.getText());
}
}
- ;
+ ;
declaratorBrackets[AST typ]
- : {#declaratorBrackets=typ;}
- (lb:LBRACK^ {#lb.setType(ARRAY_DECLARATOR);} RBRACK!)*
- ;
+ : {#declaratorBrackets=typ;}
+ (lb:LBRACK^ {#lb.setType(ARRAY_DECLARATOR);} RBRACK!)*
+ ;
varInitializer
- : ( ASSIGN^ initializer )?
- ;
+ : ( ASSIGN^ initializer )?
+ ;
// This is an initializer used to set up an array.
arrayInitializer
- : lc:LCURLY^ {#lc.setType(ARRAY_INIT); blockDepth++; }
- ( initializer
- (
- // CONFLICT: does a COMMA after an initializer start a new
- // initializer or start the option ',' at end?
- // ANTLR generates proper code by matching
- // the comma as soon as possible.
- options {
- warnWhenFollowAmbig = false;
- }
- :
- COMMA! initializer
- )*
- (COMMA!)?
- )?
- RCURLY! { blockDepth--; }
- ;
+ : lc:LCURLY^ {#lc.setType(ARRAY_INIT); blockDepth++; }
+ ( initializer
+ (
+ // CONFLICT: does a COMMA after an initializer start a new
+ // initializer or start the option ',' at end?
+ // ANTLR generates proper code by matching
+ // the comma as soon as possible.
+ options {
+ warnWhenFollowAmbig = false;
+ }
+ :
+ COMMA! initializer
+ )*
+ (COMMA!)?
+ )?
+ RCURLY! { blockDepth--; }
+ ;
// The two "things" that can initialize an array element are an expression
// and another (nested) array initializer.
initializer
- : expression
- | arrayInitializer
- ;
+ : expression
+ | arrayInitializer
+ ;
// This is the header of a method. It includes the name and parameters
// for the method.
// This also watches for a list of exception classes in a "throws" clause.
ctorHead
- : IDENT // the name of the method
+ : IDENT // the name of the method
- // parse the formal parameter declarations.
- LPAREN! parameterDeclarationList RPAREN!
+ // parse the formal parameter declarations.
+ LPAREN! parameterDeclarationList RPAREN!
- // get the list of exceptions that this method is declared to throw
- (throwsClause)?
- ;
+ // get the list of exceptions that this method is declared to throw
+ (throwsClause)?
+ ;
// This is a list of exception classes that the method is declared to throw
throwsClause
- : "throws"^ identifier ( COMMA! identifier )*
- ;
+ : "throws"^ identifier ( COMMA! identifier )*
+ ;
// A list of formal parameters
parameterDeclarationList
- : ( parameterDeclaration ( COMMA! parameterDeclaration )* )?
- {#parameterDeclarationList = #(#[PARAMETERS,"PARAMETERS"],
- #parameterDeclarationList);}
- ;
+ : ( parameterDeclaration ( COMMA! parameterDeclaration )* )?
+ {#parameterDeclarationList = #(#[PARAMETERS,"PARAMETERS"],
+ #parameterDeclarationList);}
+ ;
// A formal parameter.
parameterDeclaration!
- : pm:parameterModifier t:typeSpec[false] id:IDENT
- pd:declaratorBrackets[#t]
- {#parameterDeclaration = #(#[PARAMETER_DEF,"PARAMETER_DEF"],
- pm, #([TYPE,"TYPE"],pd), id);}
- ;
+ : pm:parameterModifier t:typeSpec[false] id:IDENT
+ pd:declaratorBrackets[#t]
+ {#parameterDeclaration = #(#[PARAMETER_DEF,"PARAMETER_DEF"],
+ pm, #([TYPE,"TYPE"],pd), id);}
+ ;
parameterModifier
- : (f:"final")?
- {#parameterModifier = #(#[MODIFIERS,"MODIFIERS"], f);}
- ;
+ : (f:"final")?
+ {#parameterModifier = #(#[MODIFIERS,"MODIFIERS"], f);}
+ ;
// Compound statement. This is used in many contexts:
// Inside a class definition prefixed with "static":
@@ -549,151 +549,151 @@
// it starts a new scope for variable definitions
compoundStatement
- : lc:LCURLY^ {#lc.setType(SLIST); blockDepth++; }
- // include the (possibly-empty) list of statements
- (statement)*
- RCURLY! { blockDepth--; }
- ;
+ : lc:LCURLY^ {#lc.setType(SLIST); blockDepth++; }
+ // include the (possibly-empty) list of statements
+ (statement)*
+ RCURLY! { blockDepth--; }
+ ;
statement
- // A list of statements in curly braces -- start a new scope!
- : compoundStatement
+ // A list of statements in curly braces -- start a new scope!
+ : compoundStatement
- // declarations are ambiguous with "ID DOT" relative to expression
- // statements. Must backtrack to be sure. Could use a semantic
- // predicate to test symbol table to see what the type was coming
- // up, but that's pretty hard without a symbol table ;)
- | (declaration)=> declaration SEMI!
-
- // An expression statement. This could be a method call,
- // assignment statement, or any other expression evaluated for
- // side-effects.
- | expression SEMI!
-
- // class definition
- | m:modifiers! classDefinition[#m]
-
- // Attach a label to the front of a statement
- | IDENT c:COLON^ {#c.setType(LABELED_STAT);} statement
-
- // If-else statement
- | "if"^ LPAREN! expression RPAREN! statement
- (
- // CONFLICT: the old "dangling-else" problem...
- // ANTLR generates proper code matching
- // as soon as possible. Hush warning.
- options {
- warnWhenFollowAmbig = false;
- }
- :
- "else"! statement
- )?
-
- // For statement
- | "for"^
- LPAREN!
- forInit SEMI! // initializer
- forCond SEMI! // condition test
- forIter // updater
- RPAREN!
- statement // statement to loop over
-
- // While statement
- | "while"^ LPAREN! expression RPAREN! statement
-
- // do-while statement
- | "do"^ statement "while"! LPAREN! expression RPAREN! SEMI!
-
- // get out of a loop (or switch)
- | "break"^ (IDENT)? SEMI!
-
- // do next iteration of a loop
- | "continue"^ (IDENT)? SEMI!
-
- // Return an expression
- | "return"^ (expression)? SEMI!
-
- // switch/case statement
- | "switch"^ LPAREN! expression RPAREN! LCURLY! { blockDepth++; }
- ( casesGroup )*
- RCURLY! { blockDepth--; }
-
- // exception try-catch block
- | tryBlock
-
- // throw an exception
- | "throw"^ expression SEMI!
-
- // synchronize a statement
- | "synchronized"^ LPAREN! expression RPAREN! compoundStatement
-
- // asserts (uncomment if you want 1.4 compatibility)
- // | "assert"^ expression ( COLON! expression )? SEMI!
-
- // empty statement
- | s:SEMI {#s.setType(EMPTY_STAT);}
- ;
+ // declarations are ambiguous with "ID DOT" relative to expression
+ // statements. Must backtrack to be sure. Could use a semantic
+ // predicate to test symbol table to see what the type was coming
+ // up, but that's pretty hard without a symbol table ;)
+ | (declaration)=> declaration SEMI!
+
+ // An expression statement. This could be a method call,
+ // assignment statement, or any other expression evaluated for
+ // side-effects.
+ | expression SEMI!
+
+ // class definition
+ | m:modifiers! classDefinition[#m]
+
+ // Attach a label to the front of a statement
+ | IDENT c:COLON^ {#c.setType(LABELED_STAT);} statement
+
+ // If-else statement
+ | "if"^ LPAREN! expression RPAREN! statement
+ (
+ // CONFLICT: the old "dangling-else" problem...
+ // ANTLR generates proper code matching
+ // as soon as possible. Hush warning.
+ options {
+ warnWhenFollowAmbig = false;
+ }
+ :
+ "else"! statement
+ )?
+
+ // For statement
+ | "for"^
+ LPAREN!
+ forInit SEMI! // initializer
+ forCond SEMI! // condition test
+ forIter // updater
+ RPAREN!
+ statement // statement to loop over
+
+ // While statement
+ | "while"^ LPAREN! expression RPAREN! statement
+
+ // do-while statement
+ | "do"^ statement "while"! LPAREN! expression RPAREN! SEMI!
+
+ // get out of a loop (or switch)
+ | "break"^ (IDENT)? SEMI!
+
+ // do next iteration of a loop
+ | "continue"^ (IDENT)? SEMI!
+
+ // Return an expression
+ | "return"^ (expression)? SEMI!
+
+ // switch/case statement
+ | "switch"^ LPAREN! expression RPAREN! LCURLY! { blockDepth++; }
+ ( casesGroup )*
+ RCURLY! { blockDepth--; }
+
+ // exception try-catch block
+ | tryBlock
+
+ // throw an exception
+ | "throw"^ expression SEMI!
+
+ // synchronize a statement
+ | "synchronized"^ LPAREN! expression RPAREN! compoundStatement
+
+ // asserts (uncomment if you want 1.4 compatibility)
+ // | "assert"^ expression ( COLON! expression )? SEMI!
+
+ // empty statement
+ | s:SEMI {#s.setType(EMPTY_STAT);}
+ ;
casesGroup
- : ( // CONFLICT: to which case group do the statements bind?
- // ANTLR generates proper code: it groups the
- // many "case"/"default" labels together then
- // follows them with the statements
- options {
- greedy = true;
- }
- :
- aCase
- )+
- caseSList
- {#casesGroup = #([CASE_GROUP, "CASE_GROUP"], #casesGroup);}
- ;
+ : ( // CONFLICT: to which case group do the statements bind?
+ // ANTLR generates proper code: it groups the
+ // many "case"/"default" labels together then
+ // follows them with the statements
+ options {
+ greedy = true;
+ }
+ :
+ aCase
+ )+
+ caseSList
+ {#casesGroup = #([CASE_GROUP, "CASE_GROUP"], #casesGroup);}
+ ;
aCase
- : ("case"^ expression | "default") COLON!
- ;
+ : ("case"^ expression | "default") COLON!
+ ;
caseSList
- : (statement)*
- {#caseSList = #(#[SLIST,"SLIST"],#caseSList);}
- ;
+ : (statement)*
+ {#caseSList = #(#[SLIST,"SLIST"],#caseSList);}
+ ;
// The initializer for a for loop
forInit
- // if it looks like a declaration, it is
- : ( (declaration)=> declaration
- // otherwise it could be an expression list...
- | expressionList
- )?
- {#forInit = #(#[FOR_INIT,"FOR_INIT"],#forInit);}
- ;
+ // if it looks like a declaration, it is
+ : ( (declaration)=> declaration
+ // otherwise it could be an expression list...
+ | expressionList
+ )?
+ {#forInit = #(#[FOR_INIT,"FOR_INIT"],#forInit);}
+ ;
forCond
- : (expression)?
- {#forCond = #(#[FOR_CONDITION,"FOR_CONDITION"],#forCond);}
- ;
+ : (expression)?
+ {#forCond = #(#[FOR_CONDITION,"FOR_CONDITION"],#forCond);}
+ ;
forIter
- : (expressionList)?
- {#forIter = #(#[FOR_ITERATOR,"FOR_ITERATOR"],#forIter);}
- ;
+ : (expressionList)?
+ {#forIter = #(#[FOR_ITERATOR,"FOR_ITERATOR"],#forIter);}
+ ;
// an exception handler try/catch block
tryBlock
- : "try"^ compoundStatement
- (handler)*
- ( finallyClause )?
- ;
+ : "try"^ compoundStatement
+ (handler)*
+ ( finallyClause )?
+ ;
finallyClause
- : "finally"^ compoundStatement
- ;
+ : "finally"^ compoundStatement
+ ;
// an exception handler
handler
- : "catch"^ LPAREN! parameterDeclaration RPAREN! compoundStatement
- ;
+ : "catch"^ LPAREN! parameterDeclaration RPAREN! compoundStatement
+ ;
// expressions
@@ -732,22 +732,22 @@
// the mother of all expressions
expression
- : assignmentExpression
- {#expression = #(#[EXPR,"EXPR"],#expression);}
- ;
+ : assignmentExpression
+ {#expression = #(#[EXPR,"EXPR"],#expression);}
+ ;
// This is a list of expressions.
expressionList
- : expression (COMMA! expression)*
- {#expressionList = #(#[ELIST,"ELIST"], expressionList);}
- ;
+ : expression (COMMA! expression)*
+ {#expressionList = #(#[ELIST,"ELIST"], expressionList);}
+ ;
// assignment expression (level 13)
assignmentExpression
- : conditionalExpression
- ( ( ASSIGN^
+ : conditionalExpression
+ ( ( ASSIGN^
| PLUS_ASSIGN^
| MINUS_ASSIGN^
| STAR_ASSIGN^
@@ -760,99 +760,99 @@
| BXOR_ASSIGN^
| BOR_ASSIGN^
)
- assignmentExpression
- )?
- ;
+ assignmentExpression
+ )?
+ ;
// conditional test (level 12)
conditionalExpression
- : logicalOrExpression
- ( QUESTION^ assignmentExpression COLON! conditionalExpression )?
- ;
+ : logicalOrExpression
+ ( QUESTION^ assignmentExpression COLON! conditionalExpression )?
+ ;
// logical or (||) (level 11)
logicalOrExpression
- : logicalAndExpression (LOR^ logicalAndExpression)*
- ;
+ : logicalAndExpression (LOR^ logicalAndExpression)*
+ ;
// logical and (&&) (level 10)
logicalAndExpression
- : inclusiveOrExpression (LAND^ inclusiveOrExpression)*
- ;
+ : inclusiveOrExpression (LAND^ inclusiveOrExpression)*
+ ;
// bitwise or non-short-circuiting or (|) (level 9)
inclusiveOrExpression
- : exclusiveOrExpression (BOR^ exclusiveOrExpression)*
- ;
+ : exclusiveOrExpression (BOR^ exclusiveOrExpression)*
+ ;
// exclusive or (^) (level 8)
exclusiveOrExpression
- : andExpression (BXOR^ andExpression)*
- ;
+ : andExpression (BXOR^ andExpression)*
+ ;
// bitwise or non-short-circuiting and (&) (level 7)
andExpression
- : equalityExpression (BAND^ equalityExpression)*
- ;
+ : equalityExpression (BAND^ equalityExpression)*
+ ;
// equality/inequality (==/!=) (level 6)
equalityExpression
- : relationalExpression ((NOT_EQUAL^ | EQUAL^) relationalExpression)*
- ;
+ : relationalExpression ((NOT_EQUAL^ | EQUAL^) relationalExpression)*
+ ;
// boolean relational expressions (level 5)
relationalExpression
- : shiftExpression
- ( ( ( LT^
- | GT^
- | LE^
- | GE^
- )
- shiftExpression
- )*
- | "instanceof"^ typeSpec[true]
- )
- ;
+ : shiftExpression
+ ( ( ( LT^
+ | GT^
+ | LE^
+ | GE^
+ )
+ shiftExpression
+ )*
+ | "instanceof"^ typeSpec[true]
+ )
+ ;
// bit shift expressions (level 4)
shiftExpression
- : additiveExpression ((SL^ | SR^ | BSR^) additiveExpression)*
- ;
+ : additiveExpression ((SL^ | SR^ | BSR^) additiveExpression)*
+ ;
// binary addition/subtraction (level 3)
additiveExpression
- : multiplicativeExpression ((PLUS^ | MINUS^) multiplicativeExpression)*
- ;
+ : multiplicativeExpression ((PLUS^ | MINUS^) multiplicativeExpression)*
+ ;
// multiplication/division/modulo (level 2)
multiplicativeExpression
- : unaryExpression ((STAR^ | DIV^ | MOD^ ) unaryExpression)*
- ;
+ : unaryExpression ((STAR^ | DIV^ | MOD^ ) unaryExpression)*
+ ;
unaryExpression
- : INC^ unaryExpression
- | DEC^ unaryExpression
- | MINUS^ {#MINUS.setType(UNARY_MINUS);} unaryExpression
- | PLUS^ {#PLUS.setType(UNARY_PLUS);} unaryExpression
- | unaryExpressionNotPlusMinus
- ;
+ : INC^ unaryExpression
+ | DEC^ unaryExpression
+ | MINUS^ {#MINUS.setType(UNARY_MINUS);} unaryExpression
+ | PLUS^ {#PLUS.setType(UNARY_PLUS);} unaryExpression
+ | unaryExpressionNotPlusMinus
+ ;
unaryExpressionNotPlusMinus
- : BNOT^ unaryExpression
- | LNOT^ unaryExpression
+ : BNOT^ unaryExpression
+ | LNOT^ unaryExpression
- // use predicate to skip cases like: (int.class)
+ // use predicate to skip cases like: (int.class)
| (LPAREN builtInTypeSpec[true] RPAREN) =>
lpb:LPAREN^ {#lpb.setType(TYPECAST);} builtInTypeSpec[true] RPAREN!
unaryExpression
@@ -860,108 +860,108 @@
// Have to backtrack to see if operator follows. If no operator
// follows, it's a typecast. No semantic checking needed to parse.
// if it _looks_ like a cast, it _is_ a cast; else it's a "(expr)"
- | (LPAREN classTypeSpec[true] RPAREN unaryExpressionNotPlusMinus)=>
+ | (LPAREN classTypeSpec[true] RPAREN unaryExpressionNotPlusMinus)=>
lp:LPAREN^ {#lp.setType(TYPECAST);} classTypeSpec[true] RPAREN!
unaryExpressionNotPlusMinus
- | postfixExpression
- ;
+ | postfixExpression
+ ;
// qualified names, array expressions, method invocation, post inc/dec
postfixExpression
- :
+ :
/*
"this"! lp1:LPAREN^ argList RPAREN!
- {#lp1.setType(CTOR_CALL);}
+ {#lp1.setType(CTOR_CALL);}
| "super"! lp2:LPAREN^ argList RPAREN!
- {#lp2.setType(SUPER_CTOR_CALL);}
+ {#lp2.setType(SUPER_CTOR_CALL);}
|
*/
primaryExpression
- (
+ (
/*
options {
- // the use of postfixExpression in SUPER_CTOR_CALL adds DOT
- // to the lookahead set, and gives loads of false non-det
- // warnings.
- // shut them off.
- generateAmbigWarnings=false;
- }
- : */
+ // the use of postfixExpression in SUPER_CTOR_CALL adds DOT
+ // to the lookahead set, and gives loads of false non-det
+ // warnings.
+ // shut them off.
+ generateAmbigWarnings=false;
+ }
+ : */
DOT^ IDENT
- ( lp:LPAREN^ {#lp.setType(METHOD_CALL);}
- argList
- RPAREN!
- )?
- | DOT^ "this"
+ ( lp:LPAREN^ {#lp.setType(METHOD_CALL);}
+ argList
+ RPAREN!
+ )?
+ | DOT^ "this"
- | DOT^ "super"
+ | DOT^ "super"
( // (new Outer()).super() (create enclosing instance)
lp3:LPAREN^ argList RPAREN!
{#lp3.setType(SUPER_CTOR_CALL);}
- | DOT^ IDENT
- ( lps:LPAREN^ {#lps.setType(METHOD_CALL);}
+ | DOT^ IDENT
+ ( lps:LPAREN^ {#lps.setType(METHOD_CALL);}
argList
RPAREN!
)?
)
- | DOT^ newExpression
- | lb:LBRACK^ {#lb.setType(INDEX_OP);} expression RBRACK!
- )*
+ | DOT^ newExpression
+ | lb:LBRACK^ {#lb.setType(INDEX_OP);} expression RBRACK!
+ )*
- ( // possibly add on a post-increment or post-decrement.
+ ( // possibly add on a post-increment or post-decrement.
// allows INC/DEC on too much, but semantics can check
- in:INC^ {#in.setType(POST_INC);}
- | de:DEC^ {#de.setType(POST_DEC);}
- )?
- ;
+ in:INC^ {#in.setType(POST_INC);}
+ | de:DEC^ {#de.setType(POST_DEC);}
+ )?
+ ;
// the basic element of an expression
primaryExpression
- : identPrimary ( options {greedy=true;} : DOT^ "class" )?
+ : identPrimary ( options {greedy=true;} : DOT^ "class" )?
| constant
- | "true"
- | "false"
- | "null"
+ | "true"
+ | "false"
+ | "null"
| newExpression
- | "this"
- | "super"
- | LPAREN! assignmentExpression RPAREN!
- // look for int.class and int[].class
- | builtInType
- ( lbt:LBRACK^ {#lbt.setType(ARRAY_DECLARATOR);} RBRACK! )*
- DOT^ "class"
- ;
+ | "this"
+ | "super"
+ | LPAREN! assignmentExpression RPAREN!
+ // look for int.class and int[].class
+ | builtInType
+ ( lbt:LBRACK^ {#lbt.setType(ARRAY_DECLARATOR);} RBRACK! )*
+ DOT^ "class"
+ ;
/** Match a, a.b.c refs, a.b.c(...) refs, a.b.c[], a.b.c[].class,
* and a.b.c.class refs. Also this(...) and super(...). Match
* this or super.
*/
identPrimary
- : IDENT
- (
+ : IDENT
+ (
options {
- // .ident could match here or in postfixExpression.
- // We do want to match here. Turn off warning.
- greedy=true;
- }
- : DOT^ IDENT
- )*
- (
+ // .ident could match here or in postfixExpression.
+ // We do want to match here. Turn off warning.
+ greedy=true;
+ }
+ : DOT^ IDENT
+ )*
+ (
options {
- // ARRAY_DECLARATOR here conflicts with INDEX_OP in
- // postfixExpression on LBRACK RBRACK.
- // We want to match [] here, so greedy. This overcomes
+ // ARRAY_DECLARATOR here conflicts with INDEX_OP in
+ // postfixExpression on LBRACK RBRACK.
+ // We want to match [] here, so greedy. This overcomes
// limitation of linear approximate lookahead.
- greedy=true;
- }
- : ( lp:LPAREN^ {#lp.setType(METHOD_CALL);} argList RPAREN! )
- | ( options {greedy=true;} :
+ greedy=true;
+ }
+ : ( lp:LPAREN^ {#lp.setType(METHOD_CALL);} argList RPAREN! )
+ | ( options {greedy=true;} :
lbc:LBRACK^ {#lbc.setType(ARRAY_DECLARATOR);} RBRACK!
)+
- )?
+ )?
;
/** object instantiation.
@@ -1014,53 +1014,53 @@
*
*/
newExpression
- : "new"^ type
- ( LPAREN! argList RPAREN! (classBlock)?
+ : "new"^ type
+ ( LPAREN! argList RPAREN! (classBlock)?
- //java 1.1
- // Note: This will allow bad constructs like
- // new int[4][][3] {exp,exp}.
- // There needs to be a semantic check here...
- // to make sure:
- // a) [ expr ] and [ ] are not mixed
- // b) [ expr ] and an init are not used together
-
- | newArrayDeclarator (arrayInitializer)?
- )
- ;
+ //java 1.1
+ // Note: This will allow bad constructs like
+ // new int[4][][3] {exp,exp}.
+ // There needs to be a semantic check here...
+ // to make sure:
+ // a) [ expr ] and [ ] are not mixed
+ // b) [ expr ] and an init are not used together
+
+ | newArrayDeclarator (arrayInitializer)?
+ )
+ ;
argList
- : ( expressionList
- | /*nothing*/
- {#argList = #[ELIST,"ELIST"];}
- )
- ;
+ : ( expressionList
+ | /*nothing*/
+ {#argList = #[ELIST,"ELIST"];}
+ )
+ ;
newArrayDeclarator
- : (
- // CONFLICT:
- // newExpression is a primaryExpression which can be
- // followed by an array index reference. This is ok,
- // as the generated code will stay in this loop as
- // long as it sees an LBRACK (proper behavior)
- options {
- warnWhenFollowAmbig = false;
- }
- :
- lb:LBRACK^ {#lb.setType(ARRAY_DECLARATOR);}
- (expression)?
- RBRACK!
- )+
- ;
+ : (
+ // CONFLICT:
+ // newExpression is a primaryExpression which can be
+ // followed by an array index reference. This is ok,
+ // as the generated code will stay in this loop as
+ // long as it sees an LBRACK (proper behavior)
+ options {
+ warnWhenFollowAmbig = false;
+ }
+ :
+ lb:LBRACK^ {#lb.setType(ARRAY_DECLARATOR);}
+ (expression)?
+ RBRACK!
+ )+
+ ;
constant
- : NUM_INT
- | CHAR_LITERAL
- | STRING_LITERAL
- | NUM_FLOAT
- | NUM_LONG
- | NUM_DOUBLE
- ;
+ : NUM_INT
+ | CHAR_LITERAL
+ | STRING_LITERAL
+ | NUM_FLOAT
+ | NUM_LONG
+ | NUM_DOUBLE
+ ;
//----------------------------------------------------------------------------
// The Java scanner
@@ -1068,121 +1068,121 @@
class JavaLexer extends Lexer;
options {
- exportVocab=Java; // call the vocabulary "Java"
- testLiterals=false; // don't automatically test for literals
- k=4; // four characters of lookahead
- charVocabulary='\u0003'..'\u7FFE';
- // without inlining some bitset tests, couldn't do unicode;
- // I need to make ANTLR generate smaller bitsets; see
- // bottom of JavaLexer.java
- codeGenBitsetTestThreshold=20;
+ exportVocab=Java; // call the vocabulary "Java"
+ testLiterals=false; // don't automatically test for literals
+ k=4; // four characters of lookahead
+ charVocabulary='\u0003'..'\u7FFE';
+ // without inlining some bitset tests, couldn't do unicode;
+ // I need to make ANTLR generate smaller bitsets; see
+ // bottom of JavaLexer.java
+ codeGenBitsetTestThreshold=20;
}
// OPERATORS
-QUESTION : '?' ;
-LPAREN : '(' ;
-RPAREN : ')' ;
-LBRACK : '[' ;
-RBRACK : ']' ;
-LCURLY : '{' ;
-RCURLY : '}' ;
-COLON : ':' ;
-COMMA : ',' ;
-//DOT : '.' ;
-ASSIGN : '=' ;
-EQUAL : "==" ;
-LNOT : '!' ;
-BNOT : '~' ;
-NOT_EQUAL : "!=" ;
-DIV : '/' ;
-DIV_ASSIGN : "/=" ;
-PLUS : '+' ;
-PLUS_ASSIGN : "+=" ;
-INC : "++" ;
-MINUS : '-' ;
-MINUS_ASSIGN : "-=" ;
-DEC : "--" ;
-STAR : '*' ;
-STAR_ASSIGN : "*=" ;
-MOD : '%' ;
-MOD_ASSIGN : "%=" ;
-SR : ">>" ;
-SR_ASSIGN : ">>=" ;
-BSR : ">>>" ;
-BSR_ASSIGN : ">>>=" ;
-GE : ">=" ;
-GT : ">" ;
-SL : "<<" ;
-SL_ASSIGN : "<<=" ;
-LE : "<=" ;
-LT : '<' ;
-BXOR : '^' ;
-BXOR_ASSIGN : "^=" ;
-BOR : '|' ;
-BOR_ASSIGN : "|=" ;
-LOR : "||" ;
-BAND : '&' ;
-BAND_ASSIGN : "&=" ;
-LAND : "&&" ;
-SEMI : ';' ;
+QUESTION : '?' ;
+LPAREN : '(' ;
+RPAREN : ')' ;
+LBRACK : '[' ;
+RBRACK : ']' ;
+LCURLY : '{' ;
+RCURLY : '}' ;
+COLON : ':' ;
+COMMA : ',' ;
+//DOT : '.' ;
+ASSIGN : '=' ;
+EQUAL : "==" ;
+LNOT : '!' ;
+BNOT : '~' ;
+NOT_EQUAL : "!=" ;
+DIV : '/' ;
+DIV_ASSIGN : "/=" ;
+PLUS : '+' ;
+PLUS_ASSIGN : "+=" ;
+INC : "++" ;
+MINUS : '-' ;
+MINUS_ASSIGN : "-=" ;
+DEC : "--" ;
+STAR : '*' ;
+STAR_ASSIGN : "*=" ;
+MOD : '%' ;
+MOD_ASSIGN : "%=" ;
+SR : ">>" ;
+SR_ASSIGN : ">>=" ;
+BSR : ">>>" ;
+BSR_ASSIGN : ">>>=" ;
+GE : ">=" ;
+GT : ">" ;
+SL : "<<" ;
+SL_ASSIGN : "<<=" ;
+LE : "<=" ;
+LT : '<' ;
+BXOR : '^' ;
+BXOR_ASSIGN : "^=" ;
+BOR : '|' ;
+BOR_ASSIGN : "|=" ;
+LOR : "||" ;
+BAND : '&' ;
+BAND_ASSIGN : "&=" ;
+LAND : "&&" ;
+SEMI : ';' ;
// Whitespace -- ignored
-WS : ( ' '
- | '\t'
- | '\f'
- // handle newlines
- | ( options {generateAmbigWarnings=false;}
- : "\r\n" // Evil DOS
- | '\r' // Macintosh
- | '\n' // Unix (the right way)
- )
- { newline(); }
- )+
- { _ttype = Token.SKIP; }
- ;
+WS : ( ' '
+ | '\t'
+ | '\f'
+ // handle newlines
+ | ( options {generateAmbigWarnings=false;}
+ : "\r\n" // Evil DOS
+ | '\r' // Macintosh
+ | '\n' // Unix (the right way)
+ )
+ { newline(); }
+ )+
+ { _ttype = Token.SKIP; }
+ ;
// Single-line comments
SL_COMMENT
- : "//"
- (~('\n'|'\r'))* ('\n'|'\r'('\n')?)?
- {$setType(Token.SKIP); newline();}
- ;
+ : "//"
+ (~('\n'|'\r'))* ('\n'|'\r'('\n')?)?
+ {$setType(Token.SKIP); newline();}
+ ;
// multiple-line comments
ML_COMMENT
- : "/*"
- ( /* '\r' '\n' can be matched in one alternative or by matching
- '\r' in one iteration and '\n' in another. I am trying to
- handle any flavor of newline that comes in, but the language
- that allows both "\r\n" and "\r" and "\n" to all be valid
- newline is ambiguous. Consequently, the resulting grammar
- must be ambiguous. I'm shutting this warning off.
- */
- options {
- generateAmbigWarnings=false;
- }
- :
- { LA(2)!='/' }? '*'
- | '\r' '\n' {newline();}
- | '\r' {newline();}
- | '\n' {newline();}
- | ~('*'|'\n'|'\r')
- )*
- "*/"
- {$setType(Token.SKIP);}
- ;
+ : "/*"
+ ( /* '\r' '\n' can be matched in one alternative or by matching
+ '\r' in one iteration and '\n' in another. I am trying to
+ handle any flavor of newline that comes in, but the language
+ that allows both "\r\n" and "\r" and "\n" to all be valid
+ newline is ambiguous. Consequently, the resulting grammar
+ must be ambiguous. I'm shutting this warning off.
+ */
+ options {
+ generateAmbigWarnings=false;
+ }
+ :
+ { LA(2)!='/' }? '*'
+ | '\r' '\n' {newline();}
+ | '\r' {newline();}
+ | '\n' {newline();}
+ | ~('*'|'\n'|'\r')
+ )*
+ "*/"
+ {$setType(Token.SKIP);}
+ ;
// character literals
CHAR_LITERAL
- : '\'' ( ESC | ~('\''|'\n'|'\r'|'\\') ) '\''
- ;
+ : '\'' ( ESC | ~('\''|'\n'|'\r'|'\\') ) '\''
+ ;
// string literals
STRING_LITERAL
- : '"' (ESC|~('"'|'\\'|'\n'|'\r'))* '"'
- ;
+ : '"' (ESC|~('"'|'\\'|'\n'|'\r'))* '"'
+ ;
// escape sequence -- note that this is protected; it can only be called
@@ -1195,121 +1195,132 @@
// the FOLLOW ambig warnings.
protected
ESC
- : '\\'
- ( 'n'
- | 'r'
- | 't'
- | 'b'
- | 'f'
- | '"'
- | '\''
- | '\\'
- | ('u')+ HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT
- | '0'..'3'
- (
- options {
- warnWhenFollowAmbig = false;
- }
- : '0'..'7'
- (
- options {
- warnWhenFollowAmbig = false;
- }
- : '0'..'7'
- )?
- )?
- | '4'..'7'
- (
- options {
- warnWhenFollowAmbig = false;
- }
- : '0'..'7'
- )?
- )
- ;
+ : '\\'
+ ( 'n'
+ | 'r'
+ | 't'
+ | 'b'
+ | 'f'
+ | '"'
+ | '\''
+ | '\\'
+ | ('u')+ HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT
+ | '0'..'3'
+ (
+ options {
+ warnWhenFollowAmbig = false;
+ }
+ : '0'..'7'
+ (
+ options {
+ warnWhenFollowAmbig = false;
+ }
+ : '0'..'7'
+ )?
+ )?
+ | '4'..'7'
+ (
+ options {
+ warnWhenFollowAmbig = false;
+ }
+ : '0'..'7'
+ )?
+ )
+ ;
// hexadecimal digit (again, note it's protected!)
protected
HEX_DIGIT
- : ('0'..'9'|'A'..'F'|'a'..'f')
- ;
+ : ('0'..'9'|'A'..'F'|'a'..'f')
+ ;
// an identifier. Note that testLiterals is set to true! This means
// that after we match the rule, we look in the literals table to see
// if it's a literal or really an identifer
IDENT
- options {testLiterals=true;}
- : ('a'..'z'|'A'..'Z'|'_'|'$') ('a'..'z'|'A'..'Z'|'_'|'0'..'9'|'$')*
- ;
+ options {testLiterals=true;}
+ : ('a'..'z'|'A'..'Z'|'_'|'$') ('a'..'z'|'A'..'Z'|'_'|'0'..'9'|'$')*
+ ;
// a numeric literal
NUM_INT
- {boolean isDecimal=false; Token t=null;}
+ {boolean isDecimal=false, isHexadecimal=false; Token t=null;}
: '.' {_ttype = DOT;}
- ( ('0'..'9')+ (EXPONENT)? (f1:FLOAT_SUFFIX {t=f1;})?
+ ( ('0'..'9')+ (EXPONENT)? (f1:FLOAT_SUFFIX {t=f1;})?
{
- if (t != null && t.getText().toUpperCase().indexOf('F')>=0) {
- _ttype = NUM_FLOAT;
- }
- else {
- _ttype = NUM_DOUBLE; // assume double
- }
- }
+ if (t != null && t.getText().toUpperCase().indexOf('F')>=0) {
+ _ttype = NUM_FLOAT;
+ }
+ else {
+ _ttype = NUM_DOUBLE; // assume double
+ }
+ }
)?
- | ( '0' {isDecimal = true;} // special case for just '0'
- ( ('x'|'X')
- ( // hex
- // the 'e'|'E' and float suffix stuff look
- // like hex digits, hence the (...)+ doesn't
- // know when to stop: ambig. ANTLR resolves
- // it correctly by matching immediately. It
- // is therefor ok to hush warning.
- options {
- warnWhenFollowAmbig=false;
- }
- : HEX_DIGIT
- )+
-
- | //float or double with leading zero
- (('0'..'9')+ ('.'|EXPONENT|FLOAT_SUFFIX)) => ('0'..'9')+
-
- | ('0'..'7')+ // octal
- )?
- | ('1'..'9') ('0'..'9')* {isDecimal=true;} // non-zero decimal
- )
- ( ('l'|'L') { _ttype = NUM_LONG; }
-
- // only check to see if it's a float if looks like decimal so far
- | {isDecimal}?
- ( '.' ('0'..'9')* (EXPONENT)? (f2:FLOAT_SUFFIX {t=f2;})?
- | EXPONENT (f3:FLOAT_SUFFIX {t=f3;})?
- | f4:FLOAT_SUFFIX {t=f4;}
- )
- {
- if (t != null && t.getText().toUpperCase() .indexOf('F') >= 0) {
- _ttype = NUM_FLOAT;
- }
- else {
- _ttype = NUM_DOUBLE; // assume double
- }
- }
+ | ( '0' {isDecimal = true;} // special case for just '0'
+ ( ('x'|'X') { isHexadecimal=true; } // hex
+ (
+ // the 'e'|'E' and float suffix stuff look
+ // like hex digits, hence the (...)+ doesn't
+ // know when to stop: ambig. ANTLR resolves
+ // it correctly by matching immediately. It
+ // is therefor ok to hush warning.
+ options {
+ warnWhenFollowAmbig=false;
+ }
+ : HEX_DIGIT
+ )+
+
+ | //float or double with leading zero
+ (('0'..'9')+ ('.'|EXPONENT|FLOAT_SUFFIX)) => ('0'..'9')+
+
+ | ('0'..'7')+ // octal
+ )?
+ | ('1'..'9') ('0'..'9')* {isDecimal=true;} // non-zero decimal
+ )
+ (
+ ('l'|'L') { _ttype = NUM_LONG; }
+
+ // check to see if it's a hexadecimal w/ binary exponent float if looks like hexadecimal so far
+ | {isHexadecimal}?
+ ( '.' ( options { warnWhenFollowAmbig=false; } : HEX_DIGIT )* )?
+ ('p'|'P') ('+'|'-')? ('0'..'9')+ (f5:FLOAT_SUFFIX {t=f5;})?
+ {
+ if (t != null && t.getText().toUpperCase() .indexOf('F') >= 0) {
+ _ttype = NUM_FLOAT;
+ } else {
+ _ttype = NUM_DOUBLE; // assume double
+ }
+ }
+ // check to see if it's a float if looks like decimal so far
+ | {isDecimal}?
+ ( '.' ('0'..'9')* (EXPONENT)? (f2:FLOAT_SUFFIX {t=f2;})?
+ | EXPONENT (f3:FLOAT_SUFFIX {t=f3;})?
+ | f4:FLOAT_SUFFIX {t=f4;}
+ )
+ {
+ if (t != null && t.getText().toUpperCase() .indexOf('F') >= 0) {
+ _ttype = NUM_FLOAT;
+ } else {
+ _ttype = NUM_DOUBLE; // assume double
+ }
+ }
)?
- ;
+ ;
// a couple protected methods to assist in matching floating point numbers
protected
EXPONENT
- : ('e'|'E') ('+'|'-')? ('0'..'9')+
- ;
+ : ('e'|'E') (PLUS|MINUS)? ('0'..'9')+
+ ;
protected
FLOAT_SUFFIX
- : 'f'|'F'|'d'|'D'
- ;
+ : 'f'|'F'|'d'|'D'
+ ;
diff -Nru gluegen2-2.2.4/src/java/com/jogamp/common/ExceptionUtils.java gluegen2-2.3.2/src/java/com/jogamp/common/ExceptionUtils.java
--- gluegen2-2.2.4/src/java/com/jogamp/common/ExceptionUtils.java 1970-01-01 00:00:00.000000000 +0000
+++ gluegen2-2.3.2/src/java/com/jogamp/common/ExceptionUtils.java 2015-10-09 04:18:28.000000000 +0000
@@ -0,0 +1,154 @@
+/**
+ * Copyright 2014 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:
+ *
+ * 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
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * 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 java.io.PrintStream;
+
+/**
+ * @since 2.3.0
+ */
+public class ExceptionUtils {
+ public static void dumpStack(final PrintStream out) {
+ dumpStack(out, 1, -1);
+ }
+ public static void dumpStack(final PrintStream out, final int skip, final int depth) {
+ dumpStack(out, new Exception(""), skip+1, depth);
+ }
+ public static void dumpStack(final PrintStream out, final Throwable t, final int skip, final int depth) {
+ dumpStack(out, t.getStackTrace(), skip, depth);
+ }
+ public static void dumpStack(final PrintStream out, final StackTraceElement[] stack, final int skip, final int depth) {
+ if( null == stack ) {
+ return;
+ }
+ final int maxDepth;
+ if( 0 > depth ) {
+ maxDepth = stack.length;
+ } else {
+ maxDepth = Math.min(depth+skip, stack.length);
+ }
+ for(int i=skip; i
+ * Implementation will iterate through all {@link Throwable#getCause() causes}.
+ *
+ * @param additionalDescr additional text placed before the {@link Throwable} details.
+ * @param t the {@link Throwable} for output
+ */
+ public static void dumpThrowable(final String additionalDescr, final Throwable t) {
+ dumpThrowable(additionalDescr, t, -1, -1);
+ }
+ /**
+ * Dumps a {@link Throwable} to {@link System.err} in a decorating message including the current thread name,
+ * and its {@link #dumpStack(PrintStream, StackTraceElement[], int, int) stack trace}.
+ *
+ * Implementation will iterate through all {@link Throwable#getCause() causes}.
+ *
+ * @param additionalDescr additional text placed before the {@link Throwable} details.
+ * @param t the {@link Throwable} for output
+ * @param causeDepth the maximum depth for causes, or {@code -1} for all
+ * @param stackDepth the maximum depth for stack entries, or {@code -1} for all
+ * @since 2.3.2
+ */
+ public static void dumpThrowable(final String additionalDescr, final Throwable t, final int causeDepth, final int stackDepth) {
+ System.err.print("Caught "+additionalDescr+" ");
+ printStackTrace(System.err, t, causeDepth, stackDepth);
+ }
+}
diff -Nru gluegen2-2.2.4/src/java/com/jogamp/common/JogampRuntimeException.java gluegen2-2.3.2/src/java/com/jogamp/common/JogampRuntimeException.java
--- gluegen2-2.2.4/src/java/com/jogamp/common/JogampRuntimeException.java 2014-10-10 13:20:51.000000000 +0000
+++ gluegen2-2.3.2/src/java/com/jogamp/common/JogampRuntimeException.java 2015-10-09 04:18:28.000000000 +0000
@@ -28,9 +28,10 @@
package com.jogamp.common;
-/** A generic exception for Jogamp errors used throughout the binding
- as a substitute for {@link RuntimeException}. */
-
+/**
+ * A generic unchecked exception for Jogamp errors used throughout the binding
+ * as a substitute for {@link RuntimeException}.
+ */
@SuppressWarnings("serial")
public class JogampRuntimeException extends RuntimeException {
/** Constructs a JogampRuntimeException object. */
diff -Nru gluegen2-2.2.4/src/java/com/jogamp/common/jvm/JNILibLoaderBase.java gluegen2-2.3.2/src/java/com/jogamp/common/jvm/JNILibLoaderBase.java
--- gluegen2-2.2.4/src/java/com/jogamp/common/jvm/JNILibLoaderBase.java 2014-10-10 13:20:51.000000000 +0000
+++ gluegen2-2.3.2/src/java/com/jogamp/common/jvm/JNILibLoaderBase.java 2015-10-09 04:18:28.000000000 +0000
@@ -42,7 +42,6 @@
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
-import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.security.AccessController;
@@ -52,8 +51,8 @@
import java.util.Iterator;
import java.util.List;
+import com.jogamp.common.net.Uri;
import com.jogamp.common.os.NativeLibrary;
-import com.jogamp.common.util.IOUtil;
import com.jogamp.common.util.JarUtil;
import com.jogamp.common.util.PropertyAccess;
import com.jogamp.common.util.cache.TempJarCache;
@@ -62,7 +61,18 @@
import jogamp.common.os.PlatformPropsImpl;
public class JNILibLoaderBase {
- public static final boolean DEBUG = Debug.debug("JNILibLoader");
+ public static final boolean DEBUG;
+ protected static final boolean PERF;
+
+ static {
+ Debug.initSingleton();
+ DEBUG = Debug.debug("JNILibLoader");
+ PERF = DEBUG || PropertyAccess.isPropertyDefined("jogamp.debug.JNILibLoader.Perf", true);
+ }
+
+ private static final Object perfSync = new Object();
+ private static long perfTotal = 0;
+ private static long perfCount = 0;
public interface LoaderAction {
/**
@@ -155,7 +165,7 @@
/**
*
* @param classFromJavaJar
- * @param classJarURI
+ * @param classJarUri
* @param jarBasename jar basename w/ suffix
* @param nativeJarBasename native jar basename w/ suffix
* @return
@@ -163,69 +173,51 @@
* @throws SecurityException
* @throws URISyntaxException
*/
- private static final boolean addNativeJarLibsImpl(final Class> classFromJavaJar, final URI classJarURI,
- final String jarBasename, final String nativeJarBasename)
+ private static final boolean addNativeJarLibsImpl(final Class> classFromJavaJar, final Uri classJarUri,
+ final Uri.Encoded jarBasename, final Uri.Encoded nativeJarBasename)
throws IOException, SecurityException, URISyntaxException
{
if (DEBUG) {
final StringBuilder msg = new StringBuilder();
msg.append("JNILibLoaderBase: addNativeJarLibsImpl(").append(PlatformPropsImpl.NEWLINE);
msg.append(" classFromJavaJar = ").append(classFromJavaJar).append(PlatformPropsImpl.NEWLINE);
- msg.append(" classJarURI = ").append(classJarURI).append(PlatformPropsImpl.NEWLINE);
+ msg.append(" classJarURI = ").append(classJarUri).append(PlatformPropsImpl.NEWLINE);
msg.append(" jarBasename = ").append(jarBasename).append(PlatformPropsImpl.NEWLINE);
msg.append(" os.and.arch = ").append(PlatformPropsImpl.os_and_arch).append(PlatformPropsImpl.NEWLINE);
msg.append(" nativeJarBasename = ").append(nativeJarBasename).append(PlatformPropsImpl.NEWLINE);
msg.append(")");
System.err.println(msg.toString());
}
+ final long t0 = PERF ? System.currentTimeMillis() : 0; // 'Platform.currentTimeMillis()' not yet available!
boolean ok = false;
- final URI jarSubURI = JarUtil.getJarSubURI( classJarURI );
+ final Uri jarSubURI = classJarUri.getContainedUri();
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() );
+ final Uri jarSubUriRoot = jarSubURI.getDirectory();
if (DEBUG) {
- System.err.printf("JNILibLoaderBase: addNativeJarLibsImpl: initial: %s -> %s%n", jarSubURI, jarUriRoot_s);
+ System.err.printf("JNILibLoaderBase: addNativeJarLibsImpl: initial: %s -> %s%n", jarSubURI, jarSubUriRoot);
}
final String nativeLibraryPath = String.format("natives/%s/", PlatformPropsImpl.os_and_arch);
if (DEBUG) {
System.err.printf("JNILibLoaderBase: addNativeJarLibsImpl: nativeLibraryPath: %s%n", nativeLibraryPath);
}
- 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
- // and all native platform libraries under 'natives/os.and.arch'!
- final URI nativeJarURI = JarUtil.getJarFileURI(jarUriRoot_s+jarBasename);
- try {
- if( TempJarCache.addNativeLibs(classFromJavaJar, nativeJarURI, nativeLibraryPath) ) {
- ok = true;
- if (DEBUG) {
- System.err.printf("JNILibLoaderBase: addNativeJarLibsImpl: fat: %s -> %s%n", jarBasename, nativeJarURI);
- }
- }
- } catch(final Exception e) {
- if(DEBUG) {
- System.err.printf("JNILibLoaderBase: addNativeJarLibsImpl: Caught %s%n", e.getMessage());
- e.printStackTrace();
- }
- }
- }
- if (!ok) {
- // We assume one slim native jar file per 'os.and.arch'!
- final URI nativeJarURI = JarUtil.getJarFileURI(jarUriRoot_s+nativeJarBasename);
+ {
+ // Attempt-1 a 'one slim native jar file' per 'os.and.arch' layout
+ // with native platform libraries under 'natives/os.and.arch'!
+ final Uri nativeJarURI = JarUtil.getJarFileUri( jarSubUriRoot.getEncoded().concat(nativeJarBasename) );
if (DEBUG) {
System.err.printf("JNILibLoaderBase: addNativeJarLibsImpl: module: %s -> %s%n", nativeJarBasename, nativeJarURI);
}
try {
- ok = TempJarCache.addNativeLibs(classFromJavaJar, nativeJarURI, null /* nativeLibraryPath */);
+ ok = TempJarCache.addNativeLibs(classFromJavaJar, nativeJarURI, nativeLibraryPath);
} catch(final Exception e) {
if(DEBUG) {
System.err.printf("JNILibLoaderBase: addNativeJarLibsImpl: Caught %s%n", e.getMessage());
@@ -234,40 +226,75 @@
}
}
if (!ok) {
- // Attempt to find via ClassLoader and Native-Jar-Tag,
- // assuming one slim native jar file per 'os.and.arch'!
- final String moduleName;
+ final ClassLoader cl = classFromJavaJar.getClassLoader();
{
- final String packageName = classFromJavaJar.getPackage().getName();
- final int idx = packageName.lastIndexOf('.');
- if( 0 <= idx ) {
- moduleName = packageName.substring(idx+1);
- } else {
- moduleName = packageName;
+ // Attempt-2 a 'one big-fat jar file' layout, containing java classes
+ // and all native platform libraries under 'natives/os.and.arch' per platform!
+ final URL nativeLibraryURI = cl.getResource(nativeLibraryPath);
+ if (null != nativeLibraryURI) {
+ final Uri nativeJarURI = JarUtil.getJarFileUri( jarSubUriRoot.getEncoded().concat(jarBasename) );
+ try {
+ if( TempJarCache.addNativeLibs(classFromJavaJar, nativeJarURI, nativeLibraryPath) ) {
+ ok = true;
+ if (DEBUG) {
+ System.err.printf("JNILibLoaderBase: addNativeJarLibsImpl: fat: %s -> %s%n", jarBasename, nativeJarURI);
+ }
+ }
+ } catch(final Exception e) {
+ if(DEBUG) {
+ System.err.printf("JNILibLoaderBase: addNativeJarLibsImpl: Caught %s%n", e.getMessage());
+ e.printStackTrace();
+ }
+ }
}
}
- final String os_and_arch_dot = PlatformPropsImpl.os_and_arch.replace('-', '.');
- final String nativeJarTagClassName = nativeJarTagPackage + "." + moduleName + "." + os_and_arch_dot + ".TAG" ; // TODO: sync with gluegen-cpptasks-base.xml
- try {
- if(DEBUG) {
- System.err.printf("JNILibLoaderBase: addNativeJarLibsImpl: ClassLoader/TAG: Locating module %s, os.and.arch %s: %s%n",
- moduleName, os_and_arch_dot, nativeJarTagClassName);
- }
- final URI nativeJarTagClassJarURI = JarUtil.getJarURI(nativeJarTagClassName, cl);
- if (DEBUG) {
- System.err.printf("JNILibLoaderBase: addNativeJarLibsImpl: ClassLoader/TAG: %s -> %s%n", nativeJarTagClassName, nativeJarTagClassJarURI);
+ if (!ok) {
+ // Attempt-3 to find via ClassLoader and Native-Jar-Tag,
+ // assuming one slim native jar file per 'os.and.arch'
+ // and native platform libraries under 'natives/os.and.arch'!
+ final String moduleName;
+ {
+ final String packageName = classFromJavaJar.getPackage().getName();
+ final int idx = packageName.lastIndexOf('.');
+ if( 0 <= idx ) {
+ moduleName = packageName.substring(idx+1);
+ } else {
+ moduleName = packageName;
+ }
}
- ok = TempJarCache.addNativeLibs(classFromJavaJar, nativeJarTagClassJarURI, null /* nativeLibraryPath */);
- } catch (final Exception e ) {
- if(DEBUG) {
- System.err.printf("JNILibLoaderBase: addNativeJarLibsImpl: Caught %s%n", e.getMessage());
- e.printStackTrace();
+ final String os_and_arch_dot = PlatformPropsImpl.os_and_arch.replace('-', '.');
+ final String nativeJarTagClassName = nativeJarTagPackage + "." + moduleName + "." + os_and_arch_dot + ".TAG"; // TODO: sync with gluegen-cpptasks-base.xml
+ try {
+ if(DEBUG) {
+ System.err.printf("JNILibLoaderBase: addNativeJarLibsImpl: ClassLoader/TAG: Locating module %s, os.and.arch %s: %s%n",
+ moduleName, os_and_arch_dot, nativeJarTagClassName);
+ }
+ final Uri nativeJarTagClassJarURI = JarUtil.getJarUri(nativeJarTagClassName, cl);
+ if (DEBUG) {
+ System.err.printf("JNILibLoaderBase: addNativeJarLibsImpl: ClassLoader/TAG: %s -> %s%n", nativeJarTagClassName, nativeJarTagClassJarURI);
+ }
+ ok = TempJarCache.addNativeLibs(classFromJavaJar, nativeJarTagClassJarURI, nativeLibraryPath);
+ } catch (final Exception e ) {
+ if(DEBUG) {
+ System.err.printf("JNILibLoaderBase: addNativeJarLibsImpl: Caught %s%n", e.getMessage());
+ e.printStackTrace();
+ }
}
}
}
- if (DEBUG) {
- System.err.printf("JNILibLoaderBase: addNativeJarLibsImpl: ok: %b%n", ok);
+ if (DEBUG || PERF) {
+ final long tNow = System.currentTimeMillis() - t0;
+ final long tTotal, tCount;
+ synchronized(perfSync) {
+ tCount = perfCount+1;
+ tTotal = perfTotal + tNow;
+ perfTotal = tTotal;
+ perfCount = tCount;
+ }
+ final double tAvrg = tTotal / (double)tCount;
+ System.err.printf("JNILibLoaderBase: addNativeJarLibsImpl.X: %s / %s -> ok: %b; duration: now %d ms, total %d ms (count %d, avrg %.3f ms)%n",
+ jarBasename, nativeJarBasename, ok, tNow, tTotal, tCount, tAvrg);
}
return ok;
}
@@ -399,14 +426,14 @@
}
final ClassLoader cl = c.getClassLoader();
- final URI classJarURI = JarUtil.getJarURI(c.getName(), cl);
- final String jarName = JarUtil.getJarBasename(classJarURI);
+ final Uri classJarURI = JarUtil.getJarUri(c.getName(), cl);
+ final Uri.Encoded jarName = JarUtil.getJarBasename(classJarURI);
if (jarName == null) {
continue;
}
- final String jarBasename = jarName.substring(0, jarName.indexOf(".jar"));
+ final Uri.Encoded jarBasename = jarName.substring(0, jarName.indexOf(".jar"));
if(DEBUG) {
System.err.printf("JNILibLoaderBase: jarBasename: %s%n", jarBasename);
@@ -423,7 +450,8 @@
}
}
- final String nativeJarBasename = String.format("%s-natives-%s.jar", jarBasename, PlatformPropsImpl.os_and_arch);
+ final Uri.Encoded nativeJarBasename =
+ Uri.Encoded.cast( String.format("%s-natives-%s.jar", jarBasename.get(), PlatformPropsImpl.os_and_arch) );
ok = JNILibLoaderBase.addNativeJarLibsImpl(c, classJarURI, jarName, nativeJarBasename);
if (ok) {
@@ -585,7 +613,7 @@
if(DEBUG) {
System.err.println("ERROR (retry w/ enumLibPath) - "+ex1.getMessage());
}
- final List possiblePaths = NativeLibrary.enumerateLibraryPaths(libraryName, libraryName, libraryName, true, cl);
+ final List possiblePaths = NativeLibrary.enumerateLibraryPaths(libraryName, libraryName, libraryName, cl);
// Iterate down these and see which one if any we can actually find.
for (final Iterator iter = possiblePaths.iterator(); 0 == mode && iter.hasNext(); ) {
final String path = iter.next();
diff -Nru gluegen2-2.2.4/src/java/com/jogamp/common/net/AssetURLContext.java gluegen2-2.3.2/src/java/com/jogamp/common/net/AssetURLContext.java
--- gluegen2-2.2.4/src/java/com/jogamp/common/net/AssetURLContext.java 2014-10-10 13:20:51.000000000 +0000
+++ gluegen2-2.3.2/src/java/com/jogamp/common/net/AssetURLContext.java 2015-10-09 04:18:28.000000000 +0000
@@ -164,7 +164,7 @@
url = new URL(path);
conn = open(url);
type = null != conn ? 1 : -1;
- } catch(final MalformedURLException e1) { if(DEBUG) { System.err.println("ERR(0): "+e1.getMessage()); } }
+ } catch(final MalformedURLException e1) { if(DEBUG) { System.err.println("FAIL(1): "+e1.getMessage()); } }
if(null == conn && null != cl) {
// lookup via ClassLoader .. cleanup leading '/'
@@ -185,11 +185,11 @@
try {
final File file = new File(path);
if(file.exists()) {
- url = IOUtil.toURISimple(file).toURL();
+ url = Uri.valueOf(file).toURL();
conn = open(url);
type = null != conn ? 3 : -1;
}
- } catch (final Throwable e) { if(DEBUG) { System.err.println("ERR(1): "+e.getMessage()); } }
+ } catch (final Throwable e) { if(DEBUG) { System.err.println("FAIL(3): "+e.getMessage()); } }
}
if(DEBUG) {
@@ -209,7 +209,7 @@
final URLConnection c = url.openConnection();
c.connect(); // redundant
return c;
- } catch (final IOException ioe) { if(DEBUG) { System.err.println("ERR: "+ioe.getMessage()); } }
+ } catch (final IOException ioe) { if(DEBUG) { System.err.println("FAIL(2): "+ioe.getMessage()); } }
return null;
}
diff -Nru gluegen2-2.2.4/src/java/com/jogamp/common/net/Uri.java gluegen2-2.3.2/src/java/com/jogamp/common/net/Uri.java
--- gluegen2-2.2.4/src/java/com/jogamp/common/net/Uri.java 1970-01-01 00:00:00.000000000 +0000
+++ gluegen2-2.3.2/src/java/com/jogamp/common/net/Uri.java 2015-10-09 04:18:28.000000000 +0000
@@ -0,0 +1,2524 @@
+/**
+ * Copyright 2014 JogAmp Community. All rights reserved.
+ * Copyright 2006, 2010 The Apache Software Foundation.
+ *
+ * This code is derived from the Apache Harmony project's {@code class java.net.URI.Helper},
+ * and has been heavily modified for GlueGen/JogAmp.
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the LICENSE.txt file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jogamp.common.net;
+
+import java.io.File;
+import java.io.UnsupportedEncodingException;
+import java.net.MalformedURLException;
+import java.net.URISyntaxException;
+import java.util.StringTokenizer;
+import java.util.regex.Pattern;
+
+import jogamp.common.Debug;
+
+import com.jogamp.common.util.IOUtil;
+import com.jogamp.common.util.PropertyAccess;
+
+/**
+ * This class implements an immutable Uri as defined by RFC 2396.
+ *
+ * Character encoding is employed as defined by RFC 3986,
+ * see RFC 3986 section 2.1,
+ * while multibyte unicode characters are preserved in encoded parts.
+ *
+ * Other characters in a Uri must be percent encoded.
+ *
+ * @since 2.2.1
+ */
+public class Uri {
+ private static final boolean DEBUG;
+ private static final boolean DEBUG_SHOWFIX;
+
+ static {
+ Debug.initSingleton();
+ DEBUG = IOUtil.DEBUG || Debug.debug("Uri");
+ DEBUG_SHOWFIX = PropertyAccess.isPropertyDefined("jogamp.debug.Uri.ShowFix", true);
+ }
+
+ /**
+ * Usually used to fix a path from a previously contained and opaque Uri,
+ * i.e. {@link #getContainedUri()}.
+ *
+ * Such an opaque Uri w/ erroneous encoding may have been injected via
+ * {@link #valueOf(URI)} and {@link #valueOf(URL)} where the given URL or URI was opaque!
+ *
+ *
+ * This remedies issues when dealing w/ java URI/URL opaque sources,
+ * which do not comply to the spec, i.e. containe un-encoded chars, e.g. ':', '$', ..
+ *
+ */
+ private static final int PARSE_HINT_FIX_PATH = 1 << 0;
+
+ private static final String DIGITS = "0123456789ABCDEF";
+
+ private static final String ENCODING = "UTF8";
+ private static final String MSG_ENCODING_NA = "Charset UTF8 not available";
+ private static final Pattern patternSingleFS = Pattern.compile("/{1}");
+
+ /**
+ * RFC 3986 section 2.3 Unreserved Characters (January 2005)
+ *
+ */
+ public static final String SSP_LEGAL = QUERY_LEGAL;
+ // Harmony: unreserved + reserved
+
+ /**
+ * Valid charset for RFC 2396 {@code fragment},
+ * additional to legal {@code alphanum} characters.
+ *
+ * {@value} + {@code alphanum}
+ *
+ */
+ public static final String FRAG_LEGAL = UNRESERVED + RESERVED;
+ // Harmony: unreserved + reserved
+
+ /** {@value} */
+ public static final char SCHEME_SEPARATOR = ':';
+ /** {@value} */
+ public static final char QUERY_SEPARATOR = '?';
+ /** {@value} */
+ public static final char FRAGMENT_SEPARATOR = '#';
+ /** {@value} */
+ public static final String FILE_SCHEME = "file";
+ /** {@value} */
+ public static final String HTTP_SCHEME = "http";
+ /** {@value} */
+ public static final String HTTPS_SCHEME = "https";
+ /** {@value} */
+ public static final String JAR_SCHEME = "jar";
+ /** A JAR sub-protocol is separated from the JAR entry w/ this separator {@value}. Even if no class is specified '!/' must follow!. */
+ public static final char JAR_SCHEME_SEPARATOR = '!';
+
+ /**
+ * Immutable RFC3986 encoded string.
+ */
+ public static class Encoded implements Comparable, CharSequence {
+ private final String s;
+
+ /**
+ * Casts the given encoded String by creating a new Encoded instance.
+ *
+ * No encoding will be performed, use with care.
+ *
+ */
+ public static Encoded cast(final String encoded) {
+ return new Encoded(encoded);
+ }
+
+ Encoded(final String encodedString) {
+ this.s = encodedString;
+ }
+
+ /**
+ * Encodes all characters into their hexadecimal value prepended by '%', except:
+ *
+ *
letters ('a'..'z', 'A'..'Z')
+ *
numbers ('0'..'9')
+ *
characters in the legal-set parameter
+ *
others (unicode characters that are not in
+ * US-ASCII set, and are not ISO Control or are not ISO Space characters)
+ *
+ *
+ * Uses {@link Uri#encode(String, String)} for implementation..
+ *
+ *
+ * @param vanilla the string to be encoded
+ * @param legal extended character set, allowed to be preserved in the vanilla string
+ */
+ public Encoded(final String vanilla, final String legal) {
+ this.s = encode(vanilla, legal);
+ }
+
+ public boolean isASCII() { return false; }
+
+ /** Returns the encoded String */
+ public final String get() { return s; }
+
+ /**
+ * Decodes the string argument which is assumed to be encoded in the {@code
+ * x-www-form-urlencoded} MIME content type using the UTF-8 encoding scheme.
+ *
+ *'%' and two following hex digit characters are converted to the
+ * equivalent byte value. All other characters are passed through
+ * unmodified.
+ *
+ *
+ * e.g. "A%20B%20C %24%25" -> "A B C $%"
+ *
+ *
+ * Uses {@link Uri#decode(String)} for implementation..
+ *
+ * Returns the encoded String, same as {@link #get()}.
+ *
+ */
+ @Override
+ public final String toString() { return s; }
+
+ @Override
+ public final int hashCode() { return s.hashCode(); }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @param o The comparison argument, either a {@link Encoded} or a {@link String}
+ *
+ * @return {@code true} if the given object is equivalent to this instance,
+ * otherwise {@code false}.
+ *
+ * @see #compareTo(Encoded)
+ * @see #equalsIgnoreCase(Encoded)
+ */
+ @Override
+ public final boolean equals(final Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o instanceof Encoded) {
+ return s.equals(((Encoded)o).s);
+ }
+ return s.equals(o);
+ }
+
+ //
+ // CharSequence
+ //
+
+ @Override
+ public final int length() { return s.length(); }
+
+ @Override
+ public final char charAt(final int index) { return s.charAt(index); }
+
+ @Override
+ public final CharSequence subSequence(final int start, final int end) { return s.subSequence(start, end); }
+
+ @Override
+ public final int compareTo(final Encoded o) { return s.compareTo(o.s); }
+
+ //
+ // String derived ..
+ //
+ /** See {@link String#concat(String)}. */
+ public Encoded concat(final Encoded encoded) { return new Encoded(s.concat(encoded.s)); }
+
+ /** See {@link String#substring(int)}. */
+ public final Encoded substring(final int start) { return new Encoded(s.substring(start)); }
+ /** See {@link String#substring(int, int)}. */
+ public final Encoded substring(final int start, final int end) { return new Encoded(s.substring(start, end)); }
+
+ /** See {@link String#indexOf(int)}. */
+ public final int indexOf(final int ch) { return s.indexOf(ch); }
+ /** See {@link String#indexOf(int, int)}. */
+ public final int indexOf(final int ch, final int fromIndex) { return s.indexOf(ch, fromIndex); }
+ /** See {@link String#indexOf(String)}. */
+ public final int indexOf(final String str) { return s.indexOf(str); }
+ /** See {@link String#indexOf(String, int)}. */
+ public final int indexOf(final String str, final int fromIndex) { return s.indexOf(str, fromIndex); }
+
+ /** See {@link String#lastIndexOf(int)}. */
+ public final int lastIndexOf(final int ch) { return s.lastIndexOf(ch); }
+ /** See {@link String#lastIndexOf(int, int)}. */
+ public int lastIndexOf(final int ch, final int fromIndex) { return s.lastIndexOf(ch, fromIndex); }
+ /** See {@link String#lastIndexOf(String)}. */
+ public int lastIndexOf(final String str) { return s.lastIndexOf(str); }
+ /** See {@link String#lastIndexOf(String, int)}. */
+ public int lastIndexOf(final String str, final int fromIndex) { return s.lastIndexOf(str, fromIndex); }
+
+ /** See {@link String#startsWith(String)} */
+ public boolean startsWith(final String prefix) { return s.startsWith(prefix); }
+ /** See {@link String#startsWith(String, int)} */
+ public boolean startsWith(final String prefix, final int toffset) { return s.startsWith(prefix, toffset); }
+ /** See {@link String#endsWith(String)} */
+ public boolean endsWith(final String suffix) { return s.endsWith(suffix); }
+
+ /** See {@link String#equalsIgnoreCase(String)}. */
+ public final boolean equalsIgnoreCase(final Encoded anotherEncoded) { return s.equalsIgnoreCase(anotherEncoded.s); }
+ }
+
+ public static class ASCIIEncoded extends Encoded {
+ /**
+ * Casts the given encoded String by creating a new ASCIIEncoded instance.
+ *
+ * No encoding will be performed, use with care.
+ *
+ */
+ public static ASCIIEncoded cast(final String encoded) {
+ return new ASCIIEncoded(encoded, null);
+ }
+ private ASCIIEncoded(final String encoded, final Object unused) {
+ super(encoded);
+ }
+
+ /**
+ * Other characters, which are Unicode chars that are not US-ASCII, and are
+ * not ISO Control or are not ISO Space chars are not preserved
+ * and encoded into their hexidecimal value prepended by '%'.
+ *
+ * For example: Euro currency symbol -> "%E2%82%AC".
+ *
+ *
+ * Uses {@link Uri#encodeToASCIIString(String)} for implementation.
+ *
+ * @param unicode unencoded input
+ */
+ public ASCIIEncoded(final String unicode) {
+ super(encodeToASCIIString(unicode));
+ }
+ public boolean isASCII() { return true; }
+ }
+
+ private static void encodeChar2UTF8(final StringBuilder buf, final char ch) {
+ final byte[] bytes;
+ try {
+ bytes = new String(new char[] { ch }).getBytes(ENCODING);
+ } catch (final UnsupportedEncodingException e) {
+ throw new RuntimeException(MSG_ENCODING_NA, e);
+ }
+ // FIXME: UTF-8 produces more than one byte ? Optimization might be possible.
+ for (int j = 0; j < bytes.length; j++) {
+ final byte b = bytes[j];
+ buf.append('%');
+ buf.append(DIGITS.charAt( ( b & 0xf0 ) >> 4 ));
+ buf.append(DIGITS.charAt( b & 0xf ));
+ }
+ }
+
+ /**
+ * All characters are encoded into their hexadecimal value prepended by '%', except:
+ *
+ *
letters ('a'..'z', 'A'..'Z')
+ *
numbers ('0'..'9')
+ *
characters in the legal-set parameter
+ *
others (unicode characters that are not in
+ * US-ASCII set, and are not ISO Control or are not ISO Space characters)
+ *
+ *
+ * Use {@link #encodeToASCIIString(String)} for US-ASCII encoding.
+ *
+ *
+ * Consider using {@link Encoded#Encoded(String, String)} in APIs
+ * to distinguish encoded from unencoded data by type.
+ *
+ *
+ * @param vanilla the string to be encoded
+ * @param legal extended character set, allowed to be preserved in the vanilla string
+ * @return java.lang.String the converted string
+ */
+ public static String encode(final String vanilla, final String legal) {
+ if( null == vanilla ) {
+ return null;
+ }
+ final StringBuilder buf = new StringBuilder();
+ for (int i = 0; i < vanilla.length(); i++) {
+ final char ch = vanilla.charAt(i);
+ if ( (ch >= 'a' && ch <= 'z') ||
+ (ch >= 'A' && ch <= 'Z') ||
+ (ch >= '0' && ch <= '9') ||
+ legal.indexOf(ch) > -1 ||
+ ( ch > 127 && !Character.isSpaceChar(ch) && !Character.isISOControl(ch) )
+ ) {
+ buf.append(ch);
+ } else {
+ encodeChar2UTF8(buf, ch);
+ }
+ }
+ return buf.toString();
+ }
+
+ /**
+ * Other characters, which are Unicode chars that are not US-ASCII, and are
+ * not ISO Control or are not ISO Space chars are not preserved
+ * and encoded into their hexidecimal value prepended by '%'.
+ *
+ * For example: Euro currency symbol -> "%E2%82%AC".
+ *
+ *
+ * Consider using {@link ASCIIEncoded#ASCIIEncoded(String)} in APIs
+ * to distinguish encoded from unencoded data by type.
+ *
+ * @param unicode string to be converted
+ * @return java.lang.String the converted string
+ */
+ public static String encodeToASCIIString(final String unicode) {
+ final StringBuilder buf = new StringBuilder();
+ for (int i = 0; i < unicode.length(); i++) {
+ final char ch = unicode.charAt(i);
+ if (ch <= 127) {
+ buf.append(ch);
+ } else {
+ encodeChar2UTF8(buf, ch);
+ }
+ }
+ return buf.toString();
+ }
+
+ /**
+ * Safe {@link Encoded#decode()} call on optional {@code encoded} instance.
+ * @param encoded {@link Encoded} instance to be decoded, may be {@code null}.
+ * @return the {@link Encoded#decode() decoded} String or {@code null} if {@code encoded} was {@code null}.
+ */
+ public static String decode(final Encoded encoded) {
+ return null != encoded ? encoded.decode() : null;
+ }
+
+ /**
+ * Decodes the string argument which is assumed to be encoded in the {@code
+ * x-www-form-urlencoded} MIME content type using the UTF-8 encoding scheme.
+ *
+ *'%' and two following hex digit characters are converted to the
+ * equivalent byte value. All other characters are passed through
+ * unmodified.
+ *
+ *
+ * e.g. "A%20B%20C %24%25" -> "A B C $%"
+ *
+ *
+ * @param encoded The encoded string.
+ * @return java.lang.String The decoded version.
+ */
+ public static String decode(final String encoded) {
+ if( null == encoded ) {
+ return null;
+ }
+ final StringBuilder result = new StringBuilder();
+ final byte[] buf = new byte[32];
+ int bufI = 0;
+ for (int i = 0; i < encoded.length();) {
+ final char c = encoded.charAt(i);
+ if (c == '%') {
+ bufI = 0;
+ do {
+ if (i + 2 >= encoded.length()) {
+ throw new IllegalArgumentException("missing '%' hex-digits at index "+i);
+ }
+ final int d1 = Character.digit(encoded.charAt(i + 1), 16);
+ final int d2 = Character.digit(encoded.charAt(i + 2), 16);
+ if (d1 == -1 || d2 == -1) {
+ throw new IllegalArgumentException("invalid hex-digits at index "+i+": "+encoded.substring(i, i + 3));
+ }
+ buf[bufI++] = (byte) ((d1 << 4) + d2);
+ if( 32 == bufI ) {
+ appendUTF8(result, buf, bufI);
+ bufI = 0;
+ }
+ i += 3;
+ } while (i < encoded.length() && encoded.charAt(i) == '%');
+ if( 0 < bufI ) {
+ appendUTF8(result, buf, bufI);
+ }
+ } else {
+ result.append(c);
+ i++;
+ }
+ }
+ return result.toString();
+ }
+ private static void appendUTF8(final StringBuilder sb, final byte[] buf, final int count) {
+ try {
+ sb.append(new String(buf, 0, count, ENCODING));
+ } catch (final UnsupportedEncodingException e) {
+ throw new RuntimeException(MSG_ENCODING_NA, e);
+ }
+ }
+
+ /**
+ * Creates a new Uri instance using the given unencoded arguments.
+ *
+ * This constructor first creates a temporary Uri string from the given unencoded components. This
+ * string will be parsed later on to create the Uri instance.
+ *
+ * {@code host} and {@code port} may be undefined or invalid within {@code scheme-specific-part}.
+ *
+ *
+ * @param scheme the unencoded scheme part of the Uri.
+ * @param ssp the unencoded scheme-specific-part of the Uri.
+ * @param fragment the unencoded fragment part of the Uri.
+ * @throws URISyntaxException
+ * if the temporary created string doesn't fit to the
+ * specification RFC2396 or could not be parsed correctly.
+ */
+ public static Uri create(final String scheme, final String ssp, final String fragment) throws URISyntaxException {
+ if ( emptyString(scheme) && emptyString(ssp) && emptyString(fragment) ) {
+ throw new URISyntaxException("", "all empty parts");
+ }
+ final StringBuilder uri = new StringBuilder();
+ if ( !emptyString(scheme) ) {
+ uri.append(scheme);
+ uri.append(SCHEME_SEPARATOR);
+ }
+ if ( !emptyString(ssp) ) {
+ // QUOTE ILLEGAL CHARACTERS
+ uri.append(encode(ssp, SSP_LEGAL));
+ }
+ if ( !emptyString(fragment) ) {
+ uri.append(FRAGMENT_SEPARATOR);
+ // QUOTE ILLEGAL CHARACTERS
+ uri.append(encode(fragment, FRAG_LEGAL));
+ }
+ return new Uri(new Encoded(uri.toString()), false, 0);
+ }
+
+ /**
+ * Creates a new Uri instance using the given encoded arguments.
+ *
+ * This constructor first creates a temporary Uri string from the given encoded components. This
+ * string will be parsed later on to create the Uri instance.
+ *
+ *
+ * The given encoded components are taken as-is, i.e. no re-encoding will be performed!
+ * However, Uri parsing will re-evaluate encoding of the resulting components.
+ *
+ * {@code host} and {@code port} may be undefined or invalid within {@code scheme-specific-part}.
+ *
+ *
+ * @param scheme the encoded scheme part of the Uri.
+ * @param ssp the encoded scheme-specific-part of the Uri.
+ * @param fragment the encoded fragment part of the Uri.
+ * @throws URISyntaxException
+ * if the temporary created string doesn't fit to the
+ * specification RFC2396 or could not be parsed correctly.
+ */
+ public static Uri create(final Encoded scheme, final Encoded ssp, final Encoded fragment) throws URISyntaxException {
+ if ( emptyString(scheme) && emptyString(ssp) && emptyString(fragment) ) {
+ throw new URISyntaxException("", "all empty parts");
+ }
+ final StringBuilder uri = new StringBuilder();
+ if ( !emptyString(scheme) ) {
+ uri.append(scheme);
+ uri.append(SCHEME_SEPARATOR);
+ }
+ if ( !emptyString(ssp) ) {
+ uri.append(ssp.get());
+ }
+ if ( !emptyString(fragment) ) {
+ uri.append(FRAGMENT_SEPARATOR);
+ uri.append(fragment.get());
+ }
+ return new Uri(new Encoded(uri.toString()), false, 0);
+ }
+
+ /**
+ * Creates a new Uri instance using the given unencoded arguments.
+ *
+ * This constructor first creates a temporary Uri string from the given unencoded components. This
+ * string will be parsed later on to create the Uri instance.
+ *
+ * {@code host} and {@code port} must be defined and valid, if any {@code authority} components are defined,
+ * i.e. {@code user-info}, {@code host} or {@code port}.
+ *
+ *
+ * @param scheme the unencoded scheme part of the Uri.
+ * @param userinfo the unencoded user information of the Uri for authentication and authorization, {@code null} for undefined.
+ * @param host the unencoded host name of the Uri, {@code null} for undefined.
+ * @param port the port number of the Uri, -1 for undefined.
+ * @param path the unencoded path to the resource on the host.
+ * @param query the unencoded query part of the Uri to specify parameters for the resource.
+ * @param fragment the unencoded fragment part of the Uri.
+ * @throws URISyntaxException
+ * if the temporary created string doesn't fit to the
+ * specification RFC2396 or could not be parsed correctly.
+ */
+ public static Uri create (final String scheme, final String userinfo, String host, final int port,
+ final String path, final String query, final String fragment) throws URISyntaxException {
+ if ( emptyString(scheme) && emptyString(userinfo) && emptyString(host) && emptyString(path) &&
+ emptyString(query) && emptyString(fragment) ) {
+ throw new URISyntaxException("", "all empty parts");
+ }
+
+ if ( !emptyString(scheme) && !emptyString(path) && path.length() > 0 && path.charAt(0) != '/') {
+ throw new URISyntaxException(path, "path doesn't start with '/'");
+ }
+
+ final StringBuilder uri = new StringBuilder();
+ if ( !emptyString(scheme) ) {
+ uri.append(scheme);
+ uri.append(SCHEME_SEPARATOR);
+ }
+
+ if ( !emptyString(userinfo) || !emptyString(host) || port != -1) {
+ uri.append("//");
+ }
+
+ if ( !emptyString(userinfo) ) {
+ // QUOTE ILLEGAL CHARACTERS in userinfo
+ uri.append(encode(userinfo, USERINFO_LEGAL));
+ uri.append('@');
+ }
+
+ if ( !emptyString(host) ) {
+ // check for ipv6 addresses that hasn't been enclosed
+ // in square brackets
+ if (host.indexOf(SCHEME_SEPARATOR) != -1 && host.indexOf(']') == -1
+ && host.indexOf('[') == -1) {
+ host = "[" + host + "]";
+ }
+ uri.append(host);
+ }
+
+ if ( port != -1 ) {
+ uri.append(SCHEME_SEPARATOR);
+ uri.append(port);
+ }
+
+ if ( !emptyString(path) ) {
+ // QUOTE ILLEGAL CHARS
+ uri.append(encode(path, PATH_LEGAL));
+ }
+
+ if ( !emptyString(query) ) {
+ uri.append(QUERY_SEPARATOR);
+ // QUOTE ILLEGAL CHARS
+ uri.append(encode(query, QUERY_LEGAL));
+ }
+
+ if ( !emptyString(fragment) ) {
+ // QUOTE ILLEGAL CHARS
+ uri.append(FRAGMENT_SEPARATOR);
+ uri.append(encode(fragment, FRAG_LEGAL));
+ }
+ return new Uri(new Encoded(uri.toString()), true, 0);
+ }
+
+ /**
+ * Creates a new Uri instance using the given encoded arguments.
+ *
+ * This constructor first creates a temporary Uri string from the given encoded components. This
+ * string will be parsed later on to create the Uri instance.
+ *
+ *
+ * The given encoded components are taken as-is, i.e. no re-encoding will be performed!
+ * However, Uri parsing will re-evaluate encoding of the resulting components.
+ *
+ * {@code host} and {@code port} must be defined and valid, if any {@code authority} components are defined,
+ * i.e. {@code user-info}, {@code host} or {@code port}.
+ *
+ *
+ * @param scheme the encoded scheme part of the Uri.
+ * @param userinfo the encoded user information of the Uri for authentication and authorization, {@code null} for undefined.
+ * @param host the encoded host name of the Uri, {@code null} for undefined.
+ * @param port the port number of the Uri, -1 for undefined.
+ * @param path the encoded path to the resource on the host.
+ * @param query the encoded query part of the Uri to specify parameters for the resource.
+ * @param fragment the encoded fragment part of the Uri.
+ * @throws URISyntaxException
+ * if the temporary created string doesn't fit to the
+ * specification RFC2396 or could not be parsed correctly.
+ */
+ public static Uri create (final Encoded scheme, final Encoded userinfo, final Encoded host, final int port,
+ final Encoded path, final Encoded query, final Encoded fragment) throws URISyntaxException {
+ if ( emptyString(scheme) && emptyString(userinfo) && emptyString(host) && emptyString(path) &&
+ emptyString(query) && emptyString(fragment) ) {
+ throw new URISyntaxException("", "all empty parts");
+ }
+
+ if ( !emptyString(scheme) && !emptyString(path) && path.length() > 0 && path.charAt(0) != '/') {
+ throw new URISyntaxException(path.get(), "path doesn't start with '/'");
+ }
+
+ final StringBuilder uri = new StringBuilder();
+ if ( !emptyString(scheme) ) {
+ uri.append(scheme);
+ uri.append(SCHEME_SEPARATOR);
+ }
+
+ if ( !emptyString(userinfo) || !emptyString(host) || port != -1) {
+ uri.append("//");
+ }
+
+ if ( !emptyString(userinfo) ) {
+ uri.append(userinfo.get());
+ uri.append('@');
+ }
+
+ if ( !emptyString(host) ) {
+ uri.append(host.get());
+ }
+
+ if ( port != -1 ) {
+ uri.append(SCHEME_SEPARATOR);
+ uri.append(port);
+ }
+
+ if ( !emptyString(path) ) {
+ uri.append(path.get());
+ }
+
+ if ( !emptyString(query) ) {
+ uri.append(QUERY_SEPARATOR);
+ uri.append(query.get());
+ }
+
+ if ( !emptyString(fragment) ) {
+ uri.append(FRAGMENT_SEPARATOR);
+ uri.append(fragment.get());
+ }
+ return new Uri(new Encoded(uri.toString()), true, 0);
+ }
+
+ /**
+ * Creates a new Uri instance using the given unencoded arguments.
+ *
+ * This constructor first creates a temporary Uri string from the given unencoded components. This
+ * string will be parsed later on to create the Uri instance.
+ *
+ *
+ * {@code [scheme:]host[path][#fragment]}
+ *
+ *
+ * {@code host} must be valid, if defined.
+ *
+ *
+ * @param scheme the unencoded scheme part of the Uri.
+ * @param host the unencoded host name of the Uri.
+ * @param path the unencoded path to the resource on the host.
+ * @param fragment the unencoded fragment part of the Uri.
+ * @throws URISyntaxException
+ * if the temporary created string doesn't fit to the
+ * specification RFC2396 or could not be parsed correctly.
+ */
+ public static Uri create(final String scheme, final String host, final String path, final String fragment) throws URISyntaxException {
+ return create(scheme, null, host, -1, path, null, fragment);
+ }
+
+ /**
+ * Creates a new Uri instance using the given encoded arguments.
+ *
+ * This constructor first creates a temporary Uri string from the given encoded components. This
+ * string will be parsed later on to create the Uri instance.
+ *
+ *
+ * The given encoded components are taken as-is, i.e. no re-encoding will be performed!
+ * However, Uri parsing will re-evaluate encoding of the resulting components.
+ *
+ *
+ * {@code [scheme:]host[path][#fragment]}
+ *
+ *
+ * {@code host} must be valid, if defined.
+ *
+ *
+ * @param scheme the encoded scheme part of the Uri.
+ * @param host the encoded host name of the Uri.
+ * @param path the encoded path to the resource on the host.
+ * @param fragment the encoded fragment part of the Uri.
+ * @throws URISyntaxException
+ * if the temporary created string doesn't fit to the
+ * specification RFC2396 or could not be parsed correctly.
+ */
+ public static Uri create(final Encoded scheme, final Encoded host, final Encoded path, final Encoded fragment) throws URISyntaxException {
+ return create(scheme, null, host, -1, path, null, fragment);
+ }
+
+ /**
+ * Creates a new Uri instance using the given unencoded arguments.
+ *
+ * This constructor first creates a temporary Uri string from the given unencoded components. This
+ * string will be parsed later on to create the Uri instance.
+ *
+ * {@code host} and {@code port} may be undefined or invalid, in the optional {@code authority}.
+ *
+ *
+ * @param scheme the unencoded scheme part of the Uri.
+ * @param authority the unencoded authority part of the Uri.
+ * @param path the unencoded path to the resource on the host.
+ * @param query the unencoded query part of the Uri to specify parameters for the resource.
+ * @param fragment the unencoded fragment part of the Uri.
+ *
+ * @throws URISyntaxException
+ * if the temporary created string doesn't fit to the
+ * specification RFC2396 or could not be parsed correctly.
+ */
+ public static Uri create(final String scheme, final String authority, final String path, final String query, final String fragment) throws URISyntaxException {
+ if ( emptyString(scheme) && emptyString(authority) && emptyString(path) &&
+ emptyString(query) && emptyString(fragment) ) {
+ throw new URISyntaxException("", "all empty parts");
+ }
+ if ( !emptyString(scheme) && !emptyString(path) && path.length() > 0 && path.charAt(0) != '/') {
+ throw new URISyntaxException(path, "path doesn't start with '/'");
+ }
+
+ final StringBuilder uri = new StringBuilder();
+ if ( !emptyString(scheme) ) {
+ uri.append(scheme);
+ uri.append(SCHEME_SEPARATOR);
+ }
+ if ( !emptyString(authority) ) {
+ uri.append("//");
+ // QUOTE ILLEGAL CHARS
+ uri.append(encode(authority, AUTHORITY_LEGAL));
+ }
+
+ if ( !emptyString(path) ) {
+ // QUOTE ILLEGAL CHARS
+ uri.append(encode(path, PATH_LEGAL));
+ }
+ if ( !emptyString(query) ) {
+ // QUOTE ILLEGAL CHARS
+ uri.append(QUERY_SEPARATOR);
+ uri.append(encode(query, QUERY_LEGAL));
+ }
+ if ( !emptyString(fragment) ) {
+ // QUOTE ILLEGAL CHARS
+ uri.append(FRAGMENT_SEPARATOR);
+ uri.append(encode(fragment, FRAG_LEGAL));
+ }
+ return new Uri(new Encoded(uri.toString()), false, 0);
+ }
+
+ /**
+ * Creates a new Uri instance using the given encoded arguments.
+ *
+ * This constructor first creates a temporary Uri string from the given encoded encoded components. This
+ * string will be parsed later on to create the Uri instance.
+ *
+ *
+ * The given encoded components are taken as-is, i.e. no re-encoding will be performed!
+ * However, Uri parsing will re-evaluate encoding of the resulting components.
+ *
+ * {@code host} and {@code port} may be undefined or invalid, in the optional {@code authority}.
+ *
+ *
+ * @param scheme the encoded scheme part of the Uri.
+ * @param authority the encoded authority part of the Uri.
+ * @param path the encoded path to the resource on the host.
+ * @param query the encoded query part of the Uri to specify parameters for the resource.
+ * @param fragment the encoded fragment part of the Uri.
+ *
+ * @throws URISyntaxException
+ * if the temporary created string doesn't fit to the
+ * specification RFC2396 or could not be parsed correctly.
+ */
+ public static Uri create(final Encoded scheme, final Encoded authority, final Encoded path, final Encoded query, final Encoded fragment) throws URISyntaxException {
+ if ( emptyString(scheme) && emptyString(authority) && emptyString(path) &&
+ emptyString(query) && emptyString(fragment) ) {
+ throw new URISyntaxException("", "all empty parts");
+ }
+ if ( !emptyString(scheme) && !emptyString(path) && path.length() > 0 && path.charAt(0) != '/') {
+ throw new URISyntaxException(path.get(), "path doesn't start with '/'");
+ }
+
+ final StringBuilder uri = new StringBuilder();
+ if ( !emptyString(scheme) ) {
+ uri.append(scheme);
+ uri.append(SCHEME_SEPARATOR);
+ }
+ if ( !emptyString(authority) ) {
+ uri.append("//");
+ uri.append(authority.get());
+ }
+
+ if ( !emptyString(path) ) {
+ uri.append(path.get());
+ }
+ if ( !emptyString(query) ) {
+ uri.append(QUERY_SEPARATOR);
+ uri.append(query.get());
+ }
+ if ( !emptyString(fragment) ) {
+ uri.append(FRAGMENT_SEPARATOR);
+ uri.append(fragment.get());
+ }
+ return new Uri(new Encoded(uri.toString()), false, 0);
+ }
+
+ /**
+ * Casts the given encoded String to a {@link Encoded#cast(String) new Encoded instance}
+ * used to create the resulting Uri instance via {@link #Uri(Encoded)}.
+ *
+ * No encoding will be performed on the given {@code encodedUri}, use with care.
+ *
+ * @throws URISyntaxException
+ */
+ public static Uri cast(final String encodedUri) throws URISyntaxException {
+ return new Uri(Encoded.cast(encodedUri));
+ }
+
+ /**
+ * Creates a new Uri instance using the given file-path argument.
+ *
+ * This constructor first creates a temporary Uri string from the given components. This
+ * string will be parsed later on to create the Uri instance.
+ *
+ *
+ * {@code file:path}
+ *
+ *
+ * @param path the unencoded path of the {@code file} {@code schema}.
+ * @throws URISyntaxException
+ * if the temporary created string doesn't fit to the
+ * specification RFC2396 or could not be parsed correctly.
+ */
+ public static Uri valueOfFilepath(final String path) throws URISyntaxException {
+ if ( emptyString(path) ) {
+ throw new URISyntaxException("", "empty path");
+ }
+ if ( path.charAt(0) != '/' ) {
+ throw new URISyntaxException(path, "path doesn't start with '/'");
+ }
+
+ final StringBuilder uri = new StringBuilder();
+ uri.append(FILE_SCHEME);
+ uri.append(SCHEME_SEPARATOR);
+
+ // QUOTE ILLEGAL CHARS
+ uri.append(encode(path, PATH_LEGAL));
+
+ return new Uri(new Encoded(uri.toString()), false, 0);
+ }
+
+ /**
+ * Creates a new Uri instance using the given File instance.
+ *
+ * This constructor first creates a temporary Uri string from the given components. This
+ * string will be parsed later on to create the Uri instance.
+ *
+ *
+ * {@code file:path}
+ *
+ *
+ * @param file using {@link IOUtil#slashify(String, boolean, boolean) slashified} {@link File#getAbsolutePath() absolute-path}
+ * for the path of the {@code file} {@code schema}, utilizing {@link #valueOfFilepath(String)}.
+ * @throws URISyntaxException
+ * if the temporary created string doesn't fit to the
+ * specification RFC2396 or could not be parsed correctly.
+ */
+ public static Uri valueOf(final File file) throws URISyntaxException {
+ return Uri.valueOfFilepath(IOUtil.slashify(file.getAbsolutePath(), true, file.isDirectory()));
+ }
+
+ /**
+ * Creates a new Uri instance using the given URI instance.
+ *
+ * Re-encoding will be performed if the given URI is {@link URI#isOpaque() not opaque}.
+ *
+ *
+ * See {@link #PARSE_HINT_FIX_PATH} for issues of injecting opaque URLs.
+ *
+ *
+ * @param uri A given URI instance
+ * @throws URISyntaxException
+ * if the temporary created string doesn't fit to the
+ * specification RFC2396 or could not be parsed correctly.
+ */
+ public static Uri valueOf(final java.net.URI uri) throws URISyntaxException {
+ if( uri.isOpaque()) {
+ // opaque, without host validation.
+ // Note: This may induce encoding errors of authority and path, see {@link #PARSE_HINT_FIX_PATH}
+ return new Uri(new Encoded( uri.toString() ), false, 0);
+ } else {
+ // with host validation if authority is defined
+ return Uri.create(uri.getScheme(), uri.getUserInfo(), uri.getHost(), uri.getPort(),
+ uri.getPath(), uri.getQuery(), uri.getFragment());
+ }
+ }
+
+ /**
+ * Creates a new Uri instance using the given URL instance,
+ * convenient wrapper for {@link #valueOf(URI)} and {@link URL#toURI()}.
+ *
+ * Re-encoding will be performed if the given URL is {@link URI#isOpaque() not opaque}, see {@link #valueOf(URI)}.
+ *
+ *
+ * See {@link #PARSE_HINT_FIX_PATH} for issues of injecting opaque URLs.
+ *
+ *
+ * @param url A given URL instance
+ *
+ * @throws URISyntaxException
+ * if the temporary created string doesn't fit to the
+ * specification RFC2396 or could not be parsed correctly.
+ */
+ public static Uri valueOf(final java.net.URL url) throws URISyntaxException {
+ return valueOf(url.toURI());
+ }
+
+ //
+ // All string fields are encoded!
+ //
+
+ /** Encoded input string used at construction, never {@code null}. */
+ public final Encoded input;
+
+ private final Object lazyLock = new Object();
+
+ /** Encoded input string used at construction, in US-ASCII encoding. */
+ private ASCIIEncoded inputASCII;
+
+ private int hash;
+
+ /** Encoded {@code scheme}, {@code null} if undefined. */
+ public final Encoded scheme;
+
+ /** Encoded {@code scheme-specific-part}, never {@code null}. */
+ public final Encoded schemeSpecificPart;
+ /** Encoded {@code path} part of {@code scheme-specific-part}, never {@code null}. */
+ public final Encoded path;
+
+ /** Indicating whether {@code authority} part is defined or not. */
+ public final boolean hasAuthority;
+ /** Encoded {@code authority} part of {@code scheme-specific-part}, {@code null} if undefined. */
+ public final Encoded authority;
+ /** Encoded {@code userinfo} part of {@code authority} and {@code scheme-specific-part}, {@code null} if undefined. */
+ public final Encoded userInfo; // part of authority
+ /** Encoded {@code host} part of {@code authority} and {@code scheme-specific-part}, {@code null} if undefined. */
+ public final Encoded host; // part of authority
+ /** Encoded {@code port} part of {@code authority} and {@code scheme-specific-part}, {@code -1} if undefined. */
+ public final int port; // part of authority
+
+ /** Encoded {@code query} part of {@code scheme-specific-part}, {@code null} if undefined. */
+ public final Encoded query;
+
+ /** Encoded {@code fragment}, {@code null} if undefined. */
+ public final Encoded fragment;
+
+ /** Indicating whether this Uri is absolute, i.e. has a {@code scheme} and hence an absolute {@code scheme-specific-part}. */
+ public final boolean absolute;
+
+ /**
+ * Indicating whether this Uri is opaque, i.e. non-hierarchical {@code scheme-specific-part}.
+ *
+ * An opaque Uri has no {@code scheme-specific-part} being parsed,
+ * i.e. {@code path}, {@code query} and {@code authority} are {@code null}.
+ *
+ */
+ public final boolean opaque;
+
+ /**
+ * Creates a new Uri instance according to the given encoded string {@code uri}.
+ *
+ * @param uri the RFC3986 encoded RFC2396 Uri representation to be parsed into a Uri object
+ * @throws URISyntaxException
+ * if the given string {@code uri} doesn't fit to the
+ * specification RFC2396 and RFC3986 or could not be parsed correctly.
+ */
+ public Uri(final Encoded uri) throws URISyntaxException {
+ this(uri, false, 0);
+ }
+
+ /** Returns true, if this instance is a {@code file} {@code scheme}, otherwise false. */
+ public final boolean isFileScheme() {
+ return null != scheme && FILE_SCHEME.equals( scheme.get() );
+ }
+
+ /**
+ * Returns true, if this instance is a {@code jar} {@code scheme}, otherwise false.
+ * @since 2.3.2
+ */
+ public final boolean isJarScheme() {
+ return null != scheme && JAR_SCHEME.equals( scheme.get() );
+ }
+
+ /**
+ * Returns the encoded {@link #input}, never {@code null}.
+ */
+ public final Encoded getEncoded() {
+ return input;
+ }
+
+ /**
+ * Returns the encoded {@link #input} as String, never {@code null}, same as {@link #getEncoded()}.
+ */
+ @Override
+ public final String toString() {
+ return input.get();
+ }
+
+ /**
+ * Returns the encoded {@link #input} encoded in US-ASCII.
+ */
+ public ASCIIEncoded toASCIIString() {
+ synchronized( lazyLock ) {
+ if( null == inputASCII ) {
+ inputASCII = new ASCIIEncoded(input.get());
+ }
+ return inputASCII;
+ }
+ }
+
+ /**
+ * Returns a new {@link URI} instance using the encoded {@link #input} string, {@code new URI(uri.input)},
+ * i.e. no re-encoding will be performed.
+ * @see #toURIReencoded(boolean)
+ * @see #valueOf(URI)
+ */
+ public final java.net.URI toURI() {
+ try {
+ return new java.net.URI(input.get());
+ } catch (final URISyntaxException e) {
+ throw new Error(e); // Can't happen
+ }
+ }
+
+ /**
+ * Returns a new {@link URI} instance based upon this instance.
+ *
+ * All Uri parts of this instance will be decoded
+ * and encoded by the URI constructor, i.e. re-encoding will be performed.
+ *
+ *
+ * @throws URISyntaxException
+ * if the given string {@code uri} doesn't fit to the
+ * specification RFC2396 or could not be parsed correctly.
+ * @see #toURI()
+ * @see #valueOf(URI)
+ */
+ public final java.net.URI toURIReencoded() throws URISyntaxException {
+ final java.net.URI recomposedURI;
+ if( opaque ) {
+ // opaque, without host validation
+ recomposedURI = new java.net.URI(decode(scheme), decode(schemeSpecificPart), decode(fragment));
+ } else if( null != host ) {
+ // with host validation
+ recomposedURI = new java.net.URI(decode(scheme), decode(userInfo), decode(host), port,
+ decode(path), decode(query), decode(fragment));
+ } else {
+ // without host validation
+ recomposedURI = new java.net.URI(decode(scheme), decode(authority),
+ decode(path), decode(query), decode(fragment));
+ }
+ return recomposedURI;
+ }
+
+
+ /**
+ * Returns a new {@link URL} instance using the encoded {@link #input} string, {@code new URL(uri.input)},
+ * i.e. no re-encoding will be performed.
+ * @throws MalformedURLException
+ * if an error occurs while creating the URL or no protocol
+ * handler could be found.
+ */
+ public final java.net.URL toURL() throws MalformedURLException {
+ if (!absolute) {
+ throw new IllegalArgumentException("Cannot convert relative Uri: "+input);
+ }
+ return new java.net.URL(input.get());
+ }
+
+ /**
+ * If this instance {@link #isFileScheme() is a file scheme},
+ * implementation decodes [ "//"+{@link #authority} ] + {@link #path},
+ * then it processes the result if {@link File#separatorChar} == '\\'
+ * as follows:
+ *
+ *
slash -> backslash
+ *
drop a starting single backslash, preserving windows UNC
+ *
+ * and returns the resulting new {@link File} instance.
+ *
+ *
+ * @throws URISyntaxException if the new string {@code uri} doesn't fit to the
+ * specification RFC2396 and RFC3986 or could not be parsed correctly.
+ */
+ public Uri getDirectory() {
+ try {
+ final Uri res = cutoffLastPathSegementImpl(true, false, null);
+ return null != res ? res : this;
+ } catch (final URISyntaxException e) {
+ if( DEBUG ) {
+ System.err.println("Caught "+e.getClass().getSimpleName()+": "+e.getMessage());
+ e.printStackTrace();
+ }
+ return this;
+ }
+ }
+
+ /**
+ * Returns this Uri's parent directory Uri..
+ *
+ * This Uri path will be {@link IOUtil#cleanPathString(String) normalized} before traversing up one directory.
+ *
+ *
+ * If a parent folder cannot be found, method returns {@code null}.
+ *
+ *
+ *
+ * Example-1:
+ * This instance : jar:http://some/path/gluegen-rt.jar!/com/Test.class?arg=1#frag
+ * Returned Uri #1: jar:http://some/path/gluegen-rt.jar!/com/?arg=1#frag
+ * Returned Uri #2: jar:http://some/path/gluegen-rt.jar!/?arg=1#frag
+ * Returned Uri #3: null
+ *
+ * Example-2:
+ * This instance : http://some/path/gluegen-rt.jar?arg=1#frag
+ * Returned Uri #1: http://some/path/?arg=1#frag
+ * Returned Uri #2: http://some/?arg=1#frag
+ * Returned Uri #2: null
+ *
+ * Example-3:
+ * This instance : http://some/path/../gluegen-rt.jar?arg=1#frag
+ * Returned Uri #1: http://some/?arg=1#frag
+ * Returned Uri #2: null
+ *
+ *
+ */
+ public final Uri getParent() {
+ try {
+ return cutoffLastPathSegementImpl(true, true, null);
+ } catch (final URISyntaxException e) {
+ if( DEBUG ) {
+ System.err.println("Caught "+e.getClass().getSimpleName()+": "+e.getMessage());
+ e.printStackTrace();
+ }
+ return null;
+ }
+ }
+
+ /**
+ * Returns a new Uri appending the given {@code appendPath}
+ * to this instance's {@link #getDirectory() directory}.
+ *
+ * If {@code appendPath} is empty, method behaves like {@link #getNormalized()}.
+ *
+ *
+ * This resulting path will be {@link IOUtil#cleanPathString(String) normalized}.
+ *
+ *
+ *
+ * @param appendPath denotes a relative path to be appended to this Uri's directory
+ * @throws URISyntaxException
+ * if the resulting {@code uri} doesn't fit to the
+ * specification RFC2396 and RFC3986 or could not be parsed correctly.
+ */
+ public Uri getRelativeOf(final Encoded appendPath) throws URISyntaxException {
+ if( emptyString(appendPath) ) {
+ return getNormalized();
+ } else {
+ return cutoffLastPathSegementImpl(true, false, appendPath);
+ }
+ }
+
+ /**
+ * Concatenates the given encoded string to the {@link #getEncoded() encoded uri}
+ * of this instance and returns {@link #Uri(Encoded) a new Uri instance} with the result.
+ *
+ * @throws URISyntaxException
+ * if the concatenated string {@code uri} doesn't fit to the
+ * specification RFC2396 and RFC3986 or could not be parsed correctly.
+ */
+ public final Uri concat(final Encoded suffix) throws URISyntaxException {
+ if( null == suffix ) {
+ return this;
+ } else {
+ return new Uri( input.concat(suffix) );
+ }
+ }
+
+ /**
+ * Returns a new Uri instance w/ the given new query {@code newQuery}.
+ *
+ * @throws URISyntaxException if this Uri is {@link #opaque}
+ * or if the new string {@code uri} doesn't fit to the
+ * specification RFC2396 and RFC3986 or could not be parsed correctly.
+ */
+ public final Uri getNewQuery(final Encoded newQuery) throws URISyntaxException {
+ if( opaque ) {
+ throw new URISyntaxException(input.decode(), "Opaque Uri cannot permute by query");
+ } else {
+ // with host validation if authority is defined
+ return Uri.create(scheme, userInfo, host, port, path, newQuery, fragment);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * Compares this Uri instance with the given argument {@code o} and
+ * determines if both are equal. Two Uri instances are equal if all single
+ * parts are identical in their meaning.
+ *
+ *
+ * @param o
+ * the Uri this instance has to be compared with.
+ * @return {@code true} if both Uri instances point to the same resource,
+ * {@code false} otherwise.
+ */
+ @Override
+ public final boolean equals(final Object o) {
+ if (!(o instanceof Uri)) {
+ return false;
+ }
+ final Uri uri = (Uri) o;
+
+ if (uri.fragment == null && fragment != null || uri.fragment != null && fragment == null) {
+ return false;
+ } else if (uri.fragment != null && fragment != null) {
+ if (!equalsHexCaseInsensitive(uri.fragment, fragment)) {
+ return false;
+ }
+ }
+
+ if (uri.scheme == null && scheme != null || uri.scheme != null && scheme == null) {
+ return false;
+ } else if (uri.scheme != null && scheme != null) {
+ if (!uri.scheme.equalsIgnoreCase(scheme)) {
+ return false;
+ }
+ }
+
+ if (uri.opaque && opaque) {
+ return equalsHexCaseInsensitive(uri.schemeSpecificPart, schemeSpecificPart);
+ } else if (!uri.opaque && !opaque) {
+ if (!equalsHexCaseInsensitive(path, uri.path)) {
+ return false;
+ }
+
+ if (uri.query != null && query == null || uri.query == null && query != null) {
+ return false;
+ } else if (uri.query != null && query != null) {
+ if (!equalsHexCaseInsensitive(uri.query, query)) {
+ return false;
+ }
+ }
+
+ if (uri.authority != null && authority == null || uri.authority == null && authority != null) {
+ return false;
+ } else if (uri.authority != null && authority != null) {
+ if (uri.host != null && host == null || uri.host == null && host != null) {
+ return false;
+ } else if (uri.host == null && host == null) {
+ // both are registry based, so compare the whole authority
+ return equalsHexCaseInsensitive(uri.authority, authority);
+ } else { // uri.host != null && host != null, so server-based
+ if (!host.equalsIgnoreCase(uri.host)) {
+ return false;
+ }
+
+ if (port != uri.port) {
+ return false;
+ }
+
+ if ( uri.userInfo != null && userInfo == null ||
+ uri.userInfo == null && userInfo != null
+ ) {
+ return false;
+ } else if (uri.userInfo != null && userInfo != null) {
+ return equalsHexCaseInsensitive(userInfo, uri.userInfo);
+ } else {
+ return true;
+ }
+ }
+ } else {
+ // no authority
+ return true;
+ }
+
+ } else {
+ // one is opaque, the other hierarchical
+ return false;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * Gets the hashcode value of this Uri instance.
+ *
+ */
+ @Override
+ public final int hashCode() {
+ synchronized( lazyLock ) {
+ if (hash == -1) {
+ hash = getHashString().hashCode();
+ }
+ return hash;
+ }
+ }
+
+ /*
+ * Takes a string that may contain hex sequences like %F1 or %2b and
+ * converts the hex values following the '%' to lowercase
+ */
+ private String convertHexToLowerCase(final String s) {
+ if (s.indexOf('%') == -1) {
+ return s;
+ }
+ final StringBuilder result = new StringBuilder("");
+ int index = 0, previndex = 0;
+ while ((index = s.indexOf('%', previndex)) != -1) {
+ result.append(s.substring(previndex, index + 1));
+ result.append(s.substring(index + 1, index + 3).toLowerCase());
+ index += 3;
+ previndex = index;
+ }
+ return result.toString();
+ }
+
+ /*
+ * Takes two strings that may contain hex sequences like %F1 or %2b and
+ * compares them, ignoring case for the hex values. Hex values must always
+ * occur in pairs as above
+ */
+ private boolean equalsHexCaseInsensitive(final Encoded first, final Encoded second) {
+ if (first.indexOf('%') != second.indexOf('%')) {
+ return first.equals(second);
+ }
+
+ int index = 0, previndex = 0;
+ while ( ( index = first.indexOf('%', previndex) ) != -1 &&
+ second.indexOf('%', previndex) == index
+ ) {
+ if( !first.get().substring(previndex, index).equals( second.get().substring(previndex, index) ) ) {
+ return false;
+ }
+ if( !first.get().substring(index + 1, index + 3).equalsIgnoreCase( second.get().substring(index + 1, index + 3) ) ) {
+ return false;
+ }
+ index += 3;
+ previndex = index;
+ }
+ return first.get().substring(previndex).equals( second.get().substring(previndex) );
+ }
+
+ /*
+ * Form a string from the components of this Uri, similarly to the
+ * toString() method. But this method converts scheme and host to lowercase,
+ * and converts escaped octets to lowercase.
+ */
+ private String getHashString() {
+ final StringBuilder result = new StringBuilder();
+ if (scheme != null) {
+ result.append(scheme.get().toLowerCase());
+ result.append(SCHEME_SEPARATOR);
+ }
+ if (opaque) {
+ result.append(schemeSpecificPart.get());
+ } else {
+ if (authority != null) {
+ result.append("//");
+ if (host == null) {
+ result.append(authority.get());
+ } else {
+ if (userInfo != null) {
+ result.append(userInfo.get() + "@");
+ }
+ result.append(host.get().toLowerCase());
+ if (port != -1) {
+ result.append(SCHEME_SEPARATOR + port);
+ }
+ }
+ }
+
+ if (path != null) {
+ result.append(path.get());
+ }
+
+ if (query != null) {
+ result.append(QUERY_SEPARATOR);
+ result.append(query.get());
+ }
+ }
+
+ if (fragment != null) {
+ result.append(FRAGMENT_SEPARATOR);
+ result.append(fragment.get());
+ }
+ return convertHexToLowerCase(result.toString());
+ }
+
+ /**
+ *
+ * @param input
+ * @param expectServer
+ * @param parseHints TODO
+ * @throws URISyntaxException
+ */
+ private Uri(final Encoded input, final boolean expectServer, final int parseHints) throws URISyntaxException {
+ if( emptyString(input) ) {
+ throw new URISyntaxException(input.get(), "empty input");
+ }
+ String temp = input.get();
+ int index;
+ // parse into Fragment, Scheme, and SchemeSpecificPart
+ // then parse SchemeSpecificPart if necessary
+
+ // Fragment
+ index = temp.indexOf(FRAGMENT_SEPARATOR);
+ if (index != -1) {
+ // remove the fragment from the end
+ fragment = new Encoded( temp.substring(index + 1) );
+ validateFragment(input, fragment, index + 1);
+ temp = temp.substring(0, index);
+ } else {
+ fragment = null;
+ }
+
+ String inputTemp = input.get(); // may get modified due to error correction
+
+ // Scheme and SchemeSpecificPart
+ final int indexSchemeSep = temp.indexOf(SCHEME_SEPARATOR);
+ index = indexSchemeSep;
+ final int indexSSP = temp.indexOf('/');
+ final int indexQuerySep = temp.indexOf(QUERY_SEPARATOR);
+
+ String sspTemp; // may get modified due to error correction
+
+ // if a '/' or '?' occurs before the first ':' the uri has no
+ // specified scheme, and is therefore not absolute
+ if ( indexSchemeSep != -1 &&
+ ( indexSSP >= indexSchemeSep || indexSSP == -1 ) &&
+ ( indexQuerySep >= indexSchemeSep || indexQuerySep == -1 )
+ ) {
+ // the characters up to the first ':' comprise the scheme
+ absolute = true;
+ scheme = new Encoded( temp.substring(0, indexSchemeSep) );
+ if (scheme.length() == 0) {
+ failExpecting(input, "scheme", indexSchemeSep);
+ }
+ validateScheme(input, scheme, 0);
+ sspTemp = temp.substring(indexSchemeSep + 1);
+ if (sspTemp.length() == 0) {
+ failExpecting(input, "scheme-specific-part", indexSchemeSep);
+ }
+ } else {
+ absolute = false;
+ scheme = null;
+ sspTemp = temp;
+ }
+
+ if ( scheme == null || sspTemp.length() > 0 && sspTemp.charAt(0) == '/' ) {
+ // Uri is hierarchical, not opaque
+ opaque = false;
+
+ // Query
+ temp = sspTemp;
+ index = temp.indexOf(QUERY_SEPARATOR);
+ if (index != -1) {
+ query = new Encoded( temp.substring(index + 1) );
+ temp = temp.substring(0, index);
+ validateQuery(input, query, indexSSP + 1 + index);
+ } else {
+ query = null;
+ }
+
+ String pathTemp; // may get modified due to error correction
+ final int indexPathInSSP;
+
+ // Authority and Path
+ if (temp.startsWith("//")) {
+ index = temp.indexOf('/', 2);
+ final String authorityS;
+ if (index != -1) {
+ authorityS = temp.substring(2, index);
+ pathTemp = temp.substring(index);
+ indexPathInSSP = index;
+ } else {
+ authorityS = temp.substring(2);
+ if (authorityS.length() == 0 && query == null && fragment == null) {
+ failExpecting(input, "authority, path [, query, fragment]", index);
+ }
+ pathTemp = "";
+ indexPathInSSP = -1;
+ // nothing left, so path is empty
+ // (not null, path should never be null if hierarchical/non-opaque)
+ }
+ if ( emptyString(authorityS) ) {
+ authority = null;
+ } else {
+ authority = new Encoded( authorityS );
+ validateAuthority(input, authority, indexSchemeSep + 3);
+ }
+ } else { // no authority specified
+ pathTemp = temp;
+ indexPathInSSP = 0;
+ authority = null;
+ }
+
+ int indexPath = 0; // in input
+ if (indexSSP > -1) {
+ indexPath += indexSSP;
+ }
+ if (indexPathInSSP > -1) {
+ indexPath += indexPathInSSP;
+ }
+
+ final int pathErrIdx = validateEncoded(pathTemp, PATH_LEGAL);
+ if( 0 <= pathErrIdx ) {
+ // Perform error correction on PATH if requested!
+ if( 0 != ( parseHints & PARSE_HINT_FIX_PATH ) ) {
+ if( DEBUG_SHOWFIX ) {
+ System.err.println("Uri FIX_FILEPATH: input at index "+(indexPath+pathErrIdx)+": "+inputTemp);
+ System.err.println("Uri FIX_FILEPATH: ssp at index "+(indexPathInSSP+pathErrIdx)+": "+sspTemp);
+ System.err.println("Uri FIX_FILEPATH: path at index "+pathErrIdx+": "+pathTemp);
+ }
+ final int pathTempOldLen = pathTemp.length();
+ pathTemp = encode( decode( pathTemp ), PATH_LEGAL); // re-encode, and hope for the best!
+ validatePath(input, pathTemp, indexPath); // re-validate!
+ {
+ // Patch SSP + INPUT !
+ final StringBuilder sb = new StringBuilder();
+ if( indexPathInSSP > 0 ) {
+ sb.append( sspTemp.substring(0, indexPathInSSP) );
+ }
+ sb.append( pathTemp ).append( sspTemp.substring( indexPathInSSP + pathTempOldLen ) );
+ sspTemp = sb.toString(); // update
+
+ sb.setLength(0);
+ if( indexPath > 0 ) {
+ sb.append( inputTemp.substring(0, indexPath) );
+ }
+ sb.append( pathTemp ).append( inputTemp.substring( indexPath + pathTempOldLen ) );
+ inputTemp = sb.toString(); // update
+ }
+ if( DEBUG_SHOWFIX ) {
+ System.err.println("Uri FIX_FILEPATH: result : "+pathTemp);
+ System.err.println("Uri FIX_FILEPATH: ssp after : "+sspTemp);
+ System.err.println("Uri FIX_FILEPATH: input after : "+inputTemp);
+ }
+ } else {
+ fail(input, "invalid path", indexPath+pathErrIdx);
+ }
+ }
+ path = new Encoded( pathTemp );
+ } else {
+ // Uri is not hierarchical, Uri is opaque
+ opaque = true;
+ query = null;
+ path = null;
+ authority = null;
+ validateSsp(input, sspTemp, indexSchemeSep + 1);
+ }
+ schemeSpecificPart = new Encoded( sspTemp );
+ this.input = inputTemp == input.get() ? input : new Encoded( inputTemp );
+
+ /**
+ * determine the host, port and userinfo if the authority parses
+ * successfully to a server based authority
+ *
+ * Behavior in error cases: if forceServer is true, throw
+ * URISyntaxException with the proper diagnostic messages. if
+ * forceServer is false assume this is a registry based uri, and just
+ * return leaving the host, port and userinfo fields undefined.
+ *
+ * and there are some error cases where URISyntaxException is thrown
+ * regardless of the forceServer parameter e.g. malformed ipv6 address
+ */
+ Encoded tempUserinfo = null, tempHost = null;
+ int tempPort = -1;
+ boolean authorityComplete;
+
+ if ( null != authority ) {
+ authorityComplete = true; // set to false later
+ int hostindex = 0;
+
+ temp = authority.get();
+ index = temp.indexOf('@');
+ if (index != -1) {
+ // remove user info
+ tempUserinfo = new Encoded( temp.substring(0, index) );
+ validateUserinfo(authority, tempUserinfo, 0);
+ temp = temp.substring(index + 1); // host[:port] is left
+ hostindex = index + 1;
+ }
+
+ index = temp.lastIndexOf(SCHEME_SEPARATOR);
+ final int endindex = temp.indexOf(']');
+
+ if (index != -1 && endindex < index) {
+ // determine port and host
+ tempHost = new Encoded( temp.substring(0, index) );
+
+ if (index < (temp.length() - 1)) { // port part is not empty
+ try {
+ tempPort = Integer.parseInt(temp.substring(index + 1));
+ if (tempPort < 0) {
+ if (expectServer) {
+ fail(authority, "invalid port <"+authority+">", hostindex + index + 1);
+ }
+ authorityComplete = false;
+ }
+ } catch (final NumberFormatException e) {
+ if (expectServer) {
+ fail(authority, "invalid port <"+authority+">, "+e.getMessage(), hostindex + index + 1);
+ }
+ authorityComplete = false;
+ }
+ }
+ } else {
+ tempHost = new Encoded( temp );
+ }
+
+ if( authorityComplete ) {
+ if ( emptyString(tempHost) ) {
+ if (expectServer) {
+ fail(authority, "empty host <"+authority+">", hostindex);
+ }
+ authorityComplete = false;
+ } else if (!isValidHost(expectServer, tempHost)) {
+ if (expectServer) {
+ fail(authority, "invalid host <"+tempHost+">", hostindex);
+ }
+ authorityComplete = false;
+ }
+ }
+ } else {
+ authorityComplete = false;
+ }
+
+ if( authorityComplete ) {
+ // this is a server based uri,
+ // fill in the userinfo, host and port fields
+ userInfo = tempUserinfo;
+ host = tempHost;
+ port = tempPort;
+ hasAuthority = true;
+ } else {
+ userInfo = null;
+ host = null;
+ port = -1;
+ hasAuthority = false;
+ }
+ }
+
+ private static void validateScheme(final Encoded uri, final Encoded scheme, final int index) throws URISyntaxException {
+ // first char needs to be an alpha char
+ final char ch = scheme.charAt(0);
+ if ( !((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')) ) {
+ fail(uri, "invalid scheme", index);
+ }
+ final int errIdx = validateAlphaNum(scheme.get(), "+-.");
+ if( 0 <= errIdx ) {
+ fail(uri, "invalid scheme", index+errIdx);
+ }
+ }
+
+ private static void validateSsp(final Encoded uri, final String ssp, final int index) throws URISyntaxException {
+ final int errIdx = validateEncoded(ssp, SSP_LEGAL);
+ if( 0 <= errIdx ) {
+ fail(uri, "invalid scheme-specific-part", index+errIdx);
+ }
+ }
+
+ private static void validateAuthority(final Encoded uri, final Encoded authority, final int index) throws URISyntaxException {
+ final int errIdx = validateEncoded(authority.get(), AUTHORITY_LEGAL);
+ if( 0 <= errIdx ) {
+ fail(uri, "invalid authority", index+errIdx);
+ }
+ }
+
+ private static void validatePath(final Encoded uri, final String path, final int index) throws URISyntaxException {
+ final int errIdx = validateEncoded(path, PATH_LEGAL);
+ if( 0 <= errIdx ) {
+ fail(uri, "invalid path", index+errIdx);
+ }
+ }
+
+ private static void validateQuery(final Encoded uri, final Encoded query, final int index) throws URISyntaxException {
+ final int errIdx = validateEncoded(query.get(), QUERY_LEGAL);
+ if( 0 <= errIdx ) {
+ fail(uri, "invalid query", index+errIdx);
+ }
+ }
+
+ private static void validateFragment(final Encoded uri, final Encoded fragment, final int index) throws URISyntaxException {
+ final int errIdx = validateEncoded(fragment.get(), FRAG_LEGAL);
+ if( 0 <= errIdx ) {
+ fail(uri, "invalid fragment", index+errIdx);
+ }
+ }
+
+ private static void validateUserinfo(final Encoded uri, final Encoded userinfo, final int index) throws URISyntaxException {
+ for (int i = 0; i < userinfo.length(); i++) {
+ final char ch = userinfo.charAt(i);
+ if (ch == ']' || ch == '[') {
+ fail(uri, "invalid userinfo", index+i);
+ }
+ }
+ }
+
+ /**
+ * distinguish between IPv4, IPv6, domain name and validate it based on
+ * its type
+ */
+ private boolean isValidHost(final boolean expectServer, final Encoded host) throws URISyntaxException {
+ if (host.charAt(0) == '[') {
+ // ipv6 address
+ if (host.charAt(host.length() - 1) != ']') {
+ fail(input, "invalid host, missing closing ipv6: "+host, 0);
+ }
+ if (!isValidIP6Address(host.get())) {
+ fail(input, "invalid ipv6: "+host, 0);
+ }
+ return true;
+ }
+
+ // '[' and ']' can only be the first char and last char
+ // of the host name
+ if (host.indexOf('[') != -1 || host.indexOf(']') != -1) {
+ fail(input, "invalid host: "+host, 0);
+ }
+
+ final int index = host.lastIndexOf('.');
+ if ( index < 0 || index == host.length() - 1 ||
+ !Character.isDigit(host.charAt(index + 1)) )
+ {
+ // domain name
+ if (isValidDomainName(host)) {
+ return true;
+ }
+ if (expectServer) {
+ fail(input, "invalid host, invalid domain-name or ipv4: "+host, 0);
+ }
+ return false;
+ }
+
+ // IPv4 address
+ if (isValidIPv4Address(host.get())) {
+ return true;
+ }
+ if (expectServer) {
+ fail(input, "invalid host, invalid ipv4: "+host, 0);
+ }
+ return false;
+ }
+
+ private static boolean isValidDomainName(final Encoded host) {
+ final String hostS = host.get();
+ if( 0 <= validateAlphaNum(hostS, "-.") ) {
+ return false;
+ }
+ String label = null;
+ final StringTokenizer st = new StringTokenizer(hostS, ".");
+ while (st.hasMoreTokens()) {
+ label = st.nextToken();
+ if (label.startsWith("-") || label.endsWith("-")) {
+ return false;
+ }
+ }
+
+ if (!label.equals(hostS)) {
+ final char ch = label.charAt(0);
+ if (ch >= '0' && ch <= '9') {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ private static boolean isValidIPv4Address(final String ipv4Address) {
+ int index;
+ int index2;
+ try {
+ int num;
+ index = ipv4Address.indexOf('.');
+ num = Integer.parseInt(ipv4Address.substring(0, index));
+ if (num < 0 || num > 255) {
+ return false;
+ }
+ index2 = ipv4Address.indexOf('.', index + 1);
+ num = Integer.parseInt(ipv4Address.substring(index + 1, index2));
+ if (num < 0 || num > 255) {
+ return false;
+ }
+ index = ipv4Address.indexOf('.', index2 + 1);
+ num = Integer.parseInt(ipv4Address.substring(index2 + 1, index));
+ if (num < 0 || num > 255) {
+ return false;
+ }
+ num = Integer.parseInt(ipv4Address.substring(index + 1));
+ if (num < 0 || num > 255) {
+ return false;
+ }
+ } catch (final Exception e) {
+ return false;
+ }
+ return true;
+ }
+
+ private static boolean isValidIP6Address(final String ipv6Address) {
+ final int length = ipv6Address.length();
+ boolean doubleColon = false;
+ int numberOfColons = 0;
+ int numberOfPeriods = 0;
+ String word = "";
+ char c = 0;
+ char prevChar = 0;
+ int offset = 0; // offset for [] ip addresses
+
+ if (length < 2) {
+ return false;
+ }
+
+ for (int i = 0; i < length; i++) {
+ prevChar = c;
+ c = ipv6Address.charAt(i);
+ switch (c) {
+
+ // case for an open bracket [x:x:x:...x]
+ case '[':
+ if (i != 0) {
+ return false; // must be first character
+ }
+ if (ipv6Address.charAt(length - 1) != ']') {
+ return false; // must have a close ]
+ }
+ if ((ipv6Address.charAt(1) == SCHEME_SEPARATOR)
+ && (ipv6Address.charAt(2) != SCHEME_SEPARATOR)) {
+ return false;
+ }
+ offset = 1;
+ if (length < 4) {
+ return false;
+ }
+ break;
+
+ // case for a closed bracket at end of IP [x:x:x:...x]
+ case ']':
+ if (i != length - 1) {
+ return false; // must be last character
+ }
+ if (ipv6Address.charAt(0) != '[') {
+ return false; // must have a open [
+ }
+ break;
+
+ // case for the last 32-bits represented as IPv4
+ // x:x:x:x:x:x:d.d.d.d
+ case '.':
+ numberOfPeriods++;
+ if (numberOfPeriods > 3) {
+ return false;
+ }
+ if (!isValidIP4Word(word)) {
+ return false;
+ }
+ if (numberOfColons != 6 && !doubleColon) {
+ return false;
+ }
+ // a special case ::1:2:3:4:5:d.d.d.d allows 7 colons
+ // with
+ // an IPv4 ending, otherwise 7 :'s is bad
+ if (numberOfColons == 7
+ && ipv6Address.charAt(0 + offset) != SCHEME_SEPARATOR
+ && ipv6Address.charAt(1 + offset) != SCHEME_SEPARATOR) {
+ return false;
+ }
+ word = "";
+ break;
+
+ case SCHEME_SEPARATOR:
+ numberOfColons++;
+ if (numberOfColons > 7) {
+ return false;
+ }
+ if (numberOfPeriods > 0) {
+ return false;
+ }
+ if (prevChar == SCHEME_SEPARATOR) {
+ if (doubleColon) {
+ return false;
+ }
+ doubleColon = true;
+ }
+ word = "";
+ break;
+
+ default:
+ if (word.length() > 3) {
+ return false;
+ }
+ if (!isValidHexChar(c)) {
+ return false;
+ }
+ word += c;
+ }
+ }
+
+ // Check if we have an IPv4 ending
+ if (numberOfPeriods > 0) {
+ if (numberOfPeriods != 3 || !isValidIP4Word(word)) {
+ return false;
+ }
+ } else {
+ // If we're at then end and we haven't had 7 colons then there
+ // is a problem unless we encountered a doubleColon
+ if (numberOfColons != 7 && !doubleColon) {
+ return false;
+ }
+
+ // If we have an empty word at the end, it means we ended in
+ // either a : or a .
+ // If we did not end in :: then this is invalid
+ if (word == "" && ipv6Address.charAt(length - 1 - offset) != SCHEME_SEPARATOR
+ && ipv6Address.charAt(length - 2 - offset) != SCHEME_SEPARATOR) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ private static boolean isValidIP4Word(final String word) {
+ char c;
+ if (word.length() < 1 || word.length() > 3) {
+ return false;
+ }
+ for (int i = 0; i < word.length(); i++) {
+ c = word.charAt(i);
+ if (!(c >= '0' && c <= '9')) {
+ return false;
+ }
+ }
+ if (Integer.parseInt(word) > 255) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Validate a string by checking if it contains any characters other than:
+ *
+ *
letters ('a'..'z', 'A'..'Z')
+ *
numbers ('0'..'9')
+ *
characters in the legal-set parameter
+ *
others (unicode characters that are not in
+ * US-ASCII set, and are not ISO Control or are not ISO Space characters)
+ *
+ *
+ * @param encoded
+ * {@code java.lang.String} the string to be validated
+ * @param legal
+ * {@code java.lang.String} the characters allowed in the String
+ * s
+ */
+ private static int validateEncoded(final String encoded, final String legal) {
+ for (int i = 0; i < encoded.length();) {
+ final char ch = encoded.charAt(i);
+ if (ch == '%') {
+ do {
+ if (i + 2 >= encoded.length()) {
+ throw new IllegalArgumentException("missing '%' hex-digits at index "+i);
+ }
+ final int d1 = Character.digit(encoded.charAt(i + 1), 16);
+ final int d2 = Character.digit(encoded.charAt(i + 2), 16);
+ if (d1 == -1 || d2 == -1) {
+ throw new IllegalArgumentException("invalid hex-digits at index "+i+": "+encoded.substring(i, i + 3));
+ }
+ i += 3;
+ } while (i < encoded.length() && encoded.charAt(i) == '%');
+ continue;
+ }
+ if ( !( (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') ||
+ (ch >= '0' && ch <= '9') || legal.indexOf(ch) > -1 ||
+ (ch > 127 && !Character.isSpaceChar(ch) && !Character.isISOControl(ch))
+ )
+ ) {
+ return i;
+ }
+ i++;
+ }
+ return -1;
+ }
+ private static int validateAlphaNum(final String s, final String legal) {
+ for (int i = 0; i < s.length();) {
+ final char ch = s.charAt(i);
+ if ( !( (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') ||
+ (ch >= '0' && ch <= '9') || legal.indexOf(ch) > -1
+ )
+ ) {
+ return i;
+ }
+ i++;
+ }
+ return -1;
+ }
+
+ private static boolean isValidHexChar(final char c) {
+ return (c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f');
+ }
+ private static boolean emptyString(final Encoded s) {
+ return null == s || 0 == s.length();
+ }
+ private static boolean emptyString(final String s) {
+ return null == s || 0 == s.length();
+ }
+
+ private static void fail(final Encoded input, final String reason, final int p) throws URISyntaxException {
+ throw new URISyntaxException(input.get(), reason, p);
+ }
+ private static void failExpecting(final Encoded input, final String expected, final int p) throws URISyntaxException {
+ fail(input, "Expecting " + expected, p);
+ }
+}
\ No newline at end of file
diff -Nru gluegen2-2.2.4/src/java/com/jogamp/common/net/UriQueryProps.java gluegen2-2.3.2/src/java/com/jogamp/common/net/UriQueryProps.java
--- gluegen2-2.2.4/src/java/com/jogamp/common/net/UriQueryProps.java 1970-01-01 00:00:00.000000000 +0000
+++ gluegen2-2.3.2/src/java/com/jogamp/common/net/UriQueryProps.java 2015-10-09 04:18:28.000000000 +0000
@@ -0,0 +1,138 @@
+/**
+ * Copyright 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:
+ *
+ * 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
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * 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.net;
+
+import java.net.URISyntaxException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
+
+/**
+ * Helper class to process URI's query, handled as properties.
+ *
+ * The order of the URI segments (any properties) are not preserved.
+ *
+ * Since 2.3.0 renamed from {@code URIQueryProps} to {@code UriQueryProps},
+ * and using {@link Uri} instead of {@link java.net.URI}.
+ *
+ */
+public class UriQueryProps {
+ private static final String QMARK = "?";
+ private static final char ASSIG = '=';
+ private static final String EMPTY = "";
+ private final String query_separator;
+
+ private final HashMap properties = new HashMap();
+
+ private UriQueryProps(final char querySeparator) {
+ query_separator = String.valueOf(querySeparator);
+ }
+
+ public final Map getProperties() { return properties; }
+ public final char getQuerySeparator() { return query_separator.charAt(0); }
+
+ public final Uri.Encoded appendQuery(Uri.Encoded baseQuery) {
+ boolean needsSep = false;
+ final StringBuilder sb = new StringBuilder();
+ if ( null != baseQuery ) {
+ if( baseQuery.startsWith(QMARK) ) {
+ baseQuery = baseQuery.substring(1); // cut off '?'
+ }
+ sb.append(baseQuery.get());
+ if( !baseQuery.endsWith(query_separator) ) {
+ needsSep = true;
+ }
+ }
+ final Iterator> entries = properties.entrySet().iterator();
+ while(entries.hasNext()) {
+ if(needsSep) {
+ sb.append(query_separator);
+ }
+ final Entry entry = entries.next();
+ sb.append(entry.getKey());
+ if( EMPTY != entry.getValue() ) {
+ sb.append(ASSIG).append(entry.getValue());
+ }
+ needsSep = true;
+ }
+ return new Uri.Encoded(sb.toString(), Uri.QUERY_LEGAL);
+ }
+
+ public final Uri appendQuery(final Uri base) throws URISyntaxException {
+ return base.getNewQuery( appendQuery( base.query ) );
+ }
+
+ /**
+ *
+ * @param uri
+ * @param querySeparator should be either ; or &, ; is encouraged due to troubles of escaping &.
+ * @return
+ * @throws IllegalArgumentException if querySeparator is illegal, i.e. neither ; nor &
+ */
+ public static final UriQueryProps create(final Uri uri, final char querySeparator) throws IllegalArgumentException {
+ if( ';' != querySeparator && '&' != querySeparator ) {
+ throw new IllegalArgumentException("querySeparator is invalid: "+querySeparator);
+ }
+ final UriQueryProps data = new UriQueryProps(querySeparator);
+ final String q = Uri.decode(uri.query);
+ final int q_l = null != q ? q.length() : -1;
+ int q_e = -1;
+ while(q_e < q_l) {
+ final int q_b = q_e + 1; // next term
+ q_e = q.indexOf(querySeparator, q_b);
+ if(0 == q_e) {
+ // single separator
+ continue;
+ }
+ if(0 > q_e) {
+ // end
+ q_e = q_l;
+ }
+ // n-part
+ final String part = q.substring(q_b, q_e);
+ final int assignment = part.indexOf(ASSIG);
+ if(0 < assignment) {
+ // assignment
+ final String k = part.substring(0, assignment);
+ final String v = part.substring(assignment+1);
+ data.properties.put(k, v);
+ } else {
+ // property key only
+ data.properties.put(part, EMPTY);
+ }
+ }
+ return data;
+ }
+}
diff -Nru gluegen2-2.2.4/src/java/com/jogamp/common/net/URIQueryProps.java gluegen2-2.3.2/src/java/com/jogamp/common/net/URIQueryProps.java
--- gluegen2-2.2.4/src/java/com/jogamp/common/net/URIQueryProps.java 2014-10-10 13:20:51.000000000 +0000
+++ gluegen2-2.3.2/src/java/com/jogamp/common/net/URIQueryProps.java 1970-01-01 00:00:00.000000000 +0000
@@ -1,137 +0,0 @@
-/**
- * Copyright 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:
- *
- * 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
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * 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.net;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Map.Entry;
-
-/**
- * Helper class to process URI's query, handled as properties.
- *
- * The order of the URI segments (any properties) are not preserved.
- *
- */
-public class URIQueryProps {
- private static final String QMARK = "?";
- private static final char ASSIG = '=';
- private static final String EMPTY = "";
- private final String query_separator;
-
- private final HashMap properties = new HashMap();
-
- private URIQueryProps(final char querySeparator) {
- query_separator = String.valueOf(querySeparator);
- }
-
- public final Map getProperties() { return properties; }
- public final char getQuerySeparator() { return query_separator.charAt(0); }
-
- public final String appendQuery(String baseQuery) {
- boolean needsSep = false;
- final StringBuilder sb = new StringBuilder();
- if ( null != baseQuery ) {
- if( !baseQuery.startsWith(QMARK) ) {
- baseQuery = baseQuery.substring(1);
- }
- sb.append(baseQuery);
- if( !baseQuery.endsWith(query_separator) ) {
- needsSep = true;
- }
- }
- final Iterator> entries = properties.entrySet().iterator();
- while(entries.hasNext()) {
- if(needsSep) {
- sb.append(query_separator);
- }
- final Entry entry = entries.next();
- sb.append(entry.getKey());
- if( EMPTY != entry.getValue() ) {
- sb.append(ASSIG).append(entry.getValue());
- }
- needsSep = true;
- }
- return sb.toString();
- }
-
- public final URI appendQuery(final URI base) throws URISyntaxException {
- return new URI(base.getScheme(),
- base.getRawUserInfo(), base.getHost(), base.getPort(),
- base.getRawPath(), appendQuery(base.getRawQuery()), base.getRawFragment());
- }
-
- /**
- *
- * @param uri
- * @param querySeparator should be either ; or &, ; is encouraged due to troubles of escaping &.
- * @return
- * @throws IllegalArgumentException if querySeparator is illegal, i.e. neither ; nor &
- */
- public static final URIQueryProps create(final URI uri, final char querySeparator) throws IllegalArgumentException {
- if( ';' != querySeparator && '&' != querySeparator ) {
- throw new IllegalArgumentException("querySeparator is invalid: "+querySeparator);
- }
- final URIQueryProps data = new URIQueryProps(querySeparator);
- final String q = uri.getQuery();
- final int q_l = null != q ? q.length() : -1;
- int q_e = -1;
- while(q_e < q_l) {
- final int q_b = q_e + 1; // next term
- q_e = q.indexOf(querySeparator, q_b);
- if(0 == q_e) {
- // single separator
- continue;
- }
- if(0 > q_e) {
- // end
- q_e = q_l;
- }
- // n-part
- final String part = q.substring(q_b, q_e);
- final int assignment = part.indexOf(ASSIG);
- if(0 < assignment) {
- // assignment
- final String k = part.substring(0, assignment);
- final String v = part.substring(assignment+1);
- data.properties.put(k, v);
- } else {
- // property key only
- data.properties.put(part, EMPTY);
- }
- }
- return data;
- }
-}
diff -Nru gluegen2-2.2.4/src/java/com/jogamp/common/nio/Buffers.java gluegen2-2.3.2/src/java/com/jogamp/common/nio/Buffers.java
--- gluegen2-2.2.4/src/java/com/jogamp/common/nio/Buffers.java 2014-10-10 13:20:51.000000000 +0000
+++ gluegen2-2.3.2/src/java/com/jogamp/common/nio/Buffers.java 2015-10-09 04:18:28.000000000 +0000
@@ -39,9 +39,15 @@
*/
package com.jogamp.common.nio;
-import java.nio.*;
-
-import jogamp.common.os.PlatformPropsImpl;
+import java.nio.Buffer;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.nio.CharBuffer;
+import java.nio.DoubleBuffer;
+import java.nio.FloatBuffer;
+import java.nio.IntBuffer;
+import java.nio.LongBuffer;
+import java.nio.ShortBuffer;
import com.jogamp.common.util.ValueConv;
@@ -445,30 +451,10 @@
if (buf == null) {
return true;
}
- if ( PlatformPropsImpl.JAVA_6 ) {
- if (buf instanceof Buffer) {
- return ((Buffer) buf).isDirect();
- } else if (buf instanceof PointerBuffer) {
- return ((PointerBuffer) buf).isDirect();
- }
- } else {
- if (buf instanceof ByteBuffer) {
- return ((ByteBuffer) buf).isDirect();
- } else if (buf instanceof IntBuffer) {
- return ((IntBuffer) buf).isDirect();
- } else if (buf instanceof ShortBuffer) {
- return ((ShortBuffer) buf).isDirect();
- } else if (buf instanceof FloatBuffer) {
- return ((FloatBuffer) buf).isDirect();
- } else if (buf instanceof DoubleBuffer) {
- return ((DoubleBuffer) buf).isDirect();
- } else if (buf instanceof LongBuffer) {
- return ((LongBuffer) buf).isDirect();
- } else if (buf instanceof CharBuffer) {
- return ((CharBuffer) buf).isDirect();
- } else if (buf instanceof PointerBuffer) {
- return ((PointerBuffer) buf).isDirect();
- }
+ if (buf instanceof Buffer) {
+ return ((Buffer) buf).isDirect();
+ } else if (buf instanceof PointerBuffer) {
+ return ((PointerBuffer) buf).isDirect();
}
throw new IllegalArgumentException("Unexpected buffer type " + buf.getClass().getName());
}
diff -Nru gluegen2-2.2.4/src/java/com/jogamp/common/nio/ByteBufferInputStream.java gluegen2-2.3.2/src/java/com/jogamp/common/nio/ByteBufferInputStream.java
--- gluegen2-2.2.4/src/java/com/jogamp/common/nio/ByteBufferInputStream.java 1970-01-01 00:00:00.000000000 +0000
+++ gluegen2-2.3.2/src/java/com/jogamp/common/nio/ByteBufferInputStream.java 2015-10-09 04:18:28.000000000 +0000
@@ -0,0 +1,186 @@
+/**
+ * Copyright 2014 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:
+ *
+ * 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
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * 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.nio;
+
+import java.io.BufferedInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.ByteBuffer;
+import java.nio.MappedByteBuffer;
+import java.nio.channels.FileChannel;
+import java.nio.channels.FileChannel.MapMode;
+
+/**
+ * An {@link InputStream} implementation based on an underlying {@link ByteBuffer}
+ * supporting {@link #markSupported() mark}.
+ *
+ * May be utilized as well with a {@link MappedByteBuffer memory-mapped} {@link FileChannel#map(MapMode, long, long) FileChannel}
+ * using a size ≤ {@link Integer#MAX_VALUE}.
+ * This becomes efficient with files ≥ 10 MiB, depending on the platform
+ * and whether the traditional method uses a {@link BufferedInputStream} supporting {@code mark} incl. it's buffer size.
+ * See test case {@code com.jogamp.common.nio.TestByteBufferInputStream}.
+ *
+ * @since 2.3.0
+ */
+public class ByteBufferInputStream extends InputStream {
+ private final ByteBuffer buf;
+ private int mark;
+
+ /**
+ * Creates a new byte-buffer input stream.
+ *
+ * @param buf the underlying byte buffer.
+ */
+ public ByteBufferInputStream(final ByteBuffer buf) {
+ this.buf = buf;
+ this.mark = -1;
+ }
+
+ @Override
+ public final int available() {
+ return buf.remaining();
+ }
+
+ /**
+ * This implementation supports {@code mark}.
+ *
+ * {@inheritDoc}
+ *
+ */
+ @Override
+ public final boolean markSupported() {
+ return true;
+ }
+
+ /**
+ * This implementation supports {@code mark}.
+ *
+ * {@inheritDoc}
+ *
+ * @see #markSupported()
+ */
+ @Override
+ public final synchronized void mark(final int unused) {
+ mark = buf.position();
+ }
+
+ /**
+ * This implementation supports {@code mark}.
+ *
+ * {@inheritDoc}
+ *
+ * @see #markSupported()
+ */
+ @Override
+ public final synchronized void reset() throws IOException {
+ if ( mark == -1 ) {
+ throw new IOException();
+ }
+ buf.position(mark);
+ }
+
+ @Override
+ public final long skip(final long n) throws IOException {
+ if( 0 > n ) {
+ return 0;
+ }
+ final int s = (int) Math.min( buf.remaining(), n );
+ buf.position(buf.position() + s);
+ return s;
+ }
+
+ @Override
+ public final int read() {
+ if ( ! buf.hasRemaining() ) {
+ return -1;
+ }
+ return buf.get() & 0xFF;
+ }
+
+ @Override
+ public final int read(final byte[] b, final int off, final int len) {
+ if (b == null) {
+ throw new NullPointerException();
+ } else if( off < 0 ||
+ len < 0 ||
+ off > b.length ||
+ off + len > b.length ||
+ off + len < 0
+ ) {
+ throw new IndexOutOfBoundsException("offset "+off+", length "+len+", b.length "+b.length);
+ } else if ( 0 == len ) {
+ return 0;
+ }
+ final int totalRem = buf.remaining();
+ if ( 0 == totalRem ) {
+ return -1;
+ }
+ final int maxLen = Math.min(totalRem, len);
+ if( buf.hasArray() ) {
+ System.arraycopy(buf.array(), buf.arrayOffset() + buf.position(), b, off, maxLen);
+ buf.position( buf.position() + maxLen );
+ } else {
+ buf.get(b, off, maxLen);
+ }
+ return maxLen;
+ }
+
+ // @Override
+ public final int read(final ByteBuffer b, final int len) {
+ if (b == null) {
+ throw new NullPointerException();
+ } else if (len < 0 || len > b.remaining()) {
+ throw new IndexOutOfBoundsException("length "+len+", b "+b);
+ } else if ( 0 == len ) {
+ return 0;
+ }
+ final int remaining = buf.remaining();
+ if ( 0 == remaining ) {
+ return -1;
+ }
+ final int maxLen = Math.min(remaining, len);
+ if( buf.hasArray() && b.hasArray() ) {
+ System.arraycopy(buf.array(), buf.arrayOffset() + buf.position(), b.array(), b.arrayOffset() + b.position(), maxLen);
+ buf.position( buf.position() + maxLen );
+ b.position( b.position() + maxLen );
+ } else if( maxLen == remaining ) {
+ b.put(buf);
+ } else {
+ final int _limit = buf.limit();
+ buf.limit(maxLen);
+ try {
+ b.put(buf);
+ } finally {
+ buf.limit(_limit);
+ }
+ }
+ return maxLen;
+ }
+
+ public final ByteBuffer getBuffer() { return buf; }
+}
diff -Nru gluegen2-2.2.4/src/java/com/jogamp/common/nio/MappedByteBufferInputStream.java gluegen2-2.3.2/src/java/com/jogamp/common/nio/MappedByteBufferInputStream.java
--- gluegen2-2.2.4/src/java/com/jogamp/common/nio/MappedByteBufferInputStream.java 1970-01-01 00:00:00.000000000 +0000
+++ gluegen2-2.3.2/src/java/com/jogamp/common/nio/MappedByteBufferInputStream.java 2015-10-09 04:18:28.000000000 +0000
@@ -0,0 +1,958 @@
+/**
+ * Copyright 2014 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:
+ *
+ * 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
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * 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.nio;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.PrintStream;
+import java.io.RandomAccessFile;
+import java.lang.ref.WeakReference;
+import java.lang.reflect.Method;
+import java.nio.ByteBuffer;
+import java.nio.MappedByteBuffer;
+import java.nio.channels.FileChannel;
+import java.nio.channels.FileChannel.MapMode;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+import jogamp.common.Debug;
+
+import com.jogamp.common.os.Platform;
+
+/**
+ * An {@link InputStream} implementation based on an underlying {@link FileChannel}'s memory mapped {@link ByteBuffer},
+ * {@link #markSupported() supporting} {@link #mark(int) mark} and {@link #reset()}.
+ *
+ * Implementation allows full memory mapped {@link ByteBuffer} coverage via {@link FileChannel#map(MapMode, long, long) FileChannel}
+ * beyond its size limitation of {@link Integer#MAX_VALUE} utilizing an array of {@link ByteBuffer} slices.
+ *
+ *
+ * Implementation further allows full random access via {@link #position()} and {@link #position(long)}
+ * and accessing the memory mapped {@link ByteBuffer} slices directly via {@link #currentSlice()} and {@link #nextSlice()}.
+ *
+ * @since 2.3.0
+ */
+public class MappedByteBufferInputStream extends InputStream {
+ public static enum CacheMode {
+ /**
+ * Keep all previous lazily cached buffer slices alive, useful for hopping readers,
+ * i.e. random access via {@link MappedByteBufferInputStream#position(long) position(p)}
+ * or {@link MappedByteBufferInputStream#reset() reset()}.
+ *
+ * Note that without flushing, the platform may fail memory mapping
+ * due to virtual address space exhaustion.
+ * In such case an {@link OutOfMemoryError} may be thrown directly,
+ * or encapsulated as the {@link IOException#getCause() the cause}
+ * of a thrown {@link IOException}.
+ *
+ */
+ FLUSH_NONE,
+ /**
+ * Soft flush the previous lazily cached buffer slice when caching the next buffer slice,
+ * useful for sequential forward readers, as well as for hopping readers like {@link #FLUSH_NONE}
+ * in case of relatively short periods between hopping across slices.
+ *
+ * Implementation clears the buffer slice reference
+ * while preserving a {@link WeakReference} to allow its resurrection if not yet
+ * {@link System#gc() garbage collected}.
+ *
+ */
+ FLUSH_PRE_SOFT,
+ /**
+ * Hard flush the previous lazily cached buffer slice when caching the next buffer slice,
+ * useful for sequential forward readers.
+ *
+ * Besides clearing the buffer slice reference,
+ * implementation attempts to hard flush the mapped buffer
+ * using a {@code sun.misc.Cleaner} by reflection.
+ * In case such method does not exist nor works, implementation falls back to {@link #FLUSH_PRE_SOFT}.
+ *
+ *
+ * This is the default.
+ *
+ */
+ FLUSH_PRE_HARD
+ };
+
+ /**
+ * File resize interface allowing a file to change its size,
+ * e.g. via {@link RandomAccessFile#setLength(long)}.
+ */
+ public static interface FileResizeOp {
+ /**
+ * @param newSize the new file size
+ * @throws IOException if file size change is not supported or any other I/O error occurs
+ */
+ void setLength(final long newSize) throws IOException;
+ }
+ private static final FileResizeOp NoFileResize = new FileResizeOp() {
+ @Override
+ public void setLength(final long newSize) throws IOException {
+ throw new IOException("file size change not supported");
+ }
+ };
+
+ /**
+ * Default slice shift, i.e. 1L << shift, denoting slice size in MiB:
+ *
+ * The {@link ByteBuffer} slices will be mapped lazily at first usage.
+ *
+ * @param fileChannel the file channel to be mapped lazily.
+ * @param mmode the map mode, default is {@link FileChannel.MapMode#READ_ONLY}.
+ * @param cmode the caching mode, default is {@link CacheMode#FLUSH_PRE_HARD}.
+ * @param sliceShift the pow2 slice size, default is {@link #DEFAULT_SLICE_SHIFT}.
+ * @throws IOException
+ */
+ public MappedByteBufferInputStream(final FileChannel fileChannel,
+ final FileChannel.MapMode mmode,
+ final CacheMode cmode,
+ final int sliceShift) throws IOException {
+ this(fileChannel, mmode, cmode, sliceShift, fileChannel.size(), 0);
+ }
+
+ /**
+ * Creates a new instance using the given {@link FileChannel},
+ * given mapping-mode, given cache-mode and the {@link #DEFAULT_SLICE_SHIFT}.
+ *
+ * The {@link ByteBuffer} slices will be mapped lazily at first usage.
+ *
+ * @param fileChannel the file channel to be used.
+ * @param mmode the map mode, default is {@link FileChannel.MapMode#READ_ONLY}.
+ * @param cmode the caching mode, default is {@link CacheMode#FLUSH_PRE_HARD}.
+ * @throws IOException
+ */
+ public MappedByteBufferInputStream(final FileChannel fileChannel, final FileChannel.MapMode mmode, final CacheMode cmode) throws IOException {
+ this(fileChannel, mmode, cmode, DEFAULT_SLICE_SHIFT);
+ }
+
+ /**
+ * Creates a new instance using the given {@link FileChannel},
+ * {@link FileChannel.MapMode#READ_ONLY read-only} mapping mode, {@link CacheMode#FLUSH_PRE_HARD}
+ * and the {@link #DEFAULT_SLICE_SHIFT}.
+ *
+ * The {@link ByteBuffer} slices will be mapped {@link FileChannel.MapMode#READ_ONLY} lazily at first usage.
+ *
+ * @param fileChannel the file channel to be used.
+ * @throws IOException
+ */
+ public MappedByteBufferInputStream(final FileChannel fileChannel) throws IOException {
+ this(fileChannel, FileChannel.MapMode.READ_ONLY, CacheMode.FLUSH_PRE_HARD, DEFAULT_SLICE_SHIFT);
+ }
+
+ /**
+ * Enable or disable synchronous mode.
+ *
+ * If synchronous mode is enabled, mapped buffers will be {@link #flush(boolean) flushed}
+ * if {@link #notifyLengthChange(long) resized}, written to or {@link #close() closing} in {@link FileChannel.MapMode#READ_WRITE read-write} mapping mode.
+ *
+ *
+ * If synchronous mode is enabled, {@link FileChannel#force(boolean)} is issued
+ * if {@link #setLength(long) resizing} or {@link #close() closing} and not in {@link FileChannel.MapMode#READ_ONLY read-only} mapping mode.
+ *
+ * @param s {@code true} to enable synchronous mode
+ */
+ public final synchronized void setSynchronous(final boolean s) {
+ synchronous = s;
+ }
+ /**
+ * Return {@link #setSynchronous(boolean) synchronous mode}.
+ */
+ public final synchronized boolean getSynchronous() {
+ return synchronous ;
+ }
+
+ final synchronized void checkOpen() throws IOException {
+ if( 0 == refCount ) {
+ throw new IOException("stream closed");
+ }
+ }
+
+ @Override
+ public final synchronized void close() throws IOException {
+ if( 0 < refCount ) {
+ refCount--;
+ if( 0 == refCount ) {
+ try {
+ cleanAllSlices( true /* syncBuffer */ );
+ } finally {
+ flushImpl(true /* metaData */, false /* syncBuffer */);
+ fc.close();
+ mark = -1;
+ sliceIdx = -1;
+ super.close();
+ }
+ }
+ }
+ }
+
+ final FileChannel.MapMode getMapMode() { return mmode; }
+
+ /**
+ * @param fileResizeOp the new {@link FileResizeOp}.
+ * @throws IllegalStateException if attempting to set the {@link FileResizeOp} to a different value than before
+ */
+ public final synchronized void setFileResizeOp(final FileResizeOp fileResizeOp) throws IllegalStateException {
+ if( NoFileResize != this.fileResizeOp && this.fileResizeOp != fileResizeOp ) {
+ throw new IllegalStateException("FileResizeOp already set, this value differs");
+ }
+ this.fileResizeOp = null != fileResizeOp ? fileResizeOp : NoFileResize;
+ }
+
+ /**
+ * Resize the underlying {@link FileChannel}'s size and adjusting this instance
+ * via {@link #notifyLengthChange(long) accordingly}.
+ *
+ * User must have a {@link FileResizeOp} {@link #setFileResizeOp(FileResizeOp) registered} before.
+ *
+ * @param newTotalSize the new total size
+ * @throws IOException if no {@link FileResizeOp} has been {@link #setFileResizeOp(FileResizeOp) registered}
+ * or if a buffer slice operation failed
+ */
+ public final synchronized void setLength(final long newTotalSize) throws IOException {
+ final long currentPosition;
+ if( 0 != newTotalSize && totalSize != newTotalSize ) {
+ currentPosition = position();
+ } else {
+ currentPosition = -1L;
+ }
+ if( fc.size() != newTotalSize ) {
+ if( Platform.OSType.WINDOWS == Platform.getOSType() ) {
+ // On Windows, we have to close all mapped slices.
+ // Otherwise we will receive:
+ // java.io.IOException: The requested operation cannot be performed on a file with a user-mapped section open
+ // at java.io.RandomAccessFile.setLength(Native Method)
+ cleanAllSlices( synchronous );
+ }
+ fileResizeOp.setLength(newTotalSize);
+ if( synchronous ) {
+ // buffers will be synchronized in notifyLengthChangeImpl(..)
+ flushImpl( true /* metaData */, false /* syncBuffer */);
+ }
+ }
+ notifyLengthChangeImpl(newTotalSize, currentPosition);
+ }
+
+ /**
+ * Notify this instance that the underlying {@link FileChannel}'s size has been changed
+ * and adjusting this instances buffer slices and states accordingly.
+ *
+ * Should be called by user API when aware of such event.
+ *
+ * @param newTotalSize the new total size
+ * @throws IOException if a buffer slice operation failed
+ */
+ public final synchronized void notifyLengthChange(final long newTotalSize) throws IOException {
+ notifyLengthChangeImpl(newTotalSize, -1L);
+ }
+ private final synchronized void notifyLengthChangeImpl(final long newTotalSize, final long currentPosition) throws IOException {
+ /* if( DEBUG ) {
+ System.err.println("notifyLengthChange.0: "+totalSize+" -> "+newTotalSize);
+ dbgDump("notifyLengthChange.0:", System.err);
+ } */
+ if( totalSize == newTotalSize ) {
+ // NOP
+ return;
+ } else if( 0 == newTotalSize ) {
+ // ZERO - ensure one entry avoiding NULL checks
+ cleanAllSlices( synchronous );
+ @SuppressWarnings("unchecked")
+ final WeakReference[] newSlices2GC = new WeakReference[ 1 ];
+ slices2GC = newSlices2GC;
+ slices = new ByteBuffer[1];
+ slices[0] = ByteBuffer.allocate(0);
+ sliceCount = 0;
+ totalSize = 0;
+ mark = -1;
+ sliceIdx = 0;
+ } else {
+ final long prePosition = 0 <= currentPosition ? currentPosition : position();
+
+ final long sliceSize = 1L << sliceShift;
+ final int newSliceCount = (int)( ( newTotalSize + ( sliceSize - 1 ) ) / sliceSize );
+ @SuppressWarnings("unchecked")
+ final WeakReference[] newSlices2GC = new WeakReference[ newSliceCount ];
+ final ByteBuffer[] newSlices = new ByteBuffer[ newSliceCount ];
+ final int copySliceCount = Math.min(newSliceCount, sliceCount-1); // drop last (resize)
+ if( 0 <= copySliceCount ) {
+ if( 0 < copySliceCount ) {
+ System.arraycopy(slices2GC, 0, newSlices2GC, 0, copySliceCount);
+ System.arraycopy(slices, 0, newSlices, 0, copySliceCount);
+ }
+ for(int i=copySliceCount; i clipped position (set currSlice and re-map/-pos buffer)
+ }
+ /* if( DEBUG ) {
+ System.err.println("notifyLengthChange.X: "+slices[currSlice]);
+ dbgDump("notifyLengthChange.X:", System.err);
+ } */
+ }
+
+ /**
+ * Similar to {@link OutputStream#flush()}, synchronizes all mapped buffers
+ * from local storage via {@link MappedByteBuffer#force()}
+ * as well as the {@link FileChannel#force(boolean)} w/o {@code metaData}.
+ * @param metaData TODO
+ * @throws IOException if this stream has been {@link #close() closed}.
+ */
+ public final synchronized void flush(final boolean metaData) throws IOException {
+ checkOpen();
+ flushImpl(metaData, true);
+ }
+ private final synchronized void flushImpl(final boolean metaData, final boolean syncBuffer) throws IOException {
+ if( FileChannel.MapMode.READ_ONLY != mmode ) {
+ if( syncBuffer && FileChannel.MapMode.READ_WRITE == mmode ) {
+ for(int i=0; i ref = slices2GC[i];
+ if( null != ref ) {
+ syncSlice(ref.get(), true);
+ }
+ }
+ }
+ fc.force(metaData);
+ }
+ }
+
+
+ /**
+ * Returns a new MappedByteBufferOutputStream instance sharing
+ * all resources of this input stream, including all buffer slices.
+ *
+ * @throws IllegalStateException if attempting to set the {@link FileResizeOp} to a different value than before
+ * @throws IOException if this instance was opened w/ {@link FileChannel.MapMode#READ_ONLY}
+ * or if this stream has been {@link #close() closed}.
+ */
+ public final synchronized MappedByteBufferOutputStream getOutputStream(final FileResizeOp fileResizeOp)
+ throws IllegalStateException, IOException
+ {
+ checkOpen();
+ final MappedByteBufferOutputStream res = new MappedByteBufferOutputStream(this, fileResizeOp);
+ refCount++;
+ return res;
+ }
+
+ /**
+ * Return the mapped {@link ByteBuffer} slice at the current {@link #position()}.
+ *
+ * Due to the nature of using sliced buffers mapping the whole region,
+ * user has to determine whether the returned buffer covers the desired region
+ * and may fetch the {@link #nextSlice()} until satisfied.
+ * It is also possible to repeat this operation after reposition the stream via {@link #position(long)}
+ * or {@link #skip(long)} to a position within the next block, similar to {@link #nextSlice()}.
+ *
+ * @throws IOException if a buffer slice operation failed.
+ */
+ public final synchronized ByteBuffer currentSlice() throws IOException {
+ final ByteBuffer s0 = slices[sliceIdx];
+ if ( null != s0 ) {
+ return s0;
+ } else {
+ if( CacheMode.FLUSH_PRE_SOFT == cmode ) {
+ final WeakReference ref = slices2GC[sliceIdx];
+ if( null != ref ) {
+ final ByteBuffer mbb = ref.get();
+ slices2GC[sliceIdx] = null;
+ slices2GCEntries--;
+ if( null != mbb ) {
+ slices[sliceIdx] = mbb;
+ slicesEntries++;
+ return mbb;
+ }
+ }
+ }
+ final long pos = (long)sliceIdx << sliceShift;
+ final MappedByteBuffer s1 = fc.map(mmode, pos, Math.min(1L << sliceShift, totalSize - pos));
+ slices[sliceIdx] = s1;
+ slicesEntries++;
+ return s1;
+ }
+ }
+
+ /**
+ * Return the next mapped {@link ByteBuffer} slice from the current {@link #position()},
+ * implicitly setting {@link #position(long)} to the start of the returned next slice,
+ * see {@link #currentSlice()}.
+ *
+ * If no subsequent slice is available, {@code null} is being returned.
+ *