ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
reflow_parse.c
Go to the documentation of this file.
1
23
24#include <stddef.h>
25#include <stdint.h>
26
27#include "ra8_err.h"
28#include "reflow.h"
30
31/* ---------------------------------------------------------------------------
32 * Public helpers (declared in reflow.h). The cross-TU tokenizer entry
33 * point `priv_reflow_xml_walk()` is declared in
34 * reflow_tokenize_internal.h and defined in reflow_tokenize.c.
35 * ---------------------------------------------------------------------------
36 */
37
38ra8_err_t reflow_parse_xhtml(reflow_t* engine, const uint8_t* xhtml_buf, size_t xhtml_len)
39{
40 if ((engine == nullptr) || (xhtml_buf == nullptr)) {
41 return k_ra8_err_null_ptr;
42 }
43 if (engine->in_use == 0U) {
45 }
46 if (xhtml_len == 0U) {
48 }
49
50 /* Reset the token + text pools and the link-target table before each parse.
51 * The layout pools (glyphs/pages/images/link-rects/anchors) are cleared
52 * separately by reflow_run_layout(). */
53 engine->token_count = 0U;
54 engine->text_pool_used = 0U;
55 engine->link_target_count = 0U;
56
57 return priv_reflow_xml_walk(engine, xhtml_buf, xhtml_len);
58}
Error Code Definitions for ra8-firmware.
@ k_ra8_err_not_initialized
Module not initialized – _init() not yet called successfully.
Definition ra8_err.h:235
@ 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
HTML / CSS reflow + paginate engine for the ra8d2 ereader.
ra8_err_t reflow_parse_xhtml(reflow_t *engine, const uint8_t *xhtml_buf, size_t xhtml_len)
Parse the XHTML buffer into the engine's token stream.
ra8_err_t priv_reflow_xml_walk(reflow_t *engine, const uint8_t *xhtml_buf, size_t xhtml_len)
Tokenize the XHTML buffer and populate engine->tokens[].
Test-access surface for reflow_tokenize.c internal helpers.
Reflow / pagination engine state.
uint32_t text_pool_used
Bytes consumed in text_pool.
uint32_t link_target_count
Interned link targets.
uint32_t token_count
Tokens used.
uint8_t in_use
1 = initialized, 0 = closed.