Get rid of the old printf code and some unused functions. 3346 lines of code less.

svn path=/trunk/; revision=50355
This commit is contained in:
Timo Kreuzer 2011-01-11 13:13:47 +00:00
parent 0b68bdaf30
commit 7397aa09ad
11 changed files with 0 additions and 3346 deletions

View file

@ -100,9 +100,4 @@
-->
<property name="NEWCC" value="0" />
<!--
Whether to compile the new sprintf
-->
<property name="NEWSPRINTF" value="0" />
</group>

View file

@ -104,9 +104,4 @@
-->
<property name="NEWCC" value="0" />
<!--
Whether to compile the new sprintf
-->
<property name="NEWSPRINTF" value="1" />
</group>

View file

@ -95,9 +95,7 @@
<file>security.c</file>
<file>slist.c</file>
<file>sid.c</file>
<file>sprintf.c</file>
<file>srw.c</file>
<file>swprintf.c</file>
<file>splaytree.c</file>
<file>thread.c</file>
<file>time.c</file>

View file

@ -1,747 +0,0 @@
#ifndef USE_NEW_SPRINTF
/*
* PROGRAMMERS: David Welch
* Eric Kohl
*
* TODO:
* - Verify the implementation of '%Z'.
*/
/*
* linux/lib/vsprintf.c
*
* Copyright (C) 1991, 1992 Linus Torvalds
*/
/* vsprintf.c -- Lars Wirzenius & Linus Torvalds. */
/*
* Wirzenius wrote this portably, Torvalds fucked it up :-)
*/
#include <rtl.h>
#define ZEROPAD 1 /* pad with zero */
#define SIGN 2 /* unsigned/signed long */
#define PLUS 4 /* show plus */
#define SPACE 8 /* space if plus */
#define LEFT 16 /* left justified */
#define SPECIAL 32 /* 0x */
#define LARGE 64 /* use 'ABCDEF' instead of 'abcdef' */
#define REMOVEHEX 256 /* use 256 as remve 0x frim BASE 16 */
typedef struct {
unsigned int mantissal:32;
unsigned int mantissah:20;
unsigned int exponent:11;
unsigned int sign:1;
} double_t;
static
__inline
int
_isinf(double __x)
{
union
{
double* __x;
double_t* x;
} x;
x.__x = &__x;
return ( x.x->exponent == 0x7ff && ( x.x->mantissah == 0 && x.x->mantissal == 0 ));
}
static
__inline
int
_isnan(double __x)
{
union
{
double* __x;
double_t* x;
} x;
x.__x = &__x;
return ( x.x->exponent == 0x7ff && ( x.x->mantissah != 0 || x.x->mantissal != 0 ));
}
static
__inline
int
do_div(long long *n, int base)
{
int a;
a = ((unsigned long long) *n) % (unsigned) base;
*n = ((unsigned long long) *n) / (unsigned) base;
return a;
}
static int skip_atoi(const char **s)
{
int i=0;
while (isdigit(**s))
i = i*10 + *((*s)++) - '0';
return i;
}
static char *
number(char * buf, char * end, long long num, int base, int size, int precision, int type)
{
char c,sign,tmp[66];
const char *digits;
const char *small_digits = "0123456789abcdefghijklmnopqrstuvwxyz";
const char *large_digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int i;
digits = (type & LARGE) ? large_digits : small_digits;
if (type & LEFT)
type &= ~ZEROPAD;
if (base < 2 || base > 36)
return 0;
c = (type & ZEROPAD) ? '0' : ' ';
sign = 0;
if (type & SIGN) {
if (num < 0) {
sign = '-';
num = -num;
size--;
} else if (type & PLUS) {
sign = '+';
size--;
} else if (type & SPACE) {
sign = ' ';
size--;
}
}
if ((type & SPECIAL) && ((type & REMOVEHEX) == 0)) {
if (base == 16)
size -= 2;
}
i = 0;
if ((num == 0) && (precision !=0))
tmp[i++] = '0';
else while (num != 0)
tmp[i++] = digits[do_div(&num,base)];
if (i > precision)
precision = i;
size -= precision;
if (!(type&(ZEROPAD+LEFT))) {
while(size-->0) {
if (buf <= end)
*buf = ' ';
++buf;
}
}
if (sign) {
if (buf <= end)
*buf = sign;
++buf;
}
if ((type & SPECIAL) && ((type & REMOVEHEX) == 0)) {
if (base==16) {
if (buf <= end)
*buf = '0';
++buf;
if (buf <= end)
*buf = digits[33];
++buf;
}
}
if (!(type & LEFT)) {
while (size-- > 0) {
if (buf <= end)
*buf = c;
++buf;
}
}
while (i < precision--) {
if (buf <= end)
*buf = '0';
++buf;
}
while (i-- > 0) {
if (buf <= end)
*buf = tmp[i];
++buf;
}
while (size-- > 0) {
if (buf <= end)
*buf = ' ';
++buf;
}
return buf;
}
static char *
numberf(char * buf, char * end, double num, int base, int size, int precision, int type)
{
char c,sign,tmp[66];
const char *digits;
const char *small_digits = "0123456789abcdefghijklmnopqrstuvwxyz";
const char *large_digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int i;
long long x;
/* FIXME
the float version of number is direcly copy of number
*/
digits = (type & LARGE) ? large_digits : small_digits;
if (type & LEFT)
type &= ~ZEROPAD;
if (base < 2 || base > 36)
return 0;
c = (type & ZEROPAD) ? '0' : ' ';
sign = 0;
if (type & SIGN) {
if (num < 0) {
sign = '-';
num = -num;
size--;
} else if (type & PLUS) {
sign = '+';
size--;
} else if (type & SPACE) {
sign = ' ';
size--;
}
}
if (type & SPECIAL) {
if (base == 16)
size -= 2;
else if (base == 8)
size--;
}
i = 0;
if (num == 0)
tmp[i++] = '0';
else while (num != 0)
{
x = num;
tmp[i++] = digits[do_div(&x,base)];
#ifndef _M_ARM // Missing __floatdidf in CeGCC 0.55 -- GCC 4.4
num=x;
#endif
}
if (i > precision)
precision = i;
size -= precision;
if (!(type&(ZEROPAD+LEFT))) {
while(size-->0) {
if (buf <= end)
*buf = ' ';
++buf;
}
}
if (sign) {
if (buf <= end)
*buf = sign;
++buf;
}
if (type & SPECIAL) {
if (base==8) {
if (buf <= end)
*buf = '0';
++buf;
} else if (base==16) {
if (buf <= end)
*buf = '0';
++buf;
if (buf <= end)
*buf = digits[33];
++buf;
}
}
if (!(type & LEFT)) {
while (size-- > 0) {
if (buf <= end)
*buf = c;
++buf;
}
}
while (i < precision--) {
if (buf <= end)
*buf = '0';
++buf;
}
while (i-- > 0) {
if (buf <= end)
*buf = tmp[i];
++buf;
}
while (size-- > 0) {
if (buf <= end)
*buf = ' ';
++buf;
}
return buf;
}
static char*
string(char* buf, char* end, const char* s, int len, int field_width, int precision, int flags)
{
int i;
char c;
c = (flags & ZEROPAD) ? '0' : ' ';
if (s == NULL)
{
s = "<NULL>";
len = 6;
}
else
{
if (len == -1)
{
len = 0;
while ((unsigned int)len < (unsigned int)precision && s[len])
len++;
}
else
{
if ((unsigned int)len > (unsigned int)precision)
len = precision;
}
}
if (!(flags & LEFT))
while (len < field_width--)
{
if (buf <= end)
*buf = c;
++buf;
}
for (i = 0; i < len; ++i)
{
if (buf <= end)
*buf = *s++;
++buf;
}
while (len < field_width--)
{
if (buf <= end)
*buf = ' ';
++buf;
}
return buf;
}
static char*
stringw(char* buf, char* end, const wchar_t* sw, int len, int field_width, int precision, int flags)
{
int i;
char c;
c = (flags & ZEROPAD) ? '0' : ' ';
if (sw == NULL)
{
sw = L"<NULL>";
len = 6;
}
else
{
if (len == -1)
{
len = 0;
while ((unsigned int)len < (unsigned int)precision && sw[len])
len++;
}
else
{
if ((unsigned int)len > (unsigned int)precision)
len = precision;
}
}
if (!(flags & LEFT))
while (len < field_width--)
{
if (buf <= end)
*buf = c;
buf++;
}
for (i = 0; i < len; ++i)
{
if (buf <= end)
*buf = (unsigned char)(*sw++);
buf++;
}
while (len < field_width--)
{
if (buf <= end)
*buf = ' ';
buf++;
}
return buf;
}
/*
* @implemented
*/
int __cdecl _vsnprintf(char *buf, size_t cnt, const char *fmt, va_list args)
{
int len;
unsigned long long num;
double _double;
int base;
char *str, *end;
const char *s;
const wchar_t *sw;
int flags; /* flags to number() */
int field_width; /* width of output field */
int precision; /* min. # of digits for integers; max
number of chars for from string */
int qualifier; /* 'h', 'l', 'L', 'I' or 'w' for integer fields */
/* clear the string buffer with zero so we do not need NULL terment it at end */
str = buf;
end = buf + cnt - 1;
if (end < buf - 1) {
end = ((char *) -1);
cnt = end - buf + 1;
}
for ( ; *fmt ; ++fmt) {
if (*fmt != '%') {
if (str <= end)
*str = *fmt;
++str;
continue;
}
/* process flags */
flags = 0;
repeat:
++fmt; /* this also skips first '%' */
switch (*fmt) {
case '-': flags |= LEFT; goto repeat;
case '+': flags |= PLUS; goto repeat;
case ' ': flags |= SPACE; goto repeat;
case '#': flags |= SPECIAL; goto repeat;
case '0': flags |= ZEROPAD; goto repeat;
}
/* get field width */
field_width = -1;
if (isdigit(*fmt))
field_width = skip_atoi(&fmt);
else if (*fmt == '*') {
++fmt;
/* it's the next argument */
field_width = va_arg(args, int);
if (field_width < 0) {
field_width = -field_width;
flags |= LEFT;
}
}
/* get the precision */
precision = -1;
if (*fmt == '.') {
++fmt;
if (isdigit(*fmt))
precision = skip_atoi(&fmt);
else if (*fmt == '*') {
++fmt;
/* it's the next argument */
precision = va_arg(args, int);
}
if (precision < 0)
precision = 0;
}
/* get the conversion qualifier */
qualifier = -1;
if (*fmt == 'l' && *(fmt+1) == 'l') {
qualifier = 'I';
fmt += 2;
} else if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L' || *fmt == 'w') {
qualifier = *fmt;
++fmt;
} else if (*fmt == 'I' && *(fmt+1) == '6' && *(fmt+2) == '4') {
qualifier = *fmt;
fmt += 3;
} else if (*fmt == 'I' && *(fmt+1) == '3' && *(fmt+2) == '2') {
qualifier = 'l';
fmt += 3;
} else if (*fmt == 'F' && *(fmt+1) == 'p') {
fmt += 1;
flags |= REMOVEHEX;
}
/* default base */
base = 10;
switch (*fmt) {
case 'c': /* finished */
if (qualifier == 'l' || qualifier == 'w') {
wchar_t sw1[2];
/* print unicode string */
sw1[0] = (wchar_t) va_arg(args, int);
sw1[1] = 0;
str = stringw(str, end, (wchar_t *)&sw1, -1, field_width, precision, flags);
} else {
char s1[2];
/* print ascii string */
s1[0] = ( unsigned char) va_arg(args, int);
s1[1] = 0;
str = string(str, end, (char *)&s1, -1, field_width, precision, flags);
}
continue;
case 'C': /* finished */
if (!(flags & LEFT))
while (--field_width > 0) {
if (str <= end)
*str = ' ';
++str;
}
if (qualifier == 'h') {
if (str <= end)
*str = (unsigned char) va_arg(args, int);
++str;
} else {
if (str <= end)
*str = (unsigned char)(wchar_t) va_arg(args, int);
++str;
}
while (--field_width > 0) {
if (str <= end)
*str = ' ';
++str;
}
continue;
case 's': /* finished */
if (qualifier == 'l' || qualifier == 'w') {
/* print unicode string */
sw = va_arg(args, wchar_t *);
str = stringw(str, end, sw, -1, field_width, precision, flags);
} else {
/* print ascii string */
s = va_arg(args, char *);
str = string(str, end, s, -1, field_width, precision, flags);
}
continue;
case 'S':
if (qualifier == 'h') {
/* print ascii string */
s = va_arg(args, char *);
str = string(str, end, s, -1, field_width, precision, flags);
} else {
/* print unicode string */
sw = va_arg(args, wchar_t *);
str = stringw(str, end, sw, -1, field_width, precision, flags);
}
continue;
case 'Z':
if (qualifier == 'w') {
/* print counted unicode string */
PUNICODE_STRING pus = va_arg(args, PUNICODE_STRING);
if ((pus == NULL) || (pus->Buffer == NULL)) {
sw = NULL;
len = -1;
} else {
sw = pus->Buffer;
len = pus->Length / sizeof(WCHAR);
}
str = stringw(str, end, sw, len, field_width, precision, flags);
} else {
/* print counted ascii string */
PANSI_STRING pus = va_arg(args, PANSI_STRING);
if ((pus == NULL) || (pus->Buffer == NULL)) {
s = NULL;
len = -1;
} else {
s = pus->Buffer;
len = pus->Length;
}
str = string(str, end, s, len, field_width, precision, flags);
}
continue;
case 'p':
if ((flags & LARGE) == 0)
flags |= LARGE;
if (field_width == -1) {
field_width = 2 * sizeof(void *);
flags |= ZEROPAD;
}
str = number(str, end,
(ULONG_PTR) va_arg(args, void *), 16,
field_width, precision, flags);
continue;
case 'n':
/* FIXME: What does C99 say about the overflow case here? */
if (qualifier == 'l') {
long * ip = va_arg(args, long *);
*ip = (str - buf);
} else {
int * ip = va_arg(args, int *);
*ip = (str - buf);
}
continue;
/* float number formats - set up the flags and "break" */
case 'e':
case 'E':
case 'f':
case 'g':
case 'G':
_double = (double)va_arg(args, double);
if ( _isnan(_double) ) {
s = "Nan";
len = 3;
while ( len > 0 ) {
if (str <= end)
*str = *s++;
++str;
len --;
}
} else if ( _isinf(_double) < 0 ) {
s = "-Inf";
len = 4;
while ( len > 0 ) {
if (str <= end)
*str = *s++;
++str;
len --;
}
} else if ( _isinf(_double) > 0 ) {
s = "+Inf";
len = 4;
while ( len > 0 ) {
if (str <= end)
*str = *s++;
++str;
len --;
}
} else {
if ( precision == -1 )
precision = 6;
str = numberf(str, end, (int)_double, base, field_width, precision, flags);
}
continue;
/* integer number formats - set up the flags and "break" */
case 'o':
base = 8;
break;
case 'b':
base = 2;
break;
case 'X':
flags |= LARGE;
case 'x':
base = 16;
break;
case 'd':
case 'i':
flags |= SIGN;
case 'u':
break;
default:
if (*fmt) {
if (str <= end)
*str = *fmt;
++str;
} else
--fmt;
continue;
}
if (qualifier == 'I')
num = va_arg(args, unsigned long long);
else if (qualifier == 'l') {
if (flags & SIGN)
num = va_arg(args, long);
else
num = va_arg(args, unsigned long);
}
else if (qualifier == 'h') {
if (flags & SIGN)
num = va_arg(args, int);
else
num = va_arg(args, unsigned int);
}
else {
if (flags & SIGN)
num = va_arg(args, int);
else
num = va_arg(args, unsigned int);
}
str = number(str, end, num, base, field_width, precision, flags);
}
if (str <= end)
*str = '\0';
else if (cnt > 0)
/* don't write out a null byte if the buf size is zero */
*end = '\0';
return str-buf;
}
/*
* @implemented
*/
int sprintf(char * buf, const char *fmt, ...)
{
va_list args;
int i;
va_start(args, fmt);
i=_vsnprintf(buf,MAXLONG,fmt,args);
va_end(args);
return i;
}
/*
* @implemented
*/
int _snprintf(char * buf, size_t cnt, const char *fmt, ...)
{
va_list args;
int i;
va_start(args, fmt);
i=_vsnprintf(buf,cnt,fmt,args);
va_end(args);
return i;
}
/*
* @implemented
*/
int __cdecl vsprintf(char *buf, const char *fmt, va_list args)
{
return _vsnprintf(buf,MAXLONG,fmt,args);
}
/* EOF */
#endif

