Namespaces

Enumerations

enum PrintfNewline
Name Value
kNo 0
kYes 1

This provides a handy generic wrapper for using the printf core with an

arbitrary int(std::string_view) callable object.

Defined at line 18 of file ../../sdk/lib/c/stdio/printf_core/wrapper.h

enum WriteMode
Name Value
FILL_BUFF_AND_DROP_OVERFLOW 0
FLUSH_TO_STREAM 1
RESIZE_AND_FILL_BUFF 2
RUNTIME_DISPATCH 3

Defined at line 24 of file ../../third_party/llvm-libc/src/src/stdio/printf_core/writer.h

enum LengthModifier
Name Value
hh 0
h 1
l 2
ll 3
j 4
z 5
t 6
L 7
w 8
wf 9
none 10

These length modifiers match the length modifiers in the format string, which

is why they are formatted differently from the rest of the file.

Defined at line 27 of file ../../third_party/llvm-libc/src/src/stdio/printf_core/core_structs.h

enum FormatFlags
Name Value
LEFT_JUSTIFIED 0x01
FORCE_SIGN 0x02
SPACE_PREFIX 0x04
ALTERNATE_FORM 0x08
LEADING_ZEROES 0x10

Defined at line 34 of file ../../third_party/llvm-libc/src/src/stdio/printf_core/core_structs.h

enum RoundDirection
Name Value
Up 0
Down 1
Even 2

This is used to represent which direction the number should be rounded.

Defined at line 70 of file ../../third_party/llvm-libc/src/src/stdio/printf_core/converter_utils.h

enum PrimaryType
Name Value
Unknown 0
Float 1
Pointer 2
Integer 3
FixedPoint 4

Defined at line 96 of file ../../third_party/llvm-libc/src/src/stdio/printf_core/core_structs.h

Records

