Mercurial > hg > octave-shane > gnulib-hg
annotate lib/search.in.h @ 13094:2ed0fc659db8
Emit #pragma system_header after the inclusion guard, not before.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Tue, 30 Mar 2010 02:35:49 +0200 |
parents | c7be8484e434 |
children | a19ace3ba849 |
rev | line source |
---|---|
9258
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1 /* A GNU-like <search.h>. |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2 |
12559
c2cbabec01dd
update nearly all FSF copyright year lists to include 2010
Jim Meyering <meyering@redhat.com>
parents:
12422
diff
changeset
|
3 Copyright (C) 2007-2010 Free Software Foundation, Inc. |
9258
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4 |
9309
bbbbbf4cd1c5
Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
9258
diff
changeset
|
5 This program is free software: you can redistribute it and/or modify |
9258
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6 it under the terms of the GNU General Public License as published by |
9309
bbbbbf4cd1c5
Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
9258
diff
changeset
|
7 the Free Software Foundation; either version 3 of the License, or |
bbbbbf4cd1c5
Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
9258
diff
changeset
|
8 (at your option) any later version. |
9258
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
9 |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
10 This program is distributed in the hope that it will be useful, |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
13 GNU General Public License for more details. |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
14 |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
15 You should have received a copy of the GNU General Public License |
9309
bbbbbf4cd1c5
Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
9258
diff
changeset
|
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
9258
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
17 |
13094
2ed0fc659db8
Emit #pragma system_header after the inclusion guard, not before.
Bruno Haible <bruno@clisp.org>
parents:
13055
diff
changeset
|
18 #ifndef _GL_SEARCH_H |
2ed0fc659db8
Emit #pragma system_header after the inclusion guard, not before.
Bruno Haible <bruno@clisp.org>
parents:
13055
diff
changeset
|
19 |
13055
c7be8484e434
maint: use pragma consistently across replacement headers
Eric Blake <eblake@redhat.com>
parents:
12937
diff
changeset
|
20 #if __GNUC__ >= 3 |
c7be8484e434
maint: use pragma consistently across replacement headers
Eric Blake <eblake@redhat.com>
parents:
12937
diff
changeset
|
21 @PRAGMA_SYSTEM_HEADER@ |
c7be8484e434
maint: use pragma consistently across replacement headers
Eric Blake <eblake@redhat.com>
parents:
12937
diff
changeset
|
22 #endif |
c7be8484e434
maint: use pragma consistently across replacement headers
Eric Blake <eblake@redhat.com>
parents:
12937
diff
changeset
|
23 |
9258
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
24 /* The include_next requires a split double-inclusion guard. */ |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
25 #if @HAVE_SEARCH_H@ |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
26 # @INCLUDE_NEXT@ @NEXT_SEARCH_H@ |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
27 #endif |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
28 |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
29 #ifndef _GL_SEARCH_H |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
30 #define _GL_SEARCH_H |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
31 |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
32 |
12937
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
33 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
34 |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
35 /* The definition of _GL_ARG_NONNULL is copied here. */ |
9258
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
36 |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
37 /* The definition of _GL_WARN_ON_USE is copied here. */ |
12422
f7842310a565
New module 'arg-nonnull'. Declare which arguments expect non-NULL values.
Bruno Haible <bruno@clisp.org>
parents:
12421
diff
changeset
|
38 |
9258
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
39 |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
40 #if @GNULIB_TSEARCH@ |
9595
53dc0fa4233a
Work around OpenBSD 4.0 tdelete() bug.
Bruno Haible <bruno@clisp.org>
parents:
9309
diff
changeset
|
41 # if @REPLACE_TSEARCH@ |
12937
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
42 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
43 # define tsearch rpl_tsearch |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
44 # define tfind rpl_tfind |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
45 # define tdelete rpl_tdelete |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
46 # define twalk rpl_twalk |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
47 # endif |
9595
53dc0fa4233a
Work around OpenBSD 4.0 tdelete() bug.
Bruno Haible <bruno@clisp.org>
parents:
9309
diff
changeset
|
48 # endif |
9258
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
49 |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
50 /* See <http://www.opengroup.org/susv3xbd/search.h.html>, |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
51 <http://www.opengroup.org/susv3xsh/tsearch.html> |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
52 for details. */ |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
53 |
12937
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
54 # if !@HAVE_TSEARCH@ |
9258
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
55 typedef enum |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
56 { |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
57 preorder, |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
58 postorder, |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
59 endorder, |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
60 leaf |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
61 } |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
62 VISIT; |
12937
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
63 # endif |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
64 |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
65 # ifdef __cplusplus |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
66 extern "C" { |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
67 # endif |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
68 typedef int (*_gl_search_compar_fn) (const void *, const void *); |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
69 typedef void (*_gl_search_action_fn) (const void *, VISIT, int); |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
70 # ifdef __cplusplus |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
71 } |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
72 # endif |
9258
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
73 |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
74 /* Searches an element in the tree *VROOTP that compares equal to KEY. |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
75 If one is found, it is returned. Otherwise, a new element equal to KEY |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
76 is inserted in the tree and is returned. */ |
12937
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
77 # if @REPLACE_TSEARCH@ |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
78 _GL_FUNCDECL_RPL (tsearch, void *, |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
79 (const void *key, void **vrootp, |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
80 _gl_search_compar_fn compar) |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
81 _GL_ARG_NONNULL ((1, 2, 3))); |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
82 _GL_CXXALIAS_RPL (tsearch, void *, |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
83 (const void *key, void **vrootp, |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
84 _gl_search_compar_fn compar)); |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
85 # else |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
86 # if !@HAVE_TSEARCH@ |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
87 _GL_FUNCDECL_SYS (tsearch, void *, |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
88 (const void *key, void **vrootp, |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
89 _gl_search_compar_fn compar) |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
90 _GL_ARG_NONNULL ((1, 2, 3))); |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
91 # endif |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
92 _GL_CXXALIAS_SYS (tsearch, void *, |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
93 (const void *key, void **vrootp, |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
94 _gl_search_compar_fn compar)); |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
95 # endif |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
96 _GL_CXXALIASWARN (tsearch); |
9258
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
97 |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
98 /* Searches an element in the tree *VROOTP that compares equal to KEY. |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
99 If one is found, it is returned. Otherwise, NULL is returned. */ |
12937
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
100 # if @REPLACE_TSEARCH@ |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
101 _GL_FUNCDECL_RPL (tfind, void *, |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
102 (const void *key, void *const *vrootp, |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
103 _gl_search_compar_fn compar) |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
104 _GL_ARG_NONNULL ((1, 2, 3))); |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
105 _GL_CXXALIAS_RPL (tfind, void *, |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
106 (const void *key, void *const *vrootp, |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
107 _gl_search_compar_fn compar)); |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
108 # else |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
109 # if !@HAVE_TSEARCH@ |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
110 _GL_FUNCDECL_SYS (tfind, void *, |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
111 (const void *key, void *const *vrootp, |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
112 _gl_search_compar_fn compar) |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
113 _GL_ARG_NONNULL ((1, 2, 3))); |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
114 # endif |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
115 /* Need to cast, because on Cygwin 1.5.x systems, the second parameter is |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
116 void **vrootp. */ |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
117 _GL_CXXALIAS_SYS_CAST (tfind, void *, |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
118 (const void *key, void *const *vrootp, |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
119 _gl_search_compar_fn compar)); |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
120 # endif |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
121 _GL_CXXALIASWARN (tfind); |
9258
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
122 |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
123 /* Searches an element in the tree *VROOTP that compares equal to KEY. |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
124 If one is found, it is removed from the tree, and its parent node is |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
125 returned. Otherwise, NULL is returned. */ |
12937
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
126 # if @REPLACE_TSEARCH@ |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
127 _GL_FUNCDECL_RPL (tdelete, void *, |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
128 (const void *key, void **vrootp, |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
129 _gl_search_compar_fn compar) |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
130 _GL_ARG_NONNULL ((1, 2, 3))); |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
131 _GL_CXXALIAS_RPL (tdelete, void *, |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
132 (const void *key, void **vrootp, |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
133 _gl_search_compar_fn compar)); |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
134 # else |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
135 # if !@HAVE_TSEARCH@ |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
136 _GL_FUNCDECL_SYS (tdelete, void *, |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
137 (const void *key, void **vrootp, |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
138 _gl_search_compar_fn compar) |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
139 _GL_ARG_NONNULL ((1, 2, 3))); |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
140 # endif |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
141 _GL_CXXALIAS_SYS (tdelete, void *, |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
142 (const void *key, void **vrootp, |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
143 _gl_search_compar_fn compar)); |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
144 # endif |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
145 _GL_CXXALIASWARN (tdelete); |
9258
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
146 |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
147 /* Perform a depth-first, left-to-right traversal of the tree VROOT. |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
148 The ACTION function is called: |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
149 - for non-leaf nodes: 3 times, before the left subtree traversal, |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
150 after the left subtree traversal but before the right subtree traversal, |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
151 and after the right subtree traversal, |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
152 - for leaf nodes: once. |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
153 The arguments passed to ACTION are: |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
154 1. the node; it can be casted to a 'const void * const *', i.e. into a |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
155 pointer to the key, |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
156 2. an indicator which visit of the node this is, |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
157 3. the level of the node in the tree (0 for the root). */ |
12937
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
158 # if @REPLACE_TSEARCH@ |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
159 _GL_FUNCDECL_RPL (twalk, void, |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
160 (const void *vroot, _gl_search_action_fn action) |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
161 _GL_ARG_NONNULL ((2))); |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
162 _GL_CXXALIAS_RPL (twalk, void, |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
163 (const void *vroot, _gl_search_action_fn action)); |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
164 # else |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
165 # if !@HAVE_TSEARCH@ |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
166 _GL_FUNCDECL_SYS (twalk, void, |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
167 (const void *vroot, _gl_search_action_fn action) |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
168 _GL_ARG_NONNULL ((2))); |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
169 # endif |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
170 _GL_CXXALIAS_SYS (twalk, void, |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
171 (const void *vroot, _gl_search_action_fn action)); |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
172 # endif |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
173 _GL_CXXALIASWARN (twalk); |
9258
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
174 |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
175 #elif defined GNULIB_POSIXCHECK |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
176 # undef tsearch |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
177 # if HAVE_RAW_DECL_TSEARCH |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
178 _GL_WARN_ON_USE (tsearch, "tsearch is unportable - " |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
179 "use gnulib module tsearch for portability"); |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
180 # endif |
9258
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
181 # undef tfind |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
182 # if HAVE_RAW_DECL_TFIND |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
183 _GL_WARN_ON_USE (tfind, "tfind is unportable - " |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
184 "use gnulib module tsearch for portability"); |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
185 # endif |
9258
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
186 # undef tdelete |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
187 # if HAVE_RAW_DECL_TDELETE |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
188 _GL_WARN_ON_USE (tdelete, "tdelete is unportable - " |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
189 "use gnulib module tsearch for portability"); |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
190 # endif |
9258
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
191 # undef twalk |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
192 # if HAVE_RAW_DECL_TWALK |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
193 _GL_WARN_ON_USE (twalk, "twalk is unportable - " |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
194 "use gnulib module tsearch for portability"); |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
195 # endif |
9258
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
196 #endif |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
197 |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
198 |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
199 #endif /* _GL_SEARCH_H */ |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
200 #endif /* _GL_SEARCH_H */ |