annotate lib/search.in.h @ 40057:b06060465f09

maint: Run 'make update-copyright'
author Paul Eggert <eggert@cs.ucla.edu>
date Tue, 01 Jan 2019 00:25:11 +0100
parents ac5267ac9bab
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
40057
b06060465f09 maint: Run 'make update-copyright'
Paul Eggert <eggert@cs.ucla.edu>
parents: 19664
diff changeset
3 Copyright (C) 2007-2019 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
19190
9759915b2aca all: prefer https: URLs
Paul Eggert <eggert@cs.ucla.edu>
parents: 18691
diff changeset
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
9258
bee5960c276a Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
17
14840
5f709022a256 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 14274
diff changeset
18 #ifndef _@GUARD_PREFIX@_SEARCH_H
13094
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
13761
a19ace3ba849 Avoid line length limitation from HP NonStop system header files.
Bruno Haible <bruno@clisp.org>
parents: 13094
diff changeset
23 @PRAGMA_COLUMNS@
13055
c7be8484e434 maint: use pragma consistently across replacement headers
Eric Blake <eblake@redhat.com>
parents: 12937
diff changeset
24
9258
bee5960c276a Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
25 /* 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
26 #if @HAVE_SEARCH_H@
bee5960c276a Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
27 # @INCLUDE_NEXT@ @NEXT_SEARCH_H@
bee5960c276a Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
28 #endif
bee5960c276a Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
29
14840
5f709022a256 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 14274
diff changeset
30 #ifndef _@GUARD_PREFIX@_SEARCH_H
5f709022a256 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 14274
diff changeset
31 #define _@GUARD_PREFIX@_SEARCH_H
9258
bee5960c276a Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
32
bee5960c276a Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
33
12937
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
34 /* 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
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_ARG_NONNULL is copied here. */
9258
bee5960c276a Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
37
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12559
diff changeset
38 /* 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
39
9258
bee5960c276a Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
40
bee5960c276a Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
41 #if @GNULIB_TSEARCH@
9595
53dc0fa4233a Work around OpenBSD 4.0 tdelete() bug.
Bruno Haible <bruno@clisp.org>
parents: 9309
diff changeset
42 # if @REPLACE_TSEARCH@
12937
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
43 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
44 # define tsearch rpl_tsearch
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
45 # define tfind rpl_tfind
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
46 # define tdelete rpl_tdelete
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
47 # define twalk rpl_twalk
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
48 # endif
9595
53dc0fa4233a Work around OpenBSD 4.0 tdelete() bug.
Bruno Haible <bruno@clisp.org>
parents: 9309
diff changeset
49 # endif
9258
bee5960c276a Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
50
bee5960c276a Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
51 /* 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
52 <http://www.opengroup.org/susv3xsh/tsearch.html>
bee5960c276a Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
53 for details. */
bee5960c276a Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
54
18691
cc7fe70bc861 search: Don't assume that tsearch() exists if 'VISIT' is defined.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
55 # if !@HAVE_TYPE_VISIT@
14274
da5595160b9f Allow multiple gnulib generated replacements to coexist.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
56 # if !GNULIB_defined_search_types
9258
bee5960c276a Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
57 typedef enum
bee5960c276a Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
58 {
bee5960c276a Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
59 preorder,
bee5960c276a Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
60 postorder,
bee5960c276a Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
61 endorder,
bee5960c276a Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
62 leaf
bee5960c276a Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
63 }
bee5960c276a Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
64 VISIT;
14274
da5595160b9f Allow multiple gnulib generated replacements to coexist.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
65 # define GNULIB_defined_search_types 1
da5595160b9f Allow multiple gnulib generated replacements to coexist.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
66 # endif
12937
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
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 extern "C" {
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
71 # endif
14274
da5595160b9f Allow multiple gnulib generated replacements to coexist.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
72 # if !GNULIB_defined_search_fn_types
12937
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
73 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
74 typedef void (*_gl_search_action_fn) (const void *, VISIT, int);
14274
da5595160b9f Allow multiple gnulib generated replacements to coexist.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
75 # define GNULIB_defined_search_fn_types 1
da5595160b9f Allow multiple gnulib generated replacements to coexist.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
76 # endif
12937
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
77 # ifdef __cplusplus
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
78 }
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
79 # endif
9258
bee5960c276a Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
80
bee5960c276a Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
81 /* 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
82 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
83 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
84 # if @REPLACE_TSEARCH@
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
85 _GL_FUNCDECL_RPL (tsearch, void *,
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
86 (const void *key, void **vrootp,
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
87 _gl_search_compar_fn compar)
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
88 _GL_ARG_NONNULL ((1, 2, 3)));
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
89 _GL_CXXALIAS_RPL (tsearch, void *,
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
90 (const void *key, void **vrootp,
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
91 _gl_search_compar_fn compar));
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
92 # else
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
93 # if !@HAVE_TSEARCH@
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
94 _GL_FUNCDECL_SYS (tsearch, void *,
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
95 (const void *key, void **vrootp,
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
96 _gl_search_compar_fn compar)
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
97 _GL_ARG_NONNULL ((1, 2, 3)));
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
98 # endif
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
99 _GL_CXXALIAS_SYS (tsearch, void *,
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
100 (const void *key, void **vrootp,
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
101 _gl_search_compar_fn compar));
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
102 # endif
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
103 _GL_CXXALIASWARN (tsearch);
9258
bee5960c276a Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
104
bee5960c276a Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
105 /* 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
106 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
107 # if @REPLACE_TSEARCH@
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
108 _GL_FUNCDECL_RPL (tfind, void *,
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
109 (const void *key, void *const *vrootp,
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
110 _gl_search_compar_fn compar)
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
111 _GL_ARG_NONNULL ((1, 2, 3)));
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
112 _GL_CXXALIAS_RPL (tfind, void *,
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
113 (const void *key, void *const *vrootp,
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
114 _gl_search_compar_fn compar));
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
115 # else
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
116 # if !@HAVE_TSEARCH@
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
117 _GL_FUNCDECL_SYS (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 _GL_ARG_NONNULL ((1, 2, 3)));
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
121 # endif
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
122 /* 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
123 void **vrootp. */
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
124 _GL_CXXALIAS_SYS_CAST (tfind, void *,
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
125 (const void *key, void *const *vrootp,
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
126 _gl_search_compar_fn compar));
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
127 # endif
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
128 _GL_CXXALIASWARN (tfind);
9258
bee5960c276a Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
129
bee5960c276a Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
130 /* 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
131 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
132 returned. Otherwise, NULL is returned. */
12937
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
133 # if @REPLACE_TSEARCH@
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
134 _GL_FUNCDECL_RPL (tdelete, void *,
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
135 (const void *key, void **vrootp,
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
136 _gl_search_compar_fn compar)
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
137 _GL_ARG_NONNULL ((1, 2, 3)));
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
138 _GL_CXXALIAS_RPL (tdelete, void *,
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
139 (const void *key, void **vrootp,
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
140 _gl_search_compar_fn compar));
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
141 # else
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
142 # if !@HAVE_TSEARCH@
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
143 _GL_FUNCDECL_SYS (tdelete, void *,
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
144 (const void *key, void **vrootp,
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
145 _gl_search_compar_fn compar)
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
146 _GL_ARG_NONNULL ((1, 2, 3)));
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
147 # endif
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
148 _GL_CXXALIAS_SYS (tdelete, void *,
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
149 (const void *key, void **vrootp,
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
150 _gl_search_compar_fn compar));
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
151 # endif
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
152 _GL_CXXALIASWARN (tdelete);
9258
bee5960c276a Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
153
bee5960c276a Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
154 /* 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
155 The ACTION function is called:
bee5960c276a Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
156 - 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
157 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
158 and after the right subtree traversal,
bee5960c276a Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
159 - for leaf nodes: once.
bee5960c276a Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
160 The arguments passed to ACTION are:
16358
a712776b11ce maint: spelling fixes
Paul Eggert <eggert@cs.ucla.edu>
parents: 16201
diff changeset
161 1. the node; it can be cast to a 'const void * const *', i.e. into a
9258
bee5960c276a Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
162 pointer to the key,
bee5960c276a Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
163 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
164 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
165 # if @REPLACE_TSEARCH@
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
166 _GL_FUNCDECL_RPL (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 _GL_CXXALIAS_RPL (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 # else
19664
ac5267ac9bab tsearch: Fix compilation error on Android.
Bruno Haible <bruno@clisp.org>
parents: 19484
diff changeset
172 # if !@HAVE_TWALK@
12937
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
173 _GL_FUNCDECL_SYS (twalk, void,
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
174 (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
175 _GL_ARG_NONNULL ((2)));
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
176 # endif
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
177 _GL_CXXALIAS_SYS (twalk, void,
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
178 (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
179 # endif
dbc0820f9ddc search: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
180 _GL_CXXALIASWARN (twalk);
9258
bee5960c276a Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
181
19664
ac5267ac9bab tsearch: Fix compilation error on Android.
Bruno Haible <bruno@clisp.org>
parents: 19484
diff changeset
182 /* Flags used by tsearch.c. */
ac5267ac9bab tsearch: Fix compilation error on Android.
Bruno Haible <bruno@clisp.org>
parents: 19484
diff changeset
183 # define GNULIB_defined_tsearch (@REPLACE_TSEARCH@ || !@HAVE_TSEARCH@)
ac5267ac9bab tsearch: Fix compilation error on Android.
Bruno Haible <bruno@clisp.org>
parents: 19484
diff changeset
184 # define GNULIB_defined_twalk (@REPLACE_TSEARCH@ || !@HAVE_TWALK@)
ac5267ac9bab tsearch: Fix compilation error on Android.
Bruno Haible <bruno@clisp.org>
parents: 19484
diff changeset
185
9258
bee5960c276a Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
186 #elif defined GNULIB_POSIXCHECK
bee5960c276a Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
187 # undef tsearch
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12559
diff changeset
188 # if HAVE_RAW_DECL_TSEARCH
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12559
diff changeset
189 _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
190 "use gnulib module tsearch for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12559
diff changeset
191 # endif
9258
bee5960c276a Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
192 # undef tfind
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12559
diff changeset
193 # if HAVE_RAW_DECL_TFIND
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12559
diff changeset
194 _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
195 "use gnulib module tsearch for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12559
diff changeset
196 # endif
9258
bee5960c276a Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
197 # undef tdelete
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12559
diff changeset
198 # if HAVE_RAW_DECL_TDELETE
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12559
diff changeset
199 _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
200 "use gnulib module tsearch for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12559
diff changeset
201 # endif
9258
bee5960c276a Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
202 # undef twalk
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12559
diff changeset
203 # if HAVE_RAW_DECL_TWALK
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12559
diff changeset
204 _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
205 "use gnulib module tsearch for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12559
diff changeset
206 # endif
9258
bee5960c276a Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
207 #endif
bee5960c276a Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
208
bee5960c276a Rename search_.h to search.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
209
14840
5f709022a256 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 14274
diff changeset
210 #endif /* _@GUARD_PREFIX@_SEARCH_H */
5f709022a256 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 14274
diff changeset
211 #endif /* _@GUARD_PREFIX@_SEARCH_H */