wchar.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. /* $OpenBSD: wchar.h,v 1.11 2010/07/24 09:58:39 guenther Exp $ */
  2. /* $NetBSD: wchar.h,v 1.16 2003/03/07 07:11:35 tshiozak Exp $ */
  3. /*-
  4. * Copyright (c)1999 Citrus Project,
  5. * All rights reserved.
  6. *
  7. * Redistribution and use in source and binary forms, with or without
  8. * modification, are permitted provided that the following conditions
  9. * are met:
  10. * 1. Redistributions of source code must retain the above copyright
  11. * notice, this list of conditions and the following disclaimer.
  12. * 2. Redistributions in binary form must reproduce the above copyright
  13. * notice, this list of conditions and the following disclaimer in the
  14. * documentation and/or other materials provided with the distribution.
  15. *
  16. * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  17. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  18. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  19. * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  20. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  21. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  22. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  23. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  24. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  25. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  26. * SUCH DAMAGE.
  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. #ifndef _WCHAR_H_
  57. #define _WCHAR_H_
  58. #include <sys/cdefs.h>
  59. #include <sys/_types.h>
  60. #include <sys/stdint.h> /* WCHAR_MAX/WCHAR_MIN */
  61. #ifndef NULL
  62. #ifdef __cplusplus
  63. #define NULL 0
  64. #else
  65. #define NULL ((void *)0)
  66. #endif
  67. #endif
  68. #if !defined(_WCHAR_T_DEFINED_) && !defined(__cplusplus)
  69. #define _WCHAR_T_DEFINED_
  70. #ifndef __WCHAR_TYPE__
  71. #define __WCHAR_TYPE__ int
  72. #endif
  73. typedef __WCHAR_TYPE__ wchar_t;
  74. #endif
  75. #ifndef _MBSTATE_T_DEFINED_
  76. #define _MBSTATE_T_DEFINED_
  77. typedef __mbstate_t mbstate_t;
  78. #endif
  79. #ifndef _WINT_T_DEFINED_
  80. #define _WINT_T_DEFINED_
  81. typedef __wint_t wint_t;
  82. #endif
  83. #ifndef _SIZE_T_DEFINED_
  84. #define _SIZE_T_DEFINED_
  85. typedef __size_t size_t;
  86. #endif
  87. #ifndef WEOF
  88. #define WEOF ((wint_t)-1)
  89. #endif
  90. __BEGIN_DECLS
  91. wint_t _TLIBC_CDECL_ btowc(int);
  92. int _TLIBC_CDECL_ wctob(wint_t);
  93. size_t _TLIBC_CDECL_ mbrlen(const char *, size_t, mbstate_t *);
  94. size_t _TLIBC_CDECL_ mbrtowc(wchar_t *, const char *, size_t, mbstate_t *);
  95. int _TLIBC_CDECL_ mbsinit(const mbstate_t *);
  96. size_t _TLIBC_CDECL_ mbsrtowcs(wchar_t *, const char **, size_t, mbstate_t *);
  97. size_t _TLIBC_CDECL_ wcrtomb(char *, wchar_t, mbstate_t *);
  98. wchar_t * _TLIBC_CDECL_ wcschr(const wchar_t *, wchar_t);
  99. int _TLIBC_CDECL_ wcscmp(const wchar_t *, const wchar_t *);
  100. int _TLIBC_CDECL_ wcscoll(const wchar_t *, const wchar_t *);
  101. size_t _TLIBC_CDECL_ wcscspn(const wchar_t *, const wchar_t *);
  102. size_t _TLIBC_CDECL_ wcslen(const wchar_t *);
  103. wchar_t * _TLIBC_CDECL_ wcsncat(wchar_t *, const wchar_t *, size_t);
  104. int _TLIBC_CDECL_ wcsncmp(const wchar_t *, const wchar_t *, size_t);
  105. wchar_t * _TLIBC_CDECL_ wcsncpy(wchar_t *, const wchar_t *, size_t);
  106. wchar_t * _TLIBC_CDECL_ wcspbrk(const wchar_t *, const wchar_t *);
  107. wchar_t * _TLIBC_CDECL_ wcsrchr(const wchar_t *, wchar_t);
  108. size_t _TLIBC_CDECL_ wcsrtombs(char *, const wchar_t **, size_t, mbstate_t *);
  109. size_t _TLIBC_CDECL_ wcsspn(const wchar_t *, const wchar_t *);
  110. wchar_t * _TLIBC_CDECL_ wcsstr(const wchar_t *, const wchar_t *);
  111. wchar_t * _TLIBC_CDECL_ wcstok(wchar_t *, const wchar_t *, wchar_t **);
  112. size_t _TLIBC_CDECL_ wcsxfrm(wchar_t *, const wchar_t *, size_t);
  113. wchar_t * _TLIBC_CDECL_ wmemchr(const wchar_t *, wchar_t, size_t);
  114. int _TLIBC_CDECL_ wmemcmp(const wchar_t *, const wchar_t *, size_t);
  115. wchar_t * _TLIBC_CDECL_ wmemcpy(wchar_t *, const wchar_t *, size_t);
  116. wchar_t * _TLIBC_CDECL_ wmemmove(wchar_t *, const wchar_t *, size_t);
  117. wchar_t * _TLIBC_CDECL_ wmemset(wchar_t *, wchar_t, size_t);
  118. int _TLIBC_CDECL_ swprintf(wchar_t *, size_t, const wchar_t *, ...);
  119. int _TLIBC_CDECL_ vswprintf(wchar_t *, size_t, const wchar_t *, __va_list);
  120. /* leagcy version of wcsstr */
  121. wchar_t * _TLIBC_CDECL_ wcswcs(const wchar_t *, const wchar_t *);
  122. __END_DECLS
  123. #endif /* !_WCHAR_H_ */