Provides Octave's Java interface. More...
#include <algorithm>
#include <array>
#include <fstream>
#include <map>
#include <string>
#include <vector>
#include <clocale>
#include "Cell.h"
#include "builtin-defun-decls.h"
#include "cmd-edit.h"
#include "defaults.h"
#include "defun.h"
#include "error.h"
#include "errwarn.h"
#include "file-ops.h"
#include "file-stat.h"
#include "fpucw-wrappers.h"
#include "interpreter.h"
#include "interpreter-private.h"
#include "load-path.h"
#include "lo-sysdep.h"
#include "oct-env.h"
#include "oct-process.h"
#include "oct-shlib.h"
#include "ov-java.h"
#include "parse.h"
#include "variables.h"
#include <jni.h>
Go to the source code of this file.
Classes | |
class | java_local_ref< T > |
class | JVMArgs |
Macros | |
#define | BOX_PRIMITIVE_ARRAY(JAVA_TYPE, JAVA_ID, JAVA_TYPE_CAP, OCTAVE_ID) |
#define | LIBJVM_FILE_NAME "libjvm.so" |
#define | TO_JAVA(obj) dynamic_cast<octave_java *> ((obj).internal_rep ()) |
#define | TO_JCLASS(obj) reinterpret_cast<jclass> (obj) |
#define | TO_JNIENV(env) reinterpret_cast<JNIEnv *> (env) |
#define | TO_JOBJECT(obj) reinterpret_cast<jobject> (obj) |
#define | UNBOX_PRIMITIVE_ARRAY(METHOD_T, OCTAVE_T, JAVA_T, JAVA_T_CAP) |
#define | UNBOX_PRIMITIVE_SCALAR(OCTAVE_T, METHOD_T, JAVA_T, JAVA_CON) |
Typedefs | |
typedef java_local_ref< jbyteArray > | jbyteArray_ref |
typedef java_local_ref< jclass > | jclass_ref |
typedef java_local_ref< jdoubleArray > | jdoubleArray_ref |
typedef java_local_ref< jintArray > | jintArray_ref |
typedef jint(JNICALL * | JNI_CreateJavaVM_t) (JavaVM **pvm, JNIEnv **penv, void *args) |
typedef jint(JNICALL * | JNI_GetCreatedJavaVMs_t) (JavaVM **pvm, jsize bufLen, jsize *nVMs) |
typedef java_local_ref< jobject > | jobject_ref |
typedef java_local_ref< jobjectArray > | jobjectArray_ref |
typedef java_local_ref< jstring > | jstring_ref |
typedef java_local_ref< jthrowable > | jthrowable_ref |
Functions | |
static octave_value | box (JNIEnv *jni_env, void *jobj_arg, void *jcls_arg) |
Convert the Java object pointed to by jobj_arg with class jcls_arg to an Octave value. More... | |
static octave_value | box_more (JNIEnv *jni_env, void *jobj_arg, void *jcls_arg=nullptr) |
static octave_value | check_exception (JNIEnv *jni_env) |
static dim_vector | compute_array_dimensions (JNIEnv *jni_env, jobject obj) |
static octave_value | convert_to_string (JNIEnv *jni_env, jobject m_java_object, bool force, char type) |
OCTAVE_EXPORT octave_value_list | F__java2mat__ (const octave_value_list &args, int) |
OCTAVE_EXPORT octave_value_list | F__java_exit__ (const octave_value_list &, int) |
OCTAVE_EXPORT octave_value_list | F__java_get__ (const octave_value_list &args, int) |
OCTAVE_NAMESPACE_BEGIN OCTAVE_EXPORT octave_value_list | F__java_init__ (const octave_value_list &, int) |
OCTAVE_EXPORT octave_value_list | F__java_set__ (const octave_value_list &args, int) |
OCTAVE_EXPORT octave_value_list | Fdebug_java (const octave_value_list &args, int nargout) |
static jclass | find_octave_class (JNIEnv *jni_env, const char *name) |
OCTAVE_EXPORT octave_value_list | Fisjava (const octave_value_list &args, int) |
OCTAVE_EXPORT octave_value_list | Fjava_matrix_autoconversion (const octave_value_list &args, int nargout) |
OCTAVE_EXPORT octave_value_list | Fjava_unsigned_autoconversion (const octave_value_list &args, int nargout) |
OCTAVE_EXPORT octave_value_list | FjavaMethod (const octave_value_list &args, int) |
OCTAVE_EXPORT octave_value_list | FjavaObject (const octave_value_list &args, int) |
static octave_value | get_array_elements (JNIEnv *jni_env, jobject jobj, const octave_value_list &idx) |
static long | get_current_thread_ID (JNIEnv *jni_env) |
Returns the id of the current thread. More... | |
static string_vector | get_invoke_list (JNIEnv *jni_env, void *jobj_arg) |
static std::string | get_jvm_lib_path_in_subdir (std::string java_home_path) |
static std::string | initial_class_path (void) |
Return the initial classpath. More... | |
static OCTAVE_NAMESPACE_END std::string | initial_java_dir (void) |
The java initialization directory is given by the environment variable OCTAVE_JAVA_DIR if defined; otherwise it is the directory of Octave's m-files defining Java functions. More... | |
static void | initialize_java (void) |
Initialize java including the virtual machine (jvm) if necessary. More... | |
static void | initialize_jvm (void) |
Initialize the java virtual machine (jvm) and field jvm if necessary. More... | |
static bool | is_auto_convertible_number (JNIEnv *jni_env, jobject jobj) |
Return whether jobj shall be automatically converted to an Octave numeric value. More... | |
static int | java_event_hook (void) |
Run the java method org.octave.Octave.checkPendingAction() . More... | |
JNIEXPORT jboolean JNICALL | Java_org_octave_Octave_call (JNIEnv *, jclass, jstring, jobjectArray, jobjectArray) |
JNIEXPORT void JNICALL | Java_org_octave_Octave_doEvalString (JNIEnv *, jclass, jstring) |
JNIEXPORT void JNICALL | Java_org_octave_Octave_doInvoke (JNIEnv *, jclass, jint, jobjectArray) |
JNIEXPORT jboolean JNICALL | Java_org_octave_Octave_needThreadedInvokation (JNIEnv *, jclass) |
JNIEXPORT void JNICALL | Java_org_octave_OctaveReference_doFinalize (JNIEnv *, jclass, jint) |
static std::string | jstring_to_string (JNIEnv *jni_env, jobject obj) |
static std::string | jstring_to_string (JNIEnv *jni_env, jstring s) |
Converts a Java string object to std::string. More... | |
static jobject | make_java_index (JNIEnv *jni_env, const octave_value_list &idx) |
static std::string | read_classpath_txt (const std::string &filepath) |
Return the classpath in the given file filepath as a string. More... | |
static octave_value | set_array_elements (JNIEnv *jni_env, jobject jobj, const octave_value_list &idx, const octave_value &rhs) |
static void | terminate_jvm (void) |
Terminate the current jvm, if there is any. More... | |
static JNIEnv * | thread_jni_env (void) |
} More... | |
static bool | unbox (JNIEnv *jni_env, const octave_value &val, jobject_ref &jobj, jclass_ref &jcls) |
static bool | unbox (JNIEnv *jni_env, const octave_value_list &args, jobjectArray_ref &jobjs, jobjectArray_ref &jclss) |
Variables | |
static JavaVM * | jvm = nullptr |
The pointer to a java virtual machine either created in the current thread or attached this thread to it. More... | |
static bool | jvm_attached = false |
Whether the current thread is attached to the jvm given by jvm. More... | |
static octave::dynamic_library | jvm_lib |
Need to keep hold of the shared library handle until exit. More... | |
static std::map< int, octave_value > | listener_map |
static int | octave_java_refcount = 0 |
static std::map< int, octave_value > | octave_ref_map |
static long | octave_thread_ID = -1 |
The thread id of the currently executing thread or -1 if this is unknown. More... | |
bool | Vdebug_java = false |
bool | Vjava_matrix_autoconversion = false |
bool | Vjava_unsigned_autoconversion = true |
Provides Octave's Java interface.
Definition in file ov-java.cc.
#define BOX_PRIMITIVE_ARRAY | ( | JAVA_TYPE, | |
JAVA_ID, | |||
JAVA_TYPE_CAP, | |||
OCTAVE_ID | |||
) |
#define LIBJVM_FILE_NAME "libjvm.so" |
Definition at line 83 of file ov-java.cc.
#define TO_JAVA | ( | obj | ) | dynamic_cast<octave_java *> ((obj).internal_rep ()) |
Definition at line 1327 of file ov-java.cc.
#define TO_JCLASS | ( | obj | ) | reinterpret_cast<jclass> (obj) |
Definition at line 87 of file ov-java.cc.
#define TO_JNIENV | ( | env | ) | reinterpret_cast<JNIEnv *> (env) |
Definition at line 89 of file ov-java.cc.
#define TO_JOBJECT | ( | obj | ) | reinterpret_cast<jobject> (obj) |
Definition at line 86 of file ov-java.cc.
#define UNBOX_PRIMITIVE_ARRAY | ( | METHOD_T, | |
OCTAVE_T, | |||
JAVA_T, | |||
JAVA_T_CAP | |||
) |
#define UNBOX_PRIMITIVE_SCALAR | ( | OCTAVE_T, | |
METHOD_T, | |||
JAVA_T, | |||
JAVA_CON | |||
) |
typedef java_local_ref<jbyteArray> jbyteArray_ref |
Definition at line 152 of file ov-java.cc.
typedef java_local_ref<jclass> jclass_ref |
Definition at line 148 of file ov-java.cc.
typedef java_local_ref<jdoubleArray> jdoubleArray_ref |
Definition at line 153 of file ov-java.cc.
typedef java_local_ref<jintArray> jintArray_ref |
Definition at line 151 of file ov-java.cc.
typedef jint(JNICALL * JNI_CreateJavaVM_t) (JavaVM **pvm, JNIEnv **penv, void *args) |
Definition at line 91 of file ov-java.cc.
typedef jint(JNICALL * JNI_GetCreatedJavaVMs_t) (JavaVM **pvm, jsize bufLen, jsize *nVMs) |
Definition at line 94 of file ov-java.cc.
typedef java_local_ref<jobject> jobject_ref |
Definition at line 147 of file ov-java.cc.
typedef java_local_ref<jobjectArray> jobjectArray_ref |
Definition at line 150 of file ov-java.cc.
typedef java_local_ref<jstring> jstring_ref |
Definition at line 149 of file ov-java.cc.
typedef java_local_ref<jthrowable> jthrowable_ref |
Definition at line 154 of file ov-java.cc.
|
static |
Convert the Java object pointed to by jobj_arg
with class jcls_arg
to an Octave value.
jni_env | JNI environment pointer. |
jobj_arg | Pointer to a Java object. |
jcls_arg | Optional pointer to the Java class of jobj_arg . |
double
if jobj_arg
is of type Byte
, Short
, Integer
, Long
, Float
or Double
jobj_arg
is of type Boolean
jobj_arg
is of type Character
or String
jobj_arg
is a Java array of primitive types jobj_arg
is of type org.octave.Matrix
and Vjava_matrix_autoconversion is enabled jobj_arg
is of type org.octave.OctaveReference
octave_java
object wrapping the Java object otherwise. Definition at line 1386 of file ov-java.cc.
References BOX_PRIMITIVE_ARRAY, octave_value::convert_to_str(), find_octave_class(), Array< T, Alloc >::fortran_vec(), is_auto_convertible_number(), octave_value::is_undefined(), jstring_to_string(), Matrix, dim_vector::ndims(), Array< T, Alloc >::numel(), octave_ref_map, octave_value(), dim_vector::resize(), TO_JCLASS, TO_JOBJECT, Vjava_matrix_autoconversion, and Vjava_unsigned_autoconversion.
Referenced by octave::CheckBoxControl::CheckBoxControl(), octave::PopupMenuControl::PopupMenuControl(), box_more(), octave_java::do_java_get(), octave_java::do_javaMethod(), get_array_elements(), Java_org_octave_Octave_call(), Java_org_octave_Octave_doInvoke(), octave::ft_text_renderer::render(), set_array_elements(), octave::shortcut_manager::shortcut_dialog(), octave::ft_text_renderer::text_to_pixels(), octave::ft_text_renderer::text_to_strlist(), octave::CheckBoxControl::update(), and octave::PopupMenuControl::update().
|
static |
Definition at line 1586 of file ov-java.cc.
References box(), Array< T, Alloc >::fortran_vec(), octave_value::is_undefined(), Array< T, Alloc >::isempty(), octave_value::isjava(), jstring_to_string(), len, Matrix, octave_set_default_fpucw(), octave_value(), Matrix::resize(), TO_JCLASS, TO_JOBJECT, and Matrix::transpose().
Referenced by F__java2mat__().
|
static |
Definition at line 967 of file ov-java.cc.
References error(), jstring_to_string(), Matrix, and Vdebug_java.
Referenced by convert_to_string(), octave_java::do_java_get(), octave_java::do_java_set(), octave_java::do_javaMethod(), octave_java::do_javaObject(), get_array_elements(), make_java_index(), and set_array_elements().
|
static |
Definition at line 1077 of file ov-java.cc.
References java_local_ref< T >::detach(), len, dim_vector::ndims(), octave_set_default_fpucw(), and dim_vector::resize().
Referenced by octave_java::dims().
|
static |
Definition at line 1268 of file ov-java.cc.
References check_exception(), error(), jstring_to_string(), len, octave_set_default_fpucw(), and octave_value().
Referenced by octave_java::convert_to_str_internal().
OCTAVE_EXPORT octave_value_list F__java2mat__ | ( | const octave_value_list & | args, |
int | |||
) |
Definition at line 3339 of file ov-java.cc.
References box_more(), err_disabled_feature(), initialize_java(), ovl(), print_usage(), thread_jni_env(), TO_JAVA, and octave_java::to_java().
OCTAVE_EXPORT octave_value_list F__java_exit__ | ( | const octave_value_list & | , |
int | |||
) |
Definition at line 3067 of file ov-java.cc.
References err_disabled_feature(), ovl(), and terminate_jvm().
OCTAVE_EXPORT octave_value_list F__java_get__ | ( | const octave_value_list & | args, |
int | |||
) |
Definition at line 3236 of file ov-java.cc.
References octave_java::do_java_get(), err_disabled_feature(), error(), initialize_java(), name, print_usage(), octave_value::string_value(), thread_jni_env(), and TO_JAVA.
Referenced by octave_java::subsref().
OCTAVE_NAMESPACE_BEGIN OCTAVE_EXPORT octave_value_list F__java_init__ | ( | const octave_value_list & | , |
int | |||
) |
Definition at line 3041 of file ov-java.cc.
References err_disabled_feature(), and initialize_java().
OCTAVE_EXPORT octave_value_list F__java_set__ | ( | const octave_value_list & | args, |
int | |||
) |
Definition at line 3296 of file ov-java.cc.
References octave_java::do_java_set(), err_disabled_feature(), error(), initialize_java(), name, print_usage(), octave_value::string_value(), thread_jni_env(), and TO_JAVA.
Referenced by octave_java::subsasgn().
OCTAVE_EXPORT octave_value_list Fdebug_java | ( | const octave_value_list & | args, |
int | nargout | ||
) |
Definition at line 3447 of file ov-java.cc.
References err_disabled_feature(), set_internal_variable(), and Vdebug_java.
|
static |
Definition at line 997 of file ov-java.cc.
References jstring_to_string(), and name.
Referenced by box(), octave_java::do_java_get(), octave_java::do_java_set(), octave_java::do_javaMethod(), octave_java::do_javaObject(), get_array_elements(), java_event_hook(), set_array_elements(), and unbox().
OCTAVE_EXPORT octave_value_list Fisjava | ( | const octave_value_list & | args, |
int | |||
) |
Definition at line 3472 of file ov-java.cc.
References ovl(), and print_usage().
OCTAVE_EXPORT octave_value_list Fjava_matrix_autoconversion | ( | const octave_value_list & | args, |
int | nargout | ||
) |
Definition at line 3385 of file ov-java.cc.
References err_disabled_feature(), set_internal_variable(), and Vjava_matrix_autoconversion.
OCTAVE_EXPORT octave_value_list Fjava_unsigned_autoconversion | ( | const octave_value_list & | args, |
int | nargout | ||
) |
Definition at line 3417 of file ov-java.cc.
References err_disabled_feature(), set_internal_variable(), and Vjava_unsigned_autoconversion.
OCTAVE_EXPORT octave_value_list FjavaMethod | ( | const octave_value_list & | args, |
int | |||
) |
Definition at line 3161 of file ov-java.cc.
References octave_java::do_javaMethod(), err_disabled_feature(), error(), initialize_java(), print_usage(), octave_value::string_value(), thread_jni_env(), and TO_JAVA.
Referenced by octave_java::subsref().
OCTAVE_EXPORT octave_value_list FjavaObject | ( | const octave_value_list & | args, |
int | |||
) |
Definition at line 3100 of file ov-java.cc.
References octave_java::do_javaObject(), err_disabled_feature(), initialize_java(), ovl(), print_usage(), and thread_jni_env().
|
static |
Definition at line 1149 of file ov-java.cc.
References box(), check_exception(), find_octave_class(), make_java_index(), and octave_set_default_fpucw().
Referenced by octave_java::subsref().
|
static |
Returns the id of the current thread.
jni_env | The current environment or nullptr . |
jni_env
is nullptr
, for example. Definition at line 1950 of file ov-java.cc.
Referenced by initialize_java(), and Java_org_octave_Octave_needThreadedInvokation().
|
static |
Definition at line 1208 of file ov-java.cc.
References jstring_to_string(), octave_set_default_fpucw(), string_vector::sort(), and TO_JOBJECT.
Referenced by octave_java::map_keys().
|
static |
Definition at line 512 of file ov-java.cc.
References LIBJVM_FILE_NAME.
Referenced by initialize_jvm().
|
static |
Return the initial classpath.
The initial classpath starts with a pointer to octave.jar
which is located in the initial java directory given by #java_init_dir().
javaclasspath.m
drops this. On the other hand, this is vital because octave.jar
contains the java core classes of octave's java interface.The rest of the classpath is read sequentially from files javaclasspath.txt
located in either:
Definition at line 423 of file ov-java.cc.
References octave::sys::file_ops::dir_sep_str(), error(), octave::sys::env::get_current_directory(), octave::sys::env::get_home_directory(), initial_java_dir(), read_classpath_txt(), and octave::sys::file_ops::tilde_expand().
Referenced by initialize_jvm().
|
static |
The java initialization directory is given by the environment variable OCTAVE_JAVA_DIR
if defined; otherwise it is the directory of Octave's m-files defining Java functions.
The Java initialization directory is the directory where resides:
octave.jar
, defining the java classes implementing octave's java interface,javaclasspath.txt
, defining the installation defined portion of the (static) classpath,java.opts
, defining the configurable options of the java virtual machine.Note that the (static) java classpath of the java virtual machine starts with octave.jar
, and that the static java classpath ends with what is read from javaclasspath.txt
located in the initial java directory. Moreover, the java virtual machine is created essentially with the options given by java.opts
.
Definition at line 344 of file ov-java.cc.
References octave::sys::file_ops::dir_sep_str(), config::fcn_file_dir(), and octave::sys::env::getenv().
Referenced by initial_class_path(), and initialize_jvm().
|
static |
Initialize java including the virtual machine (jvm) if necessary.
Initializes the fields jvm, jvm_attached, jvm_lib, and octave_thread_ID. To ensure that java is initialized, this method is used as part of octave functions javaObject
, javaMethod
, __java_get__
, __java_set__
, and __java2mat__
.
Definition at line 2005 of file ov-java.cc.
References octave::command_editor::add_event_hook(), error(), get_current_thread_ID(), initialize_jvm(), java_event_hook(), jvm, octave_set_default_fpucw(), octave_thread_ID, and thread_jni_env().
Referenced by F__java2mat__(), F__java_get__(), F__java_init__(), F__java_set__(), FjavaMethod(), and FjavaObject().
|
static |
Initialize the java virtual machine (jvm) and field jvm if necessary.
If the jvm exists and is initialized, jvm points to it, i.e. is not 0 and there is nothing to do.
If jvm is 0 and if at least one jvm exists, attach the current thread to it by setting jvm_attached. Otherwise, create a jvm with some hard- coded options:
classpath
is given by initial_class_path().Further options are read from the file java.opts
in the directory given by #java_init_dir().
Note that initial_class_path() determines the initial classpath. This is the static classpath which cannot be changed. Elements of the dynamic classpath can be added and removed using the m-file scripts javaaddpath.m
and javarmpath.m
.
The number of created jvm's.
Definition at line 669 of file ov-java.cc.
References octave::sys::file_ops::dir_sep_str(), error(), octave::process_execution_result::exit_status(), get_jvm_lib_path_in_subdir(), octave::sys::env::getenv(), initial_class_path(), initial_java_dir(), jvm, jvm_attached, jvm_lib, LIBJVM_FILE_NAME, octave::run_command_and_return_output(), octave::dynamic_library::search(), and octave::process_execution_result::stdout_output().
Referenced by initialize_java().
|
static |
Return whether jobj
shall be automatically converted to an Octave numeric value.
If jobj
is an instance of any of the numeric wrapper classes Byte
, Integer
, Long
, Short
, Float
, or Double
, then it will be converted using the java.lang.Number.doubleValue()
method.
jobj | Java object being returned to Octave |
true
if jobj
shall be converted into a numeric value automatically, false
otherwise Definition at line 1340 of file ov-java.cc.
Referenced by box().
|
static |
Run the java method org.octave.Octave.checkPendingAction()
.
Definition at line 1978 of file ov-java.cc.
References find_octave_class(), octave_set_default_fpucw(), and thread_jni_env().
Referenced by initialize_java().
JNIEXPORT jboolean JNICALL Java_org_octave_Octave_call | ( | JNIEnv * | env, |
jclass | , | ||
jstring | funcName, | ||
jobjectArray | argin, | ||
jobjectArray | argout | ||
) |
Definition at line 2029 of file ov-java.cc.
References box(), octave::feval(), jstring_to_string(), and unbox().
JNIEXPORT void JNICALL Java_org_octave_Octave_doEvalString | ( | JNIEnv * | env, |
jclass | , | ||
jstring | cmd | ||
) |
Definition at line 2096 of file ov-java.cc.
References octave::__get_interpreter__(), and jstring_to_string().
JNIEXPORT void JNICALL Java_org_octave_Octave_doInvoke | ( | JNIEnv * | env, |
jclass | , | ||
jint | ID, | ||
jobjectArray | args | ||
) |
Definition at line 2056 of file ov-java.cc.
References box(), octave_value::cell_value(), octave_value::columns(), error(), octave::feval(), octave_value::function_value(), octave_value::is_function_handle(), octave_value::iscell(), len, octave_value::length(), Array< T, Alloc >::numel(), octave_ref_map, and octave_value::rows().
JNIEXPORT jboolean JNICALL Java_org_octave_Octave_needThreadedInvokation | ( | JNIEnv * | env, |
jclass | |||
) |
Definition at line 2107 of file ov-java.cc.
References get_current_thread_ID(), and octave_thread_ID.
JNIEXPORT void JNICALL Java_org_octave_OctaveReference_doFinalize | ( | JNIEnv * | , |
jclass | , | ||
jint | ID | ||
) |
Definition at line 2050 of file ov-java.cc.
References octave_ref_map.
|
static |
Definition at line 870 of file ov-java.cc.
References jstring_to_string().
|
static |
Converts a Java string object to std::string.
{
Definition at line 855 of file ov-java.cc.
Referenced by box(), box_more(), check_exception(), convert_to_string(), find_octave_class(), get_invoke_list(), octave_java::init(), Java_org_octave_Octave_call(), Java_org_octave_Octave_doEvalString(), and jstring_to_string().
|
static |
Definition at line 1112 of file ov-java.cc.
References check_exception(), octave::idx_vector::length(), octave_value_list::length(), and octave::index_exception::set_pos_if_unset().
Referenced by get_array_elements(), and set_array_elements().
|
static |
Return the classpath in the given file filepath
as a string.
In the classpath file, each line which is neither empty nor a comment, is interpreted as a segment of a path. Comment lines are those starting with a #
or with a %
in the very first column.
filepath | The path to the file (usually classpath.txt ) containing a portion of the classpath. |
filepath
which are neither comments nor empty without trailing whitespace separated by 'octave::directory_path::path_sep_str()'. The returned string also starts with that path separator. Definition at line 375 of file ov-java.cc.
References octave::sys::ifstream(), octave::directory_path::path_sep_str(), and octave::sys::file_ops::tilde_expand().
Referenced by initial_class_path().
|
static |
Definition at line 1176 of file ov-java.cc.
References box(), check_exception(), find_octave_class(), make_java_index(), octave_set_default_fpucw(), and unbox().
Referenced by octave_java::subsasgn().
|
static |
Terminate the current jvm, if there is any.
Otherwise, detach the jvm if this thread is attached to it and unload it if this thread created it itself.
Definition at line 831 of file ov-java.cc.
References octave::dynamic_library::close(), jvm, jvm_attached, jvm_lib, and octave_set_default_fpucw().
Referenced by F__java_exit__().
|
inlinestatic |
}
Returns a reference to the jni (java native interface) environment of the Java virtual machine jvm.
nullptr
. Definition at line 895 of file ov-java.cc.
References jvm.
Referenced by octave_java::convert_to_str_internal(), octave_java::dims(), octave_java::do_java_get(), octave_java::do_java_set(), octave_java::do_javaMethod(), octave_java::do_javaObject(), F__java2mat__(), F__java_get__(), F__java_set__(), FjavaMethod(), FjavaObject(), octave_java::init(), initialize_java(), octave_java::is_instance_of(), octave_java::is_java_string(), java_event_hook(), octave_java::map_keys(), octave_java::release(), octave_java::subsasgn(), and octave_java::subsref().
|
static |
Definition at line 1688 of file ov-java.cc.
References octave_value::array_value(), octave_value::cellstr_value(), octave_value::class_name(), octave_value::columns(), java_local_ref< T >::detach(), octave_value::dims(), error(), find_octave_class(), Array< T, Alloc >::fortran_vec(), octave_value::int32_array_value(), octave_value::int8_array_value(), octave_value::is_bool_scalar(), octave_value::is_double_type(), octave_value::is_int16_type(), octave_value::is_int32_type(), octave_value::is_int64_type(), octave_value::is_int8_type(), octave_value::is_matrix_type(), octave_value::is_range(), octave_value::is_real_matrix(), octave_value::is_real_scalar(), octave_value::is_string(), octave_value::is_uint16_type(), octave_value::is_uint32_type(), octave_value::is_uint64_type(), octave_value::is_uint8_type(), octave_value::iscellstr(), octave_value::isempty(), octave_value::isfloat(), octave_value::isjava(), octave_value::islogical(), octave_value::isreal(), dim_vector::isvector(), octave_value::matrix_value(), dim_vector::ndims(), octave_value::numel(), Array< T, Alloc >::numel(), octave_java_refcount, octave_ref_map, octave_value::rows(), octave_value::string_value(), TO_JAVA, octave_java::to_java(), TO_JOBJECT, octave_value::uint8_array_value(), UNBOX_PRIMITIVE_ARRAY, UNBOX_PRIMITIVE_SCALAR, and Vjava_matrix_autoconversion.
Referenced by octave_java::do_java_set(), octave_java::do_javaMethod(), octave_java::do_javaObject(), Java_org_octave_Octave_call(), set_array_elements(), and unbox().
|
static |
Definition at line 1912 of file ov-java.cc.
References octave_value_list::length(), and unbox().
|
static |
The pointer to a java virtual machine either created in the current thread or attached this thread to it.
Definition at line 198 of file ov-java.cc.
Referenced by initialize_java(), initialize_jvm(), terminate_jvm(), and thread_jni_env().
|
static |
Whether the current thread is attached to the jvm given by jvm.
This is false
also if no jvm exists, i.e. if jvm is nullptr
.
Definition at line 205 of file ov-java.cc.
Referenced by initialize_jvm(), and terminate_jvm().
|
static |
Need to keep hold of the shared library handle until exit.
Definition at line 211 of file ov-java.cc.
Referenced by initialize_jvm(), and terminate_jvm().
|
static |
Definition at line 213 of file ov-java.cc.
|
static |
Definition at line 215 of file ov-java.cc.
Referenced by unbox().
|
static |
Definition at line 214 of file ov-java.cc.
Referenced by box(), Java_org_octave_Octave_doInvoke(), Java_org_octave_OctaveReference_doFinalize(), and unbox().
|
static |
The thread id of the currently executing thread or -1
if this is unknown.
Definition at line 221 of file ov-java.cc.
Referenced by initialize_java(), and Java_org_octave_Octave_needThreadedInvokation().
bool Vdebug_java = false |
Definition at line 225 of file ov-java.cc.
Referenced by check_exception(), Fdebug_java(), JVMArgs::read_java_opts(), and JVMArgs::update().
bool Vjava_matrix_autoconversion = false |
Definition at line 223 of file ov-java.cc.
Referenced by box(), Fjava_matrix_autoconversion(), and unbox().
bool Vjava_unsigned_autoconversion = true |
Definition at line 224 of file ov-java.cc.
Referenced by box(), and Fjava_unsigned_autoconversion().