ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_rabook_finalize.c
Go to the documentation of this file.
1
16
17#include <stdint.h>
18#include <string.h>
19
20#include "ra8_attributes.h"
21#include "ra8_check.h"
22#include "rabook_compile.h"
23
25static const char* const s_tag_rabook = "ra8_rabook_finalize";
26
32typedef enum : uint32_t {
33 k_rabook_crc_init = 0xFFFFFFFFU,
34 k_rabook_crc_poly = 0xEDB88320U,
36
42typedef enum : uint32_t {
45
47typedef enum : uint8_t {
50
70static uint32_t internal_crc_update(uint32_t crc, const uint8_t* data, uint32_t len)
71{
72 uint32_t running_crc = crc;
73 for (uint32_t i = 0U; i < len; i++) {
74 running_crc ^= (uint32_t)data[i];
75 for (uint32_t bit = 0U; bit < (uint32_t)k_rabook_crc_byte_bits; bit++) {
76 const uint32_t lsb = running_crc & 1U;
77 const uint32_t mask = 0U - lsb;
78 running_crc = (running_crc >> 1U) ^ ((uint32_t)k_rabook_crc_poly & mask);
79 }
80 }
81 return running_crc;
82}
83
93typedef struct {
94 uint32_t off_chap;
95 uint32_t off_node;
96 uint32_t off_attr;
97 uint32_t off_style;
98 uint32_t off_image;
99 uint32_t off_string;
100 uint32_t off_pool;
101 uint32_t total;
103
124{
125 const uint64_t chap_bytes = (uint64_t)ctx->chapter_count * (uint64_t)k_book_sizeof_chapter;
126 const uint64_t node_bytes = (uint64_t)ctx->node_count * (uint64_t)k_book_sizeof_node;
127 const uint64_t attr_bytes = (uint64_t)ctx->attr_count * (uint64_t)k_book_sizeof_attr;
128 const uint64_t style_bytes = (uint64_t)ctx->stylesheet_count * (uint64_t)k_book_sizeof_stylesheet;
129 const uint64_t image_bytes = (uint64_t)ctx->image_count * (uint64_t)k_book_sizeof_image;
130
131 const uint64_t off_chap = (uint64_t)k_book_sizeof_header;
132 const uint64_t off_node = off_chap + chap_bytes;
133 const uint64_t off_attr = off_node + node_bytes;
134 const uint64_t off_style = off_attr + attr_bytes;
135 const uint64_t off_image = off_style + style_bytes;
136 const uint64_t off_string = off_image + image_bytes;
137 const uint64_t off_pool = off_string + (uint64_t)ctx->string_size;
138 const uint64_t total = off_pool + (uint64_t)ctx->image_pool_size;
139
140 if (total > (uint64_t)UINT32_MAX) {
141 ra8_log_error(s_tag_rabook, "finalize: layout overflows 32-bit offsets");
143 }
144
145 lay->off_chap = (uint32_t)off_chap;
146 lay->off_node = (uint32_t)off_node;
147 lay->off_attr = (uint32_t)off_attr;
148 lay->off_style = (uint32_t)off_style;
149 lay->off_image = (uint32_t)off_image;
150 lay->off_string = (uint32_t)off_string;
151 lay->off_pool = (uint32_t)off_pool;
152 lay->total = (uint32_t)total;
153 return k_ra8_ok;
154}
155
157typedef struct {
158 const uint8_t* data;
159 uint32_t len;
161
172
188static void internal_segments(const ra8_rabook_ctx_t* ctx,
189 const ra8_rabook_layout_t* lay,
191{
193 (ra8_rabook_segment_t){(const uint8_t*)ctx->buf.chapters, lay->off_node - lay->off_chap};
195 (ra8_rabook_segment_t){(const uint8_t*)ctx->buf.nodes, lay->off_attr - lay->off_node};
197 (ra8_rabook_segment_t){(const uint8_t*)ctx->buf.attrs, lay->off_style - lay->off_attr};
199 (ra8_rabook_segment_t){(const uint8_t*)ctx->buf.stylesheets, lay->off_image - lay->off_style};
201 (ra8_rabook_segment_t){(const uint8_t*)ctx->buf.images, lay->off_string - lay->off_image};
203 (ra8_rabook_segment_t){(const uint8_t*)ctx->buf.string_pool, ctx->string_size};
204}
205
227 void* read_ctx,
228 uint32_t offset,
229 uint8_t* dst,
230 uint32_t len)
231{
232 uint32_t got = 0U;
233 const ra8_err_t err = read(read_ctx, offset, dst, len, &got);
234 if (err != k_ra8_ok) {
235 return err;
236 }
237 return (got == len) ? k_ra8_ok : k_ra8_err_invalid_size;
238}
239
259static ra8_err_t
260internal_write_exact(ra8_rabook_write_fn write, void* write_ctx, const uint8_t* src, uint32_t len)
261{
262 if (len == 0U) {
263 return k_ra8_ok;
264 }
265 uint32_t wrote = 0U;
266 const ra8_err_t err = write(write_ctx, src, len, &wrote);
267 if (err != k_ra8_ok) {
268 return err;
269 }
270 return (wrote == len) ? k_ra8_ok : k_ra8_err_invalid_size;
271}
272
296 void* read_ctx,
297 uint8_t* scratch,
298 uint32_t scratch_cap,
299 uint32_t* crc)
300{
301 if (ctx->image_pool_size == 0U) {
302 return k_ra8_ok;
303 }
304 if (ctx->image_pool_mode != (uint8_t)k_rabook_pool_external) {
305 *crc = internal_crc_update(*crc, ctx->buf.image_pool, ctx->image_pool_size);
306 return k_ra8_ok;
307 }
308 uint32_t offset = 0U;
309 while (offset < ctx->image_pool_size) {
310 uint32_t span = ctx->image_pool_size - offset;
311 if (span > scratch_cap) {
312 span = scratch_cap;
313 }
314 const ra8_err_t err = internal_read_exact(read, read_ctx, offset, scratch, span);
315 if (err != k_ra8_ok) {
316 return err;
317 }
318 *crc = internal_crc_update(*crc, scratch, span);
319 offset += span;
320 }
321 return k_ra8_ok;
322}
323
341static book_header_t
342internal_make_header(const ra8_rabook_ctx_t* ctx, const ra8_rabook_layout_t* lay, uint32_t crc)
343{
344 book_header_t hdr = {};
345 (void)memcpy(hdr.magic, "RABOOK1", sizeof(hdr.magic));
347 hdr.total_size = lay->total;
348 hdr.flags = ctx->flags;
349 hdr.title_off = ctx->title_off;
350 hdr.author_off = ctx->author_off;
351 hdr.language_off = ctx->language_off;
354 hdr.chapter_count = ctx->chapter_count;
355 hdr.chapter_off = lay->off_chap;
356 hdr.node_count = ctx->node_count;
357 hdr.node_off = lay->off_node;
358 hdr.attr_count = ctx->attr_count;
359 hdr.attr_off = lay->off_attr;
361 hdr.stylesheet_off = lay->off_style;
362 hdr.image_count = ctx->image_count;
363 hdr.image_off = lay->off_image;
364 hdr.string_off = lay->off_string;
365 hdr.string_size = ctx->string_size;
366 hdr.image_pool_off = lay->off_pool;
368 hdr.crc32_val = crc;
369 return hdr;
370}
371
396 void* read_ctx,
398 void* write_ctx,
399 uint8_t* scratch,
400 uint32_t scratch_cap)
401{
402 if (ctx->image_pool_size == 0U) {
403 return k_ra8_ok;
404 }
405 if (ctx->image_pool_mode != (uint8_t)k_rabook_pool_external) {
406 return internal_write_exact(write, write_ctx, ctx->buf.image_pool, ctx->image_pool_size);
407 }
408 uint32_t offset = 0U;
409 while (offset < ctx->image_pool_size) {
410 uint32_t span = ctx->image_pool_size - offset;
411 if (span > scratch_cap) {
412 span = scratch_cap;
413 }
414 ra8_err_t err = internal_read_exact(read, read_ctx, offset, scratch, span);
415 if (err == k_ra8_ok) {
416 err = internal_write_exact(write, write_ctx, scratch, span);
417 }
418 if (err != k_ra8_ok) {
419 return err;
420 }
421 offset += span;
422 }
423 return k_ra8_ok;
424}
425
451 void* read_ctx,
452 uint8_t* scratch,
453 uint32_t scratch_cap,
454 uint32_t* out_crc)
455{
456 uint32_t crc = (uint32_t)k_rabook_crc_init;
457 for (uint8_t i = 0U; i < (uint8_t)k_rabook_segment_count; ++i) {
458 crc = internal_crc_update(crc, seg[i].data, seg[i].len);
459 }
460 const ra8_err_t err = internal_crc_image_pool(ctx, read, read_ctx, scratch, scratch_cap, &crc);
461 if (err != k_ra8_ok) {
462 return err;
463 }
464 *out_crc = crc ^ (uint32_t)k_rabook_crc_init;
465 return k_ra8_ok;
466}
467
493 const book_header_t* hdr,
496 void* read_ctx,
498 void* write_ctx,
499 uint8_t* scratch,
500 uint32_t scratch_cap)
501{
502 ra8_err_t err =
503 internal_write_exact(write, write_ctx, (const uint8_t*)hdr, (uint32_t)sizeof(*hdr));
504 for (uint8_t i = 0U; i < (uint8_t)k_rabook_segment_count; ++i) {
505 if (err != k_ra8_ok) {
506 break;
507 }
508 err = internal_write_exact(write, write_ctx, seg[i].data, seg[i].len);
509 }
510 if (err != k_ra8_ok) {
511 return err;
512 }
513 return internal_write_image_pool(ctx, read, read_ctx, write, write_ctx, scratch, scratch_cap);
514}
515
540 ra8_rabook_image_read_fn image_read,
542 const uint8_t* scratch,
543 uint32_t scratch_cap,
544 const uint32_t* out_len)
545{
546 RA8_CHECK_NULL_PTR(ctx, s_tag_rabook, "ctx");
547 if (write == nullptr) {
548 ra8_log_error(s_tag_rabook, "write is NULL");
549 return k_ra8_err_null_ptr;
550 }
551 RA8_CHECK_NULL_PTR(out_len, s_tag_rabook, "out_len");
552 if (ctx->failed) {
553 return k_ra8_err_no_mem;
554 }
555 bool external = false;
556 if (ctx->image_pool_size != 0U) {
557 external = ctx->image_pool_mode == (uint8_t)k_rabook_pool_external;
558 }
559 if (external) {
560 if (image_read == nullptr) {
561 return k_ra8_err_null_ptr;
562 }
563 if (scratch == nullptr) {
564 return k_ra8_err_null_ptr;
565 }
566 if (scratch_cap == 0U) {
568 }
569 }
570 return k_ra8_ok;
571}
572
574 ra8_rabook_image_read_fn image_read,
575 void* image_ctx,
577 void* write_ctx,
578 uint8_t* scratch,
579 uint32_t scratch_cap,
580 uint32_t* out_len)
581{
582 const ra8_err_t arg_err =
583 internal_validate_stream_args(ctx, image_read, write, scratch, scratch_cap, out_len);
584 if (arg_err != k_ra8_ok) {
585 return arg_err;
586 }
587
588 ra8_rabook_layout_t lay = {};
589 const ra8_err_t lay_err = internal_compute_layout(ctx, &lay);
590 if (lay_err != k_ra8_ok) {
591 return lay_err;
592 }
594 internal_segments(ctx, &lay, seg);
595 uint32_t crc = 0U;
596 ra8_err_t err = internal_crc_body(ctx, seg, image_read, image_ctx, scratch, scratch_cap, &crc);
597 if (err != k_ra8_ok) {
598 return err;
599 }
600 const book_header_t hdr = internal_make_header(ctx, &lay, crc);
601 err = internal_write_book(ctx,
602 &hdr,
603 seg,
604 image_read,
605 image_ctx,
606 write,
607 write_ctx,
608 scratch,
609 scratch_cap);
610 if (err != k_ra8_ok) {
611 return err;
612 }
613 *out_len = lay.total;
614 return k_ra8_ok;
615}
616
618typedef struct {
619 uint8_t* data;
620 uint32_t cap;
621 uint32_t used;
623
643static ra8_err_t
644internal_memory_write(void* opaque, const uint8_t* src, uint32_t requested, uint32_t* out_written)
645{
647 *out_written = 0U;
648 if (requested > (sink->cap - sink->used)) {
650 }
651 (void)memcpy(&sink->data[sink->used], src, (size_t)requested);
652 sink->used += requested;
653 *out_written = requested;
654 return k_ra8_ok;
655}
656
678 const void** out_blob,
679 const uint32_t* out_len)
680{
681 RA8_CHECK_NULL_PTR(ctx, s_tag_rabook, "ctx");
682 RA8_CHECK_NULL_PTR(out_blob, s_tag_rabook, "out_blob");
683 RA8_CHECK_NULL_PTR(out_len, s_tag_rabook, "out_len");
684 if (ctx->failed) {
685 ra8_log_error(s_tag_rabook, "finalize after a builder overflow");
686 return k_ra8_err_no_mem;
687 }
688 ra8_rabook_layout_t lay = {};
690 return (lay.total <= ctx->buf.out_cap) ? k_ra8_ok : k_ra8_err_invalid_size;
691}
692
693ra8_err_t ra8_rabook_finalize(ra8_rabook_ctx_t* ctx, const void** out_blob, uint32_t* out_len)
694{
695 const ra8_err_t arg_err = internal_validate_memory_finalize(ctx, out_blob, out_len);
696 if (arg_err != k_ra8_ok) {
697 return arg_err;
698 }
699 ra8_rabook_memory_sink_t sink = {.data = ctx->buf.out, .cap = ctx->buf.out_cap};
700 uint32_t len = 0U;
702 nullptr,
703 nullptr,
705 &sink,
706 nullptr,
707 0U,
708 &len);
709 if (err != k_ra8_ok) {
710 return err;
711 }
712
713 *out_blob = ctx->buf.out;
714 *out_len = len;
715 return k_ra8_ok;
716}
@ k_book_sizeof_image
Bytes in book_image_t.
Definition book.h:233
@ k_book_sizeof_header
Bytes in book_header_t.
Definition book.h:228
@ k_book_sizeof_node
Bytes in book_node_t.
Definition book.h:230
@ k_book_sizeof_chapter
Bytes in book_chapter_t.
Definition book.h:229
@ k_book_sizeof_stylesheet
Bytes in book_stylesheet_t.
Definition book.h:232
@ k_book_sizeof_attr
Bytes in book_attr_t.
Definition book.h:231
@ k_book_format_version
Current .rabook layout revision.
Definition book.h:86
-proof
Annotation-attribute framework macros for ra8-firmware.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
Validation and Error-Checking Macros for ra8-firmware.
#define RA8_RETURN_ON_ERROR(err, tag, message)
Early return on error, propagating the code upward.
Definition ra8_check.h:184
#define RA8_CHECK_NULL_PTR(ptr, tag, message)
Reject nullptr pointer, returning k_ra8_err_null_ptr.
Definition ra8_check.h:243
@ k_ra8_err_no_mem
Static buffer exhausted (no dynamic memory on this project).
Definition ra8_err.h:142
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
Definition ra8_err.h:119
@ k_ra8_err_null_ptr
Pointer was NULL where a valid pointer was required.
Definition ra8_err.h:478
@ k_ra8_err_invalid_size
Invalid size parameter (too large, too small, or misaligned).
Definition ra8_err.h:167
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Definition ra8_err.h:546
void * memcpy(void *dst, const void *src, size_t n)
Copy memory area between non-overlapping regions.
#define ra8_log_error(tag, message)
RA8 log error.
Definition ra8_log.h:335
static ra8_err_t internal_write_exact(ra8_rabook_write_fn write, void *write_ctx, const uint8_t *src, uint32_t len)
Append one exact stream chunk, rejecting a short success.
static ra8_err_t internal_crc_image_pool(const ra8_rabook_ctx_t *ctx, ra8_rabook_image_read_fn read, void *read_ctx, uint8_t *scratch, uint32_t scratch_cap, uint32_t *crc)
Fold the logical image pool into an in-progress CRC.
ra8_err_t ra8_rabook_finalize(ra8_rabook_ctx_t *ctx, const void **out_blob, uint32_t *out_len)
Lay out the tables and pools, fill the header, CRC, and emit the blob.
static ra8_err_t internal_write_image_pool(const ra8_rabook_ctx_t *ctx, ra8_rabook_image_read_fn read, void *read_ctx, ra8_rabook_write_fn write, void *write_ctx, uint8_t *scratch, uint32_t scratch_cap)
Emit the logical image pool through the exact-write callback.
static uint32_t internal_crc_update(uint32_t crc, const uint8_t *data, uint32_t len)
Continue a CRC-32/ISO-HDLC accumulator over one byte range.
static ra8_err_t internal_crc_body(const ra8_rabook_ctx_t *ctx, const ra8_rabook_segment_t seg[k_rabook_segment_count], ra8_rabook_image_read_fn read, void *read_ctx, uint8_t *scratch, uint32_t scratch_cap, uint32_t *out_crc)
Compute the finalized CRC for all canonical body segments.
ra8_rabook_pool_mode_t
Image-pool backing recorded by the builder context.
@ k_rabook_pool_external
Bytes live behind the read callback.
ra8_rabook_crc_t
CRC-32/ISO-HDLC constants matching book_validate.
@ k_rabook_crc_poly
Reflected CRC-32 polynomial.
@ k_rabook_crc_init
CRC seed and final XOR mask.
static book_header_t internal_make_header(const ra8_rabook_ctx_t *ctx, const ra8_rabook_layout_t *lay, uint32_t crc)
Fill the fixed RABOOK1 header from one layout and CRC.
ra8_rabook_segment_count_t
Number of resident body segments before the image-pool payload.
@ k_rabook_segment_nodes
DOM node table.
@ k_rabook_segment_images
Image descriptor table.
@ k_rabook_segment_attrs
DOM attribute table.
@ k_rabook_segment_chapters
Chapter table.
@ k_rabook_segment_styles
Stylesheet table.
@ k_rabook_segment_strings
Interned string pool.
@ k_rabook_segment_count
Five tables plus the string pool.
static ra8_err_t internal_memory_write(void *opaque, const uint8_t *src, uint32_t requested, uint32_t *out_written)
Append one chunk to a bounded memory sink.
static ra8_err_t internal_validate_stream_args(const ra8_rabook_ctx_t *ctx, ra8_rabook_image_read_fn image_read, ra8_rabook_write_fn write, const uint8_t *scratch, uint32_t scratch_cap, const uint32_t *out_len)
Validate streaming-finalizer arguments and builder state.
static void internal_segments(const ra8_rabook_ctx_t *ctx, const ra8_rabook_layout_t *lay, ra8_rabook_segment_t seg[k_rabook_segment_count])
Populate the canonical resident body-segment sequence.
static ra8_err_t internal_write_book(const ra8_rabook_ctx_t *ctx, const book_header_t *hdr, const ra8_rabook_segment_t seg[k_rabook_segment_count], ra8_rabook_image_read_fn read, void *read_ctx, ra8_rabook_write_fn write, void *write_ctx, uint8_t *scratch, uint32_t scratch_cap)
Emit the fixed header followed by the canonical logical body.
ra8_rabook_crc_bits_t
Per-byte fold count for the bitwise CRC inner loop.
@ k_rabook_crc_byte_bits
Bit folds per input byte.
static ra8_err_t internal_compute_layout(const ra8_rabook_ctx_t *ctx, ra8_rabook_layout_t *lay)
Compute the table / pool offsets and total blob size, overflow-guarded.
static ra8_err_t internal_read_exact(ra8_rabook_image_read_fn read, void *read_ctx, uint32_t offset, uint8_t *dst, uint32_t len)
Read one exact external-pool chunk, rejecting a short success.
ra8_err_t ra8_rabook_finalize_stream(const ra8_rabook_ctx_t *ctx, ra8_rabook_image_read_fn image_read, void *image_ctx, ra8_rabook_write_fn write, void *write_ctx, uint8_t *scratch, uint32_t scratch_cap, uint32_t *out_len)
Stream a canonical flat RABOOK1 blob without a full output arena.
static const char *const s_tag_rabook
Component tag for finalizer diagnostics.
static ra8_err_t internal_validate_memory_finalize(ra8_rabook_ctx_t *ctx, const void **out_blob, const uint32_t *out_len)
Validate the legacy in-memory finalizer and output capacity.
Zero-heap builder that emits a RABOOK1 blob (the #149 compiler back-end).
ra8_err_t(* ra8_rabook_image_read_fn)(void *ctx, uint32_t offset, uint8_t *dst, uint32_t requested, uint32_t *out_read)
Read bytes from an externally stored image pool.
ra8_err_t(* ra8_rabook_write_fn)(void *ctx, const uint8_t *src, uint32_t requested, uint32_t *out_written)
Append bytes to a streaming RABOOK1 destination.
Fixed 100-byte prologue describing every table and pool in the blob.
Definition book.h:246
uint32_t author_off
String-pool offset of the author.
Definition book.h:252
uint32_t format_version
book_version_t of this blob.
Definition book.h:248
uint32_t crc32_val
CRC-32/ISO-HDLC of the body (all bytes after this header).
Definition book.h:270
uint32_t image_off
Offset to the image table.
Definition book.h:265
uint32_t image_pool_size
Image-pool length in bytes.
Definition book.h:269
uint32_t language_off
String-pool offset of the BCP-47 language.
Definition book.h:253
uint32_t attr_count
Number of attribute records.
Definition book.h:260
uint32_t node_count
Number of DOM nodes.
Definition book.h:258
uint32_t chapter_count
Number of spine chapters.
Definition book.h:256
uint32_t image_count
Number of image descriptors.
Definition book.h:264
uint32_t title_off
String-pool offset of the book title.
Definition book.h:251
uint32_t string_off
Offset to the string pool.
Definition book.h:266
uint32_t attr_off
Offset to the attribute table.
Definition book.h:261
uint32_t node_off
Offset to the node table.
Definition book.h:259
uint32_t identifier_off
String-pool offset of the unique book id.
Definition book.h:254
uint32_t string_size
String-pool length in bytes.
Definition book.h:267
uint32_t flags
book_flag_t bits; unknown bits are rejected.
Definition book.h:250
uint32_t stylesheet_off
Offset to the stylesheet table.
Definition book.h:263
char magic[8]
Always "RABOOK1" (7 chars + NUL).
Definition book.h:247
uint32_t chapter_off
Offset to the chapter table.
Definition book.h:257
uint32_t stylesheet_count
Number of preserved stylesheets.
Definition book.h:262
uint32_t image_pool_off
Offset to the image pool.
Definition book.h:268
uint32_t total_size
Total blob length in bytes.
Definition book.h:249
uint32_t cover_image_index
Image-table index of the cover, or nil.
Definition book.h:255
uint32_t out_cap
Output capacity in bytes.
uint8_t * image_pool
Image-pool byte arena.
char * string_pool
String-pool byte arena.
book_image_t * images
Image-table arena.
book_stylesheet_t * stylesheets
Stylesheet-table arena.
book_node_t * nodes
Node-table arena.
uint8_t * out
Final-blob output buffer.
book_attr_t * attrs
Attribute-table arena.
book_chapter_t * chapters
Chapter-table arena.
Builder state: the arenas plus running counts and a sticky-fail flag.
bool failed
Sticky: an arena overflowed.
uint32_t title_off
Metadata: title string offset.
uint8_t image_pool_mode
Internal builder storage mode.
uint32_t string_size
String-pool bytes used.
uint32_t stylesheet_count
Stylesheets appended so far.
uint32_t cover_image_index
Cover image index, or nil.
uint32_t image_pool_size
Image-pool bytes used.
ra8_rabook_buffers_t buf
Caller-provided arenas.
uint32_t language_off
Metadata: language string offset.
uint32_t chapter_count
Chapters appended so far.
uint32_t node_count
Nodes appended so far.
uint32_t image_count
Images appended so far.
uint32_t flags
Reserved header flags (0 in v1).
uint32_t author_off
Metadata: author string offset.
uint32_t identifier_off
Metadata: identifier string offset.
uint32_t attr_count
Attributes appended so far.
Computed byte offsets of every table / pool plus the total blob size.
uint32_t off_image
Image table offset.
uint32_t off_chap
Chapter table offset (== header size).
uint32_t off_string
String-pool offset.
uint32_t total
Total blob size in bytes.
uint32_t off_style
Stylesheet table offset.
uint32_t off_attr
Attribute table offset.
uint32_t off_pool
Image-pool offset.
uint32_t off_node
Node table offset.
Bounded in-memory sink used by the legacy finalizer wrapper.
uint8_t * data
Output arena base.
uint32_t cap
Output arena bytes.
uint32_t used
Bytes appended.
One resident body segment in canonical serialization order.
const uint8_t * data
First readable byte.
uint32_t len
Segment byte count.