X-Git-Url: https://pd.if.org/git/?p=pdclib;a=blobdiff_plain;f=functions%2Fwctype%2Ftowctrans.c;h=1ecb2ff2b7c2d8f410d2dae86e356477ca9384ec;hp=5c1c0a2f460293c26880423bbfac229beed13e2c;hb=abc15df6b9fae3374d24c7cf5c3ab94c605b2a6d;hpb=8894c921674bb116d0a7b8f23a55311e7a768019 diff --git a/functions/wctype/towctrans.c b/functions/wctype/towctrans.c index 5c1c0a2..1ecb2ff 100644 --- a/functions/wctype/towctrans.c +++ b/functions/wctype/towctrans.c @@ -1,42 +1,42 @@ -/* towctrans( wint_t, wctrans_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 -#include "_PDCLIB_locale.h" - -wint_t _PDCLIB_towctrans_l( wint_t wc, wctrans_t trans, locale_t l ) -{ - switch( trans ) { - case 0: return wc; - case _PDCLIB_WCTRANS_TOLOWER: return _PDCLIB_towlower_l( wc, l ); - case _PDCLIB_WCTRANS_TOUPPER: return _PDCLIB_towupper_l( wc, l ); - default: abort(); - } -} - -wint_t towctrans( wint_t wc, wctrans_t trans ) -{ - return _PDCLIB_towctrans_l( wc, trans, _PDCLIB_threadlocale() ); -} - -#endif - -#ifdef TEST -#include "_PDCLIB_test.h" - -int main( void ) -{ - TESTCASE(towctrans(L'a', wctrans("toupper")) == L'A'); - TESTCASE(towctrans(L'B', wctrans("toupper")) == L'B'); - TESTCASE(towctrans(L'a', wctrans("tolower")) == L'a'); - TESTCASE(towctrans(L'B', wctrans("tolower")) == L'b'); - TESTCASE(towctrans(L'B', wctrans("invalid")) == L'B'); - TESTCASE(towctrans(L'B', 0) == L'B'); - return TEST_RESULTS; -} -#endif +/* towctrans( wint_t, wctrans_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 +#include "_PDCLIB_locale.h" + +wint_t _PDCLIB_towctrans_l( wint_t wc, wctrans_t trans, locale_t l ) +{ + switch( trans ) { + case 0: return wc; + case _PDCLIB_WCTRANS_TOLOWER: return _PDCLIB_towlower_l( wc, l ); + case _PDCLIB_WCTRANS_TOUPPER: return _PDCLIB_towupper_l( wc, l ); + default: abort(); + } +} + +wint_t towctrans( wint_t wc, wctrans_t trans ) +{ + return _PDCLIB_towctrans_l( wc, trans, _PDCLIB_threadlocale() ); +} + +#endif + +#ifdef TEST +#include "_PDCLIB_test.h" + +int main( void ) +{ + TESTCASE(towctrans(L'a', wctrans("toupper")) == L'A'); + TESTCASE(towctrans(L'B', wctrans("toupper")) == L'B'); + TESTCASE(towctrans(L'a', wctrans("tolower")) == L'a'); + TESTCASE(towctrans(L'B', wctrans("tolower")) == L'b'); + TESTCASE(towctrans(L'B', wctrans("invalid")) == L'B'); + TESTCASE(towctrans(L'B', 0) == L'B'); + return TEST_RESULTS; +} +#endif