00001
00002
00003
00004
00005
00006
00007
00008 #ifndef LIST_H
00009 #define LIST_H
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #define list_delete cctools_list_delete
00023 #define list_pop_head cctools_pop_head
00024 #define list_peek_head cctools_peek_head
00025 #define list_pop_tail cctools_pop_tail
00026 #define list_peek_tail cctools_peek_tail
00027 #define list_remove cctools_remove
00028 #define list_find cctools_find
00029 #define list_create cctools_list_create
00030 #define list_splice cctools_list_splice
00031 #define list_size cctools_list_size
00032 #define list_push_priority cctools_push_priority
00033 #define list_push_head cctools_push_head
00034 #define list_push_tail cctools_push_tail
00035 #define list_iterate cctools_iterate
00036 #define list_iterate_reverse cctools_iterate_reverse
00037
00038
00039
00040
00041
00042 struct list_node {
00043 void *data;
00044 struct list_node *next;
00045 struct list_node *prev;
00046 int priority;
00047 };
00048
00049 struct list {
00050 struct list_node *head;
00051 struct list_node *tail;
00052 int size;
00053 };
00054
00055 typedef int (*list_op_t) ( void *item, const void *arg );
00056
00057 struct list * list_create();
00058 struct list * list_splice( struct list *top, struct list *bottom );
00059 void list_delete( struct list *l );
00060 int list_size( struct list *l );
00061
00062 int list_push_priority( struct list *l, void *item, int prio );
00063
00064 int list_push_head( struct list *l, void *item );
00065 void * list_pop_head( struct list *l );
00066 void * list_peek_head( struct list *l );
00067
00068 int list_push_tail( struct list *l, void *item );
00069 void * list_pop_tail( struct list *l );
00070 void * list_peek_tail( struct list *l );
00071
00072 void * list_remove( struct list *l, const void *value );
00073 void * list_find( struct list *l, list_op_t cmp, const void *arg );
00074 int list_iterate( struct list *l, list_op_t op, const void *arg );
00075 int list_iterate_reverse( struct list *l, list_op_t op, const void *arg );
00076
00077 #endif