1 /*
2 SL - A small and efficient linked list library.
3 Copyright (C) 2003-2005 Stig Brautaset. All rights reserved.
4 
5 This file is part of SL.
6 
7 SL is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11 
12 SL is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 GNU General Public License for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with SL; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20 
21 */
22 
23 #ifndef sl__sl_h
24 #define sl__sl_h
25 
26 #ifdef __cplusplus      /* let C++ coders use this library */
27 extern "C" {
28 #endif
29 
30 void *sl_push(void *root, void *p);
31 void *sl_pop(void *root);
32 
33 void *sl_unshift(void *root, void *p);
34 void *sl_shift(void *root);
35 
36 void *sl_reverse(void *root);
37 void *sl_map(void *root, int (*func)(void *, void *), void *data);
38 void *sl_filter(void *root, int (*func)(void *, void *), void *data);
39 
40 void *sl_split(void *root);
41 void *sl_merge(void *p1, void *p2, int (*cmp)(void *, void *));
42 void *sl_mergesort(void *root, int (*cmp)(void *, void *));
43 
44 int sl_count(void *p);
45 
46 #define sl_free(root, func) sl__free(root, func)
47 void sl__free(void *root, void (*func)(void *));
48 
49 
50 #ifdef __cplusplus
51 }
52 #endif
53 #endif	/* !sl__sl_h */
54