Categorical value cache added
[pspp-builds.git] / src / linked-list.h
1 #ifndef LL_H
2 #define LL_H
3
4
5 struct node
6 {
7   void *entry;
8   struct node *next;
9 };
10
11
12
13 typedef void ll_free_func (void *, void *aux);
14
15 struct linked_list
16 {
17   struct node *head;
18   ll_free_func *free;
19   void *aux;
20 };
21
22
23 struct ll_iterator
24 {
25   struct node *p;
26 };
27
28
29 /* Iteration */
30
31 /* Return the first element in LL */
32 void * ll_first (const struct linked_list *ll, struct ll_iterator *li);
33
34 /* Return the next element in LL iterated by LI */
35 void * ll_next (const struct linked_list *ll, struct ll_iterator *li);
36
37 /* Create a linked list.
38    Elements will be freed using F and AUX
39 */
40 struct linked_list * ll_create( ll_free_func *F , void *aux);
41
42 /* Destroy a linked list LL */
43 void ll_destroy(struct linked_list *ll);
44
45 /* Push a an element ENTRY onto the list LL */
46 void ll_push_front(struct linked_list *ll, void *entry);
47
48 #endif