theKernel 10.0 NHI1 - theKernel - theLink - theConfig - theSq3Lite - theCompiler - theBrain - theGuard
c - tcl - cs - py - rb - jv - cc
Loading...
Searching...
No Matches
MkObjectC_Obj_C_API

MkObjectC - managed-object details More...

+ Collaboration diagram for MkObjectC_Obj_C_API:

Functions

MK_OBJ MkObjCopy_RT (MK_RT mkrt, MK_OBJ const tgtmng, MK_OBJN const srcmng)
 call the copy from the object
 
MK_OBJ MkObjReset_RT (MK_RT mkrt, MK_OBJ const obj)
 free the internal memory of an object and initialize the local variables to default values
 

MkSelf

typedef void(* MkSelfIncrF) (MK_RT mkrt, MK_PTR self, MK_PTR const env)
 
typedef void(* MkSelfDecrF) (MK_RT mkrt, MK_PTR self, MK_PTR const env)
 
static void MkSelfSet (MK_OBJ const obj, MK_PTR const self, MK_PTR const env)
 set the MkObjectS::self value
 
static MK_PTR MkSelfGet (MK_OBJ const obj)
 get the MkObjectS::self value
 
static MK_ATTR_HOT enum MkErrorE MkSelfNew_RT (MK_RT mkrt, MK_OBJ obj, MK_PTR *self_out, MK_PTR const env)
 return the self pointer for a given obj
 
MK_PTR MkSelfCreate_RT (MK_RT mkrt, MK_OBJ const obj, MK_PTR const env)
 create the MkObjectS::self value
 
bool MkSelfDelete_RT (MK_RT mkrt, MK_OBJ const obj)
 delete the MkObjectS::self value
 
bool MkSelfDeleteForce_RT (MK_RT mkrt, MK_OBJ obj)
 force delete an instance, last step in instance-destructor
 
void MkSelfUnlink_RT (MK_RT mkrt, MK_OBJ obj)
 Run the MkTypeS::selfUnlink slot from the instance...
 
static bool MkSelfExists (MK_OBJN obj)
 Check if the MkObjectS::self exists …
 
#define MkSelfSet_3X(x, self, env)
 
#define MkSelfGet_1X(x)
 
#define MkSelfNew_3X(x, self_out, env)
 
#define MkSelfCreate_2X(x, env)
 
#define MkSelfDelete_1X(x)
 
#define MkSelfDeleteForce_1X(x)
 
#define MkSelfUnlink_1X(x)
 
#define MkSelfExists_1X(x)
 

MkRef…

reference management functions

static void MkRefIncr (MK_OBJ obj)
 increment the reference-count
 
void MkRefDecr_RT (MK_RT mkrt, MK_OBJ obj)
 decrement the reference-count
 
static void MkRefIncrSelf (MK_OBJ const obj, MK_PTR const self, MK_PTR const env)
 ATOMIC operation -> link self with reference-count.
 
MK_OBJ MkRefDecrWithoutSelf_RT (MK_RT mkrt, MK_OBJ const obj)
 ATOMIC operation -> unlink self with reference-count.
 
MK_OBJ MkRefDecrWithUnlinkSelf_RT (MK_RT mkrt, MK_OBJ const obj)
 ATOMIC operation -> unlink self from META und decr-ref-count in MQ.
 
static MK_I32 MkRefGet (MK_OBJ const obj)
 get the reference-count
 
static MK_I32 MkRefLock (MK_OBJ const obj)
 lock the object
 
static bool MkRefIsLocked (MK_OBJ const obj)
 check if object is locked
 
MK_NUM MkRefCidN_RT (MK_RT mkrt)
 return the reference-count-recursion-level
 
#define MkRefLOCK   999999
 unchangeable reference
 
#define MkRefIncr_1X(x)
 
#define MkRefIncr_1M(m)
 
#define MkRefIncr_FX(x)
 protect code-block, do not call the destructor…
 
#define MkRefDecr_O(o)
 
#define MkRefDecr_X(x)
 
#define MkRefDecr_X_NULL(x)
 same as MkRefDecr_X but do not expect a runtime-cache.
 
#define MkRefDecr_M(m)
 
#define MkRefDecr_M_NULL(m)
 same as MkRefDecr_M but do not expect a runtime-cache.
 
#define MkRefDecr_FX(x)
 protect code-block, do not call the destructor…
 
#define MkRefIncrSelf_2X(x, s)
 
#define MkRefGet_1X(x)
 
