diff --git a/reactos/lib/sdk/crt/crt.rbuild b/reactos/lib/sdk/crt/crt.rbuild index 14e87432366..dfa2df664e0 100644 --- a/reactos/lib/sdk/crt/crt.rbuild +++ b/reactos/lib/sdk/crt/crt.rbuild @@ -548,4 +548,27 @@ undname.c + + + chkstk + . + include + + + + streamout.c + wstreamout.c + wsprintfA.c + wsprintfW.c + wvsprintfA.c + wvsprintfW.c + wvsnprintfA.c + wvsnprintfW.c + + + mbstowcs_nt.c + wcstombs_nt.c + + + diff --git a/reactos/lib/sdk/crt/printf/_sxprintf.c b/reactos/lib/sdk/crt/printf/_sxprintf.c index c21223222c7..0b6c19658fa 100644 --- a/reactos/lib/sdk/crt/printf/_sxprintf.c +++ b/reactos/lib/sdk/crt/printf/_sxprintf.c @@ -20,7 +20,11 @@ int _cdecl _tstreamout(FILE *stream, const TCHAR *format, va_list argptr); int +#if defined(USER32_WSPRINTF) && defined(_M_IX86) +_stdcall +#else _cdecl +#endif _sxprintf( TCHAR *buffer, #if USE_COUNT diff --git a/reactos/lib/sdk/crt/printf/streamout.c b/reactos/lib/sdk/crt/printf/streamout.c index c771443b1c9..c300f3291fb 100644 --- a/reactos/lib/sdk/crt/printf/streamout.c +++ b/reactos/lib/sdk/crt/printf/streamout.c @@ -77,6 +77,8 @@ enum #define get_exp(f) floor(f == 0 ? 0 : (f >= 0 ? log10(f) : log10(-f))) #define round(x) floor((x) + 0.5) +#ifndef _USER32_WSPRINTF + void #ifdef _LIBCNT /* Due to restrictions in kernel mode regarding the use of floating point, @@ -218,6 +220,7 @@ format_float( while ((unsigned __int64)fpval2); } +#endif static int @@ -226,11 +229,15 @@ streamout_char(FILE *stream, int chr) /* Check if the buffer is full */ if (stream->_cnt < sizeof(TCHAR)) { +#ifdef _USER32_WSPRINTF + return _TEOF; +#else /* Strings are done now */ if (stream->_flag & _IOSTRG) return _TEOF; /* Flush buffer for files */ return _flsbuf(chr, stream) != _TEOF; +#endif } *(TCHAR*)stream->_ptr = chr; @@ -298,6 +305,11 @@ streamout_wstring(FILE *stream, const wchar_t *string, int count) #define streamout_string streamout_astring #endif +#ifdef _USER32_WSPRINTF +# define USE_MULTISIZE 0 +#else +# define USE_MULTISIZE 1 +#endif int _cdecl @@ -391,7 +403,7 @@ streamout(FILE *stream, const TCHAR *format, va_list argptr) else precision = -1; /* Handle argument size prefix */ - while (1) + do { if (chr == _T('h')) flags |= FLAG_SHORT; else if (chr == _T('w')) flags |= FLAG_WIDECHAR; @@ -399,14 +411,9 @@ streamout(FILE *stream, const TCHAR *format, va_list argptr) else if (chr == _T('F')) flags |= 0; // FIXME: what is that? else if (chr == _T('l')) { - flags |= FLAG_LONG; -#if SUPPORT_LL - if (format[0] == _T('l')) - { - format++; - flags |= FLAG_INT64; - } -#endif + /* Check if this is the 2nd 'l' in a row */ + if (format[-2] == 'l') flags |= FLAG_INT64; + else flags |= FLAG_LONG; } else if (chr == _T('I')) { @@ -430,6 +437,7 @@ streamout(FILE *stream, const TCHAR *format, va_list argptr) else break; chr = *format++; } + while (USE_MULTISIZE); /* Handle the format specifier */ digits = digits_l; @@ -511,6 +519,7 @@ streamout(FILE *stream, const TCHAR *format, va_list argptr) precision = 0; break; +#ifndef _USER32_WSPRINTF case _T('G'): case _T('E'): case _T('A'): @@ -528,6 +537,7 @@ streamout(FILE *stream, const TCHAR *format, va_list argptr) len = _tcslen(string); precision = 0; break; +#endif case _T('d'): case _T('i'): diff --git a/reactos/lib/sdk/crt/printf/wsprintfA.c b/reactos/lib/sdk/crt/printf/wsprintfA.c new file mode 100644 index 00000000000..28379abebd7 --- /dev/null +++ b/reactos/lib/sdk/crt/printf/wsprintfA.c @@ -0,0 +1,13 @@ +/* + * COPYRIGHT: GNU GPL, see COPYING in the top level directory + * PROJECT: ReactOS crt library + * FILE: lib/sdk/crt/printf/wsprintfA.c + * PURPOSE: Implementation of wsprintfA + * PROGRAMMER: Timo Kreuzer + */ + +#define _sxprintf wsprintfA +#define USE_COUNT 0 +#define USER32_WSPRINTF + +#include "_sxprintf.c" diff --git a/reactos/lib/sdk/crt/printf/wsprintfW.c b/reactos/lib/sdk/crt/printf/wsprintfW.c new file mode 100644 index 00000000000..0c5076c74d5 --- /dev/null +++ b/reactos/lib/sdk/crt/printf/wsprintfW.c @@ -0,0 +1,14 @@ +/* + * COPYRIGHT: GNU GPL, see COPYING in the top level directory + * PROJECT: ReactOS crt library + * FILE: lib/sdk/crt/printf/wsprintfW.c + * PURPOSE: Implementation of wsprintfW + * PROGRAMMER: Timo Kreuzer + */ + +#define _sxprintf wsprintfW +#define USE_COUNT 0 +#define _UNICODE +#define USER32_WSPRINTF + +#include "_sxprintf.c" diff --git a/reactos/lib/sdk/crt/printf/wvsnprintfA.c b/reactos/lib/sdk/crt/printf/wvsnprintfA.c new file mode 100644 index 00000000000..b81d19cd450 --- /dev/null +++ b/reactos/lib/sdk/crt/printf/wvsnprintfA.c @@ -0,0 +1,14 @@ +/* + * COPYRIGHT: GNU GPL, see COPYING in the top level directory + * PROJECT: ReactOS crt library + * FILE: lib/sdk/crt/printf/wvsnprintfA.c + * PURPOSE: Implementation of wvsnprintfA + * PROGRAMMER: Timo Kreuzer + */ + +#define _sxprintf wvsnprintfA +#define USE_COUNT 1 +#define USE_VARARGS 1 +#define USER32_WSPRINTF + +#include "_sxprintf.c" diff --git a/reactos/lib/sdk/crt/printf/wvsnprintfW.c b/reactos/lib/sdk/crt/printf/wvsnprintfW.c new file mode 100644 index 00000000000..cd042b1aaba --- /dev/null +++ b/reactos/lib/sdk/crt/printf/wvsnprintfW.c @@ -0,0 +1,14 @@ +/* + * COPYRIGHT: GNU GPL, see COPYING in the top level directory + * PROJECT: ReactOS crt library + * FILE: lib/sdk/crt/printf/wvsnprintfW.c + * PURPOSE: Implementation of wvsnprintfW + * PROGRAMMER: Timo Kreuzer + */ + +#define _sxprintf wvsnprintfW +#define USE_COUNT 1 +#define USE_VARARGS 1 +#define USER32_WSPRINTF + +#include "_sxprintf.c" diff --git a/reactos/lib/sdk/crt/printf/wvsprintfA.c b/reactos/lib/sdk/crt/printf/wvsprintfA.c new file mode 100644 index 00000000000..7be026bece5 --- /dev/null +++ b/reactos/lib/sdk/crt/printf/wvsprintfA.c @@ -0,0 +1,14 @@ +/* + * COPYRIGHT: GNU GPL, see COPYING in the top level directory + * PROJECT: ReactOS crt library + * FILE: lib/sdk/crt/printf/wvsprintfA.c + * PURPOSE: Implementation of wvsprintfA + * PROGRAMMER: Timo Kreuzer + */ + +#define _sxprintf wvsprintfA +#define USE_COUNT 0 +#define USE_VARARGS 1 +#define USER32_WSPRINTF + +#include "_sxprintf.c" diff --git a/reactos/lib/sdk/crt/printf/wvsprintfW.c b/reactos/lib/sdk/crt/printf/wvsprintfW.c new file mode 100644 index 00000000000..bf9ced2a480 --- /dev/null +++ b/reactos/lib/sdk/crt/printf/wvsprintfW.c @@ -0,0 +1,14 @@ +/* + * COPYRIGHT: GNU GPL, see COPYING in the top level directory + * PROJECT: ReactOS crt library + * FILE: lib/sdk/crt/printf/wvsprintfW.c + * PURPOSE: Implementation of wvsprintfW + * PROGRAMMER: Timo Kreuzer + */ + +#define _sxprintf wvsprintfW +#define USE_COUNT 0 +#define USE_VARARGS 1 +#define USER32_WSPRINTF + +#include "_sxprintf.c"