12 #define alloca _alloca
16 typedef __int64 LONGLONG
;
17 typedef unsigned __int64 ULONGLONG
;
19 typedef long long LONGLONG
;
20 typedef unsigned long long ULONGLONG
;
24 unsigned int mantissa
:23;
25 unsigned int exponent
:8;
30 unsigned int mantissal
:32;
31 unsigned int mantissah
:20;
32 unsigned int exponent
:11;
37 unsigned int mantissal
:32;
38 unsigned int mantissah
:32;
39 unsigned int exponent
:15;
41 unsigned int empty
:16;
45 ssprintf ( const char* fmt
, ... )
49 std::string f
= ssvprintf ( fmt
, arg
);
55 sswprintf ( const wchar_t* fmt
, ... )
59 std::wstring f
= sswvprintf ( fmt
, arg
);
64 #define ZEROPAD 1 /* pad with zero */
65 #define SIGN 2 /* unsigned/signed long */
66 #define PLUS 4 /* show plus */
67 #define SPACE 8 /* space if plus */
68 #define LEFT 16 /* left justified */
69 #define SPECIAL 32 /* 0x */
70 #define LARGE 64 /* use 'ABCDEF' instead of 'abcdef' */
71 #define ZEROTRUNC 128 /* truncate zero 's */
75 skip_atoi(const char **s
)
80 i
= i
*10 + *((*s
)++) - '0';
85 skip_wtoi(const wchar_t **s
)
90 i
= i
*10 + *((*s
)++) - L
'0';
96 do_div(LONGLONG
*n
,int base
)
98 int __res
= ((ULONGLONG
) *n
) % (unsigned) base
;
99 *n
= ((ULONGLONG
) *n
) / (unsigned) base
;
105 number(std::string
& f
, LONGLONG num
, int base
, int size
, int precision
,int type
)
108 const char *digits
="0123456789abcdefghijklmnopqrstuvwxyz";
112 digits
= "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
115 if (base
< 2 || base
> 36)
117 c
= (type
& ZEROPAD
) ? '0' : ' ';
124 } else if (type
& PLUS
) {
127 } else if (type
& SPACE
) {
132 if (type
& SPECIAL
) {
141 else while (num
!= 0)
142 tmp
[i
++] = digits
[do_div(&num
,base
)];
146 if (!(type
&(ZEROPAD
+LEFT
)))
166 while (i
< precision
--)
182 wnumber(std::wstring
& f
, LONGLONG num
, int base
, int size
, int precision
,int type
)
184 wchar_t c
,sign
,tmp
[66];
185 const wchar_t *digits
= L
"0123456789abcdefghijklmnopqrstuvwxyz";
189 digits
= L
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
192 if (base
< 2 || base
> 36)
194 c
= (type
& ZEROPAD
) ? L
'0' : L
' ';
201 } else if (type
& PLUS
) {
204 } else if (type
& SPACE
) {
209 if (type
& SPECIAL
) {
218 else while (num
!= 0)
219 tmp
[i
++] = digits
[do_div(&num
,base
)];
223 if (!(type
&(ZEROPAD
+LEFT
)))
243 while (i
< precision
--)
260 numberf(std::string
& f
, double __n
, char exp_sign
, int size
, int precision
, int type
)
262 double exponent
= 0.0;
287 if ( exp_sign
== 'g' || exp_sign
== 'G' || exp_sign
== 'e' || exp_sign
== 'E' ) {
288 ie
= ((unsigned int)n
.n
->exponent
- (unsigned int)0x3ff);
289 exponent
= ie
/3.321928;
292 if ( exp_sign
== 'g' || exp_sign
== 'G' ) {
294 if ( exponent
< -4 || fabs(exponent
) >= precision
)
295 exp_sign
-= 2; // g -> e and G -> E
298 if ( exp_sign
== 'e' || exp_sign
== 'E' ) {
299 frac
= modf(exponent
,&e
);
302 else if ( frac
< -0.5 )
305 result
= numberf(f
,__n
/pow(10.0L,e
),'f',size
-4, precision
, type
);
315 result
= number(f
,ie
, 10,2, 2,type
);
321 if ( exp_sign
== 'f' ) {
322 buf
= (char*)alloca(4096);
327 c
= (type
& ZEROPAD
) ? '0' : ' ';
334 } else if (type
& PLUS
) {
337 } else if (type
& SPACE
) {
343 frac
= modf(__n
,&intr
);
345 // # flags forces a . and prevents trucation of trailing zero's
347 if ( precision
> 0 ) {
348 //frac = modfl(__n,&intr);
352 frac
= modf(frac
, &p
);
353 buf
[i
] = (int)p
+ '0';
364 if ( precision
>= 1 || type
& SPECIAL
) {
375 while ( intr
> 0.0 ) {
382 buf
[i
++] = (int)p
+ '0';
388 while ( j
< i
&& ro
== 1) {
389 if ( buf
[j
] >= '0' && buf
[j
] <= '8' ) {
393 else if ( buf
[j
] == '9' ) {
404 if (!(type
&(ZEROPAD
+LEFT
)))
414 if (!(type
&(ZEROPAD
+LEFT
)))
419 if (type
& SPECIAL
) {
429 if ( type
& ZEROTRUNC
&& ((type
& SPECIAL
) != SPECIAL
) )
432 while ( j
< i
&& ( *tmp
== '0' || *tmp
== '.' ))
439 // while (i < precision--)
454 wnumberf(std::wstring
& f
, double __n
, wchar_t exp_sign
, int size
, int precision
, int type
)
456 double exponent
= 0.0;
465 wchar_t *buf
, *tmp
, sign
, c
, ro
= 0;
476 if ( exp_sign
== L
'g' || exp_sign
== L
'G' || exp_sign
== L
'e' || exp_sign
== L
'E' ) {
477 ie
= ((unsigned int)n
.n
->exponent
- (unsigned int)0x3ff);
478 exponent
= ie
/3.321928;
481 if ( exp_sign
== L
'g' || exp_sign
== L
'G' )
484 if ( exponent
< -4 || fabs(exponent
) >= precision
)
485 exp_sign
-= 2; // g -> e and G -> E
488 if ( exp_sign
== L
'e' || exp_sign
== L
'E' )
490 frac
= modf(exponent
,&e
);
493 else if ( frac
< -0.5 )
496 result
= wnumberf(f
,__n
/pow(10.0L,e
),L
'f',size
-4, precision
, type
);
506 result
= wnumber(f
,ie
, 10,2, 2,type
);
512 if ( exp_sign
== L
'f' )
514 buf
= (wchar_t*)alloca(4096*sizeof(wchar_t));
518 c
= (type
& ZEROPAD
) ? L
'0' : L
' ';
528 else if (type
& PLUS
)
533 else if (type
& SPACE
)
540 frac
= modf(__n
,&intr
);
542 // # flags forces a . and prevents trucation of trailing zero's
544 if ( precision
> 0 ) {
545 //frac = modfl(__n,&intr);
549 frac
= modf(frac
, &p
);
550 buf
[i
] = (int)p
+ L
'0';
561 if ( precision
>= 1 || type
& SPECIAL
) {
572 while ( intr
> 0.0 ) {
579 buf
[i
++] = (int)p
+ L
'0';
585 while ( j
< i
&& ro
== 1) {
586 if ( buf
[j
] >= L
'0' && buf
[j
] <= L
'8' ) {
590 else if ( buf
[j
] == L
'9' ) {
601 if (!(type
&(ZEROPAD
+LEFT
)))
611 if (!(type
&(ZEROPAD
+LEFT
)))
616 if (type
& SPECIAL
) {
626 if ( type
& ZEROTRUNC
&& ((type
& SPECIAL
) != SPECIAL
) )
629 while ( j
< i
&& ( *tmp
== L
'0' || *tmp
== L
'.' ))
648 numberfl(std::string
& f
, long double __n
, char exp_sign
, int size
, int precision
, int type
)
650 long double exponent
= 0.0;
660 long double frac
, intr
;
671 ieee_long_double_t
* n
;
676 if ( exp_sign
== 'g' || exp_sign
== 'G' || exp_sign
== 'e' || exp_sign
== 'E' ) {
677 ie
= ((unsigned int)n
.n
->exponent
- (unsigned int)0x3fff);
678 exponent
= ie
/3.321928;
681 if ( exp_sign
== 'g' || exp_sign
== 'G' ) {
683 if ( exponent
< -4 || fabs(exponent
) >= precision
)
684 exp_sign
-= 2; // g -> e and G -> E
687 if ( exp_sign
== 'e' || exp_sign
== 'E' ) {
688 frac
= modfl(exponent
,&e
);
691 else if ( frac
< -0.5 )
694 result
= numberf(f
,__n
/powl(10.0L,e
),'f',size
-4, precision
, type
);
704 result
= number(f
,ie
, 10,2, 2,type
);
710 if ( exp_sign
== 'f' )
713 buf
= (char*)alloca(4096);
719 c
= (type
& ZEROPAD
) ? '0' : ' ';
728 } else if (type
& PLUS
)
732 } else if (type
& SPACE
)
739 frac
= modfl(__n
,&intr
);
741 // # flags forces a . and prevents trucation of trailing zero's
744 //frac = modfl(__n,&intr);
750 frac
= modfl((long double)frac
, &p
);
751 buf
[i
] = (int)p
+ '0';
763 if ( precision
>= 1 || type
& SPECIAL
)
785 buf
[i
++] = (int)p
+ '0';
791 while ( j
< i
&& ro
== 1) {
792 if ( buf
[j
] >= '0' && buf
[j
] <= '8' )
797 else if ( buf
[j
] == '9' )
809 if (!(type
&(ZEROPAD
+LEFT
)))
819 if (!(type
&(ZEROPAD
+LEFT
)))
824 if (type
& SPECIAL
) {
833 if ( type
& ZEROTRUNC
&& ((type
& SPECIAL
) != SPECIAL
) )
836 while ( j
< i
&& ( *tmp
== '0' || *tmp
== '.' ))
855 wnumberfl(std::wstring
& f
, long double __n
, wchar_t exp_sign
, int size
, int precision
, int type
)
857 long double exponent
= 0.0;
861 wchar_t *buf
, *tmp
, sign
, c
, ro
= 0;
865 long double frac
, intr
;
873 ieee_long_double_t
* n
;
878 if ( exp_sign
== L
'g' || exp_sign
== L
'G' || exp_sign
== L
'e' || exp_sign
== L
'E' ) {
879 ie
= ((unsigned int)n
.n
->exponent
- (unsigned int)0x3fff);
880 exponent
= ie
/3.321928;
883 if ( exp_sign
== L
'g' || exp_sign
== L
'G' ) {
885 if ( exponent
< -4 || fabs(exponent
) >= precision
)
886 exp_sign
-= 2; // g -> e and G -> E
889 if ( exp_sign
== L
'e' || exp_sign
== L
'E' ) {
890 frac
= modfl(exponent
,&e
);
893 else if ( frac
< -0.5 )
896 result
= wnumberf(f
,__n
/powl(10.0L,e
),L
'f',size
-4, precision
, type
);
906 result
= wnumber(f
,ie
, 10,2, 2,type
);
912 if ( exp_sign
== L
'f' )
915 buf
= (wchar_t*)alloca(4096*sizeof(wchar_t));
921 c
= (type
& ZEROPAD
) ? L
'0' : L
' ';
930 } else if (type
& PLUS
)
934 } else if (type
& SPACE
)
941 frac
= modfl(__n
,&intr
);
943 // # flags forces a . and prevents trucation of trailing zero's
946 //frac = modfl(__n,&intr);
952 frac
= modfl((long double)frac
, &p
);
953 buf
[i
] = (int)p
+ L
'0';
965 if ( precision
>= 1 || type
& SPECIAL
)
987 buf
[i
++] = (int)p
+ L
'0';
993 while ( j
< i
&& ro
== 1) {
994 if ( buf
[j
] >= L
'0' && buf
[j
] <= L
'8' )
999 else if ( buf
[j
] == L
'9' )
1011 if (!(type
&(ZEROPAD
+LEFT
)))
1021 if (!(type
&(ZEROPAD
+LEFT
)))
1026 if (type
& SPECIAL
) {
1035 if ( type
& ZEROTRUNC
&& ((type
& SPECIAL
) != SPECIAL
) )
1038 while ( j
< i
&& ( *tmp
== L
'0' || *tmp
== L
'.' ))
1057 do_string(std::string
& f
, const char* s
, int len
, int field_width
, int precision
, int flags
)
1070 while ((unsigned int)len
< (unsigned int)precision
&& s
[len
])
1075 if ((unsigned int)len
> (unsigned int)precision
)
1079 if (!(flags
& LEFT
))
1080 while (len
< field_width
--)
1085 for (i
= 0; i
< len
; ++i
)
1090 while (len
< field_width
--)
1099 do_wstring(std::wstring
& f
, const wchar_t* s
, int len
, int field_width
, int precision
, int flags
)
1112 while ((unsigned int)len
< (unsigned int)precision
&& s
[len
])
1117 if ((unsigned int)len
> (unsigned int)precision
)
1121 if (!(flags
& LEFT
))
1122 while (len
< field_width
--)
1127 for (i
= 0; i
< len
; ++i
)
1132 while (len
< field_width
--)
1141 stringw(std::string
& f
, const wchar_t* sw
, int len
, int field_width
, int precision
, int flags
)
1154 while ((unsigned int)len
< (unsigned int)precision
&& sw
[len
])
1159 if ((unsigned int)len
> (unsigned int)precision
)
1163 if (!(flags
& LEFT
))
1164 while (len
< field_width
--)
1169 for (i
= 0; i
< len
; ++i
)
1171 #define MY_MB_CUR_MAX 1
1172 char mb
[MY_MB_CUR_MAX
];
1174 mbcount
= wctomb(mb
, *sw
++);
1179 for (j
= 0; j
< mbcount
; j
++)
1185 while (len
< field_width
--)
1194 wstringa(std::wstring
& f
, const char* sa
, int len
, int field_width
, int precision
, int flags
)
1207 while ((unsigned int)len
< (unsigned int)precision
&& sa
[len
])
1212 if ((unsigned int)len
> (unsigned int)precision
)
1216 if (!(flags
& LEFT
))
1217 while (len
< field_width
--)
1222 for (i
= 0; i
< len
;)
1226 mbcount
= mbtowc(&w
, sa
, len
-i
);
1233 while (len
< field_width
--)
1241 #define _isnanl _isnan
1242 #define _finitel _finite
1245 ssvprintf ( const char *fmt
, va_list args
)
1249 long double _ldouble
;
1256 int flags
; /* flags to number() */
1258 int field_width
; /* width of output field */
1259 int precision
; /* min. # of digits for integers; max
1260 number of chars for from string */
1261 int qualifier
= 0; /* 'h', 'l', 'L' or 'I64' for integer fields */
1263 for (; *fmt
; ++fmt
)
1274 ++fmt
; /* this also skips first '%' */
1276 case '-': flags
|= LEFT
; goto repeat
;
1277 case '+': flags
|= PLUS
; goto repeat
;
1278 case ' ': flags
|= SPACE
; goto repeat
;
1279 case '#': flags
|= SPECIAL
; goto repeat
;
1280 case '0': flags
|= ZEROPAD
; goto repeat
;
1283 /* get field width */
1286 field_width
= skip_atoi(&fmt
);
1287 else if (*fmt
== '*') {
1289 /* it's the next argument */
1290 field_width
= va_arg(args
, int);
1291 if (field_width
< 0) {
1292 field_width
= -field_width
;
1297 /* get the precision */
1302 precision
= skip_atoi(&fmt
);
1303 else if (*fmt
== '*') {
1305 /* it's the next argument */
1306 precision
= va_arg(args
, int);
1312 /* get the conversion qualifier */
1314 // %Z can be just stand alone or as size_t qualifier
1315 if ( *fmt
== 'Z' ) {
1317 switch ( *(fmt
+1)) {
1330 } else if (*fmt
== 'h' || *fmt
== 'l' || *fmt
== 'L' || *fmt
== 'w') {
1333 } else if (*fmt
== 'I' && *(fmt
+1) == '6' && *(fmt
+2) == '4') {
1338 // go fine with ll instead of L
1339 if ( *fmt
== 'l' ) {
1349 if (!(flags
& LEFT
))
1350 while (--field_width
> 0)
1354 if (qualifier
== 'l' || qualifier
== 'w')
1356 f
+= (char)(unsigned char)(wchar_t) va_arg(args
,int);
1360 f
+= (char)(unsigned char) va_arg(args
,int);
1362 while (--field_width
> 0)
1369 if (!(flags
& LEFT
))
1370 while (--field_width
> 0)
1374 if (qualifier
== 'h')
1376 f
+= (char)(unsigned char) va_arg(args
,int);
1380 f
+= (char)(unsigned char)(wchar_t) va_arg(args
,int);
1382 while (--field_width
> 0)
1389 if (qualifier
== 'l' || qualifier
== 'w') {
1390 /* print unicode string */
1391 sw
= va_arg(args
, wchar_t *);
1392 result
= stringw(f
, sw
, -1, field_width
, precision
, flags
);
1394 /* print ascii string */
1395 s
= va_arg(args
, char *);
1396 result
= do_string(f
, s
, -1, field_width
, precision
, flags
);
1400 assert(!"TODO FIXME handle error better");
1406 if (qualifier
== 'h') {
1407 /* print ascii string */
1408 s
= va_arg(args
, char *);
1409 result
= do_string(f
, s
, -1, field_width
, precision
, flags
);
1411 /* print unicode string */
1412 sw
= va_arg(args
, wchar_t *);
1413 result
= stringw(f
, sw
, -1, field_width
, precision
, flags
);
1417 assert(!"TODO FIXME handle error better");
1423 if (qualifier == 'w') {
1424 // print counted unicode string
1425 PUNICODE_STRING pus = va_arg(args, PUNICODE_STRING);
1426 if ((pus == NULL) || (pus->Buffer == NULL)) {
1431 len = pus->Length / sizeof(WCHAR);
1433 result = stringw(f, sw, len, field_width, precision, flags);
1435 // print counted ascii string
1436 PANSI_STRING pas = va_arg(args, PANSI_STRING);
1437 if ((pas == NULL) || (pas->Buffer == NULL)) {
1444 result = string(f, s, -1, field_width, precision, flags);
1455 if (qualifier
== 'l' || qualifier
== 'L' ) {
1456 _ldouble
= va_arg(args
, long double);
1458 if ( _isnanl(_ldouble
) )
1462 else if ( !_finitel(_ldouble
) )
1469 if ( precision
== -1 )
1471 result
= numberfl(f
,_ldouble
,*fmt
,field_width
,precision
,flags
);
1474 assert(!"TODO FIXME handle error better");
1479 _double
= (double)va_arg(args
, double);
1481 if ( _isnan(_double
) )
1485 else if ( !_finite(_double
) )
1494 if ( precision
== -1 )
1496 result
= numberf(f
,_double
,*fmt
,field_width
,precision
,flags
);
1499 assert(!"TODO FIXME handle error better");
1507 if (field_width
== -1) {
1508 field_width
= 2*sizeof(void *);
1512 (unsigned long) va_arg(args
, void *), 16,
1513 field_width
, precision
, flags
);
1516 assert(!"TODO FIXME handle error better");
1522 if (qualifier
== 'l') {
1523 long * ip
= va_arg(args
, long *);
1526 int * ip
= va_arg(args
, int *);
1531 /* integer number formats - set up the flags and "break" */
1566 if (qualifier
== 'I')
1567 num
= va_arg(args
, ULONGLONG
);
1568 else if (qualifier
== 'l') {
1570 num
= va_arg(args
, long);
1572 num
= va_arg(args
, unsigned long);
1574 else if (qualifier
== 'h') {
1576 num
= va_arg(args
, int);
1578 num
= va_arg(args
, unsigned int);
1580 else if (flags
& SIGN
)
1581 num
= va_arg(args
, int);
1583 num
= va_arg(args
, unsigned int);
1584 result
= number(f
, num
, base
, field_width
, precision
, flags
);
1587 assert(!"TODO FIXME handle error better");
1596 sswvprintf ( const wchar_t* fmt
, va_list args
)
1600 long double _ldouble
;
1607 int flags
; /* flags to number() */
1609 int field_width
; /* width of output field */
1610 int precision
; /* min. # of digits for integers; max
1611 number of chars for from string */
1612 int qualifier
= 0; /* 'h', 'l', 'L' or 'I64' for integer fields */
1614 for (; *fmt
; ++fmt
)
1625 ++fmt
; /* this also skips first '%' */
1627 case L
'-': flags
|= LEFT
; goto repeat
;
1628 case L
'+': flags
|= PLUS
; goto repeat
;
1629 case L
' ': flags
|= SPACE
; goto repeat
;
1630 case L
'#': flags
|= SPECIAL
; goto repeat
;
1631 case L
'0': flags
|= ZEROPAD
; goto repeat
;
1634 /* get field width */
1637 field_width
= skip_wtoi(&fmt
);
1638 else if (*fmt
== L
'*') {
1640 /* it's the next argument */
1641 field_width
= va_arg(args
, int);
1642 if (field_width
< 0) {
1643 field_width
= -field_width
;
1648 /* get the precision */
1653 precision
= skip_wtoi(&fmt
);
1654 else if (*fmt
== L
'*') {
1656 /* it's the next argument */
1657 precision
= va_arg(args
, int);
1663 /* get the conversion qualifier */
1665 // %Z can be just stand alone or as size_t qualifier
1666 if ( *fmt
== L
'Z' ) {
1668 switch ( *(fmt
+1)) {
1681 } else if (*fmt
== L
'h' || *fmt
== L
'l' || *fmt
== L
'L' || *fmt
== L
'w') {
1684 } else if (*fmt
== L
'I' && *(fmt
+1) == L
'6' && *(fmt
+2) == L
'4') {
1689 // go fine with ll instead of L
1690 if ( *fmt
== L
'l' ) {
1700 if (!(flags
& LEFT
))
1701 while (--field_width
> 0)
1705 if ( qualifier
== L
'h' )
1707 f
+= (wchar_t)(char)(unsigned char) va_arg(args
,int);
1711 f
+= (wchar_t) va_arg(args
,int);
1713 while (--field_width
> 0)
1720 if (!(flags
& LEFT
))
1721 while (--field_width
> 0)
1725 if (qualifier
== L
'l' || qualifier
== L
'w')
1727 f
+= (wchar_t) va_arg(args
,int);
1731 f
+= (wchar_t)(char)(unsigned char) va_arg(args
,int);
1733 while (--field_width
> 0)
1740 if (qualifier
== L
'h') {
1741 /* print ascii string */
1742 sa
= va_arg(args
, char *);
1743 result
= wstringa(f
, sa
, -1, field_width
, precision
, flags
);
1745 /* print unicode string */
1746 s
= va_arg(args
, wchar_t *);
1747 result
= do_wstring(f
, s
, -1, field_width
, precision
, flags
);
1751 assert(!"TODO FIXME handle error better");
1757 if (qualifier
== L
'l' || qualifier
== L
'w') {
1758 /* print unicode string */
1759 s
= va_arg(args
, wchar_t *);
1760 result
= do_wstring(f
, s
, -1, field_width
, precision
, flags
);
1762 /* print ascii string */
1763 sa
= va_arg(args
, char *);
1764 result
= wstringa(f
, sa
, -1, field_width
, precision
, flags
);
1768 assert(!"TODO FIXME handle error better");
1778 if (qualifier
== L
'l' || qualifier
== L
'L' )
1780 _ldouble
= va_arg(args
, long double);
1782 if ( _isnanl(_ldouble
) )
1786 else if ( !_finitel(_ldouble
) )
1793 if ( precision
== -1 )
1795 result
= wnumberfl(f
,_ldouble
,*fmt
,field_width
,precision
,flags
);
1798 assert(!"TODO FIXME handle error better");
1803 _double
= (double)va_arg(args
, double);
1805 if ( _isnan(_double
) )
1809 else if ( !_finite(_double
) )
1818 if ( precision
== -1 )
1820 result
= wnumberf(f
,_double
,*fmt
,field_width
,precision
,flags
);
1823 assert(!"TODO FIXME handle error better");
1831 if (field_width
== -1) {
1832 field_width
= 2*sizeof(void *);
1836 (unsigned long) va_arg(args
, void *), 16,
1837 field_width
, precision
, flags
);
1840 assert(!"TODO FIXME handle error better");
1846 if (qualifier
== L
'l') {
1847 long * ip
= va_arg(args
, long *);
1850 int * ip
= va_arg(args
, int *);
1855 /* integer number formats - set up the flags and "break" */
1890 if (qualifier
== L
'I')
1891 num
= va_arg(args
, ULONGLONG
);
1892 else if (qualifier
== L
'l') {
1894 num
= va_arg(args
, long);
1896 num
= va_arg(args
, unsigned long);
1898 else if (qualifier
== L
'h') {
1900 num
= va_arg(args
, int);
1902 num
= va_arg(args
, unsigned int);
1904 else if (flags
& SIGN
)
1905 num
= va_arg(args
, int);
1907 num
= va_arg(args
, unsigned int);
1908 result
= wnumber(f
, num
, base
, field_width
, precision
, flags
);
1911 assert(!"TODO FIXME handle error better");