#define MkRefLock_1X(x)
 
#define MkRefIsLocked_1X(x)
 
#define MkRefSet(target, source)
 update target with source and keep the MkObjectS::refCount in sync
 

MkObjectC - MkObjectC_Obj_C_API - function

MK_I32 MkRefGetP (MK_OBJ const obj)
 Non-inline replacement for MkRefGet
 
void MkRefIncrSelfP (MK_OBJ const obj, MK_PTR const self, MK_PTR const env)
 Non-inline replacement for MkRefIncrSelf
 
MK_BOOL MkRefIsLockedP (MK_OBJ const obj)
 Non-inline replacement for MkRefIsLocked
 
MK_I32 MkRefLockP (MK_OBJ const obj)
 Non-inline replacement for MkRefLock
 
MK_BOOL MkSelfExistsP (MK_OBJN obj)
 Non-inline replacement for MkSelfExists
 
MK_PTR MkSelfGetP (MK_OBJ const obj)
 Non-inline replacement for MkSelfGet
 
void MkSelfSetP (MK_OBJ const obj, MK_PTR const self, MK_PTR const env)
 Non-inline replacement for MkSelfSet
 
enum MkErrorE MkSelfNewP (MK_RT mkrt, MK_OBJ obj, MK_PTR *self_out, MK_PTR const env)
 Non-inline replacement for MkSelfNew
 
void MkRefIncrP (MK_OBJ obj)
 Non-inline replacement for MkRefIncr
 

MkObjectC - MkObjectC_Obj_C_API - overload

#define MkRefCidN_NULL()
 
#define MkObjCopy_NULL(...)
 
#define MkObjCopy(...)
 
#define MkObjReset_NULL(...)
 
#define MkObjReset(...)
 
#define MkRefDecrWithUnlinkSelf_NULL(...)
 
#define MkRefDecrWithUnlinkSelf(...)
 
#define MkRefDecrWithoutSelf_NULL(...)
 
#define MkRefDecrWithoutSelf(...)
 
#define MkSelfCreate_NULL(...)
 
#define MkSelfCreate(...)
 
#define MkSelfNew_NULL(...)
 
#define MkSelfNew(...)
 
#define MkSelfNew_E(...)
 
#define MkSelfNew_C(...)
 
#define MkRefCidN_NULL()
 
#define MkRefCidN()
 
#define MkRefDecr_NULL(...)
 
#define MkRefDecr(...)
 
#define MkSelfDelete_NULL(...)
 
#define MkSelfDelete(...)
 
#define MkSelfDeleteForce_NULL(...)
 
#define MkSelfDeleteForce(...)
 
#define MkSelfUnlink_NULL(...)
 
#define MkSelfUnlink(...)
 

Detailed Description

MkObjectC - managed-object details

Managed-Object-Technology (MOT) is a class system in C that is designed to integrate automatically into other software, which of course also includes other programming languages.

See also
Managed-Object

Macro Definition Documentation

◆ MkObjCopy

#define MkObjCopy ( ...)
Value:
MK_OBJ MkObjCopy_RT(MK_RT mkrt, MK_OBJ const tgtmng, MK_OBJN const srcmng)
call the copy from the object
#define MK_RT_CALL

Definition at line 1639 of file kernel_overload_mk.h.

◆ MkObjCopy_NULL

#define MkObjCopy_NULL ( ...)
Value:
#define MK_RT_CALL_NULL

Definition at line 1638 of file kernel_overload_mk.h.

◆ MkObjReset

#define MkObjReset ( ...)
Value:
MK_OBJ MkObjReset_RT(MK_RT mkrt, MK_OBJ const obj)
free the internal memory of an object and initialize the local variables to default values

Definition at line 1641 of file kernel_overload_mk.h.

◆ MkObjReset_NULL

#define MkObjReset_NULL ( ...)
Value:

Definition at line 1640 of file kernel_overload_mk.h.

◆ MkRefCidN

#define MkRefCidN ( )
Value:
MK_NUM MkRefCidN_RT(MK_RT mkrt)
return the reference-count-recursion-level
#define MK_RT_CALL_ONLY

Definition at line 1659 of file kernel_overload_mk.h.

◆ MkRefCidN_NULL [1/2]

#define MkRefCidN_NULL ( )
Value:

Definition at line 1658 of file kernel_overload_mk.h.

◆ MkRefCidN_NULL [2/2]

#define MkRefCidN_NULL ( )
Value:

Definition at line 4560 of file LibMkKernel_mk.h.

