towctrans.3c (2010 09)
t
towctrans(3C) towctrans(3C)
NAME
towctrans(), wctrans() - character transliteration
SYNOPSIS
#include <wctype.h>
wint_t towctrans(wint_t wc, wctrans_t desc);
wctrans_t wctrans(const char *charclass);
DESCRIPTION
towctrans()
The towctrans() function transliterates the wide-character code wc using the map-
ping described by desc . The current setting of the
LC_CTYPE category should be the
same as during the call to
wctrans()
that returned the value desc . If the value of desc
is invalidated (that is, not obtained by a call to
wctrans() or desc is invalidated by a
subsequent call to
setlocale() that has affected category
LC_CTYPE, the result is
undefined.
wctrans() The wctrans() function is defined for valid character mapping names identified in the
current locale. The charclass is a string identifying a generic character mapping name
for which codeset-specific information is required. The following character mapping
names are defined in all locales - "tolower" and "toupper". The function returns a value of
type wctrans_t, which can be used as the second argument to subsequent calls of
towctrans(). The wctrans() function determines values of wctrans_t according
to the rules of the coded character set defined by character mapping information in the
program’s locale (category LC_CTYPE). The values returned by
wctrans() are valid
until a call to
setlocale() that modifies the category LC_CTYPE.
APPLICATION USAGE
The strings "tolower" and "toupper" are reserved for the standard mapping names. In the table below, the
functions in the left column are equivalent to the functions in the right column.
towlower(wc) towctrans(wc, wctrans("tolower"))
towupper(wc) towctrans(wc, wctrans("toupper"))
The prototypes of these functions are available to applications if they are:
a.
c99 conformant.
b. Compiled with
-D_XOPEN_SOURCE
macro with a value >=500.
c. Compiled with
-D_POSIX_C_SOURCE
macro with a value >= 200112.
RETURN VALUE
If successful, the
towctrans() function returns the mapped value of wc using the mapping described
by desc . Otherwise it returns wc unchanged.
The
wctrans() function returns (wchar_t)0 if the given character mapping name is not valid for the
current locale (category LC_CTYPE), otherwise it returns a non-zero object of type wctrans_t that can
be used in calls to towctrans().
ERRORS
The
towctrans() function may fail if:
[EINVAL] desc contains an invalid transliteration descriptor.
The
wctrans() function may fail if:
[EINVAL] The character mapping name pointed to by charclass is not valid in the current
locale.
AUTHOR
towctrans(), wctrans() were developed by HP and Mitsubishi Electric Corporation.
SEE ALSO
wconv(3C), thread_safety(5).
HP-UX 11i Version 3: September 2010 − 1 − Hewlett-Packard Company 1