wctype.h 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. /* Copyright (C) 1996,1997,1998,1999,2000,2001 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, write to the Free
  13. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  14. 02111-1307 USA. */
  15. /*
  16. * ISO C99 Standard: 7.25
  17. * Wide character classification and mapping utilities <wctype.h>
  18. */
  19. #ifndef _WCTYPE_H
  20. #include <features.h>
  21. #include <bits/types.h>
  22. #ifndef __UCLIBC_HAS_WCHAR__
  23. #error Attempted to include wchar.h when uClibc built without wide char support.
  24. #endif
  25. #ifndef __need_iswxxx
  26. # define _WCTYPE_H 1
  27. #include <bits/uClibc_ctype.h>
  28. /* We try to get wint_t from <stddef.h>, but not all GCC versions define it
  29. there. So define it ourselves if it remains undefined. */
  30. # define __need_wint_t
  31. # include <stddef.h>
  32. # ifndef _WINT_T
  33. /* Integral type unchanged by default argument promotions that can
  34. hold any value corresponding to members of the extended character
  35. set, as well as at least one value that does not correspond to any
  36. member of the extended character set. */
  37. # define _WINT_T
  38. typedef unsigned int wint_t;
  39. # endif
  40. /* Constant expression of type `wint_t' whose value does not correspond
  41. to any member of the extended character set. */
  42. # ifndef WEOF
  43. # define WEOF (0xffffffffu)
  44. # endif
  45. #endif
  46. #undef __need_iswxxx
  47. /* The following part is also used in the <wcsmbs.h> header when compiled
  48. in the Unix98 compatibility mode. */
  49. #ifndef __iswxxx_defined
  50. # define __iswxxx_defined 1
  51. /* Scalar type that can hold values which represent locale-specific
  52. character classifications. */
  53. /* uClibc note: glibc uses an unsigned long int. */
  54. typedef unsigned int wctype_t;
  55. __BEGIN_DECLS
  56. /*
  57. * Wide-character classification functions: 7.15.2.1.
  58. */
  59. /* Test for any wide character for which `iswalpha' or `iswdigit' is
  60. true. */
  61. extern int iswalnum (wint_t __wc) __THROW;
  62. /* Test for any wide character for which `iswupper' or 'iswlower' is
  63. true, or any wide character that is one of a locale-specific set of
  64. wide-characters for which none of `iswcntrl', `iswdigit',
  65. `iswpunct', or `iswspace' is true. */
  66. extern int iswalpha (wint_t __wc) __THROW;
  67. /* Test for any control wide character. */
  68. extern int iswcntrl (wint_t __wc) __THROW;
  69. /* Test for any wide character that corresponds to a decimal-digit
  70. character. */
  71. extern int iswdigit (wint_t __wc) __THROW;
  72. /* Test for any wide character for which `iswprint' is true and
  73. `iswspace' is false. */
  74. extern int iswgraph (wint_t __wc) __THROW;
  75. /* Test for any wide character that corresponds to a lowercase letter
  76. or is one of a locale-specific set of wide characters for which
  77. none of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */
  78. extern int iswlower (wint_t __wc) __THROW;
  79. /* Test for any printing wide character. */
  80. extern int iswprint (wint_t __wc) __THROW;
  81. /* Test for any printing wide character that is one of a
  82. locale-specific et of wide characters for which neither `iswspace'
  83. nor `iswalnum' is true. */
  84. extern int iswpunct (wint_t __wc) __THROW;
  85. /* Test for any wide character that corresponds to a locale-specific
  86. set of wide characters for which none of `iswalnum', `iswgraph', or
  87. `iswpunct' is true. */
  88. extern int iswspace (wint_t __wc) __THROW;
  89. /* Test for any wide character that corresponds to an uppercase letter
  90. or is one of a locale-specific set of wide character for which none
  91. of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */
  92. extern int iswupper (wint_t __wc) __THROW;
  93. /* Test for any wide character that corresponds to a hexadecimal-digit
  94. character equivalent to that performed be the functions described
  95. in the previous subclause. */
  96. extern int iswxdigit (wint_t __wc) __THROW;
  97. /* Test for any wide character that corresponds to a standard blank
  98. wide character or a locale-specific set of wide characters for
  99. which `iswalnum' is false. */
  100. # ifdef __USE_ISOC99
  101. extern int iswblank (wint_t __wc) __THROW;
  102. # endif
  103. /*
  104. * Extensible wide-character classification functions: 7.15.2.2.
  105. */
  106. /* Construct value that describes a class of wide characters identified
  107. by the string argument PROPERTY. */
  108. extern wctype_t wctype (__const char *__property) __THROW;
  109. /* Determine whether the wide-character WC has the property described by
  110. DESC. */
  111. extern int iswctype (wint_t __wc, wctype_t __desc) __THROW;
  112. /*
  113. * Wide-character case-mapping functions: 7.15.3.1.
  114. */
  115. /* Scalar type that can hold values which represent locale-specific
  116. character mappings. */
  117. /* typedef __const __int32_t *wctrans_t; */
  118. typedef unsigned int wctrans_t; /* TODO: fix this */
  119. /* Converts an uppercase letter to the corresponding lowercase letter. */
  120. extern wint_t towlower (wint_t __wc) __THROW;
  121. /* Converts an lowercase letter to the corresponding uppercase letter. */
  122. extern wint_t towupper (wint_t __wc) __THROW;
  123. __END_DECLS
  124. #endif /* need iswxxx. */
  125. /* The remaining definitions and declarations must not appear in the
  126. <wcsmbs.h> header. */
  127. #ifdef _WCTYPE_H
  128. /*
  129. * Extensible wide-character mapping functions: 7.15.3.2.
  130. */
  131. __BEGIN_DECLS
  132. /* Construct value that describes a mapping between wide characters
  133. identified by the string argument PROPERTY. */
  134. extern wctrans_t wctrans (__const char *__property) __THROW;
  135. /* Map the wide character WC using the mapping described by DESC. */
  136. extern wint_t towctrans (wint_t __wc, wctrans_t __desc) __THROW;
  137. #if 0
  138. /* # ifdef __USE_GNU */
  139. /* Declare the interface to extended locale model. */
  140. # include <xlocale.h>
  141. /* Test for any wide character for which `iswalpha' or `iswdigit' is
  142. true. */
  143. extern int __iswalnum_l (wint_t __wc, __locale_t __locale) __THROW;
  144. /* Test for any wide character for which `iswupper' or 'iswlower' is
  145. true, or any wide character that is one of a locale-specific set of
  146. wide-characters for which none of `iswcntrl', `iswdigit',
  147. `iswpunct', or `iswspace' is true. */
  148. extern int __iswalpha_l (wint_t __wc, __locale_t __locale) __THROW;
  149. /* Test for any control wide character. */
  150. extern int __iswcntrl_l (wint_t __wc, __locale_t __locale) __THROW;
  151. /* Test for any wide character that corresponds to a decimal-digit
  152. character. */
  153. extern int __iswdigit_l (wint_t __wc, __locale_t __locale) __THROW;
  154. /* Test for any wide character for which `iswprint' is true and
  155. `iswspace' is false. */
  156. extern int __iswgraph_l (wint_t __wc, __locale_t __locale) __THROW;
  157. /* Test for any wide character that corresponds to a lowercase letter
  158. or is one of a locale-specific set of wide characters for which
  159. none of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */
  160. extern int __iswlower_l (wint_t __wc, __locale_t __locale) __THROW;
  161. /* Test for any printing wide character. */
  162. extern int __iswprint_l (wint_t __wc, __locale_t __locale) __THROW;
  163. /* Test for any printing wide character that is one of a
  164. locale-specific et of wide characters for which neither `iswspace'
  165. nor `iswalnum' is true. */
  166. extern int __iswpunct_l (wint_t __wc, __locale_t __locale) __THROW;
  167. /* Test for any wide character that corresponds to a locale-specific
  168. set of wide characters for which none of `iswalnum', `iswgraph', or
  169. `iswpunct' is true. */
  170. extern int __iswspace_l (wint_t __wc, __locale_t __locale) __THROW;
  171. /* Test for any wide character that corresponds to an uppercase letter
  172. or is one of a locale-specific set of wide character for which none
  173. of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */
  174. extern int __iswupper_l (wint_t __wc, __locale_t __locale) __THROW;
  175. /* Test for any wide character that corresponds to a hexadecimal-digit
  176. character equivalent to that performed be the functions described
  177. in the previous subclause. */
  178. extern int __iswxdigit_l (wint_t __wc, __locale_t __locale) __THROW;
  179. /* Test for any wide character that corresponds to a standard blank
  180. wide character or a locale-specific set of wide characters for
  181. which `iswalnum' is false. */
  182. extern int __iswblank_l (wint_t __wc, __locale_t __locale) __THROW;
  183. /* Construct value that describes a class of wide characters identified
  184. by the string argument PROPERTY. */
  185. extern wctype_t __wctype_l (__const char *__property, __locale_t __locale)
  186. __THROW;
  187. /* Determine whether the wide-character WC has the property described by
  188. DESC. */
  189. extern int __iswctype_l (wint_t __wc, wctype_t __desc, __locale_t __locale)
  190. __THROW;
  191. /*
  192. * Wide-character case-mapping functions.
  193. */
  194. /* Converts an uppercase letter to the corresponding lowercase letter. */
  195. extern wint_t __towlower_l (wint_t __wc, __locale_t __locale) __THROW;
  196. /* Converts an lowercase letter to the corresponding uppercase letter. */
  197. extern wint_t __towupper_l (wint_t __wc, __locale_t __locale) __THROW;
  198. /* Construct value that describes a mapping between wide characters
  199. identified by the string argument PROPERTY. */
  200. extern wctrans_t __wctrans_l (__const char *__property, __locale_t __locale)
  201. __THROW;
  202. /* Map the wide character WC using the mapping described by DESC. */
  203. extern wint_t __towctrans_l (wint_t __wc, wctrans_t __desc,
  204. __locale_t __locale) __THROW;
  205. # endif /* Use GNU. */
  206. __END_DECLS
  207. #endif /* __WCTYPE_H defined. */
  208. #endif /* wctype.h */