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.
25 #define alloca _alloca
29 typedef __int64 LONGLONG
;
30 typedef unsigned __int64 ULONGLONG
;
32 typedef long long LONGLONG
;
33 typedef unsigned long long ULONGLONG
;
37 unsigned int mantissa
:23;
38 unsigned int exponent
:8;
43 unsigned int mantissal
:32;
44 unsigned int mantissah
:20;
45 unsigned int exponent
:11;
50 unsigned int mantissal
:32;
51 unsigned int mantissah
:32;
52 unsigned int exponent
:15;
54 unsigned int empty
:16;
58 ssprintf ( const char* fmt
, ... )
62 std::string f
= ssvprintf ( fmt
, arg
);
68 sswprintf ( const wchar_t* fmt
, ... )
72 std::wstring f
= sswvprintf ( fmt
, arg
);
77 #define ZEROPAD 1 /* pad with zero */
78 #define SIGN 2 /* unsigned/signed long */
79 #define PLUS 4 /* show plus */
80 #define SPACE 8 /* space if plus */
81 #define LEFT 16 /* left justified */
82 #define SPECIAL 32 /* 0x */
83 #define LARGE 64 /* use 'ABCDEF' instead of 'abcdef' */
84 #define ZEROTRUNC 128 /* truncate zero 's */
88 skip_atoi(const char **s
)
93 i
= i
*10 + *((*s
)++) - '0';
98 skip_wtoi(const wchar_t **s
)
102 while (iswdigit(**s
))
103 i
= i
*10 + *((*s
)++) - L
'0';
109 do_div(LONGLONG
*n
,int base
)
111 int __res
= ((ULONGLONG
) *n
) % (unsigned) base
;
112 *n
= ((ULONGLONG
) *n
) / (unsigned) base
;
118 number(std::string
& f
, LONGLONG num
, int base
, int size
, int precision
,int type
)
121 const char *digits
="0123456789abcdefghijklmnopqrstuvwxyz";
125 digits
= "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
128 if (base
< 2 || base
> 36)
130 c
= (type
& ZEROPAD
) ? '0' : ' ';
137 } else if (type
& PLUS
) {
140 } else if (type
& SPACE
) {
145 if (type
& SPECIAL
) {
154 else while (num
!= 0)
155 tmp
[i
++] = digits
[do_div(&num
,base
)];
159 if (!(type
&(ZEROPAD
+LEFT
)))
179 while (i
< precision
--)
195 wnumber(std::wstring
& f
, LONGLONG num
, int base
, int size
, int precision
,int type
)
197 wchar_t c
,sign
,tmp
[66];
198 const wchar_t *digits
= L
"0123456789abcdefghijklmnopqrstuvwxyz";
202 digits
= L
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
205 if (base
< 2 || base
> 36)
207 c
= (type
& ZEROPAD
) ? L
'0' : L
' ';
214 } else if (type
& PLUS
) {
217 } else if (type
& SPACE
) {
222 if (type
& SPECIAL
) {
231 else while (num
!= 0)
232 tmp
[i
++] = digits
[do_div(&num
,base
)];
236 if (!(type
&(ZEROPAD
+LEFT
)))
256 while (i
< precision
--)
273 numberf(std::string
& f
, double __n
, char exp_sign
, int size
, int precision
, int type
)
275 double exponent
= 0.0;
300 if ( exp_sign
== 'g' || exp_sign
== 'G' || exp_sign
== 'e' || exp_sign
== 'E' ) {
301 ie
= ((unsigned int)n
.n
->exponent
- (unsigned int)0x3ff);
302 exponent
= ie
/3.321928;
305 if ( exp_sign
== 'g' || exp_sign
== 'G' ) {
307 if ( exponent
< -4 || fabs(exponent
) >= precision
)
308 exp_sign
-= 2; // g -> e and G -> E
313 if ( exp_sign
== 'e' || exp_sign
== 'E' ) {
314 frac
= modf(exponent
,&e
);
317 else if ( frac
< -0.5 )
320 result
= numberf(f
,__n
/pow(10.0L,e
),'f',size
-4, precision
, type
);
330 result
= number(f
,ie
, 10,2, 2,type
);
336 if ( exp_sign
== 'f' ) {
337 buf
= (char*)alloca(4096);
342 c
= (type
& ZEROPAD
) ? '0' : ' ';
349 } else if (type
& PLUS
) {
352 } else if (type
& SPACE
) {
358 frac
= modf(__n
,&intr
);
360 // # flags forces a . and prevents trucation of trailing zero's
362 if ( precision
> 0 ) {
363 //frac = modfl(__n,&intr);
367 frac
= modf(frac
, &p
);
368 buf
[i
] = (int)p
+ '0';
379 if ( precision
>= 1 || type
& SPECIAL
) {
390 while ( intr
> 0.0 ) {
397 buf
[i
++] = (int)p
+ '0';
403 while ( j
< i
&& ro
== 1) {
404 if ( buf
[j
] >= '0' && buf
[j
] <= '8' ) {
408 else if ( buf
[j
] == '9' ) {
419 if (!(type
&(ZEROPAD
+LEFT
)))
429 if (!(type
&(ZEROPAD
+LEFT
)))
434 if (type
& SPECIAL
) {
444 if ( type
& ZEROTRUNC
&& ((type
& SPECIAL
) != SPECIAL
) )
447 while ( j
< i
&& ( *tmp
== '0' || *tmp
== '.' ))
454 // while (i < precision--)
469 wnumberf(std::wstring
& f
, double __n
, wchar_t exp_sign
, int size
, int precision
, int type
)
471 double exponent
= 0.0;
480 wchar_t *buf
, *tmp
, sign
, c
, ro
= 0;
491 if ( exp_sign
== L
'g' || exp_sign
== L
'G' || exp_sign
== L
'e' || exp_sign
== L
'E' ) {
492 ie
= ((unsigned int)n
.n
->exponent
- (unsigned int)0x3ff);
493 exponent
= ie
/3.321928;
496 if ( exp_sign
== L
'g' || exp_sign
== L
'G' )
499 if ( exponent
< -4 || fabs(exponent
) >= precision
)
500 exp_sign
-= 2; // g -> e and G -> E
505 if ( exp_sign
== L
'e' || exp_sign
== L
'E' )
507 frac
= modf(exponent
,&e
);
510 else if ( frac
< -0.5 )
513 result
= wnumberf(f
,__n
/pow(10.0L,e
),L
'f',size
-4, precision
, type
);
523 result
= wnumber(f
,ie
, 10,2, 2,type
);
529 if ( exp_sign
== L
'f' )
531 buf
= (wchar_t*)alloca(4096*sizeof(wchar_t));
535 c
= (type
& ZEROPAD
) ? L
'0' : L
' ';
545 else if (type
& PLUS
)
550 else if (type
& SPACE
)
557 frac
= modf(__n
,&intr
);
559 // # flags forces a . and prevents trucation of trailing zero's
561 if ( precision
> 0 ) {
562 //frac = modfl(__n,&intr);
566 frac
= modf(frac
, &p
);
567 buf
[i
] = (int)p
+ L
'0';
578 if ( precision
>= 1 || type
& SPECIAL
) {
589 while ( intr
> 0.0 ) {
596 buf
[i
++] = (int)p
+ L
'0';
602 while ( j
< i
&& ro
== 1) {
603 if ( buf
[j
] >= L
'0' && buf
[j
] <= L
'8' ) {
607 else if ( buf
[j
] == L
'9' ) {
618 if (!(type
&(ZEROPAD
+LEFT
)))
628 if (!(type
&(ZEROPAD
+LEFT
)))
633 if (type
& SPECIAL
) {
643 if ( type
& ZEROTRUNC
&& ((type
& SPECIAL
) != SPECIAL
) )
646 while ( j
< i
&& ( *tmp
== L
'0' || *tmp
== L
'.' ))
665 numberfl(std::string
& f
, long double __n
, char exp_sign
, int size
, int precision
, int type
)
667 long double exponent
= 0.0;
677 long double frac
, intr
;
688 ieee_long_double_t
* n
;
693 if ( exp_sign
== 'g' || exp_sign
== 'G' || exp_sign
== 'e' || exp_sign
== 'E' ) {
694 ie
= ((unsigned int)n
.n
->exponent
- (unsigned int)0x3fff);
695 exponent
= ie
/3.321928;
698 if ( exp_sign
== 'g' || exp_sign
== 'G' ) {
700 if ( exponent
< -4 || fabs(exponent
) >= precision
)
701 exp_sign
-= 2; // g -> e and G -> E
706 if ( exp_sign
== 'e' || exp_sign
== 'E' ) {
707 frac
= modfl(exponent
,&e
);
710 else if ( frac
< -0.5 )
713 result
= numberf(f
,__n
/powl(10.0L,e
),'f',size
-4, precision
, type
);
723 result
= number(f
,ie
, 10,2, 2,type
);
729 if ( exp_sign
== 'f' )
732 buf
= (char*)alloca(4096);
738 c
= (type
& ZEROPAD
) ? '0' : ' ';
747 } else if (type
& PLUS
)
751 } else if (type
& SPACE
)
758 frac
= modfl(__n
,&intr
);
760 // # flags forces a . and prevents trucation of trailing zero's
763 //frac = modfl(__n,&intr);
769 frac
= modfl((long double)frac
, &p
);
770 buf
[i
] = (int)p
+ '0';
782 if ( precision
>= 1 || type
& SPECIAL
)
804 buf
[i
++] = (int)p
+ '0';
810 while ( j
< i
&& ro
== 1) {
811 if ( buf
[j
] >= '0' && buf
[j
] <= '8' )
816 else if ( buf
[j
] == '9' )
828 if (!(type
&(ZEROPAD
+LEFT
)))
838 if (!(type
&(ZEROPAD
+LEFT
)))
843 if (type
& SPECIAL
) {
852 if ( type
& ZEROTRUNC
&& ((type
& SPECIAL
) != SPECIAL
) )
855 while ( j
< i
&& ( *tmp
== '0' || *tmp
== '.' ))
874 wnumberfl(std::wstring
& f
, long double __n
, wchar_t exp_sign
, int size
, int precision
, int type
)
876 long double exponent
= 0.0;
880 wchar_t *buf
, *tmp
, sign
, c
, ro
= 0;
884 long double frac
, intr
;
892 ieee_long_double_t
* n
;
897 if ( exp_sign
== L
'g' || exp_sign
== L
'G' || exp_sign
== L
'e' || exp_sign
== L
'E' ) {
898 ie
= ((unsigned int)n
.n
->exponent
- (unsigned int)0x3fff);
899 exponent
= ie
/3.321928;
902 if ( exp_sign
== L
'g' || exp_sign
== L
'G' ) {
904 if ( exponent
< -4 || fabs(exponent
) >= precision
)
905 exp_sign
-= 2; // g -> e and G -> E
910 if ( exp_sign
== L
'e' || exp_sign
== L
'E' ) {
911 frac
= modfl(exponent
,&e
);
914 else if ( frac
< -0.5 )
917 result
= wnumberf(f
,__n
/powl(10.0L,e
),L
'f',size
-4, precision
, type
);
927 result
= wnumber(f
,ie
, 10,2, 2,type
);
933 if ( exp_sign
== L
'f' )
936 buf
= (wchar_t*)alloca(4096*sizeof(wchar_t));
942 c
= (type
& ZEROPAD
) ? L
'0' : L
' ';
951 } else if (type
& PLUS
)
955 } else if (type
& SPACE
)
962 frac
= modfl(__n
,&intr
);
964 // # flags forces a . and prevents trucation of trailing zero's
967 //frac = modfl(__n,&intr);
973 frac
= modfl((long double)frac
, &p
);
974 buf
[i
] = (int)p
+ L
'0';
986 if ( precision
>= 1 || type
& SPECIAL
)
1000 while ( intr
> 0.0 )
1008 buf
[i
++] = (int)p
+ L
'0';
1014 while ( j
< i
&& ro
== 1) {
1015 if ( buf
[j
] >= L
'0' && buf
[j
] <= L
'8' )
1020 else if ( buf
[j
] == L
'9' )
1032 if (!(type
&(ZEROPAD
+LEFT
)))
1042 if (!(type
&(ZEROPAD
+LEFT
)))
1047 if (type
& SPECIAL
) {
1056 if ( type
& ZEROTRUNC
&& ((type
& SPECIAL
) != SPECIAL
) )
1059 while ( j
< i
&& ( *tmp
== L
'0' || *tmp
== L
'.' ))
1078 do_string(std::string
& f
, const char* s
, int len
, int field_width
, int precision
, int flags
)
1091 while ((unsigned int)len
< (unsigned int)precision
&& s
[len
])
1096 if ((unsigned int)len
> (unsigned int)precision
)
1100 if (!(flags
& LEFT
))
1101 while (len
< field_width
--)
1106 for (i
= 0; i
< len
; ++i
)
1111 while (len
< field_width
--)
1120 do_wstring(std::wstring
& f
, const wchar_t* s
, int len
, int field_width
, int precision
, int flags
)
1133 while ((unsigned int)len
< (unsigned int)precision
&& s
[len
])
1138 if ((unsigned int)len
> (unsigned int)precision
)
1142 if (!(flags
& LEFT
))
1143 while (len
< field_width
--)
1148 for (i
= 0; i
< len
; ++i
)
1153 while (len
< field_width
--)
1162 stringw(std::string
& f
, const wchar_t* sw
, int len
, int field_width
, int precision
, int flags
)
1175 while ((unsigned int)len
< (unsigned int)precision
&& sw
[len
])
1180 if ((unsigned int)len
> (unsigned int)precision
)
1184 if (!(flags
& LEFT
))
1185 while (len
< field_width
--)
1190 for (i
= 0; i
< len
; ++i
)
1192 #define MY_MB_CUR_MAX 1
1193 char mb
[MY_MB_CUR_MAX
];
1195 mbcount
= wctomb(mb
, *sw
++);
1200 for (j
= 0; j
< mbcount
; j
++)
1206 while (len
< field_width
--)
1215 wstringa(std::wstring
& f
, const char* sa
, int len
, int field_width
, int precision
, int flags
)
1228 while ((unsigned int)len
< (unsigned int)precision
&& sa
[len
])
1233 if ((unsigned int)len
> (unsigned int)precision
)
1237 if (!(flags
& LEFT
))
1238 while (len
< field_width
--)
1243 for (i
= 0; i
< len
;)
1247 mbcount
= mbtowc(&w
, sa
, len
-i
);
1254 while (len
< field_width
--)
1262 #define _isnanl _isnan
1263 #define _finitel _finite
1266 ssvprintf ( const char *fmt
, va_list args
)
1270 long double _ldouble
;
1277 int flags
; /* flags to number() */
1279 int field_width
; /* width of output field */
1280 int precision
; /* min. # of digits for integers; max
1281 number of chars for from string */
1282 int qualifier
= 0; /* 'h', 'l', 'L' or 'I64' for integer fields */
1284 for (; *fmt
; ++fmt
)
1295 ++fmt
; /* this also skips first '%' */
1297 case '-': flags
|= LEFT
; goto repeat
;
1298 case '+': flags
|= PLUS
; goto repeat
;
1299 case ' ': flags
|= SPACE
; goto repeat
;
1300 case '#': flags
|= SPECIAL
; goto repeat
;
1301 case '0': flags
|= ZEROPAD
; goto repeat
;
1304 /* get field width */
1307 field_width
= skip_atoi(&fmt
);
1308 else if (*fmt
== '*') {
1310 /* it's the next argument */
1311 field_width
= va_arg(args
, int);
1312 if (field_width
< 0) {
1313 field_width
= -field_width
;
1318 /* get the precision */
1323 precision
= skip_atoi(&fmt
);
1324 else if (*fmt
== '*') {
1326 /* it's the next argument */
1327 precision
= va_arg(args
, int);
1333 /* get the conversion qualifier */
1335 // %Z can be just stand alone or as size_t qualifier
1336 if ( *fmt
== 'Z' ) {
1338 switch ( *(fmt
+1)) {
1351 } else if (*fmt
== 'h' || *fmt
== 'l' || *fmt
== 'L' || *fmt
== 'w') {
1354 } else if (*fmt
== 'I' && *(fmt
+1) == '6' && *(fmt
+2) == '4') {
1359 // go fine with ll instead of L
1360 if ( *fmt
== 'l' ) {
1370 if (!(flags
& LEFT
))
1371 while (--field_width
> 0)
1375 if (qualifier
== 'l' || qualifier
== 'w')
1377 f
+= (char)(unsigned char)(wchar_t) va_arg(args
,int);
1381 f
+= (char)(unsigned char) va_arg(args
,int);
1383 while (--field_width
> 0)
1390 if (!(flags
& LEFT
))
1391 while (--field_width
> 0)
1395 if (qualifier
== 'h')
1397 f
+= (char)(unsigned char) va_arg(args
,int);
1401 f
+= (char)(unsigned char)(wchar_t) va_arg(args
,int);
1403 while (--field_width
> 0)
1410 if (qualifier
== 'l' || qualifier
== 'w') {
1411 /* print unicode string */
1412 sw
= va_arg(args
, wchar_t *);
1413 result
= stringw(f
, sw
, -1, field_width
, precision
, flags
);
1415 /* print ascii string */
1416 s
= va_arg(args
, char *);
1417 result
= do_string(f
, s
, -1, field_width
, precision
, flags
);
1421 assert(!"TODO FIXME handle error better");
1427 if (qualifier
== 'h') {
1428 /* print ascii string */
1429 s
= va_arg(args
, char *);
1430 result
= do_string(f
, s
, -1, field_width
, precision
, flags
);
1432 /* print unicode string */
1433 sw
= va_arg(args
, wchar_t *);
1434 result
= stringw(f
, sw
, -1, field_width
, precision
, flags
);
1438 assert(!"TODO FIXME handle error better");
1444 if (qualifier == 'w') {
1445 // print counted unicode string
1446 PUNICODE_STRING pus = va_arg(args, PUNICODE_STRING);
1447 if ((pus == NULL) || (pus->Buffer == NULL)) {
1452 len = pus->Length / sizeof(WCHAR);
1454 result = stringw(f, sw, len, field_width, precision, flags);
1456 // print counted ascii string
1457 PANSI_STRING pas = va_arg(args, PANSI_STRING);
1458 if ((pas == NULL) || (pas->Buffer == NULL)) {
1465 result = string(f, s, -1, field_width, precision, flags);
1476 if (qualifier
== 'l' || qualifier
== 'L' ) {
1477 _ldouble
= va_arg(args
, long double);
1479 if ( _isnanl(_ldouble
) )
1483 else if ( !_finitel(_ldouble
) )
1490 if ( precision
== -1 )
1492 result
= numberfl(f
,_ldouble
,*fmt
,field_width
,precision
,flags
);
1495 assert(!"TODO FIXME handle error better");
1500 _double
= (double)va_arg(args
, double);
1502 if ( _isnan(_double
) )
1506 else if ( !_finite(_double
) )
1515 if ( precision
== -1 )
1517 result
= numberf(f
,_double
,*fmt
,field_width
,precision
,flags
);
1520 assert(!"TODO FIXME handle error better");
1528 if (field_width
== -1) {
1529 field_width
= 2*sizeof(void *);
1533 (unsigned long) va_arg(args
, void *), 16,
1534 field_width
, precision
, flags
);
1537 assert(!"TODO FIXME handle error better");
1543 if (qualifier
== 'l') {
1544 long * ip
= va_arg(args
, long *);
1547 int * ip
= va_arg(args
, int *);
1552 /* integer number formats - set up the flags and "break" */
1587 if (qualifier
== 'I')
1588 num
= va_arg(args
, ULONGLONG
);
1589 else if (qualifier
== 'l') {
1591 num
= va_arg(args
, long);
1593 num
= va_arg(args
, unsigned long);
1595 else if (qualifier
== 'h') {
1597 num
= va_arg(args
, int);
1599 num
= va_arg(args
, unsigned int);
1601 else if (flags
& SIGN
)
1602 num
= va_arg(args
, int);
1604 num
= va_arg(args
, unsigned int);
1605 result
= number(f
, num
, base
, field_width
, precision
, flags
);
1608 assert(!"TODO FIXME handle error better");
1617 sswvprintf ( const wchar_t* fmt
, va_list args
)
1621 long double _ldouble
;
1628 int flags
; /* flags to number() */
1630 int field_width
; /* width of output field */
1631 int precision
; /* min. # of digits for integers; max
1632 number of chars for from string */
1633 int qualifier
= 0; /* 'h', 'l', 'L' or 'I64' for integer fields */
1635 for (; *fmt
; ++fmt
)
1646 ++fmt
; /* this also skips first '%' */
1648 case L
'-': flags
|= LEFT
; goto repeat
;
1649 case L
'+': flags
|= PLUS
; goto repeat
;
1650 case L
' ': flags
|= SPACE
; goto repeat
;
1651 case L
'#': flags
|= SPECIAL
; goto repeat
;
1652 case L
'0': flags
|= ZEROPAD
; goto repeat
;
1655 /* get field width */
1658 field_width
= skip_wtoi(&fmt
);
1659 else if (*fmt
== L
'*') {
1661 /* it's the next argument */
1662 field_width
= va_arg(args
, int);
1663 if (field_width
< 0) {
1664 field_width
= -field_width
;
1669 /* get the precision */
1674 precision
= skip_wtoi(&fmt
);
1675 else if (*fmt
== L
'*') {
1677 /* it's the next argument */
1678 precision
= va_arg(args
, int);
1684 /* get the conversion qualifier */
1686 // %Z can be just stand alone or as size_t qualifier
1687 if ( *fmt
== L
'Z' ) {
1689 switch ( *(fmt
+1)) {
1702 } else if (*fmt
== L
'h' || *fmt
== L
'l' || *fmt
== L
'L' || *fmt
== L
'w') {
1705 } else if (*fmt
== L
'I' && *(fmt
+1) == L
'6' && *(fmt
+2) == L
'4') {
1710 // go fine with ll instead of L
1711 if ( *fmt
== L
'l' ) {
1721 if (!(flags
& LEFT
))
1722 while (--field_width
> 0)
1726 if ( qualifier
== L
'h' )
1728 f
+= (wchar_t)(char)(unsigned char) va_arg(args
,int);
1732 f
+= (wchar_t) va_arg(args
,int);
1734 while (--field_width
> 0)
1741 if (!(flags
& LEFT
))
1742 while (--field_width
> 0)
1746 if (qualifier
== L
'l' || qualifier
== L
'w')
1748 f
+= (wchar_t) va_arg(args
,int);
1752 f
+= (wchar_t)(char)(unsigned char) va_arg(args
,int);
1754 while (--field_width
> 0)
1761 if (qualifier
== L
'h') {
1762 /* print ascii string */
1763 sa
= va_arg(args
, char *);
1764 result
= wstringa(f
, sa
, -1, field_width
, precision
, flags
);
1766 /* print unicode string */
1767 s
= va_arg(args
, wchar_t *);
1768 result
= do_wstring(f
, s
, -1, field_width
, precision
, flags
);
1772 assert(!"TODO FIXME handle error better");
1778 if (qualifier
== L
'l' || qualifier
== L
'w') {
1779 /* print unicode string */
1780 s
= va_arg(args
, wchar_t *);
1781 result
= do_wstring(f
, s
, -1, field_width
, precision
, flags
);
1783 /* print ascii string */
1784 sa
= va_arg(args
, char *);
1785 result
= wstringa(f
, sa
, -1, field_width
, precision
, flags
);
1789 assert(!"TODO FIXME handle error better");
1799 if (qualifier
== L
'l' || qualifier
== L
'L' )
1801 _ldouble
= va_arg(args
, long double);
1803 if ( _isnanl(_ldouble
) )
1807 else if ( !_finitel(_ldouble
) )
1814 if ( precision
== -1 )
1816 result
= wnumberfl(f
,_ldouble
,*fmt
,field_width
,precision
,flags
);
1819 assert(!"TODO FIXME handle error better");
1824 _double
= (double)va_arg(args
, double);
1826 if ( _isnan(_double
) )
1830 else if ( !_finite(_double
) )
1839 if ( precision
== -1 )
1841 result
= wnumberf(f
,_double
,*fmt
,field_width
,precision
,flags
);
1844 assert(!"TODO FIXME handle error better");
1852 if (field_width
== -1) {
1853 field_width
= 2*sizeof(void *);
1857 (unsigned long) va_arg(args
, void *), 16,
1858 field_width
, precision
, flags
);
1861 assert(!"TODO FIXME handle error better");
1867 if (qualifier
== L
'l') {
1868 long * ip
= va_arg(args
, long *);
1871 int * ip
= va_arg(args
, int *);
1876 /* integer number formats - set up the flags and "break" */
1911 if (qualifier
== L
'I')
1912 num
= va_arg(args
, ULONGLONG
);
1913 else if (qualifier
== L
'l') {
1915 num
= va_arg(args
, long);
1917 num
= va_arg(args
, unsigned long);
1919 else if (qualifier
== L
'h') {
1921 num
= va_arg(args
, int);
1923 num
= va_arg(args
, unsigned int);
1925 else if (flags
& SIGN
)
1926 num
= va_arg(args
, int);
1928 num
= va_arg(args
, unsigned int);
1929 result
= wnumber(f
, num
, base
, field_width
, precision
, flags
);
1932 assert(!"TODO FIXME handle error better");