ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
epub_xml_toc_internal.h
Go to the documentation of this file.
1
12#pragma once
13
14#include <stddef.h>
15#include <stdint.h>
16
18#include "ra8_attributes.h"
19#include "xml.h"
20
31
41
58internal_ancestor_name(const xml_reader_t* reader, uint16_t depth, uint16_t levels);
59
77RA8_INTERNAL static uint8_t internal_ancestor_depth(const uint8_t* source,
78 size_t source_len,
79 const xml_reader_t* reader,
80 uint16_t depth,
81 const char* local);
82
101RA8_INTERNAL static uint16_t internal_toc_reserve(const uint8_t* source,
102 size_t source_len,
103 const xml_event_t* event,
104 xml_reader_t* reader,
105 epub_book_t* book,
106 const char* local);
107
122RA8_INTERNAL static uint16_t internal_toc_marker(const xml_reader_t* reader, uint16_t depth);
123
143RA8_INTERNAL static ra8_err_t internal_toc_capacity(const uint8_t* source,
144 size_t length,
145 epub_xml_workspace_t* workspace,
146 const xml_event_t* selected,
147 const char* entry_local,
148 bool require_list);
149
163
181RA8_INTERNAL static ra8_err_t internal_select_nav(const uint8_t* source,
182 size_t length,
183 epub_xml_workspace_t* workspace,
184 xml_event_t* out);
185
203RA8_INTERNAL static ra8_err_t internal_nav_has_list(const uint8_t* source,
204 size_t length,
205 epub_xml_workspace_t* workspace,
206 const xml_event_t* selected);
207
Private contracts for streamed EPUB XML consumers.
static void internal_ncx_event(priv_ncx_ctx_t *ctx, const xml_event_t *event)
Consume one event from the selected NCX navigation map.
static ra8_err_t internal_nav_has_list(const uint8_t *source, size_t length, epub_xml_workspace_t *workspace, const xml_event_t *selected)
Require a direct ordered-list child before TOC mutation.
static ra8_err_t internal_toc_capacity(const uint8_t *source, size_t length, epub_xml_workspace_t *workspace, const xml_event_t *selected, const char *entry_local, bool require_list)
Prove a selected TOC subtree fits before changing the book.
static uint16_t internal_toc_reserve(const uint8_t *source, size_t source_len, const xml_event_t *event, xml_reader_t *reader, epub_book_t *book, const char *local)
Reserve one preflight-proven TOC slot and mark its frame.
static uint16_t internal_toc_marker(const xml_reader_t *reader, uint16_t depth)
Find the nearest marked ancestor frame.
static xml_span_t internal_ancestor_name(const xml_reader_t *reader, uint16_t depth, uint16_t levels)
Return a checked ancestor name span.
static void internal_nav_event(priv_nav_ctx_t *ctx, const xml_event_t *event)
Consume one event from the selected EPUB navigation subtree.
static ra8_err_t internal_select_nav(const uint8_t *source, size_t length, epub_xml_workspace_t *workspace, xml_event_t *out)
Select typed TOC nav, falling back to the first nav descendant.
static uint8_t internal_ancestor_depth(const uint8_t *source, size_t source_len, const xml_reader_t *reader, uint16_t depth, const char *local)
Count local-name ancestors of a TOC entry type.
Annotation-attribute framework macros for ra8-firmware.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Definition ra8_err.h:546
Opened EPUB book.
Definition epub.h:286
Per-book bounded storage for strict OPF/container/TOC parsing.
Definition epub.h:105
Mutable state for one validated EPUB navigation pass.
bool saw_ol
Selected navigation contains its list.
xml_event_t selected
Selected navigation element.
xml_reader_t * reader
Reader whose live frames carry markers.
size_t source_len
Navigation-document byte count.
bool active
Selected subtree has begun.
epub_book_t * book
TOC output being populated.
const uint8_t * source
Immutable navigation document.
Mutable state for one validated NCX navigation-map pass.
xml_reader_t * reader
Reader whose live frames carry markers.
epub_book_t * book
TOC output being populated.
bool active
Selected subtree has begun.
xml_event_t selected
Selected navigation-map element.
size_t source_len
NCX-document byte count.
const uint8_t * source
Immutable NCX document.
One XML pull event.
Definition xml.h:71
Pull-reader state; initialise before each pass.
Definition xml.h:93
Immutable byte span expressed relative to the source.
Definition xml.h:44
Bounded, caller-owned, no-heap XML pull reader.