|
libxr
1.0
Want to be the best embedded framework
|
Runtime backend that packs arguments and executes compiled format records. More...
#include <writer.hpp>
Data Structures | |
| class | ArgumentReader |
| Sequential reader for the packed runtime argument byte blob. More... | |
| class | CodeReader |
| Sequential reader for the compiled record stream. More... | |
| struct | DecimalScale |
| class | Executor |
| Per-sink bytecode executor specialized by the compiled format profile. More... | |
| struct | Spec |
| Runtime view of one decoded field specification byte group. More... | |
Static Public Member Functions | |
| template<typename Sink , typename Format , auto ArgumentOrder, typename... Args> requires OutputSink<Sink> && CompiledFormat<std::remove_cvref_t<Format>> | |
| static ErrorCode | RunArgumentOrder (Sink &sink, const Format &, Args &&... args) |
| Runs one compiled format whose runtime pack order is provided separately from the call-site argument order. | |
Private Member Functions | |
| template<OutputSink Sink, FormatProfile Profile> | |
| __attribute__ ((noinline)) static ErrorCode Execute(Sink &sink | |
| template<OutputSink Sink, auto ArgumentInfoList, auto ArgumentOrder, FormatProfile Profile, typename... Args> | |
| __attribute__ ((noinline)) static ErrorCode RunTaggedArgumentOrder(Sink &sink | |
Static Private Member Functions | |
| static constexpr bool | HasFlag (uint8_t flags, uint8_t bit) |
| Tests whether one decoded field-spec bit is set. | |
| template<typename T > | |
| static constexpr std::string_view | ToStringView (const T &text) |
| template<FormatPackKind pack, typename T > | |
| static constexpr auto | PackValue (T &&value) |
| Normalizes one matched C++ argument into the packed runtime storage kind required by one compiled argument slot. | |
| template<typename T > | |
| static void | StoreArgument (uint8_t *&out, const T &value) |
| template<auto ArgumentInfoList> | |
| static consteval size_t | PackedArgumentBytes () |
| template<auto ArgumentInfoList, auto ArgumentOrder, typename Tuple > | |
| static void | StoreArgumentsOrdered (uint8_t *&out, Tuple &tuple) |
| template<std::unsigned_integral UInt> | |
| static size_t | AppendUnsigned (char *out, UInt value, uint8_t base, bool upper_case) |
| static size_t | AppendSmallUnsigned (char *out, uint8_t value) |
| static constexpr size_t | FieldPadding (uint8_t width, size_t payload_size) |
| Returns the padding width needed to expand one payload to the requested field width. / 返回把某段载荷扩展到目标字段宽度所需的填充长度 | |
| static constexpr size_t | IntegerPrecisionZeros (const Spec &spec, size_t digit_count) |
| Returns the extra leading-zero count introduced by integer precision. / 返回整数精度引入的额外前导零个数 | |
| static constexpr uint8_t | IntegerBase (FormatType type) |
| Returns the integer radix selected by one unsigned runtime type. / 返回某个无符号运行期类型对应的整数进制 | |
| static constexpr bool | IntegerUpperCase (FormatType type) |
| Returns whether one unsigned runtime type should emit uppercase hex digits. / 判断某个无符号运行期类型是否应输出大写十六进制数字 | |
| template<std::unsigned_integral UInt> | |
| static constexpr std::string_view | IntegerPrefix (FormatType type, const Spec &spec, UInt value) |
| Returns the alternate-form prefix carried outside the digit payload. / 返回放在数字载荷之外的备用格式前缀 | |
| template<std::unsigned_integral UInt> | |
| static size_t | ApplyAlternateOctal (char *digits, size_t digit_count, const Spec &spec, UInt value) |
| Applies %#o special rules directly onto the generated digit payload. | |
| static constexpr bool | UsesFloatTextBackend (FormatType type) |
| Returns whether one runtime type is handled by the shared float text backend. / 判断某个运行期类型是否由共享浮点文本后端处理 | |
| static constexpr bool | FloatEnabled (FormatType type) |
| Returns whether one runtime float type is currently enabled by feature switches. / 判断某个运行期浮点类型是否被当前功能开关启用 | |
| static bool | AppendBufferChar (char *buffer, size_t capacity, size_t &size, char ch) |
| Appends one character to a bounded local formatting buffer. / 向有界本地格式化缓冲区追加一个字符 | |
| static bool | AppendBufferText (char *buffer, size_t capacity, size_t &size, std::string_view text) |
| Appends one text span to a bounded local formatting buffer. / 向有界本地格式化缓冲区追加一段文本 | |
| static bool | AppendBufferU32ZeroPad (char *buffer, size_t capacity, size_t &size, uint32_t value, uint8_t width) |
| Appends one uint32_t decimal value and pads leading zeros up to width. / 追加一个 uint32_t 十进制值,并在前面补零到目标宽度 | |
| static uint64_t | RoundScaledF32 (float value, uint32_t scale) |
| Returns round(value * scale) using the exact float32 bit pattern and nearest-even ties. / 基于精确 float32 位模式并按最近偶数处理平局返回 round(value * scale) | |
| template<typename Float > | |
| static Float | Power10 (int exponent) |
| template<typename Float > | |
| static DecimalScale< Float > | NormalizeDecimal (Float value) |
| Normalizes one finite positive value so that value divided by scale stays in [1, 10). / 将一个有限正值规范化,使 value 除以 scale 后落在 [1, 10) | |
| template<typename Float > | |
| static uint8_t | ExtractDigit (Float &value, Float scale) |
| Extracts one base-10 digit at the current scale while tolerating tiny FP residue. / 在当前十进制权重下提取一位数字,并容忍微小浮点残差 | |
| static size_t | TrimGeneralText (char *text, size_t size) |
| Trims trailing zeros for general float output and removes a dangling decimal point when alternate form is absent. / 在未启用备用格式时修剪通用浮点输出的尾随零,并去掉孤立小数点 | |
| static bool | FormatF32FixedPrecText (float value, uint8_t precision, char *out, size_t &out_size) |
| Fixed-only float32 formatter that uses a uint32_t scaled-fraction fast path when possible. / 仅供 float32 定点输出使用的格式化器,在可行时优先走 uint32_t 缩放小数快路径 | |
| template<typename Float > | |
| static bool | FormatFixedText (Float value, uint8_t precision, bool alternate, char *out, size_t &out_size) |
| static bool | AppendExponentText (char *out, size_t &out_size, int exponent, bool upper_case) |
| template<typename Float > | |
| static bool | FormatScientificText (Float value, uint8_t precision, bool alternate, bool upper_case, char *out, size_t &out_size) |
| template<typename Float > | |
| static bool | FormatFloatText (FormatType type, const Spec &spec, Float value, char *out, size_t &out_size) |
Private Attributes | |
| const uint8_t * | codes |
| const uint8_t const uint8_t * | args |
Static Private Attributes | |
| static constexpr uint8_t | unspecified_precision = 0xFF |
| Emits the stack argument byte blob for one compiled argument list. | |
| static constexpr size_t | float_buffer_capacity = 512 |
| template<FormatPackKind K> | |
| static constexpr bool | dependent_false_v = false |
| static constexpr float | f32_u32_overflow_limit = 4294967296.0f |
| Largest finite float32 value whose integer part still fits in uint32_t. / 整数部分仍可放入 uint32_t 的最大 float32 值上界 | |
| static constexpr std::array< uint32_t, 10 > | f32_decimal_scales_u32 |
| Decimal scales used by the narrow float32 fixed-precision fast path. / 窄 float32 定点快路径使用的十进制缩放表 | |
Runtime backend that packs arguments and executes compiled format records.
运行期后端,负责打包参数并执行编译后的格式记录。
Definition at line 28 of file writer.hpp.
|
inlinestaticnodiscardprivate |
Appends one character to a bounded local formatting buffer. / 向有界本地格式化缓冲区追加一个字符
Definition at line 508 of file writer.hpp.
|
inlinestaticnodiscardprivate |
Appends one text span to a bounded local formatting buffer. / 向有界本地格式化缓冲区追加一段文本
Definition at line 520 of file writer.hpp.
|
inlinestaticnodiscardprivate |
Appends one uint32_t decimal value and pads leading zeros up to width. / 追加一个 uint32_t 十进制值,并在前面补零到目标宽度
Definition at line 533 of file writer.hpp.
|
inlinestaticnodiscardprivate |
Definition at line 929 of file writer.hpp.
|
inlinestaticnodiscardprivate |
Definition at line 341 of file writer.hpp.
|
inlinestaticnodiscardprivate |
Definition at line 312 of file writer.hpp.
|
inlinestaticnodiscardprivate |
Applies %#o special rules directly onto the generated digit payload.
直接在已生成的数字载荷上应用 %#o 的特殊规则。
Octal alternate form differs from hex: it is represented by a leading zero in the digit payload itself, not by a detached prefix string. This helper also preserves the required single 0 when %#.0o formats zero. 八进制备用格式与十六进制不同:它通过数字载荷本体前导一个 0 来表示, 而不是额外分离出的前缀字符串。本函数也负责在 %#.0o 格式化零值时保留 必需的单个 0。
Definition at line 427 of file writer.hpp.
|
inlinestaticnodiscardprivate |
Extracts one base-10 digit at the current scale while tolerating tiny FP residue. / 在当前十进制权重下提取一位数字,并容忍微小浮点残差
Definition at line 660 of file writer.hpp.
|
inlinestaticnodiscardconstexprprivate |
Returns the padding width needed to expand one payload to the requested field width. / 返回把某段载荷扩展到目标字段宽度所需的填充长度
Definition at line 347 of file writer.hpp.
|
inlinestaticnodiscardconstexprprivate |
Returns whether one runtime float type is currently enabled by feature switches. / 判断某个运行期浮点类型是否被当前功能开关启用
Definition at line 480 of file writer.hpp.
|
inlinestaticnodiscardprivate |
Fixed-only float32 formatter that uses a uint32_t scaled-fraction fast path when possible. / 仅供 float32 定点输出使用的格式化器,在可行时优先走 uint32_t 缩放小数快路径
Definition at line 716 of file writer.hpp.
|
inlinestaticnodiscardprivate |
Definition at line 887 of file writer.hpp.
|
inlinestaticnodiscardprivate |
Definition at line 1004 of file writer.hpp.
|
inlinestaticnodiscardprivate |
Definition at line 958 of file writer.hpp.
|
inlinestaticnodiscardconstexprprivate |
Tests whether one decoded field-spec bit is set.
判断某个已解码字段修饰位是否被设置。
Definition at line 87 of file writer.hpp.
|
inlinestaticnodiscardconstexprprivate |
Returns the integer radix selected by one unsigned runtime type. / 返回某个无符号运行期类型对应的整数进制
Definition at line 362 of file writer.hpp.
|
inlinestaticnodiscardconstexprprivate |
Returns the extra leading-zero count introduced by integer precision. / 返回整数精度引入的额外前导零个数
Definition at line 353 of file writer.hpp.
|
inlinestaticnodiscardconstexprprivate |
Returns the alternate-form prefix carried outside the digit payload. / 返回放在数字载荷之外的备用格式前缀
Definition at line 393 of file writer.hpp.
|
inlinestaticnodiscardconstexprprivate |
Returns whether one unsigned runtime type should emit uppercase hex digits. / 判断某个无符号运行期类型是否应输出大写十六进制数字
Definition at line 386 of file writer.hpp.
|
inlinestaticnodiscardprivate |
Normalizes one finite positive value so that value divided by scale stays in [1, 10). / 将一个有限正值规范化,使 value 除以 scale 后落在 [1, 10)
Definition at line 625 of file writer.hpp.
|
inlinestaticnodiscardconstevalprivate |
Definition at line 291 of file writer.hpp.
|
inlinestaticnodiscardconstexprprivate |
Normalizes one matched C++ argument into the packed runtime storage kind required by one compiled argument slot.
将一个已匹配的 C++ 实参归一化为某个编译参数槽要求的运行期打包存储类型。
Definition at line 183 of file writer.hpp.
|
inlinestaticnodiscardprivate |
Definition at line 592 of file writer.hpp.
|
inlinestaticnodiscardprivate |
Returns round(value * scale) using the exact float32 bit pattern and nearest-even ties. / 基于精确 float32 位模式并按最近偶数处理平局返回 round(value * scale)
Definition at line 553 of file writer.hpp.
|
inlinestaticnodiscard |
Runs one compiled format whose runtime pack order is provided separately from the call-site argument order.
执行一份已编译格式;其运行期打包顺序由独立的编译期参数顺序表提供。
This is used by brace-style frontends that allow repeated or reordered argument references such as {1} {0} while keeping the runtime bytecode stream itself strictly source-ordered. 该接口用于 brace 风格前端:它允许 {1} {0} 这种重复或重排参数引用, 同时保持运行期字节码流本身仍然严格按源串顺序执行。
Definition at line 44 of file writer.hpp.
|
inlinestaticprivate |
Definition at line 284 of file writer.hpp.
|
inlinestaticprivate |
Definition at line 302 of file writer.hpp.
|
inlinestaticnodiscardconstexprprivate |
Definition at line 146 of file writer.hpp.
|
inlinestaticnodiscardprivate |
Trims trailing zeros for general float output and removes a dangling decimal point when alternate form is absent. / 在未启用备用格式时修剪通用浮点输出的尾随零,并去掉孤立小数点
Definition at line 684 of file writer.hpp.
|
inlinestaticnodiscardconstexprprivate |
Returns whether one runtime type is handled by the shared float text backend. / 判断某个运行期类型是否由共享浮点文本后端处理
Definition at line 460 of file writer.hpp.
|
private |
Definition at line 1079 of file writer.hpp.
|
private |
Definition at line 1079 of file writer.hpp.
|
staticconstexprprivate |
Definition at line 66 of file writer.hpp.
|
inlinestaticconstexprprivate |
Decimal scales used by the narrow float32 fixed-precision fast path. / 窄 float32 定点快路径使用的十进制缩放表
Definition at line 70 of file writer.hpp.
|
staticconstexprprivate |
Largest finite float32 value whose integer part still fits in uint32_t. / 整数部分仍可放入 uint32_t 的最大 float32 值上界
Definition at line 68 of file writer.hpp.
|
staticconstexprprivate |
Definition at line 64 of file writer.hpp.
|
staticconstexprprivate |
Emits the stack argument byte blob for one compiled argument list.
为某个已编译参数列表生成栈上参数字节块。
Definition at line 63 of file writer.hpp.