theKernel 10.0
Loading...
Searching...
No Matches
MkBufferListC_Misc_C_API

MkBufferListC - various functions to work on a MkBufferListSMore...

+ Collaboration diagram for MkBufferListC_Misc_C_API:

Macros

#define MkBufferListSizeI(bfl)
 

Functions

void MkBufferListMove_RT (MK_RT mkrt, MK_BFL const to, MK_BFL const from)
 move all internal data from from to the end of to
 
void MkBufferListCopy_RT (MK_RT mkrt, MK_BFL const bfl, MK_BFLN const src)
 copy all internal data from src to tgt
 
MK_BFL MkBufferListPositionMerge_RT (MK_RT mkrt, MK_BFL const bfl, MK_BFL const source, MK_NUM position)
 merge a MkBufferListS list into an MkBufferListS object on position
 
MK_NUM MkBufferListSearchC_RT (MK_RT mkrt, MK_BFLN const bfl, MK_STRN const str, MK_NUM const len, MK_NUM const startindex)
 search MK_STR item from a MkBufferListS object starting at startindex
 
MK_BFL MkBufferListReset_RT (MK_RT mkrt, MK_BFL bfl)
 reset a MkBufferListC object …
 
MK_STRN MkBufferListToString_RT (MK_RT mkrt, MK_BFLN const bfl)
 get a string representation of the bfl
 
MK_NAT_LIST MkBufferListToList_RT (MK_RT mkrt, MK_BFLN const bfl)
 get a target-language list representation of the bfl
 
MK_STRN_A MkBufferListToStringList_RT (MK_RT mkrt, MK_BFLN const bfl, bool const unique)
 get a string-list representation of the bfl
 
MK_BUF MkBufferListToBuffer_RT (MK_RT mkrt, MK_BFLN const bfl)
 Export a bfl into an MkBufferC using an MkBufferStreamC
 
MK_I32 MkBufferListCmp_RT (MK_RT mkrt, MK_BFLN const bfl, MK_BFLN const bfl2)
 compare two buffer-list
 
MK_BFL MkBufferListSort_RT (MK_RT mkrt, MK_BFL const bfl)
 sort a MkBufferListC
 
void MkBufferListReserve_RT (MK_RT mkrt, MK_BFL const bfl, MK_NUM const num)
 reserve num items in a MkBufferListC object …
 
MK_NUM MkBufferListSize_RT (MK_RT mkrt, MK_BFLN const bfl)
 get the number-of-items in the bfl
 
MK_BFL MkBufferListFileGlob_RT (MK_RT mkrt, MK_STRN const pattern_match)
 create a new MkBufferListC using the result from a filesystem glob operation …
 

MkBufferListC - MkBufferListC_Misc_C_API - overload

#define MkBufferListFileGlob_NULL(...)
 
#define MkBufferListFileGlob(...)
 
#define MkBufferListPositionMerge_NULL(...)
 
#define MkBufferListPositionMerge(...)
 
#define MkBufferListReset_NULL(...)
 
#define MkBufferListReset(...)
 
#define MkBufferListSort_NULL(...)
 
#define MkBufferListSort(...)
 
#define MkBufferListToBuffer_NULL(...)
 
#define MkBufferListToBuffer(...)
 
#define MkBufferListCmp_NULL(...)
 
#define MkBufferListCmp(...)
 
#define MkBufferListCopy_NULL(...)
 
#define MkBufferListCopy(...)
 
#define MkBufferListMove_NULL(...)
 
#define MkBufferListMove(...)
 
#define MkBufferListReserve_NULL(...)
 
#define MkBufferListReserve(...)
 
#define MkBufferListSearchC_NULL(...)
 
#define MkBufferListSearchC(...)
 
#define MkBufferListSearchC_3(bfl, str, len)
 
#define MkBufferListSearchC_2(bfl, str)
 
#define MkBufferListSize_NULL(...)
 
#define MkBufferListSize(...)
 
#define MkBufferListToList_NULL(...)
 
#define MkBufferListToList(...)
 
#define MkBufferListToString_NULL(...)
 
#define MkBufferListToString(...)
 
#define MkBufferListToStringList_NULL(...)
 
#define MkBufferListToStringList(...)
 

Detailed Description

MkBufferListC - various functions to work on a MkBufferListS

Macro Definition Documentation

◆ MkBufferListCmp

#define MkBufferListCmp ( ...)
Value:
MK_I32 MkBufferListCmp_RT(MK_RT mkrt, MK_BFLN const bfl, MK_BFLN const bfl2)
compare two buffer-list …
#define MK_RT_CALL