◆ MkRefDecr

#define MkRefDecr ( ...)
Value:
void MkRefDecr_RT(MK_RT mkrt, MK_OBJ obj)
decrement the reference-count

Definition at line 1661 of file kernel_overload_mk.h.

◆ MkRefDecr_FX

#define MkRefDecr_FX ( x)
Value:
do { --(MkOBJ_R(x).refCount); } while(0)
#define MkOBJ_R(x)
cast a known-object into an MkObjectS reference

protect code-block, do not call the destructor…

Only call MkRefIncr_FX and MkRefDecr_FX together

MkRefIncr_FX(instance);
// do some operation which COULD call the destructor
MkRefDecr_FX(instance);
if (instance->refCount <= 0) {
// instance have to be deleted → clean up!!
MkSelfDeleteForce(instance); // DELETE!
}
#define MkRefDecr_FX(x)
protect code-block, do not call the destructor…
#define MkRefIncr_FX(x)
protect code-block, do not call the destructor…
#define MkSelfDeleteForce(...)

Definition at line 4457 of file LibMkKernel_mk.h.

◆ MkRefDecr_M

#define MkRefDecr_M ( m)
Value:
do { MkRefDecr_RT(MK_RT_CALL MkObj(m)); m=NULL; } while (0)
static MK_OBJ MkObj(MK_MNG mng)
cast a unknown-object into an MkObjectS pointer or NULL if not possible

decrement MkObjectS::refCount with runtime-cast of the instance-pointer.

Parameters
[in]mOnly use this if you dont trust the pointer. The pointer-cast will be MK_NULL if the pointer is invalid or broken.

Definition at line 4452 of file LibMkKernel_mk.h.

◆ MkRefDecr_M_NULL

#define MkRefDecr_M_NULL ( m)
Value:
do { MkRefDecr_RT(MK_RT_NULL MkObj(m)); m=NULL; } while (0)
#define MK_RT_NULL

same as MkRefDecr_M but do not expect a runtime-cache.

Definition at line 4454 of file LibMkKernel_mk.h.

◆ MkRefDecr_NULL

#define MkRefDecr_NULL ( ...)
Value:

Definition at line 1660 of file kernel_overload_mk.h.

◆ MkRefDecr_O

#define MkRefDecr_O ( o)
Value:
do { MkRefDecr_RT(MK_RT_CALL o); o=NULL; } while (0)

decrement MkObjectS::refCount without cast of the object-pointer.

Parameters
[in]oPrefer this if you trust the pointer and the pointer is a MkObjectC.

Definition at line 4441 of file LibMkKernel_mk.h.

◆ MkRefDecr_X

#define MkRefDecr_X ( x)
Value:
do { MkRefDecr_RT(MK_RT_CALL MkOBJ(x)); x=NULL; } while (0)
#define MkOBJ(x)
cast a known-object into an MkObjectS pointer

decrement MkObjectS::refCount with compiletime-cast of the instance-pointer.

Parameters
[in]xPrefer this if you trust the pointer and the pointer is not a MkObjectC.

Definition at line 4445 of file LibMkKernel_mk.h.

◆ MkRefDecr_X_NULL

#define MkRefDecr_X_NULL ( x)
Value:
do { MkRefDecr_RT(MK_RT_NULL MkOBJ(x)); x=NULL; } while (0)

same as MkRefDecr_X but do not expect a runtime-cache.

Definition at line 4447 of file LibMkKernel_mk.h.

◆ MkRefDecrWithoutSelf

#define MkRefDecrWithoutSelf ( ...)
Value:
MK_OBJ MkRefDecrWithoutSelf_RT(MK_RT mkrt, MK_OBJ const obj)
ATOMIC operation -> unlink self with reference-count.

Definition at line 1645 of file kernel_overload_mk.h.

◆ MkRefDecrWithoutSelf_NULL

#define MkRefDecrWithoutSelf_NULL ( ...)
Value:

Definition at line 1644 of file kernel_overload_mk.h.

◆ MkRefDecrWithUnlinkSelf

#define MkRefDecrWithUnlinkSelf ( ...)
Value:
MK_OBJ MkRefDecrWithUnlinkSelf_RT(MK_RT mkrt, MK_OBJ const obj)
ATOMIC operation -> unlink self from META und decr-ref-count in MQ.

Definition at line 1643 of file kernel_overload_mk.h.

◆ MkRefDecrWithUnlinkSelf_NULL

#define MkRefDecrWithUnlinkSelf_NULL ( ...)
Value:

