Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals  

slist.h

Go to the documentation of this file.
00001 /*
00002  * slist.h - Single linked list.
00003  *           This file is part of the FreeLCD package.
00004  *
00005  * $Id: slist_8h-source.html,v 1.1 2003/02/16 22:50:41 unicorn Exp $
00006  *
00007  * This program is free software; you can redistribute it and/or modify it
00008  * under the terms of the GNU General Public License as published by the
00009  * Free Software Foundation; either version 2 of the License, or (at your
00010  * option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
00020  * MA  02111-1307  USA
00021  *
00022  * Copyright (c) 2002, 2003, Jeroen van den Berg <unicorn@hippie.nu>
00023  */
00024 
00032 
00033 #ifndef _FLCDD_SLIST_H
00034 #define _FLCDD_SLIST_H
00035 
00037 typedef struct _slist_e
00038 {
00040   struct _slist_e *next;
00041 
00043   void *data;
00044 }
00045 slist_e;
00046 
00048 typedef struct _slist
00049 {
00051   slist_e *head;
00053   slist_e *tail;
00054 }
00055 slist;
00056 
00058 typedef struct
00059 {
00060   slist_e *curr; 
00061   slist_e *prev; 
00062 }
00063 slist_iter;
00064 
00065 
00070 void 
00071 slist_init (slist *s);
00072 
00077 void 
00078 slist_delete (slist *s);
00079 
00085 void 
00086 slist_delete_special (slist *s, void (*func) (void *));
00087 
00092 void 
00093 slist_delete_list_only (slist *s);
00094 
00099 void *
00100 slist_first (const slist *s);
00101 
00106 void *
00107 slist_last (const slist *s);
00108 
00113 void *
00114 slist_at_iter (slist_iter iter);
00115 
00119 void 
00120 slist_prepend (slist *s, void *data);
00121 
00125 void 
00126 slist_append (slist *s, void *data);
00127 
00132 void 
00133 slist_insert (slist *s, slist_iter *iter, void *data);
00134 
00138 void *
00139 slist_remove_first (slist *s);
00140 
00144 void *
00145 slist_remove_last (slist *s);
00146 
00152 void *
00153 slist_remove_at_iter (slist *s, slist_iter iter);
00154 
00160 slist_iter 
00161 slist_begin_iter (const slist *s);
00162 
00168 slist_iter
00169 slist_end_iter (const slist *s);
00170 
00178 void *
00179 slist_iter_and_next (slist_iter *iter);
00180 
00187 void 
00188 slist_for_each (const slist *s, void (*func) (void *data, void *userdata),
00189                 void *userdata);
00190 
00199 void 
00200 slist_for_each_range (slist_iter start, slist_iter end,
00201                       void (*func) (void *data, void *userdata),
00202                       void *userdata);
00203 
00208 int
00209 slist_iter_eq (slist_iter a, slist_iter b);
00210 
00213 int
00214 slist_iter_at_end (slist_iter iter);
00215 
00221 slist_iter 
00222 slist_find (const slist *s, const void *data);
00223 
00232 slist_iter 
00233 slist_find_if (const slist *s, const void *compare,
00234                int (*func) (const void *data, const void *compare));
00235 
00239 unsigned int
00240 slist_length (const slist *s);
00241 
00242 #endif /* Multiple include guard */

Generated on Sun Feb 16 23:39:49 2003 for FreeLCD by doxygen1.2.18