diff -r 6367456bf2d9 -r 558ed4c6abd0 src/cx/tree.h --- a/src/cx/tree.h Wed Jul 03 22:07:42 2024 +0200 +++ b/src/cx/tree.h Sun Jul 07 12:21:58 2024 +0200 @@ -404,6 +404,49 @@ ptrdiff_t loc_next ); +/** + * Describes a function that creates a tree node from the specified data. + */ +typedef void (*cx_tree_node_create_fun)(void const*); + +__attribute__((__nonnull__)) +size_t cx_tree_add_iter( + struct cx_iterator_base_s *iter, + cx_tree_search_func sfunc, + cx_tree_node_create_fun cfunc, + void **root, + ptrdiff_t loc_parent, + ptrdiff_t loc_children, + ptrdiff_t loc_prev, + ptrdiff_t loc_next +); + +__attribute__((__nonnull__)) +size_t cx_tree_add_array( + void const *src, + size_t num, + size_t elem_size, + cx_tree_search_func sfunc, + cx_tree_node_create_fun cfunc, + void **root, + ptrdiff_t loc_parent, + ptrdiff_t loc_children, + ptrdiff_t loc_prev, + ptrdiff_t loc_next +); + +__attribute__((__nonnull__)) +void *cx_tree_add( + void const *src, + cx_tree_search_func sfunc, + cx_tree_node_create_fun cfunc, + void **root, + ptrdiff_t loc_parent, + ptrdiff_t loc_children, + ptrdiff_t loc_prev, + ptrdiff_t loc_next +); + #ifdef __cplusplus } // extern "C" #endif