Commit | Line | Data |
---|---|---|
8690e634 JK |
1 | /* A substitute for ISO C99 <wchar.h>, for platforms that have issues. |
2 | ||
5e8754f9 | 3 | Copyright (C) 2007-2016 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 | |
5e8754f9 | 16 | along with this program; if not, see <http://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. | |
22 | * <http://www.opengroup.org/susv3xbd/wchar.h.html> | |
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) \ |
5e8754f9 | 34 | && !defined __MINGW32__ && !defined __KLIBC__) \ |
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 | |
5e8754f9 SDJ |
116 | /* MSVC defines wint_t as 'unsigned short' in <crtdefs.h>. |
117 | This is too small: ISO C 99 section 7.24.1.(2) says that wint_t must be | |
118 | "unchanged by default argument promotions". Override it. */ | |
119 | # if defined _MSC_VER | |
8690e634 | 120 | # if !GNULIB_defined_wint_t |
5e8754f9 | 121 | # include <crtdefs.h> |
8690e634 JK |
122 | typedef unsigned int rpl_wint_t; |
123 | # undef wint_t | |
124 | # define wint_t rpl_wint_t | |
125 | # define GNULIB_defined_wint_t 1 | |
126 | # endif | |
127 | # endif | |
128 | # ifndef WEOF | |
129 | # define WEOF ((wint_t) -1) | |
130 | # endif | |
131 | #endif | |
132 | ||
133 | ||
134 | /* Override mbstate_t if it is too small. | |
135 | On IRIX 6.5, sizeof (mbstate_t) == 1, which is not sufficient for | |
136 | implementing mbrtowc for encodings like UTF-8. */ | |
137 | #if !(@HAVE_MBSINIT@ && @HAVE_MBRTOWC@) || @REPLACE_MBSTATE_T@ | |
138 | # if !GNULIB_defined_mbstate_t | |
139 | typedef int rpl_mbstate_t; | |
140 | # undef mbstate_t | |
141 | # define mbstate_t rpl_mbstate_t | |
142 | # define GNULIB_defined_mbstate_t 1 | |
143 | # endif | |
144 | #endif | |
145 | ||
146 | ||
147 | /* Convert a single-byte character to a wide character. */ | |
148 | #if @GNULIB_BTOWC@ | |
149 | # if @REPLACE_BTOWC@ | |
150 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
151 | # undef btowc | |
152 | # define btowc rpl_btowc | |
153 | # endif | |
154 | _GL_FUNCDECL_RPL (btowc, wint_t, (int c) _GL_ATTRIBUTE_PURE); | |
155 | _GL_CXXALIAS_RPL (btowc, wint_t, (int c)); | |
156 | # else | |
157 | # if !@HAVE_BTOWC@ | |
158 | _GL_FUNCDECL_SYS (btowc, wint_t, (int c) _GL_ATTRIBUTE_PURE); | |
159 | # endif | |
160 | _GL_CXXALIAS_SYS (btowc, wint_t, (int c)); | |
161 | # endif | |
162 | _GL_CXXALIASWARN (btowc); | |
163 | #elif defined GNULIB_POSIXCHECK | |
164 | # undef btowc | |
165 | # if HAVE_RAW_DECL_BTOWC | |
166 | _GL_WARN_ON_USE (btowc, "btowc is unportable - " | |
167 | "use gnulib module btowc for portability"); | |
168 | # endif | |
169 | #endif | |
170 | ||
171 | ||
172 | /* Convert a wide character to a single-byte character. */ | |
173 | #if @GNULIB_WCTOB@ | |
174 | # if @REPLACE_WCTOB@ | |
175 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
176 | # undef wctob | |
177 | # define wctob rpl_wctob | |
178 | # endif | |
179 | _GL_FUNCDECL_RPL (wctob, int, (wint_t wc) _GL_ATTRIBUTE_PURE); | |
180 | _GL_CXXALIAS_RPL (wctob, int, (wint_t wc)); | |
181 | # else | |
182 | # if !defined wctob && !@HAVE_DECL_WCTOB@ | |
183 | /* wctob is provided by gnulib, or wctob exists but is not declared. */ | |
184 | _GL_FUNCDECL_SYS (wctob, int, (wint_t wc) _GL_ATTRIBUTE_PURE); | |
185 | # endif | |
186 | _GL_CXXALIAS_SYS (wctob, int, (wint_t wc)); | |
187 | # endif | |
188 | _GL_CXXALIASWARN (wctob); | |
189 | #elif defined GNULIB_POSIXCHECK | |
190 | # undef wctob | |
191 | # if HAVE_RAW_DECL_WCTOB | |
192 | _GL_WARN_ON_USE (wctob, "wctob is unportable - " | |
193 | "use gnulib module wctob for portability"); | |
194 | # endif | |
195 | #endif | |
196 | ||
197 | ||
198 | /* Test whether *PS is in the initial state. */ | |
199 | #if @GNULIB_MBSINIT@ | |
200 | # if @REPLACE_MBSINIT@ | |
201 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
202 | # undef mbsinit | |
203 | # define mbsinit rpl_mbsinit | |
204 | # endif | |
205 | _GL_FUNCDECL_RPL (mbsinit, int, (const mbstate_t *ps)); | |
206 | _GL_CXXALIAS_RPL (mbsinit, int, (const mbstate_t *ps)); | |
207 | # else | |
208 | # if !@HAVE_MBSINIT@ | |
209 | _GL_FUNCDECL_SYS (mbsinit, int, (const mbstate_t *ps)); | |
210 | # endif | |
211 | _GL_CXXALIAS_SYS (mbsinit, int, (const mbstate_t *ps)); | |
212 | # endif | |
213 | _GL_CXXALIASWARN (mbsinit); | |
214 | #elif defined GNULIB_POSIXCHECK | |
215 | # undef mbsinit | |
216 | # if HAVE_RAW_DECL_MBSINIT | |
217 | _GL_WARN_ON_USE (mbsinit, "mbsinit is unportable - " | |
218 | "use gnulib module mbsinit for portability"); | |
219 | # endif | |
220 | #endif | |
221 | ||
222 | ||
223 | /* Convert a multibyte character to a wide character. */ | |
224 | #if @GNULIB_MBRTOWC@ | |
225 | # if @REPLACE_MBRTOWC@ | |
226 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
227 | # undef mbrtowc | |
228 | # define mbrtowc rpl_mbrtowc | |
229 | # endif | |
230 | _GL_FUNCDECL_RPL (mbrtowc, size_t, | |
231 | (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)); | |
232 | _GL_CXXALIAS_RPL (mbrtowc, size_t, | |
233 | (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)); | |
234 | # else | |
235 | # if !@HAVE_MBRTOWC@ | |
236 | _GL_FUNCDECL_SYS (mbrtowc, size_t, | |
237 | (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)); | |
238 | # endif | |
239 | _GL_CXXALIAS_SYS (mbrtowc, size_t, | |
240 | (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)); | |
241 | # endif | |
242 | _GL_CXXALIASWARN (mbrtowc); | |
243 | #elif defined GNULIB_POSIXCHECK | |
244 | # undef mbrtowc | |
245 | # if HAVE_RAW_DECL_MBRTOWC | |
246 | _GL_WARN_ON_USE (mbrtowc, "mbrtowc is unportable - " | |
247 | "use gnulib module mbrtowc for portability"); | |
248 | # endif | |
249 | #endif | |
250 | ||
251 | ||
252 | /* Recognize a multibyte character. */ | |
253 | #if @GNULIB_MBRLEN@ | |
254 | # if @REPLACE_MBRLEN@ | |
255 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
256 | # undef mbrlen | |
257 | # define mbrlen rpl_mbrlen | |
258 | # endif | |
259 | _GL_FUNCDECL_RPL (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps)); | |
260 | _GL_CXXALIAS_RPL (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps)); | |
261 | # else | |
262 | # if !@HAVE_MBRLEN@ | |
263 | _GL_FUNCDECL_SYS (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps)); | |
264 | # endif | |
265 | _GL_CXXALIAS_SYS (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps)); | |
266 | # endif | |
267 | _GL_CXXALIASWARN (mbrlen); | |
268 | #elif defined GNULIB_POSIXCHECK | |
269 | # undef mbrlen | |
270 | # if HAVE_RAW_DECL_MBRLEN | |
271 | _GL_WARN_ON_USE (mbrlen, "mbrlen is unportable - " | |
272 | "use gnulib module mbrlen for portability"); | |
273 | # endif | |
274 | #endif | |
275 | ||
276 | ||
277 | /* Convert a string to a wide string. */ | |
278 | #if @GNULIB_MBSRTOWCS@ | |
279 | # if @REPLACE_MBSRTOWCS@ | |
280 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
281 | # undef mbsrtowcs | |
282 | # define mbsrtowcs rpl_mbsrtowcs | |
283 | # endif | |
284 | _GL_FUNCDECL_RPL (mbsrtowcs, size_t, | |
285 | (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps) | |
286 | _GL_ARG_NONNULL ((2))); | |
287 | _GL_CXXALIAS_RPL (mbsrtowcs, size_t, | |
288 | (wchar_t *dest, const char **srcp, size_t len, | |
289 | mbstate_t *ps)); | |
290 | # else | |
291 | # if !@HAVE_MBSRTOWCS@ | |
292 | _GL_FUNCDECL_SYS (mbsrtowcs, size_t, | |
293 | (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps) | |
294 | _GL_ARG_NONNULL ((2))); | |
295 | # endif | |
296 | _GL_CXXALIAS_SYS (mbsrtowcs, size_t, | |
297 | (wchar_t *dest, const char **srcp, size_t len, | |
298 | mbstate_t *ps)); | |
299 | # endif | |
300 | _GL_CXXALIASWARN (mbsrtowcs); | |
301 | #elif defined GNULIB_POSIXCHECK | |
302 | # undef mbsrtowcs | |
303 | # if HAVE_RAW_DECL_MBSRTOWCS | |
304 | _GL_WARN_ON_USE (mbsrtowcs, "mbsrtowcs is unportable - " | |
305 | "use gnulib module mbsrtowcs for portability"); | |
306 | # endif | |
307 | #endif | |
308 | ||
309 | ||
310 | /* Convert a string to a wide string. */ | |
311 | #if @GNULIB_MBSNRTOWCS@ | |
312 | # if @REPLACE_MBSNRTOWCS@ | |
313 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
314 | # undef mbsnrtowcs | |
315 | # define mbsnrtowcs rpl_mbsnrtowcs | |
316 | # endif | |
317 | _GL_FUNCDECL_RPL (mbsnrtowcs, size_t, | |
318 | (wchar_t *dest, const char **srcp, size_t srclen, size_t len, | |
319 | mbstate_t *ps) | |
320 | _GL_ARG_NONNULL ((2))); | |
321 | _GL_CXXALIAS_RPL (mbsnrtowcs, size_t, | |
322 | (wchar_t *dest, const char **srcp, size_t srclen, size_t len, | |
323 | mbstate_t *ps)); | |
324 | # else | |
325 | # if !@HAVE_MBSNRTOWCS@ | |
326 | _GL_FUNCDECL_SYS (mbsnrtowcs, size_t, | |
327 | (wchar_t *dest, const char **srcp, size_t srclen, size_t len, | |
328 | mbstate_t *ps) | |
329 | _GL_ARG_NONNULL ((2))); | |
330 | # endif | |
331 | _GL_CXXALIAS_SYS (mbsnrtowcs, size_t, | |
332 | (wchar_t *dest, const char **srcp, size_t srclen, size_t len, | |
333 | mbstate_t *ps)); | |
334 | # endif | |
335 | _GL_CXXALIASWARN (mbsnrtowcs); | |
336 | #elif defined GNULIB_POSIXCHECK | |
337 | # undef mbsnrtowcs | |
338 | # if HAVE_RAW_DECL_MBSNRTOWCS | |
339 | _GL_WARN_ON_USE (mbsnrtowcs, "mbsnrtowcs is unportable - " | |
340 | "use gnulib module mbsnrtowcs for portability"); | |
341 | # endif | |
342 | #endif | |
343 | ||
344 | ||
345 | /* Convert a wide character to a multibyte character. */ | |
346 | #if @GNULIB_WCRTOMB@ | |
347 | # if @REPLACE_WCRTOMB@ | |
348 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
349 | # undef wcrtomb | |
350 | # define wcrtomb rpl_wcrtomb | |
351 | # endif | |
352 | _GL_FUNCDECL_RPL (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps)); | |
353 | _GL_CXXALIAS_RPL (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps)); | |
354 | # else | |
355 | # if !@HAVE_WCRTOMB@ | |
356 | _GL_FUNCDECL_SYS (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps)); | |
357 | # endif | |
358 | _GL_CXXALIAS_SYS (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps)); | |
359 | # endif | |
360 | _GL_CXXALIASWARN (wcrtomb); | |
361 | #elif defined GNULIB_POSIXCHECK | |
362 | # undef wcrtomb | |
363 | # if HAVE_RAW_DECL_WCRTOMB | |
364 | _GL_WARN_ON_USE (wcrtomb, "wcrtomb is unportable - " | |
365 | "use gnulib module wcrtomb for portability"); | |
366 | # endif | |
367 | #endif | |
368 | ||
369 | ||
370 | /* Convert a wide string to a string. */ | |
371 | #if @GNULIB_WCSRTOMBS@ | |
372 | # if @REPLACE_WCSRTOMBS@ | |
373 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
374 | # undef wcsrtombs | |
375 | # define wcsrtombs rpl_wcsrtombs | |
376 | # endif | |
377 | _GL_FUNCDECL_RPL (wcsrtombs, size_t, | |
378 | (char *dest, const wchar_t **srcp, size_t len, mbstate_t *ps) | |
379 | _GL_ARG_NONNULL ((2))); | |
380 | _GL_CXXALIAS_RPL (wcsrtombs, size_t, | |
381 | (char *dest, const wchar_t **srcp, size_t len, | |
382 | mbstate_t *ps)); | |
383 | # else | |
384 | # if !@HAVE_WCSRTOMBS@ | |
385 | _GL_FUNCDECL_SYS (wcsrtombs, size_t, | |
386 | (char *dest, const wchar_t **srcp, size_t len, mbstate_t *ps) | |
387 | _GL_ARG_NONNULL ((2))); | |
388 | # endif | |
389 | _GL_CXXALIAS_SYS (wcsrtombs, size_t, | |
390 | (char *dest, const wchar_t **srcp, size_t len, | |
391 | mbstate_t *ps)); | |
392 | # endif | |
393 | _GL_CXXALIASWARN (wcsrtombs); | |
394 | #elif defined GNULIB_POSIXCHECK | |
395 | # undef wcsrtombs | |
396 | # if HAVE_RAW_DECL_WCSRTOMBS | |
397 | _GL_WARN_ON_USE (wcsrtombs, "wcsrtombs is unportable - " | |
398 | "use gnulib module wcsrtombs for portability"); | |
399 | # endif | |
400 | #endif | |
401 | ||
402 | ||
403 | /* Convert a wide string to a string. */ | |
404 | #if @GNULIB_WCSNRTOMBS@ | |
405 | # if @REPLACE_WCSNRTOMBS@ | |
406 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
407 | # undef wcsnrtombs | |
408 | # define wcsnrtombs rpl_wcsnrtombs | |
409 | # endif | |
410 | _GL_FUNCDECL_RPL (wcsnrtombs, size_t, | |
411 | (char *dest, const wchar_t **srcp, size_t srclen, size_t len, | |
412 | mbstate_t *ps) | |
413 | _GL_ARG_NONNULL ((2))); | |
414 | _GL_CXXALIAS_RPL (wcsnrtombs, size_t, | |
415 | (char *dest, const wchar_t **srcp, size_t srclen, size_t len, | |
416 | mbstate_t *ps)); | |
417 | # else | |
418 | # if !@HAVE_WCSNRTOMBS@ | |
419 | _GL_FUNCDECL_SYS (wcsnrtombs, size_t, | |
420 | (char *dest, const wchar_t **srcp, size_t srclen, size_t len, | |
421 | mbstate_t *ps) | |
422 | _GL_ARG_NONNULL ((2))); | |
423 | # endif | |
424 | _GL_CXXALIAS_SYS (wcsnrtombs, size_t, | |
425 | (char *dest, const wchar_t **srcp, size_t srclen, size_t len, | |
426 | mbstate_t *ps)); | |
427 | # endif | |
428 | _GL_CXXALIASWARN (wcsnrtombs); | |
429 | #elif defined GNULIB_POSIXCHECK | |
430 | # undef wcsnrtombs | |
431 | # if HAVE_RAW_DECL_WCSNRTOMBS | |
432 | _GL_WARN_ON_USE (wcsnrtombs, "wcsnrtombs is unportable - " | |
433 | "use gnulib module wcsnrtombs for portability"); | |
434 | # endif | |
435 | #endif | |
436 | ||
437 | ||
438 | /* Return the number of screen columns needed for WC. */ | |
439 | #if @GNULIB_WCWIDTH@ | |
440 | # if @REPLACE_WCWIDTH@ | |
441 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
442 | # undef wcwidth | |
443 | # define wcwidth rpl_wcwidth | |
444 | # endif | |
445 | _GL_FUNCDECL_RPL (wcwidth, int, (wchar_t) _GL_ATTRIBUTE_PURE); | |
446 | _GL_CXXALIAS_RPL (wcwidth, int, (wchar_t)); | |
447 | # else | |
448 | # if !@HAVE_DECL_WCWIDTH@ | |
449 | /* wcwidth exists but is not declared. */ | |
450 | _GL_FUNCDECL_SYS (wcwidth, int, (wchar_t) _GL_ATTRIBUTE_PURE); | |
5e8754f9 SDJ |
451 | # elif defined __KLIBC__ |
452 | /* On OS/2 kLIBC, wcwidth is a macro that expands to the name of a | |
453 | static inline function. The implementation of wcwidth in wcwidth.c | |
454 | causes a "conflicting types" error. */ | |
455 | # undef wcwidth | |
8690e634 JK |
456 | # endif |
457 | _GL_CXXALIAS_SYS (wcwidth, int, (wchar_t)); | |
458 | # endif | |
459 | _GL_CXXALIASWARN (wcwidth); | |
460 | #elif defined GNULIB_POSIXCHECK | |
461 | # undef wcwidth | |
462 | # if HAVE_RAW_DECL_WCWIDTH | |
463 | _GL_WARN_ON_USE (wcwidth, "wcwidth is unportable - " | |
464 | "use gnulib module wcwidth for portability"); | |
465 | # endif | |
466 | #endif | |
467 | ||
468 | ||
469 | /* Search N wide characters of S for C. */ | |
470 | #if @GNULIB_WMEMCHR@ | |
471 | # if !@HAVE_WMEMCHR@ | |
472 | _GL_FUNCDECL_SYS (wmemchr, wchar_t *, (const wchar_t *s, wchar_t c, size_t n) | |
473 | _GL_ATTRIBUTE_PURE); | |
474 | # endif | |
475 | /* On some systems, this function is defined as an overloaded function: | |
476 | extern "C++" { | |
477 | const wchar_t * std::wmemchr (const wchar_t *, wchar_t, size_t); | |
478 | wchar_t * std::wmemchr (wchar_t *, wchar_t, size_t); | |
479 | } */ | |
480 | _GL_CXXALIAS_SYS_CAST2 (wmemchr, | |
481 | wchar_t *, (const wchar_t *, wchar_t, size_t), | |
482 | const wchar_t *, (const wchar_t *, wchar_t, size_t)); | |
483 | # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ | |
484 | && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) | |
485 | _GL_CXXALIASWARN1 (wmemchr, wchar_t *, (wchar_t *s, wchar_t c, size_t n)); | |
486 | _GL_CXXALIASWARN1 (wmemchr, const wchar_t *, | |
487 | (const wchar_t *s, wchar_t c, size_t n)); | |
488 | # else | |
489 | _GL_CXXALIASWARN (wmemchr); | |
490 | # endif | |
491 | #elif defined GNULIB_POSIXCHECK | |
492 | # undef wmemchr | |
493 | # if HAVE_RAW_DECL_WMEMCHR | |
494 | _GL_WARN_ON_USE (wmemchr, "wmemchr is unportable - " | |
495 | "use gnulib module wmemchr for portability"); | |
496 | # endif | |
497 | #endif | |
498 | ||
499 | ||
500 | /* Compare N wide characters of S1 and S2. */ | |
501 | #if @GNULIB_WMEMCMP@ | |
502 | # if !@HAVE_WMEMCMP@ | |
503 | _GL_FUNCDECL_SYS (wmemcmp, int, | |
504 | (const wchar_t *s1, const wchar_t *s2, size_t n) | |
505 | _GL_ATTRIBUTE_PURE); | |
506 | # endif | |
507 | _GL_CXXALIAS_SYS (wmemcmp, int, | |
508 | (const wchar_t *s1, const wchar_t *s2, size_t n)); | |
509 | _GL_CXXALIASWARN (wmemcmp); | |
510 | #elif defined GNULIB_POSIXCHECK | |
511 | # undef wmemcmp | |
512 | # if HAVE_RAW_DECL_WMEMCMP | |
513 | _GL_WARN_ON_USE (wmemcmp, "wmemcmp is unportable - " | |
514 | "use gnulib module wmemcmp for portability"); | |
515 | # endif | |
516 | #endif | |
517 | ||
518 | ||
519 | /* Copy N wide characters of SRC to DEST. */ | |
520 | #if @GNULIB_WMEMCPY@ | |
521 | # if !@HAVE_WMEMCPY@ | |
522 | _GL_FUNCDECL_SYS (wmemcpy, wchar_t *, | |
523 | (wchar_t *dest, const wchar_t *src, size_t n)); | |
524 | # endif | |
525 | _GL_CXXALIAS_SYS (wmemcpy, wchar_t *, | |
526 | (wchar_t *dest, const wchar_t *src, size_t n)); | |
527 | _GL_CXXALIASWARN (wmemcpy); | |
528 | #elif defined GNULIB_POSIXCHECK | |
529 | # undef wmemcpy | |
530 | # if HAVE_RAW_DECL_WMEMCPY | |
531 | _GL_WARN_ON_USE (wmemcpy, "wmemcpy is unportable - " | |
532 | "use gnulib module wmemcpy for portability"); | |
533 | # endif | |
534 | #endif | |
535 | ||
536 | ||
537 | /* Copy N wide characters of SRC to DEST, guaranteeing correct behavior for | |
538 | overlapping memory areas. */ | |
539 | #if @GNULIB_WMEMMOVE@ | |
540 | # if !@HAVE_WMEMMOVE@ | |
541 | _GL_FUNCDECL_SYS (wmemmove, wchar_t *, | |
542 | (wchar_t *dest, const wchar_t *src, size_t n)); | |
543 | # endif | |
544 | _GL_CXXALIAS_SYS (wmemmove, wchar_t *, | |
545 | (wchar_t *dest, const wchar_t *src, size_t n)); | |
546 | _GL_CXXALIASWARN (wmemmove); | |
547 | #elif defined GNULIB_POSIXCHECK | |
548 | # undef wmemmove | |
549 | # if HAVE_RAW_DECL_WMEMMOVE | |
550 | _GL_WARN_ON_USE (wmemmove, "wmemmove is unportable - " | |
551 | "use gnulib module wmemmove for portability"); | |
552 | # endif | |
553 | #endif | |
554 | ||
555 | ||
556 | /* Set N wide characters of S to C. */ | |
557 | #if @GNULIB_WMEMSET@ | |
558 | # if !@HAVE_WMEMSET@ | |
559 | _GL_FUNCDECL_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n)); | |
560 | # endif | |
561 | _GL_CXXALIAS_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n)); | |
562 | _GL_CXXALIASWARN (wmemset); | |
563 | #elif defined GNULIB_POSIXCHECK | |
564 | # undef wmemset | |
565 | # if HAVE_RAW_DECL_WMEMSET | |
566 | _GL_WARN_ON_USE (wmemset, "wmemset is unportable - " | |
567 | "use gnulib module wmemset for portability"); | |
568 | # endif | |
569 | #endif | |
570 | ||
571 | ||
572 | /* Return the number of wide characters in S. */ | |
573 | #if @GNULIB_WCSLEN@ | |
574 | # if !@HAVE_WCSLEN@ | |
575 | _GL_FUNCDECL_SYS (wcslen, size_t, (const wchar_t *s) _GL_ATTRIBUTE_PURE); | |
576 | # endif | |
577 | _GL_CXXALIAS_SYS (wcslen, size_t, (const wchar_t *s)); | |
578 | _GL_CXXALIASWARN (wcslen); | |
579 | #elif defined GNULIB_POSIXCHECK | |
580 | # undef wcslen | |
581 | # if HAVE_RAW_DECL_WCSLEN | |
582 | _GL_WARN_ON_USE (wcslen, "wcslen is unportable - " | |
583 | "use gnulib module wcslen for portability"); | |
584 | # endif | |
585 | #endif | |
586 | ||
587 | ||
588 | /* Return the number of wide characters in S, but at most MAXLEN. */ | |
589 | #if @GNULIB_WCSNLEN@ | |
590 | # if !@HAVE_WCSNLEN@ | |
591 | _GL_FUNCDECL_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen) | |
592 | _GL_ATTRIBUTE_PURE); | |
593 | # endif | |
594 | _GL_CXXALIAS_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen)); | |
595 | _GL_CXXALIASWARN (wcsnlen); | |
596 | #elif defined GNULIB_POSIXCHECK | |
597 | # undef wcsnlen | |
598 | # if HAVE_RAW_DECL_WCSNLEN | |
599 | _GL_WARN_ON_USE (wcsnlen, "wcsnlen is unportable - " | |
600 | "use gnulib module wcsnlen for portability"); | |
601 | # endif | |
602 | #endif | |
603 | ||
604 | ||
605 | /* Copy SRC to DEST. */ | |
606 | #if @GNULIB_WCSCPY@ | |
607 | # if !@HAVE_WCSCPY@ | |
608 | _GL_FUNCDECL_SYS (wcscpy, wchar_t *, (wchar_t *dest, const wchar_t *src)); | |
609 | # endif | |
610 | _GL_CXXALIAS_SYS (wcscpy, wchar_t *, (wchar_t *dest, const wchar_t *src)); | |
611 | _GL_CXXALIASWARN (wcscpy); | |
612 | #elif defined GNULIB_POSIXCHECK | |
613 | # undef wcscpy | |
614 | # if HAVE_RAW_DECL_WCSCPY | |
615 | _GL_WARN_ON_USE (wcscpy, "wcscpy is unportable - " | |
616 | "use gnulib module wcscpy for portability"); | |
617 | # endif | |
618 | #endif | |
619 | ||
620 | ||
621 | /* Copy SRC to DEST, returning the address of the terminating L'\0' in DEST. */ | |
622 | #if @GNULIB_WCPCPY@ | |
623 | # if !@HAVE_WCPCPY@ | |
624 | _GL_FUNCDECL_SYS (wcpcpy, wchar_t *, (wchar_t *dest, const wchar_t *src)); | |
625 | # endif | |
626 | _GL_CXXALIAS_SYS (wcpcpy, wchar_t *, (wchar_t *dest, const wchar_t *src)); | |
627 | _GL_CXXALIASWARN (wcpcpy); | |
628 | #elif defined GNULIB_POSIXCHECK | |
629 | # undef wcpcpy | |
630 | # if HAVE_RAW_DECL_WCPCPY | |
631 | _GL_WARN_ON_USE (wcpcpy, "wcpcpy is unportable - " | |
632 | "use gnulib module wcpcpy for portability"); | |
633 | # endif | |
634 | #endif | |
635 | ||
636 | ||
637 | /* Copy no more than N wide characters of SRC to DEST. */ | |
638 | #if @GNULIB_WCSNCPY@ | |
639 | # if !@HAVE_WCSNCPY@ | |
640 | _GL_FUNCDECL_SYS (wcsncpy, wchar_t *, | |
641 | (wchar_t *dest, const wchar_t *src, size_t n)); | |
642 | # endif | |
643 | _GL_CXXALIAS_SYS (wcsncpy, wchar_t *, | |
644 | (wchar_t *dest, const wchar_t *src, size_t n)); | |
645 | _GL_CXXALIASWARN (wcsncpy); | |
646 | #elif defined GNULIB_POSIXCHECK | |
647 | # undef wcsncpy | |
648 | # if HAVE_RAW_DECL_WCSNCPY | |
649 | _GL_WARN_ON_USE (wcsncpy, "wcsncpy is unportable - " | |
650 | "use gnulib module wcsncpy for portability"); | |
651 | # endif | |
652 | #endif | |
653 | ||
654 | ||
655 | /* Copy no more than N characters of SRC to DEST, returning the address of | |
656 | the last character written into DEST. */ | |
657 | #if @GNULIB_WCPNCPY@ | |
658 | # if !@HAVE_WCPNCPY@ | |
659 | _GL_FUNCDECL_SYS (wcpncpy, wchar_t *, | |
660 | (wchar_t *dest, const wchar_t *src, size_t n)); | |
661 | # endif | |
662 | _GL_CXXALIAS_SYS (wcpncpy, wchar_t *, | |
663 | (wchar_t *dest, const wchar_t *src, size_t n)); | |
664 | _GL_CXXALIASWARN (wcpncpy); | |
665 | #elif defined GNULIB_POSIXCHECK | |
666 | # undef wcpncpy | |
667 | # if HAVE_RAW_DECL_WCPNCPY | |
668 | _GL_WARN_ON_USE (wcpncpy, "wcpncpy is unportable - " | |
669 | "use gnulib module wcpncpy for portability"); | |
670 | # endif | |
671 | #endif | |
672 | ||
673 | ||
674 | /* Append SRC onto DEST. */ | |
675 | #if @GNULIB_WCSCAT@ | |
676 | # if !@HAVE_WCSCAT@ | |
677 | _GL_FUNCDECL_SYS (wcscat, wchar_t *, (wchar_t *dest, const wchar_t *src)); | |
678 | # endif | |
679 | _GL_CXXALIAS_SYS (wcscat, wchar_t *, (wchar_t *dest, const wchar_t *src)); | |
680 | _GL_CXXALIASWARN (wcscat); | |
681 | #elif defined GNULIB_POSIXCHECK | |
682 | # undef wcscat | |
683 | # if HAVE_RAW_DECL_WCSCAT | |
684 | _GL_WARN_ON_USE (wcscat, "wcscat is unportable - " | |
685 | "use gnulib module wcscat for portability"); | |
686 | # endif | |
687 | #endif | |
688 | ||
689 | ||
690 | /* Append no more than N wide characters of SRC onto DEST. */ | |
691 | #if @GNULIB_WCSNCAT@ | |
692 | # if !@HAVE_WCSNCAT@ | |
693 | _GL_FUNCDECL_SYS (wcsncat, wchar_t *, | |
694 | (wchar_t *dest, const wchar_t *src, size_t n)); | |
695 | # endif | |
696 | _GL_CXXALIAS_SYS (wcsncat, wchar_t *, | |
697 | (wchar_t *dest, const wchar_t *src, size_t n)); | |
698 | _GL_CXXALIASWARN (wcsncat); | |
699 | #elif defined GNULIB_POSIXCHECK | |
700 | # undef wcsncat | |
701 | # if HAVE_RAW_DECL_WCSNCAT | |
702 | _GL_WARN_ON_USE (wcsncat, "wcsncat is unportable - " | |
703 | "use gnulib module wcsncat for portability"); | |
704 | # endif | |
705 | #endif | |
706 | ||
707 | ||
708 | /* Compare S1 and S2. */ | |
709 | #if @GNULIB_WCSCMP@ | |
710 | # if !@HAVE_WCSCMP@ | |
711 | _GL_FUNCDECL_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2) | |
712 | _GL_ATTRIBUTE_PURE); | |
713 | # endif | |
714 | _GL_CXXALIAS_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2)); | |
715 | _GL_CXXALIASWARN (wcscmp); | |
716 | #elif defined GNULIB_POSIXCHECK | |
717 | # undef wcscmp | |
718 | # if HAVE_RAW_DECL_WCSCMP | |
719 | _GL_WARN_ON_USE (wcscmp, "wcscmp is unportable - " | |
720 | "use gnulib module wcscmp for portability"); | |
721 | # endif | |
722 | #endif | |
723 | ||
724 | ||
725 | /* Compare no more than N wide characters of S1 and S2. */ | |
726 | #if @GNULIB_WCSNCMP@ | |
727 | # if !@HAVE_WCSNCMP@ | |
728 | _GL_FUNCDECL_SYS (wcsncmp, int, | |
729 | (const wchar_t *s1, const wchar_t *s2, size_t n) | |
730 | _GL_ATTRIBUTE_PURE); | |
731 | # endif | |
732 | _GL_CXXALIAS_SYS (wcsncmp, int, | |
733 | (const wchar_t *s1, const wchar_t *s2, size_t n)); | |
734 | _GL_CXXALIASWARN (wcsncmp); | |
735 | #elif defined GNULIB_POSIXCHECK | |
736 | # undef wcsncmp | |
737 | # if HAVE_RAW_DECL_WCSNCMP | |
738 | _GL_WARN_ON_USE (wcsncmp, "wcsncmp is unportable - " | |
739 | "use gnulib module wcsncmp for portability"); | |
740 | # endif | |
741 | #endif | |
742 | ||
743 | ||
744 | /* Compare S1 and S2, ignoring case. */ | |
745 | #if @GNULIB_WCSCASECMP@ | |
746 | # if !@HAVE_WCSCASECMP@ | |
747 | _GL_FUNCDECL_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2) | |
748 | _GL_ATTRIBUTE_PURE); | |
749 | # endif | |
750 | _GL_CXXALIAS_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2)); | |
751 | _GL_CXXALIASWARN (wcscasecmp); | |
752 | #elif defined GNULIB_POSIXCHECK | |
753 | # undef wcscasecmp | |
754 | # if HAVE_RAW_DECL_WCSCASECMP | |
755 | _GL_WARN_ON_USE (wcscasecmp, "wcscasecmp is unportable - " | |
756 | "use gnulib module wcscasecmp for portability"); | |
757 | # endif | |
758 | #endif | |
759 | ||
760 | ||
761 | /* Compare no more than N chars of S1 and S2, ignoring case. */ | |
762 | #if @GNULIB_WCSNCASECMP@ | |
763 | # if !@HAVE_WCSNCASECMP@ | |
764 | _GL_FUNCDECL_SYS (wcsncasecmp, int, | |
765 | (const wchar_t *s1, const wchar_t *s2, size_t n) | |
766 | _GL_ATTRIBUTE_PURE); | |
767 | # endif | |
768 | _GL_CXXALIAS_SYS (wcsncasecmp, int, | |
769 | (const wchar_t *s1, const wchar_t *s2, size_t n)); | |
770 | _GL_CXXALIASWARN (wcsncasecmp); | |
771 | #elif defined GNULIB_POSIXCHECK | |
772 | # undef wcsncasecmp | |
773 | # if HAVE_RAW_DECL_WCSNCASECMP | |
774 | _GL_WARN_ON_USE (wcsncasecmp, "wcsncasecmp is unportable - " | |
775 | "use gnulib module wcsncasecmp for portability"); | |
776 | # endif | |
777 | #endif | |
778 | ||
779 | ||
780 | /* Compare S1 and S2, both interpreted as appropriate to the LC_COLLATE | |
781 | category of the current locale. */ | |
782 | #if @GNULIB_WCSCOLL@ | |
783 | # if !@HAVE_WCSCOLL@ | |
784 | _GL_FUNCDECL_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2)); | |
785 | # endif | |
786 | _GL_CXXALIAS_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2)); | |
787 | _GL_CXXALIASWARN (wcscoll); | |
788 | #elif defined GNULIB_POSIXCHECK | |
789 | # undef wcscoll | |
790 | # if HAVE_RAW_DECL_WCSCOLL | |
791 | _GL_WARN_ON_USE (wcscoll, "wcscoll is unportable - " | |
792 | "use gnulib module wcscoll for portability"); | |
793 | # endif | |
794 | #endif | |
795 | ||
796 | ||
797 | /* Transform S2 into array pointed to by S1 such that if wcscmp is applied | |
798 | to two transformed strings the result is the as applying 'wcscoll' to the | |
799 | original strings. */ | |
800 | #if @GNULIB_WCSXFRM@ | |
801 | # if !@HAVE_WCSXFRM@ | |
802 | _GL_FUNCDECL_SYS (wcsxfrm, size_t, (wchar_t *s1, const wchar_t *s2, size_t n)); | |
803 | # endif | |
804 | _GL_CXXALIAS_SYS (wcsxfrm, size_t, (wchar_t *s1, const wchar_t *s2, size_t n)); | |
805 | _GL_CXXALIASWARN (wcsxfrm); | |
806 | #elif defined GNULIB_POSIXCHECK | |
807 | # undef wcsxfrm | |
808 | # if HAVE_RAW_DECL_WCSXFRM | |
809 | _GL_WARN_ON_USE (wcsxfrm, "wcsxfrm is unportable - " | |
810 | "use gnulib module wcsxfrm for portability"); | |
811 | # endif | |
812 | #endif | |
813 | ||
814 | ||
815 | /* Duplicate S, returning an identical malloc'd string. */ | |
816 | #if @GNULIB_WCSDUP@ | |
817 | # if !@HAVE_WCSDUP@ | |
818 | _GL_FUNCDECL_SYS (wcsdup, wchar_t *, (const wchar_t *s)); | |
819 | # endif | |
820 | _GL_CXXALIAS_SYS (wcsdup, wchar_t *, (const wchar_t *s)); | |
821 | _GL_CXXALIASWARN (wcsdup); | |
822 | #elif defined GNULIB_POSIXCHECK | |
823 | # undef wcsdup | |
824 | # if HAVE_RAW_DECL_WCSDUP | |
825 | _GL_WARN_ON_USE (wcsdup, "wcsdup is unportable - " | |
826 | "use gnulib module wcsdup for portability"); | |
827 | # endif | |
828 | #endif | |
829 | ||
830 | ||
831 | /* Find the first occurrence of WC in WCS. */ | |
832 | #if @GNULIB_WCSCHR@ | |
833 | # if !@HAVE_WCSCHR@ | |
834 | _GL_FUNCDECL_SYS (wcschr, wchar_t *, (const wchar_t *wcs, wchar_t wc) | |
835 | _GL_ATTRIBUTE_PURE); | |
836 | # endif | |
837 | /* On some systems, this function is defined as an overloaded function: | |
838 | extern "C++" { | |
839 | const wchar_t * std::wcschr (const wchar_t *, wchar_t); | |
840 | wchar_t * std::wcschr (wchar_t *, wchar_t); | |
841 | } */ | |
842 | _GL_CXXALIAS_SYS_CAST2 (wcschr, | |
843 | wchar_t *, (const wchar_t *, wchar_t), | |
844 | const wchar_t *, (const wchar_t *, wchar_t)); | |
845 | # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ | |
846 | && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) | |
847 | _GL_CXXALIASWARN1 (wcschr, wchar_t *, (wchar_t *wcs, wchar_t wc)); | |
848 | _GL_CXXALIASWARN1 (wcschr, const wchar_t *, (const wchar_t *wcs, wchar_t wc)); | |
849 | # else | |
850 | _GL_CXXALIASWARN (wcschr); | |
851 | # endif | |
852 | #elif defined GNULIB_POSIXCHECK | |
853 | # undef wcschr | |
854 | # if HAVE_RAW_DECL_WCSCHR | |
855 | _GL_WARN_ON_USE (wcschr, "wcschr is unportable - " | |
856 | "use gnulib module wcschr for portability"); | |
857 | # endif | |
858 | #endif | |
859 | ||
860 | ||
861 | /* Find the last occurrence of WC in WCS. */ | |
862 | #if @GNULIB_WCSRCHR@ | |
863 | # if !@HAVE_WCSRCHR@ | |
864 | _GL_FUNCDECL_SYS (wcsrchr, wchar_t *, (const wchar_t *wcs, wchar_t wc) | |
865 | _GL_ATTRIBUTE_PURE); | |
866 | # endif | |
867 | /* On some systems, this function is defined as an overloaded function: | |
868 | extern "C++" { | |
869 | const wchar_t * std::wcsrchr (const wchar_t *, wchar_t); | |
870 | wchar_t * std::wcsrchr (wchar_t *, wchar_t); | |
871 | } */ | |
872 | _GL_CXXALIAS_SYS_CAST2 (wcsrchr, | |
873 | wchar_t *, (const wchar_t *, wchar_t), | |
874 | const wchar_t *, (const wchar_t *, wchar_t)); | |
875 | # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ | |
876 | && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) | |
877 | _GL_CXXALIASWARN1 (wcsrchr, wchar_t *, (wchar_t *wcs, wchar_t wc)); | |
878 | _GL_CXXALIASWARN1 (wcsrchr, const wchar_t *, (const wchar_t *wcs, wchar_t wc)); | |
879 | # else | |
880 | _GL_CXXALIASWARN (wcsrchr); | |
881 | # endif | |
882 | #elif defined GNULIB_POSIXCHECK | |
883 | # undef wcsrchr | |
884 | # if HAVE_RAW_DECL_WCSRCHR | |
885 | _GL_WARN_ON_USE (wcsrchr, "wcsrchr is unportable - " | |
886 | "use gnulib module wcsrchr for portability"); | |
887 | # endif | |
888 | #endif | |
889 | ||
890 | ||
891 | /* Return the length of the initial segmet of WCS which consists entirely | |
892 | of wide characters not in REJECT. */ | |
893 | #if @GNULIB_WCSCSPN@ | |
894 | # if !@HAVE_WCSCSPN@ | |
895 | _GL_FUNCDECL_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject) | |
896 | _GL_ATTRIBUTE_PURE); | |
897 | # endif | |
898 | _GL_CXXALIAS_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject)); | |
899 | _GL_CXXALIASWARN (wcscspn); | |
900 | #elif defined GNULIB_POSIXCHECK | |
901 | # undef wcscspn | |
902 | # if HAVE_RAW_DECL_WCSCSPN | |
903 | _GL_WARN_ON_USE (wcscspn, "wcscspn is unportable - " | |
904 | "use gnulib module wcscspn for portability"); | |
905 | # endif | |
906 | #endif | |
907 | ||
908 | ||
909 | /* Return the length of the initial segmet of WCS which consists entirely | |
910 | of wide characters in ACCEPT. */ | |
911 | #if @GNULIB_WCSSPN@ | |
912 | # if !@HAVE_WCSSPN@ | |
913 | _GL_FUNCDECL_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept) | |
914 | _GL_ATTRIBUTE_PURE); | |
915 | # endif | |
916 | _GL_CXXALIAS_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept)); | |
917 | _GL_CXXALIASWARN (wcsspn); | |
918 | #elif defined GNULIB_POSIXCHECK | |
919 | # undef wcsspn | |
920 | # if HAVE_RAW_DECL_WCSSPN | |
921 | _GL_WARN_ON_USE (wcsspn, "wcsspn is unportable - " | |
922 | "use gnulib module wcsspn for portability"); | |
923 | # endif | |
924 | #endif | |
925 | ||
926 | ||
927 | /* Find the first occurrence in WCS of any character in ACCEPT. */ | |
928 | #if @GNULIB_WCSPBRK@ | |
929 | # if !@HAVE_WCSPBRK@ | |
930 | _GL_FUNCDECL_SYS (wcspbrk, wchar_t *, | |
931 | (const wchar_t *wcs, const wchar_t *accept) | |
932 | _GL_ATTRIBUTE_PURE); | |
933 | # endif | |
934 | /* On some systems, this function is defined as an overloaded function: | |
935 | extern "C++" { | |
936 | const wchar_t * std::wcspbrk (const wchar_t *, const wchar_t *); | |
937 | wchar_t * std::wcspbrk (wchar_t *, const wchar_t *); | |
938 | } */ | |
939 | _GL_CXXALIAS_SYS_CAST2 (wcspbrk, | |
940 | wchar_t *, (const wchar_t *, const wchar_t *), | |
941 | const wchar_t *, (const wchar_t *, const wchar_t *)); | |
942 | # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ | |
943 | && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) | |
944 | _GL_CXXALIASWARN1 (wcspbrk, wchar_t *, | |
945 | (wchar_t *wcs, const wchar_t *accept)); | |
946 | _GL_CXXALIASWARN1 (wcspbrk, const wchar_t *, | |
947 | (const wchar_t *wcs, const wchar_t *accept)); | |
948 | # else | |
949 | _GL_CXXALIASWARN (wcspbrk); | |
950 | # endif | |
951 | #elif defined GNULIB_POSIXCHECK | |
952 | # undef wcspbrk | |
953 | # if HAVE_RAW_DECL_WCSPBRK | |
954 | _GL_WARN_ON_USE (wcspbrk, "wcspbrk is unportable - " | |
955 | "use gnulib module wcspbrk for portability"); | |
956 | # endif | |
957 | #endif | |
958 | ||
959 | ||
960 | /* Find the first occurrence of NEEDLE in HAYSTACK. */ | |
961 | #if @GNULIB_WCSSTR@ | |
962 | # if !@HAVE_WCSSTR@ | |
963 | _GL_FUNCDECL_SYS (wcsstr, wchar_t *, | |
964 | (const wchar_t *haystack, const wchar_t *needle) | |
965 | _GL_ATTRIBUTE_PURE); | |
966 | # endif | |
967 | /* On some systems, this function is defined as an overloaded function: | |
968 | extern "C++" { | |
969 | const wchar_t * std::wcsstr (const wchar_t *, const wchar_t *); | |
970 | wchar_t * std::wcsstr (wchar_t *, const wchar_t *); | |
971 | } */ | |
972 | _GL_CXXALIAS_SYS_CAST2 (wcsstr, | |
973 | wchar_t *, (const wchar_t *, const wchar_t *), | |
974 | const wchar_t *, (const wchar_t *, const wchar_t *)); | |
975 | # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ | |
976 | && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) | |
977 | _GL_CXXALIASWARN1 (wcsstr, wchar_t *, | |
978 | (wchar_t *haystack, const wchar_t *needle)); | |
979 | _GL_CXXALIASWARN1 (wcsstr, const wchar_t *, | |
980 | (const wchar_t *haystack, const wchar_t *needle)); | |
981 | # else | |
982 | _GL_CXXALIASWARN (wcsstr); | |
983 | # endif | |
984 | #elif defined GNULIB_POSIXCHECK | |
985 | # undef wcsstr | |
986 | # if HAVE_RAW_DECL_WCSSTR | |
987 | _GL_WARN_ON_USE (wcsstr, "wcsstr is unportable - " | |
988 | "use gnulib module wcsstr for portability"); | |
989 | # endif | |
990 | #endif | |
991 | ||
992 | ||
993 | /* Divide WCS into tokens separated by characters in DELIM. */ | |
994 | #if @GNULIB_WCSTOK@ | |
995 | # if !@HAVE_WCSTOK@ | |
996 | _GL_FUNCDECL_SYS (wcstok, wchar_t *, | |
997 | (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr)); | |
998 | # endif | |
999 | _GL_CXXALIAS_SYS (wcstok, wchar_t *, | |
1000 | (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr)); | |
1001 | _GL_CXXALIASWARN (wcstok); | |
1002 | #elif defined GNULIB_POSIXCHECK | |
1003 | # undef wcstok | |
1004 | # if HAVE_RAW_DECL_WCSTOK | |
1005 | _GL_WARN_ON_USE (wcstok, "wcstok is unportable - " | |
1006 | "use gnulib module wcstok for portability"); | |
1007 | # endif | |
1008 | #endif | |
1009 | ||
1010 | ||
1011 | /* Determine number of column positions required for first N wide | |
1012 | characters (or fewer if S ends before this) in S. */ | |
1013 | #if @GNULIB_WCSWIDTH@ | |
1014 | # if @REPLACE_WCSWIDTH@ | |
1015 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
1016 | # undef wcswidth | |
1017 | # define wcswidth rpl_wcswidth | |
1018 | # endif | |
1019 | _GL_FUNCDECL_RPL (wcswidth, int, (const wchar_t *s, size_t n) | |
1020 | _GL_ATTRIBUTE_PURE); | |
1021 | _GL_CXXALIAS_RPL (wcswidth, int, (const wchar_t *s, size_t n)); | |
1022 | # else | |
1023 | # if !@HAVE_WCSWIDTH@ | |
1024 | _GL_FUNCDECL_SYS (wcswidth, int, (const wchar_t *s, size_t n) | |
1025 | _GL_ATTRIBUTE_PURE); | |
1026 | # endif | |
1027 | _GL_CXXALIAS_SYS (wcswidth, int, (const wchar_t *s, size_t n)); | |
1028 | # endif | |
1029 | _GL_CXXALIASWARN (wcswidth); | |
1030 | #elif defined GNULIB_POSIXCHECK | |
1031 | # undef wcswidth | |
1032 | # if HAVE_RAW_DECL_WCSWIDTH | |
1033 | _GL_WARN_ON_USE (wcswidth, "wcswidth is unportable - " | |
1034 | "use gnulib module wcswidth for portability"); | |
1035 | # endif | |
1036 | #endif | |
1037 | ||
1038 | ||
1039 | #endif /* _@GUARD_PREFIX@_WCHAR_H */ | |
1040 | #endif /* _@GUARD_PREFIX@_WCHAR_H */ | |
1041 | #endif |