emitting-output

Featured

Writing or converting formatted output in ripwire's C++ source — std::print/std::format via rw::emitTo, emitRaw and formatTo, which printf specifier maps to which format spec, and how to prove a conversion moved zero bytes. Use when adding any output call site, converting a printf-family one, or touching a help/legend string.

AI & Automation 1,888 stars 112 forks Updated today Apache-2.0

Install

View on GitHub

Quality Score: 93/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Emitting output in ripwire Every byte this tool prints feeds G4 (minified XML), the determinism contract, `docs/EVALS.md`'s recorded numbers, and the stored captures. Output code is therefore held to byte-exactness, not taste. ## The three primitives (`src/infra/emit.h`) | You have | Use | Why | | --- | --- | --- | | A format string **with arguments**, going to a stream | `rw::emitTo( stream, "…{}…", args )` | The choke point: `std::print` where the library has it, `std::format`+`fputs` where it does not | | **Literal text, no arguments** | `rw::emitRaw( stream, "…" )` | `std::format_string` is *consteval*; there is nothing to format, and huge literals do not compile | | A **caller-owned char buffer** | `rw::formatTo( buf, cap, "…{}…", args )` | Keeps the stack buffer — `std::format` into a `std::string` puts an allocation on hot paths (G2) | Never add a printf-family call site (`CONTRIBUTING.md` §3). Do not vendor `fmt` — the standard library has the feature, so a vendored copy is a G3 regression. ## The specifier mapping — measured, not remembered Proven byte-identical on this toolchain (218 checks; see the lane's `fmtparity.cpp`): ``` %s %u %d %zu %zd %lu %ld %llu %lld %i -> {} %.*s (precision, pointer) -> {} with std::string_view( ptr, len ) %10s -> {:>10} %-11s -> {:<11} %.9s -> {:.9} %016llx -> {:016x} %llx -> {:x} %llX -> {:X} %o -> {:o} %.3f -> {:.3f} %6.1f -> {:6.1f} %.0f -> {:.0f} %.6g -> {:.6g} %.3g -> {:.3g} ...

Details

Author
redhat-et
Repository
redhat-et/ripwire
Created
1 months ago
Last Updated
today
Language
C++
License
Apache-2.0

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category