Definition at line 585 of file kernel_overload_mk.h.

◆ MkBufferListCmp_NULL

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

Definition at line 584 of file kernel_overload_mk.h.

◆ MkBufferListCopy

#define MkBufferListCopy ( ...)
Value:
void MkBufferListCopy_RT(MK_RT mkrt, MK_BFL const bfl, MK_BFLN const src)
copy all internal data from src to tgt …

Definition at line 587 of file kernel_overload_mk.h.

◆ MkBufferListCopy_NULL

#define MkBufferListCopy_NULL ( ...)
Value:

Definition at line 586 of file kernel_overload_mk.h.

◆ MkBufferListFileGlob

#define MkBufferListFileGlob ( ...)
Value:
MK_BFL MkBufferListFileGlob_RT(MK_RT mkrt, MK_STRN const pattern_match)
create a new MkBufferListC using the result from a filesystem glob operation …

Definition at line 571 of file kernel_overload_mk.h.

◆ MkBufferListFileGlob_NULL

#define MkBufferListFileGlob_NULL ( ...)
Value:

Definition at line 570 of file kernel_overload_mk.h.

◆ MkBufferListMove

#define MkBufferListMove ( ...)
Value:
void MkBufferListMove_RT(MK_RT mkrt, MK_BFL const to, MK_BFL const from)
move all internal data from from to the end of to …

Definition at line 589 of file kernel_overload_mk.h.

◆ MkBufferListMove_NULL

#define MkBufferListMove_NULL ( ...)
Value:

Definition at line 588 of file kernel_overload_mk.h.

◆ MkBufferListPositionMerge

#define MkBufferListPositionMerge ( ...)
Value:
MK_BFL MkBufferListPositionMerge_RT(MK_RT mkrt, MK_BFL const bfl, MK_BFL const source, MK_NUM position)
merge a MkBufferListS list into an MkBufferListS object on position …

Definition at line 575 of file kernel_overload_mk.h.

◆ MkBufferListPositionMerge_NULL

#define MkBufferListPositionMerge_NULL ( ...)
Value:

Definition at line 574 of file kernel_overload_mk.h.

◆ MkBufferListReserve

#define MkBufferListReserve ( ...)
Value:
void MkBufferListReserve_RT(MK_RT mkrt, MK_BFL const bfl, MK_NUM const num)
reserve num items in a MkBufferListC object …

Definition at line 591 of file kernel_overload_mk.h.

◆ MkBufferListReserve_NULL

#define MkBufferListReserve_NULL ( ...)
Value:

Definition at line 590 of file kernel_overload_mk.h.

◆ MkBufferListReset

#define MkBufferListReset ( ...)
Value:
MK_BFL MkBufferListReset_RT(MK_RT mkrt, MK_BFL bfl)
reset a MkBufferListC object …

Definition at line 577 of file kernel_overload_mk.h.

◆ MkBufferListReset_NULL

#define MkBufferListReset_NULL ( ...)
Value:

Definition at line 576 of file kernel_overload_mk.h.

◆ MkBufferListSearchC

#define MkBufferListSearchC ( ...)
Value:
MK_NUM MkBufferListSearchC_RT(MK_RT mkrt, MK_BFLN const bfl, MK_STRN const str, MK_NUM const len, MK_NUM const startindex)
search MK_STR item from a MkBufferListS object starting at startindex …

Definition at line 593 of file kernel_overload_mk.h.

◆ MkBufferListSearchC_2

#define MkBufferListSearchC_2 ( bfl,
str )
Value:
MkBufferListSearchC(bfl,str,-1,0)
#define MkBufferListSearchC(...)

Definition at line 595 of file kernel_overload_mk.h.

◆ MkBufferListSearchC_3

#define MkBufferListSearchC_3 ( bfl,
str,
len )
Value:
MkBufferListSearchC(bfl,str,len,0)

Definition at line 594 of file kernel_overload_mk.h.

◆ MkBufferListSearchC_NULL

#define MkBufferListSearchC_NULL ( ...)
Value:

Definition at line 592 of file kernel_overload_mk.h.

◆ MkBufferListSize

#define MkBufferListSize ( ...)
Value:
MK_NUM MkBufferListSize_RT(MK_RT mkrt, MK_BFLN const bfl)
get the number-of-items in the bfl …

Definition at line 597 of file kernel_overload_mk.h.

◆ MkBufferListSize_NULL

#define MkBufferListSize_NULL ( ...)
Value:

Definition at line 596 of file kernel_overload_mk.h.

