• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/toolchains/hndtools-arm-linux-2.6.36-uclibc-4.5.3/share/libtool/libltdl/libltdl/
1/* slist.h -- generalised singly linked lists
2
3   Copyright (C) 2000, 2004, 2009 Free Software Foundation, Inc.
4   Written by Gary V. Vaughan, 2000
5
6   NOTE: The canonical source of this file is maintained with the
7   GNU Libtool package.  Report bugs to bug-libtool@gnu.org.
8
9GNU Libltdl is free software; you can redistribute it and/or
10modify it under the terms of the GNU Lesser General Public
11License as published by the Free Software Foundation; either
12version 2 of the License, or (at your option) any later version.
13
14As a special exception to the GNU Lesser General Public License,
15if you distribute this file as part of a program or library that
16is built using GNU Libtool, you may include this file under the
17same distribution terms that you use for the rest of that program.
18
19GNU Libltdl is distributed in the hope that it will be useful,
20but WITHOUT ANY WARRANTY; without even the implied warranty of
21MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22GNU Lesser General Public License for more details.
23
24You should have received a copy of the GNU Lesser General Public
25License along with GNU Libltdl; see the file COPYING.LIB.  If not, a
26copy can be downloaded from  http://www.gnu.org/licenses/lgpl.html,
27or obtained by writing to the Free Software Foundation, Inc.,
2851 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
29*/
30
31/* A generalised list.  This is deliberately transparent so that you
32   can make the NEXT field of all your chained data structures first,
33   and then cast them to `(SList *)' so that they can be manipulated
34   by this API.
35
36   Alternatively, you can generate raw SList elements using slist_new(),
37   and put the element data in the USERDATA field.  Either way you
38   get to manage the memory involved by yourself.
39*/
40
41#if !defined(SLIST_H)
42#define SLIST_H 1
43
44#if defined(LTDL)
45#  include <libltdl/lt__glibc.h>
46#  include <libltdl/lt_system.h>
47#else
48#  define LT_SCOPE
49#endif
50
51#include <stddef.h>
52
53#if defined(__cplusplus)
54extern "C" {
55#endif
56
57typedef struct slist {
58  struct slist *next;		/* chain forward pointer*/
59  const void *userdata;		/* for boxed `SList' item */
60} SList;
61
62typedef void *	SListCallback	(SList *item, void *userdata);
63typedef int	SListCompare	(const SList *item1, const SList *item2,
64				 void *userdata);
65
66LT_SCOPE SList *slist_concat	(SList *head, SList *tail);
67LT_SCOPE SList *slist_cons	(SList *item, SList *slist);
68
69LT_SCOPE SList *slist_delete	(SList *slist, void (*delete_fct) (void *item));
70LT_SCOPE SList *slist_remove	(SList **phead, SListCallback *find,
71				 void *matchdata);
72LT_SCOPE SList *slist_reverse	(SList *slist);
73LT_SCOPE SList *slist_sort	(SList *slist, SListCompare *compare,
74				 void *userdata);
75
76LT_SCOPE SList *slist_tail	(SList *slist);
77LT_SCOPE SList *slist_nth	(SList *slist, size_t n);
78LT_SCOPE void *	slist_find	(SList *slist, SListCallback *find,
79				 void *matchdata);
80LT_SCOPE size_t slist_length	(SList *slist);
81
82LT_SCOPE void *	slist_foreach   (SList *slist, SListCallback *foreach,
83				 void *userdata);
84
85LT_SCOPE SList *slist_box	(const void *userdata);
86LT_SCOPE void *	slist_unbox	(SList *item);
87
88#if defined(__cplusplus)
89}
90#endif
91
92#if !defined(LTDL)
93#  undef LT_SCOPE
94#endif
95
96#endif /*!defined(SLIST_H)*/
97