|
libxr
1.0
Want to be the best embedded framework
|
Shared compile-time backend that lowers frontend text/field events into one final compiled format. More...
#include <format_compile.hpp>
Data Structures | |
| struct | ResultData |
| Final tightly-sized compiled format emitted by this backend instance. More... | |
| struct | ScratchBuilder |
| Single-pass scratch builder driven directly by frontend events. More... | |
Static Public Member Functions | |
| static consteval auto | Compile () |
| Compiles the frontend into one final compiled format. | |
Private Types | |
| using | Error = typename Frontend::ErrorType |
| template<size_t BlobBytes, size_t ArgCount> | |
| using | Result = ResultData<BlobBytes, ArgCount> |
Static Private Member Functions | |
| static consteval void | EmitByte (auto &data, size_t &out, uint8_t value) |
| template<typename T > | |
| static consteval void | EmitNative (auto &data, size_t &out, T value) |
| template<typename T > | |
| static consteval T | ReadNative (const auto &data, size_t &pos) |
| static consteval auto | Failed (Error error) |
| static consteval FormatProfile | ProfileForOp (FormatOp op) |
| Maps one opcode family to the runtime executor profile bit it requires. | |
| static consteval FormatOp | FastFieldOp (const FormatField &field) |
| Chooses the narrowest opcode that preserves one normalized field's behavior. | |
Static Private Attributes | |
| static constexpr size_t | inline_text_limit = 2 * sizeof(size_t) - 1 |
| Maximum inline literal size before the backend spills to TextRef. / 超过该长度后,字面文本会从内嵌模式切换为 TextRef. | |
| static constexpr size_t | max_code_bytes = 3 * Frontend::SourceSize() + 1 |
| static constexpr size_t | max_text_pool_bytes = Frontend::SourceSize() |
| static constexpr size_t | max_arg_count = Frontend::SourceSize() |
| static constexpr uint8_t | unspecified_precision |
Shared compile-time backend that lowers frontend text/field events into one final compiled format.
共享编译期后端,将前端产生的文本/字段事件直接降为最终编译格式。
Frontend contract: The frontend must provide the members using ErrorType, static constexpr const char* SourceData(), static constexpr size_t SourceSize(), and static consteval ErrorType Walk(visitor). 前端协议: 前端必须提供如下成员:using ErrorType、static constexpr const char* SourceData()、static constexpr size_t SourceSize()、以及 static consteval ErrorType Walk(visitor)。
Walk(visitor) must emit source-ordered events through visitor.Text(offset, text_size) and visitor.Field(const FormatField&). Walk(visitor) 必须按源串顺序通过 visitor.Text(offset, text_size) 与 visitor.Field(const FormatField&) 发射事件。
The shared backend now walks the frontend exactly once. During that walk it accumulates code bytes, text-pool bytes, argument metadata, and packed-argument layout into one scratch builder, then materializes the final tightly-sized result in one local finalize step. 共享后端现在只遍历前端一次:遍历时同步累积码流、文本池、参数元信息与参数打包布局, 然后在本地收尾阶段生成最终精确尺寸结果。
Definition at line 42 of file format_compile.hpp.
|
private |
Definition at line 49 of file format_compile.hpp.
|
private |
Definition at line 71 of file format_compile.hpp.
|
inlinestaticnodiscardconsteval |
Compiles the frontend into one final compiled format.
将前端编译为一份最终编译格式。
Definition at line 412 of file format_compile.hpp.
|
inlinestaticconstevalprivate |
Definition at line 91 of file format_compile.hpp.
|
inlinestaticconstevalprivate |
Definition at line 97 of file format_compile.hpp.
|
inlinestaticnodiscardconstevalprivate |
Definition at line 117 of file format_compile.hpp.
|
inlinestaticnodiscardconstevalprivate |
Chooses the narrowest opcode that preserves one normalized field's behavior.
为一个规范化字段选择在行为不变前提下最窄的操作码。
Definition at line 157 of file format_compile.hpp.
|
inlinestaticnodiscardconstevalprivate |
Maps one opcode family to the runtime executor profile bit it requires.
将一个操作码族映射到它所需的运行期执行器 profile 位。
Definition at line 128 of file format_compile.hpp.
|
inlinestaticnodiscardconstevalprivate |
Definition at line 107 of file format_compile.hpp.
|
staticconstexprprivate |
Maximum inline literal size before the backend spills to TextRef. / 超过该长度后,字面文本会从内嵌模式切换为 TextRef.
Definition at line 74 of file format_compile.hpp.
|
staticconstexprprivate |
Definition at line 87 of file format_compile.hpp.
|
staticconstexprprivate |
Definition at line 85 of file format_compile.hpp.
|
staticconstexprprivate |
Definition at line 86 of file format_compile.hpp.
|
staticconstexprprivate |
Definition at line 88 of file format_compile.hpp.