libmkkernel 9.0
Loading...
Searching...
No Matches
Modules | Data Structures | Macros | Functions
MkObjectC_C_API

The MkObjectC object known as obj or object is used as base-object type for a managed-objectMore...

+ Collaboration diagram for MkObjectC_C_API:

Modules

 MkObjectC_TOR_C_API
 Create and Destroy a managed-object.
 
 MkObjectC_Obj_C_API
 managed-object details
 
 MkObjectC_Misc_C_API
 Various functions related to the MkObjectC
 
 MkObjectC_Log_C_API
 log information to MkLogFileC (default: stderr) …
 
 MkObjectC_Dbg_C_API
 log a debugging-message to the MkLogFileC (default: stderr) …
 
 MkObjectC_Sys_C_API
 L)anguage A)bstraction L)ayer definition …
 
 MkObjectC_Introspection_C_API
 Get information from the MkTypeS.
 
 MkObjectC_Cast_C_API
 cast from defined and undefined instance to MkObjectC
 

Data Structures

struct  MkObjectProtectS
 the protect is used to "protect" data set by pAllocCreate if the new object is later initialized with a type specific object-initialization … More...
 
struct  MkObjectS
 object header … More...
 
struct  MkAllocDefS
 define the storage-allocator function More...
 
struct  MkTypeS
 define a Type object … More...
 
struct  MkDefTypeS
 BASE-TYPE all non specific types More...
 

Macros

#define MK_NULL_SIGNATURE   0
 signature used to mark an invalid signature …
 
#define MkTYP_R(x)   (*(x)).super.typ
 cast a known-managed-object into an MkTypeS reference
 
#define MkTYP(x)   (&MkTYP_R(x))
 cast a known-managed-object into an MkTypeS pointer
 
#define MkTypeSlotResolve(tt, fptr, force)
 search and return functionPtr(slot) for the tt-type.
 

Functions

MK_TYP MkTyp (const MK_MNG mng)
 type-check and cast a unknown-managed-object into an MkTypeS pointer or NULL if not possible
 
MK_TYPN MkTypN (const MK_MNGN mng)
 type-check and cast a unknown-managed-object into an MkTypeS pointer or NULL if not possible
 
MK_EXTERN MK_PTR MkTypeSlotResolveP (MK_RT const mkrt, MK_TYPN const type, size_t const offset, bool const force)
 hidden function for MkTypeSlotResolve
 

MkObjectC


typedef struct MkObjectSMK_OBJ
 class-shortcut for struct MkObjectS *, all shortcut using the XX_YYY syntax (only for public API) …
 
typedef const struct MkObjectSMK_OBJN
 class-shortcut for const struct MkObjectS *, all const shortcut using the XX_YYYC syntax (only for public API) …
 
typedef struct MkObjectS MK_OBJR
 reference-shortcut for struct MkObjectS, all shortcut using the XX_YYYR syntax (only for public API) …
 

MkObjectC type definition

typedef struct MkObjectS MkObjectCR
 instance-struct-reference same as struct MkObjectS, useable in a class-macro as: class##R
 
typedef const struct MkObjectS MkObjectCNR
 const instance-struct-reference same as const struct MkObjectS, useable in a class-macro as: class##R
 
#define MkObjectC_T   (&MK_RT_REF._MkObjectC_T)
 instance-type as specific-instance-type, useable in a class-macro as: class##_T
 
#define MkObjectC_TT   (MkTYP(MkObjectC_T))
 instance-type as common-instance-type, useable in a class-macro as: class##_TT
 
#define MkObjectST   MkObjectC_T
 instance-type as specific-instance-type
 
#define MkObjectSTT   (MkTYP(MkObjectST))
 instance-type as common-instance-type (cast from MkObjectST into MkTypeS) …
 
#define MkObjectC_type   MK_OBJ
 same as MkObjectS but useable in a class-macro as: class##_type
 
#define MkObjectCT_X(instance)   ( (struct MkDefTypeS *) (MkOBJ_R(instance).type) )
 cast from an instance into the specific-instance-type
 
#define MkObjectCTT_X(instance)   (MkOBJ_R(instance).type)
 cast from an instance into the common-instance-type
 
#define MkObjectCT_TT(typ)   ( (struct MkDefTypeS *) (typ) )
 cast from an common-instance-type into an specific-instance-type
 
#define MkObjectC_NS   MK
 map class to namespace …
 
