NewMadeleine

Documentation

« back to PM2 home.

Data slicer is a collection of primitives to get a series of blocks with bounds controled by the caller from a given nm_data iterator. More...

Data Structures

struct  nm_data_coroutine_s
 
struct  nm_data_slicer_s
 internal state of a data slicer. More...
 

Macros

#define NM_DATA_SLICER_NULL   ((struct nm_data_slicer_s){ .kind = NM_DATA_SLICER_NONE })
 a slicer attached to no data
 

Typedefs

typedef void(* nm_data_coroutine_worker_t) (struct nm_data_coroutine_s *p_coroutine, void *_user_data)
 
typedef enum nm_data_coroutine_kind_e nm_data_coroutine_kind_t
 
typedef struct nm_data_slicer_s nm_data_slicer_t
 internal state of a data slicer.
 

Enumerations

enum  nm_data_coroutine_kind_e { NM_DATA_COROUTINE_NONE , NM_DATA_COROUTINE_UCONTEXT , NM_DATA_COROUTINE_LONGJMP }
 
enum  nm_data_slicer_kind_t { NM_DATA_SLICER_NONE = 0 , NM_DATA_SLICER_COROUTINE , NM_DATA_SLICER_CONTIG }
 various kinds of slicer implementations More...
 

Functions

void nm_data_coroutine_yield_to_caller (struct nm_data_coroutine_s *p_coroutine)
 
void nm_data_coroutine_yield_to_data (struct nm_data_coroutine_s *p_coroutine)
 
static int nm_data_slicer_isnull (const nm_data_slicer_t *p_slicer)
 tests whether a slicer is null
 
void nm_data_slicer_init (nm_data_slicer_t *p_slicer, const struct nm_data_s *p_data)
 
void nm_data_slicer_copy_from (nm_data_slicer_t *p_slicer, void *dest_ptr, nm_len_t slice_len)
 
void nm_data_slicer_copy_to (nm_data_slicer_t *p_slicer, const void *src_ptr, nm_len_t slice_len)
 
void nm_data_slicer_forward (nm_data_slicer_t *p_slicer, nm_len_t offset)
 
void nm_data_slicer_destroy (nm_data_slicer_t *p_slicer)
 

Detailed Description

Data slicer is a collection of primitives to get a series of blocks with bounds controled by the caller from a given nm_data iterator.

Two flavors are available:

  • contig, for contiguous data types
  • coroutine, as a general case Additionally, two implementations are avilable for coroutines, depending on platform:
  • setjmp/longjmp, as a general case
  • ucontext-based coroutine, on platforms where stack jumping is not permitted by longjmp (ia64)

Macro Definition Documentation

◆ NM_DATA_SLICER_NULL

#define NM_DATA_SLICER_NULL   ((struct nm_data_slicer_s){ .kind = NM_DATA_SLICER_NONE })

a slicer attached to no data

Definition at line 780 of file nm_data.h.

Typedef Documentation

◆ nm_data_coroutine_kind_t

Definition at line 731 of file nm_data.h.

◆ nm_data_coroutine_worker_t

typedef void(* nm_data_coroutine_worker_t) (struct nm_data_coroutine_s *p_coroutine, void *_user_data)

Definition at line 723 of file nm_data.h.

◆ nm_data_slicer_t

internal state of a data slicer.

Opaque structure for the user.

Enumeration Type Documentation

◆ nm_data_coroutine_kind_e

Enumerator
NM_DATA_COROUTINE_NONE 
NM_DATA_COROUTINE_UCONTEXT 

ucontext-based coroutines, when stack jumping is not available through longjmp

NM_DATA_COROUTINE_LONGJMP 

longjmp-based coroutine, when stack jumping is possible with longjmp

Definition at line 725 of file nm_data.h.

◆ nm_data_slicer_kind_t

various kinds of slicer implementations

Enumerator
NM_DATA_SLICER_NONE 
NM_DATA_SLICER_COROUTINE 

coroutine-based slicer, using generic data traversal

NM_DATA_SLICER_CONTIG 

slicer specialized for contig data

Definition at line 751 of file nm_data.h.

Function Documentation

◆ nm_data_coroutine_yield_to_caller()

void nm_data_coroutine_yield_to_caller ( struct nm_data_coroutine_s p_coroutine)

◆ nm_data_coroutine_yield_to_data()

void nm_data_coroutine_yield_to_data ( struct nm_data_coroutine_s p_coroutine)

◆ nm_data_slicer_copy_from()

void nm_data_slicer_copy_from ( nm_data_slicer_t p_slicer,
void *  dest_ptr,
nm_len_t  slice_len 
)

◆ nm_data_slicer_copy_to()

void nm_data_slicer_copy_to ( nm_data_slicer_t p_slicer,
const void *  src_ptr,
nm_len_t  slice_len 
)

◆ nm_data_slicer_destroy()

void nm_data_slicer_destroy ( nm_data_slicer_t p_slicer)

◆ nm_data_slicer_forward()

void nm_data_slicer_forward ( nm_data_slicer_t p_slicer,
nm_len_t  offset 
)

◆ nm_data_slicer_init()

void nm_data_slicer_init ( nm_data_slicer_t p_slicer,
const struct nm_data_s p_data 
)

◆ nm_data_slicer_isnull()

static int nm_data_slicer_isnull ( const nm_data_slicer_t p_slicer)
inlinestatic

tests whether a slicer is null

Definition at line 783 of file nm_data.h.

References nm_data_slicer_s::kind, and NM_DATA_SLICER_NONE.