◆ MkBufferListSizeI

#define MkBufferListSizeI ( bfl)
Value:
(bfl)->cursize

Definition at line 817 of file MkBufferListC_def_mk.h.

◆ MkBufferListSort

#define MkBufferListSort ( ...)
Value:
MK_BFL MkBufferListSort_RT(MK_RT mkrt, MK_BFL const bfl)
sort a MkBufferListC …

Definition at line 579 of file kernel_overload_mk.h.

◆ MkBufferListSort_NULL

#define MkBufferListSort_NULL ( ...)
Value:

Definition at line 578 of file kernel_overload_mk.h.

◆ MkBufferListToBuffer

#define MkBufferListToBuffer ( ...)
Value:
MK_BUF MkBufferListToBuffer_RT(MK_RT mkrt, MK_BFLN const bfl)
Export a bfl into an MkBufferC using an MkBufferStreamC …

Definition at line 581 of file kernel_overload_mk.h.

◆ MkBufferListToBuffer_NULL

#define MkBufferListToBuffer_NULL ( ...)
Value:

Definition at line 580 of file kernel_overload_mk.h.

◆ MkBufferListToList

#define MkBufferListToList ( ...)
Value:
MK_NAT_LIST MkBufferListToList_RT(MK_RT mkrt, MK_BFLN const bfl)
get a target-language list representation of the bfl …

Definition at line 599 of file kernel_overload_mk.h.

◆ MkBufferListToList_NULL

#define MkBufferListToList_NULL ( ...)
Value:

Definition at line 598 of file kernel_overload_mk.h.

◆ MkBufferListToString

#define MkBufferListToString ( ...)
Value:
MK_STRN MkBufferListToString_RT(MK_RT mkrt, MK_BFLN const bfl)
get a string representation of the bfl

Definition at line 601 of file kernel_overload_mk.h.

◆ MkBufferListToString_NULL

#define MkBufferListToString_NULL ( ...)
Value:

Definition at line 600 of file kernel_overload_mk.h.

◆ MkBufferListToStringList

#define MkBufferListToStringList ( ...)
Value:
MK_STRN_A MkBufferListToStringList_RT(MK_RT mkrt, MK_BFLN const bfl, bool const unique)
get a string-list representation of the bfl

Definition at line 603 of file kernel_overload_mk.h.

◆ MkBufferListToStringList_NULL

#define MkBufferListToStringList_NULL ( ...)
Value:

Definition at line 602 of file kernel_overload_mk.h.

Function Documentation

◆ MkBufferListCmp_RT()

MK_I32 MkBufferListCmp_RT ( MK_RT mkrt,
MK_BFLN const bfl,
MK_BFLN const bfl2 )

compare two buffer-list

First the size is compared and if the size is equal every argument starting from 0 is compared with BufferCmp. The first BufferCmp with a result != 0 finish the comparison and this result is returned.

Parameters
[in]mkrtthe MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only)
[in]bflthe MkBufferListS instance to work on
[in]bfl2buffer-list to compare
Returns
Returns < 0 if bfl is less than bfl2; > 0 if bfl is greater than bfl2, and 0 if they are equal

◆ MkBufferListCopy_RT()

void MkBufferListCopy_RT ( MK_RT mkrt,
MK_BFL const bfl,
MK_BFLN const src )

copy all internal data from src to tgt

  1. existing data will be overwritten
  2. the cursize of src will be the cursize of tgt
Parameters
[in]mkrtthe MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only)
[in]bflthe MkBufferListS instance to work on
[in]srcthe source of the copy

◆ MkBufferListFileGlob_RT()

MK_BFL MkBufferListFileGlob_RT ( MK_RT mkrt,
MK_STRN const pattern_match )

create a new MkBufferListC using the result from a filesystem glob operation …

◆ MkBufferListMove_RT()

void MkBufferListMove_RT ( MK_RT mkrt,
MK_BFL const to,
MK_BFL const from )

move all internal data from from to the end of to

after the move… the from is empty and only the shell exists

Parameters
[in]mkrtthe MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only)
[in]tothe target of the move
[in]fromthe source of the move

◆ MkBufferListPositionMerge_RT()

MK_BFL MkBufferListPositionMerge_RT ( MK_RT mkrt,
MK_BFL const bfl,
MK_BFL const source,
MK_NUM position )

merge a MkBufferListS list into an MkBufferListS object on position

Parameters
[in]mkrtthe MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only)
[in]bflthe MkBufferListS instance to work on
[in]sourcethe object to be merged into bfl, afterwords the source is empty and can be deleted
[in]positioninsert in at position, shift all following arguments one up. Set position to 0 to append to the beginning or set position to -1 to append to the end

