libFirm 1.20
libfirm/adt/pdeq.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 1995-2008 University of Karlsruhe.  All right reserved.
00003  *
00004  * This file is part of libFirm.
00005  *
00006  * This file may be distributed and/or modified under the terms of the
00007  * GNU General Public License version 2 as published by the Free Software
00008  * Foundation and appearing in the file LICENSE.GPL included in the
00009  * packaging of this file.
00010  *
00011  * Licensees holding valid libFirm Professional Edition licenses may use
00012  * this file in accordance with the libFirm Commercial License.
00013  * Agreement provided with the Software.
00014  *
00015  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00016  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00017  * PURPOSE.
00018  */
00019 
00025 #ifndef FIRM_ADT_PDEQ_H
00026 #define FIRM_ADT_PDEQ_H
00027 
00028 #include <stddef.h>
00029 
00030 #include "../begin.h"
00031 
00047 typedef int (*cmp_fun)(const void *elem, const void *key);
00048 
00052 typedef struct pdeq pdeq;
00053 
00059 FIRM_API pdeq *new_pdeq(void);
00060 
00068 FIRM_API pdeq *new_pdeq1(const void *x);
00069 
00075 FIRM_API void del_pdeq(pdeq *dq);
00076 
00082 FIRM_API size_t pdeq_len(pdeq *dq);
00083 
00091 FIRM_API int pdeq_empty(pdeq *dq);
00092 
00100 FIRM_API int pdeq_contains(pdeq *dq, const void *x);
00101 
00115 FIRM_API void *pdeq_search(pdeq *qp, cmp_fun cmp, const void *key);
00116 
00127 FIRM_API void **pdeq_copyl(pdeq *qp, const void **dst);
00128 
00139 FIRM_API void **pdeq_copyr(pdeq *qp, const void **dst);
00140 
00149 FIRM_API pdeq *pdeq_putl(pdeq *dq, const void *x);
00150 
00159 FIRM_API pdeq *pdeq_putr(pdeq *dq, const void *x);
00160 
00169 FIRM_API void *pdeq_getl(pdeq *dq);
00170 
00179 FIRM_API void *pdeq_getr(pdeq *dq);
00180 
00185 typedef pdeq waitq;
00186 
00192 #define new_waitq()  new_pdeq()
00193 
00199 #define del_waitq(wq) del_pdeq(wq)
00200 
00210 #define waitq_get(wq)  pdeq_getl(wq)
00211 
00220 #define waitq_put(wq, x) pdeq_putr((wq), (x))
00221 
00229 #define waitq_empty(wq) pdeq_empty(wq)
00230 
00235 typedef pdeq stack;
00236 
00242 #define new_stack()  new_pdeq()
00243 
00253 #define stack_pop(st)  pdeq_getr(st)
00254 
00263 #define stack_push(st, x) pdeq_putr((st), (x))
00264 
00272 #define stack_empty(st) pdeq_empty(wq)
00273 
00276 #include "../end.h"
00277 
00278 #endif