Pristine Ack-5.5
[Ack-5.5.git] / util / ack / list.h
1 /*
2  * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
3  * See the copyright notice in the ACK home directory, in the file "Copyright".
4  */
5 #ifndef NORCSID
6 #define RCS_LIST "$Id: list.h,v 2.3 1994/06/24 10:12:49 ceriel Exp $"
7 #endif
8
9 struct ca_elem {
10         struct ca_elem          *ca_next; /* The link */
11         char                    *ca_cont; /* The contents */
12 } ;
13
14 struct ca_list {
15         struct ca_elem          *ca_first; /* The head */
16         struct ca_elem          *ca_last;  /* The tail */
17 } ;
18
19 typedef struct ca_list list_head ;         /* The decl. for headers */
20 typedef struct ca_elem list_elem ;         /* The decl. for elements */
21
22 /* Some operations */
23
24 /* Access */
25 #define l_first(header)         (header).ca_first
26 #define l_next(elem)            (elem).ca_next
27 #define l_content(elem)         (elem).ca_cont
28
29 /* To be used for scanning lists, ptr is the running variable */
30 #define scanlist(elem,ptr) \
31         for ( ptr= elem ; ptr; ptr= l_next(*ptr) )