wchar.h 39 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100
  1. /* Copyright (C) 1995-2026 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3. The GNU C Library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Lesser General Public
  5. License as published by the Free Software Foundation; either
  6. version 2.1 of the License, or (at your option) any later version.
  7. The GNU C Library 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 GNU
  10. Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public
  12. License along with the GNU C Library; if not, see
  13. <https://www.gnu.org/licenses/>. */
  14. /*
  15. * ISO C99 Standard: 7.24
  16. * Extended multibyte and wide character utilities <wchar.h>
  17. */
  18. #ifndef _WCHAR_H
  19. #define _WCHAR_H 1
  20. #define __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION
  21. #include <bits/libc-header-start.h>
  22. /* Gather machine dependent type support. */
  23. #include <bits/floatn.h>
  24. #define __need_size_t
  25. #define __need_wchar_t
  26. #define __need_NULL
  27. #include <stddef.h>
  28. #define __need___va_list
  29. #include <stdarg.h>
  30. #if defined __USE_XOPEN2K || defined __USE_XOPEN2K8
  31. # ifdef __GNUC__
  32. # ifndef _VA_LIST_DEFINED
  33. typedef __gnuc_va_list va_list;
  34. # define _VA_LIST_DEFINED
  35. # endif
  36. # else
  37. # include <stdarg.h>
  38. # endif
  39. #endif
  40. #include <bits/wchar.h>
  41. #include <bits/types/wint_t.h>
  42. #include <bits/types/mbstate_t.h>
  43. #include <bits/types/__FILE.h>
  44. #if defined __USE_UNIX98 || defined __USE_XOPEN2K
  45. # include <bits/types/FILE.h>
  46. #endif
  47. #ifdef __USE_XOPEN2K8
  48. # include <bits/types/locale_t.h>
  49. #endif
  50. #if __GLIBC_USE (ISOC23)
  51. # define __STDC_VERSION_WCHAR_H__ 202311L
  52. #endif
  53. /* Tell the caller that we provide correct C++ prototypes. */
  54. #if defined __cplusplus && __GNUC_PREREQ (4, 4)
  55. # define __CORRECT_ISO_CPP_WCHAR_H_PROTO
  56. #endif
  57. #ifndef WCHAR_MIN
  58. /* These constants might also be defined in <inttypes.h>. */
  59. # define WCHAR_MIN __WCHAR_MIN
  60. # define WCHAR_MAX __WCHAR_MAX
  61. #endif
  62. #ifndef WEOF
  63. # define WEOF (0xffffffffu)
  64. #endif
  65. /* All versions of XPG prior to the publication of ISO C99 required
  66. the bulk of <wctype.h>'s declarations to appear in this header
  67. (because <wctype.h> did not exist prior to C99). In POSIX.1-2001
  68. those declarations were marked as XSI extensions; in -2008 they
  69. were additionally marked as obsolescent. _GNU_SOURCE mode
  70. anticipates the removal of these declarations in the next revision
  71. of POSIX. */
  72. #if (defined __USE_XOPEN && !defined __USE_GNU \
  73. && !(defined __USE_XOPEN2K && !defined __USE_XOPEN2KXSI))
  74. # include <bits/wctype-wchar.h>
  75. #endif
  76. __BEGIN_DECLS
  77. /* This incomplete type is defined in <time.h> but needed here because
  78. of `wcsftime'. */
  79. struct tm;
  80. /* Copy SRC to DEST. */
  81. extern wchar_t *wcscpy (wchar_t *__restrict __dest,
  82. const wchar_t *__restrict __src)
  83. __THROW __nonnull ((1, 2));
  84. /* Copy no more than N wide-characters of SRC to DEST. */
  85. extern wchar_t *wcsncpy (wchar_t *__restrict __dest,
  86. const wchar_t *__restrict __src, size_t __n)
  87. __THROW __nonnull ((1, 2));
  88. #ifdef __USE_MISC
  89. /* Copy at most N - 1 characters from SRC to DEST. */
  90. extern size_t wcslcpy (wchar_t *__restrict __dest,
  91. const wchar_t *__restrict __src, size_t __n)
  92. __THROW __nonnull ((1, 2)) __attr_access ((__write_only__, 1, 3));
  93. /* Append SRC to DEST, possibly with truncation to keep the total size
  94. below N. */
  95. extern size_t wcslcat (wchar_t *__restrict __dest,
  96. const wchar_t *__restrict __src, size_t __n)
  97. __THROW __nonnull ((1, 2)) __attr_access ((__read_write__, 1, 3));
  98. #endif
  99. /* Append SRC onto DEST. */
  100. extern wchar_t *wcscat (wchar_t *__restrict __dest,
  101. const wchar_t *__restrict __src)
  102. __THROW __nonnull ((1, 2));
  103. /* Append no more than N wide-characters of SRC onto DEST. */
  104. extern wchar_t *wcsncat (wchar_t *__restrict __dest,
  105. const wchar_t *__restrict __src, size_t __n)
  106. __THROW __nonnull ((1, 2));
  107. /* Compare S1 and S2. */
  108. extern int wcscmp (const wchar_t *__s1, const wchar_t *__s2)
  109. __THROW __attribute_pure__ __nonnull ((1, 2));
  110. /* Compare N wide-characters of S1 and S2. */
  111. extern int wcsncmp (const wchar_t *__s1, const wchar_t *__s2, size_t __n)
  112. __THROW __attribute_pure__ __nonnull ((1, 2));
  113. #ifdef __USE_XOPEN2K8
  114. /* Compare S1 and S2, ignoring case. */
  115. extern int wcscasecmp (const wchar_t *__s1, const wchar_t *__s2) __THROW;
  116. /* Compare no more than N chars of S1 and S2, ignoring case. */
  117. extern int wcsncasecmp (const wchar_t *__s1, const wchar_t *__s2,
  118. size_t __n) __THROW;
  119. /* Similar to the two functions above but take the information from
  120. the provided locale and not the global locale. */
  121. extern int wcscasecmp_l (const wchar_t *__s1, const wchar_t *__s2,
  122. locale_t __loc) __THROW;
  123. extern int wcsncasecmp_l (const wchar_t *__s1, const wchar_t *__s2,
  124. size_t __n, locale_t __loc) __THROW;
  125. #endif
  126. /* Compare S1 and S2, both interpreted as appropriate to the
  127. LC_COLLATE category of the current locale. */
  128. extern int wcscoll (const wchar_t *__s1, const wchar_t *__s2) __THROW;
  129. /* Transform S2 into array pointed to by S1 such that if wcscmp is
  130. applied to two transformed strings the result is the as applying
  131. `wcscoll' to the original strings. */
  132. extern size_t wcsxfrm (wchar_t *__restrict __s1,
  133. const wchar_t *__restrict __s2, size_t __n) __THROW;
  134. #ifdef __USE_XOPEN2K8
  135. /* Similar to the two functions above but take the information from
  136. the provided locale and not the global locale. */
  137. /* Compare S1 and S2, both interpreted as appropriate to the
  138. LC_COLLATE category of the given locale. */
  139. extern int wcscoll_l (const wchar_t *__s1, const wchar_t *__s2,
  140. locale_t __loc) __THROW;
  141. /* Transform S2 into array pointed to by S1 such that if wcscmp is
  142. applied to two transformed strings the result is the as applying
  143. `wcscoll' to the original strings. */
  144. extern size_t wcsxfrm_l (wchar_t *__s1, const wchar_t *__s2,
  145. size_t __n, locale_t __loc) __THROW;
  146. /* Duplicate S, returning an identical malloc'd string. */
  147. extern wchar_t *wcsdup (const wchar_t *__s) __THROW
  148. __attribute_malloc__ __attr_dealloc_free;
  149. #endif
  150. /* Find the first occurrence of WC in WCS. */
  151. #ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO
  152. extern "C++" wchar_t *wcschr (wchar_t *__wcs, wchar_t __wc)
  153. __THROW __asm ("wcschr") __attribute_pure__;
  154. extern "C++" const wchar_t *wcschr (const wchar_t *__wcs, wchar_t __wc)
  155. __THROW __asm ("wcschr") __attribute_pure__;
  156. #else
  157. extern wchar_t *wcschr (const wchar_t *__wcs, wchar_t __wc)
  158. __THROW __attribute_pure__;
  159. # if __GLIBC_USE (ISOC23) && defined __glibc_const_generic && !defined _LIBC
  160. # define wcschr(WCS, WC) \
  161. __glibc_const_generic (WCS, const wchar_t *, wcschr (WCS, WC))
  162. # endif
  163. #endif
  164. /* Find the last occurrence of WC in WCS. */
  165. #ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO
  166. extern "C++" wchar_t *wcsrchr (wchar_t *__wcs, wchar_t __wc)
  167. __THROW __asm ("wcsrchr") __attribute_pure__;
  168. extern "C++" const wchar_t *wcsrchr (const wchar_t *__wcs, wchar_t __wc)
  169. __THROW __asm ("wcsrchr") __attribute_pure__;
  170. #else
  171. extern wchar_t *wcsrchr (const wchar_t *__wcs, wchar_t __wc)
  172. __THROW __attribute_pure__;
  173. # if __GLIBC_USE (ISOC23) && defined __glibc_const_generic && !defined _LIBC
  174. # define wcsrchr(WCS, WC) \
  175. __glibc_const_generic (WCS, const wchar_t *, wcsrchr (WCS, WC))
  176. # endif
  177. #endif
  178. #ifdef __USE_GNU
  179. /* This function is similar to `wcschr'. But it returns a pointer to
  180. the closing NUL wide character in case C is not found in S. */
  181. extern wchar_t *wcschrnul (const wchar_t *__s, wchar_t __wc)
  182. __THROW __attribute_pure__;
  183. #endif
  184. /* Return the length of the initial segmet of WCS which
  185. consists entirely of wide characters not in REJECT. */
  186. extern size_t wcscspn (const wchar_t *__wcs, const wchar_t *__reject)
  187. __THROW __attribute_pure__;
  188. /* Return the length of the initial segmet of WCS which
  189. consists entirely of wide characters in ACCEPT. */
  190. extern size_t wcsspn (const wchar_t *__wcs, const wchar_t *__accept)
  191. __THROW __attribute_pure__;
  192. /* Find the first occurrence in WCS of any character in ACCEPT. */
  193. #ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO
  194. extern "C++" wchar_t *wcspbrk (wchar_t *__wcs, const wchar_t *__accept)
  195. __THROW __asm ("wcspbrk") __attribute_pure__;
  196. extern "C++" const wchar_t *wcspbrk (const wchar_t *__wcs,
  197. const wchar_t *__accept)
  198. __THROW __asm ("wcspbrk") __attribute_pure__;
  199. #else
  200. extern wchar_t *wcspbrk (const wchar_t *__wcs, const wchar_t *__accept)
  201. __THROW __attribute_pure__;
  202. # if __GLIBC_USE (ISOC23) && defined __glibc_const_generic && !defined _LIBC
  203. # define wcspbrk(WCS, ACCEPT) \
  204. __glibc_const_generic (WCS, const wchar_t *, wcspbrk (WCS, ACCEPT))
  205. # endif
  206. #endif
  207. /* Find the first occurrence of NEEDLE in HAYSTACK. */
  208. #ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO
  209. extern "C++" wchar_t *wcsstr (wchar_t *__haystack, const wchar_t *__needle)
  210. __THROW __asm ("wcsstr") __attribute_pure__;
  211. extern "C++" const wchar_t *wcsstr (const wchar_t *__haystack,
  212. const wchar_t *__needle)
  213. __THROW __asm ("wcsstr") __attribute_pure__;
  214. #else
  215. extern wchar_t *wcsstr (const wchar_t *__haystack, const wchar_t *__needle)
  216. __THROW __attribute_pure__;
  217. # if __GLIBC_USE (ISOC23) && defined __glibc_const_generic && !defined _LIBC
  218. # define wcsstr(HAYSTACK, NEEDLE) \
  219. __glibc_const_generic (HAYSTACK, const wchar_t *, \
  220. wcsstr (HAYSTACK, NEEDLE))
  221. # endif
  222. #endif
  223. /* Divide WCS into tokens separated by characters in DELIM. */
  224. extern wchar_t *wcstok (wchar_t *__restrict __s,
  225. const wchar_t *__restrict __delim,
  226. wchar_t **__restrict __ptr) __THROW;
  227. /* Return the number of wide characters in S. */
  228. extern size_t wcslen (const wchar_t *__s) __THROW __attribute_pure__;
  229. #ifdef __USE_XOPEN
  230. /* Another name for `wcsstr' from XPG4. */
  231. # ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO
  232. extern "C++" wchar_t *wcswcs (wchar_t *__haystack, const wchar_t *__needle)
  233. __THROW __asm ("wcswcs") __attribute_pure__;
  234. extern "C++" const wchar_t *wcswcs (const wchar_t *__haystack,
  235. const wchar_t *__needle)
  236. __THROW __asm ("wcswcs") __attribute_pure__;
  237. # else
  238. extern wchar_t *wcswcs (const wchar_t *__haystack, const wchar_t *__needle)
  239. __THROW __attribute_pure__;
  240. # endif
  241. #endif
  242. #ifdef __USE_XOPEN2K8
  243. /* Return the number of wide characters in S, but at most MAXLEN. */
  244. extern size_t wcsnlen (const wchar_t *__s, size_t __maxlen)
  245. __THROW __attribute_pure__;
  246. #endif
  247. /* Search N wide characters of S for C. */
  248. #ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO
  249. extern "C++" wchar_t *wmemchr (wchar_t *__s, wchar_t __c, size_t __n)
  250. __THROW __asm ("wmemchr") __attribute_pure__;
  251. extern "C++" const wchar_t *wmemchr (const wchar_t *__s, wchar_t __c,
  252. size_t __n)
  253. __THROW __asm ("wmemchr") __attribute_pure__;
  254. #else
  255. extern wchar_t *wmemchr (const wchar_t *__s, wchar_t __c, size_t __n)
  256. __THROW __attribute_pure__;
  257. # if __GLIBC_USE (ISOC23) && defined __glibc_const_generic && !defined _LIBC
  258. # define wmemchr(S, C, N) \
  259. __glibc_const_generic (S, const wchar_t *, wmemchr (S, C, N))
  260. # endif
  261. #endif
  262. /* Compare N wide characters of S1 and S2. */
  263. extern int wmemcmp (const wchar_t *__s1, const wchar_t *__s2, size_t __n)
  264. __THROW __attribute_pure__;
  265. /* Copy N wide characters of SRC to DEST. */
  266. extern wchar_t *wmemcpy (wchar_t *__restrict __s1,
  267. const wchar_t *__restrict __s2, size_t __n) __THROW;
  268. /* Copy N wide characters of SRC to DEST, guaranteeing
  269. correct behavior for overlapping strings. */
  270. extern wchar_t *wmemmove (wchar_t *__s1, const wchar_t *__s2, size_t __n)
  271. __THROW;
  272. /* Set N wide characters of S to C. */
  273. extern wchar_t *wmemset (wchar_t *__s, wchar_t __c, size_t __n) __THROW;
  274. #ifdef __USE_GNU
  275. /* Copy N wide characters of SRC to DEST and return pointer to following
  276. wide character. */
  277. extern wchar_t *wmempcpy (wchar_t *__restrict __s1,
  278. const wchar_t *__restrict __s2, size_t __n)
  279. __THROW;
  280. #endif
  281. /* Determine whether C constitutes a valid (one-byte) multibyte
  282. character. */
  283. extern wint_t btowc (int __c) __THROW;
  284. /* Determine whether C corresponds to a member of the extended
  285. character set whose multibyte representation is a single byte. */
  286. extern int wctob (wint_t __c) __THROW;
  287. /* Determine whether PS points to an object representing the initial
  288. state. */
  289. extern int mbsinit (const mbstate_t *__ps) __THROW __attribute_pure__;
  290. /* Write wide character representation of multibyte character pointed
  291. to by S to PWC. */
  292. extern size_t mbrtowc (wchar_t *__restrict __pwc,
  293. const char *__restrict __s, size_t __n,
  294. mbstate_t *__restrict __p) __THROW;
  295. /* Write multibyte representation of wide character WC to S. */
  296. extern size_t wcrtomb (char *__restrict __s, wchar_t __wc,
  297. mbstate_t *__restrict __ps) __THROW;
  298. /* Return number of bytes in multibyte character pointed to by S. */
  299. extern size_t __mbrlen (const char *__restrict __s, size_t __n,
  300. mbstate_t *__restrict __ps) __THROW;
  301. extern size_t mbrlen (const char *__restrict __s, size_t __n,
  302. mbstate_t *__restrict __ps) __THROW;
  303. #ifdef __USE_EXTERN_INLINES
  304. /* Define inline function as optimization. */
  305. /* We can use the BTOWC and WCTOB optimizations since we know that all
  306. locales must use ASCII encoding for the values in the ASCII range
  307. and because the wchar_t encoding is always ISO 10646. */
  308. extern wint_t __btowc_alias (int __c) __asm ("btowc");
  309. __extern_inline wint_t
  310. __NTH (btowc (int __c))
  311. { return (__builtin_constant_p (__c) && __c >= '\0' && __c <= '\x7f'
  312. ? (wint_t) __c : __btowc_alias (__c)); }
  313. extern int __wctob_alias (wint_t __c) __asm ("wctob");
  314. __extern_inline int
  315. __NTH (wctob (wint_t __wc))
  316. { return (__builtin_constant_p (__wc) && __wc >= L'\0' && __wc <= L'\x7f'
  317. ? (int) __wc : __wctob_alias (__wc)); }
  318. __extern_inline size_t
  319. __NTH (mbrlen (const char *__restrict __s, size_t __n,
  320. mbstate_t *__restrict __ps))
  321. { return (__ps != NULL
  322. ? mbrtowc (NULL, __s, __n, __ps) : __mbrlen (__s, __n, NULL)); }
  323. #endif
  324. /* Write wide character representation of multibyte character string
  325. SRC to DST. */
  326. extern size_t mbsrtowcs (wchar_t *__restrict __dst,
  327. const char **__restrict __src, size_t __len,
  328. mbstate_t *__restrict __ps) __THROW;
  329. /* Write multibyte character representation of wide character string
  330. SRC to DST. */
  331. extern size_t wcsrtombs (char *__restrict __dst,
  332. const wchar_t **__restrict __src, size_t __len,
  333. mbstate_t *__restrict __ps) __THROW;
  334. #ifdef __USE_XOPEN2K8
  335. /* Write wide character representation of at most NMC bytes of the
  336. multibyte character string SRC to DST. */
  337. extern size_t mbsnrtowcs (wchar_t *__restrict __dst,
  338. const char **__restrict __src, size_t __nmc,
  339. size_t __len, mbstate_t *__restrict __ps) __THROW;
  340. /* Write multibyte character representation of at most NWC characters
  341. from the wide character string SRC to DST. */
  342. extern size_t wcsnrtombs (char *__restrict __dst,
  343. const wchar_t **__restrict __src,
  344. size_t __nwc, size_t __len,
  345. mbstate_t *__restrict __ps) __THROW;
  346. #endif /* use POSIX 2008 */
  347. /* The following functions are extensions found in X/Open CAE. */
  348. #ifdef __USE_XOPEN
  349. /* Determine number of column positions required for C. */
  350. extern int wcwidth (wchar_t __c) __THROW;
  351. /* Determine number of column positions required for first N wide
  352. characters (or fewer if S ends before this) in S. */
  353. extern int wcswidth (const wchar_t *__s, size_t __n) __THROW;
  354. #endif /* Use X/Open. */
  355. /* Convert initial portion of the wide string NPTR to `double'
  356. representation. */
  357. extern double wcstod (const wchar_t *__restrict __nptr,
  358. wchar_t **__restrict __endptr) __THROW;
  359. #ifdef __USE_ISOC99
  360. /* Likewise for `float' and `long double' sizes of floating-point numbers. */
  361. extern float wcstof (const wchar_t *__restrict __nptr,
  362. wchar_t **__restrict __endptr) __THROW;
  363. extern long double wcstold (const wchar_t *__restrict __nptr,
  364. wchar_t **__restrict __endptr) __THROW;
  365. #endif /* C99 */
  366. #if __GLIBC_USE (IEC_60559_TYPES_EXT) && __GLIBC_USE (ISOC23)
  367. /* Likewise for `_FloatN' and `_FloatNx' when support is enabled. */
  368. # if __HAVE_FLOAT16
  369. extern _Float16 wcstof16 (const wchar_t *__restrict __nptr,
  370. wchar_t **__restrict __endptr) __THROW;
  371. # endif
  372. # if __HAVE_FLOAT32
  373. extern _Float32 wcstof32 (const wchar_t *__restrict __nptr,
  374. wchar_t **__restrict __endptr) __THROW;
  375. # endif
  376. # if __HAVE_FLOAT64
  377. extern _Float64 wcstof64 (const wchar_t *__restrict __nptr,
  378. wchar_t **__restrict __endptr) __THROW;
  379. # endif
  380. # if __HAVE_FLOAT128
  381. extern _Float128 wcstof128 (const wchar_t *__restrict __nptr,
  382. wchar_t **__restrict __endptr) __THROW;
  383. # endif
  384. # if __HAVE_FLOAT32X
  385. extern _Float32x wcstof32x (const wchar_t *__restrict __nptr,
  386. wchar_t **__restrict __endptr) __THROW;
  387. # endif
  388. # if __HAVE_FLOAT64X
  389. extern _Float64x wcstof64x (const wchar_t *__restrict __nptr,
  390. wchar_t **__restrict __endptr) __THROW;
  391. # endif
  392. # if __HAVE_FLOAT128X
  393. extern _Float128x wcstof128x (const wchar_t *__restrict __nptr,
  394. wchar_t **__restrict __endptr) __THROW;
  395. # endif
  396. #endif /* __GLIBC_USE (IEC_60559_TYPES_EXT) && __GLIBC_USE (ISOC23) */
  397. /* Convert initial portion of wide string NPTR to `long int'
  398. representation. */
  399. extern long int wcstol (const wchar_t *__restrict __nptr,
  400. wchar_t **__restrict __endptr, int __base) __THROW;
  401. /* Convert initial portion of wide string NPTR to `unsigned long int'
  402. representation. */
  403. extern unsigned long int wcstoul (const wchar_t *__restrict __nptr,
  404. wchar_t **__restrict __endptr, int __base)
  405. __THROW;
  406. #ifdef __USE_ISOC99
  407. /* Convert initial portion of wide string NPTR to `long long int'
  408. representation. */
  409. __extension__
  410. extern long long int wcstoll (const wchar_t *__restrict __nptr,
  411. wchar_t **__restrict __endptr, int __base)
  412. __THROW;
  413. /* Convert initial portion of wide string NPTR to `unsigned long long int'
  414. representation. */
  415. __extension__
  416. extern unsigned long long int wcstoull (const wchar_t *__restrict __nptr,
  417. wchar_t **__restrict __endptr,
  418. int __base) __THROW;
  419. #endif /* ISO C99. */
  420. #ifdef __USE_GNU
  421. /* Convert initial portion of wide string NPTR to `long long int'
  422. representation. */
  423. __extension__
  424. extern long long int wcstoq (const wchar_t *__restrict __nptr,
  425. wchar_t **__restrict __endptr, int __base)
  426. __THROW;
  427. /* Convert initial portion of wide string NPTR to `unsigned long long int'
  428. representation. */
  429. __extension__
  430. extern unsigned long long int wcstouq (const wchar_t *__restrict __nptr,
  431. wchar_t **__restrict __endptr,
  432. int __base) __THROW;
  433. #endif /* Use GNU. */
  434. /* Versions of the above functions that handle '0b' and '0B' prefixes
  435. in base 0 or 2. */
  436. #if __GLIBC_USE (C23_STRTOL)
  437. # ifdef __REDIRECT
  438. extern long int __REDIRECT_NTH (wcstol, (const wchar_t *__restrict __nptr,
  439. wchar_t **__restrict __endptr,
  440. int __base), __isoc23_wcstol);
  441. extern unsigned long int __REDIRECT_NTH (wcstoul,
  442. (const wchar_t *__restrict __nptr,
  443. wchar_t **__restrict __endptr,
  444. int __base), __isoc23_wcstoul);
  445. __extension__
  446. extern long long int __REDIRECT_NTH (wcstoll,
  447. (const wchar_t *__restrict __nptr,
  448. wchar_t **__restrict __endptr,
  449. int __base), __isoc23_wcstoll);
  450. __extension__
  451. extern unsigned long long int __REDIRECT_NTH (wcstoull,
  452. (const wchar_t *__restrict __nptr,
  453. wchar_t **__restrict __endptr,
  454. int __base), __isoc23_wcstoull);
  455. # ifdef __USE_GNU
  456. __extension__
  457. extern long long int __REDIRECT_NTH (wcstoq, (const wchar_t *__restrict __nptr,
  458. wchar_t **__restrict __endptr,
  459. int __base), __isoc23_wcstoll);
  460. __extension__
  461. extern unsigned long long int __REDIRECT_NTH (wcstouq,
  462. (const wchar_t *__restrict __nptr,
  463. wchar_t **__restrict __endptr,
  464. int __base), __isoc23_wcstoull);
  465. # endif
  466. # else
  467. extern long int __isoc23_wcstol (const wchar_t *__restrict __nptr,
  468. wchar_t **__restrict __endptr, int __base)
  469. __THROW;
  470. extern unsigned long int __isoc23_wcstoul (const wchar_t *__restrict __nptr,
  471. wchar_t **__restrict __endptr,
  472. int __base)
  473. __THROW;
  474. __extension__
  475. extern long long int __isoc23_wcstoll (const wchar_t *__restrict __nptr,
  476. wchar_t **__restrict __endptr,
  477. int __base)
  478. __THROW;
  479. __extension__
  480. extern unsigned long long int __isoc23_wcstoull (const wchar_t *__restrict __nptr,
  481. wchar_t **__restrict __endptr,
  482. int __base)
  483. __THROW;
  484. # define wcstol __isoc23_wcstol
  485. # define wcstoul __isoc23_wcstoul
  486. # define wcstoll __isoc23_wcstoll
  487. # define wcstoull __isoc23_wcstoull
  488. # ifdef __USE_GNU
  489. # define wcstoq __isoc23_wcstoll
  490. # define wcstouq __isoc23_wcstoull
  491. # endif
  492. # endif
  493. #endif
  494. #ifdef __USE_GNU
  495. /* Parallel versions of the functions above which take the locale to
  496. use as an additional parameter. These are GNU extensions inspired
  497. by the POSIX.1-2008 extended locale API. */
  498. extern long int wcstol_l (const wchar_t *__restrict __nptr,
  499. wchar_t **__restrict __endptr, int __base,
  500. locale_t __loc) __THROW;
  501. extern unsigned long int wcstoul_l (const wchar_t *__restrict __nptr,
  502. wchar_t **__restrict __endptr,
  503. int __base, locale_t __loc) __THROW;
  504. __extension__
  505. extern long long int wcstoll_l (const wchar_t *__restrict __nptr,
  506. wchar_t **__restrict __endptr,
  507. int __base, locale_t __loc) __THROW;
  508. __extension__
  509. extern unsigned long long int wcstoull_l (const wchar_t *__restrict __nptr,
  510. wchar_t **__restrict __endptr,
  511. int __base, locale_t __loc)
  512. __THROW;
  513. /* Versions of the above functions that handle '0b' and '0B' prefixes
  514. in base 0 or 2. */
  515. # if __GLIBC_USE (C23_STRTOL)
  516. # ifdef __REDIRECT
  517. extern long int __REDIRECT_NTH (wcstol_l, (const wchar_t *__restrict __nptr,
  518. wchar_t **__restrict __endptr,
  519. int __base, locale_t __loc),
  520. __isoc23_wcstol_l);
  521. extern unsigned long int __REDIRECT_NTH (wcstoul_l,
  522. (const wchar_t *__restrict __nptr,
  523. wchar_t **__restrict __endptr,
  524. int __base, locale_t __loc),
  525. __isoc23_wcstoul_l);
  526. __extension__
  527. extern long long int __REDIRECT_NTH (wcstoll_l,
  528. (const wchar_t *__restrict __nptr,
  529. wchar_t **__restrict __endptr,
  530. int __base, locale_t __loc),
  531. __isoc23_wcstoll_l);
  532. __extension__
  533. extern unsigned long long int __REDIRECT_NTH (wcstoull_l,
  534. (const wchar_t *__restrict __nptr,
  535. wchar_t **__restrict __endptr,
  536. int __base, locale_t __loc),
  537. __isoc23_wcstoull_l);
  538. # else
  539. extern long int __isoc23_wcstol_l (const wchar_t *__restrict __nptr,
  540. wchar_t **__restrict __endptr, int __base,
  541. locale_t __loc) __THROW;
  542. extern unsigned long int __isoc23_wcstoul_l (const wchar_t *__restrict __nptr,
  543. wchar_t **__restrict __endptr,
  544. int __base, locale_t __loc)
  545. __THROW;
  546. __extension__
  547. extern long long int __isoc23_wcstoll_l (const wchar_t *__restrict __nptr,
  548. wchar_t **__restrict __endptr,
  549. int __base, locale_t __loc)
  550. __THROW;
  551. __extension__
  552. extern unsigned long long int __isoc23_wcstoull_l (const wchar_t *__restrict __nptr,
  553. wchar_t **__restrict __endptr,
  554. int __base, locale_t __loc)
  555. __THROW;
  556. # define wcstol_l __isoc23_wcstol_l
  557. # define wcstoul_l __isoc23_wcstoul_l
  558. # define wcstoll_l __isoc23_wcstoll_l
  559. # define wcstoull_l __isoc23_wcstoull_l
  560. # endif
  561. # endif
  562. extern double wcstod_l (const wchar_t *__restrict __nptr,
  563. wchar_t **__restrict __endptr, locale_t __loc)
  564. __THROW;
  565. extern float wcstof_l (const wchar_t *__restrict __nptr,
  566. wchar_t **__restrict __endptr, locale_t __loc)
  567. __THROW;
  568. extern long double wcstold_l (const wchar_t *__restrict __nptr,
  569. wchar_t **__restrict __endptr,
  570. locale_t __loc) __THROW;
  571. # if __HAVE_FLOAT16
  572. extern _Float16 wcstof16_l (const wchar_t *__restrict __nptr,
  573. wchar_t **__restrict __endptr,
  574. locale_t __loc) __THROW;
  575. # endif
  576. # if __HAVE_FLOAT32
  577. extern _Float32 wcstof32_l (const wchar_t *__restrict __nptr,
  578. wchar_t **__restrict __endptr,
  579. locale_t __loc) __THROW;
  580. # endif
  581. # if __HAVE_FLOAT64
  582. extern _Float64 wcstof64_l (const wchar_t *__restrict __nptr,
  583. wchar_t **__restrict __endptr,
  584. locale_t __loc) __THROW;
  585. # endif
  586. # if __HAVE_FLOAT128
  587. extern _Float128 wcstof128_l (const wchar_t *__restrict __nptr,
  588. wchar_t **__restrict __endptr,
  589. locale_t __loc) __THROW;
  590. # endif
  591. # if __HAVE_FLOAT32X
  592. extern _Float32x wcstof32x_l (const wchar_t *__restrict __nptr,
  593. wchar_t **__restrict __endptr,
  594. locale_t __loc) __THROW;
  595. # endif
  596. # if __HAVE_FLOAT64X
  597. extern _Float64x wcstof64x_l (const wchar_t *__restrict __nptr,
  598. wchar_t **__restrict __endptr,
  599. locale_t __loc) __THROW;
  600. # endif
  601. # if __HAVE_FLOAT128X
  602. extern _Float128x wcstof128x_l (const wchar_t *__restrict __nptr,
  603. wchar_t **__restrict __endptr,
  604. locale_t __loc) __THROW;
  605. # endif
  606. #endif /* use GNU */
  607. #ifdef __USE_XOPEN2K8
  608. /* Copy SRC to DEST, returning the address of the terminating L'\0' in
  609. DEST. */
  610. extern wchar_t *wcpcpy (wchar_t *__restrict __dest,
  611. const wchar_t *__restrict __src) __THROW;
  612. /* Copy no more than N characters of SRC to DEST, returning the address of
  613. the last character written into DEST. */
  614. extern wchar_t *wcpncpy (wchar_t *__restrict __dest,
  615. const wchar_t *__restrict __src, size_t __n)
  616. __THROW;
  617. #endif
  618. /* Wide character I/O functions. */
  619. #if defined __USE_XOPEN2K8 || __GLIBC_USE (LIB_EXT2)
  620. # ifndef __attr_dealloc_fclose
  621. # if defined __has_builtin
  622. # if __has_builtin (__builtin_fclose)
  623. /* If the attribute macro hasn't been defined yet (by <stdio.h>) and
  624. fclose is a built-in, use it. */
  625. # define __attr_dealloc_fclose __attr_dealloc (__builtin_fclose, 1)
  626. # endif
  627. # endif
  628. # endif
  629. # ifndef __attr_dealloc_fclose
  630. # define __attr_dealloc_fclose /* empty */
  631. # endif
  632. /* Like OPEN_MEMSTREAM, but the stream is wide oriented and produces
  633. a wide character string. */
  634. extern __FILE *open_wmemstream (wchar_t **__bufloc, size_t *__sizeloc) __THROW
  635. __attribute_malloc__ __attr_dealloc_fclose;
  636. #endif
  637. #if defined __USE_ISOC95 || defined __USE_UNIX98
  638. /* Select orientation for stream. */
  639. extern int fwide (__FILE *__fp, int __mode) __THROW;
  640. /* Write formatted output to STREAM.
  641. This function is a possible cancellation point and therefore not
  642. marked with __THROW. */
  643. extern int fwprintf (__FILE *__restrict __stream,
  644. const wchar_t *__restrict __format, ...)
  645. /* __attribute__ ((__format__ (__wprintf__, 2, 3))) */;
  646. /* Write formatted output to stdout.
  647. This function is a possible cancellation point and therefore not
  648. marked with __THROW. */
  649. extern int wprintf (const wchar_t *__restrict __format, ...)
  650. /* __attribute__ ((__format__ (__wprintf__, 1, 2))) */;
  651. /* Write formatted output of at most N characters to S. */
  652. extern int swprintf (wchar_t *__restrict __s, size_t __n,
  653. const wchar_t *__restrict __format, ...)
  654. __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 4))) */;
  655. /* Write formatted output to S from argument list ARG.
  656. This function is a possible cancellation point and therefore not
  657. marked with __THROW. */
  658. extern int vfwprintf (__FILE *__restrict __s,
  659. const wchar_t *__restrict __format,
  660. __gnuc_va_list __arg)
  661. /* __attribute__ ((__format__ (__wprintf__, 2, 0))) */;
  662. /* Write formatted output to stdout from argument list ARG.
  663. This function is a possible cancellation point and therefore not
  664. marked with __THROW. */
  665. extern int vwprintf (const wchar_t *__restrict __format,
  666. __gnuc_va_list __arg)
  667. /* __attribute__ ((__format__ (__wprintf__, 1, 0))) */;
  668. /* Write formatted output of at most N character to S from argument
  669. list ARG. */
  670. extern int vswprintf (wchar_t *__restrict __s, size_t __n,
  671. const wchar_t *__restrict __format,
  672. __gnuc_va_list __arg)
  673. __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
  674. /* Read formatted input from STREAM.
  675. This function is a possible cancellation point and therefore not
  676. marked with __THROW. */
  677. extern int fwscanf (__FILE *__restrict __stream,
  678. const wchar_t *__restrict __format, ...)
  679. /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
  680. /* Read formatted input from stdin.
  681. This function is a possible cancellation point and therefore not
  682. marked with __THROW. */
  683. extern int wscanf (const wchar_t *__restrict __format, ...)
  684. /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */;
  685. /* Read formatted input from S. */
  686. extern int swscanf (const wchar_t *__restrict __s,
  687. const wchar_t *__restrict __format, ...)
  688. __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
  689. /* For historical reasons, the C99-compliant versions of the scanf
  690. functions are at alternative names. When __LDBL_COMPAT or
  691. __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI are in effect, this is handled in
  692. bits/wchar-ldbl.h. */
  693. # if !__GLIBC_USE (DEPRECATED_SCANF) && !defined __LDBL_COMPAT \
  694. && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
  695. # if __GLIBC_USE (C23_STRTOL)
  696. # ifdef __REDIRECT
  697. extern int __REDIRECT (fwscanf, (__FILE *__restrict __stream,
  698. const wchar_t *__restrict __format, ...),
  699. __isoc23_fwscanf)
  700. /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
  701. extern int __REDIRECT (wscanf, (const wchar_t *__restrict __format, ...),
  702. __isoc23_wscanf)
  703. /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */;
  704. extern int __REDIRECT_NTH (swscanf, (const wchar_t *__restrict __s,
  705. const wchar_t *__restrict __format,
  706. ...), __isoc23_swscanf)
  707. /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
  708. # else
  709. extern int __isoc23_fwscanf (__FILE *__restrict __stream,
  710. const wchar_t *__restrict __format, ...);
  711. extern int __isoc23_wscanf (const wchar_t *__restrict __format, ...);
  712. extern int __isoc23_swscanf (const wchar_t *__restrict __s,
  713. const wchar_t *__restrict __format, ...)
  714. __THROW;
  715. # define fwscanf __isoc23_fwscanf
  716. # define wscanf __isoc23_wscanf
  717. # define swscanf __isoc23_swscanf
  718. # endif
  719. # else
  720. # ifdef __REDIRECT
  721. extern int __REDIRECT (fwscanf, (__FILE *__restrict __stream,
  722. const wchar_t *__restrict __format, ...),
  723. __isoc99_fwscanf)
  724. /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
  725. extern int __REDIRECT (wscanf, (const wchar_t *__restrict __format, ...),
  726. __isoc99_wscanf)
  727. /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */;
  728. extern int __REDIRECT_NTH (swscanf, (const wchar_t *__restrict __s,
  729. const wchar_t *__restrict __format,
  730. ...), __isoc99_swscanf)
  731. /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
  732. # else
  733. extern int __isoc99_fwscanf (__FILE *__restrict __stream,
  734. const wchar_t *__restrict __format, ...);
  735. extern int __isoc99_wscanf (const wchar_t *__restrict __format, ...);
  736. extern int __isoc99_swscanf (const wchar_t *__restrict __s,
  737. const wchar_t *__restrict __format, ...)
  738. __THROW;
  739. # define fwscanf __isoc99_fwscanf
  740. # define wscanf __isoc99_wscanf
  741. # define swscanf __isoc99_swscanf
  742. # endif
  743. # endif
  744. # endif
  745. #endif /* Use ISO C95, C99 and Unix98. */
  746. #ifdef __USE_ISOC99
  747. /* Read formatted input from S into argument list ARG.
  748. This function is a possible cancellation point and therefore not
  749. marked with __THROW. */
  750. extern int vfwscanf (__FILE *__restrict __s,
  751. const wchar_t *__restrict __format,
  752. __gnuc_va_list __arg)
  753. /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
  754. /* Read formatted input from stdin into argument list ARG.
  755. This function is a possible cancellation point and therefore not
  756. marked with __THROW. */
  757. extern int vwscanf (const wchar_t *__restrict __format,
  758. __gnuc_va_list __arg)
  759. /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
  760. /* Read formatted input from S into argument list ARG. */
  761. extern int vswscanf (const wchar_t *__restrict __s,
  762. const wchar_t *__restrict __format,
  763. __gnuc_va_list __arg)
  764. __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
  765. /* Same redirection as above for the v*wscanf family. */
  766. # if !__GLIBC_USE (DEPRECATED_SCANF) \
  767. && (!defined __LDBL_COMPAT || !defined __REDIRECT) \
  768. && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K) \
  769. && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
  770. # if __GLIBC_USE (C23_STRTOL)
  771. # ifdef __REDIRECT
  772. extern int __REDIRECT (vfwscanf, (__FILE *__restrict __s,
  773. const wchar_t *__restrict __format,
  774. __gnuc_va_list __arg), __isoc23_vfwscanf)
  775. /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
  776. extern int __REDIRECT (vwscanf, (const wchar_t *__restrict __format,
  777. __gnuc_va_list __arg), __isoc23_vwscanf)
  778. /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
  779. extern int __REDIRECT_NTH (vswscanf, (const wchar_t *__restrict __s,
  780. const wchar_t *__restrict __format,
  781. __gnuc_va_list __arg), __isoc23_vswscanf)
  782. /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
  783. # else
  784. extern int __isoc23_vfwscanf (__FILE *__restrict __s,
  785. const wchar_t *__restrict __format,
  786. __gnuc_va_list __arg);
  787. extern int __isoc23_vwscanf (const wchar_t *__restrict __format,
  788. __gnuc_va_list __arg);
  789. extern int __isoc23_vswscanf (const wchar_t *__restrict __s,
  790. const wchar_t *__restrict __format,
  791. __gnuc_va_list __arg) __THROW;
  792. # define vfwscanf __isoc23_vfwscanf
  793. # define vwscanf __isoc23_vwscanf
  794. # define vswscanf __isoc23_vswscanf
  795. # endif
  796. # else
  797. # ifdef __REDIRECT
  798. extern int __REDIRECT (vfwscanf, (__FILE *__restrict __s,
  799. const wchar_t *__restrict __format,
  800. __gnuc_va_list __arg), __isoc99_vfwscanf)
  801. /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
  802. extern int __REDIRECT (vwscanf, (const wchar_t *__restrict __format,
  803. __gnuc_va_list __arg), __isoc99_vwscanf)
  804. /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
  805. extern int __REDIRECT_NTH (vswscanf, (const wchar_t *__restrict __s,
  806. const wchar_t *__restrict __format,
  807. __gnuc_va_list __arg), __isoc99_vswscanf)
  808. /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
  809. # else
  810. extern int __isoc99_vfwscanf (__FILE *__restrict __s,
  811. const wchar_t *__restrict __format,
  812. __gnuc_va_list __arg);
  813. extern int __isoc99_vwscanf (const wchar_t *__restrict __format,
  814. __gnuc_va_list __arg);
  815. extern int __isoc99_vswscanf (const wchar_t *__restrict __s,
  816. const wchar_t *__restrict __format,
  817. __gnuc_va_list __arg) __THROW;
  818. # define vfwscanf __isoc99_vfwscanf
  819. # define vwscanf __isoc99_vwscanf
  820. # define vswscanf __isoc99_vswscanf
  821. # endif
  822. # endif
  823. # endif
  824. #endif /* Use ISO C99. */
  825. /* Read a character from STREAM.
  826. These functions are possible cancellation points and therefore not
  827. marked with __THROW. */
  828. extern wint_t fgetwc (__FILE *__stream);
  829. extern wint_t getwc (__FILE *__stream);
  830. /* Read a character from stdin.
  831. This function is a possible cancellation point and therefore not
  832. marked with __THROW. */
  833. extern wint_t getwchar (void);
  834. /* Write a character to STREAM.
  835. These functions are possible cancellation points and therefore not
  836. marked with __THROW. */
  837. extern wint_t fputwc (wchar_t __wc, __FILE *__stream);
  838. extern wint_t putwc (wchar_t __wc, __FILE *__stream);
  839. /* Write a character to stdout.
  840. This function is a possible cancellation point and therefore not
  841. marked with __THROW. */
  842. extern wint_t putwchar (wchar_t __wc);
  843. /* Get a newline-terminated wide character string of finite length
  844. from STREAM.
  845. This function is a possible cancellation point and therefore not
  846. marked with __THROW. */
  847. extern wchar_t *fgetws (wchar_t *__restrict __ws, int __n,
  848. __FILE *__restrict __stream);
  849. /* Write a string to STREAM.
  850. This function is a possible cancellation point and therefore not
  851. marked with __THROW. */
  852. extern int fputws (const wchar_t *__restrict __ws,
  853. __FILE *__restrict __stream);
  854. /* Push a character back onto the input buffer of STREAM.
  855. This function is a possible cancellation point and therefore not
  856. marked with __THROW. */
  857. extern wint_t ungetwc (wint_t __wc, __FILE *__stream);
  858. #ifdef __USE_GNU
  859. /* These are defined to be equivalent to the `char' functions defined
  860. in POSIX.1:1996.
  861. These functions are not part of POSIX and therefore no official
  862. cancellation point. But due to similarity with an POSIX interface
  863. or due to the implementation they are cancellation points and
  864. therefore not marked with __THROW. */
  865. extern wint_t getwc_unlocked (__FILE *__stream);
  866. extern wint_t getwchar_unlocked (void);
  867. /* This is the wide character version of a GNU extension.
  868. This function is not part of POSIX and therefore no official
  869. cancellation point. But due to similarity with an POSIX interface
  870. or due to the implementation it is a cancellation point and
  871. therefore not marked with __THROW. */
  872. extern wint_t fgetwc_unlocked (__FILE *__stream);
  873. /* Faster version when locking is not necessary.
  874. This function is not part of POSIX and therefore no official
  875. cancellation point. But due to similarity with an POSIX interface
  876. or due to the implementation it is a cancellation point and
  877. therefore not marked with __THROW. */
  878. extern wint_t fputwc_unlocked (wchar_t __wc, __FILE *__stream);
  879. /* These are defined to be equivalent to the `char' functions defined
  880. in POSIX.1:1996.
  881. These functions are not part of POSIX and therefore no official
  882. cancellation point. But due to similarity with an POSIX interface
  883. or due to the implementation they are cancellation points and
  884. therefore not marked with __THROW. */
  885. extern wint_t putwc_unlocked (wchar_t __wc, __FILE *__stream);
  886. extern wint_t putwchar_unlocked (wchar_t __wc);
  887. /* This function does the same as `fgetws' but does not lock the stream.
  888. This function is not part of POSIX and therefore no official
  889. cancellation point. But due to similarity with an POSIX interface
  890. or due to the implementation it is a cancellation point and
  891. therefore not marked with __THROW. */
  892. extern wchar_t *fgetws_unlocked (wchar_t *__restrict __ws, int __n,
  893. __FILE *__restrict __stream);
  894. /* This function does the same as `fputws' but does not lock the stream.
  895. This function is not part of POSIX and therefore no official
  896. cancellation point. But due to similarity with an POSIX interface
  897. or due to the implementation it is a cancellation point and
  898. therefore not marked with __THROW. */
  899. extern int fputws_unlocked (const wchar_t *__restrict __ws,
  900. __FILE *__restrict __stream);
  901. #endif
  902. /* Format TP into S according to FORMAT.
  903. Write no more than MAXSIZE wide characters and return the number
  904. of wide characters written, or 0 if it would exceed MAXSIZE. */
  905. extern size_t wcsftime (wchar_t *__restrict __s, size_t __maxsize,
  906. const wchar_t *__restrict __format,
  907. const struct tm *__restrict __tp) __THROW;
  908. # ifdef __USE_GNU
  909. /* Similar to `wcsftime' but takes the information from
  910. the provided locale and not the global locale. */
  911. extern size_t wcsftime_l (wchar_t *__restrict __s, size_t __maxsize,
  912. const wchar_t *__restrict __format,
  913. const struct tm *__restrict __tp,
  914. locale_t __loc) __THROW;
  915. # endif
  916. /* Define some macros helping to catch buffer overflows. */
  917. #if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
  918. /* Declare all functions from bits/wchar2-decl.h first. */
  919. # include <bits/wchar2-decl.h>
  920. #endif
  921. /* The following headers provide asm redirections. These redirections must
  922. appear before the first usage of these functions, e.g. in bits/wchar.h. */
  923. #if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
  924. # include <bits/wchar-ldbl.h>
  925. #endif
  926. #if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
  927. /* Now include the function definitions and redirects too. */
  928. # include <bits/wchar2.h>
  929. #endif
  930. __END_DECLS
  931. #endif /* wchar.h */