Use Linux 5.12 and GCC 11 branch in build-many-glibcs.py.
[glibc.git] / wctype / bits / wctype-wchar.h
blob01827a7f2ba82c528102cb133b64a4f008513538
1 /* Copyright (C) 1996-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */
19 * ISO C99 Standard: 7.25
20 * Wide character classification and mapping utilities <wctype.h>
23 #ifndef _BITS_WCTYPE_WCHAR_H
24 #define _BITS_WCTYPE_WCHAR_H 1
26 #if !defined _WCTYPE_H && !defined _WCHAR_H
27 #error "Never include <bits/wctype-wchar.h> directly; include <wctype.h> or <wchar.h> instead."
28 #endif
30 #include <bits/types.h>
31 #include <bits/types/wint_t.h>
33 /* The definitions in this header are specified to appear in <wctype.h>
34 in ISO C99, but in <wchar.h> in Unix98. _GNU_SOURCE follows C99. */
36 /* Scalar type that can hold values which represent locale-specific
37 character classifications. */
38 typedef unsigned long int wctype_t;
40 # ifndef _ISwbit
41 /* The characteristics are stored always in network byte order (big
42 endian). We define the bit value interpretations here dependent on the
43 machine's byte order. */
45 # include <bits/endian.h>
46 # if __BYTE_ORDER == __BIG_ENDIAN
47 # define _ISwbit(bit) (1 << (bit))
48 # else /* __BYTE_ORDER == __LITTLE_ENDIAN */
49 # define _ISwbit(bit) \
50 ((bit) < 8 ? (int) ((1UL << (bit)) << 24) \
51 : ((bit) < 16 ? (int) ((1UL << (bit)) << 8) \
52 : ((bit) < 24 ? (int) ((1UL << (bit)) >> 8) \
53 : (int) ((1UL << (bit)) >> 24))))
54 # endif
56 enum
58 __ISwupper = 0, /* UPPERCASE. */
59 __ISwlower = 1, /* lowercase. */
60 __ISwalpha = 2, /* Alphabetic. */
61 __ISwdigit = 3, /* Numeric. */
62 __ISwxdigit = 4, /* Hexadecimal numeric. */
63 __ISwspace = 5, /* Whitespace. */
64 __ISwprint = 6, /* Printing. */
65 __ISwgraph = 7, /* Graphical. */
66 __ISwblank = 8, /* Blank (usually SPC and TAB). */
67 __ISwcntrl = 9, /* Control character. */
68 __ISwpunct = 10, /* Punctuation. */
69 __ISwalnum = 11, /* Alphanumeric. */
71 _ISwupper = _ISwbit (__ISwupper), /* UPPERCASE. */
72 _ISwlower = _ISwbit (__ISwlower), /* lowercase. */
73 _ISwalpha = _ISwbit (__ISwalpha), /* Alphabetic. */
74 _ISwdigit = _ISwbit (__ISwdigit), /* Numeric. */
75 _ISwxdigit = _ISwbit (__ISwxdigit), /* Hexadecimal numeric. */
76 _ISwspace = _ISwbit (__ISwspace), /* Whitespace. */
77 _ISwprint = _ISwbit (__ISwprint), /* Printing. */
78 _ISwgraph = _ISwbit (__ISwgraph), /* Graphical. */
79 _ISwblank = _ISwbit (__ISwblank), /* Blank (usually SPC and TAB). */
80 _ISwcntrl = _ISwbit (__ISwcntrl), /* Control character. */
81 _ISwpunct = _ISwbit (__ISwpunct), /* Punctuation. */
82 _ISwalnum = _ISwbit (__ISwalnum) /* Alphanumeric. */
84 # endif /* Not _ISwbit */
87 __BEGIN_DECLS
90 * Wide-character classification functions: 7.15.2.1.
93 /* Test for any wide character for which `iswalpha' or `iswdigit' is
94 true. */
95 extern int iswalnum (wint_t __wc) __THROW;
97 /* Test for any wide character for which `iswupper' or 'iswlower' is
98 true, or any wide character that is one of a locale-specific set of
99 wide-characters for which none of `iswcntrl', `iswdigit',
100 `iswpunct', or `iswspace' is true. */
101 extern int iswalpha (wint_t __wc) __THROW;
103 /* Test for any control wide character. */
104 extern int iswcntrl (wint_t __wc) __THROW;
106 /* Test for any wide character that corresponds to a decimal-digit
107 character. */
108 extern int iswdigit (wint_t __wc) __THROW;
110 /* Test for any wide character for which `iswprint' is true and
111 `iswspace' is false. */
112 extern int iswgraph (wint_t __wc) __THROW;
114 /* Test for any wide character that corresponds to a lowercase letter
115 or is one of a locale-specific set of wide characters for which
116 none of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */
117 extern int iswlower (wint_t __wc) __THROW;
119 /* Test for any printing wide character. */
120 extern int iswprint (wint_t __wc) __THROW;
122 /* Test for any printing wide character that is one of a
123 locale-specific et of wide characters for which neither `iswspace'
124 nor `iswalnum' is true. */
125 extern int iswpunct (wint_t __wc) __THROW;
127 /* Test for any wide character that corresponds to a locale-specific
128 set of wide characters for which none of `iswalnum', `iswgraph', or
129 `iswpunct' is true. */
130 extern int iswspace (wint_t __wc) __THROW;
132 /* Test for any wide character that corresponds to an uppercase letter
133 or is one of a locale-specific set of wide character for which none
134 of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */
135 extern int iswupper (wint_t __wc) __THROW;
137 /* Test for any wide character that corresponds to a hexadecimal-digit
138 character equivalent to that performed be the functions described
139 in the previous subclause. */
140 extern int iswxdigit (wint_t __wc) __THROW;
142 /* Test for any wide character that corresponds to a standard blank
143 wide character or a locale-specific set of wide characters for
144 which `iswalnum' is false. */
145 # ifdef __USE_ISOC99
146 extern int iswblank (wint_t __wc) __THROW;
147 # endif
150 * Extensible wide-character classification functions: 7.15.2.2.
153 /* Construct value that describes a class of wide characters identified
154 by the string argument PROPERTY. */
155 extern wctype_t wctype (const char *__property) __THROW;
157 /* Determine whether the wide-character WC has the property described by
158 DESC. */
159 extern int iswctype (wint_t __wc, wctype_t __desc) __THROW;
162 * Wide-character case-mapping functions: 7.15.3.1.
165 /* Converts an uppercase letter to the corresponding lowercase letter. */
166 extern wint_t towlower (wint_t __wc) __THROW;
168 /* Converts an lowercase letter to the corresponding uppercase letter. */
169 extern wint_t towupper (wint_t __wc) __THROW;
171 __END_DECLS
173 #endif /* bits/wctype-wchar.h. */