#define MkObjectCTT   MkObjectCTT
 instance-type as common-instance-type for MkObjectC in the target-programming-language (C,C++,C#,VB.NET,Java,Python,Ruby,Perl,PHP,Tcl or GO)
 
#define MkObjectCT   ( (struct MkDefTypeS *) MkObjectCTT )
 instance-type as specific-instance-type for MkObjectC in the target-programming-language (C,C++,C#,VB.NET,Java,Python,Ruby,Perl,PHP,Tcl or GO)
 

MkObjectC slot definition

typedef MK_OBJ(* MkConstructorF) (MK_RT const mkrt, MK_TYP type, MK_PTR nat, MK_PTR lnk)
 
typedef void(* MkDestructorF) (MK_RT const mkrt, MK_OBJ const obj)
 
typedef MK_OBJ(* MkDupF) (MK_RT const mkrt, MK_OBJ const obj)
 
typedef MK_OBJ(* MkDup2F) (MK_RT const mkrt, MK_OBJ const obj, MK_STRN const ident)
 
typedef MK_OBJ(* MkMergeF) (MK_RT const mkrt, MK_OBJ const obj)
 
typedef MK_OBJ(* MkCopyF) (MK_RT const mkrt, MK_OBJ const obj, MK_OBJN const src)
 
typedef void(* MkResetF) (MK_RT const mkrt, MK_OBJ const obj)
 
typedef MK_PTR(* MkSelfCreateF) (MK_RT const mkrt, MK_OBJ const obj, MK_PTR const env)
 
typedef void(* MkSelfDeleteF) (MK_RT const mkrt, MK_PTR self, MK_PTR const env)
 
typedef void(* MkSelfUnlinkF) (MK_RT const mkrt, MK_PTR self, MK_PTR const env)
 
typedef void(* MkLogF) (MK_RT const mkrt, MK_OBJN const obj, MK_OBJ fmt, MK_INT const debug, MK_STRN const prefix, MK_INT const lvl)
 
typedef MK_STRN(* MkToStringF) (MK_RT const mkrt, MK_OBJN const obj)
 
typedef MK_PTR(* MkAllocCreateF) (MK_RT const mkrt, MK_TYP const type)
 
typedef void(* MkAllocDeleteF) (MK_RT const mkrt, MK_TYP const type, MK_PTR ptr)
 
typedef void(* MkTypeInitF) (MK_RT const mkrt, MK_TYP const type)
 
typedef bool(* MkLogFormatF) (MK_RT const mkrt, char *header, MK_SIZE const headerSize, MK_OBJN const obj, MK_STRN const caller, MK_INT const debug, MK_STRN const fmt)
 

MkTypeC type definition

typedef struct MkTypeS MkTypeCR
 instance-struct-reference same as struct MkTypeS, useable in a class-macro as: class##R
 
typedef const struct MkTypeS MkTypeCNR
 const instance-struct-reference same as const struct MkTypeS, useable in a class-macro as: class##R
 
#define MkTypeSTT   (&MK_RT_REF._MkTypeC_TT)
 instance-type as common-instance-type
 
#define MkTypeC_TT   (&MK_RT_REF._MkTypeC_TT)
 instance-type as common-instance-type, useable in a class-macro as: class##_TT
 
#define MkTypeC_type   MK_TYP
 same as MkTypeS but useable in a class-macro as: class##_type
 
#define MkTypeCT_X(instance)   ( (struct MkTypeS *) (MkOBJ_R(instance).type) )
 cast from an instance into the specific-instance-type
 
#define MkTypeCTT_X(instance)   (MkOBJ_R(instance).type)
 cast from an instance into the common-instance-type
 
#define MkTypeCT_TT(typ)   ( (struct MkTypeS *) (typ) )
 cast from an common-instance-type into an specific-instance-type
 
#define MkTypeC_NS   MK
 map class to namespace …
 
#define MkTypeCTT   MkTypeCTT
 instance-type as common-instance-type for MkTypeC in the target-programming-language (C,C++,C#,VB.NET,Java,Python,Ruby,Perl,PHP,Tcl or GO)
 
#define MkTypeCT   ( (struct MkTypeS *) MkTypeCTT )
 instance-type as specific-instance-type for MkTypeC in the target-programming-language (C,C++,C#,VB.NET,Java,Python,Ruby,Perl,PHP,Tcl or GO)
 

MkDefTypeC type definition

typedef struct MkDefTypeS MkDefTypeCR
 instance-struct-reference same as struct MkDefTypeS, useable in a class-macro as: class##R
 
typedef const struct MkDefTypeS MkDefTypeCNR
 const instance-struct-reference same as const struct MkDefTypeS, useable in a class-macro as: class##R
 
#define MkDefTypeSTT   (&MK_RT_REF._MkDefTypeC_TT)
 instance-type as common-instance-type
 
#define MkDefTypeC_TT   (&MK_RT_REF._MkDefTypeC_TT)
 instance-type as common-instance-type, useable in a class-macro as: class##_TT
 
#define MkDefTypeCT_X(instance)   ( (struct MkTypeS *) (MkOBJ_R(instance).type) )
 cast from an instance into the specific-instance-type
 
#define MkDefTypeCTT_X(instance)   (MkOBJ_R(instance).type)
 cast from an instance into the common-instance-type
 
#define MkDefTypeCT_TT(typ)   ( (struct MkTypeS *) (typ) )
 cast from an common-instance-type into an specific-instance-type
 
#define MkDefTypeC_NS   MK
 map class to namespace …
 
#define MkDefTypeCTT   MkDefTypeCTT
 instance-type as common-instance-type for MkDefTypeC in the target-programming-language (C,C++,C#,VB.NET,Java,Python,Ruby,Perl,PHP,Tcl or GO)
 
#define MkDefTypeCT   ( (struct MkTypeS *) MkDefTypeCTT )
 instance-type as specific-instance-type for MkDefTypeC in the target-programming-language (C,C++,C#,VB.NET,Java,Python,Ruby,Perl,PHP,Tcl or GO)
 

MkObjectC signature check

bool MkObjCheck (MK_MNGN mng)
 check MkObjectS%->Mk{ObjectS::signature} …
 
#define MkObjectC_Check(mng)   MkObjCheck(mng)
 

MkTypeC signature check

bool MkTypCheck (MK_MNGN mng)
 check MkTypeS%->Mk{ObjectS::signature} …
 
#define MkTypeC_Check(mng)   MkTypCheck(mng)
 

MkObjectC type check

#define __MkCheckTO(t, o)   (((*o).signature & (*t).objmask) == (*t).objsig)
 
#define _MkCheckTO(t, o)   ((o) && __MkCheckTO((t),(o)))
 
#define __MkCheckO(cls, o)   (((*o).signature & cls##_MASK) == cls##_SIGNATURE)
 
#define __MkCheckX(cls, x)   __MkCheckO(cls,(cls##_X2obj(x)))
 
#define _MkCheckX(cls, x)   ((x) && __MkCheckO(cls,(cls##_X2obj(x))))
 
#define __MkCheckM(cls, m)   __MkCheckO(cls,((MK_OBJ)(m)))
 
#define _MkCheckM(cls, m)   ((m) && __MkCheckM(cls,m))
 
#define MkCheckNN(cls, x)   __MkCheckO(cls,(cls##_X2obj(x)))
 
#define MkSanitizeCheck(_root, _m)   _MkCheckM(_root,_m)
 
#define toTT(_type)   (MkTYP(_type))
 

MkObjectC signature define

#define MkObjectC_SIGNATURE   (0x59B3u<<16)
 
#define MkObjectC_MASK   (((1u<<16)-1)<<16)
 

MkObjectC cast to superclass

#define MkObjectC_X2obj(x)   (x)
 

MkTypeC signature define

#define MkTypeC_SIGNATURE   (MkObjectC_SIGNATURE ^ (10u<<10))
 
#define MkTypeC_MASK   (((1u<<22)-1)<<10)
 

MkTypeC cast to superclass

#define MkTypeC_X2typ(x)   (x)
 
#define MkTypeC_X2obj(x)   MkOBJ(x)
 

MkDefTypeC signature define

#define MkDefTypeC_SIGNATURE   (MkTypeC_SIGNATURE ^ (1u<<6))
 
#define MkDefTypeC_MASK   (((1u<<26)-1)<<6)
 

MkDefTypeC cast to superclass

#define MkDefTypeC_X2typ(x)   MkTYP(x)
 
#define MkDefTypeC_X2obj(x)   MkOBJ(x)
 

Detailed Description

The MkObjectC object known as obj or object is used as base-object type for a managed-object

libmqmsgque is also called as Programming-Language-Micro-Kernel. libmqmsgque is like a programming-language without syntax but using the Target-Programming-Language (in our case C) of the Micro-Kernel as runtime environment.

Integration
To operate as a Micro-Kernel a maximum integration into the Target-Programming-Language is available.

This integration is done using the managed-object-technology.

Managed-Object
A managed-object is a piece of C-Code able to act as a native datatype in all Target-Programming-Languages supported.

The managed object supports low level integration features descripted in MkObjectS :

In the implementation-layer of libmkkernel only the public-features of the MkObjectC are visible to the programmer.

MANAGED OBJECT TYPES

In Programming-Language-Micro-Kernel everything is a struct, there are type-struct(s) and instance-struct(s):

  1. A type-struct is derived from MkTypeS and provide type-properties (static-properties) and type-methods (slots)
  2. A instance-struct is derived from MkObjectS and provide instance-properties and instance-methods

An instance is full defined by min 4 structs and optional base-structs :

  1. instance-struct -> base-struct(s) -> object-struct (MkObjectS)
  2. instance-type -> base-type(s) -> type-type (MkTypeS)

The following naming-convention exist for the C-API (example: MkBufferC)

name definition
MkBufferS instance-struct → This is the main-struct to define an instance
MkBufferST instance-type as specific-instance-type
MkBufferSTT instance-type as common-instance-type (cast from MkBufferST into MkTypeS) …
MkBufferC_T instance-type as specific-instance-type, useable in a class-macro as: class##_T
MkBufferC_TT instance-type as common-instance-type, useable in a class-macro as: class##_TT
MK_BUF class-shortcut for struct MkBufferS *, all shortcut using the XX_YYY syntax (only for public API) …
MK_BUFR reference-shortcut for struct MkBufferS, all shortcut using the XX_YYYR syntax (only for public API) …
MkBufferCR instance-struct-reference same as struct MkBufferS, useable in a class-macro as: class##R
MkBufferCT_X(instance) cast from an instance into the specific-instance-type
MkBufferCTT_X(instance) cast from an instance into the common-instance-type
MkBufferCT_TT(typ) cast from an common-instance-type into an specific-instance-type
MkBufferCTT instance-type as common-instance-type for MkBufferC in the target-programming-language (C,C++,C#,VB.NET,Java,Python,Ruby,Perl,PHP,Tcl or GO)
MkBufferCT instance-type as specific-instance-type for MkBufferC in the target-programming-language (C,C++,C#,VB.NET,Java,Python,Ruby,Perl,PHP,Tcl or GO)

the struct(s) are defined as:

  1. The instance-type is a type-struct able to create an instance.
  2. The type-type is a type-struct not able to create an instance but used as super-class for a instance-type and the base-type
  3. The base-type is a type-struct and used to initialize the type-properties and type-methods (called slots).
    An instance provide methods and slots. A slot is a method predefined in the type like constructor. A list of all slots are defined in MkTypeS.

    example MkBufferC : MkTypeS -> MkDefTypeS -> MkObjectST -> MkBufferST

  4. The instance is a link between the instance-struct, the base-struct the instance-type and the base-type.

    example MkBufferC : MkBufferST -> MkBufferS <- MkObjectS

  5. The base-struct is used to provide the base-instance-properties
    struct MyBaseStruct {
    union {
    struct MkObjectS obj
    } super;
    // MyBaseStruct-properties
    }
    struct MyInstanceStruct {
    union {
    struct MkObjectS obj
    struct MyBaseStruct bse
    } super;
    // MyInstanceStruct-properties
    }
    object header …
    Definition kernel_mk.h:4442

To use the specific-instance-type as argument to a function or as property in a struct the common-instance-type of type MkTypeS is used. To cast a specific-instance-type into a common-instance-type use:

  1. the path: type->super.typ
  2. the shortcut: MkTYP(type)->XYZ (pointer) or MkTYP_R(type).XYZ (reference)

To get the common-instance-type from the instance use:

  1. the path: instance->super.obj.type
  2. the shortcut: MkOBJ(instance)->type (pointer) or MkOBJ_R(instance).type (reference)

To get the base-type from the instance-type use:

  1. the path: instance->super.obj.type->base
  2. the shortcut: MkOBJ(instance)->type->base (pointer) or MkOBJ_R(instance).type->base (reference)

The predefined instance-type is an instance of the default-instance-type (MkDefTypeS) …

struct MkRuntimeS {
...
struct MkDefTypeS _MkBufferST;
...
}
BASE-TYPE all non specific types
Definition kernel_mk.h:4885
The MkRuntimeS provide a per-thread environment for LibMkKernel …

The properties and slots of the instance-type are predefined by the base-type and may be overwritten …

MkInstanceTypeInit ( MkBufferC, MkObjectC ) ;
#define MkBufferST
instance-type as specific-instance-type …
Definition kernel_mk.h:6255
MK_EXTERN void MkBufferLog_RT(MK_RT const mkrt, MK_BUFN const buf, MK_OBJN fmtobj, MK_DBG const debug, MK_STRN const callfunc, MK_INT const lvl)
log the MkBufferC …
MK_EXTERN void MkBufferReset_RT(MK_RT const mkrt, MK_BUF const buf) MK_RT_ATTR_HDL
reset a MkBufferC to the length zero …
MK_EXTERN MK_STRN MkBufferToString_RT(MK_RT const mkrt, MK_BUFN const buf) MK_RT_ATTR_HDL
get the string representation of the buf …
MK_EXTERN MK_BUF MkBufferCopy_RT(MK_RT const mkrt, MK_BUF const buf, MK_BUFN const srce) MK_RT_ATTR_HDL
copy the MkBufferC from srce to dest …
MK_EXTERN void MkBufferDelete_RT(MK_RT const mkrt, MK_BUF const buf) MK_RT_ATTR_HDL
Destructor - delete a MkBufferC instance …
MK_EXTERN MK_BUF MkBufferMerge_RT(MK_RT const mkrt, MK_BUF const buf) MK_RT_ATTR_HDL
Merge-Constructor - create a new MkBufferC as a merge from an existing object …
MK_EXTERN MK_BUF MkBufferDup_RT(MK_RT const mkrt, MK_BUFN const buf) MK_RT_ATTR_HDL
Dup-Constructor - create a new MkBufferC instance as copy from an existing MkBufferC instance
MK_OBJ(* MkMergeF)(MK_RT const mkrt, MK_OBJ const obj)
Definition kernel_mk.h:4603
MK_OBJ(* MkCopyF)(MK_RT const mkrt, MK_OBJ const obj, MK_OBJN const src)
Definition kernel_mk.h:4604
void(* MkLogF)(MK_RT const mkrt, MK_OBJN const obj, MK_OBJ fmt, MK_INT const debug, MK_STRN const prefix, MK_INT const lvl)
Definition kernel_mk.h:4612
MK_OBJ(* MkDupF)(MK_RT const mkrt, MK_OBJ const obj)
Definition kernel_mk.h:4601
void(* MkDestructorF)(MK_RT const mkrt, MK_OBJ const obj)
Definition kernel_mk.h:4600
MK_STRN(* MkToStringF)(MK_RT const mkrt, MK_OBJN const obj)
Definition kernel_mk.h:4614
#define MkTYP_R(x)
cast a known-managed-object into an MkTypeS reference
Definition kernel_mk.h:4879
void(* MkResetF)(MK_RT const mkrt, MK_OBJ const obj)
Definition kernel_mk.h:4605

The following relationship between the three different struct exists:

  1. The instance-type and the type-type have the super-class MkTypeS and the instance not.
  2. The type-type is a super-class of an instance-type.
  3. The instance-type has the 3 attributes MkTypeS::objsig, MkTypeS::objmask and MkTypeS::objsize defined, the type-type not.
  4. The instance has access to the instance-type using the cast (example MkBufferCT_X(instance))
  5. The instance-type has access to the base using MkTypeS::base and to the type using MkObjectS::type.

MANAGED OBJECT PROGRAMMING

The Programming-Language-Micro-Kernel using the manged-object technology to create a class-system with MkObjectS as the root-class.
The MkObjectS is the FIRST and REQUIRED attribute in the super-union.

  1. The instance-type is a composition of one or more super-classes and instance-attributes.
  2. All super-classes are grouped into a annonymous union called super.
  3. Only the super-class struct MkObjectS obj is required for object-management, all other super-classes are optional.
  4. The name of the super-class like obj or buf is fix and is required by tool-macros and functions.
// instance-type: MyFeatureS
struct MyStructS {
// instance super-class
union {
struct MkObjectS obj; // 'object' instance-type (required)
struct MkBufferS buf; // 'buffer' instance-type (optional,example)
} super;
// instance attribute
int myInt; …
}
The ABSTRACT-CLASS used to store a native-type-data-item defined by PRIMITIVE TYPE …
Definition kernel_mk.h:6194

A class is a link (MkObjectS::type) between:

instance-type(example: MkBufferS)
type-type(example: MkBufferSTTMkDefTypeSTTMkTypeSTT)

A class is identified by the signature (MkObjectS::signature) located at the FIRST int32 bits of the class-instance.

There are two possible "cast" operations on a managed-object :

  1. A "cast" from a pointer of unknown origin (example: MK_MNG).
  2. A "cast" from an already known managed object pointer (example: MK_BUS).

In (1) the "cast" is checked using the "signature" and in (2) the "cast" is simply resolved within the "super-class".

Example: "cast" a pointer into a MkBufferS

Example from kernel_mk.h A full class example from MkBufferS

struct MkBufferS {
// BEGIN-MkBufferS-super - created by 'cls_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
union {
struct MkObjectS obj; // base CLASS \MkObjectS
} super;
// END-MkBufferS-super - created by 'cls_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
// instance attributes
struct {
MK_NUM cursize;
enum MkTypeE type;
} var;
// instance storage
struct {
union MkBufferU first;
bool doBufferFree;
} storage;
struct ilsS {
} ils;
#define MkBufferS_ils_size 0
};
// BEGIN-MkBufferS-ClassDef - created by 'cls_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
// Signature --------------------------------------------------------------
#define MkBufferC_SIGNATURE (MkObjectC_SIGNATURE ^ (1u<<10))
#define MkBufferC_MASK (((1u<<22)-1)<<10)
// Signature --------------------------------------------------------------
#define MkBufferC_X2buf(x) (x)
#define MkBufferC_X2obj(x) MkOBJ(x)
// TypeDef --------------------------------------------------------------
__parser__(ignore) typedef struct MkBufferS MkBufferCR;
__parser__(ignore) typedef const struct MkBufferS MkBufferCNR;
#define MkBufferC_T (&MK_RT_REF._MkBufferC_T)
#define MkBufferC_TT (MkTYP(MkBufferC_T))
#define MkBufferST MkBufferC_T
#define MkBufferSTT (MkTYP(MkBufferST))
#define MkBufferC_type MK_BUF
#define MkBufferCT_X(instance) ( (struct MkDefTypeS *) (MkOBJ_R(instance).type) )
#define MkBufferCTT_X(instance) (MkOBJ_R(instance).type)
#define MkBufferCT_TT(typ) ( (struct MkDefTypeS *) (typ) )
#define MkBufferC_NS MK
#define MkBufferCTT MkBufferCTT
#define MkBufferCT ( (struct MkDefTypeS *) MkBufferCTT )
// TypeCheck --------------------------------------------------------------
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wattributes"
__parser__(class=MkBufferC,static,hide)
return MkSanitizeCheck(MkBufferC,mng);
}
#pragma GCC diagnostic pop
#define MkBufferC_Check(mng) MkBufCheck(mng)
// ObjectCast --------------------------------------------------------------
__parser__push__(prefix=Cast);
__parser__(class=MkBufferC,hide,static)
META_ATTRIBUTE_SANITIZE
return (MkBufCheck(mng) ? (MK_BUF)mng : NULL);
}
__parser__(ignore)
META_ATTRIBUTE_SANITIZE
return (MkBufCheck(mng) ? (MK_BUFN)mng : NULL);
}
#define MkBufRaise(_buf) if (!_MkCheckX(MkBufferC,_buf)) { \
MkErrorSetC_1E("'MkBufferC' hdl is NULL"); \
goto error ; \
}
#define MkBUF_R(x) (*(x)).super.buf
#define MkBUF(x) (&MkBUF_R(x))
// END-MkBufferS-ClassDef - created by 'cls_MqS.tcl -i NHI1_HOME/theKernel/libmkkernel/.libmkkernel.meta' - DO NOT change
bool MkBufCheck(MK_MNGN mng)
check MkBufferS%->Mk{ObjectS::signature} …
Definition kernel_mk.h:6286
MK_BUF MkBuf(MK_MNG mng)
cast a unknown-object into an MkBufferS pointer or NULL if not possible
Definition kernel_mk.h:6305
MK_BUFN MkBufN(MK_MNGN mng)
(const) cast a unknown-object into an MkBufferS pointer or NULL if not possible
Definition kernel_mk.h:6312
#define mk_inline
Definition kernel_mk.h:2144
MkTypeE
basic data-types supported by Programming-Language-Micro-Kernel …
Definition kernel_mk.h:3299
const MK_PTRB * MK_MNGN
const - a managed object pointer, datatype will be checked on runtime
Definition kernel_mk.h:2731
int32_t MK_NUM
array size data-type ('num' items in array …
Definition kernel_mk.h:2679
MK_PTRB * MK_MNG
managed object pointer, datatype will be checked on runtime
Definition kernel_mk.h:2728
unsigned char MK_BINB
byte-array type data-type
Definition kernel_mk.h:2706
#define MkSanitizeCheck(_root, _m)
Definition kernel_mk.h:4412
#define MkBufferS_ils_size
ILS size
Definition kernel_mk.h:6217
#define __parser__pop__
Definition kernel_mk.h:318
#define __parser__push__(...)
Definition kernel_mk.h:317
#define __parser__(...)
Definition kernel_mk.h:314
MK_NUM offset
offset from start of MkBufferS to the start of MkBufferS::ils_data
Definition kernel_mk.h:6215
MK_NUM size
size of the MkBufferS::ils_data
Definition kernel_mk.h:6214
struct MkObjectS obj
Definition kernel_mk.h:6197
union MkBufferU first
POINTER to native data representation (ILS or malloc)
Definition kernel_mk.h:6208
struct MkBufferS::ilsS ils
ILS = predefined storage used for MkBufferS::storage->first.
struct MkBufferS::@4 storage
MK_BINB ils_data[MkBufferS_ils_size]
ILS storage
Definition kernel_mk.h:6218
struct MkBufferS::@3 var
variable part of the instance-data
union MkBufferS::@2 super
MK_NUM size
the size of the data-segment
Definition kernel_mk.h:6209
bool doBufferFree
should the data be freed? -> example: pBufferRefInit
Definition kernel_mk.h:6210
a union for all data items supported by MkBufferS …
Definition kernel_mk.h:3435

Macro Definition Documentation

◆ __MkCheckM

#define __MkCheckM (   cls,
 
)    __MkCheckO(cls,((MK_OBJ)(m)))

Definition at line 4403 of file kernel_mk.h.

◆ __MkCheckO

#define __MkCheckO (   cls,
 
)    (((*o).signature & cls##_MASK) == cls##_SIGNATURE)

Definition at line 4400 of file kernel_mk.h.

◆ __MkCheckTO

#define __MkCheckTO (   t,
 
)    (((*o).signature & (*t).objmask) == (*t).objsig)

Definition at line 4398 of file kernel_mk.h.

◆ __MkCheckX

#define __MkCheckX (   cls,
 
)    __MkCheckO(cls,(cls##_X2obj(x)))

Definition at line 4401 of file kernel_mk.h.

◆ _MkCheckM

#define _MkCheckM (   cls,
 
)    ((m) && __MkCheckM(cls,m))

Definition at line 4404 of file kernel_mk.h.

◆ _MkCheckTO

#define _MkCheckTO (   t,
 
)    ((o) && __MkCheckTO((t),(o)))

Definition at line 4399 of file kernel_mk.h.

◆ _MkCheckX

#define _MkCheckX (   cls,
 
)    ((x) && __MkCheckO(cls,(cls##_X2obj(x))))

Definition at line 4402 of file kernel_mk.h.

◆ MK_NULL_SIGNATURE

#define MK_NULL_SIGNATURE   0

signature used to mark an invalid signature …

Definition at line 4420 of file kernel_mk.h.

◆ MkCheckNN

#define MkCheckNN (   cls,
 
)    __MkCheckO(cls,(cls##_X2obj(x)))

Definition at line 4406 of file kernel_mk.h.

◆ MkDefTypeC_MASK

#define MkDefTypeC_MASK   (((1u<<26)-1)<<6)

Definition at line 4901 of file kernel_mk.h.

◆ MkDefTypeC_NS

#define MkDefTypeC_NS   MK

map class to namespace …

Definition at line 4934 of file kernel_mk.h.

◆ MkDefTypeC_SIGNATURE

#define MkDefTypeC_SIGNATURE   (MkTypeC_SIGNATURE ^ (1u<<6))

Definition at line 4900 of file kernel_mk.h.

◆ MkDefTypeC_TT

#define MkDefTypeC_TT   (&MK_RT_REF._MkDefTypeC_TT)

instance-type as common-instance-type, useable in a class-macro as: class##_TT

Definition at line 4926 of file kernel_mk.h.

◆ MkDefTypeC_X2obj

#define MkDefTypeC_X2obj (   x)    MkOBJ(x)

Definition at line 4910 of file kernel_mk.h.

◆ MkDefTypeC_X2typ

#define MkDefTypeC_X2typ (   x)    MkTYP(x)

Definition at line 4909 of file kernel_mk.h.

◆ MkDefTypeCT

#define MkDefTypeCT   ( (struct MkTypeS *) MkDefTypeCTT )

instance-type as specific-instance-type for MkDefTypeC in the target-programming-language (C,C++,C#,VB.NET,Java,Python,Ruby,Perl,PHP,Tcl or GO)

Definition at line 4938 of file kernel_mk.h.

◆ MkDefTypeCT_TT

#define MkDefTypeCT_TT (   typ)    ( (struct MkTypeS *) (typ) )

cast from an common-instance-type into an specific-instance-type

Definition at line 4932 of file kernel_mk.h.

◆ MkDefTypeCT_X

#define MkDefTypeCT_X (   instance)    ( (struct MkTypeS *) (MkOBJ_R(instance).type) )

cast from an instance into the specific-instance-type

Definition at line 4928 of file kernel_mk.h.

◆ MkDefTypeCTT

#define MkDefTypeCTT   MkDefTypeCTT

instance-type as common-instance-type for MkDefTypeC in the target-programming-language (C,C++,C#,VB.NET,Java,Python,Ruby,Perl,PHP,Tcl or GO)

Definition at line 4936 of file kernel_mk.h.

◆ MkDefTypeCTT_X

#define MkDefTypeCTT_X (   instance)    (MkOBJ_R(instance).type)

cast from an instance into the common-instance-type

Definition at line 4930 of file kernel_mk.h.

◆ MkDefTypeSTT

#define MkDefTypeSTT   (&MK_RT_REF._MkDefTypeC_TT)

instance-type as common-instance-type

Definition at line 4924 of file kernel_mk.h.

◆ MkObjectC_Check

#define MkObjectC_Check (   mng)    MkObjCheck(mng)

Definition at line 4556 of file kernel_mk.h.

◆ MkObjectC_MASK

#define MkObjectC_MASK   (((1u<<16)-1)<<16)

Definition at line 4494 of file kernel_mk.h.

◆ MkObjectC_NS

#define MkObjectC_NS   MK

map class to namespace …

Definition at line 4532 of file kernel_mk.h.

◆ MkObjectC_SIGNATURE

#define MkObjectC_SIGNATURE   (0x59B3u<<16)

Definition at line 4493 of file kernel_mk.h.

◆ MkObjectC_T

#define MkObjectC_T   (&MK_RT_REF._MkObjectC_T)

instance-type as specific-instance-type, useable in a class-macro as: class##_T

Definition at line 4516 of file kernel_mk.h.

◆ MkObjectC_TT

#define MkObjectC_TT   (MkTYP(MkObjectC_T))

instance-type as common-instance-type, useable in a class-macro as: class##_TT

Definition at line 4518 of file kernel_mk.h.

◆ MkObjectC_type

#define MkObjectC_type   MK_OBJ

same as MkObjectS but useable in a class-macro as: class##_type

Definition at line 4524 of file kernel_mk.h.

◆ MkObjectC_X2obj

#define MkObjectC_X2obj (   x)    (x)

Definition at line 4502 of file kernel_mk.h.

◆ MkObjectCT

#define MkObjectCT   ( (struct MkDefTypeS *) MkObjectCTT )

instance-type as specific-instance-type for MkObjectC in the target-programming-language (C,C++,C#,VB.NET,Java,Python,Ruby,Perl,PHP,Tcl or GO)

Definition at line 4536 of file kernel_mk.h.

◆ MkObjectCT_TT

#define MkObjectCT_TT (   typ)    ( (struct MkDefTypeS *) (typ) )

cast from an common-instance-type into an specific-instance-type

Definition at line 4530 of file kernel_mk.h.

◆ MkObjectCT_X

#define MkObjectCT_X (   instance)    ( (struct MkDefTypeS *) (MkOBJ_R(instance).type) )

cast from an instance into the specific-instance-type

Definition at line 4526 of file kernel_mk.h.

◆ MkObjectCTT

#define MkObjectCTT   MkObjectCTT

instance-type as common-instance-type for MkObjectC in the target-programming-language (C,C++,C#,VB.NET,Java,Python,Ruby,Perl,PHP,Tcl or GO)

Definition at line 4534 of file kernel_mk.h.

◆ MkObjectCTT_X

#define MkObjectCTT_X (   instance)    (MkOBJ_R(instance).type)

cast from an instance into the common-instance-type

Definition at line 4528 of file kernel_mk.h.

◆ MkObjectST

#define MkObjectST   MkObjectC_T

instance-type as specific-instance-type

Definition at line 4520 of file kernel_mk.h.

◆ MkObjectSTT

#define MkObjectSTT   (MkTYP(MkObjectST))

instance-type as common-instance-type (cast from MkObjectST into MkTypeS) …

Definition at line 4522 of file kernel_mk.h.

◆ MkSanitizeCheck

#define MkSanitizeCheck (   _root,
  _m 
)    _MkCheckM(_root,_m)

Definition at line 4412 of file kernel_mk.h.

◆ MkTYP

#define MkTYP (   x)    (&MkTYP_R(x))

cast a known-managed-object into an MkTypeS pointer

Definition at line 4881 of file kernel_mk.h.

◆ MkTYP_R

#define MkTYP_R (   x)    (*(x)).super.typ

cast a known-managed-object into an MkTypeS reference

Definition at line 4879 of file kernel_mk.h.

◆ MkTypeC_Check

#define MkTypeC_Check (   mng)    MkTypCheck(mng)

Definition at line 4850 of file kernel_mk.h.

◆ MkTypeC_MASK

#define MkTypeC_MASK   (((1u<<22)-1)<<10)

Definition at line 4791 of file kernel_mk.h.

◆ MkTypeC_NS

#define MkTypeC_NS   MK

map class to namespace …

Definition at line 4826 of file kernel_mk.h.

◆ MkTypeC_SIGNATURE

#define MkTypeC_SIGNATURE   (MkObjectC_SIGNATURE ^ (10u<<10))

Definition at line 4790 of file kernel_mk.h.

◆ MkTypeC_TT

#define MkTypeC_TT   (&MK_RT_REF._MkTypeC_TT)

instance-type as common-instance-type, useable in a class-macro as: class##_TT

Definition at line 4816 of file kernel_mk.h.

◆ MkTypeC_type

#define MkTypeC_type   MK_TYP

same as MkTypeS but useable in a class-macro as: class##_type

Definition at line 4818 of file kernel_mk.h.

◆ MkTypeC_X2obj

#define MkTypeC_X2obj (   x)    MkOBJ(x)

Definition at line 4800 of file kernel_mk.h.

◆ MkTypeC_X2typ

#define MkTypeC_X2typ (   x)    (x)

Definition at line 4799 of file kernel_mk.h.

◆ MkTypeCT

#define MkTypeCT   ( (struct MkTypeS *) MkTypeCTT )

instance-type as specific-instance-type for MkTypeC in the target-programming-language (C,C++,C#,VB.NET,Java,Python,Ruby,Perl,PHP,Tcl or GO)

Definition at line 4830 of file kernel_mk.h.

◆ MkTypeCT_TT

#define MkTypeCT_TT (   typ)    ( (struct MkTypeS *) (typ) )

cast from an common-instance-type into an specific-instance-type

Definition at line 4824 of file kernel_mk.h.

◆ MkTypeCT_X

#define MkTypeCT_X (   instance)    ( (struct MkTypeS *) (MkOBJ_R(instance).type) )

cast from an instance into the specific-instance-type

Definition at line 4820 of file kernel_mk.h.

◆ MkTypeCTT

#define MkTypeCTT   MkTypeCTT

instance-type as common-instance-type for MkTypeC in the target-programming-language (C,C++,C#,VB.NET,Java,Python,Ruby,Perl,PHP,Tcl or GO)

Definition at line 4828 of file kernel_mk.h.

◆ MkTypeCTT_X

#define MkTypeCTT_X (   instance)    (MkOBJ_R(instance).type)

cast from an instance into the common-instance-type

Definition at line 4822 of file kernel_mk.h.

◆ MkTypeSlotResolve

#define MkTypeSlotResolve (   tt,
  fptr,
  force 
)
Value:
( \
tt == NULL ? NULL : /* type not valid */ \
!force && tt->fptr == (MK_PTR) 0x1 ? NULL : /* already resolved, NOT found */ \
tt->fptr > (typeof(tt->fptr)) 0x1 ? tt->fptr : /* already resolved, found */ \
tt == MkTypeSTT ? NULL : /* already at the ROOT of the type */ \
(typeof(tt->fptr)) MkTypeSlotResolveP(MK_RT_CALL tt, offsetof(struct MkTypeS, fptr), force) \
) \
MK_PTRB * MK_PTR
generic pointer data-type
Definition kernel_mk.h:2713
MK_EXTERN MK_PTR MkTypeSlotResolveP(MK_RT const mkrt, MK_TYPN const type, size_t const offset, bool const force)
hidden function for MkTypeSlotResolve
#define MkTypeSTT
instance-type as common-instance-type
Definition kernel_mk.h:4814
#define MK_RT_CALL
Definition kernel_mk.h:2367
define a Type object …
Definition kernel_mk.h:4745

search and return functionPtr(slot) for the tt-type.

The search start with tt-type and end with MkTypeS, the root of all types. With force=false the search is done only once and not-found is marked with 0x1. To be sure your functionPtr(slot) will be found add the slot very-early into the library boot. A good place will be at the Setup (constructor) or at the RuntimeInit.

Returns
the functionPtr(slot) or NULL if not found
Parameters
[in]ttthe start of the search, use MkTYP(mng) as input
[in]fptrthe attribute of tt to search for, use man offsetof for more info
[in]forceuse/notuse the 0x1 hint. If a new functionPtr(slot) was added the force=true will find it.
Attention
, this is a macro, only use arguments without overhead.

Definition at line 4962 of file kernel_mk.h.

◆ MkTypeSTT

#define MkTypeSTT   (&MK_RT_REF._MkTypeC_TT)

instance-type as common-instance-type

Definition at line 4814 of file kernel_mk.h.

◆ toTT

#define toTT (   _type)    (MkTYP(_type))

Definition at line 4415 of file kernel_mk.h.

Typedef Documentation

◆ MK_OBJ

typedef struct MkObjectS* MK_OBJ

class-shortcut for struct MkObjectS *, all shortcut using the XX_YYY syntax (only for public API) …

Definition at line 2909 of file kernel_mk.h.

◆ MK_OBJN

typedef const struct MkObjectS* MK_OBJN

class-shortcut for const struct MkObjectS *, all const shortcut using the XX_YYYC syntax (only for public API) …

Definition at line 2912 of file kernel_mk.h.

◆ MK_OBJR

typedef struct MkObjectS MK_OBJR

reference-shortcut for struct MkObjectS, all shortcut using the XX_YYYR syntax (only for public API) …

Definition at line 2915 of file kernel_mk.h.

◆ MkAllocCreateF

typedef MK_PTR(* MkAllocCreateF) (MK_RT const mkrt, MK_TYP const type)

Definition at line 4615 of file kernel_mk.h.

◆ MkAllocDeleteF

typedef void(* MkAllocDeleteF) (MK_RT const mkrt, MK_TYP const type, MK_PTR ptr)

Definition at line 4616 of file kernel_mk.h.

◆ MkConstructorF

typedef MK_OBJ(* MkConstructorF) (MK_RT const mkrt, MK_TYP type, MK_PTR nat, MK_PTR lnk)

Definition at line 4599 of file kernel_mk.h.

◆ MkCopyF

typedef MK_OBJ(* MkCopyF) (MK_RT const mkrt, MK_OBJ const obj, MK_OBJN const src)

Definition at line 4604 of file kernel_mk.h.

◆ MkDefTypeCNR

typedef const struct MkDefTypeS MkDefTypeCNR

const instance-struct-reference same as const struct MkDefTypeS, useable in a class-macro as: class##R

Definition at line 4922 of file kernel_mk.h.

◆ MkDefTypeCR

typedef struct MkDefTypeS MkDefTypeCR

instance-struct-reference same as struct MkDefTypeS, useable in a class-macro as: class##R

Definition at line 4920 of file kernel_mk.h.

◆ MkDestructorF

typedef void(* MkDestructorF) (MK_RT const mkrt, MK_OBJ const obj)

Definition at line 4600 of file kernel_mk.h.

◆ MkDup2F

typedef MK_OBJ(* MkDup2F) (MK_RT const mkrt, MK_OBJ const obj, MK_STRN const ident)

Definition at line 4602 of file kernel_mk.h.

◆ MkDupF

typedef MK_OBJ(* MkDupF) (MK_RT const mkrt, MK_OBJ const obj)

Definition at line 4601 of file kernel_mk.h.

◆ MkLogF

typedef void(* MkLogF) (MK_RT const mkrt, MK_OBJN const obj, MK_OBJ fmt, MK_INT const debug, MK_STRN const prefix, MK_INT const lvl)

Definition at line 4612 of file kernel_mk.h.

◆ MkLogFormatF

typedef bool(* MkLogFormatF) (MK_RT const mkrt, char *header, MK_SIZE const headerSize, MK_OBJN const obj, MK_STRN const caller, MK_INT const debug, MK_STRN const fmt)

Definition at line 4618 of file kernel_mk.h.

◆ MkMergeF

typedef MK_OBJ(* MkMergeF) (MK_RT const mkrt, MK_OBJ const obj)

Definition at line 4603 of file kernel_mk.h.

◆ MkObjectCNR

typedef const struct MkObjectS MkObjectCNR

const instance-struct-reference same as const struct MkObjectS, useable in a class-macro as: class##R

Definition at line 4514 of file kernel_mk.h.

◆ MkObjectCR

typedef struct MkObjectS MkObjectCR

instance-struct-reference same as struct MkObjectS, useable in a class-macro as: class##R

Definition at line 4512 of file kernel_mk.h.

◆ MkResetF

typedef void(* MkResetF) (MK_RT const mkrt, MK_OBJ const obj)

Definition at line 4605 of file kernel_mk.h.

◆ MkSelfCreateF

typedef MK_PTR(* MkSelfCreateF) (MK_RT const mkrt, MK_OBJ const obj, MK_PTR const env)

Definition at line 4607 of file kernel_mk.h.

◆ MkSelfDeleteF

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

Definition at line 4609 of file kernel_mk.h.

◆ MkSelfUnlinkF

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

Definition at line 4611 of file kernel_mk.h.

◆ MkToStringF

typedef MK_STRN(* MkToStringF) (MK_RT const mkrt, MK_OBJN const obj)

Definition at line 4614 of file kernel_mk.h.

◆ MkTypeCNR

typedef const struct MkTypeS MkTypeCNR

const instance-struct-reference same as const struct MkTypeS, useable in a class-macro as: class##R

Definition at line 4812 of file kernel_mk.h.

◆ MkTypeCR

typedef struct MkTypeS MkTypeCR

instance-struct-reference same as struct MkTypeS, useable in a class-macro as: class##R

Definition at line 4810 of file kernel_mk.h.

◆ MkTypeInitF

typedef void(* MkTypeInitF) (MK_RT const mkrt, MK_TYP const type)

Definition at line 4617 of file kernel_mk.h.

Function Documentation

◆ MkObjCheck()

bool MkObjCheck ( MK_MNGN  mng)
inline

check MkObjectS%->Mk{ObjectS::signature} …

Returns
TRUE on valid obj and FALSE an invalid obj

Definition at line 4551 of file kernel_mk.h.

+ Here is the caller graph for this function:

◆ MkTyp()

MK_TYP MkTyp ( const MK_MNG  mng)
inline

type-check and cast a unknown-managed-object into an MkTypeS pointer or NULL if not possible

Definition at line 4858 of file kernel_mk.h.

◆ MkTypCheck()

bool MkTypCheck ( MK_MNGN  mng)
inline

check MkTypeS%->Mk{ObjectS::signature} …

Returns
TRUE on valid typ and FALSE an invalid typ

Definition at line 4845 of file kernel_mk.h.

+ Here is the caller graph for this function:

◆ MkTypeSlotResolveP()

MK_EXTERN MK_PTR MkTypeSlotResolveP ( MK_RT const  mkrt,
MK_TYPN const  type,
size_t const  offset,
bool const  force 
)

hidden function for MkTypeSlotResolve

◆ MkTypN()

MK_TYPN MkTypN ( const MK_MNGN  mng)
inline

type-check and cast a unknown-managed-object into an MkTypeS pointer or NULL if not possible

Definition at line 4869 of file kernel_mk.h.