• Home
  • Raw
  • Download

Lines Matching refs:spec

277 	     struct printf_spec spec)  in number()  argument
284 int need_pfx = ((spec.flags & SPECIAL) && spec.base != 10); in number()
289 if (i < spec.field_width) in number()
290 i = spec.field_width; in number()
298 if (spec.flags & SIGN) { in number()
302 spec.field_width--; in number()
312 spec.field_width--; in number()
313 if (spec.base == 16) in number()
314 spec.field_width--; in number()
319 if (num < spec.base) in number()
326 else if (spec.base != 10) { /* 8 or 16 */ in number()
327 int mask = spec.base - 1; in number()
330 if (spec.base == 16) in number()
346 spec.field_width -= i; in number()
347 if (!(spec.flags & (ZEROPAD+LEFT))) { in number()
348 while (--spec.field_width >= 0) { in number()
365 if (spec.base == 16) { in number()
372 if (!(spec.flags & LEFT)) { in number()
373 char c = (spec.flags & ZEROPAD) ? '0' : ' '; in number()
374 while (--spec.field_width >= 0) { in number()
393 while (--spec.field_width >= 0) { in number()
403 char *string(char *buf, char *end, const char *s, struct printf_spec spec) in string() argument
410 len = strnlen(s, spec.precision); in string()
414 if (i < spec.field_width) in string()
415 i = spec.field_width; in string()
419 if (!(spec.flags & LEFT)) { in string()
420 while (len < spec.field_width--) { in string()
431 while (len < spec.field_width--) { in string()
442 struct printf_spec spec) in pointer() argument
445 if (spec.field_width == -1) { in pointer()
446 spec.field_width = 2 * sizeof(void *); in pointer()
447 spec.flags |= ZEROPAD; in pointer()
449 spec.base = 16; in pointer()
451 return number(buf, end, (unsigned long) ptr, spec); in pointer()
475 int format_decode(const char *fmt, struct printf_spec *spec) in format_decode() argument
480 if (spec->type == FORMAT_TYPE_WIDTH) { in format_decode()
481 if (spec->field_width < 0) { in format_decode()
482 spec->field_width = -spec->field_width; in format_decode()
483 spec->flags |= LEFT; in format_decode()
485 spec->type = FORMAT_TYPE_NONE; in format_decode()
490 if (spec->type == FORMAT_TYPE_PRECISION) { in format_decode()
491 if (spec->precision < 0) in format_decode()
492 spec->precision = 0; in format_decode()
494 spec->type = FORMAT_TYPE_NONE; in format_decode()
499 spec->type = FORMAT_TYPE_NONE; in format_decode()
514 spec->flags = 0; in format_decode()
522 case '-': spec->flags |= LEFT; break; in format_decode()
525 case '#': spec->flags |= SPECIAL; break; in format_decode()
526 case '0': spec->flags |= ZEROPAD; break; in format_decode()
535 spec->field_width = -1; in format_decode()
538 spec->field_width = skip_atoi(&fmt); in format_decode()
541 spec->type = FORMAT_TYPE_WIDTH; in format_decode()
547 spec->precision = -1; in format_decode()
551 spec->precision = skip_atoi(&fmt); in format_decode()
556 spec->type = FORMAT_TYPE_PRECISION; in format_decode()
563 spec->qualifier = -1; in format_decode()
565 spec->qualifier = *fmt++; in format_decode()
566 if (unlikely(spec->qualifier == *fmt)) { in format_decode()
567 spec->qualifier = 'L'; in format_decode()
573 spec->base = 10; in format_decode()
576 spec->type = FORMAT_TYPE_CHAR; in format_decode()
580 spec->type = FORMAT_TYPE_STR; in format_decode()
584 spec->type = FORMAT_TYPE_PTR; in format_decode()
588 spec->type = FORMAT_TYPE_PERCENT_CHAR; in format_decode()
593 spec->base = 8; in format_decode()
600 spec->base = 16; in format_decode()
605 spec->flags |= SIGN; in format_decode()
610 spec->type = FORMAT_TYPE_INVALID; in format_decode()
614 if (spec->qualifier == 'L') in format_decode()
615 spec->type = FORMAT_TYPE_LONG_LONG; in format_decode()
616 else if (spec->qualifier == 'l') { in format_decode()
617 if (spec->flags & SIGN) in format_decode()
618 spec->type = FORMAT_TYPE_LONG; in format_decode()
620 spec->type = FORMAT_TYPE_ULONG; in format_decode()
622 if (spec->flags & SIGN) in format_decode()
623 spec->type = FORMAT_TYPE_INT; in format_decode()
625 spec->type = FORMAT_TYPE_UINT; in format_decode()
653 struct printf_spec spec = {0}; in kernel_vsnprintf() local
660 int read = format_decode(fmt, &spec); in kernel_vsnprintf()
664 switch (spec.type) { in kernel_vsnprintf()
677 spec.field_width = va_arg(args, int); in kernel_vsnprintf()
681 spec.precision = va_arg(args, int); in kernel_vsnprintf()
687 if (!(spec.flags & LEFT)) { in kernel_vsnprintf()
688 while (--spec.field_width > 0) { in kernel_vsnprintf()
699 while (--spec.field_width > 0) { in kernel_vsnprintf()
708 str = string(str, end, va_arg(args, char *), spec); in kernel_vsnprintf()
713 spec); in kernel_vsnprintf()
731 switch (spec.type) { in kernel_vsnprintf()
748 str = number(str, end, num, spec); in kernel_vsnprintf()