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, AddHead(), AddTail(), Insert(), Enqueue(),
40 Remove(), RemHead(), RemTail()
45 28.11.96 digulla written
47 ******************************************************************************/
55 int main (int argc
, char ** argv
)
65 /* Initializing the list */
68 /* Adding a node to the list */
69 AddHead (&list
, &node
);
72 But most of the time, you will do something like this: The struct
73 Usage contains a node as it's first field. Now you can collect any
74 number of struct Usage structures in a list.
76 AddTail (&list
, (struct Node
*)&usage
);
79 If you want to avoid the cast, you can of course do this:
81 AddTail (&list, &usage.node);
83 but sometimes you won't, because then you can write general
84 functions to handle lists with all kinds of nodes in them.