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

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

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

MkKernel - MkKernel_String_C_API - overload

#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

◆ MkString2D

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

Definition at line 5977 of file LibMkKernel_mk.h.

◆ MkString2F

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

Definition at line 5968 of file LibMkKernel_mk.h.

◆ MkString2I

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

Definition at line 5930 of file LibMkKernel_mk.h.

◆ MkString2O

#define MkString2O ( s,
l,
r )
Value:
MK_EXTERN 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 5894 of file LibMkKernel_mk.h.

◆ MkString2S

#define MkString2S ( s,
l,
r )
Value:
MK_EXTERN enum MkErrorE MkString2I16_RT(MK_RT mkrt, MK_STRN const str, MK_NUM const length, MK_I16 *val_out)

Definition at line 5912 of file LibMkKernel_mk.h.

◆ MkString2UI

#define MkString2UI ( s,
l,
r )
Value:
MK_EXTERN enum MkErrorE MkString2U32_RT(MK_RT mkrt, MK_STRN const str, MK_NUM const length, MK_U32 *val_out)

Definition at line 5939 of file LibMkKernel_mk.h.

◆ MkString2US

#define MkString2US ( s,
l,
r )
Value:
MK_EXTERN enum MkErrorE MkString2U16_RT(MK_RT mkrt, MK_STRN const str, MK_NUM const length, MK_U16 *val_out)

Definition at line 5921 of file LibMkKernel_mk.h.

◆ MkString2W

#define MkString2W ( s,
l,
r )
Value:
MK_EXTERN enum MkErrorE MkString2I64_RT(MK_RT mkrt, MK_STRN const str, MK_NUM const length, MK_I64 *val_out)

Definition at line 5948 of file LibMkKernel_mk.h.

◆ MkString2Y

#define MkString2Y ( s,
l,
r )
Value:
MK_EXTERN enum MkErrorE MkString2I8_RT(MK_RT mkrt, MK_STRN const str, MK_NUM const length, MK_I8 *val_out)

Definition at line 5903 of file LibMkKernel_mk.h.

◆ MkStringDup

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

Definition at line 1368 of file kernel_overload_mk.h.

◆ MkStringDup_NULL

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

Definition at line 1367 of file kernel_overload_mk.h.

◆ MkStringLog

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

Definition at line 1370 of file kernel_overload_mk.h.

◆ MkStringLog_NULL

#define MkStringLog_NULL ( ...)
Value:

Definition at line 1369 of file kernel_overload_mk.h.

Function Documentation

◆ MkString2ATO_RT()

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

◆ MkString2BOL_RT()

MK_EXTERN 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()

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

◆ MkString2DBL_RT()

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

◆ MkString2FLT_RT()

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

◆ MkString2HDL_RT()

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

◆ MkString2I16_RT()

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

◆ MkString2I32_RT()

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

◆ MkString2I64_RT()

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

◆ MkString2I8_RT()

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

◆ MkString2LONG_RT()

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

◆ MkString2U16_RT()

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

◆ MkString2U32_RT()

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

◆ MkStringCreate()

MkStringR MkStringCreate ( MK_NUM len,
MK_STRN str )
inline

create a str from ptr and len ...

Definition at line 1632 of file LibMkKernel_mk.h.

1632 {
1633 return (MkStringR) {(len>0?len:str?(MK_NUM)strlen(str):0), str};
1634}
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()

MkStringR MkStringCreate_1 ( MK_STRN str)
inline

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

Definition at line 1638 of file LibMkKernel_mk.h.

1638 {
1639 return (MkStringR) {str?(MK_NUM)strlen(str):0, str};
1640}

◆ MkStringCreate_1P()

MK_EXTERN MkStringR MkStringCreate_1P ( MK_STRN str)

Non-inline replacement for MkStringCreate_1

◆ MkStringCreateP()

MK_EXTERN MkStringR MkStringCreateP ( MK_NUM len,
MK_STRN str )

Non-inline replacement for MkStringCreate

◆ MkStringDup_RT()

MkStringR MkStringDup_RT ( MK_RT mkrt,
MkStringR const str )
inline

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

Definition at line 12708 of file LibMkKernel_mk.h.

12708 {
12710 return MkStringCreate(str.len,(MK_STRN)MkSysMemDup(MK_ERROR_PANIC,str.ptr,(size_t)str.len));
12711}
#define MK_ERROR_PANIC
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_EXTERN MK_PTR MkSysMemDup(MK_OBJN fmtobj, MK_PTRN const blck, size_t const size)
memdup syscall with libmkkernel error plugin
#define MK_CLASS_RT

◆ MkStringDupP()

MK_EXTERN MkStringR MkStringDupP ( MK_RT mkrt,
MkStringR const str )

Non-inline replacement for MkStringDup

◆ MkStringGetData()

MK_STRN MkStringGetData ( MkStringR const str)
inline

get ptr pointer from the string ...

Definition at line 1676 of file LibMkKernel_mk.h.

1676 {
1677 return str.ptr;
1678}

◆ MkStringGetDataP()

MK_EXTERN MK_STRN MkStringGetDataP ( MkStringR const str)

Non-inline replacement for MkStringGetData

◆ MkStringGetSize()

MK_NUM MkStringGetSize ( MkStringR const str)
inline

get len from the string ...

Definition at line 1682 of file LibMkKernel_mk.h.

1682 {
1683 return str.len;
1684}

◆ MkStringGetSizeP()

MK_EXTERN MK_NUM MkStringGetSizeP ( MkStringR const str)

Non-inline replacement for MkStringGetSize

◆ MkStringIsNULL()

bool MkStringIsNULL ( MkStringR const strR)
inline

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 1693 of file LibMkKernel_mk.h.

1693 {
1694 return ((strR.ptr) && (strR.len) == MK_NULL_STR_LEN && strcmp((strR.ptr),MK_NULL_STR)==0);
1695}
#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_EXTERN MK_BOOL MkStringIsNULLP ( MkStringR const strR)

Non-inline replacement for MkStringIsNULL

◆ MkStringLog_RT()

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

log the string ...

Definition at line 12715 of file LibMkKernel_mk.h.

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

◆ MkStringLogP()

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

Non-inline replacement for MkStringLog

◆ MkStringSlice()

MkStringR MkStringSlice ( MkStringR strR,
MK_NUM start,
MK_NUM len )
inline

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 1651 of file LibMkKernel_mk.h.

1651 {
1652 if (len < 0) len = strR.len;
1653 if (start > strR.len) {
1654 return MkStringCreate(0,NULL);
1655 } else if ((start+len) > strR.len) {
1656 return MkStringCreate(strR.len-start,strR.ptr+start);
1657 } else {
1658 return MkStringCreate(len,strR.ptr+start);
1659 }
1660}
MK_STRN ptr
pointer to the string data
MK_NUM len
len of the string data

◆ MkStringSliceP()

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

Non-inline replacement for MkStringSlice

◆ MkStringSplit()

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

split a str into ptr and len

Definition at line 1664 of file LibMkKernel_mk.h.

1664 {
1665 assert(len_out != NULL);
1666 assert(str_out != NULL);
1667 *len_out = strR.len; *str_out = strR.ptr;
1668}

◆ MkStringSplitP()

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

Non-inline replacement for MkStringSplit