00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00066 #ifndef ALGORITHM_SLIST_H
00067 #define ALGORITHM_SLIST_H
00068
00069 #ifdef __cplusplus
00070 extern "C" {
00071 #endif
00072
00080 typedef struct _SListEntry SListEntry;
00081
00086 typedef struct _SListIterator SListIterator;
00087
00092 typedef void *SListValue;
00093
00098 struct _SListIterator {
00099 SListEntry **prev_next;
00100 SListEntry *current;
00101 };
00102
00107 #define SLIST_NULL ((void *) 0)
00108
00117 typedef int (*SListCompareFunc)(SListValue value1, SListValue value2);
00118
00127 typedef int (*SListEqualFunc)(SListValue value1, SListValue value2);
00128
00135 void slist_free(SListEntry *list);
00136
00146 SListEntry *slist_prepend(SListEntry **list, SListValue data);
00147
00157 SListEntry *slist_append(SListEntry **list, SListValue data);
00158
00166 SListEntry *slist_next(SListEntry *listentry);
00167
00175 SListValue slist_data(SListEntry *listentry);
00176
00185 SListEntry *slist_nth_entry(SListEntry *list, int n);
00186
00196 SListValue slist_nth_data(SListEntry *list, int n);
00197
00205 int slist_length(SListEntry *list);
00206
00217 SListValue *slist_to_array(SListEntry *list);
00218
00228 int slist_remove_entry(SListEntry **list, SListEntry *entry);
00229
00240 int slist_remove_data(SListEntry **list,
00241 SListEqualFunc callback,
00242 SListValue data);
00243
00251 void slist_sort(SListEntry **list, SListCompareFunc compare_func);
00252
00265 SListEntry *slist_find_data(SListEntry *list,
00266 SListEqualFunc callback,
00267 SListValue data);
00268
00277 void slist_iterate(SListEntry **list, SListIterator *iter);
00278
00288 int slist_iter_has_more(SListIterator *iterator);
00289
00298 SListValue slist_iter_next(SListIterator *iterator);
00299
00307 void slist_iter_remove(SListIterator *iterator);
00308
00309 #ifdef __cplusplus
00310 }
00311 #endif
00312
00313 #endif
00314