Definition at line 1642 of file kernel_overload_mk.h.

◆ MkRefGet_1X

#define MkRefGet_1X ( x)
Value:
static MK_I32 MkRefGet(MK_OBJ const obj)
get the reference-count

Definition at line 4525 of file LibMkKernel_mk.h.

◆ MkRefIncr_1M

#define MkRefIncr_1M ( m)
Value:
static void MkRefIncr(MK_OBJ obj)
increment the reference-count

Definition at line 4407 of file LibMkKernel_mk.h.

◆ MkRefIncr_1X

#define MkRefIncr_1X ( x)
Value:

Definition at line 4406 of file LibMkKernel_mk.h.

◆ MkRefIncr_FX

#define MkRefIncr_FX ( x)
Value:

protect code-block, do not call the destructor…

Only call MkRefIncr_FX and MkRefDecr_FX together

MkRefIncr_FX(instance);
// do some operation which COULD call the destructor
MkRefDecr_FX(instance);
if (instance->refCount <= 0) {
// instance have to be deleted → clean up!!
MkSelfDeleteForce(instance); // DELETE!
}

Definition at line 4422 of file LibMkKernel_mk.h.

◆ MkRefIncrSelf_2X

#define MkRefIncrSelf_2X ( x,
s )
Value:
static void MkRefIncrSelf(MK_OBJ const obj, MK_PTR const self, MK_PTR const env)
ATOMIC operation -> link self with reference-count.

Definition at line 4474 of file LibMkKernel_mk.h.

◆ MkRefIsLocked_1X

#define MkRefIsLocked_1X ( x)
Value:
static bool MkRefIsLocked(MK_OBJ const obj)
check if object is locked

Definition at line 4544 of file LibMkKernel_mk.h.

◆ MkRefLOCK

#define MkRefLOCK   999999

unchangeable reference

Definition at line 4396 of file LibMkKernel_mk.h.

◆ MkRefLock_1X

#define MkRefLock_1X ( x)
Value:
static MK_I32 MkRefLock(MK_OBJ const obj)
lock the object

Definition at line 4534 of file LibMkKernel_mk.h.

◆ MkRefSet

#define MkRefSet ( target,
source )
Value:
({ \
if (target != source) { \
typeof(target) targetSave=target; \
target = source;\
MkRefDecr_X(targetSave);\
MkRefIncr_1X(target);\
} \
target;\
})

update target with source and keep the MkObjectS::refCount in sync

Definition at line 4547 of file LibMkKernel_mk.h.

4547#define MkRefSet(target,source) ({ \
4548 if (target != source) { \
4549 typeof(target) targetSave=target; \
4550 target = source;\
4551 MkRefDecr_X(targetSave);\
4552 MkRefIncr_1X(target);\
4553 } \
4554 target;\
4555})

◆ MkSelfCreate

#define MkSelfCreate ( ...)
Value:
MK_PTR MkSelfCreate_RT(MK_RT mkrt, MK_OBJ const obj, MK_PTR const env)
create the MkObjectS::self value

Definition at line 1649 of file kernel_overload_mk.h.

◆ MkSelfCreate_2X

#define MkSelfCreate_2X ( x,
env )
Value:
#define MkSelfCreate(...)

Definition at line 4648 of file LibMkKernel_mk.h.

◆ MkSelfCreate_NULL

#define MkSelfCreate_NULL ( ...)
Value:

Definition at line 1648 of file kernel_overload_mk.h.

◆ MkSelfDelete

#define MkSelfDelete ( ...)
Value:
bool MkSelfDelete_RT(MK_RT mkrt, MK_OBJ const obj)
delete the MkObjectS::self value

Definition at line 1663 of file kernel_overload_mk.h.

◆ MkSelfDelete_1X

#define MkSelfDelete_1X ( x)
Value:

Definition at line 4664 of file LibMkKernel_mk.h.

◆ MkSelfDelete_NULL

#define MkSelfDelete_NULL ( ...)
Value:

Definition at line 1662 of file kernel_overload_mk.h.

◆ MkSelfDeleteForce

#define MkSelfDeleteForce ( ...)
Value:
bool MkSelfDeleteForce_RT(MK_RT mkrt, MK_OBJ obj)
force delete an instance, last step in instance-destructor

Definition at line 1665 of file kernel_overload_mk.h.

◆ MkSelfDeleteForce_1X

#define MkSelfDeleteForce_1X ( x)
Value:

