50 return a_cast_s(
void *, ctx->
head_.next + 1);
52#define A_QUE_FORE_(T, ctx) a_cast_s(T *, a_que_fore_(ctx))
62 return a_cast_s(
void *, ctx->
head_.prev + 1);
64#define A_QUE_BACK_(T, ctx) a_cast_s(T *, a_que_back_(ctx))
76#define A_QUE_FORE(T, ctx) a_cast_s(T *, a_que_fore(ctx))
88#define A_QUE_BACK(T, ctx) a_cast_s(T *, a_que_back(ctx))
100#if defined(__cplusplus)
165#define A_QUE_AT(T, ctx, idx) a_cast_s(T *, a_que_at(ctx, idx))
217#define A_QUE_PUSH_SORT(T, ctx, key, cmp) a_cast_s(T *, a_que_push_sort(ctx, key, cmp))
226#define A_QUE_PUSH_FORE(T, ctx) a_cast_s(T *, a_que_push_fore(ctx))
235#define A_QUE_PUSH_BACK(T, ctx) a_cast_s(T *, a_que_push_back(ctx))
244#define A_QUE_PULL_FORE(T, ctx) a_cast_s(T *, a_que_pull_fore(ctx))
253#define A_QUE_PULL_BACK(T, ctx) a_cast_s(T *, a_que_pull_back(ctx))
265#define A_QUE_INSERT(T, ctx, idx) a_cast_s(T *, a_que_insert(ctx, idx))
277#define A_QUE_REMOVE(T, ctx, idx) a_cast_s(T *, a_que_remove(ctx, idx))
279#if defined(__cplusplus)
296#define a_que_foreach(T, S, it, ctx) \
297 for (T S it = a_cast_r(T S, (ctx)->head_.next), \
298 S it##_ = a_cast_r(T S, a_list_(*, it)->next); \
299 a_list_(*, it) != &(ctx)->head_ \
300 ? ((void)(it = a_cast_r(T S, a_list_(*, it) + 1)), 1) \
302 it = it##_, it##_ = a_cast_r(T S, a_list_(*, it)->next))
296#define a_que_foreach(T, S, it, ctx) \ …
303#define A_QUE_FOREACH(T, it, at, ctx) \
304 for ((void)(it = a_cast_r(T, (ctx)->head_.next)), \
305 at = a_cast_r(T, a_list_(*, it)->next); \
306 a_list_(*, it) != &(ctx)->head_ \
307 ? ((void)(it = a_cast_r(T, a_list_(*, it) + 1)), 1) \
309 it = at, at = a_cast_r(T, a_list_(*, it)->next))
324#define a_que_foreach_reverse(T, S, it, ctx) \
325 for (T S it = a_cast_r(T S, (ctx)->head_.prev), \
326 S it##_ = a_cast_r(T S, a_list_(*, it)->prev); \
327 a_list_(*, it) != &(ctx)->head_ \
328 ? ((void)(it = a_cast_r(T S, a_list_(*, it) + 1)), 1) \
330 it = it##_, it##_ = a_cast_r(T S, a_list_(*, it)->prev))
324#define a_que_foreach_reverse(T, S, it, ctx) \ …
331#define A_QUE_FOREACH_REVERSE(T, it, at, ctx) \
332 for ((void)(it = a_cast_r(T, (ctx)->head_.prev)), \
333 at = a_cast_r(T, a_list_(*, it)->prev); \
334 a_list_(*, it) != &(ctx)->head_ \
335 ? ((void)(it = a_cast_r(T, a_list_(*, it) + 1)), 1) \
337 it = at, at = a_cast_r(T, a_list_(*, it)->prev))
void a_list_swap_node(a_list *lhs, a_list *rhs)
swap the node lhs and the node rhs
Definition list.h:490
void a_que_sort_fore(a_que const *ctx, int(*cmp)(void const *, void const *))
insert sort foremost element for a pointer to queue structure
void * a_que_at(a_que const *ctx, a_diff idx)
access specified element for a pointer to queue structure
void * a_que_push_sort(a_que *ctx, void const *key, int(*cmp)(void const *, void const *))
push an element into the queue and sort it
a_que * a_que_new(a_size size)
allocate a pointer to queue structure from memory
void * a_que_pull_fore(a_que *ctx)
pull an element from the queue forward
void * a_que_push_back(a_que *ctx)
push an element into the queue backward
int a_que_setz(a_que *ctx, a_size siz, void(*dtor)(void *))
set size of a element for a pointer to queue structure
void * a_que_back_(a_que const *ctx)
access backmost element for a pointer to queue structure
Definition que.h:60
a_size a_que_num(a_que const *ctx)
access number of element for a pointer to queue structure
Definition que.h:40
void * a_que_back(a_que const *ctx)
access backmost element for a pointer to queue structure
Definition que.h:84
void a_que_dtor(a_que *ctx, void(*dtor)(void *))
destructor for queue structure
void a_que_die(a_que *ctx, void(*dtor)(void *))
deallocate a pointer to queue structure
void * a_que_fore(a_que const *ctx)
access foremost element for a pointer to queue structure
Definition que.h:72
void a_que_sort_back(a_que const *ctx, int(*cmp)(void const *, void const *))
insert sort backmost element for a pointer to queue structure
void * a_que_insert(a_que *ctx, a_size idx)
insert an element into the queue
void a_que_swap(a_que *lhs, a_que *rhs)
initialize a pointer to queue structure by moving
void * a_que_push_fore(a_que *ctx)
push an element into the queue forward
void * a_que_pull_back(a_que *ctx)
pull an element from the queue backward
void * a_que_fore_(a_que const *ctx)
access foremost element for a pointer to queue structure
Definition que.h:48
a_size a_que_siz(a_que const *ctx)
access size of a element for a pointer to queue structure
Definition que.h:34
void * a_que_remove(a_que *ctx, a_size idx)
remove an element from the queue
void a_que_ctor(a_que *ctx, a_size size)
constructor for queue structure
int a_que_drop(a_que *ctx, void(*dtor)(void *))
drop all the elements for a pointer to queue structure
void a_que_swap_(void *lhs, void *rhs)
swap elements lhs and rhs for a pointer to queue structure
Definition que.h:95
ptrdiff_t a_diff
signed integer type returned when subtracting two pointers
Definition a.h:780
size_t a_size
unsigned integer type returned by the sizeof operator
Definition a.h:823
circular doubly linked list implementation
instance structure for circular doubly linked list
Definition list.h:25
instance structure for basic queue
Definition que.h:21
a_size cur_
Definition que.h:26
a_size siz_
Definition que.h:24
a_list ** ptr_
Definition que.h:23
a_size num_
Definition que.h:25
a_size mem_
Definition que.h:27
a_list head_
Definition que.h:22