ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
reflow_internal.h File Reference

Test-access surface for reflow internal helpers (MC/DC). More...

#include <stddef.h>
#include <stdint.h>
#include "ra8_attributes.h"
Include dependency graph for reflow_internal.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

bool priv_reflow_internal_is_indent_tag (uint8_t tag)
 Return true iff tag is a tag that introduces / removes a block-level indent (currently <li> and <blockquote>).
bool priv_reflow_internal_right_overflow_break (int32_t cursor_x, int32_t advance, int32_t right_limit, uint8_t line_has_content)
 Decide whether a glyph emission would overflow the right margin AND the current line already has content.
bool priv_reflow_internal_xhtml_invalid (const void *xhtml_buf, size_t xhtml_len)
 Decide whether the cached XHTML buffer pointer/length pair is unusable for a re-flow (NULL pointer OR zero length).
bool priv_reflow_internal_final_page_needed (uint32_t page_count, uint32_t token_count)
 Decide whether the layout pass produced zero pages but the token stream was non-empty (must synthesise a final page).

Detailed Description

Test-access surface for reflow internal helpers (MC/DC).

Not part of the public API. Tests under tests/ MAY include this header to drive compound boolean decisions that sit in TU-private helpers behind the public reflow facade. See CLAUDE.md "Test access to internal symbols (MC/DC scope)".

Definition in file reflow_internal.h.

Function Documentation

◆ priv_reflow_internal_final_page_needed()

bool priv_reflow_internal_final_page_needed ( uint32_t page_count,
uint32_t token_count )

Decide whether the layout pass produced zero pages but the token stream was non-empty (must synthesise a final page).

Promoted from the inline AND decision in reflow_run_layout (line 750).

Parameters
[in]page_countNumber of pages flushed during the pass.
[in]token_countTotal parsed-token count.
Returns
Boolean fixup-needed predicate.
Return values
trueCaller must synthesise a single final page.
falseNo fixup required.
Precondition
None.
None.
Postcondition
No state mutated.
Return value depends solely on the two arguments.
Note
Test-access only. Pure function.
MC/DC:
2-condition AND; N+1 = 3 vectors:
  • pages>0, tokens>0 -> false
  • pages==0, tokens>0 -> true
  • pages==0, tokens==0 -> false
Since
0.1.0

Decide whether the layout pass produced zero pages but the token stream was non-empty (must synthesise a final page).

Promoted from line 750 in reflow_run_layout.

Parameters
[in]page_countNumber of pages flushed during the pass.
[in]token_countTotal parsed-token count.
Returns
Boolean fixup-needed predicate.
Return values
trueCaller must synthesise a single final page.
falseNo fixup required.
Precondition
None.
None.
Postcondition
No state mutated.
Return value depends solely on the two arguments.
Note
Pure function; thread-safe.
Since
0.1.0

Definition at line 135 of file reflow_layout.c.

Referenced by reflow_run_layout().

◆ priv_reflow_internal_is_indent_tag()

bool priv_reflow_internal_is_indent_tag ( uint8_t tag)

Return true iff tag is a tag that introduces / removes a block-level indent (currently <li> and <blockquote>).

Promoted from the inline expressions in internal_open_block (line 479) and internal_close_block (line 513) so tests can drive both arms of the tag == li || tag == blockquote decision under -fcoverage-mcdc on the production source.

Parameters
[in]tagToken tag value (raw uint8_t storage of reflow_html_tag_t to keep this header free of public-API includes).
Returns
Boolean indent-tag predicate.
Return values
trueTag is li or blockquote.
falseOtherwise.
Precondition
None.
None.
Postcondition
No state mutated.
Return value depends solely on tag.
Note
Test-access only. Pure function.
MC/DC:
Drives lines 479 / 513 tok->tag == k_reflow_tag_li || tok->tag == k_reflow_tag_blockquote (2 conditions, OR; N+1 = 3 vectors).
Since
0.1.0

Return true iff tag is a tag that introduces / removes a block-level indent (currently <li> and <blockquote>).

Pure helper factored out of internal_open_block (line 479) and internal_close_block (line 513) so the tag == li || tag == blockquote decision can be driven directly by host MC/DC tests via priv_reflow_internal_is_indent_tag.

