naspro

view permafrost/src/list.h @ 178:7169a8909d53

Added Permafrost + small changes
author Stefano D'Angelo <zanga.mail@gmail.com>
date Sun May 02 14:19:58 2010 +0300 (2010-05-02)
parents
children
line source
1 /*
2 * Permafrost - Physical modelling framework
3 *
4 * Copyright (C) 2009, 2010 Stefano D'Angelo <zanga.mail@gmail.com>
5 *
6 * See the COPYING file for license conditions.
7 */
9 #ifndef _LIST_H_
10 #define _LIST_H_
12 #include <stddef.h>
14 #include "src/types.h"
16 list_t
17 list_new();
19 void
20 list_append(list_t list, void *data);
22 void
23 list_append_copy(list_t list, void *data, size_t size);
25 #define list_push list_append
27 void *
28 list_pop(list_t list);
30 void
31 list_for_each(list_t list, void (*callback)(void *data, void *context),
32 void *context);
34 void
35 list_for_each_rev(list_t list, void (*callback)(void *data, void *context),
36 void *context);
38 void *
39 list_find(list_t list, int (*cmp)(void *d1, void *d2), void *data);
41 void
42 list_merge(list_t head, list_t tail);
44 void *
45 list_get_last_data(list_t list);
47 char
48 list_is_empty(list_t list);
50 unsigned long
51 list_get_n_elems(list_t list);
53 list_t
54 list_copy(list_t list);
56 void
57 list_free(list_t list);
59 void
60 list_dump(list_t list);
62 #endif /* !_LIST_H_ */