Definition at line 4688 of file LibMkKernel_mk.h.

◆ MkSelfDeleteForce_NULL

#define MkSelfDeleteForce_NULL ( ...)
Value:

Definition at line 1664 of file kernel_overload_mk.h.

◆ MkSelfExists_1X

#define MkSelfExists_1X ( x)
Value:
MkSelExists(MkOBJ(x))

Definition at line 4721 of file LibMkKernel_mk.h.

◆ MkSelfGet_1X

#define MkSelfGet_1X ( x)
Value:
static MK_PTR MkSelfGet(MK_OBJ const obj)
get the MkObjectS::self value

Definition at line 4598 of file LibMkKernel_mk.h.

◆ MkSelfNew

#define MkSelfNew ( ...)
Value:
static MK_ATTR_HOT enum MkErrorE MkSelfNew_RT(MK_RT mkrt, MK_OBJ obj, MK_PTR *self_out, MK_PTR const env)
return the self pointer for a given obj …

Definition at line 1653 of file kernel_overload_mk.h.

◆ MkSelfNew_3X

#define MkSelfNew_3X ( x,
self_out,
env )
Value:
MkSelfNew(MkOBJ(x),self_out,env)
#define MkSelfNew(...)

Definition at line 4631 of file LibMkKernel_mk.h.

◆ MkSelfNew_C

#define MkSelfNew_C ( ...)
Value:
if (MkErrorCheckI(MkSelfNew(__VA_ARGS__)))
#define MkErrorCheckI(err)

Definition at line 1655 of file kernel_overload_mk.h.

◆ MkSelfNew_E

#define MkSelfNew_E ( ...)
Value:
MkErrorCheck(MkSelfNew(__VA_ARGS__))
#define MkErrorCheck(err)
check return-code and goto error on error …

Definition at line 1654 of file kernel_overload_mk.h.

◆ MkSelfNew_NULL

#define MkSelfNew_NULL ( ...)
Value:

Definition at line 1652 of file kernel_overload_mk.h.

◆ MkSelfSet_3X

#define MkSelfSet_3X ( x,
self,
env )
Value:
MkSelfSet(MkOBJ(x),self,env)
static void MkSelfSet(MK_OBJ const obj, MK_PTR const self, MK_PTR const env)
set the MkObjectS::self value

Definition at line 4587 of file LibMkKernel_mk.h.

◆ MkSelfUnlink

#define MkSelfUnlink ( ...)
Value:
void MkSelfUnlink_RT(MK_RT mkrt, MK_OBJ obj)
Run the MkTypeS::selfUnlink slot from the instance...

Definition at line 1667 of file kernel_overload_mk.h.

◆ MkSelfUnlink_1X

#define MkSelfUnlink_1X ( x)
Value:
#define MkSelfUnlink(...)

Definition at line 4712 of file LibMkKernel_mk.h.

◆ MkSelfUnlink_NULL

#define MkSelfUnlink_NULL ( ...)
Value:

Definition at line 1666 of file kernel_overload_mk.h.

Typedef Documentation

◆ MkSelfDecrF

typedef void(* MkSelfDecrF) (MK_RT mkrt,MK_PTR self, MK_PTR const env)

Definition at line 4574 of file LibMkKernel_mk.h.

◆ MkSelfIncrF

typedef void(* MkSelfIncrF) (MK_RT mkrt,MK_PTR self, MK_PTR const env)

Definition at line 4573 of file LibMkKernel_mk.h.

Function Documentation

◆ MkObjCopy_RT()

MK_OBJ MkObjCopy_RT ( MK_RT mkrt,
MK_OBJ const tgtmng,
MK_OBJN const srcmng )

call the copy from the object

Returns
the new object or MK_NULL if no Merge-Constructor is available
See also
MkObjDup_RT MkObjReset_RT

◆ MkObjReset_RT()

MK_OBJ MkObjReset_RT ( MK_RT mkrt,
MK_OBJ const obj )

free the internal memory of an object and initialize the local variables to default values

See also
MkObjDup_RT MkObjMerge_RT

◆ MkRefCidN_RT()

MK_NUM MkRefCidN_RT ( MK_RT mkrt)

return the reference-count-recursion-level

◆ MkRefDecr_RT()

void MkRefDecr_RT ( MK_RT mkrt,
MK_OBJ obj )

decrement the reference-count

Parameters
[in]mkrtthe MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only)
[in]objthe MkObjectS instance to work on - a MANAGED OBJECT after type-check and able to be supported by the MkObjectS API

