]> git.saurik.com Git - apple/libc.git/blame - locale/wctype.3
Libc-583.tar.gz
[apple/libc.git] / locale / wctype.3
CommitLineData
224c7076
A
1.\" Copyright (c) 2002 Tim J. Robbins
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\" notice, this list of conditions and the following disclaimer in the
11.\" documentation and/or other materials provided with the distribution.
12.\"
13.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23.\" SUCH DAMAGE.
24.\"
25.\" $FreeBSD: src/lib/libc/locale/wctype.3,v 1.5 2004/03/27 08:59:21 tjr Exp $
26.\"
27.Dd March 27, 2004
28.Dt WCTYPE 3
29.Os
30.Sh NAME
31.Nm iswctype ,
32.Nm iswctype_l ,
33.Nm wctype ,
34.Nm wctype_l
35.Nd "wide character class functions"
36.Sh LIBRARY
37.Lb libc
38.Sh SYNOPSIS
39.In wctype.h
40.Ft int
41.Fo iswctype
42.Fa "wint_t wc"
43.Fa "wctype_t charclass"
44.Fc
45.Ft wctype_t
46.Fo wctype
47.Fa "const char *property"
48.Fc
49.In wctype.h
50.In xlocale.h
51.Ft int
52.Fo iswctype_l
53.Fa "wint_t wc"
54.Fa "wctype_t charclass"
55.Fa "locale_t loc"
56.Fc
57.Ft wctype_t
58.Fo wctype_l
59.Fa "const char *property"
60.Fa "locale_t loc"
61.Fc
62.Sh DESCRIPTION
63The
64.Fn wctype
65function returns a value of type
66.Vt wctype_t ,
67which represents the requested wide character class and
68may be used as the second argument for calls to
69.Fn iswctype .
70.Pp
71The following character class names are recognised:
72.Bl -column -offset indent ".Li alnum" ".Li cntrl" ".Li ideogram" ".Li print" ".Li space"
73.It Li "alnum cntrl ideogram print space xdigit"
74.It Li "alpha digit lower punct special"
75.It Li "blank graph phonogram rune upper"
76.El
77.Pp
78The
79.Fn iswctype
80function checks whether the wide character
81.Fa wc
82is in the character class
83.Fa charclass .
84.Pp
85Although the
86.Fn iswctype
87and
88.Fn wctype
89functions use the current locale, the
90.Fn iswctype_l
91and
92.Fn wctype_l
93functions may be passed locales directly. See
94.Xr xlocale 3
95for more information.
96.Sh RETURN VALUES
97The
98.Fn iswctype
99function returns non-zero if and only if
100.Fa wc
101has the property described by
102.Fa charclass ,
103or
104.Fa charclass
105is zero.
106.Pp
107The
108.Fn wctype
109function returns 0 if
110.Fa property
111is invalid; otherwise, it returns a value of type
112.Vt wctype_t
113that can be used in subsequent calls to
114.Fn iswctype .
115.Sh EXAMPLES
116Reimplement
117.Xr iswalpha 3
118in terms of
119.Fn iswctype
120and
121.Fn wctype :
122.Bd -literal -offset indent
123int
124myiswalpha(wint_t wc)
125{
126 return (iswctype(wc, wctype("alpha")));
127}
128.Ed
129.Sh SEE ALSO
130.Xr ctype 3 ,
131.Xr xlocale 3
132.Sh STANDARDS
133The
134.Fn iswctype
135and
136.Fn wctype
137functions conform to
138.St -p1003.1-2001 .
139The
140.Dq Li ideogram ,
141.Dq Li phonogram
142.Dq Li special ,
143and
144.Dq Li rune
145character classes are extensions.
146.Sh HISTORY
147The
148.Fn iswctype
149and
150.Fn wctype
151functions first appeared in
152.Fx 5.0 .