src/clustal/list.h File Reference

#include <stdlib.h>
Include dependency graph for list.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  list_elem_s
struct  list_t

Defines

#define LIST_APPEND(prList, data)   ListInsertNext((prList), LIST_TAIL(prList), (data))
#define LIST_PREPEND(prList, data)   ListInsertNext((prList), CLUSTALO_LIST_HEAD(prList), (data))
#define LIST_SIZE(prList)   ((prList)->size)
#define CLUSTALO_LIST_HEAD(prList)   ((prList)->head)
#define LIST_TAIL(prList)   ((prList)->tail)
#define LIST_IS_HEAD(prList, prElement)   ((prElement) == (prList)->head ? 1 : 0)
#define LIST_IS_TAIL(prElement)   ((prElement)->next == NULL ? 1 : 0)
#define LIST_DATA(prElement)   ((prElement)->data)
#define LIST_NEXT(prElement)   ((prElement)->next)
#define INT_LIST_INIT(prList)   ListInit((prList), free)
#define INT_LIST_DESTROY(prList)   ListDestroy((prList));
#define INT_LIST_APPEND(prList, data)   IntListInsertNext((prList), LIST_TAIL(prList), (data))
#define INT_LIST_PREPEND(prList, data)   IntListInsertNext((prList), CLUSTALO_LIST_HEAD(prList), (data))
#define INT_LIST_SIZE(prList)   LIST_SIZE(prList)
#define INT_CLUSTALO_LIST_HEAD(prList)   CLUSTALO_LIST_HEAD_INT((prList))
#define INT_LIST_TAIL(prList)   LIST_TAIL_INT((prList) )
#define INT_LIST_IS_HEAD(prList, prElement)   LIST_IS_HEAD(prList, prElement)
#define INT_LIST_IS_TAIL(prElement)   LIST_IS_TAIL((prElement))
#define INT_LIST_DATA(prElement)   LIST_DATA((prElement))
#define INT_LIST_NEXT(prElement)   LIST_NEXT((prElement))

Typedefs

typedef struct list_elem_s list_elem_t
typedef list_t int_list_t

Functions

void ListInit (list_t *prList, void(*destroy)(void *data))
 Initialise data members of a list.
void ListDestroy (list_t *prList)
 Calls user defined function to free data in list and resets the list to NULL. Call even if your destroy function is NULL.
int ListInsertNext (list_t *prList, list_elem_t *prElement, const void *data)
 Insert data next to given element.
int ListRemoveNext (list_t *prList, list_elem_t *prElement, void **data)
 Remove next element from current element/position.
int IntListInsertNext (list_t *prList, list_elem_t *prElement, const int data)
 Insert int next to given element.
int IntListRemoveNext (list_t *prList, list_elem_t *prElement, int *data)
 Remove next element from current element/position.

Define Documentation

#define CLUSTALO_LIST_HEAD ( prList   )     ((prList)->head)
#define INT_CLUSTALO_LIST_HEAD ( prList   )     CLUSTALO_LIST_HEAD_INT((prList))
#define INT_LIST_APPEND ( prList,
data   )     IntListInsertNext((prList), LIST_TAIL(prList), (data))
#define INT_LIST_DATA ( prElement   )     LIST_DATA((prElement))
#define INT_LIST_DESTROY ( prList   )     ListDestroy((prList));
#define INT_LIST_INIT ( prList   )     ListInit((prList), free)
#define INT_LIST_IS_HEAD ( prList,
prElement   )     LIST_IS_HEAD(prList, prElement)
#define INT_LIST_IS_TAIL ( prElement   )     LIST_IS_TAIL((prElement))
#define INT_LIST_NEXT ( prElement   )     LIST_NEXT((prElement))
#define INT_LIST_PREPEND ( prList,
data   )     IntListInsertNext((prList), CLUSTALO_LIST_HEAD(prList), (data))
#define INT_LIST_SIZE ( prList   )     LIST_SIZE(prList)
#define INT_LIST_TAIL ( prList   )     LIST_TAIL_INT((prList) )
#define LIST_APPEND ( prList,
data   )     ListInsertNext((prList), LIST_TAIL(prList), (data))
#define LIST_DATA ( prElement   )     ((prElement)->data)
#define LIST_IS_HEAD ( prList,
prElement   )     ((prElement) == (prList)->head ? 1 : 0)
#define LIST_IS_TAIL ( prElement   )     ((prElement)->next == NULL ? 1 : 0)
#define LIST_NEXT ( prElement   )     ((prElement)->next)
#define LIST_PREPEND ( prList,
data   )     ListInsertNext((prList), CLUSTALO_LIST_HEAD(prList), (data))
#define LIST_SIZE ( prList   )     ((prList)->size)
#define LIST_TAIL ( prList   )     ((prList)->tail)

Typedef Documentation

typedef list_t int_list_t
typedef struct list_elem_s list_elem_t

Function Documentation

int IntListInsertNext ( list_t prList,
list_elem_t prElement,
const int  data 
)

Insert int next to given element.

Parameters:
[in] prList List into which to insert
[in] prElement Current position/element. Element after which to insert. If NULL head is used.
[in] data int to store
Returns:
Non-zero on failure
int IntListRemoveNext ( list_t prList,
list_elem_t prElement,
int *  iData_p 
)

Remove next element from current element/position.

Parameters:
[in] prList List from which an element is to be removed.
[in] prElement Current element/position. Next item will be removed. If NULL head is used.
[out] iData_p Will be pointed to removed elements data.
Returns:
Non-zero on failure
void ListDestroy ( list_t prList  ) 

Calls user defined function to free data in list and resets the list to NULL. Call even if your destroy function is NULL.

Parameters:
[in] prList The list to destroy
void ListInit ( list_t prList,
void(*)(void *data)  destroy 
)

Initialise data members of a list.

Parameters:
[in] prList List to initialise
[in] destroy A function to be called with pointer to data when destroying the list. NULL if in doubt, free in most other cases. Note: doxygen will always fail to parse this...
int ListInsertNext ( list_t prList,
list_elem_t prElement,
const void *  pvData 
)

Insert data next to given element.

Parameters:
[in] prList List into which to insert
[in] prElement Current position/element. Element after which to insert. If NULL head is used.
[in] pvData Pointer to data to store
Returns:
Non-zero on failure
int ListRemoveNext ( list_t prList,
list_elem_t prElement,
void **  pvData_p 
)

Remove next element from current element/position.

Parameters:
[in] prList List from which an element is to be removed.
[in] prElement Current element/position. Next item will be removed. If NULL head is used.
[out] pvData_p Will be pointed to removed elements data.
Returns:
Non-zero on failure
Generated on Fri Aug 31 05:32:52 2012 for Clustal Omega by  doxygen 1.6.3