Node:Wide Character Case Conversion, Previous:Using Wide Char Classes, Up:Character Handling
The classification functions are also generalized by the ISO C
standard. Instead of just allowing the two standard mappings, a
locale can contain others. Again, the localedef
program
already supports generating such locale data files.
wctrans_t | Data Type |
This data type is defined as a scalar type which can hold a value
representing the locale-dependent character mapping. There is no way to
construct such a value apart from using the return value of the
wctrans function.
This type is defined in |
wctrans_t wctrans (const char *property) | Function |
The wctrans function has to be used to find out whether a named
mapping is defined in the current locale selected for the
LC_CTYPE category. If the returned value is non-zero, you can use
it afterwards in calls to towctrans . If the return value is
zero no such mapping is known in the current locale.
Beside locale-specific mappings there are two mappings which are guaranteed to be available in every locale:
These functions are declared in |
wint_t towctrans (wint_t wc, wctrans_t desc) | Function |
towctrans maps the input character wc
according to the rules of the mapping for which desc is a
descriptor, and returns the value it finds. desc must be
obtained by a successful call to wctrans .
This function is declared in |
For the generally available mappings, the ISO C standard defines
convenient shortcuts so that it is not necessary to call wctrans
for them.
wint_t towlower (wint_t wc) | Function |
If wc is an upper-case letter, towlower returns the corresponding
lower-case letter. If wc is not an upper-case letter,
wc is returned unchanged.
towctrans (wc, wctrans ("tolower")) This function is declared in |
wint_t towupper (wint_t wc) | Function |
If wc is a lower-case letter, towupper returns the corresponding
upper-case letter. Otherwise wc is returned unchanged.
towctrans (wc, wctrans ("toupper")) This function is declared in |
The same warnings given in the last section for the use of the wide
character classification functions apply here. It is not possible to
simply cast a char
type value to a wint_t
and use it as an
argument to towctrans
calls.