2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
5 Desc: Initialize a list
10 /*****************************************************************************
13 #include <exec/lists.h>
21 Initialize a list. After that, you can use functions like
22 AddHead(), AddTail() and Insert() on the list.
25 list - the list to be initialized
31 You can also pass a struct MinList to this function.
39 NEWLIST() macro, exec.library/AddHead(), exec.library/AddTail(),
40 exec.library/Insert(), exec.library/Enqueue(),
41 exec.library/Remove(), exec.library/RemHead(), exec.library/RemTail()
46 28.11.96 digulla written
48 ******************************************************************************/
56 int main (int argc
, char ** argv
)
66 /* Initializing the list */
69 /* Adding a node to the list */
70 AddHead (&list
, &node
);
73 But most of the time, you will do something like this: The struct
74 Usage contains a node as it's first field. Now you can collect any
75 number of struct Usage structures in a list.
77 AddTail (&list
, (struct Node
*)&usage
);
80 If you want to avoid the cast, you can of course do this:
82 AddTail (&list, &usage.node);
84 but sometimes you won't, because then you can write general
85 functions to handle lists with all kinds of nodes in them.