Main Page | Class List | File List | Class Members | File Members | Related Pages

gi_list.h

Go to the documentation of this file.
00001 /* 00002 * $Id: gi_list.h,v 1.1.2.7 2004/03/01 01:47:52 jasta Exp $ 00003 * 00004 * Copyright (C) 2003 giFT project (gift.sourceforge.net) 00005 * 00006 * This program is free software; you can redistribute it and/or modify it 00007 * under the terms of the GNU General Public License as published by the 00008 * Free Software Foundation; either version 2, or (at your option) any 00009 * later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, but 00012 * WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * General Public License for more details. 00015 */ 00016 00017 #ifndef __GI_LIST_H 00018 #define __GI_LIST_H 00019 00020 /*****************************************************************************/ 00021 00032 /*****************************************************************************/ 00033 00037 typedef struct gi_list_link 00038 { 00039 struct gi_list_link *prev; 00040 struct gi_list_link *next; 00041 void *data; 00042 } GiListLink; 00043 00049 typedef struct gi_list 00050 { 00051 GiListLink *bol; 00052 GiListLink *eol; 00053 unsigned int nelem; 00054 } GiList; 00055 00059 #define GI_LIST_LINK(gilist) ((gilist)->bol) 00060 00061 /*****************************************************************************/ 00062 00074 typedef int (*GiListCompareFn) (const void *a, const void *b); 00075 #define GI_LIST_CMP(cmpfn) ((GiListCompareFn)(cmpfn)) 00076 00085 typedef void (*GiListForeachFn) (const void *data, const void *udata); 00086 #define GI_LIST_FOREACH(foreachfn) ((GiListForeachFn)(foreachfn)) 00087 00088 typedef int (*GiListForeachExFn) (const void *data, const void *udata); 00089 #define GI_LIST_FOREACH_EX(foreachfn) ((GiListForeachExFn)(foreachfn)) 00090 00091 /*****************************************************************************/ 00092 00093 EXTERN_C_BEGIN 00094 00095 /*****************************************************************************/ 00096 00100 LIBGIFT_EXPORT 00101 GiList *gi_list_new (void); 00102 00108 LIBGIFT_EXPORT 00109 void gi_list_destroy (GiList **listref); 00110 00111 /*****************************************************************************/ 00112 00127 LIBGIFT_EXPORT 00128 GiListLink *gi_list_append (GiList **listref, const void *data); 00129 00133 LIBGIFT_EXPORT 00134 GiListLink *gi_list_prepend (GiList **listref, const void *data); 00135 00136 /*****************************************************************************/ 00137 00153 LIBGIFT_EXPORT 00154 GiListLink *gi_list_insert (GiList **listref, GiListLink *pos, 00155 const void *data); 00156 00171 LIBGIFT_EXPORT 00172 GiListLink *gi_list_insort (GiList **listref, GiListCompareFn cmpfn, 00173 const void *data); 00174 00175 /*****************************************************************************/ 00176 00184 LIBGIFT_EXPORT 00185 bool gi_list_remove (GiList **listref, const void *data); 00186 00192 LIBGIFT_EXPORT 00193 void gi_list_removel (GiList **listref, GiListLink *link); 00194 00195 /*****************************************************************************/ 00196 00201 LIBGIFT_EXPORT 00202 unsigned int gi_list_length (GiList *list); 00203 00204 /*****************************************************************************/ 00205 00219 LIBGIFT_EXPORT 00220 GiListLink *gi_listl_nth (GiListLink *link, int n); 00221 00222 #define gi_listl_nth_data(link,n) \ 00223 gi_listl_data(gi_listl_nth(link,n)) 00224 00230 LIBGIFT_EXPORT 00231 GiListLink *gi_list_nth (GiList *list, int n); 00232 00233 #define gi_list_nth_data(list,n) \ 00234 gi_listl_data(gi_list_nth(list,n)) 00235 00239 LIBGIFT_EXPORT 00240 void *gi_listl_data (GiListLink *link); 00241 00242 /*****************************************************************************/ 00243 00251 LIBGIFT_EXPORT 00252 GiListLink *gi_list_find (GiList *list, GiListCompareFn cmpfn, 00253 const void *udata); 00254 00260 LIBGIFT_EXPORT 00261 void gi_list_foreach (GiList *list, GiListForeachFn foreachfn, 00262 const void *udata); 00263 00267 LIBGIFT_EXPORT 00268 void gi_list_foreachex (GiList **listref, GiListForeachExFn foreachfn, 00269 const void *udata); 00270 00271 /*****************************************************************************/ 00272 00276 LIBGIFT_EXPORT 00277 void gi_list_sort (GiList **listref, GiListCompareFn cmpfn); 00278 00279 /*****************************************************************************/ 00280 00281 EXTERN_C_END 00282 00283 /*****************************************************************************/ 00284 00285 #endif /* __GI_LIST_H */

Generated on Sun Aug 22 07:56:40 2004 by doxygen 1.3.7