FmtInfo
Description
Stores formatting information for text output.
align : Text alignment (left, right, center). width : Minimum field width. precision : Number of decimal places for floating point. flags : Format flags (see FormatFlags enum).
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Io.h:101:
FormatFlags flags;
u32 max_read_len;
} FmtInfo;
///
- In
Io.h:108:
/// TAGS: I/O, Callback, Generic
///
typedef bool (*TypeSpecificWriter)(Str *o, FmtInfo *fmt_info, void *data);
///
- In
Io.h:115:
/// TAGS: I/O, Callback, Generic
///
typedef Zstr (*TypeSpecificReader)(Zstr i, FmtInfo *fmt_info, void *data);
///
- In
Io.h:736:
// not for direct use
bool _write_Str(Str *o, FmtInfo *fmt_info, Str *s);
bool _write_Buf(Str *o, FmtInfo *fmt_info, Buf *b);
bool _write_DateTime(Str *o, FmtInfo *fmt_info, DateTime *dt);- In
Io.h:737:
// not for direct use
bool _write_Str(Str *o, FmtInfo *fmt_info, Str *s);
bool _write_Buf(Str *o, FmtInfo *fmt_info, Buf *b);
bool _write_DateTime(Str *o, FmtInfo *fmt_info, DateTime *dt);
bool _write_u8(Str *o, FmtInfo *fmt_info, u8 *v);- In
Io.h:738:
bool _write_Str(Str *o, FmtInfo *fmt_info, Str *s);
bool _write_Buf(Str *o, FmtInfo *fmt_info, Buf *b);
bool _write_DateTime(Str *o, FmtInfo *fmt_info, DateTime *dt);
bool _write_u8(Str *o, FmtInfo *fmt_info, u8 *v);
bool _write_u16(Str *o, FmtInfo *fmt_info, u16 *v);- In
Io.h:739:
bool _write_Buf(Str *o, FmtInfo *fmt_info, Buf *b);
bool _write_DateTime(Str *o, FmtInfo *fmt_info, DateTime *dt);
bool _write_u8(Str *o, FmtInfo *fmt_info, u8 *v);
bool _write_u16(Str *o, FmtInfo *fmt_info, u16 *v);
bool _write_u32(Str *o, FmtInfo *fmt_info, u32 *v);- In
Io.h:740:
bool _write_DateTime(Str *o, FmtInfo *fmt_info, DateTime *dt);
bool _write_u8(Str *o, FmtInfo *fmt_info, u8 *v);
bool _write_u16(Str *o, FmtInfo *fmt_info, u16 *v);
bool _write_u32(Str *o, FmtInfo *fmt_info, u32 *v);
bool _write_u64(Str *o, FmtInfo *fmt_info, u64 *v);- In
Io.h:741:
bool _write_u8(Str *o, FmtInfo *fmt_info, u8 *v);
bool _write_u16(Str *o, FmtInfo *fmt_info, u16 *v);
bool _write_u32(Str *o, FmtInfo *fmt_info, u32 *v);
bool _write_u64(Str *o, FmtInfo *fmt_info, u64 *v);
bool _write_i8(Str *o, FmtInfo *fmt_info, i8 *v);- In
Io.h:742:
bool _write_u16(Str *o, FmtInfo *fmt_info, u16 *v);
bool _write_u32(Str *o, FmtInfo *fmt_info, u32 *v);
bool _write_u64(Str *o, FmtInfo *fmt_info, u64 *v);
bool _write_i8(Str *o, FmtInfo *fmt_info, i8 *v);
bool _write_i16(Str *o, FmtInfo *fmt_info, i16 *v);- In
Io.h:743:
bool _write_u32(Str *o, FmtInfo *fmt_info, u32 *v);
bool _write_u64(Str *o, FmtInfo *fmt_info, u64 *v);
bool _write_i8(Str *o, FmtInfo *fmt_info, i8 *v);
bool _write_i16(Str *o, FmtInfo *fmt_info, i16 *v);
bool _write_i32(Str *o, FmtInfo *fmt_info, i32 *v);- In
Io.h:744:
bool _write_u64(Str *o, FmtInfo *fmt_info, u64 *v);
bool _write_i8(Str *o, FmtInfo *fmt_info, i8 *v);
bool _write_i16(Str *o, FmtInfo *fmt_info, i16 *v);
bool _write_i32(Str *o, FmtInfo *fmt_info, i32 *v);
bool _write_i64(Str *o, FmtInfo *fmt_info, i64 *v);- In
Io.h:745:
bool _write_i8(Str *o, FmtInfo *fmt_info, i8 *v);
bool _write_i16(Str *o, FmtInfo *fmt_info, i16 *v);
bool _write_i32(Str *o, FmtInfo *fmt_info, i32 *v);
bool _write_i64(Str *o, FmtInfo *fmt_info, i64 *v);
bool _write_Zstr(Str *o, FmtInfo *fmt_info, Zstr *s);- In
Io.h:746:
bool _write_i16(Str *o, FmtInfo *fmt_info, i16 *v);
bool _write_i32(Str *o, FmtInfo *fmt_info, i32 *v);
bool _write_i64(Str *o, FmtInfo *fmt_info, i64 *v);
bool _write_Zstr(Str *o, FmtInfo *fmt_info, Zstr *s);
bool _write_ZstrAlloc(Str *o, FmtInfo *fmt_info, ZstrIOArg *arg);- In
Io.h:747:
bool _write_i32(Str *o, FmtInfo *fmt_info, i32 *v);
bool _write_i64(Str *o, FmtInfo *fmt_info, i64 *v);
bool _write_Zstr(Str *o, FmtInfo *fmt_info, Zstr *s);
bool _write_ZstrAlloc(Str *o, FmtInfo *fmt_info, ZstrIOArg *arg);
bool _write_f32(Str *o, FmtInfo *fmt_info, f32 *v);- In
Io.h:748:
bool _write_i64(Str *o, FmtInfo *fmt_info, i64 *v);
bool _write_Zstr(Str *o, FmtInfo *fmt_info, Zstr *s);
bool _write_ZstrAlloc(Str *o, FmtInfo *fmt_info, ZstrIOArg *arg);
bool _write_f32(Str *o, FmtInfo *fmt_info, f32 *v);
bool _write_f64(Str *o, FmtInfo *fmt_info, f64 *v);- In
Io.h:749:
bool _write_Zstr(Str *o, FmtInfo *fmt_info, Zstr *s);
bool _write_ZstrAlloc(Str *o, FmtInfo *fmt_info, ZstrIOArg *arg);
bool _write_f32(Str *o, FmtInfo *fmt_info, f32 *v);
bool _write_f64(Str *o, FmtInfo *fmt_info, f64 *v);
#if FEATURE_FLOAT- In
Io.h:750:
bool _write_ZstrAlloc(Str *o, FmtInfo *fmt_info, ZstrIOArg *arg);
bool _write_f32(Str *o, FmtInfo *fmt_info, f32 *v);
bool _write_f64(Str *o, FmtInfo *fmt_info, f64 *v);
#if FEATURE_FLOAT
bool _write_Float(Str *o, FmtInfo *fmt_info, Float *value);- In
Io.h:752:
bool _write_f64(Str *o, FmtInfo *fmt_info, f64 *v);
#if FEATURE_FLOAT
bool _write_Float(Str *o, FmtInfo *fmt_info, Float *value);
#endif
#if FEATURE_BITVEC- In
Io.h:755:
#endif
#if FEATURE_BITVEC
bool _write_BitVec(Str *o, FmtInfo *fmt_info, BitVec *bv);
#endif
#if FEATURE_INT- In
Io.h:758:
#endif
#if FEATURE_INT
bool _write_Int(Str *o, FmtInfo *fmt_info, Int *value);
#endif- In
Io.h:761:
#endif
Zstr _read_Str(Zstr i, FmtInfo *fmt_info, Str *s);
Zstr _read_Buf(Zstr i, FmtInfo *fmt_info, Buf *b);
Zstr _read_DateTime(Zstr i, FmtInfo *fmt_info, DateTime *dt);- In
Io.h:762:
Zstr _read_Str(Zstr i, FmtInfo *fmt_info, Str *s);
Zstr _read_Buf(Zstr i, FmtInfo *fmt_info, Buf *b);
Zstr _read_DateTime(Zstr i, FmtInfo *fmt_info, DateTime *dt);
Zstr _read_u8(Zstr i, FmtInfo *fmt_info, u8 *v);- In
Io.h:763:
Zstr _read_Str(Zstr i, FmtInfo *fmt_info, Str *s);
Zstr _read_Buf(Zstr i, FmtInfo *fmt_info, Buf *b);
Zstr _read_DateTime(Zstr i, FmtInfo *fmt_info, DateTime *dt);
Zstr _read_u8(Zstr i, FmtInfo *fmt_info, u8 *v);
Zstr _read_u16(Zstr i, FmtInfo *fmt_info, u16 *v);- In
Io.h:764:
Zstr _read_Buf(Zstr i, FmtInfo *fmt_info, Buf *b);
Zstr _read_DateTime(Zstr i, FmtInfo *fmt_info, DateTime *dt);
Zstr _read_u8(Zstr i, FmtInfo *fmt_info, u8 *v);
Zstr _read_u16(Zstr i, FmtInfo *fmt_info, u16 *v);
Zstr _read_u32(Zstr i, FmtInfo *fmt_info, u32 *v);- In
Io.h:765:
Zstr _read_DateTime(Zstr i, FmtInfo *fmt_info, DateTime *dt);
Zstr _read_u8(Zstr i, FmtInfo *fmt_info, u8 *v);
Zstr _read_u16(Zstr i, FmtInfo *fmt_info, u16 *v);
Zstr _read_u32(Zstr i, FmtInfo *fmt_info, u32 *v);
Zstr _read_u64(Zstr i, FmtInfo *fmt_info, u64 *v);- In
Io.h:766:
Zstr _read_u8(Zstr i, FmtInfo *fmt_info, u8 *v);
Zstr _read_u16(Zstr i, FmtInfo *fmt_info, u16 *v);
Zstr _read_u32(Zstr i, FmtInfo *fmt_info, u32 *v);
Zstr _read_u64(Zstr i, FmtInfo *fmt_info, u64 *v);
Zstr _read_i8(Zstr i, FmtInfo *fmt_info, i8 *v);- In
Io.h:767:
Zstr _read_u16(Zstr i, FmtInfo *fmt_info, u16 *v);
Zstr _read_u32(Zstr i, FmtInfo *fmt_info, u32 *v);
Zstr _read_u64(Zstr i, FmtInfo *fmt_info, u64 *v);
Zstr _read_i8(Zstr i, FmtInfo *fmt_info, i8 *v);
Zstr _read_i16(Zstr i, FmtInfo *fmt_info, i16 *v);- In
Io.h:768:
Zstr _read_u32(Zstr i, FmtInfo *fmt_info, u32 *v);
Zstr _read_u64(Zstr i, FmtInfo *fmt_info, u64 *v);
Zstr _read_i8(Zstr i, FmtInfo *fmt_info, i8 *v);
Zstr _read_i16(Zstr i, FmtInfo *fmt_info, i16 *v);
Zstr _read_i32(Zstr i, FmtInfo *fmt_info, i32 *v);- In
Io.h:769:
Zstr _read_u64(Zstr i, FmtInfo *fmt_info, u64 *v);
Zstr _read_i8(Zstr i, FmtInfo *fmt_info, i8 *v);
Zstr _read_i16(Zstr i, FmtInfo *fmt_info, i16 *v);
Zstr _read_i32(Zstr i, FmtInfo *fmt_info, i32 *v);
Zstr _read_i64(Zstr i, FmtInfo *fmt_info, i64 *v);- In
Io.h:770:
Zstr _read_i8(Zstr i, FmtInfo *fmt_info, i8 *v);
Zstr _read_i16(Zstr i, FmtInfo *fmt_info, i16 *v);
Zstr _read_i32(Zstr i, FmtInfo *fmt_info, i32 *v);
Zstr _read_i64(Zstr i, FmtInfo *fmt_info, i64 *v);
Zstr _read_Zstr(Zstr i, FmtInfo *fmt_info, Zstr *v);- In
Io.h:771:
Zstr _read_i16(Zstr i, FmtInfo *fmt_info, i16 *v);
Zstr _read_i32(Zstr i, FmtInfo *fmt_info, i32 *v);
Zstr _read_i64(Zstr i, FmtInfo *fmt_info, i64 *v);
Zstr _read_Zstr(Zstr i, FmtInfo *fmt_info, Zstr *v);
Zstr _read_ZstrAlloc(Zstr i, FmtInfo *fmt_info, ZstrIOArg *arg);- In
Io.h:772:
Zstr _read_i32(Zstr i, FmtInfo *fmt_info, i32 *v);
Zstr _read_i64(Zstr i, FmtInfo *fmt_info, i64 *v);
Zstr _read_Zstr(Zstr i, FmtInfo *fmt_info, Zstr *v);
Zstr _read_ZstrAlloc(Zstr i, FmtInfo *fmt_info, ZstrIOArg *arg);
Zstr _read_f32(Zstr i, FmtInfo *fmt_info, f32 *v);- In
Io.h:773:
Zstr _read_i64(Zstr i, FmtInfo *fmt_info, i64 *v);
Zstr _read_Zstr(Zstr i, FmtInfo *fmt_info, Zstr *v);
Zstr _read_ZstrAlloc(Zstr i, FmtInfo *fmt_info, ZstrIOArg *arg);
Zstr _read_f32(Zstr i, FmtInfo *fmt_info, f32 *v);
Zstr _read_f64(Zstr i, FmtInfo *fmt_info, f64 *v);- In
Io.h:774:
Zstr _read_Zstr(Zstr i, FmtInfo *fmt_info, Zstr *v);
Zstr _read_ZstrAlloc(Zstr i, FmtInfo *fmt_info, ZstrIOArg *arg);
Zstr _read_f32(Zstr i, FmtInfo *fmt_info, f32 *v);
Zstr _read_f64(Zstr i, FmtInfo *fmt_info, f64 *v);
#if FEATURE_FLOAT- In
Io.h:775:
Zstr _read_ZstrAlloc(Zstr i, FmtInfo *fmt_info, ZstrIOArg *arg);
Zstr _read_f32(Zstr i, FmtInfo *fmt_info, f32 *v);
Zstr _read_f64(Zstr i, FmtInfo *fmt_info, f64 *v);
#if FEATURE_FLOAT
Zstr _read_Float(Zstr i, FmtInfo *fmt_info, Float *value);- In
Io.h:777:
Zstr _read_f64(Zstr i, FmtInfo *fmt_info, f64 *v);
#if FEATURE_FLOAT
Zstr _read_Float(Zstr i, FmtInfo *fmt_info, Float *value);
#endif
#if FEATURE_BITVEC- In
Io.h:780:
#endif
#if FEATURE_BITVEC
Zstr _read_BitVec(Zstr i, FmtInfo *fmt_info, BitVec *bv);
#endif
#if FEATURE_INT- In
Io.h:783:
#endif
#if FEATURE_INT
Zstr _read_Int(Zstr i, FmtInfo *fmt_info, Int *value);
#endif- In
Io.c:58:
}
static bool _write_r8(Str *o, FmtInfo *fmt_info, u8 *v);
static bool _write_r16(Str *o, FmtInfo *fmt_info, u16 *v);
static bool _write_r32(Str *o, FmtInfo *fmt_info, u32 *v);- In
Io.c:59:
static bool _write_r8(Str *o, FmtInfo *fmt_info, u8 *v);
static bool _write_r16(Str *o, FmtInfo *fmt_info, u16 *v);
static bool _write_r32(Str *o, FmtInfo *fmt_info, u32 *v);
static bool _write_r64(Str *o, FmtInfo *fmt_info, u64 *v);- In
Io.c:60:
static bool _write_r8(Str *o, FmtInfo *fmt_info, u8 *v);
static bool _write_r16(Str *o, FmtInfo *fmt_info, u16 *v);
static bool _write_r32(Str *o, FmtInfo *fmt_info, u32 *v);
static bool _write_r64(Str *o, FmtInfo *fmt_info, u64 *v);- In
Io.c:61:
static bool _write_r16(Str *o, FmtInfo *fmt_info, u16 *v);
static bool _write_r32(Str *o, FmtInfo *fmt_info, u32 *v);
static bool _write_r64(Str *o, FmtInfo *fmt_info, u64 *v);
static Zstr _read_r8(Zstr i, FmtInfo *fmt_info, u8 *v);- In
Io.c:63:
static bool _write_r64(Str *o, FmtInfo *fmt_info, u64 *v);
static Zstr _read_r8(Zstr i, FmtInfo *fmt_info, u8 *v);
static Zstr _read_r16(Zstr i, FmtInfo *fmt_info, u16 *v);
static Zstr _read_r32(Zstr i, FmtInfo *fmt_info, u32 *v);- In
Io.c:64:
static Zstr _read_r8(Zstr i, FmtInfo *fmt_info, u8 *v);
static Zstr _read_r16(Zstr i, FmtInfo *fmt_info, u16 *v);
static Zstr _read_r32(Zstr i, FmtInfo *fmt_info, u32 *v);
static Zstr _read_r64(Zstr i, FmtInfo *fmt_info, u64 *v);- In
Io.c:65:
static Zstr _read_r8(Zstr i, FmtInfo *fmt_info, u8 *v);
static Zstr _read_r16(Zstr i, FmtInfo *fmt_info, u16 *v);
static Zstr _read_r32(Zstr i, FmtInfo *fmt_info, u32 *v);
static Zstr _read_r64(Zstr i, FmtInfo *fmt_info, u64 *v);- In
Io.c:66:
static Zstr _read_r16(Zstr i, FmtInfo *fmt_info, u16 *v);
static Zstr _read_r32(Zstr i, FmtInfo *fmt_info, u32 *v);
static Zstr _read_r64(Zstr i, FmtInfo *fmt_info, u64 *v);
// Avoids `__builtin_clzll`: we'd need a separate MSVC branch via
- In
Io.c:109:
// any base prefix; type is one of `c`/`a`/`A`/`x`/`X`/`b`/`o`/`r`/`e`/
// `E`/`s`.
static bool parse_format_spec(Zstr spec, u32 len, FmtInfo *fi) {
if (!spec || !fi) {
LOG_FATAL("Invalid arguments");- In
Io.c:117:
// case and must fall through to the defaulted FmtInfo below.
*fi = (FmtInfo) {.align = ALIGN_RIGHT, .width = 0, .precision = 6, .flags = FMT_FLAG_NONE};
u32 pos = 0;- In
Io.c:326:
size spec_len = brace_end - brace_start - 1;
FmtInfo fmt_info;
if (spec_len == 0) {
// Empty `{}` body falls through to the same defaults
- In
Io.c:331:
// parse_format_spec would have emitted for an empty
// input, without the bounds check overhead.
fmt_info = (FmtInfo) {.align = ALIGN_RIGHT, .width = 0, .precision = 6, .flags = FMT_FLAG_NONE};
} else if (!parse_format_spec(fmt + brace_start + 1, spec_len, &fmt_info)) {
return false;- In
Io.c:617:
// Validate format specifier. The spec scratch lives only
// long enough to NUL-terminate the slice for parse_format_spec.
FmtInfo fmt_info = {0};
bool spec_ok = false;
StrInitStack(spec_buf, 32) {- In
Io.c:858:
u32 spec_len = (u32)(StrIterRemainingLength(&spec_start_fsi) - StrIterRemainingLength(&fsi));
FmtInfo fmt_info = {0};
if (!parse_format_spec(spec_start, spec_len, &fmt_info)) {
*iter = start;- In
Io.c:971:
// raw output. Returns the index of the next byte after the directive,
// or 0 on a failed write (fmt error / OOM).
static bool render_one_raw_field(Str *out, FmtInfo *fmt_info, TypeSpecificIO *io, u64 arg_index) {
if (!io->writer) {
LOG_FATAL("buf_*_fmt: argument {} has no writer", arg_index);- In
Io.c:1055:
u32 spec_len = (u32)(StrIterRemainingLength(&spec_start_fsi) - StrIterRemainingLength(&fsi));
FmtInfo fmt_info = {0};
if (!parse_format_spec(spec_start, spec_len, &fmt_info)) {
return false;- In
Io.c:1296:
}
static u8 int_fmt_radix_from_flags(FmtInfo *fmt_info) {
if (fmt_info && (fmt_info->flags & FMT_FLAG_HEX)) {
return 16;- In
Io.c:1312:
#if FEATURE_FLOAT
static bool float_fmt_uses_unsupported_flags(FmtInfo *fmt_info) {
return fmt_info && (fmt_info->flags & (FMT_FLAG_CHAR | FMT_FLAG_HEX | FMT_FLAG_BINARY | FMT_FLAG_OCTAL |
FMT_FLAG_RAW | FMT_FLAG_STRING)) != 0;- In
Io.c:1602:
// post-read cursor so the outer reader can splice it back into the
// surrounding format-walk.
static inline Zstr read_chars_internal(Zstr i, u8 *buffer, size buffer_size, FmtInfo *fmt_info) {
if (!i || !buffer || !buffer_size) {
LOG_FATAL("Invalid arguments");- In
Io.c:1653:
// Buf is Vec(u8), Str is Vec(char) -- identical layout, so Buf text I/O
// aliases the Str path (same (Str *) cast buf_append_fmt relies on).
bool _write_Buf(Str *o, FmtInfo *fmt_info, Buf *b) {
return _write_Str(o, fmt_info, (Str *)b);
}- In
Io.c:1656:
return _write_Str(o, fmt_info, (Str *)b);
}
Zstr _read_Buf(Zstr i, FmtInfo *fmt_info, Buf *b) {
return _read_Str(i, fmt_info, (Str *)b);
}- In
Io.c:1665:
// fraction is exactly the nanosecond count, so it parses back as a plain
// integer. Writer and reader share the layout, so a value round-trips.
bool _write_DateTime(Str *o, FmtInfo *fmt_info, DateTime *dt) {
(void)fmt_info;
if (!o || !dt) {- In
Io.c:1698:
}
Zstr _read_DateTime(Zstr i, FmtInfo *fmt_info, DateTime *dt) {
(void)fmt_info;
if (!i || !dt) {- In
Io.c:1754:
}
bool _write_Str(Str *o, FmtInfo *fmt_info, Str *s) {
if (!o || !s || !fmt_info) {
LOG_FATAL("Invalid arguments");- In
Io.c:1842:
}
bool _write_Zstr(Str *o, FmtInfo *fmt_info, Zstr *s) {
if (!o || !s || !*s || !fmt_info) {
LOG_FATAL("Invalid arguments");- In
Io.c:1929:
}
bool _write_ZstrAlloc(Str *o, FmtInfo *fmt_info, ZstrIOArg *arg) {
Zstr *value = NULL;- In
Io.c:1940:
}
bool _write_u64(Str *o, FmtInfo *fmt_info, u64 *v) {
if (!o || !fmt_info || !v) {
LOG_FATAL("Invalid arguments");- In
Io.c:1998:
}
bool _write_u32(Str *o, FmtInfo *fmt_info, u32 *v) {
if (!o || !fmt_info || !v) {
LOG_FATAL("Invalid arguments");- In
Io.c:2012:
}
bool _write_u16(Str *o, FmtInfo *fmt_info, u16 *v) {
if (!o || !fmt_info || !v) {
LOG_FATAL("Invalid arguments");- In
Io.c:2026:
}
bool _write_u8(Str *o, FmtInfo *fmt_info, u8 *v) {
if (!o || !fmt_info || !v) {
LOG_FATAL("Invalid arguments");- In
Io.c:2040:
}
bool _write_i64(Str *o, FmtInfo *fmt_info, i64 *v) {
if (!o || !fmt_info || !v) {
LOG_FATAL("Invalid arguments");- In
Io.c:2095:
}
bool _write_i32(Str *o, FmtInfo *fmt_info, i32 *v) {
if (!o || !fmt_info || !v) {
LOG_FATAL("Invalid arguments");- In
Io.c:2109:
}
bool _write_i16(Str *o, FmtInfo *fmt_info, i16 *v) {
if (!o || !fmt_info || !v) {
LOG_FATAL("Invalid arguments");- In
Io.c:2123:
}
bool _write_i8(Str *o, FmtInfo *fmt_info, i8 *v) {
if (!o || !fmt_info || !v) {
LOG_FATAL("Invalid arguments");- In
Io.c:2137:
}
bool _write_f64(Str *o, FmtInfo *fmt_info, f64 *v) {
if (!o || !fmt_info || !v) {
LOG_FATAL("Invalid arguments");- In
Io.c:2220:
}
bool _write_f32(Str *o, FmtInfo *fmt_info, f32 *v) {
if (!o || !fmt_info || !v) {
LOG_FATAL("Invalid arguments");- In
Io.c:2239:
#if FEATURE_FLOAT
bool _write_Float(Str *o, FmtInfo *fmt_info, Float *value) {
size start_len = 0;
Str temp;- In
Io.c:2369:
}
Zstr _read_Str(Zstr i, FmtInfo *fmt_info, Str *s) {
if (!i || !s)
LOG_FATAL("Invalid arguments");- In
Io.c:2639:
// ---------------------------------------------------------------------------
Zstr _read_f64(Zstr i, FmtInfo *fmt_info, f64 *v) {
DefaultAllocator scratch = DefaultAllocatorInit();- In
Io.c:2760:
}
Zstr _read_u8(Zstr i, FmtInfo *fmt_info, u8 *v) {
DefaultAllocator scratch = DefaultAllocatorInit();- In
Io.c:2872:
// ---------------------------------------------------------------------------
#define _MAKE_READ_TXT_INT(NAME, T, VAL_T, PARSER, BOUND_CHECK) \
Zstr _read_##NAME(Zstr i, FmtInfo *fmt_info, T *v) { \
DefaultAllocator scratch = DefaultAllocatorInit(); \
\- In
Io.c:2974:
#undef _I_BOUND
Zstr _read_Zstr(Zstr i, FmtInfo *fmt_info, Zstr *out) {
(void)fmt_info;
(void)out;- In
Io.c:2981:
}
Zstr _read_ZstrAlloc(Zstr i, FmtInfo *fmt_info, ZstrIOArg *arg) {
char **out = NULL;
char *previous = NULL;- In
Io.c:2988:
Allocator *allocator_ptr = NULL;
Str temp;
FmtInfo default_fmt;
if (!i || !arg || !arg->value || !arg->allocator) {- In
Io.c:3000:
default_fmt = fmt_info ? *fmt_info :
(FmtInfo) {
.align = ALIGN_RIGHT,
.width = 0,- In
Io.c:3038:
#if FEATURE_BITVEC
bool _write_BitVec(Str *o, FmtInfo *fmt_info, BitVec *bv) {
if (!o || !fmt_info || !bv) {
LOG_FATAL("Invalid arguments");- In
Io.c:3112:
#if FEATURE_INT
bool _write_Int(Str *o, FmtInfo *fmt_info, Int *value) {
if (!o || !fmt_info || !value) {
LOG_FATAL("Invalid arguments");- In
Io.c:3176:
#if FEATURE_BITVEC
Zstr _read_BitVec(Zstr i, FmtInfo *fmt_info, BitVec *bv) {
(void)fmt_info; // Unused parameter
if (!i || !bv) {- In
Io.c:3309:
#if FEATURE_INT
Zstr _read_Int(Zstr i, FmtInfo *fmt_info, Int *value) {
if (!i || !value) {
LOG_FATAL("Invalid arguments");- In
Io.c:3396:
#if FEATURE_FLOAT
Zstr _read_Float(Zstr i, FmtInfo *fmt_info, Float *value) {
size token_len = 0;
Zstr start = NULL;- In
Io.c:3458:
#endif // FEATURE_FLOAT
Zstr _read_f32(Zstr i, FmtInfo *fmt_info, f32 *v) {
DefaultAllocator scratch = DefaultAllocatorInit();- In
Io.c:3582:
}
static bool _write_r8(Str *o, FmtInfo *fmt_info, u8 *v) {
if (!o || !fmt_info || !v) {
LOG_FATAL("Invalid arguments");- In
Io.c:3591:
}
static bool _write_r16(Str *o, FmtInfo *fmt_info, u16 *v) {
if (!o || !fmt_info || !v) {
LOG_FATAL("Invalid arguments");- In
Io.c:3617:
}
static bool _write_r32(Str *o, FmtInfo *fmt_info, u32 *v) {
if (!o || !fmt_info || !v) {
LOG_FATAL("Invalid arguments");- In
Io.c:3645:
}
static bool _write_r64(Str *o, FmtInfo *fmt_info, u64 *v) {
if (!o || !fmt_info || !v) {
LOG_FATAL("Invalid arguments");- In
Io.c:3677:
}
static Zstr _read_r8(Zstr i, FmtInfo *fmt_info, u8 *v) {
if (!i || !fmt_info || !v) {
LOG_FATAL("Invalid arguments");- In
Io.c:3686:
}
static Zstr _read_r16(Zstr i, FmtInfo *fmt_info, u16 *v) {
if (!i || !fmt_info || !v) {
LOG_FATAL("Invalid arguments");- In
Io.c:3714:
}
static Zstr _read_r32(Zstr i, FmtInfo *fmt_info, u32 *v) {
if (!i || !fmt_info || !v) {
LOG_FATAL("Invalid arguments");- In
Io.c:3740:
}
static Zstr _read_r64(Zstr i, FmtInfo *fmt_info, u64 *v) {
if (!i || !fmt_info || !v) {
LOG_FATAL("Invalid arguments");- In
UserTypes.c:53:
// nested expansions from inside an outer writer's own body. Pattern A in
// the extending-io guide.
bool _write_Point2D(Str *o, FmtInfo *info, Point2D *p);
Zstr _read_Point2D(Zstr i, FmtInfo *info, Point2D *p);
bool _write_Bounds(Str *o, FmtInfo *info, Bounds *b);- In
UserTypes.c:54:
// the extending-io guide.
bool _write_Point2D(Str *o, FmtInfo *info, Point2D *p);
Zstr _read_Point2D(Zstr i, FmtInfo *info, Point2D *p);
bool _write_Bounds(Str *o, FmtInfo *info, Bounds *b);
Zstr _read_Bounds(Zstr i, FmtInfo *info, Bounds *b);- In
UserTypes.c:55:
bool _write_Point2D(Str *o, FmtInfo *info, Point2D *p);
Zstr _read_Point2D(Zstr i, FmtInfo *info, Point2D *p);
bool _write_Bounds(Str *o, FmtInfo *info, Bounds *b);
Zstr _read_Bounds(Zstr i, FmtInfo *info, Bounds *b);
bool _write_Region(Str *o, FmtInfo *info, Region *r);- In
UserTypes.c:56:
Zstr _read_Point2D(Zstr i, FmtInfo *info, Point2D *p);
bool _write_Bounds(Str *o, FmtInfo *info, Bounds *b);
Zstr _read_Bounds(Zstr i, FmtInfo *info, Bounds *b);
bool _write_Region(Str *o, FmtInfo *info, Region *r);
Zstr _read_Region(Zstr i, FmtInfo *info, Region *r);- In
UserTypes.c:57:
bool _write_Bounds(Str *o, FmtInfo *info, Bounds *b);
Zstr _read_Bounds(Zstr i, FmtInfo *info, Bounds *b);
bool _write_Region(Str *o, FmtInfo *info, Region *r);
Zstr _read_Region(Zstr i, FmtInfo *info, Region *r);- In
UserTypes.c:58:
Zstr _read_Bounds(Zstr i, FmtInfo *info, Bounds *b);
bool _write_Region(Str *o, FmtInfo *info, Region *r);
Zstr _read_Region(Zstr i, FmtInfo *info, Region *r);
bool _write_Point2D(Str *o, FmtInfo *info, Point2D *p) {- In
UserTypes.c:60:
Zstr _read_Region(Zstr i, FmtInfo *info, Region *r);
bool _write_Point2D(Str *o, FmtInfo *info, Point2D *p) {
(void)info;
if (!o || !p) {- In
UserTypes.c:68:
}
Zstr _read_Point2D(Zstr i, FmtInfo *info, Point2D *p) {
(void)info;
if (!i || !p) {- In
UserTypes.c:80:
// `_Generic` arm for `Point2D` resolves correctly from inside another
// user-type writer.
bool _write_Bounds(Str *o, FmtInfo *info, Bounds *b) {
(void)info;
if (!o || !b) {- In
UserTypes.c:88:
}
Zstr _read_Bounds(Zstr i, FmtInfo *info, Bounds *b) {
(void)info;
if (!i || !b) {- In
UserTypes.c:100:
// a standalone Point2D plus an in-tree i32. Exercises a writer that mixes
// nested user types, repeated user types, and built-ins in one call.
bool _write_Region(Str *o, FmtInfo *info, Region *r) {
(void)info;
if (!o || !r) {- In
UserTypes.c:108:
}
Zstr _read_Region(Zstr i, FmtInfo *info, Region *r) {
(void)info;
if (!i || !r) {- In
Read.c:1487:
char *out = NULL;
ZstrIOArg arg = {.value = (void *)&out, .allocator = alloc_base};
FmtInfo fmt = {0}; // max_read_len == 0 -> hits the !max_read_len branch
Zstr next = _read_ZstrAlloc(input, &fmt, &arg);
Last updated on