151 lines
6.6 KiB
Diff
151 lines
6.6 KiB
Diff
--- jffi-jffi-1.2.12/build.xml 2016-04-29 23:23:51.000000000 +0200
|
|
+++ jffi-jffi-1.2.12/build.xml 2019-04-03 20:08:43.577425168 +0200
|
|
@@ -151,9 +151,10 @@
|
|
<target name="-post-jar" depends="-assemble-final-jar"/>
|
|
|
|
<target name="-do-compile" depends="-init">
|
|
+ <mkdir dir="${build.native.dir}"/>
|
|
<mkdir dir="${build.classes.dir}"/>
|
|
<!-- Compile the java code from ${src} into ${build} -->
|
|
- <javac srcdir="${src.dir}" destdir="${build.classes.dir}" includeantruntime="false"/>
|
|
+ <javac srcdir="${src.dir}" destdir="${build.classes.dir}" nativeheaderdir="${build.native.dir}" includeantruntime="false"/>
|
|
</target>
|
|
|
|
<target name="-compile-java" depends="-do-compile"/>
|
|
@@ -282,26 +283,10 @@
|
|
|
|
|
|
<target name="-generate-version" depends="-init,-init-vars,-generate-version-source">
|
|
- <javac target="1.6" destdir="${build.classes.dir}" srcdir="${build.dir}/java" includeantruntime="false"/>
|
|
+ <javac target="1.6" destdir="${build.classes.dir}" srcdir="${build.dir}/java" nativeheaderdir="${build.native.dir}" includeantruntime="false"/>
|
|
</target>
|
|
|
|
- <target name="-generate-native-headers" depends="-init-vars,-generate-version,-compile-java">
|
|
- <mkdir dir="${build.native.dir}"/>
|
|
- <mkdir dir="${build.classes.dir}"/>
|
|
- <javah classpath="${build.classes.dir}" destdir="${build.native.dir}" force="yes">
|
|
- <class name="com.kenai.jffi.Foreign"/>
|
|
- <class name="com.kenai.jffi.ObjectBuffer"/>
|
|
- <class name="com.kenai.jffi.Version"/>
|
|
- </javah>
|
|
- <!--
|
|
- <exec executable="javah" failonerror="true">
|
|
- <arg line="-d ${build.native.dir}"/>
|
|
- <arg line="-classpath ${build.classes.dir}"/>
|
|
- <arg line="com.kenai.jffi.Foreign"/>
|
|
- <arg line="com.kenai.jffi.ObjectBuffer"/>
|
|
- </exec>
|
|
- -->
|
|
- </target>
|
|
+ <target name="-generate-native-headers" depends="-init-vars,-generate-version,-compile-java" />
|
|
|
|
<target name="-build-native-library" depends="-init-vars, -generate-native-headers, -generate-version">
|
|
<mkdir dir="${build.native.dir}"/>
|
|
--- jffi-jffi-1.2.12/src/main/java/com/kenai/jffi/ObjectBuffer.java 2016-04-29 23:23:51.000000000 +0200
|
|
+++ jffi-jffi-1.2.12/src/main/java/com/kenai/jffi/ObjectBuffer.java 2019-04-03 20:00:13.598956759 +0200
|
|
@@ -32,55 +32,57 @@
|
|
|
|
package com.kenai.jffi;
|
|
|
|
+import java.lang.annotation.Native;
|
|
+
|
|
/**
|
|
* Holds objects the native code must handle - such as primitive arrays
|
|
*/
|
|
final class ObjectBuffer {
|
|
/** Copy the array contents to native memory before calling the function */
|
|
- public static final int IN = 0x1;
|
|
+ @Native public static final int IN = 0x1;
|
|
|
|
/** After calling the function, reload the array contents from native memory */
|
|
- public static final int OUT = 0x2;
|
|
+ @Native public static final int OUT = 0x2;
|
|
|
|
/** Append a NUL byte to the array contents after copying to native memory */
|
|
- public static final int ZERO_TERMINATE = 0x4;
|
|
+ @Native public static final int ZERO_TERMINATE = 0x4;
|
|
|
|
/** Pin the array memory and pass the JVM memory pointer directly to the function */
|
|
- public static final int PINNED = 0x8;
|
|
+ @Native public static final int PINNED = 0x8;
|
|
|
|
/** For OUT arrays, clear the temporary native memory area */
|
|
- public static final int CLEAR = 0x10;
|
|
+ @Native public static final int CLEAR = 0x10;
|
|
|
|
/*
|
|
* WARNING: The following flags cannot be altered without recompiling the native code
|
|
*/
|
|
- static final int INDEX_SHIFT = 16;
|
|
- static final int INDEX_MASK = 0x00ff0000;
|
|
- static final int TYPE_SHIFT = 24;
|
|
- static final int TYPE_MASK = 0xff << TYPE_SHIFT;
|
|
- static final int PRIM_MASK = 0x0f << TYPE_SHIFT;
|
|
- static final int FLAGS_SHIFT = 0;
|
|
- static final int FLAGS_MASK = 0xff;
|
|
-
|
|
- static final int ARRAY = 0x10 << TYPE_SHIFT;
|
|
- static final int BUFFER = 0x20 << TYPE_SHIFT;
|
|
- static final int JNI = 0x40 << TYPE_SHIFT;
|
|
-
|
|
- static final int BYTE = 0x1 << TYPE_SHIFT;
|
|
- static final int SHORT = 0x2 << TYPE_SHIFT;
|
|
- static final int INT = 0x3 << TYPE_SHIFT;
|
|
- static final int LONG = 0x4 << TYPE_SHIFT;
|
|
- static final int FLOAT = 0x5 << TYPE_SHIFT;
|
|
- static final int DOUBLE = 0x6 << TYPE_SHIFT;
|
|
- static final int BOOLEAN = 0x7 << TYPE_SHIFT;
|
|
- static final int CHAR = 0x8 << TYPE_SHIFT;
|
|
+ @Native static final int INDEX_SHIFT = 16;
|
|
+ @Native static final int INDEX_MASK = 0x00ff0000;
|
|
+ @Native static final int TYPE_SHIFT = 24;
|
|
+ @Native static final int TYPE_MASK = 0xff << TYPE_SHIFT;
|
|
+ @Native static final int PRIM_MASK = 0x0f << TYPE_SHIFT;
|
|
+ @Native static final int FLAGS_SHIFT = 0;
|
|
+ @Native static final int FLAGS_MASK = 0xff;
|
|
+
|
|
+ @Native static final int ARRAY = 0x10 << TYPE_SHIFT;
|
|
+ @Native static final int BUFFER = 0x20 << TYPE_SHIFT;
|
|
+ @Native static final int JNI = 0x40 << TYPE_SHIFT;
|
|
+
|
|
+ @Native static final int BYTE = 0x1 << TYPE_SHIFT;
|
|
+ @Native static final int SHORT = 0x2 << TYPE_SHIFT;
|
|
+ @Native static final int INT = 0x3 << TYPE_SHIFT;
|
|
+ @Native static final int LONG = 0x4 << TYPE_SHIFT;
|
|
+ @Native static final int FLOAT = 0x5 << TYPE_SHIFT;
|
|
+ @Native static final int DOUBLE = 0x6 << TYPE_SHIFT;
|
|
+ @Native static final int BOOLEAN = 0x7 << TYPE_SHIFT;
|
|
+ @Native static final int CHAR = 0x8 << TYPE_SHIFT;
|
|
|
|
/* NOTE: The JNI types can overlap the primitive type, since they are mutually exclusive */
|
|
/** The JNIEnv address */
|
|
- public static final int JNIENV = 0x1 << TYPE_SHIFT;
|
|
+ @Native public static final int JNIENV = 0x1 << TYPE_SHIFT;
|
|
|
|
/** The jobject handle */
|
|
- public static final int JNIOBJECT = 0x2 << TYPE_SHIFT;
|
|
+ @Native public static final int JNIOBJECT = 0x2 << TYPE_SHIFT;
|
|
|
|
/** The objects stored in this buffer */
|
|
private Object[] objects;
|
|
--- jffi-jffi-1.2.12/version.xml 2016-04-29 23:23:51.000000000 +0200
|
|
+++ jffi-jffi-1.2.12/version.xml 2019-04-03 20:04:11.168106751 +0200
|
|
@@ -8,11 +8,12 @@
|
|
<mkdir dir="${build.dir}/java/com/kenai/jffi"/>
|
|
<echo file="${build.dir}/java/com/kenai/jffi/Version.java" append="false">
|
|
package com.kenai.jffi;
|
|
+ import java.lang.annotation.Native;
|
|
public final class Version {
|
|
private Version() {}
|
|
- public static final int MAJOR = ${jffi.version.major};
|
|
- public static final int MINOR = ${jffi.version.minor};
|
|
- public static final int MICRO = ${jffi.version.micro};
|
|
+ @Native public static final int MAJOR = ${jffi.version.major};
|
|
+ @Native public static final int MINOR = ${jffi.version.minor};
|
|
+ @Native public static final int MICRO = ${jffi.version.micro};
|
|
}
|
|
</echo>
|
|
</target>
|
|
|
|
|