theKernel 10.0
Loading...
Searching...
No Matches
MkExceptionC_jv.c File Reference

tag: nhi1-release-250425 More...

#include <jni.h>
#include "LibMkKernel_jv.h"
+ Include dependency graph for MkExceptionC_jv.c:

Go to the source code of this file.

Macros

#define META_FILE_NAME   "MkExceptionC_jv.c"
 

Functions

void jvmkkernel_MkExceptionC_Raise (JNIEnv *env, MK_MNGN mng, MK_STRN const doc, MK_STRN const file, MK_I32 const line)
 
JNIEXPORT void JNICALL Java_jvmkkernel_MkExceptionC_Dispose (JNIEnv *env, jobject self)
 
MK_ERR jvmkkernel_MkExceptionC_Catch (JNIEnv *env, MK_MNGN mng, jthrowable ex, MK_STRN const proc, MK_STRN const stop)
 

Detailed Description

tag: nhi1-release-250425

Definition in file MkExceptionC_jv.c.

Macro Definition Documentation

◆ META_FILE_NAME

#define META_FILE_NAME   "MkExceptionC_jv.c"

Definition at line 10 of file MkExceptionC_jv.c.

Function Documentation

◆ Java_jvmkkernel_MkExceptionC_Dispose()

JNIEXPORT void JNICALL Java_jvmkkernel_MkExceptionC_Dispose ( JNIEnv * env,
jobject self )

Definition at line 40 of file MkExceptionC_jv.c.

41{
42 MK_ERR hdl = MkErr((MK_MNG)(*env)->GetLongField(env,self,NS(FID_MkExceptionC_hdl)));
43 MkRtSetup_X(hdl);
44 if (hdl) MkRefDecr_X(hdl);
45 (*env)->SetLongField(env,self,NS(FID_MkExceptionC_hdl),0);
46 return;
47}
static MK_ERR MkErr(MK_MNG mng)
cast a unknown-object into an MkErrorS pointer or NULL if not possible
MK_PTRB * MK_MNG
managed object pointer, datatype will be checked at runtime
#define MkRefDecr_X(x)
#define MkRtSetup_X(x)
The data-type to store and handle the error-condition …

◆ jvmkkernel_MkExceptionC_Catch()

MK_ERR jvmkkernel_MkExceptionC_Catch ( JNIEnv * env,
MK_MNGN mng,
jthrowable ex,
MK_STRN const proc,
MK_STRN const stop )

Definition at line 49 of file MkExceptionC_jv.c.

56{
57 if (ex == NULL) ex = (*env)->ExceptionOccurred(env);
58 MK_ERR const err = MkErrorFORMAT_1M(mng);
59 MkRtSetup_XN(err);
60
61 // is the ERROR from "java" or "jvmkkernel"
62 if (OT_LNG_OBJ_CLASS_IS(ex, NS(Class_MkExceptionC))) {
63 // error is from "jvmkkernel"
64 MK_ERR newerr = (MK_ERR) (*env)->GetLongField(env,ex,NS(FID_MkExceptionC_hdl));
65 if (newerr) {
66 MkErrorSetE(err, newerr);
67 (*env)->CallObjectMethod(env,ex,NS(MID_MkExceptionC_EXIT));
68 }
69
70 } else {
71 (*env)->CallStaticVoidMethod(
72 env, MK(Class_MkExceptionC), MK(MID_MkExceptionC_Catch),
73 MK(MkErrorC_ObjNew)(MK_RT_CALL env,err), ex, JC2O(env, proc), JC2O(env, stop)
74 );
75 }
76 (*env)->ExceptionClear(env);
77
78 return err;
79}
struct MkErrorS * MK_ERR
class-shortcut for struct MkErrorS *, all shortcut using the XX_YYY syntax (only for public API) …
#define MkErrorSetE(...)
#define MkErrorFORMAT_1M(m)
#define MkRtSetup_XN(x)
#define MK_RT_CALL

◆ jvmkkernel_MkExceptionC_Raise()

void jvmkkernel_MkExceptionC_Raise ( JNIEnv * env,
MK_MNGN mng,
MK_STRN const doc,
MK_STRN const file,
MK_I32 const line )

Definition at line 17 of file MkExceptionC_jv.c.

24{
25 MK_ERR err = MkErrorFORMAT_1M(mng);
26 MkRtSetup_XN(err);
27 MkErrorStackFormat(err,doc,file,line);
28 NS(pGetCallerStack)(MK_RT_CALL env, err);
29 MK_ERR newerr = MkErrCheck(mng) && mng != err ? (MK_ERR)mng : MkErrorDup(err);
30 MkRefIncr_1X(newerr);
31
32 jthrowable exp = (*env)->NewObject(env, NS(Class_MkExceptionC), NS(MID_MkExceptionC_INIT),
33 (jlong) newerr, JC2O(env, (MK_STRN)MkErrorGetTextI(err)));
34
35 (*env)->Throw(env, exp);
36
37 MkErrorReset_1(err);
38}
static bool MkErrCheck(MK_MNGN mng)
check MkErrorS -> MkObjectS::signature …
#define MkErrorGetTextI(e)
get the MkErrorS::text …
#define MkErrorReset_1(err)
#define MkErrorStackFormat(...)
#define MkErrorDup(...)
const MK_STRB * MK_STRN
constant string pointer data-type
#define MkRefIncr_1X(x)