17 #ifndef FIRM_ADT_PLIST_H
18 #define FIRM_ADT_PLIST_H
31 typedef struct plist plist_t;
95 #define plist_count(list) \
96 ((list)->element_count)
130 FIRM_API
void plist_insert_after(plist_t *list, plist_element_t *element,
void *value);
154 FIRM_API
void plist_erase(plist_t *list, plist_element_t *element);
167 #define plist_first(list) \
168 ((list)->first_element)
175 #define plist_last(list) \
176 ((list)->last_element)
184 #define plist_element_has_next(element) \
185 ((element)->next != NULL)
193 #define plist_element_has_prev(element) \
194 ((element)->prev != NULL)
202 #define plist_element_get_next(element) \
211 #define plist_element_get_prev(element) \
219 #define plist_element_get_value(element) \
225 #define foreach_plist(list, el) \
226 for (plist_element_t *el = plist_first(list); el; el = plist_element_get_next(el))
int element_count
Current number of elements in the list.
void plist_erase(plist_t *list, plist_element_t *element)
Erases the specified element from the pointer list.
int plist_has_value(plist_t *list, void *value)
Checks if list has an element with the given data pointer.
plist_element_t * first_free_element
First element in the free list.
plist_element_t * last_element
Last element in the list.
void plist_insert_after(plist_t *list, plist_element_t *element, void *value)
Inserts an element into a pointer list after the specified element, which must be non null...
plist_t * plist_new(void)
Creates a new pointer list and initializes it.
void plist_insert_before(plist_t *list, plist_element_t *element, void *value)
Inserts an element into a pointer list before the specified element, which must be non null...
void plist_free(plist_t *list)
Frees the passed pointer list.
plist_element_t * next
next element in double linked list
plist_t * plist_obstack_new(struct obstack *obst)
Creates a new pointer list and initializes it.
plist_element_t * prev
previous element in double linked list
plist_element_t * first_element
First element in the list.
plist_element_t * plist_find_value(plist_t *list, void *value)
Tries to find list element associated to the given data pointer.
struct obstack * obst
The obstack used for all allocations.
void plist_insert_back(plist_t *list, void *value)
Inserts an element at the back of a pointer list.
void plist_insert_front(plist_t *list, void *value)
Inserts an element at the front of a pointer list.
void plist_clear(plist_t *list)
Erases all elements from the specified pointer list.
An element in the pointer list.
unsigned foreign_obstack
Set to 1 if plist uses a foreign obstack.