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

MkKernel PACKAGE - operate on a string as struct of pointer and size … More...

+ Collaboration diagram for MkKernel_String_C_API:

Data Structures

struct  MkStringR
 string data default format … More...
 

Macros

#define MkString2O(s, l, r)
 
#define MkString2Y(s, l, r)
 
#define MkString2S(s, l, r)
 
#define MkString2US(s, l, r)
 
#define MkString2I(s, l, r)
 
#define MkString2UI(s, l, r)
 
#define MkString2W(s, l, r)
 
#define MkString2F(s, l, r)
 
#define MkString2D(s, l, r)
 

Functions

static void MkStringLog_RT (MK_RT mkrt, MkStringR const str, MK_STRN func)
 log the string ...
 
static MkStringR MkStringCreate (MK_NUM len, MK_STRN str)
 create a str from ptr and len ...
 
static MkStringR MkStringCreate_1 (MK_STRN str)
 create a str from ptr use MK_NULL as end-of-string ...
 
static MkStringR MkStringSlice (MkStringR strR, MK_NUM start, MK_NUM len)
 create a slice of strR start at start with max len bytes …
 
static void MkStringSplit (MkStringR strR, MK_NUM *len_out, MK_STRN *str_out)
 split a str into ptr and len
 
static MkStringR MkStringDup_RT (MK_RT mkrt, MkStringR const str)
 create a string as duplicate from an already existsing MkBinaryR ...
 
static MK_STRN MkStringGetData (MkStringR const str)
 get ptr pointer from the string ...
 
static MK_NUM MkStringGetSize (MkStringR const str)
 get len from the string ...
 
static bool MkStringIsNULL (MkStringR const strR)
 check if strR is MK_NULL_STR return true or false
 
enum MkErrorE MkString2BOL_RT (MK_RT mkrt, MK_STRN const str, MK_NUM const length, MK_BOL *val_out)
 convert a string into a native
 
enum MkErrorE MkString2I8_RT (MK_RT mkrt, MK_STRN const str, MK_NUM const length, MK_I8 *val_out)
 
enum MkErrorE MkString2I16_RT (MK_RT mkrt, MK_STRN const str, MK_NUM const length, MK_I16 *val_out)
 
enum MkErrorE MkString2U16_RT (MK_RT mkrt, MK_STRN const str, MK_NUM const length, MK_U16 *val_out)
 
enum MkErrorE MkString2I32_RT (MK_RT mkrt, MK_STRN const str, MK_NUM const length, MK_I32 *val_out)
 
enum MkErrorE MkString2U32_RT (MK_RT mkrt, MK_STRN const str, MK_NUM const length, MK_U32 *val_out)
 
enum MkErrorE MkString2I64_RT (MK_RT mkrt, MK_STRN const str, MK_NUM const length, MK_I64 *val_out)
 
enum MkErrorE MkString2FLT_RT (MK_RT mkrt, MK_STRN const str, MK_NUM const length, MK_FLT *val_out)
 
enum MkErrorE MkString2DBL_RT (MK_RT mkrt, MK_STRN const str, MK_NUM const length, MK_DBL *val_out)
 
enum MkErrorE MkString2LONG_RT (MK_RT mkrt, MK_STRN const str, MK_NUM const length, MK_LONG *val_out)
 
enum MkErrorE MkString2BOOL_RT (MK_RT mkrt, MK_STRN const str, MK_NUM const length, MK_BOOL *val_out)
 
enum MkErrorE MkString2ATO_RT (MK_RT mkrt, MK_STRN const str, MK_NUM const length, enum MkTypeE type, MK_ATO *val_out)
 
enum MkErrorE MkString2HDL_RT (MK_RT mkrt, MK_STRN const str, MK_NUM const length, MK_HDL *val_out)
 

MkKernel - MkKernel_String_C_API - function

MkStringR MkStringCreateP (MK_NUM len, MK_STRN str)
 Non-inline replacement for MkStringCreate
 
MkStringR MkStringCreate_1P (MK_STRN str)
 Non-inline replacement for MkStringCreate_1
 
MkStringR MkStringDupP (MK_RT mkrt, MkStringR const str)
 Non-inline replacement for MkStringDup
 
MK_STRN MkStringGetDataP (MkStringR const str)
 Non-inline replacement for MkStringGetData
 
MK_NUM MkStringGetSizeP (MkStringR const str)
 Non-inline replacement for MkStringGetSize
 
MK_BOOL MkStringIsNULLP (MkStringR const strR)
 Non-inline replacement for MkStringIsNULL
 
