1/* Copyright (C) 1996-2022 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
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.
8
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.
13
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/>. */
17
18/*
19 * ISO C99 Standard: 7.25
20 * Wide character classification and mapping utilities <wctype.h>
21 */
22
23#ifndef _WCTYPE_H
24#define _WCTYPE_H 1
25
26#include <features.h>
27#include <bits/types.h>
28#include <bits/types/wint_t.h>
29
30/* Constant expression of type `wint_t' whose value does not correspond
31 to any member of the extended character set. */
32#ifndef WEOF
33# define WEOF (0xffffffffu)
34#endif
35
36/* Some definitions from this header also appear in <wchar.h> in
37 Unix98 mode. */
38#include <bits/wctype-wchar.h>
39
40/*
41 * Extensible wide-character mapping functions: 7.15.3.2.
42 */
43
44__BEGIN_DECLS
45
46/* Scalar type that can hold values which represent locale-specific
47 character mappings. */
48typedef const __int32_t *wctrans_t;
49
50/* Construct value that describes a mapping between wide characters
51 identified by the string argument PROPERTY. */
52extern wctrans_t wctrans (const char *__property) __THROW;
53
54/* Map the wide character WC using the mapping described by DESC. */
55extern wint_t towctrans (wint_t __wc, wctrans_t __desc) __THROW;
56
57# ifdef __USE_XOPEN2K8
58/* POSIX.1-2008 extended locale interface (see locale.h). */
59# include <bits/types/locale_t.h>
60
61/* Test for any wide character for which `iswalpha' or `iswdigit' is
62 true. */
63extern int iswalnum_l (wint_t __wc, locale_t __locale) __THROW;
64
65/* Test for any wide character for which `iswupper' or 'iswlower' is
66 true, or any wide character that is one of a locale-specific set of
67 wide-characters for which none of `iswcntrl', `iswdigit',
68 `iswpunct', or `iswspace' is true. */
69extern int iswalpha_l (wint_t __wc, locale_t __locale) __THROW;
70
71/* Test for any control wide character. */
72extern int iswcntrl_l (wint_t __wc, locale_t __locale) __THROW;
73
74/* Test for any wide character that corresponds to a decimal-digit
75 character. */
76extern int iswdigit_l (wint_t __wc, locale_t __locale) __THROW;
77
78/* Test for any wide character for which `iswprint' is true and
79 `iswspace' is false. */
80extern int iswgraph_l (wint_t __wc, locale_t __locale) __THROW;
81
82/* Test for any wide character that corresponds to a lowercase letter
83 or is one of a locale-specific set of wide characters for which
84 none of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */
85extern int iswlower_l (wint_t __wc, locale_t __locale) __THROW;
86
87/* Test for any printing wide character. */
88extern int iswprint_l (wint_t __wc, locale_t __locale) __THROW;
89
90/* Test for any printing wide character that is one of a
91 locale-specific et of wide characters for which neither `iswspace'
92 nor `iswalnum' is true. */
93extern int iswpunct_l (wint_t __wc, locale_t __locale) __THROW;
94
95/* Test for any wide character that corresponds to a locale-specific
96 set of wide characters for which none of `iswalnum', `iswgraph', or
97 `iswpunct' is true. */
98extern int iswspace_l (wint_t __wc, locale_t __locale) __THROW;
99
100/* Test for any wide character that corresponds to an uppercase letter
101 or is one of a locale-specific set of wide character for which none
102 of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */
103extern int iswupper_l (wint_t __wc, locale_t __locale) __THROW;
104
105/* Test for any wide character that corresponds to a hexadecimal-digit
106 character equivalent to that performed be the functions described
107 in the previous subclause. */
108extern int iswxdigit_l (wint_t __wc, locale_t __locale) __THROW;
109
110/* Test for any wide character that corresponds to a standard blank
111 wide character or a locale-specific set of wide characters for
112 which `iswalnum' is false. */
113extern int iswblank_l (wint_t __wc, locale_t __locale) __THROW;
114
115/* Construct value that describes a class of wide characters identified
116 by the string argument PROPERTY. */
117extern wctype_t wctype_l (const char *__property, locale_t __locale)
118 __THROW;
119
120/* Determine whether the wide-character WC has the property described by
121 DESC. */
122extern int iswctype_l (wint_t __wc, wctype_t __desc, locale_t __locale)
123 __THROW;
124
125/*
126 * Wide-character case-mapping functions.
127 */
128
129/* Converts an uppercase letter to the corresponding lowercase letter. */
130extern wint_t towlower_l (wint_t __wc, locale_t __locale) __THROW;
131
132/* Converts an lowercase letter to the corresponding uppercase letter. */
133extern wint_t towupper_l (wint_t __wc, locale_t __locale) __THROW;
134
135/* Construct value that describes a mapping between wide characters
136 identified by the string argument PROPERTY. */
137extern wctrans_t wctrans_l (const char *__property, locale_t __locale)
138 __THROW;
139
140/* Map the wide character WC using the mapping described by DESC. */
141extern wint_t towctrans_l (wint_t __wc, wctrans_t __desc,
142 locale_t __locale) __THROW;
143
144# endif /* Use POSIX 2008. */
145
146__END_DECLS
147
148#endif /* wctype.h */
149