View file

@ -1,744 +0,0 @@
#ifndef USE_NEW_SPRINTF
/*
* PROGRAMMERS: David Welch
* Eric Kohl
*
* TODO:
* - Verify the implementation of '%Z'.
*/
/*
* linux/lib/vsprintf.c
*
* Copyright (C) 1991, 1992 Linus Torvalds
*/
/* vsprintf.c -- Lars Wirzenius & Linus Torvalds. */
/*
* Wirzenius wrote this portably, Torvalds fucked it up :-)
*/
#include <rtl.h>
#define ZEROPAD 1 /* pad with zero */
#define SIGN 2 /* unsigned/signed long */
#define PLUS 4 /* show plus */
#define SPACE 8 /* space if plus */
#define LEFT 16 /* left justified */
#define SPECIAL 32 /* 0x */
#define LARGE 64 /* use 'ABCDEF' instead of 'abcdef' */
#define REMOVEHEX 256 /* use 256 as remve 0x frim BASE 16 */
typedef struct {
unsigned int mantissal:32;
unsigned int mantissah:20;
unsigned int exponent:11;
unsigned int sign:1;
} double_t;
static
__inline
int
_isinf(double __x)
{
union
{
double* __x;
double_t* x;
} x;
x.__x = &__x;
return ( x.x->exponent == 0x7ff && ( x.x->mantissah == 0 && x.x->mantissal == 0 ));
}
static
__inline
int
_isnan(double __x)
{
union
{
double* __x;
double_t* x;
} x;
x.__x = &__x;
return ( x.x->exponent == 0x7ff && ( x.x->mantissah != 0 || x.x->mantissal != 0 ));
}
static
__inline
int
do_div(long long *n, int base)
{
int a;
a = ((unsigned long long) *n) % (unsigned) base;
*n = ((unsigned long long) *n) / (unsigned) base;
return a;
}
static int skip_atoi(const wchar_t **s)
{
int i=0;
while (iswdigit(**s))
i = i*10 + *((*s)++) - L'0';
return i;
}
static wchar_t *
number(wchar_t * buf, wchar_t * end, long long num, int base, int size, int precision, int type)
{
wchar_t c, sign, tmp[66];
const wchar_t *digits;
const wchar_t *small_digits = L"0123456789abcdefghijklmnopqrstuvwxyz";
const wchar_t *large_digits = L"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int i;
digits = (type & LARGE) ? large_digits : small_digits;
if (type & LEFT)
type &= ~ZEROPAD;
if (base < 2 || base > 36)
return 0;
c = (type & ZEROPAD) ? L'0' : L' ';
sign = 0;
if (type & SIGN) {
if (num < 0) {
sign = L'-';
num = -num;
size--;
} else if (type & PLUS) {
sign = L'+';
size--;
} else if (type & SPACE) {
sign = ' ';
size--;
}
}
if ((type & SPECIAL) && ((type & REMOVEHEX) == 0)) {
if (base == 16)
size -= 2;
}
i = 0;
if ((num == 0) && (precision !=0))
tmp[i++] = L'0';
else while (num != 0)
tmp[i++] = digits[do_div(&num,base)];
if (i > precision)
precision = i;
size -= precision;
if (!(type&(ZEROPAD+LEFT))) {
while(size-->0) {
if (buf <= end)
*buf = L' ';
++buf;
}
}
if (sign) {
if (buf <= end)
*buf = sign;
++buf;
}
if ((type & SPECIAL) && ((type & REMOVEHEX) == 0)) {
if (base==16) {
if (buf <= end)
*buf = L'0';
++buf;
if (buf <= end)
*buf = digits[33];
++buf;
}
}
if (!(type & LEFT)) {
while (size-- > 0) {
if (buf <= end)
*buf = c;
++buf;
}
}
while (i < precision--) {
if (buf <= end)
*buf = L'0';
++buf;
}
while (i-- > 0) {
if (buf <= end)
*buf = tmp[i];
++buf;
}
while (size-- > 0) {
if (buf <= end)
*buf = L' ';
++buf;
}
return buf;
}
static wchar_t *
numberf(wchar_t * buf, wchar_t * end, double num, int base, int size, int precision, int type)
{
wchar_t c, sign, tmp[66];
const wchar_t *digits;
const wchar_t *small_digits = L"0123456789abcdefghijklmnopqrstuvwxyz";
const wchar_t *large_digits = L"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int i;
long long x;
/* FIXME
the float version of number is direcly copy of number
*/
digits = (type & LARGE) ? large_digits : small_digits;
if (type & LEFT)
type &= ~ZEROPAD;
if (base < 2 || base > 36)
return 0;
c = (type & ZEROPAD) ? L'0' : L' ';
sign = 0;
if (type & SIGN) {
if (num < 0) {
sign = L'-';
num = -num;
size--;
} else if (type & PLUS) {
sign = L'+';
size--;
} else if (type & SPACE) {
sign = ' ';
size--;
}
}
if (type & SPECIAL) {
if (base == 16)
size -= 2;
else if (base == 8)
size--;
}
i = 0;
if (num == 0)
tmp[i++] = L'0';
else while (num != 0)
{
x = num;
tmp[i++] = digits[do_div(&x,base)];
#ifndef _M_ARM // Missing __floatdidf in CeGCC 0.55 -- GCC 4.4
num = x;
#endif
}
if (i > precision)
precision = i;
size -= precision;
if (!(type&(ZEROPAD+LEFT))) {
while(size-->0) {
if (buf <= end)
*buf = L' ';
++buf;
}
}
if (sign) {
if (buf <= end)
*buf = sign;
++buf;
}
if (type & SPECIAL) {
if (base==8) {
if (buf <= end)
*buf = L'0';
++buf;
} else if (base==16) {
if (buf <= end)
*buf = L'0';
++buf;
if (buf <= end)
*buf = digits[33];
++buf;
}
}
if (!(type & LEFT)) {
while (size-- > 0) {
if (buf <= end)
*buf = c;
++buf;
}
}
while (i < precision--) {
if (buf <= end)
*buf = L'0';
++buf;
}
while (i-- > 0) {
if (buf <= end)
*buf = tmp[i];
++buf;
}
while (size-- > 0) {
if (buf <= end)
*buf = L' ';
++buf;
}
return buf;
}
static wchar_t*
string(wchar_t* buf, wchar_t* end, const char* s, int len, int field_width, int precision, int flags)
{
int i;
wchar_t c;
c = (flags & ZEROPAD) ? L'0' : L' ';
if (s == NULL)
{
s = "<NULL>";
len = 6;
}
else
{
if (len == -1)
{
len = 0;
while ((unsigned int)len < (unsigned int)precision && s[len])
len++;
}
else
{
if ((unsigned int)len > (unsigned int)precision)
len = precision;
}
}
if (!(flags & LEFT))
while (len < field_width--)
{
if (buf <= end)
*buf = c;
++buf;
}
for (i = 0; i < len; ++i)
{
if (buf <= end)
*buf = *s++;
++buf;
}
while (len < field_width--)
{
if (buf <= end)
*buf = L' ';
++buf;
}
return buf;
}
static wchar_t*
stringw(wchar_t* buf, wchar_t* end, const wchar_t* sw, int len, int field_width, int precision, int flags)
{
int i;
wchar_t c;
c = (flags & ZEROPAD) ? L'0' : L' ';
if (sw == NULL)
{
sw = L"<NULL>";
len = 6;
}
else
{
if (len == -1)
{
len = 0;
while ((unsigned int)len < (unsigned int)precision && sw[len])
len++;
}
else
{
if ((unsigned int)len > (unsigned int)precision)
len = precision;
}
}
if (!(flags & LEFT))
while (len < field_width--)
{
if (buf <= end)
*buf = c;
buf++;
}
for (i = 0; i < len; ++i)
{
if (buf <= end)
*buf = *sw++;
buf++;
}
while (len < field_width--)
{
if (buf <= end)
*buf = L' ';
buf++;
}
return buf;
}
/*
* @implemented
*/
int __cdecl _vsnwprintf(wchar_t *buf, size_t cnt, const wchar_t *fmt, va_list args)
{
int len;
unsigned long long num;
int base;
wchar_t * str, * end;
const char *s;
const wchar_t *sw;
const wchar_t *ss;
double _double;
int flags; /* flags to number() */
int field_width; /* width of output field */
int precision; /* min. # of digits for integers; max
number of chars for from string */
int qualifier; /* 'h', 'l', 'L', 'w' or 'I' for integer fields */
str = buf;
end = buf + cnt - 1;
if (end < buf - 1) {
end = ((wchar_t *) -1);
cnt = end - buf + 1;
}
for ( ; *fmt ; ++fmt) {
if (*fmt != L'%') {
if (str <= end)
*str = *fmt;
++str;
continue;
}
/* process flags */
flags = 0;
repeat:
++fmt; /* this also skips first '%' */
switch (*fmt) {
case L'-': flags |= LEFT; goto repeat;
case L'+': flags |= PLUS; goto repeat;
case L' ': flags |= SPACE; goto repeat;
case L'#': flags |= SPECIAL; goto repeat;
case L'0': flags |= ZEROPAD; goto repeat;
}
/* get field width */
field_width = -1;
if (iswdigit(*fmt))
field_width = skip_atoi(&fmt);
else if (*fmt == L'*') {
++fmt;
/* it's the next argument */
field_width = va_arg(args, int);
if (field_width < 0) {
field_width = -field_width;
flags |= LEFT;
}
}
/* get the precision */
precision = -1;
if (*fmt == L'.') {
++fmt;
if (iswdigit(*fmt))
precision = skip_atoi(&fmt);
else if (*fmt == L'*') {
++fmt;
/* it's the next argument */
precision = va_arg(args, int);
}
if (precision < 0)
precision = 0;
}
/* get the conversion qualifier */
qualifier = -1;
if (*fmt == L'l' && *(fmt+1) == L'l') {
qualifier = L'I';
fmt += 2;
} else if (*fmt == L'h' || *fmt == L'l' || *fmt == L'L' || *fmt == L'w') {
qualifier = *fmt;
++fmt;
} else if (*fmt == L'I' && *(fmt+1) == L'6' && *(fmt+2) == L'4') {
qualifier = *fmt;
fmt += 3;
} else if (*fmt == L'I' && *(fmt+1) == L'3' && *(fmt+2) == L'2') {
qualifier = L'l';
fmt += 3;
} else if (*fmt == L'F' && *(fmt+1) == L'p') {
fmt += 1;
flags |= REMOVEHEX;
}
/* default base */
base = 10;
switch (*fmt) {
case L'c':
if (qualifier == 'h' || qualifier == 'w') {
wchar_t sw1[2];
/* print unicode string */
sw1[0] = (wchar_t) va_arg(args, int);
sw1[1] = 0;
str = stringw(str, end, (wchar_t *)&sw1, -1, field_width, precision, flags);
} else {
char s1[2];
/* print ascii string */
s1[0] = ( unsigned char) va_arg(args, int);
s1[1] = 0;
str = string(str, end, (char *)&s1, -1, field_width, precision, flags);
}
continue;
case L'C':
if (!(flags & LEFT))
while (--field_width > 0) {
if (str <= end)
*str = L' ';
++str;
}
if (qualifier == 'l' || qualifier == 'w') {
if (str <= end)
*str = (wchar_t) va_arg(args, int);
++str;
} else {
if (str <= end)
*str = (wchar_t) va_arg(args, int);
++str;
}
while (--field_width > 0) {
if (str <= end)
*str = L' ';
++str;
}
continue;
case L's':
if (qualifier == 'h') {
/* print ascii string */
s = va_arg(args, char *);
str = string(str, end, s, -1, field_width, precision, flags);
} else {
/* print unicode string */
sw = va_arg(args, wchar_t *);
str = stringw(str, end, sw, -1, field_width, precision, flags);
}
continue;
case L'S':
if (qualifier == 'l' || qualifier == 'w') {
/* print unicode string */
sw = va_arg(args, wchar_t *);
str = stringw(str, end, sw, -1, field_width, precision, flags);
} else {
/* print ascii string */
s = va_arg(args, char *);
str = string(str, end, s, -1, field_width, precision, flags);
}
continue;
case L'Z':
if (qualifier == 'h') {
/* print counted ascii string */
PANSI_STRING pus = va_arg(args, PANSI_STRING);
if ((pus == NULL) || (pus->Buffer == NULL)) {
s = NULL;
len = -1;
} else {
s = pus->Buffer;
len = pus->Length;
}
str = string(str, end, s, len, field_width, precision, flags);
} else {
/* print counted unicode string */
PUNICODE_STRING pus = va_arg(args, PUNICODE_STRING);
if ((pus == NULL) || (pus->Buffer == NULL)) {
sw = NULL;
len = -1;
} else {
sw = pus->Buffer;
len = pus->Length / sizeof(WCHAR);
}
str = stringw(str, end, sw, len, field_width, precision, flags);
}
continue;
case L'p':
if ((flags & LARGE) == 0)
flags |= LARGE;
if (field_width == -1) {
field_width = 2*sizeof(void *);
flags |= ZEROPAD;
}
str = number(str, end,
(ULONG_PTR) va_arg(args, void *), 16,
field_width, precision, flags);
continue;
case L'n':
/* FIXME: What does C99 say about the overflow case here? */
if (qualifier == 'l') {
long * ip = va_arg(args, long *);
*ip = (str - buf);
} else {
int * ip = va_arg(args, int *);
*ip = (str - buf);
}
continue;
/* float number formats - set up the flags and "break" */
case 'e':
case 'E':
case 'f':
case 'g':
case 'G':
_double = (double)va_arg(args, double);
if ( _isnan(_double) ) {
ss = L"Nan";
len = 3;
while ( len > 0 ) {
if (str <= end)
*str = *ss++;
++str;
len --;
}
} else if ( _isinf(_double) < 0 ) {
ss = L"-Inf";
len = 4;
while ( len > 0 ) {
if (str <= end)
*str = *ss++;
++str;
len --;
}
} else if ( _isinf(_double) > 0 ) {
ss = L"+Inf";
len = 4;
while ( len > 0 ) {
if (str <= end)
*str = *ss++;
++str;
len --;
}
} else {
if ( precision == -1 )
precision = 6;
str = numberf(str, end, _double, base, field_width, precision, flags);
}
continue;
/* integer number formats - set up the flags and "break" */
case L'o':
base = 8;
break;
case L'b':
base = 2;
break;
case L'X':
flags |= LARGE;
case L'x':
base = 16;
break;
case L'd':
case L'i':
flags |= SIGN;
case L'u':
break;
default:
if (*fmt) {
if (str <= end)
*str = *fmt;
++str;
} else
--fmt;
continue;
}
if (qualifier == L'I')
num = va_arg(args, unsigned long long);
else if (qualifier == L'l') {
if (flags & SIGN)
num = va_arg(args, long);
else
num = va_arg(args, unsigned long);
}
else if (qualifier == L'h') {
if (flags & SIGN)
num = va_arg(args, int);
else
num = va_arg(args, unsigned int);
}
else {
if (flags & SIGN)
num = va_arg(args, int);
else
num = va_arg(args, unsigned int);
}
str = number(str, end, num, base, field_width, precision, flags);
}
if (str <= end)
*str = L'\0';
else if (cnt > 0)
/* don't write out a null byte if the buf size is zero */
*end = L'\0';
return str-buf;
}
/*
* @implemented
*/
int swprintf(wchar_t *buf, const wchar_t *fmt, ...)
{
va_list args;
int i;
va_start(args, fmt);
i=_vsnwprintf(buf,MAXLONG,fmt,args);
va_end(args);
return i;
}
/*
* @implemented
*/
int __cdecl _snwprintf(wchar_t *buf, size_t cnt, const wchar_t *fmt, ...)
{
va_list args;
int i;
va_start(args, fmt);
i=_vsnwprintf(buf,cnt,fmt,args);
va_end(args);
return i;
}
/*
* @implemented
*/
int __cdecl vswprintf(wchar_t *buf, const wchar_t *fmt, va_list args)
{
return _vsnwprintf(buf,MAXLONG,fmt,args);
}
/* EOF */
#endif

