18# define streamout wstreamout
19# define format_float format_floatw
23#define BUFFER_SIZE (32 + 17)
25int mbtowc(
wchar_t *wchar,
const char *mbchar,
size_t count);
26int wctomb(
char *mbchar,
wchar_t wchar);
57#define va_arg_f(argptr, flags) \
58 (flags & FLAG_INT64) ? va_arg(argptr, __int64) : \
59 (flags & FLAG_SHORT) ? (short)va_arg(argptr, int) : \
62#define va_arg_fu(argptr, flags) \
63 (flags & FLAG_INT64) ? va_arg(argptr, unsigned __int64) : \
64 (flags & FLAG_SHORT) ? (unsigned short)va_arg(argptr, int) : \
65 va_arg(argptr, unsigned int)
67#define va_arg_ffp(argptr, flags) \
68 (flags & FLAG_LONGDOUBLE) ? va_arg(argptr, long double) : \
69 va_arg(argptr, double)
71#define get_exp(f) (int)floor(f == 0 ? 0 : (f >= 0 ? log10(f) : log10(-f)))
72#define round(x) floor((x) + 0.5)
74#ifndef _USER32_WSPRINTF
90 static const TCHAR digits_l[] =
_T(
"0123456789abcdef0x");
91 static const TCHAR digits_u[] =
_T(
"0123456789ABCDEF0X");
93 static const TCHAR _infinity[] =
_T(
"#INF");
95 int exponent = 0,
sign;
96 long double fpval, fpval2;
110 sign = fpval < 0 ? -1 : 1;
118 if (exponent < -4 || exponent >=
precision)
goto case_e;
145 val32 = exponent >= 0 ? exponent : -exponent;
152 *--(*string) =
digits[val32 % 10];
157 *--(*string) = exponent >= 0 ?
_T(
'+') :
_T(
'-');
160 *--(*string) =
digits[0xe];
189 (*string) -=
sizeof(
_nan) /
sizeof(
TCHAR) - 1;
195 (*string) -=
sizeof(_infinity) /
sizeof(
TCHAR) - 1;
202 while (
padding-- > 0) *--(*string) =
_T(
'0');
206 while (num_digits-- > 0)
214 *--(*string) =
_T(
'.');
222 while ((
unsigned __int64)fpval2);
231#if !defined(_USER32_WSPRINTF)
235#if defined(_USER32_WSPRINTF) || defined(_LIBCNT_)
257#if !defined(_USER32_WSPRINTF)
285#if defined(_UNICODE) && !defined(_USER32_WSPRINTF)
297 if (
mblen <= 0)
return written;
313#define streamout_string streamout_wstring
315#define streamout_string streamout_astring
318#ifdef _USER32_WSPRINTF
319# define USE_MULTISIZE 0
321# define USE_MULTISIZE 1
328 static const TCHAR digits_l[] =
_T(
"0123456789abcdef0x");
329 static const TCHAR digits_u[] =
_T(
"0123456789ABCDEF0X");
330 static const char *_nullstring =
"(null)";
336 size_t prefixlen,
len;
337 int written = 1, written_all = 0;
348 if (chr ==
_T(
'\0'))
break;
351 if ((chr !=
_T(
'%')) ||
356 written_all += written;
376#ifdef _USER32_WSPRINTF
378 written_all += written;
381 fieldwidth =
va_arg(argptr,
int);
385 fieldwidth = -fieldwidth;
393 while (chr >=
_T(
'0') && chr <=
_T(
'9'))
395 fieldwidth = fieldwidth * 10 + (chr -
_T(
'0'));
407#ifdef _USER32_WSPRINTF
409 written_all += written;
419 while (chr >=
_T(
'0') && chr <=
_T(
'9'))
433 else if (chr ==
_T(
'L'))
flags |= 0;
434 else if (chr ==
_T(
'F'))
flags |= 0;
439 else if (chr ==
_T(
'l'))
445 else if (chr ==
_T(
'I'))
480 *
va_arg(argptr,
short*) = written_all;
482 *
va_arg(argptr,
int*) = written_all;
500 ((
wchar_t*)
string)[0] =
va_arg(argptr,
int);
501 ((
wchar_t*)
string)[1] =
_T(
'\0');
505 ((
char*)
string)[0] =
va_arg(argptr,
int);
506 ((
char*)
string)[1] =
_T(
'\0');
511 nt_string =
va_arg(argptr,
void*);
512 if (nt_string && (
string = nt_string->Buffer))
514 len = nt_string->Length;
522 string =
va_arg(argptr,
void*);
529 string =
va_arg(argptr,
void*);
537 string = (
TCHAR*)_nullstring;
538 flags &= ~FLAG_WIDECHAR;
548#ifndef _USER32_WSPRINTF
559 flags &= ~FLAG_WIDECHAR;
595 flags &= ~FLAG_PAD_ZERO;
608#ifdef _USER32_WSPRINTF
621 flags &= ~FLAG_WIDECHAR;
643 prefixlen = prefix ?
_tcslen(prefix) : 0;
654 written_all += written;
662 if (written == -1)
return -1;
663 written_all += written;
671 written_all += written;
679 if (written == -1)
return -1;
680 written_all += written;
682#if 0 && SUPPORT_FLOAT
687 written_all += written;
698 written_all += written;
704 if (written == -1)
return -1;
char * strchr(const char *String, int ch)
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
double pow(double x, double y)
GLuint GLuint GLsizei count
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
GLenum GLint GLint * precision
_Check_return_ __MINGW_NOTHROW _CRTIMP int __cdecl _isnan(_In_ double)
_Check_return_ __MINGW_NOTHROW _CRTIMP int __cdecl _finite(_In_ double)
_Check_return_ int __cdecl mblen(_In_reads_bytes_opt_(_MaxCount) _Pre_opt_z_ const char *_Ch, _In_ size_t _MaxCount)
static const int digits[]
static const DWORD padding[]
_In_ ULONG _In_ ULONG _In_ ULONG Length
#define va_arg_ffp(argptr, flags)
int __cdecl streamout(FILE *stream, const TCHAR *format, va_list argptr)
static int streamout_char(FILE *stream, int chr)
static int streamout_astring(FILE *stream, const char *string, size_t count)
#define va_arg_f(argptr, flags)
void format_float(TCHAR chr, unsigned int flags, int precision, TCHAR **string, const TCHAR **prefix, va_list *argptr)
static int streamout_wstring(FILE *stream, const wchar_t *string, size_t count)
#define va_arg_fu(argptr, flags)
_In_ WDFDMATRANSACTION _In_ size_t MaximumLength