libFirm
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
pdeq.h
1 /*
2  * This file is part of libFirm.
3  * Copyright (C) 2012 University of Karlsruhe.
4  */
5 
11 #ifndef FIRM_ADT_PDEQ_H
12 #define FIRM_ADT_PDEQ_H
13 
14 #include <stddef.h>
15 
16 #include "../begin.h"
17 
33 typedef int (*cmp_fun)(const void *elem, const void *key);
34 
38 typedef struct pdeq pdeq;
39 
45 FIRM_API pdeq *new_pdeq(void);
46 
52 FIRM_API void del_pdeq(pdeq *dq);
53 
59 FIRM_API size_t pdeq_len(pdeq const *dq);
60 
68 FIRM_API int pdeq_empty(pdeq const *dq);
69 
77 FIRM_API int pdeq_contains(pdeq const *dq, const void *x);
78 
92 FIRM_API void *pdeq_search(pdeq const *qp, cmp_fun cmp, const void *key);
93 
104 FIRM_API void **pdeq_copyl(const pdeq *qp, const void **dst);
105 
116 FIRM_API void **pdeq_copyr(const pdeq *qp, const void **dst);
117 
126 FIRM_API pdeq *pdeq_putl(pdeq *dq, const void *x);
127 
136 FIRM_API pdeq *pdeq_putr(pdeq *dq, const void *x);
137 
146 FIRM_API void *pdeq_getl(pdeq *dq);
147 
156 FIRM_API void *pdeq_getr(pdeq *dq);
157 
160 #include "../end.h"
161 
162 #endif
void * pdeq_getr(pdeq *dq)
Retrieve (and remove) a pointer from the right site of a double ended pointer list.
pdeq * pdeq_putl(pdeq *dq, const void *x)
Add a pointer to the left side of a double ended pointer list.
void del_pdeq(pdeq *dq)
Delete a double ended pointer list.
pdeq * pdeq_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_search(pdeq const *qp, cmp_fun cmp, const void *key)
Search a key in a double ended pointer list, the search is controlled by a compare function...
size_t pdeq_len(pdeq const *dq)
Returns the length of a double ended pointer list.
int(* cmp_fun)(const void *elem, const void *key)
The type of the pointer compare function.
Definition: pdeq.h:33
pdeq * new_pdeq(void)
Creates a new double ended pointer list.
int pdeq_contains(pdeq const *dq, const void *x)
Returns non-zero if a double ended pointer list contains a pointer x.
struct pdeq pdeq
The pointer double ended queue (list).
Definition: pdeq.h:38
int pdeq_empty(pdeq const *dq)
Checks if a list is empty.
void ** pdeq_copyr(const pdeq *qp, const void **dst)
Convert the double ended pointer list into a linear array beginning from right, the first element in ...
void ** pdeq_copyl(const pdeq *qp, const void **dst)
Convert the double ended pointer list into a linear array beginning from left, the first element in t...