libFirm
pdeq.h File Reference

double ended queue of generic pointers. More...

#include <stddef.h>
#include "../begin.h"
#include "../end.h"

Go to the source code of this file.

Macros

#define new_waitq()   new_pdeq()
 Creates a new pointer wait queue (fifo).
#define del_waitq(wq)   del_pdeq(wq)
 Delete a wait queue (fifo)
#define waitq_get(wq)   pdeq_getl(wq)
 Retrieve a pointer from the wait queue (fifo).
#define waitq_put(wq, x)   pdeq_putr((wq), (x))
 Add a pointer to the wait queue (fifo).
#define waitq_empty(wq)   pdeq_empty(wq)
 Checks if a wait queue is empty.
#define new_stack()   new_pdeq()
 Creates a new pointer stack (lifo).
#define stack_pop(st)   pdeq_getr(st)
 Pop a pointer from the stack (lifo).
#define stack_push(st, x)   pdeq_putr((st), (x))
 Push a pointer to the stack (lifo).
#define stack_empty(st)   pdeq_empty(wq)
 Checks if a stack is empty.

Typedefs

typedef int(* cmp_fun )(const void *elem, const void *key)
 The type of the pointer compare function.
typedef struct pdeq pdeq
 The pointer double ended queue (list).
typedef pdeq waitq
 The pdeq is often used as a wait queue.
typedef pdeq stack
 The pdeq can be used as a stack.

Functions

pdeqnew_pdeq (void)
 Creates a new double ended pointer list.
pdeqnew_pdeq1 (const void *x)
 Creates a new double ended pointer list and puts an initial pointer element in.
void del_pdeq (pdeq *dq)
 Delete a double ended pointer list.
size_t pdeq_len (pdeq *dq)
 Returns the length of a double ended pointer list.
int pdeq_empty (pdeq *dq)
 Checks if a list is empty.
int pdeq_contains (pdeq *dq, const void *x)
 Returns non-zero if a double ended pointer list contains a pointer x.
void * pdeq_search (pdeq *qp, cmp_fun cmp, const void *key)
 Search a key in a double ended pointer list, the search is controlled by a compare function.
void ** pdeq_copyl (pdeq *qp, const void **dst)
 Convert the double ended pointer list into a linear array beginning from left, the first element in the linear array will be the left one.
void ** pdeq_copyr (pdeq *qp, const void **dst)
 Convert the double ended pointer list into a linear array beginning from right, the first element in the linear array will be the right one.
pdeqpdeq_putl (pdeq *dq, const void *x)
 Add a pointer to the left side of a double ended pointer list.
pdeqpdeq_putr (pdeq *dq, const void *x)
 Add a pointer to the right side of a double ended pointer list.
void * pdeq_getl (pdeq *dq)
 Retrieve (and remove) a pointer from the left site of a double ended pointer list.
void * pdeq_getr (pdeq *dq)
 Retrieve (and remove) a pointer from the right site of a double ended pointer list.

Detailed Description

double ended queue of generic pointers.

Author
Christian von Roques

Definition in file pdeq.h.