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.
28 #define _finite __finite
29 #define _isnan __isnan
30 inline int iswdigit ( wchar_t c
)
32 return ( c
>= L
'0' && c
<= L
'9' );
37 # define __isnan isnan
38 # define __finite finite
39 # define powl __builtin_powl
40 # define modfl __builtin_modfl
44 #define alloca _alloca
48 typedef __int64 LONGLONG
;
49 typedef unsigned __int64 ULONGLONG
;
51 typedef long long LONGLONG
;
52 typedef unsigned long long ULONGLONG
;
56 unsigned int mantissa
:23;
57 unsigned int exponent
:8;
62 unsigned int mantissal
:32;
63 unsigned int mantissah
:20;
64 unsigned int exponent
:11;
69 unsigned int mantissal
:32;
70 unsigned int mantissah
:32;
71 unsigned int exponent
:15;
73 unsigned int empty
:16;
77 ssprintf ( const char* fmt
, ... )
81 std::string f
= ssvprintf ( fmt
, arg
);
87 sswprintf ( const wchar_t* fmt
, ... )
91 std::wstring f
= sswvprintf ( fmt
, arg
);
96 #define ZEROPAD 1 /* pad with zero */
97 #define SIGN 2 /* unsigned/signed long */
98 #define PLUS 4 /* show plus */
99 #define SPACE 8 /* space if plus */
100 #define LEFT 16 /* left justified */
101 #define SPECIAL 32 /* 0x */
102 #define LARGE 64 /* use 'ABCDEF' instead of 'abcdef' */
103 #define ZEROTRUNC 128 /* truncate zero 's */
107 skip_atoi(const char **s
)
112 i
= i
*10 + *((*s
)++) - '0';
117 skip_wtoi(const wchar_t **s
)
121 while (iswdigit(**s
))
122 i
= i
*10 + *((*s
)++) - L
'0';
128 do_div(LONGLONG
*n
,int base
)
130 int __res
= ((ULONGLONG
) *n
) % (unsigned) base
;
131 *n
= ((ULONGLONG
) *n
) / (unsigned) base
;
137 number(std::string
& f
, LONGLONG num
, int base
, int size
, int precision
,int type
)
140 const char *digits
="0123456789abcdefghijklmnopqrstuvwxyz";
144 digits
= "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
147 if (base
< 2 || base
> 36)
149 c
= (type
& ZEROPAD
) ? '0' : ' ';
156 } else if (type
& PLUS
) {
159 } else if (type
& SPACE
) {
164 if (type
& SPECIAL
) {
173 else while (num
!= 0)
174 tmp
[i
++] = digits
[do_div(&num
,base
)];
178 if (!(type
&(ZEROPAD
+LEFT
)))
198 while (i
< precision
--)
214 wnumber(std::wstring
& f
, LONGLONG num
, int base
, int size
, int precision
,int type
)
216 wchar_t c
,sign
,tmp
[66];
217 const wchar_t *digits
= L
"0123456789abcdefghijklmnopqrstuvwxyz";
221 digits
= L
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
224 if (base
< 2 || base
> 36)
226 c
= (type
& ZEROPAD
) ? L
'0' : L
' ';
233 } else if (type
& PLUS
) {
236 } else if (type
& SPACE
) {
241 if (type
& SPECIAL
) {
250 else while (num
!= 0)
251 tmp
[i
++] = digits
[do_div(&num
,base
)];
255 if (!(type
&(ZEROPAD
+LEFT
)))
275 while (i
< precision
--)
292 numberf(std::string
& f
, double __n
, char exp_sign
, int size
, int precision
, int type
)
294 double exponent
= 0.0;
304 char *buf
, *tmp
, sign
, c
;
315 if ( exp_sign
== 'g' || exp_sign
== 'G' || exp_sign
== 'e' || exp_sign
== 'E' )
317 ie
= ((unsigned int)n
.n
->exponent
- (unsigned int)0x3ff);
318 exponent
= ie
/3.321928;
321 if ( exp_sign
== 'g' || exp_sign
== 'G' )
324 if ( exponent
< -4 || fabs(exponent
) >= precision
)
325 exp_sign
-= 2; // g -> e and G -> E
330 if ( exp_sign
== 'e' || exp_sign
== 'E' )
332 frac
= modf(exponent
,&e
);
335 else if ( frac
< -0.5 )
338 result
= numberf(f
,__n
/pow(10.0L,(long double)e
),'f',size
-4, precision
, type
);
348 result
= number(f
,ie
, 10,2, 2,type
);
354 if ( exp_sign
== 'f' )
356 buf
= (char*)alloca(4096);
360 c
= (type
& ZEROPAD
) ? '0' : ' ';
370 else if (type
& PLUS
)
375 else if (type
& SPACE
)
382 frac
= modf(__n
,&intr
);
384 // # flags forces a . and prevents trucation of trailing zero's
391 frac
= modf(frac
, &p
);
392 buf
[i
] = (int)p
+ '0';
402 if ( precision
>= 1 || type
& SPECIAL
)
424 buf
[i
++] = (int)p
+ '0';
430 while ( j
< i
&& ro
== 1)
432 if ( buf
[j
] >= '0' && buf
[j
] <= '8' )
437 else if ( buf
[j
] == '9' )
448 if (!(type
&(ZEROPAD
+LEFT
)))
458 if (!(type
&(ZEROPAD
+LEFT
)))
471 if ( type
& ZEROTRUNC
&& ((type
& SPECIAL
) != SPECIAL
) )
474 while ( j
< i
&& ( *tmp
== '0' || *tmp
== '.' ))
493 wnumberf(std::wstring
& f
, double __n
, wchar_t exp_sign
, int size
, int precision
, int type
)
495 double exponent
= 0.0;
505 wchar_t *buf
, *tmp
, sign
, c
;
516 if ( exp_sign
== L
'g' || exp_sign
== L
'G' || exp_sign
== L
'e' || exp_sign
== L
'E' )
518 ie
= ((unsigned int)n
.n
->exponent
- (unsigned int)0x3ff);
519 exponent
= ie
/3.321928;
522 if ( exp_sign
== L
'g' || exp_sign
== L
'G' )
525 if ( exponent
< -4 || fabs(exponent
) >= precision
)
526 exp_sign
-= 2; // g -> e and G -> E
531 if ( exp_sign
== L
'e' || exp_sign
== L
'E' )
533 frac
= modf(exponent
,&e
);
536 else if ( frac
< -0.5 )
539 result
= wnumberf(f
,__n
/pow(10.0L,(long double) e
),L
'f',size
-4, precision
, type
);
549 result
= wnumber(f
,ie
, 10,2, 2,type
);
555 if ( exp_sign
== L
'f' )
557 buf
= (wchar_t*)alloca(4096*sizeof(wchar_t));
561 c
= (type
& ZEROPAD
) ? L
'0' : L
' ';
571 else if (type
& PLUS
)
576 else if (type
& SPACE
)
583 frac
= modf(__n
,&intr
);
585 // # flags forces a . and prevents trucation of trailing zero's
592 frac
= modf(frac
, &p
);
593 buf
[i
] = (int)p
+ L
'0';
603 if ( precision
>= 1 || type
& SPECIAL
)
625 buf
[i
++] = (int)p
+ L
'0';
631 while ( j
< i
&& ro
== 1)
633 if ( buf
[j
] >= L
'0' && buf
[j
] <= L
'8' )
638 else if ( buf
[j
] == L
'9' )
649 if (!(type
&(ZEROPAD
+LEFT
)))
659 if (!(type
&(ZEROPAD
+LEFT
)))
672 if ( type
& ZEROTRUNC
&& ((type
& SPECIAL
) != SPECIAL
) )
675 while ( j
< i
&& ( *tmp
== L
'0' || *tmp
== L
'.' ))
694 numberfl(std::string
& f
, long double __n
, char exp_sign
, int size
, int precision
, int type
)
696 long double exponent
= 0.0;
704 long double frac
, intr
;
706 char *buf
, *tmp
, sign
, c
;
712 ieee_long_double_t
* n
;
717 if ( exp_sign
== 'g' || exp_sign
== 'G' || exp_sign
== 'e' || exp_sign
== 'E' )
719 ie
= ((unsigned int)n
.n
->exponent
- (unsigned int)0x3fff);
720 exponent
= ie
/3.321928;
723 if ( exp_sign
== 'g' || exp_sign
== 'G' )
726 if ( exponent
< -4 || fabs(exponent
) >= precision
)
727 exp_sign
-= 2; // g -> e and G -> E
732 if ( exp_sign
== 'e' || exp_sign
== 'E' )
734 frac
= modfl(exponent
,&e
);
737 else if ( frac
< -0.5 )
740 result
= numberf(f
,__n
/powl(10.0L,e
),'f',size
-4, precision
, type
);
750 result
= number(f
,ie
, 10,2, 2,type
);
756 if ( exp_sign
== 'f' )
758 buf
= (char*)alloca(4096);
762 c
= (type
& ZEROPAD
) ? '0' : ' ';
772 else if (type
& PLUS
)
777 else if (type
& SPACE
)
784 frac
= modfl(__n
,&intr
);
786 // # flags forces a . and prevents trucation of trailing zero's
793 frac
= modfl((long double)frac
, &p
);
794 buf
[i
] = (int)p
+ '0';
804 if ( precision
>= 1 || type
& SPECIAL
)
826 buf
[i
++] = (int)p
+ '0';
832 while ( j
< i
&& ro
== 1)
834 if ( buf
[j
] >= '0' && buf
[j
] <= '8' )
839 else if ( buf
[j
] == '9' )
850 if (!(type
&(ZEROPAD
+LEFT
)))
860 if (!(type
&(ZEROPAD
+LEFT
)))
873 if ( type
& ZEROTRUNC
&& ((type
& SPECIAL
) != SPECIAL
) )
876 while ( j
< i
&& ( *tmp
== '0' || *tmp
== '.' ))
895 wnumberfl(std::wstring
& f
, long double __n
, wchar_t exp_sign
, int size
, int precision
, int type
)
897 long double exponent
= 0.0;
905 long double frac
, intr
;
907 wchar_t *buf
, *tmp
, sign
, c
;
913 ieee_long_double_t
* n
;
918 if ( exp_sign
== L
'g' || exp_sign
== L
'G' || exp_sign
== L
'e' || exp_sign
== L
'E' )
920 ie
= ((unsigned int)n
.n
->exponent
- (unsigned int)0x3fff);
921 exponent
= ie
/3.321928;
924 if ( exp_sign
== L
'g' || exp_sign
== L
'G' )
927 if ( exponent
< -4 || fabs(exponent
) >= precision
)
928 exp_sign
-= 2; // g -> e and G -> E
933 if ( exp_sign
== L
'e' || exp_sign
== L
'E' )
935 frac
= modfl(exponent
,&e
);
938 else if ( frac
< -0.5 )
941 result
= wnumberf(f
,__n
/powl(10.0L,e
),L
'f',size
-4, precision
, type
);
951 result
= wnumber(f
,ie
, 10,2, 2,type
);
957 if ( exp_sign
== L
'f' )
959 buf
= (wchar_t*)alloca(4096*sizeof(wchar_t));
963 c
= (type
& ZEROPAD
) ? L
'0' : L
' ';
973 else if (type
& PLUS
)
978 else if (type
& SPACE
)
985 frac
= modfl(__n
,&intr
);
987 // # flags forces a . and prevents trucation of trailing zero's
994 frac
= modfl((long double)frac
, &p
);
995 buf
[i
] = (int)p
+ L
'0';
1005 if ( precision
>= 1 || type
& SPECIAL
)
1019 while ( intr
> 0.0 )
1027 buf
[i
++] = (int)p
+ L
'0';
1033 while ( j
< i
&& ro
== 1)
1035 if ( buf
[j
] >= L
'0' && buf
[j
] <= L
'8' )
1040 else if ( buf
[j
] == L
'9' )
1051 if (!(type
&(ZEROPAD
+LEFT
)))
1061 if (!(type
&(ZEROPAD
+LEFT
)))
1074 if ( type
& ZEROTRUNC
&& ((type
& SPECIAL
) != SPECIAL
) )
1077 while ( j
< i
&& ( *tmp
== L
'0' || *tmp
== L
'.' ))
1096 do_string(std::string
& f
, const char* s
, int len
, int field_width
, int precision
, int flags
)
1109 while ((unsigned int)len
< (unsigned int)precision
&& s
[len
])
1114 if ((unsigned int)len
> (unsigned int)precision
)
1118 if (!(flags
& LEFT
))
1119 while (len
< field_width
--)
1124 for (i
= 0; i
< len
; ++i
)
1129 while (len
< field_width
--)
1138 do_wstring(std::wstring
& f
, const wchar_t* s
, int len
, int field_width
, int precision
, int flags
)
1151 while ((unsigned int)len
< (unsigned int)precision
&& s
[len
])
1156 if ((unsigned int)len
> (unsigned int)precision
)
1160 if (!(flags
& LEFT
))
1161 while (len
< field_width
--)
1166 for (i
= 0; i
< len
; ++i
)
1171 while (len
< field_width
--)
1180 stringw(std::string
& f
, const wchar_t* sw
, int len
, int field_width
, int precision
, int flags
)
1193 while ((unsigned int)len
< (unsigned int)precision
&& sw
[len
])
1198 if ((unsigned int)len
> (unsigned int)precision
)
1202 if (!(flags
& LEFT
))
1203 while (len
< field_width
--)
1208 for (i
= 0; i
< len
; ++i
)
1210 #define MY_MB_CUR_MAX 1
1211 char mb
[MY_MB_CUR_MAX
];
1213 mbcount
= wctomb(mb
, *sw
++);
1218 for (j
= 0; j
< mbcount
; j
++)
1224 while (len
< field_width
--)
1233 wstringa(std::wstring
& f
, const char* sa
, int len
, int field_width
, int precision
, int flags
)
1246 while ((unsigned int)len
< (unsigned int)precision
&& sa
[len
])
1251 if ((unsigned int)len
> (unsigned int)precision
)
1255 if (!(flags
& LEFT
))
1256 while (len
< field_width
--)
1261 for (i
= 0; i
< len
;)
1265 mbcount
= mbtowc(&w
, sa
+i
, len
-i
);
1272 while (len
< field_width
--)
1280 #define _isnanl _isnan
1281 #define _finitel _finite
1284 ssvprintf ( const char *fmt
, va_list args
)
1288 long double _ldouble
;
1295 int flags
; /* flags to number() */
1297 int field_width
; /* width of output field */
1298 int precision
; /* min. # of digits for integers; max
1299 number of chars for from string */
1300 int qualifier
= 0; /* 'h', 'l', 'L' or 'I64' for integer fields */
1302 for (; *fmt
; ++fmt
)
1313 ++fmt
; /* this also skips first '%' */
1315 case '-': flags
|= LEFT
; goto repeat
;
1316 case '+': flags
|= PLUS
; goto repeat
;
1317 case ' ': flags
|= SPACE
; goto repeat
;
1318 case '#': flags
|= SPECIAL
; goto repeat
;
1319 case '0': flags
|= ZEROPAD
; goto repeat
;
1322 /* get field width */
1325 field_width
= skip_atoi(&fmt
);
1326 else if (*fmt
== '*') {
1328 /* it's the next argument */
1329 field_width
= va_arg(args
, int);
1330 if (field_width
< 0) {
1331 field_width
= -field_width
;
1336 /* get the precision */
1341 precision
= skip_atoi(&fmt
);
1342 else if (*fmt
== '*') {
1344 /* it's the next argument */
1345 precision
= va_arg(args
, int);
1351 /* get the conversion qualifier */
1353 // %Z can be just stand alone or as size_t qualifier
1354 if ( *fmt
== 'Z' ) {
1356 switch ( *(fmt
+1)) {
1369 } else if (*fmt
== 'h' || *fmt
== 'l' || *fmt
== 'L' || *fmt
== 'w') {
1372 } else if (*fmt
== 'I' && *(fmt
+1) == '6' && *(fmt
+2) == '4') {
1377 // go fine with ll instead of L
1378 if ( *fmt
== 'l' ) {
1388 if (!(flags
& LEFT
))
1389 while (--field_width
> 0)
1393 if (qualifier
== 'l' || qualifier
== 'w')
1395 f
+= (char)(unsigned char)(wchar_t) va_arg(args
,int);
1399 f
+= (char)(unsigned char) va_arg(args
,int);
1401 while (--field_width
> 0)
1408 if (!(flags
& LEFT
))
1409 while (--field_width
> 0)
1413 if (qualifier
== 'h')
1415 f
+= (char)(unsigned char) va_arg(args
,int);
1419 f
+= (char)(unsigned char)(wchar_t) va_arg(args
,int);
1421 while (--field_width
> 0)
1428 if (qualifier
== 'l' || qualifier
== 'w') {
1429 /* print unicode string */
1430 sw
= va_arg(args
, wchar_t *);
1431 result
= stringw(f
, sw
, -1, field_width
, precision
, flags
);
1433 /* print ascii string */
1434 s
= va_arg(args
, char *);
1435 result
= do_string(f
, s
, -1, field_width
, precision
, flags
);
1439 assert(!"TODO FIXME handle error better");
1445 if (qualifier
== 'h') {
1446 /* print ascii string */
1447 s
= va_arg(args
, char *);
1448 result
= do_string(f
, s
, -1, field_width
, precision
, flags
);
1450 /* print unicode string */
1451 sw
= va_arg(args
, wchar_t *);
1452 result
= stringw(f
, sw
, -1, field_width
, precision
, flags
);
1456 assert(!"TODO FIXME handle error better");
1462 if (qualifier == 'w') {
1463 // print counted unicode string
1464 PUNICODE_STRING pus = va_arg(args, PUNICODE_STRING);
1465 if ((pus == NULL) || (pus->Buffer == NULL)) {
1470 len = pus->Length / sizeof(WCHAR);
1472 result = stringw(f, sw, len, field_width, precision, flags);
1474 // print counted ascii string
1475 PANSI_STRING pas = va_arg(args, PANSI_STRING);
1476 if ((pas == NULL) || (pas->Buffer == NULL)) {
1483 result = string(f, s, -1, field_width, precision, flags);
1494 if (qualifier
== 'l' || qualifier
== 'L' ) {
1495 _ldouble
= va_arg(args
, long double);
1497 if ( _isnanl(_ldouble
) )
1501 else if ( !_finitel(_ldouble
) )
1508 if ( precision
== -1 )
1510 result
= numberfl(f
,_ldouble
,*fmt
,field_width
,precision
,flags
);
1513 assert(!"TODO FIXME handle error better");
1518 _double
= (double)va_arg(args
, double);
1520 if ( _isnan(_double
) )
1524 else if ( !_finite(_double
) )
1533 if ( precision
== -1 )
1535 result
= numberf(f
,_double
,*fmt
,field_width
,precision
,flags
);
1538 assert(!"TODO FIXME handle error better");
1546 if (field_width
== -1) {
1547 field_width
= 2*sizeof(void *);
1551 (unsigned long) va_arg(args
, void *), 16,
1552 field_width
, precision
, flags
);
1555 assert(!"TODO FIXME handle error better");
1561 if (qualifier
== 'l') {
1562 long * ip
= va_arg(args
, long *);
1565 int * ip
= va_arg(args
, int *);
1570 /* integer number formats - set up the flags and "break" */
1605 if (qualifier
== 'I')
1606 num
= va_arg(args
, ULONGLONG
);
1607 else if (qualifier
== 'l') {
1609 num
= va_arg(args
, long);
1611 num
= va_arg(args
, unsigned long);
1613 else if (qualifier
== 'h') {
1615 num
= va_arg(args
, int);
1617 num
= va_arg(args
, unsigned int);
1619 else if (flags
& SIGN
)
1620 num
= va_arg(args
, int);
1622 num
= va_arg(args
, unsigned int);
1623 result
= number(f
, num
, base
, field_width
, precision
, flags
);
1626 assert(!"TODO FIXME handle error better");
1635 sswvprintf ( const wchar_t* fmt
, va_list args
)
1639 long double _ldouble
;
1646 int flags
; /* flags to number() */
1648 int field_width
; /* width of output field */
1649 int precision
; /* min. # of digits for integers; max
1650 number of chars for from string */
1651 int qualifier
= 0; /* 'h', 'l', 'L' or 'I64' for integer fields */
1653 for (; *fmt
; ++fmt
)
1664 ++fmt
; /* this also skips first '%' */
1666 case L
'-': flags
|= LEFT
; goto repeat
;
1667 case L
'+': flags
|= PLUS
; goto repeat
;
1668 case L
' ': flags
|= SPACE
; goto repeat
;
1669 case L
'#': flags
|= SPECIAL
; goto repeat
;
1670 case L
'0': flags
|= ZEROPAD
; goto repeat
;
1673 /* get field width */
1676 field_width
= skip_wtoi(&fmt
);
1677 else if (*fmt
== L
'*') {
1679 /* it's the next argument */
1680 field_width
= va_arg(args
, int);
1681 if (field_width
< 0) {
1682 field_width
= -field_width
;
1687 /* get the precision */
1692 precision
= skip_wtoi(&fmt
);
1693 else if (*fmt
== L
'*') {
1695 /* it's the next argument */
1696 precision
= va_arg(args
, int);
1702 /* get the conversion qualifier */
1704 // %Z can be just stand alone or as size_t qualifier
1705 if ( *fmt
== L
'Z' ) {
1707 switch ( *(fmt
+1)) {
1720 } else if (*fmt
== L
'h' || *fmt
== L
'l' || *fmt
== L
'L' || *fmt
== L
'w') {
1723 } else if (*fmt
== L
'I' && *(fmt
+1) == L
'6' && *(fmt
+2) == L
'4') {
1728 // go fine with ll instead of L
1729 if ( *fmt
== L
'l' ) {
1739 if (!(flags
& LEFT
))
1740 while (--field_width
> 0)
1744 if ( qualifier
== L
'h' )
1746 f
+= (wchar_t)(char)(unsigned char) va_arg(args
,int);
1750 f
+= (wchar_t) va_arg(args
,int);
1752 while (--field_width
> 0)
1759 if (!(flags
& LEFT
))
1760 while (--field_width
> 0)
1764 if (qualifier
== L
'l' || qualifier
== L
'w')
1766 f
+= (wchar_t) va_arg(args
,int);
1770 f
+= (wchar_t)(char)(unsigned char) va_arg(args
,int);
1772 while (--field_width
> 0)
1779 if (qualifier
== L
'h') {
1780 /* print ascii string */
1781 sa
= va_arg(args
, char *);
1782 result
= wstringa(f
, sa
, -1, field_width
, precision
, flags
);
1784 /* print unicode string */
1785 s
= va_arg(args
, wchar_t *);
1786 result
= do_wstring(f
, s
, -1, field_width
, precision
, flags
);
1790 assert(!"TODO FIXME handle error better");
1796 if (qualifier
== L
'l' || qualifier
== L
'w') {
1797 /* print unicode string */
1798 s
= va_arg(args
, wchar_t *);
1799 result
= do_wstring(f
, s
, -1, field_width
, precision
, flags
);
1801 /* print ascii string */
1802 sa
= va_arg(args
, char *);
1803 result
= wstringa(f
, sa
, -1, field_width
, precision
, flags
);
1807 assert(!"TODO FIXME handle error better");
1817 if (qualifier
== L
'l' || qualifier
== L
'L' )
1819 _ldouble
= va_arg(args
, long double);
1821 if ( _isnanl(_ldouble
) )
1825 else if ( !_finitel(_ldouble
) )
1832 if ( precision
== -1 )
1834 result
= wnumberfl(f
,_ldouble
,*fmt
,field_width
,precision
,flags
);
1837 assert(!"TODO FIXME handle error better");
1842 _double
= (double)va_arg(args
, double);
1844 if ( _isnan(_double
) )
1848 else if ( !_finite(_double
) )
1857 if ( precision
== -1 )
1859 result
= wnumberf(f
,_double
,*fmt
,field_width
,precision
,flags
);
1862 assert(!"TODO FIXME handle error better");
1870 if (field_width
== -1) {
1871 field_width
= 2*sizeof(void *);
1875 (unsigned long) va_arg(args
, void *), 16,
1876 field_width
, precision
, flags
);
1879 assert(!"TODO FIXME handle error better");
1885 if (qualifier
== L
'l') {
1886 long * ip
= va_arg(args
, long *);
1889 int * ip
= va_arg(args
, int *);
1894 /* integer number formats - set up the flags and "break" */
1929 if (qualifier
== L
'I')
1930 num
= va_arg(args
, ULONGLONG
);
1931 else if (qualifier
== L
'l') {
1933 num
= va_arg(args
, long);
1935 num
= va_arg(args
, unsigned long);
1937 else if (qualifier
== L
'h') {
1939 num
= va_arg(args
, int);
1941 num
= va_arg(args
, unsigned int);
1943 else if (flags
& SIGN
)
1944 num
= va_arg(args
, int);
1946 num
= va_arg(args
, unsigned int);
1947 result
= wnumber(f
, num
, base
, field_width
, precision
, flags
);
1950 assert(!"TODO FIXME handle error better");