Commit | Line | Data |
---|---|---|
8690e634 JK |
1 | /* A substitute for ISO C99 <wchar.h>, for platforms that have issues. |
2 | ||
c0c3707f | 3 | Copyright (C) 2007-2019 Free Software Foundation, Inc. |
8690e634 JK |
4 | |
5 | This program is free software; you can redistribute it and/or modify | |
6 | it under the terms of the GNU General Public License as published by | |
7 | the Free Software Foundation; either version 3, or (at your option) | |
8 | any later version. | |
9 | ||
10 | This program 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 General Public License for more details. | |
14 | ||
15 | You should have received a copy of the GNU General Public License | |
c0c3707f | 16 | along with this program; if not, see <https://www.gnu.org/licenses/>. */ |
8690e634 JK |
17 | |
18 | /* Written by Eric Blake. */ | |
19 | ||
20 | /* | |
21 | * ISO C 99 <wchar.h> for platforms that have issues. | |
c0c3707f | 22 | * <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/wchar.h.html> |
8690e634 JK |
23 | * |
24 | * For now, this just ensures proper prerequisite inclusion order and | |
25 | * the declaration of wcwidth(). | |
26 | */ | |
27 | ||
28 | #if __GNUC__ >= 3 | |
29 | @PRAGMA_SYSTEM_HEADER@ | |
30 | #endif | |
31 | @PRAGMA_COLUMNS@ | |
32 | ||
4a626d0a | 33 | #if (((defined __need_mbstate_t || defined __need_wint_t) \ |
c0c3707f | 34 | && !defined __MINGW32__) \ |
4a626d0a PA |
35 | || (defined __hpux \ |
36 | && ((defined _INTTYPES_INCLUDED && !defined strtoimax) \ | |
37 | || defined _GL_JUST_INCLUDE_SYSTEM_WCHAR_H)) \ | |
49e4877c | 38 | || (defined __MINGW32__ && defined __STRING_H_SOURCED__) \ |
4a626d0a | 39 | || defined _GL_ALREADY_INCLUDING_WCHAR_H) |
8690e634 | 40 | /* Special invocation convention: |
4a626d0a | 41 | - Inside glibc and uClibc header files, but not MinGW. |
8690e634 JK |
42 | - On HP-UX 11.00 we have a sequence of nested includes |
43 | <wchar.h> -> <stdlib.h> -> <stdint.h>, and the latter includes <wchar.h>, | |
44 | once indirectly <stdint.h> -> <sys/types.h> -> <inttypes.h> -> <wchar.h> | |
45 | and once directly. In both situations 'wint_t' is not yet defined, | |
46 | therefore we cannot provide the function overrides; instead include only | |
47 | the system's <wchar.h>. | |
49e4877c PA |
48 | - With MinGW 3.22, when <string.h> includes <wchar.h>, only some part of |
49 | <wchar.h> is actually processed, and that doesn't include 'mbstate_t'. | |
8690e634 JK |
50 | - On IRIX 6.5, similarly, we have an include <wchar.h> -> <wctype.h>, and |
51 | the latter includes <wchar.h>. But here, we have no way to detect whether | |
52 | <wctype.h> is completely included or is still being included. */ | |
53 | ||
54 | #@INCLUDE_NEXT@ @NEXT_WCHAR_H@ | |
55 | ||
56 | #else | |
57 | /* Normal invocation convention. */ | |
58 | ||
59 | #ifndef _@GUARD_PREFIX@_WCHAR_H | |
60 | ||
61 | #define _GL_ALREADY_INCLUDING_WCHAR_H | |
62 | ||
63 | #if @HAVE_FEATURES_H@ | |
64 | # include <features.h> /* for __GLIBC__ */ | |
65 | #endif | |
66 | ||
67 | /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before | |
68 | <wchar.h>. | |
69 | BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be | |
70 | included before <wchar.h>. | |
71 | In some builds of uClibc, <wchar.h> is nonexistent and wchar_t is defined | |
72 | by <stddef.h>. | |
73 | But avoid namespace pollution on glibc systems. */ | |
74 | #if !(defined __GLIBC__ && !defined __UCLIBC__) | |
75 | # include <stddef.h> | |
76 | #endif | |
77 | #ifndef __GLIBC__ | |
78 | # include <stdio.h> | |
79 | # include <time.h> | |
80 | #endif | |
81 | ||
82 | /* Include the original <wchar.h> if it exists. | |
83 | Some builds of uClibc lack it. */ | |
84 | /* The include_next requires a split double-inclusion guard. */ | |
85 | #if @HAVE_WCHAR_H@ | |
86 | # @INCLUDE_NEXT@ @NEXT_WCHAR_H@ | |
87 | #endif | |
88 | ||
89 | #undef _GL_ALREADY_INCLUDING_WCHAR_H | |
90 | ||
91 | #ifndef _@GUARD_PREFIX@_WCHAR_H | |
92 | #define _@GUARD_PREFIX@_WCHAR_H | |
93 | ||
94 | /* The __attribute__ feature is available in gcc versions 2.5 and later. | |
95 | The attribute __pure__ was added in gcc 2.96. */ | |
96 | #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) | |
97 | # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) | |
98 | #else | |
99 | # define _GL_ATTRIBUTE_PURE /* empty */ | |
100 | #endif | |
101 | ||
102 | /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ | |
103 | ||
104 | /* The definition of _GL_ARG_NONNULL is copied here. */ | |
105 | ||
106 | /* The definition of _GL_WARN_ON_USE is copied here. */ | |
107 | ||
108 | ||
109 | /* Define wint_t and WEOF. (Also done in wctype.in.h.) */ | |
110 | #if !@HAVE_WINT_T@ && !defined wint_t | |
111 | # define wint_t int | |
112 | # ifndef WEOF | |
113 | # define WEOF -1 | |
114 | # endif | |
115 | #else | |
c0c3707f CB |
116 | /* mingw and MSVC define wint_t as 'unsigned short' in <crtdefs.h> or |
117 | <stddef.h>. This is too small: ISO C 99 section 7.24.1.(2) says that | |
118 | wint_t must be "unchanged by default argument promotions". Override it. */ | |
119 | # if @GNULIB_OVERRIDES_WINT_T@ | |
8690e634 | 120 | # if !GNULIB_defined_wint_t |
c0c3707f CB |
121 | # if @HAVE_CRTDEFS_H@ |
122 | # include <crtdefs.h> | |
123 | # else | |
124 | # include <stddef.h> | |
125 | # endif | |
8690e634 JK |
126 | typedef unsigned int rpl_wint_t; |
127 | # undef wint_t | |
128 | # define wint_t rpl_wint_t | |
129 | # define GNULIB_defined_wint_t 1 | |
130 | # endif | |
131 | # endif | |
132 | # ifndef WEOF | |
133 | # define WEOF ((wint_t) -1) | |
134 | # endif | |
135 | #endif | |
136 | ||
137 | ||
138 | /* Override mbstate_t if it is too small. | |
139 | On IRIX 6.5, sizeof (mbstate_t) == 1, which is not sufficient for | |
c0c3707f CB |
140 | implementing mbrtowc for encodings like UTF-8. |
141 | On AIX and MSVC, mbrtowc needs to be overridden, but mbstate_t exists and is | |
142 | large enough and overriding it would cause problems in C++ mode. */ | |
143 | #if (!(@HAVE_MBSINIT@ && @HAVE_MBRTOWC@) || @REPLACE_MBSTATE_T@) \ | |
144 | && !(defined _AIX || defined _MSC_VER) | |
8690e634 JK |
145 | # if !GNULIB_defined_mbstate_t |
146 | typedef int rpl_mbstate_t; | |
147 | # undef mbstate_t | |
148 | # define mbstate_t rpl_mbstate_t | |
149 | # define GNULIB_defined_mbstate_t 1 | |
150 | # endif | |
151 | #endif | |
152 | ||
153 | ||
154 | /* Convert a single-byte character to a wide character. */ | |
155 | #if @GNULIB_BTOWC@ | |
156 | # if @REPLACE_BTOWC@ | |
157 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
158 | # undef btowc | |
159 | # define btowc rpl_btowc | |
160 | # endif | |
161 | _GL_FUNCDECL_RPL (btowc, wint_t, (int c) _GL_ATTRIBUTE_PURE); | |
162 | _GL_CXXALIAS_RPL (btowc, wint_t, (int c)); | |
163 | # else | |
164 | # if !@HAVE_BTOWC@ | |
165 | _GL_FUNCDECL_SYS (btowc, wint_t, (int c) _GL_ATTRIBUTE_PURE); | |
166 | # endif | |
c0c3707f CB |
167 | /* Need to cast, because on mingw, the return type is 'unsigned short'. */ |
168 | _GL_CXXALIAS_SYS_CAST (btowc, wint_t, (int c)); | |
8690e634 | 169 | # endif |
c0c3707f | 170 | # if __GLIBC__ >= 2 |
8690e634 | 171 | _GL_CXXALIASWARN (btowc); |
c0c3707f | 172 | # endif |
8690e634 JK |
173 | #elif defined GNULIB_POSIXCHECK |
174 | # undef btowc | |
175 | # if HAVE_RAW_DECL_BTOWC | |
176 | _GL_WARN_ON_USE (btowc, "btowc is unportable - " | |
177 | "use gnulib module btowc for portability"); | |
178 | # endif | |
179 | #endif | |
180 | ||
181 | ||
182 | /* Convert a wide character to a single-byte character. */ | |
183 | #if @GNULIB_WCTOB@ | |
184 | # if @REPLACE_WCTOB@ | |
185 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
186 | # undef wctob | |
187 | # define wctob rpl_wctob | |
188 | # endif | |
189 | _GL_FUNCDECL_RPL (wctob, int, (wint_t wc) _GL_ATTRIBUTE_PURE); | |
190 | _GL_CXXALIAS_RPL (wctob, int, (wint_t wc)); | |
191 | # else | |
192 | # if !defined wctob && !@HAVE_DECL_WCTOB@ | |
193 | /* wctob is provided by gnulib, or wctob exists but is not declared. */ | |
194 | _GL_FUNCDECL_SYS (wctob, int, (wint_t wc) _GL_ATTRIBUTE_PURE); | |
195 | # endif | |
196 | _GL_CXXALIAS_SYS (wctob, int, (wint_t wc)); | |
197 | # endif | |
c0c3707f | 198 | # if __GLIBC__ >= 2 |
8690e634 | 199 | _GL_CXXALIASWARN (wctob); |
c0c3707f | 200 | # endif |
8690e634 JK |
201 | #elif defined GNULIB_POSIXCHECK |
202 | # undef wctob | |
203 | # if HAVE_RAW_DECL_WCTOB | |
204 | _GL_WARN_ON_USE (wctob, "wctob is unportable - " | |
205 | "use gnulib module wctob for portability"); | |
206 | # endif | |
207 | #endif | |
208 | ||
209 | ||
210 | /* Test whether *PS is in the initial state. */ | |
211 | #if @GNULIB_MBSINIT@ | |
212 | # if @REPLACE_MBSINIT@ | |
213 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
214 | # undef mbsinit | |
215 | # define mbsinit rpl_mbsinit | |
216 | # endif | |
217 | _GL_FUNCDECL_RPL (mbsinit, int, (const mbstate_t *ps)); | |
218 | _GL_CXXALIAS_RPL (mbsinit, int, (const mbstate_t *ps)); | |
219 | # else | |
220 | # if !@HAVE_MBSINIT@ | |
221 | _GL_FUNCDECL_SYS (mbsinit, int, (const mbstate_t *ps)); | |
222 | # endif | |
223 | _GL_CXXALIAS_SYS (mbsinit, int, (const mbstate_t *ps)); | |
224 | # endif | |
c0c3707f | 225 | # if __GLIBC__ >= 2 |
8690e634 | 226 | _GL_CXXALIASWARN (mbsinit); |
c0c3707f | 227 | # endif |
8690e634 JK |
228 | #elif defined GNULIB_POSIXCHECK |
229 | # undef mbsinit | |
230 | # if HAVE_RAW_DECL_MBSINIT | |
231 | _GL_WARN_ON_USE (mbsinit, "mbsinit is unportable - " | |
232 | "use gnulib module mbsinit for portability"); | |
233 | # endif | |
234 | #endif | |
235 | ||
236 | ||
237 | /* Convert a multibyte character to a wide character. */ | |
238 | #if @GNULIB_MBRTOWC@ | |
239 | # if @REPLACE_MBRTOWC@ | |
240 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
241 | # undef mbrtowc | |
242 | # define mbrtowc rpl_mbrtowc | |
243 | # endif | |
244 | _GL_FUNCDECL_RPL (mbrtowc, size_t, | |
245 | (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)); | |
246 | _GL_CXXALIAS_RPL (mbrtowc, size_t, | |
247 | (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)); | |
248 | # else | |
249 | # if !@HAVE_MBRTOWC@ | |
250 | _GL_FUNCDECL_SYS (mbrtowc, size_t, | |
251 | (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)); | |
252 | # endif | |
253 | _GL_CXXALIAS_SYS (mbrtowc, size_t, | |
254 | (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)); | |
255 | # endif | |
c0c3707f | 256 | # if __GLIBC__ >= 2 |
8690e634 | 257 | _GL_CXXALIASWARN (mbrtowc); |
c0c3707f | 258 | # endif |
8690e634 JK |
259 | #elif defined GNULIB_POSIXCHECK |
260 | # undef mbrtowc | |
261 | # if HAVE_RAW_DECL_MBRTOWC | |
262 | _GL_WARN_ON_USE (mbrtowc, "mbrtowc is unportable - " | |
263 | "use gnulib module mbrtowc for portability"); | |
264 | # endif | |
265 | #endif | |
266 | ||
267 | ||
268 | /* Recognize a multibyte character. */ | |
269 | #if @GNULIB_MBRLEN@ | |
270 | # if @REPLACE_MBRLEN@ | |
271 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
272 | # undef mbrlen | |
273 | # define mbrlen rpl_mbrlen | |
274 | # endif | |
275 | _GL_FUNCDECL_RPL (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps)); | |
276 | _GL_CXXALIAS_RPL (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps)); | |
277 | # else | |
278 | # if !@HAVE_MBRLEN@ | |
279 | _GL_FUNCDECL_SYS (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps)); | |
280 | # endif | |
281 | _GL_CXXALIAS_SYS (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps)); | |
282 | # endif | |
c0c3707f | 283 | # if __GLIBC__ >= 2 |
8690e634 | 284 | _GL_CXXALIASWARN (mbrlen); |
c0c3707f | 285 | # endif |
8690e634 JK |
286 | #elif defined GNULIB_POSIXCHECK |
287 | # undef mbrlen | |
288 | # if HAVE_RAW_DECL_MBRLEN | |
289 | _GL_WARN_ON_USE (mbrlen, "mbrlen is unportable - " | |
290 | "use gnulib module mbrlen for portability"); | |
291 | # endif | |
292 | #endif | |
293 | ||
294 | ||
295 | /* Convert a string to a wide string. */ | |
296 | #if @GNULIB_MBSRTOWCS@ | |
297 | # if @REPLACE_MBSRTOWCS@ | |
298 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
299 | # undef mbsrtowcs | |
300 | # define mbsrtowcs rpl_mbsrtowcs | |
301 | # endif | |
302 | _GL_FUNCDECL_RPL (mbsrtowcs, size_t, | |
303 | (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps) | |
304 | _GL_ARG_NONNULL ((2))); | |
305 | _GL_CXXALIAS_RPL (mbsrtowcs, size_t, | |
306 | (wchar_t *dest, const char **srcp, size_t len, | |
307 | mbstate_t *ps)); | |
308 | # else | |
309 | # if !@HAVE_MBSRTOWCS@ | |
310 | _GL_FUNCDECL_SYS (mbsrtowcs, size_t, | |
311 | (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps) | |
312 | _GL_ARG_NONNULL ((2))); | |
313 | # endif | |
314 | _GL_CXXALIAS_SYS (mbsrtowcs, size_t, | |
315 | (wchar_t *dest, const char **srcp, size_t len, | |
316 | mbstate_t *ps)); | |
317 | # endif | |
c0c3707f | 318 | # if __GLIBC__ >= 2 |
8690e634 | 319 | _GL_CXXALIASWARN (mbsrtowcs); |
c0c3707f | 320 | # endif |
8690e634 JK |
321 | #elif defined GNULIB_POSIXCHECK |
322 | # undef mbsrtowcs | |
323 | # if HAVE_RAW_DECL_MBSRTOWCS | |
324 | _GL_WARN_ON_USE (mbsrtowcs, "mbsrtowcs is unportable - " | |
325 | "use gnulib module mbsrtowcs for portability"); | |
326 | # endif | |
327 | #endif | |
328 | ||
329 | ||
330 | /* Convert a string to a wide string. */ | |
331 | #if @GNULIB_MBSNRTOWCS@ | |
332 | # if @REPLACE_MBSNRTOWCS@ | |
333 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
334 | # undef mbsnrtowcs | |
335 | # define mbsnrtowcs rpl_mbsnrtowcs | |
336 | # endif | |
337 | _GL_FUNCDECL_RPL (mbsnrtowcs, size_t, | |
338 | (wchar_t *dest, const char **srcp, size_t srclen, size_t len, | |
339 | mbstate_t *ps) | |
340 | _GL_ARG_NONNULL ((2))); | |
341 | _GL_CXXALIAS_RPL (mbsnrtowcs, size_t, | |
342 | (wchar_t *dest, const char **srcp, size_t srclen, size_t len, | |
343 | mbstate_t *ps)); | |
344 | # else | |
345 | # if !@HAVE_MBSNRTOWCS@ | |
346 | _GL_FUNCDECL_SYS (mbsnrtowcs, size_t, | |
347 | (wchar_t *dest, const char **srcp, size_t srclen, size_t len, | |
348 | mbstate_t *ps) | |
349 | _GL_ARG_NONNULL ((2))); | |
350 | # endif | |
351 | _GL_CXXALIAS_SYS (mbsnrtowcs, size_t, | |
352 | (wchar_t *dest, const char **srcp, size_t srclen, size_t len, | |
353 | mbstate_t *ps)); | |
354 | # endif | |
355 | _GL_CXXALIASWARN (mbsnrtowcs); | |
356 | #elif defined GNULIB_POSIXCHECK | |
357 | # undef mbsnrtowcs | |
358 | # if HAVE_RAW_DECL_MBSNRTOWCS | |
359 | _GL_WARN_ON_USE (mbsnrtowcs, "mbsnrtowcs is unportable - " | |
360 | "use gnulib module mbsnrtowcs for portability"); | |
361 | # endif | |
362 | #endif | |
363 | ||
364 | ||
365 | /* Convert a wide character to a multibyte character. */ | |
366 | #if @GNULIB_WCRTOMB@ | |
367 | # if @REPLACE_WCRTOMB@ | |
368 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
369 | # undef wcrtomb | |
370 | # define wcrtomb rpl_wcrtomb | |
371 | # endif | |
372 | _GL_FUNCDECL_RPL (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps)); | |
373 | _GL_CXXALIAS_RPL (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps)); | |
374 | # else | |
375 | # if !@HAVE_WCRTOMB@ | |
376 | _GL_FUNCDECL_SYS (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps)); | |
377 | # endif | |
378 | _GL_CXXALIAS_SYS (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps)); | |
379 | # endif | |
c0c3707f | 380 | # if __GLIBC__ >= 2 |
8690e634 | 381 | _GL_CXXALIASWARN (wcrtomb); |
c0c3707f | 382 | # endif |
8690e634 JK |
383 | #elif defined GNULIB_POSIXCHECK |
384 | # undef wcrtomb | |
385 | # if HAVE_RAW_DECL_WCRTOMB | |
386 | _GL_WARN_ON_USE (wcrtomb, "wcrtomb is unportable - " | |
387 | "use gnulib module wcrtomb for portability"); | |
388 | # endif | |
389 | #endif | |
390 | ||
391 | ||
392 | /* Convert a wide string to a string. */ | |
393 | #if @GNULIB_WCSRTOMBS@ | |
394 | # if @REPLACE_WCSRTOMBS@ | |
395 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
396 | # undef wcsrtombs | |
397 | # define wcsrtombs rpl_wcsrtombs | |
398 | # endif | |
399 | _GL_FUNCDECL_RPL (wcsrtombs, size_t, | |
400 | (char *dest, const wchar_t **srcp, size_t len, mbstate_t *ps) | |
401 | _GL_ARG_NONNULL ((2))); | |
402 | _GL_CXXALIAS_RPL (wcsrtombs, size_t, | |
403 | (char *dest, const wchar_t **srcp, size_t len, | |
404 | mbstate_t *ps)); | |
405 | # else | |
406 | # if !@HAVE_WCSRTOMBS@ | |
407 | _GL_FUNCDECL_SYS (wcsrtombs, size_t, | |
408 | (char *dest, const wchar_t **srcp, size_t len, mbstate_t *ps) | |
409 | _GL_ARG_NONNULL ((2))); | |
410 | # endif | |
411 | _GL_CXXALIAS_SYS (wcsrtombs, size_t, | |
412 | (char *dest, const wchar_t **srcp, size_t len, | |
413 | mbstate_t *ps)); | |
414 | # endif | |
c0c3707f | 415 | # if __GLIBC__ >= 2 |
8690e634 | 416 | _GL_CXXALIASWARN (wcsrtombs); |
c0c3707f | 417 | # endif |
8690e634 JK |
418 | #elif defined GNULIB_POSIXCHECK |
419 | # undef wcsrtombs | |
420 | # if HAVE_RAW_DECL_WCSRTOMBS | |
421 | _GL_WARN_ON_USE (wcsrtombs, "wcsrtombs is unportable - " | |
422 | "use gnulib module wcsrtombs for portability"); | |
423 | # endif | |
424 | #endif | |
425 | ||
426 | ||
427 | /* Convert a wide string to a string. */ | |
428 | #if @GNULIB_WCSNRTOMBS@ | |
429 | # if @REPLACE_WCSNRTOMBS@ | |
430 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
431 | # undef wcsnrtombs | |
432 | # define wcsnrtombs rpl_wcsnrtombs | |
433 | # endif | |
434 | _GL_FUNCDECL_RPL (wcsnrtombs, size_t, | |
435 | (char *dest, const wchar_t **srcp, size_t srclen, size_t len, | |
436 | mbstate_t *ps) | |
437 | _GL_ARG_NONNULL ((2))); | |
438 | _GL_CXXALIAS_RPL (wcsnrtombs, size_t, | |
439 | (char *dest, const wchar_t **srcp, size_t srclen, size_t len, | |
440 | mbstate_t *ps)); | |
441 | # else | |
c0c3707f | 442 | # if !@HAVE_WCSNRTOMBS@ || (defined __cplusplus && defined __sun) |
8690e634 JK |
443 | _GL_FUNCDECL_SYS (wcsnrtombs, size_t, |
444 | (char *dest, const wchar_t **srcp, size_t srclen, size_t len, | |
445 | mbstate_t *ps) | |
446 | _GL_ARG_NONNULL ((2))); | |
447 | # endif | |
448 | _GL_CXXALIAS_SYS (wcsnrtombs, size_t, | |
449 | (char *dest, const wchar_t **srcp, size_t srclen, size_t len, | |
450 | mbstate_t *ps)); | |
451 | # endif | |
c0c3707f | 452 | # if __GLIBC__ >= 2 |
8690e634 | 453 | _GL_CXXALIASWARN (wcsnrtombs); |
c0c3707f | 454 | # endif |
8690e634 JK |
455 | #elif defined GNULIB_POSIXCHECK |
456 | # undef wcsnrtombs | |
457 | # if HAVE_RAW_DECL_WCSNRTOMBS | |
458 | _GL_WARN_ON_USE (wcsnrtombs, "wcsnrtombs is unportable - " | |
459 | "use gnulib module wcsnrtombs for portability"); | |
460 | # endif | |
461 | #endif | |
462 | ||
463 | ||
464 | /* Return the number of screen columns needed for WC. */ | |
465 | #if @GNULIB_WCWIDTH@ | |
466 | # if @REPLACE_WCWIDTH@ | |
467 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
468 | # undef wcwidth | |
469 | # define wcwidth rpl_wcwidth | |
470 | # endif | |
471 | _GL_FUNCDECL_RPL (wcwidth, int, (wchar_t) _GL_ATTRIBUTE_PURE); | |
472 | _GL_CXXALIAS_RPL (wcwidth, int, (wchar_t)); | |
473 | # else | |
474 | # if !@HAVE_DECL_WCWIDTH@ | |
475 | /* wcwidth exists but is not declared. */ | |
476 | _GL_FUNCDECL_SYS (wcwidth, int, (wchar_t) _GL_ATTRIBUTE_PURE); | |
477 | # endif | |
478 | _GL_CXXALIAS_SYS (wcwidth, int, (wchar_t)); | |
479 | # endif | |
c0c3707f | 480 | # if __GLIBC__ >= 2 |
8690e634 | 481 | _GL_CXXALIASWARN (wcwidth); |
c0c3707f | 482 | # endif |
8690e634 JK |
483 | #elif defined GNULIB_POSIXCHECK |
484 | # undef wcwidth | |
485 | # if HAVE_RAW_DECL_WCWIDTH | |
486 | _GL_WARN_ON_USE (wcwidth, "wcwidth is unportable - " | |
487 | "use gnulib module wcwidth for portability"); | |
488 | # endif | |
489 | #endif | |
490 | ||
491 | ||
492 | /* Search N wide characters of S for C. */ | |
493 | #if @GNULIB_WMEMCHR@ | |
494 | # if !@HAVE_WMEMCHR@ | |
495 | _GL_FUNCDECL_SYS (wmemchr, wchar_t *, (const wchar_t *s, wchar_t c, size_t n) | |
496 | _GL_ATTRIBUTE_PURE); | |
497 | # endif | |
498 | /* On some systems, this function is defined as an overloaded function: | |
499 | extern "C++" { | |
500 | const wchar_t * std::wmemchr (const wchar_t *, wchar_t, size_t); | |
501 | wchar_t * std::wmemchr (wchar_t *, wchar_t, size_t); | |
502 | } */ | |
503 | _GL_CXXALIAS_SYS_CAST2 (wmemchr, | |
504 | wchar_t *, (const wchar_t *, wchar_t, size_t), | |
505 | const wchar_t *, (const wchar_t *, wchar_t, size_t)); | |
506 | # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ | |
507 | && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) | |
508 | _GL_CXXALIASWARN1 (wmemchr, wchar_t *, (wchar_t *s, wchar_t c, size_t n)); | |
509 | _GL_CXXALIASWARN1 (wmemchr, const wchar_t *, | |
510 | (const wchar_t *s, wchar_t c, size_t n)); | |
c0c3707f | 511 | # elif __GLIBC__ >= 2 |
8690e634 JK |
512 | _GL_CXXALIASWARN (wmemchr); |
513 | # endif | |
514 | #elif defined GNULIB_POSIXCHECK | |
515 | # undef wmemchr | |
516 | # if HAVE_RAW_DECL_WMEMCHR | |
517 | _GL_WARN_ON_USE (wmemchr, "wmemchr is unportable - " | |
518 | "use gnulib module wmemchr for portability"); | |
519 | # endif | |
520 | #endif | |
521 | ||
522 | ||
523 | /* Compare N wide characters of S1 and S2. */ | |
524 | #if @GNULIB_WMEMCMP@ | |
525 | # if !@HAVE_WMEMCMP@ | |
526 | _GL_FUNCDECL_SYS (wmemcmp, int, | |
527 | (const wchar_t *s1, const wchar_t *s2, size_t n) | |
528 | _GL_ATTRIBUTE_PURE); | |
529 | # endif | |
530 | _GL_CXXALIAS_SYS (wmemcmp, int, | |
531 | (const wchar_t *s1, const wchar_t *s2, size_t n)); | |
c0c3707f | 532 | # if __GLIBC__ >= 2 |
8690e634 | 533 | _GL_CXXALIASWARN (wmemcmp); |
c0c3707f | 534 | # endif |
8690e634 JK |
535 | #elif defined GNULIB_POSIXCHECK |
536 | # undef wmemcmp | |
537 | # if HAVE_RAW_DECL_WMEMCMP | |
538 | _GL_WARN_ON_USE (wmemcmp, "wmemcmp is unportable - " | |
539 | "use gnulib module wmemcmp for portability"); | |
540 | # endif | |
541 | #endif | |
542 | ||
543 | ||
544 | /* Copy N wide characters of SRC to DEST. */ | |
545 | #if @GNULIB_WMEMCPY@ | |
546 | # if !@HAVE_WMEMCPY@ | |
547 | _GL_FUNCDECL_SYS (wmemcpy, wchar_t *, | |
548 | (wchar_t *dest, const wchar_t *src, size_t n)); | |
549 | # endif | |
550 | _GL_CXXALIAS_SYS (wmemcpy, wchar_t *, | |
551 | (wchar_t *dest, const wchar_t *src, size_t n)); | |
c0c3707f | 552 | # if __GLIBC__ >= 2 |
8690e634 | 553 | _GL_CXXALIASWARN (wmemcpy); |
c0c3707f | 554 | # endif |
8690e634 JK |
555 | #elif defined GNULIB_POSIXCHECK |
556 | # undef wmemcpy | |
557 | # if HAVE_RAW_DECL_WMEMCPY | |
558 | _GL_WARN_ON_USE (wmemcpy, "wmemcpy is unportable - " | |
559 | "use gnulib module wmemcpy for portability"); | |
560 | # endif | |
561 | #endif | |
562 | ||
563 | ||
564 | /* Copy N wide characters of SRC to DEST, guaranteeing correct behavior for | |
565 | overlapping memory areas. */ | |
566 | #if @GNULIB_WMEMMOVE@ | |
567 | # if !@HAVE_WMEMMOVE@ | |
568 | _GL_FUNCDECL_SYS (wmemmove, wchar_t *, | |
569 | (wchar_t *dest, const wchar_t *src, size_t n)); | |
570 | # endif | |
571 | _GL_CXXALIAS_SYS (wmemmove, wchar_t *, | |
572 | (wchar_t *dest, const wchar_t *src, size_t n)); | |
c0c3707f | 573 | # if __GLIBC__ >= 2 |
8690e634 | 574 | _GL_CXXALIASWARN (wmemmove); |
c0c3707f | 575 | # endif |
8690e634 JK |
576 | #elif defined GNULIB_POSIXCHECK |
577 | # undef wmemmove | |
578 | # if HAVE_RAW_DECL_WMEMMOVE | |
579 | _GL_WARN_ON_USE (wmemmove, "wmemmove is unportable - " | |
580 | "use gnulib module wmemmove for portability"); | |
581 | # endif | |
582 | #endif | |
583 | ||
584 | ||
585 | /* Set N wide characters of S to C. */ | |
586 | #if @GNULIB_WMEMSET@ | |
587 | # if !@HAVE_WMEMSET@ | |
588 | _GL_FUNCDECL_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n)); | |
589 | # endif | |
590 | _GL_CXXALIAS_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n)); | |
c0c3707f | 591 | # if __GLIBC__ >= 2 |
8690e634 | 592 | _GL_CXXALIASWARN (wmemset); |
c0c3707f | 593 | # endif |
8690e634 JK |
594 | #elif defined GNULIB_POSIXCHECK |
595 | # undef wmemset | |
596 | # if HAVE_RAW_DECL_WMEMSET | |
597 | _GL_WARN_ON_USE (wmemset, "wmemset is unportable - " | |
598 | "use gnulib module wmemset for portability"); | |
599 | # endif | |
600 | #endif | |
601 | ||
602 | ||
603 | /* Return the number of wide characters in S. */ | |
604 | #if @GNULIB_WCSLEN@ | |
605 | # if !@HAVE_WCSLEN@ | |
606 | _GL_FUNCDECL_SYS (wcslen, size_t, (const wchar_t *s) _GL_ATTRIBUTE_PURE); | |
607 | # endif | |
608 | _GL_CXXALIAS_SYS (wcslen, size_t, (const wchar_t *s)); | |
c0c3707f | 609 | # if __GLIBC__ >= 2 |
8690e634 | 610 | _GL_CXXALIASWARN (wcslen); |
c0c3707f | 611 | # endif |
8690e634 JK |
612 | #elif defined GNULIB_POSIXCHECK |
613 | # undef wcslen | |
614 | # if HAVE_RAW_DECL_WCSLEN | |
615 | _GL_WARN_ON_USE (wcslen, "wcslen is unportable - " | |
616 | "use gnulib module wcslen for portability"); | |
617 | # endif | |
618 | #endif | |
619 | ||
620 | ||
621 | /* Return the number of wide characters in S, but at most MAXLEN. */ | |
622 | #if @GNULIB_WCSNLEN@ | |
623 | # if !@HAVE_WCSNLEN@ | |
624 | _GL_FUNCDECL_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen) | |
625 | _GL_ATTRIBUTE_PURE); | |
626 | # endif | |
627 | _GL_CXXALIAS_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen)); | |
628 | _GL_CXXALIASWARN (wcsnlen); | |
629 | #elif defined GNULIB_POSIXCHECK | |
630 | # undef wcsnlen | |
631 | # if HAVE_RAW_DECL_WCSNLEN | |
632 | _GL_WARN_ON_USE (wcsnlen, "wcsnlen is unportable - " | |
633 | "use gnulib module wcsnlen for portability"); | |
634 | # endif | |
635 | #endif | |
636 | ||
637 | ||
638 | /* Copy SRC to DEST. */ | |
639 | #if @GNULIB_WCSCPY@ | |
640 | # if !@HAVE_WCSCPY@ | |
641 | _GL_FUNCDECL_SYS (wcscpy, wchar_t *, (wchar_t *dest, const wchar_t *src)); | |
642 | # endif | |
643 | _GL_CXXALIAS_SYS (wcscpy, wchar_t *, (wchar_t *dest, const wchar_t *src)); | |
c0c3707f | 644 | # if __GLIBC__ >= 2 |
8690e634 | 645 | _GL_CXXALIASWARN (wcscpy); |
c0c3707f | 646 | # endif |
8690e634 JK |
647 | #elif defined GNULIB_POSIXCHECK |
648 | # undef wcscpy | |
649 | # if HAVE_RAW_DECL_WCSCPY | |
650 | _GL_WARN_ON_USE (wcscpy, "wcscpy is unportable - " | |
651 | "use gnulib module wcscpy for portability"); | |
652 | # endif | |
653 | #endif | |
654 | ||
655 | ||
656 | /* Copy SRC to DEST, returning the address of the terminating L'\0' in DEST. */ | |
657 | #if @GNULIB_WCPCPY@ | |
658 | # if !@HAVE_WCPCPY@ | |
659 | _GL_FUNCDECL_SYS (wcpcpy, wchar_t *, (wchar_t *dest, const wchar_t *src)); | |
660 | # endif | |
661 | _GL_CXXALIAS_SYS (wcpcpy, wchar_t *, (wchar_t *dest, const wchar_t *src)); | |
662 | _GL_CXXALIASWARN (wcpcpy); | |
663 | #elif defined GNULIB_POSIXCHECK | |
664 | # undef wcpcpy | |
665 | # if HAVE_RAW_DECL_WCPCPY | |
666 | _GL_WARN_ON_USE (wcpcpy, "wcpcpy is unportable - " | |
667 | "use gnulib module wcpcpy for portability"); | |
668 | # endif | |
669 | #endif | |
670 | ||
671 | ||
672 | /* Copy no more than N wide characters of SRC to DEST. */ | |
673 | #if @GNULIB_WCSNCPY@ | |
674 | # if !@HAVE_WCSNCPY@ | |
675 | _GL_FUNCDECL_SYS (wcsncpy, wchar_t *, | |
676 | (wchar_t *dest, const wchar_t *src, size_t n)); | |
677 | # endif | |
678 | _GL_CXXALIAS_SYS (wcsncpy, wchar_t *, | |
679 | (wchar_t *dest, const wchar_t *src, size_t n)); | |
c0c3707f | 680 | # if __GLIBC__ >= 2 |
8690e634 | 681 | _GL_CXXALIASWARN (wcsncpy); |
c0c3707f | 682 | # endif |
8690e634 JK |
683 | #elif defined GNULIB_POSIXCHECK |
684 | # undef wcsncpy | |
685 | # if HAVE_RAW_DECL_WCSNCPY | |
686 | _GL_WARN_ON_USE (wcsncpy, "wcsncpy is unportable - " | |
687 | "use gnulib module wcsncpy for portability"); | |
688 | # endif | |
689 | #endif | |
690 | ||
691 | ||
692 | /* Copy no more than N characters of SRC to DEST, returning the address of | |
693 | the last character written into DEST. */ | |
694 | #if @GNULIB_WCPNCPY@ | |
695 | # if !@HAVE_WCPNCPY@ | |
696 | _GL_FUNCDECL_SYS (wcpncpy, wchar_t *, | |
697 | (wchar_t *dest, const wchar_t *src, size_t n)); | |
698 | # endif | |
699 | _GL_CXXALIAS_SYS (wcpncpy, wchar_t *, | |
700 | (wchar_t *dest, const wchar_t *src, size_t n)); | |
701 | _GL_CXXALIASWARN (wcpncpy); | |
702 | #elif defined GNULIB_POSIXCHECK | |
703 | # undef wcpncpy | |
704 | # if HAVE_RAW_DECL_WCPNCPY | |
705 | _GL_WARN_ON_USE (wcpncpy, "wcpncpy is unportable - " | |
706 | "use gnulib module wcpncpy for portability"); | |
707 | # endif | |
708 | #endif | |
709 | ||
710 | ||
711 | /* Append SRC onto DEST. */ | |
712 | #if @GNULIB_WCSCAT@ | |
713 | # if !@HAVE_WCSCAT@ | |
714 | _GL_FUNCDECL_SYS (wcscat, wchar_t *, (wchar_t *dest, const wchar_t *src)); | |
715 | # endif | |
716 | _GL_CXXALIAS_SYS (wcscat, wchar_t *, (wchar_t *dest, const wchar_t *src)); | |
c0c3707f | 717 | # if __GLIBC__ >= 2 |
8690e634 | 718 | _GL_CXXALIASWARN (wcscat); |
c0c3707f | 719 | # endif |
8690e634 JK |
720 | #elif defined GNULIB_POSIXCHECK |
721 | # undef wcscat | |
722 | # if HAVE_RAW_DECL_WCSCAT | |
723 | _GL_WARN_ON_USE (wcscat, "wcscat is unportable - " | |
724 | "use gnulib module wcscat for portability"); | |
725 | # endif | |
726 | #endif | |
727 | ||
728 | ||
729 | /* Append no more than N wide characters of SRC onto DEST. */ | |
730 | #if @GNULIB_WCSNCAT@ | |
731 | # if !@HAVE_WCSNCAT@ | |
732 | _GL_FUNCDECL_SYS (wcsncat, wchar_t *, | |
733 | (wchar_t *dest, const wchar_t *src, size_t n)); | |
734 | # endif | |
735 | _GL_CXXALIAS_SYS (wcsncat, wchar_t *, | |
736 | (wchar_t *dest, const wchar_t *src, size_t n)); | |
c0c3707f | 737 | # if __GLIBC__ >= 2 |
8690e634 | 738 | _GL_CXXALIASWARN (wcsncat); |
c0c3707f | 739 | # endif |
8690e634 JK |
740 | #elif defined GNULIB_POSIXCHECK |
741 | # undef wcsncat | |
742 | # if HAVE_RAW_DECL_WCSNCAT | |
743 | _GL_WARN_ON_USE (wcsncat, "wcsncat is unportable - " | |
744 | "use gnulib module wcsncat for portability"); | |
745 | # endif | |
746 | #endif | |
747 | ||
748 | ||
749 | /* Compare S1 and S2. */ | |
750 | #if @GNULIB_WCSCMP@ | |
751 | # if !@HAVE_WCSCMP@ | |
752 | _GL_FUNCDECL_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2) | |
753 | _GL_ATTRIBUTE_PURE); | |
754 | # endif | |
755 | _GL_CXXALIAS_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2)); | |
c0c3707f | 756 | # if __GLIBC__ >= 2 |
8690e634 | 757 | _GL_CXXALIASWARN (wcscmp); |
c0c3707f | 758 | # endif |
8690e634 JK |
759 | #elif defined GNULIB_POSIXCHECK |
760 | # undef wcscmp | |
761 | # if HAVE_RAW_DECL_WCSCMP | |
762 | _GL_WARN_ON_USE (wcscmp, "wcscmp is unportable - " | |
763 | "use gnulib module wcscmp for portability"); | |
764 | # endif | |
765 | #endif | |
766 | ||
767 | ||
768 | /* Compare no more than N wide characters of S1 and S2. */ | |
769 | #if @GNULIB_WCSNCMP@ | |
770 | # if !@HAVE_WCSNCMP@ | |
771 | _GL_FUNCDECL_SYS (wcsncmp, int, | |
772 | (const wchar_t *s1, const wchar_t *s2, size_t n) | |
773 | _GL_ATTRIBUTE_PURE); | |
774 | # endif | |
775 | _GL_CXXALIAS_SYS (wcsncmp, int, | |
776 | (const wchar_t *s1, const wchar_t *s2, size_t n)); | |
c0c3707f | 777 | # if __GLIBC__ >= 2 |
8690e634 | 778 | _GL_CXXALIASWARN (wcsncmp); |
c0c3707f | 779 | # endif |
8690e634 JK |
780 | #elif defined GNULIB_POSIXCHECK |
781 | # undef wcsncmp | |
782 | # if HAVE_RAW_DECL_WCSNCMP | |
783 | _GL_WARN_ON_USE (wcsncmp, "wcsncmp is unportable - " | |
784 | "use gnulib module wcsncmp for portability"); | |
785 | # endif | |
786 | #endif | |
787 | ||
788 | ||
789 | /* Compare S1 and S2, ignoring case. */ | |
790 | #if @GNULIB_WCSCASECMP@ | |
791 | # if !@HAVE_WCSCASECMP@ | |
792 | _GL_FUNCDECL_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2) | |
793 | _GL_ATTRIBUTE_PURE); | |
794 | # endif | |
795 | _GL_CXXALIAS_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2)); | |
796 | _GL_CXXALIASWARN (wcscasecmp); | |
797 | #elif defined GNULIB_POSIXCHECK | |
798 | # undef wcscasecmp | |
799 | # if HAVE_RAW_DECL_WCSCASECMP | |
800 | _GL_WARN_ON_USE (wcscasecmp, "wcscasecmp is unportable - " | |
801 | "use gnulib module wcscasecmp for portability"); | |
802 | # endif | |
803 | #endif | |
804 | ||
805 | ||
806 | /* Compare no more than N chars of S1 and S2, ignoring case. */ | |
807 | #if @GNULIB_WCSNCASECMP@ | |
808 | # if !@HAVE_WCSNCASECMP@ | |
809 | _GL_FUNCDECL_SYS (wcsncasecmp, int, | |
810 | (const wchar_t *s1, const wchar_t *s2, size_t n) | |
811 | _GL_ATTRIBUTE_PURE); | |
812 | # endif | |
813 | _GL_CXXALIAS_SYS (wcsncasecmp, int, | |
814 | (const wchar_t *s1, const wchar_t *s2, size_t n)); | |
815 | _GL_CXXALIASWARN (wcsncasecmp); | |
816 | #elif defined GNULIB_POSIXCHECK | |
817 | # undef wcsncasecmp | |
818 | # if HAVE_RAW_DECL_WCSNCASECMP | |
819 | _GL_WARN_ON_USE (wcsncasecmp, "wcsncasecmp is unportable - " | |
820 | "use gnulib module wcsncasecmp for portability"); | |
821 | # endif | |
822 | #endif | |
823 | ||
824 | ||
825 | /* Compare S1 and S2, both interpreted as appropriate to the LC_COLLATE | |
826 | category of the current locale. */ | |
827 | #if @GNULIB_WCSCOLL@ | |
828 | # if !@HAVE_WCSCOLL@ | |
829 | _GL_FUNCDECL_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2)); | |
830 | # endif | |
831 | _GL_CXXALIAS_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2)); | |
c0c3707f | 832 | # if __GLIBC__ >= 2 |
8690e634 | 833 | _GL_CXXALIASWARN (wcscoll); |
c0c3707f | 834 | # endif |
8690e634 JK |
835 | #elif defined GNULIB_POSIXCHECK |
836 | # undef wcscoll | |
837 | # if HAVE_RAW_DECL_WCSCOLL | |
838 | _GL_WARN_ON_USE (wcscoll, "wcscoll is unportable - " | |
839 | "use gnulib module wcscoll for portability"); | |
840 | # endif | |
841 | #endif | |
842 | ||
843 | ||
844 | /* Transform S2 into array pointed to by S1 such that if wcscmp is applied | |
845 | to two transformed strings the result is the as applying 'wcscoll' to the | |
846 | original strings. */ | |
847 | #if @GNULIB_WCSXFRM@ | |
848 | # if !@HAVE_WCSXFRM@ | |
849 | _GL_FUNCDECL_SYS (wcsxfrm, size_t, (wchar_t *s1, const wchar_t *s2, size_t n)); | |
850 | # endif | |
851 | _GL_CXXALIAS_SYS (wcsxfrm, size_t, (wchar_t *s1, const wchar_t *s2, size_t n)); | |
c0c3707f | 852 | # if __GLIBC__ >= 2 |
8690e634 | 853 | _GL_CXXALIASWARN (wcsxfrm); |
c0c3707f | 854 | # endif |
8690e634 JK |
855 | #elif defined GNULIB_POSIXCHECK |
856 | # undef wcsxfrm | |
857 | # if HAVE_RAW_DECL_WCSXFRM | |
858 | _GL_WARN_ON_USE (wcsxfrm, "wcsxfrm is unportable - " | |
859 | "use gnulib module wcsxfrm for portability"); | |
860 | # endif | |
861 | #endif | |
862 | ||
863 | ||
864 | /* Duplicate S, returning an identical malloc'd string. */ | |
865 | #if @GNULIB_WCSDUP@ | |
866 | # if !@HAVE_WCSDUP@ | |
867 | _GL_FUNCDECL_SYS (wcsdup, wchar_t *, (const wchar_t *s)); | |
868 | # endif | |
869 | _GL_CXXALIAS_SYS (wcsdup, wchar_t *, (const wchar_t *s)); | |
870 | _GL_CXXALIASWARN (wcsdup); | |
871 | #elif defined GNULIB_POSIXCHECK | |
872 | # undef wcsdup | |
873 | # if HAVE_RAW_DECL_WCSDUP | |
874 | _GL_WARN_ON_USE (wcsdup, "wcsdup is unportable - " | |
875 | "use gnulib module wcsdup for portability"); | |
876 | # endif | |
877 | #endif | |
878 | ||
879 | ||
880 | /* Find the first occurrence of WC in WCS. */ | |
881 | #if @GNULIB_WCSCHR@ | |
882 | # if !@HAVE_WCSCHR@ | |
883 | _GL_FUNCDECL_SYS (wcschr, wchar_t *, (const wchar_t *wcs, wchar_t wc) | |
884 | _GL_ATTRIBUTE_PURE); | |
885 | # endif | |
886 | /* On some systems, this function is defined as an overloaded function: | |
887 | extern "C++" { | |
888 | const wchar_t * std::wcschr (const wchar_t *, wchar_t); | |
889 | wchar_t * std::wcschr (wchar_t *, wchar_t); | |
890 | } */ | |
891 | _GL_CXXALIAS_SYS_CAST2 (wcschr, | |
892 | wchar_t *, (const wchar_t *, wchar_t), | |
893 | const wchar_t *, (const wchar_t *, wchar_t)); | |
894 | # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ | |
895 | && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) | |
896 | _GL_CXXALIASWARN1 (wcschr, wchar_t *, (wchar_t *wcs, wchar_t wc)); | |
897 | _GL_CXXALIASWARN1 (wcschr, const wchar_t *, (const wchar_t *wcs, wchar_t wc)); | |
c0c3707f | 898 | # elif __GLIBC__ >= 2 |
8690e634 JK |
899 | _GL_CXXALIASWARN (wcschr); |
900 | # endif | |
901 | #elif defined GNULIB_POSIXCHECK | |
902 | # undef wcschr | |
903 | # if HAVE_RAW_DECL_WCSCHR | |
904 | _GL_WARN_ON_USE (wcschr, "wcschr is unportable - " | |
905 | "use gnulib module wcschr for portability"); | |
906 | # endif | |
907 | #endif | |
908 | ||
909 | ||
910 | /* Find the last occurrence of WC in WCS. */ | |
911 | #if @GNULIB_WCSRCHR@ | |
912 | # if !@HAVE_WCSRCHR@ | |
913 | _GL_FUNCDECL_SYS (wcsrchr, wchar_t *, (const wchar_t *wcs, wchar_t wc) | |
914 | _GL_ATTRIBUTE_PURE); | |
915 | # endif | |
916 | /* On some systems, this function is defined as an overloaded function: | |
917 | extern "C++" { | |
918 | const wchar_t * std::wcsrchr (const wchar_t *, wchar_t); | |
919 | wchar_t * std::wcsrchr (wchar_t *, wchar_t); | |
920 | } */ | |
921 | _GL_CXXALIAS_SYS_CAST2 (wcsrchr, | |
922 | wchar_t *, (const wchar_t *, wchar_t), | |
923 | const wchar_t *, (const wchar_t *, wchar_t)); | |
924 | # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ | |
925 | && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) | |
926 | _GL_CXXALIASWARN1 (wcsrchr, wchar_t *, (wchar_t *wcs, wchar_t wc)); | |
927 | _GL_CXXALIASWARN1 (wcsrchr, const wchar_t *, (const wchar_t *wcs, wchar_t wc)); | |
c0c3707f | 928 | # elif __GLIBC__ >= 2 |
8690e634 JK |
929 | _GL_CXXALIASWARN (wcsrchr); |
930 | # endif | |
931 | #elif defined GNULIB_POSIXCHECK | |
932 | # undef wcsrchr | |
933 | # if HAVE_RAW_DECL_WCSRCHR | |
934 | _GL_WARN_ON_USE (wcsrchr, "wcsrchr is unportable - " | |
935 | "use gnulib module wcsrchr for portability"); | |
936 | # endif | |
937 | #endif | |
938 | ||
939 | ||
940 | /* Return the length of the initial segmet of WCS which consists entirely | |
941 | of wide characters not in REJECT. */ | |
942 | #if @GNULIB_WCSCSPN@ | |
943 | # if !@HAVE_WCSCSPN@ | |
944 | _GL_FUNCDECL_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject) | |
945 | _GL_ATTRIBUTE_PURE); | |
946 | # endif | |
947 | _GL_CXXALIAS_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject)); | |
c0c3707f | 948 | # if __GLIBC__ >= 2 |
8690e634 | 949 | _GL_CXXALIASWARN (wcscspn); |
c0c3707f | 950 | # endif |
8690e634 JK |
951 | #elif defined GNULIB_POSIXCHECK |
952 | # undef wcscspn | |
953 | # if HAVE_RAW_DECL_WCSCSPN | |
954 | _GL_WARN_ON_USE (wcscspn, "wcscspn is unportable - " | |
955 | "use gnulib module wcscspn for portability"); | |
956 | # endif | |
957 | #endif | |
958 | ||
959 | ||
960 | /* Return the length of the initial segmet of WCS which consists entirely | |
961 | of wide characters in ACCEPT. */ | |
962 | #if @GNULIB_WCSSPN@ | |
963 | # if !@HAVE_WCSSPN@ | |
964 | _GL_FUNCDECL_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept) | |
965 | _GL_ATTRIBUTE_PURE); | |
966 | # endif | |
967 | _GL_CXXALIAS_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept)); | |
c0c3707f | 968 | # if __GLIBC__ >= 2 |
8690e634 | 969 | _GL_CXXALIASWARN (wcsspn); |
c0c3707f | 970 | # endif |
8690e634 JK |
971 | #elif defined GNULIB_POSIXCHECK |
972 | # undef wcsspn | |
973 | # if HAVE_RAW_DECL_WCSSPN | |
974 | _GL_WARN_ON_USE (wcsspn, "wcsspn is unportable - " | |
975 | "use gnulib module wcsspn for portability"); | |
976 | # endif | |
977 | #endif | |
978 | ||
979 | ||
980 | /* Find the first occurrence in WCS of any character in ACCEPT. */ | |
981 | #if @GNULIB_WCSPBRK@ | |
982 | # if !@HAVE_WCSPBRK@ | |
983 | _GL_FUNCDECL_SYS (wcspbrk, wchar_t *, | |
984 | (const wchar_t *wcs, const wchar_t *accept) | |
985 | _GL_ATTRIBUTE_PURE); | |
986 | # endif | |
987 | /* On some systems, this function is defined as an overloaded function: | |
988 | extern "C++" { | |
989 | const wchar_t * std::wcspbrk (const wchar_t *, const wchar_t *); | |
990 | wchar_t * std::wcspbrk (wchar_t *, const wchar_t *); | |
991 | } */ | |
992 | _GL_CXXALIAS_SYS_CAST2 (wcspbrk, | |
993 | wchar_t *, (const wchar_t *, const wchar_t *), | |
994 | const wchar_t *, (const wchar_t *, const wchar_t *)); | |
995 | # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ | |
996 | && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) | |
997 | _GL_CXXALIASWARN1 (wcspbrk, wchar_t *, | |
998 | (wchar_t *wcs, const wchar_t *accept)); | |
999 | _GL_CXXALIASWARN1 (wcspbrk, const wchar_t *, | |
1000 | (const wchar_t *wcs, const wchar_t *accept)); | |
c0c3707f | 1001 | # elif __GLIBC__ >= 2 |
8690e634 JK |
1002 | _GL_CXXALIASWARN (wcspbrk); |
1003 | # endif | |
1004 | #elif defined GNULIB_POSIXCHECK | |
1005 | # undef wcspbrk | |
1006 | # if HAVE_RAW_DECL_WCSPBRK | |
1007 | _GL_WARN_ON_USE (wcspbrk, "wcspbrk is unportable - " | |
1008 | "use gnulib module wcspbrk for portability"); | |
1009 | # endif | |
1010 | #endif | |
1011 | ||
1012 | ||
1013 | /* Find the first occurrence of NEEDLE in HAYSTACK. */ | |
1014 | #if @GNULIB_WCSSTR@ | |
1015 | # if !@HAVE_WCSSTR@ | |
1016 | _GL_FUNCDECL_SYS (wcsstr, wchar_t *, | |
1017 | (const wchar_t *haystack, const wchar_t *needle) | |
1018 | _GL_ATTRIBUTE_PURE); | |
1019 | # endif | |
1020 | /* On some systems, this function is defined as an overloaded function: | |
1021 | extern "C++" { | |
1022 | const wchar_t * std::wcsstr (const wchar_t *, const wchar_t *); | |
1023 | wchar_t * std::wcsstr (wchar_t *, const wchar_t *); | |
1024 | } */ | |
1025 | _GL_CXXALIAS_SYS_CAST2 (wcsstr, | |
1026 | wchar_t *, (const wchar_t *, const wchar_t *), | |
1027 | const wchar_t *, (const wchar_t *, const wchar_t *)); | |
1028 | # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ | |
1029 | && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) | |
1030 | _GL_CXXALIASWARN1 (wcsstr, wchar_t *, | |
1031 | (wchar_t *haystack, const wchar_t *needle)); | |
1032 | _GL_CXXALIASWARN1 (wcsstr, const wchar_t *, | |
1033 | (const wchar_t *haystack, const wchar_t *needle)); | |
c0c3707f | 1034 | # elif __GLIBC__ >= 2 |
8690e634 JK |
1035 | _GL_CXXALIASWARN (wcsstr); |
1036 | # endif | |
1037 | #elif defined GNULIB_POSIXCHECK | |
1038 | # undef wcsstr | |
1039 | # if HAVE_RAW_DECL_WCSSTR | |
1040 | _GL_WARN_ON_USE (wcsstr, "wcsstr is unportable - " | |
1041 | "use gnulib module wcsstr for portability"); | |
1042 | # endif | |
1043 | #endif | |
1044 | ||
1045 | ||
1046 | /* Divide WCS into tokens separated by characters in DELIM. */ | |
1047 | #if @GNULIB_WCSTOK@ | |
c0c3707f CB |
1048 | # if @REPLACE_WCSTOK@ |
1049 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
1050 | # undef wcstok | |
1051 | # define wcstok rpl_wcstok | |
1052 | # endif | |
1053 | _GL_FUNCDECL_RPL (wcstok, wchar_t *, | |
1054 | (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr)); | |
1055 | _GL_CXXALIAS_RPL (wcstok, wchar_t *, | |
1056 | (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr)); | |
1057 | # else | |
1058 | # if !@HAVE_WCSTOK@ | |
8690e634 JK |
1059 | _GL_FUNCDECL_SYS (wcstok, wchar_t *, |
1060 | (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr)); | |
c0c3707f | 1061 | # endif |
8690e634 JK |
1062 | _GL_CXXALIAS_SYS (wcstok, wchar_t *, |
1063 | (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr)); | |
c0c3707f CB |
1064 | # endif |
1065 | # if __GLIBC__ >= 2 | |
8690e634 | 1066 | _GL_CXXALIASWARN (wcstok); |
c0c3707f | 1067 | # endif |
8690e634 JK |
1068 | #elif defined GNULIB_POSIXCHECK |
1069 | # undef wcstok | |
1070 | # if HAVE_RAW_DECL_WCSTOK | |
1071 | _GL_WARN_ON_USE (wcstok, "wcstok is unportable - " | |
1072 | "use gnulib module wcstok for portability"); | |
1073 | # endif | |
1074 | #endif | |
1075 | ||
1076 | ||
1077 | /* Determine number of column positions required for first N wide | |
1078 | characters (or fewer if S ends before this) in S. */ | |
1079 | #if @GNULIB_WCSWIDTH@ | |
1080 | # if @REPLACE_WCSWIDTH@ | |
1081 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
1082 | # undef wcswidth | |
1083 | # define wcswidth rpl_wcswidth | |
1084 | # endif | |
1085 | _GL_FUNCDECL_RPL (wcswidth, int, (const wchar_t *s, size_t n) | |
1086 | _GL_ATTRIBUTE_PURE); | |
1087 | _GL_CXXALIAS_RPL (wcswidth, int, (const wchar_t *s, size_t n)); | |
1088 | # else | |
1089 | # if !@HAVE_WCSWIDTH@ | |
1090 | _GL_FUNCDECL_SYS (wcswidth, int, (const wchar_t *s, size_t n) | |
1091 | _GL_ATTRIBUTE_PURE); | |
1092 | # endif | |
1093 | _GL_CXXALIAS_SYS (wcswidth, int, (const wchar_t *s, size_t n)); | |
1094 | # endif | |
c0c3707f | 1095 | # if __GLIBC__ >= 2 |
8690e634 | 1096 | _GL_CXXALIASWARN (wcswidth); |
c0c3707f | 1097 | # endif |
8690e634 JK |
1098 | #elif defined GNULIB_POSIXCHECK |
1099 | # undef wcswidth | |
1100 | # if HAVE_RAW_DECL_WCSWIDTH | |
1101 | _GL_WARN_ON_USE (wcswidth, "wcswidth is unportable - " | |
1102 | "use gnulib module wcswidth for portability"); | |
1103 | # endif | |
1104 | #endif | |
1105 | ||
1106 | ||
c0c3707f CB |
1107 | /* Convert *TP to a date and time wide string. See |
1108 | <https://pubs.opengroup.org/onlinepubs/9699919799/functions/wcsftime.html>. */ | |
1109 | #if @GNULIB_WCSFTIME@ | |
1110 | # if @REPLACE_WCSFTIME@ | |
1111 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
1112 | # undef wcsftime | |
1113 | # define wcsftime rpl_wcsftime | |
1114 | # endif | |
1115 | _GL_FUNCDECL_RPL (wcsftime, size_t, (wchar_t *__buf, size_t __bufsize, | |
1116 | const wchar_t *__fmt, const struct tm *__tp) | |
1117 | _GL_ARG_NONNULL ((1, 3, 4))); | |
1118 | _GL_CXXALIAS_RPL (wcsftime, size_t, (wchar_t *__buf, size_t __bufsize, | |
1119 | const wchar_t *__fmt, const struct tm *__tp)); | |
1120 | # else | |
1121 | # if !@HAVE_WCSFTIME@ | |
1122 | _GL_FUNCDECL_SYS (wcsftime, size_t, (wchar_t *__buf, size_t __bufsize, | |
1123 | const wchar_t *__fmt, const struct tm *__tp) | |
1124 | _GL_ARG_NONNULL ((1, 3, 4))); | |
1125 | # endif | |
1126 | _GL_CXXALIAS_SYS (wcsftime, size_t, (wchar_t *__buf, size_t __bufsize, | |
1127 | const wchar_t *__fmt, const struct tm *__tp)); | |
1128 | # endif | |
1129 | # if __GLIBC__ >= 2 | |
1130 | _GL_CXXALIASWARN (wcsftime); | |
1131 | # endif | |
1132 | #elif defined GNULIB_POSIXCHECK | |
1133 | # undef wcsftime | |
1134 | # if HAVE_RAW_DECL_WCSFTIME | |
1135 | _GL_WARN_ON_USE (wcsftime, "wcsftime is unportable - " | |
1136 | "use gnulib module wcsftime for portability"); | |
1137 | # endif | |
1138 | #endif | |
1139 | ||
1140 | ||
8690e634 JK |
1141 | #endif /* _@GUARD_PREFIX@_WCHAR_H */ |
1142 | #endif /* _@GUARD_PREFIX@_WCHAR_H */ | |
1143 | #endif |