X-Git-Url: https://pd.if.org/git/?p=pdclib.old;a=blobdiff_plain;f=functions%2Fwctype%2Ftowupper.c;fp=functions%2Fwctype%2Ftowupper.c;h=faac657501cac24ec24b262673befcdb97f5713f;hp=0000000000000000000000000000000000000000;hb=b641165a0d122178a33070e3434ab7b49397ad94;hpb=54ea00c95db2e7f49aba027e3f645c99413c415a diff --git a/functions/wctype/towupper.c b/functions/wctype/towupper.c new file mode 100644 index 0000000..faac657 --- /dev/null +++ b/functions/wctype/towupper.c @@ -0,0 +1,36 @@ +/* towupper( wint_t ) + + This file is part of the Public Domain C Library (PDCLib). + Permission is granted to use, modify, and / or redistribute at will. +*/ + +#include +#ifndef REGTEST +#include <_PDCLIB_locale.h> + +wint_t towupper( wint_t wc ) +{ + wint_t uwc = _PDCLIB_unpackwint( wc ); + _PDCLIB_wcinfo_t *info = _PDCLIB_wcgetinfo( uwc ); + if( info && info->upper != uwc ) + { + wc = info->upper; + } + return wc; +} + +#endif + +#ifdef TEST +#include <_PDCLIB_test.h> + +int main( void ) +{ + TESTCASE(towupper(0) == 0); + TESTCASE(towupper(L'a') == L'A'); + TESTCASE(towupper(L'B') == L'B'); + TESTCASE(towupper(L'0') == L'0'); + + return TEST_RESULTS; +} +#endif