◆ MkRefDecrWithoutSelf_RT()

MK_OBJ MkRefDecrWithoutSelf_RT ( MK_RT mkrt,
MK_OBJ const obj )

ATOMIC operation -> unlink self with reference-count.

First the MkObjectS::self and MkObjectS::env will be set to NULL and than MkRefDecr is called.

This api-function is used to free libmkkernel ressources on an already destroyed Target-Programming-Language (TPL) instance.

Parameters
[in]mkrtthe MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only)
[in]objthe MkObjectS instance to work on - a MANAGED OBJECT after type-check and able to be supported by the MkObjectS API
Returns
always return NULL
See also
MkRefIncr MkSelfSet MkRefIncrSelf

◆ MkRefDecrWithUnlinkSelf_RT()

MK_OBJ MkRefDecrWithUnlinkSelf_RT ( MK_RT mkrt,
MK_OBJ const obj )

ATOMIC operation -> unlink self from META und decr-ref-count in MQ.

This ATOMIC operation has 2 steps:

  1. unlink the META from SELF using the MkSelfUnlink call This api-function is used to free libmkkernel ressources on an existing Target-Programming-Language (TPL) instance.
Parameters
[in]mkrtthe MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only)
[in]objthe MkObjectS instance to work on - a MANAGED OBJECT after type-check and able to be supported by the MkObjectS API
Returns
always return NULL
See also
MkRefIncr MkSelfSet MkRefIncrSelf

◆ MkRefGet()

static MK_I32 MkRefGet ( MK_OBJ const obj)
inlinestatic

get the reference-count

Parameters
[in]objthe MkObjectS instance to work on - a MANAGED OBJECT after type-check and able to be supported by the MkObjectS API
Returns
the reference-count

Definition at line 4520 of file LibMkKernel_mk.h.

4520 {
4521 MK_INSTANCE_HDL(obj);
4522 return (*obj).refCount;
4523}
#define MK_INSTANCE_HDL(x)
+ Here is the caller graph for this function:

◆ MkRefGetP()

MK_I32 MkRefGetP ( MK_OBJ const obj)

Non-inline replacement for MkRefGet

◆ MkRefIncr()

static void MkRefIncr ( MK_OBJ obj)
inlinestatic

increment the reference-count

Parameters
[in]objthe MkObjectS instance to work on - a MANAGED OBJECT after type-check and able to be supported by the MkObjectS API

Definition at line 4402 of file LibMkKernel_mk.h.

4402 {
4403 if (obj) ++(*obj).refCount;
4404}

◆ MkRefIncrP()

void MkRefIncrP ( MK_OBJ obj)

Non-inline replacement for MkRefIncr

◆ MkRefIncrSelf()

static void MkRefIncrSelf ( MK_OBJ const obj,
MK_PTR const self,
MK_PTR const env )
inlinestatic

ATOMIC operation -> link self with reference-count.

Parameters
[in]objthe MkObjectS instance to work on - a MANAGED OBJECT after type-check and able to be supported by the MkObjectS API
[in]selfthis is the self pointer of the object in the programming-language-shell used for libmkkernel pointer.
[in]envstorage for an application specific environment pointer. (java: JNIEnv*)
See also
MkRefIncr MkSelfSet MkRefDecrWithoutSelf

Definition at line 4467 of file LibMkKernel_mk.h.

4467 {
4468 MK_INSTANCE_HDL(obj);
4469 obj->refCount++;
4470 obj->self = self;
4471 obj->env = env;
4472}

◆ MkRefIncrSelfP()

void MkRefIncrSelfP ( MK_OBJ const obj,
MK_PTR const self,
MK_PTR const env )

Non-inline replacement for MkRefIncrSelf

◆ MkRefIsLocked()

static bool MkRefIsLocked ( MK_OBJ const obj)
inlinestatic

check if object is locked

Parameters
[in]objthe MkObjectS instance to work on - a MANAGED OBJECT after type-check and able to be supported by the MkObjectS API
Returns
the boolean value

Definition at line 4540 of file LibMkKernel_mk.h.

4540 {
4541 MK_INSTANCE_HDL(obj);
4542 return (*obj).refCount >= MkRefLOCK;
4543}
#define MkRefLOCK
unchangeable reference

◆ MkRefIsLockedP()

MK_BOOL MkRefIsLockedP ( MK_OBJ const obj)

Non-inline replacement for MkRefIsLocked

◆ MkRefLock()

