|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object extended byjni.JNIUtilities
A collection of utilities for generating Java Native Interface (JNI) classes.
For information about JNI, see
http://java.sun.com/docs/books/tutorial/native1.1/concepts/index.html
For information about how to create shared libraries under Windows using
Cygwin, see
http://cygwin.com/cygwin-ug-net/dll.html
For information about using JNI with Cygwin, see
http://www.inonit.com/cygwin/jni/helloWorld/c.html
meaningOfLife()
that returns a double.
meaningOfLife.c that contains
// Return the answer to "the meaning of life, the universe, and everything"
double meaningOfLife() {
return 42.0;
}
meaningOfLife.h that contains
extern "C" double meaningOfLife();
.dll
gcc -shared -o meaningOfLife.dll meaningOfLife.c
CLASSPATH=. export CLASSPATH
$PTII/bin/vergil -jniNote that the
-jni option may go away in the future
if we merge the jni facility into the main tree
Name:
output
C or C++ type:
double
Kind:
return
libraryDirectory
""
nativeFunction:
"meaningOfLife"
nativeLibrary
"meaningOfLife"
cp meaningOfLife.dll $PTII/bin cp jni/jnimeaningOfLife/JnijnimeaningOfLife.dll $PTII/bin
/cygdrive/c/Program Files/j2sdk1.4.1_01/include/win32/jni_md.h:16: syntax error before `;'See http://java.sun.com/products/jdk/faq/jni-j2sdk-faq.html#compiler" and then follow these steps:
jdk_root>/include/win32/jni_md.h,
Where jdk_root is the installation root (eg.,
c:/Program Files/Java/jdk1.5.0_01
typedef __int64 jlong;with:
#ifdef __GNUC__ typedef long long jlong; #else typedef __int64 jlong; #endif
| Method Summary | |
protected static java.io.File |
_exportCInterfaceFile(GenericJNIActor actor,
java.lang.String destinationDirectory)
Create the JNI C file. |
protected static void |
_exportDSP(GenericJNIActor actor,
java.lang.String destinationDirectory)
Export the Visual Studio project. |
protected static java.io.File |
_exportJavaInterfaceFile(GenericJNIActor actor,
java.lang.String destinationDirectory)
Create the JNI Java file. |
protected static void |
_exportMakefile(GenericJNIActor actor,
java.lang.String destinationDirectory)
Export a makefile. |
protected static java.util.Vector |
_getArguments(GenericJNIActor actor,
boolean isInput,
boolean isOutput,
boolean isReturn)
Get the arguments belonging to a GenericJNIActor. |
protected static java.lang.String |
_getArguments(GenericJNIActor actor,
boolean isInput,
boolean isOutput,
boolean isReturn,
java.lang.String separator)
Get the args belonging to this entity. |
protected static java.util.Vector |
_getArgumentsIn(GenericJNIActor actor)
Get the args In belonging to this entity. |
protected static java.lang.String |
_getArgumentsIn(GenericJNIActor actor,
java.lang.String separator)
Get the args In name belonging to this entity. |
protected static java.util.Vector |
_getArgumentsInOut(GenericJNIActor actor)
Get the args InOut belonging to this entity. |
protected static java.lang.String |
_getArgumentsInOut(GenericJNIActor actor,
java.lang.String separator)
Get the args InOut belonging to this entity. |
protected static java.lang.String |
_getArgumentsInOutWithCType(GenericJNIActor actor,
java.lang.String separator)
Get the args In belonging to a GenericJNIActor with their c type. |
protected static java.lang.String |
_getArgumentsInOutWithJNIType(GenericJNIActor actor,
java.lang.String separator)
Get the InOut args belonging to a GenericJNIActor entity with their JNI type. |
protected static java.lang.String |
_getArgumentsInOutWithJType(GenericJNIActor actor,
java.lang.String separator)
Get the InOut args belonging to a GenericJNIActor entity with their java type. |
protected static java.lang.String |
_getArgumentsInWithCType(GenericJNIActor actor,
java.lang.String separator)
Get the In args belonging to a GenericJNIActor entity with their c type. |
protected static java.lang.String |
_getArgumentsInWithJNIType(GenericJNIActor actor,
java.lang.String separator)
Get the In args belonging to a GenericJNIActor entity with their JNI type, excluding the out arguments. |
protected static java.lang.String |
_getArgumentsInWithJType(GenericJNIActor actor,
java.lang.String separator)
Get the In args belonging to a GenericJNIActor entity with their java type. |
protected static java.util.Vector |
_getArgumentsOut(GenericJNIActor actor)
Get the Out args belonging a GenericJNIActor entity. |
protected static java.lang.String |
_getArgumentsOut(GenericJNIActor actor,
java.lang.String separator)
Get the names of the out args name belonging to a GenericJNIActor. |
protected static java.lang.String |
_getArgumentsOutWithCType(GenericJNIActor actor,
java.lang.String separator)
Get the Out args belonging to a GenericJNIActor entity with their c type. |
protected static java.lang.String |
_getArgumentsOutWithJNIType(GenericJNIActor actor,
java.lang.String separator)
Get the args In belonging to this entity with their JNI type, excluding the out arguments. |
protected static java.lang.String |
_getArgumentsOutWithJType(GenericJNIActor actor,
java.lang.String separator)
Get the args Out belonging to this entity with their java type. |
protected static java.lang.String |
_getArgumentsWithCType(GenericJNIActor actor,
boolean isInput,
boolean isOutput,
boolean isReturn,
java.lang.String separator)
Get the args belonging to this entity with their c type. |
protected static java.lang.String |
_getArgumentsWithCTypeCast(GenericJNIActor actor,
boolean isInput,
boolean isOutput,
boolean isReturn,
java.lang.String separator)
Get the arguments belonging to this entity with their c type. |
protected static java.lang.String |
_getArgumentsWithJNIType(GenericJNIActor actor,
boolean isInput,
boolean isOutput,
boolean isReturn,
java.lang.String separator)
Get the arguments In belonging to this entity with their JNI type, excluding the out arguments. |
protected static java.lang.String |
_getArgumentsWithJType(GenericJNIActor actor,
boolean isInput,
boolean isOutput,
boolean isReturn,
java.lang.String separator)
Get the arguments belonging to this entity with their java type. |
protected static java.lang.String |
_signature(java.lang.String typ)
Return the signature of the interface function. |
protected static java.lang.String |
_signatureSendResults(GenericJNIActor actor)
Return the signature of the interface function. |
static boolean |
generateJNI(CompositeEntity model)
Given a model, generate JNI files for all GenericJNIActors. |
static void |
generateJNI(CompositeEntity model,
GenericJNIActor actor)
Generate JNI files for one actor in a model. |
static ExecuteCommands |
getExecuteCommands()
Get the command executor, which can be either non-graphical or graphical. |
static java.lang.String |
getNativeLibrary(GenericJNIActor actor)
Return the value of the nativeLibrary attribute with the double quotes stripped off. |
static void |
setExecuteCommands(ExecuteCommands executeCommands)
Set the command executor, which can be either non-graphical or graphical. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
public static boolean generateJNI(CompositeEntity model) throws java.lang.Exception
model - The model to generate JNI files for any
contained GenericJNIActors.
java.lang.Exception - If there was a problem creating the JNI files.public static void generateJNI(CompositeEntity model, GenericJNIActor actor) throws java.lang.Exception
model - The model that contains the actor.actor - The actor for which to generate JNI files.
java.lang.Exception - If an actor with the JNI name already
exists, if there is a problem creating or compiling the JNI files,
or if there is a problem creating the ports that correspond with
the native method parameters.public static java.lang.String getNativeLibrary(GenericJNIActor actor) throws IllegalActionException
actor - The actor that contains a nativeLibrary attribute.
IllegalActionException - If there is a problem getting
the nativeLibrary attribute.public static ExecuteCommands getExecuteCommands()
setExecuteCommands(ExecuteCommands)public static void setExecuteCommands(ExecuteCommands executeCommands)
executeCommands - The subprocess command executor.getExecuteCommands()protected static java.io.File _exportCInterfaceFile(GenericJNIActor actor, java.lang.String destinationDirectory) throws IllegalActionException, java.io.IOException
actor - Actor to generate a JNI C file for.destinationDirectory - Directory to create the file in.
IllegalActionException - If there is a problem accessing
parameters or ports.
java.io.IOException - If there is a problem writing the C files.protected static void _exportDSP(GenericJNIActor actor, java.lang.String destinationDirectory) throws IllegalActionException, java.io.IOException
actor - Actor to generate a JNI Java file for.destinationDirectory - Directory to create the file in.
IllegalActionException - If there is a problem accessing
parameters or ports.
java.io.IOException - If there is a problem writing the
Visual Studio files.protected static java.io.File _exportJavaInterfaceFile(GenericJNIActor actor, java.lang.String destinationDirectory) throws IllegalActionException, java.io.IOException
actor - Actor to generate a JNI Java file for.destinationDirectory - Directory to create the file in.
IllegalActionException - If there is a problem accessing
parameters or ports.
java.io.IOException - If there is a problem writing the Java file.protected static void _exportMakefile(GenericJNIActor actor, java.lang.String destinationDirectory) throws IllegalActionException, java.io.IOException
actor - Actor to generate a makefile for.destinationDirectory - Directory to create the file in.
IllegalActionException - If there is a problem accessing
parameters or ports.
java.io.IOException - If there is a problem writing the makefile.protected static java.util.Vector _getArguments(GenericJNIActor actor, boolean isInput, boolean isOutput, boolean isReturn)
actor - The GenericJNIActor objectisInput - True if we are searching for input arguments.isOutput - True if we are searching for output arguments.isReturn - True if we are searchin for return arguments.
protected static java.lang.String _getArguments(GenericJNIActor actor, boolean isInput, boolean isOutput, boolean isReturn, java.lang.String separator)
actor - The GenericJNIActor object.isInput - True if we are searching for input arguments.isOutput - True if we are searching for output arguments.isReturn - True if we are searchin for return arguments.separator - The separator used between multiple arguments.
protected static java.util.Vector _getArgumentsIn(GenericJNIActor actor)
actor - The GenericJNIActor object
protected static java.lang.String _getArgumentsIn(GenericJNIActor actor, java.lang.String separator)
actor - The GenericJNIActor objectseparator - The separator used between multiple arguments.
protected static java.util.Vector _getArgumentsInOut(GenericJNIActor actor)
actor - The GenericJNIActor object
protected static java.lang.String _getArgumentsInOut(GenericJNIActor actor, java.lang.String separator)
actor - The GenericJNIActor objectseparator - The separator used between multiple arguments.
protected static java.lang.String _getArgumentsInOutWithCType(GenericJNIActor actor, java.lang.String separator)
actor - The GenericJNIActor object.separator - The separator used between multiple arguments.
protected static java.lang.String _getArgumentsInOutWithJNIType(GenericJNIActor actor, java.lang.String separator)
actor - The GenericJNIActor object.separator - The separator used between multiple arguments.
protected static java.lang.String _getArgumentsInOutWithJType(GenericJNIActor actor, java.lang.String separator)
actor - The GenericJNIActor object.separator - The separator used between multiple arguments.
protected static java.lang.String _getArgumentsInWithCType(GenericJNIActor actor, java.lang.String separator)
actor - The GenericJNIActor object.separator - The separator used between multiple arguments.
protected static java.lang.String _getArgumentsInWithJNIType(GenericJNIActor actor, java.lang.String separator)
actor - The GenericJNIActor object.separator - The separator used between multiple arguments.
protected static java.lang.String _getArgumentsInWithJType(GenericJNIActor actor, java.lang.String separator)
actor - The GenericJNIActor object.separator - The separator used between multiple arguments.
protected static java.util.Vector _getArgumentsOut(GenericJNIActor actor)
actor - The GenericJNIActor object.
protected static java.lang.String _getArgumentsOut(GenericJNIActor actor, java.lang.String separator)
actor - The GenericJNIActor object.separator - The separator used between multiple arguments.
protected static java.lang.String _getArgumentsOutWithCType(GenericJNIActor actor, java.lang.String separator)
actor - The GenericJNIActor object.separator - The separator used between multiple arguments.
protected static java.lang.String _getArgumentsOutWithJNIType(GenericJNIActor actor, java.lang.String separator)
actor - The GenericJNIActor object.separator - The separator used between multiple arguments.
protected static java.lang.String _getArgumentsOutWithJType(GenericJNIActor actor, java.lang.String separator)
actor - The GenericJNIActor object.separator - The separator used between multiple arguments.
protected static java.lang.String _getArgumentsWithCType(GenericJNIActor actor, boolean isInput, boolean isOutput, boolean isReturn, java.lang.String separator)
actor - The GenericJNIActor object.isInput - True if we are searching for input arguments.isOutput - True if we are searching for output arguments.isReturn - True if we are searchin for return arguments.separator - The separator used between multiple arguments.
protected static java.lang.String _getArgumentsWithCTypeCast(GenericJNIActor actor, boolean isInput, boolean isOutput, boolean isReturn, java.lang.String separator)
actor - The GenericJNIActor object.isInput - True if we are searching for input arguments.isOutput - True if we are searching for output arguments.isReturn - True if we are searchin for return arguments.separator - The separator used between multiple arguments.
protected static java.lang.String _getArgumentsWithJNIType(GenericJNIActor actor, boolean isInput, boolean isOutput, boolean isReturn, java.lang.String separator)
actor - The GenericJNIActor object.isInput - True if we are searching for input arguments.isOutput - True if we are searching for output arguments.isReturn - True if we are searchin for return arguments.separator - The separator used between multiple arguments.
protected static java.lang.String _getArgumentsWithJType(GenericJNIActor actor, boolean isInput, boolean isOutput, boolean isReturn, java.lang.String separator)
actor - The GenericJNIActor object.isInput - True if we are searching for input arguments.isOutput - True if we are searching for output arguments.isReturn - True if we are searchin for return arguments.separator - The separator used between multiple arguments.
protected static java.lang.String _signature(java.lang.String typ)
typ - The interface function declaration.
protected static java.lang.String _signatureSendResults(GenericJNIActor actor)
actor - The GenericJNIActor object.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||