void MkStringLogP (MK_RT mkrt, MkStringR const str, MK_STRN func)
 Non-inline replacement for MkStringLog
 
MkStringR MkStringSliceP (MkStringR strR, MK_NUM start, MK_NUM len)
 Non-inline replacement for MkStringSlice
 
void MkStringSplitP (MkStringR strR, MK_NUM *len_out, MK_STRN *str_out)
 Non-inline replacement for MkStringSplit
 

MkKernel - MkKernel_String_C_API - overload

#define MkString2ATO_NULL(...)
 
#define MkString2ATO(...)
 
#define MkString2BOL_NULL(...)
 
#define MkString2BOL(...)
 
#define MkString2BOOL_NULL(...)
 
#define MkString2BOOL(...)
 
#define MkString2DBL_NULL(...)
 
#define MkString2DBL(...)
 
#define MkString2FLT_NULL(...)
 
#define MkString2FLT(...)
 
#define MkString2HDL_NULL(...)
 
#define MkString2HDL(...)
 
#define MkString2I16_NULL(...)
 
#define MkString2I16(...)
 
#define MkString2I32_NULL(...)
 
#define MkString2I32(...)
 
#define MkString2I64_NULL(...)
 
#define MkString2I64(...)
 
#define MkString2I8_NULL(...)
 
#define MkString2I8(...)
 
#define MkString2LONG_NULL(...)
 
#define MkString2LONG(...)
 
#define MkString2U16_NULL(...)
 
#define MkString2U16(...)
 
#define MkString2U32_NULL(...)
 
#define MkString2U32(...)
 
#define MkStringDup_NULL(...)
 
#define MkStringDup(...)
 
#define MkStringLog_NULL(...)
 
#define MkStringLog(...)
 

Detailed Description

MkKernel PACKAGE - operate on a string as struct of pointer and size …

Attention
In general MkStringR is owned by the called function, to get your own copy use MkStringDup.

Macro Definition Documentation

◆ MkString2ATO

#define MkString2ATO ( ...)
Value:
enum MkErrorE MkString2ATO_RT(MK_RT mkrt, MK_STRN const str, MK_NUM const length, enum MkTypeE type, MK_ATO *val_out)
#define MK_RT_CALL

Definition at line 1371 of file kernel_overload_mk.h.

◆ MkString2ATO_NULL

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

Definition at line 1370 of file kernel_overload_mk.h.

◆ MkString2BOL

#define MkString2BOL ( ...)
Value:
enum MkErrorE MkString2BOL_RT(MK_RT mkrt, MK_STRN const str, MK_NUM const length, MK_BOL *val_out)
convert a string into a native

Definition at line 1373 of file kernel_overload_mk.h.

◆ MkString2BOL_NULL

#define MkString2BOL_NULL ( ...)
Value:

Definition at line 1372 of file kernel_overload_mk.h.

◆ MkString2BOOL

#define MkString2BOOL ( ...)
Value:
enum MkErrorE MkString2BOOL_RT(MK_RT mkrt, MK_STRN const str, MK_NUM const length, MK_BOOL *val_out)

Definition at line 1375 of file kernel_overload_mk.h.

◆ MkString2BOOL_NULL

#define MkString2BOOL_NULL ( ...)
Value:

Definition at line 1374 of file kernel_overload_mk.h.

◆ MkString2D

#define MkString2D ( s,
l,
r )
Value:
enum MkErrorE MkString2DBL_RT(MK_RT mkrt, MK_STRN const str, MK_NUM const length, MK_DBL *val_out)

Definition at line 6248 of file LibMkKernel_mk.h.

◆ MkString2DBL

#define MkString2DBL ( ...)
Value:

Definition at line 1377 of file kernel_overload_mk.h.

◆ MkString2DBL_NULL

#define MkString2DBL_NULL ( ...)
Value:

Definition at line 1376 of file kernel_overload_mk.h.

◆ MkString2F

#define MkString2F ( s,
l,
r )
Value:
enum MkErrorE MkString2FLT_RT(MK_RT mkrt, MK_STRN const str, MK_NUM const length, MK_FLT *val_out)

Definition at line 6239 of file LibMkKernel_mk.h.

◆ MkString2FLT

#define MkString2FLT ( ...)
Value:

Definition at line 1379 of file kernel_overload_mk.h.

◆ MkString2FLT_NULL

#define MkString2FLT_NULL ( ...)
Value:

Definition at line 1378 of file kernel_overload_mk.h.

◆ MkString2HDL

#define MkString2HDL ( ...)
Value:
enum MkErrorE MkString2HDL_RT(MK_RT mkrt, MK_STRN const str, MK_NUM const length, MK_HDL *val_out)

