Author: tkreuzer
Date: Tue Jan 11 19:09:48 2011
New Revision: 50360
URL:
http://svn.reactos.org/svn/reactos?rev=50360&view=rev
Log:
[CRT]
- Add user32_wsprintf library, with all the wsprintf functions, generated from the same
codebase
- simplify handling of ll modifier in streamout
Added:
trunk/reactos/lib/sdk/crt/printf/wsprintfA.c (with props)
trunk/reactos/lib/sdk/crt/printf/wsprintfW.c (with props)
trunk/reactos/lib/sdk/crt/printf/wvsnprintfA.c (with props)
trunk/reactos/lib/sdk/crt/printf/wvsnprintfW.c (with props)
trunk/reactos/lib/sdk/crt/printf/wvsprintfA.c (with props)
trunk/reactos/lib/sdk/crt/printf/wvsprintfW.c (with props)
Modified:
trunk/reactos/lib/sdk/crt/crt.rbuild
trunk/reactos/lib/sdk/crt/printf/_sxprintf.c
trunk/reactos/lib/sdk/crt/printf/streamout.c
Modified: trunk/reactos/lib/sdk/crt/crt.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/crt.rbuild?rev…
==============================================================================
--- trunk/reactos/lib/sdk/crt/crt.rbuild [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/crt.rbuild [iso-8859-1] Tue Jan 11 19:09:48 2011
@@ -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>
Modified: trunk/reactos/lib/sdk/crt/printf/_sxprintf.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/printf/_sxprin…
==============================================================================
--- trunk/reactos/lib/sdk/crt/printf/_sxprintf.c [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/printf/_sxprintf.c [iso-8859-1] Tue Jan 11 19:09:48 2011
@@ -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
Modified: trunk/reactos/lib/sdk/crt/printf/streamout.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/printf/streamo…
==============================================================================
--- trunk/reactos/lib/sdk/crt/printf/streamout.c [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/printf/streamout.c [iso-8859-1] Tue Jan 11 19:09:48 2011
@@ -76,6 +76,8 @@
#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
@@ -218,6 +220,7 @@
while ((unsigned __int64)fpval2);
}
+#endif
static
int
@@ -226,11 +229,15 @@
/* 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 @@
#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 @@
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 @@
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 @@
else break;
chr = *format++;
}
+ while (USE_MULTISIZE);
/* Handle the format specifier */
digits = digits_l;
@@ -511,6 +519,7 @@
precision = 0;
break;
+#ifndef _USER32_WSPRINTF
case _T('G'):
case _T('E'):
case _T('A'):
@@ -528,6 +537,7 @@
len = _tcslen(string);
precision = 0;
break;
+#endif
case _T('d'):
case _T('i'):
Added: trunk/reactos/lib/sdk/crt/printf/wsprintfA.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/printf/wsprint…
==============================================================================
--- trunk/reactos/lib/sdk/crt/printf/wsprintfA.c (added)
+++ trunk/reactos/lib/sdk/crt/printf/wsprintfA.c [iso-8859-1] Tue Jan 11 19:09:48 2011
@@ -1,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"
Propchange: trunk/reactos/lib/sdk/crt/printf/wsprintfA.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/reactos/lib/sdk/crt/printf/wsprintfW.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/printf/wsprint…
==============================================================================
--- trunk/reactos/lib/sdk/crt/printf/wsprintfW.c (added)
+++ trunk/reactos/lib/sdk/crt/printf/wsprintfW.c [iso-8859-1] Tue Jan 11 19:09:48 2011
@@ -1,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"
Propchange: trunk/reactos/lib/sdk/crt/printf/wsprintfW.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/reactos/lib/sdk/crt/printf/wvsnprintfA.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/printf/wvsnpri…
==============================================================================
--- trunk/reactos/lib/sdk/crt/printf/wvsnprintfA.c (added)
+++ trunk/reactos/lib/sdk/crt/printf/wvsnprintfA.c [iso-8859-1] Tue Jan 11 19:09:48 2011
@@ -1,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"
Propchange: trunk/reactos/lib/sdk/crt/printf/wvsnprintfA.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/reactos/lib/sdk/crt/printf/wvsnprintfW.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/printf/wvsnpri…
==============================================================================
--- trunk/reactos/lib/sdk/crt/printf/wvsnprintfW.c (added)
+++ trunk/reactos/lib/sdk/crt/printf/wvsnprintfW.c [iso-8859-1] Tue Jan 11 19:09:48 2011
@@ -1,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"
Propchange: trunk/reactos/lib/sdk/crt/printf/wvsnprintfW.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/reactos/lib/sdk/crt/printf/wvsprintfA.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/printf/wvsprin…
==============================================================================
--- trunk/reactos/lib/sdk/crt/printf/wvsprintfA.c (added)
+++ trunk/reactos/lib/sdk/crt/printf/wvsprintfA.c [iso-8859-1] Tue Jan 11 19:09:48 2011
@@ -1,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"
Propchange: trunk/reactos/lib/sdk/crt/printf/wvsprintfA.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/reactos/lib/sdk/crt/printf/wvsprintfW.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/printf/wvsprin…
==============================================================================
--- trunk/reactos/lib/sdk/crt/printf/wvsprintfW.c (added)
+++ trunk/reactos/lib/sdk/crt/printf/wvsprintfW.c [iso-8859-1] Tue Jan 11 19:09:48 2011
@@ -1,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"
Propchange: trunk/reactos/lib/sdk/crt/printf/wvsprintfW.c
------------------------------------------------------------------------------
svn:eol-style = native