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