View file

@ -1,43 +0,0 @@
/*
* COPYRIGHT: Winehq
* PROJECT: wine
* FILE: msvcrt/conio/cprintf.c
* PURPOSE: C Runtime
* PROGRAMMER: Magnus Olsen (Imported from wine cvs 2006-05-23)
*/
#ifndef USE_NEW_SPRINTF
#include <precomp.h>
/*
* @implemented
*/
int
_cprintf(const char *fmt, ...)
{
char buf[2048], *mem = buf;
int written, resize = sizeof(buf), retval;
va_list valist;
va_start( valist, fmt );
while ((written = _vsnprintf( mem, resize, fmt, valist )) == -1 ||
written > resize)
{
resize = (written == -1 ? resize * 2 : written + 1);
if (mem != buf)
free (mem);
if (!(mem = (char *)malloc(resize)))
return EOF;
va_end ( valist );
va_start( valist, fmt );
}
va_end ( valist );
retval = _cputs( mem );
if (mem != buf)
free (mem);
return retval;
}
#endif

View file

@ -55,7 +55,6 @@
<directory name="conio">
<file>cgets.c</file>
<file>cprintf.c</file>
<file>cputs.c</file>
<file>getch.c</file>
<file>getche.c</file>
@ -362,7 +361,6 @@
<file>find64.c</file>
<file>findi64.c</file>
<file>fmode.c</file>
<file>lnx_sprintf.c</file>
<file>perror.c</file>
<file>popen.c</file>
<file>stat.c</file>

