Released version 3-2014010505
[notion.git] / ioncore / llist.h
blob5e1c7a91821f896271ff0a8fa5f928c653a27097
1 /*
2 * ion/ioncore/llist.h
4 * Copyright (c) Tuomo Valkonen 2005-2009.
5 *
6 * See the included file LICENSE for details.
7 */
9 #ifndef ION_IONCORE_LLIST_H
10 #define ION_IONCORE_LLIST_H
12 #include <limits.h>
14 #include "mplex.h"
15 #include "mplexpholder.h"
16 #include "extlconv.h"
17 #include "stacking.h"
20 DECLSTRUCT(WLListNode){
21 WLListNode *next, *prev;
22 WMPlexPHolder *phs;
23 WStacking *st;
26 typedef WLListNode *WLListIterTmp;
29 #define FOR_ALL_NODES_ON_LLIST(NODE, LL, TMP) \
30 FOR_ALL_ITER(llist_iter_init, llist_iter, NODE, LL, &(TMP))
32 #define FOR_ALL_REGIONS_ON_LLIST(NODE, LL, TMP) \
33 FOR_ALL_ITER(llist_iter_init, llist_iter_regions, NODE, LL, &(TMP))
36 extern void llist_iter_init(WLListIterTmp *tmp, WLListNode *llist);
37 extern WLListNode *llist_iter(WLListIterTmp *tmp);
38 extern WRegion *llist_iter_regions(WLListIterTmp *tmp);
39 extern WLListNode *llist_nth_node(WLListNode *list, uint n);
40 extern ExtlTab llist_to_table(WLListNode *list);
41 extern void llist_link_after(WLListNode **list,
42 WLListNode *after, WLListNode *node);
43 extern void llist_link_last(WLListNode **list, WLListNode *node);
44 extern WLListNode *llist_index_to_after(WLListNode *list,
45 WLListNode *current,
46 int index);
47 extern void llist_unlink(WLListNode **list, WLListNode *node);
49 #define LLIST_INDEX_LAST (-1)
50 #define LLIST_INDEX_AFTER_CURRENT (-2)
51 #define LLIST_INDEX_AFTER_CURRENT_ACT (-3)
53 #endif /* ION_IONCORE_LLIST_H */