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