wchar.h 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. /****************************************************************************
  2. * include/wchar.h
  3. *
  4. * Licensed to the Apache Software Foundation (ASF) under one or more
  5. * contributor license agreements. See the NOTICE file distributed with
  6. * this work for additional information regarding copyright ownership. The
  7. * ASF licenses this file to you under the Apache License, Version 2.0 (the
  8. * "License"); you may not use this file except in compliance with the
  9. * License. You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing, software
  14. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  15. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  16. * License for the specific language governing permissions and limitations
  17. * under the License.
  18. *
  19. ****************************************************************************/
  20. #ifndef __INCLUDE_WCHAR_H
  21. #define __INCLUDE_WCHAR_H
  22. /****************************************************************************
  23. * Included Files
  24. ****************************************************************************/
  25. /* "Inclusion of the <wchar.h> header may make visible all symbols from the
  26. * headers <ctype.h>, <stdio.h>, <stdarg.h>, <stdlib.h>, <string.h>,
  27. * <stddef.h> and <time.h>."
  28. *
  29. * Reference: Opengroup.org
  30. */
  31. #include <stdio.h>
  32. #include <stddef.h>
  33. /****************************************************************************
  34. * Pre-processor Definitions
  35. ****************************************************************************/
  36. /* <wchar.h> defines the following macro names:
  37. *
  38. * WCHAR_MAX
  39. * The maximum value representable by an object of type wchar_t.
  40. *
  41. * WCHAR_MIN
  42. * The minimum value representable by an object of type wchar_t.
  43. *
  44. * WEOF
  45. * Constant expression of type wint_t that is returned by several WP
  46. * functions to indicate end-of-file.
  47. *
  48. * NULL
  49. * As described in <stddef.h>.
  50. *
  51. * Reference: Opengroup.org
  52. */
  53. #define WCHAR_MAX 0xffff
  54. #define WCHAR_MIN 0x0000
  55. #define WEOF ((wint_t)-1)
  56. #ifndef NULL
  57. # define NULL ((FAR void *)0)
  58. #endif
  59. /****************************************************************************
  60. * Type Definitions
  61. ****************************************************************************/
  62. /* "The <wchar.h> header defines the following data types:
  63. *
  64. * wchar_t
  65. * Provided via <stddef.h>.
  66. *
  67. * wint_t
  68. * An integral type capable of storing any valid value of wchar_t, or WEOF.
  69. * Provided via <sys/type.h>
  70. *
  71. * wctype_t
  72. * A scalar type of a data object that can hold values which represent
  73. * locale-specific character classification. Provided via <sys/type.h>
  74. *
  75. * mbstate_t
  76. * An object type other than an array type that can hold the conversion
  77. * state information necessary to convert between sequences of (possibly
  78. * multibyte) characters and wide-characters. If a codeset is being used
  79. * such that an mbstate_t needs to preserve more than 2 levels of reserved
  80. * state, the results are unspecified.
  81. */
  82. struct mbstate_s
  83. {
  84. int __fill[6];
  85. };
  86. typedef struct mbstate_s mbstate_t;
  87. /* FILE
  88. * As described in <stdio.h>.
  89. *
  90. * size_t
  91. * As described in <stddef.h>."
  92. *
  93. * Reference: Opengroup.org
  94. */
  95. /* "The tag tm is declared as naming an incomplete structure type, the
  96. * contents of which are described in the header <time.h>."
  97. *
  98. * Reference: Opengroup.org
  99. */
  100. struct tm; /* Forward reference (see <time.h>) */
  101. /****************************************************************************
  102. * Public Data
  103. ****************************************************************************/
  104. #ifdef __cplusplus
  105. #define EXTERN extern "C"
  106. extern "C"
  107. {
  108. #else
  109. #define EXTERN extern
  110. #endif
  111. /****************************************************************************
  112. * Public Function Prototypes
  113. ****************************************************************************/
  114. /* "The <wchar.h> header declares the following as functions and may also
  115. * define them as macros. Function prototypes must be provided for use with
  116. * an ISO C compiler."
  117. *
  118. * Reference: Opengroup.org
  119. */
  120. wint_t btowc(int);
  121. int fwprintf(FILE *, FAR const wchar_t *, ...);
  122. int fwscanf(FILE *, FAR const wchar_t *, ...);
  123. wint_t fgetwc(FILE *);
  124. FAR wchar_t *fgetws(wchar_t *, int, FILE *);
  125. wint_t fputwc(wchar_t, FILE *);
  126. int fputws(FAR const wchar_t *, FILE *);
  127. int fwide(FILE *, int);
  128. wint_t getwc(FILE *);
  129. wint_t getwchar(void);
  130. int mbsinit(FAR const mbstate_t *);
  131. size_t mbrlen(FAR const char *, size_t, FAR mbstate_t *);
  132. size_t mbrtowc(FAR wchar_t *, FAR const char *, size_t,
  133. FAR mbstate_t *);
  134. size_t mbsnrtowcs(FAR wchar_t *, FAR const char **, size_t,
  135. size_t, FAR mbstate_t *);
  136. size_t mbsrtowcs(FAR wchar_t *, FAR const char **, size_t,
  137. FAR mbstate_t *);
  138. wint_t putwc(wchar_t, FILE *);
  139. wint_t putwchar(wchar_t);
  140. int swprintf(FAR wchar_t *, size_t, FAR const wchar_t *, ...);
  141. int swscanf(FAR const wchar_t *, FAR const wchar_t *, ...);
  142. wint_t ungetwc(wint_t, FILE *);
  143. int vfwprintf(FILE *, FAR const wchar_t *, va_list);
  144. int vfwscanf(FILE *, FAR const wchar_t *, va_list);
  145. int vwprintf(FAR const wchar_t *, va_list);
  146. int vwscanf(FAR const wchar_t *, va_list);
  147. int vswprintf(FAR wchar_t *, size_t, FAR const wchar_t *,
  148. va_list);
  149. int vswscanf(FAR const wchar_t *, FAR const wchar_t *,
  150. va_list);
  151. size_t wcrtomb(FAR char *, wchar_t, FAR mbstate_t *);
  152. FAR wchar_t *wcscat(FAR wchar_t *, FAR const wchar_t *);
  153. FAR wchar_t *wcschr(FAR const wchar_t *, wchar_t);
  154. int wcscmp(FAR const wchar_t *, FAR const wchar_t *);
  155. int wcscoll(FAR const wchar_t *, FAR const wchar_t *);
  156. FAR wchar_t *wcscpy(FAR wchar_t *, FAR const wchar_t *);
  157. size_t wcscspn(FAR const wchar_t *, FAR const wchar_t *);
  158. size_t wcsftime(FAR wchar_t *, size_t, FAR const wchar_t *,
  159. FAR const struct tm *);
  160. size_t wcslen(FAR const wchar_t *);
  161. size_t wcslcpy(FAR wchar_t *, FAR const wchar_t *, size_t);
  162. size_t wcslcat(FAR wchar_t *, FAR const wchar_t *, size_t);
  163. FAR wchar_t *wcsncat(FAR wchar_t *, FAR const wchar_t *, size_t);
  164. int wcsncmp(FAR const wchar_t *, FAR const wchar_t *, size_t);
  165. FAR wchar_t *wcsncpy(FAR wchar_t *, FAR const wchar_t *, size_t);
  166. size_t wcsnrtombs(FAR char *, FAR const wchar_t **, size_t,
  167. size_t, FAR mbstate_t *);
  168. FAR wchar_t *wcspbrk(FAR const wchar_t *, FAR const wchar_t *);
  169. FAR wchar_t *wcsrchr(FAR const wchar_t *, wchar_t);
  170. size_t wcsrtombs(FAR char *, FAR const wchar_t **, size_t,
  171. FAR mbstate_t *);
  172. size_t wcsspn(FAR const wchar_t *, FAR const wchar_t *);
  173. FAR wchar_t *wcsstr(FAR const wchar_t *, FAR const wchar_t *);
  174. #ifdef CONFIG_HAVE_DOUBLE
  175. double wcstod(FAR const wchar_t *, FAR wchar_t **);
  176. #endif
  177. float wcstof(FAR const wchar_t *, FAR wchar_t **);
  178. FAR wchar_t *wcstok(FAR wchar_t *, FAR const wchar_t *, FAR wchar_t **);
  179. long int wcstol(FAR const wchar_t *, FAR wchar_t **, int);
  180. #ifdef CONFIG_HAVE_LONG_DOUBLE
  181. long double wcstold(FAR const wchar_t *, FAR wchar_t **);
  182. #endif
  183. long long int wcstoll(FAR const wchar_t *, FAR wchar_t **, int);
  184. unsigned long int wcstoul(FAR const wchar_t *, FAR wchar_t **, int);
  185. unsigned long long int wcstoull(FAR const wchar_t *, FAR wchar_t **, int);
  186. FAR wchar_t *wcswcs(FAR const wchar_t *, FAR const wchar_t *);
  187. int wcswidth(FAR const wchar_t *, size_t);
  188. size_t wcsxfrm(FAR wchar_t *, FAR const wchar_t *, size_t);
  189. int wctob(wint_t);
  190. int wcwidth(wchar_t);
  191. FAR wchar_t *wmemchr(FAR const wchar_t *, wchar_t, size_t);
  192. int wmemcmp(FAR const wchar_t *, FAR const wchar_t *, size_t);
  193. FAR wchar_t *wmemcpy(FAR wchar_t *, FAR const wchar_t *, size_t);
  194. FAR wchar_t *wmemmove(FAR wchar_t *, FAR const wchar_t *, size_t);
  195. FAR wchar_t *wmemset(FAR wchar_t *, wchar_t, size_t);
  196. int wprintf(FAR const wchar_t *, ...);
  197. int wscanf(FAR const wchar_t *, ...);
  198. #undef EXTERN
  199. #ifdef __cplusplus
  200. }
  201. #endif
  202. #endif /* __INCLUDE_WCHAR_H */