Don't call ReadArgs() if started from WB.
[tangerine.git] / compiler / alib / newlist.c
blob1bcf1fd37915ecf9dc3ae5b95acfa913da04f1d1
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Initialize a list
6 Lang: english
7 */
10 /*****************************************************************************
12 NAME */
13 #include <exec/lists.h>
15 void NewList (
17 /* SYNOPSIS */
18 struct List * list)
20 /* FUNCTION
21 Initialize a list. After that, you can use functions like
22 AddHead(), AddTail() and Insert() on the list.
24 INPUTS
25 list - the list to be initialized
27 RESULT
28 None.
30 NOTES
31 You can also pass a struct MinList to this function.
33 EXAMPLE
34 See below.
36 BUGS
38 SEE ALSO
39 NEWLIST() macro, AddHead(), AddTail(), Insert(), Enqueue(),
40 Remove(), RemHead(), RemTail()
42 INTERNALS
44 HISTORY
45 28.11.96 digulla written
47 ******************************************************************************/
49 NEWLIST(list);
50 } /* NewList */
52 #ifdef TEST
53 #include <stdio.h>
55 int main (int argc, char ** argv)
57 struct List list;
58 struct Node node;
59 struct Usage
61 struct Node node;
62 int data;
63 } usage;
65 /* Initializing the list */
66 NewList (&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.
87 return 0;
88 } /* main */
89 #endif /* TEST */