src/cx/tree.h

changeset 862
387414a7afd8
parent 859
6367456bf2d9
child 863
4a220afebad0
equal deleted inserted replaced
861:bab51b32fcb1 862:387414a7afd8
247 247
248 /** 248 /**
249 * Links a node to a (new) parent. 249 * Links a node to a (new) parent.
250 * 250 *
251 * If the node has already a parent, it is unlinked, first. 251 * If the node has already a parent, it is unlinked, first.
252 * If the parent has children already, the node is \em prepended to the list 252 * If the parent has children already, the node is \em appended to the list
253 * of all currently existing children. 253 * of all currently existing children.
254 * 254 *
255 * @param parent the parent node 255 * @param parent the parent node
256 * @param node the node that shall be linked 256 * @param node the node that shall be linked
257 * @param loc_parent offset in the node struct for the parent pointer 257 * @param loc_parent offset in the node struct for the parent pointer
258 * @param loc_children offset in the node struct for the children linked list 258 * @param loc_children offset in the node struct for the children linked list
259 * @param loc_last_child optional offset in the node struct for the pointer to
260 * the last child in the linked list (negative if there is no such pointer)
259 * @param loc_prev offset in the node struct for the prev pointer 261 * @param loc_prev offset in the node struct for the prev pointer
260 * @param loc_next offset in the node struct for the next pointer 262 * @param loc_next offset in the node struct for the next pointer
261 * @see cx_tree_unlink() 263 * @see cx_tree_unlink()
262 */ 264 */
263 __attribute__((__nonnull__)) 265 __attribute__((__nonnull__))
264 void cx_tree_link( 266 void cx_tree_link(
265 void * restrict parent, 267 void *restrict parent,
266 void * restrict node, 268 void *restrict node,
267 ptrdiff_t loc_parent, 269 ptrdiff_t loc_parent,
268 ptrdiff_t loc_children, 270 ptrdiff_t loc_children,
271 ptrdiff_t loc_last_child,
269 ptrdiff_t loc_prev, 272 ptrdiff_t loc_prev,
270 ptrdiff_t loc_next 273 ptrdiff_t loc_next
271 ); 274 );
272 275
273 /** 276 /**
276 * If the node has no parent, this function does nothing. 279 * If the node has no parent, this function does nothing.
277 * 280 *
278 * @param node the node that shall be unlinked from its parent 281 * @param node the node that shall be unlinked from its parent
279 * @param loc_parent offset in the node struct for the parent pointer 282 * @param loc_parent offset in the node struct for the parent pointer
280 * @param loc_children offset in the node struct for the children linked list 283 * @param loc_children offset in the node struct for the children linked list
284 * @param loc_last_child optional offset in the node struct for the pointer to
285 * the last child in the linked list (negative if there is no such pointer)
281 * @param loc_prev offset in the node struct for the prev pointer 286 * @param loc_prev offset in the node struct for the prev pointer
282 * @param loc_next offset in the node struct for the next pointer 287 * @param loc_next offset in the node struct for the next pointer
283 * @see cx_tree_link() 288 * @see cx_tree_link()
284 */ 289 */
285 __attribute__((__nonnull__)) 290 __attribute__((__nonnull__))
286 void cx_tree_unlink( 291 void cx_tree_unlink(
287 void *node, 292 void *node,
288 ptrdiff_t loc_parent, 293 ptrdiff_t loc_parent,
289 ptrdiff_t loc_children, 294 ptrdiff_t loc_children,
295 ptrdiff_t loc_last_child,
290 ptrdiff_t loc_prev, 296 ptrdiff_t loc_prev,
291 ptrdiff_t loc_next 297 ptrdiff_t loc_next
292 ); 298 );
293 299
294 /** 300 /**

mercurial