]> git.saurik.com Git - apple/libc.git/blame - locale/FreeBSD/wctrans.3
Libc-1082.20.4.tar.gz
[apple/libc.git] / locale / FreeBSD / wctrans.3
CommitLineData
9385eb3d
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/wctrans.3,v 1.3 2002/11/29 17:35:09 ru Exp $
26.\"
27.Dd October 3, 2002
28.Dt WCTRANS 3
29.Os
30.Sh NAME
ad3c9f2a
A
31.Nm towctrans ,
32.Nm towctrans_l ,
33.Nm wctrans ,
34.Nm wctrans_l
9385eb3d
A
35.Nd "wide character mapping functions"
36.Sh LIBRARY
37.Lb libc
38.Sh SYNOPSIS
39.In wctype.h
40.Ft wint_t
ad3c9f2a
A
41.Fo towctrans
42.Fa "wint_t wc"
43.Fa "wctrans_t desc"
44.Fc
9385eb3d 45.Ft wctrans_t
ad3c9f2a
A
46.Fo wctrans
47.Fa "const char *charclass"
48.Fc
49.In wctype.h
50.In xlocale.h
51.Ft wint_t
52.Fo towctrans_l
53.Fa "wint_t wc"
54.Fa "wctrans_t desc"
55.Fa "locale_t loc"
56.Fc
57.Ft wctrans_t
58.Fo wctrans_l
59.Fa "const char *charclass"
60.Fa "locale_t loc"
61.Fc
9385eb3d
A
62.Sh DESCRIPTION
63The
64.Fn wctrans
65function returns a value of type
ad3c9f2a 66.Vt wctrans_t ,
9385eb3d
A
67which represents the requested wide character mapping operation and
68may be used as the second argument for calls to
69.Fn towctrans .
70.Pp
71The following character mapping names are recognised:
72.Bl -column -offset indent ".Li tolower" ".Li toupper"
73.It Li "tolower toupper"
74.El
75.Pp
76The
77.Fn towctrans
78function transliterates the wide character
ad3c9f2a 79.Fa wc ,
9385eb3d
A
80according to the mapping described by
81.Fa desc .
ad3c9f2a
A
82.Pp
83While the
84.Fn towctrans
85and
86.Fn wctrans
87functions use the current locale, the
88.Fn towctrans_l
89and
90.Fn wctrans_l
91functions may be passed locales directly. See
92.Xr xlocale 3
93for more information.
9385eb3d
A
94.Sh RETURN VALUES
95The
96.Fn towctrans
97function returns the transliterated character if successful, otherwise
98it returns the character unchanged and sets
99.Va errno .
100.Pp
101The
102.Fn wctrans
103function returns non-zero if successful, otherwise it returns zero
104and sets
105.Va errno .
106.Sh EXAMPLES
107Reimplement
108.Fn towupper
109in terms of
110.Fn towctrans
111and
112.Fn wctrans :
113.Bd -literal -offset indent
114wint_t
115mytowupper(wint_t wc)
116{
117 return (towctrans(wc, wctrans("toupper")));
118}
119.Ed
120.Sh ERRORS
121The
122.Fn towctrans
123function will fail if:
124.Bl -tag -width Er
125.It Bq Er EINVAL
126The supplied
127.Fa desc
128argument is invalid.
129.El
130.Pp
131The
132.Fn wctrans
133function will fail if:
134.Bl -tag -width Er
135.It Bq Er EINVAL
136The requested mapping name is invalid.
137.El
138.Sh SEE ALSO
139.Xr tolower 3 ,
140.Xr toupper 3 ,
ad3c9f2a
A
141.Xr wctype 3 ,
142.Xr xlocale 3
9385eb3d
A
143.Sh STANDARDS
144The
145.Fn towctrans
146and
147.Fn wctrans
148functions conform to
149.St -p1003.1-2001 .
150.Sh HISTORY
151The
152.Fn towctrans
153and
154.Fn wctrans
155functions first appeared in
156.Fx 5.0 .