42typedef enum : uint32_t {
529 const uint8_t* xhtml_buf,
Annotation-attribute framework macros for ra8-firmware.
#define RA8_PRIV
Module-private helper: shared across TUs but only inside one library.
Error Code Definitions for ra8-firmware.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
HTML / CSS reflow + paginate engine for the ra8d2 ereader.
ra8_css_style_t priv_reflow_tok_css_inline(const uint8_t *tag, size_t span)
Parse a just-opened tag's inline style="..." into a CSS declaration.
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[].
bool priv_reflow_tok_starts_with(const uint8_t *buf, size_t i, size_t len, const char *lit)
Test whether buf at i begins with the literal lit.
ra8_css_element_t priv_reflow_tok_css_element(reflow_html_tag_t kind, const uint8_t *tag, size_t span)
Build a CSS element identity from a just-opened tag's attributes.
bool priv_reflow_tok_find_attr(const uint8_t *tag, size_t tag_len, const char *name, size_t name_len, size_t *out_voff, size_t *out_vlen)
Locate a named attribute's quoted value span within a tag (no copy).
bool priv_reflow_tok_decode_entity(const char *src, size_t avail, uint32_t *out_cp, size_t *out_used)
Decode one XML entity reference beginning at &.
bool priv_reflow_tok_stash_run(reflow_t *engine, const uint8_t *buf, size_t start, size_t end, uint32_t *out_off, uint32_t *out_len)
Entity-decode and whitespace-collapse a text run into the pool.
size_t priv_reflow_tok_utf8_encode(uint32_t cp, uint8_t *dst)
UTF-8 encode a code point into dst (up to 4 bytes).
size_t priv_reflow_tok_find_lit(const uint8_t *buf, size_t i, size_t len, const char *lit)
Return the index of the first occurrence of lit (its start), or len.
bool priv_reflow_tok_emit(reflow_t *engine, reflow_token_kind_t kind, reflow_html_tag_t tag, uint8_t style, uint32_t off, uint32_t len)
Append one token to the engine's token pool.
bool priv_reflow_tok_is_block(reflow_html_tag_t tag)
Test whether a tag is a block-flow container in the v1 subset.
void priv_reflow_tok_capture_attr(reflow_t *engine, const uint8_t *tag, size_t tag_len, const char *name, size_t name_len, uint32_t *out_off, uint32_t *out_len)
Copy a named attribute's quoted value from a tag span into the pool.
priv_tok_consts_t
Tokenizer bounds and UTF-8 / numeric-entity encoding constants.
@ k_priv_max_depth
Max element nesting (matches old shim).
@ k_priv_utf8_lead4
4-byte sequence lead-byte prefix.
@ k_priv_entity_window
Max bytes scanned for one '&...;'.
@ k_priv_hex_offset
Value of hex 'a'/'A' minus the letter.
@ k_priv_utf8_sh18
Shift for three continuation bytes.
@ k_priv_utf8_lead3
3-byte sequence lead-byte prefix.
@ k_priv_uc_4byte
Code points >= need 4 UTF-8 bytes.
@ k_priv_uc_3byte
Code points >= need >= 3 UTF-8 bytes.
@ k_priv_tag_name_cap
Lower-cased tag-name buffer size.
@ k_priv_utf8_mask
Low 6 bits per continuation byte.
@ k_priv_utf8_cont
Continuation-byte prefix.
@ k_priv_entity_min
Shortest valid reference ("<").
@ k_priv_base_dec
Decimal numeric-entity base.
@ k_priv_utf8_sh6
Shift for one continuation byte.
@ k_priv_utf8_sh12
Shift for two continuation bytes.
@ k_priv_base_hex
Hexadecimal numeric-entity base.
@ k_priv_utf8_lead2
2-byte sequence lead-byte prefix.
@ k_priv_uc_2byte
Code points >= need >= 2 UTF-8 bytes.
@ k_priv_uc_max
Highest valid Unicode code point.
@ k_priv_style_mask
Run-style bits.
reflow_html_tag_t priv_reflow_tok_classify(const char *name, size_t len)
Map a (possibly namespace-prefixed) tag name to its enum.
bool priv_reflow_tok_rel_is_stylesheet(const uint8_t *rel, size_t len)
True if a rel attribute value contains the stylesheet token.
size_t priv_reflow_tok_skip_past(const uint8_t *buf, size_t i, size_t len, const char *lit)
Return the index just past the first occurrence of lit.
uint8_t priv_reflow_tok_style_for(reflow_html_tag_t tag)
Return the style bit an inline tag contributes to its subtree.
uint8_t priv_reflow_tok_resolve_face_slot(const reflow_t *engine, const ra8_css_style_t *comp)
Map a cascaded run's (font-family + emphasis) to an embedded face slot.
bool priv_reflow_tok_is_xml_whitespace(char c)
True for the ASCII characters XHTML treats as whitespace.
bool priv_reflow_tok_feed(reflow_t *engine, char ch, bool *last_ws)
Write one byte through the whitespace-collapse state machine.
uint8_t priv_reflow_tok_intern_link(reflow_t *engine, uint32_t href_off, uint32_t href_len)
Intern an <a> href slice into the link-target table.
reflow_html_tag_t
Recognised HTML element kinds.
reflow_token_kind_t
Parsed token classification.
@ k_reflow_style_italic
Italic face.
@ k_reflow_style_bold
Bold face.
@ k_reflow_style_underline
Underlined run.
The identity of one element, used to match selectors.
A declared or computed style: a presence mask plus property values.
Reflow / pagination engine state.