diff --git a/reactos/boot/freeldr/freeldr/freeldr.c b/reactos/boot/freeldr/freeldr/freeldr.c index 77a164a374a..6d069b63573 100644 --- a/reactos/boot/freeldr/freeldr/freeldr.c +++ b/reactos/boot/freeldr/freeldr/freeldr.c @@ -57,6 +57,8 @@ VOID BootMain(LPSTR CmdLine) } // We need to emulate these, because the original ones don't work in freeldr +// These functions are here, because they need to be in the main compilation unit +// and cannot be in a library. int __cdecl wctomb(char *mbchar, wchar_t wchar) { *mbchar = (char)wchar; @@ -68,3 +70,10 @@ int __cdecl mbtowc (wchar_t *wchar, const char *mbchar, size_t count) *wchar = (wchar_t)*mbchar; return 1; } + +// The wctype table is 144 KB, too much for poor freeldr +int iswctype(wint_t wc, wctype_t wctypeFlags) +{ + return _isctype((char)wc, wctypeFlags); +} + diff --git a/reactos/lib/sdk/crt/crt.cmake b/reactos/lib/sdk/crt/crt.cmake index 05479fb94b5..01f11982cab 100644 --- a/reactos/lib/sdk/crt/crt.cmake +++ b/reactos/lib/sdk/crt/crt.cmake @@ -252,6 +252,8 @@ list(APPEND CRT_SOURCE string/atoi64.c string/atol.c string/ctype.c + string/iswctype.c + string/is_wctype.c string/itoa.c string/itow.c string/scanf.c diff --git a/reactos/lib/sdk/crt/libcntpr.cmake b/reactos/lib/sdk/crt/libcntpr.cmake index b69636ec764..5723d993344 100644 --- a/reactos/lib/sdk/crt/libcntpr.cmake +++ b/reactos/lib/sdk/crt/libcntpr.cmake @@ -27,6 +27,8 @@ list(APPEND LIBCNTPR_SOURCE search/lfind.c stdlib/qsort.c string/ctype.c + string/iswctype.c + string/is_wctype.c string/scanf.c string/strcspn.c string/stricmp.c @@ -182,7 +184,7 @@ else() endif() add_library(libcntpr ${LIBCNTPR_SOURCE}) -add_target_compile_definitions(libcntpr +add_target_compile_definitions(libcntpr NO_RTL_INLINES _NTSYSTEM_ _NTDLLBUILD_ diff --git a/reactos/lib/sdk/crt/string/ctype.c b/reactos/lib/sdk/crt/string/ctype.c index 7c5188570f9..a28fd2058f1 100644 --- a/reactos/lib/sdk/crt/string/ctype.c +++ b/reactos/lib/sdk/crt/string/ctype.c @@ -584,24 +584,6 @@ int _isctype (int c, int ctypeFlags) return (_pctype[(unsigned char)(c & 0xFF)] & ctypeFlags); } -/* - * @implemented - */ -int iswctype(wint_t wc, wctype_t wctypeFlags) -{ - return (wine_wctype_table[wine_wctype_table[wc >> 8] + (wc & 0xff)] & wctypeFlags); -} - -/* - * obsolete - * - * @implemented - */ -int is_wctype(wint_t wc, wctype_t wctypeFlags) -{ - return (wine_wctype_table[wine_wctype_table[wc >> 8] + (wc & 0xff)] & wctypeFlags); -} - /* * @implemented */ diff --git a/reactos/lib/sdk/crt/string/is_wctype.c b/reactos/lib/sdk/crt/string/is_wctype.c new file mode 100644 index 00000000000..030900010de --- /dev/null +++ b/reactos/lib/sdk/crt/string/is_wctype.c @@ -0,0 +1,13 @@ +#include + +extern const unsigned short wine_wctype_table[]; + +/* + * obsolete + * + * @implemented + */ +int is_wctype(wint_t wc, wctype_t wctypeFlags) +{ + return iswctype(wc, wctypeFlags); +} diff --git a/reactos/lib/sdk/crt/string/iswctype.c b/reactos/lib/sdk/crt/string/iswctype.c new file mode 100644 index 00000000000..94b59e6ba74 --- /dev/null +++ b/reactos/lib/sdk/crt/string/iswctype.c @@ -0,0 +1,12 @@ +#include + +extern const unsigned short wine_wctype_table[]; + +/* + * @implemented + */ +int iswctype(wint_t wc, wctype_t wctypeFlags) +{ + return (wine_wctype_table[wine_wctype_table[wc >> 8] + (wc & 0xff)] & wctypeFlags); +} +