34 typedef void (*
putcf) (
void*,char);
39 #ifdef PRINTF_LONG_SUPPORT 41 static void uli2a(
unsigned long int num,
unsigned int base,
int uc,
char * bf)
51 if (n || dgt>0|| d==0) {
52 *bf++ = dgt+(dgt<10 ?
'0' : (uc ?
'A' :
'a')-10);
59 static void li2a (
long num,
char * bf)
70 static void ui2a(
unsigned int num,
unsigned int base,
int uc,
char * bf)
80 if (n || dgt>0 || d==0) {
81 *bf++ = dgt+(dgt<10 ?
'0' : (uc ?
'A' :
'a')-10);
88 static void i2a (
int num,
char * bf)
97 static int a2d(
char ch)
99 if (ch>=
'0' && ch<=
'9')
101 else if (ch>=
'a' && ch<=
'f')
103 else if (ch>=
'A' && ch<=
'F')
108 static char a2i(
char ch,
char** src,
int base,
int* nump)
113 while ((digit=
a2d(ch))>=0) {
114 if (digit>base)
break;
125 char fc=z?
'0' :
' ';
128 while (*p++ && n > 0)
143 while ((ch=*(fmt++))) {
148 #ifdef PRINTF_LONG_SUPPORT 157 if (ch>=
'0' && ch<=
'9') {
158 ch=
a2i(ch, (
char **)&fmt, 10, &w);
160 #ifdef PRINTF_LONG_SUPPORT 170 #ifdef PRINTF_LONG_SUPPORT 172 uli2a(va_arg(va,
unsigned long int),10,0,bf);
175 ui2a(va_arg(va,
unsigned int),10,0,bf);
176 putchw(putp,putf,w,lz,bf);
180 #ifdef PRINTF_LONG_SUPPORT 182 li2a(va_arg(va,
unsigned long int),bf);
185 i2a(va_arg(va,
int),bf);
186 putchw(putp,putf,w,lz,bf);
190 #ifdef PRINTF_LONG_SUPPORT 192 uli2a(va_arg(va,
unsigned long int),16,(ch==
'X'),bf);
195 ui2a(va_arg(va,
unsigned int),16,(ch==
'X'),bf);
196 putchw(putp,putf,w,lz,bf);
199 putf(putp,(
char)(va_arg(va,
int)));
202 putchw(putp,putf,w,0,va_arg(va,
char*));
231 *(*((
char**)p))++ = c;
static void uli2a(unsigned long int num, unsigned int base, int uc, char *bf)
static void putchw(void *putp, putcf putf, int n, char z, char *bf)
static void li2a(long num, char *bf)
void tfp_printf(const char *fmt,...)
static char a2i(char ch, char **src, int base, int *nump)
void tfp_format(void *putp, putcf putf, const char *fmt, va_list va)
void init_printf(void *putp, void(*putf)(void *, char))
void tfp_sprintf(char *s, const char *fmt,...)
static void putcp(void *p, char c)
static void ui2a(unsigned int num, unsigned int base, int uc, char *bf)
static void i2a(int num, char *bf)
static void * stdout_putp
void(* putcf)(void *, char)