|
SCIMBridge 0.4.x
|
00001 /* slist.h -- generalised singly linked lists 00002 00003 Copyright (C) 2000, 2004 Free Software Foundation, Inc. 00004 Written by Gary V. Vaughan, 2000 00005 00006 NOTE: The canonical source of this file is maintained with the 00007 GNU Libtool package. Report bugs to bug-libtool@gnu.org. 00008 00009 GNU Libltdl is free software; you can redistribute it and/or 00010 modify it under the terms of the GNU Lesser General Public 00011 License as published by the Free Software Foundation; either 00012 version 2 of the License, or (at your option) any later version. 00013 00014 As a special exception to the GNU Lesser General Public License, 00015 if you distribute this file as part of a program or library that 00016 is built using GNU Libtool, you may include this file under the 00017 same distribution terms that you use for the rest of that program. 00018 00019 GNU Libltdl is distributed in the hope that it will be useful, 00020 but WITHOUT ANY WARRANTY; without even the implied warranty of 00021 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00022 GNU Lesser General Public License for more details. 00023 00024 You should have received a copy of the GNU Lesser General Public 00025 License along with GNU Libltdl; see the file COPYING.LIB. If not, a 00026 copy can be downloaded from http://www.gnu.org/licenses/lgpl.html, 00027 or obtained by writing to the Free Software Foundation, Inc., 00028 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00029 */ 00030 00031 /* A generalised list. This is deliberately transparent so that you 00032 can make the NEXT field of all your chained data structures first, 00033 and then cast them to `(SList *)' so that they can be manipulated 00034 by this API. 00035 00036 Alternatively, you can generate raw SList elements using slist_new(), 00037 and put the element data in the USERDATA field. Either way you 00038 get to manage the memory involved by yourself. 00039 */ 00040 00041 #if !defined(SLIST_H) 00042 #define SLIST_H 1 00043 00044 #if defined(LTDL) 00045 # include <libltdl/lt__glibc.h> 00046 # include <libltdl/lt_system.h> 00047 #else 00048 # define LT_SCOPE 00049 #endif 00050 00051 #if defined(__cplusplus) 00052 extern "C" { 00053 #endif 00054 00055 typedef struct slist { 00056 struct slist *next; /* chain forward pointer*/ 00057 const void *userdata; /* for boxed `SList' item */ 00058 } SList; 00059 00060 typedef void * SListCallback (SList *item, void *userdata); 00061 typedef int SListCompare (const SList *item1, const SList *item2, 00062 void *userdata); 00063 00064 LT_SCOPE SList *slist_concat (SList *head, SList *tail); 00065 LT_SCOPE SList *slist_cons (SList *item, SList *slist); 00066 00067 LT_SCOPE SList *slist_delete (SList *slist, void (*delete_fct) (void *item)); 00068 LT_SCOPE void * slist_remove (SList **phead, SListCallback *find, 00069 void *matchdata); 00070 LT_SCOPE SList *slist_reverse (SList *slist); 00071 LT_SCOPE SList *slist_sort (SList *slist, SListCompare *compare, 00072 void *userdata); 00073 00074 LT_SCOPE SList *slist_tail (SList *slist); 00075 LT_SCOPE SList *slist_nth (SList *slist, size_t n); 00076 LT_SCOPE void * slist_find (SList *slist, SListCallback *find, 00077 void *matchdata); 00078 LT_SCOPE size_t slist_length (SList *slist); 00079 00080 LT_SCOPE void * slist_foreach (SList *slist, SListCallback *foreach, 00081 void *userdata); 00082 00083 LT_SCOPE SList *slist_box (const void *userdata); 00084 LT_SCOPE void * slist_unbox (SList *item); 00085 00086 #if defined(__cplusplus) 00087 } 00088 #endif 00089 00090 #if !defined(LTDL) 00091 # undef LT_SCOPE 00092 #endif 00093 00094 #endif
1.7.3