Lines Matching refs:conv
339 static inline const char *extract_flags(struct conversion *conv, in extract_flags() argument
347 conv->flag_dash = true; in extract_flags()
350 conv->flag_plus = true; in extract_flags()
353 conv->flag_space = true; in extract_flags()
356 conv->flag_hash = true; in extract_flags()
359 conv->flag_zero = true; in extract_flags()
370 if (conv->flag_zero && conv->flag_dash) { in extract_flags()
371 conv->flag_zero = false; in extract_flags()
388 static inline const char *extract_width(struct conversion *conv, in extract_width() argument
391 conv->width_present = true; in extract_width()
394 conv->width_star = true; in extract_width()
402 conv->width_present = true; in extract_width()
403 conv->width_value = width; in extract_width()
404 conv->unsupported |= ((conv->width_value < 0) in extract_width()
405 || (width != (size_t)conv->width_value)); in extract_width()
420 static inline const char *extract_prec(struct conversion *conv, in extract_prec() argument
423 conv->prec_present = (*sp == '.'); in extract_prec()
425 if (!conv->prec_present) { in extract_prec()
431 conv->prec_star = true; in extract_prec()
437 conv->prec_value = prec; in extract_prec()
438 conv->unsupported |= ((conv->prec_value < 0) in extract_prec()
439 || (prec != (size_t)conv->prec_value)); in extract_prec()
453 static inline const char *extract_length(struct conversion *conv, in extract_length() argument
459 conv->length_mod = LENGTH_HH; in extract_length()
462 conv->length_mod = LENGTH_H; in extract_length()
467 conv->length_mod = LENGTH_LL; in extract_length()
470 conv->length_mod = LENGTH_L; in extract_length()
474 conv->length_mod = LENGTH_J; in extract_length()
478 conv->length_mod = LENGTH_Z; in extract_length()
482 conv->length_mod = LENGTH_T; in extract_length()
486 conv->length_mod = LENGTH_UPPER_L; in extract_length()
492 conv->unsupported = true; in extract_length()
495 conv->length_mod = LENGTH_NONE; in extract_length()
513 static inline const char *extract_specifier(struct conversion *conv, in extract_specifier() argument
518 conv->specifier = *sp; in extract_specifier()
521 switch (conv->specifier) { in extract_specifier()
523 conv->specifier_cat = SPECIFIER_SINT; in extract_specifier()
526 conv->specifier_cat = SPECIFIER_UINT; in extract_specifier()
529 if (conv->length_mod == LENGTH_UPPER_L) { in extract_specifier()
530 conv->invalid = true; in extract_specifier()
536 if (conv->specifier == 'c') { in extract_specifier()
537 unsupported = (conv->length_mod != LENGTH_NONE); in extract_specifier()
542 switch (conv->length_mod) { in extract_specifier()
571 conv->specifier_cat = SPECIFIER_FP; in extract_specifier()
580 conv->specifier_a = (conv->specifier == 'a') in extract_specifier()
581 || (conv->specifier == 'A'); in extract_specifier()
582 if (conv->specifier_a in extract_specifier()
591 if (conv->length_mod == LENGTH_L) { in extract_specifier()
592 conv->length_mod = LENGTH_NONE; in extract_specifier()
593 } else if ((conv->length_mod != LENGTH_NONE) in extract_specifier()
594 && (conv->length_mod != LENGTH_UPPER_L)) { in extract_specifier()
595 conv->invalid = true; in extract_specifier()
604 conv->specifier_cat = SPECIFIER_PTR; in extract_specifier()
606 if (conv->length_mod == LENGTH_UPPER_L) { in extract_specifier()
613 conv->specifier_cat = SPECIFIER_PTR; in extract_specifier()
620 if (conv->length_mod != LENGTH_NONE) { in extract_specifier()
626 conv->invalid = true; in extract_specifier()
630 conv->unsupported |= unsupported; in extract_specifier()
643 static inline const char *extract_conversion(struct conversion *conv, in extract_conversion() argument
646 *conv = (struct conversion) { in extract_conversion()
656 conv->specifier = *sp; in extract_conversion()
661 sp = extract_flags(conv, sp); in extract_conversion()
662 sp = extract_width(conv, sp); in extract_conversion()
663 sp = extract_prec(conv, sp); in extract_conversion()
664 sp = extract_length(conv, sp); in extract_conversion()
665 sp = extract_specifier(conv, sp); in extract_conversion()
791 struct conversion *conv, in encode_uint() argument
795 bool upcase = isupper((int)conv->specifier) != 0; in encode_uint()
796 const unsigned int radix = conversion_radix(conv->specifier); in encode_uint()
811 if (conv->flag_hash) { in encode_uint()
813 conv->altform_0 = true; in encode_uint()
815 conv->altform_0c = true; in encode_uint()
870 struct conversion *conv, in encode_float() argument
890 } else if (conv->flag_plus) { in encode_float()
892 } else if (conv->flag_space) { in encode_float()
901 char c = conv->specifier; in encode_float()
937 conv->flag_zero = false; in encode_float()
951 || conv->specifier_a)) { in encode_float()
977 if (!(conv->specifier_a && conv->prec_present)) { in encode_float()
981 conv->pad0_pre_exp = precision - FRACTION_HEX; in encode_float()
982 conv->pad_fp = true; in encode_float()
1000 bool require_dp = ((fract != 0) || conv->flag_hash); in encode_float()
1159 if (!conv->flag_hash && (precision > 0)) { in encode_float()
1201 conv->pad0_value = decexp; in encode_float()
1212 if (conv->flag_hash || (precision > 0)) { in encode_float()
1218 conv->pad0_value = -decexp; in encode_float()
1219 if (conv->pad0_value > precision) { in encode_float()
1220 conv->pad0_value = precision; in encode_float()
1223 precision -= conv->pad0_value; in encode_float()
1224 conv->pad_postdp = (conv->pad0_value > 0); in encode_float()
1238 if (conv->flag_hash || (precision > 0)) { in encode_float()
1250 conv->pad0_pre_exp = precision; in encode_float()
1253 conv->pad0_pre_exp = 0; in encode_float()
1288 conv->pad_fp = (conv->pad0_value > 0) in encode_float()
1289 || (conv->pad0_pre_exp > 0); in encode_float()
1309 static inline void store_count(const struct conversion *conv, in store_count() argument
1313 switch ((enum length_mod_enum)conv->length_mod) { in store_count()
1419 struct conversion conv; in z_cbvprintf_impl() member
1425 struct conversion *const conv = &state.conv; in z_cbvprintf_impl() local
1434 fp = extract_conversion(conv, sp); in z_cbvprintf_impl()
1436 if (conv->specifier_cat != SPECIFIER_INVALID) { in z_cbvprintf_impl()
1449 if (conv->width_star) { in z_cbvprintf_impl()
1453 conv->flag_dash = true; in z_cbvprintf_impl()
1456 } else if (conv->width_present) { in z_cbvprintf_impl()
1457 width = conv->width_value; in z_cbvprintf_impl()
1466 if (conv->prec_star) { in z_cbvprintf_impl()
1470 conv->prec_present = false; in z_cbvprintf_impl()
1474 } else if (conv->prec_present) { in z_cbvprintf_impl()
1475 precision = conv->prec_value; in z_cbvprintf_impl()
1483 conv->pad0_value = 0; in z_cbvprintf_impl()
1484 conv->pad0_pre_exp = 0; in z_cbvprintf_impl()
1488 && (conv->specifier_cat == SPECIFIER_FP) in z_cbvprintf_impl()
1489 && !conv->prec_present) { in z_cbvprintf_impl()
1490 if (conv->specifier_a) { in z_cbvprintf_impl()
1504 = (enum specifier_cat_enum)conv->specifier_cat; in z_cbvprintf_impl()
1506 = (enum length_mod_enum)conv->length_mod; in z_cbvprintf_impl()
1523 && (conv->specifier == 'c')) { in z_cbvprintf_impl()
1566 && (conv->specifier == 'c')) { in z_cbvprintf_impl()
1609 if (conv->invalid || conv->unsupported) { in z_cbvprintf_impl()
1617 switch (conv->specifier) { in z_cbvprintf_impl()
1643 bps = encode_uint((uintptr_t)value->ptr, conv, in z_cbvprintf_impl()
1647 conv->altform_0c = true; in z_cbvprintf_impl()
1648 conv->specifier = 'x'; in z_cbvprintf_impl()
1664 if (conv->flag_plus) { in z_cbvprintf_impl()
1666 } else if (conv->flag_space) { in z_cbvprintf_impl()
1687 bps = encode_uint(value->uint, conv, buf, bpe); in z_cbvprintf_impl()
1701 conv->flag_zero = false; in z_cbvprintf_impl()
1705 conv->pad0_value = precision - (int)len; in z_cbvprintf_impl()
1712 store_count(conv, value->ptr, count); in z_cbvprintf_impl()
1719 bps = encode_float(value->dbl, conv, precision, in z_cbvprintf_impl()
1764 if (conv->altform_0c) { in z_cbvprintf_impl()
1766 } else if (conv->altform_0) { in z_cbvprintf_impl()
1770 nj_len += conv->pad0_value; in z_cbvprintf_impl()
1771 if (conv->pad_fp) { in z_cbvprintf_impl()
1772 nj_len += conv->pad0_pre_exp; in z_cbvprintf_impl()
1785 if (!conv->flag_dash) { in z_cbvprintf_impl()
1791 if (conv->flag_zero) { in z_cbvprintf_impl()
1812 if (IS_ENABLED(CONFIG_CBPRINTF_FP_SUPPORT) && conv->pad_fp) { in z_cbvprintf_impl()
1815 if (conv->specifier_a) { in z_cbvprintf_impl()
1827 pad_len = conv->pad0_value; in z_cbvprintf_impl()
1828 if (!conv->pad_postdp) { in z_cbvprintf_impl()
1850 pad_len = conv->pad0_pre_exp; in z_cbvprintf_impl()
1857 if ((conv->altform_0c | conv->altform_0) != 0) { in z_cbvprintf_impl()
1861 if (conv->altform_0c) { in z_cbvprintf_impl()
1862 OUTC(conv->specifier); in z_cbvprintf_impl()
1865 pad_len = conv->pad0_value; in z_cbvprintf_impl()