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