2 * Iterators for the several collection types used in firm.
3 * Useful for formatted and unified dumping of collections of objects.
4 * @author Sebastian Hack
12 #define ITERATOR_MAGIC FOURCC('I', 'T', 'E', 'R')
15 * Check, if some memory object appears to be an iterator.
16 * @param ptr Some memory.
17 * @return 1, if that memory area appears to be an iterator, 0 if not.
19 #define is_iterator(ptr) (((const iterator_t *) (ptr))->magic == ITERATOR_MAGIC)
21 typedef struct _iterator_t {
23 void *(*start)(void *collection);
24 void *(*next)(void *collection, void *curr);
25 void (*finish)(void *collection, void *curr);
29 * An iterator implementation for linked lists.
31 extern const iterator_t *list_iterator;
34 * An iterator implementation for psets.
36 extern const iterator_t *pset_iterator;