cwchar 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. // -*- C++ -*-
  2. //===----------------------------------------------------------------------===//
  3. //
  4. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  5. // See https://llvm.org/LICENSE.txt for license information.
  6. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  7. //
  8. //===----------------------------------------------------------------------===//
  9. #ifndef _LIBCPP_CWCHAR
  10. #define _LIBCPP_CWCHAR
  11. /*
  12. cwchar synopsis
  13. Macros:
  14. NULL
  15. WCHAR_MAX
  16. WCHAR_MIN
  17. WEOF
  18. namespace std
  19. {
  20. Types:
  21. mbstate_t
  22. size_t
  23. tm
  24. wint_t
  25. int fwprintf(FILE* restrict stream, const wchar_t* restrict format, ...);
  26. int fwscanf(FILE* restrict stream, const wchar_t* restrict format, ...);
  27. int swprintf(wchar_t* restrict s, size_t n, const wchar_t* restrict format, ...);
  28. int swscanf(const wchar_t* restrict s, const wchar_t* restrict format, ...);
  29. int vfwprintf(FILE* restrict stream, const wchar_t* restrict format, va_list arg);
  30. int vfwscanf(FILE* restrict stream, const wchar_t* restrict format, va_list arg); // C99
  31. int vswprintf(wchar_t* restrict s, size_t n, const wchar_t* restrict format, va_list arg);
  32. int vswscanf(const wchar_t* restrict s, const wchar_t* restrict format, va_list arg); // C99
  33. int vwprintf(const wchar_t* restrict format, va_list arg);
  34. int vwscanf(const wchar_t* restrict format, va_list arg); // C99
  35. int wprintf(const wchar_t* restrict format, ...);
  36. int wscanf(const wchar_t* restrict format, ...);
  37. wint_t fgetwc(FILE* stream);
  38. wchar_t* fgetws(wchar_t* restrict s, int n, FILE* restrict stream);
  39. wint_t fputwc(wchar_t c, FILE* stream);
  40. int fputws(const wchar_t* restrict s, FILE* restrict stream);
  41. int fwide(FILE* stream, int mode);
  42. wint_t getwc(FILE* stream);
  43. wint_t getwchar();
  44. wint_t putwc(wchar_t c, FILE* stream);
  45. wint_t putwchar(wchar_t c);
  46. wint_t ungetwc(wint_t c, FILE* stream);
  47. double wcstod(const wchar_t* restrict nptr, wchar_t** restrict endptr);
  48. float wcstof(const wchar_t* restrict nptr, wchar_t** restrict endptr); // C99
  49. long double wcstold(const wchar_t* restrict nptr, wchar_t** restrict endptr); // C99
  50. long wcstol(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base);
  51. long long wcstoll(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base); // C99
  52. unsigned long wcstoul(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base);
  53. unsigned long long wcstoull(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base); // C99
  54. wchar_t* wcscpy(wchar_t* restrict s1, const wchar_t* restrict s2);
  55. wchar_t* wcsncpy(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
  56. wchar_t* wcscat(wchar_t* restrict s1, const wchar_t* restrict s2);
  57. wchar_t* wcsncat(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
  58. int wcscmp(const wchar_t* s1, const wchar_t* s2);
  59. int wcscoll(const wchar_t* s1, const wchar_t* s2);
  60. int wcsncmp(const wchar_t* s1, const wchar_t* s2, size_t n);
  61. size_t wcsxfrm(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
  62. const wchar_t* wcschr(const wchar_t* s, wchar_t c);
  63. wchar_t* wcschr( wchar_t* s, wchar_t c);
  64. size_t wcscspn(const wchar_t* s1, const wchar_t* s2);
  65. size_t wcslen(const wchar_t* s);
  66. const wchar_t* wcspbrk(const wchar_t* s1, const wchar_t* s2);
  67. wchar_t* wcspbrk( wchar_t* s1, const wchar_t* s2);
  68. const wchar_t* wcsrchr(const wchar_t* s, wchar_t c);
  69. wchar_t* wcsrchr( wchar_t* s, wchar_t c);
  70. size_t wcsspn(const wchar_t* s1, const wchar_t* s2);
  71. const wchar_t* wcsstr(const wchar_t* s1, const wchar_t* s2);
  72. wchar_t* wcsstr( wchar_t* s1, const wchar_t* s2);
  73. wchar_t* wcstok(wchar_t* restrict s1, const wchar_t* restrict s2, wchar_t** restrict ptr);
  74. const wchar_t* wmemchr(const wchar_t* s, wchar_t c, size_t n);
  75. wchar_t* wmemchr( wchar_t* s, wchar_t c, size_t n);
  76. int wmemcmp(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
  77. wchar_t* wmemcpy(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
  78. wchar_t* wmemmove(wchar_t* s1, const wchar_t* s2, size_t n);
  79. wchar_t* wmemset(wchar_t* s, wchar_t c, size_t n);
  80. size_t wcsftime(wchar_t* restrict s, size_t maxsize, const wchar_t* restrict format,
  81. const tm* restrict timeptr);
  82. wint_t btowc(int c);
  83. int wctob(wint_t c);
  84. int mbsinit(const mbstate_t* ps);
  85. size_t mbrlen(const char* restrict s, size_t n, mbstate_t* restrict ps);
  86. size_t mbrtowc(wchar_t* restrict pwc, const char* restrict s, size_t n, mbstate_t* restrict ps);
  87. size_t wcrtomb(char* restrict s, wchar_t wc, mbstate_t* restrict ps);
  88. size_t mbsrtowcs(wchar_t* restrict dst, const char** restrict src, size_t len,
  89. mbstate_t* restrict ps);
  90. size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len,
  91. mbstate_t* restrict ps);
  92. } // std
  93. */
  94. #include <__config>
  95. #include <cwctype>
  96. #include <wchar.h>
  97. #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
  98. # pragma GCC system_header
  99. #endif
  100. _LIBCPP_BEGIN_NAMESPACE_STD
  101. using ::mbstate_t _LIBCPP_USING_IF_EXISTS;
  102. using ::size_t _LIBCPP_USING_IF_EXISTS;
  103. using ::tm _LIBCPP_USING_IF_EXISTS;
  104. using ::wint_t _LIBCPP_USING_IF_EXISTS;
  105. using ::FILE _LIBCPP_USING_IF_EXISTS;
  106. using ::fwprintf _LIBCPP_USING_IF_EXISTS;
  107. using ::fwscanf _LIBCPP_USING_IF_EXISTS;
  108. using ::swprintf _LIBCPP_USING_IF_EXISTS;
  109. using ::vfwprintf _LIBCPP_USING_IF_EXISTS;
  110. using ::vswprintf _LIBCPP_USING_IF_EXISTS;
  111. using ::swscanf _LIBCPP_USING_IF_EXISTS;
  112. using ::vfwscanf _LIBCPP_USING_IF_EXISTS;
  113. using ::vswscanf _LIBCPP_USING_IF_EXISTS;
  114. using ::fgetwc _LIBCPP_USING_IF_EXISTS;
  115. using ::fgetws _LIBCPP_USING_IF_EXISTS;
  116. using ::fputwc _LIBCPP_USING_IF_EXISTS;
  117. using ::fputws _LIBCPP_USING_IF_EXISTS;
  118. using ::fwide _LIBCPP_USING_IF_EXISTS;
  119. using ::getwc _LIBCPP_USING_IF_EXISTS;
  120. using ::putwc _LIBCPP_USING_IF_EXISTS;
  121. using ::ungetwc _LIBCPP_USING_IF_EXISTS;
  122. using ::wcstod _LIBCPP_USING_IF_EXISTS;
  123. using ::wcstof _LIBCPP_USING_IF_EXISTS;
  124. using ::wcstold _LIBCPP_USING_IF_EXISTS;
  125. using ::wcstol _LIBCPP_USING_IF_EXISTS;
  126. using ::wcstoll _LIBCPP_USING_IF_EXISTS;
  127. using ::wcstoul _LIBCPP_USING_IF_EXISTS;
  128. using ::wcstoull _LIBCPP_USING_IF_EXISTS;
  129. using ::wcscpy _LIBCPP_USING_IF_EXISTS;
  130. using ::wcsncpy _LIBCPP_USING_IF_EXISTS;
  131. using ::wcscat _LIBCPP_USING_IF_EXISTS;
  132. using ::wcsncat _LIBCPP_USING_IF_EXISTS;
  133. using ::wcscmp _LIBCPP_USING_IF_EXISTS;
  134. using ::wcscoll _LIBCPP_USING_IF_EXISTS;
  135. using ::wcsncmp _LIBCPP_USING_IF_EXISTS;
  136. using ::wcsxfrm _LIBCPP_USING_IF_EXISTS;
  137. using ::wcschr _LIBCPP_USING_IF_EXISTS;
  138. using ::wcspbrk _LIBCPP_USING_IF_EXISTS;
  139. using ::wcsrchr _LIBCPP_USING_IF_EXISTS;
  140. using ::wcsstr _LIBCPP_USING_IF_EXISTS;
  141. using ::wmemchr _LIBCPP_USING_IF_EXISTS;
  142. using ::wcscspn _LIBCPP_USING_IF_EXISTS;
  143. using ::wcslen _LIBCPP_USING_IF_EXISTS;
  144. using ::wcsspn _LIBCPP_USING_IF_EXISTS;
  145. using ::wcstok _LIBCPP_USING_IF_EXISTS;
  146. using ::wmemcmp _LIBCPP_USING_IF_EXISTS;
  147. using ::wmemcpy _LIBCPP_USING_IF_EXISTS;
  148. using ::wmemmove _LIBCPP_USING_IF_EXISTS;
  149. using ::wmemset _LIBCPP_USING_IF_EXISTS;
  150. using ::wcsftime _LIBCPP_USING_IF_EXISTS;
  151. using ::btowc _LIBCPP_USING_IF_EXISTS;
  152. using ::wctob _LIBCPP_USING_IF_EXISTS;
  153. using ::mbsinit _LIBCPP_USING_IF_EXISTS;
  154. using ::mbrlen _LIBCPP_USING_IF_EXISTS;
  155. using ::mbrtowc _LIBCPP_USING_IF_EXISTS;
  156. using ::wcrtomb _LIBCPP_USING_IF_EXISTS;
  157. using ::mbsrtowcs _LIBCPP_USING_IF_EXISTS;
  158. using ::wcsrtombs _LIBCPP_USING_IF_EXISTS;
  159. using ::getwchar _LIBCPP_USING_IF_EXISTS;
  160. using ::vwscanf _LIBCPP_USING_IF_EXISTS;
  161. using ::wscanf _LIBCPP_USING_IF_EXISTS;
  162. using ::putwchar _LIBCPP_USING_IF_EXISTS;
  163. using ::vwprintf _LIBCPP_USING_IF_EXISTS;
  164. using ::wprintf _LIBCPP_USING_IF_EXISTS;
  165. _LIBCPP_END_NAMESPACE_STD
  166. #endif // _LIBCPP_CWCHAR