#include <oskit/queue.h>
struct queue_entry *next; /* next element */ struct queue_entry *prev; /* previous element */};typedef struct queue_entry *queue_t ;
typedef struct queue_entry queue_head_t ;
typedef struct queue_entry queue_chain_t ;
typedef struct queue_entry *queue_entry_t ;
Macros and structures for implementation of a ``queue'' data type. The implementation uses a doubly-linked list and supports operations to insert and delete anywhere in the list.
- queue_init(q)
- Initialize the given queue.
- queue_first(q)
- Returns the first entry in the queue.
- queue_next(q)
- Returns the entry after an item in the queue.
- queue_last(q)
- Returns the last entry in the queue.
- queue_prev(q)
- Returns the entry before an item in the queue.
- queue_end(q, qe)
- Tests whether a new entry is really the end of the queue.
- queue_empty(q)
- Tests whether a queue is empty.
- queue_enter(q, elt, type, field)
- Insert a new element at the tail of the queue.
- queue_enter_first(head, elt, type, field)
- Insert a new element at the head of the queue.
- queue_enter_before(head, nelt, elt, type, field)
- Insert a new element before the indicated element.
- queue_enter_after(head, pelt, elt, type, field)
- Insert a new element after the indicated element.
- queue_remove(head, elt, type, field)
- Remove an arbitrary item from the queue.
- queue_remove_first(head, entry, type, field)
- Remove and return the entry at the head of the queue.
- queue_remove_last(head, entry, type, field)
- Remove and return the entry at the tail of the queue.
- queue_assign(to, from, type, field)
- Move an element in a queue to a new piece of memory.
- queue_iterate(head, elt, type, field)
- Iterate over each item in the queue. Generates a 'for' loop, setting elt to each item in turn (by reference).
This header file is taken from CMU's Mach kernel.