- Add user32_wsprintf library, with all the wsprintf functions, generated from the same codebase
- simplify handling of ll modifier in streamout

svn path=/trunk/; revision=50360
This commit is contained in:
Timo Kreuzer 2011-01-11 19:09:48 +00:00
parent 279d1b9348
commit 85a33b9385
9 changed files with 129 additions and 9 deletions

View file

@ -548,4 +548,27 @@
<file>undname.c</file>
</directory>
</module>
<module name="user32_wsprintf" type="staticlibrary">
<library>chkstk</library>
<include base="crt">.</include>
<include base="crt">include</include>
<define name="_USER32_WSPRINTF" />
<directory name="printf">
<file>streamout.c</file>
<file>wstreamout.c</file>
<file>wsprintfA.c</file>
<file>wsprintfW.c</file>
<file>wvsprintfA.c</file>
<file>wvsprintfW.c</file>
<file>wvsnprintfA.c</file>
<file>wvsnprintfW.c</file>
</directory>
<directory name="string">
<file>mbstowcs_nt.c</file>
<file>wcstombs_nt.c</file>
</directory>
</module>
</group>

View file

@ -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

View file

@ -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'):

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"