Definition at line 1381 of file kernel_overload_mk.h.

◆ MkString2HDL_NULL

#define MkString2HDL_NULL ( ...)
Value:

Definition at line 1380 of file kernel_overload_mk.h.

◆ MkString2I

#define MkString2I ( s,
l,
r )
Value:
enum MkErrorE MkString2I32_RT(MK_RT mkrt, MK_STRN const str, MK_NUM const length, MK_I32 *val_out)

Definition at line 6201 of file LibMkKernel_mk.h.

◆ MkString2I16

#define MkString2I16 ( ...)
Value:
enum MkErrorE MkString2I16_RT(MK_RT mkrt, MK_STRN const str, MK_NUM const length, MK_I16 *val_out)

Definition at line 1383 of file kernel_overload_mk.h.

◆ MkString2I16_NULL

#define MkString2I16_NULL ( ...)
Value:

Definition at line 1382 of file kernel_overload_mk.h.

◆ MkString2I32

#define MkString2I32 ( ...)
Value:

Definition at line 1385 of file kernel_overload_mk.h.

◆ MkString2I32_NULL

#define MkString2I32_NULL ( ...)
Value:

Definition at line 1384 of file kernel_overload_mk.h.

◆ MkString2I64

#define MkString2I64 ( ...)
Value:
enum MkErrorE MkString2I64_RT(MK_RT mkrt, MK_STRN const str, MK_NUM const length, MK_I64 *val_out)

Definition at line 1387 of file kernel_overload_mk.h.

◆ MkString2I64_NULL

#define MkString2I64_NULL ( ...)
Value:

Definition at line 1386 of file kernel_overload_mk.h.

◆ MkString2I8

#define MkString2I8 ( ...)
Value:
enum MkErrorE MkString2I8_RT(MK_RT mkrt, MK_STRN const str, MK_NUM const length, MK_I8 *val_out)

Definition at line 1389 of file kernel_overload_mk.h.

◆ MkString2I8_NULL

#define MkString2I8_NULL ( ...)
Value:

Definition at line 1388 of file kernel_overload_mk.h.

◆ MkString2LONG

#define MkString2LONG ( ...)
Value:
enum MkErrorE MkString2LONG_RT(MK_RT mkrt, MK_STRN const str, MK_NUM const length, MK_LONG *val_out)

Definition at line 1391 of file kernel_overload_mk.h.

◆ MkString2LONG_NULL

#define MkString2LONG_NULL ( ...)
Value:

Definition at line 1390 of file kernel_overload_mk.h.

◆ MkString2O

#define MkString2O ( s,
l,
r )
Value:

Definition at line 6165 of file LibMkKernel_mk.h.

◆ MkString2S

#define MkString2S ( s,
l,
r )
Value:

Definition at line 6183 of file LibMkKernel_mk.h.

◆ MkString2U16

#define MkString2U16 ( ...)
Value:
enum MkErrorE MkString2U16_RT(MK_RT mkrt, MK_STRN const str, MK_NUM const length, MK_U16 *val_out)

Definition at line 1393 of file kernel_overload_mk.h.

◆ MkString2U16_NULL

#define MkString2U16_NULL ( ...)
Value:

Definition at line 1392 of file kernel_overload_mk.h.

◆ MkString2U32

#define MkString2U32 ( ...)
Value:
enum MkErrorE MkString2U32_RT(MK_RT mkrt, MK_STRN const str, MK_NUM const length, MK_U32 *val_out)

Definition at line 1395 of file kernel_overload_mk.h.

◆ MkString2U32_NULL

#define MkString2U32_NULL ( ...)
Value:

Definition at line 1394 of file kernel_overload_mk.h.

◆ MkString2UI

#define MkString2UI ( s,
l,
r )
Value:

Definition at line 6210 of file LibMkKernel_mk.h.

◆ MkString2US

#define MkString2US ( s,
l,
r )
Value:

Definition at line 6192 of file LibMkKernel_mk.h.

◆ MkString2W

#define MkString2W ( s,
l,
r )
Value:

Definition at line 6219 of file LibMkKernel_mk.h.

◆ MkString2Y

#define MkString2Y ( s,
l,
r )
Value:

Definition at line 6174 of file LibMkKernel_mk.h.

◆ MkStringDup

#define MkStringDup ( ...)
Value:
static MkStringR MkStringDup_RT(MK_RT mkrt, MkStringR const str)
create a string as duplicate from an already existsing MkBinaryR ...

Definition at line 1399 of file kernel_overload_mk.h.

◆ MkStringDup_NULL

#define MkStringDup_NULL ( ...)
Value:

