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

What this FORM injects, and how one parsed invocation reaches a mode. More...

#include "mdl_app.h"
#include "mdl_cli.h"
#include "mdl_format.h"
#include "ra8_attributes.h"
Include dependency graph for mdl_compose_internal.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

const mdl_net_provider_tpriv_mdl_compose_net_provider (void)
 The libcurl transport factory this form injects into every run.
mdl_series_run_t priv_mdl_compose_build_run (const mdl_args_t *a, mdl_format_t format, const mdl_run_opts_t *opts, const mdl_nums_t *n)
 Translate validated argv state into one portable series-run value.
int priv_mdl_compose_dispatch (const mdl_args_t *a, mdl_cli_mode_t mode, mdl_format_t format, const mdl_run_opts_t *opts, const mdl_nums_t *nums, const mdl_series_run_t *run)
 Route the one validated mode to its portable application entry point.

Detailed Description

What this FORM injects, and how one parsed invocation reaches a mode.

The only place the argv grammar and the portable application layer meet. Everything here is a translation – an mdl_args_t field into a value ::mdl_app.h already names, or a concrete host backend into the seam that consumes it – so nothing above it has to know a command line exists and nothing below it names libcurl.

Definition in file mdl_compose_internal.h.

Function Documentation

◆ priv_mdl_compose_build_run()

mdl_series_run_t priv_mdl_compose_build_run ( const mdl_args_t * a,
mdl_format_t format,
const mdl_run_opts_t * opts,
const mdl_nums_t * n )

Translate validated argv state into one portable series-run value.

Copies only validated selections, numeric bounds, output format and policy pointers, so the application layer sees values rather than the argv-shaped structs that produced them.

Parameters
[in]aParsed and validated command-line options.
[in]formatValidated output format.
[in]optsValidated run policy, including the injected transport.
[in]nValidated numeric command options.
Returns
The assembled run description.
Return values
mdl_series_run_tA value borrowing the caller-owned argument storage.
Precondition
a, opts and n are non-NULL and were validated.
Referenced strings outlive every dispatched run function.
Postcondition
The returned value owns no newly allocated storage.
The input objects remain unchanged.
Note
Thread-safe for independent input objects.
Since
0.1.0

Definition at line 71 of file mdl_compose.c.

References mdl_args_t::cache_dir, mdl_args_t::cfg, mdl_nums_t::chapters, mdl_nums_t::from_num, mdl_nums_t::from_present, mdl_args_t::out, RA8_PRIV, mdl_nums_t::seed, mdl_args_t::separate, mdl_args_t::series, mdl_nums_t::timeout, and mdl_args_t::update.

Referenced by internal_main_run().

◆ priv_mdl_compose_dispatch()

int priv_mdl_compose_dispatch ( const mdl_args_t * a,
mdl_cli_mode_t mode,
mdl_format_t format,
const mdl_run_opts_t * opts,
const mdl_nums_t * nums,
const mdl_series_run_t * run )

Route the one validated mode to its portable application entry point.

The whole of the argv-to-application translation: every case reads the fields that mode needs out of a and nums and calls one ::mdl_app.h entry point. The mode enum already encodes the selection strictly, so no case re-derives it from option precedence.

Parameters
[in]aParsed and validated command-line options.
[in]modeThe one mode mdl_cli_validate selected.
[in]formatValidated output format.
[in]optsValidated run policy, including the injected transport.
[in]numsValidated numeric command options.
[in]runPrepared series-run template.
Returns
Process-style status from the selected mode.
Return values
0The selected operation completed successfully.
1The selected operation reported an execution failure.
2The mode value was not one validation can produce.
Precondition
All pointer arguments are non-NULL.
mode was produced by mdl_cli_validate and a context is bound.
Postcondition
Exactly one mode entry point is invoked.
Non-selected mode entry points perform no work.
Note
Not thread-safe because the modes share one bound context.
Since
0.1.0

Definition at line 91 of file mdl_compose.c.

References mdl_args_t::attr, mdl_args_t::browse, mdl_args_t::cfg, mdl_args_t::init_site_url, k_mdl_cli_mode_artifact, k_mdl_cli_mode_browse, k_mdl_cli_mode_init_site, k_mdl_cli_mode_list, k_mdl_cli_mode_pack, k_mdl_cli_mode_page, k_mdl_cli_mode_remove, k_mdl_cli_mode_search, k_mdl_cli_mode_series, k_mdl_cli_mode_update_all, k_mdl_cli_mode_verify, mdl_nums_t::max_imgs, mdl_app_run_artifact(), mdl_app_run_discover(), mdl_app_run_init_site(), mdl_app_run_list(), mdl_app_run_pack(), mdl_app_run_page(), mdl_app_run_remove(), mdl_app_run_series(), mdl_app_run_update_all(), mdl_app_run_verify(), mdl_args_t::out, mdl_args_t::pack, mdl_args_t::page_url, mdl_args_t::pick, mdl_nums_t::pick, RA8_PRIV, mdl_args_t::remove_series, mdl_nums_t::seed, mdl_nums_t::timeout, and mdl_args_t::verify_dir.

Referenced by internal_main_run().

◆ priv_mdl_compose_net_provider()

const mdl_net_provider_t * priv_mdl_compose_net_provider ( void )

The libcurl transport factory this form injects into every run.

Returns the one provider whose open wires mdl_net_curl_init over this form's own backend storage. A run mode receives it through mdl_run_opts_t and never names libcurl; another form returns a different provider from its own composition and the modes are unchanged.

Returns
The provider to publish in mdl_run_opts_t::net.
Return values
non-NULLA process-lifetime provider valid for the whole run.
Precondition
The process is single-threaded with respect to network runs.
No interface previously opened from this provider is still live.
Postcondition
No caller-visible state is modified.
Successive calls return the same provider.
Note
Not thread-safe: one backend storage serves one serial run at a time.
Since
0.1.0

Definition at line 66 of file mdl_compose.c.

References RA8_PRIV, and s_curl_provider.

Referenced by main().