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

Private byte-stream helpers shared by mdl CLI units. More...

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

Go to the source code of this file.

Functions

ra8_err_t priv_mdl_cli_put_parts (ra8_io_stream_t *stream, const char *const *parts, size_t count)
 Write a bounded ordered vector of NUL-terminated text fragments.
ra8_err_t priv_mdl_cli_reject_parts (ra8_io_stream_t *stream, const char *const *parts, size_t count)
 Write a rejection diagnostic and return invalid-argument status.

Detailed Description

Private byte-stream helpers shared by mdl CLI units.

Declares bounded diagnostic fragment composition used by the split CLI parser and usage presenters.

Definition in file mdl_cli_internal.h.

Function Documentation

◆ priv_mdl_cli_put_parts()

ra8_err_t priv_mdl_cli_put_parts ( ra8_io_stream_t * stream,
const char *const * parts,
size_t count )

Write a bounded ordered vector of NUL-terminated text fragments.

Parameters
[in,out]streamBound destination stream.
[in]partsArray of borrowed text pointers.
[in]countNumber of entries in parts.
Returns
Canonical stream or argument status.
Return values
k_ra8_okEvery fragment was accepted in order.
k_ra8_err_null_ptrA required pointer or fragment was null.
k_ra8_err_invalid_sizecount exceeds the fixed fragment ceiling.
otherThe destination rejected a fragment.
Precondition
parts covers count readable pointer entries.
Every non-null fragment is NUL-terminated.
Postcondition
Success writes the concatenation without separators or terminators.
Failure stops at the first rejected or invalid fragment.
Note
Thread-safe across distinct streams.
Since
0.1.0

Writes fragments in order through the injected stream. The first sink error stops later writes and is returned unchanged.

Definition at line 18 of file mdl_cli_stream.c.

References k_mdl_cli_part_limit, k_ra8_err_invalid_size, k_ra8_err_null_ptr, k_ra8_ok, ra8_io_stream_puts(), RA8_LOOP_BOUND, and RA8_PRIV.

Referenced by internal_cli_reject_limit(), internal_cli_usage_actions(), internal_cli_usage_discovery(), mdl_cli_usage(), and priv_mdl_cli_reject_parts().

◆ priv_mdl_cli_reject_parts()

ra8_err_t priv_mdl_cli_reject_parts ( ra8_io_stream_t * stream,
const char *const * parts,
size_t count )

Write a rejection diagnostic and return invalid-argument status.

Parameters
[in,out]streamBound diagnostic stream.
[in]partsOrdered fragments forming one complete diagnostic.
[in]countNumber of entries in parts.
Returns
Invalid-argument after a complete write, or the stream failure.
Return values
k_ra8_err_invalid_argEvery diagnostic fragment was accepted.
otherArgument validation or destination write failed first.
Precondition
parts includes any required prefix and newline.
stream is exclusively owned for the call.
Postcondition
A successful diagnostic is never reported as command success.
Stream failures are not hidden behind validation status.
Note
Thread-safe across distinct streams.
Since
0.1.0

Writes fragments in order through the injected stream. The first sink error stops later writes and is returned unchanged.

Definition at line 41 of file mdl_cli_stream.c.

References k_ra8_err_invalid_arg, k_ra8_ok, priv_mdl_cli_put_parts(), and RA8_PRIV.

Referenced by internal_cli_invalid(), internal_cli_parse_chapter_pick(), internal_cli_reject_integer(), internal_cli_reject_limit(), internal_cli_validate_num_ranges(), internal_prepare_run_policy(), and internal_validate_allowed_args().