74 void *data, uint64_t size,
77 void (*copy)(
cr8r_base_ft*,
void *dest,
const void *src),
78 int (*cmp)(
const cr8r_base_ft*,
const void*,
const void*)
99 cr8r_sla *sla, uint64_t size, uint64_t reserve,
100 void (*copy)(
cr8r_base_ft*,
void *dest,
const void *src),
101 int (*cmp)(
const cr8r_base_ft*,
const void*,
const void*)
bool cr8r_cll_pushr(cr8r_cll_node **self, cr8r_cll_ft *, const void *val)
Add a node with a given value at the end of the list.
void cr8r_cll_delete(cr8r_cll_node *, cr8r_cll_ft *)
Delete a list.
cr8r_cll_node * cr8r_cll_combine(cr8r_cll_node *a, cr8r_cll_node *b, cr8r_cll_ft *)
Stitch together two lists, one after the other.
bool cr8r_cll_mapped(cr8r_cll_node **dest, const cr8r_cll_node *src, cr8r_cll_ft *dest_ft, void(*f)(void *o, const void *e))
Create a new list by applying a transformation function to every element in a list.
cr8r_cll_node * cr8r_cll_new(cr8r_cll_ft *, const void *data)
Allocate a new list node and initialize it with given data.
cr8r_cll_node * cr8r_cll_lsearch(cr8r_cll_node *, cr8r_cll_ft *, const void *e)
Find the first node in a list with an element matching a given element according to ft->cmp.
cr8r_cll_node * cr8r_cll_sorted(const cr8r_cll_node *, cr8r_cll_ft *)
Create a sorted copy of a list.
void * cr8r_cll_foldr(const cr8r_cll_node *, cr8r_cll_ft *, void *init, void *(*f)(void *acc, const void *e))
Perform a right fold on a list.
cr8r_cll_node * cr8r_cll_reversed(const cr8r_cll_node *, cr8r_cll_ft *)
Creates a reversed copy of a list.
cr8r_cll_node * cr8r_cll_copy(const cr8r_cll_node *, cr8r_cll_ft *)
Create a copy of a list.
bool cr8r_cll_filtered(cr8r_cll_node **dest, const cr8r_cll_node *src, cr8r_cll_ft *, bool(*pred)(const void *))
Create a new list from the subsequence of a given list satisfying a predicate.
void cr8r_cll_reverse(cr8r_cll_node **self, cr8r_cll_ft *)
Reverse a list in place.
bool cr8r_cll_popl(cr8r_cll_node **self, cr8r_cll_ft *, void *out)
Remove the first node in the list.
bool cr8r_cll_pushl(cr8r_cll_node **self, cr8r_cll_ft *, const void *val)
Add a node with a given value at the beginning of the list.
bool cr8r_cll_all(const cr8r_cll_node *, cr8r_cll_ft *, bool(*pred)(const void *))
Test if a predicate holds for all elements in a list.
void cr8r_cll_filter(cr8r_cll_node **self, cr8r_cll_ft *, bool(*pred)(const void *))
Filter a list in place by deleting all nodes that don't match a predicate.
void cr8r_cll_forEach(cr8r_cll_node *, cr8r_cll_ft *, void(*f)(void *))
Execute a given function on each element in a list.
bool cr8r_cll_any(const cr8r_cll_node *, cr8r_cll_ft *, bool(*pred)(const void *))
Test if a predicate holds for any element in a list.
cr8r_cll_node * cr8r_cll_from(cr8r_cll_ft *, uint64_t len, const void *a)
Create a list from an array.
bool cr8r_cll_ft_initsla(cr8r_cll_ft *, cr8r_sla *sla, uint64_t size, uint64_t reserve, void(*copy)(cr8r_base_ft *, void *dest, const void *src), int(*cmp)(const cr8r_base_ft *, const void *, const void *))
Convenience function to initialize a cr8r_cll_ft and associated slab allocator.
void cr8r_cll_sort(cr8r_cll_node **self, cr8r_cll_ft *)
Sort a list in place.
bool cr8r_cll_popr(cr8r_cll_node **self, cr8r_cll_ft *, void *out)
Remove the first node in the list.
bool cr8r_cll_ft_init(cr8r_cll_ft *, void *data, uint64_t size, void *(*alloc)(cr8r_base_ft *), void(*del)(cr8r_base_ft *, void *), void(*copy)(cr8r_base_ft *, void *dest, const void *src), int(*cmp)(const cr8r_base_ft *, const void *, const void *))
Convenience function to initialize a cr8r_cll_ft.
Base function table for all Crater containers.
Function table for linked list.
cr8r_base_ft base
Base function table values (data and size)
A circular linked list node, or an entire circular linked list by synecdoche Note that a pointer to t...
char data[]
flexible length array holding element
cr8r_cll_node * next
pointer to the next node in the list