Debian Codegraph @

lib/ctype.in.h

raw
1 /* A substitute for ISO C99 <ctype.h>, for platforms on which it is incomplete.
2
3 Copyright (C) 2009-2025 Free Software Foundation, Inc.
4
5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
9
10 This file is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17
18 /* Written by Bruno Haible. */
19
20 /*
21 * ISO C 99 <ctype.h> for platforms on which it is incomplete.
22 * <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/ctype.h.html>
23 */
24
25 #ifndef _@GUARD_PREFIX@_CTYPE_H
26
27 #if __GNUC__ >= 3
28 @PRAGMA_SYSTEM_HEADER@
29 #endif
30 @PRAGMA_COLUMNS@
31
32 /* On Solaris 11 OmniOS, we cannot include <locale.h> until after <wchar.h> has
33 been entirely included. That is because
34 - <locale.h> includes <xlocale.h>, which makes use of the mbstate_t type.
35 - <wchar.h> includes <iso/wchar_iso.h>, which includes <ctype.h> *before*
36 defining mbstate_t, WEOF, etc. */
37 #if defined __sun && defined _ISO_WCHAR_ISO_H && !defined WEOF
38 /* We're in the middle of including <iso/wchar_iso.h>.
39 Include just the original <ctype.h>. */
40
41 #@INCLUDE_NEXT@ @NEXT_CTYPE_H@
42
43 #else
44
45 /* Include the original <ctype.h>. */
46 /* The include_next requires a split double-inclusion guard. */
47 #@INCLUDE_NEXT@ @NEXT_CTYPE_H@
48
49 #ifndef _@GUARD_PREFIX@_CTYPE_H
50 #define _@GUARD_PREFIX@_CTYPE_H
51
52 /* This file uses _GL_ARG_NONNULL, GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */
53 #if !_GL_CONFIG_H_INCLUDED
54 #error "Please include config.h first."
55 #endif
56
57 #if (@GNULIB_ISALNUM_L@ || @GNULIB_ISALPHA_L@ || @GNULIB_ISBLANK_L@ \
58 || @GNULIB_ISCNTRL_L@ || @GNULIB_ISDIGIT_L@ || @GNULIB_ISGRAPH_L@ \
59 || @GNULIB_ISLOWER_L@ || @GNULIB_ISPRINT_L@ || @GNULIB_ISPUNCT_L@ \
60 || @GNULIB_ISSPACE_L@ || @GNULIB_ISUPPER_L@ || @GNULIB_ISXDIGIT_L@ \
61 || @GNULIB_TOLOWER_L@ || @GNULIB_TOUPPER_L@)
62 /* Get locale_t. */
63 # include <locale.h>
64 #endif
65
66 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
67
68 /* The definition of _GL_ARG_NONNULL is copied here. */
69
70 /* The definition of _GL_WARN_ON_USE is copied here. */
71
72 /* Return non-zero if c is alphanumeric. */
73 #if @GNULIB_ISALNUM_L@
74 # if !@HAVE_ISALNUM_L@
75 _GL_FUNCDECL_SYS (isalnum_l, int, (int c, locale_t locale),
76 _GL_ARG_NONNULL ((2)));
77 # endif
78 _GL_CXXALIAS_SYS (isalnum_l, int, (int c, locale_t locale));
79 # if __GLIBC__ >= 2
80 _GL_CXXALIASWARN (isalnum_l);
81 # endif
82 #elif defined GNULIB_POSIXCHECK
83 # undef isalnum_l
84 # if HAVE_RAW_DECL_ISALNUM_L
85 _GL_WARN_ON_USE (isalnum_l, "isalnum_l is unportable - "
86 "use gnulib module isalnum_l for portability");
87 # endif
88 #endif
89
90 /* Return non-zero if c is alphabetic. */
91 #if @GNULIB_ISALPHA_L@
92 # if !@HAVE_ISALPHA_L@
93 _GL_FUNCDECL_SYS (isalpha_l, int, (int c, locale_t locale),
94 _GL_ARG_NONNULL ((2)));
95 # endif
96 _GL_CXXALIAS_SYS (isalpha_l, int, (int c, locale_t locale));
97 # if __GLIBC__ >= 2
98 _GL_CXXALIASWARN (isalpha_l);
99 # endif
100 #elif defined GNULIB_POSIXCHECK
101 # undef isalpha_l
102 # if HAVE_RAW_DECL_ISALPHA_L
103 _GL_WARN_ON_USE (isalpha_l, "isalpha_l is unportable - "
104 "use gnulib module isalpha_l for portability");
105 # endif
106 #endif
107
108 /* Return non-zero if c is a blank, i.e. a space or tab character. */
109 #if @GNULIB_ISBLANK@
110 # if !@HAVE_ISBLANK@
111 _GL_EXTERN_C int isblank (int c);
112 # endif
113 #elif defined GNULIB_POSIXCHECK
114 # undef isblank
115 # if HAVE_RAW_DECL_ISBLANK
116 _GL_WARN_ON_USE (isblank, "isblank is unportable - "
117 "use gnulib module isblank for portability");
118 # endif
119 #endif
120
121 /* Return non-zero if c is a blank, i.e. a space or tab character. */
122 #if @GNULIB_ISBLANK_L@
123 # if !@HAVE_ISBLANK_L@
124 _GL_FUNCDECL_SYS (isblank_l, int, (int c, locale_t locale),
125 _GL_ARG_NONNULL ((2)));
126 # endif
127 _GL_CXXALIAS_SYS (isblank_l, int, (int c, locale_t locale));
128 # if __GLIBC__ >= 2
129 _GL_CXXALIASWARN (isblank_l);
130 # endif
131 #elif defined GNULIB_POSIXCHECK
132 # undef isblank_l
133 # if HAVE_RAW_DECL_ISBLANK_L
134 _GL_WARN_ON_USE (isblank_l, "isblank_l is unportable - "
135 "use gnulib module isblank_l for portability");
136 # endif
137 #endif
138
139 /* Return non-zero if c is a control character. */
140 #if @GNULIB_ISCNTRL_L@
141 # if !@HAVE_ISCNTRL_L@
142 _GL_FUNCDECL_SYS (iscntrl_l, int, (int c, locale_t locale),
143 _GL_ARG_NONNULL ((2)));
144 # endif
145 _GL_CXXALIAS_SYS (iscntrl_l, int, (int c, locale_t locale));
146 # if __GLIBC__ >= 2
147 _GL_CXXALIASWARN (iscntrl_l);
148 # endif
149 #elif defined GNULIB_POSIXCHECK
150 # undef iscntrl_l
151 # if HAVE_RAW_DECL_ISCNTRL_L
152 _GL_WARN_ON_USE (iscntrl_l, "iscntrl_l is unportable - "
153 "use gnulib module iscntrl_l for portability");
154 # endif
155 #endif
156
157 /* Return non-zero if c is a digit. */
158 #if @GNULIB_ISDIGIT_L@
159 # if !@HAVE_ISDIGIT_L@
160 _GL_FUNCDECL_SYS (isdigit_l, int, (int c, locale_t locale),
161 _GL_ARG_NONNULL ((2)));
162 # endif
163 _GL_CXXALIAS_SYS (isdigit_l, int, (int c, locale_t locale));
164 # if __GLIBC__ >= 2
165 _GL_CXXALIASWARN (isdigit_l);
166 # endif
167 #elif defined GNULIB_POSIXCHECK
168 # undef isdigit_l
169 # if HAVE_RAW_DECL_ISDIGIT_L
170 _GL_WARN_ON_USE (isdigit_l, "isdigit_l is unportable - "
171 "use gnulib module isdigit_l for portability");
172 # endif
173 #endif
174
175 /* Return non-zero if c is graphic. */
176 #if @GNULIB_ISGRAPH_L@
177 # if !@HAVE_ISGRAPH_L@
178 _GL_FUNCDECL_SYS (isgraph_l, int, (int c, locale_t locale),
179 _GL_ARG_NONNULL ((2)));
180 # endif
181 _GL_CXXALIAS_SYS (isgraph_l, int, (int c, locale_t locale));
182 # if __GLIBC__ >= 2
183 _GL_CXXALIASWARN (isgraph_l);
184 # endif
185 #elif defined GNULIB_POSIXCHECK
186 # undef isgraph_l
187 # if HAVE_RAW_DECL_ISGRAPH_L
188 _GL_WARN_ON_USE (isgraph_l, "isgraph_l is unportable - "
189 "use gnulib module isgraph_l for portability");
190 # endif
191 #endif
192
193 /* Return non-zero if c is lowercase. */
194 #if @GNULIB_ISLOWER_L@
195 # if !@HAVE_ISLOWER_L@
196 _GL_FUNCDECL_SYS (islower_l, int, (int c, locale_t locale),
197 _GL_ARG_NONNULL ((2)));
198 # endif
199 _GL_CXXALIAS_SYS (islower_l, int, (int c, locale_t locale));
200 # if __GLIBC__ >= 2
201 _GL_CXXALIASWARN (islower_l);
202 # endif
203 #elif defined GNULIB_POSIXCHECK
204 # undef islower_l
205 # if HAVE_RAW_DECL_ISLOWER_L
206 _GL_WARN_ON_USE (islower_l, "islower_l is unportable - "
207 "use gnulib module islower_l for portability");
208 # endif
209 #endif
210
211 /* Return non-zero if c is printable. */
212 #if @GNULIB_ISPRINT_L@
213 # if !@HAVE_ISPRINT_L@
214 _GL_FUNCDECL_SYS (isprint_l, int, (int c, locale_t locale),
215 _GL_ARG_NONNULL ((2)));
216 # endif
217 _GL_CXXALIAS_SYS (isprint_l, int, (int c, locale_t locale));
218 # if __GLIBC__ >= 2
219 _GL_CXXALIASWARN (isprint_l);
220 # endif
221 #elif defined GNULIB_POSIXCHECK
222 # undef isprint_l
223 # if HAVE_RAW_DECL_ISPRINT_L
224 _GL_WARN_ON_USE (isprint_l, "isprint_l is unportable - "
225 "use gnulib module isprint_l for portability");
226 # endif
227 #endif
228
229 /* Return non-zero if c is a punctuation or symbol character. */
230 #if @GNULIB_ISPUNCT_L@
231 # if !@HAVE_ISPUNCT_L@
232 _GL_FUNCDECL_SYS (ispunct_l, int, (int c, locale_t locale),
233 _GL_ARG_NONNULL ((2)));
234 # endif
235 _GL_CXXALIAS_SYS (ispunct_l, int, (int c, locale_t locale));
236 # if __GLIBC__ >= 2
237 _GL_CXXALIASWARN (ispunct_l);
238 # endif
239 #elif defined GNULIB_POSIXCHECK
240 # undef ispunct_l
241 # if HAVE_RAW_DECL_ISPUNCT_L
242 _GL_WARN_ON_USE (ispunct_l, "ispunct_l is unportable - "
243 "use gnulib module ispunct_l for portability");
244 # endif
245 #endif
246
247 /* Return non-zero if c is white-space. */
248 #if @GNULIB_ISSPACE_L@
249 # if !@HAVE_ISSPACE_L@
250 _GL_FUNCDECL_SYS (isspace_l, int, (int c, locale_t locale),
251 _GL_ARG_NONNULL ((2)));
252 # endif
253 _GL_CXXALIAS_SYS (isspace_l, int, (int c, locale_t locale));
254 # if __GLIBC__ >= 2
255 _GL_CXXALIASWARN (isspace_l);
256 # endif
257 #elif defined GNULIB_POSIXCHECK
258 # undef isspace_l
259 # if HAVE_RAW_DECL_ISSPACE_L
260 _GL_WARN_ON_USE (isspace_l, "isspace_l is unportable - "
261 "use gnulib module isspace_l for portability");
262 # endif
263 #endif
264
265 /* Return non-zero if c is uppercase. */
266 #if @GNULIB_ISUPPER_L@
267 # if !@HAVE_ISUPPER_L@
268 _GL_FUNCDECL_SYS (isupper_l, int, (int c, locale_t locale),
269 _GL_ARG_NONNULL ((2)));
270 # endif
271 _GL_CXXALIAS_SYS (isupper_l, int, (int c, locale_t locale));
272 # if __GLIBC__ >= 2
273 _GL_CXXALIASWARN (isupper_l);
274 # endif
275 #elif defined GNULIB_POSIXCHECK
276 # undef isupper_l
277 # if HAVE_RAW_DECL_ISUPPER_L
278 _GL_WARN_ON_USE (isupper_l, "isupper_l is unportable - "
279 "use gnulib module isupper_l for portability");
280 # endif
281 #endif
282
283 /* Return non-zero if c is a hexadecimal digit. */
284 #if @GNULIB_ISXDIGIT_L@
285 # if !@HAVE_ISXDIGIT_L@
286 _GL_FUNCDECL_SYS (isxdigit_l, int, (int c, locale_t locale),
287 _GL_ARG_NONNULL ((2)));
288 # endif
289 _GL_CXXALIAS_SYS (isxdigit_l, int, (int c, locale_t locale));
290 # if __GLIBC__ >= 2
291 _GL_CXXALIASWARN (isxdigit_l);
292 # endif
293 #elif defined GNULIB_POSIXCHECK
294 # undef isxdigit_l
295 # if HAVE_RAW_DECL_ISXDIGIT_L
296 _GL_WARN_ON_USE (isxdigit_l, "isxdigit_l is unportable - "
297 "use gnulib module isxdigit_l for portability");
298 # endif
299 #endif
300
301 /* Map c to lowercase. */
302 #if @GNULIB_TOLOWER_L@
303 # if !@HAVE_TOLOWER_L@
304 _GL_FUNCDECL_SYS (tolower_l, int, (int c, locale_t locale),
305 _GL_ARG_NONNULL ((2)));
306 # endif
307 _GL_CXXALIAS_SYS (tolower_l, int, (int c, locale_t locale));
308 # if __GLIBC__ >= 2
309 _GL_CXXALIASWARN (tolower_l);
310 # endif
311 #elif defined GNULIB_POSIXCHECK
312 # undef tolower_l
313 # if HAVE_RAW_DECL_TOLOWER_L
314 _GL_WARN_ON_USE (tolower_l, "tolower_l is unportable - "
315 "use gnulib module tolower_l for portability");
316 # endif
317 #endif
318
319 /* Map c to uppercase. */
320 #if @GNULIB_TOUPPER_L@
321 # if !@HAVE_TOUPPER_L@
322 _GL_FUNCDECL_SYS (toupper_l, int, (int c, locale_t locale),
323 _GL_ARG_NONNULL ((2)));
324 # endif
325 _GL_CXXALIAS_SYS (toupper_l, int, (int c, locale_t locale));
326 # if __GLIBC__ >= 2
327 _GL_CXXALIASWARN (toupper_l);
328 # endif
329 #elif defined GNULIB_POSIXCHECK
330 # undef toupper_l
331 # if HAVE_RAW_DECL_TOUPPER_L
332 _GL_WARN_ON_USE (toupper_l, "toupper_l is unportable - "
333 "use gnulib module toupper_l for portability");
334 # endif
335 #endif
336
337 #endif /* _@GUARD_PREFIX@_CTYPE_H */
338 #endif
339 #endif /* _@GUARD_PREFIX@_CTYPE_H */