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