Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __PJ_LIST_H__
00021 #define __PJ_LIST_H__
00022
00028 #include <pj/types.h>
00029
00030 PJ_BEGIN_DECL
00031
00032
00033
00034
00035
00062 #define PJ_DECL_LIST_MEMBER(type) \
00063 \
00064 type *prev; \
00065 \
00066 type *next
00067
00068
00074 struct pj_list
00075 {
00076 PJ_DECL_LIST_MEMBER(void);
00077 };
00078
00079
00088 PJ_INLINE(void) pj_list_init(pj_list_type * node)
00089 {
00090 ((pj_list*)node)->next = ((pj_list*)node)->prev = node;
00091 }
00092
00093
00102 PJ_INLINE(int) pj_list_empty(const pj_list_type * node)
00103 {
00104 return ((pj_list*)node)->next == node;
00105 }
00106
00107
00116 PJ_IDECL(void) pj_list_insert_before(pj_list_type *pos, pj_list_type *node);
00117
00118
00126 PJ_INLINE(void) pj_list_push_back(pj_list_type *list, pj_list_type *node)
00127 {
00128 pj_list_insert_before(list, node);
00129 }
00130
00131
00138 PJ_IDECL(void) pj_list_insert_nodes_before(pj_list_type *lst,
00139 pj_list_type *nodes);
00140
00150 PJ_IDECL(void) pj_list_insert_after(pj_list_type *pos, pj_list_type *node);
00151
00152
00160 PJ_INLINE(void) pj_list_push_front(pj_list_type *list, pj_list_type *node)
00161 {
00162 pj_list_insert_after(list, node);
00163 }
00164
00165
00172 PJ_IDECL(void) pj_list_insert_nodes_after(pj_list_type *lst,
00173 pj_list_type *nodes);
00174
00175
00190 PJ_IDECL(void) pj_list_merge_first(pj_list_type *list1, pj_list_type *list2);
00191
00192
00208 PJ_IDECL(void) pj_list_merge_last( pj_list_type *list1, pj_list_type *list2);
00209
00210
00216 PJ_IDECL(void) pj_list_erase(pj_list_type *node);
00217
00218
00228 PJ_IDECL(pj_list_type*) pj_list_find_node(pj_list_type *list,
00229 pj_list_type *node);
00230
00231
00246 PJ_IDECL(pj_list_type*) pj_list_search(pj_list_type *list, void *value,
00247 int (*comp)(void *value,
00248 const pj_list_type *node)
00249 );
00250
00251
00259 PJ_IDECL(pj_size_t) pj_list_size(const pj_list_type *list);
00260
00261
00266 #if PJ_FUNCTIONS_ARE_INLINED
00267 # include "list_i.h"
00268 #endif
00269
00270 PJ_END_DECL
00271
00272 #endif
00273