]> pd.if.org Git - pdclib/blob - functions/wctype/towupper.c
PDCLIB-3 towupper(3) towlower(3)
[pdclib] / functions / wctype / towupper.c
1 /* towupper( wint_t )\r
2 \r
3    This file is part of the Public Domain C Library (PDCLib).\r
4    Permission is granted to use, modify, and / or redistribute at will.\r
5 */\r
6 \r
7 #include <wctype.h>\r
8 #ifndef REGTEST\r
9 #include <_PDCLIB_locale.h>\r
10 \r
11 wint_t towupper( wint_t wc )\r
12 {\r
13     wint_t uwc = _PDCLIB_unpackwint( wc );\r
14     _PDCLIB_wcinfo_t *info = _PDCLIB_wcgetinfo( uwc );\r
15     if( info && info->upper != uwc ) \r
16     {\r
17         wc = info->upper;\r
18     }\r
19     return wc;\r
20 }\r
21 \r
22 #endif\r
23 \r
24 #ifdef TEST\r
25 #include <_PDCLIB_test.h>\r
26 \r
27 int main( void )\r
28 {\r
29     TESTCASE(towupper(0) == 0);\r
30     TESTCASE(towupper(L'a') == L'A');\r
31     TESTCASE(towupper(L'B') == L'B');\r
32     TESTCASE(towupper(L'0') == L'0');\r
33 \r
34     return TEST_RESULTS;\r
35 }\r
36 #endif\r