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
13 * The iterator magic word.
15 #define ITERATOR_MAGIC FOURCC('I', 'T', 'E', 'R')
18 * Check, if some memory object appears to be an iterator.
19 * @param ptr Some memory.
20 * @return 1, if that memory area appears to be an iterator, 0 if not.
22 #define is_iterator(ptr) (((const iterator_t *) (ptr))->magic == ITERATOR_MAGIC)
24 typedef struct _iterator_t {
26 void *(*start)(void *collection);
27 void *(*next)(void *collection, void *curr);
28 void (*finish)(void *collection, void *curr);
32 * An iterator implementation for linked lists.
34 extern const iterator_t *list_iterator;
37 * An iterator implementation for psets.
39 extern const iterator_t *pset_iterator;