X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=include%2Flibfirm%2Fadt%2Fpdeq.h;h=bfbb45198c454f11cc788b120e9c883e1143c182;hb=07c77ebb4b165865ecdfc45a048ac55dea14d84e;hp=d191291533c416172ea0c339c1d3e7f051339ea2;hpb=1ce363f80e6a204d4011f85813362d9bd1d0e7e4;p=libfirm diff --git a/include/libfirm/adt/pdeq.h b/include/libfirm/adt/pdeq.h index d19129153..bfbb45198 100644 --- a/include/libfirm/adt/pdeq.h +++ b/include/libfirm/adt/pdeq.h @@ -21,11 +21,21 @@ * @file * @brief double ended queue of generic pointers. * @author Christian von Roques - * @version $Id$ */ #ifndef FIRM_ADT_PDEQ_H #define FIRM_ADT_PDEQ_H +#include + +#include "../begin.h" + +/** + * @ingroup adt + * @defgroup pdeq Double Ended Queue + * Implementation if a double ended queue datastructure for generic pointers + * @{ + */ + /** * The type of the pointer compare function. * @@ -46,7 +56,7 @@ typedef struct pdeq pdeq; * * @return A new list. */ -pdeq *new_pdeq(void); +FIRM_API pdeq *new_pdeq(void); /** * Creates a new double ended pointer list and puts an initial pointer element in. @@ -55,21 +65,21 @@ pdeq *new_pdeq(void); * * @return The new list. */ -pdeq *new_pdeq1(const void *x); +FIRM_API pdeq *new_pdeq1(const void *x); /** * Delete a double ended pointer list. * * @param dq The list to be deleted. */ -void del_pdeq(pdeq *dq); +FIRM_API void del_pdeq(pdeq *dq); /** - * Returns the lenght of a double ended pointer list. + * Returns the length of a double ended pointer list. * * @param dq The list. */ -int pdeq_len(pdeq *dq); +FIRM_API size_t pdeq_len(pdeq *dq); /** * Checks if a list is empty. @@ -78,7 +88,7 @@ int pdeq_len(pdeq *dq); * * @return non-zero if the list is empty. */ -int pdeq_empty(pdeq *dq); +FIRM_API int pdeq_empty(pdeq *dq); /** * Returns non-zero if a double ended pointer list @@ -87,7 +97,7 @@ int pdeq_empty(pdeq *dq); * @param dq The list. * @param x The pointer to be searched for. */ -int pdeq_contains(pdeq *dq, const void *x); +FIRM_API int pdeq_contains(pdeq *dq, const void *x); /** * Search a key in a double ended pointer list, the search @@ -102,7 +112,7 @@ int pdeq_contains(pdeq *dq, const void *x); * @return The address of the element entry if the key was found, * NULL else. */ -void *pdeq_search(pdeq *qp, cmp_fun cmp, const void *key); +FIRM_API void *pdeq_search(pdeq *qp, cmp_fun cmp, const void *key); /** * Convert the double ended pointer list into a linear array beginning from @@ -114,7 +124,7 @@ void *pdeq_search(pdeq *qp, cmp_fun cmp, const void *key); * * @return dst */ -void **pdeq_copyl(pdeq *qp, const void **dst); +FIRM_API void **pdeq_copyl(pdeq *qp, const void **dst); /** * Convert the double ended pointer list into a linear array beginning from @@ -126,7 +136,7 @@ void **pdeq_copyl(pdeq *qp, const void **dst); * * @return dst */ -void **pdeq_copyr(pdeq *qp, const void **dst); +FIRM_API void **pdeq_copyr(pdeq *qp, const void **dst); /** * Add a pointer to the left side of a double ended pointer list. @@ -136,7 +146,7 @@ void **pdeq_copyr(pdeq *qp, const void **dst); * * @return The list. */ -pdeq *pdeq_putl(pdeq *dq, const void *x); +FIRM_API pdeq *pdeq_putl(pdeq *dq, const void *x); /** * Add a pointer to the right side of a double ended pointer list. @@ -146,36 +156,27 @@ pdeq *pdeq_putl(pdeq *dq, const void *x); * * @return The list. */ -pdeq *pdeq_putr(pdeq *dq, const void *x); +FIRM_API pdeq *pdeq_putr(pdeq *dq, const void *x); /** - * Retrieve a pointer from the left site of a double ended pointer list. + * Retrieve (and remove) a pointer from the left site of a double ended pointer + * list. * * @param dq The list - * * @return The pointer element. - * * @remark This function will fail if the list is empty. */ -void *pdeq_getl(pdeq *dq); +FIRM_API void *pdeq_getl(pdeq *dq); /** - * Retrieve a pointer from the right site of a double ended pointer list. + * Retrieve (and remove) a pointer from the right site of a double ended pointer + * list. * * @param dq The list - * * @return The pointer element. - * * @remark This function will fail if the list is empty. */ -void *pdeq_getr(pdeq *dq); - -#ifdef NDEBUG -#define PDEQ_VRFY(deq) ((void)0) -#else -#define PDEQ_VRFY(deq) _pdeq_vrfy ((deq)) -void _pdeq_vrfy(pdeq *dq); -#endif +FIRM_API void *pdeq_getr(pdeq *dq); /** * The pdeq is often used as a wait queue. A helper @@ -270,4 +271,8 @@ typedef pdeq stack; */ #define stack_empty(st) pdeq_empty(wq) +/** @} */ + +#include "../end.h" + #endif