4 * Copyright (c) Tuomo Valkonen 1999-2007.
6 * See the included file LICENSE for details.
14 /*{{{ WMPlex numbered/mut.ex. list stuff */
17 void llist_iter_init(WLListIterTmp *tmp, WLListNode *llist)
23 WLListNode *llist_iter(WLListIterTmp *tmp)
32 WRegion *llist_iter_regions(WLListIterTmp *tmp)
34 WLListNode *lnode=llist_iter(tmp);
35 return (lnode==NULL ? NULL : lnode->st->reg);
39 WLListNode *llist_nth_node(WLListNode *list, uint n)
42 llist_iter_init(&tmp, list);
43 return (WLListNode*)iterable_nth(n, (VoidIterator*)llist_iter, &tmp);
47 void llist_link_after(WLListNode **list,
48 WLListNode *after, WLListNode *node)
51 LINK_ITEM_AFTER(*list, after, node, next, prev);
53 LINK_ITEM_FIRST(*list, node, next, prev);
58 void llist_link_last(WLListNode **list, WLListNode *node)
60 LINK_ITEM_LAST(*list, node, next, prev);
64 WLListNode *llist_index_to_after(WLListNode *list,
68 if(index==LLIST_INDEX_AFTER_CURRENT_ACT){
69 WLListNode *after=current;
71 WLListNode *nxt=after->next;
72 if(nxt==NULL || nxt->st==NULL || nxt->st->reg==NULL)
74 if(!region_is_activity_r(nxt->st->reg))
79 }else if(index==LLIST_INDEX_AFTER_CURRENT){
82 return (list!=NULL ? list->prev : NULL);
86 return llist_nth_node(list, index-1);
91 void llist_unlink(WLListNode **list, WLListNode *node)
93 UNLINK_ITEM(*list, node, next, prev);