|
ProtoCore v0.0.2
Deterministic, zero-heap network stack for embedded targets
|
The one frame engine. Walks a pc_field spec, pulls one argument per valued field. More...
Go to the source code of this file.
Macros | |
| #define | PC_FRAME_SCAN_LITERALS 0 |
Functions | |
| PC_OPTIMIZE_O2 size_t | pc_frame_vbuild (char *out, size_t cap, const pc_field *spec, va_list ap) |
| va_list form, for a caller that already has one. | |
| size_t | pc_frame_build (char *out, size_t cap, const pc_field *spec,...) |
Build spec into out (capacity cap), taking one variadic argument per valued field. | |
| size_t | pc_frame_append (char *out, size_t cap, const pc_field *spec,...) |
Append spec to the NUL-terminated contents already in out. | |
The one frame engine. Walks a pc_field spec, pulls one argument per valued field.
Deliberately thin: every conversion is an already-tested pc_sb appender, so this file adds a dispatch loop and the fail-closed contract, not new formatting logic. That is the point of the spec - the number of places that can get a conversion wrong stays at one no matter how many frames the library declares.
Definition in file frame.cpp.
| PC_OPTIMIZE_O2 size_t pc_frame_vbuild | ( | char * | out, |
| size_t | cap, | ||
| const pc_field * | spec, | ||
| va_list | ap | ||
| ) |
va_list form, for a caller that already has one.
Definition at line 25 of file frame.cpp.
References pc_field::kind, pc_sb::len, PC_FK_CH, PC_FK_DEC, PC_FK_END, PC_FK_FIX, PC_FK_G, PC_FK_HEX, PC_FK_I64, PC_FK_JSON, PC_FK_LIT, PC_FK_OCT, PC_FK_STR, PC_FK_U32, PC_FK_U64, PC_FK_XML, pc_sb_ch(), pc_sb_finish(), pc_sb_fixed(), pc_sb_g(), pc_sb_hex(), pc_sb_i64(), pc_sb_json(), pc_sb_put(), pc_sb_put_n(), pc_sb_u32(), pc_sb_u32w(), pc_sb_u64(), pc_sb_uint(), and pc_sb_xml().
Referenced by pc_frame_append(), and pc_frame_build().
| size_t pc_frame_build | ( | char * | out, |
| size_t | cap, | ||
| const pc_field * | spec, | ||
| ... | |||
| ) |
Build spec into out (capacity cap), taking one variadic argument per valued field.
out is set empty). Definition at line 100 of file frame.cpp.
References pc_frame_vbuild().
| size_t pc_frame_append | ( | char * | out, |
| size_t | cap, | ||
| const pc_field * | spec, | ||
| ... | |||
| ) |
Append spec to the NUL-terminated contents already in out.
The append idiom this library uses for header and cookie accumulation: on overflow the buffer is rewound to its previous length, so a frame is added whole or not at all and a half-written line never reaches the wire.
Definition at line 109 of file frame.cpp.
References pc_frame_vbuild().