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

list.h

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 a BSD-style license.
00005 See the file COPYING for details.
00006 */
00007 
00008 #ifndef LIST_H
00009 #define LIST_H
00010 
00011 
00012 /*
00013 It turns out that many libraries and tools make use of
00014 symbols like "debug" and "fatal".  This causes strange
00015 failures when we link against such codes.  Rather than change
00016 all of our code, we simply insert these defines to
00017 transparently modify the linker namespace we are using.
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

Generated on Mon Oct 19 10:11:27 2009 for cctools by  doxygen 1.3.9.1