source: libabac/abac_list.h @ e97d2e2

mei_rt2_fix_1
Last change on this file since e97d2e2 was abf8d5d, checked in by Mei <mei@…>, 12 years ago

1) add backtrack/multiple solutions proof code changes and new

examples.

  • Property mode set to 100644
File size: 985 bytes
Line 
1#ifndef __LIST_H__
2#define __LIST_H__
3
4#include "utlist.h"
5
6typedef struct _abac_list_t abac_list_t;
7typedef struct _abac_list_element_t abac_list_element_t;
8
9struct _abac_list_element_t {
10    void *ptr;
11    abac_list_element_t *prev, *next;
12};
13
14struct _abac_list_t {
15    abac_list_element_t *elts;
16    int size;
17};
18
19abac_list_t *abac_list_new(void);
20void abac_list_add(abac_list_t *list, void *elt);
21int abac_list_unique_add(abac_list_t *list, void *elt);
22void abac_list_prepend(abac_list_t *list, void *elt);
23int abac_list_remove(abac_list_t *list, void *elt);
24int abac_list_size(abac_list_t *list);
25void abac_list_free(abac_list_t *list);
26
27#define abac_list_foreach(LIST, CURRENT, BODY) do {  \
28    abac_list_element_t *_elt;                  \
29    DL_FOREACH(LIST->elts, _elt) {              \
30        CURRENT = (typeof(CURRENT))_elt->ptr;   \
31        BODY                                    \
32    }                                           \
33} while (0)
34
35#endif /* __LIST_H__ */
Note: See TracBrowser for help on using the repository browser.