1.1 --- a/src/cx/tree.h Sat Feb 17 20:51:27 2024 +0100 1.2 +++ b/src/cx/tree.h Sun Feb 18 12:24:04 2024 +0100 1.3 @@ -46,14 +46,23 @@ 1.4 1.5 /** 1.6 * When entering a node. 1.7 + * 1.8 + * When this is the first sibling, source is the parent, otherwise it is the previous child. 1.9 */ 1.10 #define CX_TREE_ITERATOR_ENTER 0x1 1.11 /** 1.12 * When advancing to the next child. 1.13 + * 1.14 + * The visited node is the next child and the source is the previous child. 1.15 + * This pass is triggered after exiting the previous child and before entering the next child. 1.16 */ 1.17 #define CX_TREE_ITERATOR_NEXT_CHILD 0x2 1.18 /** 1.19 * When exiting the node. 1.20 + * 1.21 + * The visited node is the node being exited and source is the previously entered node 1.22 + * (usually the last child of the exited node, unless it has no children, in which case it is the node itself). 1.23 + * When advancing to the next child in a list of siblings, the previous child is exited, first. 1.24 */ 1.25 #define CX_TREE_ITERATOR_EXIT 0x4 1.26 1.27 @@ -278,8 +287,8 @@ 1.28 * @see cxTreeIteratorDispose() 1.29 */ 1.30 __attribute__((__nonnull__)) 1.31 -CxTreeIterator cx_tree_iterate( 1.32 - void const *root, 1.33 +CxTreeIterator cx_tree_iterator( 1.34 + void *root, 1.35 int passes, 1.36 ptrdiff_t loc_children, 1.37 ptrdiff_t loc_next