39 typedef void (*
putcf)(
void *,char);
44 #ifdef PRINTF_LONG_SUPPORT 46 static void uli2a(
unsigned long int num,
unsigned int base,
int uc,
char *bf)
57 if (n || dgt>0|| d==0)
59 *bf++ = dgt+(dgt<10 ?
'0' : (uc ?
'A' :
'a')-10);
66 static void li2a(
long num,
char *bf)
78 static void ui2a(
unsigned int num,
unsigned int base,
int uc,
char *bf)
82 #pragma GCC diagnostic push 83 #pragma GCC diagnostic ignored "-Wstrict-overflow" 85 #pragma GCC diagnostic pop 92 if (n || dgt>0 || d==0)
94 *bf++ = dgt+(dgt<10 ?
'0' : (uc ?
'A' :
'a')-10);
101 static void i2a(
int num,
char *bf)
113 if (ch>=
'0' && ch<=
'9')
115 else if (ch>=
'a' && ch<=
'f')
117 else if (ch>=
'A' && ch<=
'F')
122 static char a2i(
char ch,
char **src,
int base,
int *nump)
127 while ((digit=
a2d(ch))>=0)
129 if (digit>base)
break;
138 static void putchw(
void *putp,
putcf putf,
int n,
char z,
char *bf)
140 char fc=z?
'0' :
' ';
143 while (*p++ && n != 0)
158 while ((ch=*(fmt++)))
165 #ifdef PRINTF_LONG_SUPPORT 175 if (ch>=
'0' && ch<=
'9')
177 ch=
a2i(ch, const_cast<char **>(&fmt), 10, &w);
179 #ifdef PRINTF_LONG_SUPPORT 192 #ifdef PRINTF_LONG_SUPPORT 194 uli2a(va_arg(va,
unsigned long int),10,0,bf);
197 ui2a(va_arg(va,
unsigned int),10,0,bf);
198 putchw(putp,putf,w,lz,bf);
203 #ifdef PRINTF_LONG_SUPPORT 205 li2a(va_arg(va,
unsigned long int),bf);
208 i2a(va_arg(va,
int),bf);
209 putchw(putp,putf,w,lz,bf);
214 #ifdef PRINTF_LONG_SUPPORT 216 uli2a(va_arg(va,
unsigned long int),16,(ch==
'X'),bf);
219 ui2a(va_arg(va,
unsigned int),16,(ch==
'X'),bf);
220 putchw(putp,putf,w,lz,bf);
223 putf(putp,static_cast<char>(va_arg(va,
int)));
226 putchw(putp,putf,w,0,va_arg(va,
char *));
256 *(*(
static_cast<char **
>(p)))++ = c;
void(* putcf)(void *, char)
static void ui2a(unsigned int num, unsigned int base, int uc, char *bf)
void init_printf(void *putp, void(*putf)(void *, char))
static void i2a(int num, char *bf)
void tfp_format(void *putp, void(*putf)(void *, char), const char *fmt, va_list va)
static void putcp(void *p, char c)
static void li2a(long num, char *bf)
static void * stdout_putp
static char a2i(char ch, char **src, int base, int *nump)
void tfp_sprintf(char *s, const char *fmt, va_list va)
static void uli2a(unsigned long int num, unsigned int base, int uc, char *bf)
void tfp_printf(const char *fmt,...)
static void putchw(void *putp, putcf putf, int n, char z, char *bf)