|
liba 0.1.15
An algorithm library based on C/C++
|
Data Structures | |
| struct | a_buf |
| instance structure for basic buffer More... | |
Macros | |
| #define | A_BUF_DEF a_size num_, mem_, siz_ |
| #define | a_buf_(_, x) |
| cast a buffer pointer from another type pointer | |
| #define | A_BUF_PTR(T, ctx) |
| #define | A_BUF_AT_(T, ctx, idx) |
| #define | A_BUF_AT(T, ctx, idx) |
| #define | A_BUF_OF(T, ctx, idx) |
| #define | A_BUF_TOP_(T, ctx) |
| #define | A_BUF_TOP(T, ctx) |
| #define | A_BUF_END(T, ctx) |
| #define | A_BUF_PUSH_SORT(T, ctx, key, cmp) |
| #define | A_BUF_SEARCH(T, ctx, obj, cmp) |
| #define | A_BUF_INSERT(T, ctx, idx) |
| #define | A_BUF_REMOVE(T, ctx, idx) |
| #define | A_BUF_PUSH_FORE(T, ctx) |
| #define | A_BUF_PUSH_BACK(T, ctx) |
| #define | A_BUF_PULL_FORE(T, ctx) |
| #define | A_BUF_PULL_BACK(T, ctx) |
| #define | A_BUF_PUSH(T, ctx) |
| #define | A_BUF_PULL(T, ctx) |
| #define | a_buf_forenum(i, ctx) |
| iterate over a buffer | |
| #define | A_BUF_FORENUM(I, i, ctx) |
| #define | a_buf_forenum_reverse(i, ctx) |
| iterate over a buffer in reverse | |
| #define | A_BUF_FORENUM_REVERSE(I, i, ctx) |
| #define | a_buf_foreach(T, S, it, ctx) |
| iterate over a buffer | |
| #define | A_BUF_FOREACH(T, it, at, ctx) |
| #define | a_buf_foreach_reverse(T, S, it, ctx) |
| iterate over a buffer in reverse | |
| #define | A_BUF_FOREACH_REVERSE(T, it, at, ctx) |
Typedefs | |
| typedef struct a_buf | a_buf |
| instance structure for basic buffer | |
Functions | |
| a_size | a_buf_num (void const *ctx) |
| access number of element for a pointer to buffer structure | |
| a_size | a_buf_mem (void const *ctx) |
| access memory of element for a pointer to buffer structure | |
| a_size | a_buf_siz (void const *ctx) |
| access size of a element for a pointer to buffer structure | |
| void * | a_buf_ptr (void const *ctx) |
| access address of buffer for a pointer to buffer structure | |
| void * | a_buf_at_ (void const *ctx, a_size idx) |
| access specified element for a pointer to buffer structure | |
| void * | a_buf_at (void const *ctx, a_size idx) |
| access specified element for a pointer to buffer structure | |
| void * | a_buf_of (void const *ctx, a_diff idx) |
| access specified element for a pointer to buffer structure | |
| void * | a_buf_top_ (void const *ctx) |
| access top element for a pointer to buffer structure | |
| void * | a_buf_top (void const *ctx) |
| access top element for a pointer to buffer structure | |
| void * | a_buf_end (void const *ctx) |
| access end pointer for a pointer to 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 | |
| void | a_buf_ctor (void *ctx, a_size siz, a_size num) |
| constructor for buffer structure | |
| void | a_buf_dtor (void *ctx, void(*dtor)(void *)) |
| destructor for buffer structure | |
| a_buf * | a_buf_setm (a_buf *ctx, a_size mem) |
| set memory of element for a pointer to buffer structure | |
| 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_setz (void *ctx, a_size siz, void(*dtor)(void *)) |
| set size of a element for a pointer to buffer structure | |
| 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_sort_fore (void const *ctx, int(*cmp)(void const *, void const *)) |
| insert sort foremost element for a pointer to buffer structure | |
| 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_sort (void *ctx, void const *key, int(*cmp)(void const *, void const *)) |
| push an element into the buffer and sort it | |
| 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_insert (void *ctx, a_size idx) |
| insert an element into the buffer | |
| void * | a_buf_remove (void *ctx, a_size idx) |
| remove an element from the buffer | |
| void * | a_buf_push_fore (void *ctx) |
| push an element into the buffer forward | |
| void * | a_buf_push_back (void *ctx) |
| push an element into the buffer backward | |
| void * | a_buf_pull_fore (void *ctx) |
| pull an element from the buffer forward | |
| void * | a_buf_pull_back (void *ctx) |
| pull an element from the buffer backward | |
| int | a_buf_store (void *ctx, a_size idx, void *ptr, a_size num, int(*copy)(void *, void const *)) |
| store elements into the buffer | |
| int | a_buf_erase (void *ctx, a_size idx, a_size num, void(*dtor)(void *)) |
| erase elements from the buffer | |
| void * | a_buf_push (void *ctx) |
| push an element into the buffer | |
| void * | a_buf_pull (void *ctx) |
| pull an element from the buffer | |
| #define a_buf_ | ( | _, | |
| x ) |
| #define A_BUF_AT | ( | T, | |
| ctx, | |||
| idx ) |
| #define A_BUF_AT_ | ( | T, | |
| ctx, | |||
| idx ) |
| #define A_BUF_END | ( | T, | |
| ctx ) |
| #define A_BUF_FOREACH | ( | T, | |
| it, | |||
| at, | |||
| ctx ) |
| #define a_buf_foreach | ( | T, | |
| S, | |||
| it, | |||
| ctx ) |
iterate over a buffer
| T | the prefix of the element type |
| S | the suffix of the element type |
| it | the &a_buf to use as a loop counter |
| ctx | points to an instance of buffer structure |
| #define A_BUF_FOREACH_REVERSE | ( | T, | |
| it, | |||
| at, | |||
| ctx ) |
| #define a_buf_foreach_reverse | ( | T, | |
| S, | |||
| it, | |||
| ctx ) |
iterate over a buffer in reverse
| T | the prefix of the element type |
| S | the suffix of the element type |
| it | the &a_buf to use as a loop counter |
| ctx | points to an instance of buffer structure |
| #define A_BUF_FORENUM | ( | I, | |
| i, | |||
| ctx ) |
| #define a_buf_forenum | ( | i, | |
| ctx ) |
iterate over a buffer
| i | index of elements in the buffer |
| ctx | points to an instance of buffer structure |
| #define A_BUF_FORENUM_REVERSE | ( | I, | |
| i, | |||
| ctx ) |
| #define a_buf_forenum_reverse | ( | i, | |
| ctx ) |
iterate over a buffer in reverse
| i | index of elements in the buffer |
| ctx | points to an instance of buffer structure |
| #define A_BUF_INSERT | ( | T, | |
| ctx, | |||
| idx ) |
| #define A_BUF_OF | ( | T, | |
| ctx, | |||
| idx ) |
| #define A_BUF_PTR | ( | T, | |
| ctx ) |
| #define A_BUF_PULL | ( | T, | |
| ctx ) |
| #define A_BUF_PULL_BACK | ( | T, | |
| ctx ) |
| #define A_BUF_PULL_FORE | ( | T, | |
| ctx ) |
| #define A_BUF_PUSH | ( | T, | |
| ctx ) |
| #define A_BUF_PUSH_BACK | ( | T, | |
| ctx ) |
| #define A_BUF_PUSH_FORE | ( | T, | |
| ctx ) |
| #define A_BUF_PUSH_SORT | ( | T, | |
| ctx, | |||
| key, | |||
| cmp ) |
| #define A_BUF_REMOVE | ( | T, | |
| ctx, | |||
| idx ) |
| #define A_BUF_SEARCH | ( | T, | |
| ctx, | |||
| obj, | |||
| cmp ) |
| #define A_BUF_TOP | ( | T, | |
| ctx ) |
| #define A_BUF_TOP_ | ( | T, | |
| ctx ) |
| void * a_buf_at | ( | void const * | ctx, |
| a_size | idx ) |
access specified element for a pointer to buffer structure
| [in] | ctx | points to an instance of buffer structure |
| [in] | idx | index of element less than memory |
| 0 | out of bounds |
| void * a_buf_at_ | ( | void const * | ctx, |
| a_size | idx ) |
access specified element for a pointer to buffer structure
| [in] | ctx | points to an instance of buffer structure |
| [in] | idx | index of element less than memory |
constructor for buffer structure
| [in] | ctx | points to an instance of buffer structure |
| [in] | siz | size of a element |
| [in] | num | number of element |
| void a_buf_die | ( | a_buf * | ctx, |
| void(* | dtor )(void *) ) |
deallocate a pointer to buffer structure
| [in] | ctx | points to an instance of buffer structure |
| [in] | dtor | element destructor |
| void a_buf_dtor | ( | void * | ctx, |
| void(* | dtor )(void *) ) |
destructor for buffer structure
| [in] | ctx | points to an instance of buffer structure |
| [in] | dtor | element destructor |
| void * a_buf_end | ( | void const * | ctx | ) |
access end pointer for a pointer to buffer structure
| [in] | ctx | points to an instance of buffer structure |
erase elements from the buffer
| [in] | ctx | points to an instance of buffer structure |
| [in] | idx | index of element in this buffer |
| [in] | num | number of elements to erase |
| [in] | dtor | a function that erases elements
|
| 0 | success |
| void * a_buf_insert | ( | void * | ctx, |
| a_size | idx ) |
insert an element into the buffer
| [in] | ctx | points to an instance of buffer structure |
| [in] | idx | index of element in this buffer
|
| 0 | failure |
| a_size a_buf_mem | ( | void const * | ctx | ) |
access memory of element for a pointer to buffer structure
| [in] | ctx | points to an instance of buffer structure |
allocate a pointer to buffer structure from memory
| [in] | siz | size of a element |
| [in] | num | number of element |
| a_size a_buf_num | ( | void const * | ctx | ) |
access number of element for a pointer to buffer structure
| [in] | ctx | points to an instance of buffer structure |
| void * a_buf_of | ( | void const * | ctx, |
| a_diff | idx ) |
access specified element for a pointer to buffer structure
| [in] | ctx | points to an instance of buffer structure |
| [in] | idx | index of element -memory < idx < memory |
| 0 | out of bounds |
| void * a_buf_ptr | ( | void const * | ctx | ) |
access address of buffer for a pointer to buffer structure
| [in] | ctx | points to an instance of buffer structure |
| void * a_buf_pull | ( | void * | ctx | ) |
pull an element from the buffer
| [in] | ctx | points to an instance of buffer structure |
| 0 | failure |
| void * a_buf_pull_back | ( | void * | ctx | ) |
pull an element from the buffer backward
| [in] | ctx | points to an instance of buffer structure |
| 0 | failure |
| void * a_buf_pull_fore | ( | void * | ctx | ) |
pull an element from the buffer forward
| [in] | ctx | points to an instance of buffer structure |
| 0 | failure |
| void * a_buf_push | ( | void * | ctx | ) |
push an element into the buffer
| [in] | ctx | points to an instance of buffer structure |
| 0 | failure |
| void * a_buf_push_back | ( | void * | ctx | ) |
push an element into the buffer backward
| [in] | ctx | points to an instance of buffer structure |
| 0 | failure |
| void * a_buf_push_fore | ( | void * | ctx | ) |
push an element into the buffer forward
| [in] | ctx | points to an instance of buffer structure |
| 0 | failure |
| 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
| [in] | ctx | points to an instance of buffer structure |
| [in] | key | the key on the right for insertion sort |
| [in] | cmp | a function that compares two elements
|
| 0 | failure |
| void * a_buf_remove | ( | void * | ctx, |
| a_size | idx ) |
remove an element from the buffer
| [in] | ctx | points to an instance of buffer structure |
| [in] | idx | index of element in this buffer
|
| 0 | failure |
| void * a_buf_search | ( | void const * | ctx, |
| void const * | obj, | ||
| int(* | cmp )(void const *, void const *) ) |
search the given element in this buffer
| [in] | ctx | points to an instance of buffer structure |
| [in] | obj | object that serves as key for the search |
| [in] | cmp | a function that compares two elements
|
| 0 | failure |
set memory of element for a pointer to buffer structure
| [in] | ctx | points to an instance of string structure |
| [in] | mem | new memory of current element |
| 0 | success |
| void a_buf_setn | ( | void * | ctx, |
| a_size | num, | ||
| void(* | dtor )(void *) ) |
set number of element for a pointer to buffer structure
| [in] | ctx | points to an instance of buffer structure |
| [in] | num | new number of current element |
| [in] | dtor | current element destructor |
| void a_buf_setz | ( | void * | ctx, |
| a_size | siz, | ||
| void(* | dtor )(void *) ) |
set size of a element for a pointer to buffer structure
| [in] | ctx | points to an instance of buffer structure |
| [in] | siz | the size of the new element |
| [in] | dtor | previous element destructor |
| a_size a_buf_siz | ( | void const * | ctx | ) |
access size of a element for a pointer to buffer structure
| [in] | ctx | points to an instance of buffer structure |
| void a_buf_sort | ( | void const * | ctx, |
| int(* | cmp )(void const *, void const *) ) |
sort all elements for a pointer to buffer structure
| [in] | ctx | points to an instance of buffer structure |
| [in] | cmp | a function that compares two elements
|
| void a_buf_sort_back | ( | void const * | ctx, |
| int(* | cmp )(void const *, void const *) ) |
insert sort backmost element for a pointer to buffer structure
| [in] | ctx | points to an instance of buffer structure |
| [in] | cmp | a function that compares two elements
|
| void a_buf_sort_fore | ( | void const * | ctx, |
| int(* | cmp )(void const *, void const *) ) |
insert sort foremost element for a pointer to buffer structure
| [in] | ctx | points to an instance of buffer structure |
| [in] | cmp | a function that compares two elements
|
| int a_buf_store | ( | void * | ctx, |
| a_size | idx, | ||
| void * | ptr, | ||
| a_size | num, | ||
| int(* | copy )(void *, void const *) ) |
store elements into the buffer
| [in] | ctx | points to an instance of buffer structure |
| [in] | idx | index of element in this buffer |
| [in] | ptr | points to array elements |
| [in] | num | number of array elements |
| [in] | copy | a function that copies elements
|
| 0 | success |
| void * a_buf_top | ( | void const * | ctx | ) |
access top element for a pointer to buffer structure
| [in] | ctx | points to an instance of buffer structure |
| 0 | empty buffer |
| void * a_buf_top_ | ( | void const * | ctx | ) |
access top element for a pointer to buffer structure
| [in] | ctx | points to an instance of buffer structure |