wchar.in.h 40 KB

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