|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Shared bounded markup lexer helpers for media extraction units. More...
Go to the source code of this file.
Functions | |
| static char | internal_lc (char c) |
| ASCII lower-case (locale-independent). | |
| static bool | internal_is_attr_boundary (char c) |
| True if c ends an HTML attribute token on its left side. | |
| static bool | internal_is_name_end (char c) |
| True if c terminates a tag name (so "<a" != "<article"). | |
| static const char * | internal_find_ci (const char *hay, size_t hay_len, const char *needle) |
| Case-insensitive search for needle in [hay, hay+hay_len). | |
| static size_t | internal_skip_ws (const char *tag, size_t tag_len, size_t k) |
| Advance past spaces/tabs in [k, tag_len). | |
| static bool | internal_read_eq_value (const char *tag, size_t tag_len, size_t k, char *out, size_t out_cap) |
| From position k just after an attr name, read ="value". | |
| static bool | internal_find_attr_value (const char *tag, size_t tag_len, const char *attr, char *out, size_t out_cap) |
| Read the value of attr inside one tag [tag, tag+tag_len). | |
| static bool | internal_contains_ok (const char *url, const char *needle) |
| True if needle is empty/NULL or a substring of url. | |
| static bool | internal_copy_fits (char *out, size_t out_cap, const char *src) |
| Copy src into out if it fits (incl. | |
Shared bounded markup lexer helpers for media extraction units.
Centralizes allocation-free ASCII matching, attribute parsing, and bounded string copies used by the image and titled-anchor scanners. Every definition is internal inline code in the including unit.
Definition in file mdl_extract_internal.h.
|
inlinestatic |
True if needle is empty/NULL or a substring of url.
Applies the optional substring filter without modifying either input. Both NUL-terminated inputs remain borrowed for the call.
| [in] | url | NUL-terminated URL input. |
| [in] | needle | Optional substring filter. |
needle is absent, empty, or occurs in url. | true | The documented predicate holds or the requested operation completed. |
| false | The predicate does not hold or validation rejected the operation. |
Definition at line 226 of file mdl_extract_internal.h.
References RA8_INTERNAL, and strstr().
Referenced by internal_emit_hit(), and internal_emit_tag_url().
|
inlinestatic |
Copy src into out if it fits (incl.
NUL).
Applies locale-independent HTML token rules to caller-owned text. Offsets and copies remain inside supplied spans and capacities.
| [out] | out | Caller-owned result storage. |
| [in] | out_cap | Destination capacity including any terminator. |
| [in] | src | Readable source bytes. |
src and its terminator fit completely in out. | true | The documented predicate holds or the requested operation completed. |
| false | The predicate does not hold or validation rejected the operation. |
Definition at line 250 of file mdl_extract_internal.h.
References memcpy(), RA8_INTERNAL, and strlen().
Referenced by internal_emit_tag_url(), internal_merge_hit(), internal_selector_copy(), and mdl_extract_resolve_url().
|
inlinestatic |
Read the value of attr inside one tag [tag, tag+tag_len).
Applies locale-independent HTML token rules to caller-owned text. Offsets and copies remain inside supplied spans and capacities.
| [in] | tag | Readable tag byte span. |
| [in] | tag_len | Readable tag length. |
| [in] | attr | Attribute name to locate. |
| [out] | out | Caller-owned result storage. |
| [in] | out_cap | Destination capacity including any terminator. |
| true | The documented predicate holds or the requested operation completed. |
| false | The predicate does not hold or validation rejected the operation. |
Definition at line 188 of file mdl_extract_internal.h.
References internal_find_ci(), internal_is_attr_boundary(), internal_read_eq_value(), RA8_INTERNAL, and strlen().
Referenced by internal_anchor_title(), internal_emit_hit(), internal_emit_tag_url(), internal_extract_class(), and internal_extract_meta().
|
inlinestatic |
Case-insensitive search for needle in [hay, hay+hay_len).
Definition at line 80 of file mdl_extract_internal.h.
References internal_lc(), and strlen().
Referenced by internal_anchor_title(), internal_extract_class(), internal_extract_label(), internal_extract_meta(), internal_find_attr_value(), internal_scan_tags(), and mdl_extract_hits().
|
inlinestatic |
True if c ends an HTML attribute token on its left side.
Applies locale-independent HTML token rules to caller-owned text. Offsets and copies remain inside supplied spans and capacities.
| [in] | c | Input ASCII byte. |
c may delimit the left edge of an attribute. | true | The documented predicate holds or the requested operation completed. |
| false | The predicate does not hold or validation rejected the operation. |
Definition at line 53 of file mdl_extract_internal.h.
References RA8_INTERNAL.
Referenced by internal_find_attr_value().
|
inlinestatic |
True if c terminates a tag name (so "<a" != "<article").
Applies locale-independent HTML token rules to caller-owned text. Offsets and copies remain inside supplied spans and capacities.
| [in] | c | Input ASCII byte. |
c terminates an HTML tag name. | true | The documented predicate holds or the requested operation completed. |
| false | The predicate does not hold or validation rejected the operation. |
Definition at line 73 of file mdl_extract_internal.h.
References RA8_INTERNAL.
Referenced by internal_scan_tags(), and mdl_extract_hits().
|
inlinestatic |
ASCII lower-case (locale-independent).
Applies locale-independent HTML token rules to caller-owned text. Offsets and copies remain inside supplied spans and capacities.
| [in] | c | Input ASCII byte. |
c, or c unchanged outside A-Z. | 0 | The input character was NUL. |
| other | Lower-case mapping or unchanged input character. |
Definition at line 32 of file mdl_extract_internal.h.
References RA8_INTERNAL.
Referenced by internal_find_ci().
|
inlinestatic |
From position k just after an attr name, read ="value".
Applies locale-independent HTML token rules to caller-owned text. Offsets and copies remain inside supplied spans and capacities.
| [in] | tag | Readable tag byte span. |
| [in] | tag_len | Readable tag length. |
| [in,out] | k | Current bounded scan offset. |
| [out] | out | Caller-owned result storage. |
| [in] | out_cap | Destination capacity including any terminator. |
| true | The documented predicate holds or the requested operation completed. |
| false | The predicate does not hold or validation rejected the operation. |
Definition at line 143 of file mdl_extract_internal.h.
References internal_skip_ws().
Referenced by internal_find_attr_value().
|
inlinestatic |
Advance past spaces/tabs in [k, tag_len).
Applies locale-independent HTML token rules to caller-owned text. Offsets and copies remain inside supplied spans and capacities.
| [in] | tag | Readable tag byte span. |
| [in] | tag_len | Readable tag length. |
| [in,out] | k | Current bounded scan offset. |
k that is not a space or tab. | tag_len | Only whitespace remains through the end of the span. |
| other | First non-whitespace offset in the span. |
Definition at line 114 of file mdl_extract_internal.h.
References RA8_INTERNAL.
Referenced by internal_read_eq_value().