2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 // For character conversion functions like "wctomb" and "alloca" under Unix
21 // Under Win32 hosts, "alloca" is not defined by stdlib.h, but by malloc.h
22 // On the other hand, malloc.h is deprecated under some Unix hosts, so only include it for Win32 hosts.
33 #define _finite __finite
34 #define _isnan __isnan
38 inline int iswdigit ( wchar_t c
)
40 return ( c
>= L
'0' && c
<= L
'9' );
44 #if defined(__FreeBSD__) || defined(__APPLE__) || defined(__CYGWIN__)
45 # define __isnan isnan
46 # define __finite finite
47 # define powl __builtin_powl
48 # define modfl __builtin_modfl
52 #define alloca _alloca
56 typedef __int64 LONGLONG
;
57 typedef unsigned __int64 ULONGLONG
;
59 typedef long long LONGLONG
;
60 typedef unsigned long long ULONGLONG
;
64 unsigned int mantissa
:23;
65 unsigned int exponent
:8;
70 unsigned int mantissal
:32;
71 unsigned int mantissah
:20;
72 unsigned int exponent
:11;
77 unsigned int mantissal
:32;
78 unsigned int mantissah
:32;
79 unsigned int exponent
:15;
81 unsigned int empty
:16;
85 ssprintf ( const char* fmt
, ... )
89 std::string f
= ssvprintf ( fmt
, arg
);
95 sswprintf ( const wchar_t* fmt
, ... )
99 std::wstring f
= sswvprintf ( fmt
, arg
);
104 #define ZEROPAD 1 /* pad with zero */
105 #define SIGN 2 /* unsigned/signed long */
106 #define PLUS 4 /* show plus */
107 #define SPACE 8 /* space if plus */
108 #define LEFT 16 /* left justified */
109 #define SPECIAL 32 /* 0x */
110 #define LARGE 64 /* use 'ABCDEF' instead of 'abcdef' */
111 #define ZEROTRUNC 128 /* truncate zero 's */
115 skip_atoi(const char **s
)
120 i
= i
*10 + *((*s
)++) - '0';
125 skip_wtoi(const wchar_t **s
)
129 while (iswdigit(**s
))
130 i
= i
*10 + *((*s
)++) - L
'0';
136 do_div(LONGLONG
*n
,int base
)
138 int __res
= ((ULONGLONG
) *n
) % (unsigned) base
;
139 *n
= ((ULONGLONG
) *n
) / (unsigned) base
;
145 number(std::string
& f
, LONGLONG num
, int base
, int size
, int precision
,int type
)
148 const char *digits
="0123456789abcdefghijklmnopqrstuvwxyz";
152 digits
= "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
155 if (base
< 2 || base
> 36)
157 c
= (type
& ZEROPAD
) ? '0' : ' ';
164 } else if (type
& PLUS
) {
167 } else if (type
& SPACE
) {
172 if (type
& SPECIAL
) {
181 else while (num
!= 0)
182 tmp
[i
++] = digits
[do_div(&num
,base
)];
186 if (!(type
&(ZEROPAD
+LEFT
)))
206 while (i
< precision
--)
222 wnumber(std::wstring
& f
, LONGLONG num
, int base
, int size
, int precision
,int type
)
224 wchar_t c
,sign
,tmp
[66];
225 const wchar_t *digits
= L
"0123456789abcdefghijklmnopqrstuvwxyz";
229 digits
= L
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
232 if (base
< 2 || base
> 36)
234 c
= (type
& ZEROPAD
) ? L
'0' : L
' ';
241 } else if (type
& PLUS
) {
244 } else if (type
& SPACE
) {
249 if (type
& SPECIAL
) {
258 else while (num
!= 0)
259 tmp
[i
++] = digits
[do_div(&num
,base
)];
263 if (!(type
&(ZEROPAD
+LEFT
)))
283 while (i
< precision
--)
300 numberf(std::string
& f
, double __n
, char exp_sign
, int size
, int precision
, int type
)
302 double exponent
= 0.0;
312 char *buf
, *tmp
, sign
, c
;
323 if ( exp_sign
== 'g' || exp_sign
== 'G' || exp_sign
== 'e' || exp_sign
== 'E' )
325 ie
= ((unsigned int)n
.n
->exponent
- (unsigned int)0x3ff);
326 exponent
= ie
/3.321928;
329 if ( exp_sign
== 'g' || exp_sign
== 'G' )
332 if ( exponent
< -4 || fabs(exponent
) >= precision
)
333 exp_sign
-= 2; // g -> e and G -> E
338 if ( exp_sign
== 'e' || exp_sign
== 'E' )
340 frac
= modf(exponent
,&e
);
343 else if ( frac
< -0.5 )
346 result
= numberf(f
,__n
/pow(10.0L,(long double)e
),'f',size
-4, precision
, type
);
356 result
= number(f
,ie
, 10,2, 2,type
);
362 if ( exp_sign
== 'f' )
364 buf
= (char*)alloca(4096);
368 c
= (type
& ZEROPAD
) ? '0' : ' ';
378 else if (type
& PLUS
)
383 else if (type
& SPACE
)
390 frac
= modf(__n
,&intr
);
392 // # flags forces a . and prevents trucation of trailing zero's
399 frac
= modf(frac
, &p
);
400 buf
[i
] = (int)p
+ '0';
410 if ( precision
>= 1 || type
& SPECIAL
)
432 buf
[i
++] = (int)p
+ '0';
438 while ( j
< i
&& ro
== 1)
440 if ( buf
[j
] >= '0' && buf
[j
] <= '8' )
445 else if ( buf
[j
] == '9' )
456 if (!(type
&(ZEROPAD
+LEFT
)))
466 if (!(type
&(ZEROPAD
+LEFT
)))
479 if ( type
& ZEROTRUNC
&& ((type
& SPECIAL
) != SPECIAL
) )
482 while ( j
< i
&& ( *tmp
== '0' || *tmp
== '.' ))
501 wnumberf(std::wstring
& f
, double __n
, wchar_t exp_sign
, int size
, int precision
, int type
)
503 double exponent
= 0.0;
513 wchar_t *buf
, *tmp
, sign
, c
;
524 if ( exp_sign
== L
'g' || exp_sign
== L
'G' || exp_sign
== L
'e' || exp_sign
== L
'E' )
526 ie
= ((unsigned int)n
.n
->exponent
- (unsigned int)0x3ff);
527 exponent
= ie
/3.321928;
530 if ( exp_sign
== L
'g' || exp_sign
== L
'G' )
533 if ( exponent
< -4 || fabs(exponent
) >= precision
)
534 exp_sign
-= 2; // g -> e and G -> E
539 if ( exp_sign
== L
'e' || exp_sign
== L
'E' )
541 frac
= modf(exponent
,&e
);
544 else if ( frac
< -0.5 )
547 result
= wnumberf(f
,__n
/pow(10.0L,(long double) e
),L
'f',size
-4, precision
, type
);
557 result
= wnumber(f
,ie
, 10,2, 2,type
);
563 if ( exp_sign
== L
'f' )
565 buf
= (wchar_t*)alloca(4096*sizeof(wchar_t));
569 c
= (type
& ZEROPAD
) ? L
'0' : L
' ';
579 else if (type
& PLUS
)
584 else if (type
& SPACE
)
591 frac
= modf(__n
,&intr
);
593 // # flags forces a . and prevents trucation of trailing zero's
600 frac
= modf(frac
, &p
);
601 buf
[i
] = (int)p
+ L
'0';
611 if ( precision
>= 1 || type
& SPECIAL
)
633 buf
[i
++] = (int)p
+ L
'0';
639 while ( j
< i
&& ro
== 1)
641 if ( buf
[j
] >= L
'0' && buf
[j
] <= L
'8' )
646 else if ( buf
[j
] == L
'9' )
657 if (!(type
&(ZEROPAD
+LEFT
)))
667 if (!(type
&(ZEROPAD
+LEFT
)))
680 if ( type
& ZEROTRUNC
&& ((type
& SPECIAL
) != SPECIAL
) )
683 while ( j
< i
&& ( *tmp
== L
'0' || *tmp
== L
'.' ))
702 numberfl(std::string
& f
, long double __n
, char exp_sign
, int size
, int precision
, int type
)
704 long double exponent
= 0.0;
712 long double frac
, intr
;
714 char *buf
, *tmp
, sign
, c
;
720 ieee_long_double_t
* n
;
725 if ( exp_sign
== 'g' || exp_sign
== 'G' || exp_sign
== 'e' || exp_sign
== 'E' )
727 ie
= ((unsigned int)n
.n
->exponent
- (unsigned int)0x3fff);
728 exponent
= ie
/3.321928;
731 if ( exp_sign
== 'g' || exp_sign
== 'G' )
734 if ( exponent
< -4 || fabs(exponent
) >= precision
)
735 exp_sign
-= 2; // g -> e and G -> E
740 if ( exp_sign
== 'e' || exp_sign
== 'E' )
742 frac
= modfl(exponent
,&e
);
745 else if ( frac
< -0.5 )
748 result
= numberf(f
,__n
/powl(10.0L,e
),'f',size
-4, precision
, type
);
758 result
= number(f
,ie
, 10,2, 2,type
);
764 if ( exp_sign
== 'f' )
766 buf
= (char*)alloca(4096);
770 c
= (type
& ZEROPAD
) ? '0' : ' ';
780 else if (type
& PLUS
)
785 else if (type
& SPACE
)
792 frac
= modfl(__n
,&intr
);
794 // # flags forces a . and prevents trucation of trailing zero's
801 frac
= modfl((long double)frac
, &p
);
802 buf
[i
] = (int)p
+ '0';
812 if ( precision
>= 1 || type
& SPECIAL
)
834 buf
[i
++] = (int)p
+ '0';
840 while ( j
< i
&& ro
== 1)
842 if ( buf
[j
] >= '0' && buf
[j
] <= '8' )
847 else if ( buf
[j
] == '9' )
858 if (!(type
&(ZEROPAD
+LEFT
)))
868 if (!(type
&(ZEROPAD
+LEFT
)))
881 if ( type
& ZEROTRUNC
&& ((type
& SPECIAL
) != SPECIAL
) )
884 while ( j
< i
&& ( *tmp
== '0' || *tmp
== '.' ))
903 wnumberfl(std::wstring
& f
, long double __n
, wchar_t exp_sign
, int size
, int precision
, int type
)
905 long double exponent
= 0.0;
913 long double frac
, intr
;
915 wchar_t *buf
, *tmp
, sign
, c
;
921 ieee_long_double_t
* n
;
926 if ( exp_sign
== L
'g' || exp_sign
== L
'G' || exp_sign
== L
'e' || exp_sign
== L
'E' )
928 ie
= ((unsigned int)n
.n
->exponent
- (unsigned int)0x3fff);
929 exponent
= ie
/3.321928;
932 if ( exp_sign
== L
'g' || exp_sign
== L
'G' )
935 if ( exponent
< -4 || fabs(exponent
) >= precision
)
936 exp_sign
-= 2; // g -> e and G -> E
941 if ( exp_sign
== L
'e' || exp_sign
== L
'E' )
943 frac
= modfl(exponent
,&e
);
946 else if ( frac
< -0.5 )
949 result
= wnumberf(f
,__n
/powl(10.0L,e
),L
'f',size
-4, precision
, type
);
959 result
= wnumber(f
,ie
, 10,2, 2,type
);
965 if ( exp_sign
== L
'f' )
967 buf
= (wchar_t*)alloca(4096*sizeof(wchar_t));
971 c
= (type
& ZEROPAD
) ? L
'0' : L
' ';
981 else if (type
& PLUS
)
986 else if (type
& SPACE
)
993 frac
= modfl(__n
,&intr
);
995 // # flags forces a . and prevents trucation of trailing zero's
1002 frac
= modfl((long double)frac
, &p
);
1003 buf
[i
] = (int)p
+ L
'0';
1013 if ( precision
>= 1 || type
& SPECIAL
)
1027 while ( intr
> 0.0 )
1035 buf
[i
++] = (int)p
+ L
'0';
1041 while ( j
< i
&& ro
== 1)
1043 if ( buf
[j
] >= L
'0' && buf
[j
] <= L
'8' )
1048 else if ( buf
[j
] == L
'9' )
1059 if (!(type
&(ZEROPAD
+LEFT
)))
1069 if (!(type
&(ZEROPAD
+LEFT
)))
1082 if ( type
& ZEROTRUNC
&& ((type
& SPECIAL
) != SPECIAL
) )
1085 while ( j
< i
&& ( *tmp
== L
'0' || *tmp
== L
'.' ))
1104 do_string(std::string
& f
, const char* s
, int len
, int field_width
, int precision
, int flags
)
1117 while ((unsigned int)len
< (unsigned int)precision
&& s
[len
])
1122 if ((unsigned int)len
> (unsigned int)precision
)
1126 if (!(flags
& LEFT
))
1127 while (len
< field_width
--)
1132 for (i
= 0; i
< len
; ++i
)
1137 while (len
< field_width
--)
1146 do_wstring(std::wstring
& f
, const wchar_t* s
, int len
, int field_width
, int precision
, int flags
)
1159 while ((unsigned int)len
< (unsigned int)precision
&& s
[len
])
1164 if ((unsigned int)len
> (unsigned int)precision
)
1168 if (!(flags
& LEFT
))
1169 while (len
< field_width
--)
1174 for (i
= 0; i
< len
; ++i
)
1179 while (len
< field_width
--)
1188 stringw(std::string
& f
, const wchar_t* sw
, int len
, int field_width
, int precision
, int flags
)
1201 while ((unsigned int)len
< (unsigned int)precision
&& sw
[len
])
1206 if ((unsigned int)len
> (unsigned int)precision
)
1210 if (!(flags
& LEFT
))
1211 while (len
< field_width
--)
1216 for (i
= 0; i
< len
; ++i
)
1218 #define MY_MB_CUR_MAX 1
1219 char mb
[MY_MB_CUR_MAX
];
1221 mbcount
= wctomb(mb
, *sw
++);
1226 for (j
= 0; j
< mbcount
; j
++)
1232 while (len
< field_width
--)
1241 wstringa(std::wstring
& f
, const char* sa
, int len
, int field_width
, int precision
, int flags
)
1254 while ((unsigned int)len
< (unsigned int)precision
&& sa
[len
])
1259 if ((unsigned int)len
> (unsigned int)precision
)
1263 if (!(flags
& LEFT
))
1264 while (len
< field_width
--)
1269 for (i
= 0; i
< len
;)
1273 mbcount
= mbtowc(&w
, sa
+i
, len
-i
);
1280 while (len
< field_width
--)
1288 #define _isnanl _isnan
1289 #define _finitel _finite
1292 ssvprintf ( const char *fmt
, va_list args
)
1296 long double _ldouble
;
1303 int flags
; /* flags to number() */
1305 int field_width
; /* width of output field */
1306 int precision
; /* min. # of digits for integers; max
1307 number of chars for from string */
1308 int qualifier
= 0; /* 'h', 'l', 'L' or 'I64' for integer fields */
1310 for (; *fmt
; ++fmt
)
1321 ++fmt
; /* this also skips first '%' */
1323 case '-': flags
|= LEFT
; goto repeat
;
1324 case '+': flags
|= PLUS
; goto repeat
;
1325 case ' ': flags
|= SPACE
; goto repeat
;
1326 case '#': flags
|= SPECIAL
; goto repeat
;
1327 case '0': flags
|= ZEROPAD
; goto repeat
;
1330 /* get field width */
1333 field_width
= skip_atoi(&fmt
);
1334 else if (*fmt
== '*') {
1336 /* it's the next argument */
1337 field_width
= va_arg(args
, int);
1338 if (field_width
< 0) {
1339 field_width
= -field_width
;
1344 /* get the precision */
1349 precision
= skip_atoi(&fmt
);
1350 else if (*fmt
== '*') {
1352 /* it's the next argument */
1353 precision
= va_arg(args
, int);
1359 /* get the conversion qualifier */
1361 // %Z can be just stand alone or as size_t qualifier
1362 if ( *fmt
== 'Z' ) {
1364 switch ( *(fmt
+1)) {
1377 } else if (*fmt
== 'h' || *fmt
== 'l' || *fmt
== 'L' || *fmt
== 'w') {
1380 } else if (*fmt
== 'I' && *(fmt
+1) == '6' && *(fmt
+2) == '4') {
1385 // go fine with ll instead of L
1386 if ( *fmt
== 'l' ) {
1396 if (!(flags
& LEFT
))
1397 while (--field_width
> 0)
1401 if (qualifier
== 'l' || qualifier
== 'w')
1403 f
+= (char)(unsigned char)(wchar_t) va_arg(args
,int);
1407 f
+= (char)(unsigned char) va_arg(args
,int);
1409 while (--field_width
> 0)
1416 if (!(flags
& LEFT
))
1417 while (--field_width
> 0)
1421 if (qualifier
== 'h')
1423 f
+= (char)(unsigned char) va_arg(args
,int);
1427 f
+= (char)(unsigned char)(wchar_t) va_arg(args
,int);
1429 while (--field_width
> 0)
1436 if (qualifier
== 'l' || qualifier
== 'w') {
1437 /* print unicode string */
1438 sw
= va_arg(args
, wchar_t *);
1439 result
= stringw(f
, sw
, -1, field_width
, precision
, flags
);
1441 /* print ascii string */
1442 s
= va_arg(args
, char *);
1443 result
= do_string(f
, s
, -1, field_width
, precision
, flags
);
1447 assert(!"TODO FIXME handle error better");
1453 if (qualifier
== 'h') {
1454 /* print ascii string */
1455 s
= va_arg(args
, char *);
1456 result
= do_string(f
, s
, -1, field_width
, precision
, flags
);
1458 /* print unicode string */
1459 sw
= va_arg(args
, wchar_t *);
1460 result
= stringw(f
, sw
, -1, field_width
, precision
, flags
);
1464 assert(!"TODO FIXME handle error better");
1470 if (qualifier == 'w') {
1471 // print counted unicode string
1472 PUNICODE_STRING pus = va_arg(args, PUNICODE_STRING);
1473 if ((pus == NULL) || (pus->Buffer == NULL)) {
1478 len = pus->Length / sizeof(WCHAR);
1480 result = stringw(f, sw, len, field_width, precision, flags);
1482 // print counted ascii string
1483 PANSI_STRING pas = va_arg(args, PANSI_STRING);
1484 if ((pas == NULL) || (pas->Buffer == NULL)) {
1491 result = string(f, s, -1, field_width, precision, flags);
1502 if (qualifier
== 'l' || qualifier
== 'L' ) {
1503 _ldouble
= va_arg(args
, long double);
1505 if ( _isnanl(_ldouble
) )
1509 else if ( !_finitel(_ldouble
) )
1516 if ( precision
== -1 )
1518 result
= numberfl(f
,_ldouble
,*fmt
,field_width
,precision
,flags
);
1521 assert(!"TODO FIXME handle error better");
1526 _double
= (double)va_arg(args
, double);
1528 if ( _isnan(_double
) )
1532 else if ( !_finite(_double
) )
1541 if ( precision
== -1 )
1543 result
= numberf(f
,_double
,*fmt
,field_width
,precision
,flags
);
1546 assert(!"TODO FIXME handle error better");
1554 if (field_width
== -1) {
1555 field_width
= 2*sizeof(void *);
1559 (size_t) va_arg(args
, void *), 16,
1560 field_width
, precision
, flags
);
1563 assert(!"TODO FIXME handle error better");
1569 if (qualifier
== 'l') {
1570 long * ip
= va_arg(args
, long *);
1573 int * ip
= va_arg(args
, int *);
1578 /* integer number formats - set up the flags and "break" */
1613 if (qualifier
== 'I')
1614 num
= va_arg(args
, ULONGLONG
);
1615 else if (qualifier
== 'l') {
1617 num
= va_arg(args
, long);
1619 num
= va_arg(args
, unsigned long);
1621 else if (qualifier
== 'h') {
1623 num
= va_arg(args
, int);
1625 num
= va_arg(args
, unsigned int);
1627 else if (flags
& SIGN
)
1628 num
= va_arg(args
, int);
1630 num
= va_arg(args
, unsigned int);
1631 result
= number(f
, num
, base
, field_width
, precision
, flags
);
1634 assert(!"TODO FIXME handle error better");
1643 sswvprintf ( const wchar_t* fmt
, va_list args
)
1647 long double _ldouble
;
1654 int flags
; /* flags to number() */
1656 int field_width
; /* width of output field */
1657 int precision
; /* min. # of digits for integers; max
1658 number of chars for from string */
1659 int qualifier
= 0; /* 'h', 'l', 'L' or 'I64' for integer fields */
1661 for (; *fmt
; ++fmt
)
1672 ++fmt
; /* this also skips first '%' */
1674 case L
'-': flags
|= LEFT
; goto repeat
;
1675 case L
'+': flags
|= PLUS
; goto repeat
;
1676 case L
' ': flags
|= SPACE
; goto repeat
;
1677 case L
'#': flags
|= SPECIAL
; goto repeat
;
1678 case L
'0': flags
|= ZEROPAD
; goto repeat
;
1681 /* get field width */
1684 field_width
= skip_wtoi(&fmt
);
1685 else if (*fmt
== L
'*') {
1687 /* it's the next argument */
1688 field_width
= va_arg(args
, int);
1689 if (field_width
< 0) {
1690 field_width
= -field_width
;
1695 /* get the precision */
1700 precision
= skip_wtoi(&fmt
);
1701 else if (*fmt
== L
'*') {
1703 /* it's the next argument */
1704 precision
= va_arg(args
, int);
1710 /* get the conversion qualifier */
1712 // %Z can be just stand alone or as size_t qualifier
1713 if ( *fmt
== L
'Z' ) {
1715 switch ( *(fmt
+1)) {
1728 } else if (*fmt
== L
'h' || *fmt
== L
'l' || *fmt
== L
'L' || *fmt
== L
'w') {
1731 } else if (*fmt
== L
'I' && *(fmt
+1) == L
'6' && *(fmt
+2) == L
'4') {
1736 // go fine with ll instead of L
1737 if ( *fmt
== L
'l' ) {
1747 if (!(flags
& LEFT
))
1748 while (--field_width
> 0)
1752 if ( qualifier
== L
'h' )
1754 f
+= (wchar_t)(char)(unsigned char) va_arg(args
,int);
1758 f
+= (wchar_t) va_arg(args
,int);
1760 while (--field_width
> 0)
1767 if (!(flags
& LEFT
))
1768 while (--field_width
> 0)
1772 if (qualifier
== L
'l' || qualifier
== L
'w')
1774 f
+= (wchar_t) va_arg(args
,int);
1778 f
+= (wchar_t)(char)(unsigned char) va_arg(args
,int);
1780 while (--field_width
> 0)
1787 if (qualifier
== L
'h') {
1788 /* print ascii string */
1789 sa
= va_arg(args
, char *);
1790 result
= wstringa(f
, sa
, -1, field_width
, precision
, flags
);
1792 /* print unicode string */
1793 s
= va_arg(args
, wchar_t *);
1794 result
= do_wstring(f
, s
, -1, field_width
, precision
, flags
);
1798 assert(!"TODO FIXME handle error better");
1804 if (qualifier
== L
'l' || qualifier
== L
'w') {
1805 /* print unicode string */
1806 s
= va_arg(args
, wchar_t *);
1807 result
= do_wstring(f
, s
, -1, field_width
, precision
, flags
);
1809 /* print ascii string */
1810 sa
= va_arg(args
, char *);
1811 result
= wstringa(f
, sa
, -1, field_width
, precision
, flags
);
1815 assert(!"TODO FIXME handle error better");
1825 if (qualifier
== L
'l' || qualifier
== L
'L' )
1827 _ldouble
= va_arg(args
, long double);
1829 if ( _isnanl(_ldouble
) )
1833 else if ( !_finitel(_ldouble
) )
1840 if ( precision
== -1 )
1842 result
= wnumberfl(f
,_ldouble
,*fmt
,field_width
,precision
,flags
);
1845 assert(!"TODO FIXME handle error better");
1850 _double
= (double)va_arg(args
, double);
1852 if ( _isnan(_double
) )
1856 else if ( !_finite(_double
) )
1865 if ( precision
== -1 )
1867 result
= wnumberf(f
,_double
,*fmt
,field_width
,precision
,flags
);
1870 assert(!"TODO FIXME handle error better");
1878 if (field_width
== -1) {
1879 field_width
= 2*sizeof(void *);
1883 (size_t) va_arg(args
, void *), 16,
1884 field_width
, precision
, flags
);
1887 assert(!"TODO FIXME handle error better");
1893 if (qualifier
== L
'l') {
1894 long * ip
= va_arg(args
, long *);
1897 int * ip
= va_arg(args
, int *);
1902 /* integer number formats - set up the flags and "break" */
1937 if (qualifier
== L
'I')
1938 num
= va_arg(args
, ULONGLONG
);
1939 else if (qualifier
== L
'l') {
1941 num
= va_arg(args
, long);
1943 num
= va_arg(args
, unsigned long);
1945 else if (qualifier
== L
'h') {
1947 num
= va_arg(args
, int);
1949 num
= va_arg(args
, unsigned int);
1951 else if (flags
& SIGN
)
1952 num
= va_arg(args
, int);
1954 num
= va_arg(args
, unsigned int);
1955 result
= wnumber(f
, num
, base
, field_width
, precision
, flags
);
1958 assert(!"TODO FIXME handle error better");