11#include "jni_h/jvmkkernel_MkKernel.h"
12#include "LibMkKernel_private_jv.h"
15JavaVM *MK(cached_jvm) = NULL;
22#define defClass(v,n) jclass v;
23#define defOAtr(v,c,n,s) jfieldID v;
24#define defSAtr(v,c,n,s) jfieldID v;
25#define defOMth(v,c,n,s) jmethodID v;
26#define defSMth(v,c,n,s) jmethodID v;
53#define MkCleanupTmpl()
69 MkErrorC_Check(NULL, errVal)
70 jobject __retVal__S = MK(pGetEnumFromString)(env,MK(Class_MkErrorE),
"Ljvmkkernel/MkErrorE;",
MkErrorE_ToString(value_out));
81 MkErrorC_Check(NULL, errVal)
82 jobject __retVal__S = MK(pGetEnumFromString)(env,MK(Class_MkIdSE),
"Ljvmkkernel/MkIdSE;",
MkIdSE_ToString(value_out));
93 MkErrorC_Check(NULL, errVal)
94 jobject __retVal__S = MK(pGetEnumFromString)(env,MK(Class_MkTimeoutE),
"Ljvmkkernel/MkTimeoutE;",
MkTimeoutE_ToString(value_out));
105 MkErrorC_Check(NULL, errVal)
106 jobject __retVal__S = MK(pGetEnumFromString)(env,MK(Class_MkTypeE),
"Ljvmkkernel/MkTypeE;",
MkTypeE_ToString(value_out));
117 enum MkErrorE value_e = MK(pGetEnumFromObj)(env, NS(Class_MkErrorE), value);
120 jint __retVal__S = __retVal__L;
129 enum MkErrorE value_e = MK(pGetEnumFromObj)(env, NS(Class_MkErrorE), value);
132 jstring __retVal__S = JC2O(env,__retVal__L);
141 enum MkIdSE value_e = MK(pGetEnumFromObj)(env, NS(Class_MkIdSE), value);
144 jint __retVal__S = __retVal__L;
153 enum MkIdSE value_e = MK(pGetEnumFromObj)(env, NS(Class_MkIdSE), value);
156 jstring __retVal__S = JC2O(env,__retVal__L);
165 enum MkTimeoutE value_e = MK(pGetEnumFromObj)(env, NS(Class_MkTimeoutE), value);
168 jint __retVal__S = __retVal__L;
177 enum MkTimeoutE value_e = MK(pGetEnumFromObj)(env, NS(Class_MkTimeoutE), value);
180 jstring __retVal__S = JC2O(env,__retVal__L);
189 enum MkTypeE value_e = MK(pGetEnumFromObj)(env, NS(Class_MkTypeE), value);
192 jint __retVal__S = __retVal__L;
201 enum MkTypeE value_e = MK(pGetEnumFromObj)(env, NS(Class_MkTypeE), value);
204 jstring __retVal__S = JC2O(env,__retVal__L);
226JNIEXPORT
void JNICALL
Setup (JNIEnv *env, jclass
class) {
241 jint get_env_result = (*MK(cached_jvm))->GetEnv(MK(cached_jvm), (
void**)env, JNI_VERSION_1_6);
242 if (get_env_result == JNI_EDETACHED) {
243 JavaVMAttachArgs args = {JNI_VERSION_10,
"libmqmsgque", NULL};
245 if ((*MK(cached_jvm))->AttachCurrentThread(MK(cached_jvm), (
void**)env, &args) == JNI_OK) {
246 did_attach_thread =
MK_OK;
251 }
else if (get_env_result == JNI_EVERSION) {
256 did_attach_thread =
MkErrorSetC_1E (
"unable to retrieve 'JNIEnv'");
257 }
else if ((**env)->ExceptionCheck(*env)) {
258 did_attach_thread =
MkErrorSetC_1E (
"exception during retrieving of 'JNIEnv'");
260 return did_attach_thread;
269JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *jvm,
void *reserved)
272 MK(cached_jvm) = jvm;
274 JavaErrorCheck0 ((*jvm)->GetEnv(jvm, (
void*) &env, JNI_VERSION_1_6));
282 JavaErrorCheck0 ((*env)->EnsureLocalCapacity(env, 50));
286#define check(v,c) if ((v=(c))==NULL) return JNI_ERR
287#define defClass(v,n) check(cls, (*env)->FindClass(env, n));\
289 check(v, (*env)->NewGlobalRef(env, cls)); \
291#define defOAtr(v,c,n,s) check(v, (*env)->GetFieldID(env,c,n,s)); \
293#define defSAtr(v,c,n,s) check(v, (*env)->GetStaticFieldID(env,c,n,s)); \
295#define defOMth(v,c,n,s) check(v, (*env)->GetMethodID(env,c,n,s)); \
297#define defSMth(v,c,n,s) check(v, (*env)->GetStaticMethodID(env,c,n,s)); \
313 return JNI_VERSION_10;
318JNIEXPORT
void JNICALL JNI_OnUnload(JavaVM *jvm,
void *reserved)
322 if ((*jvm)->GetEnv(jvm, &val, JNI_VERSION_1_6)) {
332#define defClass(v,n) (*env)->DeleteGlobalRef(env, v);
333#define defOAtr(v,c,n,s)
334#define defSAtr(v,c,n,s)
335#define defOMth(v,c,n,s)
336#define defSMth(v,c,n,s)
#define MkErrorSetC_1E(message)
MK_STRN MkTimeoutE_ToString(enum MkTimeoutE value)
return the MkTimeoutE as string …
MkTimeoutE
Predefined Timeout values …
enum MkErrorE MkIdSE_FromInt(MK_I32 const value, enum MkIdSE *value_out)
return the MkIdSE from integer …
static MK_I32 MkTypeE_ToInt(enum MkTypeE value)
return the MkTypeE as integer …
static MK_I32 MkErrorE_ToInt(enum MkErrorE value)
return the MkErrorE as integer …
static MK_I32 MkTimeoutE_ToInt(enum MkTimeoutE value)
return the MkTimeoutE as integer …
enum MkErrorE MkTypeE_FromInt(MK_I32 const value, enum MkTypeE *value_out)
return the MkTypeE from integer …
MK_STRN MkIdSE_ToString(enum MkIdSE value)
return the MkIdSE as string …
static MK_I32 MkIdSE_ToInt(enum MkIdSE value)
return the MkIdSE as integer …
enum MkErrorE MkErrorE_FromInt(MK_I32 const value, enum MkErrorE *value_out)
return the MkErrorE from integer …
enum MkErrorE MkTimeoutE_FromInt(MK_I32 const value, enum MkTimeoutE *value_out)
return the MkTimeoutE from integer …
MK_STRN MkTypeE_ToString(enum MkTypeE value)
return the MkTypeE as string …
MkErrorE
collection for the different error-codes …
MkTypeE
basic data-types supported by Programming-Language-Micro-Kernel (PLMK) …
MK_STRN MkErrorE_ToString(enum MkErrorE value)
return the MkErrorE as string …
@ MK_OK
(persistent) everything is OK.
JNIEXPORT jstring JNICALL Java_jvmkkernel_MkKernel_IdSE_1ToString(JNIEnv *env, jclass class, jobject value)
Java: [static] String IdSE_ToString(MkIdSE value) → C-API return the MkIdSE as string …
JNIEXPORT jint JNICALL Java_jvmkkernel_MkKernel_IdSE_1ToInt(JNIEnv *env, jclass class, jobject value)
Java: [static] int IdSE_ToInt(MkIdSE value) → C-API return the MkIdSE as integer …
JNIEXPORT jint JNICALL Java_jvmkkernel_MkKernel_ErrorE_1ToInt(JNIEnv *env, jclass class, jobject value)
Java: [static] int ErrorE_ToInt(MkErrorE value) → C-API return the MkErrorE as integer …
JNIEXPORT jstring JNICALL Java_jvmkkernel_MkKernel_ErrorE_1ToString(JNIEnv *env, jclass class, jobject value)
Java: [static] String ErrorE_ToString(MkErrorE value) → C-API return the MkErrorE as string …
JNIEXPORT jobject JNICALL Java_jvmkkernel_MkKernel_IdSE_1FromInt(JNIEnv *env, jclass class, jint value)
Java: [static] MkIdSE IdSE_FromInt(int value) → C-API return the MkIdSE from integer …
JNIEXPORT jobject JNICALL Java_jvmkkernel_MkKernel_ErrorE_1FromInt(JNIEnv *env, jclass class, jint value)
Java: [static] MkErrorE ErrorE_FromInt(int value) → C-API return the MkErrorE from integer …
JNIEXPORT jstring JNICALL Java_jvmkkernel_MkKernel_TypeE_1ToString(JNIEnv *env, jclass class, jobject value)
Java: [static] String TypeE_ToString(MkTypeE value) → C-API return the MkTypeE as string …
JNIEXPORT jint JNICALL Java_jvmkkernel_MkKernel_TypeE_1ToInt(JNIEnv *env, jclass class, jobject value)
Java: [static] int TypeE_ToInt(MkTypeE value) → C-API return the MkTypeE as integer …
JNIEXPORT jint JNICALL Java_jvmkkernel_MkKernel_TimeoutE_1ToInt(JNIEnv *env, jclass class, jobject value)
Java: [static] int TimeoutE_ToInt(MkTimeoutE value) → C-API return the MkTimeoutE as integer …
JNIEXPORT jobject JNICALL Java_jvmkkernel_MkKernel_TypeE_1FromInt(JNIEnv *env, jclass class, jint value)
Java: [static] MkTypeE TypeE_FromInt(int value) → C-API return the MkTypeE from integer …
JNIEXPORT jstring JNICALL Java_jvmkkernel_MkKernel_TimeoutE_1ToString(JNIEnv *env, jclass class, jobject value)
Java: [static] String TimeoutE_ToString(MkTimeoutE value) → C-API return the MkTimeoutE as strin...
JNIEXPORT jobject JNICALL Java_jvmkkernel_MkKernel_TimeoutE_1FromInt(JNIEnv *env, jclass class, jint value)
Java: [static] MkTimeoutE TimeoutE_FromInt(int value) → C-API return the MkTimeoutE from integer...
void MkSetup(void)
setup jvmkkernel internal memory …
void MkCleanup(void)
cleanup jvmkkernel internal memory …
JNIEXPORT void JNICALL Java_jvmkkernel_MkKernel_Cleanup(JNIEnv *env, jclass class)
Java: [static] Cleanup() → C-API cleanup jvmkkernel internal memory …
JNIEXPORT void JNICALL Setup(JNIEnv *env, jclass class)
Java: [static] Setup() → C-API setup jvmkkernel internal memory …
const MK_STRB * MK_STRN
constant string pointer data-type
signed int MK_I32
4 byte integer data-type
MkIdSE
signal type of the MkIdS data val …
bool MkRuntimeSysPipeHandlerUse
block SIGPIPE ignore handlern default=true, Java require this
size_t MkRuntimeCallbackAdd(MK_RT mkrt, MkRuntimeCallbackS *cbdata, MkRuntimeInitF rt_callback, MK_STRN ident)
add a callback to the runtime …
void MkRuntimeCallbackDel(MK_RT mkrt, MkRuntimeCallbackS *cbdata)
delete a callback from the runtime …
keep callback related data …