Mercurial > hg > octave-shane > gnulib-hg
annotate lib/search.in.h @ 12937:dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Mon, 08 Mar 2010 01:16:01 +0100 |
parents | 2c14f1e449e5 |
children | c7be8484e434 |
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 |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
18 #ifndef _GL_SEARCH_H |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
19 |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
20 /* 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
|
21 #if @HAVE_SEARCH_H@ |
10655
8668b19a7032
Avoid gcc warnings because of #pragma GCC system_header on older gcc.
Bruno Haible <bruno@clisp.org>
parents:
10375
diff
changeset
|
22 # if __GNUC__ >= 3 |
10375
f96e845fc36d
Avoid some "gcc -pedantic" warnings.
Bruno Haible <bruno@clisp.org>
parents:
9595
diff
changeset
|
23 @PRAGMA_SYSTEM_HEADER@ |
10655
8668b19a7032
Avoid gcc warnings because of #pragma GCC system_header on older gcc.
Bruno Haible <bruno@clisp.org>
parents:
10375
diff
changeset
|
24 # endif |
9258
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
25 # @INCLUDE_NEXT@ @NEXT_SEARCH_H@ |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
26 #endif |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
27 |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
28 #ifndef _GL_SEARCH_H |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
29 #define _GL_SEARCH_H |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
30 |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
31 |
12937
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
32 /* 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
|
33 |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
34 /* 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
|
35 |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
36 /* 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
|
37 |
9258
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
38 |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
39 #if @GNULIB_TSEARCH@ |
9595
53dc0fa4233a
Work around OpenBSD 4.0 tdelete() bug.
Bruno Haible <bruno@clisp.org>
parents:
9309
diff
changeset
|
40 # if @REPLACE_TSEARCH@ |
12937
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
41 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
42 # define tsearch rpl_tsearch |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
43 # define tfind rpl_tfind |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
44 # define tdelete rpl_tdelete |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
45 # define twalk rpl_twalk |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
46 # endif |
9595
53dc0fa4233a
Work around OpenBSD 4.0 tdelete() bug.
Bruno Haible <bruno@clisp.org>
parents:
9309
diff
changeset
|
47 # endif |
9258
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
48 |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
49 /* 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
|
50 <http://www.opengroup.org/susv3xsh/tsearch.html> |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
51 for details. */ |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
52 |
12937
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
53 # if !@HAVE_TSEARCH@ |
9258
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
54 typedef enum |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
55 { |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
56 preorder, |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
57 postorder, |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
58 endorder, |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
59 leaf |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
60 } |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
61 VISIT; |
12937
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
62 # endif |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
63 |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
64 # ifdef __cplusplus |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
65 extern "C" { |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
66 # endif |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
67 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
|
68 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
|
69 # ifdef __cplusplus |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
70 } |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
71 # endif |
9258
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
72 |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
73 /* 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
|
74 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
|
75 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
|
76 # if @REPLACE_TSEARCH@ |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
77 _GL_FUNCDECL_RPL (tsearch, void *, |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
78 (const void *key, void **vrootp, |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
79 _gl_search_compar_fn compar) |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
80 _GL_ARG_NONNULL ((1, 2, 3))); |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
81 _GL_CXXALIAS_RPL (tsearch, void *, |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
82 (const void *key, void **vrootp, |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
83 _gl_search_compar_fn compar)); |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
84 # else |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
85 # if !@HAVE_TSEARCH@ |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
86 _GL_FUNCDECL_SYS (tsearch, void *, |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
87 (const void *key, void **vrootp, |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
88 _gl_search_compar_fn compar) |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
89 _GL_ARG_NONNULL ((1, 2, 3))); |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
90 # endif |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
91 _GL_CXXALIAS_SYS (tsearch, void *, |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
92 (const void *key, void **vrootp, |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
93 _gl_search_compar_fn compar)); |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
94 # endif |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
95 _GL_CXXALIASWARN (tsearch); |
9258
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
96 |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
97 /* 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
|
98 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
|
99 # if @REPLACE_TSEARCH@ |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
100 _GL_FUNCDECL_RPL (tfind, void *, |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
101 (const void *key, void *const *vrootp, |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
102 _gl_search_compar_fn compar) |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
103 _GL_ARG_NONNULL ((1, 2, 3))); |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
104 _GL_CXXALIAS_RPL (tfind, void *, |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
105 (const void *key, void *const *vrootp, |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
106 _gl_search_compar_fn compar)); |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
107 # else |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
108 # if !@HAVE_TSEARCH@ |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
109 _GL_FUNCDECL_SYS (tfind, void *, |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
110 (const void *key, void *const *vrootp, |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
111 _gl_search_compar_fn compar) |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
112 _GL_ARG_NONNULL ((1, 2, 3))); |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
113 # endif |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
114 /* 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
|
115 void **vrootp. */ |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
116 _GL_CXXALIAS_SYS_CAST (tfind, void *, |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
117 (const void *key, void *const *vrootp, |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
118 _gl_search_compar_fn compar)); |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
119 # endif |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
120 _GL_CXXALIASWARN (tfind); |
9258
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
121 |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
122 /* 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
|
123 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
|
124 returned. Otherwise, NULL is returned. */ |
12937
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
125 # if @REPLACE_TSEARCH@ |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
126 _GL_FUNCDECL_RPL (tdelete, void *, |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
127 (const void *key, void **vrootp, |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
128 _gl_search_compar_fn compar) |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
129 _GL_ARG_NONNULL ((1, 2, 3))); |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
130 _GL_CXXALIAS_RPL (tdelete, void *, |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
131 (const void *key, void **vrootp, |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
132 _gl_search_compar_fn compar)); |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
133 # else |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
134 # if !@HAVE_TSEARCH@ |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
135 _GL_FUNCDECL_SYS (tdelete, void *, |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
136 (const void *key, void **vrootp, |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
137 _gl_search_compar_fn compar) |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
138 _GL_ARG_NONNULL ((1, 2, 3))); |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
139 # endif |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
140 _GL_CXXALIAS_SYS (tdelete, void *, |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
141 (const void *key, void **vrootp, |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
142 _gl_search_compar_fn compar)); |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
143 # endif |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
144 _GL_CXXALIASWARN (tdelete); |
9258
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
145 |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
146 /* 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
|
147 The ACTION function is called: |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
148 - 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
|
149 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
|
150 and after the right subtree traversal, |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
151 - for leaf nodes: once. |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
152 The arguments passed to ACTION are: |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
153 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
|
154 pointer to the key, |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
155 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
|
156 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
|
157 # if @REPLACE_TSEARCH@ |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
158 _GL_FUNCDECL_RPL (twalk, void, |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
159 (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
|
160 _GL_ARG_NONNULL ((2))); |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
161 _GL_CXXALIAS_RPL (twalk, void, |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
162 (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
|
163 # else |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
164 # if !@HAVE_TSEARCH@ |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
165 _GL_FUNCDECL_SYS (twalk, void, |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
166 (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
|
167 _GL_ARG_NONNULL ((2))); |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
168 # endif |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
169 _GL_CXXALIAS_SYS (twalk, void, |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
170 (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
|
171 # endif |
dbc0820f9ddc
search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
172 _GL_CXXALIASWARN (twalk); |
9258
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
173 |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
174 #elif defined GNULIB_POSIXCHECK |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
175 # undef tsearch |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
176 # if HAVE_RAW_DECL_TSEARCH |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
177 _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
|
178 "use gnulib module tsearch for portability"); |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
179 # endif |
9258
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
180 # undef tfind |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
181 # if HAVE_RAW_DECL_TFIND |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
182 _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
|
183 "use gnulib module tsearch for portability"); |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
184 # endif |
9258
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
185 # undef tdelete |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
186 # if HAVE_RAW_DECL_TDELETE |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
187 _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
|
188 "use gnulib module tsearch for portability"); |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
189 # endif |
9258
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
190 # undef twalk |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
191 # if HAVE_RAW_DECL_TWALK |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
192 _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
|
193 "use gnulib module tsearch for portability"); |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
194 # endif |
9258
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
195 #endif |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
196 |
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 #endif /* _GL_SEARCH_H */ |
bee5960c276a
Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
199 #endif /* _GL_SEARCH_H */ |