| 1 | /** |
| 2 | * This file has no copyright assigned and is placed in the Public Domain. |
| 3 | * This file is part of the mingw-w64 runtime package. |
| 4 | * No warranty is given; refer to the file DISCLAIMER.PD within this package. |
| 5 | */ |
| 6 | |
| 7 | #define _CTYPE_DISABLE_MACROS |
| 8 | #include <wctype.h> |
| 9 | |
| 10 | /** |
| 11 | * Both `wctrans` and `towctrans` functions were added in msvcr120.dll. |
| 12 | * |
| 13 | * CRT's `towctrans` does not properly handle case when second argument is |
| 14 | * `(wctrans_t)0`. |
| 15 | */ |
| 16 | |
| 17 | /** |
| 18 | * This is CRT's `towctrans` renamed to `__msvcrt_towctrans`. |
| 19 | */ |
| 20 | extern wint_t (__cdecl *__MINGW_IMP_SYMBOL (__msvcrt_towctrans)) (wint_t, wctrans_t); |
| 21 | |
| 22 | wint_t __cdecl towctrans (wint_t _C, wctrans_t _Type) { |
| 23 | /** |
| 24 | * POSIX requires that if `_Type` is zero, `_C` is returned unchanged. |
| 25 | */ |
| 26 | if (_Type == (wctrans_t) 0) { |
| 27 | return _C; |
| 28 | } |
| 29 | |
| 30 | return __MINGW_IMP_SYMBOL (__msvcrt_towctrans) (_C, _Type); |
| 31 | } |
| 32 | |
| 33 | wint_t (__cdecl *__MINGW_IMP_SYMBOL (towctrans)) (wint_t, wctrans_t) = towctrans; |