Definition at line 1398 of file kernel_overload_mk.h.

◆ MkStringLog

#define MkStringLog ( ...)
Value:
static void MkStringLog_RT(MK_RT mkrt, MkStringR const str, MK_STRN func)
log the string ...

Definition at line 1401 of file kernel_overload_mk.h.

◆ MkStringLog_NULL

#define MkStringLog_NULL ( ...)
Value:

Definition at line 1400 of file kernel_overload_mk.h.

Function Documentation

◆ MkString2ATO_RT()

enum MkErrorE MkString2ATO_RT ( MK_RT mkrt,
MK_STRN const str,
MK_NUM const length,
enum MkTypeE type,
MK_ATO * val_out )

◆ MkString2BOL_RT()

enum MkErrorE MkString2BOL_RT ( MK_RT mkrt,
MK_STRN const str,
MK_NUM const length,
MK_BOL * val_out )

convert a string into a native

◆ MkString2BOOL_RT()

enum MkErrorE MkString2BOOL_RT ( MK_RT mkrt,
MK_STRN const str,
MK_NUM const length,
MK_BOOL * val_out )

◆ MkString2DBL_RT()

enum MkErrorE MkString2DBL_RT ( MK_RT mkrt,
MK_STRN const str,
MK_NUM const length,
MK_DBL * val_out )

◆ MkString2FLT_RT()

enum MkErrorE MkString2FLT_RT ( MK_RT mkrt,
MK_STRN const str,
MK_NUM const length,
MK_FLT * val_out )

◆ MkString2HDL_RT()

enum MkErrorE MkString2HDL_RT ( MK_RT mkrt,
MK_STRN const str,
MK_NUM const length,
MK_HDL * val_out )

◆ MkString2I16_RT()

enum MkErrorE MkString2I16_RT ( MK_RT mkrt,
MK_STRN const str,
MK_NUM const length,
MK_I16 * val_out )

◆ MkString2I32_RT()

enum MkErrorE MkString2I32_RT ( MK_RT mkrt,
MK_STRN const str,
MK_NUM const length,
MK_I32 * val_out )

◆ MkString2I64_RT()

enum MkErrorE MkString2I64_RT ( MK_RT mkrt,
MK_STRN const str,
MK_NUM const length,
MK_I64 * val_out )

◆ MkString2I8_RT()

enum MkErrorE MkString2I8_RT ( MK_RT mkrt,
MK_STRN const str,
MK_NUM const length,
MK_I8 * val_out )

◆ MkString2LONG_RT()

enum MkErrorE MkString2LONG_RT ( MK_RT mkrt,
MK_STRN const str,
MK_NUM const length,
MK_LONG * val_out )

◆ MkString2U16_RT()

enum MkErrorE MkString2U16_RT ( MK_RT mkrt,
MK_STRN const str,
MK_NUM const length,
MK_U16 * val_out )

◆ MkString2U32_RT()

enum MkErrorE MkString2U32_RT ( MK_RT mkrt,
MK_STRN const str,
MK_NUM const length,
MK_U32 * val_out )

◆ MkStringCreate()

static MkStringR MkStringCreate ( MK_NUM len,
MK_STRN str )
inlinestatic

create a str from ptr and len ...

Definition at line 1677 of file LibMkKernel_mk.h.

