The standard wide
character header file <wctype.h>
defines
three data types and numerous macros and functions that are useful in the
analysis of text that contain extended or wide (2 byte) character data.
The three data types declared are wint_t
,
wctrans_t
, and wctype_t
. The type wint_t
is an integer type that can hold any valid wide character (of type wchar_t
) as well as the value of the macro WEOF
. The type
wctrans_t
is
a scalar type that can hold values that represent locale-specific character
mappings. The type wctype_t
is a scalar type
that can hold values that represent locale-specific character classifications.
Also defined in the header file <wctype.h>
is the macro
WEOF
. This macro
expands to a constant value of type wint_t
,
which does not correspond to any valid member of the wide character set.
It is accepted and returned by several of the functions (or macros) defined
in the header file and is used to indicate an error condition.
The wide character classification functions (i.e., the iswXXX
functions) and
the case mapping functions (that is,
the towupper
and towlower
functions) are defined in the header file as macros. Therefore, one should
always include this header if one uses any of these macros; otherwise, the
compiler will generate a reference to a function of the same name, which
can degrade performance.
The results produced by the functions in all four groups
are affected by the current locale's LC_CTYPE
category, which may cause a different character type array to be used than
the one supplied for the default C locale. And for those functions (or macros)
that accept an argument of type wint_t
, the
argument has to be representable as a valid wide character (that is, of type wchar_t
) or have the value of WEOF
.
Otherwise, its behavior is undefined.
Wide Character Type Macros and Functions and Their Return Values lists the functions (or macros) defined in the
<wctype.h>
header file. These functions (or macros) can be classified
into the following four groups:
Each of these groups is discussed in one of the following
sections.
The following functions provide wide character classification:
These classification functions are closely related to
the corresponding byte classification functions (that is, the isXXX
functions) declared in the header <ctype.h>
. These functions
return nonzero (true) only if the value
of their argument conforms to the specifications stated in the description
of the function.
The following extensible functions provide wide character classification:
These extensible functions provide the testing equivalent
of the standard wide character classification functions described above.
That is, each of the following expressions return true:
( iswctype(wc, wctype("alnum")) == iswalnum(wc) )
( iswctype(wc, wctype("alpha")) == iswalpha(wc) )
( iswctype(wc, wctype("cntrl")) == iswcntrl(wc) )
( iswctype(wc, wctype("digit")) == iswdigit(wc) )
( iswctype(wc, wctype("graph")) == iswgraph(wc) )
( iswctype(wc, wctype("lower")) == iswlower(wc) )
( iswctype(wc, wctype("print")) == iswprint(wc) )
( iswctype(wc, wctype("punct")) == iswpunct(wc) )
( iswctype(wc, wctype("space")) == iswspace(wc) )
( iswctype(wc, wctype("upper")) == iswupper(wc) )
( iswctype(wc, wctype("xdigit")) == iswxdigit(wc) )
These functions also provide the SAS/C Library a standard
mechanism to create additional classification functions in the future.
The following functions provide wide character case mapping:
Each of these functions convert or map the case of a
wide character. Each returns its argument unchanged if it does not qualify
for the conversion.
The following extensible functions provide wide character mapping:
These functions also provide the SAS/C Library a standard
mechanism to create additional mapping functions in the future.
Copyright © 2001
by SAS Institute Inc., Cary, NC, USA. All rights reserved.