#ifndef GQUEUE_H #define GQUEUE_H typedef struct gqueue *gqueue; /* The queue uses the concept of a cursor. A cursor works like the Emacs dot, i.e. it is located between two element, at the very beginning, or at the very end of the queue. */ /* create an empty queue */ extern gqueue gq_create(void); /* check whether queue is empty */ extern int gq_empty(gqueue q); /* destroy the queue. The queue must be empty. */ extern void gq_destroy(gqueue q); /* functions to position the cursor */ /* position cursor at the very beginning of the queue */ extern void gq_go_beginning(gqueue q); /* position cursor at the very end of the queue */ extern void gq_go_end(gqueue q); /* move cursor forward. Cursor must not be at end as indicated by gq_at_end(). */ extern void gq_go_forward(gqueue q); /* move cursor backward. Cursor must not be at beginning as indicated by gq_at_beginning(). */ extern void gq_go_backward(gqueue q); /* functions for checking where the cursor is located */ /* check whether cursor is located at the very beginning of the queue */ extern int gq_at_beginning(gqueue q); /* check whether cursor is located at the very end of the queue */ extern int gq_at_end(gqueue q); /* get element after cursor without moving cursor. The cursor must not be at end as indicated by gq_at_end(). */ extern void *gq_get(gqueue); /* functions for insertion and deletion of elements */ /* insert an element after cursor and position the cursor after the newly inserted element */ extern void gq_insert(gqueue q, void *element); /* delete element after the cursor. Cursor must not be at end as indicated by gq_at_end() */ extern void gq_delete(gqueue q); #endif