151 uint32_t* out_written);
221 uint16_t attr_count);
337 uint8_t pixel_format,
372 uint8_t pixel_format,
374 uint32_t* out_data_off);
426 uint32_t language_off,
427 uint32_t identifier_off,
428 uint32_t cover_image_index);
499 uint32_t scratch_cap,
Flat, execute-in-place container for a build-time "compiled" e-book.
Error Code Definitions for ra8-firmware.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
uint32_t ra8_rabook_add_element(ra8_rabook_ctx_t *ctx, uint32_t name_off, const book_attr_t *attrs, uint16_t attr_count)
Append an element node with its attributes; return its node index.
ra8_err_t ra8_rabook_link_sibling(ra8_rabook_ctx_t *ctx, uint32_t previous_node, uint32_t next_sibling)
Set previous_node's next sibling to next_sibling.
uint32_t ra8_rabook_add_text(ra8_rabook_ctx_t *ctx, uint32_t text_off)
Append a text node carrying text_off; return its node index.
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.
ra8_err_t ra8_rabook_link_child(ra8_rabook_ctx_t *ctx, uint32_t parent, uint32_t child)
Set parent's first child to child.
uint32_t ra8_rabook_intern(ra8_rabook_ctx_t *ctx, const char *str)
Intern a NUL-terminated UTF-8 string into the pool, de-duplicated.
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.
uint32_t ra8_rabook_add_image(ra8_rabook_ctx_t *ctx, uint32_t id_off, uint16_t width, uint16_t height, uint8_t format, uint8_t pixel_format, const uint8_t *data, uint32_t data_size)
Append an image descriptor and copy its pixel/SVG bytes into the pool.
ra8_err_t ra8_rabook_set_metadata(ra8_rabook_ctx_t *ctx, uint32_t title_off, uint32_t author_off, uint32_t language_off, uint32_t identifier_off, uint32_t cover_image_index)
Record the book metadata offsets that land in the blob header.
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.
uint32_t ra8_rabook_add_image_external(ra8_rabook_ctx_t *ctx, uint32_t id_off, uint16_t width, uint16_t height, uint8_t format, uint8_t pixel_format, uint32_t data_size, uint32_t *out_data_off)
Append an image descriptor whose bytes live in a caller-owned spool.
uint32_t ra8_rabook_add_stylesheet(ra8_rabook_ctx_t *ctx, uint32_t source_off, uint32_t scope_chapter)
Append a preserved stylesheet; return its stylesheet index.
uint32_t ra8_rabook_add_chapter(ra8_rabook_ctx_t *ctx, uint32_t title_off, uint32_t href_off, uint32_t root_node)
Append a spine chapter; return its chapter index.
ra8_err_t rabook_compile_init(ra8_rabook_ctx_t *ctx, const ra8_rabook_buffers_t *buf)
Bind a builder context to its caller-provided arenas.
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.
One name="value" attribute on an element.
One spine document (a renderable chapter) plus its TOC label.
Descriptor for one transcoded image in the image pool.
A preserved CSS stylesheet and the chapter it scopes to.
Caller-owned, fixed-capacity arenas the builder appends into (no heap).
uint32_t out_cap
Output capacity in bytes.
uint32_t attr_cap
Max attribute records.
uint8_t * image_pool
Image-pool byte arena.
uint32_t chapter_cap
Max chapters.
uint32_t stylesheet_cap
Max stylesheets.
char * string_pool
String-pool byte arena.
uint32_t image_cap
Max image descriptors.
uint32_t image_pool_cap
Image-pool capacity in bytes.
book_image_t * images
Image-table arena.
uint32_t string_cap
String-pool capacity in bytes.
book_stylesheet_t * stylesheets
Stylesheet-table arena.
uint32_t node_cap
Max DOM nodes.
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.