33#define A_BUF_PTR(T, ctx) a_cast_s(T *, a_buf_ptr(ctx))
62 return a_byte_(*, ctx->
ptr_) + ctx->
siz_ * idx;
64#define A_BUF_AT_(T, ctx, idx) a_cast_s(T *, a_buf_at_(ctx, idx))
77#define A_BUF_AT(T, ctx, idx) a_cast_s(T *, a_buf_at(ctx, idx))
91#define A_BUF_IDX(T, ctx, idx) a_cast_s(T *, a_buf_idx(ctx, idx))
101 return a_byte_(*, ctx->
ptr_) + ctx->
siz_ * (ctx->
num_ - 1);
103#define A_BUF_TOP_(T, ctx) a_cast_s(T *, a_buf_top_(ctx))
115#define A_BUF_TOP(T, ctx) a_cast_s(T *, a_buf_top(ctx))
126#define A_BUF_END(T, ctx) a_cast_s(T *, a_buf_end(ctx))
128#if defined(__cplusplus)
230#define A_BUF_PUSH_SORT(T, ctx, key, cmp) a_cast_s(T *, a_buf_push_sort(ctx, key, cmp))
243A_EXTERN
void *
a_buf_search(
a_buf const *ctx,
void const *obj,
int (*cmp)(
void const *,
void const *));
244#define A_BUF_SEARCH(T, ctx, obj, cmp) a_cast_s(T *, a_buf_search(ctx, obj, cmp))
256#define A_BUF_INSERT(T, ctx, idx) a_cast_s(T *, a_buf_insert(ctx, idx))
268#define A_BUF_REMOVE(T, ctx, idx) a_cast_s(T *, a_buf_remove(ctx, idx))
277#define A_BUF_PUSH_FORE(T, ctx) a_cast_s(T *, a_buf_push_fore(ctx))
286#define A_BUF_PUSH_BACK(T, ctx) a_cast_s(T *, a_buf_push_back(ctx))
295#define A_BUF_PULL_FORE(T, ctx) a_cast_s(T *, a_buf_pull_fore(ctx))
304#define A_BUF_PULL_BACK(T, ctx) a_cast_s(T *, a_buf_pull_back(ctx))
306#if defined(__cplusplus)
317#define A_BUF_PUSH(T, ctx) a_cast_s(T *, a_buf_push(ctx))
326#define A_BUF_PULL(T, ctx) a_cast_s(T *, a_buf_pull(ctx))
340#define a_buf_forenum(i, ctx) a_forenum(a_size, i, (ctx)->num_)
354#define a_buf_forenum_reverse(i, ctx) a_forenum_reverse(a_size, i, (ctx)->num_)
369#define a_buf_foreach(T, P, it, ctx) a_foreach(T, P, it, (ctx)->ptr_, (ctx)->num_)
384#define a_buf_foreach_reverse(T, P, it, ctx) a_foreach_reverse(T, P, it, (ctx)->ptr_, (ctx)->num_)
void * a_buf_at_(a_buf const *ctx, size_t idx)
access specified element for a pointer to buffer structure
Definition buf.h:60
void * a_buf_pull_back(a_buf *ctx)
pull an element from the buffer backward
void a_buf_move(a_buf *ctx, a_buf *obj)
initialize a pointer to buffer structure by moving
void a_buf_sort_fore(a_buf const *ctx, int(*cmp)(void const *, void const *))
insert sort foremost element for a pointer to buffer structure
void a_buf_sort(a_buf const *ctx, int(*cmp)(void const *, void const *))
sort all elements for a pointer to buffer structure
void * a_buf_insert(a_buf *ctx, size_t idx)
insert an element into the buffer
void * a_buf_at(a_buf const *ctx, size_t idx)
access specified element for a pointer to buffer structure
Definition buf.h:73
void a_buf_drop(a_buf *ctx, void(*dtor)(void *))
drop all the elements for a pointer to buffer structure
void a_buf_sort_back(a_buf const *ctx, int(*cmp)(void const *, void const *))
insert sort backmost element for a pointer to buffer structure
size_t a_buf_mem(a_buf const *ctx)
access memory of element for a pointer to buffer structure
Definition buf.h:51
void * a_buf_ptr(a_buf const *ctx)
access address of buffer for a pointer to buffer structure
Definition buf.h:32
void * a_buf_end(a_buf const *ctx)
access end pointer for a pointer to buffer structure
Definition buf.h:122
void a_buf_dtor(a_buf *ctx, void(*dtor)(void *))
destructor for buffer structure
void a_buf_ctor(a_buf *ctx, void *ptr, size_t siz, size_t num)
constructor for buffer structure
void * a_buf_push(a_buf *ctx)
push an element into the buffer
Definition buf.h:316
void a_buf_swap(a_buf const *ctx, size_t lhs, size_t rhs)
swap elements lhs and rhs for a pointer to buffer structure
void * a_buf_pull_fore(a_buf *ctx)
pull an element from the buffer forward
size_t a_buf_num(a_buf const *ctx)
access number of element for a pointer to buffer structure
Definition buf.h:45
void * a_buf_remove(a_buf *ctx, size_t idx)
remove an element from the buffer
void * a_buf_top(a_buf const *ctx)
access top element for a pointer to buffer structure
Definition buf.h:111
void * a_buf_idx(a_buf const *ctx, ptrdiff_t idx)
access specified element for a pointer to buffer structure
Definition buf.h:86
size_t a_buf_siz(a_buf const *ctx)
access size of a element for a pointer to buffer structure
Definition buf.h:39
void * a_buf_pull(a_buf *ctx)
pull an element from the buffer
Definition buf.h:325
void * a_buf_top_(a_buf const *ctx)
access top element for a pointer to buffer structure
Definition buf.h:99
void * a_buf_push_back(a_buf *ctx)
push an element into the buffer backward
void * a_buf_search(a_buf const *ctx, void const *obj, int(*cmp)(void const *, void const *))
search the given element in this buffer
void * a_buf_push_sort(a_buf *ctx, void const *key, int(*cmp)(void const *, void const *))
push an element into the buffer and sort it
void * a_buf_push_fore(a_buf *ctx)
push an element into the buffer forward
struct a_buf a_buf
instance structure for basic buffer
#define a_size
Definition a.h:610
#define a_diff
Definition a.h:598
#define a_size_c(x)
Definition a.h:607
instance structure for basic buffer
Definition buf.h:21
size_t siz_
Definition buf.h:23
void * ptr_
Definition buf.h:22
size_t num_
Definition buf.h:24
size_t mem_
Definition buf.h:25