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

MkKernel PACKAGE - a collection of common used data types and definitions … More...

+ Collaboration diagram for MkKernel_Type_C_API:

Classes

struct  libmkkernel::MK_STRN_A
 array of libmkkernel::MK_STRN values … More...
 

Macros

#define MK_ALFA   '@'
 MK_ALFA the command-line separator between server and client …
 
#define MK_ALFA_STR   ((MkStringR){1,"@"})
 MK_ALFA the command-line separator as string …
 

Typedefs

typedef void(* libmkkernel::MkMarkF) (MK_RT const mkrt, MK_PTR data)
 prototype for a Garbage-Collection mark function …
 

boolean data-type

typedef unsigned char libmkkernel::MK_BOL
 1 byte boolean data-type
 
typedef bool libmkkernel::MK_BOOL
 real bool data-type
 
#define bool2str(_bool)
 

signed integer data-type

typedef signed char libmkkernel::MK_I8
 1 byte byte data-type
 
typedef signed short int libmkkernel::MK_I16
 2 byte short data-type
 
typedef signed int libmkkernel::MK_I32
 4 byte integer data-type
 
typedef signed long long libmkkernel::MK_I64
 8 byte wide integer data-type
 
typedef long libmkkernel::MK_LONG
 4/8 byte long data-type
 

unsigned integer data-type

typedef unsigned char libmkkernel::MK_U8
 
typedef unsigned short libmkkernel::MK_U16
 
typedef unsigned int libmkkernel::MK_U32
 
typedef unsigned long long libmkkernel::MK_U64
 
typedef unsigned long libmkkernel::MK_ULN
 

float data-type

typedef float libmkkernel::MK_FLT
 4 byte float data-type
 
typedef double libmkkernel::MK_DBL
 8 byte double data-type
 

"handle" data-type

4 byte int handle data-type

The handle is a special type to represent an object as numeric-type able to be stored into an external-software.

The handle support the following API:

typedef int32_t libmkkernel::MK_HDL
 4 byte int handle data-type
 
#define MK_HDL_REF_S3(__prefix)
 
#define MK_HDL_REF_S1(__prefix)
 
#define MK_HDLT   MK_I32T
 

misc data-type

typedef long libmkkernel::MK_SIZE
 
typedef union MkBufferAtomU libmkkernel::MK_ATO
 8 byte atom data-type
 
