16 # define __isnan isnan
17 # define __finite finite
18 # define powl __builtin_powl
19 # define modfl __builtin_modfl
23 #define alloca _alloca
27 typedef __int64 LONGLONG
;
28 typedef unsigned __int64 ULONGLONG
;
30 typedef long long LONGLONG
;
31 typedef unsigned long long ULONGLONG
;
35 unsigned int mantissa
:23;
36 unsigned int exponent
:8;
41 unsigned int mantissal
:32;
42 unsigned int mantissah
:20;
43 unsigned int exponent
:11;
48 unsigned int mantissal
:32;
49 unsigned int mantissah
:32;
50 unsigned int exponent
:15;
52 unsigned int empty
:16;
56 ssprintf ( const char* fmt
, ... )
60 std::string f
= ssvprintf ( fmt
, arg
);
66 sswprintf ( const wchar_t* fmt
, ... )
70 std::wstring f
= sswvprintf ( fmt
, arg
);
75 #define ZEROPAD 1 /* pad with zero */
76 #define SIGN 2 /* unsigned/signed long */
77 #define PLUS 4 /* show plus */
78 #define SPACE 8 /* space if plus */
79 #define LEFT 16 /* left justified */
80 #define SPECIAL 32 /* 0x */
81 #define LARGE 64 /* use 'ABCDEF' instead of 'abcdef' */
82 #define ZEROTRUNC 128 /* truncate zero 's */
86 skip_atoi(const char **s
)
91 i
= i
*10 + *((*s
)++) - '0';
96 skip_wtoi(const wchar_t **s
)
100 while (iswdigit(**s
))
101 i
= i
*10 + *((*s
)++) - L
'0';
107 do_div(LONGLONG
*n
,int base
)
109 int __res
= ((ULONGLONG
) *n
) % (unsigned) base
;
110 *n
= ((ULONGLONG
) *n
) / (unsigned) base
;
116 number(std::string
& f
, LONGLONG num
, int base
, int size
, int precision
,int type
)
119 const char *digits
="0123456789abcdefghijklmnopqrstuvwxyz";
123 digits
= "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
126 if (base
< 2 || base
> 36)
128 c
= (type
& ZEROPAD
) ? '0' : ' ';
135 } else if (type
& PLUS
) {
138 } else if (type
& SPACE
) {
143 if (type
& SPECIAL
) {
152 else while (num
!= 0)
153 tmp
[i
++] = digits
[do_div(&num
,base
)];
157 if (!(type
&(ZEROPAD
+LEFT
)))
177 while (i
< precision
--)
193 wnumber(std::wstring
& f
, LONGLONG num
, int base
, int size
, int precision
,int type
)
195 wchar_t c
,sign
,tmp
[66];
196 const wchar_t *digits
= L
"0123456789abcdefghijklmnopqrstuvwxyz";
200 digits
= L
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
203 if (base
< 2 || base
> 36)
205 c
= (type
& ZEROPAD
) ? L
'0' : L
' ';
212 } else if (type
& PLUS
) {
215 } else if (type
& SPACE
) {
221 if (type
& SPECIAL
) {
230 else while (num
!= 0)
231 tmp
[i
++] = digits
[do_div(&num
,base
)];
235 if (!(type
&(ZEROPAD
+LEFT
)))
255 while (i
< precision
--)
272 numberf(std::string
& f
, double __n
, char exp_sign
, int size
, int precision
, int type
)
274 double exponent
= 0.0;
299 if ( exp_sign
== 'g' || exp_sign
== 'G' || exp_sign
== 'e' || exp_sign
== 'E' ) {
300 ie
= ((unsigned int)n
.n
->exponent
- (unsigned int)0x3ff);
301 exponent
= ie
/3.321928;
304 if ( exp_sign
== 'g' || exp_sign
== 'G' ) {
306 if ( exponent
< -4 || fabs(exponent
) >= precision
)
307 exp_sign
-= 2; // g -> e and G -> E
310 if ( exp_sign
== 'e' || exp_sign
== 'E' ) {
311 frac
= modf(exponent
,&e
);
314 else if ( frac
< -0.5 )
317 result
= numberf(f
,__n
/pow(10.0L,e
),'f',size
-4, precision
, type
);
327 result
= number(f
,ie
, 10,2, 2,type
);
333 if ( exp_sign
== 'f' ) {
334 buf
= (char*)alloca(4096);
339 c
= (type
& ZEROPAD
) ? '0' : ' ';
346 } else if (type
& PLUS
) {
349 } else if (type
& SPACE
) {
355 frac
= modf(__n
,&intr
);
357 // # flags forces a . and prevents trucation of trailing zero's
359 if ( precision
> 0 ) {
360 //frac = modfl(__n,&intr);
364 frac
= modf(frac
, &p
);
365 buf
[i
] = (int)p
+ '0';
376 if ( precision
>= 1 || type
& SPECIAL
) {
387 while ( intr
> 0.0 ) {
394 buf
[i
++] = (int)p
+ '0';
400 while ( j
< i
&& ro
== 1) {
401 if ( buf
[j
] >= '0' && buf
[j
] <= '8' ) {
405 else if ( buf
[j
] == '9' ) {
416 if (!(type
&(ZEROPAD
+LEFT
)))
426 if (!(type
&(ZEROPAD
+LEFT
)))
431 if (type
& SPECIAL
) {
441 if ( type
& ZEROTRUNC
&& ((type
& SPECIAL
) != SPECIAL
) )
444 while ( j
< i
&& ( *tmp
== '0' || *tmp
== '.' ))
451 // while (i < precision--)
466 wnumberf(std::wstring
& f
, double __n
, wchar_t exp_sign
, int size
, int precision
, int type
)
468 double exponent
= 0.0;
477 wchar_t *buf
, *tmp
, sign
, c
, ro
= 0;
488 if ( exp_sign
== L
'g' || exp_sign
== L
'G' || exp_sign
== L
'e' || exp_sign
== L
'E' ) {
489 ie
= ((unsigned int)n
.n
->exponent
- (unsigned int)0x3ff);
490 exponent
= ie
/3.321928;
493 if ( exp_sign
== L
'g' || exp_sign
== L
'G' )
496 if ( exponent
< -4 || fabs(exponent
) >= precision
)
497 exp_sign
-= 2; // g -> e and G -> E
500 if ( exp_sign
== L
'e' || exp_sign
== L
'E' )
502 frac
= modf(exponent
,&e
);
505 else if ( frac
< -0.5 )
508 result
= wnumberf(f
,__n
/pow(10.0L,e
),L
'f',size
-4, precision
, type
);
518 result
= wnumber(f
,ie
, 10,2, 2,type
);
524 if ( exp_sign
== L
'f' )
526 buf
= (wchar_t*)alloca(4096*sizeof(wchar_t));
530 c
= (type
& ZEROPAD
) ? L
'0' : L
' ';
540 else if (type
& PLUS
)
545 else if (type
& SPACE
)
552 frac
= modf(__n
,&intr
);
554 // # flags forces a . and prevents trucation of trailing zero's
556 if ( precision
> 0 ) {
557 //frac = modfl(__n,&intr);
561 frac
= modf(frac
, &p
);
562 buf
[i
] = (int)p
+ L
'0';
573 if ( precision
>= 1 || type
& SPECIAL
) {
584 while ( intr
> 0.0 ) {
591 buf
[i
++] = (int)p
+ L
'0';
597 while ( j
< i
&& ro
== 1) {
598 if ( buf
[j
] >= L
'0' && buf
[j
] <= L
'8' ) {
602 else if ( buf
[j
] == L
'9' ) {
613 if (!(type
&(ZEROPAD
+LEFT
)))
623 if (!(type
&(ZEROPAD
+LEFT
)))
628 if (type
& SPECIAL
) {
638 if ( type
& ZEROTRUNC
&& ((type
& SPECIAL
) != SPECIAL
) )
641 while ( j
< i
&& ( *tmp
== L
'0' || *tmp
== L
'.' ))
660 numberfl(std::string
& f
, long double __n
, char exp_sign
, int size
, int precision
, int type
)
662 long double exponent
= 0.0;
672 long double frac
, intr
;
683 ieee_long_double_t
* n
;
688 if ( exp_sign
== 'g' || exp_sign
== 'G' || exp_sign
== 'e' || exp_sign
== 'E' ) {
689 ie
= ((unsigned int)n
.n
->exponent
- (unsigned int)0x3fff);
690 exponent
= ie
/3.321928;
693 if ( exp_sign
== 'g' || exp_sign
== 'G' ) {
695 if ( exponent
< -4 || fabs(exponent
) >= precision
)
696 exp_sign
-= 2; // g -> e and G -> E
699 if ( exp_sign
== 'e' || exp_sign
== 'E' ) {
700 frac
= modfl(exponent
,&e
);
703 else if ( frac
< -0.5 )
706 result
= numberf(f
,__n
/powl(10.0L,e
),'f',size
-4, precision
, type
);
716 result
= number(f
,ie
, 10,2, 2,type
);
723 if ( exp_sign
== 'f' )
726 buf
= (char*)alloca(4096);
732 c
= (type
& ZEROPAD
) ? '0' : ' ';
741 } else if (type
& PLUS
)
745 } else if (type
& SPACE
)
752 frac
= modfl(__n
,&intr
);
754 // # flags forces a . and prevents trucation of trailing zero's
757 //frac = modfl(__n,&intr);
763 frac
= modfl((long double)frac
, &p
);
764 buf
[i
] = (int)p
+ '0';
776 if ( precision
>= 1 || type
& SPECIAL
)
798 buf
[i
++] = (int)p
+ '0';
804 while ( j
< i
&& ro
== 1) {
805 if ( buf
[j
] >= '0' && buf
[j
] <= '8' )
810 else if ( buf
[j
] == '9' )
822 if (!(type
&(ZEROPAD
+LEFT
)))
832 if (!(type
&(ZEROPAD
+LEFT
)))
837 if (type
& SPECIAL
) {
846 if ( type
& ZEROTRUNC
&& ((type
& SPECIAL
) != SPECIAL
) )
849 while ( j
< i
&& ( *tmp
== '0' || *tmp
== '.' ))
868 wnumberfl(std::wstring
& f
, long double __n
, wchar_t exp_sign
, int size
, int precision
, int type
)
870 long double exponent
= 0.0;
874 wchar_t *buf
, *tmp
, sign
, c
, ro
= 0;
878 long double frac
, intr
;
886 ieee_long_double_t
* n
;
891 if ( exp_sign
== L
'g' || exp_sign
== L
'G' || exp_sign
== L
'e' || exp_sign
== L
'E' ) {
892 ie
= ((unsigned int)n
.n
->exponent
- (unsigned int)0x3fff);
893 exponent
= ie
/3.321928;
896 if ( exp_sign
== L
'g' || exp_sign
== L
'G' ) {
898 if ( exponent
< -4 || fabs(exponent
) >= precision
)
899 exp_sign
-= 2; // g -> e and G -> E
903 if ( exp_sign
== L
'e' || exp_sign
== L
'E' ) {
904 frac
= modfl(exponent
,&e
);
907 else if ( frac
< -0.5 )
910 result
= wnumberf(f
,__n
/powl(10.0L,e
),L
'f',size
-4, precision
, type
);
920 result
= wnumber(f
,ie
, 10,2, 2,type
);
926 if ( exp_sign
== L
'f' )
929 buf
= (wchar_t*)alloca(4096*sizeof(wchar_t));
935 c
= (type
& ZEROPAD
) ? L
'0' : L
' ';
944 } else if (type
& PLUS
)
948 } else if (type
& SPACE
)
955 frac
= modfl(__n
,&intr
);
957 // # flags forces a . and prevents trucation of trailing zero's
960 //frac = modfl(__n,&intr);
966 frac
= modfl((long double)frac
, &p
);
967 buf
[i
] = (int)p
+ L
'0';
979 if ( precision
>= 1 || type
& SPECIAL
)
1001 buf
[i
++] = (int)p
+ L
'0';
1007 while ( j
< i
&& ro
== 1) {
1008 if ( buf
[j
] >= L
'0' && buf
[j
] <= L
'8' )
1013 else if ( buf
[j
] == L
'9' )
1025 if (!(type
&(ZEROPAD
+LEFT
)))
1035 if (!(type
&(ZEROPAD
+LEFT
)))
1040 if (type
& SPECIAL
) {
1049 if ( type
& ZEROTRUNC
&& ((type
& SPECIAL
) != SPECIAL
) )
1052 while ( j
< i
&& ( *tmp
== L
'0' || *tmp
== L
'.' ))
1071 do_string(std::string
& f
, const char* s
, int len
, int field_width
, int precision
, int flags
)
1084 while ((unsigned int)len
< (unsigned int)precision
&& s
[len
])
1089 if ((unsigned int)len
> (unsigned int)precision
)
1093 if (!(flags
& LEFT
))
1094 while (len
< field_width
--)
1099 for (i
= 0; i
< len
; ++i
)
1104 while (len
< field_width
--)
1113 do_wstring(std::wstring
& f
, const wchar_t* s
, int len
, int field_width
, int precision
, int flags
)
1126 while ((unsigned int)len
< (unsigned int)precision
&& s
[len
])
1131 if ((unsigned int)len
> (unsigned int)precision
)
1135 if (!(flags
& LEFT
))
1136 while (len
< field_width
--)
1141 for (i
= 0; i
< len
; ++i
)
1146 while (len
< field_width
--)
1155 stringw(std::string
& f
, const wchar_t* sw
, int len
, int field_width
, int precision
, int flags
)
1168 while ((unsigned int)len
< (unsigned int)precision
&& sw
[len
])
1173 if ((unsigned int)len
> (unsigned int)precision
)
1177 if (!(flags
& LEFT
))
1178 while (len
< field_width
--)
1183 for (i
= 0; i
< len
; ++i
)
1185 #define MY_MB_CUR_MAX 1
1186 char mb
[MY_MB_CUR_MAX
];
1188 mbcount
= wctomb(mb
, *sw
++);
1193 for (j
= 0; j
< mbcount
; j
++)
1199 while (len
< field_width
--)
1208 wstringa(std::wstring
& f
, const char* sa
, int len
, int field_width
, int precision
, int flags
)
1221 while ((unsigned int)len
< (unsigned int)precision
&& sa
[len
])
1226 if ((unsigned int)len
> (unsigned int)precision
)
1230 if (!(flags
& LEFT
))
1231 while (len
< field_width
--)
1236 for (i
= 0; i
< len
;)
1240 mbcount
= mbtowc(&w
, sa
, len
-i
);
1247 while (len
< field_width
--)
1255 #define _isnanl _isnan
1256 #define _finitel _finite
1259 ssvprintf ( const char *fmt
, va_list args
)
1263 long double _ldouble
;
1270 int flags
; /* flags to number() */
1272 int field_width
; /* width of output field */
1273 int precision
; /* min. # of digits for integers; max
1274 number of chars for from string */
1275 int qualifier
= 0; /* 'h', 'l', 'L' or 'I64' for integer fields */
1277 for (; *fmt
; ++fmt
)
1288 ++fmt
; /* this also skips first '%' */
1290 case '-': flags
|= LEFT
; goto repeat
;
1291 case '+': flags
|= PLUS
; goto repeat
;
1292 case ' ': flags
|= SPACE
; goto repeat
;
1293 case '#': flags
|= SPECIAL
; goto repeat
;
1294 case '0': flags
|= ZEROPAD
; goto repeat
;
1297 /* get field width */
1300 field_width
= skip_atoi(&fmt
);
1301 else if (*fmt
== '*') {
1303 /* it's the next argument */
1304 field_width
= va_arg(args
, int);
1305 if (field_width
< 0) {
1306 field_width
= -field_width
;
1311 /* get the precision */
1316 precision
= skip_atoi(&fmt
);
1317 else if (*fmt
== '*') {
1319 /* it's the next argument */
1320 precision
= va_arg(args
, int);
1326 /* get the conversion qualifier */
1328 // %Z can be just stand alone or as size_t qualifier
1329 if ( *fmt
== 'Z' ) {
1331 switch ( *(fmt
+1)) {
1344 } else if (*fmt
== 'h' || *fmt
== 'l' || *fmt
== 'L' || *fmt
== 'w') {
1347 } else if (*fmt
== 'I' && *(fmt
+1) == '6' && *(fmt
+2) == '4') {
1352 // go fine with ll instead of L
1353 if ( *fmt
== 'l' ) {
1363 if (!(flags
& LEFT
))
1364 while (--field_width
> 0)
1368 if (qualifier
== 'l' || qualifier
== 'w')
1370 f
+= (char)(unsigned char)(wchar_t) va_arg(args
,int);
1374 f
+= (char)(unsigned char) va_arg(args
,int);
1376 while (--field_width
> 0)
1383 if (!(flags
& LEFT
))
1384 while (--field_width
> 0)
1388 if (qualifier
== 'h')
1390 f
+= (char)(unsigned char) va_arg(args
,int);
1394 f
+= (char)(unsigned char)(wchar_t) va_arg(args
,int);
1396 while (--field_width
> 0)
1403 if (qualifier
== 'l' || qualifier
== 'w') {
1404 /* print unicode string */
1405 sw
= va_arg(args
, wchar_t *);
1406 result
= stringw(f
, sw
, -1, field_width
, precision
, flags
);
1408 /* print ascii string */
1409 s
= va_arg(args
, char *);
1410 result
= do_string(f
, s
, -1, field_width
, precision
, flags
);
1414 assert(!"TODO FIXME handle error better");
1420 if (qualifier
== 'h') {
1421 /* print ascii string */
1422 s
= va_arg(args
, char *);
1423 result
= do_string(f
, s
, -1, field_width
, precision
, flags
);
1425 /* print unicode string */
1426 sw
= va_arg(args
, wchar_t *);
1427 result
= stringw(f
, sw
, -1, field_width
, precision
, flags
);
1431 assert(!"TODO FIXME handle error better");
1437 if (qualifier == 'w') {
1438 // print counted unicode string
1439 PUNICODE_STRING pus = va_arg(args, PUNICODE_STRING);
1440 if ((pus == NULL) || (pus->Buffer == NULL)) {
1445 len = pus->Length / sizeof(WCHAR);
1447 result = stringw(f, sw, len, field_width, precision, flags);
1449 // print counted ascii string
1450 PANSI_STRING pas = va_arg(args, PANSI_STRING);
1451 if ((pas == NULL) || (pas->Buffer == NULL)) {
1458 result = string(f, s, -1, field_width, precision, flags);
1469 if (qualifier
== 'l' || qualifier
== 'L' ) {
1470 _ldouble
= va_arg(args
, long double);
1472 if ( _isnanl(_ldouble
) )
1476 else if ( !_finitel(_ldouble
) )
1483 if ( precision
== -1 )
1485 result
= numberfl(f
,_ldouble
,*fmt
,field_width
,precision
,flags
);
1488 assert(!"TODO FIXME handle error better");
1493 _double
= (double)va_arg(args
, double);
1495 if ( _isnan(_double
) )
1499 else if ( !_finite(_double
) )
1508 if ( precision
== -1 )
1510 result
= numberf(f
,_double
,*fmt
,field_width
,precision
,flags
);
1513 assert(!"TODO FIXME handle error better");
1521 if (field_width
== -1) {
1522 field_width
= 2*sizeof(void *);
1526 (unsigned long) va_arg(args
, void *), 16,
1527 field_width
, precision
, flags
);
1530 assert(!"TODO FIXME handle error better");
1536 if (qualifier
== 'l') {
1537 long * ip
= va_arg(args
, long *);
1540 int * ip
= va_arg(args
, int *);
1545 /* integer number formats - set up the flags and "break" */
1580 if (qualifier
== 'I')
1581 num
= va_arg(args
, ULONGLONG
);
1582 else if (qualifier
== 'l') {
1584 num
= va_arg(args
, long);
1586 num
= va_arg(args
, unsigned long);
1588 else if (qualifier
== 'h') {
1590 num
= va_arg(args
, int);
1592 num
= va_arg(args
, unsigned int);
1594 else if (flags
& SIGN
)
1595 num
= va_arg(args
, int);
1597 num
= va_arg(args
, unsigned int);
1598 result
= number(f
, num
, base
, field_width
, precision
, flags
);
1601 assert(!"TODO FIXME handle error better");
1610 sswvprintf ( const wchar_t* fmt
, va_list args
)
1614 long double _ldouble
;
1621 int flags
; /* flags to number() */
1623 int field_width
; /* width of output field */
1624 int precision
; /* min. # of digits for integers; max
1625 number of chars for from string */
1626 int qualifier
= 0; /* 'h', 'l', 'L' or 'I64' for integer fields */
1628 for (; *fmt
; ++fmt
)
1639 ++fmt
; /* this also skips first '%' */
1641 case L
'-': flags
|= LEFT
; goto repeat
;
1642 case L
'+': flags
|= PLUS
; goto repeat
;
1643 case L
' ': flags
|= SPACE
; goto repeat
;
1644 case L
'#': flags
|= SPECIAL
; goto repeat
;
1645 case L
'0': flags
|= ZEROPAD
; goto repeat
;
1648 /* get field width */
1651 field_width
= skip_wtoi(&fmt
);
1652 else if (*fmt
== L
'*') {
1654 /* it's the next argument */
1655 field_width
= va_arg(args
, int);
1656 if (field_width
< 0) {
1657 field_width
= -field_width
;
1662 /* get the precision */
1667 precision
= skip_wtoi(&fmt
);
1668 else if (*fmt
== L
'*') {
1670 /* it's the next argument */
1671 precision
= va_arg(args
, int);
1677 /* get the conversion qualifier */
1679 // %Z can be just stand alone or as size_t qualifier
1680 if ( *fmt
== L
'Z' ) {
1682 switch ( *(fmt
+1)) {
1695 } else if (*fmt
== L
'h' || *fmt
== L
'l' || *fmt
== L
'L' || *fmt
== L
'w') {
1698 } else if (*fmt
== L
'I' && *(fmt
+1) == L
'6' && *(fmt
+2) == L
'4') {
1703 // go fine with ll instead of L
1704 if ( *fmt
== L
'l' ) {
1714 if (!(flags
& LEFT
))
1715 while (--field_width
> 0)
1719 if ( qualifier
== L
'h' )
1721 f
+= (wchar_t)(char)(unsigned char) va_arg(args
,int);
1725 f
+= (wchar_t) va_arg(args
,int);
1727 while (--field_width
> 0)
1734 if (!(flags
& LEFT
))
1735 while (--field_width
> 0)
1739 if (qualifier
== L
'l' || qualifier
== L
'w')
1741 f
+= (wchar_t) va_arg(args
,int);
1745 f
+= (wchar_t)(char)(unsigned char) va_arg(args
,int);
1747 while (--field_width
> 0)
1754 if (qualifier
== L
'h') {
1755 /* print ascii string */
1756 sa
= va_arg(args
, char *);
1757 result
= wstringa(f
, sa
, -1, field_width
, precision
, flags
);
1759 /* print unicode string */
1760 s
= va_arg(args
, wchar_t *);
1761 result
= do_wstring(f
, s
, -1, field_width
, precision
, flags
);
1765 assert(!"TODO FIXME handle error better");
1771 if (qualifier
== L
'l' || qualifier
== L
'w') {
1772 /* print unicode string */
1773 s
= va_arg(args
, wchar_t *);
1774 result
= do_wstring(f
, s
, -1, field_width
, precision
, flags
);
1776 /* print ascii string */
1777 sa
= va_arg(args
, char *);
1778 result
= wstringa(f
, sa
, -1, field_width
, precision
, flags
);
1782 assert(!"TODO FIXME handle error better");
1792 if (qualifier
== L
'l' || qualifier
== L
'L' )
1794 _ldouble
= va_arg(args
, long double);
1796 if ( _isnanl(_ldouble
) )
1800 else if ( !_finitel(_ldouble
) )
1807 if ( precision
== -1 )
1809 result
= wnumberfl(f
,_ldouble
,*fmt
,field_width
,precision
,flags
);
1812 assert(!"TODO FIXME handle error better");
1817 _double
= (double)va_arg(args
, double);
1819 if ( _isnan(_double
) )
1823 else if ( !_finite(_double
) )
1832 if ( precision
== -1 )
1834 result
= wnumberf(f
,_double
,*fmt
,field_width
,precision
,flags
);
1837 assert(!"TODO FIXME handle error better");
1845 if (field_width
== -1) {
1846 field_width
= 2*sizeof(void *);
1850 (unsigned long) va_arg(args
, void *), 16,
1851 field_width
, precision
, flags
);
1854 assert(!"TODO FIXME handle error better");
1860 if (qualifier
== L
'l') {
1861 long * ip
= va_arg(args
, long *);
1864 int * ip
= va_arg(args
, int *);
1869 /* integer number formats - set up the flags and "break" */
1904 if (qualifier
== L
'I')
1905 num
= va_arg(args
, ULONGLONG
);
1906 else if (qualifier
== L
'l') {
1908 num
= va_arg(args
, long);
1910 num
= va_arg(args
, unsigned long);
1912 else if (qualifier
== L
'h') {
1914 num
= va_arg(args
, int);
1916 num
= va_arg(args
, unsigned int);
1918 else if (flags
& SIGN
)
1919 num
= va_arg(args
, int);
1921 num
= va_arg(args
, unsigned int);
1922 result
= wnumber(f
, num
, base
, field_width
, precision
, flags
);
1925 assert(!"TODO FIXME handle error better");