3 /* Copyright © 1995, The AROS Development Team. All rights reserved. */
9 typedef be_ptr
<struct List
> ListPtr
;
10 typedef be_ptr
<struct MinList
> MinListPtr
;
30 #define IsListEmpty(l) \
31 ( (((struct List *)l)->lh_TailPred) == (struct Node *)(l) )
32 #define IsMsgPortEmpty(mp) \
33 ( (((struct MsgPort *)mp)->mp_MsgList.lh_TailPred) \
34 == (struct Node *)(&(((struct MsgPort *)mp)->mp_MsgList)) )
36 # define NEWLIST(l) (((struct List *)l)->lh_TailPred \
38 ((struct List *)l)->lh_Tail = 0, \
39 ((struct List *)l)->lh_Head \
41 &(((struct List *)l)->lh_Tail))
43 # define ADDHEAD(l,n) ((void)(\
44 ((struct Node *)n)->ln_Succ = ((struct List *)l)->lh_Head, \
45 ((struct Node *)n)->ln_Pred = (struct Node *)&((struct List *)l)->lh_Head, \
46 ((struct Node *)((struct List *)l)->lh_Head)->ln_Pred = ((struct Node *)n), \
47 ((struct List *)l)->lh_Head = ((struct Node *)n)))
49 # define ADDTAIL(l,n) ((void)(\
50 ((struct Node *)n)->ln_Succ = (struct Node *)&((struct List *)l)->lh_Tail, \
51 ((struct Node *)n)->ln_Pred = ((struct List *)l)->lh_TailPred, \
52 ((struct List *)l)->lh_TailPred->ln_Succ = ((struct Node *)n), \
53 ((struct List *)l)->lh_TailPred = ((struct Node *)n) ))
55 # define REMOVE(n) ((void)(\
56 ((struct Node *)n)->ln_Pred->ln_Succ = ((struct Node *)n)->ln_Succ,\
57 ((struct Node *)n)->ln_Succ->ln_Pred = ((struct Node *)n)->ln_Pred ))
59 # define GetHead(l) (void *)(((struct List *)l)->lh_Head->ln_Succ \
60 ? ((struct List *)l)->lh_Head \
62 # define GetTail(l) (void *)(((struct List *)l)->lh_TailPred->ln_Pred \
63 ? ((struct List *)l)->lh_TailPred \
65 # define GetSucc(n) (void *)(((struct Node *)n)->ln_Succ->ln_Succ \
66 ? ((struct Node *)n)->ln_Succ \
68 # define GetPred(n) (void *)(((struct Node *)n)->ln_Pred->ln_Pred \
69 ? ((struct Node *)n)->ln_Pred \
71 # define ForeachNode(l,n) \
72 for (n=(void *)(((struct List *)(l))->lh_Head); \
73 ((struct Node *)(n))->ln_Succ; \
74 n=(void *)(((struct Node *)(n))->ln_Succ))
76 # define ForeachNodeSafe(l,n,n2) \
77 for (n=(void *)(((struct List *)(l))->lh_Head); \
78 (n2=(void *)((struct Node *)(n))->ln_Succ); \
81 # define SetNodeName(node,name) \
82 (((struct Node *)(node))->ln_Name = (char *)(name))
83 # define GetNodeName(node) \
84 (((struct Node *)(node))->ln_Name
86 # define ListLength(list,count) \
90 ForeachNode (list,n) count ++; \
94 #endif /* EXEC_LISTS_H */