typedef int32_t libmkkernel::MK_NUM
 array size data-type ('num' items in array …
 
typedef int libmkkernel::MK_DBG
 debug-level data-type …
 
typedef unsigned int libmkkernel::MK_SIG
 signature datatype
 
#define MK_FORMAT_N   "%i"
 

OS wide MK_TIME_T

timeout in seconds as "integer" value

typedef time_t libmkkernel::MK_TIME_T
 
#define MK_FORMAT_TIME   "%li"
 
#define MK_TIME   ((MK_TIME_T)time(NULL))
 
#define MK_TIME_MAX   (365*24*60*60)
 one year
 

pointer data-type

typedef void libmkkernel::MK_PTRB
 pointer type data-type
 
typedef MK_PTRBlibmkkernel::MK_PTR
 generic pointer data-type
 
typedef const MK_PTRBlibmkkernel::MK_PTRN
 const generic pointer data-type
 
typedef MK_PTRBlibmkkernel::MK_CCP
 class constructor/destructor data type
 
typedef MK_PTRBlibmkkernel::MK_CBP
 generic pointer to call-back data
 
typedef MK_PTRBlibmkkernel::MK_MNG
 managed object pointer, datatype will be checked at runtime
 
typedef const MK_PTRBlibmkkernel::MK_MNGN
 const - a managed object pointer, datatype will be checked at runtime
 
typedef MK_PTRB const * libmkkernel::MK_EXP
 exception object pointer
 
typedef MK_PTRBlibmkkernel::MK_MXP
 MkExceptionC object pointer.
 

list data-type

typedef unsigned char libmkkernel::MK_LSTB
 list type data-type
 
typedef MK_LSTBlibmkkernel::MK_LST
 list pointer data-type
 

binary data-type

typedef unsigned char libmkkernel::MK_BINB
 byte-array type data-type
 
typedef MK_BINBlibmkkernel::MK_BIN
 byte-array pointer data-type with binary encoding (MK_BINN)
 
typedef MK_BINB const * libmkkernel::MK_BINN
 const byte-array pointer data-type
 

primitive string data-type

typedef char libmkkernel::MK_STRB
 string type data-type
 
typedef MK_STRBlibmkkernel::MK_STR
 string pointer data-type with UTF8 ecoding (MK_STR)
 
typedef const MK_STRBlibmkkernel::MK_STRN
 constant string pointer data-type
 
typedef MK_STRB const * libmkkernel::MK_FST
 const format string pointer data-type
 
MK_UNUSED static const MK_STRN_A libmkkernel::MK_STRN_A_NULL = (MK_STRN_A) {0,0}
 

helper type for target language implementation

typedef void * libmkkernel::MK_NAT_OBJECT
 
typedef void * libmkkernel::MK_NAT_LIST
 

Detailed Description

MkKernel PACKAGE - a collection of common used data types and definitions …

Macro Definition Documentation

◆ bool2str

#define bool2str ( _bool)
Value:
(_bool?"true":"false")

Definition at line 1069 of file LibMkKernel_mk.h.

◆ MK_ALFA

#define MK_ALFA   '@'

MK_ALFA the command-line separator between server and client …

Definition at line 1052 of file LibMkKernel_mk.h.

◆ MK_ALFA_STR

#define MK_ALFA_STR   ((MkStringR){1,"@"})

MK_ALFA the command-line separator as string …

Definition at line 1054 of file LibMkKernel_mk.h.

◆ MK_FORMAT_N

#define MK_FORMAT_N   "%i"

Definition at line 1181 of file LibMkKernel_mk.h.

◆ MK_FORMAT_TIME

#define MK_FORMAT_TIME   "%li"

Definition at line 1257 of file LibMkKernel_mk.h.

◆ MK_HDL_REF_S1

#define MK_HDL_REF_S1 ( __prefix)
Value:
__prefix ## I32

Definition at line 1155 of file LibMkKernel_mk.h.

◆ MK_HDL_REF_S3

#define MK_HDL_REF_S3 ( __prefix)
Value:
__prefix ## NI4

Definition at line 1154 of file LibMkKernel_mk.h.

◆ MK_HDLT

#define MK_HDLT   MK_I32T

Definition at line 1156 of file LibMkKernel_mk.h.

◆ MK_TIME

#define MK_TIME   ((MK_TIME_T)time(NULL))

Definition at line 1258 of file LibMkKernel_mk.h.

◆ MK_TIME_MAX

#define MK_TIME_MAX   (365*24*60*60)

one year

Definition at line 1259 of file LibMkKernel_mk.h.

Typedef Documentation

◆ MK_ATO

8 byte atom data-type

Definition at line 1175 of file LibMkKernel_mk.h.

◆ MK_BIN

byte-array pointer data-type with binary encoding (MK_BINN)

Definition at line 1326 of file LibMkKernel_mk.h.

◆ MK_BINB

typedef unsigned char libmkkernel::MK_BINB

byte-array type data-type

Definition at line 1322 of file LibMkKernel_mk.h.

◆ MK_BINN

typedef MK_BINB const* libmkkernel::MK_BINN

const byte-array pointer data-type

Definition at line 1330 of file LibMkKernel_mk.h.

◆ MK_BOL

typedef unsigned char libmkkernel::MK_BOL

1 byte boolean data-type

Definition at line 1063 of file LibMkKernel_mk.h.

◆ MK_BOOL

typedef bool libmkkernel::MK_BOOL

real bool data-type

Definition at line 1068 of file LibMkKernel_mk.h.

◆ MK_CBP

generic pointer to call-back data

Definition at line 1284 of file LibMkKernel_mk.h.

◆ MK_CCP

class constructor/destructor data type

Definition at line 1281 of file LibMkKernel_mk.h.

◆ MK_DBG

typedef int libmkkernel::MK_DBG

debug-level data-type …

Definition at line 1185 of file LibMkKernel_mk.h.

◆ MK_DBL

typedef double libmkkernel::MK_DBL

8 byte double data-type

Definition at line 1131 of file LibMkKernel_mk.h.

◆ MK_EXP

typedef MK_PTRB const* libmkkernel::MK_EXP

exception object pointer

Definition at line 1293 of file LibMkKernel_mk.h.

◆ MK_FLT

typedef float libmkkernel::MK_FLT

4 byte float data-type

Definition at line 1128 of file LibMkKernel_mk.h.

◆ MK_FST

typedef MK_STRB const* libmkkernel::MK_FST

const format string pointer data-type

Definition at line 1363 of file LibMkKernel_mk.h.

◆ MK_HDL

typedef int32_t libmkkernel::MK_HDL

4 byte int handle data-type

The handle is a special type to represent an object as numeric-type able to be stored into an external-software.

The handle support the following API:

Definition at line 1153 of file LibMkKernel_mk.h.

◆ MK_I16

typedef signed short int libmkkernel::MK_I16

2 byte short data-type

Definition at line 1083 of file LibMkKernel_mk.h.

◆ MK_I32

typedef signed int libmkkernel::MK_I32

4 byte integer data-type

Definition at line 1086 of file LibMkKernel_mk.h.

◆ MK_I64

typedef signed long long libmkkernel::MK_I64

8 byte wide integer data-type

Definition at line 1093 of file LibMkKernel_mk.h.

◆ MK_I8

typedef signed char libmkkernel::MK_I8

1 byte byte data-type

Definition at line 1080 of file LibMkKernel_mk.h.

◆ MK_LONG

typedef long libmkkernel::MK_LONG

4/8 byte long data-type

Definition at line 1098 of file LibMkKernel_mk.h.

◆ MK_LST

list pointer data-type

Definition at line 1311 of file LibMkKernel_mk.h.

◆ MK_LSTB

typedef unsigned char libmkkernel::MK_LSTB

list type data-type

Definition at line 1307 of file LibMkKernel_mk.h.

◆ MK_MNG

managed object pointer, datatype will be checked at runtime

Definition at line 1287 of file LibMkKernel_mk.h.

◆ MK_MNGN

typedef const MK_PTRB* libmkkernel::MK_MNGN

const - a managed object pointer, datatype will be checked at runtime

Definition at line 1290 of file LibMkKernel_mk.h.

◆ MK_MXP

MkExceptionC object pointer.

Definition at line 1296 of file LibMkKernel_mk.h.

◆ MK_NAT_LIST

typedef void* libmkkernel::MK_NAT_LIST

Definition at line 1374 of file LibMkKernel_mk.h.

◆ MK_NAT_OBJECT

Definition at line 1372 of file LibMkKernel_mk.h.

◆ MK_NUM

typedef int32_t libmkkernel::MK_NUM

array size data-type ('num' items in array …

Attention
-> need signed integer in pBusReadNextWord -> need int because of pSwapI in pReadHDR

Definition at line 1180 of file LibMkKernel_mk.h.

◆ MK_PTR

generic pointer data-type

Definition at line 1275 of file LibMkKernel_mk.h.

◆ MK_PTRB

typedef void libmkkernel::MK_PTRB

pointer type data-type

Definition at line 1271 of file LibMkKernel_mk.h.

◆ MK_PTRN

typedef const MK_PTRB* libmkkernel::MK_PTRN

const generic pointer data-type

Definition at line 1278 of file LibMkKernel_mk.h.

◆ MK_SIG

typedef unsigned int libmkkernel::MK_SIG

signature datatype

The MOT-class is identified by a signature and a mask.

The signature and the mask are an 32bit unsigned integer value of type libmkkernel::MK_SIG.

  • The signature and the mask define the MOT-class and the class-hierarchie.
  • The signature and the mask are created by the CLASS-TOOL and written into the class-def-source-code.
    #define MkBufferC_SIGNATURE (MkObjectC_SIGNATURE ^ (1u<<10))
    #define MkBufferC_MASK (((1u<<22)-1)<<10)

The class-type is the storage for the signature and the mask

  • The signature is stored in the (MkTypeS::objsig) entry of the MkTypeS class-type.
  • The mask is stored in the (MkTypeS::objmask) entry of the MkTypeS class-type.
  • The class-type is initialized at runtime-startup.
    MkInstanceTypeInit ( MkBufferC, MkObjectC ) ;
    MkTYP_R(MkBufferST).destructor = (MkDestructorF) MkBufferDelete_RT ;
    MkTYP_R(MkBufferST).dup = (MkDupF) MkBufferDup_RT ;
    MkTYP_R(MkBufferST).merge = (MkMergeF) MkBufferMerge_RT ;
    MkTYP_R(MkBufferST).copy = (MkCopyF) MkBufferCopy_RT ;
    MkTYP_R(MkBufferST).reset = (MkResetF) MkBufferReset_RT ;
    MkTYP_R(MkBufferST).log = (MkLogF) MkBufferLog_RT ;
    MkTYP_R(MkBufferST).toString = (MkToStringF) MkBufferToString_RT ;
    ...
    #define MkInstanceTypeInit(cls,bse) MkInstanceTypeInit_4(cls,((RT_REF)._##cls##_T),bse,#cls)
    ...
    #define MkInstanceTypeInit_4(_cls,_typ,_bse,_nme) do { \
    *_cls##_TT = *_bse##_TT ; \
    (*_cls##_TT).objsig = _cls##_SIGNATURE ; \
    (*_cls##_TT).objmask = _cls##_MASK ; \
    (*_cls##_TT).objsize = sizeof (_cls##R) ; \
    strcpy((*_cls##_TT).type_name, _nme); /* speed !! */ \
    (*_cls##_TT).base = _bse##_TT ; \
    (*_cls##_TT).typsize = sizeof (_typ) ; \
    MkRefIncr_1X(_bse##_TT) ; \
    MkRuntimeS_MkTypeRegister_do(_cls##_TT); \
    } while (0)

The instance-type is initialized by the class-type

  • The instance-signature stored at instance.super.obj.signature.
    • The instance.super.obj.signature is the MkObjectS::signature attribute of the MkObjectS instance-type.
    • Every pointer to the instance is also a pointer to the instance.super.obj.signature.
  • The instance-signature is initialized from MkTypeS::objsig.
    #define MkObjInitFromType(typeV,isLocalV) \
    MkObjInit2(MK_RT_PTR, NULL, (*typeV).objsig, typeV, 0, isLocalV)
    ...
    #define MkObjInit2(rtmkV,rtExtV,sigV,typeV,refCountV,isLocalV) \
    (struct MkObjectS) { \
    .signature = sigV, \
    .refCount = refCountV, \
    .self = NULL, \
    .type = typeV, \
    .env = NULL, \
    .selfCreated = false, \
    .selfRefCount = 0, \
    .objRt = rtmkV, \
    .objRtExt = rtExtV, \
    .obj_protect = { \
    .isLocal = isLocalV, \
    .prev = NULL, \
    .next = NULL, \
    }, \
    }

The signature check is done at runtime with MyClassC_Check(instancePtr) (example: MkBufferC_Check).

  • The test is true if the instance belongs to the class MyClassC or has MyClassC as base-class.

To check an instance on the instance-type without instance-base use:

  • switch (obj->signature) {
    case LcConfigC_SIGNATURE: ...; break;
    case LcSettingC_SIGNATURE: ...; break;
    default: ...; break;
    }

To check an instance on the instance-type and instance-base use:

  • if (LcConfigC_Check(obj) {
    ...
    } else if (LcSettingC_Check(obj)) {
    ...
    } else {
    ...
    }

Definition at line 1246 of file LibMkKernel_mk.h.

◆ MK_SIZE

typedef long libmkkernel::MK_SIZE

Definition at line 1172 of file LibMkKernel_mk.h.

◆ MK_STR

string pointer data-type with UTF8 ecoding (MK_STR)

Definition at line 1345 of file LibMkKernel_mk.h.

◆ MK_STRB

typedef char libmkkernel::MK_STRB

string type data-type

Definition at line 1341 of file LibMkKernel_mk.h.

◆ MK_STRN

typedef const MK_STRB* libmkkernel::MK_STRN

constant string pointer data-type

Definition at line 1349 of file LibMkKernel_mk.h.

◆ MK_TIME_T

typedef time_t libmkkernel::MK_TIME_T

Definition at line 1256 of file LibMkKernel_mk.h.

◆ MK_U16

typedef unsigned short libmkkernel::MK_U16

Definition at line 1110 of file LibMkKernel_mk.h.

◆ MK_U32

typedef unsigned int libmkkernel::MK_U32

Definition at line 1112 of file LibMkKernel_mk.h.

◆ MK_U64

typedef unsigned long long libmkkernel::MK_U64

Definition at line 1114 of file LibMkKernel_mk.h.

◆ MK_U8

typedef unsigned char libmkkernel::MK_U8

Definition at line 1108 of file LibMkKernel_mk.h.

◆ MK_ULN

typedef unsigned long libmkkernel::MK_ULN

Definition at line 1118 of file LibMkKernel_mk.h.

◆ MkMarkF

typedef void( * libmkkernel::MkMarkF) (MK_RT const mkrt, MK_PTR data)

prototype for a Garbage-Collection mark function …

Definition at line 2191 of file LibMkKernel_mk.h.

Variable Documentation

◆ MK_STRN_A_NULL

MK_UNUSED static const MK_STRN_A libmkkernel::MK_STRN_A_NULL = (MK_STRN_A) {0,0}
static

Definition at line 1359 of file LibMkKernel_mk.h.

1359{0,0};