static MK_I32 MkRefLock ( MK_OBJ const obj)
inlinestatic

lock the object

Parameters
[in]objthe MkObjectS instance to work on - a MANAGED OBJECT after type-check and able to be supported by the MkObjectS API

Definition at line 4530 of file LibMkKernel_mk.h.

4530 {
4531 MK_INSTANCE_HDL(obj);
4532 return (*obj).refCount=MkRefLOCK;
4533}

◆ MkRefLockP()

MK_I32 MkRefLockP ( MK_OBJ const obj)

Non-inline replacement for MkRefLock

◆ MkSelfCreate_RT()

MK_PTR MkSelfCreate_RT ( MK_RT mkrt,
MK_OBJ const obj,
MK_PTR const env )

create the MkObjectS::self value

create the self from the object mng using MkTypeS::selfCreate

Parameters
[in]mkrtthe MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only)
[in]objthe MkObjectS instance to work on - a MANAGED OBJECT after type-check and able to be supported by the MkObjectS API
[in]envstorage for an application specific environment pointer. (java: JNIEnv*)
Returns
the MkObjectS::self value

◆ MkSelfDelete_RT()

bool MkSelfDelete_RT ( MK_RT mkrt,
MK_OBJ const obj )

delete the MkObjectS::self value

delete the self from obj using MkTypeS::selfDelete

Parameters
[in]mkrtthe MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only)
[in]objthe MkObjectS instance to work on - a MANAGED OBJECT after type-check and able to be supported by the MkObjectS API
Returns
true if self and mq-obj was deleted and false if self is not available or self-delete does not delete the mq-obj

◆ MkSelfDeleteForce_RT()

bool MkSelfDeleteForce_RT ( MK_RT mkrt,
MK_OBJ obj )

force delete an instance, last step in instance-destructor

A instance has two parts an PLMK (Programming-Language-Micro-Kernel)-part and a TPL-part, the PLMK (Programming-Language-Micro-Kernel)-part have to be deleted but the deletion of the TPL-part depend on the TPL object-model-philosophy. Some TPL have a HARD-delete some TPL have only a SOFT-delete, read more at MkObjectDelete.

This function will do the following steps:

  1. if available -> call MkTypeS::selfDelete if MkTypeS::selfCreate was called first
  2. if 1. was not done and MkTypeS::selfUnlink is available -> unlink the TPL-instance from the PLMK (Programming-Language-Micro-Kernel)-instance.
  3. if non-local -> set the MkObjectS::signature to MK_NULL_SIGNATURE and free the memory
Parameters
[in]mkrtthe MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only)
[in]objthe MkObjectS instance to work on - a MANAGED OBJECT after type-check and able to be supported by the MkObjectS API
Returns
MK_YES if instance is global or was already deleted and MK_NO if local

◆ MkSelfExists()

static bool MkSelfExists ( MK_OBJN obj)
inlinestatic

Check if the MkObjectS::self exists …

Definition at line 4716 of file LibMkKernel_mk.h.

4716 {
4717 MK_INSTANCE_HDL(obj);
4718 return obj->self != NULL;
4719}
MK_PTR self
link between the managed object and the object in the target-programming-language

◆ MkSelfExistsP()

MK_BOOL MkSelfExistsP ( MK_OBJN obj)

Non-inline replacement for MkSelfExists

◆ MkSelfGet()

static MK_PTR MkSelfGet ( MK_OBJ const obj)
inlinestatic

get the MkObjectS::self value

Parameters
[in]objthe MkObjectS instance to work on - a MANAGED OBJECT after type-check and able to be supported by the MkObjectS API
Returns
the MkObjectS::self value

Definition at line 4593 of file LibMkKernel_mk.h.

4593 {
4594 // BUG FIX - 1 mar 2023: remove nonnull on obj because C# require this
4595 return obj ? obj->self : NULL;
4596}
+ Here is the caller graph for this function:

◆ MkSelfGetP()

MK_PTR MkSelfGetP ( MK_OBJ const obj)

Non-inline replacement for MkSelfGet

◆ MkSelfNew_RT()

static enum MkErrorE MkSelfNew_RT ( MK_RT mkrt,
MK_OBJ obj,
MK_PTR * self_out,
MK_PTR const env )
inlinestatic

return the self pointer for a given obj

This is an important function because every return of a managed-object in a Target-Programming-Language (TPL) will call this function to check if the self is already set. If MK_YES the self is returned and if MK_NO a new self is created.

