]> git.saurik.com Git - apple/libc.git/blame_incremental - locale/FreeBSD/wctype.3
Libc-1082.50.1.tar.gz
[apple/libc.git] / locale / FreeBSD / wctype.3
... / ...
CommitLineData
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.7 2006/10/13 16:11:12 ru 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 nextwctype 3 ,
132.Xr xlocale 3
133.Sh STANDARDS
134The
135.Fn iswctype
136and
137.Fn wctype
138functions conform to
139.St -p1003.1-2001 .
140The
141.Dq Li ideogram ,
142.Dq Li phonogram ,
143.Dq Li special ,
144and
145.Dq Li rune
146character classes are extensions.
147.Sh HISTORY
148The
149.Fn iswctype
150and
151.Fn wctype
152functions first appeared in
153.Fx 5.0 .