theKernel 10.0 NHI1 - theKernel - theLink - theConfig - theSq3Lite - theCompiler - theBrain - theGuard
c - tcl - py - rb - 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:

Data Structures

struct  MK_STRN_A
 array of 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(* MkMarkF) (MK_RT mkrt, MK_PTR data)
 prototype for a Garbage-Collection mark function …
 

boolean data-type

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

signed integer data-type

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

unsigned integer data-type

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

float data-type

typedef float MK_FLT
 4 byte float data-type
 
typedef double 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 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 MK_SIZE
 
typedef union MkBufferAtomU MK_ATO
 8 byte atom data-type
 
typedef int32_t MK_NUM
 array size data-type ('num' items in array …
 
typedef int MK_DBG
 debug-level data-type …
 
typedef unsigned int MK_SIG
 signature datatype
 
#define MK_FORMAT_N   "%i"
 

OS wide MK_TIME_T

timeout in seconds as "integer" value

typedef time_t 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 MK_PTRB
 pointer type data-type
 
typedef MK_PTRBMK_PTR
 generic pointer data-type
 
typedef const MK_PTRBMK_PTRN
 const generic pointer data-type
 
typedef MK_PTRBMK_CCP
 class constructor/destructor data type
 
typedef MK_PTRBMK_CBP
 generic pointer to call-back data
 
typedef MK_PTRBMK_MNG
 managed object pointer, datatype will be checked at runtime
 
typedef const MK_PTRBMK_MNGN
 const - a managed object pointer, datatype will be checked at runtime
 
typedef MK_PTRB const * MK_EXP
 exception object pointer
 
typedef MK_PTRBMK_MXP
 MkExceptionC object pointer.
 

list data-type

typedef unsigned char MK_LSTB
 list type data-type
 
typedef MK_LSTBMK_LST
 list pointer data-type
 

binary data-type

typedef unsigned char MK_BINB
 byte-array type data-type
 
typedef MK_BINBMK_BIN
 byte-array pointer data-type with binary encoding (MK_BINN)
 
typedef MK_BINB const * MK_BINN
 const byte-array pointer data-type
 

primitive string data-type

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

helper type for target language implementation

typedef void * MK_NAT_OBJECT
 
typedef void * 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 1054 of file LibMkKernel_mk.h.

◆ MK_ALFA

#define MK_ALFA   '@'

MK_ALFA the command-line separator between server and client …

Definition at line 1037 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 1039 of file LibMkKernel_mk.h.

◆ MK_FORMAT_N

#define MK_FORMAT_N   "%i"

Definition at line 1166 of file LibMkKernel_mk.h.

◆ MK_FORMAT_TIME

#define MK_FORMAT_TIME   "%li"

Definition at line 1242 of file LibMkKernel_mk.h.

◆ MK_HDL_REF_S1

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

Definition at line 1140 of file LibMkKernel_mk.h.

◆ MK_HDL_REF_S3

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

Definition at line 1139 of file LibMkKernel_mk.h.

◆ MK_HDLT

#define MK_HDLT   MK_I32T

Definition at line 1141 of file LibMkKernel_mk.h.

◆ MK_TIME

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

Definition at line 1243 of file LibMkKernel_mk.h.

◆ MK_TIME_MAX

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

one year

Definition at line 1244 of file LibMkKernel_mk.h.

Typedef Documentation

◆ MK_ATO

typedef union MkBufferAtomU MK_ATO

8 byte atom data-type

Definition at line 1160 of file LibMkKernel_mk.h.

◆ MK_BIN

typedef MK_BINB* MK_BIN

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

Definition at line 1311 of file LibMkKernel_mk.h.

◆ MK_BINB

typedef unsigned char MK_BINB

byte-array type data-type

Definition at line 1307 of file LibMkKernel_mk.h.

◆ MK_BINN

typedef MK_BINB const* MK_BINN

const byte-array pointer data-type

Definition at line 1315 of file LibMkKernel_mk.h.

◆ MK_BOL

typedef unsigned char MK_BOL

1 byte boolean data-type

Definition at line 1048 of file LibMkKernel_mk.h.

◆ MK_BOOL

typedef bool MK_BOOL

real bool data-type

Definition at line 1053 of file LibMkKernel_mk.h.

◆ MK_CBP

typedef MK_PTRB* MK_CBP

generic pointer to call-back data

Definition at line 1269 of file LibMkKernel_mk.h.

◆ MK_CCP

typedef MK_PTRB* MK_CCP

class constructor/destructor data type

Definition at line 1266 of file LibMkKernel_mk.h.

◆ MK_DBG

typedef int MK_DBG

debug-level data-type …

Definition at line 1170 of file LibMkKernel_mk.h.

◆ MK_DBL

typedef double MK_DBL

8 byte double data-type

Definition at line 1116 of file LibMkKernel_mk.h.

◆ MK_EXP

typedef MK_PTRB const* MK_EXP

exception object pointer

Definition at line 1278 of file LibMkKernel_mk.h.

◆ MK_FLT

typedef float MK_FLT

4 byte float data-type

Definition at line 1113 of file LibMkKernel_mk.h.

◆ MK_FST

typedef MK_STRB const* MK_FST

const format string pointer data-type

Definition at line 1348 of file LibMkKernel_mk.h.

◆ MK_HDL

typedef int32_t 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 1138 of file LibMkKernel_mk.h.

◆ MK_I16

typedef signed short int MK_I16

2 byte short data-type

Definition at line 1068 of file LibMkKernel_mk.h.

◆ MK_I32

typedef signed int MK_I32

4 byte integer data-type

Definition at line 1071 of file LibMkKernel_mk.h.

◆ MK_I64

typedef signed long long MK_I64

8 byte wide integer data-type

Definition at line 1078 of file LibMkKernel_mk.h.

◆ MK_I8

typedef signed char MK_I8

1 byte byte data-type

Definition at line 1065 of file LibMkKernel_mk.h.

◆ MK_LONG

typedef long MK_LONG

4/8 byte long data-type

Definition at line 1083 of file LibMkKernel_mk.h.

◆ MK_LST

typedef MK_LSTB* MK_LST

list pointer data-type

Definition at line 1296 of file LibMkKernel_mk.h.

◆ MK_LSTB

typedef unsigned char MK_LSTB

list type data-type

Definition at line 1292 of file LibMkKernel_mk.h.

◆ MK_MNG

typedef MK_PTRB* MK_MNG

managed object pointer, datatype will be checked at runtime

Definition at line 1272 of file LibMkKernel_mk.h.

◆ MK_MNGN

typedef const MK_PTRB* MK_MNGN

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

Definition at line 1275 of file LibMkKernel_mk.h.

◆ MK_MXP

typedef MK_PTRB* MK_MXP

MkExceptionC object pointer.

Definition at line 1281 of file LibMkKernel_mk.h.

◆ MK_NAT_LIST

typedef void* MK_NAT_LIST

Definition at line 1359 of file LibMkKernel_mk.h.

◆ MK_NAT_OBJECT

typedef void* MK_NAT_OBJECT

Definition at line 1357 of file LibMkKernel_mk.h.

◆ MK_NUM

typedef int32_t 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 1165 of file LibMkKernel_mk.h.

◆ MK_PTR

typedef MK_PTRB* MK_PTR

generic pointer data-type

Definition at line 1260 of file LibMkKernel_mk.h.

◆ MK_PTRB

typedef void MK_PTRB

pointer type data-type

Definition at line 1256 of file LibMkKernel_mk.h.

◆ MK_PTRN

typedef const MK_PTRB* MK_PTRN

const generic pointer data-type

Definition at line 1263 of file LibMkKernel_mk.h.

◆ MK_SIG

typedef unsigned int 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 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 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 1231 of file LibMkKernel_mk.h.

◆ MK_SIZE

typedef long MK_SIZE

Definition at line 1157 of file LibMkKernel_mk.h.

◆ MK_STR

typedef MK_STRB* MK_STR

string pointer data-type with UTF8 ecoding (MK_STR)

Definition at line 1330 of file LibMkKernel_mk.h.

◆ MK_STRB

typedef char MK_STRB

string type data-type

Definition at line 1326 of file LibMkKernel_mk.h.

◆ MK_STRN

typedef const MK_STRB* MK_STRN

constant string pointer data-type

Definition at line 1334 of file LibMkKernel_mk.h.

◆ MK_TIME_T

typedef time_t MK_TIME_T

Definition at line 1241 of file LibMkKernel_mk.h.

◆ MK_U16

typedef unsigned short MK_U16

Definition at line 1095 of file LibMkKernel_mk.h.

◆ MK_U32

typedef unsigned int MK_U32

Definition at line 1097 of file LibMkKernel_mk.h.

◆ MK_U64

typedef unsigned long long MK_U64

Definition at line 1099 of file LibMkKernel_mk.h.

◆ MK_U8

typedef unsigned char MK_U8

Definition at line 1093 of file LibMkKernel_mk.h.

◆ MK_ULN

typedef unsigned long MK_ULN

Definition at line 1103 of file LibMkKernel_mk.h.

◆ MkMarkF

typedef void( * MkMarkF) (MK_RT mkrt, MK_PTR data)

prototype for a Garbage-Collection mark function …

Definition at line 2196 of file LibMkKernel_mk.h.

Variable Documentation

◆ MK_STRN_A_NULL

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

Definition at line 1344 of file LibMkKernel_mk.h.

1344{0,0};