#define L_P_FUNCTION(name) int lp_ ## name(const list_t *list, int index)
#define L_A_FUNCTION(name) void la_ ## name(const list_t *list, int index)
#define L_C_FUNCTION(name) int lc_ ## name(const list_t *list, int i1, int i2)
typedefint(*_l_predicate)(constlist_t*,int);/** Takes (list), (index). Returns non-zero if true **/
typedefint(*_l_comparator)(constlist_t*,int,int);/** Takes (list), (i1), (i2). Returns 0 if equal, -1 if <i1> goes before <i2>, +1 if <i1> goes after <i2> **/
list_t*l_create(size_ttype,intblocksize);/** Allocates new list_t aligned to size <type> (e.g. "sizeof(int)"), and first block with <blocksize> (use l_create_d(size_t) to use default blocksize) **/
list_t*l_create_from(void*from,intitems,size_ttype,intbs);/** Allocates new list_t and copies elements from <from> into it **/
voidl_destroy(list_t*t);/** Frees all memory alocated to <t> and then frees <t> **/
intl_add(list_t*t,constvoid*o);/** Adds new element at end of array with copy of data at <o>, then updates ->length pointer and returns index of new element **/
void*l_get(constlist_t*t,intindex);/** Returns pointer to element at <index> **/
voidl_nullify(list_t*t,intindex);/** Writes over element at <index> with 0s (bytes) **/
voidl_copy(constlist_t*src,intso,list_t*de,into,intlen);/** Copies <len> elements from <src> (offset by <so>) to <de> (offset by <o>) **/
voidl_copy_ar(constlist_t*src,intso,void*dest,intlen);/** Copies <len> elements from <src> (offset by <so>) to <dest> **/
void*l_toarray_n(constlist_t*t,int*size,_l_predicatep);/** Creates a new array and copies each element that satisfies <p>, or if <p> is NULL, all of them. Size of the new array is returned in <size> unless <size> is NULL **/
voidl_toarray(constlist_t*t,void*dest,size_tlen);/** Copies <len> elements from <t> to <dest> **/
intl_isnull(constlist_t*t,intindex);/** Returns 1 if all bytes of element at <index> are 0 **/
voidl_nullify_if(list_t*t,_l_predicatef);/** Nullifies elements that satisfy <f> **/
voidl_do(list_t*t,_l_actionact);/** Calls <act> on all elements of <t> **/
voidl_do_if(list_t*t,_l_actionact,_l_predicatef);/** Calls <act> on elements that satisfy <f> **/
voidl_swap(list_t*t,intindex1,intindex2);/** Swap elements at <index1> and <index2> **/
voidl_sort(list_t*t,_l_sort_algalg,_l_comparatorcomp);/** Sorts <t> with algorithm <alg> using comparator <comp> **/
list_t*l_clone(constlist_t*t);/** Creates new list from <t> **/
list_t*l_clone_if(constlist_t*t,_l_predicatef);/** Creates new list from <t> with all elements that satisfy <f> **/
intl_count(constlist_t*t,_l_predicatef);/** Count all elements that satisfy <f>, or all if <f> is NULL **/
void*l_push(list_t*t,constvoid*o);/** Adds new element at end of <t>, updates ->length, and returns pointer to element **/
intl_pop(list_t*t,void*pop_into);/** Removes last element after copying it into <pop_into> (if not NULL), then updates ->length and returns new length. returns -1 if ->length is 0 **/
void*l_pop_n(list_t*t);/** Copies last element into newly malloc'd memory and calls l_pop, returns pointer to new memory. returns NULL if ->length is 0 **/