|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Cross-TU surface for the split content-CSS cascade (#111). More...
Go to the source code of this file.
Functions | |
| bool | priv_reflow_css_is_ws (char c) |
| True for CSS whitespace (space / tab / newline / CR / FF). | |
| char | priv_reflow_css_lower (char c) |
| ASCII-fold one byte to lower case. | |
| bool | priv_reflow_css_ci_eq (const char *s, size_t len, const char *lit) |
Case-insensitive compare of span s[0..len) against NUL literal lit. | |
| const char * | priv_reflow_css_trim (const char *s, size_t *len) |
Trim leading + trailing whitespace from s[0..*len); returns start. | |
| void | priv_reflow_css_parse_decls (const char *s, size_t len, ra8_css_style_t *out) |
Parse a prop:value; ... declaration body (no braces) into out. | |
| void | priv_reflow_css_parse_one_block (ra8_css_sheet_t *sheet, const char *sel, size_t sel_len, const char *block, size_t block_len) |
| Dispatch one selector|@rule { block }: at-rule vs. | |
Cross-TU surface for the split content-CSS cascade (#111).
The content-CSS implementation is split across three translation units that share a small set of pure, leaf-level helpers:
[Ring 4 / Reflow] {World: NS}
Definition in file reflow_css_internal.h.
| bool priv_reflow_css_ci_eq | ( | const char * | s, |
| size_t | len, | ||
| const char * | lit ) |
Case-insensitive compare of span s[0..len) against NUL literal lit.
Compares exactly len bytes of s against the NUL-terminated string lit using ASCII case folding via priv_reflow_css_lower(). Returns true only when the span and the literal have equal length and all bytes fold equal. Either null pointer causes an immediate false return without dereferencing.
| [in] | s | Pointer to the byte span (need not be NUL-terminated). |
| [in] | len | Number of bytes in s to compare. |
| [in] | lit | NUL-terminated reference string; must not be NULL for a true result. |
| true | s[0..len) equals lit case-insensitively and lengths match. |
| false | Lengths differ, any byte differs, or a null pointer was passed. |
len is the exact byte count of the span to compare (may be 0). lit is a valid NUL-terminated string pointer or NULL. s and lit are not modified.Definition at line 162 of file reflow_css.c.
References priv_reflow_css_lower().
Referenced by internal_apply_align(), internal_apply_decl(), internal_apply_emphasis(), internal_extract_url(), internal_face_apply(), internal_family_cb(), internal_is_bold_kw(), internal_is_italic_kw(), internal_parse_at_rule(), internal_parse_color(), and internal_parse_fontsize().
| bool priv_reflow_css_is_ws | ( | char | c | ) |
True for CSS whitespace (space / tab / newline / CR / FF).
Classifies a single byte as a CSS white-space character per the CSS specification: space (0x20), horizontal tab (0x09), newline (0x0A), carriage return (0x0D), and form feed (0x0C). Used throughout the parser to skip or trim tokens.
| [in] | c | Byte to classify (any value). |
| true | c is a CSS whitespace byte. |
| false | c is not a CSS whitespace byte. |
c; all byte values are valid inputs. c; no state is mutated. Definition at line 106 of file reflow_css.c.
Referenced by internal_class_list_has(), internal_split_compounds(), priv_reflow_css_trim(), and ra8_css_parse().
| char priv_reflow_css_lower | ( | char | c | ) |
ASCII-fold one byte to lower case.
Converts an ASCII upper-case letter ('A'-'Z') to its lower-case equivalent by adding the fixed offset between 'A' and 'a'. All other byte values are returned unchanged. This is used for case-insensitive CSS keyword and identifier comparisons throughout the parser.
| [in] | c | Byte to fold; may be any value. |
| c | + ('a' - 'A') When c is in the range 'A'..'Z'. |
| c | For all other byte values. |
c; all byte values are valid inputs. c only when c is an ASCII upper-case letter. Definition at line 133 of file reflow_css.c.
Referenced by internal_ci_contains(), internal_ci_eq_span(), internal_hex_val(), and priv_reflow_css_ci_eq().
| void priv_reflow_css_parse_decls | ( | const char * | s, |
| size_t | len, | ||
| ra8_css_style_t * | out ) |
Parse a prop:value; ... declaration body (no braces) into out.
Iterates over semicolon-delimited declarations in s[0..len). For each declaration, it locates the colon separator, trims whitespace from both property name and value, and applies the recognised property to out. Declarations with an empty property or value after trimming are skipped silently. The loop is bounded by len; each iteration advances past the next semicolon.
| [in] | s | Byte span of the declaration block (no surrounding braces). |
| [in] | len | Number of bytes in s. |
| [in,out] | out | Style record to accumulate parsed declarations into. |
s points to at least len readable bytes (may be NULL only when len == 0). out is non-NULL and zero-initialised or partially filled by the caller. out reflects all successfully parsed declarations from s. s is not modified.out instances. Iterates over semicolon-delimited declarations in s[0..len). For each declaration, it locates the colon separator, trims whitespace from both property name and value, and delegates to internal_apply_decl(). Declarations with an empty property or value after trimming are skipped silently. The loop is bounded by len; each iteration advances past the next semicolon.
| [in] | s | Byte span of the declaration block (no surrounding braces). |
| [in] | len | Number of bytes in s. |
| [in,out] | out | Style record to accumulate parsed declarations into. |
s points to at least len readable bytes (may be NULL only when len == 0). out is non-NULL and zero-initialised or partially filled by the caller. out reflects all successfully parsed declarations from s. s is not modified.out instances. Definition at line 774 of file reflow_css.c.
References internal_apply_decl(), and priv_reflow_css_trim().
Referenced by priv_reflow_css_parse_one_block(), and ra8_css_parse_inline().
| void priv_reflow_css_parse_one_block | ( | ra8_css_sheet_t * | sheet, |
| const char * | sel, | ||
| size_t | sel_len, | ||
| const char * | block, | ||
| size_t | block_len ) |
Dispatch one selector|@rule { block }: at-rule vs.
style rule.
Trims sel to obtain the effective keyword. When the first byte is '@', routes to the @font-face handler. Otherwise, parses the declaration block and distributes the resulting style to every comma-separated selector in sel. This is the per-block worker called by the top-level stylesheet scanner ra8_css_parse() (which lives in a different translation unit).
| [in,out] | sheet | Sheet receiving parsed rules or font faces. |
| [in] | sel | Selector or at-keyword text. |
| [in] | sel_len | Number of bytes in sel. |
| [in] | block | Declaration block body (no surrounding braces). |
| [in] | block_len | Number of bytes in block. |
sheet is non-NULL. sel points to at least sel_len readable bytes. sheet has been updated with all rules or faces derived from this block. sel and block are not modified.sheet instances. style rule.
Trims sel to obtain the effective keyword. When the first byte is '@', routes to internal_parse_at_rule(). Otherwise, parses the declaration block via priv_reflow_css_parse_decls() and internal_extract_family(), then distributes the resulting style to every comma-separated selector in sel via internal_parse_selector_list().
| [in,out] | sheet | Sheet receiving parsed rules or font faces. |
| [in] | sel | Selector or at-keyword text. |
| [in] | sel_len | Number of bytes in sel. |
| [in] | block | Declaration block body (no surrounding braces). |
| [in] | block_len | Number of bytes in block. |
sheet is non-NULL. sel points to at least sel_len readable bytes. sheet has been updated with all rules or faces derived from this block. sel and block are not modified.sheet instances. Definition at line 958 of file reflow_css_rules.c.
References internal_extract_family(), internal_parse_at_rule(), internal_parse_selector_list(), priv_reflow_css_parse_decls(), and priv_reflow_css_trim().
Referenced by ra8_css_parse().
| const char * priv_reflow_css_trim | ( | const char * | s, |
| size_t * | len ) |
Trim leading + trailing whitespace from s[0..*len); returns start.
Advances past leading priv_reflow_css_is_ws() bytes and shrinks past trailing ones, writing the trimmed length back through len and returning a pointer to the first retained byte. Used to normalise property names, values, and selector spans before classification.
| [in] | s | Byte span to trim (need not be NUL-terminated). |
| [in,out] | len | On entry, the span length; on return, the trimmed length. |
s. | &s[a] | Pointer to the trimmed start; *len holds the trimmed length. |
s points to at least *len readable bytes. len is non-NULL. *len is in [0, *len_entry]; s contents are not modified. s, s + *len_entry].Definition at line 228 of file reflow_css.c.
References priv_reflow_css_is_ws().
Referenced by internal_extract_url(), internal_for_each_decl(), internal_parse_selector_list(), priv_reflow_css_parse_decls(), and priv_reflow_css_parse_one_block().