◆ MkBufferListReserve_RT()

void MkBufferListReserve_RT ( MK_RT mkrt,
MK_BFL const bfl,
MK_NUM const num )

reserve num items in a MkBufferListC object …

  1. cursize will be num
  2. size will b >= num
  3. free: num <= X < cursize
  4. init: cursize <= X < num
Parameters
[in]mkrtthe MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only)
bflthe MkBufferListC object to reserve memory
numreserve the number of items for later use.

◆ MkBufferListReset_RT()

MK_BFL MkBufferListReset_RT ( MK_RT mkrt,
MK_BFL bfl )

reset a MkBufferListC object …

Parameters
[in]mkrtthe MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only)
[in]bflthe MkBufferListS instance to work on
Attention
all MkBufferC objects will be freed

◆ MkBufferListSearchC_RT()

MK_NUM MkBufferListSearchC_RT ( MK_RT mkrt,
MK_BFLN const bfl,
MK_STRN const str,
MK_NUM const len,
MK_NUM const startindex )

search MK_STR item from a MkBufferListS object starting at startindex

Parameters
[in]mkrtthe MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only)
[in]bflthe MkBufferListS instance to work on
strthe string to search for
lenthe length of str or -1 to calulate the length with strlen
startindexstart searching in buf from index startindex
Returns
The index of the str found or -1 if not found. The return value can be used as startindex of following calls to BufferListSearchC

a typical usage for this code is parsing an MkBufferListS object for multiple occurrences of a string

while ((startindex = MkBufferListSearchC (buf, str, strlen(str), startindex)) != -1) {
...
}
Attention
The size of str have to be at least 4 bytes

◆ MkBufferListSize_RT()

MK_NUM MkBufferListSize_RT ( MK_RT mkrt,
MK_BFLN const bfl )

get the number-of-items in the bfl

Parameters
[in]mkrtthe MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only)
[in]bflthe MkBufferListS instance to work on
Returns
the number-of-items in the bfl

◆ MkBufferListSort_RT()

MK_BFL MkBufferListSort_RT ( MK_RT mkrt,
MK_BFL const bfl )

sort a MkBufferListC

Parameters
[in]mkrtthe MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only)
[in]bflthe MkBufferListS instance to work on
Returns
Return the input bfl as sorted list

◆ MkBufferListToBuffer_RT()

MK_BUF MkBufferListToBuffer_RT ( MK_RT mkrt,
MK_BFLN const bfl )

Export a bfl into an MkBufferC using an MkBufferStreamC

An buffer is able to hold all primitive types and LIST of primitive types. An buffer-list is an Indexed-LIST representation of a LIST of buffer.

To add a buffer-list into an buffer the buffer-list have to be converted into a buffer-stream and the buffer-stream have to be exported as buffer. The buffer is finally apended to the buffer-list.

Parameters
[in]mkrtthe MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only)
[in]bflthe MkBufferListS instance to work on
Returns
the required buffer or a MK_NULL on error
Attention
(do not free) The memory of the out/return value belongs to the called libmkkernel function and therefore never becomes MK_NULL for a non-error result.
For details on the out/return value, see: MkKernel_Storage_C_API.

◆ MkBufferListToList_RT()

MK_NAT_LIST MkBufferListToList_RT ( MK_RT mkrt,
MK_BFLN const bfl )

get a target-language list representation of the bfl

Parameters
[in]mkrtthe MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only)
[in]bflthe MkBufferListS instance to work on
Returns
the required list
Attention
this is only implemented by the Target-Programming-Language (TPL)

◆ MkBufferListToString_RT()

MK_STRN MkBufferListToString_RT ( MK_RT mkrt,
MK_BFLN const bfl )

get a string representation of the bfl

Parameters
[in]mkrtthe MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only)
[in]bflthe MkBufferListS instance to work on
Returns
the required string
Attention
  • The returned string is owned by self… do not free.
  • On error an empty string is returned.

◆ MkBufferListToStringList_RT()

MK_STRN_A MkBufferListToStringList_RT ( MK_RT mkrt,
MK_BFLN const bfl,
bool const unique )

get a string-list representation of the bfl

Parameters
[in]mkrtthe MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only)
[in]bflthe MkBufferListS instance to work on
[out]uniqueif true the return belongs to the caller and have to be freed, if false the return belongs to the function and must NOT be freed.
Returns
the required list
Attention
the string-list is terminated with MK_NULL