/include/wchar.h

https://bitbucket.org/freebsd/freebsd-head/ · C Header · 231 lines · 153 code · 19 blank · 59 comment · 2 complexity · c4b0197359ed751b162d763d46b7b270 MD5 · raw file

  1. /*-
  2. * Copyright (c)1999 Citrus Project,
  3. * All rights reserved.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions
  7. * are met:
  8. * 1. Redistributions of source code must retain the above copyright
  9. * notice, this list of conditions and the following disclaimer.
  10. * 2. Redistributions in binary form must reproduce the above copyright
  11. * notice, this list of conditions and the following disclaimer in the
  12. * documentation and/or other materials provided with the distribution.
  13. *
  14. * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  15. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  16. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  17. * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  18. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  19. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  20. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  21. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  22. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  23. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  24. * SUCH DAMAGE.
  25. *
  26. * $FreeBSD$
  27. */
  28. /*-
  29. * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
  30. * All rights reserved.
  31. *
  32. * This code is derived from software contributed to The NetBSD Foundation
  33. * by Julian Coleman.
  34. *
  35. * Redistribution and use in source and binary forms, with or without
  36. * modification, are permitted provided that the following conditions
  37. * are met:
  38. * 1. Redistributions of source code must retain the above copyright
  39. * notice, this list of conditions and the following disclaimer.
  40. * 2. Redistributions in binary form must reproduce the above copyright
  41. * notice, this list of conditions and the following disclaimer in the
  42. * documentation and/or other materials provided with the distribution.
  43. *
  44. * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
  45. * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  46. * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  47. * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
  48. * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  49. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  50. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  51. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  52. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  53. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  54. * POSSIBILITY OF SUCH DAMAGE.
  55. *
  56. * $NetBSD: wchar.h,v 1.8 2000/12/22 05:31:42 itojun Exp $
  57. */
  58. #ifndef _WCHAR_H_
  59. #define _WCHAR_H_
  60. #include <sys/cdefs.h>
  61. #include <sys/_null.h>
  62. #include <sys/_types.h>
  63. #include <machine/_limits.h>
  64. #include <_ctype.h>
  65. #ifndef _MBSTATE_T_DECLARED
  66. typedef __mbstate_t mbstate_t;
  67. #define _MBSTATE_T_DECLARED
  68. #endif
  69. #ifndef _SIZE_T_DECLARED
  70. typedef __size_t size_t;
  71. #define _SIZE_T_DECLARED
  72. #endif
  73. #ifndef __cplusplus
  74. #ifndef _WCHAR_T_DECLARED
  75. typedef __wchar_t wchar_t;
  76. #define _WCHAR_T_DECLARED
  77. #endif
  78. #endif
  79. #ifndef _WINT_T_DECLARED
  80. typedef __wint_t wint_t;
  81. #define _WINT_T_DECLARED
  82. #endif
  83. #define WCHAR_MIN __WCHAR_MIN
  84. #define WCHAR_MAX __WCHAR_MAX
  85. #ifndef WEOF
  86. #define WEOF ((wint_t)-1)
  87. #endif
  88. #ifndef _STDFILE_DECLARED
  89. #define _STDFILE_DECLARED
  90. typedef struct __sFILE FILE;
  91. #endif
  92. struct tm;
  93. __BEGIN_DECLS
  94. wint_t btowc(int);
  95. wint_t fgetwc(FILE *);
  96. wchar_t *
  97. fgetws(wchar_t * __restrict, int, FILE * __restrict);
  98. wint_t fputwc(wchar_t, FILE *);
  99. int fputws(const wchar_t * __restrict, FILE * __restrict);
  100. int fwide(FILE *, int);
  101. int fwprintf(FILE * __restrict, const wchar_t * __restrict, ...);
  102. int fwscanf(FILE * __restrict, const wchar_t * __restrict, ...);
  103. wint_t getwc(FILE *);
  104. wint_t getwchar(void);
  105. size_t mbrlen(const char * __restrict, size_t, mbstate_t * __restrict);
  106. size_t mbrtowc(wchar_t * __restrict, const char * __restrict, size_t,
  107. mbstate_t * __restrict);
  108. int mbsinit(const mbstate_t *);
  109. size_t mbsrtowcs(wchar_t * __restrict, const char ** __restrict, size_t,
  110. mbstate_t * __restrict);
  111. wint_t putwc(wchar_t, FILE *);
  112. wint_t putwchar(wchar_t);
  113. int swprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict,
  114. ...);
  115. int swscanf(const wchar_t * __restrict, const wchar_t * __restrict, ...);
  116. wint_t ungetwc(wint_t, FILE *);
  117. int vfwprintf(FILE * __restrict, const wchar_t * __restrict,
  118. __va_list);
  119. int vswprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict,
  120. __va_list);
  121. int vwprintf(const wchar_t * __restrict, __va_list);
  122. size_t wcrtomb(char * __restrict, wchar_t, mbstate_t * __restrict);
  123. wchar_t *wcscat(wchar_t * __restrict, const wchar_t * __restrict);
  124. wchar_t *wcschr(const wchar_t *, wchar_t) __pure;
  125. int wcscmp(const wchar_t *, const wchar_t *) __pure;
  126. int wcscoll(const wchar_t *, const wchar_t *);
  127. wchar_t *wcscpy(wchar_t * __restrict, const wchar_t * __restrict);
  128. size_t wcscspn(const wchar_t *, const wchar_t *) __pure;
  129. size_t wcsftime(wchar_t * __restrict, size_t, const wchar_t * __restrict,
  130. const struct tm * __restrict);
  131. size_t wcslen(const wchar_t *) __pure;
  132. wchar_t *wcsncat(wchar_t * __restrict, const wchar_t * __restrict,
  133. size_t);
  134. int wcsncmp(const wchar_t *, const wchar_t *, size_t) __pure;
  135. wchar_t *wcsncpy(wchar_t * __restrict , const wchar_t * __restrict, size_t);
  136. wchar_t *wcspbrk(const wchar_t *, const wchar_t *) __pure;
  137. wchar_t *wcsrchr(const wchar_t *, wchar_t) __pure;
  138. size_t wcsrtombs(char * __restrict, const wchar_t ** __restrict, size_t,
  139. mbstate_t * __restrict);
  140. size_t wcsspn(const wchar_t *, const wchar_t *) __pure;
  141. wchar_t *wcsstr(const wchar_t * __restrict, const wchar_t * __restrict)
  142. __pure;
  143. size_t wcsxfrm(wchar_t * __restrict, const wchar_t * __restrict, size_t);
  144. int wctob(wint_t);
  145. double wcstod(const wchar_t * __restrict, wchar_t ** __restrict);
  146. wchar_t *wcstok(wchar_t * __restrict, const wchar_t * __restrict,
  147. wchar_t ** __restrict);
  148. long wcstol(const wchar_t * __restrict, wchar_t ** __restrict, int);
  149. unsigned long
  150. wcstoul(const wchar_t * __restrict, wchar_t ** __restrict, int);
  151. wchar_t *wmemchr(const wchar_t *, wchar_t, size_t) __pure;
  152. int wmemcmp(const wchar_t *, const wchar_t *, size_t) __pure;
  153. wchar_t *wmemcpy(wchar_t * __restrict, const wchar_t * __restrict, size_t);
  154. wchar_t *wmemmove(wchar_t *, const wchar_t *, size_t);
  155. wchar_t *wmemset(wchar_t *, wchar_t, size_t);
  156. int wprintf(const wchar_t * __restrict, ...);
  157. int wscanf(const wchar_t * __restrict, ...);
  158. #ifndef _STDSTREAM_DECLARED
  159. extern FILE *__stdinp;
  160. extern FILE *__stdoutp;
  161. extern FILE *__stderrp;
  162. #define _STDSTREAM_DECLARED
  163. #endif
  164. #define getwc(fp) fgetwc(fp)
  165. #define getwchar() fgetwc(__stdinp)
  166. #define putwc(wc, fp) fputwc(wc, fp)
  167. #define putwchar(wc) fputwc(wc, __stdoutp)
  168. #if __ISO_C_VISIBLE >= 1999
  169. int vfwscanf(FILE * __restrict, const wchar_t * __restrict,
  170. __va_list);
  171. int vswscanf(const wchar_t * __restrict, const wchar_t * __restrict,
  172. __va_list);
  173. int vwscanf(const wchar_t * __restrict, __va_list);
  174. float wcstof(const wchar_t * __restrict, wchar_t ** __restrict);
  175. long double
  176. wcstold(const wchar_t * __restrict, wchar_t ** __restrict);
  177. #ifdef __LONG_LONG_SUPPORTED
  178. /* LONGLONG */
  179. long long
  180. wcstoll(const wchar_t * __restrict, wchar_t ** __restrict, int);
  181. /* LONGLONG */
  182. unsigned long long
  183. wcstoull(const wchar_t * __restrict, wchar_t ** __restrict, int);
  184. #endif
  185. #endif /* __ISO_C_VISIBLE >= 1999 */
  186. #if __XSI_VISIBLE
  187. int wcswidth(const wchar_t *, size_t);
  188. int wcwidth(wchar_t);
  189. #define wcwidth(_c) __wcwidth(_c)
  190. #endif
  191. #if __POSIX_VISIBLE >= 200809 || __BSD_VISIBLE
  192. size_t mbsnrtowcs(wchar_t * __restrict, const char ** __restrict, size_t,
  193. size_t, mbstate_t * __restrict);
  194. wchar_t *wcpcpy(wchar_t * __restrict, const wchar_t * __restrict);
  195. wchar_t *wcpncpy(wchar_t * __restrict, const wchar_t * __restrict, size_t);
  196. wchar_t *wcsdup(const wchar_t *) __malloc_like;
  197. int wcscasecmp(const wchar_t *, const wchar_t *);
  198. int wcsncasecmp(const wchar_t *, const wchar_t *, size_t n);
  199. size_t wcsnlen(const wchar_t *, size_t) __pure;
  200. size_t wcsnrtombs(char * __restrict, const wchar_t ** __restrict, size_t,
  201. size_t, mbstate_t * __restrict);
  202. #endif
  203. #if __BSD_VISIBLE
  204. wchar_t *fgetwln(FILE * __restrict, size_t * __restrict);
  205. size_t wcslcat(wchar_t *, const wchar_t *, size_t);
  206. size_t wcslcpy(wchar_t *, const wchar_t *, size_t);
  207. #endif
  208. #if __POSIX_VISIBLE >= 200809 || defined(_XLOCALE_H_)
  209. #include <xlocale/_wchar.h>
  210. #endif
  211. __END_DECLS
  212. #endif /* !_WCHAR_H_ */