View file

@ -10,8 +10,6 @@
<define name="_CRTBLD" />
<define name="__CRT__NO_INLINE" />
<if property="NEWSPRINTF" value="1">
<define name="USE_NEW_SPRINTF" />
<directory name="printf">
<file>_snprintf.c</file>
<file>_snwprintf.c</file>
@ -26,7 +24,6 @@
<file>vswprintf.c</file>
<file>wstreamout.c</file>
</directory>
</if>
<if property="ARCH" value="i386">
<define name="__MINGW_IMPORT">"extern __attribute__ ((dllexport))"</define>

View file

@ -2783,142 +2783,6 @@ FILE* CDECL tmpfile(void)
return file;
}
#ifndef USE_NEW_SPRINTF
/*********************************************************************
* vfprintf (MSVCRT.@)
*/
int CDECL vfprintf(FILE* file, const char *format, va_list valist)
{
char buf[2048], *mem = buf;
int written, resize = sizeof(buf), retval;
/* There are two conventions for vsnprintf failing:
* Return -1 if we truncated, or
* Return the number of bytes that would have been written
* The code below handles both cases
*/
while ((written = _vsnprintf(mem, resize, format, valist)) == -1 ||
written > resize)
{
resize = (written == -1 ? resize * 2 : written + 1);
if (mem != buf)
free (mem);
if (!(mem = malloc(resize)))
return EOF;
}
retval = fwrite(mem, sizeof(*mem), written, file);
if (mem != buf)
free (mem);
return retval;
}
/*********************************************************************
* vfwprintf (MSVCRT.@)
* FIXME:
* Is final char included in written (then resize is too big) or not
* (then we must test for equality too)?
*/
int CDECL vfwprintf(FILE* file, const wchar_t *format, va_list valist)
{
wchar_t buf[2048], *mem = buf;
int written, resize = sizeof(buf) / sizeof(wchar_t), retval;
/* See vfprintf comments */
while ((written = _vsnwprintf(mem, resize, format, valist)) == -1 ||
written > resize)
{
resize = (written == -1 ? resize * 2 : written + sizeof(wchar_t));
if (mem != buf)
free (mem);
if (!(mem = malloc(resize*sizeof(*mem))))
return EOF;
}
/* Check if outputting to a text-file */
if (fdesc[file->_file].wxflag & WX_TEXT)
{
/* Convert each character and stop at the first invalid character. Behavior verified by tests under WinXP SP2 */
char chMultiByte[MB_LEN_MAX];
int nReturn;
wchar_t *p;
retval = 0;
for (p = mem; *p; p++)
{
nReturn = wctomb(chMultiByte, *p);
if(nReturn == -1)
break;
retval += fwrite(chMultiByte, 1, nReturn, file);
}
}
else
{
retval = fwrite(mem, sizeof(*mem), written, file);
}
if (mem != buf)
free (mem);
return retval;
}
/*********************************************************************
* vprintf (MSVCRT.@)
*/
int CDECL vprintf(const char *format, va_list valist)
{
return vfprintf(stdout,format,valist);
}
/*********************************************************************
* vwprintf (MSVCRT.@)
*/
int CDECL vwprintf(const wchar_t *format, va_list valist)
{
return vfwprintf(stdout,format,valist);
}
/*********************************************************************
* fprintf (MSVCRT.@)
*/
int CDECL fprintf(FILE* file, const char *format, ...)
{
va_list valist;
int res;
va_start(valist, format);
res = vfprintf(file, format, valist);
va_end(valist);
return res;
}
/*********************************************************************
* fwprintf (MSVCRT.@)
*/
int CDECL fwprintf(FILE* file, const wchar_t *format, ...)
{
va_list valist;
int res;
va_start(valist, format);
res = vfwprintf(file, format, valist);
va_end(valist);
return res;
}
/*********************************************************************
* printf (MSVCRT.@)
*/
int CDECL printf(const char *format, ...)
{
va_list valist;
int res;
va_start(valist, format);
res = vfprintf(stdout, format, valist);
va_end(valist);
return res;
}
#endif
/*********************************************************************
* ungetc (MSVCRT.@)
*/
@ -2955,21 +2819,6 @@ wint_t CDECL ungetwc(wint_t wc, FILE * file)
return mwc;
}
#ifndef USE_NEW_SPRINTF
/*********************************************************************
* wprintf (MSVCRT.@)
*/
int CDECL wprintf(const wchar_t *format, ...)
{
va_list valist;
int res;
va_start(valist, format);
res = vwprintf(format, valist);
va_end(valist);
return res;
}
#endif
/*********************************************************************
* _getmaxstdio (MSVCRT.@)
*/

