Lines Matching refs:pi

160 __printf_out(struct __printf_io *io, const struct printf_info *pi, const void *ptr, int len)
164 if ((!pi->left) && pi->width > len)
165 ret += __printf_pad(io, pi->width - len, pi->pad == '0');
167 if (pi->left && pi->width > len)
168 ret += __printf_pad(io, pi->width - len, pi->pad == '0');
176 __printf_arginfo_pct(const struct printf_info *pi __unused, size_t n __unused, int *argt __unused)
183 __printf_render_pct(struct __printf_io *io, const struct printf_info *pi __unused, const void *const *arg __unused)
192 __printf_arginfo_n(const struct printf_info *pi, size_t n, int *argt)
206 __printf_render_n(FILE *io __unused, const struct printf_info *pi, const void *const *arg)
209 if (pi->is_char)
210 **((signed char **)arg[0]) = (signed char)pi->sofar;
211 else if (pi->is_short)
212 **((short **)arg[0]) = (short)pi->sofar;
213 else if (pi->is_long)
214 **((long **)arg[0]) = pi->sofar;
215 else if (pi->is_long_double)
216 **((long long **)arg[0]) = pi->sofar;
217 else if (pi->is_intmax)
218 **((intmax_t **)arg[0]) = pi->sofar;
219 else if (pi->is_ptrdiff)
220 **((ptrdiff_t **)arg[0]) = pi->sofar;
221 else if (pi->is_quad)
222 **((quad_t **)arg[0]) = pi->sofar;
223 else if (pi->is_size)
224 **((size_t **)arg[0]) = pi->sofar;
226 **((int **)arg[0]) = pi->sofar;
267 struct printf_info *pi, *pil;
286 for (pi = pia; ; pi++) {
287 memset(pi, 0, sizeof *pi);
288 pil = pi;
291 pil = pi + 1;
292 pi->prec = -1;
293 pi->pad = ' ';
294 pi->begin = pi->end = fmt;
296 pi->end = ++fmt;
301 pi->spec = *fmt;
302 switch (pi->spec) {
309 if (pi->showsign == 0)
310 pi->showsign = ' ';
314 pi->alt = 1;
318 pi->prec = 0;
322 pi->get_prec = nextarg;
327 pi->prec *= 10;
328 pi->prec += to_digit(*fmt);
333 pi->left = 1;
337 pi->showsign = '+';
342 pi->get_width = nextarg;
349 pi->group = 1;
358 pi->pad = '0';
376 pi->width = n;
381 pi->spec += ('a' - 'A');
382 pi->is_intmax = 0;
383 if (pi->is_long_double || pi->is_quad) {
384 pi->is_long = 0;
385 pi->is_long_double = 1;
387 pi->is_long = 1;
388 pi->is_long_double = 0;
393 pi->is_intmax = 1;
397 pi->is_long = 0;
398 pi->is_quad = 1;
402 pi->is_long_double = 1;
409 pi->is_char = 1;
411 pi->is_short = 1;
418 pi->is_long_double = 1;
419 pi->is_quad = 0;
421 pi->is_quad = 0;
422 pi->is_long = 1;
426 pi->is_ptrdiff = 1;
430 pi->is_size = 1;
437 if (printf_tbl[pi->spec].arginfo == NULL)
438 errx(1, "arginfo[%c] = NULL", pi->spec);
439 ch = printf_tbl[pi->spec].arginfo(
440 pi, __PRINTFMAXARG, &argt[nextarg]);
442 pi->arg[0] = &args[nextarg];
444 pi->arg[1] = &args[nextarg + 1];
514 for (pi = pia; pi < pil; pi++) {
516 fprintf(stderr, "pi %p", pi);
517 fprintf(stderr, " spec '%c'", pi->spec);
519 ((uintptr_t)pi->arg[0] - (uintptr_t)args) / sizeof args[0]);
520 if (pi->width) fprintf(stderr, " width %d", pi->width);
521 if (pi->pad) fprintf(stderr, " pad 0x%x", pi->pad);
522 if (pi->left) fprintf(stderr, " left");
523 if (pi->showsign) fprintf(stderr, " showsign");
524 if (pi->prec != -1) fprintf(stderr, " prec %d", pi->prec);
525 if (pi->is_char) fprintf(stderr, " char");
526 if (pi->is_short) fprintf(stderr, " short");
527 if (pi->is_long) fprintf(stderr, " long");
528 if (pi->is_long_double) fprintf(stderr, " long_double");
530 fprintf(stderr, "\t\"%.*s\"\n", pi->end - pi->begin, pi->begin);
532 if (pi->get_width) {
533 pi->width = args[pi->get_width].intarg;
540 if (pi->width < 0) {
541 pi->left = 1;
542 pi->width = -pi->width;
545 if (pi->get_prec)
546 pi->prec = args[pi->get_prec].intarg;
547 ret += __printf_puts(&io, pi->begin, pi->end - pi->begin);
548 if (printf_tbl[pi->spec].gnurender != NULL) {
550 pi->sofar = ret;
551 ret += printf_tbl[pi->spec].gnurender(
552 fp, pi, (const void *)pi->arg);
553 } else if (printf_tbl[pi->spec].render != NULL) {
554 pi->sofar = ret;
555 n = printf_tbl[pi->spec].render(
556 &io, pi, (const void *)pi->arg);
561 } else if (pi->begin == pi->end)