libFirm
pdeq.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved.
3  *
4  * This file is part of libFirm.
5  *
6  * This file may be distributed and/or modified under the terms of the
7  * GNU General Public License version 2 as published by the Free Software
8  * Foundation and appearing in the file LICENSE.GPL included in the
9  * packaging of this file.
10  *
11  * Licensees holding valid libFirm Professional Edition licenses may use
12  * this file in accordance with the libFirm Commercial License.
13  * Agreement provided with the Software.
14  *
15  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17  * PURPOSE.
18  */
19 
25 #ifndef FIRM_ADT_PDEQ_H
26 #define FIRM_ADT_PDEQ_H
27 
28 #include <stddef.h>
29 
30 #include "../begin.h"
31 
47 typedef int (*cmp_fun)(const void *elem, const void *key);
48 
52 typedef struct pdeq pdeq;
53 
59 FIRM_API pdeq *new_pdeq(void);
60 
68 FIRM_API pdeq *new_pdeq1(const void *x);
69 
75 FIRM_API void del_pdeq(pdeq *dq);
76 
82 FIRM_API size_t pdeq_len(pdeq *dq);
83 
91 FIRM_API int pdeq_empty(pdeq *dq);
92 
100 FIRM_API int pdeq_contains(pdeq *dq, const void *x);
101 
115 FIRM_API void *pdeq_search(pdeq *qp, cmp_fun cmp, const void *key);
116 
127 FIRM_API void **pdeq_copyl(pdeq *qp, const void **dst);
128 
139 FIRM_API void **pdeq_copyr(pdeq *qp, const void **dst);
140 
149 FIRM_API pdeq *pdeq_putl(pdeq *dq, const void *x);
150 
159 FIRM_API pdeq *pdeq_putr(pdeq *dq, const void *x);
160 
169 FIRM_API void *pdeq_getl(pdeq *dq);
170 
179 FIRM_API void *pdeq_getr(pdeq *dq);
180 
185 typedef pdeq waitq;
186 
192 #define new_waitq() new_pdeq()
193 
199 #define del_waitq(wq) del_pdeq(wq)
200 
210 #define waitq_get(wq) pdeq_getl(wq)
211 
220 #define waitq_put(wq, x) pdeq_putr((wq), (x))
221 
229 #define waitq_empty(wq) pdeq_empty(wq)
230 
235 typedef pdeq stack;
236 
242 #define new_stack() new_pdeq()
243 
253 #define stack_pop(st) pdeq_getr(st)
254 
263 #define stack_push(st, x) pdeq_putr((st), (x))
264 
272 #define stack_empty(st) pdeq_empty(wq)
273 
276 #include "../end.h"
277 
278 #endif