View file

@ -1,882 +0,0 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PURPOSE: CRT's vsnprintf
* FILE: lib/sdk/crt/stdio/lnx_printf.c
* PROGRAMERS: David Welch
Eric Kohl
Gregor Schneider
* TODO:
* - Verify the implementation of '%Z'.
*/
/*
* Parts from linux/lib/vsprintf.c
* Lars Wirzenius & Linus Torvalds
* Wirzenius wrote this portably, Torvalds fucked it up :-)
*/
#ifndef USE_NEW_SPRINTF
#include <precomp.h>
#include <wchar.h>
#include <tchar.h>
#define ZEROPAD 1 /* pad with zero */
#define SIGN 2 /* unsigned/signed */
#define PLUS 4 /* show plus */
#define SPACE 8 /* space if plus */
#define LEFT 16 /* left justified */
#define SPECIAL 32 /* 0x */
#define LARGE 64 /* use 'ABCDEF' instead of 'abcdef' */
#define ZEROTRUNC 128 /* truncate zero's */
#define REMOVEHEX 256 /* remove 0x from BASE 16 */
static
__inline
int
do_div(long long *n, int base)
{
int a;
a = ((unsigned long long) *n) % (unsigned) base;
*n = ((unsigned long long) *n) / (unsigned) base;
return a;
}
static int skip_atoi(const char **s)
{
int i=0;
while (isdigit(**s))
i = i*10 + *((*s)++) - '0';
return i;
}
static char *
number(char * buf, char * end, long long num, int base, int size, int precision, int type)
{
char c,sign,tmp[66];
const char *digits;
const char *small_digits = "0123456789abcdefghijklmnopqrstuvwxyz";
const char *large_digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int i;
digits = (type & LARGE) ? large_digits : small_digits;
if (type & LEFT)
type &= ~ZEROPAD;
if (base < 2 || base > 36)
return 0;
c = (type & ZEROPAD) ? '0' : ' ';
sign = 0;
if (type & SIGN) {
if (num < 0) {
sign = '-';
num = -num;
size--;
} else if (type & PLUS) {
sign = '+';
size--;
} else if (type & SPACE) {
sign = ' ';
size--;
}
}
if ((type & SPECIAL) && ((type & REMOVEHEX) == 0)) {
if (base == 16)
size -= 2;
}
i = 0;
if ((num == 0) && (precision !=0))
tmp[i++] = '0';
else while (num != 0)
tmp[i++] = digits[do_div(&num,base)];
if (i > precision)
precision = i;
size -= precision;
if (!(type&(ZEROPAD+LEFT))) {
while(size-->0) {
if (buf <= end)
*buf = ' ';
++buf;
}
}
if (sign) {
if (buf <= end)
*buf = sign;
++buf;
}
if ((type & SPECIAL) && ((type & REMOVEHEX) == 0)) {
if (base==16) {
if (buf <= end)
*buf = '0';
++buf;
if (buf <= end)
*buf = digits[33];
++buf;
}
}
if (!(type & LEFT)) {
while (size-- > 0) {
if (buf <= end)
*buf = c;
++buf;
}
}
while (i < precision--) {
if (buf <= end)
*buf = '0';
++buf;
}
while (i-- > 0) {
if (buf <= end)
*buf = tmp[i];
++buf;
}
while (size-- > 0) {
if (buf <= end)
*buf = ' ';
++buf;
}
return buf;
}
typedef struct {
unsigned int mantissal:32;
unsigned int mantissah:20;
unsigned int exponent:11;
unsigned int sign:1;
} ieee_double_t;
static __inline void fracrnd(double *number, int prec)
{
/* Shifts fractional digits to decimal places and compares to round table */
/* Only suitable to determine the exponent with more precision, not for normal rounding */
/* Incoming numbers are expected to range from approx -10.0 to 10.0 */
int lpos = 1, ubound, sign = 1;
long decimal = abs((long)*number);
double frac = (*number - decimal) * 10;
long rt[] =
{
0,
9,
99,
999,
9999,
99999,
999999,
9999999,
99999999,
999999999
};
if (*number < 0)
{
sign = -1;
}
ubound = min(prec, sizeof(rt)/sizeof(*rt) - 1);
while ((long)frac % 10 != 0 && lpos < ubound)
{
frac *= 10;
lpos++;
}
if (abs((long)frac) == rt[lpos])
{
*number = sign * (decimal + 1);
}
}
static char *
numberf(char * buf, char * end, double num, char exp_sign, int size, int precision, int type)
{
double exponent = 0.0;
double e = 0.0;
long ie;
int i = 0;
int j = 0;
int ro = 0;
int isize;
double num2, frac, intr;
double p;
char c, sign, digits[66];
char *tmp;
union
{
double* __n;
ieee_double_t* n;
} n;
n.__n = &num;
if ( exp_sign == 'g' || exp_sign == 'G' || exp_sign == 'e' || exp_sign == 'E' )
{
ie = ((unsigned int)n.n->exponent - (unsigned int)0x3ff);
if (num != 0.0)
{
exponent = ie/3.321928;
}
}
if ( exp_sign == 'g' || exp_sign == 'G' )
{
type |= ZEROTRUNC;
if ( exponent < -4 || fabs(exponent) >= precision )
exp_sign -= 2; // g -> e and G -> E
else
exp_sign = 'f';
if (type & SPECIAL) precision--;
}
if ( exp_sign == 'e' || exp_sign == 'E' )
{
if (num != 0.0)
{
/* Find a suitable exponent */
frac = modf(exponent, &e);
num2 = num/pow(10.0L, (long double)e);
/* Check if rounding is possible */
fracrnd(&num2, precision);
if (num2 < 1.0 && num2 > -1.0)
{
e--;
}
else if (num2 <= -10.0 || num2 >= 10.0)
{
e++;
}
}
/* size-5 because "e+abc" is going to follow */
buf = numberf(buf, end, num/pow(10.0L,(long double)e), 'f', size-5, precision, type);
isize = 4;
while(*(buf-1) == ' ')
{
isize++;
--buf;
}
if (buf <= end)
*buf = exp_sign;
++buf;
size--;
ie = (long)e;
type = LEFT | SIGN | PLUS;
buf = number(buf, end, ie, 10, isize, 3, type);
return buf;
}
if ( exp_sign == 'f' )
{
if (type & LEFT)
type &= ~ZEROPAD;
c = (type & ZEROPAD) ? '0' : ' ';
sign = 0;
if (num < 0)
{
sign = '-';
num = fabs(num);
size--;
}
else if (type & PLUS)
{
sign = '+';
size--;
}
else if (type & SPACE)
{
sign = ' ';
size--;
}
frac = modf(num,&intr);
// # flags forces a . and prevents truncation of trailing zero's
if ( precision > 0 )
{
i = precision-1;
while ( i >= 0 )
{
frac*=10.0L;
frac = modf(frac, &p);
digits[i] = (int)p + '0';
i--;
}
i = precision;
size -= precision;
}
if ( precision >= 1 || type & SPECIAL)
{
digits[i++] = '.';
size--;
}
ro = 0;
if ( frac > 0.5 )
{
ro = 1;
}
if ( intr == 0.0 )
{
digits[i++] = '0';
size--;
}
else
{
while ( intr > 0.0 )
{
p = intr;
intr/=10.0L;
modf(intr, &intr);
p -= 10.0*intr;
digits[i++] = (int)p + '0';
size--;
}
}
j = 0;
while ( j < i && ro == 1)
{
if ( digits[j] >= '0' && digits[j] <= '8' )
{
digits[j]++;
ro = 0;
}
else if ( digits[j] == '9' )
{
digits[j] = '0';
}
j++;
}
if ( ro == 1 )
digits[i++] = '1';
digits[i] = 0;
if (!(type & (ZEROPAD+LEFT)))
{
while(size-->0)
{
if (buf <= end)
*buf = ' ';
++buf;
}
}
if (sign)
{
if (buf <= end)
*buf = sign;
++buf;
}
if (!(type & (ZEROPAD+LEFT)))
{
while(size-->0)
{
if (buf <= end)
*buf = ' ';
++buf;
}
}
if (!(type & LEFT))
{
while (size-- > 0)
{
if (buf <= end)
*buf = c;
++buf;
}
}
tmp = digits;
if ( type & ZEROTRUNC && ((type & SPECIAL) != SPECIAL) )
{
j = 0;
while ( j < i && ( *tmp == '0' || *tmp == '.' ))
{
tmp++;
i--;
}
}
while (i-- > 0)
{
if (buf <= end)
*buf = tmp[i];
++buf;
}
while (size-- > 0)
{
if (buf <= end)
*buf = ' ';
buf++;
}
}
return buf;
}
static char*
string(char* buf, char* end, const char* s, int len, int field_width, int precision, int flags)
{
int i;
char c;
c = (flags & ZEROPAD) ? '0' : ' ';
if (s == NULL)
{
s = "<NULL>";
len = 6;
}
else
{
if (len == -1)
{
len = 0;
while ((unsigned int)len < (unsigned int)precision && s[len])
len++;
}
else
{
if ((unsigned int)len > (unsigned int)precision)
len = precision;
}
}
if (!(flags & LEFT))
while (len < field_width--)
{
if (buf <= end)
*buf = c;
++buf;
}
for (i = 0; i < len; ++i)
{
if (buf <= end)
*buf = *s++;
++buf;
}
while (len < field_width--)
{
if (buf <= end)
*buf = ' ';
++buf;
}
return buf;
}
static char*
stringw(char* buf, char* end, const wchar_t* sw, int len, int field_width, int precision, int flags)
{
int i;
char c;
c = (flags & ZEROPAD) ? '0' : ' ';
if (sw == NULL)
{
sw = L"<NULL>";
len = 6;
}
else
{
if (len == -1)
{
len = 0;
while ((unsigned int)len < (unsigned int)precision && sw[len])
len++;
}
else
{
if ((unsigned int)len > (unsigned int)precision)
len = precision;
}
}
if (!(flags & LEFT))
while (len < field_width--)
{
if (buf <= end)
*buf = c;
buf++;
}
for (i = 0; i < len; ++i)
{
if (buf <= end)
*buf = (unsigned char)(*sw++);
buf++;
}
while (len < field_width--)
{
if (buf <= end)
*buf = ' ';
buf++;
}
return buf;
}
/*
* @implemented
*/
int __cdecl lnx_vsnprintf(char *buf, size_t cnt, const char *fmt, va_list args)
{
int len;
unsigned long long num;
double _double;
int base;
char *str, *end;
const char *s;
const wchar_t *sw;
int flags; /* flags to number() */
int field_width; /* width of output field */
int precision; /* min. # of digits for integers; max
number of chars for from string */
int qualifier; /* 'h', 'l', 'L', 'I' or 'w' for integer fields */
str = buf;
end = buf + cnt - 1;
if (end < buf - 1) {
end = ((char *) -1);
cnt = end - buf + 1;
}
for ( ; *fmt ; ++fmt) {
if (*fmt != '%') {
if (str <= end)
*str = *fmt;
++str;
continue;
}
/* process flags */
flags = 0;
repeat:
++fmt; /* this also skips first '%' */
switch (*fmt) {
case '-': flags |= LEFT; goto repeat;
case '+': flags |= PLUS; goto repeat;
case ' ': flags |= SPACE; goto repeat;
case '#': flags |= SPECIAL; goto repeat;
case '0': flags |= ZEROPAD; goto repeat;
}
/* get field width */
field_width = -1;
if (isdigit(*fmt))
field_width = skip_atoi(&fmt);
else if (*fmt == '*') {
++fmt;
/* it's the next argument */
field_width = va_arg(args, int);
if (field_width < 0) {
field_width = -field_width;
flags |= LEFT;
}
}
/* get the precision */
precision = -1;
if (*fmt == '.') {
++fmt;
if (isdigit(*fmt))
precision = skip_atoi(&fmt);
else if (*fmt == '*') {
++fmt;
/* it's the next argument */
precision = va_arg(args, int);
}
if (precision < 0)
precision = 0;
}
/* get the conversion qualifier */
qualifier = -1;
if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L' || *fmt == 'w') {
qualifier = *fmt;
++fmt;
} else if (*fmt == 'I' && *(fmt+1) == '6' && *(fmt+2) == '4') {
qualifier = *fmt;
fmt += 3;
} else if (*fmt == 'I' && *(fmt+1) == '3' && *(fmt+2) == '2') {
qualifier = 'l';
fmt += 3;
} else if (*fmt == 'F' && *(fmt+1) == 'p') {
fmt += 1;
flags |= REMOVEHEX;
}
/* default base */
base = 10;
switch (*fmt) {
case 'c': /* finished */
if (qualifier == 'l' || qualifier == 'w') {
wchar_t sw1[2];
/* print unicode string */
sw1[0] = (wchar_t) va_arg(args, int);
sw1[1] = 0;
str = stringw(str, end, (wchar_t *)&sw1, -1, field_width, precision, flags);
} else {
char s1[2];
/* print ascii string */
s1[0] = ( unsigned char) va_arg(args, int);
s1[1] = 0;
str = string(str, end, (char *)&s1, -1, field_width, precision, flags);
}
continue;
case 'C': /* finished */
if (!(flags & LEFT))
while (--field_width > 0) {
if (str <= end)
*str = ' ';
++str;
}
if (qualifier == 'h') {
if (str <= end)
*str = (unsigned char) va_arg(args, int);
++str;
} else {
if (str <= end)
*str = (unsigned char)(wchar_t) va_arg(args, int);
++str;
}
while (--field_width > 0) {
if (str <= end)
*str = ' ';
++str;
}
continue;
case 's': /* finished */
if (qualifier == 'l' || qualifier == 'w') {
/* print unicode string */
sw = va_arg(args, wchar_t *);
str = stringw(str, end, sw, -1, field_width, precision, flags);
} else {
/* print ascii string */
s = va_arg(args, char *);
str = string(str, end, s, -1, field_width, precision, flags);
}
continue;
case 'S':
if (qualifier == 'h') {
/* print ascii string */
s = va_arg(args, char *);
str = string(str, end, s, -1, field_width, precision, flags);
} else {
/* print unicode string */
sw = va_arg(args, wchar_t *);
str = stringw(str, end, sw, -1, field_width, precision, flags);
}
continue;
case 'Z':
if (qualifier == 'w') {
/* print counted unicode string */
PUNICODE_STRING pus = va_arg(args, PUNICODE_STRING);
if ((pus == NULL) || (pus->Buffer == NULL)) {
sw = NULL;
len = -1;
} else {
sw = pus->Buffer;
len = pus->Length / sizeof(WCHAR);
}
str = stringw(str, end, sw, len, field_width, precision, flags);
} else {
/* print counted ascii string */
PANSI_STRING pus = va_arg(args, PANSI_STRING);
if ((pus == NULL) || (pus->Buffer == NULL)) {
s = NULL;
len = -1;
} else {
s = pus->Buffer;
len = pus->Length;
}
str = string(str, end, s, len, field_width, precision, flags);
}
continue;
case 'p':
if ((flags & LARGE) == 0)
flags |= LARGE;
if (field_width == -1) {
field_width = 2 * sizeof(void *);
flags |= ZEROPAD;
}
str = number(str, end,
(uintptr_t) va_arg(args, void *), 16,
field_width, precision, flags);
continue;
case 'n':
/* FIXME: What does C99 say about the overflow case here? */
if (qualifier == 'l') {
long * ip = va_arg(args, long *);
*ip = (str - buf);
} else {
int * ip = va_arg(args, int *);
*ip = (str - buf);
}
continue;
/* float number formats - set up the flags and "break" */
case 'e':
case 'E':
case 'f':
case 'g':
case 'G':
_double = (double)va_arg(args, double);
if ( _isnan(_double) ) {
s = "Nan";
len = 3;
while ( len > 0 ) {
if (str <= end)
*str = *s++;
++str;
len --;
}
} else if ( _isinf(_double) < 0 ) {
s = "-Inf";
len = 4;
while ( len > 0 ) {
if (str <= end)
*str = *s++;
++str;
len --;
}
} else if ( _isinf(_double) > 0 ) {
s = "+Inf";
len = 4;
while ( len > 0 ) {
if (str <= end)
*str = *s++;
++str;
len --;
}
} else {
if ( precision == -1 )
precision = 6;
str = numberf(str, end, _double, *fmt, field_width, precision, flags);
}
continue;
/* integer number formats - set up the flags and "break" */
case 'o':
base = 8;
break;
case 'b':
base = 2;
break;
case 'X':
flags |= LARGE;
case 'x':
base = 16;
break;
case 'd':
case 'i':
flags |= SIGN;
case 'u':
break;
default:
if (*fmt) {
if (str <= end)
*str = *fmt;
++str;
} else
--fmt;
continue;
}
if (qualifier == 'I')
num = va_arg(args, unsigned long long);
else if (qualifier == 'l') {
if (flags & SIGN)
num = va_arg(args, long);
else
num = va_arg(args, unsigned long);
}
else if (qualifier == 'h') {
if (flags & SIGN)
num = va_arg(args, int);
else
num = va_arg(args, unsigned int);
}
else {
if (flags & SIGN)
num = va_arg(args, int);
else
num = va_arg(args, unsigned int);
}
str = number(str, end, num, base, field_width, precision, flags);
}
if (str <= end)
*str = '\0';
else if (cnt > 0)
/* don't write out a null byte if the buf size is zero */
*end = '\0';
return str-buf;
}
/*
* @implemented
*/
int lnx_sprintf(char * buf, const char *fmt, ...)
{
va_list args;
int i;
va_start(args, fmt);
i=lnx_vsnprintf(buf,MAXLONG,fmt,args);
va_end(args);
return i;
}
#if 0
/*
* @implemented
*/
int _snprintf(char * buf, size_t cnt, const char *fmt, ...)
{
va_list args;
int i;
va_start(args, fmt);
i=_vsnprintf(buf,cnt,fmt,args);
va_end(args);
return i;
}
/*
* @implemented
*/
int __cdecl vsprintf(char *buf, const char *fmt, va_list args)
{
return _vsnprintf(buf,MAXLONG,fmt,args);
}
#endif
/* EOF */
#endif