Parameters
[in]tagToken tag value (raw uint8_t storage of reflow_html_tag_t).
Returns
Boolean indent-tag predicate.
Return values
trueTag is k_reflow_tag_li or k_reflow_tag_blockquote.
falseOtherwise.
Precondition
None.
None.
Postcondition
No state mutated.
Return value depends solely on tag.
Note
Pure function; thread-safe.
Since
0.1.0

Definition at line 67 of file reflow_layout.c.

References k_reflow_tag_blockquote, and k_reflow_tag_li.

Referenced by internal_close_block(), and internal_open_block().

◆ priv_reflow_internal_right_overflow_break()

bool priv_reflow_internal_right_overflow_break ( int32_t cursor_x,
int32_t advance,
int32_t right_limit,
uint8_t line_has_content )

Decide whether a glyph emission would overflow the right margin AND the current line already has content.

Promoted from the inline compound decisions in internal_emit_char (line 404), internal_layout_text (line 468) and priv_apply_image (line 605) so the cur->x + advance > right_limit && line_has_content != 0 AND decision can be driven directly under -fcoverage-mcdc.

Parameters
[in]cursor_xCurrent pen x position in pixels.
[in]advanceWidth about to be emitted in pixels.
[in]right_limitRight edge in pixels (viewport_w - margin).
[in]line_has_contentNon-zero iff the current line already has at least one glyph.
Returns
Boolean break-needed predicate.
Return values
trueCaller must call priv_newline before emitting.
falseEmitting in place is safe.
Precondition
None.
None.
Postcondition
No state mutated.
Return value depends solely on the four arguments.
Note
Test-access only. Pure function.
MC/DC:
2-condition AND; N+1 = 3 vectors:
  • x+adv <= right, content=1 -> false (control: both false-side)
  • x+adv > right, content=1 -> true (varies left only)
  • x+adv > right, content=0 -> false (varies right only)
Since
0.1.0

Decide whether a glyph emission would overflow the right margin AND the current line already has content.

Promoted from inline expressions at original lines 404, 468 and 605 so MC/DC tests can drive both arms of the (cur->x + advance > right_limit) && line_has_content decision directly.

Parameters
[in]cursor_xPen x position in pixels.
[in]advanceWidth about to be emitted in pixels.
[in]right_limitRight edge in pixels.
[in]line_has_contentNon-zero iff the line already has glyphs.
Returns
Boolean break-needed predicate.
Return values
trueCaller must call priv_reflow_layout_newline before emitting.
falseEmitting in place is safe.
Precondition
None.
None.
Postcondition
No state mutated.
Return value depends solely on the four arguments.
Note
Pure function; thread-safe.
Since
0.1.0

Definition at line 92 of file reflow_layout.c.

Referenced by internal_apply_image_placeholder(), internal_emit_char(), and internal_layout_text().

◆ priv_reflow_internal_xhtml_invalid()

bool priv_reflow_internal_xhtml_invalid ( const void * xhtml_buf,
size_t xhtml_len )

Decide whether the cached XHTML buffer pointer/length pair is unusable for a re-flow (NULL pointer OR zero length).

Promoted from the inline OR decision in reflow_set_font_size (line 953).

Parameters
[in]xhtml_bufCached buffer pointer (may be NULL).
[in]xhtml_lenCached buffer length (may be zero).
Returns
Boolean invalid-buffer predicate.
Return values
trueBuffer is unusable; caller must return invalid_state.
falseBuffer is usable.
Precondition
None.
None.
Postcondition
No state mutated.
Return value depends solely on the two arguments.
Note
Test-access only. Pure function.
MC/DC:
2-condition OR; N+1 = 3 vectors:
  • buf!=NULL, len!=0 -> false (both false-side)
  • buf==NULL, len!=0 -> true (varies buf)
  • buf!=NULL, len==0 -> true (varies len)
Since
0.1.0

Decide whether the cached XHTML buffer pointer/length pair is unusable for a re-flow (NULL pointer OR zero length).

Promoted from line 953 in reflow_set_font_size.

Parameters
[in]xhtml_bufCached buffer pointer (may be NULL).
[in]xhtml_lenCached buffer length (may be zero).
Returns
Boolean invalid-buffer predicate.
Return values
trueBuffer is unusable.
falseBuffer is usable.
Precondition
None.
None.
Postcondition
No state mutated.
Return value depends solely on the two arguments.
Note
Pure function; thread-safe.
Since
0.1.0

Definition at line 115 of file reflow_layout.c.

Referenced by reflow_bind_font(), and reflow_set_font_size().