Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

list.h

Go to the documentation of this file.
00001 /*
00002 Copyright (C) 2003-2004 Douglas Thain and the University of Wisconsin
00003 Copyright (C) 2005- The University of Notre Dame
00004 This software is distributed under the GNU General Public License.
00005 See the file COPYING for details.
00006 */
00007 
00008 #ifndef LIST_H
00009 #define LIST_H
00010 
00013 /*
00014 It turns out that many libraries and tools make use of
00015 symbols like "debug" and "fatal".  This causes strange
00016 failures when we link against such codes.  Rather than change
00017 all of our code, we simply insert these defines to
00018 transparently modify the linker namespace we are using.
00019 */
00020 
00021 #define list_delete                     cctools_list_delete
00022 #define list_free                       cctools_list_free
00023 #define list_pop_head                   cctools_list_pop_head 
00024 #define list_peek_head                  cctools_list_peek_head
00025 #define list_pop_tail                   cctools_list_pop_tail
00026 #define list_peek_tail                  cctools_list_peek_tail
00027 #define list_remove                     cctools_list_remove
00028 #define list_find                       cctools_list_find
00029 #define list_create                     cctools_list_create
00030 #define list_splice                     cctools_list_splice
00031 #define list_split                      cctools_list_split
00032 #define list_size                       cctools_list_size
00033 #define list_push_priority              cctools_list_push_priority
00034 #define list_push_head                  cctools_list_push_head
00035 #define list_push_tail                  cctools_list_push_tail
00036 #define list_iterate                    cctools_list_iterate
00037 #define list_iterate_reverse            cctools_list_iterate_reverse
00038 #define list_first_item                 cctools_list_first_item
00039 #define list_next_item                  cctools_list_next_item
00040 
00041 struct list_node {
00042         void *data;
00043         struct list_node *next;
00044         struct list_node *prev;
00045         int priority;
00046 };
00047 
00048 struct list {
00049         struct list_node *head;
00050         struct list_node *tail;
00051         struct list_node *iter;
00052         int size;
00053 };
00054 
00055 typedef int (*list_op_t) ( void *item, const void *arg );
00056 
00061 struct list * list_create();
00062 
00069 void list_delete( struct list *list );
00070 
00076 void list_free( struct list *list );
00077 
00084 struct list * list_splice( struct list *top, struct list *bottom );
00085 
00095 struct list * list_split( struct list *src, list_op_t cmp, const void *arg );
00096 
00102 int list_size( struct list *list );
00103 
00110 int list_push_priority( struct list *list, void *item, int prio );
00111 
00117 int list_push_head( struct list *list, void *item );
00118 
00123 void * list_pop_head( struct list *list );
00124 
00129 void * list_peek_head( struct list *list );
00130 
00136 int list_push_tail( struct list *list, void *item );
00137 
00142 void * list_pop_tail( struct list *list );
00143 
00148 void * list_peek_tail( struct list *list );
00149 
00158 void * list_find( struct list *list, list_op_t cmp, const void *arg );
00159 
00167 void * list_remove( struct list *list, const void *value );
00168 
00175 void list_first_item( struct list *list );
00176 
00184 void * list_next_item( struct list *list );
00185 
00193 int list_iterate( struct list *list, list_op_t op, const void *arg );
00194 
00201 int list_iterate_reverse( struct list *list, list_op_t op, const void *arg );
00202 
00203 #endif

Generated on Mon Mar 29 16:26:25 2010 for cctools by  doxygen 1.3.9.1