xref: /freebsd/lib/libc/locale/wctype.3 (revision 069ac184)
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.Dd March 27, 2004
26.Dt WCTYPE 3
27.Os
28.Sh NAME
29.Nm iswctype , wctype
30.Nd "wide character class functions"
31.Sh LIBRARY
32.Lb libc
33.Sh SYNOPSIS
34.In wctype.h
35.Ft int
36.Fn iswctype "wint_t wc" "wctype_t charclass"
37.Ft wctype_t
38.Fn wctype "const char *property"
39.Sh DESCRIPTION
40The
41.Fn wctype
42function returns a value of type
43.Vt wctype_t
44which represents the requested wide character class and
45may be used as the second argument for calls to
46.Fn iswctype .
47.Pp
48The following character class names are recognised:
49.Bl -column -offset indent ".Li alnum" ".Li cntrl" ".Li ideogram" ".Li print" ".Li space"
50.It Li "alnum	cntrl	ideogram	print	space	xdigit"
51.It Li "alpha	digit	lower	punct	special"
52.It Li "blank	graph	phonogram	rune	upper"
53.El
54.Pp
55The
56.Fn iswctype
57function checks whether the wide character
58.Fa wc
59is in the character class
60.Fa charclass .
61.Sh RETURN VALUES
62The
63.Fn iswctype
64function returns non-zero if and only if
65.Fa wc
66has the property described by
67.Fa charclass ,
68or
69.Fa charclass
70is zero.
71.Pp
72The
73.Fn wctype
74function returns 0 if
75.Fa property
76is invalid, otherwise it returns a value of type
77.Vt wctype_t
78that can be used in subsequent calls to
79.Fn iswctype .
80.Sh EXAMPLES
81Reimplement
82.Xr iswalpha 3
83in terms of
84.Fn iswctype
85and
86.Fn wctype :
87.Bd -literal -offset indent
88int
89myiswalpha(wint_t wc)
90{
91	return (iswctype(wc, wctype("alpha")));
92}
93.Ed
94.Sh SEE ALSO
95.Xr ctype 3 ,
96.Xr nextwctype 3
97.Sh STANDARDS
98The
99.Fn iswctype
100and
101.Fn wctype
102functions conform to
103.St -p1003.1-2001 .
104The
105.Dq Li ideogram ,
106.Dq Li phonogram ,
107.Dq Li special ,
108and
109.Dq Li rune
110character classes are extensions.
111.Sh HISTORY
112The
113.Fn iswctype
114and
115.Fn wctype
116functions first appeared in
117.Fx 5.0 .
118