* @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 <stddef.h>
+
+#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.
*
*
* @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.
*
* @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.
*
* @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
* @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
* @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
*
* @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
*
* @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.
*
* @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.
*
* @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
*/
#define stack_empty(st) pdeq_empty(wq)
+/** @} */
+
+#include "../end.h"
+
#endif