1677 {
1678 return (MkStringR) {(len>0?len:str?(MK_NUM)strlen(str):0), str};
1679}
int32_t MK_NUM
array size data-type ('num' items in array …
string data default format …
+ Here is the caller graph for this function:

◆ MkStringCreate_1()

static MkStringR MkStringCreate_1 ( MK_STRN str)
inlinestatic

create a str from ptr use MK_NULL as end-of-string ...

Definition at line 1683 of file LibMkKernel_mk.h.

1683 {
1684 return (MkStringR) {str?(MK_NUM)strlen(str):0, str};
1685}

◆ MkStringCreate_1P()

MkStringR MkStringCreate_1P ( MK_STRN str)

Non-inline replacement for MkStringCreate_1

◆ MkStringCreateP()

MkStringR MkStringCreateP ( MK_NUM len,
MK_STRN str )

Non-inline replacement for MkStringCreate

◆ MkStringDup_RT()

static MkStringR MkStringDup_RT ( MK_RT mkrt,
MkStringR const str )
inlinestatic

create a string as duplicate from an already existsing MkBinaryR ...

Definition at line 13031 of file LibMkKernel_mk.h.

13031 {
13033 return MkStringCreate(str.len,(MK_STRN)MkSysMemDup(MK_ERROR_PANIC,str.ptr,(size_t)str.len));
13034}
#define MK_ERROR_PANIC
static MkStringR MkStringCreate(MK_NUM len, MK_STRN str)
create a str from ptr and len ...
const MK_STRB * MK_STRN
constant string pointer data-type
MK_PTR MkSysMemDup(MK_OBJN fmtobj, MK_PTRN const blck, size_t const size)
memdup syscall with libmkkernel error plugin
#define MK_STATIC_RT

◆ MkStringDupP()

MkStringR MkStringDupP ( MK_RT mkrt,
MkStringR const str )

Non-inline replacement for MkStringDup

◆ MkStringGetData()

static MK_STRN MkStringGetData ( MkStringR const str)
inlinestatic

get ptr pointer from the string ...

Definition at line 1721 of file LibMkKernel_mk.h.

1721 {
1722 return str.ptr;
1723}

◆ MkStringGetDataP()

MK_STRN MkStringGetDataP ( MkStringR const str)

Non-inline replacement for MkStringGetData

◆ MkStringGetSize()

static MK_NUM MkStringGetSize ( MkStringR const str)
inlinestatic

get len from the string ...

Definition at line 1727 of file LibMkKernel_mk.h.

1727 {
1728 return str.len;
1729}

◆ MkStringGetSizeP()

MK_NUM MkStringGetSizeP ( MkStringR const str)

Non-inline replacement for MkStringGetSize

◆ MkStringIsNULL()

static bool MkStringIsNULL ( MkStringR const strR)
inlinestatic

check if strR is MK_NULL_STR return true or false

See also
MK_NULL
Parameters
[in]strRthe string reference to test.
Returns
the a boolean value → true if strR is a MK_NULL_STR.

Definition at line 1738 of file LibMkKernel_mk.h.

1738 {
1739 return ((strR.ptr) && (strR.len) == MK_NULL_STR_LEN && strcmp((strR.ptr),MK_NULL_STR)==0);
1740}
#define MK_NULL_STR
the string "MK_NULL" value as MK_NULL_STR …
#define MK_NULL_STR_LEN
the integer strlen("MK_NULL") value as MK_NULL_STR_LEN …

◆ MkStringIsNULLP()

MK_BOOL MkStringIsNULLP ( MkStringR const strR)

Non-inline replacement for MkStringIsNULL

◆ MkStringLog_RT()

static void MkStringLog_RT ( MK_RT mkrt,
MkStringR const str,
MK_STRN func )
inlinestatic

log the string ...

Definition at line 13038 of file LibMkKernel_mk.h.

13038 {
13040 MkLogV(MK_ERROR_FORMAT,func,0,"MkStringR: len=%i -> %.*s\n", str.len, str.len, str.ptr);
13041}
#define MK_ERROR_FORMAT
#define MkLogV(...)

◆ MkStringLogP()

void MkStringLogP ( MK_RT mkrt,
MkStringR const str,
MK_STRN func )

Non-inline replacement for MkStringLog

◆ MkStringSlice()

static MkStringR MkStringSlice ( MkStringR strR,
MK_NUM start,
MK_NUM len )
inlinestatic

create a slice of strR start at start with max len bytes …

Parameters
[in]strRthe string reference to operate on
[in]startthe start-index, will be strR.ptr + start
[in]lenthe size of the new slize, <0 will be to end of string
Returns
The new MkStringR

Definition at line 1696 of file LibMkKernel_mk.h.

1696 {
1697 if (len < 0) len = strR.len;
1698 if (start > strR.len) {
1699 return MkStringCreate(0,NULL);
1700 } else if ((start+len) > strR.len) {
1701 return MkStringCreate(strR.len-start,strR.ptr+start);
1702 } else {
1703 return MkStringCreate(len,strR.ptr+start);
1704 }
1705}
MK_STRN ptr
pointer to the string data
MK_NUM len
len of the string data

◆ MkStringSliceP()

MkStringR MkStringSliceP ( MkStringR strR,
MK_NUM start,
MK_NUM len )

Non-inline replacement for MkStringSlice

◆ MkStringSplit()

static void MkStringSplit ( MkStringR strR,
MK_NUM * len_out,
MK_STRN * str_out )
inlinestatic

split a str into ptr and len

Definition at line 1709 of file LibMkKernel_mk.h.

1709 {
1710 assert(len_out != NULL);
1711 assert(str_out != NULL);
1712 *len_out = strR.len; *str_out = strR.ptr;
1713}

◆ MkStringSplitP()

void MkStringSplitP ( MkStringR strR,
MK_NUM * len_out,
MK_STRN * str_out )

Non-inline replacement for MkStringSplit