View file

@ -209,677 +209,6 @@ double CDECL wcstod(const wchar_t* lpszStr, wchar_t** end)
TRACE("returning %g\n", ret);
return ret;
}
typedef struct pf_output_t
{
int used;
int len;
BOOL unicode;
union {
LPWSTR W;
LPSTR A;
} buf;
} pf_output;
typedef struct pf_flags_t
{
char Sign, LeftAlign, Alternate, PadZero;
int FieldLength, Precision;
char IntegerLength, IntegerDouble;
char WideString;
char Format;
} pf_flags;
/*
* writes a string of characters to the output
* returns -1 if the string doesn't fit in the output buffer
* return the length of the string if all characters were written
*/
static inline int pf_output_stringW( pf_output *out, LPCWSTR str, int len )
{
int space = out->len - out->used;
if( len < 0 )
len = strlenW( str );
if( out->unicode )
{
LPWSTR p = out->buf.W + out->used;
if( space >= len )
{
memcpy( p, str, len*sizeof(WCHAR) );
out->used += len;
return len;
}
if( space > 0 )
memcpy( p, str, space*sizeof(WCHAR) );
out->used += len;
}
else
{
int n = WideCharToMultiByte( CP_ACP, 0, str, len, NULL, 0, NULL, NULL );
LPSTR p = out->buf.A + out->used;
if( space >= n )
{
WideCharToMultiByte( CP_ACP, 0, str, len, p, n, NULL, NULL );
out->used += n;
return len;
}
if( space > 0 )
WideCharToMultiByte( CP_ACP, 0, str, len, p, space, NULL, NULL );
out->used += n;
}
return -1;
}
static inline int pf_output_stringA( pf_output *out, LPCSTR str, int len )
{
int space = out->len - out->used;
if( len < 0 )
len = strlen( str );
if( !out->unicode )
{
LPSTR p = out->buf.A + out->used;
if( space >= len )
{
memcpy( p, str, len );
out->used += len;
return len;
}
if( space > 0 )
memcpy( p, str, space );
out->used += len;
}
else
{
int n = MultiByteToWideChar( CP_ACP, 0, str, len, NULL, 0 );
LPWSTR p = out->buf.W + out->used;
if( space >= n )
{
MultiByteToWideChar( CP_ACP, 0, str, len, p, n );
out->used += n;
return len;
}
if( space > 0 )
MultiByteToWideChar( CP_ACP, 0, str, len, p, space );
out->used += n;
}
return -1;
}
/* pf_fill: takes care of signs, alignment, zero and field padding */
static inline int pf_fill( pf_output *out, int len, pf_flags *flags, char left )
{
int i, r = 0;
if( flags->Sign && !( flags->Format == 'd' || flags->Format == 'i' ) )
flags->Sign = 0;
if( left && flags->Sign )
{
flags->FieldLength--;
if( flags->PadZero )
r = pf_output_stringA( out, &flags->Sign, 1 );
}
if( ( !left && flags->LeftAlign ) ||
( left && !flags->LeftAlign ))
{
for( i=0; (i<(flags->FieldLength-len)) && (r>=0); i++ )
{
if( left && flags->PadZero )
r = pf_output_stringA( out, "0", 1 );
else
r = pf_output_stringA( out, " ", 1 );
}
}
if( left && flags->Sign && !flags->PadZero )
r = pf_output_stringA( out, &flags->Sign, 1 );
return r;
}
static inline int pf_output_format_W( pf_output *out, LPCWSTR str,
int len, pf_flags *flags )
{
int r = 0;
if( len < 0 )
len = strlenW( str );
if (flags->Precision >= 0 && flags->Precision < len)
len = flags->Precision;
r = pf_fill( out, len, flags, 1 );
if( r>=0 )
r = pf_output_stringW( out, str, len );
if( r>=0 )
r = pf_fill( out, len, flags, 0 );
return r;
}
static inline int pf_output_format_A( pf_output *out, LPCSTR str,
int len, pf_flags *flags )
{
int r = 0;
if( len < 0 )
len = strlen( str );
if (flags->Precision >= 0 && flags->Precision < len)
len = flags->Precision;
r = pf_fill( out, len, flags, 1 );
if( r>=0 )
r = pf_output_stringA( out, str, len );
if( r>=0 )
r = pf_fill( out, len, flags, 0 );
return r;
}
#ifndef USE_NEW_SPRINTF
static int pf_handle_string_format( pf_output *out, const void* str, int len,
pf_flags *flags, BOOL capital_letter)
{
if(str == NULL) /* catch NULL pointer */
return pf_output_format_A( out, "(null)", -1, flags);
/* prefixes take priority over %c,%s vs. %C,%S, so we handle them first */
if(flags->WideString || flags->IntegerLength == 'l')
return pf_output_format_W( out, str, len, flags);
if(flags->IntegerLength == 'h')
return pf_output_format_A( out, str, len, flags);
/* %s,%c -> chars in ansi functions & wchars in unicode
* %S,%C -> wchars in ansi functions & chars in unicode */
if( capital_letter == out->unicode) /* either both TRUE or both FALSE */
return pf_output_format_A( out, str, len, flags);
else
return pf_output_format_W( out, str, len, flags);
}
static inline BOOL pf_is_integer_format( char fmt )
{
static const char float_fmts[] = "diouxX";
if (!fmt)
return FALSE;
return strchr( float_fmts, fmt ) ? TRUE : FALSE;
}
static inline BOOL pf_is_double_format( char fmt )
{
static const char float_fmts[] = "aeEfgG";
if (!fmt)
return FALSE;
return strchr( float_fmts, fmt ) ? TRUE : FALSE;
}
static inline BOOL pf_is_valid_format( char fmt )
{
static const char float_fmts[] = "acCdeEfgGinouxX";
if (!fmt)
return FALSE;
return strchr( float_fmts, fmt ) ? TRUE : FALSE;
}
static void pf_rebuild_format_string( char *p, pf_flags *flags )
{
*p++ = '%';
if( flags->Sign )
*p++ = flags->Sign;
if( flags->LeftAlign )
*p++ = flags->LeftAlign;
if( flags->Alternate )
*p++ = flags->Alternate;
if( flags->PadZero )
*p++ = flags->PadZero;
if( flags->FieldLength )
{
lnx_sprintf(p, "%d", flags->FieldLength);
p += strlen(p);
}
if( flags->Precision >= 0 )
{
lnx_sprintf(p, ".%d", flags->Precision);
p += strlen(p);
}
*p++ = flags->Format;
*p++ = 0;
}
/* pf_integer_conv: prints x to buf, including alternate formats and
additional precision digits, but not field characters or the sign */
static void pf_integer_conv( char *buf, unsigned int buf_len, pf_flags *flags,
LONGLONG x )
{
unsigned int base;
const char *digits;
int i, j, k;
char number[40], *tmp = number;
if( buf_len > sizeof number )
tmp = HeapAlloc( GetProcessHeap(), 0, buf_len );
base = 10;
if( flags->Format == 'o' )
base = 8;
else if( flags->Format == 'x' || flags->Format == 'X' )
base = 16;
if( flags->Format == 'X' )
digits = "0123456789ABCDEFX";
else
digits = "0123456789abcdefx";
if( x < 0 && ( flags->Format == 'd' || flags->Format == 'i' ) )
{
x = -x;
flags->Sign = '-';
}
/* Do conversion (backwards) */
i = 0;
if( x == 0 && flags->Precision )
tmp[i++] = '0';
else
while( x != 0 )
{
j = (ULONGLONG) x % base;
x = (ULONGLONG) x / base;
tmp[i++] = digits[j];
}
k = flags->Precision - i;
while( k-- > 0 )
tmp[i++] = '0';
if( flags->Alternate )
{
if( base == 16 )
{
tmp[i++] = digits[16];
tmp[i++] = '0';
}
else if( base == 8 && tmp[i-1] != '0' )
tmp[i++] = '0';
}
/* Reverse for buf */
j = 0;
while( i-- > 0 )
buf[j++] = tmp[i];
buf[j] = '\0';
/* Adjust precision so pf_fill won't truncate the number later */
flags->Precision = strlen( buf );
if( tmp != number )
HeapFree( GetProcessHeap(), 0, tmp );
return;
}
/*********************************************************************
* pf_vsnprintf (INTERNAL)
*
* implements both A and W vsnprintf functions
*/
static int pf_vsnprintf( pf_output *out, const WCHAR *format, va_list valist )
{
int r;
LPCWSTR q, p = format;
pf_flags flags;
TRACE("format is %s\n",debugstr_w(format));
while (*p)
{
q = strchrW( p, '%' );
/* there's no % characters left, output the rest of the string */
if( !q )
{
r = pf_output_stringW(out, p, -1);
if( r<0 )
return r;
p += r;
continue;
}
/* there's characters before the %, output them */
if( q != p )
{
r = pf_output_stringW(out, p, q - p);
if( r<0 )
return r;
p = q;
}
/* we must be at a % now, skip over it */
assert( *p == '%' );
p++;
/* output a single % character */
if( *p == '%' )
{
r = pf_output_stringW(out, p++, 1);
if( r<0 )
return r;
continue;
}
/* parse the flags */
memset( &flags, 0, sizeof flags );
while (*p)
{
if( *p == '+' || *p == ' ' )
{
if ( flags.Sign != '+' )
flags.Sign = *p;
}
else if( *p == '-' )
flags.LeftAlign = *p;
else if( *p == '0' )
flags.PadZero = *p;
else if( *p == '#' )
flags.Alternate = *p;
else
break;
p++;
}
/* deal with the field width specifier */
flags.FieldLength = 0;
if( *p == '*' )
{
flags.FieldLength = va_arg( valist, int );
if (flags.FieldLength < 0)
{
flags.LeftAlign = '-';
flags.FieldLength = -flags.FieldLength;
}
p++;
}
else while( isdigit(*p) )
{
flags.FieldLength *= 10;
flags.FieldLength += *p++ - '0';
}
/* deal with precision */
flags.Precision = -1;
if( *p == '.' )
{
flags.Precision = 0;
p++;
if( *p == '*' )
{
flags.Precision = va_arg( valist, int );
p++;
}
else while( isdigit(*p) )
{
flags.Precision *= 10;
flags.Precision += *p++ - '0';
}
}
/* deal with integer width modifier */
while( *p )
{
if( *p == 'h' || *p == 'l' || *p == 'L' )
{
flags.IntegerLength = *p;
p++;
}
else if( *p == 'I' )
{
if( *(p+1) == '6' && *(p+2) == '4' )
{
flags.IntegerDouble++;
p += 3;
}
else if( *(p+1) == '3' && *(p+2) == '2' )
p += 3;
else if( isdigit(*(p+1)) || *(p+1) == 0 )
break;
else
p++;
}
else if( *p == 'w' )
flags.WideString = *p++;
else if( *p == 'F' )
p++; /* ignore */
else
break;
}
flags.Format = *p;
r = 0;
/* output a string */
if( flags.Format == 's' || flags.Format == 'S' )
r = pf_handle_string_format( out, va_arg(valist, const void*), -1,
&flags, (flags.Format == 'S') );
/* output a single character */
else if( flags.Format == 'c' || flags.Format == 'C' )
{
INT ch = va_arg( valist, int );
r = pf_handle_string_format( out, &ch, 1, &flags, (flags.Format == 'C') );
}
/* output a pointer */
else if( flags.Format == 'p' )
{
char pointer[11];
flags.PadZero = 0;
if( flags.Alternate )
lnx_sprintf(pointer, "0X%08lX", va_arg(valist, long));
else
lnx_sprintf(pointer, "%08lX", va_arg(valist, long));
r = pf_output_format_A( out, pointer, -1, &flags );
}
/* deal with %n */
else if( flags.Format == 'n' )
{
int *x = va_arg(valist, int *);
*x = out->used;
}
/* deal with 64-bit integers */
else if( pf_is_integer_format( flags.Format ) && flags.IntegerDouble )
{
char number[40], *x = number;
/* Estimate largest possible required buffer size:
* Chooses the larger of the field or precision
* Includes extra bytes: 1 byte for null, 1 byte for sign,
4 bytes for exponent, 2 bytes for alternate formats, 1 byte
for a decimal, and 1 byte for an additional float digit. */
unsigned x_len = ((flags.FieldLength > flags.Precision) ?
flags.FieldLength : flags.Precision) + 10;
if( x_len >= sizeof number)
x = HeapAlloc( GetProcessHeap(), 0, x_len );
pf_integer_conv( x, x_len, &flags, va_arg(valist, LONGLONG) );
r = pf_output_format_A( out, x, -1, &flags );
if( x != number )
HeapFree( GetProcessHeap(), 0, x );
}
/* deal with integers and floats using libc's printf */
else if( pf_is_valid_format( flags.Format ) )
{
char fmt[20], number[40], *x = number;
/* Estimate largest possible required buffer size:
* Chooses the larger of the field or precision
* Includes extra bytes: 1 byte for null, 1 byte for sign,
4 bytes for exponent, 2 bytes for alternate formats, 1 byte
for a decimal, and 1 byte for an additional float digit. */
unsigned x_len = ((flags.FieldLength > flags.Precision) ?
flags.FieldLength : flags.Precision) + 10;
if( x_len >= sizeof number)
x = HeapAlloc( GetProcessHeap(), 0, x_len );
pf_rebuild_format_string( fmt, &flags );
if( pf_is_double_format( flags.Format ) )
lnx_sprintf( x, fmt, va_arg(valist, double) );
else
lnx_sprintf( x, fmt, va_arg(valist, int) );
r = pf_output_stringA( out, x, -1 );
if( x != number )
HeapFree( GetProcessHeap(), 0, x );
}
else
continue;
if( r<0 )
return r;
p++;
}
/* check we reached the end, and null terminate the string */
assert( *p == 0 );
pf_output_stringW( out, p, 1 );
return out->used - 1;
}
/*********************************************************************
* _vsnprintf (MSVCRT.@)
*/
int CDECL _vsnprintf( char *str, size_t len,
const char *format, va_list valist )
{
DWORD sz;
LPWSTR formatW = NULL;
pf_output out;
int r;
out.unicode = FALSE;
out.buf.A = str;
out.used = 0;
out.len = len;
if( format )
{
sz = MultiByteToWideChar( CP_ACP, 0, format, -1, NULL, 0 );
formatW = HeapAlloc( GetProcessHeap(), 0, sz*sizeof(WCHAR) );
MultiByteToWideChar( CP_ACP, 0, format, -1, formatW, sz );
}
r = pf_vsnprintf( &out, formatW, valist );
HeapFree( GetProcessHeap(), 0, formatW );
return r;
}
/*********************************************************************
* vsprintf (MSVCRT.@)
*/
int CDECL vsprintf( char *str, const char *format, va_list valist)
{
return _vsnprintf(str, INT_MAX, format, valist);
}
/*********************************************************************
* _snprintf (MSVCRT.@)
*/
int CDECL _snprintf(char *str, size_t len, const char *format, ...)
{
int retval;
va_list valist;
va_start(valist, format);
retval = _vsnprintf(str, len, format, valist);
va_end(valist);
return retval;
}
/*********************************************************************
* _vsnwsprintf (MSVCRT.@)
*/
int CDECL _vsnwprintf( wchar_t *str, size_t len,
const wchar_t *format, va_list valist )
{
pf_output out;
out.unicode = TRUE;
out.buf.W = str;
out.used = 0;
out.len = len;
return pf_vsnprintf( &out, format, valist );
}
/*********************************************************************
* _snwprintf (MSVCRT.@)
*/
int CDECL _snwprintf( wchar_t *str, size_t len, const wchar_t *format, ...)
{
int retval;
va_list valist;
va_start(valist, format);
retval = _vsnwprintf(str, len, format, valist);
va_end(valist);
return retval;
}
/*********************************************************************
* sprintf (MSVCRT.@)
*/
int CDECL sprintf( char *str, const char *format, ... )
{
va_list ap;
int r;
va_start( ap, format );
r = _vsnprintf( str, INT_MAX, format, ap );
va_end( ap );
return r;
}
/*********************************************************************
* swprintf (MSVCRT.@)
*/
int CDECL swprintf( wchar_t *str, const wchar_t *format, ... )
{
va_list ap;
int r;
va_start( ap, format );
r = _vsnwprintf( str, INT_MAX, format, ap );
va_end( ap );
return r;
}
/*********************************************************************
* vswprintf (MSVCRT.@)
*/
int CDECL vswprintf( wchar_t* str, const wchar_t* format, va_list args )
{
return _vsnwprintf( str, INT_MAX, format, args );
}
#endif
#endif
/*********************************************************************
@ -1048,97 +377,6 @@ size_t CDECL wcstombs(char *mbstr, const wchar_t *wcstr, size_t count)
}
#endif
#ifndef __REACTOS__
/*********************************************************************
* iswalnum (MSVCRT.@)
*/
INT CDECL iswalnum( wchar_t wc )
{
return isalnumW( wc );
}
/*********************************************************************
* iswalpha (MSVCRT.@)
*/
INT CDECL iswalpha( wchar_t wc )
{
return isalphaW( wc );
}
/*********************************************************************
* iswcntrl (MSVCRT.@)
*/
INT CDECL iswcntrl( wchar_t wc )
{
return iscntrlW( wc );
}
/*********************************************************************
* iswdigit (MSVCRT.@)
*/
INT CDECL iswdigit( wchar_t wc )
{
return isdigitW( wc );
}
/*********************************************************************
* iswgraph (MSVCRT.@)
*/
INT CDECL iswgraph( wchar_t wc )
{
return isgraphW( wc );
}
/*********************************************************************
* iswlower (MSVCRT.@)
*/
INT CDECL iswlower( wchar_t wc )
{
return islowerW( wc );
}
/*********************************************************************
* iswprint (MSVCRT.@)
*/
INT CDECL iswprint( wchar_t wc )
{
return isprintW( wc );
}
/*********************************************************************
* iswpunct (MSVCRT.@)
*/
INT CDECL iswpunct( wchar_t wc )
{
return ispunctW( wc );
}
/*********************************************************************
* iswspace (MSVCRT.@)
*/
INT CDECL iswspace( wchar_t wc )
{
return isspaceW( wc );
}
/*********************************************************************
* iswupper (MSVCRT.@)
*/
INT CDECL iswupper( wchar_t wc )
{
return isupperW( wc );
}
/*********************************************************************
* iswxdigit (MSVCRT.@)
*/
INT CDECL iswxdigit( wchar_t wc )
{
return isxdigitW( wc );
}
#endif
/*********************************************************************
* wcscpy_s (MSVCRT.@)
*/