Functions

  • int PrintfImpl (int (*)(std::string_view, void *) write, void * hook, std::span<char> buffer, PrintfNewline newline, const char * format, va_list args)

    Defined at line 14 of file ../../sdk/lib/c/stdio/printf_core/wrapper.cc

  • int PrintfImpl (int (*)(std::string_view, void *) write, void * hook, std::span<char> buffer, PrintfNewline newline, const char * format, va_list args)

    Defined at line 14 of file ../../sdk/lib/c/stdio/printf_core/wrapper.cc

  • Writer<WriteMode::FILL_BUFF_AND_DROP_OVERFLOW> <deduction guide for Writer> (WriteBuffer<WriteMode::FILL_BUFF_AND_DROP_OVERFLOW> )

    Class-template auto deduction helpers.

  • Writer<WriteMode::RESIZE_AND_FILL_BUFF> <deduction guide for Writer> (WriteBuffer<WriteMode::RESIZE_AND_FILL_BUFF> )
  • Writer<WriteMode::FLUSH_TO_STREAM> <deduction guide for Writer> (WriteBuffer<WriteMode::FLUSH_TO_STREAM> )
  • FloatWriter<WriteMode::FILL_BUFF_AND_DROP_OVERFLOW> <deduction guide for FloatWriter> (Writer<WriteMode::FILL_BUFF_AND_DROP_OVERFLOW> , bool , const PaddingWriter<WriteMode::FILL_BUFF_AND_DROP_OVERFLOW> )

    Class-template auto deduction helpers, add more if needed.

  • FloatWriter<WriteMode::RESIZE_AND_FILL_BUFF> <deduction guide for FloatWriter> (Writer<WriteMode::RESIZE_AND_FILL_BUFF> , bool , const PaddingWriter<WriteMode::RESIZE_AND_FILL_BUFF> )
  • FloatWriter<WriteMode::FLUSH_TO_STREAM> <deduction guide for FloatWriter> (Writer<WriteMode::FLUSH_TO_STREAM> , bool , const PaddingWriter<WriteMode::FLUSH_TO_STREAM> )
  • template <WriteMode write_mode>
    int convert_pointer (Writer<write_mode> * writer, const FormatSection & to_conv)

    Defined at line 22 of file ../../third_party/llvm-libc/src/src/stdio/printf_core/ptr_converter.h

  • uintmax_t apply_length_modifier (uintmax_t num, LengthSpec length_spec)

    Defined at line 22 of file ../../third_party/llvm-libc/src/src/stdio/printf_core/converter_utils.h

  • uintmax_t apply_length_modifier (uintmax_t num, LengthSpec length_spec)

    Defined at line 22 of file ../../third_party/llvm-libc/src/src/stdio/printf_core/converter_utils.h

  • template <WriteMode write_mode>
    int convert_strerror (Writer<write_mode> * writer, const FormatSection & to_conv)

    Defined at line 23 of file ../../third_party/llvm-libc/src/src/stdio/printf_core/strerror_converter.h

  • template <WriteMode write_mode>
    int convert_string (Writer<write_mode> * writer, const FormatSection & to_conv)

    Defined at line 24 of file ../../third_party/llvm-libc/src/src/stdio/printf_core/string_converter.h

  • template <size_t BufferSize, PrintfNewline AddNewline = PrintfNewline::kNo, typename T>
    int Printf (T && write, const char * format, va_list args)

    Defined at line 24 of file ../../sdk/lib/c/stdio/printf_core/wrapper.h

  • template <size_t BufferSize, PrintfNewline AddNewline = PrintfNewline::kNo, typename T>
    int Printf (T && write, const char * format, va_list args)

    Defined at line 24 of file ../../sdk/lib/c/stdio/printf_core/wrapper.h

  • template <WriteMode write_mode>
    ErrorOr<size_t> printf_main (Writer<write_mode> * writer, const char *__restrict str, internal::ArgList & args)

    Defined at line 26 of file ../../third_party/llvm-libc/src/src/stdio/printf_core/printf_main.h

  • template <WriteMode write_mode>
    ErrorOr<size_t> printf_main (Writer<write_mode> * writer, const char *__restrict str, internal::ArgList & args)

    Defined at line 26 of file ../../third_party/llvm-libc/src/src/stdio/printf_core/printf_main.h

  • template <WriteMode write_mode>
    int convert_inf_nan (Writer<write_mode> * writer, const FormatSection & to_conv)

    Defined at line 28 of file ../../third_party/llvm-libc/src/src/stdio/printf_core/float_inf_nan_converter.h

  • template <WriteMode write_mode>
    int convert_float_hex_exp (Writer<write_mode> * writer, const FormatSection & to_conv)

    Defined at line 29 of file ../../third_party/llvm-libc/src/src/stdio/printf_core/float_hex_converter.h

  • template <WriteMode write_mode>
    int convert_char (Writer<write_mode> * writer, const FormatSection & to_conv)

    Defined at line 30 of file ../../third_party/llvm-libc/src/src/stdio/printf_core/char_converter.h

  • template <WriteMode write_mode>
    int convert (Writer<write_mode> * writer, const FormatSection & to_conv)

    convert will call a conversion function to convert the FormatSection into

    its string representation, and then that will write the result to the

    writer.

    Defined at line 35 of file ../../third_party/llvm-libc/src/src/stdio/printf_core/converter.h

  • template <typename T>
    cpp::enable_if_t<cpp::is_integral_v<T> || is_big_int_v<T>, bool> multiple_of_power_of_2 (T value, uint32_t p)

    Returns true if value is divisible by 2^p.

    Defined at line 39 of file ../../third_party/llvm-libc/src/src/stdio/printf_core/float_dec_converter.h

  • RoundDirection get_round_direction (int last_digit, bool truncated, Sign sign)

    Defined at line 52 of file ../../third_party/llvm-libc/src/src/stdio/printf_core/float_dec_converter.h

  • template <WriteMode write_mode>
    int convert_int (Writer<write_mode> * writer, const FormatSection & to_conv)

    Defined at line 65 of file ../../third_party/llvm-libc/src/src/stdio/printf_core/int_converter.h

  • template <size_t BufferSize, PrintfNewline AddNewline = PrintfNewline::kNo, typename T>
    int Printf (T && write, const char * format)

    Defined at line 82 of file ../../sdk/lib/c/stdio/printf_core/wrapper.h

  • template <size_t BufferSize, PrintfNewline AddNewline = PrintfNewline::kNo, typename T>
    int Printf (T && write, const char * format)

    Defined at line 82 of file ../../sdk/lib/c/stdio/printf_core/wrapper.h

  • template <typename T>
    cpp::enable_if_t<cpp::is_integral_v<T> || is_big_int_v<T>, bool> zero_after_digits (int32_t base_2_exp, int32_t digits_after_point, T mantissa, const int32_t mant_width)

    Defined at line 83 of file ../../third_party/llvm-libc/src/src/stdio/printf_core/float_dec_converter.h

  • template <size_t BufferSize, PrintfNewline AddNewline = PrintfNewline::kNo, typename T>
    auto MakePrintf (T write)

    This returns a move-only lambda the argument is moved into.

    Calling it with ... calls Printf(write, ...).

    Defined at line 93 of file ../../sdk/lib/c/stdio/printf_core/wrapper.h

  • template <size_t BufferSize, PrintfNewline AddNewline = PrintfNewline::kNo, typename T>
    auto MakePrintf (T write)

    This returns a move-only lambda the argument is moved into.

    Calling it with ... calls Printf(write, ...).

    Defined at line 93 of file ../../sdk/lib/c/stdio/printf_core/wrapper.h

  • template <typename T>
    TypeDesc type_desc_from_type ()

    Defined at line 114 of file ../../third_party/llvm-libc/src/src/stdio/printf_core/core_structs.h

  • template <typename T, WriteMode write_mode, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
    int convert_float_decimal_typed (Writer<write_mode> * writer, const FormatSection & to_conv, fputil::FPBits<T> float_bits)

    This implementation is based on the Ryu Printf algorithm by Ulf Adams:

    Ulf Adams. 2019. Ryƫ revisited: printf floating point conversion.

    Proc. ACM Program. Lang. 3, OOPSLA, Article 169 (October 2019), 23 pages.

    https://doi.org/10.1145/3360595

    Defined at line 488 of file ../../third_party/llvm-libc/src/src/stdio/printf_core/float_dec_converter.h

  • template <typename T, WriteMode write_mode, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
    int convert_float_dec_exp_typed (Writer<write_mode> * writer, const FormatSection & to_conv, fputil::FPBits<T> float_bits)

    Defined at line 598 of file ../../third_party/llvm-libc/src/src/stdio/printf_core/float_dec_converter.h

  • template <typename T, WriteMode write_mode, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
    int convert_float_dec_auto_typed (Writer<write_mode> * writer, const FormatSection & to_conv, fputil::FPBits<T> float_bits)

    Defined at line 760 of file ../../third_party/llvm-libc/src/src/stdio/printf_core/float_dec_converter.h

  • template <WriteMode write_mode>
    int convert_float_decimal (Writer<write_mode> * writer, const FormatSection & to_conv)

    TODO: unify the float converters to remove the duplicated checks for inf/nan.

    Defined at line 1128 of file ../../third_party/llvm-libc/src/src/stdio/printf_core/float_dec_converter.h

  • template <WriteMode write_mode>
    int convert_float_dec_exp (Writer<write_mode> * writer, const FormatSection & to_conv)

    Defined at line 1150 of file ../../third_party/llvm-libc/src/src/stdio/printf_core/float_dec_converter.h

  • template <WriteMode write_mode>
    int convert_float_dec_auto (Writer<write_mode> * writerconst FormatSection & to_conv)

    Defined at line 1172 of file ../../third_party/llvm-libc/src/src/stdio/printf_core/float_dec_converter.h