the following steps are done:

  • if obj has a self pointer (MkSelfGet)
    • if refCount > 0 return the self pointer
    • if refCount <= 0 return an error
  • if obj NOT has a self pointer... create a self pointer
Parameters
[in]mkrtthe MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only)
[in]objthe MkObjectS instance to work on - a MANAGED OBJECT after type-check and able to be supported by the MkObjectS API
[out]self_outthe new libmkkernel object as return
[in]envstorage for an application specific environment pointer. This pointer will be passed to MkTypeS::selfCreate. (example java: JNIEnv*)
Returns

Definition at line 12946 of file LibMkKernel_mk.h.

12951 {
12952 assert(self_out != NULL);
12953
12954 if (obj == NULL) {
12955 *self_out = NULL;
12956 return MK_OK;
12957 }
12958 MkRtSetup_ON_RT(obj);
12959
12960 enum MkErrorE ret = MK_OK;
12961 MK_PTR self = MkSelfGet(obj);
12962 if (self != NULL) {
12963 if (MkRefGet(obj) <= 0) {
12964 MkErrorSetV_2M(obj, "RefCount Error: object '%s' has 'self' but 'refCout <= 0", obj->type->type_name);
12965 goto error;
12966 } else {
12967 ret = MK_CONTINUE;
12968 if (MK_RT_REF.MkSelfIncrOnCacheB && MK_RT_REF.fSelfIncr) (*MK_RT_REF.fSelfIncr)(MK_RT_CALL self, env);
12969 goto end;
12970 }
12971 }
12972 self = MkSelfCreate(obj, env);
12973 if (self == NULL) {
12974 MkErrorSetV_2M(obj, "Error: '%s->SelfCreate' return a NULL pointer", obj->type->type_name);
12975 goto error;
12976 }
12977end:
12978 *self_out = self;
12979 return ret;
12980error:
12981 *self_out = NULL;
12982 return MK_ERROR;
12983}
#define MkErrorSetV_2M(err, printfmt,...)
MkErrorE
collection for the different error-codes …
@ MK_ERROR
(persistent) raise an error-event, the calling-fucntion is interrupted.
@ MK_CONTINUE
(transient) raise an continue-event, the calling-function must handle this.
@ MK_OK
(persistent) everything is OK.
MK_PTRB * MK_PTR
generic pointer data-type
#define MkRtSetup_ON_RT(o)
#define MK_RT_REF
MK_TYP type
link to the object type
MK_STRB type_name[MkTypeS_name_size]
public type name like MkBufferC

◆ MkSelfNewP()

enum MkErrorE MkSelfNewP ( MK_RT mkrt,
MK_OBJ obj,
MK_PTR * self_out,
MK_PTR const env )

Non-inline replacement for MkSelfNew

◆ MkSelfSet()

static void MkSelfSet ( MK_OBJ const obj,
MK_PTR const self,
MK_PTR const env )
inlinestatic

set the MkObjectS::self value

Parameters
[in]objthe MkObjectS instance to work on - a MANAGED OBJECT after type-check and able to be supported by the MkObjectS API
[in]selfthe target-language-self-pointer usually self or this
[in]envstorage for an application specific environment pointer. (java: JNIEnv*)

Definition at line 4581 of file LibMkKernel_mk.h.

4581 {
4582 MK_INSTANCE_HDL(obj);
4583 obj->env = env;
4584 obj->self = (obj->type->noSelf ? NULL : self);
4585}

◆ MkSelfSetP()

void MkSelfSetP ( MK_OBJ const obj,
MK_PTR const self,
MK_PTR const env )

Non-inline replacement for MkSelfSet

◆ MkSelfUnlink_RT()

void MkSelfUnlink_RT ( MK_RT mkrt,
MK_OBJ obj )

Run the MkTypeS::selfUnlink slot from the instance...

An instance has a META-part and a LNG-part, both are connected by MkObjectS::self and an LNG-specific proprietary connector. This low-level function will separate the MQpart from the LNG-part, leaving TWO independent objects.

The unlink has the following consequence:

  1. When accessing the LNG-part, a NOT-INITIALIZED-EXCEPTION is generated
  2. The MQ-part can be deleted without deleting the LNG-part
  3. Accessing the MQ-part via the LNG-code creates a new LNG-part connected to the MQ-part
Parameters
[in]mkrtthe MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only)
[in]objthe MkObjectS instance to work on - a MANAGED OBJECT after type-check and able to be supported by the MkObjectS API
Attention
this function has only an effect if the MkTypeS::selfUnlink slot is available