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