17#define A_BUF_DEF a_size num_, mem_, siz_
32#define a_buf_(_, x) a_cast_s(a_buf _, a_cast_s(void _, x))
58 return a_cast_r(
a_buf *, a_cast_r(
a_uptr, ctx)) + 1;
60#define A_BUF_PTR(T, ctx) a_cast_s(T *, a_buf_ptr(ctx))
73#define A_BUF_AT_(T, ctx, idx) a_cast_s(T *, a_buf_at_(ctx, idx))
86#define A_BUF_AT(T, ctx, idx) a_cast_s(T *, a_buf_at(ctx, idx))
100#define A_BUF_OF(T, ctx, idx) a_cast_s(T *, a_buf_of(ctx, idx))
112#define A_BUF_TOP_(T, ctx) a_cast_s(T *, a_buf_top_(ctx))
124#define A_BUF_TOP(T, ctx) a_cast_s(T *, a_buf_top(ctx))
135#define A_BUF_END(T, ctx) a_cast_s(T *, a_buf_end(ctx))
137#if defined(__cplusplus)
203A_EXTERN
void a_buf_sort(
void const *ctx,
int (*cmp)(
void const *,
void const *));
222A_EXTERN
void a_buf_sort_fore(
void const *ctx,
int (*cmp)(
void const *,
void const *));
241A_EXTERN
void a_buf_sort_back(
void const *ctx,
int (*cmp)(
void const *,
void const *));
254A_EXTERN
void *
a_buf_push_sort(
void *ctx,
void const *key,
int (*cmp)(
void const *,
void const *));
255#define A_BUF_PUSH_SORT(T, ctx, key, cmp) a_cast_s(T *, a_buf_push_sort(ctx, key, cmp))
268A_EXTERN
void *
a_buf_search(
void const *ctx,
void const *obj,
int (*cmp)(
void const *,
void const *));
269#define A_BUF_SEARCH(T, ctx, obj, cmp) a_cast_s(T *, a_buf_search(ctx, obj, cmp))
281#define A_BUF_INSERT(T, ctx, idx) a_cast_s(T *, a_buf_insert(ctx, idx))
293#define A_BUF_REMOVE(T, ctx, idx) a_cast_s(T *, a_buf_remove(ctx, idx))
302#define A_BUF_PUSH_FORE(T, ctx) a_cast_s(T *, a_buf_push_fore(ctx))
311#define A_BUF_PUSH_BACK(T, ctx) a_cast_s(T *, a_buf_push_back(ctx))
320#define A_BUF_PULL_FORE(T, ctx) a_cast_s(T *, a_buf_pull_fore(ctx))
329#define A_BUF_PULL_BACK(T, ctx) a_cast_s(T *, a_buf_pull_back(ctx))
356#if defined(__cplusplus)
367#define A_BUF_PUSH(T, ctx) a_cast_s(T *, a_buf_push(ctx))
376#define A_BUF_PULL(T, ctx) a_cast_s(T *, a_buf_pull(ctx))
390#define a_buf_forenum(i, ctx) a_forenum(a_size, i, a_buf_num(ctx))
391#define A_BUF_FORENUM(I, i, ctx) A_FORENUM(I, i, a_buf_num(ctx))
405#define a_buf_forenum_reverse(i, ctx) a_forenum_reverse(a_size, i, a_buf_num(ctx))
406#define A_BUF_FORENUM_REVERSE(I, i, ctx) A_FORENUM_REVERSE(I, i, a_buf_num(ctx))
421#define a_buf_foreach(T, S, it, ctx) a_foreach(T, S, it, a_buf_ptr(ctx), a_buf_num(ctx))
422#define A_BUF_FOREACH(T, it, at, ctx) A_FOREACH(T, it, at, a_buf_ptr(ctx), a_buf_num(ctx))
437#define a_buf_foreach_reverse(T, S, it, ctx) a_foreach_reverse(T, S, it, a_buf_ptr(ctx), a_buf_num(ctx))
438#define A_BUF_FOREACH_REVERSE(T, it, at, ctx) A_FOREACH_REVERSE(T, it, at, a_buf_ptr(ctx), a_buf_num(ctx))
void * a_buf_top_(void const *ctx)
access top element for a pointer to buffer structure
Definition buf.h:108
void * a_buf_insert(void *ctx, a_size idx)
insert an element into the buffer
a_size a_buf_num(void const *ctx)
access number of element for a pointer to buffer structure
Definition buf.h:38
void * a_buf_at(void const *ctx, a_size idx)
access specified element for a pointer to buffer structure
Definition buf.h:82
void * a_buf_ptr(void const *ctx)
access address of buffer for a pointer to buffer structure
Definition buf.h:56
#define a_buf_(_, x)
cast a buffer pointer from another type pointer
Definition buf.h:32
void a_buf_sort(void const *ctx, int(*cmp)(void const *, void const *))
sort all elements for a pointer to buffer structure
void a_buf_dtor(void *ctx, void(*dtor)(void *))
destructor for buffer structure
void * a_buf_search(void const *ctx, void const *obj, int(*cmp)(void const *, void const *))
search the given element in this buffer
void a_buf_setz(void *ctx, a_size siz, void(*dtor)(void *))
set size of a element for a pointer to buffer structure
void * a_buf_push(void *ctx)
push an element into the buffer
Definition buf.h:366
void * a_buf_push_sort(void *ctx, void const *key, int(*cmp)(void const *, void const *))
push an element into the buffer and sort it
void * a_buf_remove(void *ctx, a_size idx)
remove an element from the buffer
void * a_buf_pull_back(void *ctx)
pull an element from the buffer backward
void * a_buf_of(void const *ctx, a_diff idx)
access specified element for a pointer to buffer structure
Definition buf.h:95
void * a_buf_pull_fore(void *ctx)
pull an element from the buffer forward
a_buf * a_buf_setm(a_buf *ctx, a_size mem)
set memory of element for a pointer to buffer structure
int a_buf_store(void *ctx, a_size idx, void *ptr, a_size num, int(*copy)(void *, void const *))
store elements into the buffer
a_size a_buf_siz(void const *ctx)
access size of a element for a pointer to buffer structure
Definition buf.h:50
void a_buf_setn(void *ctx, a_size num, void(*dtor)(void *))
set number of element for a pointer to buffer structure
void * a_buf_pull(void *ctx)
pull an element from the buffer
Definition buf.h:375
void a_buf_sort_back(void const *ctx, int(*cmp)(void const *, void const *))
insert sort backmost element for a pointer to buffer structure
void * a_buf_push_back(void *ctx)
push an element into the buffer backward
void a_buf_sort_fore(void const *ctx, int(*cmp)(void const *, void const *))
insert sort foremost element for a pointer to buffer structure
void * a_buf_end(void const *ctx)
access end pointer for a pointer to buffer structure
Definition buf.h:131
void * a_buf_push_fore(void *ctx)
push an element into the buffer forward
void * a_buf_at_(void const *ctx, a_size idx)
access specified element for a pointer to buffer structure
Definition buf.h:69
int a_buf_erase(void *ctx, a_size idx, a_size num, void(*dtor)(void *))
erase elements from the buffer
void * a_buf_top(void const *ctx)
access top element for a pointer to buffer structure
Definition buf.h:120
a_size a_buf_mem(void const *ctx)
access memory of element for a pointer to buffer structure
Definition buf.h:44
void a_buf_ctor(void *ctx, a_size siz, a_size num)
constructor for buffer structure
a_buf * a_buf_new(a_size siz, a_size num)
allocate a pointer to buffer structure from memory
void a_buf_die(a_buf *ctx, void(*dtor)(void *))
deallocate a pointer to buffer structure
ptrdiff_t a_diff
signed integer type returned when subtracting two pointers
Definition a.h:780
unsigned long a_uptr
unsigned integer type capable of holding a pointer to void
Definition a.h:738
#define a_size_c(x)
static cast to a_size
Definition a.h:820
size_t a_size
unsigned integer type returned by the sizeof operator
Definition a.h:823
instance structure for basic buffer
Definition buf.h:22