Go to the first, previous, next, last section, table of contents.


Mapping of wide characters.

As for the classification functions the ISO C standard also generalizes the mapping functions. Instead of only allowing the two standard mappings the locale can contain others. Again, the localedef program already supports generating such locale data files.

Data Type: wctrans_t
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 beside using the return value of the wctrans function.

This type is defined in `wctype.h'.

Function: wctrans_t wctrans (const char *property)
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 it can afterwards be used 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:

@multitable @columnfractions .5 .5

  • "tolower" @tab "toupper" This function is declared in `wctype.h'.
  • Function: wint_t towctrans (wint_t wc, wctrans_t desc)
    The towctrans function maps the input character wc according to the rules of the mapping for which desc is an descriptor and returns the so found value. The desc value must be obtained by a successful call to wctrans. This function is declared in `wctype.h'.
    The ISO C standard also defines for the generally available mappings convenient shortcuts so that it is not necessary to call wctrans for them.
    Function: wint_t towlower (wint_t wc)
    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. towlower can be implemented using
    towctrans (wc, wctrans ("tolower"))
    
    This function is declared in `wctype.h'.
    Function: wint_t towupper (wint_t wc)
    If wc is a lower-case letter, towupper returns the corresponding upper-case letter. Otherwise wc is returned unchanged. towupper can be implemented using
    towctrans (wc, wctrans ("toupper"))
    
    This function is declared in `wctype.h'.
    The same warnings given in the last section for the use of the wide character classification function applies here. It is not possible to simply cast a char type value to a wint_t and use it as an argument for towctrans calls.


    Go to the first, previous, next, last section, table of contents.