comparison th_string.c @ 411:371567cf0a38

Add some XXX TODO FIXME in here :P
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 09 Mar 2016 12:10:41 +0200
parents 04cb03baf114
children 77fd4f0327dc
comparison
equal deleted inserted replaced
410:04cb03baf114 411:371567cf0a38
244 f_sign = f_unsig ? 0 : ((f_flags & TH_PF_SIGN) ? 244 f_sign = f_unsig ? 0 : ((f_flags & TH_PF_SIGN) ?
245 (f_neg ? '-' : '+') : 245 (f_neg ? '-' : '+') :
246 (f_neg ? '-' : ((f_flags & TH_PF_SPACE) ? ' ' : 0))); 246 (f_neg ? '-' : ((f_flags & TH_PF_SPACE) ? ' ' : 0)));
247 247
248 // Calculate necessary padding, etc 248 // Calculate necessary padding, etc
249 //
250 // << XXX TODO FIXME: The logic here is not very elegant, and it's incorrect
251 // at least for some alternate format modifier cases.
252 //
253
249 int nlen = (f_sign ? 1 : 0) + (f_altstr ? strlen(f_altstr) : 0); 254 int nlen = (f_sign ? 1 : 0) + (f_altstr ? strlen(f_altstr) : 0);
250 int qlen = (f_prec > f_len ? f_prec : f_len) + nlen; 255 int qlen = (f_prec > f_len ? f_prec : f_len) + nlen;
251 256
252 if (f_flags & TH_PF_LEFT) 257 if (f_flags & TH_PF_LEFT)
253 f_flags &= ~TH_PF_ZERO; 258 f_flags &= ~TH_PF_ZERO;
273 nwidth = (f_width >= 0) ? f_width - qlen : 0; 278 nwidth = (f_width >= 0) ? f_width - qlen : 0;
274 } 279 }
275 280
276 PP_PRINTF(": vret=%3d, f_flags=[%s], f_unsig=%d, f_sign='%c', f_len=%3d, f_width=%3d, f_prec=%3d, nwidth=%3d, nprec=%3d, qlen=%3d\n", 281 PP_PRINTF(": vret=%3d, f_flags=[%s], f_unsig=%d, f_sign='%c', f_len=%3d, f_width=%3d, f_prec=%3d, nwidth=%3d, nprec=%3d, qlen=%3d\n",
277 vret, get_flags(f_flags), f_unsig, f_sign ? f_sign : '?', f_len, f_width, f_prec, nwidth, nprec, qlen); 282 vret, get_flags(f_flags), f_unsig, f_sign ? f_sign : '?', f_len, f_width, f_prec, nwidth, nprec, qlen);
283
284 // << XXX TODO FIXME
278 285
279 // Prefix padding 286 // Prefix padding
280 if ((ret = th_printf_pad_pre(ctx, vputch, nwidth, f_flags)) == EOF) 287 if ((ret = th_printf_pad_pre(ctx, vputch, nwidth, f_flags)) == EOF)
281 return ret; 288 return ret;
282 289