Don't fail when locale env. vars specify a dot-less locale name.
[bpt/guile.git] / lib / wchar.in.h
CommitLineData
e65fc94b
LC
1/* A substitute for ISO C99 <wchar.h>, for platforms that have issues.
2
f0007cad 3 Copyright (C) 2007-2012 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
3d458a81 52#ifndef _@GUARD_PREFIX@_WCHAR_H
e65fc94b 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 63 included before <wchar.h>.
dd7d0148
LC
64 In some builds of uClibc, <wchar.h> is nonexistent and wchar_t is defined
65 by <stddef.h>.
61cd9dc9 66 But avoid namespace pollution on glibc systems. */
dd7d0148 67#if !(defined __GLIBC__ && !defined __UCLIBC__)
61cd9dc9 68# include <stddef.h>
dd7d0148
LC
69#endif
70#ifndef __GLIBC__
61cd9dc9
LC
71# include <stdio.h>
72# include <time.h>
73#endif
e65fc94b
LC
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
f240aacb
LC
82#undef _GL_ALREADY_INCLUDING_WCHAR_H
83
3d458a81
AW
84#ifndef _@GUARD_PREFIX@_WCHAR_H
85#define _@GUARD_PREFIX@_WCHAR_H
e65fc94b 86
f4c79b3c
LC
87/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
88
1cd4fffc
LC
89/* The definition of _GL_ARG_NONNULL is copied here. */
90
61cd9dc9
LC
91/* The definition of _GL_WARN_ON_USE is copied here. */
92
e65fc94b 93
a927b6c1 94/* Define wint_t and WEOF. (Also done in wctype.in.h.) */
aa7a939c
LC
95#if !@HAVE_WINT_T@ && !defined wint_t
96# define wint_t int
4a462e35
NJ
97# ifndef WEOF
98# define WEOF -1
99# endif
a927b6c1 100#else
35428fb6
LC
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>
107typedef 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
a927b6c1
LC
113# ifndef WEOF
114# define WEOF ((wint_t) -1)
115# endif
4a462e35
NJ
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@
49114fd4 123# if !GNULIB_defined_mbstate_t
4a462e35 124typedef int rpl_mbstate_t;
49114fd4
LC
125# undef mbstate_t
126# define mbstate_t rpl_mbstate_t
127# define GNULIB_defined_mbstate_t 1
128# endif
4a462e35
NJ
129#endif
130
131
132/* Convert a single-byte character to a wide character. */
133#if @GNULIB_BTOWC@
134# if @REPLACE_BTOWC@
f4c79b3c
LC
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));
4a462e35 146# endif
f4c79b3c 147_GL_CXXALIASWARN (btowc);
4a462e35
NJ
148#elif defined GNULIB_POSIXCHECK
149# undef btowc
61cd9dc9
LC
150# if HAVE_RAW_DECL_BTOWC
151_GL_WARN_ON_USE (btowc, "btowc is unportable - "
152 "use gnulib module btowc for portability");
153# endif
4a462e35
NJ
154#endif
155
156
157/* Convert a wide character to a single-byte character. */
158#if @GNULIB_WCTOB@
159# if @REPLACE_WCTOB@
f4c79b3c
LC
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@
4a462e35 168/* wctob is provided by gnulib, or wctob exists but is not declared. */
f4c79b3c
LC
169_GL_FUNCDECL_SYS (wctob, int, (wint_t wc));
170# endif
171_GL_CXXALIAS_SYS (wctob, int, (wint_t wc));
4a462e35 172# endif
f4c79b3c 173_GL_CXXALIASWARN (wctob);
4a462e35
NJ
174#elif defined GNULIB_POSIXCHECK
175# undef wctob
61cd9dc9
LC
176# if HAVE_RAW_DECL_WCTOB
177_GL_WARN_ON_USE (wctob, "wctob is unportable - "
178 "use gnulib module wctob for portability");
179# endif
4a462e35
NJ
180#endif
181
182
183/* Test whether *PS is in the initial state. */
184#if @GNULIB_MBSINIT@
185# if @REPLACE_MBSINIT@
f4c79b3c
LC
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));
4a462e35 197# endif
f4c79b3c 198_GL_CXXALIASWARN (mbsinit);
4a462e35
NJ
199#elif defined GNULIB_POSIXCHECK
200# undef mbsinit
61cd9dc9
LC
201# if HAVE_RAW_DECL_MBSINIT
202_GL_WARN_ON_USE (mbsinit, "mbsinit is unportable - "
203 "use gnulib module mbsinit for portability");
204# endif
4a462e35
NJ
205#endif
206
207
208/* Convert a multibyte character to a wide character. */
209#if @GNULIB_MBRTOWC@
210# if @REPLACE_MBRTOWC@
f4c79b3c
LC
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));
4a462e35 226# endif
f4c79b3c 227_GL_CXXALIASWARN (mbrtowc);
4a462e35
NJ
228#elif defined GNULIB_POSIXCHECK
229# undef mbrtowc
61cd9dc9
LC
230# if HAVE_RAW_DECL_MBRTOWC
231_GL_WARN_ON_USE (mbrtowc, "mbrtowc is unportable - "
232 "use gnulib module mbrtowc for portability");
233# endif
4a462e35
NJ
234#endif
235
236
237/* Recognize a multibyte character. */
238#if @GNULIB_MBRLEN@
239# if @REPLACE_MBRLEN@
f4c79b3c
LC
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));
4a462e35 251# endif
f4c79b3c 252_GL_CXXALIASWARN (mbrlen);
4a462e35
NJ
253#elif defined GNULIB_POSIXCHECK
254# undef mbrlen
61cd9dc9
LC
255# if HAVE_RAW_DECL_MBRLEN
256_GL_WARN_ON_USE (mbrlen, "mbrlen is unportable - "
257 "use gnulib module mbrlen for portability");
258# endif
4a462e35
NJ
259#endif
260
261
262/* Convert a string to a wide string. */
263#if @GNULIB_MBSRTOWCS@
264# if @REPLACE_MBSRTOWCS@
f4c79b3c
LC
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));
4a462e35 284# endif
f4c79b3c 285_GL_CXXALIASWARN (mbsrtowcs);
4a462e35
NJ
286#elif defined GNULIB_POSIXCHECK
287# undef mbsrtowcs
61cd9dc9
LC
288# if HAVE_RAW_DECL_MBSRTOWCS
289_GL_WARN_ON_USE (mbsrtowcs, "mbsrtowcs is unportable - "
290 "use gnulib module mbsrtowcs for portability");
291# endif
4a462e35
NJ
292#endif
293
294
295/* Convert a string to a wide string. */
296#if @GNULIB_MBSNRTOWCS@
297# if @REPLACE_MBSNRTOWCS@
f4c79b3c
LC
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));
4a462e35 319# endif
f4c79b3c 320_GL_CXXALIASWARN (mbsnrtowcs);
4a462e35
NJ
321#elif defined GNULIB_POSIXCHECK
322# undef mbsnrtowcs
61cd9dc9
LC
323# if HAVE_RAW_DECL_MBSNRTOWCS
324_GL_WARN_ON_USE (mbsnrtowcs, "mbsnrtowcs is unportable - "
325 "use gnulib module mbsnrtowcs for portability");
326# endif
4a462e35
NJ
327#endif
328
329
330/* Convert a wide character to a multibyte character. */
331#if @GNULIB_WCRTOMB@
332# if @REPLACE_WCRTOMB@
f4c79b3c
LC
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));
4a462e35 344# endif
f4c79b3c 345_GL_CXXALIASWARN (wcrtomb);
4a462e35
NJ
346#elif defined GNULIB_POSIXCHECK
347# undef wcrtomb
61cd9dc9
LC
348# if HAVE_RAW_DECL_WCRTOMB
349_GL_WARN_ON_USE (wcrtomb, "wcrtomb is unportable - "
350 "use gnulib module wcrtomb for portability");
351# endif
4a462e35
NJ
352#endif
353
354
355/* Convert a wide string to a string. */
356#if @GNULIB_WCSRTOMBS@
357# if @REPLACE_WCSRTOMBS@
f4c79b3c
LC
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));
4a462e35 377# endif
f4c79b3c 378_GL_CXXALIASWARN (wcsrtombs);
4a462e35
NJ
379#elif defined GNULIB_POSIXCHECK
380# undef wcsrtombs
61cd9dc9
LC
381# if HAVE_RAW_DECL_WCSRTOMBS
382_GL_WARN_ON_USE (wcsrtombs, "wcsrtombs is unportable - "
383 "use gnulib module wcsrtombs for portability");
384# endif
4a462e35
NJ
385#endif
386
387
388/* Convert a wide string to a string. */
389#if @GNULIB_WCSNRTOMBS@
f240aacb 390# if @REPLACE_WCSNRTOMBS@
f4c79b3c
LC
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));
4a462e35 412# endif
f4c79b3c 413_GL_CXXALIASWARN (wcsnrtombs);
4a462e35
NJ
414#elif defined GNULIB_POSIXCHECK
415# undef wcsnrtombs
61cd9dc9
LC
416# if HAVE_RAW_DECL_WCSNRTOMBS
417_GL_WARN_ON_USE (wcsnrtombs, "wcsnrtombs is unportable - "
418 "use gnulib module wcsnrtombs for portability");
419# endif
aa7a939c
LC
420#endif
421
422
e65fc94b
LC
423/* Return the number of screen columns needed for WC. */
424#if @GNULIB_WCWIDTH@
425# if @REPLACE_WCWIDTH@
f4c79b3c
LC
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));
e65fc94b 432# else
a927b6c1 433# if !@HAVE_DECL_WCWIDTH@
e65fc94b 434/* wcwidth exists but is not declared. */
f4c79b3c 435_GL_FUNCDECL_SYS (wcwidth, int, (wchar_t));
e65fc94b 436# endif
f4c79b3c 437_GL_CXXALIAS_SYS (wcwidth, int, (wchar_t));
e65fc94b 438# endif
f4c79b3c 439_GL_CXXALIASWARN (wcwidth);
e65fc94b
LC
440#elif defined GNULIB_POSIXCHECK
441# undef wcwidth
61cd9dc9
LC
442# if HAVE_RAW_DECL_WCWIDTH
443_GL_WARN_ON_USE (wcwidth, "wcwidth is unportable - "
444 "use gnulib module wcwidth for portability");
445# endif
e65fc94b
LC
446#endif
447
448
49114fd4
LC
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
dd7d0148
LC
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
49114fd4 468_GL_CXXALIASWARN (wmemchr);
dd7d0148 469# endif
49114fd4
LC
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
dd7d0148
LC
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
49114fd4 822_GL_CXXALIASWARN (wcschr);
dd7d0148 823# endif
49114fd4
LC
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
dd7d0148
LC
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
49114fd4 851_GL_CXXALIASWARN (wcsrchr);
dd7d0148 852# endif
49114fd4
LC
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
dd7d0148
LC
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
49114fd4 917_GL_CXXALIASWARN (wcspbrk);
dd7d0148 918# endif
49114fd4
LC
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
dd7d0148
LC
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
49114fd4 949_GL_CXXALIASWARN (wcsstr);
dd7d0148 950# endif
49114fd4
LC
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
3d458a81
AW
1004#endif /* _@GUARD_PREFIX@_WCHAR_H */
1005#endif /* _@GUARD_PREFIX@_WCHAR_H */
e65fc94b 1006#endif