Comparar commits
168 Commits
| Autor | SHA1 | Data | |
|---|---|---|---|
| 9e4cfa339b | |||
| f7699b98fb | |||
| 05a8ec1fec | |||
| 004e63c433 | |||
| 898f41b95a | |||
| 859a6a75aa | |||
| b90dae6448 | |||
| dc1ddf4cff | |||
| 46ef5d86c3 | |||
| ac63a6b125 | |||
| 72778c97df | |||
| b4b86081f9 | |||
| e4a47a4ca5 | |||
| 79c60f6d4e | |||
| 4c4d55e0dc | |||
| 9504416beb | |||
| 99586d9b3f | |||
| 65b19cbbd3 | |||
| 7b64f4443d | |||
| abb2e857be | |||
| df10745963 | |||
| 3d729595d1 | |||
| 96a38d1895 | |||
| b4c1390af8 | |||
| e9604ac212 | |||
| ea3a4b34ea | |||
| 79a0d92161 | |||
| b10c40260c | |||
| 9e056d2097 | |||
| 8a250c5994 | |||
| e311ac3269 | |||
| 28078a2d0c | |||
| 7def8c1bbf | |||
| 24ca11387e | |||
| bccc9583c1 | |||
| 9643747b17 | |||
| c695848092 | |||
| 5011613e4c | |||
| 6cc7f69a59 | |||
| db6678637b | |||
| 93892e12a2 | |||
| c196aab89d | |||
| 54a7718b88 | |||
| cec6e6175a | |||
| bc5036bd34 | |||
| 021826eb1b | |||
| facd071967 | |||
| 486e81ad77 | |||
| 872cd3d7c0 | |||
| ca9851b311 | |||
| 2fa0940d45 | |||
| 3485338386 | |||
| 786a821f3f | |||
| da1c9c5ea5 | |||
| 93d8cce7ac | |||
| 5086ba2a3b | |||
| 4cf8611dcd | |||
| 101e9d705a | |||
| 7d8bfa1b62 | |||
| 5dcf9e2f41 | |||
| cdf18b6c4d | |||
| 609ce3b6e0 | |||
| 3ba8be2e21 | |||
| 6b13a97ce4 | |||
| 130e40957e | |||
| a7b28317d7 | |||
| 29fcd0fdcf | |||
| 9d5f63e543 | |||
| 208c28ead2 | |||
| 447d5ee94b | |||
| bb443add17 | |||
| cb954773ed | |||
| 89749c7eb1 | |||
| 30146f8744 | |||
| a623f374b1 | |||
| b41584feb3 | |||
| 77d5bbb767 | |||
| 171d428d3a | |||
| 61254c6cc4 | |||
| 44b3a8952e | |||
| 0fc8c5e7e9 | |||
| 6d969eb92f | |||
| 26ea0f81ca | |||
| dc45e38f11 | |||
| 9d5db40d3f | |||
| 9e25d52679 | |||
| 1f98d4f6ff | |||
| b73883ce1d | |||
| 7af42da5d2 | |||
| cf75057b67 | |||
| e5b1841030 | |||
| 57325a22a5 | |||
| c640166cf8 | |||
| 4b4c362c03 | |||
| c71bfb1602 | |||
| 022e6349c1 | |||
| 917671ac9a | |||
| a108975d78 | |||
| 62d31c5902 | |||
| 5d28314ee3 | |||
| 1b22109f95 | |||
| e5c05bfd66 | |||
| 62e97858d7 | |||
| b9da9b977e | |||
| f121b6c039 | |||
| c48b13bc0a | |||
| 26abb9beb9 | |||
| 02cc7d53b7 | |||
| 67136b5986 | |||
| 58d5175fde | |||
| c511c4063e | |||
| 6429611b3c | |||
| 3cea53ddca | |||
| d661e58fc3 | |||
| e140b6e4e2 | |||
| e1025d9337 | |||
| f1acc483c3 | |||
| 0e25e979a2 | |||
| 0c129ff02e | |||
| 05234082a9 | |||
| bdc44962a1 | |||
| e96a59965e | |||
| 507f3fc74b | |||
| 22d997fcd9 | |||
| 89a98ca51b | |||
| 9834abe3ab | |||
| 54ffc2c138 | |||
| 4785c4f11e | |||
| 9d5b0deb61 | |||
| 9c0b540ddc | |||
| c124a9f2b8 | |||
| 8b0e08f9df | |||
| 9ee115d1a0 | |||
| a7ebf431a8 | |||
| d85330d54a | |||
| f8f93c7351 | |||
| ee1fd4944f | |||
| 5117fa06b8 | |||
| 2ac1552bf7 | |||
| 94c2647d25 | |||
| 6b2f067435 | |||
| 3e2471d0a0 | |||
| f0b1d33398 | |||
| bae955f7c5 | |||
| b747e71583 | |||
| 48160da4b7 | |||
| d17df6a9db | |||
| df7a9ec977 | |||
| f2157420f2 | |||
| ae9c56416f | |||
| 1dec6a541a | |||
| c75157ffd8 | |||
| fa77d03fea | |||
| 618f4c533c | |||
| 9b77631dd5 | |||
| 7aa22df1e2 | |||
| ee0ff79820 | |||
| ca772e8a9c | |||
| 8af05c14be | |||
| 20f230e910 | |||
| 8af51875b6 | |||
| a4ead757f6 | |||
| 0cc6bc9e2e | |||
| 00a551d2b1 | |||
| b6f1652aab | |||
| b304555389 | |||
| 456af457bb | |||
| e9cb67844d |
+8
-8
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" output="build.eclipse/test-classes" path="test"/>
|
||||
<classpathentry kind="lib" path="lib/junit.jar" sourcepath="/DEV/junit/src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JDK 1.5.0"/>
|
||||
<classpathentry kind="output" path="build.eclipse/classes"/>
|
||||
</classpath>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" output="build.eclipse/test-classes" path="test"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JDK 1.5"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/>
|
||||
<classpathentry kind="output" path="build.eclipse/classes"/>
|
||||
</classpath>
|
||||
|
||||
+18
-9
@@ -3,14 +3,14 @@
|
||||
this means no java object arguments to callbacks; use some sort of integer
|
||||
key instead (hashcode?) callbacks can hold local data anyway...
|
||||
o make simplest Java usage map to most common C usage
|
||||
- additional constructs provided for esoteric cases (WString)
|
||||
- additional constructs provided for less-common cases
|
||||
(WString,Structure.ByValue/ByReference)
|
||||
o structure is treated as a pointer, except within a struct
|
||||
o primitive types are passed directly
|
||||
o arrays are treated as pointers, except within a struct
|
||||
- in structure (inline; otherwise pointer-to-X should be used)
|
||||
- as function argument (auto-convert to pointer via Memory)
|
||||
- pointer to type in struct should be handled with Pointer
|
||||
- how to do pointer to struct in struct? (Pointer to start with)
|
||||
o pointer to type in struct should use Pointer or ByReference
|
||||
o "free" should be invisible wherever possible
|
||||
|
||||
# FUTURE DEMOS:
|
||||
@@ -22,18 +22,24 @@
|
||||
|
||||
# TODO
|
||||
|
||||
* write structure to contiguous Java array, then write all at once to minimize
|
||||
native calls. Otherwise, structs with lots of fields take a big performance
|
||||
hit making a native call for each field.
|
||||
|
||||
* parser (gluegen? swig? others?) to auto-generate JNA interfaces from headers;
|
||||
ideally get the native library build system to output preprocessed headers,
|
||||
otherwise CPP crap is a nightmare to get right.
|
||||
o write SWIG transformer to auto-generate interfaces from header files
|
||||
|
||||
* stdcall/w32 underscore prefix issue
|
||||
|
||||
* should structure offsets be "long"?
|
||||
|
||||
* allow return of W/String[] or Pointer[], if NULL-terminated?
|
||||
* allow return of W/String[] or Pointer[], if array is NULL-terminated?
|
||||
|
||||
* Direct buffers should be used where
|
||||
hotspot inlining can improve performance.
|
||||
|
||||
* use libffi closure allocation/deallocation
|
||||
|
||||
* parser (gluegen? others?) to auto-generate JNA interfaces from headers;
|
||||
ideally get the native library build system to output preprocessed headers,
|
||||
otherwise CPP crap is a nightmare to get right.
|
||||
|
||||
* (maybe) move all native functions into Native (limit header files, easier
|
||||
management)
|
||||
@@ -128,6 +134,9 @@
|
||||
|
||||
|
||||
# DONE
|
||||
* embed version in DLL ('depends'-done)/so (symlink?)
|
||||
* use libffi closure allocation/deallocation
|
||||
|
||||
* ensure Library options are passed to NativeFunctionHandler
|
||||
(needs getLibraryOptions(Class cls))
|
||||
|
||||
|
||||
+167
-82
@@ -17,6 +17,8 @@
|
||||
<property name="jar" value="${name}.jar"/>
|
||||
<property name="debug" value="true"/>
|
||||
<property name="debug.native" value="false"/>
|
||||
<property name="cflags_extra.native" value=""/>
|
||||
<property name="dynlink.native" value="false"/>
|
||||
<property name="native" location="native"/>
|
||||
<property name="src" location="src"/>
|
||||
<property name="dist" location="dist"/>
|
||||
@@ -26,18 +28,27 @@
|
||||
<property name="stylesheet" location="${javadoc}/doc/css/javadoc.css"/>
|
||||
<property name="vendor" value="JNA Development Team"/>
|
||||
<property name="copyright"
|
||||
value="Copyright &copy; 2007 Timothy Wall. All Rights Reserved."/>
|
||||
value="Copyright &copy; 2007-2008 Timothy Wall. All Rights Reserved."/>
|
||||
<buildnumber/>
|
||||
<!-- JNA library release version -->
|
||||
<property name="jna.version" value="3.0"/>
|
||||
<property name="jna.major" value="3"/>
|
||||
<property name="jna.minor" value="0"/>
|
||||
<property name="jna.revision" value="5"/>
|
||||
<property name="jna.build" value="${build.number}"/>
|
||||
<property name="jna.version" value="${jna.major}.${jna.minor}.${jna.revision}"/>
|
||||
<!-- jnidispatch library release version -->
|
||||
<property name="jni.version" value="3.0"/>
|
||||
<property name="jni.major" value="3"/>
|
||||
<property name="jni.minor" value="0"/>
|
||||
<property name="jni.revision" value="4"/>
|
||||
<property name="jni.build" value="${build.number}"/>
|
||||
<property name="jni.version" value="${jni.major}.${jni.minor}.${jni.revision}"/>
|
||||
<property name="jni.md5" value="892beacd437514d23ed9b1cefeb2ead6"/>
|
||||
<property name="spec.title" value="Java Native Access (JNA)"/>
|
||||
<property name="spec.vendor" value="${vendor}"/>
|
||||
<property name="spec.version" value="${jna.version}"/>
|
||||
<property name="impl.title" value="${spec.title}"/>
|
||||
<property name="spec.version" value="${jna.major}"/>
|
||||
<property name="impl.title" value="com.sun.jna"/>
|
||||
<property name="impl.vendor" value="${spec.vendor}"/>
|
||||
<property name="impl.version" value="${spec.version}"/>
|
||||
<property name="impl.version" value="${jna.version} b${jna.build}"/>
|
||||
|
||||
<property name="compatibility" value="1.4"/>
|
||||
<property name="test.compatibility" value="1.5"/>
|
||||
@@ -47,10 +58,32 @@
|
||||
|
||||
<target name="default" depends="test" description="Build and Test."/>
|
||||
|
||||
<import file="nbproject/profiler-build-impl.xml"/>
|
||||
<target name="init" depends="-setup"/>
|
||||
<target name="compile-test-single" depends="compile-tests"/>
|
||||
<target name="compile-single" depends="compile"/>
|
||||
|
||||
<target name="-dynamic-properties">
|
||||
<echo>Java version: ${java.version}, compatibility: ${compatibility}</echo>
|
||||
<echo>JNA version ${jna.version}, native API version ${jni.version}</echo>
|
||||
<property name="build" value="build"/>
|
||||
|
||||
<replaceregexp match="(<version>).*(</version>)"
|
||||
replace="\1${jna.version}\2"
|
||||
file="pom.xml"/>
|
||||
|
||||
<condition property="jar.omitted" value="**/*jnidispatch*" else="jnilib-included">
|
||||
<isset property="omit-jnilib"/>
|
||||
</condition>
|
||||
<condition property="vm.arch" value="-d64" else="">
|
||||
<or>
|
||||
<equals arg1="${sun.arch.data.model}" arg2="64" trim="true"/>
|
||||
<os arch="x86_64"/>
|
||||
<os arch="ppc64"/>
|
||||
<os arch="sparcv9"/>
|
||||
<os arch="amd64"/>
|
||||
</or>
|
||||
</condition>
|
||||
<property name="build" value="build${vm.arch}"/>
|
||||
<property name="classes" location="${build}/classes"/>
|
||||
<property name="eclipse.classes" location="build.eclipse/classes"/>
|
||||
<property name="test.classes" location="${build}/test-classes"/>
|
||||
@@ -60,6 +93,14 @@
|
||||
<condition property="os.prefix" value="win32-${os.arch}">
|
||||
<os family="windows"/>
|
||||
</condition>
|
||||
<condition property="os.prefix" value="linux-i386">
|
||||
<!-- IBM's J9 reports 'x86' -->
|
||||
<and><os name="Linux"/><os arch="x86"/></and>
|
||||
</condition>
|
||||
<condition property="os.prefix" value="linux-amd64">
|
||||
<!-- Debian reports 'x86_64' -->
|
||||
<and><os name="Linux"/><os arch="x86_64"/></and>
|
||||
</condition>
|
||||
<condition property="os.prefix" value="linux-${os.arch}">
|
||||
<os name="Linux"/>
|
||||
</condition>
|
||||
@@ -73,6 +114,9 @@
|
||||
<condition property="os.prefix" value="freebsd-${os.arch}">
|
||||
<os name="FreeBSD"/>
|
||||
</condition>
|
||||
<condition property="os.prefix" value="openbsd-${os.arch}">
|
||||
<os name="OpenBSD"/>
|
||||
</condition>
|
||||
<fail unless="os.prefix" message="OS/arch not supported (${os.name}/${os.arch}), edit build.xml and native/Makefile to add it."/>
|
||||
<condition property="jdk.home" value="${java.home}">
|
||||
<available file="${java.home}/include"/>
|
||||
@@ -115,7 +159,7 @@
|
||||
<pathelement path="${build}/${jar}"/>
|
||||
<pathelement path="${build}/examples.jar"/>
|
||||
<pathelement path="${test.classes}"/>
|
||||
<pathelement path="${ant.home}/lib/clover.jar"/>
|
||||
<pathelement path="lib/clover.jar"/>
|
||||
<path refid="test.libs"/>
|
||||
</path>
|
||||
</target>
|
||||
@@ -147,15 +191,19 @@
|
||||
description="Build primary jar">
|
||||
<jar jarfile="${build}/${jar}">
|
||||
<manifest>
|
||||
<attribute name="Implementation-Title" value="${impl.title}"/>
|
||||
<attribute name="Implementation-Vendor" value="${vendor}"/>
|
||||
<attribute name="Implementation-Version" value="${impl.version}"/>
|
||||
<attribute name="Specification-Title" value="${spec.title}"/>
|
||||
<attribute name="Specification-Vendor" value="${spec.vendor}"/>
|
||||
<attribute name="Specification-Version" value="${spec.version}"/>
|
||||
<attribute name="Main-Class" value="com.sun.jna.Native"/>
|
||||
<section name="com/sun/jna/">
|
||||
<attribute name="Implementation-Title" value="${impl.title}"/>
|
||||
<attribute name="Implementation-Vendor" value="${vendor}"/>
|
||||
<attribute name="Implementation-Version" value="${impl.version}"/>
|
||||
<attribute name="Specification-Title" value="${spec.title}"/>
|
||||
<attribute name="Specification-Vendor" value="${spec.vendor}"/>
|
||||
<attribute name="Specification-Version" value="${spec.version}"/>
|
||||
</section>
|
||||
</manifest>
|
||||
<fileset dir="${classes}"><patternset refid="jar-compiled"/></fileset>
|
||||
<fileset dir="${classes}" excludes="${jar.omitted}">
|
||||
<patternset refid="jar-compiled"/>
|
||||
</fileset>
|
||||
</jar>
|
||||
</target>
|
||||
<target name="examples" depends="jar,native">
|
||||
@@ -179,7 +227,15 @@
|
||||
<class name="com.sun.jna.NativeLibrary"/>
|
||||
<class name="com.sun.jna.CallbackReference"/>
|
||||
</javah>
|
||||
<apply dir="${build.native}" executable="grep" parallel="true" relative="true" output="${md5.file}">
|
||||
<condition property="grep" value="/usr/sfw/bin/ggrep">
|
||||
<os name="SunOS"/>
|
||||
</condition>
|
||||
<condition property="grep" value="ggrep">
|
||||
<os name="OpenBSD"/>
|
||||
</condition>
|
||||
<property name="grep" value="grep"/>
|
||||
<apply dir="${build.native}" executable="${grep}" parallel="true"
|
||||
failonerror="true" relative="true" output="${md5.file}">
|
||||
<arg value="-A"/>
|
||||
<arg value="1"/>
|
||||
<arg value="JNIEXPORT"/>
|
||||
@@ -200,7 +256,10 @@
|
||||
<copy file="${dist}/out-of-date.jar" tofile="${dist}/linux-i386.jar" overwrite="true"/>
|
||||
<copy file="${dist}/out-of-date.jar" tofile="${dist}/linux-amd64.jar" overwrite="true"/>
|
||||
<copy file="${dist}/out-of-date.jar" tofile="${dist}/freebsd-i386.jar" overwrite="true"/>
|
||||
<copy file="${dist}/out-of-date.jar" tofile="${dist}/freebsd-amd64.jar" overwrite="true"/>
|
||||
<copy file="${dist}/out-of-date.jar" tofile="${dist}/openbsd-i386.jar" overwrite="true"/>
|
||||
<copy file="${dist}/out-of-date.jar" tofile="${dist}/sunos-x86.jar" overwrite="true"/>
|
||||
<copy file="${dist}/out-of-date.jar" tofile="${dist}/sunos-amd64.jar" overwrite="true"/>
|
||||
<copy file="${dist}/out-of-date.jar" tofile="${dist}/sunos-sparc.jar" overwrite="true"/>
|
||||
<copy file="${dist}/out-of-date.jar" tofile="${dist}/sunos-sparcv9.jar" overwrite="true"/>
|
||||
<delete failOnError="false" includeEmptyDirs="true">
|
||||
@@ -209,7 +268,33 @@
|
||||
<fail>API for native code has changed. Re-run this build after updating jni.version and jni.md5 in build.xml</fail>
|
||||
</target>
|
||||
|
||||
<target name="native" depends="-setup,javah,-native-api-check"
|
||||
<target name=":rsrc">
|
||||
<condition property="-rsrc">
|
||||
<not><os family="windows"/></not>
|
||||
</condition>
|
||||
</target>
|
||||
<target name="rsrc" depends="-setup,:rsrc" unless="-rsrc"
|
||||
description="Generate w32 DLL version resource information">
|
||||
<property name="rsrc" location="${build.native}/jnidispatch.rc"/>
|
||||
<copy todir="${build.native}" file="${native}/jnidispatch.rc"/>
|
||||
<replaceregexp match="FILEVERSION.*"
|
||||
replace="FILEVERSION ${jni.major},${jni.minor},${jni.revision},${jni.build}"
|
||||
file="${rsrc}" byline="true"/>
|
||||
<replaceregexp match="PRODUCTVERSION.*"
|
||||
replace="PRODUCTVERSION ${jna.major},${jna.minor},${jna.revision},${jna.build}"
|
||||
file="${rsrc}" byline="true"/>
|
||||
<replaceregexp match="FileVersion.*"
|
||||
replace="FileVersion","${jni.version}""
|
||||
file="${rsrc}" byline="true"/>
|
||||
<replaceregexp match="Full Version.*"
|
||||
replace="Full Version","${jni.version} b${jni.build}""
|
||||
file="${rsrc}" byline="true"/>
|
||||
<replaceregexp match="ProductVersion.*"
|
||||
replace="ProductVersion","${spec.version}""
|
||||
file="${rsrc}" byline="true"/>
|
||||
</target>
|
||||
|
||||
<target name="native" depends="-setup,javah,-native-api-check,rsrc"
|
||||
description="Build native libraries. Use 'ant -DCC=xxx' to build using a compiler other than gcc">
|
||||
<property name="comment" value="# auto-generated by ant"/>
|
||||
<replaceregexp match="^VERSION=.*"
|
||||
@@ -218,14 +303,9 @@
|
||||
<replaceregexp match="^CHECKSUM=.*"
|
||||
replace="CHECKSUM=${jni.md5} ${comment}"
|
||||
file="native/Makefile" byline="true"/>
|
||||
<!-- ensure ARCH is set properly for various platforms -->
|
||||
<!-- ARCH is used in native/Makefile to find the JAWT library -->
|
||||
<condition property="ARCH" value="${os.arch}">
|
||||
<or>
|
||||
<os name="SunOS"/>
|
||||
<os arch="amd64"/>
|
||||
</or>
|
||||
</condition>
|
||||
<!-- ensure ARCH is set properly for 64-bit capable platforms -->
|
||||
<!-- use ANT_OPTS=-d64 to build 64-bit if not the platform default -->
|
||||
<property name="ARCH" value="${os.arch}"/>
|
||||
<condition property="make.CC" value="CC=${CC}" else="IGNORE=">
|
||||
<isset property="CC"/>
|
||||
</condition>
|
||||
@@ -235,7 +315,12 @@
|
||||
<condition property="make.SDKROOT" value="SDKROOT=${SDKROOT}">
|
||||
<isset property="SDKROOT"/>
|
||||
</condition>
|
||||
<condition property="make.SDKROOT" value="SDKROOT=/Developer/SDKs/MacOSX10.4u.sdk" else="IGNORE=">
|
||||
<condition property="make.SDKROOT"
|
||||
value="SDKROOT=/Developer/SDKs/MacOSX10.5.sdk">
|
||||
<available file="/Developer/SDKs/MacOSX10.5.sdk"/>
|
||||
</condition>
|
||||
<condition property="make.SDKROOT"
|
||||
value="SDKROOT=/Developer/SDKs/MacOSX10.4u.sdk" else="IGNORE=">
|
||||
<available file="/Developer/SDKs/MacOSX10.4u.sdk"/>
|
||||
</condition>
|
||||
<!-- Windows' drive letters and spaces in absolute paths wreak havoc on
|
||||
@@ -250,7 +335,10 @@
|
||||
<os name="SunOS"/>
|
||||
</condition>
|
||||
<condition property="make" value="gmake">
|
||||
<os name="FreeBSD"/>
|
||||
<or>
|
||||
<os name="FreeBSD"/>
|
||||
<os name="OpenBSD"/>
|
||||
</or>
|
||||
</condition>
|
||||
<!-- Default make program -->
|
||||
<property name="make" value="make"/>
|
||||
@@ -259,6 +347,8 @@
|
||||
<arg value="JAVA_HOME=${jdk.home}"/>
|
||||
<arg value="JAVAH=${build.native}"/>
|
||||
<arg value="DEBUG=${debug.native}"/>
|
||||
<arg value="CFLAGS_EXTRA=${cflags_extra.native}"/>
|
||||
<arg value="DYNAMIC_LIBFFI=${dynlink.native}"/>
|
||||
<arg value="${make.CC}"/>
|
||||
<arg value="${make.BUILD}"/>
|
||||
<arg value="${make.SDKROOT}"/>
|
||||
@@ -269,12 +359,13 @@
|
||||
</exec>
|
||||
<mkdir dir="${classes}/com/sun/jna/${os.prefix}"/>
|
||||
<copy todir="${classes}/com/sun/jna/${os.prefix}">
|
||||
<fileset dir="${build.native}"
|
||||
<fileset dir="${build.native}"
|
||||
includes="jnidispatch.dll,libjnidispatch.*"/>
|
||||
</copy>
|
||||
<mkdir dir="${eclipse.classes}/com/sun/jna/${os.prefix}"/>
|
||||
<copy todir="${eclipse.classes}/com/sun/jna/${os.prefix}"
|
||||
failonerror="false">
|
||||
<fileset dir="${build.native}"
|
||||
<fileset dir="${build.native}"
|
||||
includes="jnidispatch.dll,libjnidispatch.*"/>
|
||||
</copy>
|
||||
<!-- For web start, native libraries may be provided in the root of -->
|
||||
@@ -282,7 +373,7 @@
|
||||
<jar jarfile="${build}/${native.jar}">
|
||||
<fileset dir="${build.native}" includes="jnidispatch.dll,libjnidispatch.*"/>
|
||||
<manifest>
|
||||
<attribute name="Implementation-Version" value="${jni.version}"/>
|
||||
<attribute name="Implementation-Version" value="${jni.version} b${jni.build}"/>
|
||||
<attribute name="Specification-Version" value="${jni.version}"/>
|
||||
</manifest>
|
||||
</jar>
|
||||
@@ -300,7 +391,7 @@
|
||||
</target>
|
||||
|
||||
<!-- When running tests from an IDE, be sure to set jna.library.path -->
|
||||
<!-- to where the test library (testlib) is found -->
|
||||
<!-- to where the test library (testlib) is found. Also need to add -Ddir.build.suffix=-d64 for 64-bit JVMs. -->
|
||||
<target name="test" depends="jar,examples,compile-tests"
|
||||
description="Run all unit tests">
|
||||
<property name="test.fork" value="yes"/>
|
||||
@@ -317,9 +408,19 @@
|
||||
<not><os family="mac"/></not>
|
||||
</and>
|
||||
</condition>
|
||||
<condition property="vmopt.arch" value="-d64" else="-Dignore">
|
||||
<equals arg1="${vm.arch}" arg2="-d64" trim="true"/>
|
||||
</condition>
|
||||
<condition property="dir.build.suffix" value="-d64" else="">
|
||||
<equals arg1="${vm.arch}" arg2="-d64" trim="true"/>
|
||||
</condition>
|
||||
<property name="tests.platform" value=""/>
|
||||
<junit printsummary="yes" fork="${test.fork}" failureproperty="testfailure">
|
||||
<jvmarg value="-Djna.library.path=${build.native}"/>
|
||||
<!-- Avoid VM crashes, if possible -->
|
||||
<jvmarg value="-Djna.protected=true"/>
|
||||
<jvmarg value="-Ddir.build.suffix=${dir.build.suffix}"/>
|
||||
<jvmarg value="${vmopt.arch}"/>
|
||||
<classpath><path refid="test.runpath"/></classpath>
|
||||
<formatter type="xml"/>
|
||||
<batchtest todir="${results.junit}">
|
||||
@@ -342,18 +443,10 @@
|
||||
</target>
|
||||
|
||||
<target name="with.clover" description="Enable code coverage for tests">
|
||||
<taskdef resource="clovertasks"/>
|
||||
<taskdef resource="cloverlib.xml" classpath="lib/clover.jar"/>
|
||||
<property name="clover" value="true"/>
|
||||
<property name="build" value="build.clover"/>
|
||||
<property name="clover.include" value="**/*.java"/>
|
||||
<property name="clover.exclude" value="**/examples/**/*.java"/>
|
||||
<property name="tests.exclude" value="${clover.exclude}"/>
|
||||
<clover-setup initString="${build}/coverage.db">
|
||||
<fileset dir="${src}">
|
||||
<include name="${clover.include}"/>
|
||||
<exclude name="${clover.exclude}"/>
|
||||
</fileset>
|
||||
</clover-setup>
|
||||
<clover-setup/>
|
||||
</target>
|
||||
|
||||
<target name="clover" depends="with.clover,test"
|
||||
@@ -362,6 +455,8 @@
|
||||
<mkdir dir="${reports.clover}"/>
|
||||
<clover-report>
|
||||
<current outfile="${reports.clover}" title="clover">
|
||||
<fileset dir="." includes="**/*.java" excludes="**/examples/**/*.java"/>
|
||||
<testresults dir="${results.junit}" includes="TEST-*.xml"/>
|
||||
<format type="html"/>
|
||||
</current>
|
||||
</clover-report>
|
||||
@@ -405,8 +500,19 @@
|
||||
</target>
|
||||
|
||||
<target name="dist" depends="jar,compile-tests,native,examples,javadoc"
|
||||
description="Build examples">
|
||||
description="Build distribution files">
|
||||
<jar jarfile="${dist}/jna.jar" duplicate="preserve">
|
||||
<manifest>
|
||||
<attribute name="Main-Class" value="com.sun.jna.Native"/>
|
||||
<section name="com/sun/jna/">
|
||||
<attribute name="Implementation-Title" value="${impl.title}"/>
|
||||
<attribute name="Implementation-Vendor" value="${vendor}"/>
|
||||
<attribute name="Implementation-Version" value="${impl.version}"/>
|
||||
<attribute name="Specification-Title" value="${spec.title}"/>
|
||||
<attribute name="Specification-Vendor" value="${spec.vendor}"/>
|
||||
<attribute name="Specification-Version" value="${spec.version}"/>
|
||||
</section>
|
||||
</manifest>
|
||||
<zipfileset src="${build}/${jar}"/>
|
||||
<zipfileset src="${dist}/win32-x86.jar"
|
||||
includes="*jnidispatch*"
|
||||
@@ -423,6 +529,9 @@
|
||||
<zipfileset src="${dist}/sunos-x86.jar"
|
||||
includes="*jnidispatch*"
|
||||
prefix="com/sun/jna/sunos-x86"/>
|
||||
<zipfileset src="${dist}/sunos-amd64.jar"
|
||||
includes="*jnidispatch*"
|
||||
prefix="com/sun/jna/sunos-amd64"/>
|
||||
<zipfileset src="${dist}/sunos-sparc.jar"
|
||||
includes="*jnidispatch*"
|
||||
prefix="com/sun/jna/sunos-sparc"/>
|
||||
@@ -432,6 +541,12 @@
|
||||
<zipfileset src="${dist}/freebsd-i386.jar"
|
||||
includes="*jnidispatch*"
|
||||
prefix="com/sun/jna/freebsd-i386"/>
|
||||
<zipfileset src="${dist}/freebsd-amd64.jar"
|
||||
includes="*jnidispatch*"
|
||||
prefix="com/sun/jna/freebsd-amd64"/>
|
||||
<zipfileset src="${dist}/openbsd-i386.jar"
|
||||
includes="*jnidispatch*"
|
||||
prefix="com/sun/jna/openbsd-i386"/>
|
||||
</jar>
|
||||
<copy todir="${dist}">
|
||||
<fileset dir="${build}">
|
||||
@@ -442,11 +557,20 @@
|
||||
<zip zipfile="${dist}/doc.zip">
|
||||
<zipfileset dir="${javadoc}" prefix="javadoc"/>
|
||||
</zip>
|
||||
<!-- JNA sources only, for use in Linux build from source -->
|
||||
<zip zipfile="${dist}/src.zip">
|
||||
<zipfileset dir="." includes="build.xml"/>
|
||||
<zipfileset dir="${src}" includes="**/*.java" prefix="src"/>
|
||||
<zipfileset dir="${test.src}" includes="**/*.java" prefix="test"/>
|
||||
<zipfileset dir="${native}" prefix="native"/>
|
||||
<zipfileset dir="${native}" excludes="libffi,libffi/**/*" prefix="native"/>
|
||||
</zip>
|
||||
<!-- Full sources required to build and test everything -->
|
||||
<zip zipfile="${dist}/src-full.zip">
|
||||
<zipfileset src="${dist}/src.zip"/>
|
||||
<zipfileset dir="lib" includes="junit.jar" prefix="lib"/>
|
||||
<zipfileset dir="." includes=".classpath,.project"/>
|
||||
<zipfileset dir="nbproject" includes="**/*" prefix="nbproject"/>
|
||||
<zipfileset dir="${native}" includes="libffi,libffi/**/*" prefix="native"/>
|
||||
</zip>
|
||||
</target>
|
||||
|
||||
@@ -460,45 +584,6 @@
|
||||
</delete>
|
||||
</target>
|
||||
|
||||
<target name="profile-single" depends="examples" description="Profile Class">
|
||||
<fail unless="netbeans.home">This target can only run inside the NetBeans IDE.</fail>
|
||||
<nbprofiledirect>
|
||||
<classpath> <pathelement location="${build}/examples.jar"/> </classpath>
|
||||
</nbprofiledirect>
|
||||
<java classname="${main.class}" fork="true">
|
||||
<jvmarg value="${profiler.info.jvmargs.agent}"/>
|
||||
<jvmarg value="${profiler.info.jvmargs}"/>
|
||||
<jvmarg value="-Djna.library.path=${build.native}"/>
|
||||
<classpath>
|
||||
<pathelement location="${build}/examples.jar"/>
|
||||
</classpath>
|
||||
</java>
|
||||
</target>
|
||||
|
||||
<target name="profile-test-single" depends="examples,compile-tests"
|
||||
description="Profile Test Class">
|
||||
<fail unless="netbeans.home">This target can only run inside the NetBeans IDE.</fail>
|
||||
<nbprofiledirect>
|
||||
<classpath>
|
||||
<pathelement location="${build}/examples.jar"/>
|
||||
<pathelement location="${test.classes}"/>
|
||||
</classpath>
|
||||
</nbprofiledirect>
|
||||
<junit dir="${build.native}" jvm="${profiler.info.jvm}"
|
||||
failureproperty="tests.failed" errorproperty="tests.failed" fork="true">
|
||||
<jvmarg value="${profiler.info.jvmargs.agent}"/>
|
||||
<jvmarg value="${profiler.info.jvmargs}"/>
|
||||
<jvmarg value="-Djna.library.path=${build.native}"/>
|
||||
<test name="${profile.class}"/>
|
||||
<classpath>
|
||||
<pathelement location="${build}/examples.jar"/>
|
||||
<pathelement location="${test.classes}"/>
|
||||
</classpath>
|
||||
<formatter type="brief" usefile="false"/>
|
||||
<formatter type="xml"/>
|
||||
</junit>
|
||||
</target>
|
||||
|
||||
</project>
|
||||
|
||||
|
||||
|
||||
externo
BIN
Arquivo binário não exibido.
externo
BIN
Arquivo binário não exibido.
externo
BIN
Arquivo binário não exibido.
externo
BIN
Arquivo binário não exibido.
externo
BIN
Arquivo binário não exibido.
externo
BIN
Arquivo binário não exibido.
externo
BIN
Arquivo binário não exibido.
externo
BIN
Arquivo binário não exibido.
externo
BIN
Arquivo binário não exibido.
externo
BIN
Arquivo binário não exibido.
externo
BIN
Arquivo binário não exibido.
externo
BIN
Arquivo binário não exibido.
externo
BIN
Arquivo binário não exibido.
externo
BIN
Arquivo binário não exibido.
externo
BIN
Arquivo binário não exibido.
externo
BIN
Arquivo binário não exibido.
Arquivo binário não exibido.
@@ -0,0 +1,5 @@
|
||||
nQMpVtdkeiLDhkfVhlebsGWVMnsDeqDAmHuaUJSRUxwraf
|
||||
mi2K4SaejnjOrPDIm3nJq8<b2Ke>wQwCu3>RYeCLGxFda>
|
||||
PRoQxwONRmmnMpmQRPQvuNmQoQpMQRMpOnSSTxXMvwWmvu
|
||||
VtqwVvXwqqRnmqmUUnnvuvvqqmmmmmUUnnvuvvqqmmmmmU
|
||||
UgkXkabskgXsXkkbqUUnmm
|
||||
+79
-43
@@ -10,10 +10,10 @@
|
||||
# Supported platforms (built and tested):
|
||||
#
|
||||
# Windows 2000/XP/2003/Vista (x86)
|
||||
# OS X (i386/ppc)
|
||||
# Linux (i386, amd64)
|
||||
# Solaris (i386, sparc, sparcv9)
|
||||
# FreeBSD (i386)
|
||||
# Darwin/OS X (i386/x86_64/ppc)
|
||||
# Linux (i386/amd64)
|
||||
# Solaris (i386/amd64/sparc/sparcv9)
|
||||
# FreeBSD (i386/amd64)
|
||||
#
|
||||
|
||||
# Systems which support POSIX signals may be able to support VM crash
|
||||
@@ -23,10 +23,11 @@
|
||||
OS=$(shell uname | sed -e 's/\(CYGWIN\|MINGW32\).*/win32/g' \
|
||||
-e 's/SunOS.*/solaris/g' \
|
||||
-e 's/FreeBSD.*/freebsd/g' \
|
||||
-e 's/OpenBSD.*/openbsd/g' \
|
||||
-e 's/Darwin.*/darwin/g' \
|
||||
-e 's/Linux.*/linux/g')
|
||||
|
||||
VERSION=3.0 # auto-generated by ant
|
||||
VERSION=3.0.4 # auto-generated by ant
|
||||
CHECKSUM=892beacd437514d23ed9b1cefeb2ead6 # auto-generated by ant
|
||||
|
||||
JAVA_INCLUDES=-I"$(JAVA_HOME)/include" \
|
||||
@@ -36,12 +37,14 @@ LIBDIR=$(JAVA_HOME)/jre/lib/$(ARCH)
|
||||
BUILD=../build/native
|
||||
JAVAH=$(BUILD)
|
||||
INSTALLDIR=../build/$(OS)
|
||||
JNIDISPATCH_OBJS=$(BUILD)/dispatch.o \
|
||||
$(BUILD)/callback.o
|
||||
JNIDISPATCH_OBJS=$(BUILD)/dispatch.o $(BUILD)/callback.o $(EXTRAOBJS)
|
||||
RSRC=$(BUILD)/rsrc.o
|
||||
ifneq ($(DYNAMIC_LIBFFI),true)
|
||||
FFI_SRC=$(shell pwd)/libffi
|
||||
FFI_BUILD=$(BUILD)/libffi
|
||||
FFI_LIB=$(FFI_BUILD)/.libs/libffi_convenience.a
|
||||
FFI_CONFIG=--disable-static --with-pic=yes
|
||||
endif
|
||||
LIBRARY=$(BUILD)/$(LIBPFX)jnidispatch$(JNISFX)
|
||||
TESTLIB=$(BUILD)/$(LIBPFX)testlib$(LIBSFX)
|
||||
|
||||
@@ -51,6 +54,7 @@ LIBSFX=.so
|
||||
JNISFX=$(LIBSFX)
|
||||
CC=gcc
|
||||
LD=gcc
|
||||
LIBS=
|
||||
# Default to Sun recommendations for JNI compilation
|
||||
#COPT=-O2 -fomit-frame-pointer
|
||||
COPT=-fno-omit-frame-pointer -fno-strict-aliasing
|
||||
@@ -58,14 +62,21 @@ CASM=-S
|
||||
ifeq ($(DEBUG),true)
|
||||
CDEBUG=-g
|
||||
endif
|
||||
CFLAGS_EXTRA=
|
||||
COUT=-o $@
|
||||
CINCLUDES=$(JAVA_INCLUDES) -I"$(JAVAH)" -I$(FFI_BUILD)/include
|
||||
CDEFINES=-D_REENTRANT
|
||||
PCFLAGS=-W -Wall -Wno-unused -Wno-parentheses
|
||||
CFLAGS=$(PCFLAGS) $(COPT) $(CDEBUG) $(CDEFINES) $(CINCLUDES) \
|
||||
CFLAGS=$(PCFLAGS) $(CFLAGS_EXTRA) $(COPT) $(CDEBUG) $(CDEFINES) $(CINCLUDES) \
|
||||
-DVERSION='"$(VERSION)"' -DCHECKSUM='"$(CHECKSUM)"'
|
||||
LDFLAGS=-o $@ -shared
|
||||
ifeq ($(DYNAMIC_LIBFFI),true)
|
||||
CFLAGS += $(shell pkg-config --cflags libffi 2>/dev/null || echo)
|
||||
LIBS += $(shell pkg-config --libs libffi 2>/dev/null || echo -lffi)
|
||||
else
|
||||
# -static-libgcc avoids gcc library incompatibilities across linux systems
|
||||
LDFLAGS=-o $@ -shared -Wl,-soname,$@ -static-libgcc
|
||||
LDFLAGS += -static-libgcc
|
||||
endif
|
||||
# Avoid bug in X11-based 1.5/1.6 VMs; dynamically load instead of linking
|
||||
# See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6539705
|
||||
#LIBS=-L"$(LIBDIR)" -ljawt
|
||||
@@ -75,7 +86,8 @@ STRIP=strip -x
|
||||
ifeq ($(OS),win32)
|
||||
# Uncomment this line to use MSVC (doesn't yet work with libffi)
|
||||
#CC=cl
|
||||
ARCH=$(shell uname -m | sed 's/i[456]86/i386/g')
|
||||
ARCH=$(shell uname -m | sed 's/i.86/i386/g')
|
||||
CDEFINES=-DHAVE_PROTECTION
|
||||
|
||||
ifeq ($(CC),cl)
|
||||
LD=link
|
||||
@@ -86,7 +98,6 @@ DBG=d
|
||||
CDEBUG=-D_DEBUG -GZ -Zi
|
||||
endif
|
||||
COUT=-Fo$@
|
||||
CDEFINES=-DWIN32 -D_WINDOWS -D_MBCS -D_USRDLL -DNATIVE_EXPORTS
|
||||
PCFLAGS=-nologo -MD$(DBG) -W3 -WX -GX -YX -Fd$(@D)/$* -Fp$(@D)/$*
|
||||
CASM=-FAs
|
||||
|
||||
@@ -95,65 +106,81 @@ LIBDIR=/libpath:"$(JAVA_HOME)/lib"
|
||||
#LIBS=$(LIBDIR) jawt.lib
|
||||
STRIP=@echo
|
||||
else
|
||||
CDEFINES=-D__int64="long long" -D_JNI_IMPLEMENTATION -DHAVE_PROTECTION
|
||||
PCFLAGS+=-mno-cygwin
|
||||
LDFLAGS+=-mno-cygwin -Wl,--add-stdcall-alias
|
||||
CC += -mno-cygwin
|
||||
LD += -mno-cygwin -Wl,--add-stdcall-alias
|
||||
LIBDIR="$(JAVA_HOME)/lib"
|
||||
#LIBS=$(LIBDIR)/jawt.lib
|
||||
endif
|
||||
|
||||
LIBPFX=
|
||||
LIBSFX=.dll
|
||||
EXTRAOBJS=$(RSRC)
|
||||
endif
|
||||
|
||||
ifeq ($(OS),linux)
|
||||
ARCH=$(shell uname -m | sed 's/i[456]86/i386/g')
|
||||
ARCH=$(shell uname -m | sed 's/i.86/i386/g')
|
||||
PCFLAGS+=-fPIC
|
||||
CDEFINES+=-DHAVE_PROTECTION
|
||||
LDFLAGS+=-Wl,-soname,$@
|
||||
endif
|
||||
|
||||
ifeq ($(OS),freebsd)
|
||||
ARCH=$(shell uname -m | sed 's/i[456]86/i386/g')
|
||||
ARCH=$(shell uname -m | sed 's/i.86/i386/g')
|
||||
PCFLAGS+=-fPIC
|
||||
CINCLUDES+=-I/usr/X11R6/include
|
||||
LDFLAGS=-o $@ -shared
|
||||
CDEFINES+=-DHAVE_PROTECTION
|
||||
CDEFINES+=-DHAVE_PROTECTION -DFFI_MMAP_EXEC_WRIT
|
||||
endif
|
||||
|
||||
ifeq ($(OS),openbsd)
|
||||
ARCH=$(shell uname -m | sed 's/i.86/i386/g')
|
||||
PCFLAGS+=-fPIC
|
||||
CINCLUDES+=-I/usr/X11R6/include
|
||||
LDFLAGS=-o $@ -shared
|
||||
CDEFINES+=-DHAVE_PROTECTION -DFFI_MMAP_EXEC_WRIT
|
||||
endif
|
||||
|
||||
ifeq ($(OS),solaris)
|
||||
ifeq ($(ARCH),)
|
||||
ARCH=$(shell uname -n)
|
||||
ARCH=$(shell uname -p)
|
||||
endif
|
||||
PCFLAGS+=-fPIC
|
||||
LDFLAGS=-o $@ -G
|
||||
CDEFINES+=-DHAVE_PROTECTION -DFFI_MMAP_EXEC_WRIT
|
||||
ifeq ($(ARCH), sparcv9)
|
||||
# alter CC instead of PCFLAGS, since we need to pass it down to libffi
|
||||
# configure and some of the other settings in PCFLAGS might make the build
|
||||
# choke
|
||||
CC += -m64
|
||||
LDFLAGS += -m64
|
||||
LD += -m64
|
||||
endif
|
||||
endif
|
||||
|
||||
# Enable 64-bit builds if the arch demands it
|
||||
ifeq ($(ARCH),amd64)
|
||||
CC += -m64
|
||||
LD += -m64
|
||||
endif
|
||||
|
||||
ifeq ($(OS),darwin)
|
||||
ARCH=$(shell arch)
|
||||
ifeq ($(ARCH),ppc)
|
||||
ALT_ARCH=i386
|
||||
OSX_FFI_CONFIG=--host=i386-apple-darwin --disable-dependency-tracking
|
||||
ALT_ARCHS=i386
|
||||
else
|
||||
ALT_ARCH=ppc
|
||||
OSX_FFI_CONFIG=--host=powerpc-apple-darwin --disable-dependency-tracking
|
||||
ALT_ARCHS=ppc
|
||||
endif
|
||||
FFI_ALT_BUILD=$(BUILD)/libffi-$(ALT_ARCH)
|
||||
LIBSFX=.dylib
|
||||
JNISFX=.jnilib
|
||||
ifneq ($(SDKROOT),)
|
||||
SYSLIBROOT=-Wl,-syslibroot,$(SDKROOT)
|
||||
ISYSROOT=-isysroot $(SDKROOT)
|
||||
ARCHFLAGS=-arch ppc -arch i386
|
||||
ifneq ($(findstring 10.5,$(SDKROOT)),)
|
||||
ALT_ARCHS+=x86_64 #ppc64
|
||||
ARCHFLAGS+=-arch x86_64 #-arch ppc64
|
||||
endif
|
||||
endif
|
||||
PCFLAGS+=$(ISYSROOT) -x objective-c
|
||||
CDEFINES=-DTARGET_RT_MAC_CFM=0
|
||||
CDEFINES+=-DTARGET_RT_MAC_CFM=0 -DFFI_MMAP_EXEC_WRIT
|
||||
LDFLAGS=$(ARCHFLAGS) -dynamiclib -o $@ -framework JavaVM \
|
||||
-compatibility_version $(shell echo ${VERSION}|sed 's/^\([0-9][0-9]*\).*/\1/g') \
|
||||
-current_version $(VERSION) \
|
||||
@@ -165,14 +192,16 @@ LIBS=
|
||||
endif
|
||||
|
||||
# Unfortunately, we have to use different libffi include files depending on
|
||||
# the target, so we can't do a simple universal build on darwin. Do two
|
||||
# the target, so we can't do a simple universal build on darwin. Do
|
||||
# separate builds, then merge the results.
|
||||
$(BUILD)/%.o : %.c dispatch.h $(FFI_LIB)
|
||||
@mkdir -p $(BUILD)
|
||||
ifneq ($(SDKROOT),)
|
||||
$(CC) -arch $(ARCH) $(CFLAGS) -c $< -o $@.$(ARCH)
|
||||
$(CC) -arch $(ALT_ARCH) -I$(FFI_ALT_BUILD)/include $(CFLAGS) -c $< -o $@.$(ALT_ARCH)
|
||||
lipo -create -output $@ $@.$(ARCH) $@.$(ALT_ARCH)
|
||||
for arch in $(ALT_ARCHS); do \
|
||||
$(CC) -arch $$arch -I$(BUILD)/libffi.$$arch/include $(CFLAGS) -c $< -o $@.$$arch; \
|
||||
done
|
||||
lipo -create -output $@ $@.*
|
||||
else
|
||||
$(CC) $(CFLAGS) -c $< $(COUT)
|
||||
endif
|
||||
@@ -183,32 +212,39 @@ install:
|
||||
mkdir $(INSTALLDIR)
|
||||
cp $(LIBRARY) $(INSTALLDIR)
|
||||
|
||||
$(RSRC): $(BUILD)/jnidispatch.rc
|
||||
windres -i $< -o $@
|
||||
|
||||
$(LIBRARY): $(JNIDISPATCH_OBJS) $(FFI_LIB)
|
||||
$(LD) $(LDFLAGS) $(JNIDISPATCH_OBJS) $(FFI_LIB) $(LIBS)
|
||||
|
||||
$(TESTLIB): $(BUILD)/testlib.o
|
||||
$(LD) $(LDFLAGS) $< $(TESTDEF)
|
||||
$(LD) $(LDFLAGS) $< $(TESTDEF)
|
||||
|
||||
ifneq ($(DYNAMIC_LIBFFI),true)
|
||||
$(FFI_LIB):
|
||||
@mkdir -p $(FFI_BUILD)
|
||||
@if [ ! -f $(FFI_BUILD)/Makefile ]; then \
|
||||
echo "Configuring libffi ($(ARCH))"; \
|
||||
(cd $(FFI_BUILD) \
|
||||
&& CC="$(CC) $(CDEBUG)" $(FFI_SRC)/configure $(FFI_CONFIG)); \
|
||||
&& CC="$(CC)" CFLAGS="$(CDEBUG)" CPPFLAGS="$(CDEFINES)" $(FFI_SRC)/configure $(FFI_CONFIG)); \
|
||||
fi
|
||||
$(MAKE) -C $(FFI_BUILD)
|
||||
ifneq ($(SDKROOT),)
|
||||
@mkdir -p $(FFI_ALT_BUILD)
|
||||
@if [ ! -f $(FFI_ALT_BUILD)/Makefile ]; then \
|
||||
echo "Configuring libffi ($(ALT_ARCH))"; \
|
||||
(cd $(FFI_ALT_BUILD) \
|
||||
&& CFLAGS="-arch $(ALT_ARCH) $(ISYSROOT) $(COPT) $(CDEBUG) $(CDEFINES)" \
|
||||
LDFLAGS="-arch $(ALT_ARCH)" \
|
||||
$(FFI_SRC)/configure $(FFI_CONFIG) $(OSX_FFI_CONFIG)); \
|
||||
fi
|
||||
$(MAKE) -C $(FFI_ALT_BUILD)
|
||||
/usr/bin/libtool -static -o $@.tmp $(FFI_BUILD)/.libs/${@F} $(FFI_ALT_BUILD)/.libs/${@F}
|
||||
@mv $@.tmp $@
|
||||
@for arch in $(ALT_ARCHS); do \
|
||||
mkdir -p $(BUILD)/libffi.$$arch; \
|
||||
if [ ! -f $(BUILD)/libffi.$$arch/Makefile ]; then \
|
||||
echo "Configuring libffi ($$arch)"; \
|
||||
(cd $(BUILD)/libffi.$$arch \
|
||||
&& CC="$(CC)" CFLAGS="-arch $$arch $(ISYSROOT) $(COPT) $(CDEBUG)" CPPFLAGS="$(CDEFINES)" \
|
||||
LDFLAGS="-arch $$arch" \
|
||||
$(FFI_SRC)/configure $(FFI_CONFIG) --host=$$arch-apple-darwin --disable-dependency-tracking); \
|
||||
fi; \
|
||||
$(MAKE) -C $(BUILD)/libffi.$$arch; \
|
||||
done
|
||||
/usr/bin/libtool -static -o $@.tmp $(FFI_BUILD)/.libs/${@F} $(BUILD)/libffi.*/.libs/${@F}
|
||||
mv $@.tmp $@
|
||||
endif
|
||||
endif
|
||||
|
||||
clean:
|
||||
@@ -217,4 +253,4 @@ clean:
|
||||
version:
|
||||
@echo version=$(VERSION)
|
||||
|
||||
#EOF
|
||||
#EOF
|
||||
|
||||
+7
-113
@@ -20,26 +20,9 @@
|
||||
#if defined(_WIN32)
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <windows.h>
|
||||
# undef SLIST_ENTRY
|
||||
# define MMAP_CLOSURE
|
||||
# define roundup(x,y) ((((x) + ((y) - 1)) / (y)) * (y))
|
||||
# define XM_ALLOC(SIZE) VirtualAlloc(0, SIZE, MEM_COMMIT|MEM_RESERVE, PAGE_EXECUTE_READWRITE)
|
||||
# define XM_FREE(P,SIZE) VirtualFree(P,SIZE,MEM_RELEASE)
|
||||
# define PAGE_SIZE w32_page_size()
|
||||
typedef void* caddr_t;
|
||||
#else
|
||||
# include <sys/types.h>
|
||||
# include <sys/param.h>
|
||||
# if defined(__linux__)
|
||||
# include <sys/user.h> /* for PAGE_SIZE */
|
||||
# endif
|
||||
# include <sys/mman.h>
|
||||
# ifdef sun
|
||||
# include <sys/sysmacros.h>
|
||||
# endif
|
||||
# define MMAP_CLOSURE
|
||||
# define XM_ALLOC(SIZE) mmap(0, SIZE, PROT_EXEC|PROT_READ|PROT_WRITE,MAP_ANON|MAP_PRIVATE,-1,0)
|
||||
# define XM_FREE(P,SIZE) munmap(P,SIZE)
|
||||
#endif
|
||||
#include "dispatch.h"
|
||||
|
||||
@@ -48,14 +31,6 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
static void callback_dispatch(ffi_cif*, void*, void**, void*);
|
||||
static ffi_closure* alloc_closure(JNIEnv *env);
|
||||
static void free_closure(JNIEnv* env, ffi_closure *closure);
|
||||
|
||||
#ifdef MMAP_CLOSURE
|
||||
#include "queue.h"
|
||||
static LIST_HEAD(closure_list, list_entry) closure_list;
|
||||
static LIST_HEAD(alloc_list, list_entry) alloc_list;
|
||||
#endif
|
||||
|
||||
static jclass classObject;
|
||||
|
||||
@@ -79,7 +54,7 @@ create_callback(JNIEnv* env, jobject obj, jobject method,
|
||||
}
|
||||
argc = (*env)->GetArrayLength(env, param_types);
|
||||
cb = (callback *)malloc(sizeof(callback));
|
||||
cb->ffi_closure = alloc_closure(env);
|
||||
cb->ffi_closure = ffi_closure_alloc(sizeof(ffi_closure), &cb->x_closure);
|
||||
cb->object = (*env)->NewWeakGlobalRef(env, obj);
|
||||
cb->methodID = (*env)->FromReflectedMethod(env, method);
|
||||
cb->vm = vm;
|
||||
@@ -119,7 +94,8 @@ create_callback(JNIEnv* env, jobject obj, jobject method,
|
||||
throwByName(env, EIllegalArgument, msg);
|
||||
break;
|
||||
case FFI_OK:
|
||||
ffi_prep_closure(cb->ffi_closure, &cb->ffi_cif, callback_dispatch, cb);
|
||||
ffi_prep_closure_loc(cb->ffi_closure, &cb->ffi_cif, callback_dispatch, cb,
|
||||
cb->x_closure);
|
||||
return cb;
|
||||
default:
|
||||
sprintf(msg, "Native callback setup failure: error code %d", status);
|
||||
@@ -134,7 +110,7 @@ create_callback(JNIEnv* env, jobject obj, jobject method,
|
||||
void
|
||||
free_callback(JNIEnv* env, callback *cb) {
|
||||
(*env)->DeleteWeakGlobalRef(env, cb->object);
|
||||
free_closure(env, cb->ffi_closure);
|
||||
ffi_closure_free(cb->ffi_closure);
|
||||
free(cb);
|
||||
}
|
||||
|
||||
@@ -184,46 +160,12 @@ callback_dispatch(ffi_cif* cif, void* resp, void** cbargs, void* user_data) {
|
||||
}
|
||||
}
|
||||
|
||||
// Use mmap for closure memory, if available.
|
||||
// A page of memory is allocated and divided into closure-sized
|
||||
// chunks managed in a queue. The queue is protected by
|
||||
// Java synchronization locks to ensure single-threaded access.
|
||||
#ifdef MMAP_CLOSURE
|
||||
# ifndef PAGE_SIZE
|
||||
# if defined(PAGESIZE)
|
||||
# define PAGE_SIZE PAGESIZE
|
||||
# elif defined(NBPG)
|
||||
# define PAGE_SIZE NBPG
|
||||
# endif
|
||||
# endif
|
||||
typedef struct list_entry {
|
||||
LIST_ENTRY(list_entry) list;
|
||||
} list_entry;
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
static int w32_page_size() {
|
||||
static int page_size = 0;
|
||||
if (page_size == 0) {
|
||||
SYSTEM_INFO info;
|
||||
GetSystemInfo(&info);
|
||||
page_size = info.dwPageSize;
|
||||
}
|
||||
return page_size;
|
||||
}
|
||||
#endif
|
||||
|
||||
jboolean
|
||||
const char*
|
||||
jnidispatch_callback_init(JNIEnv* env) {
|
||||
|
||||
if (!LOAD_CREF(env, Object, "java/lang/Object")) return JNI_FALSE;
|
||||
if (!LOAD_CREF(env, Object, "java/lang/Object")) return "java.lang.Object";
|
||||
|
||||
#ifdef MMAP_CLOSURE
|
||||
LIST_INIT(&closure_list);
|
||||
LIST_INIT(&alloc_list);
|
||||
#endif
|
||||
|
||||
return JNI_TRUE;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -232,54 +174,6 @@ jnidispatch_callback_dispose(JNIEnv* env) {
|
||||
(*env)->DeleteWeakGlobalRef(env, classObject);
|
||||
classObject = NULL;
|
||||
}
|
||||
#ifdef MMAP_CLOSURE
|
||||
while (alloc_list.lh_first != NULL) {
|
||||
list_entry* entry = alloc_list.lh_first;
|
||||
XM_FREE((caddr_t)entry, PAGE_SIZE);
|
||||
LIST_REMOVE(entry, list);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static ffi_closure*
|
||||
alloc_closure(JNIEnv* env) {
|
||||
#ifdef MMAP_CLOSURE
|
||||
list_entry* entry = NULL;
|
||||
|
||||
if (closure_list.lh_first == NULL) {
|
||||
/*
|
||||
* Get a new page from the kernel and divvy that up
|
||||
*/
|
||||
int clsize = roundup(sizeof(ffi_closure), sizeof(list_entry));
|
||||
int i;
|
||||
caddr_t ptr = XM_ALLOC(PAGE_SIZE);
|
||||
if (ptr == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
LIST_INSERT_HEAD(&alloc_list, (list_entry*)ptr, list);
|
||||
|
||||
for (i = 0; i <= (int)(PAGE_SIZE - clsize); i += clsize) {
|
||||
entry = (list_entry *)(ptr + i);
|
||||
LIST_INSERT_HEAD(&closure_list, entry, list);
|
||||
}
|
||||
}
|
||||
entry = closure_list.lh_first;
|
||||
LIST_REMOVE(entry, list);
|
||||
|
||||
memset(entry, 0, sizeof(ffi_closure));
|
||||
return (ffi_closure *)entry;
|
||||
#else
|
||||
return (ffi_closure *)calloc(1, sizeof(ffi_closure));
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
free_closure(JNIEnv* env, ffi_closure *ffi_closure) {
|
||||
#ifdef MMAP_CLOSURE
|
||||
LIST_INSERT_HEAD(&closure_list, (list_entry*)ffi_closure, list);
|
||||
#else
|
||||
free(closure);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
+115
-68
@@ -47,7 +47,11 @@ w32_format_error(char* buf, int len) {
|
||||
#include <dlfcn.h>
|
||||
#include <errno.h>
|
||||
#define LIBNAMETYPE char*
|
||||
#ifdef __APPLE__
|
||||
#define LIBNAME2CSTR(ENV,JSTR) newCStringUTF8(ENV,JSTR)
|
||||
#else
|
||||
#define LIBNAME2CSTR(ENV,JSTR) newCString(ENV,JSTR)
|
||||
#endif
|
||||
#define LOAD_LIBRARY(NAME) dlopen(NAME, RTLD_LAZY)
|
||||
#define LOAD_ERROR(BUF,LEN) (sprintf(BUF, "%s", dlerror()), BUF)
|
||||
#define FREE_LIBRARY(HANDLE) dlclose(HANDLE)
|
||||
@@ -127,6 +131,7 @@ static jclass classStructureByValue;
|
||||
|
||||
static jmethodID MID_Class_getComponentType;
|
||||
static jmethodID MID_String_getBytes;
|
||||
static jmethodID MID_String_getBytes2;
|
||||
static jmethodID MID_String_toCharArray;
|
||||
static jmethodID MID_String_init_bytes;
|
||||
static jmethodID MID_Method_getReturnType;
|
||||
@@ -174,6 +179,7 @@ static jfieldID FID_Structure_typeInfo;
|
||||
|
||||
/* Forward declarations */
|
||||
static char* newCString(JNIEnv *env, jstring jstr);
|
||||
static char* newCStringUTF8(JNIEnv *env, jstring jstr);
|
||||
static wchar_t* newWideCString(JNIEnv *env, jstring jstr);
|
||||
static jstring newJavaString(JNIEnv *env, const char *str, jboolean wide);
|
||||
|
||||
@@ -205,17 +211,17 @@ dispatch(JNIEnv *env, jobject self, jint callconv, jobjectArray arr,
|
||||
{
|
||||
int i, nargs;
|
||||
void *func;
|
||||
jvalue c_args[MAX_NARGS];
|
||||
jvalue* c_args;
|
||||
char array_pt;
|
||||
struct _array_elements {
|
||||
char type;
|
||||
jobject array;
|
||||
void *elems;
|
||||
} array_elements[MAX_NARGS];
|
||||
} *array_elements;
|
||||
int array_count = 0;
|
||||
ffi_cif cif;
|
||||
ffi_type* ffi_types[MAX_NARGS];
|
||||
void* ffi_values[MAX_NARGS];
|
||||
ffi_type** ffi_types;
|
||||
void** ffi_values;
|
||||
ffi_abi abi;
|
||||
ffi_status status;
|
||||
char msg[128];
|
||||
@@ -227,6 +233,11 @@ dispatch(JNIEnv *env, jobject self, jint callconv, jobjectArray arr,
|
||||
throwByName(env, EUnsupportedOperation, msg);
|
||||
return;
|
||||
}
|
||||
c_args = (jvalue*)alloca(nargs * sizeof(jvalue));
|
||||
array_elements = (struct _array_elements*)
|
||||
alloca(nargs * sizeof(struct _array_elements));
|
||||
ffi_types = (ffi_type**)alloca(nargs * sizeof(ffi_type*));
|
||||
ffi_values = (void**)alloca(nargs * sizeof(void*));
|
||||
|
||||
// Get the function pointer
|
||||
func = getNativeAddress(env, self);
|
||||
@@ -383,10 +394,10 @@ dispatch(JNIEnv *env, jobject self, jint callconv, jobjectArray arr,
|
||||
case FFI_OK: {
|
||||
PSTART();
|
||||
ffi_call(&cif, FFI_FN(func), resP, ffi_values);
|
||||
PEND();
|
||||
if (preserve_last_error) {
|
||||
update_last_error(env, GET_LAST_ERROR());
|
||||
}
|
||||
PEND();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -657,122 +668,125 @@ Java_com_sun_jna_NativeLibrary_findSymbol(JNIEnv *env, jclass cls,
|
||||
return (jlong)A2L(func);
|
||||
}
|
||||
|
||||
static jboolean
|
||||
static const char*
|
||||
jnidispatch_init(JNIEnv* env) {
|
||||
if (!LOAD_CREF(env, Object, "java/lang/Object")) return JNI_FALSE;
|
||||
if (!LOAD_CREF(env, Class, "java/lang/Class")) return JNI_FALSE;
|
||||
if (!LOAD_CREF(env, Method, "java/lang/reflect/Method")) return JNI_FALSE;
|
||||
if (!LOAD_CREF(env, String, "java/lang/String")) return JNI_FALSE;
|
||||
if (!LOAD_CREF(env, Buffer, "java/nio/Buffer")) return JNI_FALSE;
|
||||
if (!LOAD_CREF(env, ByteBuffer, "java/nio/ByteBuffer")) return JNI_FALSE;
|
||||
if (!LOAD_CREF(env, CharBuffer, "java/nio/CharBuffer")) return JNI_FALSE;
|
||||
if (!LOAD_CREF(env, ShortBuffer, "java/nio/ShortBuffer")) return JNI_FALSE;
|
||||
if (!LOAD_CREF(env, IntBuffer, "java/nio/IntBuffer")) return JNI_FALSE;
|
||||
if (!LOAD_CREF(env, LongBuffer, "java/nio/LongBuffer")) return JNI_FALSE;
|
||||
if (!LOAD_CREF(env, FloatBuffer, "java/nio/FloatBuffer")) return JNI_FALSE;
|
||||
if (!LOAD_CREF(env, DoubleBuffer, "java/nio/DoubleBuffer")) return JNI_FALSE;
|
||||
if (!LOAD_CREF(env, Object, "java/lang/Object")) return "java.lang.Object";
|
||||
if (!LOAD_CREF(env, Class, "java/lang/Class")) return "java.lang.Class";
|
||||
if (!LOAD_CREF(env, Method, "java/lang/reflect/Method")) return "java.lang.reflect.Method";
|
||||
if (!LOAD_CREF(env, String, "java/lang/String")) return "java.lang.String";
|
||||
if (!LOAD_CREF(env, Buffer, "java/nio/Buffer")) return "java.nio.Buffer";
|
||||
if (!LOAD_CREF(env, ByteBuffer, "java/nio/ByteBuffer")) return "java.nio.ByteBuffer";
|
||||
if (!LOAD_CREF(env, CharBuffer, "java/nio/CharBuffer")) return "java.nio.CharBuffer";
|
||||
if (!LOAD_CREF(env, ShortBuffer, "java/nio/ShortBuffer")) return "java.nio.ShortBuffer";
|
||||
if (!LOAD_CREF(env, IntBuffer, "java/nio/IntBuffer")) return "java.nio.IntBuffer";
|
||||
if (!LOAD_CREF(env, LongBuffer, "java/nio/LongBuffer")) return "java.nio.LongBuffer";
|
||||
if (!LOAD_CREF(env, FloatBuffer, "java/nio/FloatBuffer")) return "java.nio.FloatBuffer";
|
||||
if (!LOAD_CREF(env, DoubleBuffer, "java/nio/DoubleBuffer")) return "java.nio.DoubleBuffer";
|
||||
|
||||
if (!LOAD_PCREF(env, Void, "java/lang/Void")) return JNI_FALSE;
|
||||
if (!LOAD_PCREF(env, Boolean, "java/lang/Boolean")) return JNI_FALSE;
|
||||
if (!LOAD_PCREF(env, Byte, "java/lang/Byte")) return JNI_FALSE;
|
||||
if (!LOAD_PCREF(env, Character, "java/lang/Character")) return JNI_FALSE;
|
||||
if (!LOAD_PCREF(env, Short, "java/lang/Short")) return JNI_FALSE;
|
||||
if (!LOAD_PCREF(env, Integer, "java/lang/Integer")) return JNI_FALSE;
|
||||
if (!LOAD_PCREF(env, Long, "java/lang/Long")) return JNI_FALSE;
|
||||
if (!LOAD_PCREF(env, Float, "java/lang/Float")) return JNI_FALSE;
|
||||
if (!LOAD_PCREF(env, Double, "java/lang/Double")) return JNI_FALSE;
|
||||
if (!LOAD_PCREF(env, Void, "java/lang/Void")) return "java.lang.Void";
|
||||
if (!LOAD_PCREF(env, Boolean, "java/lang/Boolean")) return "java.lang.Boolean";
|
||||
if (!LOAD_PCREF(env, Byte, "java/lang/Byte")) return "java.lang.Byte";
|
||||
if (!LOAD_PCREF(env, Character, "java/lang/Character")) return "java.lang.Character";
|
||||
if (!LOAD_PCREF(env, Short, "java/lang/Short")) return "java.lang.Short";
|
||||
if (!LOAD_PCREF(env, Integer, "java/lang/Integer")) return "java.lang.Integer";
|
||||
if (!LOAD_PCREF(env, Long, "java/lang/Long")) return "java.lang.Long";
|
||||
if (!LOAD_PCREF(env, Float, "java/lang/Float")) return "java.lang.Float";
|
||||
if (!LOAD_PCREF(env, Double, "java/lang/Double")) return "java.lang.Double";
|
||||
|
||||
if (!LOAD_MID(env, MID_Long_init, classLong,
|
||||
"<init>", "(J)V"))
|
||||
return JNI_FALSE;
|
||||
return "java.lang.Long<init>(J)V";
|
||||
if (!LOAD_MID(env, MID_Integer_init, classInteger,
|
||||
"<init>", "(I)V"))
|
||||
return JNI_FALSE;
|
||||
return "java.lang.Integer<init>(I)V";
|
||||
if (!LOAD_MID(env, MID_Short_init, classShort,
|
||||
"<init>", "(S)V"))
|
||||
return JNI_FALSE;
|
||||
return "java.lang.Short<init>(S)V";
|
||||
if (!LOAD_MID(env, MID_Character_init, classCharacter,
|
||||
"<init>", "(C)V"))
|
||||
return JNI_FALSE;
|
||||
return "java.lang.Character<init>(C)V";
|
||||
if (!LOAD_MID(env, MID_Byte_init, classByte,
|
||||
"<init>", "(B)V"))
|
||||
return JNI_FALSE;
|
||||
return "java.lang.Byte<init>(B)V";
|
||||
if (!LOAD_MID(env, MID_Boolean_init, classBoolean,
|
||||
"<init>", "(Z)V"))
|
||||
return JNI_FALSE;
|
||||
return "java.lang.Boolean<init>(Z)V";
|
||||
if (!LOAD_MID(env, MID_Float_init, classFloat,
|
||||
"<init>", "(F)V"))
|
||||
return JNI_FALSE;
|
||||
return "java.lang.Float<init>(F)V";
|
||||
if (!LOAD_MID(env, MID_Double_init, classDouble,
|
||||
"<init>", "(D)V"))
|
||||
return JNI_FALSE;
|
||||
return "java.lang.Double<init>(D)V";
|
||||
if (!LOAD_MID(env, MID_Class_getComponentType, classClass,
|
||||
"getComponentType", "()Ljava/lang/Class;"))
|
||||
return JNI_FALSE;
|
||||
return "Class.getComponentType(Class)";
|
||||
if (!LOAD_MID(env, MID_String_getBytes, classString,
|
||||
"getBytes", "()[B"))
|
||||
return JNI_FALSE;
|
||||
return "String.getBytes()";
|
||||
if (!LOAD_MID(env, MID_String_getBytes2, classString,
|
||||
"getBytes", "(Ljava/lang/String;)[B"))
|
||||
return "String.getBytes(String)";
|
||||
if (!LOAD_MID(env, MID_String_toCharArray, classString,
|
||||
"toCharArray", "()[C"))
|
||||
return JNI_FALSE;
|
||||
return "String.toCharArray()";
|
||||
if (!LOAD_MID(env, MID_String_init_bytes, classString,
|
||||
"<init>", "([B)V"))
|
||||
return JNI_FALSE;
|
||||
return "String<init>([B)V";
|
||||
if (!LOAD_MID(env, MID_Method_getParameterTypes, classMethod,
|
||||
"getParameterTypes", "()[Ljava/lang/Class;"))
|
||||
return JNI_FALSE;
|
||||
return "Method.getParameterTypes()";
|
||||
if (!LOAD_MID(env, MID_Method_getReturnType, classMethod,
|
||||
"getReturnType", "()Ljava/lang/Class;"))
|
||||
return JNI_FALSE;
|
||||
return "Method.getReturnType()";
|
||||
|
||||
if (!LOAD_MID(env, MID_ByteBuffer_array, classByteBuffer, "array", "()[B"))
|
||||
return JNI_FALSE;
|
||||
return "ByteBuffer.array";
|
||||
if (!LOAD_MID(env, MID_ByteBuffer_arrayOffset, classByteBuffer, "arrayOffset", "()I"))
|
||||
return JNI_FALSE;
|
||||
return "ByteBuffer.arrayOffset";
|
||||
if (!LOAD_MID(env, MID_CharBuffer_array, classCharBuffer, "array", "()[C"))
|
||||
return JNI_FALSE;
|
||||
return "CharBuffer.array";
|
||||
if (!LOAD_MID(env, MID_CharBuffer_arrayOffset, classCharBuffer, "arrayOffset", "()I"))
|
||||
return JNI_FALSE;
|
||||
return "CharBuffer.arrayOffset";
|
||||
if (!LOAD_MID(env, MID_ShortBuffer_array, classShortBuffer, "array", "()[S"))
|
||||
return JNI_FALSE;
|
||||
return "ShortBuffer.array";
|
||||
if (!LOAD_MID(env, MID_ShortBuffer_arrayOffset, classShortBuffer, "arrayOffset", "()I"))
|
||||
return JNI_FALSE;
|
||||
return "ShortBuffer.arrayOffset";
|
||||
if (!LOAD_MID(env, MID_IntBuffer_array, classIntBuffer, "array", "()[I"))
|
||||
return JNI_FALSE;
|
||||
return "IntBuffer.array";
|
||||
if (!LOAD_MID(env, MID_IntBuffer_arrayOffset, classIntBuffer, "arrayOffset", "()I"))
|
||||
return JNI_FALSE;
|
||||
return "IntBuffer.arrayOffset";
|
||||
if (!LOAD_MID(env, MID_LongBuffer_array, classLongBuffer, "array", "()[J"))
|
||||
return JNI_FALSE;
|
||||
return "LongBuffer.array";
|
||||
if (!LOAD_MID(env, MID_LongBuffer_arrayOffset, classLongBuffer, "arrayOffset", "()I"))
|
||||
return JNI_FALSE;
|
||||
return "LongBuffer.arrayOffset";
|
||||
if (!LOAD_MID(env, MID_FloatBuffer_array, classFloatBuffer, "array", "()[F"))
|
||||
return JNI_FALSE;
|
||||
return "FloatBuffer.array";
|
||||
if (!LOAD_MID(env, MID_FloatBuffer_arrayOffset, classFloatBuffer, "arrayOffset", "()I"))
|
||||
return JNI_FALSE;
|
||||
return "FloatBuffer.arrayOffset";
|
||||
if (!LOAD_MID(env, MID_DoubleBuffer_array, classDoubleBuffer, "array", "()[D"))
|
||||
return JNI_FALSE;
|
||||
return "DoubleBuffer.array";
|
||||
if (!LOAD_MID(env, MID_DoubleBuffer_arrayOffset, classDoubleBuffer, "arrayOffset", "()I"))
|
||||
return JNI_FALSE;
|
||||
return "DoubleBuffer.arrayOffset";
|
||||
|
||||
|
||||
if (!LOAD_FID(env, FID_Boolean_value, classBoolean, "value", "Z"))
|
||||
return JNI_FALSE;
|
||||
return "Boolean.value";
|
||||
if (!LOAD_FID(env, FID_Byte_value, classByte, "value", "B"))
|
||||
return JNI_FALSE;
|
||||
return "Byte.value";
|
||||
if (!LOAD_FID(env, FID_Short_value, classShort, "value", "S"))
|
||||
return JNI_FALSE;
|
||||
return "Short.value";
|
||||
if (!LOAD_FID(env, FID_Character_value, classCharacter, "value", "C"))
|
||||
return JNI_FALSE;
|
||||
return "Character.value";
|
||||
if (!LOAD_FID(env, FID_Integer_value, classInteger, "value", "I"))
|
||||
return JNI_FALSE;
|
||||
return "Integer.value";
|
||||
if (!LOAD_FID(env, FID_Long_value, classLong, "value", "J"))
|
||||
return JNI_FALSE;
|
||||
return "Long.value";
|
||||
if (!LOAD_FID(env, FID_Float_value, classFloat, "value", "F"))
|
||||
return JNI_FALSE;
|
||||
return "Float.value";
|
||||
if (!LOAD_FID(env, FID_Double_value, classDouble, "value", "D"))
|
||||
return JNI_FALSE;
|
||||
return "Double.value";
|
||||
|
||||
return JNI_TRUE;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1131,7 +1145,8 @@ JNIEXPORT void JNICALL Java_com_sun_jna_Pointer__1setByte
|
||||
JNIEXPORT void JNICALL Java_com_sun_jna_Pointer__1setChar
|
||||
(JNIEnv *env, jclass cls, jlong addr, jchar value)
|
||||
{
|
||||
MEMCPY(L2A(addr), &value, sizeof(value));
|
||||
wchar_t ch = value;
|
||||
MEMCPY(L2A(addr), &ch, sizeof(ch));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1292,6 +1307,32 @@ newCString(JNIEnv *env, jstring jstr)
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Translates a Java string to a C string using the String.getBytes("UTF8")
|
||||
* method, which uses UTF8 encoding.
|
||||
*/
|
||||
static char *
|
||||
newCStringUTF8(JNIEnv *env, jstring jstr)
|
||||
{
|
||||
jbyteArray bytes = 0;
|
||||
char *result = NULL;
|
||||
|
||||
bytes = (*env)->CallObjectMethod(env, jstr, MID_String_getBytes2,
|
||||
newJavaString(env, "UTF8", JNI_FALSE));
|
||||
if (!(*env)->ExceptionCheck(env)) {
|
||||
jint len = (*env)->GetArrayLength(env, bytes);
|
||||
result = (char *)malloc(len + 1);
|
||||
if (result == NULL) {
|
||||
throwByName(env, EOutOfMemory, "Can't allocate C string");
|
||||
(*env)->DeleteLocalRef(env, bytes);
|
||||
return NULL;
|
||||
}
|
||||
(*env)->GetByteArrayRegion(env, bytes, 0, len, (jbyte *)result);
|
||||
result[len] = 0; /* NUL-terminate */
|
||||
}
|
||||
(*env)->DeleteLocalRef(env, bytes);
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Translates a Java string to a wide C string using the String.toCharArray
|
||||
* method.
|
||||
*/
|
||||
@@ -1307,7 +1348,7 @@ newWideCString(JNIEnv *env, jstring str)
|
||||
jint len = (*env)->GetArrayLength(env, chars);
|
||||
result = (wchar_t *)malloc(sizeof(wchar_t) * (len + 1));
|
||||
if (result == NULL) {
|
||||
throwByName(env, EOutOfMemory, 0);
|
||||
throwByName(env, EOutOfMemory, "Can't allocate wide C string");
|
||||
(*env)->DeleteLocalRef(env, chars);
|
||||
return NULL;
|
||||
}
|
||||
@@ -1913,6 +1954,8 @@ JNI_OnLoad(JavaVM *jvm, void *reserved) {
|
||||
JNIEnv* env;
|
||||
int result = JNI_VERSION_1_4;
|
||||
int attached = (*jvm)->GetEnv(jvm, (void *)&env, JNI_VERSION_1_4) == JNI_OK;
|
||||
const char* err;
|
||||
|
||||
if (!attached) {
|
||||
if ((*jvm)->AttachCurrentThread(jvm, (void *)&env, NULL) != JNI_OK) {
|
||||
fprintf(stderr, "JNA: Can't attach to JVM thread on load\n");
|
||||
@@ -1920,8 +1963,12 @@ JNI_OnLoad(JavaVM *jvm, void *reserved) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!jnidispatch_init(env)
|
||||
|| !jnidispatch_callback_init(env)) {
|
||||
if ((err = jnidispatch_init(env)) != NULL) {
|
||||
fprintf(stderr, "JNA: Problems loading core IDs: %s\n", err);
|
||||
result = 0;
|
||||
}
|
||||
else if ((err = jnidispatch_callback_init(env)) != NULL) {
|
||||
fprintf(stderr, "JNA: Problems loading callback IDs: %s\n", err);
|
||||
result = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,8 @@ typedef enum _callconv {
|
||||
#define MAX_NARGS com_sun_jna_Function_MAX_NARGS
|
||||
|
||||
typedef struct _callback {
|
||||
// Location of this field must agree with CallbackReference.getTrampoline()
|
||||
void* x_closure;
|
||||
ffi_closure* ffi_closure;
|
||||
ffi_cif ffi_cif;
|
||||
ffi_type* ffi_args[MAX_NARGS];
|
||||
@@ -86,7 +88,7 @@ extern jobject newJavaPointer(JNIEnv *, void *);
|
||||
extern char get_jtype(JNIEnv*, jclass);
|
||||
extern ffi_type* get_ffi_type(JNIEnv*, jclass, char);
|
||||
extern ffi_type* get_ffi_rtype(JNIEnv*, jclass, char);
|
||||
extern jboolean jnidispatch_callback_init(JNIEnv*);
|
||||
extern const char* jnidispatch_callback_init(JNIEnv*);
|
||||
extern void jnidispatch_callback_dispose(JNIEnv*);
|
||||
extern callback* create_callback(JNIEnv*, jobject, jobject,
|
||||
jobjectArray, jclass,
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
// Resource file to generate version information for jnidispatch.dll
|
||||
// Copyright (c) 2008 Timothy Wall
|
||||
// Type: version
|
||||
|
||||
// Name: 1
|
||||
LANGUAGE 0, 0
|
||||
|
||||
1 VERSIONINFO
|
||||
FILEVERSION 3,0,0,0
|
||||
PRODUCTVERSION 3,0,1,0
|
||||
FILEFLAGSMASK 0x3f
|
||||
FILEOS 0x4
|
||||
FILETYPE 0x2
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "000004b0"
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Java(TM) Native Access (JNA)"
|
||||
VALUE "FileDescription", "JNA native library"
|
||||
VALUE "FileVersion","3.0.0"
|
||||
VALUE "Full Version","3.0.0 b0"
|
||||
VALUE "InternalName", "jnidispatch"
|
||||
VALUE "LegalCopyright", "Copyright \251 2008 Timothy Wall"
|
||||
VALUE "OriginalFilename", "jnidispatch.dll"
|
||||
VALUE "ProductName", "Java(TM) Native Access"
|
||||
VALUE "ProductVersion","3"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x0, 1200
|
||||
END
|
||||
END
|
||||
@@ -41,6 +41,13 @@
|
||||
locations in the virtual memory space, one location writable and
|
||||
another executable. */
|
||||
# define FFI_MMAP_EXEC_WRIT 1
|
||||
# define HAVE_MNTENT 1
|
||||
# endif
|
||||
# ifdef X86_WIN32
|
||||
/* Windows systems may have Data Execution Protection (DEP) enabled,
|
||||
which requires the use of VirtualMalloc/VirtualFree to alloc/free
|
||||
executable memory. */
|
||||
# define FFI_MMAP_EXEC_WRIT 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@@ -92,7 +99,10 @@
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#ifndef X86_WIN32
|
||||
#ifdef HAVE_MNTENT
|
||||
#include <mntent.h>
|
||||
#endif /* HAVE_MNTENT */
|
||||
#include <sys/param.h>
|
||||
#include <pthread.h>
|
||||
|
||||
@@ -149,6 +159,7 @@ selinux_enabled_check (void)
|
||||
#define is_selinux_enabled() 0
|
||||
|
||||
#endif
|
||||
#endif /* X86_WIN32 */
|
||||
|
||||
/* Declare all functions defined in dlmalloc.c as static. */
|
||||
static void *dlmalloc(size_t);
|
||||
@@ -167,9 +178,11 @@ static int dlmalloc_trim(size_t) MAYBE_UNUSED;
|
||||
static size_t dlmalloc_usable_size(void*) MAYBE_UNUSED;
|
||||
static void dlmalloc_stats(void) MAYBE_UNUSED;
|
||||
|
||||
#ifndef X86_WIN32
|
||||
/* Use these for mmap and munmap within dlmalloc.c. */
|
||||
static void *dlmmap(void *, size_t, int, int, int, off_t);
|
||||
static int dlmunmap(void *, size_t);
|
||||
#endif /* X86_WIN32 */
|
||||
|
||||
#define mmap dlmmap
|
||||
#define munmap dlmunmap
|
||||
@@ -179,6 +192,8 @@ static int dlmunmap(void *, size_t);
|
||||
#undef mmap
|
||||
#undef munmap
|
||||
|
||||
#ifndef X86_WIN32
|
||||
|
||||
/* A mutex used to synchronize access to *exec* variables in this file. */
|
||||
static pthread_mutex_t open_temp_exec_file_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
@@ -231,6 +246,7 @@ open_temp_exec_file_env (const char *envvar)
|
||||
return open_temp_exec_file_dir (value);
|
||||
}
|
||||
|
||||
#ifdef HAVE_MNTENT
|
||||
/* Open a temporary file in an executable and writable mount point
|
||||
listed in the mounts file. Subsequent calls with the same mounts
|
||||
keep searching for mount points in the same file. Providing NULL
|
||||
@@ -277,6 +293,7 @@ open_temp_exec_file_mnt (const char *mounts)
|
||||
return fd;
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_MNTENT */
|
||||
|
||||
/* Instructions to look for a location to hold a temporary file that
|
||||
can be mapped in for execution. */
|
||||
@@ -291,8 +308,10 @@ static struct
|
||||
{ open_temp_exec_file_dir, "/var/tmp", 0 },
|
||||
{ open_temp_exec_file_dir, "/dev/shm", 0 },
|
||||
{ open_temp_exec_file_env, "HOME", 0 },
|
||||
#ifdef HAVE_MNTENT
|
||||
{ open_temp_exec_file_mnt, "/etc/mtab", 1 },
|
||||
{ open_temp_exec_file_mnt, "/proc/mounts", 1 },
|
||||
#endif /* HAVE_MNTENT */
|
||||
};
|
||||
|
||||
/* Current index into open_temp_exec_file_opts. */
|
||||
@@ -488,6 +507,8 @@ segment_holding_code (mstate m, char* addr)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* X86_WIN32 */
|
||||
|
||||
/* Allocate a chunk of memory with the given size. Returns a pointer
|
||||
to the writable address, and sets *CODE to the executable
|
||||
corresponding virtual address. */
|
||||
|
||||
@@ -1140,9 +1140,9 @@ int mspace_mallopt(int, int);
|
||||
|
||||
/*------------------------------ internal #includes ---------------------- */
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning( disable : 4146 ) /* no "unsigned" warnings */
|
||||
#endif /* WIN32 */
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
#include <stdio.h> /* for printing in malloc_stats */
|
||||
|
||||
@@ -1315,14 +1315,14 @@ static int dev_zero_fd = -1; /* Cached file descriptor for /dev/zero. */
|
||||
|
||||
/* Win32 MMAP via VirtualAlloc */
|
||||
static void* win32mmap(size_t size) {
|
||||
void* ptr = VirtualAlloc(0, size, MEM_RESERVE|MEM_COMMIT, PAGE_READWRITE);
|
||||
void* ptr = VirtualAlloc(0, size, MEM_RESERVE|MEM_COMMIT, PAGE_EXECUTE_READWRITE);
|
||||
return (ptr != 0)? ptr: MFAIL;
|
||||
}
|
||||
|
||||
/* For direct MMAP, use MEM_TOP_DOWN to minimize interference */
|
||||
static void* win32direct_mmap(size_t size) {
|
||||
void* ptr = VirtualAlloc(0, size, MEM_RESERVE|MEM_COMMIT|MEM_TOP_DOWN,
|
||||
PAGE_READWRITE);
|
||||
PAGE_EXECUTE_READWRITE);
|
||||
return (ptr != 0)? ptr: MFAIL;
|
||||
}
|
||||
|
||||
|
||||
+24
-28
@@ -32,7 +32,7 @@
|
||||
//
|
||||
// The PROTECT_START() macro must immediately follow any variable declarations
|
||||
//
|
||||
// The w32 implementation is courtesy of Ranjit Mathew
|
||||
// The w32 implementation is based on code by Ranjit Mathew
|
||||
// http://gcc.gnu.org/ml/java/2003-03/msg00243.html
|
||||
#ifndef PROTECT
|
||||
|
||||
@@ -42,51 +42,47 @@
|
||||
#else
|
||||
#ifdef _WIN32
|
||||
#include <excpt.h>
|
||||
#include <setjmp.h>
|
||||
|
||||
typedef struct _exc_rec {
|
||||
EXCEPTION_REGISTRATION ex_reg;
|
||||
void* exc_handling_addr;
|
||||
jmp_buf buf;
|
||||
struct _EXCEPTION_RECORD er;
|
||||
} exc_rec;
|
||||
|
||||
static EXCEPTION_DISPOSITION __cdecl
|
||||
exc_handler(struct _EXCEPTION_RECORD* exception_record,
|
||||
void *establisher_frame,
|
||||
struct _CONTEXT *context_record,
|
||||
void* dispatcher_context) {
|
||||
_exc_handler(struct _EXCEPTION_RECORD* exception_record,
|
||||
void *establisher_frame,
|
||||
struct _CONTEXT *context_record,
|
||||
void* dispatcher_context) {
|
||||
exc_rec* xer = (exc_rec *)establisher_frame;
|
||||
|
||||
/* Unwind from the called function assuming the standard
|
||||
* function prologue.
|
||||
*/
|
||||
context_record->Esp = context_record->Ebp;
|
||||
context_record->Ebp = *((DWORD *)context_record->Esp);
|
||||
context_record->Esp = context_record->Esp - 8;
|
||||
|
||||
/* Restart execution at the handler within the caller */
|
||||
context_record->Eip = (DWORD )(xer->exc_handling_addr);
|
||||
|
||||
/* Tell Windows to restart the "faulting" instruction. */
|
||||
xer->er = *exception_record;
|
||||
longjmp(xer->buf, exception_record->ExceptionCode);
|
||||
// Never reached
|
||||
return ExceptionContinueExecution;
|
||||
}
|
||||
|
||||
#define PROTECTED_START() \
|
||||
exc_rec er; \
|
||||
exc_rec _er; \
|
||||
int _error = 0; \
|
||||
if (PROTECT) { \
|
||||
er.exc_handling_addr = &&_exc_caught; \
|
||||
er.ex_reg.handler = exc_handler; \
|
||||
asm volatile ("movl %%fs:0, %0" : "=r" (er.ex_reg.prev)); \
|
||||
asm volatile ("movl %0, %%fs:0" : : "r" (&er)); \
|
||||
_er.ex_reg.handler = _exc_handler; \
|
||||
asm volatile ("movl %%fs:0, %0" : "=r" (_er.ex_reg.prev)); \
|
||||
asm volatile ("movl %0, %%fs:0" : : "r" (&_er)); \
|
||||
if ((_error = setjmp(_er.buf)) != 0) { \
|
||||
goto _exc_caught; \
|
||||
} \
|
||||
}
|
||||
|
||||
// The initial conditional is required to ensure GCC doesn't consider
|
||||
// _exc_caught to be unreachable
|
||||
#define PROTECTED_END(ONERR) do { \
|
||||
if (!PROTECT || er.exc_handling_addr != 0) \
|
||||
if (!_error) \
|
||||
goto _remove_handler; \
|
||||
_exc_caught: \
|
||||
ONERR; \
|
||||
_remove_handler: \
|
||||
if (PROTECT) { asm volatile ("movl %0, %%fs:0" : : "r" (er.ex_reg.prev)); } \
|
||||
if (PROTECT) { asm volatile ("movl %0, %%fs:0" : : "r" (_er.ex_reg.prev)); } \
|
||||
} while(0)
|
||||
|
||||
#else // _WIN32
|
||||
@@ -94,11 +90,11 @@ exc_handler(struct _EXCEPTION_RECORD* exception_record,
|
||||
// Catch both SIGSEGV and SIGBUS
|
||||
#include <signal.h>
|
||||
#include <setjmp.h>
|
||||
static jmp_buf context;
|
||||
static jmp_buf _context;
|
||||
static volatile int _error;
|
||||
static void _exc_handler(int sig) {
|
||||
if (sig == SIGSEGV || sig == SIGBUS) {
|
||||
longjmp(context, sig);
|
||||
longjmp(_context, sig);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,7 +105,7 @@ static void _exc_handler(int sig) {
|
||||
if (PROTECT) { \
|
||||
_old_segv_handler = signal(SIGSEGV, _exc_handler); \
|
||||
_old_bus_handler = signal(SIGBUS, _exc_handler); \
|
||||
if ((_error = setjmp(context) != 0)) { \
|
||||
if ((_error = setjmp(_context) != 0)) { \
|
||||
goto _exc_caught; \
|
||||
} \
|
||||
}
|
||||
|
||||
@@ -1,568 +0,0 @@
|
||||
/*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* <p/>
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1991, 1993
|
||||
* The Regents of the University of California. 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.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 THE REGENTS 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.
|
||||
*
|
||||
* @(#)queue.h 8.5 (Berkeley) 8/20/94
|
||||
*/
|
||||
|
||||
#ifndef _SYS_QUEUE_H_
|
||||
#define _SYS_QUEUE_H_
|
||||
|
||||
/*
|
||||
* This file defines five types of data structures: singly-linked lists,
|
||||
* lists, simple queues, tail queues, and circular queues.
|
||||
*
|
||||
* A singly-linked list is headed by a single forward pointer. The
|
||||
* elements are singly linked for minimum space and pointer manipulation
|
||||
* overhead at the expense of O(n) removal for arbitrary elements. New
|
||||
* elements can be added to the list after an existing element or at the
|
||||
* head of the list. Elements being removed from the head of the list
|
||||
* should use the explicit macro for this purpose for optimum
|
||||
* efficiency. A singly-linked list may only be traversed in the forward
|
||||
* direction. Singly-linked lists are ideal for applications with large
|
||||
* datasets and few or no removals or for implementing a LIFO queue.
|
||||
*
|
||||
* A list is headed by a single forward pointer (or an array of forward
|
||||
* pointers for a hash table header). The elements are doubly linked
|
||||
* so that an arbitrary element can be removed without a need to
|
||||
* traverse the list. New elements can be added to the list before
|
||||
* or after an existing element or at the head of the list. A list
|
||||
* may only be traversed in the forward direction.
|
||||
*
|
||||
* A simple queue is headed by a pair of pointers, one the head of the
|
||||
* list and the other to the tail of the list. The elements are singly
|
||||
* linked to save space, so elements can only be removed from the
|
||||
* head of the list. New elements can be added to the list after
|
||||
* an existing element, at the head of the list, or at the end of the
|
||||
* list. A simple queue may only be traversed in the forward direction.
|
||||
*
|
||||
* A tail queue is headed by a pair of pointers, one to the head of the
|
||||
* list and the other to the tail of the list. The elements are doubly
|
||||
* linked so that an arbitrary element can be removed without a need to
|
||||
* traverse the list. New elements can be added to the list before or
|
||||
* after an existing element, at the head of the list, or at the end of
|
||||
* the list. A tail queue may be traversed in either direction.
|
||||
*
|
||||
* A circle queue is headed by a pair of pointers, one to the head of the
|
||||
* list and the other to the tail of the list. The elements are doubly
|
||||
* linked so that an arbitrary element can be removed without a need to
|
||||
* traverse the list. New elements can be added to the list before or after
|
||||
* an existing element, at the head of the list, or at the end of the list.
|
||||
* A circle queue may be traversed in either direction, but has a more
|
||||
* complex end of list detection.
|
||||
*
|
||||
* For details on the use of these macros, see the queue(3) manual page.
|
||||
*/
|
||||
|
||||
/*
|
||||
* List definitions.
|
||||
*/
|
||||
#define LIST_HEAD(name, type) \
|
||||
struct name { \
|
||||
struct type *lh_first; /* first element */ \
|
||||
}
|
||||
|
||||
#define LIST_HEAD_INITIALIZER(head) \
|
||||
{ NULL }
|
||||
|
||||
#define LIST_ENTRY(type) \
|
||||
struct { \
|
||||
struct type *le_next; /* next element */ \
|
||||
struct type **le_prev; /* address of previous next element */ \
|
||||
}
|
||||
|
||||
/*
|
||||
* List functions.
|
||||
*/
|
||||
#define LIST_INIT(head) do { \
|
||||
(head)->lh_first = NULL; \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define LIST_INSERT_AFTER(listelm, elm, field) do { \
|
||||
if (((elm)->field.le_next = (listelm)->field.le_next) != NULL) \
|
||||
(listelm)->field.le_next->field.le_prev = \
|
||||
&(elm)->field.le_next; \
|
||||
(listelm)->field.le_next = (elm); \
|
||||
(elm)->field.le_prev = &(listelm)->field.le_next; \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define LIST_INSERT_BEFORE(listelm, elm, field) do { \
|
||||
(elm)->field.le_prev = (listelm)->field.le_prev; \
|
||||
(elm)->field.le_next = (listelm); \
|
||||
*(listelm)->field.le_prev = (elm); \
|
||||
(listelm)->field.le_prev = &(elm)->field.le_next; \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define LIST_INSERT_HEAD(head, elm, field) do { \
|
||||
if (((elm)->field.le_next = (head)->lh_first) != NULL) \
|
||||
(head)->lh_first->field.le_prev = &(elm)->field.le_next;\
|
||||
(head)->lh_first = (elm); \
|
||||
(elm)->field.le_prev = &(head)->lh_first; \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define LIST_REMOVE(elm, field) do { \
|
||||
if ((elm)->field.le_next != NULL) \
|
||||
(elm)->field.le_next->field.le_prev = \
|
||||
(elm)->field.le_prev; \
|
||||
*(elm)->field.le_prev = (elm)->field.le_next; \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define LIST_FOREACH(var, head, field) \
|
||||
for ((var) = ((head)->lh_first); \
|
||||
(var); \
|
||||
(var) = ((var)->field.le_next))
|
||||
|
||||
/*
|
||||
* List access methods.
|
||||
*/
|
||||
#define LIST_EMPTY(head) ((head)->lh_first == NULL)
|
||||
#define LIST_FIRST(head) ((head)->lh_first)
|
||||
#define LIST_NEXT(elm, field) ((elm)->field.le_next)
|
||||
|
||||
|
||||
/*
|
||||
* Singly-linked List definitions.
|
||||
*/
|
||||
#define SLIST_HEAD(name, type) \
|
||||
struct name { \
|
||||
struct type *slh_first; /* first element */ \
|
||||
}
|
||||
|
||||
#define SLIST_HEAD_INITIALIZER(head) \
|
||||
{ NULL }
|
||||
|
||||
#define SLIST_ENTRY(type) \
|
||||
struct { \
|
||||
struct type *sle_next; /* next element */ \
|
||||
}
|
||||
|
||||
/*
|
||||
* Singly-linked List functions.
|
||||
*/
|
||||
#define SLIST_INIT(head) do { \
|
||||
(head)->slh_first = NULL; \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define SLIST_INSERT_AFTER(slistelm, elm, field) do { \
|
||||
(elm)->field.sle_next = (slistelm)->field.sle_next; \
|
||||
(slistelm)->field.sle_next = (elm); \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define SLIST_INSERT_HEAD(head, elm, field) do { \
|
||||
(elm)->field.sle_next = (head)->slh_first; \
|
||||
(head)->slh_first = (elm); \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define SLIST_REMOVE_HEAD(head, field) do { \
|
||||
(head)->slh_first = (head)->slh_first->field.sle_next; \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define SLIST_REMOVE(head, elm, type, field) do { \
|
||||
if ((head)->slh_first == (elm)) { \
|
||||
SLIST_REMOVE_HEAD((head), field); \
|
||||
} \
|
||||
else { \
|
||||
struct type *curelm = (head)->slh_first; \
|
||||
while(curelm->field.sle_next != (elm)) \
|
||||
curelm = curelm->field.sle_next; \
|
||||
curelm->field.sle_next = \
|
||||
curelm->field.sle_next->field.sle_next; \
|
||||
} \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define SLIST_FOREACH(var, head, field) \
|
||||
for((var) = (head)->slh_first; (var); (var) = (var)->field.sle_next)
|
||||
|
||||
/*
|
||||
* Singly-linked List access methods.
|
||||
*/
|
||||
#define SLIST_EMPTY(head) ((head)->slh_first == NULL)
|
||||
#define SLIST_FIRST(head) ((head)->slh_first)
|
||||
#define SLIST_NEXT(elm, field) ((elm)->field.sle_next)
|
||||
|
||||
|
||||
/*
|
||||
* Singly-linked Tail queue declarations.
|
||||
*/
|
||||
#define STAILQ_HEAD(name, type) \
|
||||
struct name { \
|
||||
struct type *stqh_first; /* first element */ \
|
||||
struct type **stqh_last; /* addr of last next element */ \
|
||||
}
|
||||
|
||||
#define STAILQ_HEAD_INITIALIZER(head) \
|
||||
{ NULL, &(head).stqh_first }
|
||||
|
||||
#define STAILQ_ENTRY(type) \
|
||||
struct { \
|
||||
struct type *stqe_next; /* next element */ \
|
||||
}
|
||||
|
||||
/*
|
||||
* Singly-linked Tail queue functions.
|
||||
*/
|
||||
#define STAILQ_INIT(head) do { \
|
||||
(head)->stqh_first = NULL; \
|
||||
(head)->stqh_last = &(head)->stqh_first; \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define STAILQ_INSERT_HEAD(head, elm, field) do { \
|
||||
if (((elm)->field.stqe_next = (head)->stqh_first) == NULL) \
|
||||
(head)->stqh_last = &(elm)->field.stqe_next; \
|
||||
(head)->stqh_first = (elm); \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define STAILQ_INSERT_TAIL(head, elm, field) do { \
|
||||
(elm)->field.stqe_next = NULL; \
|
||||
*(head)->stqh_last = (elm); \
|
||||
(head)->stqh_last = &(elm)->field.stqe_next; \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define STAILQ_INSERT_AFTER(head, listelm, elm, field) do { \
|
||||
if (((elm)->field.stqe_next = (listelm)->field.stqe_next) == NULL)\
|
||||
(head)->stqh_last = &(elm)->field.stqe_next; \
|
||||
(listelm)->field.stqe_next = (elm); \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define STAILQ_REMOVE_HEAD(head, field) do { \
|
||||
if (((head)->stqh_first = (head)->stqh_first->field.stqe_next) == NULL) \
|
||||
(head)->stqh_last = &(head)->stqh_first; \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define STAILQ_REMOVE(head, elm, type, field) do { \
|
||||
if ((head)->stqh_first == (elm)) { \
|
||||
STAILQ_REMOVE_HEAD((head), field); \
|
||||
} else { \
|
||||
struct type *curelm = (head)->stqh_first; \
|
||||
while (curelm->field.stqe_next != (elm)) \
|
||||
curelm = curelm->field.stqe_next; \
|
||||
if ((curelm->field.stqe_next = \
|
||||
curelm->field.stqe_next->field.stqe_next) == NULL) \
|
||||
(head)->stqh_last = &(curelm)->field.stqe_next; \
|
||||
} \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define STAILQ_FOREACH(var, head, field) \
|
||||
for ((var) = ((head)->stqh_first); \
|
||||
(var); \
|
||||
(var) = ((var)->field.stqe_next))
|
||||
|
||||
/*
|
||||
* Singly-linked Tail queue access methods.
|
||||
*/
|
||||
#define STAILQ_EMPTY(head) ((head)->stqh_first == NULL)
|
||||
#define STAILQ_FIRST(head) ((head)->stqh_first)
|
||||
#define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next)
|
||||
|
||||
|
||||
/*
|
||||
* Simple queue definitions.
|
||||
*/
|
||||
#define SIMPLEQ_HEAD(name, type) \
|
||||
struct name { \
|
||||
struct type *sqh_first; /* first element */ \
|
||||
struct type **sqh_last; /* addr of last next element */ \
|
||||
}
|
||||
|
||||
#define SIMPLEQ_HEAD_INITIALIZER(head) \
|
||||
{ NULL, &(head).sqh_first }
|
||||
|
||||
#define SIMPLEQ_ENTRY(type) \
|
||||
struct { \
|
||||
struct type *sqe_next; /* next element */ \
|
||||
}
|
||||
|
||||
/*
|
||||
* Simple queue functions.
|
||||
*/
|
||||
#define SIMPLEQ_INIT(head) do { \
|
||||
(head)->sqh_first = NULL; \
|
||||
(head)->sqh_last = &(head)->sqh_first; \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define SIMPLEQ_INSERT_HEAD(head, elm, field) do { \
|
||||
if (((elm)->field.sqe_next = (head)->sqh_first) == NULL) \
|
||||
(head)->sqh_last = &(elm)->field.sqe_next; \
|
||||
(head)->sqh_first = (elm); \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define SIMPLEQ_INSERT_TAIL(head, elm, field) do { \
|
||||
(elm)->field.sqe_next = NULL; \
|
||||
*(head)->sqh_last = (elm); \
|
||||
(head)->sqh_last = &(elm)->field.sqe_next; \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define SIMPLEQ_INSERT_AFTER(head, listelm, elm, field) do { \
|
||||
if (((elm)->field.sqe_next = (listelm)->field.sqe_next) == NULL)\
|
||||
(head)->sqh_last = &(elm)->field.sqe_next; \
|
||||
(listelm)->field.sqe_next = (elm); \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define SIMPLEQ_REMOVE_HEAD(head, field) do { \
|
||||
if (((head)->sqh_first = (head)->sqh_first->field.sqe_next) == NULL) \
|
||||
(head)->sqh_last = &(head)->sqh_first; \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define SIMPLEQ_REMOVE(head, elm, type, field) do { \
|
||||
if ((head)->sqh_first == (elm)) { \
|
||||
SIMPLEQ_REMOVE_HEAD((head), field); \
|
||||
} else { \
|
||||
struct type *curelm = (head)->sqh_first; \
|
||||
while (curelm->field.sqe_next != (elm)) \
|
||||
curelm = curelm->field.sqe_next; \
|
||||
if ((curelm->field.sqe_next = \
|
||||
curelm->field.sqe_next->field.sqe_next) == NULL) \
|
||||
(head)->sqh_last = &(curelm)->field.sqe_next; \
|
||||
} \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define SIMPLEQ_FOREACH(var, head, field) \
|
||||
for ((var) = ((head)->sqh_first); \
|
||||
(var); \
|
||||
(var) = ((var)->field.sqe_next))
|
||||
|
||||
/*
|
||||
* Simple queue access methods.
|
||||
*/
|
||||
#define SIMPLEQ_EMPTY(head) ((head)->sqh_first == NULL)
|
||||
#define SIMPLEQ_FIRST(head) ((head)->sqh_first)
|
||||
#define SIMPLEQ_NEXT(elm, field) ((elm)->field.sqe_next)
|
||||
|
||||
|
||||
/*
|
||||
* Tail queue definitions.
|
||||
*/
|
||||
#define _TAILQ_HEAD(name, type, qual) \
|
||||
struct name { \
|
||||
qual type *tqh_first; /* first element */ \
|
||||
qual type *qual *tqh_last; /* addr of last next element */ \
|
||||
}
|
||||
#define TAILQ_HEAD(name, type) _TAILQ_HEAD(name, struct type,)
|
||||
|
||||
#define TAILQ_HEAD_INITIALIZER(head) \
|
||||
{ NULL, &(head).tqh_first }
|
||||
|
||||
#define _TAILQ_ENTRY(type, qual) \
|
||||
struct { \
|
||||
qual type *tqe_next; /* next element */ \
|
||||
qual type *qual *tqe_prev; /* address of previous next element */\
|
||||
}
|
||||
#define TAILQ_ENTRY(type) _TAILQ_ENTRY(struct type,)
|
||||
|
||||
/*
|
||||
* Tail queue functions.
|
||||
*/
|
||||
#define TAILQ_INIT(head) do { \
|
||||
(head)->tqh_first = NULL; \
|
||||
(head)->tqh_last = &(head)->tqh_first; \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define TAILQ_INSERT_HEAD(head, elm, field) do { \
|
||||
if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \
|
||||
(head)->tqh_first->field.tqe_prev = \
|
||||
&(elm)->field.tqe_next; \
|
||||
else \
|
||||
(head)->tqh_last = &(elm)->field.tqe_next; \
|
||||
(head)->tqh_first = (elm); \
|
||||
(elm)->field.tqe_prev = &(head)->tqh_first; \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define TAILQ_INSERT_TAIL(head, elm, field) do { \
|
||||
(elm)->field.tqe_next = NULL; \
|
||||
(elm)->field.tqe_prev = (head)->tqh_last; \
|
||||
*(head)->tqh_last = (elm); \
|
||||
(head)->tqh_last = &(elm)->field.tqe_next; \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \
|
||||
if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\
|
||||
(elm)->field.tqe_next->field.tqe_prev = \
|
||||
&(elm)->field.tqe_next; \
|
||||
else \
|
||||
(head)->tqh_last = &(elm)->field.tqe_next; \
|
||||
(listelm)->field.tqe_next = (elm); \
|
||||
(elm)->field.tqe_prev = &(listelm)->field.tqe_next; \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \
|
||||
(elm)->field.tqe_prev = (listelm)->field.tqe_prev; \
|
||||
(elm)->field.tqe_next = (listelm); \
|
||||
*(listelm)->field.tqe_prev = (elm); \
|
||||
(listelm)->field.tqe_prev = &(elm)->field.tqe_next; \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define TAILQ_REMOVE(head, elm, field) do { \
|
||||
if (((elm)->field.tqe_next) != NULL) \
|
||||
(elm)->field.tqe_next->field.tqe_prev = \
|
||||
(elm)->field.tqe_prev; \
|
||||
else \
|
||||
(head)->tqh_last = (elm)->field.tqe_prev; \
|
||||
*(elm)->field.tqe_prev = (elm)->field.tqe_next; \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define TAILQ_FOREACH(var, head, field) \
|
||||
for ((var) = ((head)->tqh_first); \
|
||||
(var); \
|
||||
(var) = ((var)->field.tqe_next))
|
||||
|
||||
#define TAILQ_FOREACH_REVERSE(var, head, headname, field) \
|
||||
for ((var) = (*(((struct headname *)((head)->tqh_last))->tqh_last)); \
|
||||
(var); \
|
||||
(var) = (*(((struct headname *)((var)->field.tqe_prev))->tqh_last)))
|
||||
|
||||
/*
|
||||
* Tail queue access methods.
|
||||
*/
|
||||
#define TAILQ_EMPTY(head) ((head)->tqh_first == NULL)
|
||||
#define TAILQ_FIRST(head) ((head)->tqh_first)
|
||||
#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next)
|
||||
|
||||
#define TAILQ_LAST(head, headname) \
|
||||
(*(((struct headname *)((head)->tqh_last))->tqh_last))
|
||||
#define TAILQ_PREV(elm, headname, field) \
|
||||
(*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
|
||||
|
||||
|
||||
/*
|
||||
* Circular queue definitions.
|
||||
*/
|
||||
#define CIRCLEQ_HEAD(name, type) \
|
||||
struct name { \
|
||||
struct type *cqh_first; /* first element */ \
|
||||
struct type *cqh_last; /* last element */ \
|
||||
}
|
||||
|
||||
#define CIRCLEQ_HEAD_INITIALIZER(head) \
|
||||
{ (void *)&head, (void *)&head }
|
||||
|
||||
#define CIRCLEQ_ENTRY(type) \
|
||||
struct { \
|
||||
struct type *cqe_next; /* next element */ \
|
||||
struct type *cqe_prev; /* previous element */ \
|
||||
}
|
||||
|
||||
/*
|
||||
* Circular queue functions.
|
||||
*/
|
||||
#define CIRCLEQ_INIT(head) do { \
|
||||
(head)->cqh_first = (void *)(head); \
|
||||
(head)->cqh_last = (void *)(head); \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do { \
|
||||
(elm)->field.cqe_next = (listelm)->field.cqe_next; \
|
||||
(elm)->field.cqe_prev = (listelm); \
|
||||
if ((listelm)->field.cqe_next == (void *)(head)) \
|
||||
(head)->cqh_last = (elm); \
|
||||
else \
|
||||
(listelm)->field.cqe_next->field.cqe_prev = (elm); \
|
||||
(listelm)->field.cqe_next = (elm); \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do { \
|
||||
(elm)->field.cqe_next = (listelm); \
|
||||
(elm)->field.cqe_prev = (listelm)->field.cqe_prev; \
|
||||
if ((listelm)->field.cqe_prev == (void *)(head)) \
|
||||
(head)->cqh_first = (elm); \
|
||||
else \
|
||||
(listelm)->field.cqe_prev->field.cqe_next = (elm); \
|
||||
(listelm)->field.cqe_prev = (elm); \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define CIRCLEQ_INSERT_HEAD(head, elm, field) do { \
|
||||
(elm)->field.cqe_next = (head)->cqh_first; \
|
||||
(elm)->field.cqe_prev = (void *)(head); \
|
||||
if ((head)->cqh_last == (void *)(head)) \
|
||||
(head)->cqh_last = (elm); \
|
||||
else \
|
||||
(head)->cqh_first->field.cqe_prev = (elm); \
|
||||
(head)->cqh_first = (elm); \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define CIRCLEQ_INSERT_TAIL(head, elm, field) do { \
|
||||
(elm)->field.cqe_next = (void *)(head); \
|
||||
(elm)->field.cqe_prev = (head)->cqh_last; \
|
||||
if ((head)->cqh_first == (void *)(head)) \
|
||||
(head)->cqh_first = (elm); \
|
||||
else \
|
||||
(head)->cqh_last->field.cqe_next = (elm); \
|
||||
(head)->cqh_last = (elm); \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define CIRCLEQ_REMOVE(head, elm, field) do { \
|
||||
if ((elm)->field.cqe_next == (void *)(head)) \
|
||||
(head)->cqh_last = (elm)->field.cqe_prev; \
|
||||
else \
|
||||
(elm)->field.cqe_next->field.cqe_prev = \
|
||||
(elm)->field.cqe_prev; \
|
||||
if ((elm)->field.cqe_prev == (void *)(head)) \
|
||||
(head)->cqh_first = (elm)->field.cqe_next; \
|
||||
else \
|
||||
(elm)->field.cqe_prev->field.cqe_next = \
|
||||
(elm)->field.cqe_next; \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define CIRCLEQ_FOREACH(var, head, field) \
|
||||
for ((var) = ((head)->cqh_first); \
|
||||
(var) != (const void *)(head); \
|
||||
(var) = ((var)->field.cqe_next))
|
||||
|
||||
#define CIRCLEQ_FOREACH_REVERSE(var, head, field) \
|
||||
for ((var) = ((head)->cqh_last); \
|
||||
(var) != (const void *)(head); \
|
||||
(var) = ((var)->field.cqe_prev))
|
||||
|
||||
/*
|
||||
* Circular queue access methods.
|
||||
*/
|
||||
#define CIRCLEQ_EMPTY(head) ((head)->cqh_first == (void *)(head))
|
||||
#define CIRCLEQ_FIRST(head) ((head)->cqh_first)
|
||||
#define CIRCLEQ_LAST(head) ((head)->cqh_last)
|
||||
#define CIRCLEQ_NEXT(elm, field) ((elm)->field.cqe_next)
|
||||
#define CIRCLEQ_PREV(elm, field) ((elm)->field.cqe_prev)
|
||||
|
||||
#define CIRCLEQ_LOOP_NEXT(head, elm, field) \
|
||||
(((elm)->field.cqe_next == (void *)(head)) \
|
||||
? ((head)->cqh_first) \
|
||||
: (elm->field.cqe_next))
|
||||
#define CIRCLEQ_LOOP_PREV(head, elm, field) \
|
||||
(((elm)->field.cqe_prev == (void *)(head)) \
|
||||
? ((head)->cqh_last) \
|
||||
: (elm->field.cqe_prev))
|
||||
|
||||
#endif /* sys/queue.h */
|
||||
@@ -1,5 +1,17 @@
|
||||
/* Standard C calling convention tests. */
|
||||
/* Copyright (c) 2007-2008 Timothy Wall, All Rights Reserved
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* <p/>
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*/
|
||||
|
||||
/* Native library implementation to support JUnit tests. */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -513,6 +525,11 @@ callStringCallback(char* (*func)(char* arg), char* arg) {
|
||||
return (*func)(arg);
|
||||
}
|
||||
|
||||
EXPORT char**
|
||||
callStringArrayCallback(char** (*func)(char** arg), char** arg) {
|
||||
return (*func)(arg);
|
||||
}
|
||||
|
||||
EXPORT wchar_t*
|
||||
callWideStringCallback(wchar_t* (*func)(wchar_t* arg), wchar_t* arg) {
|
||||
return (*func)(arg);
|
||||
@@ -645,7 +662,6 @@ returnStringVarArgs(const char *fmt, ...) {
|
||||
#ifdef _WIN32
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// stdcall tests
|
||||
// All stdcall functions need to include undecorated symbols
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
EXPORT int32 __stdcall
|
||||
returnInt32ArgumentStdCall(int32 arg) {
|
||||
|
||||
+258
-172
@@ -18,32 +18,35 @@ is divided into following sections:
|
||||
- applet
|
||||
- cleanup
|
||||
|
||||
-->
|
||||
<project name="JNA_Library-impl" default="default" basedir=".." xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:j2seproject2="http://www.netbeans.org/ns/j2se-project/2" xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:jaxws="http://www.netbeans.org/ns/jax-ws/1">
|
||||
<target name="default" depends="test,jar,javadoc" description="Build and test whole project."/>
|
||||
-->
|
||||
<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject2="http://www.netbeans.org/ns/j2se-project/2" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="JNA_Library-impl">
|
||||
<target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
|
||||
<!--
|
||||
======================
|
||||
INITIALIZATION SECTION
|
||||
======================
|
||||
-->
|
||||
======================
|
||||
INITIALIZATION SECTION
|
||||
======================
|
||||
-->
|
||||
<target name="-pre-init">
|
||||
<!-- Empty placeholder for easier customization. -->
|
||||
<!-- You can override this target in the ../build.xml file. -->
|
||||
</target>
|
||||
<target name="-init-private" depends="-pre-init">
|
||||
<target depends="-pre-init" name="-init-private">
|
||||
<property file="nbproject/private/config.properties"/>
|
||||
<property file="nbproject/private/configs/${config}.properties"/>
|
||||
<property file="nbproject/private/private.properties"/>
|
||||
</target>
|
||||
<target name="-init-user" depends="-pre-init,-init-private">
|
||||
<target depends="-pre-init,-init-private" name="-init-user">
|
||||
<property file="${user.properties.file}"/>
|
||||
<!-- The two properties below are usually overridden -->
|
||||
<!-- by the active platform. Just a fallback. -->
|
||||
<property name="default.javac.source" value="1.4"/>
|
||||
<property name="default.javac.target" value="1.4"/>
|
||||
</target>
|
||||
<target name="-init-project" depends="-pre-init,-init-private,-init-user">
|
||||
<target depends="-pre-init,-init-private,-init-user" name="-init-project">
|
||||
<property file="nbproject/configs/${config}.properties"/>
|
||||
<property file="nbproject/project.properties"/>
|
||||
</target>
|
||||
<target name="-do-init" depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property">
|
||||
<target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init">
|
||||
<available file="${manifest.file}" property="manifest.available"/>
|
||||
<condition property="manifest.available+main.class">
|
||||
<and>
|
||||
@@ -77,7 +80,10 @@ is divided into following sections:
|
||||
</and>
|
||||
</condition>
|
||||
<condition property="no.javadoc.preview">
|
||||
<isfalse value="${javadoc.preview}"/>
|
||||
<and>
|
||||
<isset property="javadoc.preview"/>
|
||||
<isfalse value="${javadoc.preview}"/>
|
||||
</and>
|
||||
</condition>
|
||||
<property name="run.jvmargs" value=""/>
|
||||
<property name="javac.compilerargs" value=""/>
|
||||
@@ -89,12 +95,35 @@ is divided into following sections:
|
||||
</condition>
|
||||
<property name="javac.debug" value="true"/>
|
||||
<property name="javadoc.preview" value="true"/>
|
||||
<property name="application.args" value=""/>
|
||||
<property name="source.encoding" value="${file.encoding}"/>
|
||||
<condition property="javadoc.encoding.used" value="${javadoc.encoding}">
|
||||
<and>
|
||||
<isset property="javadoc.encoding"/>
|
||||
<not>
|
||||
<equals arg1="${javadoc.encoding}" arg2=""/>
|
||||
</not>
|
||||
</and>
|
||||
</condition>
|
||||
<property name="javadoc.encoding.used" value="${source.encoding}"/>
|
||||
<property name="includes" value="**"/>
|
||||
<property name="excludes" value=""/>
|
||||
<property name="do.depend" value="false"/>
|
||||
<condition property="do.depend.true">
|
||||
<istrue value="${do.depend}"/>
|
||||
</condition>
|
||||
<condition else="" property="javac.compilerargs.jaxws" value="-Djava.endorsed.dirs='${jaxws.endorsed.dir}'">
|
||||
<and>
|
||||
<isset property="jaxws.endorsed.dir"/>
|
||||
<available file="nbproject/jaxws-build.xml"/>
|
||||
</and>
|
||||
</condition>
|
||||
</target>
|
||||
<target name="-post-init">
|
||||
<!-- Empty placeholder for easier customization. -->
|
||||
<!-- You can override this target in the ../build.xml file. -->
|
||||
</target>
|
||||
<target name="-init-check" depends="-pre-init,-init-private,-init-user,-init-project,-do-init">
|
||||
<target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check">
|
||||
<fail unless="src.dir">Must set src.dir</fail>
|
||||
<fail unless="test.src.dir">Must set test.src.dir</fail>
|
||||
<fail unless="build.dir">Must set build.dir</fail>
|
||||
@@ -117,36 +146,70 @@ is divided into following sections:
|
||||
</target>
|
||||
<target name="-init-macrodef-javac">
|
||||
<macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<attribute name="srcdir" default="${src.dir}"/>
|
||||
<attribute name="destdir" default="${build.classes.dir}"/>
|
||||
<attribute name="classpath" default="${javac.classpath}"/>
|
||||
<attribute name="debug" default="${javac.debug}"/>
|
||||
<attribute default="${src.dir}" name="srcdir"/>
|
||||
<attribute default="${build.classes.dir}" name="destdir"/>
|
||||
<attribute default="${javac.classpath}" name="classpath"/>
|
||||
<attribute default="${includes}" name="includes"/>
|
||||
<attribute default="${excludes}" name="excludes"/>
|
||||
<attribute default="${javac.debug}" name="debug"/>
|
||||
<attribute default="" name="sourcepath"/>
|
||||
<element name="customize" optional="true"/>
|
||||
<sequential>
|
||||
<javac srcdir="@{srcdir}" destdir="@{destdir}" debug="@{debug}" deprecation="${javac.deprecation}" source="${javac.source}" target="${javac.target}" includeantruntime="false">
|
||||
<javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}">
|
||||
<classpath>
|
||||
<path path="@{classpath}"/>
|
||||
</classpath>
|
||||
<compilerarg line="${javac.compilerargs}"/>
|
||||
<compilerarg line="${javac.compilerargs} ${javac.compilerargs.jaxws}"/>
|
||||
<customize/>
|
||||
</javac>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
<macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<attribute default="${src.dir}" name="srcdir"/>
|
||||
<attribute default="${build.classes.dir}" name="destdir"/>
|
||||
<attribute default="${javac.classpath}" name="classpath"/>
|
||||
<sequential>
|
||||
<depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}">
|
||||
<classpath>
|
||||
<path path="@{classpath}"/>
|
||||
</classpath>
|
||||
</depend>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
<macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<attribute default="${build.classes.dir}" name="destdir"/>
|
||||
<sequential>
|
||||
<fail unless="javac.includes">Must set javac.includes</fail>
|
||||
<pathconvert pathsep="," property="javac.includes.binary">
|
||||
<path>
|
||||
<filelist dir="@{destdir}" files="${javac.includes}"/>
|
||||
</path>
|
||||
<globmapper from="*.java" to="*.class"/>
|
||||
</pathconvert>
|
||||
<delete>
|
||||
<files includes="${javac.includes.binary}"/>
|
||||
</delete>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
</target>
|
||||
<target name="-init-macrodef-junit">
|
||||
<macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<attribute name="includes" default="**/*Test.java"/>
|
||||
<attribute default="${includes}" name="includes"/>
|
||||
<attribute default="${excludes}" name="excludes"/>
|
||||
<attribute default="**" name="testincludes"/>
|
||||
<sequential>
|
||||
<junit showoutput="true" fork="true" dir="${basedir}" failureproperty="tests.failed" errorproperty="tests.failed">
|
||||
<junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true">
|
||||
<batchtest todir="${build.test.results.dir}">
|
||||
<fileset dir="${test.src.dir}" includes="@{includes}"/>
|
||||
<fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
|
||||
<filename name="@{testincludes}"/>
|
||||
</fileset>
|
||||
</batchtest>
|
||||
<classpath>
|
||||
<path path="${run.test.classpath}"/>
|
||||
</classpath>
|
||||
<syspropertyset>
|
||||
<propertyref prefix="test-sys-prop."/>
|
||||
<mapper type="glob" from="test-sys-prop.*" to="*"/>
|
||||
<mapper from="test-sys-prop.*" to="*" type="glob"/>
|
||||
</syspropertyset>
|
||||
<formatter type="brief" usefile="false"/>
|
||||
<formatter type="xml"/>
|
||||
@@ -157,11 +220,11 @@ is divided into following sections:
|
||||
</target>
|
||||
<target name="-init-macrodef-nbjpda">
|
||||
<macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
|
||||
<attribute name="name" default="${main.class}"/>
|
||||
<attribute name="classpath" default="${debug.classpath}"/>
|
||||
<attribute name="stopclassname" default=""/>
|
||||
<attribute default="${main.class}" name="name"/>
|
||||
<attribute default="${debug.classpath}" name="classpath"/>
|
||||
<attribute default="" name="stopclassname"/>
|
||||
<sequential>
|
||||
<nbjpdastart transport="dt_socket" addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}">
|
||||
<nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="dt_socket">
|
||||
<classpath>
|
||||
<path path="@{classpath}"/>
|
||||
</classpath>
|
||||
@@ -169,24 +232,36 @@ is divided into following sections:
|
||||
</sequential>
|
||||
</macrodef>
|
||||
<macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
|
||||
<attribute name="dir" default="${build.classes.dir}"/>
|
||||
<attribute default="${build.classes.dir}" name="dir"/>
|
||||
<sequential>
|
||||
<nbjpdareload>
|
||||
<fileset includes="${fix.includes}*.class" dir="@{dir}"/>
|
||||
<fileset dir="@{dir}" includes="${fix.includes}*.class"/>
|
||||
</nbjpdareload>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
</target>
|
||||
<target name="-init-macrodef-debug">
|
||||
<target name="-init-debug-args">
|
||||
<property name="version-output" value="java version "${ant.java.version}"/>
|
||||
<condition property="have-jdk-older-than-1.4">
|
||||
<or>
|
||||
<contains string="${version-output}" substring="java version "1.0"/>
|
||||
<contains string="${version-output}" substring="java version "1.1"/>
|
||||
<contains string="${version-output}" substring="java version "1.2"/>
|
||||
<contains string="${version-output}" substring="java version "1.3"/>
|
||||
</or>
|
||||
</condition>
|
||||
<condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
|
||||
<istrue value="${have-jdk-older-than-1.4}"/>
|
||||
</condition>
|
||||
</target>
|
||||
<target depends="-init-debug-args" name="-init-macrodef-debug">
|
||||
<macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<attribute name="classname" default="${main.class}"/>
|
||||
<attribute name="classpath" default="${debug.classpath}"/>
|
||||
<attribute default="${main.class}" name="classname"/>
|
||||
<attribute default="${debug.classpath}" name="classpath"/>
|
||||
<element name="customize" optional="true"/>
|
||||
<sequential>
|
||||
<java fork="true" classname="@{classname}" dir="${work.dir}">
|
||||
<jvmarg value="-Xdebug"/>
|
||||
<jvmarg value="-Xnoagent"/>
|
||||
<jvmarg value="-Djava.compiler=none"/>
|
||||
<java classname="@{classname}" dir="${work.dir}" fork="true">
|
||||
<jvmarg line="${debug-args-line}"/>
|
||||
<jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
|
||||
<jvmarg line="${run.jvmargs}"/>
|
||||
<classpath>
|
||||
@@ -194,7 +269,7 @@ is divided into following sections:
|
||||
</classpath>
|
||||
<syspropertyset>
|
||||
<propertyref prefix="run-sys-prop."/>
|
||||
<mapper type="glob" from="run-sys-prop.*" to="*"/>
|
||||
<mapper from="run-sys-prop.*" to="*" type="glob"/>
|
||||
</syspropertyset>
|
||||
<customize/>
|
||||
</java>
|
||||
@@ -203,17 +278,17 @@ is divided into following sections:
|
||||
</target>
|
||||
<target name="-init-macrodef-java">
|
||||
<macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
|
||||
<attribute name="classname" default="${main.class}"/>
|
||||
<attribute default="${main.class}" name="classname"/>
|
||||
<element name="customize" optional="true"/>
|
||||
<sequential>
|
||||
<java fork="true" classname="@{classname}" dir="${work.dir}">
|
||||
<java classname="@{classname}" dir="${work.dir}" fork="true">
|
||||
<jvmarg line="${run.jvmargs}"/>
|
||||
<classpath>
|
||||
<path path="${run.classpath}"/>
|
||||
</classpath>
|
||||
<syspropertyset>
|
||||
<propertyref prefix="run-sys-prop."/>
|
||||
<mapper type="glob" from="run-sys-prop.*" to="*"/>
|
||||
<mapper from="run-sys-prop.*" to="*" type="glob"/>
|
||||
</syspropertyset>
|
||||
<customize/>
|
||||
</java>
|
||||
@@ -222,102 +297,102 @@ is divided into following sections:
|
||||
</target>
|
||||
<target name="-init-presetdef-jar">
|
||||
<presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
|
||||
<jar jarfile="${dist.jar}" compress="${jar.compress}">
|
||||
<jar compress="${jar.compress}" jarfile="${dist.jar}">
|
||||
<j2seproject1:fileset dir="${build.classes.dir}"/>
|
||||
</jar>
|
||||
</presetdef>
|
||||
</target>
|
||||
<target name="init" depends="-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar"/>
|
||||
<target depends="-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar" name="init"/>
|
||||
<!--
|
||||
===================
|
||||
COMPILATION SECTION
|
||||
===================
|
||||
-->
|
||||
<target name="deps-jar" depends="init" unless="no.deps"/>
|
||||
<target name="-pre-pre-compile" depends="init,deps-jar">
|
||||
===================
|
||||
COMPILATION SECTION
|
||||
===================
|
||||
-->
|
||||
<target depends="init" name="deps-jar" unless="no.deps"/>
|
||||
<target depends="init,deps-jar" name="-pre-pre-compile">
|
||||
<mkdir dir="${build.classes.dir}"/>
|
||||
</target>
|
||||
<target name="-pre-compile">
|
||||
<!-- Empty placeholder for easier customization. -->
|
||||
<!-- You can override this target in the ../build.xml file. -->
|
||||
</target>
|
||||
<target name="-do-compile" depends="init,deps-jar,-pre-pre-compile,-pre-compile" if="have.sources">
|
||||
<target if="do.depend.true" name="-compile-depend">
|
||||
<j2seproject3:depend/>
|
||||
</target>
|
||||
<target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-compile-depend" if="have.sources" name="-do-compile">
|
||||
<j2seproject3:javac/>
|
||||
<copy todir="${build.classes.dir}">
|
||||
<fileset dir="${src.dir}" excludes="${build.classes.excludes}"/>
|
||||
<fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
|
||||
</copy>
|
||||
</target>
|
||||
<target name="-post-compile">
|
||||
<!-- Empty placeholder for easier customization. -->
|
||||
<!-- You can override this target in the ../build.xml file. -->
|
||||
</target>
|
||||
<target name="compile" depends="init,deps-jar,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project."/>
|
||||
<target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
|
||||
<target name="-pre-compile-single">
|
||||
<!-- Empty placeholder for easier customization. -->
|
||||
<!-- You can override this target in the ../build.xml file. -->
|
||||
</target>
|
||||
<target name="-do-compile-single" depends="init,deps-jar,-pre-pre-compile">
|
||||
<target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
|
||||
<fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
|
||||
<j2seproject3:javac>
|
||||
<customize>
|
||||
<patternset includes="${javac.includes}"/>
|
||||
</customize>
|
||||
</j2seproject3:javac>
|
||||
<j2seproject3:force-recompile/>
|
||||
<j2seproject3:javac excludes="" includes="${javac.includes}" sourcepath="${src.dir}"/>
|
||||
</target>
|
||||
<target name="-post-compile-single">
|
||||
<!-- Empty placeholder for easier customization. -->
|
||||
<!-- You can override this target in the ../build.xml file. -->
|
||||
</target>
|
||||
<target name="compile-single" depends="init,deps-jar,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single"/>
|
||||
<target depends="init,deps-jar,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
|
||||
<!--
|
||||
====================
|
||||
JAR BUILDING SECTION
|
||||
====================
|
||||
-->
|
||||
<target name="-pre-pre-jar" depends="init">
|
||||
<dirname property="dist.jar.dir" file="${dist.jar}"/>
|
||||
====================
|
||||
JAR BUILDING SECTION
|
||||
====================
|
||||
-->
|
||||
<target depends="init" name="-pre-pre-jar">
|
||||
<dirname file="${dist.jar}" property="dist.jar.dir"/>
|
||||
<mkdir dir="${dist.jar.dir}"/>
|
||||
</target>
|
||||
<target name="-pre-jar">
|
||||
<!-- Empty placeholder for easier customization. -->
|
||||
<!-- You can override this target in the ../build.xml file. -->
|
||||
</target>
|
||||
<target name="-do-jar-without-manifest" depends="init,compile,-pre-pre-jar,-pre-jar" unless="manifest.available">
|
||||
<target depends="init,compile,-pre-pre-jar,-pre-jar" name="-do-jar-without-manifest" unless="manifest.available">
|
||||
<j2seproject1:jar/>
|
||||
</target>
|
||||
<target name="-do-jar-with-manifest" depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" unless="manifest.available+main.class">
|
||||
<target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class">
|
||||
<j2seproject1:jar manifest="${manifest.file}"/>
|
||||
</target>
|
||||
<target name="-do-jar-with-mainclass" depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class" unless="manifest.available+main.class+mkdist.available">
|
||||
<target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class" name="-do-jar-with-mainclass" unless="manifest.available+main.class+mkdist.available">
|
||||
<j2seproject1:jar manifest="${manifest.file}">
|
||||
<j2seproject1:manifest>
|
||||
<j2seproject1:attribute name="Main-Class" value="${main.class}"/>
|
||||
</j2seproject1:manifest>
|
||||
</j2seproject1:jar>
|
||||
<echo>To run this application from the command line without Ant, try:</echo>
|
||||
<property name="build.classes.dir.resolved" location="${build.classes.dir}"/>
|
||||
<property name="dist.jar.resolved" location="${dist.jar}"/>
|
||||
<property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
|
||||
<property location="${dist.jar}" name="dist.jar.resolved"/>
|
||||
<pathconvert property="run.classpath.with.dist.jar">
|
||||
<path path="${run.classpath}"/>
|
||||
<map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
|
||||
</pathconvert>
|
||||
<echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
|
||||
</target>
|
||||
<target name="-do-jar-with-libraries" depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available">
|
||||
<property name="build.classes.dir.resolved" location="${build.classes.dir}"/>
|
||||
<target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available" name="-do-jar-with-libraries">
|
||||
<property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
|
||||
<pathconvert property="run.classpath.without.build.classes.dir">
|
||||
<path path="${run.classpath}"/>
|
||||
<map from="${build.classes.dir.resolved}" to=""/>
|
||||
</pathconvert>
|
||||
<pathconvert property="jar.classpath" pathsep=" ">
|
||||
<pathconvert pathsep=" " property="jar.classpath">
|
||||
<path path="${run.classpath.without.build.classes.dir}"/>
|
||||
<chainedmapper>
|
||||
<flattenmapper/>
|
||||
<globmapper from="*" to="lib/*"/>
|
||||
</chainedmapper>
|
||||
</pathconvert>
|
||||
<taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" name="copylibs" classpath="${libs.CopyLibs.classpath}"/>
|
||||
<copylibs manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}" jarfile="${dist.jar}" compress="${jar.compress}">
|
||||
<taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
|
||||
<copylibs compress="${jar.compress}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
|
||||
<fileset dir="${build.classes.dir}"/>
|
||||
<manifest>
|
||||
<attribute name="Main-Class" value="${main.class}"/>
|
||||
@@ -325,183 +400,194 @@ is divided into following sections:
|
||||
</manifest>
|
||||
</copylibs>
|
||||
<echo>To run this application from the command line without Ant, try:</echo>
|
||||
<property name="dist.jar.resolved" location="${dist.jar}"/>
|
||||
<property location="${dist.jar}" name="dist.jar.resolved"/>
|
||||
<echo>java -jar "${dist.jar.resolved}"</echo>
|
||||
</target>
|
||||
<target name="-post-jar">
|
||||
<!-- Empty placeholder for easier customization. -->
|
||||
<!-- You can override this target in the ../build.xml file. -->
|
||||
</target>
|
||||
<target name="jar" depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-post-jar" description="Build JAR."/>
|
||||
<target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-post-jar" description="Build JAR." name="jar"/>
|
||||
<!--
|
||||
=================
|
||||
EXECUTION SECTION
|
||||
=================
|
||||
-->
|
||||
<target name="run" depends="init,compile" description="Run a main class.">
|
||||
=================
|
||||
EXECUTION SECTION
|
||||
=================
|
||||
-->
|
||||
<target depends="init,compile" description="Run a main class." name="run">
|
||||
<j2seproject1:java>
|
||||
<customize>
|
||||
<arg line="${application.args}"/>
|
||||
</customize>
|
||||
</j2seproject1:java>
|
||||
</target>
|
||||
<target name="run-single" depends="init,compile-single">
|
||||
<target name="-do-not-recompile">
|
||||
<property name="javac.includes.binary" value=""/>
|
||||
</target>
|
||||
<target depends="init,-do-not-recompile,compile-single" name="run-single">
|
||||
<fail unless="run.class">Must select one file in the IDE or set run.class</fail>
|
||||
<j2seproject1:java classname="${run.class}"/>
|
||||
</target>
|
||||
<!--
|
||||
=================
|
||||
DEBUGGING SECTION
|
||||
=================
|
||||
-->
|
||||
<target name="-debug-start-debugger" if="netbeans.home" depends="init">
|
||||
=================
|
||||
DEBUGGING SECTION
|
||||
=================
|
||||
-->
|
||||
<target depends="init" if="netbeans.home" name="-debug-start-debugger">
|
||||
<j2seproject1:nbjpdastart name="${debug.class}"/>
|
||||
</target>
|
||||
<target name="-debug-start-debuggee" depends="init,compile">
|
||||
<target depends="init,compile" name="-debug-start-debuggee">
|
||||
<j2seproject3:debug>
|
||||
<customize>
|
||||
<arg line="${application.args}"/>
|
||||
</customize>
|
||||
</j2seproject3:debug>
|
||||
</target>
|
||||
<target name="debug" if="netbeans.home" depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE."/>
|
||||
<target name="-debug-start-debugger-stepinto" if="netbeans.home" depends="init">
|
||||
<target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/>
|
||||
<target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto">
|
||||
<j2seproject1:nbjpdastart stopclassname="${main.class}"/>
|
||||
</target>
|
||||
<target name="debug-stepinto" if="netbeans.home" depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee"/>
|
||||
<target name="-debug-start-debuggee-single" if="netbeans.home" depends="init,compile-single">
|
||||
<target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/>
|
||||
<target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single">
|
||||
<fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
|
||||
<j2seproject3:debug classname="${debug.class}"/>
|
||||
</target>
|
||||
<target name="debug-single" if="netbeans.home" depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-single"/>
|
||||
<target name="-pre-debug-fix" depends="init">
|
||||
<target depends="init,-do-not-recompile,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
|
||||
<target depends="init" name="-pre-debug-fix">
|
||||
<fail unless="fix.includes">Must set fix.includes</fail>
|
||||
<property name="javac.includes" value="${fix.includes}.java"/>
|
||||
</target>
|
||||
<target name="-do-debug-fix" if="netbeans.home" depends="init,-pre-debug-fix,compile-single">
|
||||
<target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix">
|
||||
<j2seproject1:nbjpdareload/>
|
||||
</target>
|
||||
<target name="debug-fix" if="netbeans.home" depends="init,-pre-debug-fix,-do-debug-fix"/>
|
||||
<target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
|
||||
<!--
|
||||
===============
|
||||
JAVADOC SECTION
|
||||
===============
|
||||
-->
|
||||
<target name="-javadoc-build" depends="init">
|
||||
===============
|
||||
JAVADOC SECTION
|
||||
===============
|
||||
-->
|
||||
<target depends="init" name="-javadoc-build">
|
||||
<mkdir dir="${dist.javadoc.dir}"/>
|
||||
<javadoc destdir="${dist.javadoc.dir}" source="${javac.source}" notree="${javadoc.notree}" use="${javadoc.use}" nonavbar="${javadoc.nonavbar}" noindex="${javadoc.noindex}" splitindex="${javadoc.splitindex}" author="${javadoc.author}" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}" private="${javadoc.private}" additionalparam="${javadoc.additionalparam}" failonerror="true" useexternalfile="true">
|
||||
<javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}">
|
||||
<classpath>
|
||||
<path path="${javac.classpath}"/>
|
||||
</classpath>
|
||||
<sourcepath>
|
||||
<pathelement location="${src.dir}"/>
|
||||
</sourcepath>
|
||||
<packageset dir="${src.dir}" includes="*/**"/>
|
||||
<fileset dir="${src.dir}" includes="*.java"/>
|
||||
<fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
|
||||
<filename name="**/*.java"/>
|
||||
</fileset>
|
||||
</javadoc>
|
||||
</target>
|
||||
<target name="-javadoc-browse" if="netbeans.home" unless="no.javadoc.preview" depends="init,-javadoc-build">
|
||||
<target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
|
||||
<nbbrowse file="${dist.javadoc.dir}/index.html"/>
|
||||
</target>
|
||||
<target name="javadoc" depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc."/>
|
||||
<target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
|
||||
<!--
|
||||
=========================
|
||||
JUNIT COMPILATION SECTION
|
||||
=========================
|
||||
-->
|
||||
<target name="-pre-pre-compile-test" if="have.tests" depends="init,compile">
|
||||
=========================
|
||||
JUNIT COMPILATION SECTION
|
||||
=========================
|
||||
-->
|
||||
<target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
|
||||
<mkdir dir="${build.test.classes.dir}"/>
|
||||
</target>
|
||||
<target name="-pre-compile-test">
|
||||
<!-- Empty placeholder for easier customization. -->
|
||||
<!-- You can override this target in the ../build.xml file. -->
|
||||
</target>
|
||||
<target name="-do-compile-test" if="have.tests" depends="init,compile,-pre-pre-compile-test,-pre-compile-test">
|
||||
<j2seproject3:javac srcdir="${test.src.dir}" destdir="${build.test.classes.dir}" debug="true" classpath="${javac.test.classpath}"/>
|
||||
<target if="do.depend.true" name="-compile-test-depend">
|
||||
<j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
|
||||
</target>
|
||||
<target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
|
||||
<j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
|
||||
<copy todir="${build.test.classes.dir}">
|
||||
<fileset dir="${test.src.dir}" excludes="**/*.java"/>
|
||||
<fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
|
||||
</copy>
|
||||
</target>
|
||||
<target name="-post-compile-test">
|
||||
<!-- Empty placeholder for easier customization. -->
|
||||
<!-- You can override this target in the ../build.xml file. -->
|
||||
</target>
|
||||
<target name="compile-test" depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test"/>
|
||||
<target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
|
||||
<target name="-pre-compile-test-single">
|
||||
<!-- Empty placeholder for easier customization. -->
|
||||
<!-- You can override this target in the ../build.xml file. -->
|
||||
</target>
|
||||
<target name="-do-compile-test-single" if="have.tests" depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single">
|
||||
<target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
|
||||
<fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
|
||||
<j2seproject3:javac srcdir="${test.src.dir}" destdir="${build.test.classes.dir}" debug="true" classpath="${javac.test.classpath}">
|
||||
<customize>
|
||||
<patternset includes="${javac.includes}"/>
|
||||
</customize>
|
||||
</j2seproject3:javac>
|
||||
<j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
|
||||
<j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" sourcepath="${test.src.dir}" srcdir="${test.src.dir}"/>
|
||||
<copy todir="${build.test.classes.dir}">
|
||||
<fileset dir="${test.src.dir}" excludes="**/*.java"/>
|
||||
<fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
|
||||
</copy>
|
||||
</target>
|
||||
<target name="-post-compile-test-single">
|
||||
<!-- Empty placeholder for easier customization. -->
|
||||
<!-- You can override this target in the ../build.xml file. -->
|
||||
</target>
|
||||
<target name="compile-test-single" depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single"/>
|
||||
<target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
|
||||
<!--
|
||||
=======================
|
||||
JUNIT EXECUTION SECTION
|
||||
=======================
|
||||
-->
|
||||
<target name="-pre-test-run" if="have.tests" depends="init">
|
||||
=======================
|
||||
JUNIT EXECUTION SECTION
|
||||
=======================
|
||||
-->
|
||||
<target depends="init" if="have.tests" name="-pre-test-run">
|
||||
<mkdir dir="${build.test.results.dir}"/>
|
||||
</target>
|
||||
<target name="-do-test-run" if="have.tests" depends="init,compile-test,-pre-test-run">
|
||||
<j2seproject3:junit/>
|
||||
<target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
|
||||
<j2seproject3:junit testincludes="**/*Test.java"/>
|
||||
</target>
|
||||
<target name="-post-test-run" if="have.tests" depends="init,compile-test,-pre-test-run,-do-test-run">
|
||||
<target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
|
||||
<fail if="tests.failed">Some tests failed; see details above.</fail>
|
||||
</target>
|
||||
<target name="test-report" if="have.tests" depends="init"/>
|
||||
<target name="-test-browse" if="netbeans.home+have.tests" depends="init"/>
|
||||
<target name="test" depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests."/>
|
||||
<target name="-pre-test-run-single" if="have.tests" depends="init">
|
||||
<target depends="init" if="have.tests" name="test-report"/>
|
||||
<target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
|
||||
<target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/>
|
||||
<target depends="init" if="have.tests" name="-pre-test-run-single">
|
||||
<mkdir dir="${build.test.results.dir}"/>
|
||||
</target>
|
||||
<target name="-do-test-run-single" if="have.tests" depends="init,compile-test-single,-pre-test-run-single">
|
||||
<target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
|
||||
<fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
|
||||
<j2seproject3:junit includes="${test.includes}"/>
|
||||
<j2seproject3:junit excludes="" includes="${test.includes}"/>
|
||||
</target>
|
||||
<target name="-post-test-run-single" if="have.tests" depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single">
|
||||
<target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
|
||||
<fail if="tests.failed">Some tests failed; see details above.</fail>
|
||||
</target>
|
||||
<target name="test-single" depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test."/>
|
||||
<target depends="init,-do-not-recompile,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/>
|
||||
<!--
|
||||
=======================
|
||||
JUNIT DEBUGGING SECTION
|
||||
=======================
|
||||
-->
|
||||
<target name="-debug-start-debuggee-test" if="have.tests" depends="init,compile-test">
|
||||
=======================
|
||||
JUNIT DEBUGGING SECTION
|
||||
=======================
|
||||
-->
|
||||
<target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
|
||||
<fail unless="test.class">Must select one file in the IDE or set test.class</fail>
|
||||
<j2seproject3:debug classname="junit.textui.TestRunner" classpath="${debug.test.classpath}">
|
||||
<property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/>
|
||||
<delete file="${test.report.file}"/>
|
||||
<mkdir dir="${build.test.results.dir}"/>
|
||||
<j2seproject3:debug classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" classpath="${ant.home}/lib/ant.jar:${ant.home}/lib/ant-junit.jar:${debug.test.classpath}">
|
||||
<customize>
|
||||
<arg line="${test.class}"/>
|
||||
<syspropertyset>
|
||||
<propertyref prefix="test-sys-prop."/>
|
||||
<mapper from="test-sys-prop.*" to="*" type="glob"/>
|
||||
</syspropertyset>
|
||||
<arg value="${test.class}"/>
|
||||
<arg value="showoutput=true"/>
|
||||
<arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
|
||||
<arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
|
||||
</customize>
|
||||
</j2seproject3:debug>
|
||||
</target>
|
||||
<target name="-debug-start-debugger-test" if="netbeans.home+have.tests" depends="init,compile-test">
|
||||
<j2seproject1:nbjpdastart name="${test.class}" classpath="${debug.test.classpath}"/>
|
||||
<target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
|
||||
<j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
|
||||
</target>
|
||||
<target name="debug-test" depends="init,compile-test,-debug-start-debugger-test,-debug-start-debuggee-test"/>
|
||||
<target name="-do-debug-fix-test" if="netbeans.home" depends="init,-pre-debug-fix,compile-test-single">
|
||||
<target depends="init,-do-not-recompile,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
|
||||
<target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
|
||||
<j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
|
||||
</target>
|
||||
<target name="debug-fix-test" if="netbeans.home" depends="init,-pre-debug-fix,-do-debug-fix-test"/>
|
||||
<target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
|
||||
<!--
|
||||
=========================
|
||||
APPLET EXECUTION SECTION
|
||||
=========================
|
||||
-->
|
||||
<target name="run-applet" depends="init,compile-single">
|
||||
=========================
|
||||
APPLET EXECUTION SECTION
|
||||
=========================
|
||||
-->
|
||||
<target depends="init,compile-single" name="run-applet">
|
||||
<fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
|
||||
<j2seproject1:java classname="sun.applet.AppletViewer">
|
||||
<customize>
|
||||
@@ -510,11 +596,11 @@ is divided into following sections:
|
||||
</j2seproject1:java>
|
||||
</target>
|
||||
<!--
|
||||
=========================
|
||||
APPLET DEBUGGING SECTION
|
||||
=========================
|
||||
-->
|
||||
<target name="-debug-start-debuggee-applet" if="netbeans.home" depends="init,compile-single">
|
||||
=========================
|
||||
APPLET DEBUGGING SECTION
|
||||
=========================
|
||||
-->
|
||||
<target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet">
|
||||
<fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
|
||||
<j2seproject3:debug classname="sun.applet.AppletViewer">
|
||||
<customize>
|
||||
@@ -522,14 +608,14 @@ is divided into following sections:
|
||||
</customize>
|
||||
</j2seproject3:debug>
|
||||
</target>
|
||||
<target name="debug-applet" if="netbeans.home" depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet"/>
|
||||
<target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/>
|
||||
<!--
|
||||
===============
|
||||
CLEANUP SECTION
|
||||
===============
|
||||
-->
|
||||
<target name="deps-clean" depends="init" unless="no.deps"/>
|
||||
<target name="-do-clean" depends="init">
|
||||
===============
|
||||
CLEANUP SECTION
|
||||
===============
|
||||
-->
|
||||
<target depends="init" name="deps-clean" unless="no.deps"/>
|
||||
<target depends="init" name="-do-clean">
|
||||
<delete dir="${build.dir}"/>
|
||||
<delete dir="${dist.dir}"/>
|
||||
</target>
|
||||
@@ -537,5 +623,5 @@ is divided into following sections:
|
||||
<!-- Empty placeholder for easier customization. -->
|
||||
<!-- You can override this target in the ../build.xml file. -->
|
||||
</target>
|
||||
<target name="clean" depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products."/>
|
||||
<target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/>
|
||||
</project>
|
||||
|
||||
@@ -2,8 +2,8 @@ build.xml.data.CRC32=c09e9b0e
|
||||
build.xml.script.CRC32=6f0d9f8d
|
||||
build.xml.stylesheet.CRC32=240b97a2
|
||||
nbproject/build-impl.xml.data.CRC32=c09e9b0e
|
||||
nbproject/build-impl.xml.script.CRC32=216dd50e
|
||||
nbproject/build-impl.xml.stylesheet.CRC32=20b9345e
|
||||
nbproject/build-impl.xml.script.CRC32=ee8cb023
|
||||
nbproject/build-impl.xml.stylesheet.CRC32=f1d9da08
|
||||
nbproject/profiler-build-impl.xml.data.CRC32=c09e9b0e
|
||||
nbproject/profiler-build-impl.xml.script.CRC32=abda56ed
|
||||
nbproject/profiler-build-impl.xml.stylesheet.CRC32=a5b6598e
|
||||
nbproject/profiler-build-impl.xml.stylesheet.CRC32=42cb6bcf
|
||||
|
||||
@@ -119,6 +119,7 @@ is divided into following sections:
|
||||
<test name="${profile.class}"/>
|
||||
<classpath>
|
||||
<path path="${run.test.classpath}"/>
|
||||
<path refid="test.runpath"/>
|
||||
</classpath>
|
||||
<syspropertyset>
|
||||
<propertyref prefix="test-sys-prop."/>
|
||||
|
||||
@@ -1,56 +1,58 @@
|
||||
application.args=
|
||||
build.classes.dir=${build.dir}/classes
|
||||
build.classes.excludes=**/*.java,**/*.form
|
||||
# This directory is removed when the project is cleaned:
|
||||
build.dir=build
|
||||
build.generated.dir=${build.dir}/generated
|
||||
# Only compile against the classpath explicitly listed here:
|
||||
build.sysclasspath=ignore
|
||||
build.test.classes.dir=${build.dir}/test/classes
|
||||
build.test.results.dir=${build.dir}/test/results
|
||||
debug.classpath=\
|
||||
${run.classpath}
|
||||
debug.test.classpath=\
|
||||
${run.test.classpath}
|
||||
# This directory is removed when the project is cleaned:
|
||||
dist.dir=dist
|
||||
dist.jar=${dist.dir}/jna.jar
|
||||
dist.javadoc.dir=${dist.dir}/javadoc
|
||||
file.reference.jnalib-src=src
|
||||
jar.compress=false
|
||||
javac.classpath=
|
||||
# Space-separated list of extra javac options
|
||||
javac.compilerargs=-Xlint:unchecked
|
||||
javac.deprecation=false
|
||||
javac.source=1.5
|
||||
javac.target=1.5
|
||||
javac.test.classpath=\
|
||||
${javac.classpath}:\
|
||||
${build.classes.dir}:\
|
||||
${libs.junit.classpath}
|
||||
javadoc.additionalparam=
|
||||
javadoc.author=false
|
||||
javadoc.encoding=
|
||||
javadoc.noindex=false
|
||||
javadoc.nonavbar=false
|
||||
javadoc.notree=false
|
||||
javadoc.private=false
|
||||
javadoc.splitindex=true
|
||||
javadoc.use=true
|
||||
javadoc.version=false
|
||||
javadoc.windowtitle=
|
||||
main.class=
|
||||
meta.inf.dir=${src.dir}/META-INF
|
||||
platform.active=default_platform
|
||||
run.classpath=\
|
||||
${javac.classpath}:\
|
||||
${build.classes.dir}
|
||||
# Space-separated list of JVM arguments used when running the project
|
||||
# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
|
||||
# or test-sys-prop.name=value to set system properties for unit tests):
|
||||
run.jvmargs=-Djava.library.path=./native/testlib/Debug;./native/jnidispatch/Debug
|
||||
run.test.classpath=\
|
||||
${javac.test.classpath}:\
|
||||
${build.test.classes.dir}
|
||||
src.dir=${file.reference.jnalib-src}
|
||||
test.src.dir=test
|
||||
application.args=
|
||||
build.classes.dir=${build.dir}/classes
|
||||
build.classes.excludes=**/*.java,**/*.form
|
||||
# This directory is removed when the project is cleaned:
|
||||
build.dir=build
|
||||
build.generated.dir=${build.dir}/generated
|
||||
# Only compile against the classpath explicitly listed here:
|
||||
build.sysclasspath=ignore
|
||||
build.test.classes.dir=${build.dir}/test/classes
|
||||
build.test.results.dir=${build.dir}/test/results
|
||||
debug.classpath=\
|
||||
${run.classpath}
|
||||
debug.test.classpath=\
|
||||
${run.test.classpath}
|
||||
# This directory is removed when the project is cleaned:
|
||||
dist.dir=dist
|
||||
dist.jar=${dist.dir}/jna.jar
|
||||
dist.javadoc.dir=${dist.dir}/javadoc
|
||||
excludes=
|
||||
file.reference.jnalib-src=src
|
||||
includes=**
|
||||
jar.compress=false
|
||||
javac.classpath=
|
||||
# Space-separated list of extra javac options
|
||||
javac.compilerargs=-Xlint:unchecked
|
||||
javac.deprecation=false
|
||||
javac.source=1.5
|
||||
javac.target=1.5
|
||||
javac.test.classpath=\
|
||||
${javac.classpath}:\
|
||||
${build.classes.dir}:\
|
||||
${libs.junit.classpath}}
|
||||
javadoc.additionalparam=
|
||||
javadoc.author=false
|
||||
javadoc.encoding=
|
||||
javadoc.noindex=false
|
||||
javadoc.nonavbar=false
|
||||
javadoc.notree=false
|
||||
javadoc.private=false
|
||||
javadoc.splitindex=true
|
||||
javadoc.use=true
|
||||
javadoc.version=false
|
||||
javadoc.windowtitle=
|
||||
main.class=
|
||||
meta.inf.dir=${src.dir}/META-INF
|
||||
platform.active=default_platform
|
||||
run.classpath=\
|
||||
${javac.classpath}:\
|
||||
${build.classes.dir}
|
||||
# Space-separated list of JVM arguments used when running the project
|
||||
# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
|
||||
# or test-sys-prop.name=value to set system properties for unit tests):
|
||||
run.jvmargs=-Djava.library.path=./native/testlib/Debug;./native/jnidispatch/Debug
|
||||
run.test.classpath=\
|
||||
${javac.test.classpath}:\
|
||||
${build.test.classes.dir}
|
||||
src.dir=${file.reference.jnalib-src}
|
||||
test.src.dir=test
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
|
||||
http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>net.java.dev.jna</groupId>
|
||||
<artifactId>jna</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>3.0.5</version>
|
||||
<name>Java Native Access</name>
|
||||
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>java.net-m2-repository</id>
|
||||
<url>java-net:/maven2-repository/trunk/www/repository/</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<!-- fake out maven and install the binary artifact -->
|
||||
<plugin>
|
||||
<groupId>org.jvnet.maven-antrun-extended-plugin</groupId>
|
||||
<artifactId>maven-antrun-extended-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<tasks>
|
||||
<!--<ant dir="." target="dist" />-->
|
||||
<attachArtifact file="dist/jna.jar" />
|
||||
<attachArtifact file="dist/src-full.zip" classifier="sources" type="jar"/>
|
||||
</tasks>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<extensions>
|
||||
<extension>
|
||||
<groupId>org.jvnet.wagon-svn</groupId>
|
||||
<artifactId>wagon-svn</artifactId>
|
||||
<version>1.8</version>
|
||||
</extension>
|
||||
</extensions>
|
||||
</build>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>maven2-repository.dev.java.net</id>
|
||||
<name>Java.net Repository for Maven</name>
|
||||
<url>http://download.java.net/maven/2/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>maven2-repository.dev.java.net</id>
|
||||
<name>Java.net Repository for Maven</name>
|
||||
<url>http://download.java.net/maven/2/</url>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
</project>
|
||||
Arquivo executável
+195
@@ -0,0 +1,195 @@
|
||||
<a name="top"></a>
|
||||
<h2>Release 3.0.5</h2>
|
||||
<b>Features</b><br>
|
||||
<ul>
|
||||
<li>Allow explicit declaration of field order for VMs which have an unpredictable field order.
|
||||
<li>Check for w32 libraries with a "lib" prefix in addition to normal lookup.
|
||||
<li>Allow String[]/WString[] as callback argument/return value (assume NULL-terminated array).
|
||||
<li>Add Solaris8 compatibility to sunos-sparc build (Corey Puffalt).
|
||||
<li>Look up libraries using web start library path, if appropriate (Corey Puffalt).
|
||||
<li>Use constants to return integer boolean values.
|
||||
</ul>
|
||||
<b>Bug Fixes</b><br>
|
||||
<ul>
|
||||
<li>Properly track cursor on alpha-masked windows.
|
||||
<li>Avoid searching /lib or /usr/lib on 64-bit Linux.
|
||||
<li>Avoid using incorrect version of a library when both 32- and 64-bit versions are found.
|
||||
<li>Avoid transparent window events always dragging window bug on OSX.
|
||||
<li>Fix division by zero error calculating structure size on OSX/ppc.
|
||||
<li>Avoid overwriting initialized NativeMapped Structure fields when calculating structure size.
|
||||
<li>Fix NPE reading back into StringArray.
|
||||
</ul>
|
||||
<h2>Release 3.0.4</h2>
|
||||
<b>Features</b><br>
|
||||
<ul>
|
||||
<li>Automatically write contents of Structure.ByReference fields on Structure.write().
|
||||
<li>Use the actual parameter type in Function invocations if no parameter type information is available (whether method is missing or untyped varargs).
|
||||
<li>Augmented X11 library mappings (xylo).
|
||||
<li>Support read/write of NativeMapped arrays within Structure (notably NativeLong).
|
||||
</ul>
|
||||
<b>Bug Fixes</b><br>
|
||||
<ul>
|
||||
<li>Fix library load error when /usr/lib32 and /usr/lib both exist (linux) (Marek Slama).
|
||||
<li>Avoid incorrect matches against libraries named with the same prefix
|
||||
(e.g. libc-client.so vs libc.so) (xylo).
|
||||
<li>Properly handle arrays of NativeMapped (e.g. NativeLong) as a Structure field (stefan endrullis).
|
||||
<li>Ensure structure size calculated prior to setting union active type.
|
||||
<li>XID is 64-bits on 64-bit X clients (xylo).
|
||||
<li>Ensure proper arch name is used on Debian (amd64 instead of x86_64).
|
||||
</ul>
|
||||
<h2>Release 3.0.3</h2>
|
||||
<b>Features</b><br>
|
||||
<ul>
|
||||
<li>Enable build/run using IBM's J9 VM (leonardo).
|
||||
<li>Make StdCallFunctionMapper attempt a leading underscore if the simpler mapping doesn't work.
|
||||
<li>Allow Structure.read to overwrite final fields (may not work on some 1.4 VMs).
|
||||
</ul>
|
||||
<b>Bug Fixes</b><br>
|
||||
<ul>
|
||||
<li>Fix NPE when passing an array of Structure.ByReference.
|
||||
<li>Compare entire linux library version when finding a match.
|
||||
<li>Don't pass struct by value unless the method signature declares it.
|
||||
<li>Restrict custom first element structure alignment to OSX/ppc.
|
||||
<li>Improve performance and reduce memory footprint for window masks.
|
||||
Optimize polygon-based masks on w32. Use XFillRectangles on X11.
|
||||
<li>Fix linkage settings on sunos-amd64 to avoid relocation errors.
|
||||
<li>Fix callback allocation code on w32, solaris, freebsd, darwin (libffi was misconfigured).
|
||||
<li>Fix bug when NativeMapped fields are used in a Structure.ByValue instance.
|
||||
<li>Fix NPE calling Structure.read() before memory is initialized.
|
||||
<li>Fix NPE calling Structure.read/write with uninitialized NativeMapped fields.
|
||||
</ul>
|
||||
|
||||
<h2>Release 3.0.2</h2>
|
||||
<b>Features</b><br>
|
||||
<ul>
|
||||
<li>Attempt to force unload of jnidispatch library prior to deleting it (w32).
|
||||
<li>Added amd64 targets for OSX, FreeBSD, and Solaris.
|
||||
</ul>
|
||||
<b>Bug Fixes</b><br>
|
||||
<ul>
|
||||
<li>Reduce space allocated for invocation arguments.
|
||||
<li>Fix NPE when NativeMapped type is used in a Structure.
|
||||
<li>Fix some X11 type mappings for 64-bit.
|
||||
<li>Fix OSX Leopard/JRE1.5+ window transparency.
|
||||
<li>Fix window alpha compositing on X11.
|
||||
<li>Fix loading of libraries with unicode names on OSX.
|
||||
</ul>
|
||||
|
||||
<h2>Release 3.0.1</h2>
|
||||
<b>Features</b><br>
|
||||
<ul>
|
||||
<li>Improve transparent window drawing performance on w32
|
||||
<li>Use closure allocation from libffi
|
||||
</ul>
|
||||
<b>Bug Fixes</b><br>
|
||||
<ul>
|
||||
<li>Ensure nested structure arrays initialized with Structure.toArray use the
|
||||
appropriate native memory.
|
||||
<li>Ensure structure size is calculated prior to converting to array
|
||||
<li>Avoid creating new windows when setting a window mask
|
||||
<li>Fix bug in Pointer.setChar.
|
||||
</ul>
|
||||
|
||||
<h2>Release 3.0</h2>
|
||||
<b>Features</b><br>
|
||||
<ul>
|
||||
<li>More supported platforms, via GCC's libffi (wmeissner)
|
||||
<li>Support struct by value as parameter and return value (duncan)
|
||||
<li>Support struct by reference within structures
|
||||
<li>Provide access to native peer for java.awt.Component
|
||||
<li>Provide access to native peer on OS X.
|
||||
<li>Support MINGW32 builds (fullung)
|
||||
<li>Allow per-field Structure read/write by field name
|
||||
<li>Avoid writing Structure fields marked 'volatile'
|
||||
<li>Read and wrap function pointers in Structure fields when read with a Java
|
||||
proxy to allow easy Java-side invocation (Ken Larson)
|
||||
<li>Support array-backed Buffers as arguments (wmeissner)
|
||||
<li>Auto-conversion of custom types (wmeissner)
|
||||
<li>Allow pointer type-safety
|
||||
<li>Optional VM crash protection, via Native.setProtected(boolean)
|
||||
<li>Auto-convert WString[]
|
||||
<li>Provide library synchronization wrapper similar to Collections.synchronizedX
|
||||
<li>Support lookup of OSX framework libraries by name
|
||||
<li>Explicit access to shared library global data
|
||||
<li>Invocation interception to facilitate translation of C preprocessor macros
|
||||
and inline functions
|
||||
<li>Provide utility to determine Web Start native library cache location;
|
||||
auto-include this path if jnidispatch is included as a <nativelib>
|
||||
(robertengels)
|
||||
<li>Provide access to aligned memory
|
||||
<li>Versioning information embedded in jna.jar and native library
|
||||
</ul>
|
||||
<b>Bug Fixes</b><br>
|
||||
<li>Avoid attempts to free native library if it failed to load (wmeissner)
|
||||
<li>Explicitly check method signatures for varargs instead of heuristically
|
||||
guessing (wmeissner)
|
||||
<li>Disallow declaring Pointer-derived fields in Structures (Function, Memory)
|
||||
<li>Ensure Object.toString/hashCode/equals methods are intercepted on proxyied
|
||||
interfaces
|
||||
<li>Update X11 library for 64-bit use (wmeissner)
|
||||
<li>Properly map arrays of char*/wchar_t* under w32
|
||||
<li>Allow Pointer[] as a Structure field and Function argument
|
||||
<li>Fix some misleading Structure error messages
|
||||
<li>Properly preserve/return GetLastError/errno after native calls
|
||||
<li>Allocate executable memory on w32 to avoid errors with hardware-enforced
|
||||
data execution protection (DEP)
|
||||
<li>Fix VM crash on w32 stdcall callbacks
|
||||
<li>Use long offsets and sizes rather than ints (64-bit safe)
|
||||
<li>Properly clean up references and release closure memory on JNI_Unload
|
||||
<li>Use simpler AWT/JAWT library loading workaround
|
||||
<li>Avoid changing array references within a Structure on read
|
||||
|
||||
<h2>Release 2.5</h2>
|
||||
<b>Features</b><br>
|
||||
<ul>
|
||||
<li>Unions
|
||||
<li>Optimized shaped windows (chris deckers & olivier chafik); instantiation time
|
||||
improved by about 2-3 orders of magnitude for large, mostly contiguous shapes
|
||||
<li>Provide type mapping in callback arguments/results
|
||||
<li>Provide access to ByteBuffer direct address as a Pointer
|
||||
<li>Provide customization of native string encoding with jna.encoding system property
|
||||
</ul>
|
||||
|
||||
<b>Bug Fixes</b><br>
|
||||
<ul>
|
||||
<li>Properly handle VMs with reversed Structure member storage
|
||||
<li>Avoid making window undecorated when clearing window mask on X11
|
||||
<li>Fix structure alignment bug on OSX/PPC when first element is > 4 bytes in size
|
||||
<li>Clearing OSX window mask by setting to MASK_NONE now works properly
|
||||
<li>Avoid index exceptions if native buffers are not NUL-terminated on string conversions
|
||||
<li>Write initialized Structure[] argument memory prior to function calls
|
||||
<li>Fix IllegalArgumentException reading WString into a Structure
|
||||
<li>Clear memory when allocating a structure block (fixes VM crash)
|
||||
<li>Remove versioned JAWT dependency on OSX, allowing use on 10.3/JRE1.4.
|
||||
</ul>
|
||||
|
||||
<h2>Release 2.4</h2>
|
||||
<b>Features</b><br>
|
||||
<ul>
|
||||
<li>Explicitly support unaligned structures
|
||||
<li>Auto-reallocate structure arrays
|
||||
<li>Automatic handling of w32 UNICODE/ASCII variants
|
||||
<li>Automatic mapping of decorated w32 stdcall function names
|
||||
<li>Customizable, automatic type conversion of arguments and results (wmeissner)
|
||||
<li>Support char*[] arguments as Java String[]
|
||||
<li>Structure supports Callback members (wmeissner)
|
||||
<li>getByteBuffer from Pointer/Memory (wmeissner)
|
||||
<li>Allow GC of native libraries
|
||||
<li>Facilitate use from non-Java contexts (JRuby et al.) (wmeissner)
|
||||
<li>Improve library path searching (wmeissner)
|
||||
<li>Handle Structure[] arguments
|
||||
<li>Handle native long arguments and return values
|
||||
<li>Handle direct and array-based ByteBuffer arguments (wmeissner)
|
||||
<li>Change default w32 build to use GCC (it's free, yo)
|
||||
</ul>
|
||||
|
||||
<b>Bug Fixes</b><br>
|
||||
<ul>
|
||||
<li>Structure.toArray failed to initialize members
|
||||
<li>Disallow explicit free of Structure/Memory
|
||||
<li>Ensure native libraries are only loaded once until released
|
||||
<li>Properly handle NULL when the return value is a Structure
|
||||
<li>Proper conversion to wchar_t on linux
|
||||
<li>Copy full length of Java strings to C strings instead of stopping when a NUL
|
||||
character is encountered
|
||||
</ul>
|
||||
@@ -1,94 +0,0 @@
|
||||
Release 3.0
|
||||
Features
|
||||
* More supported platforms, via GCC's libffi (wmeissner)
|
||||
* Support struct by value as parameter and return value (duncan)
|
||||
* Support struct by reference within structures
|
||||
* Provide access to native peer for java.awt.Component
|
||||
* Provide access to native peer on OS X.
|
||||
* Support MINGW32 builds (fullung)
|
||||
* Allow per-field Structure read/write by field name
|
||||
* Avoid writing Structure fields marked 'volatile'
|
||||
* Read and wrap function pointers in Structure fields when read with a Java
|
||||
proxy to allow easy Java-side invocation (Ken Larson)
|
||||
* Support array-backed Buffers as arguments (wmeissner)
|
||||
* Auto-conversion of custom types (wmeissner)
|
||||
* Allow pointer type-safety
|
||||
* Optional VM crash protection, via Native.setProtected(boolean)
|
||||
* Auto-convert WString[]
|
||||
* Provide library synchronization wrapper similar to Collections.synchronizedX
|
||||
* Support lookup of OSX framework libraries by name
|
||||
* Explicit access to shared library global data
|
||||
* Invocation interception to facilitate translation of C preprocessor macros
|
||||
and inline functions
|
||||
* Provide utility to determine Web Start native library cache location;
|
||||
auto-include this path if jnidispatch is included as a <nativelib>
|
||||
(robertengels)
|
||||
* Provide access to aligned memory
|
||||
* Versioning information embedded in jna.jar and native library
|
||||
|
||||
Bug Fixes
|
||||
* Avoid attempts to free native library if it failed to load (wmeissner)
|
||||
* Explicitly check method signatures for varargs instead of heuristically
|
||||
guessing (wmeissner)
|
||||
* Disallow declaring Pointer-derived fields in Structures (Function, Memory)
|
||||
* Ensure Object.toString/hashCode/equals methods are intercepted on proxyied
|
||||
interfaces
|
||||
* Update X11 library for 64-bit use (wmeissner)
|
||||
* Properly map arrays of char*/wchar_t* under w32
|
||||
* Allow Pointer[] as a Structure field and Function argument
|
||||
* Fix some misleading Structure error messages
|
||||
* Properly preserve/return GetLastError/errno after native calls
|
||||
* Allocate executable memory on w32 to avoid errors with hardware-enforced
|
||||
data execution protection (DEP)
|
||||
* Fix VM crash on w32 stdcall callbacks
|
||||
* Use long offsets and sizes rather than ints (64-bit safe)
|
||||
* Properly clean up references and release closure memory on JNI_Unload
|
||||
* Use simpler AWT/JAWT library loading workaround
|
||||
* Avoid changing array references within a Structure on read
|
||||
|
||||
Release 2.5
|
||||
Features
|
||||
* Unions
|
||||
* Optimized shaped windows (chris deckers & olivier chafik); instantiation time
|
||||
improved by about 2-3 orders of magnitude for large, mostly contiguous shapes
|
||||
* Provide type mapping in callback arguments/results
|
||||
* Provide access to ByteBuffer direct address as a Pointer
|
||||
* Provide customization of native string encoding with jna.encoding system property
|
||||
|
||||
Bug Fixes
|
||||
* Properly handle VMs with reversed Structure member storage
|
||||
* Avoid making window undecorated when clearing window mask on X11
|
||||
* Fix structure alignment bug on OSX/PPC when first element is > 4 bytes in size
|
||||
* Clearing OSX window mask by setting to MASK_NONE now works properly
|
||||
* Avoid index exceptions if native buffers are not NUL-terminated on string conversions
|
||||
* Write initialized Structure[] argument memory prior to function calls
|
||||
* Fix IllegalArgumentException reading WString into a Structure
|
||||
* Clear memory when allocating a structure block (fixes VM crash)
|
||||
* Remove versioned JAWT dependency on OSX, allowing use on 10.3/JRE1.4.
|
||||
|
||||
Release 2.4
|
||||
Features
|
||||
* Explicitly support unaligned structures
|
||||
* Auto-reallocate structure arrays
|
||||
* Automatic handling of w32 UNICODE/ASCII variants
|
||||
* Automatic mapping of decorated w32 stdcall function names
|
||||
* Customizable, automatic type conversion of arguments and results (wmeissner)
|
||||
* Support char*[] arguments as Java String[]
|
||||
* Structure supports Callback members (wmeissner)
|
||||
* getByteBuffer from Pointer/Memory (wmeissner)
|
||||
* Allow GC of native libraries
|
||||
* Facilitate use from non-Java contexts (JRuby et al.) (wmeissner)
|
||||
* Improve library path searching (wmeissner)
|
||||
* Handle Structure[] arguments
|
||||
* Handle native long arguments and return values
|
||||
* Handle direct and array-based ByteBuffer arguments (wmeissner)
|
||||
* Change default w32 build to use GCC (it's free, yo)
|
||||
|
||||
Bug Fixes
|
||||
* Structure.toArray failed to initialize members
|
||||
* Disallow explicit free of Structure/Memory
|
||||
* Ensure native libraries are only loaded once until released
|
||||
* Properly handle NULL when the return value is a Structure
|
||||
* Proper conversion to wchar_t on linux
|
||||
* Copy full length of Java strings to C strings instead of stopping when a NUL
|
||||
character is encountered
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2007 Timothy Wall, All Rights Reserved
|
||||
/* Copyright (c) 2007-2008 Timothy Wall, All Rights Reserved
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -32,7 +32,7 @@ class CallbackReference extends WeakReference {
|
||||
|
||||
static final Map callbackMap = new WeakHashMap();
|
||||
static final Map altCallbackMap = new WeakHashMap();
|
||||
private static final Map nativeStrings = new WeakHashMap();
|
||||
private static final Map allocations = new WeakHashMap();
|
||||
|
||||
/** Return a Callback associated with the given function pointer.
|
||||
* If the pointer refers to a Java callback trampoline, return the original
|
||||
@@ -141,10 +141,12 @@ class CallbackReference extends WeakReference {
|
||||
return Pointer.class;
|
||||
}
|
||||
else if (NativeMapped.class.isAssignableFrom(cls)) {
|
||||
return new NativeMappedConverter(cls).nativeType();
|
||||
return NativeMappedConverter.getInstance(cls).nativeType();
|
||||
}
|
||||
else if (cls == String.class
|
||||
|| cls == WString.class
|
||||
|| cls == String[].class
|
||||
|| cls == WString[].class
|
||||
|| Callback.class.isAssignableFrom(cls)) {
|
||||
return Pointer.class;
|
||||
}
|
||||
@@ -226,7 +228,7 @@ class CallbackReference extends WeakReference {
|
||||
Class returnType = callbackMethod.getReturnType();
|
||||
fromNative = new FromNativeConverter[argTypes.length];
|
||||
if (NativeMapped.class.isAssignableFrom(returnType)) {
|
||||
toNative = new NativeMappedConverter(returnType);
|
||||
toNative = NativeMappedConverter.getInstance(returnType);
|
||||
}
|
||||
else if (mapper != null) {
|
||||
toNative = mapper.getToNativeConverter(returnType);
|
||||
@@ -310,6 +312,10 @@ class CallbackReference extends WeakReference {
|
||||
else if (dstType == WString.class) {
|
||||
value = new WString(((Pointer)value).getString(0, true));
|
||||
}
|
||||
else if (dstType == String[].class
|
||||
|| dstType == WString[].class) {
|
||||
value = ((Pointer)value).getStringArray(0, dstType == WString[].class);
|
||||
}
|
||||
else if (Callback.class.isAssignableFrom(dstType)) {
|
||||
value = getCallback(dstType, (Pointer)value);
|
||||
}
|
||||
@@ -328,7 +334,7 @@ class CallbackReference extends WeakReference {
|
||||
}
|
||||
else if ((boolean.class == dstType || Boolean.class == dstType)
|
||||
&& value instanceof Number) {
|
||||
value = Boolean.valueOf(((Number)value).intValue() != 0);
|
||||
value = Function.valueOf(((Number)value).intValue() != 0);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
@@ -347,15 +353,23 @@ class CallbackReference extends WeakReference {
|
||||
return ((Structure)value).getPointer();
|
||||
}
|
||||
else if (cls == boolean.class || cls == Boolean.class) {
|
||||
return new Integer(Boolean.TRUE.equals(value)?-1:0);
|
||||
return Boolean.TRUE.equals(value) ?
|
||||
Function.INTEGER_TRUE : Function.INTEGER_FALSE;
|
||||
}
|
||||
else if (cls == String.class || cls == WString.class) {
|
||||
// Store in a weak hash map to delay GC until string
|
||||
// itself is GC'd.
|
||||
NativeString ns = new NativeString(value.toString(), cls == WString.class);
|
||||
nativeStrings.put(value, ns);
|
||||
// Delay GC until string itself is GC'd.
|
||||
allocations.put(value, ns);
|
||||
return ns.getPointer();
|
||||
}
|
||||
else if (cls == String[].class || cls == WString.class) {
|
||||
StringArray sa = cls == String[].class
|
||||
? new StringArray((String[])value)
|
||||
: new StringArray((WString[])value);
|
||||
// Delay GC until array itself is GC'd.
|
||||
allocations.put(value, sa);
|
||||
return sa;
|
||||
}
|
||||
else if (Callback.class.isAssignableFrom(cls)) {
|
||||
return getFunctionPointer((Callback)value);
|
||||
}
|
||||
@@ -406,7 +420,7 @@ class CallbackReference extends WeakReference {
|
||||
else if (Library.Handler.OBJECT_EQUALS.equals(method)) {
|
||||
Object o = args[0];
|
||||
if (o != null && Proxy.isProxyClass(o.getClass())) {
|
||||
return Boolean.valueOf(Proxy.getInvocationHandler(o) == this);
|
||||
return Function.valueOf(Proxy.getInvocationHandler(o) == this);
|
||||
}
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
|
||||
@@ -27,6 +27,16 @@ import java.util.Map;
|
||||
* @see Pointer
|
||||
*/
|
||||
public class Function extends Pointer {
|
||||
/** Any argument which implements this interface will have the
|
||||
* {@link #read} method called immediately after function invocation.
|
||||
*/
|
||||
public interface PostCallRead {
|
||||
/** Perform any necessary post-call synchronization. Normally this
|
||||
* just means reading from native memory any changes made by
|
||||
* the native function call.
|
||||
*/
|
||||
void read();
|
||||
}
|
||||
|
||||
/** Maximum number of arguments supported by a JNA function call. */
|
||||
public static final int MAX_NARGS = 256;
|
||||
@@ -36,6 +46,9 @@ public class Function extends Pointer {
|
||||
/** First alternate convention (currently used only for w32 stdcall). */
|
||||
public static final int ALT_CONVENTION = 1;
|
||||
|
||||
static final Integer INTEGER_TRUE = new Integer(-1);
|
||||
static final Integer INTEGER_FALSE = new Integer(0);
|
||||
|
||||
/**
|
||||
* Obtain a <code>Function</code> representing a native
|
||||
* function that follows the standard "C" calling convention.
|
||||
@@ -196,7 +209,7 @@ public class Function extends Pointer {
|
||||
Class nativeType = returnType;
|
||||
FromNativeConverter resultConverter = null;
|
||||
if (NativeMapped.class.isAssignableFrom(returnType)) {
|
||||
NativeMappedConverter tc = new NativeMappedConverter(returnType);
|
||||
NativeMappedConverter tc = NativeMappedConverter.getInstance(returnType);
|
||||
resultConverter = tc;
|
||||
nativeType = tc.nativeType();
|
||||
}
|
||||
@@ -224,31 +237,30 @@ public class Function extends Pointer {
|
||||
// Sync all memory which might have been modified by the native call
|
||||
if (inArgs != null) {
|
||||
for (int i=0; i < inArgs.length; i++) {
|
||||
Object arg = inArgs[i];
|
||||
if (arg == null)
|
||||
Object inArg = inArgs[i];
|
||||
if (inArg == null)
|
||||
continue;
|
||||
if (arg instanceof Structure) {
|
||||
if (!(arg instanceof Structure.ByValue)) {
|
||||
((Structure)arg).read();
|
||||
if (inArg instanceof Structure) {
|
||||
if (!(inArg instanceof Structure.ByValue)) {
|
||||
((Structure)inArg).read();
|
||||
}
|
||||
}
|
||||
else if (args[i] instanceof StringArray) {
|
||||
((StringArray)args[i]).read();
|
||||
}
|
||||
else if (args[i] instanceof PointerArray) {
|
||||
PointerArray array = (PointerArray)args[i];
|
||||
array.read();
|
||||
if (Structure.ByReference[].class.isAssignableFrom(arg.getClass())) {
|
||||
Class type = arg.getClass().getComponentType();
|
||||
Structure[] ss = (Structure[])arg;
|
||||
for (int si=0;si < ss.length;si++) {
|
||||
Pointer p = array.getPointer(Pointer.SIZE * si);
|
||||
ss[si] = Structure.updateStructureByReference(type, ss[si], p);
|
||||
else if (args[i] instanceof PostCallRead) {
|
||||
((PostCallRead)args[i]).read();
|
||||
if (args[i] instanceof PointerArray) {
|
||||
PointerArray array = (PointerArray)args[i];
|
||||
if (Structure.ByReference[].class.isAssignableFrom(inArg.getClass())) {
|
||||
Class type = inArg.getClass().getComponentType();
|
||||
Structure[] ss = (Structure[])inArg;
|
||||
for (int si=0;si < ss.length;si++) {
|
||||
Pointer p = array.getPointer(Pointer.SIZE * si);
|
||||
ss[si] = Structure.updateStructureByReference(type, ss[si], p);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (Structure[].class.isAssignableFrom(arg.getClass())) {
|
||||
Structure[] ss = (Structure[])arg;
|
||||
else if (Structure[].class.isAssignableFrom(inArg.getClass())) {
|
||||
Structure[] ss = (Structure[])inArg;
|
||||
for (int si=0;si < ss.length;si++) {
|
||||
ss[si].read();
|
||||
}
|
||||
@@ -267,7 +279,7 @@ public class Function extends Pointer {
|
||||
result = null;
|
||||
}
|
||||
else if (returnType==boolean.class || returnType==Boolean.class) {
|
||||
result = Boolean.valueOf(invokeInt(callingConvention, args) != 0);
|
||||
result = valueOf(invokeInt(callingConvention, args) != 0);
|
||||
}
|
||||
else if (returnType==byte.class || returnType==Byte.class) {
|
||||
result = new Byte((byte)invokeInt(callingConvention, args));
|
||||
@@ -338,7 +350,7 @@ public class Function extends Pointer {
|
||||
Class type = arg.getClass();
|
||||
ToNativeConverter converter = null;
|
||||
if (NativeMapped.class.isAssignableFrom(type)) {
|
||||
converter = new NativeMappedConverter(type);
|
||||
converter = NativeMappedConverter.getInstance(type);
|
||||
}
|
||||
else if (mapper != null) {
|
||||
converter = mapper.getToNativeConverter(type);
|
||||
@@ -363,11 +375,30 @@ public class Function extends Pointer {
|
||||
Structure struct = (Structure)arg;
|
||||
struct.write();
|
||||
if (struct instanceof Structure.ByValue) {
|
||||
return struct;
|
||||
}
|
||||
else {
|
||||
return struct.getPointer();
|
||||
// Double-check against the method signature, if available
|
||||
Class ptype = struct.getClass();
|
||||
if (invokingMethod != null) {
|
||||
Class[] ptypes = invokingMethod.getParameterTypes();
|
||||
if (isVarArgs(invokingMethod)) {
|
||||
if (index < ptypes.length-1) {
|
||||
ptype = ptypes[index];
|
||||
}
|
||||
else {
|
||||
Class etype = ptypes[ptypes.length-1].getComponentType();
|
||||
if (etype != Object.class) {
|
||||
ptype = etype;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
ptype = ptypes[index];
|
||||
}
|
||||
}
|
||||
if (Structure.ByValue.class.isAssignableFrom(ptype)) {
|
||||
return struct;
|
||||
}
|
||||
}
|
||||
return struct.getPointer();
|
||||
}
|
||||
// Convert Callback to Pointer
|
||||
else if (arg instanceof Callback) {
|
||||
@@ -387,7 +418,7 @@ public class Function extends Pointer {
|
||||
// Default conversion of boolean to int; if you want something
|
||||
// different, use a ToNativeConverter
|
||||
else if (arg instanceof Boolean) {
|
||||
return new Integer(Boolean.TRUE.equals(arg) ? -1 : 0);
|
||||
return Boolean.TRUE.equals(arg) ? INTEGER_TRUE : INTEGER_FALSE;
|
||||
}
|
||||
else if (String[].class == argClass) {
|
||||
return new StringArray((String[])arg);
|
||||
@@ -405,7 +436,7 @@ public class Function extends Pointer {
|
||||
if (byRef) {
|
||||
Pointer[] pointers = new Pointer[ss.length + 1];
|
||||
for (int i=0;i < ss.length;i++) {
|
||||
pointers[i] = ss[i].getPointer();
|
||||
pointers[i] = ss[i] != null ? ss[i].getPointer() : null;
|
||||
}
|
||||
return new PointerArray(pointers);
|
||||
}
|
||||
@@ -556,8 +587,8 @@ public class Function extends Pointer {
|
||||
* @param callingConvention calling convention to be used
|
||||
* @param args
|
||||
* Arguments to pass to the native function
|
||||
* @param struct Pre-allocated structure to hold the result
|
||||
* @return The native pointer returned by the target native function
|
||||
* @param result Pre-allocated structure to hold the result
|
||||
* @return The passed-in struct argument
|
||||
*/
|
||||
private native Structure invokeStructure(int callingConvention, Object[] args,
|
||||
Structure result);
|
||||
@@ -570,7 +601,7 @@ public class Function extends Pointer {
|
||||
}
|
||||
return "native function@0x" + Long.toHexString(peer);
|
||||
}
|
||||
|
||||
|
||||
/** Convenience method for
|
||||
* {@link #invoke(Class,Object[]) invoke(Pointer.class, args)}.
|
||||
*/
|
||||
@@ -679,7 +710,7 @@ public class Function extends Pointer {
|
||||
return false;
|
||||
}
|
||||
|
||||
private static class PointerArray extends Memory {
|
||||
private static class PointerArray extends Memory implements PostCallRead {
|
||||
private Pointer[] original;
|
||||
public PointerArray(Pointer[] arg) {
|
||||
super(Pointer.SIZE * (arg.length+1));
|
||||
@@ -695,4 +726,9 @@ public class Function extends Pointer {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Implementation of Boolean.valueOf for older VMs. */
|
||||
static Boolean valueOf(boolean b) {
|
||||
return b ? Boolean.TRUE : Boolean.FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,7 +73,9 @@ public abstract class IntegerType extends Number implements NativeMapped {
|
||||
}
|
||||
|
||||
public Object fromNative(Object nativeValue, FromNativeContext context) {
|
||||
long value = ((Number) nativeValue).longValue();
|
||||
// be forgiving of null values read from memory
|
||||
long value = nativeValue == null
|
||||
? 0 : ((Number) nativeValue).longValue();
|
||||
try {
|
||||
IntegerType number = (IntegerType) getClass().newInstance();
|
||||
number.setValue(value);
|
||||
|
||||
@@ -166,7 +166,7 @@ public interface Library {
|
||||
else if (OBJECT_EQUALS.equals(method)) {
|
||||
Object o = inArgs[0];
|
||||
if (o != null && Proxy.isProxyClass(o.getClass())) {
|
||||
return Boolean.valueOf(Proxy.getInvocationHandler(o) == this);
|
||||
return Function.valueOf(Proxy.getInvocationHandler(o) == this);
|
||||
}
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,9 @@ import java.nio.Buffer;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
import com.sun.jna.Structure.ByReference;
|
||||
@@ -81,7 +83,6 @@ public final class Native {
|
||||
public static final int LONG_SIZE;
|
||||
/** Size of a native <code>wchar_t</code> type, in bytes. */
|
||||
public static final int WCHAR_SIZE;
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("jnidispatch");
|
||||
@@ -158,7 +159,7 @@ public final class Native {
|
||||
throw new IllegalStateException("Component must be displayable");
|
||||
// On X11 VMs prior to 1.5, the window must be visible
|
||||
if (Platform.isX11()
|
||||
&& System.getProperty("java.version").matches("^1\\.4\\..*")) {
|
||||
&& System.getProperty("java.version").startsWith("1.4")) {
|
||||
if (!c.isVisible()) {
|
||||
throw new IllegalStateException("Component must be visible");
|
||||
}
|
||||
@@ -350,7 +351,7 @@ public final class Native {
|
||||
}
|
||||
|
||||
/** Return the preferred {@link TypeMapper} for the given native interface.
|
||||
* @see Library#OPTION_TYPE_MAPPER
|
||||
* See {@link com.sun.jna.Library#OPTION_TYPE_MAPPER}.
|
||||
*/
|
||||
public static TypeMapper getTypeMapper(Class cls) {
|
||||
synchronized(libraries) {
|
||||
@@ -381,7 +382,7 @@ public final class Native {
|
||||
}
|
||||
|
||||
/** Return the preferred structure alignment for the given native interface.
|
||||
* @see Library#OPTION_STRUCTURE_ALIGNMENT
|
||||
* See {@link com.sun.jna.Library#OPTION_STRUCTURE_ALIGNMENT}.
|
||||
*/
|
||||
public static int getStructureAlignment(Class cls) {
|
||||
synchronized(libraries) {
|
||||
@@ -428,7 +429,7 @@ public final class Native {
|
||||
}
|
||||
|
||||
private static String getNativeLibraryResourcePath() {
|
||||
String arch = System.getProperty("os.arch");
|
||||
String arch = System.getProperty("os.arch").toLowerCase();
|
||||
String osPrefix;
|
||||
if (Platform.isWindows()) {
|
||||
osPrefix = "win32-" + arch;
|
||||
@@ -437,6 +438,12 @@ public final class Native {
|
||||
osPrefix = "darwin";
|
||||
}
|
||||
else if (Platform.isLinux()) {
|
||||
if ("x86".equals(arch)) {
|
||||
arch = "i386";
|
||||
}
|
||||
else if ("x86_64".equals(arch)) {
|
||||
arch = "amd64";
|
||||
}
|
||||
osPrefix = "linux-" + arch;
|
||||
}
|
||||
else if (Platform.isSolaris()) {
|
||||
@@ -470,12 +477,8 @@ public final class Native {
|
||||
|
||||
File lib = null;
|
||||
if (url.getProtocol().toLowerCase().equals("file")) {
|
||||
try {
|
||||
lib = new File(URLDecoder.decode(url.getPath(), "UTF8"));
|
||||
}
|
||||
catch(UnsupportedEncodingException e) {
|
||||
throw new Error("JRE is unexpectedly missing UTF8 encoding");
|
||||
}
|
||||
// NOTE: use older API for 1.3 compatibility
|
||||
lib = new File(URLDecoder.decode(url.getPath()));
|
||||
}
|
||||
else {
|
||||
InputStream is = Native.class.getResourceAsStream(resourceName);
|
||||
@@ -489,9 +492,8 @@ public final class Native {
|
||||
// Let Java pick the suffix
|
||||
lib = File.createTempFile("jna", null);
|
||||
lib.deleteOnExit();
|
||||
// Have to remove the temp file after VM exit on w32
|
||||
if (Platform.isWindows()) {
|
||||
Runtime.getRuntime().addShutdownHook(new W32Cleanup(lib));
|
||||
if (Platform.deleteNativeLibraryAfterVMExit()) {
|
||||
Runtime.getRuntime().addShutdownHook(new DeleteNativeLibrary(lib));
|
||||
}
|
||||
fos = new FileOutputStream(lib);
|
||||
int count;
|
||||
@@ -501,7 +503,7 @@ public final class Native {
|
||||
}
|
||||
}
|
||||
catch(IOException e) {
|
||||
throw new Error("Failed to create temporary file for jnidispatch library", e);
|
||||
throw new Error("Failed to create temporary file for jnidispatch library: " + e);
|
||||
}
|
||||
finally {
|
||||
try { is.close(); } catch(IOException e) { }
|
||||
@@ -592,7 +594,8 @@ public final class Native {
|
||||
* <code>jna.library.path</code> so that JNA can load libraries identified
|
||||
* by the <nativelib> tag in the JNLP configuration file. Returns
|
||||
* <code>null</code> if the Web Start native library cache location can not
|
||||
* be determined.
|
||||
* be determined. Note that the path returned may be different for any
|
||||
* given library name.
|
||||
* <p>
|
||||
* Use <code>System.getProperty("javawebstart.version")</code> to detect
|
||||
* whether your code is running under Web Start.
|
||||
@@ -628,21 +631,48 @@ public final class Native {
|
||||
* all native bits to be encapsulated in a private class).
|
||||
* Instead, spawn a cleanup task to remove the file *after* the VM exits.
|
||||
*/
|
||||
public static class W32Cleanup extends Thread {
|
||||
public static class DeleteNativeLibrary extends Thread {
|
||||
private File file;
|
||||
public W32Cleanup(File file) {
|
||||
public DeleteNativeLibrary(File file) {
|
||||
this.file = file;
|
||||
}
|
||||
public void run() {
|
||||
private boolean unload(String path) {
|
||||
// Reach into the bowels of ClassLoader to force the native
|
||||
// library to unload
|
||||
try {
|
||||
Runtime.getRuntime().exec(new String[] {
|
||||
System.getProperty("java.home") + "/bin/java",
|
||||
"-cp", System.getProperty("java.class.path"),
|
||||
getClass().getName(),
|
||||
file.getAbsolutePath(),
|
||||
});
|
||||
ClassLoader cl = getClass().getClassLoader();
|
||||
Field f = ClassLoader.class.getDeclaredField("nativeLibraries");
|
||||
f.setAccessible(true);
|
||||
List libs = (List)f.get(cl);
|
||||
for (Iterator i = libs.iterator();i.hasNext();) {
|
||||
Object lib = i.next();
|
||||
f = lib.getClass().getDeclaredField("name");
|
||||
f.setAccessible(true);
|
||||
String name = (String)f.get(lib);
|
||||
if (name.equals(path)) {
|
||||
Method m = lib.getClass().getDeclaredMethod("finalize", new Class[0]);
|
||||
m.setAccessible(true);
|
||||
m.invoke(lib, new Object[0]);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(Exception e) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public void run() {
|
||||
if (!unload(file.getAbsolutePath()) || !file.delete()) {
|
||||
try {
|
||||
Runtime.getRuntime().exec(new String[] {
|
||||
System.getProperty("java.home") + "/bin/java",
|
||||
"-cp", System.getProperty("java.class.path"),
|
||||
getClass().getName(),
|
||||
file.getAbsolutePath(),
|
||||
});
|
||||
}
|
||||
catch(IOException e) { e.printStackTrace(); }
|
||||
}
|
||||
catch(IOException e) { e.printStackTrace(); }
|
||||
}
|
||||
public static void main(String[] args) {
|
||||
if (args.length == 1) {
|
||||
@@ -652,8 +682,11 @@ public final class Native {
|
||||
while (!file.delete() && file.exists()) {
|
||||
try { Thread.sleep(10); }
|
||||
catch(InterruptedException e) { }
|
||||
if (System.currentTimeMillis() - start > 1000)
|
||||
if (System.currentTimeMillis() - start > 5000) {
|
||||
System.err.println("Could not remove temp file: "
|
||||
+ file.getAbsolutePath());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -667,7 +700,7 @@ public final class Native {
|
||||
*/
|
||||
public static int getNativeSize(Class cls) {
|
||||
if (NativeMapped.class.isAssignableFrom(cls)) {
|
||||
cls = new NativeMappedConverter(cls).nativeType();
|
||||
cls = NativeMappedConverter.getInstance(cls).nativeType();
|
||||
}
|
||||
// boolean defaults to 32 bit integer if not otherwise mapped
|
||||
if (cls == boolean.class || cls == Boolean.class) return 4;
|
||||
@@ -697,7 +730,7 @@ public final class Native {
|
||||
|
||||
/** Indicate whether the given class is supported as a native argument
|
||||
* type.
|
||||
*/
|
||||
*/
|
||||
public static boolean isSupportedNativeType(Class cls) {
|
||||
if (Structure.class.isAssignableFrom(cls)) {
|
||||
return true;
|
||||
@@ -712,9 +745,18 @@ public final class Native {
|
||||
|
||||
/** Prints JNA library details to the console. */
|
||||
public static void main(String[] args) {
|
||||
final String DEFAULT_TITLE = "Java Native Access (JNA)";
|
||||
final String UNKNOWN_VERSION = "unknown - package information missing";
|
||||
Package pkg = Native.class.getPackage();
|
||||
System.out.println(pkg.getSpecificationTitle());
|
||||
System.out.println("Version: " + Native.class.getPackage().getImplementationVersion());
|
||||
String title = pkg.getSpecificationTitle();
|
||||
if (title == null) title = DEFAULT_TITLE;
|
||||
String version = pkg.getSpecificationVersion();
|
||||
if (version == null) version = UNKNOWN_VERSION;
|
||||
title += " API Version " + version;
|
||||
System.out.println(title);
|
||||
version = pkg.getImplementationVersion();
|
||||
if (version == null) version = UNKNOWN_VERSION;
|
||||
System.out.println("Version: " + version);
|
||||
System.out.println(" Native: " + getNativeVersion() + " ("
|
||||
+ getAPIChecksum() + ")");
|
||||
System.exit(0);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2007 Wayne Meissner, All Rights Reserved
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
@@ -24,10 +24,10 @@ import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
/**
|
||||
* Provides management of native library resources. One instance of this
|
||||
* Provides management of native library resources. One instance of this
|
||||
* class corresponds to a single loaded native library.
|
||||
* <p>
|
||||
* <b>Library Search Paths</b>
|
||||
@@ -41,10 +41,10 @@ import java.util.regex.Pattern;
|
||||
public class NativeLibrary {
|
||||
|
||||
private long handle;
|
||||
private String libraryName;
|
||||
private String libraryPath;
|
||||
private final String libraryName;
|
||||
private final String libraryPath;
|
||||
private final Map functions = new HashMap();
|
||||
|
||||
|
||||
private static final Map libraries = new HashMap();
|
||||
private static final Map searchPaths = Collections.synchronizedMap(new HashMap());
|
||||
private static final List librarySearchPath = new LinkedList();
|
||||
@@ -72,10 +72,17 @@ public class NativeLibrary {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static NativeLibrary loadLibrary(String libraryName) {
|
||||
List searchPath = new LinkedList(librarySearchPath);
|
||||
|
||||
|
||||
// Append web start path, if available. Note that this does not
|
||||
// attempt any library name variations
|
||||
String webstartPath = Native.getWebStartLibraryPath(libraryName);
|
||||
if (webstartPath != null) {
|
||||
searchPath.add(webstartPath);
|
||||
}
|
||||
|
||||
//
|
||||
// Prepend any custom search paths specifically for this library
|
||||
//
|
||||
@@ -110,6 +117,12 @@ public class NativeLibrary {
|
||||
catch(UnsatisfiedLinkError e2) { e = e2; }
|
||||
}
|
||||
}
|
||||
// Try the same library with a "lib" prefix
|
||||
else if (Platform.isWindows()) {
|
||||
libraryPath = findLibraryPath("lib" + libraryName, searchPath);
|
||||
try { handle = open(libraryPath); }
|
||||
catch(UnsatisfiedLinkError e2) { e = e2; }
|
||||
}
|
||||
if (handle == 0) {
|
||||
throw new UnsatisfiedLinkError("Unable to load library '" + libraryName + "': "
|
||||
+ e.getMessage());
|
||||
@@ -117,7 +130,7 @@ public class NativeLibrary {
|
||||
}
|
||||
return new NativeLibrary(libraryName, libraryPath, handle);
|
||||
}
|
||||
|
||||
|
||||
private String getLibraryName(String libraryName) {
|
||||
String simplified = libraryName;
|
||||
final String BASE = "---";
|
||||
@@ -133,16 +146,16 @@ public class NativeLibrary {
|
||||
}
|
||||
return simplified;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns an instance of NativeLibrary for the specified name.
|
||||
* The library is loaded if not already loaded. If already loaded, the
|
||||
* Returns an instance of NativeLibrary for the specified name.
|
||||
* The library is loaded if not already loaded. If already loaded, the
|
||||
* existing instance is returned.<p>
|
||||
* More than one name may map to the same NativeLibrary instance; only
|
||||
* a single instance will be provided for any given unique file path.
|
||||
*
|
||||
*
|
||||
* @param libraryName The library name to load.
|
||||
* This can be short form (e.g. "c"),
|
||||
* This can be short form (e.g. "c"),
|
||||
* an explicit version (e.g. "libc.so.6"), or
|
||||
* the full path to the library (e.g. "/lib/libc.so.6").
|
||||
*/
|
||||
@@ -163,13 +176,13 @@ public class NativeLibrary {
|
||||
return library;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a path to search for the specified library, ahead of any system paths
|
||||
*
|
||||
*
|
||||
* @param libraryName The name of the library to use the path for
|
||||
* @param path The path to use when trying to load the library
|
||||
*/
|
||||
*/
|
||||
public static final void addSearchPath(String libraryName, String path) {
|
||||
synchronized (searchPaths) {
|
||||
List customPaths = (List) searchPaths.get(libraryName);
|
||||
@@ -177,7 +190,7 @@ public class NativeLibrary {
|
||||
customPaths = Collections.synchronizedList(new LinkedList());
|
||||
searchPaths.put(libraryName, customPaths);
|
||||
}
|
||||
|
||||
|
||||
customPaths.add(path);
|
||||
}
|
||||
}
|
||||
@@ -196,7 +209,7 @@ public class NativeLibrary {
|
||||
public Function getFunction(String functionName) {
|
||||
return getFunction(functionName, Function.C_CONVENTION);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a new @{link Function} that is linked with a native
|
||||
* function that follows a given calling convention.
|
||||
@@ -226,19 +239,19 @@ public class NativeLibrary {
|
||||
/** Look up the given global variable within this library.
|
||||
* @param symbolName
|
||||
* @return Pointer representing the global variable address
|
||||
* @throws UnsatisfiedLinkError if the symbol is not found
|
||||
* @throws UnsatisfiedLinkError if the symbol is not found
|
||||
*/
|
||||
public Pointer getGlobalVariableAddress(String symbolName) {
|
||||
try {
|
||||
return new Pointer(getSymbolAddress(symbolName));
|
||||
}
|
||||
catch(UnsatisfiedLinkError e) {
|
||||
throw new UnsatisfiedLinkError("Error looking up '"
|
||||
+ symbolName + "': "
|
||||
throw new UnsatisfiedLinkError("Error looking up '"
|
||||
+ symbolName + "': "
|
||||
+ e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Used by the Function class to locate a symbol
|
||||
* @throws UnsatisfiedLinkError if the symbol can't be found
|
||||
@@ -256,49 +269,61 @@ public class NativeLibrary {
|
||||
public String getName() {
|
||||
return libraryName;
|
||||
}
|
||||
/** Returns the file on disk corresponding to this NativeLibrary instacne.
|
||||
/** Returns the file on disk corresponding to this NativeLibrary instacne.
|
||||
*/
|
||||
public File getFile() {
|
||||
return new File(libraryPath);
|
||||
}
|
||||
/** Close the library when it is no longer referenced. */
|
||||
protected void finalize() {
|
||||
if (handle != 0) {
|
||||
close(handle);
|
||||
handle = 0;
|
||||
dispose();
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
synchronized(libraries) {
|
||||
libraries.remove(getName());
|
||||
libraries.remove(getFile().getAbsolutePath());
|
||||
libraries.remove(getFile().getName());
|
||||
}
|
||||
synchronized(this) {
|
||||
if (handle != 0) {
|
||||
close(handle);
|
||||
handle = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static List initPaths(String key) {
|
||||
String value = System.getProperty(key, "");
|
||||
if ("".equals(value)) {
|
||||
return Collections.EMPTY_LIST;
|
||||
}
|
||||
String[] paths = value.split(File.pathSeparator);
|
||||
StringTokenizer st = new StringTokenizer(value, File.pathSeparator);
|
||||
List list = new ArrayList();
|
||||
for (int i=0;i < paths.length;i++) {
|
||||
if (!"".equals(paths[i])) {
|
||||
list.add(paths[i]);
|
||||
while (st.hasMoreTokens()) {
|
||||
String path = st.nextToken();
|
||||
if (!"".equals(path)) {
|
||||
list.add(path);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
/** Use standard library search paths to find the library. */
|
||||
private static String findLibraryPath(String libName, List searchPath) {
|
||||
|
||||
|
||||
//
|
||||
// If a full path to the library was specified, don't search for it
|
||||
//
|
||||
if (new File(libName).isAbsolute()) {
|
||||
return libName;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Get the system name for the library (e.g. libfoo.so)
|
||||
//
|
||||
String name = mapLibraryName(libName);
|
||||
|
||||
|
||||
// Search in the JNA paths for it
|
||||
for (Iterator it = searchPath.iterator(); it.hasNext(); ) {
|
||||
File file = new File(new File((String) it.next()), name);
|
||||
@@ -306,7 +331,7 @@ public class NativeLibrary {
|
||||
return file.getAbsolutePath();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Default to returning the mapped library name and letting the system
|
||||
// search for it
|
||||
@@ -314,45 +339,67 @@ public class NativeLibrary {
|
||||
return name;
|
||||
}
|
||||
private static String mapLibraryName(String libName) {
|
||||
|
||||
|
||||
if (Platform.isMac()) {
|
||||
if (libName.matches("lib.*\\.(dylib|jnilib)$")) {
|
||||
if (libName.startsWith("lib")
|
||||
&& (libName.endsWith(".dylib")
|
||||
|| libName.endsWith(".jnilib"))) {
|
||||
return libName;
|
||||
}
|
||||
String name = System.mapLibraryName(libName);
|
||||
// On MacOSX, System.mapLibraryName() returns the .jnilib extension
|
||||
// (the suffix for JNI libraries); ordinarily shared libraries have
|
||||
// (the suffix for JNI libraries); ordinarily shared libraries have
|
||||
// a .dylib suffix
|
||||
if (name.endsWith(".jnilib")) {
|
||||
return name.substring(0, name.lastIndexOf(".jnilib")) + ".dylib";
|
||||
}
|
||||
return name;
|
||||
} else if (Platform.isLinux()) {
|
||||
//
|
||||
// A specific version was requested - use as is for search
|
||||
//
|
||||
if (libName.matches("lib.*\\.so\\.[0-9]+$")) {
|
||||
}
|
||||
else if (Platform.isLinux()) {
|
||||
if (isVersionedName(libName)) {
|
||||
// A specific version was requested - use as is for search
|
||||
return libName;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return System.mapLibraryName(libName);
|
||||
}
|
||||
|
||||
|
||||
private static boolean isVersionedName(String name) {
|
||||
if (name.startsWith("lib")) {
|
||||
int so = name.lastIndexOf(".so.");
|
||||
if (so != -1 && so + 4 < name.length()) {
|
||||
for (int i=so+4;i < name.length();i++) {
|
||||
char ch = name.charAt(i);
|
||||
if (!Character.isDigit(ch) && ch != '.') {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* matchLibrary is very Linux specific. It is here to deal with the case
|
||||
* where there is no /usr/lib/libc.so, or it is not a valid symlink to
|
||||
* /lib/libc.so.6.
|
||||
* matchLibrary() is very Linux specific. It is here to deal with the case
|
||||
* where /usr/lib/libc.so does not exist, or it is not a valid symlink to
|
||||
* a versioned file (e.g. /lib/libc.so.6).
|
||||
*/
|
||||
private static String matchLibrary(final String libName, List searchPath) {
|
||||
|
||||
static String matchLibrary(final String libName, List searchPath) {
|
||||
File lib = new File(libName);
|
||||
if (lib.isAbsolute()) {
|
||||
searchPath = Arrays.asList(new String[] { lib.getParent() });
|
||||
}
|
||||
FilenameFilter filter = new FilenameFilter() {
|
||||
Pattern p = Pattern.compile("lib" + libName + "\\.so\\.[0-9]+$");
|
||||
public boolean accept(File dir, String name) {
|
||||
return p.matcher(name).matches();
|
||||
public boolean accept(File dir, String filename) {
|
||||
return (filename.startsWith("lib" + libName + ".so")
|
||||
|| (filename.startsWith(libName + ".so")
|
||||
&& libName.startsWith("lib")))
|
||||
&& isVersionedName(filename);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
List matches = new LinkedList();
|
||||
for (Iterator it = searchPath.iterator(); it.hasNext(); ) {
|
||||
File[] files = new File((String) it.next()).listFiles(filter);
|
||||
@@ -360,30 +407,56 @@ public class NativeLibrary {
|
||||
matches.addAll(Arrays.asList(files));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Search through the results and return the highest numbered version
|
||||
// i.e. libc.so.6 is preferred over libc.so.5
|
||||
//
|
||||
int version = 0;
|
||||
double bestVersion = -1;
|
||||
String bestMatch = null;
|
||||
for (Iterator it = matches.iterator(); it.hasNext(); ) {
|
||||
String path = ((File) it.next()).getAbsolutePath();
|
||||
String num = path.substring(path.lastIndexOf('.') + 1);
|
||||
try {
|
||||
if (Integer.parseInt(num) >= version) {
|
||||
bestMatch = path;
|
||||
}
|
||||
} catch (NumberFormatException e) {} // Just skip if not a number
|
||||
String ver = path.substring(path.lastIndexOf(".so.") + 4);
|
||||
double version = parseVersion(ver);
|
||||
if (version > bestVersion) {
|
||||
bestVersion = version;
|
||||
bestMatch = path;
|
||||
}
|
||||
}
|
||||
return bestMatch;
|
||||
}
|
||||
|
||||
|
||||
static double parseVersion(String ver) {
|
||||
double v = 0;
|
||||
double divisor = 1;
|
||||
int dot = ver.indexOf(".");
|
||||
while (ver != null) {
|
||||
String num;
|
||||
if (dot != -1) {
|
||||
num = ver.substring(0, dot);
|
||||
ver = ver.substring(dot + 1);
|
||||
dot = ver.indexOf(".");
|
||||
}
|
||||
else {
|
||||
num = ver;
|
||||
ver = null;
|
||||
}
|
||||
try {
|
||||
v += Integer.parseInt(num) / divisor;
|
||||
}
|
||||
catch(NumberFormatException e) {
|
||||
return 0;
|
||||
}
|
||||
divisor *= 100;
|
||||
}
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
private static native long open(String name);
|
||||
private static native void close(long handle);
|
||||
private static native long findSymbol(long handle, String name);
|
||||
static {
|
||||
|
||||
|
||||
librarySearchPath.addAll(initPaths("jna.library.path"));
|
||||
String webstartPath = Native.getWebStartLibraryPath("jnidispatch");
|
||||
if (webstartPath != null) {
|
||||
@@ -395,13 +468,15 @@ public class NativeLibrary {
|
||||
String platformPath = "";
|
||||
String sep = "";
|
||||
String archPath = "";
|
||||
|
||||
|
||||
//
|
||||
// Search first for an arch specific path, but fall back to the generic
|
||||
// path if it does not exist. Some older linux amd64 distros did not
|
||||
// have /usr/lib64, and 32bit distros only have /usr/lib.
|
||||
// FreeBSD also only has /usr/lib by default, with /usr/lib32 for 32bit compat.
|
||||
// Solaris seems to have both, but defaults to 32bit userland even on
|
||||
// Search first for an arch specific path if one exists, but always
|
||||
// include the generic paths if they exist.
|
||||
// NOTES (wmeissner):
|
||||
// Some older linux amd64 distros did not have /usr/lib64, and 32bit
|
||||
// distros only have /usr/lib. FreeBSD also only has /usr/lib by
|
||||
// default, with /usr/lib32 for 32bit compat.
|
||||
// Solaris seems to have both, but defaults to 32bit userland even on
|
||||
// 64bit machines, so we have to explicitly search the 64bit one when
|
||||
// running a 64bit JVM.
|
||||
//
|
||||
@@ -409,25 +484,25 @@ public class NativeLibrary {
|
||||
// Linux & FreeBSD use /usr/lib32, solaris uses /usr/lib/32
|
||||
archPath = (Platform.isSolaris() ? "/" : "") + Pointer.SIZE * 8;
|
||||
}
|
||||
|
||||
if (new File("/usr/lib" + archPath).exists()) {
|
||||
platformPath += sep + "/usr/lib" + archPath;
|
||||
sep = File.pathSeparator;
|
||||
String[] paths = {
|
||||
"/usr/lib" + archPath,
|
||||
"/lib" + archPath,
|
||||
"/usr/lib",
|
||||
"/lib",
|
||||
};
|
||||
// Linux 64-bit does not use /lib or /usr/lib
|
||||
if (Platform.isLinux() && Pointer.SIZE == 8) {
|
||||
paths = new String[] {
|
||||
"/usr/lib" + archPath,
|
||||
"/lib" + archPath,
|
||||
};
|
||||
}
|
||||
// Use default if arch specific is not found
|
||||
else if (new File("/usr/lib").exists()) {
|
||||
platformPath += sep + "/usr/lib";
|
||||
sep = File.pathSeparator;
|
||||
}
|
||||
|
||||
if (new File("/lib" + archPath).exists()) {
|
||||
platformPath += sep + "/lib" + archPath;
|
||||
sep = File.pathSeparator;
|
||||
}
|
||||
// Use default if arch specific is not found
|
||||
else if (new File("/lib").exists()) {
|
||||
platformPath += sep + "/lib";
|
||||
sep = File.pathSeparator;
|
||||
for (int i=0;i < paths.length;i++) {
|
||||
File dir = new File(paths[i]);
|
||||
if (dir.exists() && dir.isDirectory()) {
|
||||
platformPath += sep + paths[i];
|
||||
sep = File.pathSeparator;
|
||||
}
|
||||
}
|
||||
if (!"".equals(platformPath)) {
|
||||
System.setProperty("jna.platform.library.path", platformPath);
|
||||
|
||||
@@ -1,22 +1,38 @@
|
||||
/* Copyright (c) 2007 Timothy Wall, All Rights Reserved
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
* Lesser General Public License for more details.
|
||||
*/
|
||||
package com.sun.jna;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
/** Provides type conversion for instances of {@link NativeMapped}. */
|
||||
public class NativeMappedConverter implements TypeConverter {
|
||||
private Class type;
|
||||
private Class nativeType;
|
||||
private NativeMapped instance;
|
||||
private static Map converters = new WeakHashMap();
|
||||
private final Class type;
|
||||
private final Class nativeType;
|
||||
private final NativeMapped instance;
|
||||
|
||||
public static NativeMappedConverter getInstance(Class cls) {
|
||||
synchronized(converters) {
|
||||
NativeMappedConverter nmc = (NativeMappedConverter)converters.get(cls);
|
||||
if (nmc == null) {
|
||||
nmc = new NativeMappedConverter(cls);
|
||||
converters.put(cls, nmc);
|
||||
}
|
||||
return nmc;
|
||||
}
|
||||
}
|
||||
|
||||
public NativeMappedConverter(Class type) {
|
||||
if (!NativeMapped.class.isAssignableFrom(type))
|
||||
throw new IllegalArgumentException("Type must derive from "
|
||||
@@ -25,7 +41,7 @@ public class NativeMappedConverter implements TypeConverter {
|
||||
this.instance = defaultValue();
|
||||
this.nativeType = instance.nativeType();
|
||||
}
|
||||
|
||||
|
||||
public NativeMapped defaultValue() {
|
||||
try {
|
||||
return (NativeMapped)type.newInstance();
|
||||
@@ -50,6 +66,6 @@ public class NativeMappedConverter implements TypeConverter {
|
||||
}
|
||||
|
||||
public Object toNative(Object value, ToNativeContext context) {
|
||||
return ((NativeMapped)value).toNative();
|
||||
return value == null ? defaultValue().toNative() : ((NativeMapped)value).toNative();
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,8 @@
|
||||
*/
|
||||
package com.sun.jna;
|
||||
|
||||
import java.nio.CharBuffer;
|
||||
|
||||
|
||||
/** Provides a temporary allocation of an immutable C string
|
||||
* (<code>const char*</code> or <code>const wchar_t*</code>) for use when
|
||||
@@ -91,7 +93,7 @@ class NativeString implements CharSequence, Comparable {
|
||||
}
|
||||
|
||||
public CharSequence subSequence(int start, int end) {
|
||||
return value.subSequence(start, end);
|
||||
return CharBuffer.wrap(value).subSequence(start, end);
|
||||
}
|
||||
|
||||
public int compareTo(Object other) {
|
||||
|
||||
@@ -17,6 +17,8 @@ public final class Platform {
|
||||
private static final int WINDOWS = 2;
|
||||
private static final int SOLARIS = 3;
|
||||
private static final int FREEBSD = 4;
|
||||
private static final int OPENBSD = 5;
|
||||
private static final int WINDOWSCE = 6;
|
||||
private static final int osType;
|
||||
|
||||
static {
|
||||
@@ -27,6 +29,9 @@ public final class Platform {
|
||||
else if (osName.startsWith("Mac") || osName.startsWith("Darwin")) {
|
||||
osType = MAC;
|
||||
}
|
||||
else if (osName.startsWith("Windows CE")) {
|
||||
osType = WINDOWSCE;
|
||||
}
|
||||
else if (osName.startsWith("Windows")) {
|
||||
osType = WINDOWS;
|
||||
}
|
||||
@@ -36,6 +41,9 @@ public final class Platform {
|
||||
else if (osName.startsWith("FreeBSD")) {
|
||||
osType = FREEBSD;
|
||||
}
|
||||
else if (osName.startsWith("OpenBSD")) {
|
||||
osType = OPENBSD;
|
||||
}
|
||||
else {
|
||||
osType = UNSPECIFIED;
|
||||
}
|
||||
@@ -47,8 +55,11 @@ public final class Platform {
|
||||
public static final boolean isLinux() {
|
||||
return osType == LINUX;
|
||||
}
|
||||
public static final boolean isWindowsCE() {
|
||||
return osType == WINDOWSCE;
|
||||
}
|
||||
public static final boolean isWindows() {
|
||||
return osType == WINDOWS;
|
||||
return osType == WINDOWS || osType == WINDOWSCE;
|
||||
}
|
||||
public static final boolean isSolaris() {
|
||||
return osType == SOLARIS;
|
||||
@@ -56,8 +67,19 @@ public final class Platform {
|
||||
public static final boolean isFreeBSD() {
|
||||
return osType == FREEBSD;
|
||||
}
|
||||
public static final boolean isOpenBSD() {
|
||||
return osType == OPENBSD;
|
||||
}
|
||||
public static final boolean isX11() {
|
||||
// TODO: check FS or do some other X11-specific test
|
||||
// TODO: check filesystem for /usr/X11 or some other X11-specific test
|
||||
return !Platform.isWindows() && !Platform.isMac();
|
||||
}
|
||||
public static final boolean deleteNativeLibraryAfterVMExit() {
|
||||
return osType == WINDOWS;
|
||||
}
|
||||
public static final boolean hasRuntimeExec() {
|
||||
if (isWindowsCE() && "J9".equals(System.getProperty("java.vm.name")))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,8 @@ package com.sun.jna;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* An abstraction for a native pointer data type. A Pointer instance
|
||||
@@ -112,12 +114,12 @@ public class Pointer {
|
||||
}
|
||||
|
||||
private static native long _indexOf(long addr, byte value);
|
||||
|
||||
|
||||
/**
|
||||
* Indirect the native pointer, copying <em>from</em> memory pointed to by
|
||||
* Indirect the native pointer, copying <em>from</em> memory pointed to by
|
||||
* native pointer, into the specified array.
|
||||
*
|
||||
* @param offset byte offset from pointer into which data is copied
|
||||
* @param offset byte offset from pointer into which data is copied
|
||||
* @param buf <code>byte</code> array into which data is copied
|
||||
* @param index array index from which to start copying
|
||||
* @param length number of elements from native pointer that must be copied
|
||||
@@ -125,15 +127,15 @@ public class Pointer {
|
||||
public void read(long offset, byte[] buf, int index, int length) {
|
||||
_read(peer + offset, buf, index, length);
|
||||
}
|
||||
|
||||
|
||||
private static native void _read(long addr, byte[] buf, int index, int length);
|
||||
|
||||
|
||||
/**
|
||||
* Indirect the native pointer, copying <em>from</em> memory pointed to by
|
||||
* Indirect the native pointer, copying <em>from</em> memory pointed to by
|
||||
* native pointer, into the specified array.
|
||||
*
|
||||
* @param offset byte offset from pointer from which data is copied
|
||||
* @param offset byte offset from pointer from which data is copied
|
||||
* @param buf <code>short</code> array into which data is copied
|
||||
* @param index array index to which data is copied
|
||||
* @param length number of elements from native pointer that must be copied
|
||||
@@ -141,15 +143,15 @@ public class Pointer {
|
||||
public void read(long offset, short[] buf, int index, int length) {
|
||||
_read(peer + offset, buf, index, length);
|
||||
}
|
||||
|
||||
|
||||
private static native void _read(long addr, short[] buf, int index, int length);
|
||||
|
||||
|
||||
/**
|
||||
* Indirect the native pointer, copying <em>from</em> memory pointed to by
|
||||
* Indirect the native pointer, copying <em>from</em> memory pointed to by
|
||||
* native pointer, into the specified array.
|
||||
*
|
||||
* @param offset byte offset from pointer from which data is copied
|
||||
* @param offset byte offset from pointer from which data is copied
|
||||
* @param buf <code>char</code> array into which data is copied
|
||||
* @param index array index to which data is copied
|
||||
* @param length number of elements from native pointer that must be copied
|
||||
@@ -162,10 +164,10 @@ public class Pointer {
|
||||
|
||||
|
||||
/**
|
||||
* Indirect the native pointer, copying <em>from</em> memory pointed to by
|
||||
* Indirect the native pointer, copying <em>from</em> memory pointed to by
|
||||
* native pointer, into the specified array.
|
||||
*
|
||||
* @param offset byte offset from pointer from which data is copied
|
||||
* @param offset byte offset from pointer from which data is copied
|
||||
* @param buf <code>int</code> array into which data is copied
|
||||
* @param index array index to which data is copied
|
||||
* @param length number of elements from native pointer that must be copied
|
||||
@@ -175,12 +177,12 @@ public class Pointer {
|
||||
}
|
||||
|
||||
private static native void _read(long addr, int[] buf, int index, int length);
|
||||
|
||||
|
||||
/**
|
||||
* Indirect the native pointer, copying <em>from</em> memory pointed to by
|
||||
* Indirect the native pointer, copying <em>from</em> memory pointed to by
|
||||
* native pointer, into the specified array.
|
||||
*
|
||||
* @param offset byte offset from pointer from which data is copied
|
||||
* @param offset byte offset from pointer from which data is copied
|
||||
* @param buf <code>long</code> array into which data is copied
|
||||
* @param index array index to which data is copied
|
||||
* @param length number of elements from native pointer that must be copied
|
||||
@@ -192,10 +194,10 @@ public class Pointer {
|
||||
private static native void _read(long addr, long[] buf, int index, int length);
|
||||
|
||||
/**
|
||||
* Indirect the native pointer, copying <em>from</em> memory pointed to by
|
||||
* Indirect the native pointer, copying <em>from</em> memory pointed to by
|
||||
* native pointer, into the specified array.
|
||||
*
|
||||
* @param offset byte offset from pointer from which data is copied
|
||||
* @param offset byte offset from pointer from which data is copied
|
||||
* @param buf <code>float</code> array into which data is copied
|
||||
* @param index array index to which data is copied
|
||||
* @param length number of elements from native pointer that must be copied
|
||||
@@ -203,14 +205,14 @@ public class Pointer {
|
||||
public void read(long offset, float[] buf, int index, int length) {
|
||||
_read(peer + offset, buf, index, length);
|
||||
}
|
||||
|
||||
|
||||
private static native void _read(long addr, float[] buf, int index, int length);
|
||||
|
||||
/**
|
||||
* Indirect the native pointer, copying <em>from</em> memory pointed to by
|
||||
* Indirect the native pointer, copying <em>from</em> memory pointed to by
|
||||
* native pointer, into the specified array.
|
||||
*
|
||||
* @param offset byte offset from pointer from which data is copied
|
||||
* @param offset byte offset from pointer from which data is copied
|
||||
* @param buf <code>double</code> array into which data is copied
|
||||
* @param index array index to which data is copied
|
||||
* @param length number of elements from native pointer that must be copied
|
||||
@@ -218,14 +220,14 @@ public class Pointer {
|
||||
public void read(long offset, double[] buf, int index, int length) {
|
||||
_read(peer + offset, buf, index, length);
|
||||
}
|
||||
|
||||
|
||||
private static native void _read(long addr, double[] buf, int index, int length);
|
||||
|
||||
/**
|
||||
* Indirect the native pointer, copying <em>from</em> memory pointed to by
|
||||
* Indirect the native pointer, copying <em>from</em> memory pointed to by
|
||||
* native pointer, into the specified array.
|
||||
*
|
||||
* @param offset byte offset from pointer from which data is copied
|
||||
* @param offset byte offset from pointer from which data is copied
|
||||
* @param buf {@link Pointer} array into which data is copied
|
||||
* @param index array index to which data is copied
|
||||
* @param length number of elements from native pointer that must be copied
|
||||
@@ -242,10 +244,10 @@ public class Pointer {
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Indirect the native pointer, copying <em>into</em> memory pointed to by
|
||||
* Indirect the native pointer, copying <em>into</em> memory pointed to by
|
||||
* native pointer, from the specified array.
|
||||
*
|
||||
* @param offset byte offset from pointer into which data is copied
|
||||
* @param offset byte offset from pointer into which data is copied
|
||||
* @param buf <code>byte</code> array from which to copy
|
||||
* @param index array index from which to start copying
|
||||
* @param length number of elements from <code>buf</code> that must be
|
||||
@@ -254,15 +256,15 @@ public class Pointer {
|
||||
public void write(long offset, byte[] buf, int index, int length) {
|
||||
_write(peer + offset, buf, index, length);
|
||||
}
|
||||
|
||||
|
||||
private static native void _write(long addr, byte[] buf, int index, int length);
|
||||
|
||||
|
||||
/**
|
||||
* Indirect the native pointer, copying <em>into</em> memory pointed to by
|
||||
* Indirect the native pointer, copying <em>into</em> memory pointed to by
|
||||
* native pointer, from the specified array.
|
||||
*
|
||||
* @param offset byte offset from pointer into which data is copied
|
||||
* @param offset byte offset from pointer into which data is copied
|
||||
* @param buf <code>short</code> array from which to copy
|
||||
* @param index array index from which to start copying
|
||||
* @param length number of elements from <code>buf</code> that must be
|
||||
@@ -275,10 +277,10 @@ public class Pointer {
|
||||
private static native void _write(long addr, short[] buf, int index, int length);
|
||||
|
||||
/**
|
||||
* Indirect the native pointer, copying <em>into</em> memory pointed to by
|
||||
* Indirect the native pointer, copying <em>into</em> memory pointed to by
|
||||
* native pointer, from the specified array.
|
||||
*
|
||||
* @param offset byte offset from pointer into which data is copied
|
||||
* @param offset byte offset from pointer into which data is copied
|
||||
* @param buf <code>char</code> array from which to copy
|
||||
* @param index array index from which to start copying
|
||||
* @param length number of elements from <code>buf</code> that must be
|
||||
@@ -291,10 +293,10 @@ public class Pointer {
|
||||
private static native void _write(long addr, char[] buf, int index, int length);
|
||||
|
||||
/**
|
||||
* Indirect the native pointer, copying <em>into</em> memory pointed to by
|
||||
* Indirect the native pointer, copying <em>into</em> memory pointed to by
|
||||
* native pointer, from the specified array.
|
||||
*
|
||||
* @param offset byte offset from pointer into which data is copied
|
||||
* @param offset byte offset from pointer into which data is copied
|
||||
* @param buf <code>int</code> array from which to copy
|
||||
* @param index array index from which to start copying
|
||||
* @param length number of elements from <code>buf</code> that must be
|
||||
@@ -310,7 +312,7 @@ public class Pointer {
|
||||
* Indirect the native pointer, copying <em>into</em> memory pointed to by
|
||||
* native pointer, from the specified array.
|
||||
*
|
||||
* @param offset byte offset from pointer into which data is copied
|
||||
* @param offset byte offset from pointer into which data is copied
|
||||
* @param buf <code>long</code> array from which to copy
|
||||
* @param index array index from which to start copying
|
||||
* @param length number of elements from <code>buf</code> that must be
|
||||
@@ -323,10 +325,10 @@ public class Pointer {
|
||||
private static native void _write(long addr, long[] buf, int index, int length);
|
||||
|
||||
/**
|
||||
* Indirect the native pointer, copying <em>into</em> memory pointed to by
|
||||
* Indirect the native pointer, copying <em>into</em> memory pointed to by
|
||||
* native pointer, from the specified array.
|
||||
*
|
||||
* @param offset byte offset from pointer into which data is copied
|
||||
* @param offset byte offset from pointer into which data is copied
|
||||
* @param buf <code>float</code> array from which to copy
|
||||
* @param index array index from which to start copying
|
||||
* @param length number of elements from <code>buf</code> that must be
|
||||
@@ -339,10 +341,10 @@ public class Pointer {
|
||||
private static native void _write(long addr, float[] buf, int index, int length);
|
||||
|
||||
/**
|
||||
* Indirect the native pointer, copying <em>into</em> memory pointed to by
|
||||
* Indirect the native pointer, copying <em>into</em> memory pointed to by
|
||||
* native pointer, from the specified array.
|
||||
*
|
||||
* @param offset byte offset from pointer into which data is copied
|
||||
* @param offset byte offset from pointer into which data is copied
|
||||
* @param buf <code>double</code> array from which to copy
|
||||
* @param index array index from which to start copying
|
||||
* @param length number of elements from <code>buf</code> that must be
|
||||
@@ -354,7 +356,7 @@ public class Pointer {
|
||||
|
||||
private static native void _write(long addr, double[] buf, int index, int length);
|
||||
|
||||
/** Write the given array of Pointer to native memory.
|
||||
/** Write the given array of Pointer to native memory.
|
||||
* @param bOff byte offset from pointer into which data is copied
|
||||
* @param buf <code>Pointer</code> array from which to copy
|
||||
* @param index array index from which to start copying
|
||||
@@ -366,14 +368,14 @@ public class Pointer {
|
||||
setPointer(bOff + i * Pointer.SIZE, buf[index + i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Java type read methods
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Indirect the native pointer as a pointer to <code>byte</code>. This is
|
||||
* equivalent to the expression
|
||||
* equivalent to the expression
|
||||
* <code>*((jbyte *)((char *)Pointer + offset))</code>.
|
||||
*
|
||||
* @param offset offset from pointer to perform the indirection
|
||||
@@ -382,12 +384,12 @@ public class Pointer {
|
||||
public byte getByte(long offset) {
|
||||
return _getByte(peer + offset);
|
||||
}
|
||||
|
||||
|
||||
private static native byte _getByte(long addr);
|
||||
|
||||
/**
|
||||
* Indirect the native pointer as a pointer to <code>wchar_t</code>. This
|
||||
* is equivalent to the expression
|
||||
* Indirect the native pointer as a pointer to <code>wchar_t</code>. This
|
||||
* is equivalent to the expression
|
||||
* <code>*((wchar_t*)((char *)Pointer + offset))</code>.
|
||||
*
|
||||
* @param offset offset from pointer to perform the indirection
|
||||
@@ -396,7 +398,7 @@ public class Pointer {
|
||||
public char getChar(long offset) {
|
||||
return _getChar(peer + offset);
|
||||
}
|
||||
|
||||
|
||||
private static native char _getChar(long addr);
|
||||
|
||||
/**
|
||||
@@ -452,7 +454,7 @@ public class Pointer {
|
||||
public NativeLong getNativeLong(long offset) {
|
||||
return new NativeLong(NativeLong.SIZE == 8 ? getLong(offset) : getInt(offset));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Indirect the native pointer as a pointer to <code>float</code>. This is
|
||||
* equivalent to the expression
|
||||
@@ -468,7 +470,7 @@ public class Pointer {
|
||||
private native float _getFloat(long addr);
|
||||
|
||||
/**
|
||||
* Indirect the native pointer as a pointer to <code>double</code>. This
|
||||
* Indirect the native pointer as a pointer to <code>double</code>. This
|
||||
* is equivalent to the expression
|
||||
* <code>*((jdouble *)((char *)Pointer + offset))</code>.
|
||||
*
|
||||
@@ -478,18 +480,18 @@ public class Pointer {
|
||||
public double getDouble(long offset) {
|
||||
return _getDouble(peer + offset);
|
||||
}
|
||||
|
||||
|
||||
private static native double _getDouble(long addr);
|
||||
|
||||
/**
|
||||
* Indirect the native pointer as a pointer to pointer. This is equivalent
|
||||
* to the expression
|
||||
* Indirect the native pointer as a pointer to pointer. This is equivalent
|
||||
* to the expression
|
||||
* <code>*((void **)((char *)Pointer + offset))</code>.
|
||||
*
|
||||
* @param offset byte offset from pointer to perform the indirection
|
||||
* @return a {@link Pointer} equivalent of the pointer value
|
||||
* being pointed to, or <code>null</code> if the pointer value is
|
||||
* <code>NULL</code>;
|
||||
* @return a {@link Pointer} equivalent of the pointer value
|
||||
* being pointed to, or <code>null</code> if the pointer value is
|
||||
* <code>NULL</code>;
|
||||
*/
|
||||
public Pointer getPointer(long offset) {
|
||||
return _getPointer(peer + offset);
|
||||
@@ -503,16 +505,16 @@ public class Pointer {
|
||||
*
|
||||
* @param offset byte offset from pointer to start the buffer
|
||||
* @param length Length of ByteBuffer
|
||||
* @return a direct ByteBuffer that accesses the memory being pointed to,
|
||||
* @return a direct ByteBuffer that accesses the memory being pointed to,
|
||||
*/
|
||||
public ByteBuffer getByteBuffer(long offset, long length) {
|
||||
return _getDirectByteBuffer(peer + offset, length).order(ByteOrder.nativeOrder());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get a direct ByteBuffer mapped to the memory pointed to by the pointer.
|
||||
*
|
||||
* @param offset byte offset from pointer to start the buffer
|
||||
* @param addr byte offset from pointer to start the buffer
|
||||
* @param length Length of ByteBuffer
|
||||
* @return a direct ByteBuffer that accesses the memory being pointed to,
|
||||
*/
|
||||
@@ -603,12 +605,53 @@ v * @param wide whether to convert from a wide or standard C string
|
||||
return buf;
|
||||
}
|
||||
|
||||
/** Returns an array of {@link Pointer}. The array length is
|
||||
* determined by a NULL-valued terminating element.
|
||||
*/
|
||||
public Pointer[] getPointerArray(long base) {
|
||||
List array = new ArrayList();
|
||||
int offset = 0;
|
||||
Pointer p = getPointer(base);
|
||||
while (p != null) {
|
||||
array.add(p);
|
||||
offset += Pointer.SIZE;
|
||||
p = getPointer(base + offset);
|
||||
}
|
||||
return (Pointer[])array.toArray(new Pointer[array.size()]);
|
||||
}
|
||||
|
||||
/** Returns an array of {@link Pointer} of the requested size. */
|
||||
public Pointer[] getPointerArray(long offset, int arraySize) {
|
||||
Pointer[] buf = new Pointer[arraySize];
|
||||
read(offset, buf, 0, arraySize);
|
||||
return buf;
|
||||
}
|
||||
|
||||
/** Returns an array of <code>String</code> based on a native array
|
||||
* of <code>char *</code>. The array length is determined by a
|
||||
* NULL-valued terminating element.
|
||||
*/
|
||||
public String[] getStringArray(long base) {
|
||||
return getStringArray(base, false);
|
||||
}
|
||||
|
||||
/** Returns an array of <code>String</code> based on a native array
|
||||
* of <code>char*</code> or <code>wchar_t*</code> based on the
|
||||
* <code>wide</code> parameter. The array length is determined by a
|
||||
* NULL-valued terminating element.
|
||||
*/
|
||||
public String[] getStringArray(long base, boolean wide) {
|
||||
List strings = new ArrayList();
|
||||
int offset = 0;
|
||||
Pointer p = getPointer(base);
|
||||
while (p != null) {
|
||||
strings.add(p.getString(0, wide));
|
||||
offset += SIZE;
|
||||
p = getPointer(base + offset);
|
||||
}
|
||||
return (String[])strings.toArray(new String[strings.size()]);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Java type write methods
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -1,3 +1,15 @@
|
||||
/* Copyright (c) 2007-2008 Timothy Wall, All Rights Reserved
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* <p/>
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*/
|
||||
package com.sun.jna;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -8,7 +20,7 @@ import java.util.List;
|
||||
* pointers. An extra NULL pointer is always added to the end of the native
|
||||
* pointer array for convenience.
|
||||
*/
|
||||
public class StringArray extends Memory {
|
||||
public class StringArray extends Memory implements Function.PostCallRead {
|
||||
private boolean wide;
|
||||
private List natives = new ArrayList();
|
||||
private Object[] original;
|
||||
@@ -43,8 +55,13 @@ public class StringArray extends Memory {
|
||||
public void read() {
|
||||
boolean returnWide = original instanceof WString[];
|
||||
for (int si=0;si < original.length;si++) {
|
||||
String s = getPointer(si * Pointer.SIZE).getString(0, wide);
|
||||
original[si] = returnWide ? new WString(s) : (Object)s;
|
||||
Pointer p = getPointer(si * Pointer.SIZE);
|
||||
Object s = null;
|
||||
if (p != null) {
|
||||
s = p.getString(0, wide);
|
||||
if (returnWide) s = new WString((String)s);
|
||||
}
|
||||
original[si] = s;
|
||||
}
|
||||
}
|
||||
}
|
||||
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
@@ -44,6 +44,7 @@ public abstract class Union extends Structure {
|
||||
* any declared union field.
|
||||
*/
|
||||
public void setType(Class type) {
|
||||
ensureAllocated();
|
||||
for (Iterator i=fields().values().iterator();i.hasNext();) {
|
||||
StructField f = (StructField)i.next();
|
||||
if (f.type == type) {
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
*/
|
||||
package com.sun.jna;
|
||||
|
||||
import java.nio.CharBuffer;
|
||||
|
||||
/** Simple wrapper class to identify a wide string argument or return type.
|
||||
* @author twall@users.sf.net
|
||||
*/
|
||||
@@ -39,6 +41,6 @@ public final class WString implements CharSequence, Comparable {
|
||||
return toString().charAt(index);
|
||||
}
|
||||
public CharSequence subSequence(int start, int end) {
|
||||
return toString().subSequence(start, end);
|
||||
return CharBuffer.wrap(toString()).subSequence(start, end);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2007 Timothy Wall, All Rights Reserved
|
||||
/* Copyright (c) 2007-2008 Timothy Wall, All Rights Reserved
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -12,6 +12,7 @@
|
||||
*/
|
||||
package com.sun.jna.examples;
|
||||
|
||||
import java.awt.event.*;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics;
|
||||
@@ -57,8 +58,6 @@ import com.sun.jna.Pointer;
|
||||
import com.sun.jna.examples.unix.X11;
|
||||
import com.sun.jna.examples.unix.X11.Display;
|
||||
import com.sun.jna.examples.unix.X11.GC;
|
||||
import com.sun.jna.examples.unix.X11.Pixmap;
|
||||
import com.sun.jna.examples.unix.X11.Visual;
|
||||
import com.sun.jna.examples.unix.X11.XSetWindowAttributes;
|
||||
import com.sun.jna.examples.win32.GDI32;
|
||||
import com.sun.jna.examples.win32.User32;
|
||||
@@ -89,6 +88,10 @@ public class AlphaMaskDemo implements Runnable {
|
||||
private float alpha = 1f;
|
||||
private Image image;
|
||||
|
||||
private void update() {
|
||||
update(false, true);
|
||||
}
|
||||
|
||||
private void update(boolean a, boolean i) {
|
||||
String os = System.getProperty("os.name");
|
||||
if (os.startsWith("Windows"))
|
||||
@@ -119,6 +122,8 @@ public class AlphaMaskDemo implements Runnable {
|
||||
}
|
||||
}
|
||||
|
||||
private com.sun.jna.Memory buffer;
|
||||
private int[] pixels;
|
||||
private void updateX11(boolean a, boolean i) {
|
||||
X11 x11 = X11.INSTANCE;
|
||||
X11.Window win = X11.Window.None;
|
||||
@@ -129,11 +134,6 @@ public class AlphaMaskDemo implements Runnable {
|
||||
if (System.getProperty("java.version").matches("^1\\.4\\..*"))
|
||||
alphaWindow.setVisible(true);
|
||||
win = new X11.Window((int)Native.getWindowID(alphaWindow));
|
||||
XSetWindowAttributes xswa = new XSetWindowAttributes();
|
||||
xswa.background_pixel = new NativeLong(0x0);
|
||||
Visual visual = x11.XDefaultVisual(dpy, x11.XDefaultScreen(dpy));
|
||||
xswa.colormap = x11.XCreateColormap(dpy, win, visual, X11.AllocNone);
|
||||
x11.XChangeWindowAttributes(dpy, win, new NativeLong(X11.CWBackPixel|X11.CWColormap), xswa);
|
||||
Window parent = alphaWindow.getOwner();
|
||||
Point where = parent.getLocationOnScreen();
|
||||
where.translate(parent.getWidth(), 0);
|
||||
@@ -149,34 +149,54 @@ public class AlphaMaskDemo implements Runnable {
|
||||
int w = image.getWidth(null);
|
||||
int h = image.getHeight(null);
|
||||
alphaWindow.setSize(w, h);
|
||||
if (buffer == null || buffer.getSize() != w*h*4) {
|
||||
buffer = new com.sun.jna.Memory(w*h*4);
|
||||
pixels = new int[w*h];
|
||||
}
|
||||
|
||||
BufferedImage buf = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB_PRE);
|
||||
Graphics g = buf.getGraphics();
|
||||
g.drawImage(image, 0, 0, w, h, null);
|
||||
|
||||
long start = System.currentTimeMillis();
|
||||
long blitTime, putImageTime, write;
|
||||
GC gc = x11.XCreateGC(dpy, win, new NativeLong(0), null);
|
||||
Pixmap pixmap = x11.XCreatePixmap(dpy, win, w, h, 32);
|
||||
long gcTime = System.currentTimeMillis();
|
||||
try {
|
||||
x11.XSetForeground(dpy, gc, new NativeLong(0));
|
||||
x11.XFillRectangle(dpy, pixmap, gc, 0, 0, w, h);
|
||||
Raster raster = buf.getData();
|
||||
int[] pixel = new int[4];
|
||||
for (int y=0;y < h;y++) {
|
||||
for (int x=0;x < w;x++) {
|
||||
raster.getPixel(x, h-y-1, pixel);
|
||||
raster.getPixel(x, y, pixel);
|
||||
int alpha = (pixel[3]&0xFF)<<24;
|
||||
int red = (pixel[2]&0xFF);
|
||||
int green = (pixel[1]&0xFF)<<8;
|
||||
int blue = (pixel[0]&0xFF)<<16;
|
||||
x11.XSetForeground(dpy, gc, new NativeLong(alpha|red|green|blue));
|
||||
x11.XFillRectangle(dpy, pixmap, gc, x, h-y-1, 1, 1);
|
||||
pixels[y*w+x] = alpha|red|green|blue;
|
||||
}
|
||||
}
|
||||
x11.XCopyArea(dpy, pixmap, win, gc, 0, 0, w, h, 0, 0);
|
||||
blitTime = System.currentTimeMillis();
|
||||
X11.XWindowAttributes xwa = new X11.XWindowAttributes();
|
||||
x11.XGetWindowAttributes(dpy, win, xwa);
|
||||
X11.XImage image = x11.XCreateImage(dpy, xwa.visual,
|
||||
32, X11.ZPixmap,
|
||||
0, buffer, w, h, 32, w*4);
|
||||
buffer.write(0, pixels, 0, pixels.length);
|
||||
write = System.currentTimeMillis();
|
||||
x11.XPutImage(dpy, win, gc, image, 0,0,0,0,w,h);
|
||||
x11.XFree(image.getPointer());
|
||||
putImageTime = System.currentTimeMillis();
|
||||
}
|
||||
finally {
|
||||
if (gc != null)
|
||||
x11.XFreeGC(dpy, gc);
|
||||
}
|
||||
long end = System.currentTimeMillis();
|
||||
//System.out.println("gc: " + (gcTime-start) + "ms");
|
||||
//System.out.println("blit: " + (blitTime-gcTime) + "ms");
|
||||
//System.out.println("write: " + (write-blitTime) + "ms");
|
||||
//System.out.println("put image: " + (putImageTime-write) + "ms");
|
||||
//System.out.println("total: " + (end-start) + "ms");
|
||||
}
|
||||
}
|
||||
finally {
|
||||
@@ -469,6 +489,11 @@ public class AlphaMaskDemo implements Runnable {
|
||||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
centerOnScreen(frame);
|
||||
frame.setVisible(true);
|
||||
p.addMouseListener(new MouseAdapter() {
|
||||
public void mousePressed(MouseEvent e) {
|
||||
update();
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
URL url = getClass().getResource("tardis.png");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007 Timothy Wall, All Rights Reserved This library is
|
||||
* Copyright (c) 2007-2008 Timothy Wall, All Rights Reserved This library is
|
||||
* free software; you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Lesser General Public License as published by the
|
||||
* Free Software Foundation; either version 2.1 of the License, or (at
|
||||
@@ -10,6 +10,7 @@
|
||||
*/
|
||||
package com.sun.jna.examples;
|
||||
|
||||
import java.awt.Cursor;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.GraphicsConfiguration;
|
||||
import java.awt.GraphicsEnvironment;
|
||||
@@ -33,6 +34,7 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComponent;
|
||||
@@ -50,16 +52,11 @@ import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
import javax.swing.event.MouseInputAdapter;
|
||||
|
||||
// TODO: put this into a reasonable API; right now this is pretty much
|
||||
// just hard-coded blitting of an image into a window
|
||||
// Thanks to Rui Lopes for the C# example on which this is based:
|
||||
// rui@ruilopes.com
|
||||
// http://www.codeproject.com/cs/media/perpxalpha_sharp.asp?df=100&forumid=3270&exp=0&select=773155
|
||||
public class AlphaMaskDemo2 implements Runnable {
|
||||
private static final DataFlavor URL_FLAVOR = new DataFlavor("application/x-java-url; class=java.net.URL",
|
||||
"URL");
|
||||
private static final DataFlavor URI_LIST_FLAVOR = new DataFlavor("text/uri-list; class=java.lang.String",
|
||||
"URI list");
|
||||
private static final DataFlavor URL_FLAVOR =
|
||||
new DataFlavor("application/x-java-url; class=java.net.URL", "URL");
|
||||
private static final DataFlavor URI_LIST_FLAVOR =
|
||||
new DataFlavor("text/uri-list; class=java.lang.String", "URI list");
|
||||
private JFrame frame;
|
||||
private JWindow alphaWindow;
|
||||
private JLabel icon;
|
||||
@@ -106,6 +103,7 @@ public class AlphaMaskDemo2 implements Runnable {
|
||||
frame = new JFrame("Alpha Mask Demo");
|
||||
alphaWindow = new JWindow(frame, gconfig);
|
||||
icon = new JLabel();
|
||||
icon.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
|
||||
alphaWindow.getContentPane().add(icon);
|
||||
JButton quit = new JButton("Quit");
|
||||
JLabel label = new JLabel("Drag this window by its image");
|
||||
@@ -251,6 +249,7 @@ public class AlphaMaskDemo2 implements Runnable {
|
||||
"<html><center>Drop an image with an alpha channel onto this window<br>"
|
||||
+ "You may also adjust the overall transparency with the slider</center></html>"),
|
||||
BorderLayout.NORTH);
|
||||
p.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
|
||||
final JSlider slider = new JSlider(0, 255, 255);
|
||||
slider.addChangeListener(new ChangeListener() {
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
|
||||
@@ -21,7 +21,6 @@ import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import com.sun.jna.Pointer;
|
||||
import com.sun.jna.examples.win32.Kernel32;
|
||||
import com.sun.jna.examples.win32.Kernel32.FILE_NOTIFY_INFORMATION;
|
||||
import com.sun.jna.examples.win32.Kernel32.OVERLAPPED;
|
||||
@@ -56,8 +55,8 @@ public abstract class FileMonitor {
|
||||
}
|
||||
|
||||
public class FileEvent extends EventObject {
|
||||
private File file;
|
||||
private int type;
|
||||
private final File file;
|
||||
private final int type;
|
||||
public FileEvent(File file, int type) {
|
||||
super(FileMonitor.this);
|
||||
this.file = file;
|
||||
@@ -70,7 +69,7 @@ public abstract class FileMonitor {
|
||||
}
|
||||
}
|
||||
|
||||
private Map watched = new HashMap();
|
||||
private final Map watched = new HashMap();
|
||||
private List listeners = new ArrayList();
|
||||
|
||||
protected abstract void watch(File file, int mask, boolean recursive) throws IOException ;
|
||||
@@ -143,13 +142,13 @@ public abstract class FileMonitor {
|
||||
|
||||
private static final int BUFFER_SIZE = 4096;
|
||||
private class FileInfo {
|
||||
public File file;
|
||||
public HANDLE handle;
|
||||
public int notifyMask;
|
||||
public boolean recursive;
|
||||
public FILE_NOTIFY_INFORMATION info = new FILE_NOTIFY_INFORMATION(BUFFER_SIZE);
|
||||
public IntByReference infoLength = new IntByReference();
|
||||
public OVERLAPPED overlapped = new OVERLAPPED();
|
||||
public final File file;
|
||||
public final HANDLE handle;
|
||||
public final int notifyMask;
|
||||
public final boolean recursive;
|
||||
public final FILE_NOTIFY_INFORMATION info = new FILE_NOTIFY_INFORMATION(BUFFER_SIZE);
|
||||
public final IntByReference infoLength = new IntByReference();
|
||||
public final OVERLAPPED overlapped = new OVERLAPPED();
|
||||
public FileInfo(File f, HANDLE h, int mask, boolean recurse) {
|
||||
this.file = f;
|
||||
this.handle = h;
|
||||
@@ -159,8 +158,8 @@ public abstract class FileMonitor {
|
||||
}
|
||||
private Thread watcher;
|
||||
private HANDLE port;
|
||||
private Map fileMap = new HashMap();
|
||||
private Map handleMap = new HashMap();
|
||||
private final Map fileMap = new HashMap();
|
||||
private final Map handleMap = new HashMap();
|
||||
|
||||
private void handleChanges(FileInfo finfo) throws IOException {
|
||||
Kernel32 klib = Kernel32.INSTANCE;
|
||||
@@ -212,7 +211,10 @@ public abstract class FileMonitor {
|
||||
HANDLEByReference rkey = new HANDLEByReference();
|
||||
PointerByReference roverlap = new PointerByReference();
|
||||
klib.GetQueuedCompletionStatus(port, rcount, rkey, roverlap, Kernel32.INFINITE);
|
||||
return (FileInfo)handleMap.get(rkey.getValue());
|
||||
|
||||
synchronized (this) {
|
||||
return (FileInfo)handleMap.get(rkey.getValue());
|
||||
}
|
||||
}
|
||||
private int convertMask(int mask) {
|
||||
int result = 0;
|
||||
@@ -220,7 +222,7 @@ public abstract class FileMonitor {
|
||||
result |= Kernel32.FILE_NOTIFY_CHANGE_CREATION;
|
||||
}
|
||||
if ((mask & FILE_DELETED) != 0) {
|
||||
result |= Kernel32.FILE_NOTIFY_CHANGE_CREATION;
|
||||
result |= Kernel32.FILE_NOTIFY_CHANGE_NAME;
|
||||
}
|
||||
if ((mask & FILE_MODIFIED) != 0) {
|
||||
result |= Kernel32.FILE_NOTIFY_CHANGE_LAST_WRITE;
|
||||
@@ -242,6 +244,9 @@ public abstract class FileMonitor {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int watcherThreadID;
|
||||
|
||||
protected synchronized void watch(File file, int eventMask, boolean recursive) throws IOException {
|
||||
File dir = file;
|
||||
if (!dir.isDirectory()) {
|
||||
@@ -291,10 +296,21 @@ public abstract class FileMonitor {
|
||||
+ "' (" + err + ")");
|
||||
}
|
||||
if (watcher == null) {
|
||||
watcher = new Thread("W32 File Monitor") {
|
||||
watcher = new Thread("W32 File Monitor-" + (watcherThreadID++)) {
|
||||
public void run() {
|
||||
FileInfo finfo;
|
||||
while ((finfo = waitForChange()) != null) {
|
||||
while (true) {
|
||||
finfo = waitForChange();
|
||||
if (finfo == null) {
|
||||
synchronized(W32FileMonitor.this) {
|
||||
if (fileMap.isEmpty()) {
|
||||
watcher = null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
handleChanges(finfo);
|
||||
}
|
||||
@@ -309,6 +325,7 @@ public abstract class FileMonitor {
|
||||
watcher.start();
|
||||
}
|
||||
}
|
||||
|
||||
protected synchronized void unwatch(File file) {
|
||||
FileInfo finfo = (FileInfo)fileMap.remove(file);
|
||||
if (finfo != null) {
|
||||
@@ -318,6 +335,12 @@ public abstract class FileMonitor {
|
||||
}
|
||||
}
|
||||
protected synchronized void dispose() {
|
||||
// unwatch any remaining files in map, allows watcher thread to exit
|
||||
int i = 0;
|
||||
for (Object[] keys = fileMap.keySet().toArray(); !fileMap.isEmpty();) {
|
||||
unwatch((File)keys[i++]);
|
||||
}
|
||||
|
||||
Kernel32 klib = Kernel32.INSTANCE;
|
||||
klib.PostQueuedCompletionStatus(port, 0, null, null);
|
||||
klib.CloseHandle(port);
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
/* Copyright (c) 2007 Olivier Chafik, All Rights Reserved
|
||||
*
|
||||
* Copyright (c) 2008 Timothy Wall, All Rights Reserved
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
* Lesser General Public License for more details.
|
||||
*/
|
||||
package com.sun.jna.examples;
|
||||
|
||||
@@ -20,10 +21,16 @@ import java.awt.image.MultiPixelPackedSampleModel;
|
||||
import java.awt.image.Raster;
|
||||
import java.awt.image.SampleModel;
|
||||
import java.awt.image.SinglePixelPackedSampleModel;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
/**
|
||||
* Methods that are useful to decompose a raster in ranges of contiguous unoccupied pixels.
|
||||
* An occupied pixel has two possible meanings, depending on the raster :
|
||||
* Methods that are useful to decompose a raster into a set of rectangles.
|
||||
* An occupied pixel has two possible meanings, depending on the raster :
|
||||
* <ul>
|
||||
* <li>if the raster has an alpha layer, occupied means with alpha not null</li>
|
||||
* <li>if the raster doesn't have any alpha layer, occupied means not completely black</li>
|
||||
@@ -31,12 +38,18 @@ import java.awt.image.SinglePixelPackedSampleModel;
|
||||
* @author Olivier Chafik
|
||||
*/
|
||||
public class RasterRangesUtils {
|
||||
/// Masks used to isolate the current column in a set of 8 binary columns packed in a byte
|
||||
/// Masks used to isolate the current column in a set of 8 binary columns packed in a byte
|
||||
private static final int[] subColMasks = new int[] {
|
||||
0x0080, 0x0040, 0x0020, 0x0010,
|
||||
0x0008, 0x0004, 0x0002, 0x0001
|
||||
};
|
||||
|
||||
|
||||
private static final Comparator COMPARATOR = new Comparator() {
|
||||
public int compare(Object o1, Object o2) {
|
||||
return ((Rectangle)o1).x - ((Rectangle)o2).x;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Abstraction of a sink for ranges.
|
||||
*/
|
||||
@@ -45,13 +58,13 @@ public class RasterRangesUtils {
|
||||
* Output a rectangular range.
|
||||
* @param x x coordinate of the top-left corner of the range
|
||||
* @param y y coordinate of the top-left corner of the range
|
||||
* @param w witdh of the range
|
||||
* @param w width of the range
|
||||
* @param h height of the range
|
||||
* @return true if the output succeeded, false otherwise
|
||||
*/
|
||||
public boolean outputRange(int x, int y, int w, int h);
|
||||
boolean outputRange(int x, int y, int w, int h);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Outputs ranges of occupied pixels.
|
||||
* In a raster that has an alpha layer, a pixel is occupied if its alpha value is not null.
|
||||
@@ -64,15 +77,15 @@ public class RasterRangesUtils {
|
||||
Rectangle bounds = raster.getBounds();
|
||||
SampleModel sampleModel = raster.getSampleModel();
|
||||
boolean hasAlpha = sampleModel.getNumBands() == 4;
|
||||
|
||||
|
||||
// Try to use the underlying data array directly for a few common raster formats
|
||||
if (raster.getParent() == null && bounds.x == 0 && bounds.y == 0) {
|
||||
// No support for subraster (as obtained with Image.getSubimage(...))
|
||||
|
||||
|
||||
DataBuffer data = raster.getDataBuffer();
|
||||
if (data.getNumBanks() == 1) {
|
||||
// There is always a single bank for all BufferedImage types, except maybe TYPE_CUSTOM
|
||||
|
||||
|
||||
if (sampleModel instanceof MultiPixelPackedSampleModel) {
|
||||
MultiPixelPackedSampleModel packedSampleModel = (MultiPixelPackedSampleModel)sampleModel;
|
||||
if (packedSampleModel.getPixelBitStride() == 1) {
|
||||
@@ -93,18 +106,21 @@ public class RasterRangesUtils {
|
||||
int[] pixels = raster.getPixels(0, 0, bounds.width, bounds.height, (int[])null);
|
||||
return outputOccupiedRanges(pixels, bounds.width, bounds.height, hasAlpha ? 0xff000000 : 0xffffff, out);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Output the non-null values of a binary image as ranges of contiguous values.
|
||||
* @param binaryBits byte-packed binary bits of an image
|
||||
* @param w width of the image (in pixels)
|
||||
* @param h height of the image
|
||||
* @param output
|
||||
* @param out
|
||||
* @return true if the output succeeded, false otherwise
|
||||
*/
|
||||
public static boolean outputOccupiedRangesOfBinaryPixels(byte[] binaryBits, int w, int h, RangesOutput output) {
|
||||
public static boolean outputOccupiedRangesOfBinaryPixels(byte[] binaryBits, int w, int h, RangesOutput out) {
|
||||
Set rects = new HashSet();
|
||||
Set prevLine = Collections.EMPTY_SET;
|
||||
int scanlineBytes = binaryBits.length / h;
|
||||
for (int row = 0; row < h; row++) {
|
||||
Set curLine = new TreeSet(COMPARATOR);
|
||||
int rowOffsetBytes = row * scanlineBytes;
|
||||
int startCol = -1;
|
||||
// Look at each batch of 8 columns in this row
|
||||
@@ -115,9 +131,7 @@ public class RasterRangesUtils {
|
||||
// all 8 bits are zeroes
|
||||
if (startCol >= 0) {
|
||||
// end of current region
|
||||
if (!output.outputRange(startCol, row, firstByteCol - startCol, 1)) {
|
||||
return false;
|
||||
}
|
||||
curLine.add(new Rectangle(startCol, row, firstByteCol - startCol, 1));
|
||||
startCol = -1;
|
||||
}
|
||||
} else if (byteColBits == 0xff) {
|
||||
@@ -138,9 +152,7 @@ public class RasterRangesUtils {
|
||||
} else {
|
||||
if (startCol >= 0) {
|
||||
// end of current region
|
||||
if (!output.outputRange(startCol, row, col - startCol, 1)) {
|
||||
return false;
|
||||
}
|
||||
curLine.add(new Rectangle(startCol, row, col - startCol, 1));
|
||||
startCol = -1;
|
||||
}
|
||||
}
|
||||
@@ -149,15 +161,23 @@ public class RasterRangesUtils {
|
||||
}
|
||||
if (startCol >= 0) {
|
||||
// end of last region
|
||||
if (!output.outputRange(startCol, row, w - startCol, 1)) {
|
||||
return false;
|
||||
}
|
||||
startCol = -1;
|
||||
curLine.add(new Rectangle(startCol, row, w - startCol, 1));
|
||||
}
|
||||
Set unmerged = mergeRects(prevLine, curLine);
|
||||
rects.addAll(unmerged);
|
||||
prevLine = curLine;
|
||||
}
|
||||
// Add anything left over
|
||||
rects.addAll(prevLine);
|
||||
for (Iterator i=rects.iterator();i.hasNext();) {
|
||||
Rectangle r = (Rectangle)i.next();
|
||||
if (!out.outputRange(r.x, r.y, r.width, r.height)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Output the occupied values of an integer-pixels image as ranges of contiguous values.
|
||||
* A pixel is considered occupied if the bitwise AND of its integer value with the provided occupationMask is not null.
|
||||
@@ -169,11 +189,13 @@ public class RasterRangesUtils {
|
||||
* @return true if the output succeeded, false otherwise
|
||||
*/
|
||||
public static boolean outputOccupiedRanges(int[] pixels, int w, int h, int occupationMask, RangesOutput out) {
|
||||
|
||||
Set rects = new HashSet();
|
||||
Set prevLine = Collections.EMPTY_SET;
|
||||
for (int row = 0; row < h; row++) {
|
||||
Set curLine = new TreeSet(COMPARATOR);
|
||||
int idxOffset = row * w;
|
||||
int startCol = -1;
|
||||
|
||||
|
||||
for (int col = 0; col < w; col++) {
|
||||
if ((pixels[idxOffset + col] & occupationMask) != 0) {
|
||||
if (startCol < 0) {
|
||||
@@ -182,21 +204,55 @@ public class RasterRangesUtils {
|
||||
} else {
|
||||
if (startCol >= 0) {
|
||||
// end of current region
|
||||
if (!out.outputRange(startCol, row, col - startCol, 1)) {
|
||||
return false;
|
||||
}
|
||||
curLine.add(new Rectangle(startCol, row, col-startCol, 1));
|
||||
startCol = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (startCol >= 0) {
|
||||
// end of last region of current row
|
||||
if (!out.outputRange(startCol, row, w - startCol, 1)) {
|
||||
return false;
|
||||
}
|
||||
startCol = -1;
|
||||
curLine.add(new Rectangle(startCol, row, w-startCol, 1));
|
||||
}
|
||||
Set unmerged = mergeRects(prevLine, curLine);
|
||||
rects.addAll(unmerged);
|
||||
prevLine = curLine;
|
||||
}
|
||||
// Add anything left over
|
||||
rects.addAll(prevLine);
|
||||
for (Iterator i=rects.iterator();i.hasNext();) {
|
||||
Rectangle r = (Rectangle)i.next();
|
||||
if (!out.outputRange(r.x, r.y, r.width, r.height)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static Set mergeRects(Set prev, Set current) {
|
||||
Set unmerged = new HashSet(prev);
|
||||
if (!prev.isEmpty() && !current.isEmpty()) {
|
||||
Rectangle[] pr = (Rectangle[])prev.toArray(new Rectangle[prev.size()]);
|
||||
Rectangle[] cr = (Rectangle[])current.toArray(new Rectangle[current.size()]);
|
||||
int ipr = 0;
|
||||
int icr = 0;
|
||||
while (ipr < pr.length && icr < cr.length) {
|
||||
while (cr[icr].x < pr[ipr].x) {
|
||||
if (++icr == cr.length) {
|
||||
return unmerged;
|
||||
}
|
||||
}
|
||||
if (cr[icr].x == pr[ipr].x && cr[icr].width == pr[ipr].width) {
|
||||
unmerged.remove(pr[ipr]);
|
||||
cr[icr].y = pr[ipr].y;
|
||||
cr[icr].height = pr[ipr].height + 1;
|
||||
++icr;
|
||||
}
|
||||
else {
|
||||
++ipr;
|
||||
}
|
||||
}
|
||||
}
|
||||
return unmerged;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ import java.awt.geom.Ellipse2D;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.Calendar;
|
||||
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JFrame;
|
||||
@@ -198,8 +199,6 @@ public class ShapedWindowDemo {
|
||||
private Point offset;
|
||||
private void showPopup(MouseEvent e) {
|
||||
final JPopupMenu m = new JPopupMenu();
|
||||
// use a heavyweight popup to avoid having it clipped
|
||||
// by the window mask
|
||||
m.add(new AbstractAction("Hide") {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
frame.setState(JFrame.ICONIFIED);
|
||||
|
||||
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
@@ -8,7 +8,7 @@
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
* Lesser General Public License for more details.
|
||||
*/
|
||||
package com.sun.jna.examples.unix;
|
||||
|
||||
@@ -27,136 +27,211 @@ import com.sun.jna.ptr.PointerByReference;
|
||||
|
||||
/** Definition (incomplete) of the X library. */
|
||||
public interface X11 extends Library {
|
||||
|
||||
public static class XID implements NativeMapped {
|
||||
|
||||
class VisualID extends NativeLong {
|
||||
public VisualID() { }
|
||||
public VisualID(long value) { super(value); }
|
||||
}
|
||||
|
||||
class XID extends NativeLong {
|
||||
public static final XID None = null;
|
||||
private Integer id = new Integer(0);
|
||||
public XID() { this(X11.None); }
|
||||
public XID(Integer id) { this.id = id; }
|
||||
public XID(int id) { this(new Integer(id)); }
|
||||
public XID() { this(0); }
|
||||
public XID(long id) { super(id); }
|
||||
protected boolean isNone(Object o) {
|
||||
return ((Integer)o).intValue() == X11.None;
|
||||
return o == null
|
||||
|| (o instanceof Number
|
||||
&& ((Number)o).longValue() == X11.None);
|
||||
}
|
||||
public Object fromNative(Object nativeValue, FromNativeContext context) {
|
||||
if (isNone(nativeValue))
|
||||
return None;
|
||||
return new XID((Integer)nativeValue);
|
||||
return new XID(((Number)nativeValue).longValue());
|
||||
}
|
||||
public Class nativeType() {
|
||||
return Integer.class;
|
||||
}
|
||||
public Object toNative() {
|
||||
return id;
|
||||
public String toString() {
|
||||
return "0x" + Long.toHexString(longValue());
|
||||
}
|
||||
}
|
||||
public static class Atom extends XID {
|
||||
class Atom extends XID {
|
||||
public static final Atom None = null;
|
||||
public Atom() { }
|
||||
public Atom(Integer id) { super(id); }
|
||||
public Atom(int id) { super(id); }
|
||||
public Atom(long id) { super(id); }
|
||||
/** Return constants for predefined <code>Atom</code> values. */
|
||||
public Object fromNative(Object nativeValue, FromNativeContext context) {
|
||||
int value = ((Integer)nativeValue).intValue();
|
||||
switch(value) {
|
||||
case 0:
|
||||
return None;
|
||||
case 1:
|
||||
return XA_PRIMARY;
|
||||
case 2:
|
||||
return XA_SECONDARY;
|
||||
case 3:
|
||||
return XA_ARC;
|
||||
case 4:
|
||||
return XA_ATOM;
|
||||
case 5:
|
||||
return XA_BITMAP;
|
||||
case 6:
|
||||
return XA_CARDINAL;
|
||||
default:
|
||||
return new Atom((Integer)nativeValue);
|
||||
long value = ((Number)nativeValue).longValue();
|
||||
if (value <= Integer.MAX_VALUE) {
|
||||
switch((int)value) {
|
||||
case 0: return None;
|
||||
case 1: return XA_PRIMARY;
|
||||
case 2: return XA_SECONDARY;
|
||||
case 3: return XA_ARC;
|
||||
case 4: return XA_ATOM;
|
||||
case 5: return XA_BITMAP;
|
||||
case 6: return XA_CARDINAL;
|
||||
case 7: return XA_COLORMAP;
|
||||
case 8: return XA_CURSOR;
|
||||
case 9: return XA_CUT_BUFFER0;
|
||||
case 10: return XA_CUT_BUFFER1;
|
||||
case 11: return XA_CUT_BUFFER2;
|
||||
case 12: return XA_CUT_BUFFER3;
|
||||
case 13: return XA_CUT_BUFFER4;
|
||||
case 14: return XA_CUT_BUFFER5;
|
||||
case 15: return XA_CUT_BUFFER6;
|
||||
case 16: return XA_CUT_BUFFER7;
|
||||
case 17: return XA_DRAWABLE;
|
||||
case 18: return XA_FONT;
|
||||
case 19: return XA_INTEGER;
|
||||
case 20: return XA_PIXMAP;
|
||||
case 21: return XA_POINT;
|
||||
case 22: return XA_RECTANGLE;
|
||||
case 23: return XA_RESOURCE_MANAGER;
|
||||
case 24: return XA_RGB_COLOR_MAP;
|
||||
case 25: return XA_RGB_BEST_MAP;
|
||||
case 26: return XA_RGB_BLUE_MAP;
|
||||
case 27: return XA_RGB_DEFAULT_MAP;
|
||||
case 28: return XA_RGB_GRAY_MAP;
|
||||
case 29: return XA_RGB_GREEN_MAP;
|
||||
case 30: return XA_RGB_RED_MAP;
|
||||
case 31: return XA_STRING;
|
||||
case 32: return XA_VISUALID;
|
||||
case 33: return XA_WINDOW;
|
||||
case 34: return XA_WM_COMMAND;
|
||||
case 35: return XA_WM_HINTS;
|
||||
case 36: return XA_WM_CLIENT_MACHINE;
|
||||
case 37: return XA_WM_ICON_NAME;
|
||||
case 38: return XA_WM_ICON_SIZE;
|
||||
case 39: return XA_WM_NAME;
|
||||
case 40: return XA_WM_NORMAL_HINTS;
|
||||
case 41: return XA_WM_SIZE_HINTS;
|
||||
case 42: return XA_WM_ZOOM_HINTS;
|
||||
case 43: return XA_MIN_SPACE;
|
||||
case 44: return XA_NORM_SPACE;
|
||||
case 45: return XA_MAX_SPACE;
|
||||
case 46: return XA_END_SPACE;
|
||||
case 47: return XA_SUPERSCRIPT_X;
|
||||
case 48: return XA_SUPERSCRIPT_Y;
|
||||
case 49: return XA_SUBSCRIPT_X;
|
||||
case 50: return XA_SUBSCRIPT_Y;
|
||||
case 51: return XA_UNDERLINE_POSITION;
|
||||
case 52: return XA_UNDERLINE_THICKNESS;
|
||||
case 53: return XA_STRIKEOUT_ASCENT;
|
||||
case 54: return XA_STRIKEOUT_DESCENT;
|
||||
case 55: return XA_ITALIC_ANGLE;
|
||||
case 56: return XA_X_HEIGHT;
|
||||
case 57: return XA_QUAD_WIDTH;
|
||||
case 58: return XA_WEIGHT;
|
||||
case 59: return XA_POINT_SIZE;
|
||||
case 60: return XA_RESOLUTION;
|
||||
case 61: return XA_COPYRIGHT;
|
||||
case 62: return XA_NOTICE;
|
||||
case 63: return XA_FONT_NAME;
|
||||
case 64: return XA_FAMILY_NAME;
|
||||
case 65: return XA_FULL_NAME;
|
||||
case 66: return XA_CAP_HEIGHT;
|
||||
case 67: return XA_WM_CLASS;
|
||||
case 68: return XA_WM_TRANSIENT_FOR;
|
||||
default:
|
||||
}
|
||||
}
|
||||
return new Atom(value);
|
||||
}
|
||||
}
|
||||
public static class AtomByReference extends ByReference {
|
||||
public AtomByReference() { super(4); }
|
||||
class AtomByReference extends ByReference {
|
||||
public AtomByReference() { super(XID.SIZE); }
|
||||
public Atom getValue() {
|
||||
int value = getPointer().getInt(0);
|
||||
return (Atom)new Atom().fromNative(new Integer(value), null);
|
||||
NativeLong value = getPointer().getNativeLong(0);
|
||||
return (Atom)new Atom().fromNative(value, null);
|
||||
}
|
||||
}
|
||||
public static class Colormap extends XID {
|
||||
class Colormap extends XID {
|
||||
public static final Colormap None = null;
|
||||
public Colormap() { }
|
||||
public Colormap(Integer id) { super(id); }
|
||||
public Colormap(int id) { super(id); }
|
||||
public Colormap(long id) { super(id); }
|
||||
public Object fromNative(Object nativeValue, FromNativeContext context) {
|
||||
if (isNone(nativeValue))
|
||||
return None;
|
||||
return new Colormap((Integer)nativeValue);
|
||||
return new Colormap(((Number)nativeValue).longValue());
|
||||
}
|
||||
}
|
||||
public static class Cursor extends XID {
|
||||
class Font extends XID {
|
||||
public static final Font None = null;
|
||||
public Font() { }
|
||||
public Font(long id) { super(id); }
|
||||
public Object fromNative(Object nativeValue, FromNativeContext context) {
|
||||
if (isNone(nativeValue))
|
||||
return None;
|
||||
return new Font(((Number)nativeValue).longValue());
|
||||
}
|
||||
}
|
||||
class Cursor extends XID {
|
||||
public static final Cursor None = null;
|
||||
public Cursor() { }
|
||||
public Cursor(Integer id) { super(id); }
|
||||
public Cursor(int id) { super(id); }
|
||||
public Cursor(long id) { super(id); }
|
||||
public Object fromNative(Object nativeValue, FromNativeContext context) {
|
||||
if (isNone(nativeValue))
|
||||
return None;
|
||||
return new Cursor((Integer)nativeValue);
|
||||
return new Cursor(((Number)nativeValue).longValue());
|
||||
}
|
||||
}
|
||||
public static class Drawable extends XID {
|
||||
class Drawable extends XID {
|
||||
public static final Drawable None = null;
|
||||
public Drawable() { }
|
||||
public Drawable(Integer id) { super(id); }
|
||||
public Drawable(int id) { super(id); }
|
||||
public Drawable(long id) { super(id); }
|
||||
public Object fromNative(Object nativeValue, FromNativeContext context) {
|
||||
if (isNone(nativeValue))
|
||||
return None;
|
||||
return new Drawable((Integer)nativeValue);
|
||||
return new Drawable(((Number)nativeValue).longValue());
|
||||
}
|
||||
}
|
||||
public static class Window extends Drawable {
|
||||
class Window extends Drawable {
|
||||
public static final Window None = null;
|
||||
public Window() { }
|
||||
public Window(Integer id) { super(id); }
|
||||
public Window(int id) { super(id); }
|
||||
public Window(long id) { super(id); }
|
||||
public Object fromNative(Object nativeValue, FromNativeContext context) {
|
||||
if (isNone(nativeValue))
|
||||
return None;
|
||||
return new Window((Integer)nativeValue);
|
||||
return new Window(((Number)nativeValue).longValue());
|
||||
}
|
||||
}
|
||||
public static class WindowByReference extends ByReference {
|
||||
public WindowByReference() { super(4); }
|
||||
class WindowByReference extends ByReference {
|
||||
public WindowByReference() { super(XID.SIZE); }
|
||||
public Window getValue() {
|
||||
int value = getPointer().getInt(0);
|
||||
return value == X11.None ? Window.None : new Window(value);
|
||||
NativeLong value = getPointer().getNativeLong(0);
|
||||
return value.longValue() == X11.None
|
||||
? Window.None : new Window(value.longValue());
|
||||
}
|
||||
}
|
||||
public static class Pixmap extends Drawable {
|
||||
class Pixmap extends Drawable {
|
||||
public static final Pixmap None = null;
|
||||
public Pixmap() { }
|
||||
public Pixmap(Integer id) { super(id); }
|
||||
public Pixmap(int id) { super(id); }
|
||||
public Pixmap(long id) { super(id); }
|
||||
public Object fromNative(Object nativeValue, FromNativeContext context) {
|
||||
if (isNone(nativeValue))
|
||||
return None;
|
||||
return new Pixmap((Integer)nativeValue);
|
||||
return new Pixmap(((Number)nativeValue).longValue());
|
||||
}
|
||||
}
|
||||
// TODO: define structure
|
||||
public static class Display extends PointerType { }
|
||||
class Display extends PointerType { }
|
||||
// TODO: define structure
|
||||
public static class Visual extends PointerType { }
|
||||
class Visual extends PointerType {
|
||||
public NativeLong getVisualID() {
|
||||
if (getPointer() != null)
|
||||
return getPointer().getNativeLong(Native.POINTER_SIZE);
|
||||
return new NativeLong(0);
|
||||
}
|
||||
public String toString() {
|
||||
return "Visual: VisualID=0x" + Long.toHexString(getVisualID().longValue());
|
||||
}
|
||||
}
|
||||
// TODO: define structure
|
||||
public static class Screen extends PointerType { }
|
||||
class Screen extends PointerType { }
|
||||
// TODO: define structure
|
||||
public static class GC extends PointerType { }
|
||||
|
||||
class GC extends PointerType { }
|
||||
// TODO: define structure
|
||||
class XImage extends PointerType { }
|
||||
|
||||
/** Definition (incomplete) of the Xext library. */
|
||||
public interface Xext extends Library {
|
||||
interface Xext extends Library {
|
||||
Xext INSTANCE = (Xext)Native.loadLibrary("Xext", Xext.class);
|
||||
// Shape Kinds
|
||||
int ShapeBounding = 0;
|
||||
@@ -172,27 +247,32 @@ public interface X11 extends Library {
|
||||
void XShapeCombineMask(Display display, Window window, int dest_kind,
|
||||
int x_off, int y_off, Pixmap src, int op);
|
||||
}
|
||||
|
||||
|
||||
/** Definition (incomplete) of the Xrender library. */
|
||||
public interface Xrender extends Library {
|
||||
interface Xrender extends Library {
|
||||
Xrender INSTANCE = (Xrender)Native.loadLibrary("Xrender", Xrender.class);
|
||||
public static class XRenderDirectFormat extends Structure {
|
||||
class XRenderDirectFormat extends Structure {
|
||||
public short red, redMask;
|
||||
public short green, greenMask;
|
||||
public short blue, blueMask;
|
||||
public short alpha, alphaMask;
|
||||
}
|
||||
public static class XRenderPictFormat extends Structure {
|
||||
public int id;
|
||||
class PictFormat extends NativeLong {
|
||||
public PictFormat(long value) { super(value); }
|
||||
public PictFormat() { }
|
||||
}
|
||||
class XRenderPictFormat extends Structure {
|
||||
public PictFormat id;
|
||||
public int type;
|
||||
public int depth;
|
||||
public XRenderDirectFormat direct;
|
||||
public int colormap;
|
||||
public Colormap colormap;
|
||||
}
|
||||
int PictTypeIndexed = 0x0;
|
||||
int PictTypeDirect = 0x1;
|
||||
XRenderPictFormat XRenderFindVisualFormat(Display display, Visual visual);
|
||||
}
|
||||
|
||||
|
||||
X11 INSTANCE = (X11)Native.loadLibrary("X11", X11.class);
|
||||
|
||||
int Success = 0;
|
||||
@@ -213,66 +293,132 @@ public interface X11 extends Library {
|
||||
int BadName = 15;
|
||||
int BadLength = 16;
|
||||
int BadImplementation = 17;
|
||||
|
||||
public static class XWMHints extends Structure {
|
||||
|
||||
/*
|
||||
typedef struct {
|
||||
long flags; // marks which fields in this structure are defined
|
||||
Bool input; // does this application rely on the window manager to
|
||||
// get keyboard input?
|
||||
int initial_state; // see below
|
||||
Pixmap icon_pixmap; // pixmap to be used as icon
|
||||
Window icon_window; // window to be used as icon
|
||||
int icon_x, icon_y; // initial position of icon
|
||||
Pixmap icon_mask; // icon mask bitmap
|
||||
XID window_group; // id of related window group
|
||||
// this structure may be extended in the future
|
||||
} XWMHints;
|
||||
*/
|
||||
class XWMHints extends Structure {
|
||||
public NativeLong flags;
|
||||
public int input;
|
||||
public boolean input;
|
||||
public int initial_state;
|
||||
public int icon_pixmap;
|
||||
public int icon_window;
|
||||
public Pixmap icon_pixmap;
|
||||
public Window icon_window;
|
||||
public int icon_x, icon_y;
|
||||
public int icon_mask;
|
||||
public int window_group;
|
||||
public Pixmap icon_mask;
|
||||
public XID window_group;
|
||||
}
|
||||
|
||||
public static class XTextProperty extends Structure {
|
||||
/*
|
||||
typedef struct {
|
||||
unsigned char *value; // same as Property routines
|
||||
Atom encoding; // prop type
|
||||
int format; // prop data format: 8, 16, or 32
|
||||
unsigned long nitems; // number of data items in value
|
||||
} XTextProperty;
|
||||
*/
|
||||
class XTextProperty extends Structure {
|
||||
public String value;
|
||||
public int encoding;
|
||||
public Atom encoding;
|
||||
public int format;
|
||||
public NativeLong nitems;
|
||||
}
|
||||
|
||||
public static class XSizeHints extends Structure {
|
||||
/*
|
||||
typedef struct {
|
||||
long flags; // marks which fields in this structure are defined
|
||||
int x, y; // obsolete for new window mgrs, but clients
|
||||
int width, height; /// should set so old wm's don't mess up
|
||||
int min_width, min_height;
|
||||
int max_width, max_height;
|
||||
int width_inc, height_inc;
|
||||
struct {
|
||||
int x; // numerator
|
||||
int y; // denominator
|
||||
} min_aspect, max_aspect;
|
||||
int base_width, base_height; // added by ICCCM version 1
|
||||
int win_gravity; // added by ICCCM version 1
|
||||
} XSizeHints;
|
||||
*/
|
||||
class XSizeHints extends Structure {
|
||||
public NativeLong flags;
|
||||
public int x, y;
|
||||
public int width, height;
|
||||
public int min_width, min_height;
|
||||
public int max_width, max_height;
|
||||
public int width_inc, height_inc;
|
||||
// TODO: nested struct
|
||||
public int min_aspect_x;
|
||||
public int min_aspect_y;
|
||||
public int max_aspect_x;
|
||||
public int max_aspect_y;
|
||||
public int base_width_y;
|
||||
public static class Aspect extends Structure {
|
||||
public int x; // numerator
|
||||
public int y; // denominator
|
||||
}
|
||||
public Aspect min_aspect, max_aspect;
|
||||
public int base_width, base_height;
|
||||
public int win_gravity;
|
||||
}
|
||||
|
||||
public static class XWindowAttributes extends Structure {
|
||||
|
||||
/*
|
||||
typedef struct {
|
||||
int x, y; // location of window
|
||||
int width, height; // width and height of window
|
||||
int border_width; // border width of window
|
||||
int depth; // depth of window
|
||||
Visual *visual; // the associated visual structure
|
||||
Window root; // root of screen containing window
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
int c_class; // C++ InputOutput, InputOnly
|
||||
#else
|
||||
int class; // InputOutput, InputOnly
|
||||
#endif
|
||||
int bit_gravity; // one of bit gravity values
|
||||
int win_gravity; // one of the window gravity values
|
||||
int backing_store; // NotUseful, WhenMapped, Always
|
||||
unsigned long backing_planes;// planes to be preserved if possible
|
||||
unsigned long backing_pixel;// value to be used when restoring planes
|
||||
Bool save_under; // boolean, should bits under be saved?
|
||||
Colormap colormap; // color map to be associated with window
|
||||
Bool map_installed; // boolean, is color map currently installed
|
||||
int map_state; // IsUnmapped, IsUnviewable, IsViewable
|
||||
long all_event_masks; // set of events all people have interest in
|
||||
long your_event_mask; // my event mask
|
||||
long do_not_propagate_mask; // set of events that should not propagate
|
||||
Bool override_redirect; // boolean value for override-redirect
|
||||
Screen *screen; // back pointer to correct screen
|
||||
} XWindowAttributes;
|
||||
*/
|
||||
class XWindowAttributes extends Structure {
|
||||
public int x, y;
|
||||
public int width, height;
|
||||
public int border_width;
|
||||
public int depth;
|
||||
public Visual visual;
|
||||
public int root;
|
||||
public Window root;
|
||||
public int c_class;
|
||||
public int bit_gravity;
|
||||
public int win_gravity;
|
||||
public int backing_store;
|
||||
public NativeLong backing_planes;
|
||||
public NativeLong backing_pixel;
|
||||
public int save_under;
|
||||
public int colormap;
|
||||
public int map_installed;
|
||||
public boolean save_under;
|
||||
public Colormap colormap;
|
||||
public boolean map_installed;
|
||||
public int map_state;
|
||||
public NativeLong all_event_masks;
|
||||
public NativeLong your_event_mask;
|
||||
public NativeLong do_not_propagate_mask;
|
||||
public int override_redirect;
|
||||
public Pointer screen;
|
||||
public boolean override_redirect;
|
||||
public Screen screen;
|
||||
}
|
||||
|
||||
|
||||
int CWBackPixmap = (1<<0);
|
||||
int CWBackPixel = (1<<1);
|
||||
int CWBorderPixmap = (1<<2);
|
||||
@@ -288,7 +434,26 @@ public interface X11 extends Library {
|
||||
int CWDontPropagate = (1<<12);
|
||||
int CWColormap = (1<<13);
|
||||
int CWCursor = (1<<14);
|
||||
public static class XSetWindowAttributes extends Structure {
|
||||
/*
|
||||
typedef struct {
|
||||
Pixmap background_pixmap; // background or None or ParentRelative
|
||||
unsigned long background_pixel; // background pixel
|
||||
Pixmap border_pixmap; // border of the window
|
||||
unsigned long border_pixel; // border pixel value
|
||||
int bit_gravity; // one of bit gravity values
|
||||
int win_gravity; // one of the window gravity values
|
||||
int backing_store; // NotUseful, WhenMapped, Always
|
||||
unsigned long backing_planes;// planes to be preseved if possible
|
||||
unsigned long backing_pixel;// value to use in restoring planes
|
||||
Bool save_under; // should bits under be saved? (popups)
|
||||
long event_mask; // set of events that should be saved
|
||||
long do_not_propagate_mask; // set of events that should not propagate
|
||||
Bool override_redirect; // boolean value for override-redirect
|
||||
Colormap colormap; // color map to be associated with window
|
||||
Cursor cursor; // cursor to be displayed (or None)
|
||||
} XSetWindowAttributes;
|
||||
*/
|
||||
class XSetWindowAttributes extends Structure {
|
||||
public Pixmap background_pixmap;
|
||||
public NativeLong background_pixel;
|
||||
public Pixmap border_pixmap;
|
||||
@@ -298,15 +463,14 @@ public interface X11 extends Library {
|
||||
public int backing_store;
|
||||
public NativeLong backing_planes;
|
||||
public NativeLong backing_pixel;
|
||||
public boolean save_under;
|
||||
public boolean save_under;
|
||||
public NativeLong event_mask;
|
||||
public NativeLong do_not_propagate_mask;
|
||||
public boolean override_redirect;
|
||||
public boolean override_redirect;
|
||||
public Colormap colormap;
|
||||
public Cursor cursor;
|
||||
|
||||
}
|
||||
|
||||
|
||||
int XK_0 = 0x30;
|
||||
int XK_9 = 0x39;
|
||||
int XK_A = 0x41;
|
||||
@@ -335,16 +499,16 @@ public interface X11 extends Library {
|
||||
int VisualColormapSizeMask = 0x80;
|
||||
int VisualBitsPerRGBMask = 0x100;
|
||||
int VisualAllMask = 0x1FF;
|
||||
|
||||
|
||||
int StaticGray = 0x0;
|
||||
int GrayScale = 0x1;
|
||||
int StaticColor = 0x2;
|
||||
int PseudoColor = 0x3;
|
||||
int TrueColor = 0x4;
|
||||
int DirectColor = 0x5;
|
||||
public static class XVisualInfo extends Structure {
|
||||
class XVisualInfo extends Structure {
|
||||
public Visual visual;
|
||||
public int visualID;
|
||||
public VisualID visualid;
|
||||
public int screen;
|
||||
public int depth;
|
||||
public int c_class;
|
||||
@@ -354,9 +518,27 @@ public interface X11 extends Library {
|
||||
public int colormap_size;
|
||||
public int bits_per_rgb;
|
||||
}
|
||||
class XPoint extends Structure {
|
||||
public short x, y;
|
||||
public XPoint() { }
|
||||
public XPoint(short x, short y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
}
|
||||
class XRectangle extends Structure {
|
||||
public short x, y;
|
||||
public short width, height;
|
||||
public XRectangle() { }
|
||||
public XRectangle(short x, short y, short width, short height) {
|
||||
this.x = x; this.y = y;
|
||||
this.width = width; this.height = height;
|
||||
}
|
||||
}
|
||||
|
||||
int AllocNone = 0;
|
||||
int AllocAll = 1;
|
||||
|
||||
|
||||
Atom XA_PRIMARY = new Atom(1);
|
||||
Atom XA_SECONDARY = new Atom(2);
|
||||
Atom XA_ARC = new Atom(3);
|
||||
@@ -365,7 +547,68 @@ public interface X11 extends Library {
|
||||
Atom XA_CARDINAL = new Atom(6);
|
||||
Atom XA_COLORMAP = new Atom(7);
|
||||
Atom XA_CURSOR = new Atom(8);
|
||||
|
||||
Atom XA_CUT_BUFFER0 = new Atom(9);
|
||||
Atom XA_CUT_BUFFER1 = new Atom(10);
|
||||
Atom XA_CUT_BUFFER2 = new Atom(11);
|
||||
Atom XA_CUT_BUFFER3 = new Atom(12);
|
||||
Atom XA_CUT_BUFFER4 = new Atom(13);
|
||||
Atom XA_CUT_BUFFER5 = new Atom(14);
|
||||
Atom XA_CUT_BUFFER6 = new Atom(15);
|
||||
Atom XA_CUT_BUFFER7 = new Atom(16);
|
||||
Atom XA_DRAWABLE = new Atom(17);
|
||||
Atom XA_FONT = new Atom(18);
|
||||
Atom XA_INTEGER = new Atom(19);
|
||||
Atom XA_PIXMAP = new Atom(20);
|
||||
Atom XA_POINT = new Atom(21);
|
||||
Atom XA_RECTANGLE = new Atom(22);
|
||||
Atom XA_RESOURCE_MANAGER = new Atom(23);
|
||||
Atom XA_RGB_COLOR_MAP = new Atom(24);
|
||||
Atom XA_RGB_BEST_MAP = new Atom(25);
|
||||
Atom XA_RGB_BLUE_MAP = new Atom(26);
|
||||
Atom XA_RGB_DEFAULT_MAP = new Atom(27);
|
||||
Atom XA_RGB_GRAY_MAP = new Atom(28);
|
||||
Atom XA_RGB_GREEN_MAP = new Atom(29);
|
||||
Atom XA_RGB_RED_MAP = new Atom(30);
|
||||
Atom XA_STRING = new Atom(31);
|
||||
Atom XA_VISUALID = new Atom(32);
|
||||
Atom XA_WINDOW = new Atom(33);
|
||||
Atom XA_WM_COMMAND = new Atom(34);
|
||||
Atom XA_WM_HINTS = new Atom(35);
|
||||
Atom XA_WM_CLIENT_MACHINE = new Atom(36);
|
||||
Atom XA_WM_ICON_NAME = new Atom(37);
|
||||
Atom XA_WM_ICON_SIZE = new Atom(38);
|
||||
Atom XA_WM_NAME = new Atom(39);
|
||||
Atom XA_WM_NORMAL_HINTS = new Atom(40);
|
||||
Atom XA_WM_SIZE_HINTS = new Atom(41);
|
||||
Atom XA_WM_ZOOM_HINTS = new Atom(42);
|
||||
Atom XA_MIN_SPACE = new Atom(43);
|
||||
Atom XA_NORM_SPACE = new Atom(44);
|
||||
Atom XA_MAX_SPACE = new Atom(45);
|
||||
Atom XA_END_SPACE = new Atom(46);
|
||||
Atom XA_SUPERSCRIPT_X = new Atom(47);
|
||||
Atom XA_SUPERSCRIPT_Y = new Atom(48);
|
||||
Atom XA_SUBSCRIPT_X = new Atom(49);
|
||||
Atom XA_SUBSCRIPT_Y = new Atom(50);
|
||||
Atom XA_UNDERLINE_POSITION = new Atom(51);
|
||||
Atom XA_UNDERLINE_THICKNESS = new Atom(52);
|
||||
Atom XA_STRIKEOUT_ASCENT = new Atom(53);
|
||||
Atom XA_STRIKEOUT_DESCENT = new Atom(54);
|
||||
Atom XA_ITALIC_ANGLE = new Atom(55);
|
||||
Atom XA_X_HEIGHT = new Atom(56);
|
||||
Atom XA_QUAD_WIDTH = new Atom(57);
|
||||
Atom XA_WEIGHT = new Atom(58);
|
||||
Atom XA_POINT_SIZE = new Atom(59);
|
||||
Atom XA_RESOLUTION = new Atom(60);
|
||||
Atom XA_COPYRIGHT = new Atom(61);
|
||||
Atom XA_NOTICE = new Atom(62);
|
||||
Atom XA_FONT_NAME = new Atom(63);
|
||||
Atom XA_FAMILY_NAME = new Atom(64);
|
||||
Atom XA_FULL_NAME = new Atom(65);
|
||||
Atom XA_CAP_HEIGHT = new Atom(66);
|
||||
Atom XA_WM_CLASS = new Atom(67);
|
||||
Atom XA_WM_TRANSIENT_FOR = new Atom(68);
|
||||
Atom XA_LAST_PREDEFINED = XA_WM_TRANSIENT_FOR;
|
||||
|
||||
int PropModeReplace = 0;
|
||||
int PropModePrepend = 1;
|
||||
int PropModeAppend = 2;
|
||||
@@ -382,17 +625,19 @@ public interface X11 extends Library {
|
||||
int AllTemporary = 0;
|
||||
int CurrentTime = 0;
|
||||
int NoSymbol = 0;
|
||||
|
||||
|
||||
Display XOpenDisplay(String name);
|
||||
int XGetErrorText(Display display, int code, byte[] buffer, int len);
|
||||
int XDefaultScreen(Display display);
|
||||
// Screen *DefaultScreenOfDisplay(Display *display);
|
||||
Screen DefaultScreenOfDisplay(Display display);
|
||||
Visual XDefaultVisual(Display display, int screen);
|
||||
Colormap XDefaultColormap(Display display, int screen);
|
||||
int XDisplayWidth(Display display, int screen);
|
||||
int XDisplayHeight(Display display, int screen);
|
||||
Window XDefaultRootWindow(Display display);
|
||||
Window XRootWindow(Display display, int screen);
|
||||
int XAllocNamedColor(Display display, int colormap, String color_name,
|
||||
int XAllocNamedColor(Display display, int colormap, String color_name,
|
||||
Pointer screen_def_return, Pointer exact_def_return);
|
||||
XSizeHints XAllocSizeHints();
|
||||
void XSetWMProperties(Display display, Window window, String window_name,
|
||||
@@ -400,10 +645,10 @@ public interface X11 extends Library {
|
||||
XSizeHints normal_hints, Pointer wm_hints,
|
||||
Pointer class_hints);
|
||||
int XFree(Pointer data);
|
||||
Window XCreateSimpleWindow(Display display, Window parent, int x, int y,
|
||||
Window XCreateSimpleWindow(Display display, Window parent, int x, int y,
|
||||
int width, int height, int border_width,
|
||||
int border, int background);
|
||||
Pixmap XCreateBitmapFromData(Display display, Window window, Pointer data,
|
||||
Pixmap XCreateBitmapFromData(Display display, Window window, Pointer data,
|
||||
int width, int height);
|
||||
int XMapWindow(Display display, Window window);
|
||||
int XFlush(Display display);
|
||||
@@ -414,28 +659,99 @@ public interface X11 extends Library {
|
||||
int XClearArea(Display display, Window window, int x, int y, int w, int h, int exposures);
|
||||
Pixmap XCreatePixmap(Display display, Drawable drawable, int width, int height, int depth);
|
||||
int XFreePixmap(Display display, Pixmap pixmap);
|
||||
GC XCreateGC(Display display, Drawable drawable, NativeLong mask, Pointer values);
|
||||
int GCFunction = (1<<0);
|
||||
int GCPlaneMask = (1<<1);
|
||||
int GCForeground = (1<<2);
|
||||
int GCBackground = (1<<3);
|
||||
int GCLineWidth = (1<<4);
|
||||
int GCLineStyle = (1<<5);
|
||||
int GCCapStyle = (1<<6);
|
||||
int GCJoinStyle = (1<<7);
|
||||
int GCFillStyle = (1<<8);
|
||||
int GCFillRule = (1<<9);
|
||||
int GCTile = (1<<10);
|
||||
int GCStipple = (1<<11);
|
||||
int GCTileStipXOrigin = (1<<12);
|
||||
int GCTileStipYOrigin = (1<<13);
|
||||
int GCFont = (1<<14);
|
||||
int GCSubwindowMode = (1<<15);
|
||||
int GCGraphicsExposures = (1<<16);
|
||||
int GCClipXOrigin = (1<<17);
|
||||
int GCClipYOrigin = (1<<18);
|
||||
int GCClipMask = (1<<19);
|
||||
int GCDashOffset = (1<<20);
|
||||
int GCDashList = (1<<21);
|
||||
int GCArcMode = (1<<22);
|
||||
class XGCValues extends Structure {
|
||||
public int function; /* logical operation */
|
||||
public NativeLong plane_mask;/* plane mask */
|
||||
public NativeLong foreground;/* foreground pixel */
|
||||
public NativeLong background;/* background pixel */
|
||||
public int line_width; /* line width (in pixels) */
|
||||
public int line_style; /* LineSolid, LineOnOffDash, LineDoubleDash*/
|
||||
public int cap_style; /* CapNotLast, CapButt, CapRound, CapProjecting */
|
||||
public int join_style; /* JoinMiter, JoinRound, JoinBevel */
|
||||
public int fill_style; /* FillSolid, FillTiled, FillStippled FillOpaqueStippled*/
|
||||
public int fill_rule; /* EvenOddRule, WindingRule */
|
||||
public int arc_mode; /* ArcChord, ArcPieSlice */
|
||||
public Pixmap tile; /* tile pixmap for tiling operations */
|
||||
public Pixmap stipple; /* stipple 1 plane pixmap for stippling */
|
||||
public int ts_x_origin; /* offset for tile or stipple operations */
|
||||
public int ts_y_origin;
|
||||
public Font font; /* default text font for text operations */
|
||||
public int subwindow_mode; /* ClipByChildren, IncludeInferiors */
|
||||
public boolean graphics_exposures; /* boolean, should exposures be generated */
|
||||
public int clip_x_origin; /* origin for clipping */
|
||||
public int clip_y_origin;
|
||||
public Pixmap clip_mask; /* bitmap clipping; other calls for rects */
|
||||
public int dash_offset; /* patterned/dashed line information */
|
||||
public byte dashes;
|
||||
}
|
||||
GC XCreateGC(Display display, Drawable drawable, NativeLong mask, XGCValues values);
|
||||
int EvenOddRule = 0;
|
||||
int WindingRule = 1;
|
||||
int XSetFillRule(Display display, GC gc, int fill_rule);
|
||||
int XFreeGC(Display display, GC gc);
|
||||
int XFillRectangle(Display display, Drawable drawable, GC gc,
|
||||
int XDrawPoint(Display display, Drawable drawable, GC gc, int x, int y);
|
||||
int CoordModeOrigin = 0;
|
||||
int CoordModePrevious = 1;
|
||||
int XDrawPoints(Display display, Drawable drawable, GC gc,
|
||||
XPoint[] points, int npoints, int mode);
|
||||
int XFillRectangle(Display display, Drawable drawable, GC gc,
|
||||
int x, int y, int width, int height);
|
||||
int XFillRectangles(Display display, Drawable drawable, GC gc,
|
||||
XRectangle[] rectangles, int nrectangles);
|
||||
int XSetForeground(Display display, GC gc, NativeLong color);
|
||||
int XSetBackground(Display display, GC gc, NativeLong color);
|
||||
int XFillArc(Display display, Drawable drawable, GC gc, int x, int y,
|
||||
int XFillArc(Display display, Drawable drawable, GC gc, int x, int y,
|
||||
int width, int height, int angle1, int angle2);
|
||||
int XQueryTree(Display display, Window window, WindowByReference root,
|
||||
int Complex = 0;
|
||||
int Nonconvex = 1;
|
||||
int Convex = 2;
|
||||
int XFillPolygon(Display dpy, Drawable drawable, GC gc, XPoint[] points,
|
||||
int npoints, int shape, int mode);
|
||||
int XQueryTree(Display display, Window window, WindowByReference root,
|
||||
WindowByReference parent, PointerByReference children,
|
||||
IntByReference childCount);
|
||||
boolean XQueryPointer(Display display, Window window,
|
||||
boolean XQueryPointer(Display display, Window window,
|
||||
WindowByReference root_return,
|
||||
WindowByReference child_return,
|
||||
WindowByReference child_return,
|
||||
IntByReference root_x_return,
|
||||
IntByReference root_y_return,
|
||||
IntByReference root_y_return,
|
||||
IntByReference win_x_return,
|
||||
IntByReference win_y_return,
|
||||
IntByReference mask_return);
|
||||
int XGetWindowAttributes(Display display, Window window, XWindowAttributes attributes);
|
||||
int XChangeWindowAttributes(Display display, Window window, NativeLong valuemask, XSetWindowAttributes attributes);
|
||||
|
||||
// Status XGetGeometry(Display *display, Drawable d, Window *root_return, int *x_return, int *y_return, unsigned int *width_return,
|
||||
// unsigned int *height_return, unsigned int *border_width_return, unsigned int *depth_return);
|
||||
int XGetGeometry(Display display, Drawable d, WindowByReference w, IntByReference x, IntByReference y, IntByReference width,
|
||||
IntByReference heigth, IntByReference border_width, IntByReference depth);
|
||||
// Bool XTranslateCoordinates(Display *display, Window src_w, dest_w, int src_x, int src_y,
|
||||
// int *dest_x_return, int *dest_y_return, Window *child_return);
|
||||
boolean XTranslateCoordinates(Display display, Window src_w, Window dest_w, int src_x, int src_y,
|
||||
IntByReference dest_x_return, IntByReference dest_y_return, WindowByReference child_return);
|
||||
|
||||
int NoEventMask = 0;
|
||||
int KeyPressMask = (1<<0);
|
||||
int KeyReleaseMask = (1<<1);
|
||||
@@ -462,7 +778,7 @@ public interface X11 extends Library {
|
||||
int PropertyChangeMask = (1<<22);
|
||||
int ColormapChangeMask = (1<<23);
|
||||
int OwnerGrabButtonMask = (1<<24);
|
||||
|
||||
|
||||
int XSelectInput(Display display, Window window, NativeLong eventMask);
|
||||
/** Returns an {@link XWMHints} which must be freed by {@link #XFree}. */
|
||||
XWMHints XGetWMHints(Display display, Window window);
|
||||
@@ -471,26 +787,40 @@ public interface X11 extends Library {
|
||||
int XQueryKeymap(Display display, byte[] keys_return);
|
||||
int XKeycodeToKeysym(Display display, byte keycode, int index);
|
||||
/** Returns an array of {@link XVisualInfo} which must be freed by {@link #XFree}.
|
||||
* Use {@link XVisualInfo#toArray(int)
|
||||
* toArray(nitems_return.getValue()} to obtain the array.
|
||||
* Use {@link XVisualInfo#toArray(int)
|
||||
* toArray(nitems_return.getValue()} to obtain the array.
|
||||
*/
|
||||
XVisualInfo XGetVisualInfo(Display display, NativeLong vinfo_mask,
|
||||
XVisualInfo XGetVisualInfo(Display display, NativeLong vinfo_mask,
|
||||
XVisualInfo vinfo_template,
|
||||
IntByReference nitems_return);
|
||||
Colormap XCreateColormap(Display display, Window w, Visual visual, int alloc);
|
||||
int XGetWindowProperty(Display display, Window w, Atom property,
|
||||
int XGetWindowProperty(Display display, Window w, Atom property,
|
||||
NativeLong long_offset,
|
||||
NativeLong long_length, boolean delete,
|
||||
NativeLong long_length, boolean delete,
|
||||
Atom reg_type,
|
||||
AtomByReference actual_type_return,
|
||||
AtomByReference actual_type_return,
|
||||
IntByReference actual_format_return,
|
||||
NativeLongByReference nitems_return,
|
||||
NativeLongByReference bytes_after_return,
|
||||
PointerByReference prop_return);
|
||||
int XChangeProperty(Display display, Window w, Atom property, Atom type,
|
||||
int XChangeProperty(Display display, Window w, Atom property, Atom type,
|
||||
int format, int mode, Pointer data, int nelements);
|
||||
int XDeleteProperty(Display display, Window w, Atom property);
|
||||
// Atom XInternAtom(Display *display, char *atom_name, Bool only_if_exists);
|
||||
Atom XInternAtom(Display display, String name, boolean only_if_exists);
|
||||
int XCopyArea(Display dpy, Drawable src, Drawable dst, GC gc,
|
||||
// char *XGetAtomName(Display *display, Atom atom);
|
||||
String XGetAtomName(Display display, Atom atom);
|
||||
int XCopyArea(Display dpy, Drawable src, Drawable dst, GC gc,
|
||||
int src_x, int src_y, int w, int h, int dst_x, int dst_y);
|
||||
|
||||
int XYBitmap = 0;
|
||||
int XYPixmap = 1;
|
||||
int ZPixmap = 2;
|
||||
XImage XCreateImage(Display dpy, Visual visual, int depth, int format,
|
||||
int offset, Pointer data, int width, int height,
|
||||
int bitmap_pad, int bytes_per_line);
|
||||
int XPutImage(Display dpy, Drawable d, GC gc, XImage image,
|
||||
int src_x, int src_y, int dest_x, int dest_y,
|
||||
int width, int height);
|
||||
int XDestroyImage(XImage image);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
* Lesser General Public License for more details.
|
||||
*/
|
||||
package com.sun.jna.examples.win32;
|
||||
|
||||
@@ -17,15 +17,16 @@ import java.awt.Rectangle;
|
||||
import com.sun.jna.Native;
|
||||
import com.sun.jna.Pointer;
|
||||
import com.sun.jna.Structure;
|
||||
import com.sun.jna.examples.win32.User32.POINT;
|
||||
import com.sun.jna.ptr.PointerByReference;
|
||||
|
||||
/** Definition (incomplete) of <code>gdi32.dll</code>. */
|
||||
public interface GDI32 extends W32API {
|
||||
|
||||
|
||||
GDI32 INSTANCE = (GDI32)
|
||||
Native.loadLibrary("gdi32", GDI32.class, DEFAULT_OPTIONS);
|
||||
|
||||
public static class RECT extends Structure {
|
||||
class RECT extends Structure {
|
||||
public int left;
|
||||
public int top;
|
||||
public int right;
|
||||
@@ -39,14 +40,14 @@ public interface GDI32 extends W32API {
|
||||
}
|
||||
|
||||
int RDH_RECTANGLES = 1;
|
||||
public static class RGNDATAHEADER extends Structure {
|
||||
class RGNDATAHEADER extends Structure {
|
||||
public int dwSize = size();
|
||||
public int iType = RDH_RECTANGLES; // required
|
||||
public int nCount;
|
||||
public int nRgnSize;
|
||||
public RECT rcBound;
|
||||
public RECT rcBound;
|
||||
}
|
||||
public static class RGNDATA extends Structure {
|
||||
class RGNDATA extends Structure {
|
||||
public RGNDATAHEADER rdh;
|
||||
public byte[] Buffer;
|
||||
public RGNDATA(int bufferSize) {
|
||||
@@ -54,7 +55,7 @@ public interface GDI32 extends W32API {
|
||||
allocateMemory();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public HRGN ExtCreateRegion(Pointer lpXform, int nCount, RGNDATA lpRgnData);
|
||||
|
||||
int RGN_AND = 1;
|
||||
@@ -62,35 +63,38 @@ public interface GDI32 extends W32API {
|
||||
int RGN_XOR = 3;
|
||||
int RGN_DIFF = 4;
|
||||
int RGN_COPY = 5;
|
||||
|
||||
|
||||
int ERROR = 0;
|
||||
int NULLREGION = 1;
|
||||
int SIMPLEREGION = 2;
|
||||
int COMPLEXREGION = 3;
|
||||
int CombineRgn(HRGN hrgnDest, HRGN hrgnSrc1, HRGN hrgnSrc2, int fnCombineMode);
|
||||
|
||||
|
||||
HRGN CreateRectRgn(int nLeftRect, int nTopRect,
|
||||
int nRightRect, int nBottomRect);
|
||||
|
||||
|
||||
HRGN CreateRoundRectRgn(int nLeftRect, int nTopRect,
|
||||
int nRightRect, int nBottomRect,
|
||||
int nWidthEllipse,
|
||||
int nWidthEllipse,
|
||||
int nHeightEllipse);
|
||||
|
||||
int ALTERNATE = 1;
|
||||
int WINDING = 2;
|
||||
HRGN CreatePolyPolygonRgn(POINT[] lppt, int[] lpPolyCounts, int nCount, int fnPolyFillMode);
|
||||
|
||||
boolean SetRectRgn(HRGN hrgn, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect);
|
||||
|
||||
|
||||
int SetPixel(HDC hDC, int x, int y, int crColor);
|
||||
|
||||
|
||||
HDC CreateCompatibleDC(HDC hDC);
|
||||
boolean DeleteDC(HDC hDC);
|
||||
|
||||
|
||||
int BI_RGB = 0;
|
||||
int BI_RLE8 = 1;
|
||||
int BI_RLE4 = 2;
|
||||
int BI_BITFIELDS = 3;
|
||||
int BI_JPEG = 4;
|
||||
int BI_PNG = 5;
|
||||
public static class BITMAPINFOHEADER extends Structure {
|
||||
class BITMAPINFOHEADER extends Structure {
|
||||
public int biSize = size();
|
||||
public int biWidth;
|
||||
public int biHeight;
|
||||
@@ -103,13 +107,13 @@ public interface GDI32 extends W32API {
|
||||
public int biClrUsed;
|
||||
public int biClrImportant;
|
||||
}
|
||||
public static class RGBQUAD extends Structure {
|
||||
class RGBQUAD extends Structure {
|
||||
public byte rgbBlue;
|
||||
public byte rgbGreen;
|
||||
public byte rgbRed;
|
||||
public byte rgbReserved = 0;
|
||||
}
|
||||
public static class BITMAPINFO extends Structure {
|
||||
class BITMAPINFO extends Structure {
|
||||
public BITMAPINFOHEADER bmiHeader = new BITMAPINFOHEADER();
|
||||
//RGBQUAD:
|
||||
//byte rgbBlue;
|
||||
@@ -131,7 +135,7 @@ public interface GDI32 extends W32API {
|
||||
PointerByReference ppvBits, Pointer hSection,
|
||||
int dwOffset);
|
||||
HBITMAP CreateCompatibleBitmap(HDC hDC, int width, int height);
|
||||
|
||||
|
||||
HANDLE SelectObject(HDC hDC, HANDLE hGDIObj);
|
||||
boolean DeleteObject(HANDLE p);
|
||||
}
|
||||
|
||||
@@ -13,11 +13,8 @@
|
||||
package com.sun.jna.examples.win32;
|
||||
|
||||
import java.nio.Buffer;
|
||||
import com.sun.jna.FromNativeContext;
|
||||
import com.sun.jna.Native;
|
||||
import com.sun.jna.NativeMapped;
|
||||
import com.sun.jna.Pointer;
|
||||
import com.sun.jna.PointerType;
|
||||
import com.sun.jna.Structure;
|
||||
import com.sun.jna.ptr.ByReference;
|
||||
import com.sun.jna.ptr.IntByReference;
|
||||
@@ -29,7 +26,7 @@ public interface Kernel32 extends W32API {
|
||||
Kernel32 INSTANCE = (Kernel32)
|
||||
Native.loadLibrary("kernel32", Kernel32.class, DEFAULT_OPTIONS);
|
||||
|
||||
public static class SYSTEMTIME extends Structure {
|
||||
class SYSTEMTIME extends Structure {
|
||||
public short wYear;
|
||||
public short wMonth;
|
||||
public short wDayOfWeek;
|
||||
@@ -50,8 +47,10 @@ public interface Kernel32 extends W32API {
|
||||
int GetCurrentProcessId();
|
||||
HANDLE GetCurrentProcess();
|
||||
int GetProcessId(HANDLE process);
|
||||
int GetProcessVersion(int processId);
|
||||
int GetLastError();
|
||||
void SetLastError(int dwErrCode);
|
||||
int GetDriveType(String rootPathName);
|
||||
|
||||
int FORMAT_MESSAGE_ALLOCATE_BUFFER = 0x0100;
|
||||
int FORMAT_MESSAGE_FROM_SYSTEM = 0x1000;
|
||||
@@ -100,9 +99,17 @@ public interface Kernel32 extends W32API {
|
||||
int FILE_ATTRIBUTE_OFFLINE = 0x00001000;
|
||||
int FILE_ATTRIBUTE_NOT_CONTENT_INDEXED = 0x00002000;
|
||||
int FILE_ATTRIBUTE_ENCRYPTED = 0x00004000;
|
||||
|
||||
int DRIVE_UNKNOWN = 0;
|
||||
int DRIVE_NO_ROOT_DIR = 1;
|
||||
int DRIVE_REMOVABLE = 2;
|
||||
int DRIVE_FIXED = 3;
|
||||
int DRIVE_REMOTE = 4;
|
||||
int DRIVE_CDROM = 5;
|
||||
int DRIVE_RAMDISK = 6;
|
||||
|
||||
int GENERIC_WRITE = 0x40000000;
|
||||
public static class SECURITY_ATTRIBUTES extends Structure {
|
||||
class SECURITY_ATTRIBUTES extends Structure {
|
||||
public int nLength = size();
|
||||
public Pointer lpSecurityDescriptor;
|
||||
public boolean bInheritHandle;
|
||||
@@ -161,7 +168,7 @@ public interface Kernel32 extends W32API {
|
||||
* into a large block of result memory rather than something that stands
|
||||
* alone or is used for input.
|
||||
*/
|
||||
public static class FILE_NOTIFY_INFORMATION extends Structure {
|
||||
class FILE_NOTIFY_INFORMATION extends Structure {
|
||||
public int NextEntryOffset;
|
||||
public int Action;
|
||||
public int FileNameLength;
|
||||
@@ -197,7 +204,7 @@ public interface Kernel32 extends W32API {
|
||||
return next;
|
||||
}
|
||||
}
|
||||
public static class OVERLAPPED extends Structure {
|
||||
class OVERLAPPED extends Structure {
|
||||
public int Internal;
|
||||
public int InternalHigh;
|
||||
public int Offset;
|
||||
@@ -205,7 +212,7 @@ public interface Kernel32 extends W32API {
|
||||
public Pointer hEvent;
|
||||
}
|
||||
// TODO: figure out how OVERLAPPED is used and apply an appropriate mapping
|
||||
public static interface OVERLAPPED_COMPLETION_ROUTINE extends StdCallCallback {
|
||||
interface OVERLAPPED_COMPLETION_ROUTINE extends StdCallCallback {
|
||||
void callback(int errorCode, int nBytesTransferred, OVERLAPPED overlapped);
|
||||
}
|
||||
/** NOTE: only exists in unicode form (W suffix). Define this method
|
||||
@@ -220,4 +227,14 @@ public interface Kernel32 extends W32API {
|
||||
OVERLAPPED overlapped,
|
||||
OVERLAPPED_COMPLETION_ROUTINE completionRoutine);
|
||||
|
||||
/** ASCII version. Use {@link Native#toString(byte[])} to obtain the short
|
||||
* path from the <code>byte</code> array.
|
||||
* Use only if <code>w32.ascii==true</code>.
|
||||
*/
|
||||
int GetShortPathName(String lpszLongPath, byte[] lpdzShortPath, int cchBuffer);
|
||||
|
||||
/** Unicode version (the default). Use {@link Native#toString(char[])} to
|
||||
* obtain the short path from the <code>char</code> array.
|
||||
*/
|
||||
int GetShortPathName(String lpszLongPath, char[] lpdzShortPath, int cchBuffer);
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public interface Shell32 extends W32API {
|
||||
int FOF_NOERRORUI = 1024;
|
||||
int FOF_NOCOPYSECURITYATTRIBS = 2048;
|
||||
|
||||
public static class SHFILEOPSTRUCT extends Structure {
|
||||
class SHFILEOPSTRUCT extends Structure {
|
||||
public HANDLE hwnd;
|
||||
public int wFunc;
|
||||
public String pFrom;
|
||||
|
||||
@@ -8,14 +8,11 @@
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
* Lesser General Public License for more details.
|
||||
*/
|
||||
package com.sun.jna.examples.win32;
|
||||
|
||||
import com.sun.jna.FromNativeContext;
|
||||
import com.sun.jna.IntegerType;
|
||||
import com.sun.jna.Native;
|
||||
import com.sun.jna.NativeMapped;
|
||||
import com.sun.jna.Pointer;
|
||||
import com.sun.jna.Structure;
|
||||
import com.sun.jna.examples.win32.GDI32.RECT;
|
||||
@@ -24,7 +21,7 @@ import com.sun.jna.ptr.IntByReference;
|
||||
|
||||
/** Provides access to the w32 user32 library.
|
||||
* Incomplete implementation to support demos.
|
||||
*
|
||||
*
|
||||
* @author Todd Fast, todd.fast@sun.com
|
||||
* @author twall@users.sf.net
|
||||
*/
|
||||
@@ -32,7 +29,7 @@ public interface User32 extends W32API {
|
||||
|
||||
User32 INSTANCE = (User32)
|
||||
Native.loadLibrary("user32", User32.class, DEFAULT_OPTIONS);
|
||||
|
||||
|
||||
HDC GetDC(HWND hWnd);
|
||||
int ReleaseDC(HWND hWnd, HDC hDC);
|
||||
|
||||
@@ -42,8 +39,8 @@ public interface User32 extends W32API {
|
||||
int FLASHW_ALL = (FLASHW_CAPTION|FLASHW_TRAY);
|
||||
int FLASHW_TIMER = 4;
|
||||
int FLASHW_TIMERNOFG = 12;
|
||||
|
||||
public static class FLASHWINFO extends Structure {
|
||||
|
||||
class FLASHWINFO extends Structure {
|
||||
public int cbSize;
|
||||
public HANDLE hWnd;
|
||||
public int dwFlags;
|
||||
@@ -72,20 +69,20 @@ public interface User32 extends W32API {
|
||||
|
||||
HWND FindWindow(String winClass, String title);
|
||||
int GetClassName(HWND hWnd, byte[] lpClassName, int nMaxCount);
|
||||
public static class GUITHREADINFO extends Structure {
|
||||
class GUITHREADINFO extends Structure {
|
||||
public int cbSize = size();
|
||||
public int flags;
|
||||
HWND hwndActive;
|
||||
HWND hwndFocus;
|
||||
HWND hwndCapture;
|
||||
HWND hwndMenuOwner;
|
||||
HWND hwndMoveSize;
|
||||
HWND hwndCaret;
|
||||
RECT rcCaret;
|
||||
public HWND hwndActive;
|
||||
public HWND hwndFocus;
|
||||
public HWND hwndCapture;
|
||||
public HWND hwndMenuOwner;
|
||||
public HWND hwndMoveSize;
|
||||
public HWND hwndCaret;
|
||||
public RECT rcCaret;
|
||||
}
|
||||
boolean GetGUIThreadInfo(int idThread, GUITHREADINFO lpgui);
|
||||
|
||||
public static class WINDOWINFO extends Structure {
|
||||
|
||||
class WINDOWINFO extends Structure {
|
||||
public int cbSize = size();
|
||||
public RECT rcWindow;
|
||||
public RECT rcClient;
|
||||
@@ -114,12 +111,12 @@ public interface User32 extends W32API {
|
||||
|
||||
HICON LoadIcon(HINSTANCE hInstance, String iconName);
|
||||
|
||||
HANDLE LoadImage(HINSTANCE hinst, // handle to instance
|
||||
String name, // image to load
|
||||
int type, // image type
|
||||
int xDesired, // desired width
|
||||
int yDesired, // desired height
|
||||
int load // load options
|
||||
HANDLE LoadImage(HINSTANCE hinst, // handle to instance
|
||||
String name, // image to load
|
||||
int type, // image type
|
||||
int xDesired, // desired width
|
||||
int yDesired, // desired height
|
||||
int load // load options
|
||||
);
|
||||
|
||||
boolean DestroyIcon(HICON hicon);
|
||||
@@ -140,7 +137,7 @@ public interface User32 extends W32API {
|
||||
int SetWindowLong(HWND hWnd, int nIndex, int dwNewLong);
|
||||
// Do not use this version on win64
|
||||
Pointer SetWindowLong(HWND hWnd, int nIndex, Pointer dwNewLong);
|
||||
|
||||
|
||||
LONG_PTR GetWindowLongPtr(HWND hWnd, int nIndex);
|
||||
LONG_PTR SetWindowLongPtr(HWND hWnd, int nIndex, LONG_PTR dwNewLongPtr);
|
||||
Pointer SetWindowLongPtr(HWND hWnd, int nIndex, Pointer dwNewLongPtr);
|
||||
@@ -150,7 +147,7 @@ public interface User32 extends W32API {
|
||||
int ULW_COLORKEY = 1;
|
||||
int ULW_ALPHA = 2;
|
||||
int ULW_OPAQUE = 4;
|
||||
boolean SetLayeredWindowAttributes(HWND hwnd, int crKey,
|
||||
boolean SetLayeredWindowAttributes(HWND hwnd, int crKey,
|
||||
byte bAlpha, int dwFlags);
|
||||
boolean GetLayeredWindowAttributes(HWND hwnd,
|
||||
IntByReference pcrKey,
|
||||
@@ -158,26 +155,30 @@ public interface User32 extends W32API {
|
||||
IntByReference pdwFlags);
|
||||
|
||||
/** Defines the x- and y-coordinates of a point. */
|
||||
public static class POINT extends Structure {
|
||||
class POINT extends Structure {
|
||||
public int x, y;
|
||||
public POINT() { }
|
||||
public POINT(int x, int y) { this.x = x; this.y = y; }
|
||||
}
|
||||
/** Specifies the width and height of a rectangle. */
|
||||
public static class SIZE extends Structure {
|
||||
class SIZE extends Structure {
|
||||
public int cx, cy;
|
||||
public SIZE() { }
|
||||
public SIZE(int w, int h) { this.cx = w; this.cy = h; }
|
||||
}
|
||||
int AC_SRC_OVER = 0x00;
|
||||
int AC_SRC_ALPHA = 0x01;
|
||||
int AC_SRC_NO_PREMULT_ALPHA = 0x01;
|
||||
int AC_SRC_NO_ALPHA = 0x02;
|
||||
public static class BLENDFUNCTION extends Structure {
|
||||
class BLENDFUNCTION extends Structure {
|
||||
public byte BlendOp = AC_SRC_OVER; // only valid value
|
||||
public byte BlendFlags = 0; // only valid value
|
||||
public byte SourceConstantAlpha;
|
||||
public byte AlphaFormat;
|
||||
}
|
||||
boolean UpdateLayeredWindow(HWND hwnd, HDC hdcDst,
|
||||
POINT pptDst, SIZE psize,
|
||||
HDC hdcSrc, POINT pptSrc, int crKey,
|
||||
boolean UpdateLayeredWindow(HWND hwnd, HDC hdcDst,
|
||||
POINT pptDst, SIZE psize,
|
||||
HDC hdcSrc, POINT pptSrc, int crKey,
|
||||
BLENDFUNCTION pblend, int dwFlags);
|
||||
int SetWindowRgn(HWND hWnd, HRGN hRgn, boolean bRedraw);
|
||||
int VK_SHIFT = 16;
|
||||
@@ -196,28 +197,28 @@ public interface User32 extends W32API {
|
||||
int WH_MOUSE = 7;
|
||||
int WH_KEYBOARD_LL = 13;
|
||||
int WH_MOUSE_LL = 14;
|
||||
public static class HHOOK extends HANDLE { }
|
||||
public static interface HOOKPROC extends StdCallCallback { }
|
||||
class HHOOK extends HANDLE { }
|
||||
interface HOOKPROC extends StdCallCallback { }
|
||||
int WM_KEYDOWN = 256;
|
||||
int WM_KEYUP = 257;
|
||||
int WM_SYSKEYDOWN = 260;
|
||||
int WM_SYSKEYUP = 261;
|
||||
public static class KBDLLHOOKSTRUCT extends Structure {
|
||||
class KBDLLHOOKSTRUCT extends Structure {
|
||||
public int vkCode;
|
||||
public int scanCode;
|
||||
public int flags;
|
||||
public int time;
|
||||
public ULONG_PTR dwExtraInfo;
|
||||
}
|
||||
public static interface LowLevelKeyboardProc extends HOOKPROC {
|
||||
interface LowLevelKeyboardProc extends HOOKPROC {
|
||||
LRESULT callback(int nCode, WPARAM wParam, KBDLLHOOKSTRUCT lParam);
|
||||
}
|
||||
HHOOK SetWindowsHookEx(int idHook, HOOKPROC lpfn, HINSTANCE hMod, int dwThreadId);
|
||||
LRESULT CallNextHookEx(HHOOK hhk, int nCode, WPARAM wParam, LPARAM lParam);
|
||||
LRESULT CallNextHookEx(HHOOK hhk, int nCode, WPARAM wParam, Pointer lParam);
|
||||
boolean UnhookWindowsHookEx(HHOOK hhk);
|
||||
|
||||
public static class MSG extends Structure {
|
||||
|
||||
class MSG extends Structure {
|
||||
public HWND hWnd;
|
||||
public int message;
|
||||
public WPARAM wParam;
|
||||
|
||||
@@ -46,7 +46,7 @@ public interface W32API extends StdCallLibrary, W32Errors {
|
||||
};
|
||||
Map DEFAULT_OPTIONS = Boolean.getBoolean("w32.ascii") ? ASCII_OPTIONS : UNICODE_OPTIONS;
|
||||
|
||||
public static class HANDLE extends PointerType {
|
||||
class HANDLE extends PointerType {
|
||||
/** Override to the appropriate object for INVALID_HANDLE_VALUE. */
|
||||
public Object fromNative(Object nativeValue, FromNativeContext context) {
|
||||
Object o = super.fromNative(nativeValue, context);
|
||||
@@ -55,13 +55,23 @@ public interface W32API extends StdCallLibrary, W32Errors {
|
||||
return o;
|
||||
}
|
||||
}
|
||||
public static class HDC extends HANDLE { }
|
||||
public static class HICON extends HANDLE { }
|
||||
public static class HBITMAP extends HANDLE { }
|
||||
public static class HRGN extends HANDLE { }
|
||||
public static class HWND extends HANDLE { }
|
||||
public static class HINSTANCE extends HANDLE { }
|
||||
public static class HMODULE extends HINSTANCE { }
|
||||
|
||||
class WORD extends IntegerType {
|
||||
public WORD() { this(0); }
|
||||
public WORD(long value) { super(2, value); }
|
||||
}
|
||||
class DWORD extends IntegerType {
|
||||
public DWORD() { this(0); }
|
||||
public DWORD(long value) { super(4, value); }
|
||||
}
|
||||
|
||||
class HDC extends HANDLE { }
|
||||
class HICON extends HANDLE { }
|
||||
class HBITMAP extends HANDLE { }
|
||||
class HRGN extends HANDLE { }
|
||||
class HWND extends HANDLE { }
|
||||
class HINSTANCE extends HANDLE { }
|
||||
class HMODULE extends HINSTANCE { }
|
||||
|
||||
/** Constant value representing an invalid HANDLE. */
|
||||
HANDLE INVALID_HANDLE_VALUE = new HANDLE() {
|
||||
@@ -78,7 +88,7 @@ public interface W32API extends StdCallLibrary, W32Errors {
|
||||
}
|
||||
};
|
||||
/** LPHANDLE */
|
||||
public static class HANDLEByReference extends ByReference {
|
||||
class HANDLEByReference extends ByReference {
|
||||
public HANDLEByReference() {
|
||||
this(null);
|
||||
}
|
||||
@@ -101,36 +111,36 @@ public interface W32API extends StdCallLibrary, W32Errors {
|
||||
}
|
||||
}
|
||||
|
||||
public static class LONG_PTR extends IntegerType {
|
||||
class LONG_PTR extends IntegerType {
|
||||
public LONG_PTR() { this(0); }
|
||||
public LONG_PTR(long value) { super(Pointer.SIZE, value); }
|
||||
}
|
||||
public static class SSIZE_T extends LONG_PTR {
|
||||
class SSIZE_T extends LONG_PTR {
|
||||
public SSIZE_T() { this(0); }
|
||||
public SSIZE_T(long value) { super(value); }
|
||||
}
|
||||
public static class ULONG_PTR extends IntegerType {
|
||||
class ULONG_PTR extends IntegerType {
|
||||
public ULONG_PTR() { this(0); }
|
||||
public ULONG_PTR(long value) { super(Pointer.SIZE, value); }
|
||||
}
|
||||
public static class SIZE_T extends ULONG_PTR {
|
||||
class SIZE_T extends ULONG_PTR {
|
||||
public SIZE_T() { this(0); }
|
||||
public SIZE_T(long value) { super(value); }
|
||||
}
|
||||
public static class LPARAM extends LONG_PTR {
|
||||
class LPARAM extends LONG_PTR {
|
||||
public LPARAM() { this(0); }
|
||||
public LPARAM(long value) { super(value); }
|
||||
}
|
||||
public static class LRESULT extends LONG_PTR {
|
||||
class LRESULT extends LONG_PTR {
|
||||
public LRESULT() { this(0); }
|
||||
public LRESULT(long value) { super(value); }
|
||||
}
|
||||
public static class UINT_PTR extends IntegerType {
|
||||
class UINT_PTR extends IntegerType {
|
||||
public UINT_PTR() { super(Pointer.SIZE); }
|
||||
public UINT_PTR(long value) { super(Pointer.SIZE, value); }
|
||||
public Pointer toPointer() { return Pointer.createConstant(longValue()); }
|
||||
}
|
||||
public static class WPARAM extends UINT_PTR {
|
||||
class WPARAM extends UINT_PTR {
|
||||
public WPARAM() { this(0); }
|
||||
public WPARAM(long value) { super(value); }
|
||||
}
|
||||
|
||||
@@ -115,6 +115,8 @@ Java types must be chosen to match native types of the same size. Following are
|
||||
<tr><td colspan=3>In addition to the above types, which are supported at the native layer, the JNA Java library automatically handles the following types. All but <code>NativeMapped</code> and <code>NativeLong</code> are converted to {@link com.sun.jna.Pointer} before being passed to the native layer.</td></tr>
|
||||
<tr><td>{@link java.lang.String}</td><td>char*</td><td>NUL-terminated array (native encoding or <code>jna.encoding</code>)</td>
|
||||
<tr><td>{@link com.sun.jna.WString}</td><td>wchar_t*</td><td>NUL-terminated array (unicode)</td>
|
||||
<tr><td>{@link java.lang.String String[]}</td><td>char**</td><td>NULL-terminated array of C strings</td>
|
||||
<tr><td>{@link com.sun.jna.WString WString[]}</td><td>wchar_t**</td><td>NULL-terminated array of wide C strings</td>
|
||||
<tr><td>{@link com.sun.jna.Structure}</td><td>struct*<br>struct</td><td>pointer to struct (argument or return) ({@link com.sun.jna.Structure.ByReference or explicitly})<br>struct by value (member of struct) ({@link com.sun.jna.Structure.ByValue or explicitly})</td>
|
||||
<tr><td>{@link com.sun.jna.Union}</td><td>union</td><td>same as <code>Structure</code></td>
|
||||
<tr><td>{@link com.sun.jna.Structure Structure[]}</td><td>struct[]</td><td>array of structs, contiguous in memory</td>
|
||||
@@ -145,12 +147,14 @@ Java primitive arrays may be used wherever a native primitive array is used. An
|
||||
To map a native multi-dimensional array, use a single-dimensional Java array with a number of elements equivalent to the full native array, e.g.<br>
|
||||
<blockquote><code><pre>
|
||||
// Original C code
|
||||
int array[2][3];
|
||||
#define DIM0 2
|
||||
#define DIM1 3
|
||||
int array[DIM0][DIM1];
|
||||
int i,j;
|
||||
|
||||
for (i=0;i < 2;i++) {
|
||||
for (j=0;j < 3;j++) {
|
||||
array[i][j] = i*3 + j;
|
||||
for (i=0;i < DIM0;i++) {
|
||||
for (j=0;j < DIM1;j++) {
|
||||
array[i][j] = i*DIM1 + j;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,9 +162,9 @@ for (i=0;i < 2;i++) {
|
||||
final int DIM0 = 2;
|
||||
final int DIM1 = 3;
|
||||
int[] array = new int[6];
|
||||
for (int i=0;i < 2;i++) {
|
||||
for (int j=0;j < 3;j++) {
|
||||
array[i*3 + j] = i*3 + j;
|
||||
for (int i=0;i < DIM0;i++) {
|
||||
for (int j=0;j < DIM1;j++) {
|
||||
array[i*DIM1 + j] = i*DIM1 + j;
|
||||
}
|
||||
}
|
||||
</pre></code></blockquote>
|
||||
@@ -196,6 +200,7 @@ the default platform encoding is used, unless the system property
|
||||
<code>jna.encoding</code> is set to a valid encoding. This property may be
|
||||
set to "UTF8", for example, to ensure all native strings use that encoding.
|
||||
<p>
|
||||
Arrays of <code>String</code> passed to native code (either as a function argument or callback return value) will be converted into a NULL-terminated array of <code>char*</code> (or <code>wchar_t*</code> in the case of an array of <code>WString</code>.
|
||||
|
||||
<a name="wide-strings"></a>
|
||||
<h3>Wide Strings</h3>
|
||||
@@ -225,6 +230,9 @@ function pointer required by the native code. The name of the method
|
||||
<em>must</em> be "callback", and the arguments and return value follow the
|
||||
same rules as for a direct function invocation.
|
||||
<p>
|
||||
If the callback returns a <code>String</code> or <code>String[]</code>, the
|
||||
returned memory will be valid until the returned object is GC'd.
|
||||
<p>
|
||||
If your native code initializes function pointers within a struct, JNA will
|
||||
automatically generate an <code>Callback</code> instance matching the declared
|
||||
type. This enables you to easily call the function supplied by native code
|
||||
@@ -526,6 +534,37 @@ native memory, call {@link com.sun.jna.Structure#read()} (to update the entire
|
||||
structure) or {@link com.sun.jna.Structure#readField(String)
|
||||
data.readField("refCount")} (to update just the <code>refCount</code> field).
|
||||
|
||||
<h4>Read-only fields</h4>
|
||||
If you want to absolutely prevent Java code from modifying
|
||||
a <code>Structure</code>'s contents, you may mark its
|
||||
fields <code>final</code>. Structure reads can still overwrite the values
|
||||
based on native memory contents, but no Java code will be able to modify any
|
||||
of the fields.
|
||||
<blockquote><code><pre>
|
||||
class ReadOnly extends com.sun.jna.Structure {
|
||||
// Do not initialize the field here, or the compiler will inline the value!
|
||||
public final int refCount;
|
||||
{
|
||||
// Initialize fields here, to ensure the values are not inlined
|
||||
refCount = -1;
|
||||
read();
|
||||
// refCount might now have a different value
|
||||
}
|
||||
}
|
||||
...
|
||||
ReadOnly ro = new ReadOnly();
|
||||
// Will not compile!
|
||||
ro.refCount = 0;
|
||||
</pre></code></blockquote>
|
||||
|
||||
Make certain you attend to the following:
|
||||
<ol>
|
||||
<li>All final fields should be initialized in the constructor.
|
||||
<li>If you call Structure.read() from anywhere but the constructor, keep in
|
||||
mind that the compiler and/or hotspot will be assuming field values will not
|
||||
change across that function call.
|
||||
</ol>
|
||||
|
||||
<a name="unions"></a>
|
||||
<h3>Unions</h3>
|
||||
Unions are a special type of Structure. Each declared field within the union
|
||||
|
||||
@@ -38,7 +38,7 @@ public class StdCallFunctionMapper implements FunctionMapper {
|
||||
/** Override this to handle any custom class mappings. */
|
||||
protected int getArgumentNativeStackSize(Class cls) {
|
||||
if (NativeMapped.class.isAssignableFrom(cls)) {
|
||||
cls = new NativeMappedConverter(cls).nativeType();
|
||||
cls = NativeMappedConverter.getInstance(cls).nativeType();
|
||||
}
|
||||
if (cls.isArray()) {
|
||||
return Pointer.SIZE;
|
||||
@@ -61,11 +61,19 @@ public class StdCallFunctionMapper implements FunctionMapper {
|
||||
pop += getArgumentNativeStackSize(argTypes[i]);
|
||||
}
|
||||
String decorated = name + "@" + pop;
|
||||
int conv = StdCallLibrary.STDCALL_CONVENTION;
|
||||
try {
|
||||
name = library.getFunction(decorated, StdCallLibrary.STDCALL_CONVENTION).getName();
|
||||
name = library.getFunction(decorated, conv).getName();
|
||||
|
||||
}
|
||||
catch(UnsatisfiedLinkError e) {
|
||||
// not found; let caller try undecorated version
|
||||
// try with an explicit underscore
|
||||
try {
|
||||
name = library.getFunction("_" + decorated, conv).getName();
|
||||
}
|
||||
catch(UnsatisfiedLinkError e2) {
|
||||
// not found; let caller try undecorated version
|
||||
}
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
@@ -48,10 +48,10 @@ public class W32APITypeMapper extends DefaultTypeMapper {
|
||||
public Object fromNative(Object value, FromNativeContext context) {
|
||||
if (value == null)
|
||||
return null;
|
||||
return ((Pointer)value).getString(0, true);
|
||||
return value.toString();
|
||||
}
|
||||
public Class nativeType() {
|
||||
return Pointer.class;
|
||||
return WString.class;
|
||||
}
|
||||
};
|
||||
addTypeConverter(String.class, stringConverter);
|
||||
@@ -62,7 +62,7 @@ public class W32APITypeMapper extends DefaultTypeMapper {
|
||||
return new Integer(Boolean.TRUE.equals(value) ? 1 : 0);
|
||||
}
|
||||
public Object fromNative(Object value, FromNativeContext context) {
|
||||
return Boolean.valueOf(((Integer)value).intValue() != 0);
|
||||
return ((Integer)value).intValue() != 0 ? Boolean.TRUE : Boolean.FALSE;
|
||||
}
|
||||
public Class nativeType() {
|
||||
// BOOL is 32-bit int
|
||||
|
||||
@@ -274,6 +274,12 @@ public class ArgumentsMarshalTest extends TestCase {
|
||||
assertEquals("Native address of structure should be returned",
|
||||
struct.getPointer(),
|
||||
lib.testStructurePointerArgument(struct));
|
||||
// ensure that even if the argument is ByValue, it's passed as ptr
|
||||
struct = new TestLibrary.CheckFieldAlignment.ByValue();
|
||||
assertEquals("Structure argument should be passed according to method "
|
||||
+ "parameter type, not argument type",
|
||||
struct.getPointer(),
|
||||
lib.testStructurePointerArgument(struct));
|
||||
}
|
||||
|
||||
public void testStructureByValueArgument() {
|
||||
@@ -334,11 +340,11 @@ public class ArgumentsMarshalTest extends TestCase {
|
||||
}
|
||||
|
||||
public void testRejectNoncontiguousStructureArrayArgument() {
|
||||
TestLibrary.CheckFieldAlignment[] block =
|
||||
new TestLibrary.CheckFieldAlignment[] {
|
||||
new TestLibrary.CheckFieldAlignment(),
|
||||
new TestLibrary.CheckFieldAlignment(),
|
||||
};
|
||||
TestLibrary.CheckFieldAlignment s1, s2, s3;
|
||||
s3 = new TestLibrary.CheckFieldAlignment();
|
||||
s1 = new TestLibrary.CheckFieldAlignment();
|
||||
s2 = new TestLibrary.CheckFieldAlignment();
|
||||
TestLibrary.CheckFieldAlignment[] block = { s1, s2, s3 };
|
||||
try {
|
||||
lib.modifyStructureArray(block, block.length);
|
||||
fail("Library invocation should fail");
|
||||
@@ -483,21 +489,27 @@ public class ArgumentsMarshalTest extends TestCase {
|
||||
}
|
||||
|
||||
public void testPointerArrayArgument() {
|
||||
Pointer[] args = { new NativeString(getName()).getPointer(),
|
||||
new NativeString(getName()+"2").getPointer() };
|
||||
Pointer[] args = {
|
||||
new NativeString(getName()).getPointer(),
|
||||
null,
|
||||
new NativeString(getName()+"2").getPointer(),
|
||||
};
|
||||
assertEquals("Wrong value returned", args[0], lib.returnPointerArrayElement(args, 0));
|
||||
assertEquals("Wrong value returned", args[1], lib.returnPointerArrayElement(args, 1));
|
||||
assertNull("Native array should be null terminated", lib.returnPointerArrayElement(args, 2));
|
||||
assertNull("Wrong value returned", lib.returnPointerArrayElement(args, 1));
|
||||
assertEquals("Wrong value returned", args[2], lib.returnPointerArrayElement(args, 2));
|
||||
assertNull("Native array should be null terminated", lib.returnPointerArrayElement(args, 3));
|
||||
}
|
||||
|
||||
public void testStructureByReferenceArrayArgument() {
|
||||
CheckFieldAlignment.ByReference[] args = {
|
||||
new CheckFieldAlignment.ByReference(),
|
||||
new CheckFieldAlignment.ByReference()
|
||||
null,
|
||||
new CheckFieldAlignment.ByReference(),
|
||||
};
|
||||
assertEquals("Wrong value returned", args[0], lib.returnPointerArrayElement(args, 0));
|
||||
assertEquals("Wrong value returned", args[1], lib.returnPointerArrayElement(args, 1));
|
||||
assertNull("Native array should be null terminated", lib.returnPointerArrayElement(args, 2));
|
||||
assertNull("Wrong value returned", lib.returnPointerArrayElement(args, 1));
|
||||
assertEquals("Wrong value returned", args[2], lib.returnPointerArrayElement(args, 2));
|
||||
assertNull("Native array should be null terminated", lib.returnPointerArrayElement(args, 3));
|
||||
}
|
||||
|
||||
public void testModifiedCharArrayArgument() {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2007 Timothy Wall, All Rights Reserved
|
||||
/* Copyright (c) 2007-2008 Timothy Wall, All Rights Reserved
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -94,6 +94,10 @@ public class CallbacksTest extends TestCase {
|
||||
interface CopyArgToByReference extends Callback {
|
||||
int callback(int arg, IntByReference result);
|
||||
}
|
||||
interface StringArrayCallback extends Callback {
|
||||
String[] callback(String[] arg);
|
||||
}
|
||||
Pointer callStringArrayCallback(StringArrayCallback c, String[] arg);
|
||||
int callCallbackWithByReferenceArgument(CopyArgToByReference cb, int arg, IntByReference result);
|
||||
TestStructure.ByValue callCallbackWithStructByValue(TestStructure.TestCallback callback, TestStructure.ByValue cbstruct);
|
||||
interface CbCallback extends Callback {
|
||||
@@ -406,6 +410,24 @@ public class CallbacksTest extends TestCase {
|
||||
assertEquals("Wrong wide string return", VALUE, value);
|
||||
}
|
||||
|
||||
public void testCallStringArrayCallback() {
|
||||
final boolean[] called = {false};
|
||||
final String[][] cbargs = { null };
|
||||
TestLibrary.StringArrayCallback cb = new TestLibrary.StringArrayCallback() {
|
||||
public String[] callback(String[] arg) {
|
||||
called[0] = true;
|
||||
cbargs[0] = arg;
|
||||
return arg;
|
||||
}
|
||||
};
|
||||
final String[] VALUE = { "value", null };
|
||||
Pointer value = lib.callStringArrayCallback(cb, VALUE);
|
||||
assertTrue("Callback not called", called[0]);
|
||||
assertEquals("Wrong callback argument 1", VALUE[0], cbargs[0][0]);
|
||||
String[] result = value.getStringArray(0);
|
||||
assertEquals("Wrong String return", VALUE[0], result[0]);
|
||||
}
|
||||
|
||||
public void testCallCallbackWithByReferenceArgument() {
|
||||
final boolean[] called = {false};
|
||||
TestLibrary.CopyArgToByReference cb = new TestLibrary.CopyArgToByReference() {
|
||||
|
||||
@@ -3,24 +3,41 @@ package com.sun.jna;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class IntegerTypeTest extends TestCase {
|
||||
|
||||
private class Sized extends IntegerType {
|
||||
|
||||
public static class Sized extends IntegerType {
|
||||
public Sized() { this(4, 0); }
|
||||
public Sized(int size, long value) { super(size, value); }
|
||||
}
|
||||
|
||||
|
||||
public void testWriteNull() {
|
||||
class NTStruct extends Structure {
|
||||
public Sized field;
|
||||
}
|
||||
NTStruct s = new NTStruct();
|
||||
assertNotNull("Field not initialized", s.field);
|
||||
}
|
||||
public void testReadNull() {
|
||||
class NTStruct extends Structure {
|
||||
public Sized field;
|
||||
}
|
||||
NTStruct s = new NTStruct();
|
||||
s.read();
|
||||
assertNotNull("Integer type field should be initialized on read", s.field);
|
||||
}
|
||||
|
||||
public void testCheckArgumentSize() {
|
||||
for (int i=1;i <= 8;i*=2) {
|
||||
long value = -1L << (i*8-1);
|
||||
long value = -1L << (i*8-1);
|
||||
new Sized(i, value);
|
||||
new Sized(i, -1);
|
||||
new Sized(i, 0);
|
||||
new Sized(i, 1);
|
||||
|
||||
|
||||
value = 1L << (i*8-1);
|
||||
new Sized(i, value);
|
||||
value = -1L & ~(-1L << (i*8));
|
||||
new Sized(i, value);
|
||||
|
||||
|
||||
if (i < 8) {
|
||||
try {
|
||||
value = 1L << (i*8);
|
||||
@@ -42,6 +59,12 @@ public class IntegerTypeTest extends TestCase {
|
||||
}
|
||||
}
|
||||
|
||||
public void testInitialValue() {
|
||||
long VALUE = 20;
|
||||
NativeLong nl = new NativeLong(VALUE);
|
||||
assertEquals("Wrong initial value", VALUE, nl.longValue());
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
junit.textui.TestRunner.run(IntegerTypeTest.class);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@ import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.util.Properties;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class JNAUnloadTest extends TestCase {
|
||||
@@ -25,7 +24,9 @@ public class JNAUnloadTest extends TestCase {
|
||||
private static class TestLoader extends URLClassLoader {
|
||||
public TestLoader() throws MalformedURLException {
|
||||
super(new URL[] {
|
||||
new File("build/classes").toURI().toURL(),
|
||||
// use "build-d64" for 64-bit jvm's
|
||||
new File("build" + System.getProperty(LibraryLoadTest.DIR_BUILD_SUFFIX, "")
|
||||
+ "/classes").toURI().toURL(),
|
||||
}, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,9 +19,6 @@ import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
@@ -83,20 +80,30 @@ public class LibraryLoadTest extends TestCase {
|
||||
try { os.close(); } catch(IOException e) { }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** System property name (set by Ant) when running with 64-bit JVM. */
|
||||
static final String DIR_BUILD_SUFFIX = "dir.build.suffix";
|
||||
|
||||
public void testLoadLibraryWithUnicodeName() throws Exception {
|
||||
String tmp = System.getProperty("java.io.tmpdir");
|
||||
String libName = System.mapLibraryName("jnidispatch");
|
||||
File src = new File("build/native", libName);
|
||||
// use "build-d64" for 64-bit jvm's
|
||||
File src = new File("build" + System.getProperty(DIR_BUILD_SUFFIX, "")
|
||||
+ "/native", libName);
|
||||
String newLibName = UNICODE;
|
||||
if (libName.startsWith("lib"))
|
||||
newLibName = "lib" + newLibName;
|
||||
int dot = libName.lastIndexOf(".");
|
||||
if (dot != -1) {
|
||||
newLibName += libName.substring(dot, libName.length());
|
||||
if (Platform.isMac()) {
|
||||
newLibName += ".dylib";
|
||||
}
|
||||
else {
|
||||
newLibName += libName.substring(dot, libName.length());
|
||||
}
|
||||
}
|
||||
File dst = new File(tmp, newLibName);
|
||||
//dst.deleteOnExit();
|
||||
dst.deleteOnExit();
|
||||
copy(src, dst);
|
||||
NativeLibrary.addSearchPath(UNICODE, tmp);
|
||||
NativeLibrary.getInstance(UNICODE);
|
||||
|
||||
@@ -17,14 +17,23 @@ import junit.framework.TestCase;
|
||||
|
||||
public class MemoryTest extends TestCase {
|
||||
public void testAutoFreeMemory() throws Exception {
|
||||
Memory core = new Memory(10);
|
||||
final boolean[] flag = { false };
|
||||
Memory core = new Memory(10) {
|
||||
protected void finalize() {
|
||||
super.finalize();
|
||||
flag[0] = true;
|
||||
}
|
||||
};
|
||||
Pointer shared = core.share(0, 5);
|
||||
WeakReference ref = new WeakReference(core);
|
||||
|
||||
core = null;
|
||||
System.gc();
|
||||
long start = System.currentTimeMillis();
|
||||
assertNotNull("Memory prematurely GC'd", ref.get());
|
||||
assertFalse("Memory prematurely GC'd", flag[0]);
|
||||
// This check fails on IBM's J9, on which the weak ref
|
||||
// is cleared but the object not yet GC'd
|
||||
//assertNotNull("Memory prematurely GC'd", ref.get());
|
||||
shared = null;
|
||||
System.gc();
|
||||
while (ref.get() != null) {
|
||||
|
||||
@@ -14,6 +14,9 @@ package com.sun.jna;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class NativeLibraryTest extends TestCase {
|
||||
@@ -108,7 +111,7 @@ public class NativeLibraryTest extends TestCase {
|
||||
assertNull("Library not GC'd", ref.get());
|
||||
}
|
||||
|
||||
public void testLoadPathVariations() {
|
||||
public void testLoadFrameworkLibrary() {
|
||||
if (Platform.isMac()) {
|
||||
try {
|
||||
NativeLibrary lib = NativeLibrary.getInstance("CoreServices");
|
||||
@@ -130,7 +133,55 @@ public class NativeLibraryTest extends TestCase {
|
||||
global.setInt(0, MAGIC+1);
|
||||
assertEquals("Library global variable not updated", MAGIC+1, global.getInt(0));
|
||||
}
|
||||
|
||||
public void testMatchUnversionedToVersioned() throws Exception {
|
||||
File lib0 = File.createTempFile("lib", ".so.0");
|
||||
File dir = lib0.getParentFile();
|
||||
String name = lib0.getName();
|
||||
name = name.substring(3, name.indexOf(".so"));
|
||||
lib0.deleteOnExit();
|
||||
File lib1 = new File(dir, "lib" + name + ".so.1.0");
|
||||
lib1.createNewFile();
|
||||
lib1.deleteOnExit();
|
||||
File lib1_1 = new File(dir, "lib" + name + ".so.1.1");
|
||||
lib1_1.createNewFile();
|
||||
lib1_1.deleteOnExit();
|
||||
List path = Arrays.asList(new String[] { dir.getAbsolutePath() });
|
||||
assertEquals("Latest versioned library not found when unversioned requested",
|
||||
lib1_1.getAbsolutePath(),
|
||||
NativeLibrary.matchLibrary(name, path));
|
||||
}
|
||||
|
||||
public void testAvoidFalseMatch() throws Exception {
|
||||
File lib0 = File.createTempFile("lib", ".so.1");
|
||||
File dir = lib0.getParentFile();
|
||||
lib0.deleteOnExit();
|
||||
String name = lib0.getName();
|
||||
name = name.substring(3, name.indexOf(".so"));
|
||||
File lib1 = new File(dir, "lib" + name + "-client.so.2");
|
||||
lib1.createNewFile();
|
||||
lib1.deleteOnExit();
|
||||
List path = Arrays.asList(new String[] { dir.getAbsolutePath() });
|
||||
assertEquals("Library with similar prefix should be ignored",
|
||||
lib0.getAbsolutePath(),
|
||||
NativeLibrary.matchLibrary(name, path));
|
||||
}
|
||||
|
||||
public void testParseVersion() throws Exception {
|
||||
String[] VERSIONS = {
|
||||
"1",
|
||||
"1.2",
|
||||
"1.2.3",
|
||||
"1.2.3.4",
|
||||
};
|
||||
double[] EXPECTED = {
|
||||
1, 1.02, 1.0203, 1.020304,
|
||||
};
|
||||
for (int i=0;i < VERSIONS.length;i++) {
|
||||
assertEquals("Badly parsed version", EXPECTED[i], NativeLibrary.parseVersion(VERSIONS[i]), 0.0000001);
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
junit.textui.TestRunner.run(NativeLibraryTest.class);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
* Lesser General Public License for more details.
|
||||
*/
|
||||
package com.sun.jna;
|
||||
|
||||
@@ -18,8 +18,8 @@ import java.util.Map;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import com.sun.jna.IntegerType;
|
||||
import com.sun.jna.StructureTest.VariableSizeTest.VariableSizedStructure;
|
||||
import com.sun.jna.ptr.ByteByReference;
|
||||
import com.sun.jna.ptr.IntByReference;
|
||||
import com.sun.jna.ptr.LongByReference;
|
||||
|
||||
@@ -27,7 +27,7 @@ import com.sun.jna.ptr.LongByReference;
|
||||
* @author twall@users.sf.net
|
||||
*/
|
||||
public class StructureTest extends TestCase {
|
||||
|
||||
|
||||
public static void main(java.lang.String[] argList) {
|
||||
junit.textui.TestRunner.run(StructureTest.class);
|
||||
}
|
||||
@@ -39,7 +39,7 @@ public class StructureTest extends TestCase {
|
||||
Structure s = new TestStructure();
|
||||
assertEquals("Wrong size", 4, s.size());
|
||||
}
|
||||
|
||||
|
||||
// must be public to populate array
|
||||
public static class TestAllocStructure extends Structure {
|
||||
public int f0;
|
||||
@@ -54,17 +54,17 @@ public class StructureTest extends TestCase {
|
||||
assertEquals("Memory not cleared on structure init", 0, s.f1);
|
||||
assertEquals("Memory not cleared on structure init", 0, s.f2);
|
||||
assertEquals("Memory not cleared on structure init", 0, s.f3);
|
||||
|
||||
|
||||
s = (TestAllocStructure)s.toArray(2)[1];
|
||||
assertEquals("Memory not cleared on array init", 0, s.f0);
|
||||
assertEquals("Memory not cleared on array init", 0, s.f1);
|
||||
assertEquals("Memory not cleared on array init", 0, s.f2);
|
||||
assertEquals("Memory not cleared on array init", 0, s.f3);
|
||||
}
|
||||
|
||||
|
||||
// cross-platform smoke test
|
||||
public void testGNUCAlignment() {
|
||||
class TestStructure extends Structure {
|
||||
class TestStructure extends Structure {
|
||||
public byte b;
|
||||
public short s;
|
||||
public int i;
|
||||
@@ -78,10 +78,10 @@ public class StructureTest extends TestCase {
|
||||
final int SIZE = NativeLong.SIZE == 4 && !isSPARC ? 28 : 32;
|
||||
assertEquals("Wrong structure size", SIZE, s.size());
|
||||
}
|
||||
|
||||
|
||||
// cross-platform smoke test
|
||||
public void testMSVCAlignment() {
|
||||
class TestStructure extends Structure {
|
||||
class TestStructure extends Structure {
|
||||
public byte b;
|
||||
public short s;
|
||||
public int i;
|
||||
@@ -93,7 +93,7 @@ public class StructureTest extends TestCase {
|
||||
s.setAlignType(Structure.ALIGN_MSVC);
|
||||
assertEquals("Wrong structure size", 32, s.size());
|
||||
}
|
||||
|
||||
|
||||
public static class FilledStructure extends Structure {
|
||||
public FilledStructure() {
|
||||
for (int i=0;i < size();i++) {
|
||||
@@ -161,12 +161,12 @@ public class StructureTest extends TestCase {
|
||||
public void testStructureSize5() {
|
||||
testStructureSize(5);
|
||||
}
|
||||
|
||||
|
||||
public interface AlignmentTest extends Library {
|
||||
int testStructureAlignment(Structure s, int type,
|
||||
int testStructureAlignment(Structure s, int type,
|
||||
IntByReference offsetp, LongByReference valuep);
|
||||
}
|
||||
|
||||
|
||||
private void testAlignStruct(int index) {
|
||||
AlignmentTest lib = (AlignmentTest)Native.loadLibrary("testlib", AlignmentTest.class);
|
||||
try {
|
||||
@@ -175,9 +175,9 @@ public class StructureTest extends TestCase {
|
||||
Class cls = Class.forName(getClass().getName() + "$TestStructure" + index);
|
||||
Structure s = (Structure)cls.newInstance();
|
||||
int result = lib.testStructureAlignment(s, index, offset, value);
|
||||
assertEquals("Wrong native value at field " + result
|
||||
+ "=0x" + Long.toHexString(value.getValue())
|
||||
+ " (actual native field offset=" + offset.getValue()
|
||||
assertEquals("Wrong native value at field " + result
|
||||
+ "=0x" + Long.toHexString(value.getValue())
|
||||
+ " (actual native field offset=" + offset.getValue()
|
||||
+ ") in " + s, -2, result);
|
||||
}
|
||||
catch(Exception e) {
|
||||
@@ -202,7 +202,7 @@ public class StructureTest extends TestCase {
|
||||
public void testAlignStruct5() {
|
||||
testAlignStruct(5);
|
||||
}
|
||||
|
||||
|
||||
// must be publicly accessible in order to create array elements
|
||||
public static class PublicTestStructure extends Structure {
|
||||
public static class ByReference extends PublicTestStructure implements Structure.ByReference { }
|
||||
@@ -215,12 +215,12 @@ public class StructureTest extends TestCase {
|
||||
}
|
||||
TestStructure s = new TestStructure();
|
||||
assertNotNull("Inner structure should be initialized", s.s1);
|
||||
assertEquals("Wrong aggregate size",
|
||||
assertEquals("Wrong aggregate size",
|
||||
s.s1.size() + s.s2.size() + 4, s.size());
|
||||
s.write();
|
||||
s.read();
|
||||
}
|
||||
|
||||
|
||||
public void testPrimitiveArrayField() {
|
||||
class TestStructure extends Structure {
|
||||
public byte[] buffer = new byte[1024];
|
||||
@@ -231,14 +231,18 @@ public class StructureTest extends TestCase {
|
||||
s.write();
|
||||
s.read();
|
||||
}
|
||||
|
||||
|
||||
public void testStructureArrayField() {
|
||||
class TestStructure extends Structure {
|
||||
public PublicTestStructure[] inner = new PublicTestStructure[2];
|
||||
public PublicTestStructure[] inner2 = (PublicTestStructure[])
|
||||
new PublicTestStructure().toArray(2);
|
||||
}
|
||||
TestStructure s = new TestStructure();
|
||||
int innerSize = new PublicTestStructure().size();
|
||||
assertEquals("Wrong size for structure with nested array of struct",
|
||||
s.inner.length * new PublicTestStructure().size(), s.size());
|
||||
s.inner.length * innerSize + s.inner2.length * innerSize,
|
||||
s.size());
|
||||
s.write();
|
||||
assertNotNull("Inner array elements should auto-initialize", s.inner[0]);
|
||||
s.inner[0].x = s.inner[0].y = -1;
|
||||
@@ -248,8 +252,29 @@ public class StructureTest extends TestCase {
|
||||
0, s.inner[0].x);
|
||||
assertEquals("Inner structure array element 1 not properly read",
|
||||
0, s.inner[1].x);
|
||||
|
||||
assertEquals("Wrong memory for uninitialized nested array",
|
||||
s.getPointer(), s.inner[0].getPointer());
|
||||
assertEquals("Wrong memory for initialized nested array",
|
||||
s.getPointer().share(innerSize * s.inner.length),
|
||||
s.inner2[0].getPointer());
|
||||
}
|
||||
|
||||
|
||||
public static class ToArrayTestStructure extends Structure {
|
||||
public PublicTestStructure[] inner =
|
||||
(PublicTestStructure[])new PublicTestStructure().toArray(2);
|
||||
}
|
||||
public void testToArrayWithStructureArrayField() {
|
||||
ToArrayTestStructure[] array =
|
||||
(ToArrayTestStructure[])new ToArrayTestStructure().toArray(2);
|
||||
assertEquals("Wrong address for top-level array element",
|
||||
array[0].getPointer().share(array[0].size()),
|
||||
array[1].getPointer());
|
||||
assertEquals("Wrong address for nested array element",
|
||||
array[1].inner[0].getPointer().share(array[1].inner[0].size()),
|
||||
array[1].inner[1].getPointer());
|
||||
}
|
||||
|
||||
public void testUninitializedNestedArrayFails() {
|
||||
class TestStructure extends Structure {
|
||||
public Pointer[] buffer;
|
||||
@@ -269,65 +294,76 @@ public class StructureTest extends TestCase {
|
||||
// Have to do this due to inline primitive arrays
|
||||
allocateMemory();
|
||||
}
|
||||
public boolean z;
|
||||
public byte b;
|
||||
public char c;
|
||||
public short s;
|
||||
public int i;
|
||||
public long j;
|
||||
public float f;
|
||||
public double d;
|
||||
public byte[] ba = new byte[8];
|
||||
public char[] ca = new char[8];
|
||||
public short[] sa = new short[8];
|
||||
public int[] ia = new int[8];
|
||||
public long[] ja = new long[8];
|
||||
public float[] fa = new float[8];
|
||||
public double[] da = new double[8];
|
||||
public boolean z; // native int
|
||||
public byte b; // native char
|
||||
public char c; // native wchar_t
|
||||
public short s; // native short
|
||||
public int i; // native int
|
||||
public long l; // native long long
|
||||
public float f; // native float
|
||||
public double d; // native double
|
||||
public byte[] ba = new byte[3];
|
||||
public char[] ca = new char[3];
|
||||
public short[] sa = new short[3];
|
||||
public int[] ia = new int[3];
|
||||
public long[] la = new long[3];
|
||||
public float[] fa = new float[3];
|
||||
public double[] da = new double[3];
|
||||
public PublicTestStructure nested;
|
||||
}
|
||||
TestStructure s = new TestStructure();
|
||||
// set content of the structure
|
||||
s.z = true;
|
||||
s.b = 1;
|
||||
s.s = 2;
|
||||
s.c = 'a';
|
||||
s.i = 3;
|
||||
s.j = 4;
|
||||
s.f = 5;
|
||||
s.d = 6;
|
||||
s.c = 2;
|
||||
s.s = 3;
|
||||
s.i = 4;
|
||||
s.l = 5;
|
||||
s.f = 6.0f;
|
||||
s.d = 7.0;
|
||||
s.nested.x = 1;
|
||||
s.nested.y = 2;
|
||||
s.ba[0] = 3;
|
||||
for (int i = 0; i < 3; i++) {
|
||||
s.ba[i] = (byte) (8 + i);
|
||||
s.ca[i] = (char) (11 + i);
|
||||
s.sa[i] = (short) (14 + i);
|
||||
s.ia[i] = 17 + i;
|
||||
s.la[i] = 23 + i;
|
||||
s.fa[i] = (float) 26 + i;
|
||||
s.da[i] = (double) 29 + i;
|
||||
}
|
||||
// write content to memory
|
||||
s.write();
|
||||
s.z = false;
|
||||
s.b = 0;
|
||||
s.c = 0;
|
||||
s.s = 0;
|
||||
s.i = 0;
|
||||
s.j = 0;
|
||||
s.f = 0;
|
||||
s.d = 0;
|
||||
s.nested.x = s.nested.y = 0;
|
||||
s.ba[0] = 0;
|
||||
byte[] ref = s.ba;
|
||||
Pointer p = s.getPointer();
|
||||
s = new TestStructure();
|
||||
s.useMemory(p);
|
||||
// read content from memory and compare field values
|
||||
s.read();
|
||||
assertTrue("Wrong boolean field value after write/read", s.z);
|
||||
assertEquals("Wrong byte field value after write/read", (byte)1, s.b);
|
||||
assertEquals("Wrong char field value after write/read", 'a', s.c);
|
||||
assertEquals("Wrong short field value after write/read", 2, s.s);
|
||||
assertEquals("Wrong int field value after write/read", 3, s.i);
|
||||
assertEquals("Wrong long field value after write/read", 4, s.j);
|
||||
assertEquals("Wrong float field value after write/read", 5.0f, s.f);
|
||||
assertEquals("Wrong double field value after write/read", 6.0d, s.d);
|
||||
assertEquals("Wrong nested struct field value after write/read (x)",
|
||||
1, s.nested.x);
|
||||
assertEquals("Wrong nested struct field value after write/read (y)",
|
||||
2, s.nested.y);
|
||||
assertEquals("Wrong nested array element value after write/read",
|
||||
3, s.ba[0]);
|
||||
assertSame("Array field reference should be unchanged", ref, s.ba);
|
||||
assertEquals("Wrong boolean field value after write/read", s.z, true);
|
||||
assertEquals("Wrong byte field value after write/read", s.b, 1);
|
||||
assertEquals("Wrong char field value after write/read", s.c, 2);
|
||||
assertEquals("Wrong short field value after write/read", s.s, 3);
|
||||
assertEquals("Wrong int field value after write/read", s.i, 4);
|
||||
assertEquals("Wrong long field value after write/read", s.l, 5);
|
||||
assertEquals("Wrong float field value after write/read", s.f, 6.0f);
|
||||
assertEquals("Wrong double field value after write/read", s.d, 7.0);
|
||||
assertEquals("Wrong nested struct field value after write/read (x)", s.nested.x, 1);
|
||||
assertEquals("Wrong nested struct field value after write/read (y)", s.nested.y, 2);
|
||||
for (int i = 0; i < 3; i++) {
|
||||
assertEquals("Wrong byte array field value after write/read", s.ba[i], (byte) (8 + i));
|
||||
assertEquals("Wrong char array field value after write/read", s.ca[i], (char) (11 + i));
|
||||
assertEquals("Wrong short array field value after write/read", s.sa[i], (short) (14 + i));
|
||||
assertEquals("Wrong int array field value after write/read", s.ia[i], 17 + i);
|
||||
assertEquals("Wrong long array field value after write/read", s.la[i], 23 + i);
|
||||
assertEquals("Wrong float array field value after write/read", s.fa[i], (float) 26 + i);
|
||||
assertEquals("Wrong double array field value after write/read", s.da[i], (double) 29 + i);
|
||||
}
|
||||
// test constancy of references after read
|
||||
int[] ia = s.ia;
|
||||
s.read();
|
||||
assertTrue("Array field reference should be unchanged", ia == s.ia);
|
||||
}
|
||||
|
||||
|
||||
public void testNativeLongSize() throws Exception {
|
||||
class TestStructure extends Structure {
|
||||
public NativeLong l;
|
||||
@@ -335,7 +371,7 @@ public class StructureTest extends TestCase {
|
||||
Structure s = new TestStructure();
|
||||
assertEquals("Wrong size", NativeLong.SIZE, s.size());
|
||||
}
|
||||
|
||||
|
||||
public void testNativeLongRead() throws Exception {
|
||||
class TestStructure extends Structure {
|
||||
public int i;
|
||||
@@ -347,7 +383,7 @@ public class StructureTest extends TestCase {
|
||||
s.getPointer().setLong(8, MAGIC);
|
||||
s.read();
|
||||
assertEquals("NativeLong field mismatch", MAGIC, s.l.longValue());
|
||||
}
|
||||
}
|
||||
else {
|
||||
final int MAGIC = 0xABEDCF23;
|
||||
s.getPointer().setInt(4, MAGIC);
|
||||
@@ -355,7 +391,7 @@ public class StructureTest extends TestCase {
|
||||
assertEquals("NativeLong field mismatch", MAGIC, s.l.intValue());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void testNativeLongWrite() throws Exception {
|
||||
class TestStructure extends Structure {
|
||||
public int i;
|
||||
@@ -368,7 +404,7 @@ public class StructureTest extends TestCase {
|
||||
s.write();
|
||||
long l = s.getPointer().getLong(8);
|
||||
assertEquals("NativeLong field mismatch", MAGIC, l);
|
||||
}
|
||||
}
|
||||
else {
|
||||
final int MAGIC = 0xABEDCF23;
|
||||
s.l = new NativeLong(MAGIC);
|
||||
@@ -377,7 +413,7 @@ public class StructureTest extends TestCase {
|
||||
assertEquals("NativeLong field mismatch", MAGIC, i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void testDisallowFunctionPointerAsField() {
|
||||
class BadFieldStructure extends Structure {
|
||||
public Function cb;
|
||||
@@ -398,7 +434,7 @@ public class StructureTest extends TestCase {
|
||||
assertEquals("First element should be original", s, array[0]);
|
||||
assertEquals("Structure memory should be expanded", 2, s.toArray(2).length);
|
||||
}
|
||||
|
||||
|
||||
static class CbStruct extends Structure {
|
||||
public Callback cb;
|
||||
}
|
||||
@@ -426,7 +462,7 @@ public class StructureTest extends TestCase {
|
||||
CallbackReference ref = (CallbackReference)refs.get(s.cb);
|
||||
assertEquals("Wrong trampoline", ref.getTrampoline(), func);
|
||||
}
|
||||
|
||||
|
||||
public void testCallCallbackInStructure() {
|
||||
final boolean[] flag = {false};
|
||||
final CbStruct s = new CbStruct();
|
||||
@@ -439,22 +475,22 @@ public class StructureTest extends TestCase {
|
||||
lib.callCallbackInStruct(s);
|
||||
assertTrue("Callback not invoked", flag[0]);
|
||||
}
|
||||
|
||||
|
||||
public void testReadFunctionPointerAsCallback() {
|
||||
CbStruct2 s = new CbStruct2();
|
||||
CbTest lib = (CbTest)Native.loadLibrary("testlib", CbTest.class);
|
||||
lib.setCallbackInStruct(s);
|
||||
assertNotNull("Callback field not set", s.cb);
|
||||
}
|
||||
|
||||
|
||||
public void testCallProxiedFunctionPointer() {
|
||||
CbStruct2 s = new CbStruct2();
|
||||
CbTest lib = (CbTest)Native.loadLibrary("testlib", CbTest.class);
|
||||
lib.setCallbackInStruct(s);
|
||||
assertEquals("Proxy to native function pointer failed",
|
||||
assertEquals("Proxy to native function pointer failed",
|
||||
3, s.cb.callback(1, 2));
|
||||
}
|
||||
|
||||
|
||||
public void testUninitializedArrayField() {
|
||||
class UninitializedArrayFieldStructure extends Structure {
|
||||
public byte[] array;
|
||||
@@ -467,7 +503,7 @@ public class StructureTest extends TestCase {
|
||||
catch(IllegalStateException e) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static class ArrayOfStructure extends Structure {
|
||||
public Structure[] array;
|
||||
}
|
||||
@@ -482,7 +518,7 @@ public class StructureTest extends TestCase {
|
||||
fail("Wrong exception thrown on Structure[] field in Structure: " + e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void testPointerArrayField() {
|
||||
class ArrayOfPointerStructure extends Structure {
|
||||
final static int SIZE = 10;
|
||||
@@ -497,7 +533,7 @@ public class StructureTest extends TestCase {
|
||||
s.read();
|
||||
assertEquals("Wrong first element", s.getPointer(), s.array[0]);
|
||||
}
|
||||
|
||||
|
||||
public void testBufferField() {
|
||||
// NOTE: may support write-only Buffer fields in the future
|
||||
class BufferStructure extends Structure {
|
||||
@@ -510,10 +546,10 @@ public class StructureTest extends TestCase {
|
||||
new BufferStructure(new byte[1024]);
|
||||
fail("Buffer fields should fail immediately");
|
||||
}
|
||||
catch(IllegalArgumentException e) {
|
||||
catch(IllegalArgumentException e) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void testVolatileStructureField() {
|
||||
class VolatileStructure extends Structure {
|
||||
public volatile int counter;
|
||||
@@ -537,13 +573,13 @@ public class StructureTest extends TestCase {
|
||||
StructureWithPointers s = new StructureWithPointers();
|
||||
assertEquals("Wrong size for structure with structure references",
|
||||
Pointer.SIZE * 2, s.size());
|
||||
|
||||
|
||||
assertNull("Initial refs should be null", s.s1);
|
||||
}
|
||||
|
||||
|
||||
public void testRegenerateStructureByReferenceField() {
|
||||
StructureWithPointers s = new StructureWithPointers();
|
||||
PublicTestStructure.ByReference inner =
|
||||
PublicTestStructure.ByReference inner =
|
||||
new PublicTestStructure.ByReference();
|
||||
s.s1 = inner;
|
||||
s.write();
|
||||
@@ -552,24 +588,24 @@ public class StructureTest extends TestCase {
|
||||
assertEquals("Inner structure not regenerated on read", inner, s.s1);
|
||||
}
|
||||
|
||||
public void testPreserveStructureByReferenceWithUnchangedPointer() {
|
||||
public void testPreserveStructureByReferenceWithUnchangedPointerOnRead() {
|
||||
StructureWithPointers s = new StructureWithPointers();
|
||||
PublicTestStructure.ByReference inner =
|
||||
PublicTestStructure.ByReference inner =
|
||||
new PublicTestStructure.ByReference();
|
||||
|
||||
|
||||
s.s1 = inner;
|
||||
s.write();
|
||||
s.read();
|
||||
assertSame("Read should preserve structure object", inner, s.s1);
|
||||
assertTrue("Read should preserve structure memory",
|
||||
assertSame("Read should preserve structure object", inner, s.s1);
|
||||
assertTrue("Read should preserve structure memory",
|
||||
inner.getPointer() instanceof Memory);
|
||||
}
|
||||
|
||||
public void testOverwriteStructureByReferenceField() {
|
||||
|
||||
public void testOverwriteStructureByReferenceFieldOnRead() {
|
||||
StructureWithPointers s = new StructureWithPointers();
|
||||
PublicTestStructure.ByReference inner =
|
||||
PublicTestStructure.ByReference inner =
|
||||
new PublicTestStructure.ByReference();
|
||||
PublicTestStructure.ByReference inner2 =
|
||||
PublicTestStructure.ByReference inner2 =
|
||||
new PublicTestStructure.ByReference();
|
||||
s.s1 = inner2;
|
||||
s.write();
|
||||
@@ -577,27 +613,36 @@ public class StructureTest extends TestCase {
|
||||
s.read();
|
||||
assertNotSame("Read should overwrite structure reference", inner, s.s1);
|
||||
}
|
||||
|
||||
|
||||
public void testAutoWriteStructureByReferenceField() {
|
||||
StructureWithPointers s = new StructureWithPointers();
|
||||
s.s1 = new StructureTest.PublicTestStructure.ByReference();
|
||||
s.s1.x = -1;
|
||||
s.write();
|
||||
assertEquals("Structure.ByReference not written automatically",
|
||||
-1, s.s1.getPointer().getInt(0));
|
||||
}
|
||||
|
||||
public void testStructureByReferenceArrayField() {
|
||||
class TestStructure extends Structure {
|
||||
public PublicTestStructure.ByReference[] array = new PublicTestStructure.ByReference[2];
|
||||
}
|
||||
TestStructure s = new TestStructure();
|
||||
assertEquals("Wrong structure size", 2*Pointer.SIZE, s.size());
|
||||
|
||||
|
||||
PublicTestStructure.ByReference ref = new PublicTestStructure.ByReference();
|
||||
ref.x = 42;
|
||||
Object aref = s.array;
|
||||
s.array[0] = ref;
|
||||
s.array[1] = new PublicTestStructure.ByReference();
|
||||
|
||||
|
||||
s.write();
|
||||
s.read();
|
||||
|
||||
|
||||
assertSame("Array reference should not change", aref, s.array);
|
||||
assertSame("Elements should not be overwritten when unchanged",
|
||||
assertSame("Elements should not be overwritten when unchanged",
|
||||
ref, s.array[0]);
|
||||
|
||||
|
||||
s.array[0] = null;
|
||||
s.read();
|
||||
assertNotSame("Null should be overwritten with a new ref", ref, s.array[0]);
|
||||
@@ -618,7 +663,7 @@ public class StructureTest extends TestCase {
|
||||
}
|
||||
public void testNestedStructureTypeInfo() {
|
||||
class FFIType extends Structure {
|
||||
public FFIType(Pointer p) {
|
||||
public FFIType(Pointer p) {
|
||||
useMemory(p); read();
|
||||
}
|
||||
public size_t size;
|
||||
@@ -637,10 +682,10 @@ public class StructureTest extends TestCase {
|
||||
assertEquals("Wrong type information for integer field",
|
||||
Structure.getTypeInfo(new Integer(0)),
|
||||
els.getPointer(Pointer.SIZE));
|
||||
assertNull("Type element list should be null-terminated",
|
||||
assertNull("Type element list should be null-terminated",
|
||||
els.getPointer(Pointer.SIZE*2));
|
||||
}
|
||||
|
||||
|
||||
public void testInnerArrayTypeInfo() {
|
||||
class TestStructure extends Structure {
|
||||
public int[] inner = new int[5];
|
||||
@@ -650,13 +695,13 @@ public class StructureTest extends TestCase {
|
||||
Pointer p = s.getTypeInfo();
|
||||
assertNotNull("Type info should not be null", p);
|
||||
}
|
||||
|
||||
|
||||
public void testTypeInfoForNull() {
|
||||
assertEquals("Wrong type information for 'null'",
|
||||
Structure.getTypeInfo(new Pointer(0)),
|
||||
Structure.getTypeInfo(null));
|
||||
}
|
||||
|
||||
|
||||
public void testToString() {
|
||||
class TestStructure extends Structure {
|
||||
public int intField;
|
||||
@@ -665,7 +710,7 @@ public class StructureTest extends TestCase {
|
||||
TestStructure s = new TestStructure();
|
||||
final String LS = System.getProperty("line.separator");
|
||||
System.setProperty("jna.dump_memory", "true");
|
||||
final String EXPECTED = "(?m).*" + s.size() + " bytes.*\\{" + LS
|
||||
final String EXPECTED = "(?m).*" + s.size() + " bytes.*\\{" + LS
|
||||
+ " int intField@0=0" + LS
|
||||
+ " .* inner@4=.*\\{" + LS
|
||||
+ " int x@0=0" + LS
|
||||
@@ -677,11 +722,11 @@ public class StructureTest extends TestCase {
|
||||
+ "\\[00000000\\]" + LS
|
||||
+ "\\[00000000\\]";
|
||||
String actual = s.toString();
|
||||
assertTrue("Improperly formatted toString(): expected "
|
||||
+ EXPECTED + "\n" + actual,
|
||||
assertTrue("Improperly formatted toString(): expected "
|
||||
+ EXPECTED + "\n" + actual,
|
||||
actual.matches(EXPECTED));
|
||||
}
|
||||
|
||||
|
||||
public interface VariableSizeTest extends Library {
|
||||
public static class VariableSizedStructure extends Structure {
|
||||
public int length;
|
||||
@@ -701,4 +746,118 @@ public class StructureTest extends TestCase {
|
||||
assertEquals("Wrong string returned from variable sized struct",
|
||||
EXPECTED, lib.returnStringFromVariableSizedStructure(s));
|
||||
}
|
||||
|
||||
public void testNativeMappedWrite() {
|
||||
class TestStructure extends Structure {
|
||||
public ByteByReference ref;
|
||||
}
|
||||
TestStructure s = new TestStructure();
|
||||
s.ref = null;
|
||||
s.write();
|
||||
}
|
||||
|
||||
public static class TestNativeMappedInStructure extends Structure {
|
||||
public static class ByValue extends TestNativeMappedInStructure implements Structure.ByValue { }
|
||||
public NativeLong field;
|
||||
}
|
||||
public void testNativeMappedInByValue() {
|
||||
new TestNativeMappedInStructure.ByValue();
|
||||
}
|
||||
|
||||
public static class ROStructure extends Structure {
|
||||
public final int field;
|
||||
{
|
||||
field = 0;
|
||||
getPointer().setInt(0, 42);
|
||||
read();
|
||||
}
|
||||
}
|
||||
public void testReadOnlyField() {
|
||||
ROStructure s = new ROStructure();
|
||||
assertEquals("Field value should be writable from native", 42, s.field);
|
||||
}
|
||||
public void testNativeMappedArrayField() {
|
||||
final int SIZE = 24;
|
||||
class TestStructure extends Structure {
|
||||
public NativeLong[] longs = new NativeLong[SIZE];
|
||||
}
|
||||
TestStructure s = new TestStructure();
|
||||
assertEquals("Wrong structure size", Native.LONG_SIZE * SIZE, s.size());
|
||||
|
||||
NativeLong[] aref = s.longs;
|
||||
for (int i=0;i < s.longs.length;i++) {
|
||||
s.longs[i] = new NativeLong(i);
|
||||
}
|
||||
s.write();
|
||||
for (int i=0;i < s.longs.length;i++) {
|
||||
assertEquals("Value not written to memory at index " + i,
|
||||
i, s.getPointer().getNativeLong(i * NativeLong.SIZE).intValue());
|
||||
}
|
||||
s.read();
|
||||
assertEquals("Array reference should remain unchanged on read",
|
||||
aref, s.longs);
|
||||
|
||||
for (int i=0;i < s.longs.length;i++) {
|
||||
assertEquals("Wrong value after read at index " + i,
|
||||
i, s.longs[i].intValue());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void testInitializeNativeMappedField() {
|
||||
final long VALUE = 20;
|
||||
final NativeLong INITIAL = new NativeLong(VALUE);
|
||||
class TestStructure extends Structure {
|
||||
// field overwritten, wrong value before write
|
||||
// NL bug, wrong value written
|
||||
{ setAlignType(ALIGN_NONE); }
|
||||
public NativeLong nl = INITIAL;
|
||||
public NativeLong uninitialized;
|
||||
}
|
||||
TestStructure ts = new TestStructure();
|
||||
assertEquals("Wrong value in field", VALUE, ts.nl.longValue());
|
||||
assertSame("Initial value overwritten", INITIAL, ts.nl);
|
||||
assertEquals("Wrong field value before write", VALUE, ts.nl.longValue());
|
||||
assertNotNull("Uninitialized field should be initialized", ts.uninitialized);
|
||||
assertEquals("Wrong initialized value", 0, ts.uninitialized.longValue());
|
||||
ts.write();
|
||||
assertEquals("Wrong field value written", VALUE, ts.getPointer().getNativeLong(0).longValue());
|
||||
assertEquals("Wrong field value written (2)", 0, ts.getPointer().getNativeLong(NativeLong.SIZE).longValue());
|
||||
ts.read();
|
||||
assertEquals("Wrong field value", VALUE, ts.nl.longValue());
|
||||
assertEquals("Wrong field value (2)", 0, ts.uninitialized.longValue());
|
||||
}
|
||||
|
||||
public void testStructureFieldOrder() {
|
||||
Structure.REQUIRES_FIELD_ORDER = true;
|
||||
try {
|
||||
class TestStructure extends Structure {
|
||||
public int one = 1;
|
||||
public int three = 3;
|
||||
public int two = 2;
|
||||
{
|
||||
setFieldOrder(new String[] { "one", "two", "three" });
|
||||
}
|
||||
}
|
||||
class DerivedTestStructure extends TestStructure {
|
||||
public int four = 4;
|
||||
{
|
||||
setFieldOrder(new String[] { "four" });
|
||||
}
|
||||
}
|
||||
|
||||
DerivedTestStructure s = new DerivedTestStructure();
|
||||
DerivedTestStructure s2 = new DerivedTestStructure();
|
||||
s.write();
|
||||
s2.write();
|
||||
assertEquals("Wrong first field", 1, s.getPointer().getInt(0));
|
||||
assertEquals("Wrong second field", 2, s.getPointer().getInt(4));
|
||||
assertEquals("Wrong third field", 3, s.getPointer().getInt(8));
|
||||
assertEquals("Wrong derived field", 4, s.getPointer().getInt(12));
|
||||
}
|
||||
finally {
|
||||
Structure.REQUIRES_FIELD_ORDER = false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -71,6 +71,18 @@ public class UnionTest extends TestCase {
|
||||
u.getTypeInfo());
|
||||
}
|
||||
|
||||
public void testArraysInUnion() {
|
||||
class TestUnion extends Union {
|
||||
public byte[] bytes = new byte[16];
|
||||
public short[] shorts = new short[8];
|
||||
public int[] ints = new int[4];
|
||||
}
|
||||
Union u = new TestUnion();
|
||||
u.setType(byte[].class);
|
||||
u.setType(short[].class);
|
||||
u.setType(int[].class);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
junit.textui.TestRunner.run(UnionTest.class);
|
||||
}
|
||||
|
||||
@@ -21,21 +21,18 @@ import junit.framework.TestCase;
|
||||
import com.sun.jna.Platform;
|
||||
import com.sun.jna.examples.FileMonitor.FileEvent;
|
||||
import com.sun.jna.examples.FileMonitor.FileListener;
|
||||
import com.sun.jna.examples.win32.Kernel32;
|
||||
import com.sun.jna.ptr.PointerByReference;
|
||||
|
||||
public class FileMonitorTest extends TestCase {
|
||||
|
||||
Map events;
|
||||
FileListener listener;
|
||||
FileMonitor monitor;
|
||||
File tmpdir;
|
||||
private Map events;
|
||||
private FileMonitor monitor;
|
||||
private File tmpdir;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
if (!Platform.isWindows()) return;
|
||||
|
||||
events = new HashMap();
|
||||
listener = new FileListener() {
|
||||
final FileListener listener = new FileListener() {
|
||||
public void fileChanged(FileEvent e) {
|
||||
events.put(new Integer(e.getType()), e);
|
||||
}
|
||||
@@ -57,15 +54,7 @@ public class FileMonitorTest extends TestCase {
|
||||
monitor.addWatch(tmpdir);
|
||||
File file = File.createTempFile(getName(), ".tmp", tmpdir);
|
||||
file.deleteOnExit();
|
||||
FileEvent event = (FileEvent)events.get(new Integer(FileMonitor.FILE_CREATED));
|
||||
long start = System.currentTimeMillis();
|
||||
while (System.currentTimeMillis() - start < 5000 && event == null) {
|
||||
Thread.sleep(10);
|
||||
event = (FileEvent)events.get(new Integer(FileMonitor.FILE_CREATED));
|
||||
}
|
||||
assertTrue("No events sent", events.size() != 0);
|
||||
assertNotNull("No creation event: " + events, event);
|
||||
assertEquals("Wrong target file for event", file, event.getFile());
|
||||
assertFileEventCreated(file);
|
||||
}
|
||||
|
||||
public void testNotifyOnFileDelete() throws Exception {
|
||||
@@ -74,17 +63,24 @@ public class FileMonitorTest extends TestCase {
|
||||
monitor.addWatch(tmpdir);
|
||||
File file = File.createTempFile(getName(), ".tmp", tmpdir);
|
||||
file.delete();
|
||||
FileEvent event = (FileEvent)events.get(new Integer(FileMonitor.FILE_DELETED));
|
||||
long start = System.currentTimeMillis();
|
||||
while (System.currentTimeMillis() - start < 5000 && event == null) {
|
||||
Thread.sleep(10);
|
||||
event = (FileEvent)events.get(new Integer(FileMonitor.FILE_DELETED));
|
||||
}
|
||||
assertTrue("No events sent", events.size() != 0);
|
||||
|
||||
final FileEvent event = waitForFileEvent(FileMonitor.FILE_DELETED);
|
||||
assertNotNull("No delete event: " + events, event);
|
||||
assertEquals("Wrong target file for event", file, event.getFile());
|
||||
}
|
||||
|
||||
public void testNotifyOnFileDeleteViaAddWatchMask() throws Exception {
|
||||
if (!Platform.isWindows()) return;
|
||||
|
||||
monitor.addWatch(tmpdir, FileMonitor.FILE_DELETED);
|
||||
File file = File.createTempFile(getName(), ".tmp", tmpdir);
|
||||
file.delete();
|
||||
|
||||
final FileEvent event = waitForFileEvent(FileMonitor.FILE_DELETED);
|
||||
assertNotNull("No delete event: " + events, event);
|
||||
assertEquals("Wrong target file for event", file, event.getFile());
|
||||
}
|
||||
|
||||
public void testNotifyOnFileRename() throws Exception {
|
||||
if (!Platform.isWindows()) return;
|
||||
|
||||
@@ -94,19 +90,13 @@ public class FileMonitorTest extends TestCase {
|
||||
newFile.deleteOnExit();
|
||||
file.deleteOnExit();
|
||||
file.renameTo(newFile);
|
||||
FileEvent e1 = (FileEvent)events.get(new Integer(FileMonitor.FILE_NAME_CHANGED_OLD));
|
||||
FileEvent e2 = (FileEvent)events.get(new Integer(FileMonitor.FILE_NAME_CHANGED_NEW));
|
||||
long start = System.currentTimeMillis();
|
||||
while (System.currentTimeMillis() - start < 5000 && e1 == null && e2 == null) {
|
||||
Thread.sleep(10);
|
||||
e1 = (FileEvent)events.get(new Integer(FileMonitor.FILE_NAME_CHANGED_OLD));
|
||||
e2 = (FileEvent)events.get(new Integer(FileMonitor.FILE_NAME_CHANGED_NEW));
|
||||
}
|
||||
assertTrue("No events sent", events.size() != 0);
|
||||
assertNotNull("No rename event (old): " + events, e1);
|
||||
assertNotNull("No rename event (new): " + events, e2);
|
||||
assertEquals("Wrong target file for event (old)", file, e1.getFile());
|
||||
assertEquals("Wrong target file for event (new)", newFile, e2.getFile());
|
||||
|
||||
final FileEvent eventFilenameOld = waitForFileEvent(FileMonitor.FILE_NAME_CHANGED_OLD);
|
||||
final FileEvent eventFilenameNew = waitForFileEvent(FileMonitor.FILE_NAME_CHANGED_NEW);
|
||||
assertNotNull("No rename event (old): " + events, eventFilenameOld);
|
||||
assertNotNull("No rename event (new): " + events, eventFilenameNew);
|
||||
assertEquals("Wrong target file for event (old)", file, eventFilenameOld.getFile());
|
||||
assertEquals("Wrong target file for event (new)", newFile, eventFilenameNew.getFile());
|
||||
}
|
||||
|
||||
public void testNotifyOnFileModification() throws Exception {
|
||||
@@ -115,16 +105,13 @@ public class FileMonitorTest extends TestCase {
|
||||
monitor.addWatch(tmpdir);
|
||||
File file = File.createTempFile(getName(), ".tmp", tmpdir);
|
||||
file.deleteOnExit();
|
||||
FileOutputStream os = new FileOutputStream(file);
|
||||
os.write(getName().getBytes());
|
||||
os.close();
|
||||
FileEvent event = (FileEvent)events.get(new Integer(FileMonitor.FILE_MODIFIED));
|
||||
long start = System.currentTimeMillis();
|
||||
while (System.currentTimeMillis() - start < 5000 && event == null) {
|
||||
Thread.sleep(10);
|
||||
event = (FileEvent)events.get(new Integer(FileMonitor.FILE_MODIFIED));
|
||||
final FileOutputStream os = new FileOutputStream(file);
|
||||
try {
|
||||
os.write(getName().getBytes());
|
||||
} finally {
|
||||
os.close();
|
||||
}
|
||||
assertTrue("No events sent", events.size() != 0);
|
||||
final FileEvent event = waitForFileEvent(FileMonitor.FILE_MODIFIED);
|
||||
assertNotNull("No file modified event: " + events, event);
|
||||
assertEquals("Wrong target file for event (old)", file, event.getFile());
|
||||
}
|
||||
@@ -147,48 +134,20 @@ public class FileMonitorTest extends TestCase {
|
||||
public void testMultipleWatches() throws Exception {
|
||||
if (!Platform.isWindows()) return;
|
||||
|
||||
File subdir1 = createSubdir(tmpdir, "sub1");
|
||||
File subdir2 = createSubdir(tmpdir, "sub2");
|
||||
File subdir1 = createSubdir(tmpdir, "sub1-");
|
||||
File subdir2 = createSubdir(tmpdir, "sub2-");
|
||||
try {
|
||||
monitor.addWatch(subdir1);
|
||||
monitor.addWatch(subdir2);
|
||||
|
||||
// trigger change in dir 1
|
||||
File file = File.createTempFile(getName(), ".tmp", subdir1);
|
||||
FileEvent event = (FileEvent)events.get(new Integer(FileMonitor.FILE_CREATED));
|
||||
long start = System.currentTimeMillis();
|
||||
while (System.currentTimeMillis() - start < 5000 && event == null) {
|
||||
Thread.sleep(10);
|
||||
event = (FileEvent)events.get(new Integer(FileMonitor.FILE_CREATED));
|
||||
}
|
||||
assertTrue("No events sent", events.size() != 0);
|
||||
assertNotNull("No creation event: " + events, event);
|
||||
assertEquals("Wrong target file for event", file, event.getFile());
|
||||
events.clear();
|
||||
assertFileEventCreated(File.createTempFile(getName(), ".tmp", subdir1));
|
||||
|
||||
// trigger change in dir 2
|
||||
file = File.createTempFile(getName(), ".tmp", subdir2);
|
||||
event = (FileEvent)events.get(new Integer(FileMonitor.FILE_CREATED));
|
||||
start = System.currentTimeMillis();
|
||||
while (System.currentTimeMillis() - start < 5000 && event == null) {
|
||||
Thread.sleep(10);
|
||||
event = (FileEvent)events.get(new Integer(FileMonitor.FILE_CREATED));
|
||||
}
|
||||
assertTrue("No events sent", events.size() != 0);
|
||||
assertNotNull("No creation event: " + events, event);
|
||||
assertEquals("Wrong target file for event", file, event.getFile());
|
||||
assertFileEventCreated(File.createTempFile(getName(), ".tmp", subdir2));
|
||||
|
||||
// trigger change in dir 1
|
||||
file = File.createTempFile(getName(), ".tmp", subdir1);
|
||||
event = (FileEvent)events.get(new Integer(FileMonitor.FILE_CREATED));
|
||||
start = System.currentTimeMillis();
|
||||
while (System.currentTimeMillis() - start < 5000 && event == null) {
|
||||
Thread.sleep(10);
|
||||
event = (FileEvent)events.get(new Integer(FileMonitor.FILE_CREATED));
|
||||
}
|
||||
assertTrue("No events sent", events.size() != 0);
|
||||
assertNotNull("No creation event: " + events, event);
|
||||
assertEquals("Wrong target file for event", file, event.getFile());
|
||||
assertFileEventCreated(File.createTempFile(getName(), ".tmp", subdir1));
|
||||
}
|
||||
finally {
|
||||
delete(subdir1);
|
||||
@@ -196,6 +155,60 @@ public class FileMonitorTest extends TestCase {
|
||||
}
|
||||
}
|
||||
|
||||
public void testMultipleConsecutiveWatches() throws Exception {
|
||||
if (!Platform.isWindows()) return;
|
||||
|
||||
File subdir1 = createSubdir(tmpdir, "sub1-");
|
||||
File subdir2 = createSubdir(tmpdir, "sub2-");
|
||||
try {
|
||||
monitor.addWatch(subdir1);
|
||||
monitor.addWatch(subdir2);
|
||||
// trigger change in dir 1
|
||||
assertFileEventCreated(File.createTempFile(getName(), ".tmp", subdir1));
|
||||
monitor.removeWatch(subdir1);
|
||||
// trigger change in dir 2
|
||||
assertFileEventCreated(File.createTempFile(getName(), ".tmp", subdir2));
|
||||
monitor.removeWatch(subdir2);
|
||||
monitor.addWatch(subdir1);
|
||||
// assertion below has intermittent failures on slow W2K box w/out sleep
|
||||
Thread.sleep(10);
|
||||
// trigger change in dir 1
|
||||
assertFileEventCreated(File.createTempFile(getName(), ".tmp", subdir1));
|
||||
monitor.removeWatch(subdir1);
|
||||
}
|
||||
finally {
|
||||
delete(subdir1);
|
||||
delete(subdir2);
|
||||
}
|
||||
}
|
||||
|
||||
private void assertFileEventCreated(final File expectedFile)
|
||||
throws InterruptedException {
|
||||
|
||||
final FileEvent actualEvent = waitForFileEvent(FileMonitor.FILE_CREATED);
|
||||
|
||||
assertNotNull("No creation event: " + events, actualEvent);
|
||||
assertEquals("Wrong target file for event", expectedFile, actualEvent.getFile());
|
||||
events.clear();
|
||||
}
|
||||
|
||||
private FileEvent waitForFileEvent(final int expectedFileEvent)
|
||||
throws InterruptedException {
|
||||
|
||||
final Integer expectedFileEventInteger = new Integer(expectedFileEvent);
|
||||
|
||||
FileEvent actualEvent = (FileEvent)events.get(expectedFileEventInteger);
|
||||
final long start = System.currentTimeMillis();
|
||||
while (System.currentTimeMillis() - start < 5000 && actualEvent == null) {
|
||||
Thread.sleep(10);
|
||||
actualEvent = (FileEvent) events.get(expectedFileEventInteger);
|
||||
}
|
||||
|
||||
assertTrue("No events sent", events.size() != 0);
|
||||
return actualEvent;
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
junit.textui.TestRunner.run(FileMonitorTest.class);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
/* Copyright (c) 2008 Timothy Wall, All Rights Reserved
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*/
|
||||
package com.sun.jna.examples;
|
||||
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.Shape;
|
||||
import java.awt.geom.Area;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.image.Raster;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import com.sun.jna.examples.RasterRangesUtils.RangesOutput;
|
||||
|
||||
public class RasterRangesUtilsTest extends TestCase {
|
||||
|
||||
Set rects = new HashSet();
|
||||
|
||||
RangesOutput out = new RangesOutput() {
|
||||
public boolean outputRange(int x, int y, int w, int h) {
|
||||
rects.add(new Rectangle(x, y, w, h));
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
private Raster createRaster(Shape mask) {
|
||||
BufferedImage image = new BufferedImage(100, 100, BufferedImage.TYPE_INT_ARGB);
|
||||
Graphics2D g = image.createGraphics();
|
||||
g.fill(mask);
|
||||
g.dispose();
|
||||
return image.getRaster();
|
||||
}
|
||||
|
||||
public void testDecomposeRectangles() {
|
||||
Set EXPECTED = new HashSet() {
|
||||
{
|
||||
add(new Rectangle(0, 0, 100, 50));
|
||||
add(new Rectangle(0, 50, 50, 50));
|
||||
}
|
||||
};
|
||||
|
||||
Area mask = new Area(new Rectangle(0, 0, 100, 100));
|
||||
mask.subtract(new Area(new Rectangle(50, 50, 50, 50)));
|
||||
RasterRangesUtils.outputOccupiedRanges(createRaster(mask), out);
|
||||
|
||||
assertEquals("Wrong number of rectangles", EXPECTED.size(), rects.size());
|
||||
assertEquals("Wrong rectangles", EXPECTED, rects);
|
||||
}
|
||||
|
||||
public void testDecomposeRectanglesWithHole() {
|
||||
Set EXPECTED = new HashSet() {
|
||||
{
|
||||
add(new Rectangle(0, 0, 100, 25));
|
||||
add(new Rectangle(0, 25, 25, 50));
|
||||
add(new Rectangle(75, 25, 25, 50));
|
||||
add(new Rectangle(0, 75, 100, 25));
|
||||
}
|
||||
};
|
||||
|
||||
Area mask = new Area(new Rectangle(0, 0, 100, 100));
|
||||
mask.subtract(new Area(new Rectangle(25, 25, 50, 50)));
|
||||
RasterRangesUtils.outputOccupiedRanges(createRaster(mask), out);
|
||||
|
||||
assertEquals("Wrong number of rectangles", EXPECTED.size(), rects.size());
|
||||
assertEquals("Wrong rectangles", EXPECTED, rects);
|
||||
|
||||
/*
|
||||
long start = System.currentTimeMillis();
|
||||
for (int i=0;i < 100;i++) {
|
||||
RasterRangesUtils.outputOccupiedRanges(createRaster(mask), out);
|
||||
}
|
||||
System.out.println("raster: " + (System.currentTimeMillis()-start));
|
||||
*/
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
junit.textui.TestRunner.run(RasterRangesUtilsTest.class);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2007 Timothy Wall, All Rights Reserved
|
||||
/* Copyright (c) 2007-2008 Timothy Wall, All Rights Reserved
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -12,29 +12,38 @@
|
||||
*/
|
||||
package com.sun.jna.examples;
|
||||
|
||||
import java.awt.AlphaComposite;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Container;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Frame;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.GraphicsConfiguration;
|
||||
import java.awt.GraphicsEnvironment;
|
||||
import java.awt.Insets;
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.Robot;
|
||||
import java.awt.Shape;
|
||||
import java.awt.Window;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.geom.Area;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.Arrays;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JWindow;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.event.MouseInputAdapter;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.image.*;
|
||||
import com.sun.jna.Platform;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
@@ -92,6 +101,77 @@ public class WindowUtilsTest extends TestCase {
|
||||
private static final int Y = 100;
|
||||
private static final int W = 100;
|
||||
private static final int H = 100;
|
||||
|
||||
public void xtestReveal() throws Exception {
|
||||
final int SIZE = 200;
|
||||
System.setProperty("sun.java2d.noddraw", "true");
|
||||
GraphicsConfiguration gconfig =
|
||||
WindowUtils.getAlphaCompatibleGraphicsConfiguration();
|
||||
Window w;
|
||||
Container content;
|
||||
if (true) {
|
||||
JFrame frame = new JFrame(getName(), gconfig);
|
||||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
content = frame.getContentPane();
|
||||
w = frame;
|
||||
}
|
||||
else {
|
||||
Frame frame = JOptionPane.getRootFrame();
|
||||
JWindow window = new JWindow(frame, gconfig);
|
||||
content = window.getContentPane();
|
||||
w = window;
|
||||
}
|
||||
final Window f = w;
|
||||
WindowUtils.setWindowTransparent(f, true);
|
||||
content.add(new JButton("Quit") {
|
||||
{
|
||||
addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
System.exit(0);
|
||||
}
|
||||
});
|
||||
}
|
||||
}, BorderLayout.SOUTH);
|
||||
content.add(new JComponent() {
|
||||
public Dimension getPreferredSize() {
|
||||
return new Dimension(SIZE, SIZE);
|
||||
}
|
||||
protected void paintComponent(Graphics graphics) {
|
||||
Graphics2D g = (Graphics2D)graphics.create();
|
||||
g.setComposite(AlphaComposite.Clear);
|
||||
g.fillRect(0,0,SIZE,SIZE);
|
||||
g.dispose();
|
||||
|
||||
g = (Graphics2D)graphics.create();
|
||||
Color[] colors = {
|
||||
new Color(0,0,0),
|
||||
new Color(0,0,0,128),
|
||||
new Color(128,128,128),
|
||||
new Color(128,128,128,128),
|
||||
new Color(255,255,255),
|
||||
new Color(255,255,255,128),
|
||||
};
|
||||
for (int i=0;i < colors.length;i++) {
|
||||
g.setColor(colors[i]);
|
||||
g.fillRect((SIZE * i)/colors.length, 0,
|
||||
(SIZE + colors.length-1)/colors.length, SIZE);
|
||||
}
|
||||
g.setColor(Color.red);
|
||||
g.drawRect(0, 0, SIZE-1, SIZE-1);
|
||||
g.dispose();
|
||||
SwingUtilities.getWindowAncestor(this).toFront();
|
||||
}
|
||||
});
|
||||
f.pack();
|
||||
f.addMouseListener(handler);
|
||||
f.addMouseMotionListener(handler);
|
||||
f.setLocation(100, 100);
|
||||
f.setVisible(true);
|
||||
while (f.isVisible()) {
|
||||
Thread.sleep(1000);
|
||||
//f.repaint();
|
||||
}
|
||||
}
|
||||
|
||||
// Expect failure on windows and x11, since transparent pixels are not
|
||||
// properly captured by java.awt.Robot
|
||||
@@ -260,6 +340,80 @@ public class WindowUtilsTest extends TestCase {
|
||||
}
|
||||
}
|
||||
|
||||
public void testDisposeHeavyweightForcer() throws Exception {
|
||||
if (GraphicsEnvironment.isHeadless())
|
||||
return;
|
||||
// Forcer not required on OSX
|
||||
if (Platform.isMac())
|
||||
return;
|
||||
|
||||
Frame root = JOptionPane.getRootFrame();
|
||||
final JWindow w = new JWindow(root);
|
||||
w.getContentPane().add(new JLabel(getName()));
|
||||
final Rectangle mask = new Rectangle(0, 0, 10, 10);
|
||||
SwingUtilities.invokeAndWait(new Runnable() {
|
||||
public void run() {
|
||||
w.pack();
|
||||
WindowUtils.setWindowMask(w, mask);
|
||||
w.setVisible(true);
|
||||
}
|
||||
});
|
||||
try {
|
||||
Window[] owned = w.getOwnedWindows();
|
||||
WeakReference ref = null;
|
||||
for (int i = 0; i < owned.length; i++) {
|
||||
if (owned[i].getClass().getName().indexOf("Heavy") != -1) {
|
||||
ref = new WeakReference(owned[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
owned = null;
|
||||
assertNotNull("Forcer not found", ref);
|
||||
SwingUtilities.invokeAndWait(new Runnable() {
|
||||
public void run() {
|
||||
WindowUtils.setWindowMask(w, WindowUtils.MASK_NONE);
|
||||
}
|
||||
});
|
||||
System.gc();
|
||||
long start = System.currentTimeMillis();
|
||||
while (ref.get() != null) {
|
||||
Thread.sleep(10);
|
||||
System.gc();
|
||||
if (System.currentTimeMillis() - start > 5000)
|
||||
fail("Timed out waiting for forcer to be GC'd");
|
||||
}
|
||||
assertNull("Forcer not GC'd", ref.get());
|
||||
} finally {
|
||||
w.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
// Test for accumulation of windows with repetitive setting of mask
|
||||
public void xtestWindowDisposeBug() throws Exception {
|
||||
final JFrame w = new JFrame(getName());
|
||||
w.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
w.getContentPane().add(new JLabel(getName()));
|
||||
|
||||
WindowUtils.setWindowMask(w, new Area(new Rectangle(600, 20)));
|
||||
w.pack();
|
||||
// small window, no bug. big window, bug.
|
||||
w.setSize(600, 600);
|
||||
w.setResizable(false);
|
||||
w.setVisible(true);
|
||||
final Shape mask = new Rectangle(0, 0, w.getWidth(), w.getHeight());
|
||||
while (true) {
|
||||
System.gc();
|
||||
Thread.sleep(50);
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
WindowUtils.setWindowMask(w, mask);
|
||||
Window[] owned = w.getOwnedWindows();
|
||||
System.err.println(owned.length + ": " + Arrays.asList(w.getOwnedWindows()));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
junit.textui.TestRunner.run(WindowUtilsTest.class);
|
||||
}
|
||||
|
||||
@@ -15,21 +15,29 @@ package com.sun.jna.examples.win32;
|
||||
import java.util.Calendar;
|
||||
import java.util.TimeZone;
|
||||
import junit.framework.TestCase;
|
||||
import com.sun.jna.Platform;
|
||||
|
||||
public class Kernel32Test extends TestCase {
|
||||
|
||||
public void testGetDriveType() {
|
||||
if (!Platform.isWindows()) return;
|
||||
|
||||
Kernel32 kernel = Kernel32.INSTANCE;
|
||||
assertEquals("Wrong drive type.", Kernel32.DRIVE_FIXED, kernel.GetDriveType("c:"));
|
||||
}
|
||||
|
||||
public void testStructureOutArgument() {
|
||||
Kernel32 kernel = Kernel32.INSTANCE;
|
||||
Kernel32.SYSTEMTIME time = new Kernel32.SYSTEMTIME();
|
||||
kernel.GetSystemTime(time);
|
||||
Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
|
||||
assertEquals("Hour not properly set",
|
||||
cal.get(Calendar.HOUR_OF_DAY), time.wHour);
|
||||
assertEquals("Day not properly set",
|
||||
cal.get(Calendar.DAY_OF_WEEK)-1,
|
||||
time.wDayOfWeek);
|
||||
assertEquals("Hour not properly set",
|
||||
cal.get(Calendar.HOUR_OF_DAY), time.wHour);
|
||||
assertEquals("Day not properly set",
|
||||
cal.get(Calendar.DAY_OF_WEEK)-1,
|
||||
time.wDayOfWeek);
|
||||
assertEquals("Year not properly set",
|
||||
cal.get(Calendar.YEAR), time.wYear);
|
||||
cal.get(Calendar.YEAR), time.wYear);
|
||||
}
|
||||
|
||||
public void testGetLastError() {
|
||||
@@ -40,10 +48,10 @@ public class Kernel32Test extends TestCase {
|
||||
int code = kernel.GetLastError();
|
||||
assertEquals("Wrong error value after SetLastError", ERRCODE, code);
|
||||
|
||||
if (kernel.GetProcessId(null) == 0) {
|
||||
final int INVALID_HANDLE = 6;
|
||||
if (kernel.GetProcessVersion(-1) == 0) {
|
||||
final int INVALID_PARAMETER = 87;
|
||||
code = kernel.GetLastError();
|
||||
assertEquals("Wrong error value after failed syscall", INVALID_HANDLE, code);
|
||||
assertEquals("Wrong error value after failed syscall", INVALID_PARAMETER, code);
|
||||
}
|
||||
else {
|
||||
fail("GetProcessId(NULL) should fail");
|
||||
|
||||
@@ -17,6 +17,7 @@ import java.util.HashMap;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import com.sun.jna.FunctionMapper;
|
||||
import com.sun.jna.Library;
|
||||
import com.sun.jna.Native;
|
||||
import com.sun.jna.NativeLibrary;
|
||||
@@ -65,18 +66,31 @@ public class W32StdCallTest extends TestCase {
|
||||
}
|
||||
|
||||
public void testFunctionMapper() throws Exception {
|
||||
FunctionMapper mapper = StdCallLibrary.FUNCTION_MAPPER;
|
||||
NativeLibrary lib = NativeLibrary.getInstance("testlib");
|
||||
Method m = TestLibrary.class.getMethod("returnInt32ArgumentStdCall", new Class[] { int.class });
|
||||
assertEquals("Function mapper should provide decorated name",
|
||||
"returnInt32ArgumentStdCall@" + Native.getNativeSize(int.class),
|
||||
StdCallLibrary.FUNCTION_MAPPER.getFunctionName(lib, m));
|
||||
|
||||
Class type = TestLibrary.TestStructure.ByValue.class;
|
||||
m = TestLibrary.class.getMethod("returnStructureByValueArgumentStdCall",
|
||||
new Class[] { type });
|
||||
assertEquals("Function mapper should provide decorated name for by-value structs",
|
||||
"returnStructureByValueArgumentStdCall@" + Native.getNativeSize(type),
|
||||
StdCallLibrary.FUNCTION_MAPPER.getFunctionName(lib, m));
|
||||
|
||||
Method[] methods = {
|
||||
TestLibrary.class.getMethod("returnInt32ArgumentStdCall",
|
||||
new Class[] { int.class }),
|
||||
TestLibrary.class.getMethod("returnStructureByValueArgumentStdCall",
|
||||
new Class[] {
|
||||
TestLibrary.TestStructure.ByValue.class
|
||||
}),
|
||||
TestLibrary.class.getMethod("callInt32StdCallCallback",
|
||||
new Class[] {
|
||||
TestLibrary.Int32Callback.class,
|
||||
int.class, int.class,
|
||||
}),
|
||||
};
|
||||
|
||||
for (int i=0;i < methods.length;i++) {
|
||||
String name = mapper.getFunctionName(lib, methods[i]);
|
||||
assertTrue("Function name not decorated for method "
|
||||
+ methods[i].getName()
|
||||
+ ": " + name, name.indexOf("@") != -1);
|
||||
assertEquals("Wrong name in mapped function",
|
||||
name, lib.getFunction(name, StdCallLibrary.STDCALL_CONVENTION).getName());
|
||||
}
|
||||
}
|
||||
|
||||
public void testStdCallReturnInt32Argument() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generic JNLP/Web Start Configuration -->
|
||||
<jnlp spec="1.0" codebase="http://abbot.sf.net/demo" href="http://jna.dev.java.net/demo/BalloonManagerDemo.jnlp">
|
||||
<jnlp spec="1.0" codebase="http://abbot.sf.net/demo" href="https://jna.dev.java.net/demo/BalloonManagerDemo.jnlp">
|
||||
<information>
|
||||
<title>Balloon Manager Demo</title>
|
||||
<vendor>Java Native Access (JNA)</vendor>
|
||||
@@ -23,6 +23,28 @@
|
||||
<property name="jna.library.path" value="/usr/X11R6/lib:/usr/lib32:/usr/lib"/>
|
||||
<nativelib href="linux-i386.jar"/>
|
||||
</resources>
|
||||
<resources os="Linux" arch="amd64">
|
||||
<property name="jna.library.path" value="/usr/X11R6/lib:/usr/lib"/>
|
||||
<nativelib href="linux-amd64.jar"/>
|
||||
</resources>
|
||||
<resources os="FreeBSD" arch="i386">
|
||||
<nativelib href="freebsd-i386.jar"/>
|
||||
</resources>
|
||||
<resources os="FreeBSD" arch="amd64">
|
||||
<nativelib href="freebsd-amd64.jar"/>
|
||||
</resources>
|
||||
<resources os="SunOS" arch="x86">
|
||||
<nativelib href="sunos-x86.jar"/>
|
||||
</resources>
|
||||
<resources os="SunOS" arch="amd64">
|
||||
<nativelib href="sunos-amd64.jar"/>
|
||||
</resources>
|
||||
<resources os="SunOS" arch="sparc">
|
||||
<nativelib href="sunos-sparc.jar"/>
|
||||
</resources>
|
||||
<resources os="SunOS" arch="sparcv9">
|
||||
<nativelib href="sunos-sparcv9.jar"/>
|
||||
</resources>
|
||||
<resources os="Mac">
|
||||
<nativelib href="darwin.jar"/>
|
||||
</resources>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generic JNLP/Web Start Configuration -->
|
||||
<jnlp spec="1.0" codebase="http://abbot.sf.net/demo" href="http://jna.dev.java.net/demo/ShapedWindowDemo.jnlp">
|
||||
<jnlp spec="1.0" codebase="http://abbot.sf.net/demo" href="https://jna.dev.java.net/demo/ShapedWindowDemo.jnlp">
|
||||
<information>
|
||||
<title>Shaped Window Demo</title>
|
||||
<vendor>Java Native Access (JNA)</vendor>
|
||||
@@ -23,6 +23,28 @@
|
||||
<property name="jna.library.path" value="/usr/X11R6/lib:/usr/lib32:/usr/lib"/>
|
||||
<nativelib href="linux-i386.jar"/>
|
||||
</resources>
|
||||
<resources os="Linux" arch="amd64">
|
||||
<property name="jna.library.path" value="/usr/X11R6/lib:/usr/lib"/>
|
||||
<nativelib href="linux-amd64.jar"/>
|
||||
</resources>
|
||||
<resources os="FreeBSD" arch="i386">
|
||||
<nativelib href="freebsd-i386.jar"/>
|
||||
</resources>
|
||||
<resources os="FreeBSD" arch="amd64">
|
||||
<nativelib href="freebsd-amd64.jar"/>
|
||||
</resources>
|
||||
<resources os="SunOS" arch="x86">
|
||||
<nativelib href="sunos-x86.jar"/>
|
||||
</resources>
|
||||
<resources os="SunOS" arch="amd64">
|
||||
<nativelib href="sunos-amd64.jar"/>
|
||||
</resources>
|
||||
<resources os="SunOS" arch="sparc">
|
||||
<nativelib href="sunos-sparc.jar"/>
|
||||
</resources>
|
||||
<resources os="SunOS" arch="sparcv9">
|
||||
<nativelib href="sunos-sparcv9.jar"/>
|
||||
</resources>
|
||||
<resources os="Mac">
|
||||
<nativelib href="darwin.jar"/>
|
||||
</resources>
|
||||
|
||||
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
|
Depois Largura: | Altura: | Tamanho: 2.7 KiB |
+155
-41
@@ -3,11 +3,33 @@
|
||||
<meta name="author" content="Timothy Wall">
|
||||
<meta name="keywords" content="java,jna,jni,c,c++,native,method,function,call,ctypes,ffi,foreign function interface,jdirect,jinvoke,pinvoke,platform invoke,native library access,native access,call native from java,java c library,easy jni,call c from java,avoid jni,jni alternative,jni replacement,legacy,call from java">
|
||||
<meta name="description" content="Java Native Access (JNA): access native libraries with pure Java code.">
|
||||
<meta name="date" content="2007-12-08">
|
||||
<meta name="date" content="2008-08-08">
|
||||
<title>Java Native Access (JNA): Pure Java access to native libraries</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
<div style="display:none">
|
||||
<div style="border: 1px solid black; padding: 1em; float: right; font-size: 1.5em; background-color: rgb(255, 255, 240);" id="downloadBox">
|
||||
<a href="/servlets/ProjectDocumentList" class=dynamic>
|
||||
<img src="folder.png" style="vertical-align: middle;" border="0">Download
|
||||
</a>
|
||||
<center>
|
||||
<a href="https://jna.dev.java.net/source/browse/*checkout*/jna/trunk/jnalib/release-notes.html"
|
||||
style="font-size:0.5em" class=dynamic>(release notes)</a>
|
||||
|
||||
</center>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var box = document.getElementById("projecthome");
|
||||
var div = document.getElementById("downloadBox");
|
||||
box.insertBefore(div,box.firstChild);
|
||||
</script>
|
||||
|
||||
|
||||
<table rows=1 cols=3>
|
||||
<colgroup span=1 width=0*>
|
||||
<colgroup span=1>
|
||||
@@ -18,6 +40,7 @@
|
||||
<li><a href="#features">Features</a>
|
||||
<li><a href="#demos">Demos</a>
|
||||
<li><a href="#community">Community</a>
|
||||
<li><a href="#support">Support</a>
|
||||
<li><a href="#projects">Projects</a>
|
||||
<li><a href="#development">Development</a>
|
||||
<li><a href="#building">Building</a>
|
||||
@@ -48,7 +71,7 @@ JNA provides Java programs easy access to native shared libraries (DLLs on Windo
|
||||
</tr>
|
||||
</table>
|
||||
<hr>
|
||||
The <a href="javadoc/overview-summary.html">JavaDoc is available online</a>,
|
||||
The <a href="http://jna.dev.java.net/nonav/javadoc/index.html">JavaDoc is available online</a>,
|
||||
which includes detailed descriptions of JNA usage in different situations.<p>
|
||||
This library is provided under the <a href="http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html">LGPL</a>, version 2.1 or later.
|
||||
<p>
|
||||
@@ -58,26 +81,25 @@ This library is provided under the <a href="http://www.gnu.org/licenses/old-lice
|
||||
<a name=features></a>
|
||||
<h3>Features</h3>
|
||||
<ul>
|
||||
<li>Most platforms supported
|
||||
<li>Automatic mapping from Java interface to native function
|
||||
<li>8-, 16-, 32, and 64-bit basic data types
|
||||
<li>Automatic mapping from Java interface method to native function, with simple mappings for all primitive data types
|
||||
<li>Runs on <a href="#building">most platforms which support Java</a>
|
||||
<li>Automatic conversion between C and Java strings, with customizable encoding/decoding
|
||||
<li><a href="javadoc/com/sun/jna/Structure.html">Structure</a> and <a href="javadoc/com/sun/jna/Union.html">Union</a> arguments/return values, by reference and by value
|
||||
<li>Automatic conversion between C and Java strings
|
||||
<li>Function pointers (callbacks from native code to Java code) as arguments and/or members of a <code>struct</code>
|
||||
<li>Function Pointers, (callbacks from native code to Java) as arguments and/or members of a <code>struct</code>
|
||||
<li>Auto-generated Java proxies for native function pointers
|
||||
<li>By-reference (pointer-to-type) arguments
|
||||
<li>Java array and NIO <code>Buffer</code> arguments (primitive types and pointers) as pointer-to-buffer
|
||||
<li>Nested structures and arrays
|
||||
<li><code>wchar_t</code>-based strings
|
||||
<li>Wide (<code>wchar_t</code>-based) strings
|
||||
<li><a href="javadoc/com/sun/jna/NativeLong.html">Native <code>long</code></a> support (32- or 64-bit as appropriate)
|
||||
<li><a href="#demos">Full-blown demo applications</a>
|
||||
<li>Supported on 1.4 or later JVMs (earlier VMs may work with stubbed NIO support)
|
||||
<li>Customizable marshalling/unmarshalling (argument and return value conversions)
|
||||
<li>Customizable mapping from Java method to native function name
|
||||
<li>Customizable mapping from Java method to native function name, and customizable invocation to simulate C preprocessor function macros
|
||||
<li>Support for automatic Windows ASCII/UNICODE function mappings
|
||||
<li>Auto-generated proxies for native function pointers in structs
|
||||
<li>Varargs support
|
||||
<li>Optional <a href="javadoc/com/sun/jna/PointerType.html">type-safety for native pointers</a>
|
||||
<li>Optional <a href="javadoc/com/sun/jna/Native.html#setProtected(boolean)">VM crash protection</a>
|
||||
<li><a href="javadoc/com/sun/jna/PointerType.html">Type-safety for native pointers</a>
|
||||
<li><a href="javadoc/com/sun/jna/Native.html#setProtected(boolean)">VM crash protection</a> (optional)
|
||||
</ul>
|
||||
<p>
|
||||
|
||||
@@ -87,33 +109,67 @@ This library is provided under the <a href="http://www.gnu.org/licenses/old-lice
|
||||
<p>Java Native Access (JNA) has a single component, <code>jna.jar</code>; the supporting native library (<code>jnidispatch</code>) is included in the jar file. JNA is capable of extracting and loading the native library on its own, so you don't need additional configuration. JNA falls back to extraction if the native library is not already installed on the local system somewhere accessible to <code>System.loadLibrary</code> (see <a href="javadoc/com/sun/jna/Native.html#library_loading">information on library loading</a>). The native library is also available in platform-specific jar files for use with Java Web Start.</p>
|
||||
<ol>
|
||||
<li>Download <code>jna.jar</code> from the <a href="https://jna.dev.java.net/servlets/ProjectDocumentList?folderID=7408&expandFolder=7408&folderID=0">download page</a>.</li>
|
||||
<li>Identify a native <em>target library</em> that you want to use. This can be any shared library with exported functions. A good example is the local C library (libc.so on linux or msvcrt.dll on windows).</li>
|
||||
<li>Compile and run this short example, which maps the <code>printf</code> function from the standard C library and calls it. Be sure to include jna.jar in the classpath:<br>
|
||||
<textarea name="textarea" cols="80" rows="24" readonly="readonly">
|
||||
package com.sun.jna.examples;
|
||||
|
||||
import com.sun.jna.Library;
|
||||
import com.sun.jna.Native;
|
||||
import com.sun.jna.Platform;
|
||||
|
||||
/** Simple example of native library declaration and usage. */
|
||||
public class HelloWorld {
|
||||
|
||||
public interface CLibrary extends Library {
|
||||
CLibrary INSTANCE = (CLibrary)
|
||||
Native.loadLibrary((Platform.isWindows() ? "msvcrt" : "c"),
|
||||
CLibrary.class);
|
||||
|
||||
void printf(String format, Object... args);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
CLibrary.INSTANCE.printf("Hello, World\n");
|
||||
for (int i=0;i < args.length;i++) {
|
||||
CLibrary.INSTANCE.printf("Argument %d: %s\n", i, args[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
</textarea>
|
||||
<li>Identify a native <em>target library</em> that you want to use. This can be any shared library with exported functions. Some examples of mappings for common system libraries may be found in the <a href="https://jna.dev.java.net/source/browse/jna/trunk/jnalib/src/com/sun/jna/examples/unix?rev=HEAD">unix</a> and <a href="https://jna.dev.java.net/source/browse/jna/trunk/jnalib/src/com/sun/jna/examples/win32?rev=HEAD">win32</a> examples subdirectories.</li>
|
||||
<li>Make your target library available to your Java program. There are two ways to do this:
|
||||
<ul>
|
||||
<li>The preferred method is to set the <code>jna.library.path</code> system property to the path to your target library. This property is similar to <code>java.library.path</code> but only applies to libraries loaded by JNA.</li>
|
||||
<li>Change the appropriate library access environment variable. This is PATH on Windows, LD_LIBRARY_PATH on Linux, and DYLD_LIBRARY_PATH on OSX.</li>
|
||||
<li>Change the appropriate library access environment variable before launching the VM. This is PATH on Windows, LD_LIBRARY_PATH on Linux, and DYLD_LIBRARY_PATH on OSX.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Declare a Java interface to hold the native library methods by extending the <a href="javadoc/com/sun/jna/Library.html"><code>Library</code></a> interface. Following is an example of mapping for the Windows kernel32 library.<br>
|
||||
<textarea name="textarea" cols="80" rows="8" readonly="readonly">
|
||||
<li>Declare a Java interface to hold the native library methods by extending the <a href="javadoc/com/sun/jna/Library.html"><code>Library</code></a> interface.
|
||||
|
||||
Following is an example of mapping for the Windows kernel32 library.<br>
|
||||
<textarea name="textarea" cols="80" rows="10" readonly="readonly">
|
||||
package com.sun.jna.examples.win32;
|
||||
|
||||
import com.sun.jna.*;
|
||||
|
||||
// kernel32.dll uses the __stdcall calling convention
|
||||
// Most C libraries will just extend com.sun.jna.Library
|
||||
// kernel32.dll uses the __stdcall calling convention (check the function
|
||||
// declaration for "WINAPI"), so extend StdCallLibrary
|
||||
// Most C libraries will just extend com.sun.jna.Library,
|
||||
public interface Kernel32 extends StdCallLibrary {
|
||||
// Method declarations, constant and structure definitions go here
|
||||
}</textarea>
|
||||
</li>
|
||||
<li>In your interface, allocate an instance of the native library using the <code>Native.loadLibrary(Class)</code> method, providing the native library interface you defined in step (4).<br>
|
||||
<textarea name="textarea" cols="80" rows="2" readonly="readonly">
|
||||
<li>Within this interface, define an instance of the native library using the <code>Native.loadLibrary(Class)</code> method, providing the native library interface you defined in step (5).<br>
|
||||
<textarea name="textarea" cols="80" rows="6" readonly="readonly">
|
||||
Kernel32 INSTANCE = (Kernel32)
|
||||
Native.loadLibrary("kernel32", Kernel32.class);
|
||||
// Optional: wraps every call to the native library in a
|
||||
// synchronized block, limiting native calls to one at a time
|
||||
Kernel32 SYNC_INSTANCE = (Kernel32)
|
||||
Native.synchronizedLibrary(INSTANCE);
|
||||
</textarea><br>
|
||||
This instance is for convenient reuse. Alternatively, you can load the library into a local variable so that it will be available for garbage collection when it goes out of scope. A <code>Map</code> of options may be provided as the third argument to customize the library behavior; some of these options are explained in more detail below.
|
||||
The INSTANCE variable is for convenient reuse of a single instance of the library. Alternatively, you can load the library into a local variable so that it will be available for garbage collection when it goes out of scope. A <code>Map</code> of options may be provided as the third argument to <code>loadLibrary</code> to customize the library behavior; some of these options are explained in more detail below.
|
||||
</li>
|
||||
<li>Declare methods that mirror the functions in the target library by defining Java methods with the same name and argument types as the native function (refer to the <a href="#mapping">basic mappings</a> below or <a href="javadoc/overview-summary.html#marshalling">the detailed table of type mappings</a>). You may also need to declare native structures to pass to your native functions. To do this, create a class that extends <a href="javadoc/com/sun/jna/Structure.html"><code>Structure</code></a> and add public fields (which may include arrays or nested structures).</li>
|
||||
<li>Declare methods that mirror the functions in the target library by defining Java methods with the same name and argument types as the native function (refer to the <a href="#mapping">basic mappings</a> below or <a href="javadoc/overview-summary.html#marshalling">the detailed table of type mappings</a>). You may also need to declare native structures to pass to your native functions. To do this, create a class within the interface definition that extends <a href="javadoc/com/sun/jna/Structure.html"><code>Structure</code></a> and add public fields (which may include arrays or nested structures).</li>
|
||||
<textarea name="textarea" cols="80" rows="12" readonly="readonly">
|
||||
public static class SYSTEMTIME extends Structure {
|
||||
public short wYear;
|
||||
@@ -153,14 +209,12 @@ Java primitive types (and their object equivalents) map directly to the native C
|
||||
<tr><td>wchar_t</td><td>16/32-bit character</td><td>char</td><td>TCHAR</td>
|
||||
<tr><td>int</td><td>32-bit integer</td><td>int</td><td>DWORD</td>
|
||||
<tr><td>int</td><td>boolean value</td><td>boolean</td><td>BOOL</td>
|
||||
<tr><td>long</td><td>32/64-bit integer</td><td>NativeLong</td><td></td>
|
||||
<tr><td>long</td><td>32/64-bit integer</td><td>NativeLong</td><td>LONG</td>
|
||||
<tr><td>long long</td><td>64-bit integer</td><td>long</td><td></td>
|
||||
<tr><td>float</td><td>32-bit FP</td><td>float</td><td></td>
|
||||
<tr><td>double</td><td>64-bit FP</td><td>double</td><td></td>
|
||||
<tr><td>char*</td><td>C string</td><td>String</td><td>LPTCSTR</td>
|
||||
<tr><td>void*</td><td>pointer</td><td>Pointer</td><td>LPVOID, HANDLE</td>
|
||||
<tr><td>size_t</td><td>address size</td><td>IntegerType(Pointer.SIZE)</td><td></td>
|
||||
<tr><td>off_t</td><td>address offset</td><td>IntegerType(Pointer.SIZE)</td><td></td>
|
||||
<tr><td>void*</td><td>pointer</td><td>Pointer</td><td>LPVOID, HANDLE, LP<i>XXX</i></td>
|
||||
</table></blockquote>
|
||||
Unsigned types use the same mappings as signed types. A full list of mappings may be found <a href="javadoc/overview-summary.html#marshalling">here</a>.
|
||||
<p>
|
||||
@@ -189,7 +243,7 @@ Arrays of C strings (the <code>char* argv[]</code> to the C <code>main</code>, f
|
||||
When a function requires a pointer to a <code>struct</code>, a Java <a href="javadoc/com/sun/jna/Structure.html">Structure</a> should be used. If the <code>struct</code> is passed or returned by value, you need only make <a href="javadoc/overview-summary.html#byvalue">minor modifications</a> to the parameter or return type class declaration.<p>
|
||||
Typically you define a <code>public static</code> class derived from <code>Structure</code> within your library interface definition. This allows the structure to share any options (like custom type mapping) defined for the library interface.
|
||||
<p>
|
||||
If a function requires an array of <code>struct</code>, a Java <code>Structure[]</code> may be used. When passing in an array of <code>Structure</code>, it is not necessary to initialize the array elements (the function call will allocate, zero memory, and assign the elements for you). If you <em>do</em> need to initialize the array, you should use the <code>Structure.toArray</code> method to obtain an array of <code>Structure</code> elements contiguous in memory, which you can then initialize as needed.
|
||||
If a function requires an array of <code>struct</code> (allocated contiguously in memory), a Java <code>Structure[]</code> may be used. When passing in an array of <code>Structure</code>, it is not necessary to initialize the array elements (the function call will allocate, zero memory, and assign the elements for you). If you <em>do</em> need to initialize the array, you should use the <code>Structure.toArray</code> method to obtain an array of <code>Structure</code> elements contiguous in memory, which you can then initialize as needed.
|
||||
<p>
|
||||
Unions are generally interchangeable with <code>Structure</code>s, but require that you indicate which union field is active with the <code>setType</code> method before it can be properly passed to a function call.
|
||||
<p>
|
||||
@@ -341,19 +395,39 @@ Libc.fclose(fp)
|
||||
<a name=faq></a>
|
||||
<h3>Frequently Asked Questions (FAQ)</h3>
|
||||
<ul>
|
||||
<li><a href="#char_buffer">How do I read back a string?</a>
|
||||
<li><a href="#native_long">How do I map a native <code>long</code> type?</a>
|
||||
<li><a href="#w32link">My library mapping causes an UnsatisfiedLinkError</a>
|
||||
<li><a href="#crash">My library sometimes causes a VM crash</a>
|
||||
<li><a href="#w32crash">My Windows library mapping causes a VM crash on every call</a>
|
||||
<li><a href="#ptr_values">How do I get an arbitrary Pointer value?</a>
|
||||
<li><a href="#struct_debug">My structure has the wrong contents. What did I do wrong?</a>
|
||||
<li><a href="#j2me">Does JNA work with J2ME/Windows Mobile?</a>
|
||||
<li><a href="#performance">How does JNA performance compared to custom JNI?</a>
|
||||
</ul>
|
||||
<a name=char_buffer></a>
|
||||
<h4>How do I read back a function's string result?</h4>
|
||||
Suppose you have a function:<br>
|
||||
<blockquote><code><pre>
|
||||
// Returns the number of characters written to the buffer
|
||||
int getString(char* buffer, int bufsize);
|
||||
</pre></code></blockquote>
|
||||
The native code is expecting a fixed-size buffer, which it will fill in with the requested data. A Java <code>String</code> is not appropriate here, since <code>String</code>s are immutable. Nor is a Java <code>StringBuffer</code>, since the native code only fills the buffer and does not change its size. The appropriate argument type would be either <code>byte[]</code>, <code>Memory</code>, or an NIO <code>Buffer</code>, with the size of the object passed as the second argument. The method <a href="javadoc/com/sun/jna/Native#toString(byte[])">Native.toString(byte[])</a> may then be used to convert the array of byte into a Java <code>String</code>.
|
||||
|
||||
<a name=native_long></a>
|
||||
<h4>How do I map a native <code>long</code> type?</h4>
|
||||
Actually, no one ever asks this question, but they <em>really</em> need the answer. <font color='red'><em>Do not</em> use Java <code>long</code>!</font><p>
|
||||
|
||||
On Windows, you can use a Java <code>int</code>, since the native <code>long</code> type is always 32 bits. On any other platform, the type may be 32 or 64 bits, so you should use the <a href="javadoc/com/sun/jna/NativeLong.html">NativeLong</a> type to ensure the proper size is used.
|
||||
|
||||
|
||||
<a name=w32link></a>
|
||||
<h4>My library mapping causes an UnsatisfiedLinkError</h4>
|
||||
Use a dump utility to examine the names of your exported functions to make sure they match (<a href=http://linux.die.net/man/1/nm>nm</a> on linux, <a href=http://www.dependencywalker.com>depends</a> on Windows). On Windows, if the functions have a suffix of the form "@NN", you need to pass a StdCallFunctionMapper as an option when initializing your library interface (<a href="#stdcallmapper">see here</a>). In general, you can use a function mapper (<a href="javadoc/com/sun/jna/FunctionMapper.html">FunctionMapper</a>) to change the name of the looked-up method, or an invocation mapper (<a href="javadoc/com/sun/jna/InvocationMapper.html">InvocationMapper</a>) for more extensive control over the method invocation.
|
||||
|
||||
<a name=crash></a>
|
||||
<h4>My library sometimes causes a VM crash</h4>
|
||||
Double check the signature of the method causing the crash to ensure all arguments are of the appropriate size and type. Be especially careful with native pointer variations.
|
||||
Double check the signature of the method causing the crash to ensure all arguments are of the appropriate size and type. Be especially careful with native pointer variations. See also <a href="#struct_debug">information on debugging structure definitions</a>.
|
||||
|
||||
<a name=w32crash></a>
|
||||
<h4>My Windows library mapping causes a VM crash on every call</h4>
|
||||
@@ -364,7 +438,7 @@ If your library uses the <code>stdcall</code> calling convention, your interface
|
||||
First, you probably don't actually want an <em>arbitrary</em> value. Ask yourself what you're really trying to do. Remember, type safety is your friend.
|
||||
<ul>
|
||||
<li>Pointer.createConstant() should be used when you need a special value that is not really a pointer (NULL usually serves this purpose, but some C programmers like to check pointers for special integer values instead). The Pointer produced by this function can't actually be used to access memory.
|
||||
<li>Pointer#share() can be used to generate a new Pointer as an offset from an existing one
|
||||
<li>Pointer.share() can be used to generate a new Pointer as an offset from an existing one
|
||||
<li>java.nio.Buffer can be used to wrap a Java array with a different offset and length than the original.
|
||||
<li>Clean up the sloppy C code by declaring an appropriate function interface. If your function in C takes either a Pointer or an integer type, simply declare both method signatures in your JNA interface. They will both invoke the same function, but you get the added benefit of type checking on the arguments.
|
||||
</ul>
|
||||
@@ -372,12 +446,40 @@ If you <em>really</em>, <em>really</em>, <em>HAVE</em> to convert an integer
|
||||
value into a Pointer, you can do something like this:<br>
|
||||
<code>new IntByReference(value).getPointer().getPointer(0)</code>
|
||||
|
||||
<a name=struct_debug></a>
|
||||
<h4>Debugging Structure Definitions</h4>
|
||||
Normally when you invoke <code>toString</code> on a <code>Structure</code>, it will print each defined field with its calculated memory offset. If when launching the VM, you pass it "-Djna.dump_memory=true", <code>toString</code> will also dump the contents of the corresponding native memory. This is useful to determine if you've added or omitted a field, or chosen an incorrect size. Viewing the memory as bytes usually makes it clear where field boundaries should be, assuming the memory has been initialized by native code.
|
||||
|
||||
<a name=j2me></a>
|
||||
<h4>Does JNA work with J2ME/Windows Mobile?</h4>
|
||||
JNA requires Java 1.4 (or greater) and uses (but does not depend on) NIO buffers. A stub NIO buffer implementation may be provided and things should otherwise Just Work.<p>
|
||||
Windows Mobile is supported by libffi (mingwce) but JNA has not yet been (publicly) built for that target. Nothing technically should prevent it, though.
|
||||
<p>
|
||||
|
||||
<a name=performance></a>
|
||||
<h4>How does JNA performance compare to custom JNI?</h4>
|
||||
<p>
|
||||
A simple test calling a function like <code>int testfunc(int)</code> with JNA
|
||||
might take an order of magnitude (~10X) greater time than equivalent custom
|
||||
JNI (whether it actually does in the context of your application is a
|
||||
different question).
|
||||
This magnitude is typical of the difference between systems using
|
||||
dynamically-maintained type information and systems where type information is
|
||||
statically compiled. JNI hard-codes type information in the method
|
||||
invocation, where JNA dynamically determines type information at runtime.
|
||||
<p>
|
||||
You might expect a speedup of about an order of magnitude moving to custom JNI,
|
||||
but the actual difference will vary depending on usage and function
|
||||
signatures. As with any optimization process, you should determine
|
||||
first <em>where</em> you need a speed increase, and then see how much
|
||||
difference there is by performing targeted optimizations. The ease of
|
||||
programming everything in Java usually outweighs performance gains when using
|
||||
custom JNI.
|
||||
<p>
|
||||
Java primitive arrays are generally slower to use than memory
|
||||
(Pointer, Memory, or ByReference) or NIO buffers, since the Java memory has to
|
||||
be pinned and possibly copied across the native call, since the Java array is not necessarily contiguously allocated.
|
||||
<p>
|
||||
<a href=#top>Top</a>
|
||||
<a name=demos></a>
|
||||
<h3>Examples</h3>
|
||||
@@ -396,7 +498,7 @@ the JNA library (and are pretty nifty utilities in and of themselves).
|
||||
<a href=#top>Top</a>
|
||||
<a name=community></a>
|
||||
<h3>Community</h3>
|
||||
<p>Please use the appropriate <a href="https://jna.dev.java.net/servlets/ProjectMailingListList">mailing list</a> to ask for help, suggest ideas, contribute patches, etc. All contributions are welcome.</p>
|
||||
<p>Please use the appropriate <a href="https://jna.dev.java.net/servlets/ProjectMailingListList">mailing list</a> to ask for help, suggest ideas, contribute patches, etc. All contributions are welcome. When asking about how to do a library mapping, be sure to include C API definitions and example usage, as well as whatever Java mapping you've already tried.</p>
|
||||
<p>All mailing lists are also available via RSS:
|
||||
<ul>
|
||||
<li><a href="https://jna.dev.java.net/servlets/MailingListRSS?listName=announce"><img src=https://jna.dev.java.net/branding/images/rss.gif></img> Announcements</a>
|
||||
@@ -406,20 +508,31 @@ the JNA library (and are pretty nifty utilities in and of themselves).
|
||||
</ul>
|
||||
<p>
|
||||
|
||||
<a href=#top>Top</a>
|
||||
<a name=support></a>
|
||||
<h3>Support</h3>
|
||||
If you are interested in paid support, feel free to say so on one of the JNA mailing lists. Most simple questions will be answered on the list, but more complicated work, new features or target platforms can be negotiated with any of the JNA developers (this is how several of JNA's features came into being). You may even encounter other users with the same need and be able to cost share the new development.
|
||||
<p>
|
||||
|
||||
<a href=#top>Top</a>
|
||||
<a name=projects></a>
|
||||
<h3>Projects Using JNA</h3>
|
||||
<ul>
|
||||
<li><a href="http://jruby.codehaus.org">JRuby</a> (Charles Nutter)
|
||||
<li><a href="http://rococoa.dev.java.net">Rococoa</a> Java bindings to the Mac OS X Cocoa framework.
|
||||
<li><a href="http://fmj.sf.net">Freedom for Media in Java (FMJ)</a> (Ken Larson/Dieter Krachtus)
|
||||
<li><a href="http://code.google.com/p/gstreamer-java">gstreamer for Java</a> (Wayne Meissner)
|
||||
<li><a href="http://trac.videolan.org/jvlc/">Videolan</a> JVLC Java Multimedia Library
|
||||
<li><a href="http://svnkit.com">SVNKit</a> pure Java Subversion client library.
|
||||
<li><a href="http://omegat.sf.net">OmegaT Computer-Aided Translation</a>, which makes use of the <a href="http://hunspell.sf.net">hunspell spell checker</a>.
|
||||
<li><a href="http://jetbrains.com">IntelliJ IDEA</a> (JetBrains)
|
||||
<li><a href="http://netbeans.org">NetBeans IDE</a>
|
||||
<li><a href="http://epirsch.blogspot.com/2008/02/jna-love-nxt.html">Drive Lego Mindstorm NXT</a> (Emmanuel Pirsch)
|
||||
<li><a href="https://jna.dev.java.net/source/browse/jna/trunk/jnalib/contrib">Miscellaneous contributed mappings and utilities</a> (including Windows NT Service, Registry, and User Account libraries).
|
||||
<li><a href="http://jruby.codehaus.org">JRuby</a> (Charles Nutter)
|
||||
<li><a href="http://sellmic.com/blog/2007/05/22/javafx-clock-update-now-with-transparency">A JavaFX Clock</a> (Augusto Sellhorn)
|
||||
<li><a href="http://ochafik.free.fr/blog/?p=98">Detect User Inactivity</a> (Olivier Chafik)
|
||||
<li><a href="http://fmj.sf.net">Freedom for Media in Java (FMJ)</a> (Ken Larson/Dieter Krachtus)
|
||||
<li><a href="http://code.google.com/p/gstreamer-java">gstreamer for Java</a> (Wayne Meissner)
|
||||
<li><a href="http://glossitope.org">Glossitope (AKA ab5k)</a> (Josh Marinacci)
|
||||
<li><a href="http://www.athenabackup.com">Athena Backup</a> (Doug Patriarche)
|
||||
<li><a href="https://launchpad.net/libusb4j">USB for Java</a> (Mario Boikov)
|
||||
</ul>
|
||||
Post to users AT jna DOT dev DOT java DOT net to include your project in this list, or if you'd like to contribute a library mapping you've written.
|
||||
<p>
|
||||
@@ -429,6 +542,7 @@ the JNA library (and are pretty nifty utilities in and of themselves).
|
||||
<h3>Development Tasks</h3>
|
||||
<p>The library works fairly well now, but there are a number of tasks with which we'd appreciate help:</p>
|
||||
<ul>
|
||||
<li>Create a transformer using SWIG or something else that already parses C headers to auto-generate JNA interface definitions.
|
||||
<li>Build the <code>jnidispatch</code> library backend on new platforms (it should mostly work out of the box if we can just get access to the appropriate build platform).</li>
|
||||
<li>More comprehensive documentation on using JNA, including examples of Java to native conversions of data types, function usage, and proper memory management.</li>
|
||||
<li>Tips and recommended usage of JNA: Likely danger areas, failure modes, best practices, multithreading, etc.</li>
|
||||
@@ -440,11 +554,11 @@ the JNA library (and are pretty nifty utilities in and of themselves).
|
||||
<a href=#top>Top</a>
|
||||
<a name=building></a>
|
||||
<h3>Building and Multi-platform support</h3>
|
||||
JNA has been built and tested on OSX (PPC and x86), linux (x86, amd64),
|
||||
FreeBSD, SunOS (x86, sparc, sparcv9) and Windows (x86). The ant build
|
||||
script's test target will build and run the test suite, which has decent
|
||||
coverage and is a quick way to determine if your environment is set up
|
||||
correctly.<p>
|
||||
JNA has been built and tested on OSX (ppc, x86, x86_64), linux (x86, amd64),
|
||||
FreeBSD (x86, amd64), SunOS (x86, amd64, sparc, sparcv9) and Windows (x86).
|
||||
The ant build script's test target will build and run the test suite, which
|
||||
has decent coverage and is a quick way to determine if your environment is set
|
||||
up correctly.<p>
|
||||
If you want to do a build yourself, you'll need <a
|
||||
href="http://ant.apache.org">ANT</a>, <a
|
||||
href="http://directory.fsf.org/make.html">GNU make</a> and <a
|
||||
@@ -456,7 +570,7 @@ library and chokes on the libffi includes). To rebuild <code>jna.jar</code>, an
|
||||
% ant dist test
|
||||
</pre></code></blockquote>
|
||||
<p>
|
||||
If JNA has not yet been built on for your platform, you may need to tweak the build.xml and native/Makefile build configurations so that your platform is recognized.
|
||||
If JNA has not yet been built on for your platform, you may need to tweak the build.xml and native/Makefile build configurations so that your platform is recognized.
|
||||
<p>
|
||||
The project also includes <a href="http://netbeans.org">NetBeans</a> and <a href="http://www.eclipse.org">Eclipse</a> project configurations, if you're so inclined.<p>
|
||||
|
||||
@@ -464,7 +578,7 @@ The project also includes <a href="http://netbeans.org">NetBeans</a> and <a href
|
||||
<a name=history></a>
|
||||
<h3>History</h3>
|
||||
<p>Fragments of this project date back to a small shared stubs library originally written by Sheng Liang of the Sun JNI team and demoed at JavaOne circa 1999. <p>
|
||||
Todd Fast (also of Sun) first published JNA on dev.java.net in the fall of 2006 (that code is still available in the SVN repo under the <a href="https://jna.dev.java.net/svn/jna/tags/CVS%20HEAD">CVS HEAD</a> tag). From the original project announcement:
|
||||
Todd Fast (also of Sun) first published JNA on dev.java.net in the fall of 2006, which allowed calls with primitive type parameters and partial struct support (that code is still available in the SVN repo under the <a href="https://jna.dev.java.net/svn/jna/tags/CVS%20HEAD">CVS HEAD</a> tag). From the original project announcement:
|
||||
<blockquote><pre>
|
||||
Headline Initial JNA code checked in
|
||||
Date Nov 30, 2006
|
||||
|
||||
Arquivo executável → Arquivo normal
+351
-327
@@ -1,327 +1,351 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<!--NewPage-->
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>
|
||||
All Classes (JNA API)
|
||||
</TITLE>
|
||||
|
||||
|
||||
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
|
||||
|
||||
|
||||
</HEAD>
|
||||
|
||||
<BODY BGCOLOR="white">
|
||||
<FONT size="+1" CLASS="FrameHeadingFont">
|
||||
<B>All Classes</B></FONT>
|
||||
<BR>
|
||||
|
||||
<TABLE BORDER="0" WIDTH="100%" SUMMARY="">
|
||||
<TR>
|
||||
<TD NOWRAP><FONT CLASS="FrameItemFont"><A HREF="com/sun/jna/examples/AlphaMaskDemo.html" title="class in com.sun.jna.examples" target="classFrame">AlphaMaskDemo</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/AlphaMaskDemo2.html" title="class in com.sun.jna.examples" target="classFrame">AlphaMaskDemo2</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/AltCallingConvention.html" title="interface in com.sun.jna" target="classFrame"><I>AltCallingConvention</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/BalloonManager.html" title="class in com.sun.jna.examples" target="classFrame">BalloonManager</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/BalloonManagerDemo.html" title="class in com.sun.jna.examples" target="classFrame">BalloonManagerDemo</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/ptr/ByReference.html" title="class in com.sun.jna.ptr" target="classFrame">ByReference</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/ptr/ByteByReference.html" title="class in com.sun.jna.ptr" target="classFrame">ByteByReference</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/Callback.html" title="interface in com.sun.jna" target="classFrame"><I>Callback</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/CallbackParameterContext.html" title="class in com.sun.jna" target="classFrame">CallbackParameterContext</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/CallbackProxy.html" title="interface in com.sun.jna" target="classFrame"><I>CallbackProxy</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/CallbackReference.html" title="class in com.sun.jna" target="classFrame">CallbackReference</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/CallbackResultContext.html" title="class in com.sun.jna" target="classFrame">CallbackResultContext</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/CLibrary.html" title="interface in com.sun.jna.examples" target="classFrame"><I>CLibrary</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/DefaultTypeMapper.html" title="class in com.sun.jna" target="classFrame">DefaultTypeMapper</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/ptr/DoubleByReference.html" title="class in com.sun.jna.ptr" target="classFrame">DoubleByReference</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/dnd/DragHandler.html" title="class in com.sun.jna.examples.dnd" target="classFrame">DragHandler</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/dnd/DropHandler.html" title="class in com.sun.jna.examples.dnd" target="classFrame">DropHandler</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/dnd/DropTargetPainter.html" title="interface in com.sun.jna.examples.dnd" target="classFrame"><I>DropTargetPainter</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/FileMonitor.html" title="class in com.sun.jna.examples" target="classFrame">FileMonitor</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/FileMonitor.FileListener.html" title="interface in com.sun.jna.examples" target="classFrame"><I>FileMonitor.FileListener</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/FileUtils.html" title="class in com.sun.jna.examples" target="classFrame">FileUtils</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/ptr/FloatByReference.html" title="class in com.sun.jna.ptr" target="classFrame">FloatByReference</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/FromNativeContext.html" title="class in com.sun.jna" target="classFrame">FromNativeContext</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/FromNativeConverter.html" title="interface in com.sun.jna" target="classFrame"><I>FromNativeConverter</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/Function.html" title="class in com.sun.jna" target="classFrame">Function</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/FunctionMapper.html" title="interface in com.sun.jna" target="classFrame"><I>FunctionMapper</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/FunctionParameterContext.html" title="class in com.sun.jna" target="classFrame">FunctionParameterContext</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/FunctionResultContext.html" title="class in com.sun.jna" target="classFrame">FunctionResultContext</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/GDI32.html" title="interface in com.sun.jna.examples.win32" target="classFrame"><I>GDI32</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/GDI32.BITMAPINFO.html" title="class in com.sun.jna.examples.win32" target="classFrame">GDI32.BITMAPINFO</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/GDI32.BITMAPINFOHEADER.html" title="class in com.sun.jna.examples.win32" target="classFrame">GDI32.BITMAPINFOHEADER</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/GDI32.RECT.html" title="class in com.sun.jna.examples.win32" target="classFrame">GDI32.RECT</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/GDI32.RGBQUAD.html" title="class in com.sun.jna.examples.win32" target="classFrame">GDI32.RGBQUAD</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/GDI32.RGNDATA.html" title="class in com.sun.jna.examples.win32" target="classFrame">GDI32.RGNDATA</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/GDI32.RGNDATAHEADER.html" title="class in com.sun.jna.examples.win32" target="classFrame">GDI32.RGNDATAHEADER</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/dnd/GhostedDragImage.html" title="class in com.sun.jna.examples.dnd" target="classFrame">GhostedDragImage</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/dnd/GhostedDragImageDemo.html" title="class in com.sun.jna.examples.dnd" target="classFrame">GhostedDragImageDemo</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/dnd/GhostedDragImageDemo.DragLabel.html" title="class in com.sun.jna.examples.dnd" target="classFrame">GhostedDragImageDemo.DragLabel</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/dnd/GhostedDragImageDemo.ImageSelection.html" title="class in com.sun.jna.examples.dnd" target="classFrame">GhostedDragImageDemo.ImageSelection</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/ptr/IntByReference.html" title="class in com.sun.jna.ptr" target="classFrame">IntByReference</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/IntegerType.html" title="class in com.sun.jna" target="classFrame">IntegerType</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/InvocationMapper.html" title="interface in com.sun.jna" target="classFrame"><I>InvocationMapper</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/Kernel32.html" title="interface in com.sun.jna.examples.win32" target="classFrame"><I>Kernel32</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/Kernel32.FILE_NOTIFY_INFORMATION.html" title="class in com.sun.jna.examples.win32" target="classFrame">Kernel32.FILE_NOTIFY_INFORMATION</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/Kernel32.OVERLAPPED.html" title="class in com.sun.jna.examples.win32" target="classFrame">Kernel32.OVERLAPPED</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/Kernel32.OVERLAPPED_COMPLETION_ROUTINE.html" title="interface in com.sun.jna.examples.win32" target="classFrame"><I>Kernel32.OVERLAPPED_COMPLETION_ROUTINE</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/Kernel32.SECURITY_ATTRIBUTES.html" title="class in com.sun.jna.examples.win32" target="classFrame">Kernel32.SECURITY_ATTRIBUTES</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/Kernel32.SYSTEMTIME.html" title="class in com.sun.jna.examples.win32" target="classFrame">Kernel32.SYSTEMTIME</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/KeyboardUtils.html" title="class in com.sun.jna.examples" target="classFrame">KeyboardUtils</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/Library.html" title="interface in com.sun.jna" target="classFrame"><I>Library</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/Library.Handler.html" title="class in com.sun.jna" target="classFrame">Library.Handler</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/ptr/LongByReference.html" title="class in com.sun.jna.ptr" target="classFrame">LongByReference</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/Memory.html" title="class in com.sun.jna" target="classFrame">Memory</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/MethodParameterContext.html" title="class in com.sun.jna" target="classFrame">MethodParameterContext</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/MethodResultContext.html" title="class in com.sun.jna" target="classFrame">MethodResultContext</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/Native.html" title="class in com.sun.jna" target="classFrame">Native</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/Native.W32Cleanup.html" title="class in com.sun.jna" target="classFrame">Native.W32Cleanup</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/NativeLibrary.html" title="class in com.sun.jna" target="classFrame">NativeLibrary</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/NativeLong.html" title="class in com.sun.jna" target="classFrame">NativeLong</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/ptr/NativeLongByReference.html" title="class in com.sun.jna.ptr" target="classFrame">NativeLongByReference</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/NativeMapped.html" title="interface in com.sun.jna" target="classFrame"><I>NativeMapped</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/NativeMappedConverter.html" title="class in com.sun.jna" target="classFrame">NativeMappedConverter</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/NativeString.html" title="class in com.sun.jna" target="classFrame">NativeString</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/Platform.html" title="class in com.sun.jna" target="classFrame">Platform</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/Pointer.html" title="class in com.sun.jna" target="classFrame">Pointer</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/ptr/PointerByReference.html" title="class in com.sun.jna.ptr" target="classFrame">PointerByReference</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/PointerType.html" title="class in com.sun.jna" target="classFrame">PointerType</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/RasterRangesUtils.html" title="class in com.sun.jna.examples" target="classFrame">RasterRangesUtils</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/RasterRangesUtils.RangesOutput.html" title="interface in com.sun.jna.examples" target="classFrame"><I>RasterRangesUtils.RangesOutput</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/ShapedWindowDemo.html" title="class in com.sun.jna.examples" target="classFrame">ShapedWindowDemo</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/Shell32.html" title="interface in com.sun.jna.examples.win32" target="classFrame"><I>Shell32</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/Shell32.SHFILEOPSTRUCT.html" title="class in com.sun.jna.examples.win32" target="classFrame">Shell32.SHFILEOPSTRUCT</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/ptr/ShortByReference.html" title="class in com.sun.jna.ptr" target="classFrame">ShortByReference</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/win32/StdCall.html" title="interface in com.sun.jna.win32" target="classFrame"><I>StdCall</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/win32/StdCallFunctionMapper.html" title="class in com.sun.jna.win32" target="classFrame">StdCallFunctionMapper</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/win32/StdCallLibrary.html" title="interface in com.sun.jna.win32" target="classFrame"><I>StdCallLibrary</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/win32/StdCallLibrary.StdCallCallback.html" title="interface in com.sun.jna.win32" target="classFrame"><I>StdCallLibrary.StdCallCallback</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/StringArray.html" title="class in com.sun.jna" target="classFrame">StringArray</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/Structure.html" title="class in com.sun.jna" target="classFrame">Structure</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/Structure.ByReference.html" title="interface in com.sun.jna" target="classFrame"><I>Structure.ByReference</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/Structure.ByValue.html" title="interface in com.sun.jna" target="classFrame"><I>Structure.ByValue</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/StructureReadContext.html" title="class in com.sun.jna" target="classFrame">StructureReadContext</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/StructureWriteContext.html" title="class in com.sun.jna" target="classFrame">StructureWriteContext</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/ToNativeContext.html" title="class in com.sun.jna" target="classFrame">ToNativeContext</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/ToNativeConverter.html" title="interface in com.sun.jna" target="classFrame"><I>ToNativeConverter</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/TypeConverter.html" title="interface in com.sun.jna" target="classFrame"><I>TypeConverter</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/TypeMapper.html" title="interface in com.sun.jna" target="classFrame"><I>TypeMapper</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/Union.html" title="class in com.sun.jna" target="classFrame">Union</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/User32.html" title="interface in com.sun.jna.examples.win32" target="classFrame"><I>User32</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/User32.BLENDFUNCTION.html" title="class in com.sun.jna.examples.win32" target="classFrame">User32.BLENDFUNCTION</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/User32.FLASHWINFO.html" title="class in com.sun.jna.examples.win32" target="classFrame">User32.FLASHWINFO</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/User32.GUITHREADINFO.html" title="class in com.sun.jna.examples.win32" target="classFrame">User32.GUITHREADINFO</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/User32.HHOOK.html" title="class in com.sun.jna.examples.win32" target="classFrame">User32.HHOOK</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/User32.HOOKPROC.html" title="interface in com.sun.jna.examples.win32" target="classFrame"><I>User32.HOOKPROC</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/User32.KBDLLHOOKSTRUCT.html" title="class in com.sun.jna.examples.win32" target="classFrame">User32.KBDLLHOOKSTRUCT</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/User32.LowLevelKeyboardProc.html" title="interface in com.sun.jna.examples.win32" target="classFrame"><I>User32.LowLevelKeyboardProc</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/User32.MSG.html" title="class in com.sun.jna.examples.win32" target="classFrame">User32.MSG</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/User32.POINT.html" title="class in com.sun.jna.examples.win32" target="classFrame">User32.POINT</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/User32.SIZE.html" title="class in com.sun.jna.examples.win32" target="classFrame">User32.SIZE</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/User32.WINDOWINFO.html" title="class in com.sun.jna.examples.win32" target="classFrame">User32.WINDOWINFO</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/User32.WNDENUMPROC.html" title="interface in com.sun.jna.examples.win32" target="classFrame"><I>User32.WNDENUMPROC</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.html" title="interface in com.sun.jna.examples.win32" target="classFrame"><I>W32API</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.HANDLE.html" title="class in com.sun.jna.examples.win32" target="classFrame">W32API.HANDLE</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.HANDLEByReference.html" title="class in com.sun.jna.examples.win32" target="classFrame">W32API.HANDLEByReference</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.HBITMAP.html" title="class in com.sun.jna.examples.win32" target="classFrame">W32API.HBITMAP</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.HDC.html" title="class in com.sun.jna.examples.win32" target="classFrame">W32API.HDC</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.HICON.html" title="class in com.sun.jna.examples.win32" target="classFrame">W32API.HICON</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.HINSTANCE.html" title="class in com.sun.jna.examples.win32" target="classFrame">W32API.HINSTANCE</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.HMODULE.html" title="class in com.sun.jna.examples.win32" target="classFrame">W32API.HMODULE</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.HRGN.html" title="class in com.sun.jna.examples.win32" target="classFrame">W32API.HRGN</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.HWND.html" title="class in com.sun.jna.examples.win32" target="classFrame">W32API.HWND</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.LONG_PTR.html" title="class in com.sun.jna.examples.win32" target="classFrame">W32API.LONG_PTR</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.LPARAM.html" title="class in com.sun.jna.examples.win32" target="classFrame">W32API.LPARAM</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.LRESULT.html" title="class in com.sun.jna.examples.win32" target="classFrame">W32API.LRESULT</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.SIZE_T.html" title="class in com.sun.jna.examples.win32" target="classFrame">W32API.SIZE_T</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.SSIZE_T.html" title="class in com.sun.jna.examples.win32" target="classFrame">W32API.SSIZE_T</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.UINT_PTR.html" title="class in com.sun.jna.examples.win32" target="classFrame">W32API.UINT_PTR</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.ULONG_PTR.html" title="class in com.sun.jna.examples.win32" target="classFrame">W32API.ULONG_PTR</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.WPARAM.html" title="class in com.sun.jna.examples.win32" target="classFrame">W32API.WPARAM</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/win32/W32APIFunctionMapper.html" title="class in com.sun.jna.win32" target="classFrame">W32APIFunctionMapper</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/win32/W32APITypeMapper.html" title="class in com.sun.jna.win32" target="classFrame">W32APITypeMapper</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32Errors.html" title="interface in com.sun.jna.examples.win32" target="classFrame"><I>W32Errors</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/WindowUtils.html" title="class in com.sun.jna.examples" target="classFrame">WindowUtils</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/WindowUtils.NativeWindowUtils.html" title="class in com.sun.jna.examples" target="classFrame">WindowUtils.NativeWindowUtils</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/WString.html" title="class in com.sun.jna" target="classFrame">WString</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.html" title="interface in com.sun.jna.examples.unix" target="classFrame"><I>X11</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.Atom.html" title="class in com.sun.jna.examples.unix" target="classFrame">X11.Atom</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.AtomByReference.html" title="class in com.sun.jna.examples.unix" target="classFrame">X11.AtomByReference</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.Colormap.html" title="class in com.sun.jna.examples.unix" target="classFrame">X11.Colormap</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.Cursor.html" title="class in com.sun.jna.examples.unix" target="classFrame">X11.Cursor</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.Display.html" title="class in com.sun.jna.examples.unix" target="classFrame">X11.Display</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.Drawable.html" title="class in com.sun.jna.examples.unix" target="classFrame">X11.Drawable</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.GC.html" title="class in com.sun.jna.examples.unix" target="classFrame">X11.GC</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.Pixmap.html" title="class in com.sun.jna.examples.unix" target="classFrame">X11.Pixmap</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.Screen.html" title="class in com.sun.jna.examples.unix" target="classFrame">X11.Screen</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.Visual.html" title="class in com.sun.jna.examples.unix" target="classFrame">X11.Visual</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.Window.html" title="class in com.sun.jna.examples.unix" target="classFrame">X11.Window</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.WindowByReference.html" title="class in com.sun.jna.examples.unix" target="classFrame">X11.WindowByReference</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.Xext.html" title="interface in com.sun.jna.examples.unix" target="classFrame"><I>X11.Xext</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.XID.html" title="class in com.sun.jna.examples.unix" target="classFrame">X11.XID</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.Xrender.html" title="interface in com.sun.jna.examples.unix" target="classFrame"><I>X11.Xrender</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.Xrender.XRenderDirectFormat.html" title="class in com.sun.jna.examples.unix" target="classFrame">X11.Xrender.XRenderDirectFormat</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.Xrender.XRenderPictFormat.html" title="class in com.sun.jna.examples.unix" target="classFrame">X11.Xrender.XRenderPictFormat</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.XSetWindowAttributes.html" title="class in com.sun.jna.examples.unix" target="classFrame">X11.XSetWindowAttributes</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.XSizeHints.html" title="class in com.sun.jna.examples.unix" target="classFrame">X11.XSizeHints</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.XTextProperty.html" title="class in com.sun.jna.examples.unix" target="classFrame">X11.XTextProperty</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.XVisualInfo.html" title="class in com.sun.jna.examples.unix" target="classFrame">X11.XVisualInfo</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.XWindowAttributes.html" title="class in com.sun.jna.examples.unix" target="classFrame">X11.XWindowAttributes</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.XWMHints.html" title="class in com.sun.jna.examples.unix" target="classFrame">X11.XWMHints</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/X11AlphaMaskTest.html" title="class in com.sun.jna.examples" target="classFrame">X11AlphaMaskTest</A>
|
||||
<BR>
|
||||
</FONT></TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<!--NewPage-->
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>
|
||||
All Classes (JNA API)
|
||||
</TITLE>
|
||||
|
||||
|
||||
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
|
||||
|
||||
|
||||
</HEAD>
|
||||
|
||||
<BODY BGCOLOR="white">
|
||||
<FONT size="+1" CLASS="FrameHeadingFont">
|
||||
<B>All Classes</B></FONT>
|
||||
<BR>
|
||||
|
||||
<TABLE BORDER="0" WIDTH="100%" SUMMARY="">
|
||||
<TR>
|
||||
<TD NOWRAP><FONT CLASS="FrameItemFont"><A HREF="com/sun/jna/examples/AlphaMaskDemo.html" title="class in com.sun.jna.examples" target="classFrame">AlphaMaskDemo</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/AlphaMaskDemo2.html" title="class in com.sun.jna.examples" target="classFrame">AlphaMaskDemo2</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/AltCallingConvention.html" title="interface in com.sun.jna" target="classFrame"><I>AltCallingConvention</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/BalloonManager.html" title="class in com.sun.jna.examples" target="classFrame">BalloonManager</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/BalloonManagerDemo.html" title="class in com.sun.jna.examples" target="classFrame">BalloonManagerDemo</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/ptr/ByReference.html" title="class in com.sun.jna.ptr" target="classFrame">ByReference</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/ptr/ByteByReference.html" title="class in com.sun.jna.ptr" target="classFrame">ByteByReference</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/Callback.html" title="interface in com.sun.jna" target="classFrame"><I>Callback</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/CallbackParameterContext.html" title="class in com.sun.jna" target="classFrame">CallbackParameterContext</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/CallbackProxy.html" title="interface in com.sun.jna" target="classFrame"><I>CallbackProxy</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/CallbackReference.html" title="class in com.sun.jna" target="classFrame">CallbackReference</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/CallbackResultContext.html" title="class in com.sun.jna" target="classFrame">CallbackResultContext</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/CLibrary.html" title="interface in com.sun.jna.examples" target="classFrame"><I>CLibrary</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/DefaultTypeMapper.html" title="class in com.sun.jna" target="classFrame">DefaultTypeMapper</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/ptr/DoubleByReference.html" title="class in com.sun.jna.ptr" target="classFrame">DoubleByReference</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/dnd/DragHandler.html" title="class in com.sun.jna.examples.dnd" target="classFrame">DragHandler</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/dnd/DropHandler.html" title="class in com.sun.jna.examples.dnd" target="classFrame">DropHandler</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/dnd/DropTargetPainter.html" title="interface in com.sun.jna.examples.dnd" target="classFrame"><I>DropTargetPainter</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/FileMonitor.html" title="class in com.sun.jna.examples" target="classFrame">FileMonitor</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/FileMonitor.FileListener.html" title="interface in com.sun.jna.examples" target="classFrame"><I>FileMonitor.FileListener</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/FileUtils.html" title="class in com.sun.jna.examples" target="classFrame">FileUtils</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/ptr/FloatByReference.html" title="class in com.sun.jna.ptr" target="classFrame">FloatByReference</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/FromNativeContext.html" title="class in com.sun.jna" target="classFrame">FromNativeContext</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/FromNativeConverter.html" title="interface in com.sun.jna" target="classFrame"><I>FromNativeConverter</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/Function.html" title="class in com.sun.jna" target="classFrame">Function</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/Function.PostCallRead.html" title="interface in com.sun.jna" target="classFrame"><I>Function.PostCallRead</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/FunctionMapper.html" title="interface in com.sun.jna" target="classFrame"><I>FunctionMapper</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/FunctionParameterContext.html" title="class in com.sun.jna" target="classFrame">FunctionParameterContext</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/FunctionResultContext.html" title="class in com.sun.jna" target="classFrame">FunctionResultContext</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/GDI32.html" title="interface in com.sun.jna.examples.win32" target="classFrame"><I>GDI32</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/GDI32.BITMAPINFO.html" title="class in com.sun.jna.examples.win32" target="classFrame">GDI32.BITMAPINFO</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/GDI32.BITMAPINFOHEADER.html" title="class in com.sun.jna.examples.win32" target="classFrame">GDI32.BITMAPINFOHEADER</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/GDI32.RECT.html" title="class in com.sun.jna.examples.win32" target="classFrame">GDI32.RECT</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/GDI32.RGBQUAD.html" title="class in com.sun.jna.examples.win32" target="classFrame">GDI32.RGBQUAD</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/GDI32.RGNDATA.html" title="class in com.sun.jna.examples.win32" target="classFrame">GDI32.RGNDATA</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/GDI32.RGNDATAHEADER.html" title="class in com.sun.jna.examples.win32" target="classFrame">GDI32.RGNDATAHEADER</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/dnd/GhostedDragImage.html" title="class in com.sun.jna.examples.dnd" target="classFrame">GhostedDragImage</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/dnd/GhostedDragImageDemo.html" title="class in com.sun.jna.examples.dnd" target="classFrame">GhostedDragImageDemo</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/dnd/GhostedDragImageDemo.DragLabel.html" title="class in com.sun.jna.examples.dnd" target="classFrame">GhostedDragImageDemo.DragLabel</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/dnd/GhostedDragImageDemo.ImageSelection.html" title="class in com.sun.jna.examples.dnd" target="classFrame">GhostedDragImageDemo.ImageSelection</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/ptr/IntByReference.html" title="class in com.sun.jna.ptr" target="classFrame">IntByReference</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/IntegerType.html" title="class in com.sun.jna" target="classFrame">IntegerType</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/InvocationMapper.html" title="interface in com.sun.jna" target="classFrame"><I>InvocationMapper</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/Kernel32.html" title="interface in com.sun.jna.examples.win32" target="classFrame"><I>Kernel32</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/Kernel32.FILE_NOTIFY_INFORMATION.html" title="class in com.sun.jna.examples.win32" target="classFrame">Kernel32.FILE_NOTIFY_INFORMATION</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/Kernel32.OVERLAPPED.html" title="class in com.sun.jna.examples.win32" target="classFrame">Kernel32.OVERLAPPED</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/Kernel32.OVERLAPPED_COMPLETION_ROUTINE.html" title="interface in com.sun.jna.examples.win32" target="classFrame"><I>Kernel32.OVERLAPPED_COMPLETION_ROUTINE</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/Kernel32.SECURITY_ATTRIBUTES.html" title="class in com.sun.jna.examples.win32" target="classFrame">Kernel32.SECURITY_ATTRIBUTES</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/Kernel32.SYSTEMTIME.html" title="class in com.sun.jna.examples.win32" target="classFrame">Kernel32.SYSTEMTIME</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/KeyboardUtils.html" title="class in com.sun.jna.examples" target="classFrame">KeyboardUtils</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/Library.html" title="interface in com.sun.jna" target="classFrame"><I>Library</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/Library.Handler.html" title="class in com.sun.jna" target="classFrame">Library.Handler</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/ptr/LongByReference.html" title="class in com.sun.jna.ptr" target="classFrame">LongByReference</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/Memory.html" title="class in com.sun.jna" target="classFrame">Memory</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/MethodParameterContext.html" title="class in com.sun.jna" target="classFrame">MethodParameterContext</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/MethodResultContext.html" title="class in com.sun.jna" target="classFrame">MethodResultContext</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/Native.html" title="class in com.sun.jna" target="classFrame">Native</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/Native.DeleteNativeLibrary.html" title="class in com.sun.jna" target="classFrame">Native.DeleteNativeLibrary</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/NativeLibrary.html" title="class in com.sun.jna" target="classFrame">NativeLibrary</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/NativeLong.html" title="class in com.sun.jna" target="classFrame">NativeLong</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/ptr/NativeLongByReference.html" title="class in com.sun.jna.ptr" target="classFrame">NativeLongByReference</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/NativeMapped.html" title="interface in com.sun.jna" target="classFrame"><I>NativeMapped</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/NativeMappedConverter.html" title="class in com.sun.jna" target="classFrame">NativeMappedConverter</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/NativeString.html" title="class in com.sun.jna" target="classFrame">NativeString</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/Platform.html" title="class in com.sun.jna" target="classFrame">Platform</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/Pointer.html" title="class in com.sun.jna" target="classFrame">Pointer</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/ptr/PointerByReference.html" title="class in com.sun.jna.ptr" target="classFrame">PointerByReference</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/PointerType.html" title="class in com.sun.jna" target="classFrame">PointerType</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/RasterRangesUtils.html" title="class in com.sun.jna.examples" target="classFrame">RasterRangesUtils</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/RasterRangesUtils.RangesOutput.html" title="interface in com.sun.jna.examples" target="classFrame"><I>RasterRangesUtils.RangesOutput</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/ShapedWindowDemo.html" title="class in com.sun.jna.examples" target="classFrame">ShapedWindowDemo</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/Shell32.html" title="interface in com.sun.jna.examples.win32" target="classFrame"><I>Shell32</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/Shell32.SHFILEOPSTRUCT.html" title="class in com.sun.jna.examples.win32" target="classFrame">Shell32.SHFILEOPSTRUCT</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/ptr/ShortByReference.html" title="class in com.sun.jna.ptr" target="classFrame">ShortByReference</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/win32/StdCall.html" title="interface in com.sun.jna.win32" target="classFrame"><I>StdCall</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/win32/StdCallFunctionMapper.html" title="class in com.sun.jna.win32" target="classFrame">StdCallFunctionMapper</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/win32/StdCallLibrary.html" title="interface in com.sun.jna.win32" target="classFrame"><I>StdCallLibrary</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/win32/StdCallLibrary.StdCallCallback.html" title="interface in com.sun.jna.win32" target="classFrame"><I>StdCallLibrary.StdCallCallback</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/StringArray.html" title="class in com.sun.jna" target="classFrame">StringArray</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/Structure.html" title="class in com.sun.jna" target="classFrame">Structure</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/Structure.ByReference.html" title="interface in com.sun.jna" target="classFrame"><I>Structure.ByReference</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/Structure.ByValue.html" title="interface in com.sun.jna" target="classFrame"><I>Structure.ByValue</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/StructureReadContext.html" title="class in com.sun.jna" target="classFrame">StructureReadContext</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/StructureWriteContext.html" title="class in com.sun.jna" target="classFrame">StructureWriteContext</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/ToNativeContext.html" title="class in com.sun.jna" target="classFrame">ToNativeContext</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/ToNativeConverter.html" title="interface in com.sun.jna" target="classFrame"><I>ToNativeConverter</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/TypeConverter.html" title="interface in com.sun.jna" target="classFrame"><I>TypeConverter</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/TypeMapper.html" title="interface in com.sun.jna" target="classFrame"><I>TypeMapper</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/Union.html" title="class in com.sun.jna" target="classFrame">Union</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/User32.html" title="interface in com.sun.jna.examples.win32" target="classFrame"><I>User32</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/User32.BLENDFUNCTION.html" title="class in com.sun.jna.examples.win32" target="classFrame">User32.BLENDFUNCTION</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/User32.FLASHWINFO.html" title="class in com.sun.jna.examples.win32" target="classFrame">User32.FLASHWINFO</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/User32.GUITHREADINFO.html" title="class in com.sun.jna.examples.win32" target="classFrame">User32.GUITHREADINFO</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/User32.HHOOK.html" title="class in com.sun.jna.examples.win32" target="classFrame">User32.HHOOK</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/User32.HOOKPROC.html" title="interface in com.sun.jna.examples.win32" target="classFrame"><I>User32.HOOKPROC</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/User32.KBDLLHOOKSTRUCT.html" title="class in com.sun.jna.examples.win32" target="classFrame">User32.KBDLLHOOKSTRUCT</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/User32.LowLevelKeyboardProc.html" title="interface in com.sun.jna.examples.win32" target="classFrame"><I>User32.LowLevelKeyboardProc</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/User32.MSG.html" title="class in com.sun.jna.examples.win32" target="classFrame">User32.MSG</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/User32.POINT.html" title="class in com.sun.jna.examples.win32" target="classFrame">User32.POINT</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/User32.SIZE.html" title="class in com.sun.jna.examples.win32" target="classFrame">User32.SIZE</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/User32.WINDOWINFO.html" title="class in com.sun.jna.examples.win32" target="classFrame">User32.WINDOWINFO</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/User32.WNDENUMPROC.html" title="interface in com.sun.jna.examples.win32" target="classFrame"><I>User32.WNDENUMPROC</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.html" title="interface in com.sun.jna.examples.win32" target="classFrame"><I>W32API</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.DWORD.html" title="class in com.sun.jna.examples.win32" target="classFrame">W32API.DWORD</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.HANDLE.html" title="class in com.sun.jna.examples.win32" target="classFrame">W32API.HANDLE</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.HANDLEByReference.html" title="class in com.sun.jna.examples.win32" target="classFrame">W32API.HANDLEByReference</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.HBITMAP.html" title="class in com.sun.jna.examples.win32" target="classFrame">W32API.HBITMAP</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.HDC.html" title="class in com.sun.jna.examples.win32" target="classFrame">W32API.HDC</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.HICON.html" title="class in com.sun.jna.examples.win32" target="classFrame">W32API.HICON</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.HINSTANCE.html" title="class in com.sun.jna.examples.win32" target="classFrame">W32API.HINSTANCE</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.HMODULE.html" title="class in com.sun.jna.examples.win32" target="classFrame">W32API.HMODULE</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.HRGN.html" title="class in com.sun.jna.examples.win32" target="classFrame">W32API.HRGN</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.HWND.html" title="class in com.sun.jna.examples.win32" target="classFrame">W32API.HWND</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.LONG_PTR.html" title="class in com.sun.jna.examples.win32" target="classFrame">W32API.LONG_PTR</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.LPARAM.html" title="class in com.sun.jna.examples.win32" target="classFrame">W32API.LPARAM</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.LRESULT.html" title="class in com.sun.jna.examples.win32" target="classFrame">W32API.LRESULT</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.SIZE_T.html" title="class in com.sun.jna.examples.win32" target="classFrame">W32API.SIZE_T</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.SSIZE_T.html" title="class in com.sun.jna.examples.win32" target="classFrame">W32API.SSIZE_T</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.UINT_PTR.html" title="class in com.sun.jna.examples.win32" target="classFrame">W32API.UINT_PTR</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.ULONG_PTR.html" title="class in com.sun.jna.examples.win32" target="classFrame">W32API.ULONG_PTR</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.WORD.html" title="class in com.sun.jna.examples.win32" target="classFrame">W32API.WORD</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.WPARAM.html" title="class in com.sun.jna.examples.win32" target="classFrame">W32API.WPARAM</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/win32/W32APIFunctionMapper.html" title="class in com.sun.jna.win32" target="classFrame">W32APIFunctionMapper</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/win32/W32APITypeMapper.html" title="class in com.sun.jna.win32" target="classFrame">W32APITypeMapper</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32Errors.html" title="interface in com.sun.jna.examples.win32" target="classFrame"><I>W32Errors</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/WindowUtils.html" title="class in com.sun.jna.examples" target="classFrame">WindowUtils</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/WindowUtils.NativeWindowUtils.html" title="class in com.sun.jna.examples" target="classFrame">WindowUtils.NativeWindowUtils</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/WindowUtils.RepaintTrigger.html" title="class in com.sun.jna.examples" target="classFrame">WindowUtils.RepaintTrigger</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/WString.html" title="class in com.sun.jna" target="classFrame">WString</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.html" title="interface in com.sun.jna.examples.unix" target="classFrame"><I>X11</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.Atom.html" title="class in com.sun.jna.examples.unix" target="classFrame">X11.Atom</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.AtomByReference.html" title="class in com.sun.jna.examples.unix" target="classFrame">X11.AtomByReference</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.Colormap.html" title="class in com.sun.jna.examples.unix" target="classFrame">X11.Colormap</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.Cursor.html" title="class in com.sun.jna.examples.unix" target="classFrame">X11.Cursor</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.Display.html" title="class in com.sun.jna.examples.unix" target="classFrame">X11.Display</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.Drawable.html" title="class in com.sun.jna.examples.unix" target="classFrame">X11.Drawable</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.Font.html" title="class in com.sun.jna.examples.unix" target="classFrame">X11.Font</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.GC.html" title="class in com.sun.jna.examples.unix" target="classFrame">X11.GC</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.Pixmap.html" title="class in com.sun.jna.examples.unix" target="classFrame">X11.Pixmap</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.Screen.html" title="class in com.sun.jna.examples.unix" target="classFrame">X11.Screen</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.Visual.html" title="class in com.sun.jna.examples.unix" target="classFrame">X11.Visual</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.VisualID.html" title="class in com.sun.jna.examples.unix" target="classFrame">X11.VisualID</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.Window.html" title="class in com.sun.jna.examples.unix" target="classFrame">X11.Window</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.WindowByReference.html" title="class in com.sun.jna.examples.unix" target="classFrame">X11.WindowByReference</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.Xext.html" title="interface in com.sun.jna.examples.unix" target="classFrame"><I>X11.Xext</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.XGCValues.html" title="class in com.sun.jna.examples.unix" target="classFrame">X11.XGCValues</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.XID.html" title="class in com.sun.jna.examples.unix" target="classFrame">X11.XID</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.XImage.html" title="class in com.sun.jna.examples.unix" target="classFrame">X11.XImage</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.XPoint.html" title="class in com.sun.jna.examples.unix" target="classFrame">X11.XPoint</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.XRectangle.html" title="class in com.sun.jna.examples.unix" target="classFrame">X11.XRectangle</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.Xrender.html" title="interface in com.sun.jna.examples.unix" target="classFrame"><I>X11.Xrender</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.Xrender.PictFormat.html" title="class in com.sun.jna.examples.unix" target="classFrame">X11.Xrender.PictFormat</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.Xrender.XRenderDirectFormat.html" title="class in com.sun.jna.examples.unix" target="classFrame">X11.Xrender.XRenderDirectFormat</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.Xrender.XRenderPictFormat.html" title="class in com.sun.jna.examples.unix" target="classFrame">X11.Xrender.XRenderPictFormat</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.XSetWindowAttributes.html" title="class in com.sun.jna.examples.unix" target="classFrame">X11.XSetWindowAttributes</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.XSizeHints.html" title="class in com.sun.jna.examples.unix" target="classFrame">X11.XSizeHints</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.XSizeHints.Aspect.html" title="class in com.sun.jna.examples.unix" target="classFrame">X11.XSizeHints.Aspect</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.XTextProperty.html" title="class in com.sun.jna.examples.unix" target="classFrame">X11.XTextProperty</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.XVisualInfo.html" title="class in com.sun.jna.examples.unix" target="classFrame">X11.XVisualInfo</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.XWindowAttributes.html" title="class in com.sun.jna.examples.unix" target="classFrame">X11.XWindowAttributes</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.XWMHints.html" title="class in com.sun.jna.examples.unix" target="classFrame">X11.XWMHints</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/X11AlphaMaskTest.html" title="class in com.sun.jna.examples" target="classFrame">X11AlphaMaskTest</A>
|
||||
<BR>
|
||||
</FONT></TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
||||
Arquivo executável → Arquivo normal
+351
-327
@@ -1,327 +1,351 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<!--NewPage-->
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>
|
||||
All Classes (JNA API)
|
||||
</TITLE>
|
||||
|
||||
|
||||
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
|
||||
|
||||
|
||||
</HEAD>
|
||||
|
||||
<BODY BGCOLOR="white">
|
||||
<FONT size="+1" CLASS="FrameHeadingFont">
|
||||
<B>All Classes</B></FONT>
|
||||
<BR>
|
||||
|
||||
<TABLE BORDER="0" WIDTH="100%" SUMMARY="">
|
||||
<TR>
|
||||
<TD NOWRAP><FONT CLASS="FrameItemFont"><A HREF="com/sun/jna/examples/AlphaMaskDemo.html" title="class in com.sun.jna.examples">AlphaMaskDemo</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/AlphaMaskDemo2.html" title="class in com.sun.jna.examples">AlphaMaskDemo2</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/AltCallingConvention.html" title="interface in com.sun.jna"><I>AltCallingConvention</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/BalloonManager.html" title="class in com.sun.jna.examples">BalloonManager</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/BalloonManagerDemo.html" title="class in com.sun.jna.examples">BalloonManagerDemo</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/ptr/ByReference.html" title="class in com.sun.jna.ptr">ByReference</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/ptr/ByteByReference.html" title="class in com.sun.jna.ptr">ByteByReference</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/Callback.html" title="interface in com.sun.jna"><I>Callback</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/CallbackParameterContext.html" title="class in com.sun.jna">CallbackParameterContext</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/CallbackProxy.html" title="interface in com.sun.jna"><I>CallbackProxy</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/CallbackReference.html" title="class in com.sun.jna">CallbackReference</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/CallbackResultContext.html" title="class in com.sun.jna">CallbackResultContext</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/CLibrary.html" title="interface in com.sun.jna.examples"><I>CLibrary</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/DefaultTypeMapper.html" title="class in com.sun.jna">DefaultTypeMapper</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/ptr/DoubleByReference.html" title="class in com.sun.jna.ptr">DoubleByReference</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/dnd/DragHandler.html" title="class in com.sun.jna.examples.dnd">DragHandler</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/dnd/DropHandler.html" title="class in com.sun.jna.examples.dnd">DropHandler</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/dnd/DropTargetPainter.html" title="interface in com.sun.jna.examples.dnd"><I>DropTargetPainter</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/FileMonitor.html" title="class in com.sun.jna.examples">FileMonitor</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/FileMonitor.FileListener.html" title="interface in com.sun.jna.examples"><I>FileMonitor.FileListener</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/FileUtils.html" title="class in com.sun.jna.examples">FileUtils</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/ptr/FloatByReference.html" title="class in com.sun.jna.ptr">FloatByReference</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/FromNativeContext.html" title="class in com.sun.jna">FromNativeContext</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/FromNativeConverter.html" title="interface in com.sun.jna"><I>FromNativeConverter</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/Function.html" title="class in com.sun.jna">Function</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/FunctionMapper.html" title="interface in com.sun.jna"><I>FunctionMapper</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/FunctionParameterContext.html" title="class in com.sun.jna">FunctionParameterContext</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/FunctionResultContext.html" title="class in com.sun.jna">FunctionResultContext</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/GDI32.html" title="interface in com.sun.jna.examples.win32"><I>GDI32</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/GDI32.BITMAPINFO.html" title="class in com.sun.jna.examples.win32">GDI32.BITMAPINFO</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/GDI32.BITMAPINFOHEADER.html" title="class in com.sun.jna.examples.win32">GDI32.BITMAPINFOHEADER</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/GDI32.RECT.html" title="class in com.sun.jna.examples.win32">GDI32.RECT</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/GDI32.RGBQUAD.html" title="class in com.sun.jna.examples.win32">GDI32.RGBQUAD</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/GDI32.RGNDATA.html" title="class in com.sun.jna.examples.win32">GDI32.RGNDATA</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/GDI32.RGNDATAHEADER.html" title="class in com.sun.jna.examples.win32">GDI32.RGNDATAHEADER</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/dnd/GhostedDragImage.html" title="class in com.sun.jna.examples.dnd">GhostedDragImage</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/dnd/GhostedDragImageDemo.html" title="class in com.sun.jna.examples.dnd">GhostedDragImageDemo</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/dnd/GhostedDragImageDemo.DragLabel.html" title="class in com.sun.jna.examples.dnd">GhostedDragImageDemo.DragLabel</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/dnd/GhostedDragImageDemo.ImageSelection.html" title="class in com.sun.jna.examples.dnd">GhostedDragImageDemo.ImageSelection</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/ptr/IntByReference.html" title="class in com.sun.jna.ptr">IntByReference</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/IntegerType.html" title="class in com.sun.jna">IntegerType</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/InvocationMapper.html" title="interface in com.sun.jna"><I>InvocationMapper</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/Kernel32.html" title="interface in com.sun.jna.examples.win32"><I>Kernel32</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/Kernel32.FILE_NOTIFY_INFORMATION.html" title="class in com.sun.jna.examples.win32">Kernel32.FILE_NOTIFY_INFORMATION</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/Kernel32.OVERLAPPED.html" title="class in com.sun.jna.examples.win32">Kernel32.OVERLAPPED</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/Kernel32.OVERLAPPED_COMPLETION_ROUTINE.html" title="interface in com.sun.jna.examples.win32"><I>Kernel32.OVERLAPPED_COMPLETION_ROUTINE</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/Kernel32.SECURITY_ATTRIBUTES.html" title="class in com.sun.jna.examples.win32">Kernel32.SECURITY_ATTRIBUTES</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/Kernel32.SYSTEMTIME.html" title="class in com.sun.jna.examples.win32">Kernel32.SYSTEMTIME</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/KeyboardUtils.html" title="class in com.sun.jna.examples">KeyboardUtils</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/Library.html" title="interface in com.sun.jna"><I>Library</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/Library.Handler.html" title="class in com.sun.jna">Library.Handler</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/ptr/LongByReference.html" title="class in com.sun.jna.ptr">LongByReference</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/Memory.html" title="class in com.sun.jna">Memory</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/MethodParameterContext.html" title="class in com.sun.jna">MethodParameterContext</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/MethodResultContext.html" title="class in com.sun.jna">MethodResultContext</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/Native.html" title="class in com.sun.jna">Native</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/Native.W32Cleanup.html" title="class in com.sun.jna">Native.W32Cleanup</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/NativeLibrary.html" title="class in com.sun.jna">NativeLibrary</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/NativeLong.html" title="class in com.sun.jna">NativeLong</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/ptr/NativeLongByReference.html" title="class in com.sun.jna.ptr">NativeLongByReference</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/NativeMapped.html" title="interface in com.sun.jna"><I>NativeMapped</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/NativeMappedConverter.html" title="class in com.sun.jna">NativeMappedConverter</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/NativeString.html" title="class in com.sun.jna">NativeString</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/Platform.html" title="class in com.sun.jna">Platform</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/Pointer.html" title="class in com.sun.jna">Pointer</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/ptr/PointerByReference.html" title="class in com.sun.jna.ptr">PointerByReference</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/PointerType.html" title="class in com.sun.jna">PointerType</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/RasterRangesUtils.html" title="class in com.sun.jna.examples">RasterRangesUtils</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/RasterRangesUtils.RangesOutput.html" title="interface in com.sun.jna.examples"><I>RasterRangesUtils.RangesOutput</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/ShapedWindowDemo.html" title="class in com.sun.jna.examples">ShapedWindowDemo</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/Shell32.html" title="interface in com.sun.jna.examples.win32"><I>Shell32</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/Shell32.SHFILEOPSTRUCT.html" title="class in com.sun.jna.examples.win32">Shell32.SHFILEOPSTRUCT</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/ptr/ShortByReference.html" title="class in com.sun.jna.ptr">ShortByReference</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/win32/StdCall.html" title="interface in com.sun.jna.win32"><I>StdCall</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/win32/StdCallFunctionMapper.html" title="class in com.sun.jna.win32">StdCallFunctionMapper</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/win32/StdCallLibrary.html" title="interface in com.sun.jna.win32"><I>StdCallLibrary</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/win32/StdCallLibrary.StdCallCallback.html" title="interface in com.sun.jna.win32"><I>StdCallLibrary.StdCallCallback</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/StringArray.html" title="class in com.sun.jna">StringArray</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/Structure.html" title="class in com.sun.jna">Structure</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/Structure.ByReference.html" title="interface in com.sun.jna"><I>Structure.ByReference</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/Structure.ByValue.html" title="interface in com.sun.jna"><I>Structure.ByValue</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/StructureReadContext.html" title="class in com.sun.jna">StructureReadContext</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/StructureWriteContext.html" title="class in com.sun.jna">StructureWriteContext</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/ToNativeContext.html" title="class in com.sun.jna">ToNativeContext</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/ToNativeConverter.html" title="interface in com.sun.jna"><I>ToNativeConverter</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/TypeConverter.html" title="interface in com.sun.jna"><I>TypeConverter</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/TypeMapper.html" title="interface in com.sun.jna"><I>TypeMapper</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/Union.html" title="class in com.sun.jna">Union</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/User32.html" title="interface in com.sun.jna.examples.win32"><I>User32</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/User32.BLENDFUNCTION.html" title="class in com.sun.jna.examples.win32">User32.BLENDFUNCTION</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/User32.FLASHWINFO.html" title="class in com.sun.jna.examples.win32">User32.FLASHWINFO</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/User32.GUITHREADINFO.html" title="class in com.sun.jna.examples.win32">User32.GUITHREADINFO</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/User32.HHOOK.html" title="class in com.sun.jna.examples.win32">User32.HHOOK</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/User32.HOOKPROC.html" title="interface in com.sun.jna.examples.win32"><I>User32.HOOKPROC</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/User32.KBDLLHOOKSTRUCT.html" title="class in com.sun.jna.examples.win32">User32.KBDLLHOOKSTRUCT</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/User32.LowLevelKeyboardProc.html" title="interface in com.sun.jna.examples.win32"><I>User32.LowLevelKeyboardProc</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/User32.MSG.html" title="class in com.sun.jna.examples.win32">User32.MSG</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/User32.POINT.html" title="class in com.sun.jna.examples.win32">User32.POINT</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/User32.SIZE.html" title="class in com.sun.jna.examples.win32">User32.SIZE</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/User32.WINDOWINFO.html" title="class in com.sun.jna.examples.win32">User32.WINDOWINFO</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/User32.WNDENUMPROC.html" title="interface in com.sun.jna.examples.win32"><I>User32.WNDENUMPROC</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.html" title="interface in com.sun.jna.examples.win32"><I>W32API</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.HANDLE.html" title="class in com.sun.jna.examples.win32">W32API.HANDLE</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.HANDLEByReference.html" title="class in com.sun.jna.examples.win32">W32API.HANDLEByReference</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.HBITMAP.html" title="class in com.sun.jna.examples.win32">W32API.HBITMAP</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.HDC.html" title="class in com.sun.jna.examples.win32">W32API.HDC</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.HICON.html" title="class in com.sun.jna.examples.win32">W32API.HICON</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.HINSTANCE.html" title="class in com.sun.jna.examples.win32">W32API.HINSTANCE</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.HMODULE.html" title="class in com.sun.jna.examples.win32">W32API.HMODULE</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.HRGN.html" title="class in com.sun.jna.examples.win32">W32API.HRGN</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.HWND.html" title="class in com.sun.jna.examples.win32">W32API.HWND</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.LONG_PTR.html" title="class in com.sun.jna.examples.win32">W32API.LONG_PTR</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.LPARAM.html" title="class in com.sun.jna.examples.win32">W32API.LPARAM</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.LRESULT.html" title="class in com.sun.jna.examples.win32">W32API.LRESULT</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.SIZE_T.html" title="class in com.sun.jna.examples.win32">W32API.SIZE_T</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.SSIZE_T.html" title="class in com.sun.jna.examples.win32">W32API.SSIZE_T</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.UINT_PTR.html" title="class in com.sun.jna.examples.win32">W32API.UINT_PTR</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.ULONG_PTR.html" title="class in com.sun.jna.examples.win32">W32API.ULONG_PTR</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.WPARAM.html" title="class in com.sun.jna.examples.win32">W32API.WPARAM</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/win32/W32APIFunctionMapper.html" title="class in com.sun.jna.win32">W32APIFunctionMapper</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/win32/W32APITypeMapper.html" title="class in com.sun.jna.win32">W32APITypeMapper</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32Errors.html" title="interface in com.sun.jna.examples.win32"><I>W32Errors</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/WindowUtils.html" title="class in com.sun.jna.examples">WindowUtils</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/WindowUtils.NativeWindowUtils.html" title="class in com.sun.jna.examples">WindowUtils.NativeWindowUtils</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/WString.html" title="class in com.sun.jna">WString</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.html" title="interface in com.sun.jna.examples.unix"><I>X11</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.Atom.html" title="class in com.sun.jna.examples.unix">X11.Atom</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.AtomByReference.html" title="class in com.sun.jna.examples.unix">X11.AtomByReference</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.Colormap.html" title="class in com.sun.jna.examples.unix">X11.Colormap</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.Cursor.html" title="class in com.sun.jna.examples.unix">X11.Cursor</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.Display.html" title="class in com.sun.jna.examples.unix">X11.Display</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.Drawable.html" title="class in com.sun.jna.examples.unix">X11.Drawable</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.GC.html" title="class in com.sun.jna.examples.unix">X11.GC</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.Pixmap.html" title="class in com.sun.jna.examples.unix">X11.Pixmap</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.Screen.html" title="class in com.sun.jna.examples.unix">X11.Screen</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.Visual.html" title="class in com.sun.jna.examples.unix">X11.Visual</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.Window.html" title="class in com.sun.jna.examples.unix">X11.Window</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.WindowByReference.html" title="class in com.sun.jna.examples.unix">X11.WindowByReference</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.Xext.html" title="interface in com.sun.jna.examples.unix"><I>X11.Xext</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.XID.html" title="class in com.sun.jna.examples.unix">X11.XID</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.Xrender.html" title="interface in com.sun.jna.examples.unix"><I>X11.Xrender</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.Xrender.XRenderDirectFormat.html" title="class in com.sun.jna.examples.unix">X11.Xrender.XRenderDirectFormat</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.Xrender.XRenderPictFormat.html" title="class in com.sun.jna.examples.unix">X11.Xrender.XRenderPictFormat</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.XSetWindowAttributes.html" title="class in com.sun.jna.examples.unix">X11.XSetWindowAttributes</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.XSizeHints.html" title="class in com.sun.jna.examples.unix">X11.XSizeHints</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.XTextProperty.html" title="class in com.sun.jna.examples.unix">X11.XTextProperty</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.XVisualInfo.html" title="class in com.sun.jna.examples.unix">X11.XVisualInfo</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.XWindowAttributes.html" title="class in com.sun.jna.examples.unix">X11.XWindowAttributes</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.XWMHints.html" title="class in com.sun.jna.examples.unix">X11.XWMHints</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/X11AlphaMaskTest.html" title="class in com.sun.jna.examples">X11AlphaMaskTest</A>
|
||||
<BR>
|
||||
</FONT></TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<!--NewPage-->
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>
|
||||
All Classes (JNA API)
|
||||
</TITLE>
|
||||
|
||||
|
||||
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
|
||||
|
||||
|
||||
</HEAD>
|
||||
|
||||
<BODY BGCOLOR="white">
|
||||
<FONT size="+1" CLASS="FrameHeadingFont">
|
||||
<B>All Classes</B></FONT>
|
||||
<BR>
|
||||
|
||||
<TABLE BORDER="0" WIDTH="100%" SUMMARY="">
|
||||
<TR>
|
||||
<TD NOWRAP><FONT CLASS="FrameItemFont"><A HREF="com/sun/jna/examples/AlphaMaskDemo.html" title="class in com.sun.jna.examples">AlphaMaskDemo</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/AlphaMaskDemo2.html" title="class in com.sun.jna.examples">AlphaMaskDemo2</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/AltCallingConvention.html" title="interface in com.sun.jna"><I>AltCallingConvention</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/BalloonManager.html" title="class in com.sun.jna.examples">BalloonManager</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/BalloonManagerDemo.html" title="class in com.sun.jna.examples">BalloonManagerDemo</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/ptr/ByReference.html" title="class in com.sun.jna.ptr">ByReference</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/ptr/ByteByReference.html" title="class in com.sun.jna.ptr">ByteByReference</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/Callback.html" title="interface in com.sun.jna"><I>Callback</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/CallbackParameterContext.html" title="class in com.sun.jna">CallbackParameterContext</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/CallbackProxy.html" title="interface in com.sun.jna"><I>CallbackProxy</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/CallbackReference.html" title="class in com.sun.jna">CallbackReference</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/CallbackResultContext.html" title="class in com.sun.jna">CallbackResultContext</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/CLibrary.html" title="interface in com.sun.jna.examples"><I>CLibrary</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/DefaultTypeMapper.html" title="class in com.sun.jna">DefaultTypeMapper</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/ptr/DoubleByReference.html" title="class in com.sun.jna.ptr">DoubleByReference</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/dnd/DragHandler.html" title="class in com.sun.jna.examples.dnd">DragHandler</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/dnd/DropHandler.html" title="class in com.sun.jna.examples.dnd">DropHandler</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/dnd/DropTargetPainter.html" title="interface in com.sun.jna.examples.dnd"><I>DropTargetPainter</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/FileMonitor.html" title="class in com.sun.jna.examples">FileMonitor</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/FileMonitor.FileListener.html" title="interface in com.sun.jna.examples"><I>FileMonitor.FileListener</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/FileUtils.html" title="class in com.sun.jna.examples">FileUtils</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/ptr/FloatByReference.html" title="class in com.sun.jna.ptr">FloatByReference</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/FromNativeContext.html" title="class in com.sun.jna">FromNativeContext</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/FromNativeConverter.html" title="interface in com.sun.jna"><I>FromNativeConverter</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/Function.html" title="class in com.sun.jna">Function</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/Function.PostCallRead.html" title="interface in com.sun.jna"><I>Function.PostCallRead</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/FunctionMapper.html" title="interface in com.sun.jna"><I>FunctionMapper</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/FunctionParameterContext.html" title="class in com.sun.jna">FunctionParameterContext</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/FunctionResultContext.html" title="class in com.sun.jna">FunctionResultContext</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/GDI32.html" title="interface in com.sun.jna.examples.win32"><I>GDI32</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/GDI32.BITMAPINFO.html" title="class in com.sun.jna.examples.win32">GDI32.BITMAPINFO</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/GDI32.BITMAPINFOHEADER.html" title="class in com.sun.jna.examples.win32">GDI32.BITMAPINFOHEADER</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/GDI32.RECT.html" title="class in com.sun.jna.examples.win32">GDI32.RECT</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/GDI32.RGBQUAD.html" title="class in com.sun.jna.examples.win32">GDI32.RGBQUAD</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/GDI32.RGNDATA.html" title="class in com.sun.jna.examples.win32">GDI32.RGNDATA</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/GDI32.RGNDATAHEADER.html" title="class in com.sun.jna.examples.win32">GDI32.RGNDATAHEADER</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/dnd/GhostedDragImage.html" title="class in com.sun.jna.examples.dnd">GhostedDragImage</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/dnd/GhostedDragImageDemo.html" title="class in com.sun.jna.examples.dnd">GhostedDragImageDemo</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/dnd/GhostedDragImageDemo.DragLabel.html" title="class in com.sun.jna.examples.dnd">GhostedDragImageDemo.DragLabel</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/dnd/GhostedDragImageDemo.ImageSelection.html" title="class in com.sun.jna.examples.dnd">GhostedDragImageDemo.ImageSelection</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/ptr/IntByReference.html" title="class in com.sun.jna.ptr">IntByReference</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/IntegerType.html" title="class in com.sun.jna">IntegerType</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/InvocationMapper.html" title="interface in com.sun.jna"><I>InvocationMapper</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/Kernel32.html" title="interface in com.sun.jna.examples.win32"><I>Kernel32</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/Kernel32.FILE_NOTIFY_INFORMATION.html" title="class in com.sun.jna.examples.win32">Kernel32.FILE_NOTIFY_INFORMATION</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/Kernel32.OVERLAPPED.html" title="class in com.sun.jna.examples.win32">Kernel32.OVERLAPPED</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/Kernel32.OVERLAPPED_COMPLETION_ROUTINE.html" title="interface in com.sun.jna.examples.win32"><I>Kernel32.OVERLAPPED_COMPLETION_ROUTINE</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/Kernel32.SECURITY_ATTRIBUTES.html" title="class in com.sun.jna.examples.win32">Kernel32.SECURITY_ATTRIBUTES</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/Kernel32.SYSTEMTIME.html" title="class in com.sun.jna.examples.win32">Kernel32.SYSTEMTIME</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/KeyboardUtils.html" title="class in com.sun.jna.examples">KeyboardUtils</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/Library.html" title="interface in com.sun.jna"><I>Library</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/Library.Handler.html" title="class in com.sun.jna">Library.Handler</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/ptr/LongByReference.html" title="class in com.sun.jna.ptr">LongByReference</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/Memory.html" title="class in com.sun.jna">Memory</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/MethodParameterContext.html" title="class in com.sun.jna">MethodParameterContext</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/MethodResultContext.html" title="class in com.sun.jna">MethodResultContext</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/Native.html" title="class in com.sun.jna">Native</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/Native.DeleteNativeLibrary.html" title="class in com.sun.jna">Native.DeleteNativeLibrary</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/NativeLibrary.html" title="class in com.sun.jna">NativeLibrary</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/NativeLong.html" title="class in com.sun.jna">NativeLong</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/ptr/NativeLongByReference.html" title="class in com.sun.jna.ptr">NativeLongByReference</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/NativeMapped.html" title="interface in com.sun.jna"><I>NativeMapped</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/NativeMappedConverter.html" title="class in com.sun.jna">NativeMappedConverter</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/NativeString.html" title="class in com.sun.jna">NativeString</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/Platform.html" title="class in com.sun.jna">Platform</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/Pointer.html" title="class in com.sun.jna">Pointer</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/ptr/PointerByReference.html" title="class in com.sun.jna.ptr">PointerByReference</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/PointerType.html" title="class in com.sun.jna">PointerType</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/RasterRangesUtils.html" title="class in com.sun.jna.examples">RasterRangesUtils</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/RasterRangesUtils.RangesOutput.html" title="interface in com.sun.jna.examples"><I>RasterRangesUtils.RangesOutput</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/ShapedWindowDemo.html" title="class in com.sun.jna.examples">ShapedWindowDemo</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/Shell32.html" title="interface in com.sun.jna.examples.win32"><I>Shell32</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/Shell32.SHFILEOPSTRUCT.html" title="class in com.sun.jna.examples.win32">Shell32.SHFILEOPSTRUCT</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/ptr/ShortByReference.html" title="class in com.sun.jna.ptr">ShortByReference</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/win32/StdCall.html" title="interface in com.sun.jna.win32"><I>StdCall</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/win32/StdCallFunctionMapper.html" title="class in com.sun.jna.win32">StdCallFunctionMapper</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/win32/StdCallLibrary.html" title="interface in com.sun.jna.win32"><I>StdCallLibrary</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/win32/StdCallLibrary.StdCallCallback.html" title="interface in com.sun.jna.win32"><I>StdCallLibrary.StdCallCallback</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/StringArray.html" title="class in com.sun.jna">StringArray</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/Structure.html" title="class in com.sun.jna">Structure</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/Structure.ByReference.html" title="interface in com.sun.jna"><I>Structure.ByReference</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/Structure.ByValue.html" title="interface in com.sun.jna"><I>Structure.ByValue</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/StructureReadContext.html" title="class in com.sun.jna">StructureReadContext</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/StructureWriteContext.html" title="class in com.sun.jna">StructureWriteContext</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/ToNativeContext.html" title="class in com.sun.jna">ToNativeContext</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/ToNativeConverter.html" title="interface in com.sun.jna"><I>ToNativeConverter</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/TypeConverter.html" title="interface in com.sun.jna"><I>TypeConverter</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/TypeMapper.html" title="interface in com.sun.jna"><I>TypeMapper</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/Union.html" title="class in com.sun.jna">Union</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/User32.html" title="interface in com.sun.jna.examples.win32"><I>User32</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/User32.BLENDFUNCTION.html" title="class in com.sun.jna.examples.win32">User32.BLENDFUNCTION</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/User32.FLASHWINFO.html" title="class in com.sun.jna.examples.win32">User32.FLASHWINFO</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/User32.GUITHREADINFO.html" title="class in com.sun.jna.examples.win32">User32.GUITHREADINFO</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/User32.HHOOK.html" title="class in com.sun.jna.examples.win32">User32.HHOOK</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/User32.HOOKPROC.html" title="interface in com.sun.jna.examples.win32"><I>User32.HOOKPROC</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/User32.KBDLLHOOKSTRUCT.html" title="class in com.sun.jna.examples.win32">User32.KBDLLHOOKSTRUCT</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/User32.LowLevelKeyboardProc.html" title="interface in com.sun.jna.examples.win32"><I>User32.LowLevelKeyboardProc</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/User32.MSG.html" title="class in com.sun.jna.examples.win32">User32.MSG</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/User32.POINT.html" title="class in com.sun.jna.examples.win32">User32.POINT</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/User32.SIZE.html" title="class in com.sun.jna.examples.win32">User32.SIZE</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/User32.WINDOWINFO.html" title="class in com.sun.jna.examples.win32">User32.WINDOWINFO</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/User32.WNDENUMPROC.html" title="interface in com.sun.jna.examples.win32"><I>User32.WNDENUMPROC</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.html" title="interface in com.sun.jna.examples.win32"><I>W32API</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.DWORD.html" title="class in com.sun.jna.examples.win32">W32API.DWORD</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.HANDLE.html" title="class in com.sun.jna.examples.win32">W32API.HANDLE</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.HANDLEByReference.html" title="class in com.sun.jna.examples.win32">W32API.HANDLEByReference</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.HBITMAP.html" title="class in com.sun.jna.examples.win32">W32API.HBITMAP</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.HDC.html" title="class in com.sun.jna.examples.win32">W32API.HDC</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.HICON.html" title="class in com.sun.jna.examples.win32">W32API.HICON</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.HINSTANCE.html" title="class in com.sun.jna.examples.win32">W32API.HINSTANCE</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.HMODULE.html" title="class in com.sun.jna.examples.win32">W32API.HMODULE</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.HRGN.html" title="class in com.sun.jna.examples.win32">W32API.HRGN</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.HWND.html" title="class in com.sun.jna.examples.win32">W32API.HWND</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.LONG_PTR.html" title="class in com.sun.jna.examples.win32">W32API.LONG_PTR</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.LPARAM.html" title="class in com.sun.jna.examples.win32">W32API.LPARAM</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.LRESULT.html" title="class in com.sun.jna.examples.win32">W32API.LRESULT</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.SIZE_T.html" title="class in com.sun.jna.examples.win32">W32API.SIZE_T</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.SSIZE_T.html" title="class in com.sun.jna.examples.win32">W32API.SSIZE_T</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.UINT_PTR.html" title="class in com.sun.jna.examples.win32">W32API.UINT_PTR</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.ULONG_PTR.html" title="class in com.sun.jna.examples.win32">W32API.ULONG_PTR</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.WORD.html" title="class in com.sun.jna.examples.win32">W32API.WORD</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32API.WPARAM.html" title="class in com.sun.jna.examples.win32">W32API.WPARAM</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/win32/W32APIFunctionMapper.html" title="class in com.sun.jna.win32">W32APIFunctionMapper</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/win32/W32APITypeMapper.html" title="class in com.sun.jna.win32">W32APITypeMapper</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/win32/W32Errors.html" title="interface in com.sun.jna.examples.win32"><I>W32Errors</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/WindowUtils.html" title="class in com.sun.jna.examples">WindowUtils</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/WindowUtils.NativeWindowUtils.html" title="class in com.sun.jna.examples">WindowUtils.NativeWindowUtils</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/WindowUtils.RepaintTrigger.html" title="class in com.sun.jna.examples">WindowUtils.RepaintTrigger</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/WString.html" title="class in com.sun.jna">WString</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.html" title="interface in com.sun.jna.examples.unix"><I>X11</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.Atom.html" title="class in com.sun.jna.examples.unix">X11.Atom</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.AtomByReference.html" title="class in com.sun.jna.examples.unix">X11.AtomByReference</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.Colormap.html" title="class in com.sun.jna.examples.unix">X11.Colormap</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.Cursor.html" title="class in com.sun.jna.examples.unix">X11.Cursor</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.Display.html" title="class in com.sun.jna.examples.unix">X11.Display</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.Drawable.html" title="class in com.sun.jna.examples.unix">X11.Drawable</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.Font.html" title="class in com.sun.jna.examples.unix">X11.Font</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.GC.html" title="class in com.sun.jna.examples.unix">X11.GC</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.Pixmap.html" title="class in com.sun.jna.examples.unix">X11.Pixmap</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.Screen.html" title="class in com.sun.jna.examples.unix">X11.Screen</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.Visual.html" title="class in com.sun.jna.examples.unix">X11.Visual</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.VisualID.html" title="class in com.sun.jna.examples.unix">X11.VisualID</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.Window.html" title="class in com.sun.jna.examples.unix">X11.Window</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.WindowByReference.html" title="class in com.sun.jna.examples.unix">X11.WindowByReference</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.Xext.html" title="interface in com.sun.jna.examples.unix"><I>X11.Xext</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.XGCValues.html" title="class in com.sun.jna.examples.unix">X11.XGCValues</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.XID.html" title="class in com.sun.jna.examples.unix">X11.XID</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.XImage.html" title="class in com.sun.jna.examples.unix">X11.XImage</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.XPoint.html" title="class in com.sun.jna.examples.unix">X11.XPoint</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.XRectangle.html" title="class in com.sun.jna.examples.unix">X11.XRectangle</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.Xrender.html" title="interface in com.sun.jna.examples.unix"><I>X11.Xrender</I></A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.Xrender.PictFormat.html" title="class in com.sun.jna.examples.unix">X11.Xrender.PictFormat</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.Xrender.XRenderDirectFormat.html" title="class in com.sun.jna.examples.unix">X11.Xrender.XRenderDirectFormat</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.Xrender.XRenderPictFormat.html" title="class in com.sun.jna.examples.unix">X11.Xrender.XRenderPictFormat</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.XSetWindowAttributes.html" title="class in com.sun.jna.examples.unix">X11.XSetWindowAttributes</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.XSizeHints.html" title="class in com.sun.jna.examples.unix">X11.XSizeHints</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.XSizeHints.Aspect.html" title="class in com.sun.jna.examples.unix">X11.XSizeHints.Aspect</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.XTextProperty.html" title="class in com.sun.jna.examples.unix">X11.XTextProperty</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.XVisualInfo.html" title="class in com.sun.jna.examples.unix">X11.XVisualInfo</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.XWindowAttributes.html" title="class in com.sun.jna.examples.unix">X11.XWindowAttributes</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/unix/X11.XWMHints.html" title="class in com.sun.jna.examples.unix">X11.XWMHints</A>
|
||||
<BR>
|
||||
<A HREF="com/sun/jna/examples/X11AlphaMaskTest.html" title="class in com.sun.jna.examples">X11AlphaMaskTest</A>
|
||||
<BR>
|
||||
</FONT></TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
||||
Arquivo executável → Arquivo normal
+173
-175
@@ -1,176 +1,174 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<!--NewPage-->
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>
|
||||
AltCallingConvention (JNA API)
|
||||
</TITLE>
|
||||
|
||||
|
||||
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
|
||||
|
||||
<SCRIPT type="text/javascript">
|
||||
function windowTitle()
|
||||
{
|
||||
if (location.href.indexOf('is-external=true') == -1) {
|
||||
parent.document.title="AltCallingConvention (JNA API)";
|
||||
}
|
||||
}
|
||||
</SCRIPT>
|
||||
<NOSCRIPT>
|
||||
</NOSCRIPT>
|
||||
|
||||
</HEAD>
|
||||
|
||||
<BODY BGCOLOR="white" onload="windowTitle();">
|
||||
<HR>
|
||||
|
||||
|
||||
<!-- ========= START OF TOP NAVBAR ======= -->
|
||||
<A NAME="navbar_top"><!-- --></A>
|
||||
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
|
||||
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
|
||||
<TR>
|
||||
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
|
||||
<A NAME="navbar_top_firstrow"><!-- --></A>
|
||||
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
|
||||
<TR ALIGN="center" VALIGN="top">
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</TD>
|
||||
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
|
||||
<b>JNA API</><font size=-1> 3.0</font></EM>
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
<TR>
|
||||
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
||||
PREV CLASS
|
||||
<A HREF="../../../com/sun/jna/Callback.html" title="interface in com.sun.jna"><B>NEXT CLASS</B></A></FONT></TD>
|
||||
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
||||
<A HREF="../../../index.html?com/sun/jna/AltCallingConvention.html" target="_top"><B>FRAMES</B></A>
|
||||
<A HREF="AltCallingConvention.html" target="_top"><B>NO FRAMES</B></A>
|
||||
<SCRIPT type="text/javascript">
|
||||
<!--
|
||||
if(window==top) {
|
||||
document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
|
||||
}
|
||||
//-->
|
||||
</SCRIPT>
|
||||
<NOSCRIPT>
|
||||
<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
|
||||
</NOSCRIPT>
|
||||
|
||||
|
||||
</FONT></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
|
||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD</FONT></TD>
|
||||
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
|
||||
DETAIL: FIELD | CONSTR | METHOD</FONT></TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
<A NAME="skip-navbar_top"></A>
|
||||
<!-- ========= END OF TOP NAVBAR ========= -->
|
||||
|
||||
<HR>
|
||||
<!-- ======== START OF CLASS DATA ======== -->
|
||||
<H2>
|
||||
<FONT SIZE="-1">
|
||||
com.sun.jna</FONT>
|
||||
<BR>
|
||||
Interface AltCallingConvention</H2>
|
||||
<DL>
|
||||
<DT><B>All Known Subinterfaces:</B> <DD><A HREF="../../../com/sun/jna/examples/win32/GDI32.html" title="interface in com.sun.jna.examples.win32">GDI32</A>, <A HREF="../../../com/sun/jna/examples/win32/Kernel32.html" title="interface in com.sun.jna.examples.win32">Kernel32</A>, <A HREF="../../../com/sun/jna/examples/win32/Kernel32.OVERLAPPED_COMPLETION_ROUTINE.html" title="interface in com.sun.jna.examples.win32">Kernel32.OVERLAPPED_COMPLETION_ROUTINE</A>, <A HREF="../../../com/sun/jna/examples/win32/Shell32.html" title="interface in com.sun.jna.examples.win32">Shell32</A>, <A HREF="../../../com/sun/jna/win32/StdCall.html" title="interface in com.sun.jna.win32">StdCall</A>, <A HREF="../../../com/sun/jna/win32/StdCallLibrary.html" title="interface in com.sun.jna.win32">StdCallLibrary</A>, <A HREF="../../../com/sun/jna/win32/StdCallLibrary.StdCallCallback.html" title="interface in com.sun.jna.win32">StdCallLibrary.StdCallCallback</A>, <A HREF="../../../com/sun/jna/examples/win32/User32.html" title="interface in com.sun.jna.examples.win32">User32</A>, <A HREF="../../../com/sun/jna/examples/win32/User32.HOOKPROC.html" title="interface in com.sun.jna.examples.win32">User32.HOOKPROC</A>, <A HREF="../../../com/sun/jna/examples/win32/User32.LowLevelKeyboardProc.html" title="interface in com.sun.jna.examples.win32">User32.LowLevelKeyboardProc</A>, <A HREF="../../../com/sun/jna/examples/win32/User32.WNDENUMPROC.html" title="interface in com.sun.jna.examples.win32">User32.WNDENUMPROC</A>, <A HREF="../../../com/sun/jna/examples/win32/W32API.html" title="interface in com.sun.jna.examples.win32">W32API</A></DD>
|
||||
</DL>
|
||||
<HR>
|
||||
<DL>
|
||||
<DT><PRE>public interface <B>AltCallingConvention</B></DL>
|
||||
</PRE>
|
||||
|
||||
<P>
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<!--NewPage-->
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>
|
||||
AltCallingConvention (JNA API)
|
||||
</TITLE>
|
||||
|
||||
<META NAME="keywords" CONTENT="com.sun.jna.AltCallingConvention interface">
|
||||
|
||||
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
|
||||
|
||||
<SCRIPT type="text/javascript">
|
||||
function windowTitle()
|
||||
{
|
||||
parent.document.title="AltCallingConvention (JNA API)";
|
||||
}
|
||||
</SCRIPT>
|
||||
<NOSCRIPT>
|
||||
</NOSCRIPT>
|
||||
|
||||
</HEAD>
|
||||
|
||||
<BODY BGCOLOR="white" onload="windowTitle();">
|
||||
|
||||
|
||||
<!-- ========= START OF TOP NAVBAR ======= -->
|
||||
<A NAME="navbar_top"><!-- --></A>
|
||||
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
|
||||
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
|
||||
<TR>
|
||||
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
|
||||
<A NAME="navbar_top_firstrow"><!-- --></A>
|
||||
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
|
||||
<TR ALIGN="center" VALIGN="top">
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</TD>
|
||||
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
|
||||
<b>JNA API</><font size="-1"> 3.0.4</font></EM>
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
<TR>
|
||||
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
||||
PREV CLASS
|
||||
<A HREF="../../../com/sun/jna/Callback.html" title="interface in com.sun.jna"><B>NEXT CLASS</B></A></FONT></TD>
|
||||
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
||||
<A HREF="../../../index.html?com/sun/jna/AltCallingConvention.html" target="_top"><B>FRAMES</B></A>
|
||||
<A HREF="AltCallingConvention.html" target="_top"><B>NO FRAMES</B></A>
|
||||
<SCRIPT type="text/javascript">
|
||||
<!--
|
||||
if(window==top) {
|
||||
document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
|
||||
}
|
||||
//-->
|
||||
</SCRIPT>
|
||||
<NOSCRIPT>
|
||||
<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
|
||||
</NOSCRIPT>
|
||||
|
||||
|
||||
</FONT></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
|
||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD</FONT></TD>
|
||||
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
|
||||
DETAIL: FIELD | CONSTR | METHOD</FONT></TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
<A NAME="skip-navbar_top"></A>
|
||||
<!-- ========= END OF TOP NAVBAR ========= -->
|
||||
|
||||
<HR>
|
||||
<!-- ======== START OF CLASS DATA ======== -->
|
||||
<H2>
|
||||
<FONT SIZE="-1">
|
||||
com.sun.jna</FONT>
|
||||
<BR>
|
||||
Interface AltCallingConvention</H2>
|
||||
<DL>
|
||||
<DT><B>All Known Subinterfaces:</B> <DD><A HREF="../../../com/sun/jna/examples/win32/GDI32.html" title="interface in com.sun.jna.examples.win32">GDI32</A>, <A HREF="../../../com/sun/jna/examples/win32/Kernel32.html" title="interface in com.sun.jna.examples.win32">Kernel32</A>, <A HREF="../../../com/sun/jna/examples/win32/Kernel32.OVERLAPPED_COMPLETION_ROUTINE.html" title="interface in com.sun.jna.examples.win32">Kernel32.OVERLAPPED_COMPLETION_ROUTINE</A>, <A HREF="../../../com/sun/jna/examples/win32/Shell32.html" title="interface in com.sun.jna.examples.win32">Shell32</A>, <A HREF="../../../com/sun/jna/win32/StdCall.html" title="interface in com.sun.jna.win32">StdCall</A>, <A HREF="../../../com/sun/jna/win32/StdCallLibrary.html" title="interface in com.sun.jna.win32">StdCallLibrary</A>, <A HREF="../../../com/sun/jna/win32/StdCallLibrary.StdCallCallback.html" title="interface in com.sun.jna.win32">StdCallLibrary.StdCallCallback</A>, <A HREF="../../../com/sun/jna/examples/win32/User32.html" title="interface in com.sun.jna.examples.win32">User32</A>, <A HREF="../../../com/sun/jna/examples/win32/User32.HOOKPROC.html" title="interface in com.sun.jna.examples.win32">User32.HOOKPROC</A>, <A HREF="../../../com/sun/jna/examples/win32/User32.LowLevelKeyboardProc.html" title="interface in com.sun.jna.examples.win32">User32.LowLevelKeyboardProc</A>, <A HREF="../../../com/sun/jna/examples/win32/User32.WNDENUMPROC.html" title="interface in com.sun.jna.examples.win32">User32.WNDENUMPROC</A>, <A HREF="../../../com/sun/jna/examples/win32/W32API.html" title="interface in com.sun.jna.examples.win32">W32API</A></DD>
|
||||
</DL>
|
||||
<HR>
|
||||
<DL>
|
||||
<DT><PRE>public interface <B>AltCallingConvention</B></DL>
|
||||
</PRE>
|
||||
|
||||
<P>
|
||||
Tagging interface to indicate the library or callback uses an alternate
|
||||
calling convention.
|
||||
<P>
|
||||
|
||||
<P>
|
||||
<DL>
|
||||
<DT><B>Author:</B></DT>
|
||||
<DD>twall</DD>
|
||||
</DL>
|
||||
<HR>
|
||||
|
||||
<P>
|
||||
|
||||
<P>
|
||||
<!-- ========= END OF CLASS DATA ========= -->
|
||||
<HR>
|
||||
|
||||
|
||||
<!-- ======= START OF BOTTOM NAVBAR ====== -->
|
||||
<A NAME="navbar_bottom"><!-- --></A>
|
||||
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
|
||||
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
|
||||
<TR>
|
||||
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
|
||||
<A NAME="navbar_bottom_firstrow"><!-- --></A>
|
||||
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
|
||||
<TR ALIGN="center" VALIGN="top">
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</TD>
|
||||
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
|
||||
<b>JNA API</><font size=-1> 3.0</font></EM>
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
<TR>
|
||||
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
||||
PREV CLASS
|
||||
<A HREF="../../../com/sun/jna/Callback.html" title="interface in com.sun.jna"><B>NEXT CLASS</B></A></FONT></TD>
|
||||
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
||||
<A HREF="../../../index.html?com/sun/jna/AltCallingConvention.html" target="_top"><B>FRAMES</B></A>
|
||||
<A HREF="AltCallingConvention.html" target="_top"><B>NO FRAMES</B></A>
|
||||
<SCRIPT type="text/javascript">
|
||||
<!--
|
||||
if(window==top) {
|
||||
document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
|
||||
}
|
||||
//-->
|
||||
</SCRIPT>
|
||||
<NOSCRIPT>
|
||||
<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
|
||||
</NOSCRIPT>
|
||||
|
||||
|
||||
</FONT></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
|
||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD</FONT></TD>
|
||||
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
|
||||
DETAIL: FIELD | CONSTR | METHOD</FONT></TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
<A NAME="skip-navbar_bottom"></A>
|
||||
<!-- ======== END OF BOTTOM NAVBAR ======= -->
|
||||
|
||||
<HR>
|
||||
<center><i>Copyright © 2007 Timothy Wall. All Rights Reserved.</i></center>
|
||||
</BODY>
|
||||
</HTML>
|
||||
calling convention.
|
||||
<P>
|
||||
|
||||
<P>
|
||||
<DL>
|
||||
<DT><B>Author:</B></DT>
|
||||
<DD>twall</DD>
|
||||
</DL>
|
||||
<HR>
|
||||
|
||||
<P>
|
||||
|
||||
<P>
|
||||
<!-- ========= END OF CLASS DATA ========= -->
|
||||
<HR>
|
||||
|
||||
|
||||
<!-- ======= START OF BOTTOM NAVBAR ====== -->
|
||||
<A NAME="navbar_bottom"><!-- --></A>
|
||||
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
|
||||
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
|
||||
<TR>
|
||||
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
|
||||
<A NAME="navbar_bottom_firstrow"><!-- --></A>
|
||||
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
|
||||
<TR ALIGN="center" VALIGN="top">
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</TD>
|
||||
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
|
||||
<b>JNA API</><font size="-1"> 3.0.4</font></EM>
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
<TR>
|
||||
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
||||
PREV CLASS
|
||||
<A HREF="../../../com/sun/jna/Callback.html" title="interface in com.sun.jna"><B>NEXT CLASS</B></A></FONT></TD>
|
||||
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
||||
<A HREF="../../../index.html?com/sun/jna/AltCallingConvention.html" target="_top"><B>FRAMES</B></A>
|
||||
<A HREF="AltCallingConvention.html" target="_top"><B>NO FRAMES</B></A>
|
||||
<SCRIPT type="text/javascript">
|
||||
<!--
|
||||
if(window==top) {
|
||||
document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
|
||||
}
|
||||
//-->
|
||||
</SCRIPT>
|
||||
<NOSCRIPT>
|
||||
<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
|
||||
</NOSCRIPT>
|
||||
|
||||
|
||||
</FONT></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
|
||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD</FONT></TD>
|
||||
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
|
||||
DETAIL: FIELD | CONSTR | METHOD</FONT></TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
<A NAME="skip-navbar_bottom"></A>
|
||||
<!-- ======== END OF BOTTOM NAVBAR ======= -->
|
||||
|
||||
<HR>
|
||||
<center><i>Copyright © 2007-2008 Timothy Wall. All Rights Reserved.</i></center>
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
||||
Alguns arquivos não foram exibidos porque demasiados arquivos foram alterados neste diff Mostrar Mais
Referência em uma Nova Issue
Bloquear um usuário