Data Structures | Defines | Functions

Buffer Managment
[IoUtil Functions]

General Purpose Buffers. More...

Data Structures

struct  buffer_pool_t
struct  buffer_stream_t
struct  buffer_t

Defines

#define BUFFER_ADVANCE(b, more)   do{ b->istart += more;}while(0)
#define BUFFER_ELSZ(x)   (sizeof(buffer_t) + (x))
#define BUFFER_FREE_AT_END(b)   (b->len - b->iend)
#define BUFFER_FREE_AT_START(b)   (b->istart)
#define BUFFER_GET_MEMBLOCK(b, pmem, size)
#define BUFFER_IS_LOCKED(b)   ((b->used&2)!=0)
#define BUFFER_IS_USED(b)   ((b->used&1)!=0)
#define BUFFER_LAST_CHAR(b)   (b->iend <= b->istart) ? EOF : (char)b->data[b->iend-1]
#define BUFFER_PDATA(b)   (b->data + b->istart)
#define BUFFER_RESET(b, start)   do{ b->iend = b->istart = start;}while(0)
#define BUFFER_SEEK(b, offset)   (b->data + (b->iend=offset))
#define BUFFER_SET_LOCK(b)   do{b->used|=2;}while(0)
#define BUFFER_SET_UNLOCK(b)   do{b->used&=~2;}while(0)
#define BUFFER_SET_UNUSED(b)   do{b->used&=~1;}while(0)
#define BUFFER_SET_USED(b)   do{b->used|=1;}while(0)
#define BUFFER_SIZE(b)   (b->iend - b->istart)
#define BUFFER_UPDATE_MEMBLOCK(b, end)

Functions

buffer_tbuffer_alloc (buffer_pool_t *ppool, uint8_t istart)
uint8_t buffer_append_block (buffer_t *b, void *pdata, uint8_t size)
int buffer_append_char (buffer_t *b, uint8_t c)
void buffer_free (buffer_t *pbuf)
uint8_t buffer_get_block (buffer_t *b, void *pdata, uint8_t size)
int buffer_get_char (buffer_t *b)
buffer_tbuffer_init (void *pmem, uint8_t size, uint8_t start)
buffer_pool_tbuffer_pool_init (uint8_t *pmem, size_t memsz, uint8_t bsz)
uint8_t buffer_prepend_block (buffer_t *b, void *pdata, uint8_t size)
int buffer_prepend_char (buffer_t *b, int c)
int buffer_stream_getchar (FILE *f)
int buffer_stream_init (buffer_stream_t *pbs, void(*incb)(buffer_t *pbuf), void(*outcb)(buffer_t *pbuf))
int buffer_stream_putchar (char c, FILE *f)

Detailed Description

General Purpose Buffers.


Define Documentation

#define BUFFER_GET_MEMBLOCK (   b,
  pmem,
  size 
)
Value:
do{\
        b->used = 1;\
        pmem = (b->data + b->iend);\
        size = (b->len - b->iend);\
    }while(0)
#define BUFFER_SET_USED (   b  )     do{b->used|=1;}while(0)
#define BUFFER_UPDATE_MEMBLOCK (   b,
  end 
)
Value:
do{\
        b->iend = end;\
        b->used = 0;\
    }while(0);

Function Documentation

uint8_t buffer_append_block ( buffer_t b,
void *  pdata,
uint8_t  size 
)

append a data block at the end of a buffer

int buffer_append_char ( buffer_t b,
uint8_t  c 
)

append a char at the end of a buffer

uint8_t buffer_get_block ( buffer_t b,
void *  pdata,
uint8_t  size 
)

read a datablock from the start of a buffer

int buffer_get_char ( buffer_t b  ) 

read a char from the start of a buffer

buffer_t* buffer_init ( void *  pmem,
uint8_t  size,
uint8_t  start 
)

format a chunk of memory as buffer_t structure

uint8_t buffer_prepend_block ( buffer_t b,
void *  pdata,
uint8_t  size 
)

prepend a data block at the start of a buffer

int buffer_prepend_char ( buffer_t b,
int  c 
)

prepend a char at the start of a buffer


This documentation for µracoli was generated on Tue Apr 9 2013 by  doxygen 1.7.1