From f5b6a4a272e6d63b67319be63ed4fcb92570e9c4 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Wed, 2 Aug 2023 21:32:26 -0500 Subject: [PATCH] Update: Move standard console parameters enumeration into a standard enumeration set and provide appropriate functions. This should make the commonly used code slightly easier to maintain. The control project is omitted because I am in the process of migrating it. The migrated version will contain the appropriate changes from this. --- level_0/f_console/c/console/common.h | 28 +++++ level_2/fll_program/c/private-program.c | 86 ++++++++++++--- level_2/fll_program/c/private-program.h | 42 +++++++- level_2/fll_program/c/program.c | 116 ++++++++++----------- level_2/fll_program/c/program.h | 58 +++++++++++ level_3/byte_dump/c/main/common.c | 64 ++++-------- level_3/byte_dump/c/main/common.h | 6 +- level_3/byte_dump/c/main/common/enumeration.h | 16 +-- level_3/byte_dump/c/main/common/print.c | 4 +- level_3/byte_dump/c/main/common/print.h | 4 +- level_3/controller/c/common.c | 61 ++++------- level_3/controller/c/common.h | 16 +-- level_3/controller/c/controller.c | 57 +++------- level_3/controller/c/rule/private-rule.c | 14 +-- level_3/fake/c/main/common.c | 60 ++++------- level_3/fake/c/main/common.h | 4 +- level_3/fake/c/main/common/enumeration.h | 16 +-- level_3/fake/c/main/common/print.c | 4 +- level_3/fake/c/main/common/print.h | 4 +- level_3/fake/c/main/make/load_parameters.c | 28 ++--- level_3/fake/c/main/make/operate_process_type.c | 4 +- level_3/firewall/c/common.c | 59 ++++------- level_3/firewall/c/common.h | 13 +-- level_3/firewall/c/firewall.c | 57 +++------- level_3/fss_embedded_list_read/c/common.c | 61 ++++------- level_3/fss_embedded_list_read/c/common.h | 16 +-- .../c/fss_embedded_list_read.c | 57 +++------- level_3/fss_identify/c/main/common.c | 44 ++++---- level_3/fss_identify/c/main/common/enumeration.h | 16 +-- level_3/fss_identify/c/main/common/print.c | 4 +- level_3/fss_identify/c/main/common/print.h | 4 +- level_3/fss_read/c/main/common.c | 64 ++++-------- level_3/fss_read/c/main/common.h | 4 +- level_3/fss_read/c/main/common/enumeration.h | 16 +-- level_3/fss_read/c/main/common/print.c | 4 +- level_3/fss_read/c/main/common/print.h | 4 +- level_3/fss_read/c/main/main.h | 4 +- level_3/fss_write/c/main/common.c | 64 ++++-------- level_3/fss_write/c/main/common.h | 4 +- level_3/fss_write/c/main/common/enumeration.h | 16 +-- level_3/fss_write/c/main/common/print.c | 4 +- level_3/fss_write/c/main/common/print.h | 4 +- level_3/fss_write/c/main/main.h | 4 +- level_3/iki_read/c/main/common.c | 78 +++++--------- level_3/iki_read/c/main/common.h | 4 +- level_3/iki_read/c/main/common/enumeration.h | 16 +-- level_3/iki_read/c/main/common/print.c | 4 +- level_3/iki_read/c/main/common/print.h | 4 +- level_3/iki_write/c/main/common.c | 60 ++++------- level_3/iki_write/c/main/common.h | 4 +- level_3/iki_write/c/main/common/enumeration.h | 16 +-- level_3/iki_write/c/main/common/print.c | 4 +- level_3/iki_write/c/main/common/print.h | 4 +- level_3/status_code/c/main/common.c | 78 +++++--------- level_3/status_code/c/main/common/enumeration.h | 16 +-- level_3/status_code/c/main/common/print.c | 4 +- level_3/status_code/c/main/common/print.h | 4 +- level_3/utf8/c/main/common.c | 64 ++++-------- level_3/utf8/c/main/common/enumeration.h | 16 +-- level_3/utf8/c/main/common/print.c | 4 +- level_3/utf8/c/main/common/print.h | 4 +- 61 files changed, 652 insertions(+), 947 deletions(-) diff --git a/level_0/f_console/c/console/common.h b/level_0/f_console/c/console/common.h index 337245c..21e9734 100644 --- a/level_0/f_console/c/console/common.h +++ b/level_0/f_console/c/console/common.h @@ -553,6 +553,34 @@ extern "C" { #endif // _di_f_console_parameters_t_ /** + * Provide enumerations for the console parameters. + * + * See the f_console_standard_*_s strings for details. + * + * The f_console_standard_parameter_last_e is not a parameter. + * f_console_standard_parameter_last_e represents the end of the enumeration. + * Use f_console_standard_parameter_last_e as the starting enum for any custom project. + */ +#ifndef _di_f_console_parameter_state_type_e_ + enum { + f_console_standard_parameter_help_e = 0, + f_console_standard_parameter_copyright_e, + f_console_standard_parameter_light_e, + f_console_standard_parameter_dark_e, + f_console_standard_parameter_no_color_e, + f_console_standard_parameter_verbosity_quiet_e, + f_console_standard_parameter_verbosity_error_e, + f_console_standard_parameter_verbosity_normal_e, + f_console_standard_parameter_verbosity_verbose_e, + f_console_standard_parameter_verbosity_debug_e, + f_console_standard_parameter_version_e, + f_console_standard_parameter_line_first_no_e, + f_console_standard_parameter_line_last_no_e, + f_console_standard_parameter_last_e, + }; // enum +#endif // _di_f_console_standard_parameter_e_ + +/** * Create some standard command line parameter options required/expected by the kevux/fss/fll specifications. * * It is expected that all of the "+" and "++" console options described below are reserved for these purposes. diff --git a/level_2/fll_program/c/private-program.c b/level_2/fll_program/c/private-program.c index 2d9a562..3deadb7 100644 --- a/level_2/fll_program/c/private-program.c +++ b/level_2/fll_program/c/private-program.c @@ -5,6 +5,68 @@ extern "C" { #endif +#if !defined(_di_fll_program_parameter_process_context_) || !defined(_di_fll_program_parameter_process_context_standard_) + f_status_t private_fll_program_parameter_process_context(const f_uint16s_t choices, const uint8_t modes[], const bool right, fll_program_data_t * const main) { + + { + if (choices.used) { + f_status_t status = F_none; + f_number_unsigned_t choice = 0; + + if (right) { + status = f_console_parameter_prioritize_right(main->parameters, choices, &choice); + } + else { + status = f_console_parameter_prioritize_left(main->parameters, choices, &choice); + } + + if (F_status_is_error(status)) return status; + + if (status == F_data_not) { + main->context.mode = modes[choices.used - 1]; + } + else { + main->context.mode = modes[choice]; + } + + if (main->context.mode == f_color_mode_dark_e || main->context.mode == f_color_mode_light_e) { + status = f_color_load_context(main->context.mode, &main->context); + if (F_status_is_error(status)) return status; + } + } + else { + main->context.mode = f_color_mode_not_e; + } + } + + main->message.set = + main->output.set = + main->error.set = + main->warning.set = &main->context.set; + + if (main->context.set.error.before) { + main->message.context = f_color_set_empty_s; + main->message.notable = main->context.set.notable; + + main->output.context = f_color_set_empty_s; + main->output.notable = main->context.set.notable; + + main->error.context = main->context.set.error; + main->error.notable = main->context.set.notable; + + main->warning.context = main->context.set.warning; + main->warning.notable = main->context.set.notable; + } + else { + f_color_set_t * const sets[] = { &main->message.context, &main->message.notable, &main->output.context, &main->output.notable, &main->error.context, &main->error.notable, &main->warning.context, &main->warning.notable, 0 }; + + private_fll_program_parameter_process_empty(&main->context, sets); + } + + return F_none; + } +#endif // !defined(_di_fll_program_parameter_process_context_) || !defined(_di_fll_program_parameter_process_context_standard_) + #if !defined(_di_fll_program_print_help_option_) || !defined(_di_fll_program_print_help_option_standard_) f_status_t private_fll_program_print_help_option(fl_print_t * const print, const f_string_static_t option_short, const f_string_static_t option_long, const f_string_static_t symbol_short, const f_string_static_t symbol_long, const char *description) { @@ -42,19 +104,19 @@ extern "C" { } #endif // !defined(_di_fll_program_standard_signal_received_) || !defined(_di_fll_program_standard_signal_handle_) -#if !defined(_di_fll_program_parameter_process_context_) || !defined(_di_fll_program_parameter_process_empty_) +#if !defined(_di_fll_program_parameter_process_context_) || !defined(_di_fll_program_parameter_process_context_standard_) || !defined(_di_fll_program_parameter_process_empty_) void private_fll_program_parameter_process_empty(f_color_context_t * const context, f_color_set_t * const sets[]) { - context->set.error = f_color_set_empty_s; - context->set.important = f_color_set_empty_s; - context->set.normal = f_color_set_empty_s; - context->set.normal_reset = f_color_set_empty_s; - context->set.notable = f_color_set_empty_s; - context->set.reset = f_color_set_empty_s; - context->set.standout = f_color_set_empty_s; - context->set.success = f_color_set_empty_s; - context->set.title = f_color_set_empty_s; - context->set.warning = f_color_set_empty_s; + context->set.error = + context->set.important = + context->set.normal = + context->set.normal_reset = + context->set.notable = + context->set.reset = + context->set.standout = + context->set.success = + context->set.title = + context->set.warning = f_color_set_empty_s; if (sets) { for (f_number_unsigned_t i = 0; sets[i]; ++i) { @@ -62,7 +124,7 @@ extern "C" { } // for } } -#endif // !defined(_di_fll_program_parameter_process_context_) || !defined(_di_fll_program_parameter_process_empty_) +#endif // !defined(_di_fll_program_parameter_process_context_) || !defined(_di_fll_program_parameter_process_context_standard_) || !defined(_di_fll_program_parameter_process_empty_) #ifdef __cplusplus } // extern "C" diff --git a/level_2/fll_program/c/private-program.h b/level_2/fll_program/c/private-program.h index 0619c3c..c32bd38 100644 --- a/level_2/fll_program/c/private-program.h +++ b/level_2/fll_program/c/private-program.h @@ -16,6 +16,43 @@ extern "C" { #endif /** + * Private implementation of fll_program_parameter_process_context(). + * + * Intended to be shared to each of the different implementation variations. + * + * @param choices + * An array of color modes. + * The default, if no mode is specified, will be the last value in the array. + * @param modes + * An array designating the context modes associated with each choice. + * This must exactly match the size of the choices array. + * No bounds checking is performed. + * @param right + * If TRUE, use the right-most parameter on conflict. + * If FALSE, use the left-most parameter on conflict. + * @param main + * The main program data. + * + * @return + * F_none on success. + * F_data_not if "values" parameters were expected but not found. + * + * F_memory_not (with error bit) on out of memory. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_console_parameter_prioritize_left(). + * Errors (with error bit) from: f_console_parameter_prioritize_right(). + * Errors (with error bit) from: f_color_load_context(). + * + * @see f_console_parameter_prioritize_left() + * @see f_console_parameter_prioritize_right() + * @see f_color_load_context() + */ +#if !defined(_di_fll_program_parameter_process_context_) || !defined(_di_fll_program_parameter_process_context_standard_) + extern f_status_t private_fll_program_parameter_process_context(const f_uint16s_t choices, const uint8_t modes[], const bool right, fll_program_data_t * const main); +#endif // !defined(_di_fll_program_parameter_process_context_) || !defined(_di_fll_program_parameter_process_context_standard_) + +/** * Print standard help option. * * This print function does not use locking, be sure something like flockfile() and funlockfile() are appropriately called. @@ -79,11 +116,12 @@ extern "C" { * Set to NULL to not use. * * @see fll_program_parameter_process_context() + * @see fll_program_parameter_process_context_standard() * @see fll_program_parameter_process_empty() */ -#if !defined(_di_fll_program_parameter_process_context_) || !defined(_di_fll_program_parameter_process_empty_) +#if !defined(_di_fll_program_parameter_process_context_) || !defined(_di_fll_program_parameter_process_context_standard_) || !defined(_di_fll_program_parameter_process_empty_) extern void private_fll_program_parameter_process_empty(f_color_context_t * const context, f_color_set_t * const sets[]) F_attribute_visibility_internal_d; -#endif // !defined(_di_fll_program_parameter_process_context_) || !defined(_di_fll_program_parameter_process_empty_) +#endif // !defined(_di_fll_program_parameter_process_context_) || !defined(_di_fll_program_parameter_process_context_standard_) || !defined(_di_fll_program_parameter_process_empty_) #ifdef __cplusplus } // extern "C" diff --git a/level_2/fll_program/c/program.c b/level_2/fll_program/c/program.c index cb5cd2e..c90ec82 100644 --- a/level_2/fll_program/c/program.c +++ b/level_2/fll_program/c/program.c @@ -7,71 +7,32 @@ extern "C" { #ifndef _di_fll_program_parameter_process_context_ f_status_t fll_program_parameter_process_context(const f_uint16s_t choices, const uint8_t modes[], const bool right, fll_program_data_t * const main) { + #ifndef _di_level_2_parameter_checking_ + if (!main) return F_status_set_error(F_parameter); + #endif // _di_level_2_parameter_checking_ - { - if (choices.used) { - f_status_t status = F_none; - f_number_unsigned_t choice = 0; - - if (right) { - status = f_console_parameter_prioritize_right(main->parameters, choices, &choice); - } - else { - status = f_console_parameter_prioritize_left(main->parameters, choices, &choice); - } - - if (F_status_is_error(status)) return status; - - if (status == F_data_not) { - main->context.mode = modes[choices.used - 1]; - } - else { - main->context.mode = modes[choice]; - } - - if (main->context.mode == f_color_mode_dark_e || main->context.mode == f_color_mode_light_e) { - status = f_color_load_context(main->context.mode, &main->context); - if (F_status_is_error(status)) return status; - } - } - else { - main->context.mode = f_color_mode_not_e; - } - } - - main->message.set = &main->context.set; - main->output.set = &main->context.set; - main->error.set = &main->context.set; - main->warning.set = &main->context.set; - - if (main->context.set.error.before) { - main->message.context = f_color_set_empty_s; - main->message.notable = main->context.set.notable; - - main->output.context = f_color_set_empty_s; - main->output.notable = main->context.set.notable; - - main->error.context = main->context.set.error; - main->error.notable = main->context.set.notable; + return private_fll_program_parameter_process_context(choices, modes, right, main); + } +#endif // _di_fll_program_parameter_process_context_ - main->warning.context = main->context.set.warning; - main->warning.notable = main->context.set.notable; - } - else { - f_color_set_t *sets[] = { &main->message.context, &main->message.notable, &main->output.context, &main->output.notable, &main->error.context, &main->error.notable, &main->warning.context, &main->warning.notable, 0 }; +#ifndef _di_fll_program_parameter_process_context_standard_ + f_status_t fll_program_parameter_process_context_standard(const bool right, fll_program_data_t * const main) { + #ifndef _di_level_2_parameter_checking_ + if (!main) return F_status_set_error(F_parameter); + #endif // _di_level_2_parameter_checking_ - private_fll_program_parameter_process_empty(&main->context, sets); - } + uint16_t array[3] = { f_console_standard_parameter_no_color_e, f_console_standard_parameter_light_e, f_console_standard_parameter_dark_e }; + const f_uint16s_t choices = macro_f_uint16s_t_initialize_1(array, 0, 3); + const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e }; - return F_none; + return private_fll_program_parameter_process_context(choices, modes, right, main); } -#endif // _di_fll_program_parameter_process_context_ +#endif // _di_fll_program_parameter_process_context_standard_ #ifndef _di_fll_program_parameter_process_empty_ f_status_t fll_program_parameter_process_empty(f_color_context_t * const context, f_color_set_t * const sets[]) { #ifndef _di_level_2_parameter_checking_ if (!context) return F_status_set_error(F_parameter); - if (!sets) return F_status_set_error(F_parameter); #endif // _di_level_2_parameter_checking_ private_fll_program_parameter_process_empty(context, sets); @@ -109,11 +70,43 @@ extern "C" { } #endif // _di_fll_program_parameter_process_verbosity_ +#ifndef _di_fll_program_parameter_process_verbosity_standard_ + f_status_t fll_program_parameter_process_verbosity_standard(const bool right, fll_program_data_t * const main) { + #ifndef _di_level_2_parameter_checking_ + if (!main) return F_status_set_error(F_parameter); + #endif // _di_level_2_parameter_checking_ + + uint16_t array[5] = { f_console_standard_parameter_verbosity_quiet_e, f_console_standard_parameter_verbosity_error_e, f_console_standard_parameter_verbosity_verbose_e, f_console_standard_parameter_verbosity_debug_e, f_console_standard_parameter_verbosity_normal_e }; + const f_uint16s_t choices = macro_f_uint16s_t_initialize_1(array, 0, 5); + + const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e }; + + + f_number_unsigned_t choice = 0; + + { + const f_status_t status = right ? f_console_parameter_prioritize_right(main->parameters, choices, &choice) : f_console_parameter_prioritize_left(main->parameters, choices, &choice); + + if (F_status_is_error(status)) return status; + + if (status == F_data_not) { + choice = choices.used - 1; + } + } + + main->message.verbosity = verbosity[choice]; + main->output.verbosity = main->message.verbosity; + main->error.verbosity = main->message.verbosity; + main->warning.verbosity = main->message.verbosity; + + return F_none; + } +#endif // _di_fll_program_parameter_process_verbosity_standard_ + #ifndef _di_fll_program_parameter_additional_append_ f_status_t fll_program_parameter_additional_append(const f_string_static_t * const arguments, const f_number_unsigneds_t values, f_string_dynamics_t * const destination) { #ifndef _di_level_2_parameter_checking_ - if (!arguments) return F_status_set_error(F_parameter); - if (!destination) return F_status_set_error(F_parameter); + if (!arguments || !destination) return F_status_set_error(F_parameter); #endif // _di_level_2_parameter_checking_ f_status_t status = F_none; @@ -149,8 +142,7 @@ extern "C" { #ifndef _di_fll_program_parameter_additional_mash_ f_status_t fll_program_parameter_additional_mash(const f_string_static_t glue, const f_string_static_t * const arguments, const f_number_unsigneds_t values, f_string_dynamic_t * const destination) { #ifndef _di_level_2_parameter_checking_ - if (!arguments) return F_status_set_error(F_parameter); - if (!destination) return F_status_set_error(F_parameter); + if (!arguments || !destination) return F_status_set_error(F_parameter); #endif // _di_level_2_parameter_checking_ f_status_t status = F_none; @@ -174,8 +166,7 @@ extern "C" { #ifndef _di_fll_program_parameter_additional_rip_ f_status_t fll_program_parameter_additional_rip(const f_string_static_t * const arguments, const f_number_unsigneds_t values, f_string_dynamics_t * const destination) { #ifndef _di_level_2_parameter_checking_ - if (!arguments) return F_status_set_error(F_parameter); - if (!destination) return F_status_set_error(F_parameter); + if (!arguments || !destination) return F_status_set_error(F_parameter); #endif // _di_level_2_parameter_checking_ f_status_t status = F_none; @@ -211,8 +202,7 @@ extern "C" { #ifndef _di_fll_program_parameter_additional_rip_mash_ f_status_t fll_program_parameter_additional_rip_mash(const f_string_static_t glue, const f_string_static_t * const arguments, const f_number_unsigneds_t values, f_string_dynamic_t * const destination) { #ifndef _di_level_2_parameter_checking_ - if (!arguments) return F_status_set_error(F_parameter); - if (!destination) return F_status_set_error(F_parameter); + if (!arguments || !destination) return F_status_set_error(F_parameter); #endif // _di_level_2_parameter_checking_ f_status_t status = F_none; diff --git a/level_2/fll_program/c/program.h b/level_2/fll_program/c/program.h index 14c9e46..4e6e465 100644 --- a/level_2/fll_program/c/program.h +++ b/level_2/fll_program/c/program.h @@ -75,6 +75,38 @@ extern "C" { #endif // _di_fll_program_parameter_process_context_ /** + * Determine the color context from the parameters and then set the color context based on the choice. + * + * This will allow for the color context and the color sets to be safely used when colors are disabled. + * + * This is identical to fll_program_parameter_process_context() except it provides the standard choices and modes. + * + * @param right + * If TRUE, use the right-most parameter on conflict. + * If FALSE, use the left-most parameter on conflict. + * @param main + * The main program data. + * + * @return + * F_none on success. + * F_data_not if "values" parameters were expected but not found. + * + * F_memory_not (with error bit) on out of memory. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_console_parameter_prioritize_left(). + * Errors (with error bit) from: f_console_parameter_prioritize_right(). + * Errors (with error bit) from: f_color_load_context(). + * + * @see f_console_parameter_prioritize_left() + * @see f_console_parameter_prioritize_right() + * @see f_color_load_context() + */ +#ifndef _di_fll_program_parameter_process_context_standard_ + extern f_status_t fll_program_parameter_process_context_standard(const bool right, fll_program_data_t * const main); +#endif // _di_fll_program_parameter_process_context_standard_ + +/** * Set the provided context to empty along with all additional color sets. * * This will allow for safe usage of the color context and color sets to be safely processed when colors are disabled. @@ -127,6 +159,32 @@ extern "C" { #endif // _di_fll_program_parameter_process_verbosity_ /** + * Determine the verbosity from the parameters and then set the verbosity based on the choice. + * + * This is identical to fll_program_parameter_process_verbosity() except it provides the standard choices and modes. + * + * @param right + * If TRUE, use the right-most parameter on conflict. + * If FALSE, use the left-most parameter on conflict. + * @param main + * The main program data. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_console_parameter_prioritize_left(). + * Errors (with error bit) from: f_console_parameter_prioritize_right(). + * + * @see f_console_parameter_prioritize_left() + * @see f_console_parameter_prioritize_right() + */ +#ifndef _di_fll_program_parameter_process_verbosity_standard_ + extern f_status_t fll_program_parameter_process_verbosity_standard(const bool right, fll_program_data_t * const main); +#endif // _di_fll_program_parameter_process_verbosity_standard_ + +/** * Allocate new strings from all of the provided locations. * * These new strings are appended onto the destination. diff --git a/level_3/byte_dump/c/main/common.c b/level_3/byte_dump/c/main/common.c index 724557a..b60d79f 100644 --- a/level_3/byte_dump/c/main/common.c +++ b/level_3/byte_dump/c/main/common.c @@ -16,14 +16,14 @@ extern "C" { main->setting.state.step_small = byte_dump_allocation_small_d; // Identify and process first/last parameters. - if (main->program.parameters.array[byte_dump_parameter_line_first_no_e].result & f_console_result_found_e) { + if (main->program.parameters.array[f_console_standard_parameter_line_first_no_e].result & f_console_result_found_e) { main->setting.flag -= main->setting.flag & byte_dump_main_flag_print_first_e; } else { main->setting.flag |= byte_dump_main_flag_print_first_e; } - if (main->program.parameters.array[byte_dump_parameter_line_last_no_e].result & f_console_result_found_e) { + if (main->program.parameters.array[f_console_standard_parameter_line_last_no_e].result & f_console_result_found_e) { main->setting.flag -= main->setting.flag & byte_dump_main_flag_print_last_e; } else { @@ -40,51 +40,33 @@ extern "C" { return; } - { - f_number_unsigned_t choice = 0; - f_uint16s_t choices = f_uint16s_t_initialize; - - // Identify and prioritize "color context" parameters. - { - uint16_t choices_array[3] = { byte_dump_parameter_no_color_e, byte_dump_parameter_light_e, byte_dump_parameter_dark_e }; - choices.array = choices_array; - choices.used = 3; + main->setting.state.status = fll_program_parameter_process_context_standard(F_true, &main->program); - static const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e }; + if (F_status_is_error(main->setting.state.status)) { + if ((main->setting.flag & byte_dump_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); + } - main->setting.state.status = fll_program_parameter_process_context(choices, modes, F_true, &main->program); + byte_dump_print_error(&main->program.error, macro_byte_dump_f(fll_program_parameter_process_context_standard)); - if (F_status_is_error(main->setting.state.status)) { - if ((main->setting.flag & byte_dump_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { - fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); - } + return; + } - byte_dump_print_error(&main->program.error, macro_byte_dump_f(fll_program_parameter_process_context)); + main->setting.state.status = fll_program_parameter_process_verbosity_standard(F_true, &main->program); - return; - } + if (F_status_is_error(main->setting.state.status)) { + if ((main->setting.flag & byte_dump_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); } - // Identify and prioritize "verbosity" parameters. - { - uint16_t choices_array[5] = { byte_dump_parameter_verbosity_quiet_e, byte_dump_parameter_verbosity_error_e, byte_dump_parameter_verbosity_verbose_e, byte_dump_parameter_verbosity_debug_e, byte_dump_parameter_verbosity_normal_e }; - choices.array = choices_array; - choices.used = 5; - - static const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e }; - - main->setting.state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, &main->program); - - if (F_status_is_error(main->setting.state.status)) { - if ((main->setting.flag & byte_dump_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { - fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); - } + byte_dump_print_error(&main->program.error, macro_byte_dump_f(fll_program_parameter_process_verbosity_standard)); - byte_dump_print_error(&main->program.error, macro_byte_dump_f(fll_program_parameter_process_verbosity)); + return; + } - return; - } - } + { + f_number_unsigned_t choice = 0; + f_uint16s_t choices = f_uint16s_t_initialize; // Identify priority of mode parameters. { @@ -182,19 +164,19 @@ extern "C" { } } - if (main->program.parameters.array[byte_dump_parameter_help_e].result & f_console_result_found_e) { + if (main->program.parameters.array[f_console_standard_parameter_help_e].result & f_console_result_found_e) { main->setting.flag |= byte_dump_main_flag_help_e; return; } - if (main->program.parameters.array[byte_dump_parameter_version_e].result & f_console_result_found_e) { + if (main->program.parameters.array[f_console_standard_parameter_version_e].result & f_console_result_found_e) { main->setting.flag |= byte_dump_main_flag_version_e; return; } - if (main->program.parameters.array[byte_dump_parameter_copyright_e].result & f_console_result_found_e) { + if (main->program.parameters.array[f_console_standard_parameter_copyright_e].result & f_console_result_found_e) { main->setting.flag |= byte_dump_main_flag_copyright_e; return; diff --git a/level_3/byte_dump/c/main/common.h b/level_3/byte_dump/c/main/common.h index be220c4..c16719d 100644 --- a/level_3/byte_dump/c/main/common.h +++ b/level_3/byte_dump/c/main/common.h @@ -32,10 +32,12 @@ extern "C" { * F_none on success. * * Errors (with error bit) from: f_console_parameter_process(). - * Errors (with error bit) from: fll_program_parameter_process_context(). + * Errors (with error bit) from: fll_program_parameter_process_context_standard(). + * Errors (with error bit) from: fll_program_parameter_process_verbosity_standard(). * * @see f_console_parameter_process() - * @see fll_program_parameter_process_context() + * @see fll_program_parameter_process_context_standard() + * @see fll_program_parameter_process_verbosity_standard() */ #ifndef _di_byte_dump_setting_load_ extern void byte_dump_setting_load(const f_console_arguments_t arguments, byte_dump_main_t * const main); diff --git a/level_3/byte_dump/c/main/common/enumeration.h b/level_3/byte_dump/c/main/common/enumeration.h index 0b6a49c..b102980 100644 --- a/level_3/byte_dump/c/main/common/enumeration.h +++ b/level_3/byte_dump/c/main/common/enumeration.h @@ -120,21 +120,7 @@ extern "C" { */ #ifndef _di_byte_dump_parameter_e_ enum { - byte_dump_parameter_help_e, - byte_dump_parameter_copyright_e, - byte_dump_parameter_light_e, - byte_dump_parameter_dark_e, - byte_dump_parameter_no_color_e, - byte_dump_parameter_verbosity_quiet_e, - byte_dump_parameter_verbosity_error_e, - byte_dump_parameter_verbosity_normal_e, - byte_dump_parameter_verbosity_verbose_e, - byte_dump_parameter_verbosity_debug_e, - byte_dump_parameter_version_e, - byte_dump_parameter_line_first_no_e, - byte_dump_parameter_line_last_no_e, - - byte_dump_parameter_binary_e, + byte_dump_parameter_binary_e = f_console_standard_parameter_last_e, byte_dump_parameter_decimal_e, byte_dump_parameter_duodecimal_e, byte_dump_parameter_hexidecimal_e, diff --git a/level_3/byte_dump/c/main/common/print.c b/level_3/byte_dump/c/main/common/print.c index d751877..b989ef3 100644 --- a/level_3/byte_dump/c/main/common/print.c +++ b/level_3/byte_dump/c/main/common/print.c @@ -13,8 +13,8 @@ extern "C" { "f_string_dynamics_increase_by", "f_thread_create", "fl_conversion_dynamic_to_unsigned_detect", - "fll_program_parameter_process_context", - "fll_program_parameter_process_verbosity", + "fll_program_parameter_process_context_standard", + "fll_program_parameter_process_verbosity_standard", }; #endif // _di_byte_dump_f_a_ diff --git a/level_3/byte_dump/c/main/common/print.h b/level_3/byte_dump/c/main/common/print.h index 71ec9f9..b97bc89 100644 --- a/level_3/byte_dump/c/main/common/print.h +++ b/level_3/byte_dump/c/main/common/print.h @@ -46,8 +46,8 @@ extern "C" { byte_dump_f_f_string_dynamics_increase_by_e, byte_dump_f_f_thread_create_e, byte_dump_f_fl_conversion_dynamic_to_unsigned_detect_e, - byte_dump_f_fll_program_parameter_process_context_e, - byte_dump_f_fll_program_parameter_process_verbosity_e, + byte_dump_f_fll_program_parameter_process_context_standard_e, + byte_dump_f_fll_program_parameter_process_verbosity_standard_e, }; // enum #endif // _di_byte_dump_f_e_ diff --git a/level_3/controller/c/common.c b/level_3/controller/c/common.c index 1d6f326..4ad0ab0 100644 --- a/level_3/controller/c/common.c +++ b/level_3/controller/c/common.c @@ -623,14 +623,14 @@ extern "C" { main->setting.state.step_small = controller_allocation_small_d; // Identify and process first/last parameters. - if (main->program.parameters.array[controller_parameter_line_first_no_e].result & f_console_result_found_e) { + if (main->program.parameters.array[f_console_standard_parameter_line_first_no_e].result & f_console_result_found_e) { main->setting.flag -= main->setting.flag & controller_main_flag_print_first_e; } else { main->setting.flag |= controller_main_flag_print_first_e; } - if (main->program.parameters.array[controller_parameter_line_last_no_e].result & f_console_result_found_e) { + if (main->program.parameters.array[f_console_standard_parameter_line_last_no_e].result & f_console_result_found_e) { main->setting.flag -= main->setting.flag & controller_main_flag_print_last_e; } else { @@ -647,70 +647,47 @@ extern "C" { return; } - { - f_number_unsigned_t choice = 0; - f_uint16s_t choices = f_uint16s_t_initialize; + main->setting.state.status = fll_program_parameter_process_context_standard(F_true, &main->program); - // Identify and prioritize "color context" parameters. - { - uint16_t choices_array[3] = { controller_parameter_no_color_e, controller_parameter_light_e, controller_parameter_dark_e }; - choices.array = choices_array; - choices.used = 3; - - static const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e }; - - main->setting.state.status = fll_program_parameter_process_context(choices, modes, F_true, &main->program); - - if (F_status_is_error(main->setting.state.status)) { - fll_error_print(&main->program.error, F_status_set_fine(main->setting.state.status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e); - - if (main->program.error.verbosity > f_console_verbosity_quiet_e) { - fll_print_dynamic_raw(f_string_eol_s, main->program.error); - } + if (F_status_is_error(main->setting.state.status)) { + fll_error_print(&main->program.error, F_status_set_fine(main->setting.state.status), "fll_program_parameter_process_context_standard", fll_error_file_flag_fallback_e); - return; - } + if (main->program.error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.error); } - // Identify and prioritize "verbosity" parameters. - { - uint16_t choices_array[5] = { controller_parameter_verbosity_quiet_e, controller_parameter_verbosity_error_e, controller_parameter_verbosity_verbose_e, controller_parameter_verbosity_debug_e, controller_parameter_verbosity_normal_e }; - choices.array = choices_array; - choices.used = 5; - - static const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e }; - - main->setting.state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, &main->program); + return; + } - if (F_status_is_error(main->setting.state.status)) { - fll_error_print(&main->program.error, F_status_set_fine(main->setting.state.status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e); + main->setting.state.status = fll_program_parameter_process_verbosity_standard(F_true, &main->program); - if (main->program.error.verbosity > f_console_verbosity_quiet_e) { - fll_print_dynamic_raw(f_string_eol_s, main->program.error); - } + if (F_status_is_error(main->setting.state.status)) { + fll_error_print(&main->program.error, F_status_set_fine(main->setting.state.status), "fll_program_parameter_process_verbosity_standard", fll_error_file_flag_fallback_e); - return; - } + if (main->program.error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.error); } + + return; } main->program.output.to.id = F_type_descriptor_output_d; main->program.output.to.stream = F_type_output_d; main->program.output.to.flag = F_file_flag_create_d | F_file_flag_write_only_d | F_file_flag_append_d; - if (main->program.parameters.array[controller_parameter_help_e].result & f_console_result_found_e) { + if (main->program.parameters.array[f_console_standard_parameter_help_e].result & f_console_result_found_e) { main->setting.flag |= controller_main_flag_help_e; return; } - if (main->program.parameters.array[controller_parameter_version_e].result & f_console_result_found_e) { + if (main->program.parameters.array[f_console_standard_parameter_version_e].result & f_console_result_found_e) { main->setting.flag |= controller_main_flag_version_e; return; } - if (main->program.parameters.array[controller_parameter_copyright_e].result & f_console_result_found_e) { + if (main->program.parameters.array[f_console_standard_parameter_copyright_e].result & f_console_result_found_e) { main->setting.flag |= controller_main_flag_copyright_e; return; diff --git a/level_3/controller/c/common.h b/level_3/controller/c/common.h index 3bed915..1c800bf 100644 --- a/level_3/controller/c/common.h +++ b/level_3/controller/c/common.h @@ -132,21 +132,7 @@ extern "C" { extern const f_string_static_t controller_long_validate_s; enum { - controller_parameter_help_e, - controller_parameter_copyright_e, - controller_parameter_light_e, - controller_parameter_dark_e, - controller_parameter_no_color_e, - controller_parameter_verbosity_quiet_e, - controller_parameter_verbosity_error_e, - controller_parameter_verbosity_normal_e, - controller_parameter_verbosity_verbose_e, - controller_parameter_verbosity_debug_e, - controller_parameter_version_e, - controller_parameter_line_first_no_e, - controller_parameter_line_last_no_e, - - controller_parameter_cgroup_e, + controller_parameter_cgroup_e = f_console_standard_parameter_last_e, controller_parameter_daemon_e, controller_parameter_init_e, controller_parameter_interruptible_e, diff --git a/level_3/controller/c/controller.c b/level_3/controller/c/controller.c index b23727a..98114f8 100644 --- a/level_3/controller/c/controller.c +++ b/level_3/controller/c/controller.c @@ -25,66 +25,43 @@ extern "C" { if (F_status_is_error(status)) return; - { - f_number_unsigned_t choice = 0; - f_uint16s_t choices = f_uint16s_t_initialize; + status = fll_program_parameter_process_context_standard(F_true, &main->program); - // Identify and prioritize "color context" parameters. - { - uint16_t choices_array[3] = { controller_parameter_no_color_e, controller_parameter_light_e, controller_parameter_dark_e }; - choices.array = choices_array; - choices.used = 3; - - static const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e }; - - status = fll_program_parameter_process_context(choices, modes, F_true, &main->program); - - if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e); - - if (main->error.verbosity > f_console_verbosity_quiet_e) { - fll_print_dynamic_raw(f_string_eol_s, main->error); - } + if (F_status_is_error(status)) { + fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_context_standard", fll_error_file_flag_fallback_e); - return; - } + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error); } - // Identify and prioritize "verbosity" parameters. - { - uint16_t choices_array[5] = { controller_parameter_verbosity_quiet_e, controller_parameter_verbosity_error_e, controller_parameter_verbosity_verbose_e, controller_parameter_verbosity_debug_e, controller_parameter_verbosity_normal_e }; - choices.array = choices_array; - choices.used = 5; - - const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e }; - - status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, &main->program); + return; + } - if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e); + status = fll_program_parameter_process_verbosity_standard(F_true, &main->program); - if (main->error.verbosity > f_console_verbosity_quiet_e) { - fll_print_dynamic_raw(f_string_eol_s, main->error); - } + if (F_status_is_error(status)) { + fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_verbosity_standard", fll_error_file_flag_fallback_e); - return; - } + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error); } + + return; } - if (main->parameters.array[controller_parameter_help_e].result & f_console_result_found_e) { + if (main->parameters.array[f_console_standard_parameter_help_e].result & f_console_result_found_e) { controller_print_help(main); return F_none; } - if (main->parameters.array[controller_parameter_version_e].result & f_console_result_found_e) { + if (main->parameters.array[f_console_standard_parameter_version_e].result & f_console_result_found_e) { fll_program_print_version(main->message, controller_program_version_s); return F_none; } - if (main->parameters.array[controller_parameter_copyright_e].result & f_console_result_found_e) { + if (main->parameters.array[f_console_standard_parameter_copyright_e].result & f_console_result_found_e) { fll_program_print_copyright(main->message); return F_none; diff --git a/level_3/controller/c/rule/private-rule.c b/level_3/controller/c/rule/private-rule.c index 52c1248..05bfbe8 100644 --- a/level_3/controller/c/rule/private-rule.c +++ b/level_3/controller/c/rule/private-rule.c @@ -2169,13 +2169,13 @@ extern "C" { }; const uint8_t codes[] = { - controller_parameter_help_e, - controller_parameter_dark_e, - controller_parameter_no_color_e, - controller_parameter_verbosity_quiet_e, - controller_parameter_verbosity_normal_e, - controller_parameter_verbosity_verbose_e, - controller_parameter_verbosity_debug_e, + f_console_standard_parameter_help_e, + f_console_standard_parameter_dark_e, + f_console_standard_parameter_no_color_e, + f_console_standard_parameter_verbosity_quiet_e, + f_console_standard_parameter_verbosity_normal_e, + f_console_standard_parameter_verbosity_verbose_e, + f_console_standard_parameter_verbosity_debug_e, controller_parameter_init_e, controller_parameter_interruptible_e, controller_parameter_daemon_e, diff --git a/level_3/fake/c/main/common.c b/level_3/fake/c/main/common.c index 3e830c9..68bcb86 100644 --- a/level_3/fake/c/main/common.c +++ b/level_3/fake/c/main/common.c @@ -26,14 +26,14 @@ extern "C" { } // Identify and process first/last parameters. - if (main->program.parameters.array[fake_parameter_line_first_no_e].result & f_console_result_found_e) { + if (main->program.parameters.array[f_console_standard_parameter_line_first_no_e].result & f_console_result_found_e) { main->setting.flag -= main->setting.flag & fake_main_flag_print_first_e; } else { main->setting.flag |= fake_main_flag_print_first_e; } - if (main->program.parameters.array[fake_parameter_line_last_no_e].result & f_console_result_found_e) { + if (main->program.parameters.array[f_console_standard_parameter_line_last_no_e].result & f_console_result_found_e) { main->setting.flag -= main->setting.flag & fake_main_flag_print_last_e; } else { @@ -50,65 +50,43 @@ extern "C" { return; } - { - f_uint16s_t choices = f_uint16s_t_initialize; - - // Identify and prioritize "color context" parameters. - { - uint16_t choices_array[3] = { fake_parameter_no_color_e, fake_parameter_light_e, fake_parameter_dark_e }; - choices.array = choices_array; - choices.used = 3; + main->setting.state.status = fll_program_parameter_process_context_standard(F_true, &main->program); - static const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e }; - - main->setting.state.status = fll_program_parameter_process_context(choices, modes, F_true, &main->program); - - if (F_status_is_error(main->setting.state.status)) { - if ((main->setting.flag & fake_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { - fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); - } - - fake_print_error(&main->program.error, macro_fake_f(fll_program_parameter_process_context)); - - return; - } + if (F_status_is_error(main->setting.state.status)) { + if ((main->setting.flag & fake_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); } - // Identify and prioritize "verbosity" parameters. - { - uint16_t choices_array[5] = { fake_parameter_verbosity_quiet_e, fake_parameter_verbosity_error_e, fake_parameter_verbosity_verbose_e, fake_parameter_verbosity_debug_e, fake_parameter_verbosity_normal_e }; - choices.array = choices_array; - choices.used = 5; + fake_print_error(&main->program.error, macro_fake_f(fll_program_parameter_process_context_standard)); - static const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e }; + return; + } - main->setting.state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, &main->program); + main->setting.state.status = fll_program_parameter_process_verbosity_standard(F_true, &main->program); - if (F_status_is_error(main->setting.state.status)) { - if ((main->setting.flag & fake_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { - fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); - } + if (F_status_is_error(main->setting.state.status)) { + if ((main->setting.flag & fake_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); + } - fake_print_error(&main->program.error, macro_fake_f(fll_program_parameter_process_verbosity)); + fake_print_error(&main->program.error, macro_fake_f(fll_program_parameter_process_verbosity_standard)); - return; - } - } + return; } - if (main->program.parameters.array[fake_parameter_help_e].result & f_console_result_found_e) { + if (main->program.parameters.array[f_console_standard_parameter_help_e].result & f_console_result_found_e) { main->setting.flag |= fake_main_flag_help_e; return; } - if (main->program.parameters.array[fake_parameter_version_e].result & f_console_result_found_e) { + if (main->program.parameters.array[f_console_standard_parameter_version_e].result & f_console_result_found_e) { main->setting.flag |= fake_main_flag_version_e; return; } - if (main->program.parameters.array[fake_parameter_copyright_e].result & f_console_result_found_e) { + if (main->program.parameters.array[f_console_standard_parameter_copyright_e].result & f_console_result_found_e) { main->setting.flag |= fake_main_flag_copyright_e; return; diff --git a/level_3/fake/c/main/common.h b/level_3/fake/c/main/common.h index 9999760..d9ff36b 100644 --- a/level_3/fake/c/main/common.h +++ b/level_3/fake/c/main/common.h @@ -36,7 +36,7 @@ extern "C" { * Errors (with error bit) from: f_uint8s_increase_by(). * Errors (with error bit) from: fll_program_parameter_additional_rip(). * Errors (with error bit) from: fll_program_parameter_process_context(). - * Errors (with error bit) from: fll_program_parameter_process_verbosity(). + * Errors (with error bit) from: fll_program_parameter_process_verbosity_standard(). * * @see f_console_parameter_process() * @see f_path_directory_cleanup() @@ -45,7 +45,7 @@ extern "C" { * @see f_uint8s_increase_by() * @see fll_program_parameter_additional_rip() * @see fll_program_parameter_process_context() - * @see fll_program_parameter_process_verbosity() + * @see fll_program_parameter_process_verbosity_standard() */ #ifndef _di_fake_setting_load_ extern void fake_setting_load(const f_console_arguments_t arguments, fake_main_t * const main); diff --git a/level_3/fake/c/main/common/enumeration.h b/level_3/fake/c/main/common/enumeration.h index f6c5ed5..6cb521c 100644 --- a/level_3/fake/c/main/common/enumeration.h +++ b/level_3/fake/c/main/common/enumeration.h @@ -21,21 +21,7 @@ extern "C" { */ #ifndef _di_fake_parameter_e_ enum { - fake_parameter_help_e, - fake_parameter_copyright_e, - fake_parameter_light_e, - fake_parameter_dark_e, - fake_parameter_no_color_e, - fake_parameter_verbosity_quiet_e, - fake_parameter_verbosity_error_e, - fake_parameter_verbosity_normal_e, - fake_parameter_verbosity_verbose_e, - fake_parameter_verbosity_debug_e, - fake_parameter_version_e, - fake_parameter_line_first_no_e, - fake_parameter_line_last_no_e, - - fake_parameter_build_e, + fake_parameter_build_e = f_console_standard_parameter_last_e, fake_parameter_data_e, fake_parameter_define_e, fake_parameter_documents_e, diff --git a/level_3/fake/c/main/common/print.c b/level_3/fake/c/main/common/print.c index 2acad15..cfcd165 100644 --- a/level_3/fake/c/main/common/print.c +++ b/level_3/fake/c/main/common/print.c @@ -87,8 +87,8 @@ extern "C" { "fll_fss_snatch_apart", "fll_fss_snatch_map_apart", "fll_program_parameter_additional_rip", - "fll_program_parameter_process_context", - "fll_program_parameter_process_verbosity", + "fll_program_parameter_process_context_standard", + "fll_program_parameter_process_verbosity_standard", "fake_build_arguments_standard_add", "fake_build_get_file_name_without_extension", "fake_build_load_setting", diff --git a/level_3/fake/c/main/common/print.h b/level_3/fake/c/main/common/print.h index 1503352..0391e79 100644 --- a/level_3/fake/c/main/common/print.h +++ b/level_3/fake/c/main/common/print.h @@ -120,8 +120,8 @@ extern "C" { fake_f_fll_fss_snatch_apart_e, fake_f_fll_fss_snatch_map_apart_e, fake_f_fll_program_parameter_additional_rip_e, - fake_f_fll_program_parameter_process_context_e, - fake_f_fll_program_parameter_process_verbosity_e, + fake_f_fll_program_parameter_process_context_standard_e, + fake_f_fll_program_parameter_process_verbosity_standard_e, fake_f_fake_build_arguments_standard_add_e, fake_f_fake_build_get_file_name_without_extension_e, fake_f_fake_build_load_setting_e, diff --git a/level_3/fake/c/main/make/load_parameters.c b/level_3/fake/c/main/make/load_parameters.c index ef63cd5..2a3dee4 100644 --- a/level_3/fake/c/main/make/load_parameters.c +++ b/level_3/fake/c/main/make/load_parameters.c @@ -26,10 +26,10 @@ extern "C" { } if (main->program.context.mode == f_color_mode_not_e) { - if (main->program.parameters.array[fake_parameter_no_color_e].flag & f_console_flag_normal_e) { + if (main->program.parameters.array[f_console_standard_parameter_no_color_e].flag & f_console_flag_normal_e) { main->setting.state.status = f_string_dynamic_append(f_console_symbol_short_normal_s, &data_make->parameter.color.array[data_make->parameter.color.used]); } - else if (main->program.parameters.array[fake_parameter_no_color_e].flag & f_console_flag_normal_e) { + else if (main->program.parameters.array[f_console_standard_parameter_no_color_e].flag & f_console_flag_normal_e) { main->setting.state.status = f_string_dynamic_append(f_console_symbol_short_inverse_s, &data_make->parameter.color.array[data_make->parameter.color.used]); } @@ -38,10 +38,10 @@ extern "C" { } } else if (main->program.context.mode == f_color_mode_dark_e) { - if (main->program.parameters.array[fake_parameter_dark_e].flag & f_console_flag_normal_e) { + if (main->program.parameters.array[f_console_standard_parameter_dark_e].flag & f_console_flag_normal_e) { main->setting.state.status = f_string_dynamic_append(f_console_symbol_short_normal_s, &data_make->parameter.color.array[data_make->parameter.color.used]); } - else if (main->program.parameters.array[fake_parameter_dark_e].flag & f_console_flag_normal_e) { + else if (main->program.parameters.array[f_console_standard_parameter_dark_e].flag & f_console_flag_normal_e) { main->setting.state.status = f_string_dynamic_append(f_console_symbol_short_inverse_s, &data_make->parameter.color.array[data_make->parameter.color.used]); } @@ -50,10 +50,10 @@ extern "C" { } } else { - if (main->program.parameters.array[fake_parameter_light_e].flag & f_console_flag_normal_e) { + if (main->program.parameters.array[f_console_standard_parameter_light_e].flag & f_console_flag_normal_e) { main->setting.state.status = f_string_dynamic_append(f_console_symbol_short_normal_s, &data_make->parameter.color.array[data_make->parameter.color.used]); } - else if (main->program.parameters.array[fake_parameter_light_e].flag & f_console_flag_normal_e) { + else if (main->program.parameters.array[f_console_standard_parameter_light_e].flag & f_console_flag_normal_e) { main->setting.state.status = f_string_dynamic_append(f_console_symbol_short_inverse_s, &data_make->parameter.color.array[data_make->parameter.color.used]); } @@ -90,10 +90,10 @@ extern "C" { } if (main->program.error.verbosity == f_console_verbosity_quiet_e) { - if (main->program.parameters.array[fake_parameter_verbosity_quiet_e].flag & f_console_flag_normal_e) { + if (main->program.parameters.array[f_console_standard_parameter_verbosity_quiet_e].flag & f_console_flag_normal_e) { main->setting.state.status = f_string_dynamic_append(f_console_symbol_short_normal_s, &data_make->parameter.verbosity.array[data_make->parameter.verbosity.used]); } - else if (main->program.parameters.array[fake_parameter_verbosity_quiet_e].flag & f_console_flag_normal_e) { + else if (main->program.parameters.array[f_console_standard_parameter_verbosity_quiet_e].flag & f_console_flag_normal_e) { main->setting.state.status = f_string_dynamic_append(f_console_symbol_short_inverse_s, &data_make->parameter.verbosity.array[data_make->parameter.verbosity.used]); } @@ -102,10 +102,10 @@ extern "C" { } } else if (main->program.error.verbosity == f_console_verbosity_error_e) { - if (main->program.parameters.array[fake_parameter_verbosity_error_e].flag & f_console_flag_normal_e) { + if (main->program.parameters.array[f_console_standard_parameter_verbosity_error_e].flag & f_console_flag_normal_e) { main->setting.state.status = f_string_dynamic_append(f_console_symbol_short_normal_s, &data_make->parameter.verbosity.array[data_make->parameter.verbosity.used]); } - else if (main->program.parameters.array[fake_parameter_verbosity_error_e].flag & f_console_flag_normal_e) { + else if (main->program.parameters.array[f_console_standard_parameter_verbosity_error_e].flag & f_console_flag_normal_e) { main->setting.state.status = f_string_dynamic_append(f_console_symbol_short_inverse_s, &data_make->parameter.verbosity.array[data_make->parameter.verbosity.used]); } @@ -114,10 +114,10 @@ extern "C" { } } else if (main->program.error.verbosity >= f_console_verbosity_verbose_e) { - if (main->program.parameters.array[fake_parameter_verbosity_verbose_e].flag & f_console_flag_normal_e) { + if (main->program.parameters.array[f_console_standard_parameter_verbosity_verbose_e].flag & f_console_flag_normal_e) { main->setting.state.status = f_string_dynamic_append(f_console_symbol_short_normal_s, &data_make->parameter.verbosity.array[data_make->parameter.verbosity.used]); } - else if (main->program.parameters.array[fake_parameter_verbosity_verbose_e].flag & f_console_flag_normal_e) { + else if (main->program.parameters.array[f_console_standard_parameter_verbosity_verbose_e].flag & f_console_flag_normal_e) { main->setting.state.status = f_string_dynamic_append(f_console_symbol_short_inverse_s, &data_make->parameter.verbosity.array[data_make->parameter.verbosity.used]); } @@ -126,10 +126,10 @@ extern "C" { } } else { - if (main->program.parameters.array[fake_parameter_verbosity_debug_e].flag & f_console_flag_normal_e) { + if (main->program.parameters.array[f_console_standard_parameter_verbosity_debug_e].flag & f_console_flag_normal_e) { main->setting.state.status = f_string_dynamic_append(f_console_symbol_short_normal_s, &data_make->parameter.verbosity.array[data_make->parameter.verbosity.used]); } - else if (main->program.parameters.array[fake_parameter_verbosity_debug_e].flag & f_console_flag_normal_e) { + else if (main->program.parameters.array[f_console_standard_parameter_verbosity_debug_e].flag & f_console_flag_normal_e) { main->setting.state.status = f_string_dynamic_append(f_console_symbol_short_inverse_s, &data_make->parameter.verbosity.array[data_make->parameter.verbosity.used]); } diff --git a/level_3/fake/c/main/make/operate_process_type.c b/level_3/fake/c/main/make/operate_process_type.c index 1420d50..cbbc455 100644 --- a/level_3/fake/c/main/make/operate_process_type.c +++ b/level_3/fake/c/main/make/operate_process_type.c @@ -1238,7 +1238,7 @@ extern "C" { F_true, main->setting.work.used, main->program.parameters.array[fake_parameter_build_e].result & f_console_result_value_e, - (main->program.parameters.array[fake_parameter_light_e].result & f_console_result_found_e) || (main->program.parameters.array[fake_parameter_dark_e].result & f_console_result_found_e) || (main->program.parameters.array[fake_parameter_no_color_e].result & f_console_result_found_e), + (main->program.parameters.array[f_console_standard_parameter_light_e].result & f_console_result_found_e) || (main->program.parameters.array[f_console_standard_parameter_dark_e].result & f_console_result_found_e) || (main->program.parameters.array[f_console_standard_parameter_no_color_e].result & f_console_result_found_e), main->program.parameters.array[fake_parameter_data_e].result & f_console_result_value_e, main->program.parameters.array[fake_parameter_define_e].result & f_console_result_value_e, main->program.parameters.array[fake_parameter_fakefile_e].result & f_console_result_value_e, @@ -1246,7 +1246,7 @@ extern "C" { main->program.parameters.array[fake_parameter_process_e].result & f_console_result_value_e, main->program.parameters.array[fake_parameter_settings_e].result & f_console_result_value_e, main->program.parameters.array[fake_parameter_sources_e].result & f_console_result_value_e, - (main->program.parameters.array[fake_parameter_verbosity_quiet_e].result & f_console_result_found_e) || (main->program.parameters.array[fake_parameter_verbosity_normal_e].result & f_console_result_found_e) || (main->program.parameters.array[fake_parameter_verbosity_verbose_e].result & f_console_result_found_e) || (main->program.parameters.array[fake_parameter_verbosity_debug_e].result & f_console_result_found_e), + (main->program.parameters.array[f_console_standard_parameter_verbosity_quiet_e].result & f_console_result_found_e) || (main->program.parameters.array[f_console_standard_parameter_verbosity_normal_e].result & f_console_result_found_e) || (main->program.parameters.array[f_console_standard_parameter_verbosity_verbose_e].result & f_console_result_found_e) || (main->program.parameters.array[f_console_standard_parameter_verbosity_debug_e].result & f_console_result_found_e), main->program.parameters.array[fake_parameter_work_e].result & f_console_result_value_e, data_make->parameter_value.build.used, data_make->parameter_value.color.used, diff --git a/level_3/firewall/c/common.c b/level_3/firewall/c/common.c index 088b29d..488fedf 100644 --- a/level_3/firewall/c/common.c +++ b/level_3/firewall/c/common.c @@ -122,14 +122,14 @@ extern "C" { main->setting.state.status = f_console_parameter_process(state, arguments, &main->program.parameters, &main->setting.state, 0); // Identify and process first/last parameters. - if (main->program.parameters.array[firewall_parameter_line_first_no_e].result & f_console_result_found_e) { + if (main->program.parameters.array[f_console_standard_parameter_line_first_no_e].result & f_console_result_found_e) { main->setting.flag -= main->setting.flag & firewall_main_flag_print_first_e; } else { main->setting.flag |= firewall_main_flag_print_first_e; } - if (main->program.parameters.array[firewall_parameter_line_last_no_e].result & f_console_result_found_e) { + if (main->program.parameters.array[f_console_standard_parameter_line_last_no_e].result & f_console_result_found_e) { main->setting.flag -= main->setting.flag & firewall_main_flag_print_last_e; } else { @@ -146,64 +146,41 @@ extern "C" { return; } - { - f_number_unsigned_t choice = 0; - f_uint16s_t choices = f_uint16s_t_initialize; + main->setting.state.status = fll_program_parameter_process_context_standard(F_true, &main->program); - // Identify and prioritize "color context" parameters. - { - uint16_t choices_array[3] = { firewall_parameter_no_color_e, firewall_parameter_light_e, firewall_parameter_dark_e }; - choices.array = choices_array; - choices.used = 3; - - static const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e }; - - main->setting.state.status = fll_program_parameter_process_context(choices, modes, F_true, &main->program); - - if (F_status_is_error(main->setting.state.status)) { - fll_error_print(&main->program.error, F_status_set_fine(main->setting.state.status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e); - - if (main->program.error.verbosity > f_console_verbosity_quiet_e) { - fll_print_dynamic_raw(f_string_eol_s, main->program.error); - } + if (F_status_is_error(main->setting.state.status)) { + fll_error_print(&main->program.error, F_status_set_fine(main->setting.state.status), "fll_program_parameter_process_context_standard", fll_error_file_flag_fallback_e); - return; - } + if (main->program.error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.error); } - // Identify and prioritize "verbosity" parameters. - { - uint16_t choices_array[5] = { firewall_parameter_verbosity_quiet_e, firewall_parameter_verbosity_error_e, firewall_parameter_verbosity_verbose_e, firewall_parameter_verbosity_debug_e, firewall_parameter_verbosity_normal_e }; - choices.array = choices_array; - choices.used = 5; - - static const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e }; - - main->setting.state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, &main->program); + return; + } - if (F_status_is_error(main->setting.state.status)) { - fll_error_print(&main->program.error, F_status_set_fine(main->setting.state.status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e); + main->setting.state.status = fll_program_parameter_process_verbosity_standard(F_true, &main->program); - if (main->program.error.verbosity > f_console_verbosity_quiet_e) { - fll_print_dynamic_raw(f_string_eol_s, main->program.error); - } + if (F_status_is_error(main->setting.state.status)) { + fll_error_print(&main->program.error, F_status_set_fine(main->setting.state.status), "fll_program_parameter_process_verbosity_standard", fll_error_file_flag_fallback_e); - return; - } + if (main->program.error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.error); } + + return; } main->program.output.to.id = F_type_descriptor_output_d; main->program.output.to.stream = F_type_output_d; main->program.output.to.flag = F_file_flag_create_d | F_file_flag_write_only_d | F_file_flag_append_d; - if (main->program.parameters.array[firewall_parameter_help_e].result & f_console_result_found_e) { + if (main->program.parameters.array[f_console_standard_parameter_help_e].result & f_console_result_found_e) { main->setting.flag |= firewall_main_flag_help_e; return; } - if (main->program.parameters.array[firewall_parameter_version_e].result & f_console_result_found_e) { + if (main->program.parameters.array[f_console_standard_parameter_version_e].result & f_console_result_found_e) { main->setting.flag |= firewall_main_flag_version_e; return; diff --git a/level_3/firewall/c/common.h b/level_3/firewall/c/common.h index 3ba3a3a..c3c3222 100644 --- a/level_3/firewall/c/common.h +++ b/level_3/firewall/c/common.h @@ -349,18 +349,7 @@ extern "C" { }; // enum enum { - firewall_parameter_help_e, - firewall_parameter_light_e, - firewall_parameter_dark_e, - firewall_parameter_no_color_e, - firewall_parameter_verbosity_quiet_e, - firewall_parameter_verbosity_error_e, - firewall_parameter_verbosity_normal_e, - firewall_parameter_verbosity_verbose_e, - firewall_parameter_verbosity_debug_e, - firewall_parameter_version_e, - - firewall_parameter_command_start_e, + firewall_parameter_command_start_e = f_console_standard_parameter_last_e, firewall_parameter_command_stop_e, firewall_parameter_command_restart_e, firewall_parameter_command_lock_e, diff --git a/level_3/firewall/c/firewall.c b/level_3/firewall/c/firewall.c index 94ad055..1e627c5 100644 --- a/level_3/firewall/c/firewall.c +++ b/level_3/firewall/c/firewall.c @@ -25,66 +25,43 @@ extern "C" { if (F_status_is_error(status)) return; - { - f_number_unsigned_t choice = 0; - f_uint16s_t choices = f_uint16s_t_initialize; + status = fll_program_parameter_process_context_standard(F_true, &main->program); - // Identify and prioritize "color context" parameters. - { - uint16_t choices_array[3] = { firewall_parameter_no_color_e, firewall_parameter_light_e, firewall_parameter_dark_e }; - choices.array = choices_array; - choices.used = 3; - - static const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e }; - - status = fll_program_parameter_process_context(choices, modes, F_true, &main->program); - - if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e); + if (F_status_is_error(status)) { + fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_context_standard", fll_error_file_flag_fallback_e); - if (main->error.verbosity > f_console_verbosity_quiet_e) { - fll_print_dynamic_raw(f_string_eol_s, main->error); - } - - return; - } + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error); } - // Identify and prioritize "verbosity" parameters. - { - uint16_t choices_array[5] = { firewall_parameter_verbosity_quiet_e, firewall_parameter_verbosity_error_e, firewall_parameter_verbosity_verbose_e, firewall_parameter_verbosity_debug_e, firewall_parameter_verbosity_normal_e }; - choices.array = choices_array; - choices.used = 5; - - const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e }; - - status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, &main->program); + return; + } - if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e); + status = fll_program_parameter_process_verbosity_standard(F_true, &main->program); - if (main->error.verbosity > f_console_verbosity_quiet_e) { - fll_print_dynamic_raw(f_string_eol_s, main->error); - } + if (F_status_is_error(status)) { + fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_verbosity_standard", fll_error_file_flag_fallback_e); - return; - } + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error); } + + return; } - if (main->parameters.array[firewall_parameter_help_e].result & f_console_result_found_e) { + if (main->parameters.array[f_console_standard_parameter_help_e].result & f_console_result_found_e) { firewall_print_help(setting, main->message); return F_none; } - if (main->parameters.array[firewall_parameter_version_e].result & f_console_result_found_e) { + if (main->parameters.array[f_console_standard_parameter_version_e].result & f_console_result_found_e) { fll_program_print_version(&main->message, firewall_program_version_s); return F_none; } - if (main->parameters.array[firewall_parameter_copyright_e].result & f_console_result_found_e) { + if (main->parameters.array[f_console_standard_parameter_copyright_e].result & f_console_result_found_e) { fll_program_print_copyright(&main->message); return F_none; diff --git a/level_3/fss_embedded_list_read/c/common.c b/level_3/fss_embedded_list_read/c/common.c index 0cf42a1..6c6f2ed 100644 --- a/level_3/fss_embedded_list_read/c/common.c +++ b/level_3/fss_embedded_list_read/c/common.c @@ -80,14 +80,14 @@ extern "C" { main->setting.state.step_small = fss_embedded_list_read_allocation_small_d; // Identify and process first/last parameters. - if (main->program.parameters.array[fss_embedded_list_read_parameter_line_first_no_e].result & f_console_result_found_e) { + if (main->program.parameters.array[f_console_standard_parameter_line_first_no_e].result & f_console_result_found_e) { main->setting.flag -= main->setting.flag & fss_embedded_list_read_main_flag_print_first_e; } else { main->setting.flag |= fss_embedded_list_read_main_flag_print_first_e; } - if (main->program.parameters.array[fss_embedded_list_read_parameter_line_last_no_e].result & f_console_result_found_e) { + if (main->program.parameters.array[f_console_standard_parameter_line_last_no_e].result & f_console_result_found_e) { main->setting.flag -= main->setting.flag & fss_embedded_list_read_main_flag_print_last_e; } else { @@ -104,70 +104,47 @@ extern "C" { return; } - { - f_number_unsigned_t choice = 0; - f_uint16s_t choices = f_uint16s_t_initialize; + main->setting.state.status = fll_program_parameter_process_context_standard(F_true, &main->program); - // Identify and prioritize "color context" parameters. - { - uint16_t choices_array[3] = { fss_embedded_list_read_parameter_no_color_e, fss_embedded_list_read_parameter_light_e, fss_embedded_list_read_parameter_dark_e }; - choices.array = choices_array; - choices.used = 3; - - static const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e }; - - main->setting.state.status = fll_program_parameter_process_context(choices, modes, F_true, &main->program); - - if (F_status_is_error(main->setting.state.status)) { - fll_error_print(&main->program.error, F_status_set_fine(main->setting.state.status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e); - - if (main->program.error.verbosity > f_console_verbosity_quiet_e) { - fll_print_dynamic_raw(f_string_eol_s, main->program.error); - } + if (F_status_is_error(main->setting.state.status)) { + fll_error_print(&main->program.error, F_status_set_fine(main->setting.state.status), "fll_program_parameter_process_context_standard", fll_error_file_flag_fallback_e); - return; - } + if (main->program.error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.error); } - // Identify and prioritize "verbosity" parameters. - { - uint16_t choices_array[5] = { fss_embedded_list_read_parameter_verbosity_quiet_e, fss_embedded_list_read_parameter_verbosity_error_e, fss_embedded_list_read_parameter_verbosity_verbose_e, fss_embedded_list_read_parameter_verbosity_debug_e, fss_embedded_list_read_parameter_verbosity_normal_e }; - choices.array = choices_array; - choices.used = 5; - - static const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e }; - - main->setting.state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, &main->program); + return; + } - if (F_status_is_error(main->setting.state.status)) { - fll_error_print(&main->program.error, F_status_set_fine(main->setting.state.status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e); + main->setting.state.status = fll_program_parameter_process_verbosity_standard(F_true, &main->program); - if (main->program.error.verbosity > f_console_verbosity_quiet_e) { - fll_print_dynamic_raw(f_string_eol_s, main->program.error); - } + if (F_status_is_error(main->setting.state.status)) { + fll_error_print(&main->program.error, F_status_set_fine(main->setting.state.status), "fll_program_parameter_process_verbosity_standard", fll_error_file_flag_fallback_e); - return; - } + if (main->program.error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.error); } + + return; } main->program.output.to.id = F_type_descriptor_output_d; main->program.output.to.stream = F_type_output_d; main->program.output.to.flag = F_file_flag_create_d | F_file_flag_write_only_d | F_file_flag_append_d; - if (main->program.parameters.array[fss_embedded_list_read_parameter_help_e].result & f_console_result_found_e) { + if (main->program.parameters.array[f_console_standard_parameter_help_e].result & f_console_result_found_e) { main->setting.flag |= fss_embedded_list_read_main_flag_help_e; return; } - if (main->program.parameters.array[fss_embedded_list_read_parameter_version_e].result & f_console_result_found_e) { + if (main->program.parameters.array[f_console_standard_parameter_version_e].result & f_console_result_found_e) { main->setting.flag |= fss_embedded_list_read_main_flag_version_e; return; } - if (main->program.parameters.array[fss_embedded_list_read_parameter_copyright_e].result & f_console_result_found_e) { + if (main->program.parameters.array[f_console_standard_parameter_copyright_e].result & f_console_result_found_e) { main->setting.flag |= fss_embedded_list_read_main_flag_copyright_e; return; diff --git a/level_3/fss_embedded_list_read/c/common.h b/level_3/fss_embedded_list_read/c/common.h index 4758a57..d50e843 100644 --- a/level_3/fss_embedded_list_read/c/common.h +++ b/level_3/fss_embedded_list_read/c/common.h @@ -199,21 +199,7 @@ extern "C" { extern const f_string_static_t fss_embedded_list_read_long_trim_s; enum { - fss_embedded_list_read_parameter_help_e, - fss_embedded_list_read_parameter_copyright_e, - fss_embedded_list_read_parameter_light_e, - fss_embedded_list_read_parameter_dark_e, - fss_embedded_list_read_parameter_no_color_e, - fss_embedded_list_read_parameter_verbosity_quiet_e, - fss_embedded_list_read_parameter_verbosity_error_e, - fss_embedded_list_read_parameter_verbosity_normal_e, - fss_embedded_list_read_parameter_verbosity_verbose_e, - fss_embedded_list_read_parameter_verbosity_debug_e, - fss_embedded_list_read_parameter_version_e, - fss_embedded_list_read_parameter_line_first_no_e, - fss_embedded_list_read_parameter_line_last_no_e, - - fss_embedded_list_read_parameter_at_e, + fss_embedded_list_read_parameter_at_e = f_console_standard_parameter_last_e, fss_embedded_list_read_parameter_content_e, fss_embedded_list_read_parameter_columns_e, fss_embedded_list_read_parameter_delimit_e, diff --git a/level_3/fss_embedded_list_read/c/fss_embedded_list_read.c b/level_3/fss_embedded_list_read/c/fss_embedded_list_read.c index 0e38380..9279de2 100644 --- a/level_3/fss_embedded_list_read/c/fss_embedded_list_read.c +++ b/level_3/fss_embedded_list_read/c/fss_embedded_list_read.c @@ -20,66 +20,43 @@ extern "C" { if (F_status_is_error(status)) return; - { - f_number_unsigned_t choice = 0; - f_uint16s_t choices = f_uint16s_t_initialize; + status = fll_program_parameter_process_context_standard(F_true, &main->program); - // Identify and prioritize "color context" parameters. - { - uint16_t choices_array[3] = { fss_embedded_list_read_parameter_no_color_e, fss_embedded_list_read_parameter_light_e, fss_embedded_list_read_parameter_dark_e }; - choices.array = choices_array; - choices.used = 3; + if (F_status_is_error(status)) { + fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_context_standard", fll_error_file_flag_fallback_e); - static const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e }; - - status = fll_program_parameter_process_context(choices, modes, F_true, &main->program); - - if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e); - - if (main->error.verbosity > f_console_verbosity_quiet_e) { - fll_print_dynamic_raw(f_string_eol_s, main->error); - } - - return; - } + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error); } - // Identify and prioritize "verbosity" parameters. - { - uint16_t choices_array[5] = { fss_embedded_list_read_parameter_verbosity_quiet_e, fss_embedded_list_read_parameter_verbosity_error_e, fss_embedded_list_read_parameter_verbosity_verbose_e, fss_embedded_list_read_parameter_verbosity_debug_e, fss_embedded_list_read_parameter_verbosity_normal_e }; - choices.array = choices_array; - choices.used = 5; - - const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e }; - - status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, &main->program); + return; + } - if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e); + status = fll_program_parameter_process_verbosity_standard(F_true, &main->program); - if (main->error.verbosity > f_console_verbosity_quiet_e) { - fll_print_dynamic_raw(f_string_eol_s, main->error); - } + if (F_status_is_error(status)) { + fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_verbosity_standard", fll_error_file_flag_fallback_e); - return; - } + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error); } + + return; } - if (main->parameters.array[fss_embedded_list_read_parameter_help_e].result & f_console_result_found_e) { + if (main->parameters.array[f_console_standard_parameter_help_e].result & f_console_result_found_e) { fss_embedded_list_read_print_help(setting, main->message); return F_none; } - if (main->parameters.array[fss_embedded_list_read_parameter_version_e].result & f_console_result_found_e) { + if (main->parameters.array[f_console_standard_parameter_version_e].result & f_console_result_found_e) { fll_program_print_version(main->message, fss_embedded_list_read_program_version_s); return F_none; } - if (main->parameters.array[fss_embedded_list_read_parameter_copyright_e].result & f_console_result_found_e) { + if (main->parameters.array[f_console_standard_parameter_copyright_e].result & f_console_result_found_e) { fll_program_print_copyright(main->message); return F_none; diff --git a/level_3/fss_identify/c/main/common.c b/level_3/fss_identify/c/main/common.c index c989648..a2a2870 100644 --- a/level_3/fss_identify/c/main/common.c +++ b/level_3/fss_identify/c/main/common.c @@ -16,14 +16,14 @@ extern "C" { main->setting.state.step_small = fss_identify_allocation_small_d; // Identify and process first/last parameters. - if (main->program.parameters.array[fss_identify_parameter_line_first_no_e].result & f_console_result_found_e) { + if (main->program.parameters.array[f_console_standard_parameter_line_first_no_e].result & f_console_result_found_e) { main->setting.flag -= main->setting.flag & fss_identify_main_flag_print_first_e; } else { main->setting.flag |= fss_identify_main_flag_print_first_e; } - if (main->program.parameters.array[fss_identify_parameter_line_last_no_e].result & f_console_result_found_e) { + if (main->program.parameters.array[f_console_standard_parameter_line_last_no_e].result & f_console_result_found_e) { main->setting.flag -= main->setting.flag & fss_identify_main_flag_print_last_e; } else { @@ -40,45 +40,43 @@ extern "C" { return; } - { - f_number_unsigned_t choice = 0; - f_uint16s_t choices = f_uint16s_t_initialize; + main->setting.state.status = fll_program_parameter_process_context_standard(F_true, &main->program); - // Identify and prioritize "color context" parameters. - { - uint16_t choices_array[3] = { fss_identify_parameter_no_color_e, fss_identify_parameter_light_e, fss_identify_parameter_dark_e }; - choices.array = choices_array; - choices.used = 3; - - static const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e }; + if (F_status_is_error(main->setting.state.status)) { + if ((main->setting.flag & fss_identify_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); + } - main->setting.state.status = fll_program_parameter_process_context(choices, modes, F_true, &main->program); + fss_identify_print_error(&main->program.error, macro_fss_identify_f(fll_program_parameter_process_context_standard)); - if (F_status_is_error(main->setting.state.status)) { - if ((main->setting.flag & fss_identify_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { - fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); - } + return; + } - fss_identify_print_error(&main->program.error, macro_fss_identify_f(fll_program_parameter_process_context)); + main->setting.state.status = fll_program_parameter_process_verbosity_standard(F_true, &main->program); - return; - } + if (F_status_is_error(main->setting.state.status)) { + if ((main->setting.flag & fss_identify_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); } + + fss_identify_print_error(&main->program.error, macro_fss_identify_f(fll_program_parameter_process_verbosity_standard)); + + return; } - if (main->program.parameters.array[fss_identify_parameter_help_e].result & f_console_result_found_e) { + if (main->program.parameters.array[f_console_standard_parameter_help_e].result & f_console_result_found_e) { main->setting.flag |= fss_identify_main_flag_help_e; return; } - if (main->program.parameters.array[fss_identify_parameter_version_e].result & f_console_result_found_e) { + if (main->program.parameters.array[f_console_standard_parameter_version_e].result & f_console_result_found_e) { main->setting.flag |= fss_identify_main_flag_version_e; return; } - if (main->program.parameters.array[fss_identify_parameter_copyright_e].result & f_console_result_found_e) { + if (main->program.parameters.array[f_console_standard_parameter_copyright_e].result & f_console_result_found_e) { main->setting.flag |= fss_identify_main_flag_copyright_e; return; diff --git a/level_3/fss_identify/c/main/common/enumeration.h b/level_3/fss_identify/c/main/common/enumeration.h index e246821..4404ee0 100644 --- a/level_3/fss_identify/c/main/common/enumeration.h +++ b/level_3/fss_identify/c/main/common/enumeration.h @@ -61,21 +61,7 @@ extern "C" { */ #ifndef _di_fss_identify_parameter_e_ enum { - fss_identify_parameter_help_e, - fss_identify_parameter_copyright_e, - fss_identify_parameter_light_e, - fss_identify_parameter_dark_e, - fss_identify_parameter_no_color_e, - fss_identify_parameter_verbosity_quiet_e, - fss_identify_parameter_verbosity_error_e, - fss_identify_parameter_verbosity_normal_e, - fss_identify_parameter_verbosity_verbose_e, - fss_identify_parameter_verbosity_debug_e, - fss_identify_parameter_version_e, - fss_identify_parameter_line_first_no_e, - fss_identify_parameter_line_last_no_e, - - fss_identify_parameter_content_e, + fss_identify_parameter_content_e = f_console_standard_parameter_last_e, fss_identify_parameter_line_e, fss_identify_parameter_name_e, fss_identify_parameter_object_e, diff --git a/level_3/fss_identify/c/main/common/print.c b/level_3/fss_identify/c/main/common/print.c index 5386a40..8ac08cd 100644 --- a/level_3/fss_identify/c/main/common/print.c +++ b/level_3/fss_identify/c/main/common/print.c @@ -16,8 +16,8 @@ extern "C" { "f_thread_create", "f_utf_is_word_dash", "fll_fss_identify", - "fll_program_parameter_process_context", - "fll_program_parameter_process_verbosity", + "fll_program_parameter_process_context_standard", + "fll_program_parameter_process_verbosity_standard", }; #endif // _di_fss_identify_f_a_ diff --git a/level_3/fss_identify/c/main/common/print.h b/level_3/fss_identify/c/main/common/print.h index 07a176e..2bd3f34 100644 --- a/level_3/fss_identify/c/main/common/print.h +++ b/level_3/fss_identify/c/main/common/print.h @@ -49,8 +49,8 @@ extern "C" { fss_identify_f_f_thread_create_e, fss_identify_f_f_utf_is_word_dash_e, fss_identify_f_fll_fss_identify_e, - fss_identify_f_fll_program_parameter_process_context_e, - fss_identify_f_fll_program_parameter_process_verbosity_e, + fss_identify_f_fll_program_parameter_process_context_standard_e, + fss_identify_f_fll_program_parameter_process_verbosity_standard_e, }; // enum #endif // _di_fss_identify_f_e_ diff --git a/level_3/fss_read/c/main/common.c b/level_3/fss_read/c/main/common.c index 75d88ba..17c3d13 100644 --- a/level_3/fss_read/c/main/common.c +++ b/level_3/fss_read/c/main/common.c @@ -54,14 +54,14 @@ extern "C" { main->setting.state.step_small = fss_read_allocation_small_d; // Identify and process first/last parameters. - if (parameters->array[fss_read_parameter_line_first_no_e].result & f_console_result_found_e) { + if (parameters->array[f_console_standard_parameter_line_first_no_e].result & f_console_result_found_e) { main->setting.flag -= main->setting.flag & fss_read_main_flag_print_first_e; } else { main->setting.flag |= fss_read_main_flag_print_first_e; } - if (parameters->array[fss_read_parameter_line_last_no_e].result & f_console_result_found_e) { + if (parameters->array[f_console_standard_parameter_line_last_no_e].result & f_console_result_found_e) { main->setting.flag -= main->setting.flag & fss_read_main_flag_print_last_e; } else { @@ -78,65 +78,43 @@ extern "C" { return; } - { - f_uint16s_t choices = f_uint16s_t_initialize; - - // Identify and prioritize "color context" parameters. - { - uint16_t choices_array[3] = { fss_read_parameter_no_color_e, fss_read_parameter_light_e, fss_read_parameter_dark_e }; - choices.array = choices_array; - choices.used = 3; - - static const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e }; - - main->setting.state.status = fll_program_parameter_process_context(choices, modes, F_true, &main->program); + main->setting.state.status = fll_program_parameter_process_context_standard(F_true, &main->program); - if (F_status_is_error(main->setting.state.status)) { - if ((main->setting.flag & fss_read_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { - fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); - } - - fss_read_print_error(&main->program.error, macro_fss_read_f(fll_program_parameter_process_context)); - - return; - } + if (F_status_is_error(main->setting.state.status)) { + if ((main->setting.flag & fss_read_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); } - // Identify and prioritize "verbosity" parameters. - { - uint16_t choices_array[5] = { fss_read_parameter_verbosity_quiet_e, fss_read_parameter_verbosity_error_e, fss_read_parameter_verbosity_verbose_e, fss_read_parameter_verbosity_debug_e, fss_read_parameter_verbosity_normal_e }; - choices.array = choices_array; - choices.used = 5; + fss_read_print_error(&main->program.error, macro_fss_read_f(fll_program_parameter_process_context_standard)); - const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e }; + return; + } - main->setting.state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, &main->program); + main->setting.state.status = fll_program_parameter_process_verbosity_standard(F_true, &main->program); - if (F_status_is_error(main->setting.state.status)) { - if ((main->setting.flag & fss_read_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { - fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); - } + if (F_status_is_error(main->setting.state.status)) { + if ((main->setting.flag & fss_read_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); + } - fss_read_print_error(&main->program.error, macro_fss_read_f(fll_program_parameter_process_verbosity)); + fss_read_print_error(&main->program.error, macro_fss_read_f(fll_program_parameter_process_verbosity_standard)); - return; - } - } + return; } main->program.output.to.id = F_type_descriptor_output_d; main->program.output.to.stream = F_type_output_d; main->program.output.to.flag = F_file_flag_create_d | F_file_flag_write_only_d | F_file_flag_append_d; - if (parameters->array[fss_read_parameter_help_e].result & f_console_result_found_e) { + if (parameters->array[f_console_standard_parameter_help_e].result & f_console_result_found_e) { main->setting.flag |= fss_read_main_flag_help_e; } - if (parameters->array[fss_read_parameter_version_e].result & f_console_result_found_e) { + if (parameters->array[f_console_standard_parameter_version_e].result & f_console_result_found_e) { main->setting.flag |= fss_read_main_flag_version_e; } - if (parameters->array[fss_read_parameter_copyright_e].result & f_console_result_found_e) { + if (parameters->array[f_console_standard_parameter_copyright_e].result & f_console_result_found_e) { main->setting.flag |= fss_read_main_flag_copyright_e; } @@ -151,8 +129,8 @@ extern "C" { } } - if (parameters->array[fss_read_parameter_help_e].result & f_console_result_found_e) return; - if (parameters->array[fss_read_parameter_version_e].result & f_console_result_found_e) return; + if (parameters->array[f_console_standard_parameter_help_e].result & f_console_result_found_e) return; + if (parameters->array[f_console_standard_parameter_version_e].result & f_console_result_found_e) return; f_number_unsigned_t i = 0; f_number_unsigned_t index = 0; diff --git a/level_3/fss_read/c/main/common.h b/level_3/fss_read/c/main/common.h index 0ac1cae..ce47ccf 100644 --- a/level_3/fss_read/c/main/common.h +++ b/level_3/fss_read/c/main/common.h @@ -62,7 +62,7 @@ extern "C" { * Errors (with error bit) from: f_file_stream_open(). * Errors (with error bit) from: f_string_dynamics_resize(). * Errors (with error bit) from: fll_program_parameter_process_context(). - * Errors (with error bit) from: fll_program_parameter_process_verbosity(). + * Errors (with error bit) from: fll_program_parameter_process_verbosity_standard(). * * Errors (with error bit) from: fss_read_setting_load_depth(). * Errors (with error bit) from: fss_read_signal_check() @@ -75,7 +75,7 @@ extern "C" { * @see f_file_stream_open() * @see f_string_dynamics_resize() * @see fll_program_parameter_process_context() - * @see fll_program_parameter_process_verbosity() + * @see fll_program_parameter_process_verbosity_standard() * * @see fss_read_setting_load_depth() * @see fss_read_signal_check() diff --git a/level_3/fss_read/c/main/common/enumeration.h b/level_3/fss_read/c/main/common/enumeration.h index dea9f48..4cbb25e 100644 --- a/level_3/fss_read/c/main/common/enumeration.h +++ b/level_3/fss_read/c/main/common/enumeration.h @@ -89,21 +89,7 @@ extern "C" { */ #ifndef _di_fss_read_parameter_e_ enum { - fss_read_parameter_help_e, - fss_read_parameter_copyright_e, - fss_read_parameter_light_e, - fss_read_parameter_dark_e, - fss_read_parameter_no_color_e, - fss_read_parameter_verbosity_quiet_e, - fss_read_parameter_verbosity_error_e, - fss_read_parameter_verbosity_normal_e, - fss_read_parameter_verbosity_verbose_e, - fss_read_parameter_verbosity_debug_e, - fss_read_parameter_version_e, - fss_read_parameter_line_first_no_e, - fss_read_parameter_line_last_no_e, - - fss_read_parameter_as_e, + fss_read_parameter_as_e = f_console_standard_parameter_last_e, fss_read_parameter_at_e, fss_read_parameter_content_e, fss_read_parameter_columns_e, diff --git a/level_3/fss_read/c/main/common/print.c b/level_3/fss_read/c/main/common/print.c index eb112e3..7df4a2e 100644 --- a/level_3/fss_read/c/main/common/print.c +++ b/level_3/fss_read/c/main/common/print.c @@ -49,8 +49,8 @@ extern "C" { "fll_fss_extended_read", "fll_fss_extended_list_read", "fll_fss_payload_read", - "fll_program_parameter_process_context", - "fll_program_parameter_process_verbosity", + "fll_program_parameter_process_context_standard", + "fll_program_parameter_process_verbosity_standard", "fss_read_depths_resize", "fss_read_ensure_quotes_length", "fss_read_files_resize", diff --git a/level_3/fss_read/c/main/common/print.h b/level_3/fss_read/c/main/common/print.h index 8a3da05..12b358e 100644 --- a/level_3/fss_read/c/main/common/print.h +++ b/level_3/fss_read/c/main/common/print.h @@ -82,8 +82,8 @@ extern "C" { fss_read_f_fll_fss_extended_read_e, fss_read_f_fll_fss_extended_list_read_e, fss_read_f_fll_fss_payload_read_e, - fss_read_f_fll_program_parameter_process_context_e, - fss_read_f_fll_program_parameter_process_verbosity_e, + fss_read_f_fll_program_parameter_process_context_standard_e, + fss_read_f_fll_program_parameter_process_verbosity_standard_e, fss_read_f_fss_read_depths_resize_e, fss_read_f_fss_read_ensure_quotes_length_e, fss_read_f_fss_read_files_resize_e, diff --git a/level_3/fss_read/c/main/main.h b/level_3/fss_read/c/main/main.h index f913001..d183272 100644 --- a/level_3/fss_read/c/main/main.h +++ b/level_3/fss_read/c/main/main.h @@ -74,13 +74,13 @@ extern int main(const int argc, const f_string_t *argv, const f_string_t *envp); * Errors (with error bit) from: f_file_stream_open(). * Errors (with error bit) from: f_string_dynamics_resize(). * Errors (with error bit) from: fll_program_parameter_process_context(). - * Errors (with error bit) from: fll_program_parameter_process_verbosity(). + * Errors (with error bit) from: fll_program_parameter_process_verbosity_standard(). * * @see f_console_parameter_process() * @see f_file_stream_open() * @see f_string_dynamics_resize() * @see fll_program_parameter_process_context() - * @see fll_program_parameter_process_verbosity() + * @see fll_program_parameter_process_verbosity_standard() * * @see fss_read_setting_load() */ diff --git a/level_3/fss_write/c/main/common.c b/level_3/fss_write/c/main/common.c index afed4a6..3f778a1 100644 --- a/level_3/fss_write/c/main/common.c +++ b/level_3/fss_write/c/main/common.c @@ -16,14 +16,14 @@ extern "C" { main->setting.state.step_small = fss_write_allocation_small_d; // Identify and process first/last parameters. - if (main->program.parameters.array[fss_write_parameter_line_first_no_e].result & f_console_result_found_e) { + if (main->program.parameters.array[f_console_standard_parameter_line_first_no_e].result & f_console_result_found_e) { main->setting.flag -= main->setting.flag & fss_write_main_flag_print_first_e; } else { main->setting.flag |= fss_write_main_flag_print_first_e; } - if (main->program.parameters.array[fss_write_parameter_line_last_no_e].result & f_console_result_found_e) { + if (main->program.parameters.array[f_console_standard_parameter_line_last_no_e].result & f_console_result_found_e) { main->setting.flag -= main->setting.flag & fss_write_main_flag_print_last_e; } else { @@ -40,65 +40,43 @@ extern "C" { return; } - { - f_uint16s_t choices = f_uint16s_t_initialize; - - // Identify and prioritize "color context" parameters. - { - uint16_t choices_array[3] = { fss_write_parameter_no_color_e, fss_write_parameter_light_e, fss_write_parameter_dark_e }; - choices.array = choices_array; - choices.used = 3; - - static const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e }; - - main->setting.state.status = fll_program_parameter_process_context(choices, modes, F_true, &main->program); + main->setting.state.status = fll_program_parameter_process_context_standard(F_true, &main->program); - if (F_status_is_error(main->setting.state.status)) { - if ((main->setting.flag & fss_write_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { - fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); - } - - fss_write_print_error(&main->program.error, macro_fss_write_f(fll_program_parameter_process_context)); - - return; - } + if (F_status_is_error(main->setting.state.status)) { + if ((main->setting.flag & fss_write_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); } - // Identify and prioritize "verbosity" parameters. - { - uint16_t choices_array[5] = { fss_write_parameter_verbosity_quiet_e, fss_write_parameter_verbosity_error_e, fss_write_parameter_verbosity_verbose_e, fss_write_parameter_verbosity_debug_e, fss_write_parameter_verbosity_normal_e }; - choices.array = choices_array; - choices.used = 5; + fss_write_print_error(&main->program.error, macro_fss_write_f(fll_program_parameter_process_context_standard)); - static const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e }; + return; + } - main->setting.state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, &main->program); + main->setting.state.status = fll_program_parameter_process_verbosity_standard(F_true, &main->program); - if (F_status_is_error(main->setting.state.status)) { - if ((main->setting.flag & fss_write_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { - fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); - } + if (F_status_is_error(main->setting.state.status)) { + if ((main->setting.flag & fss_write_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); + } - fss_write_print_error(&main->program.error, macro_fss_write_f(fll_program_parameter_process_verbosity)); + fss_write_print_error(&main->program.error, macro_fss_write_f(fll_program_parameter_process_verbosity_standard)); - return; - } - } + return; } main->program.output.to.id = F_type_descriptor_output_d; main->program.output.to.stream = F_type_output_d; main->program.output.to.flag = F_file_flag_create_d | F_file_flag_write_only_d | F_file_flag_append_d; - if (main->program.parameters.array[fss_write_parameter_help_e].result & f_console_result_found_e) { + if (main->program.parameters.array[f_console_standard_parameter_help_e].result & f_console_result_found_e) { main->setting.flag |= fss_write_main_flag_help_e; } - if (main->program.parameters.array[fss_write_parameter_version_e].result & f_console_result_found_e) { + if (main->program.parameters.array[f_console_standard_parameter_version_e].result & f_console_result_found_e) { main->setting.flag |= fss_write_main_flag_version_e; } - if (main->program.parameters.array[fss_write_parameter_copyright_e].result & f_console_result_found_e) { + if (main->program.parameters.array[f_console_standard_parameter_copyright_e].result & f_console_result_found_e) { main->setting.flag |= fss_write_main_flag_copyright_e; } @@ -113,8 +91,8 @@ extern "C" { } } - if (main->program.parameters.array[fss_write_parameter_help_e].result & f_console_result_found_e) return; - if (main->program.parameters.array[fss_write_parameter_version_e].result & f_console_result_found_e) return; + if (main->program.parameters.array[f_console_standard_parameter_help_e].result & f_console_result_found_e) return; + if (main->program.parameters.array[f_console_standard_parameter_version_e].result & f_console_result_found_e) return; if ((main->program.parameters.array[fss_write_parameter_file_e].result & f_console_result_value_e) && main->program.parameters.array[fss_write_parameter_file_e].values.used) { if (main->program.parameters.array[fss_write_parameter_file_e].values.used > 1) { diff --git a/level_3/fss_write/c/main/common.h b/level_3/fss_write/c/main/common.h index f8ef104..3ea8b01 100644 --- a/level_3/fss_write/c/main/common.h +++ b/level_3/fss_write/c/main/common.h @@ -40,7 +40,7 @@ extern "C" { * Errors (with error bit) from: f_file_stream_open(). * Errors (with error bit) from: f_string_dynamics_resize(). * Errors (with error bit) from: fll_program_parameter_process_context(). - * Errors (with error bit) from: fll_program_parameter_process_verbosity(). + * Errors (with error bit) from: fll_program_parameter_process_verbosity_standard(). * @param callback * (optional) Designate a function to call after performing the initial processing, but before printing help. * If the function returns F_done, then this function immediately returns, resetting status to F_none. @@ -50,7 +50,7 @@ extern "C" { * @see f_file_stream_open() * @see f_string_dynamics_resize() * @see fll_program_parameter_process_context() - * @see fll_program_parameter_process_verbosity() + * @see fll_program_parameter_process_verbosity_standard() */ #ifndef _di_fss_write_setting_load_ extern void fss_write_setting_load(const f_console_arguments_t arguments, fss_write_main_t * const main, void (*callback)(const f_console_arguments_t arguments, fss_write_main_t * const main)); diff --git a/level_3/fss_write/c/main/common/enumeration.h b/level_3/fss_write/c/main/common/enumeration.h index 511ab14..2c6c8f2 100644 --- a/level_3/fss_write/c/main/common/enumeration.h +++ b/level_3/fss_write/c/main/common/enumeration.h @@ -64,21 +64,7 @@ extern "C" { */ #ifndef _di_fss_write_parameter_e_ enum { - fss_write_parameter_help_e, - fss_write_parameter_copyright_e, - fss_write_parameter_light_e, - fss_write_parameter_dark_e, - fss_write_parameter_no_color_e, - fss_write_parameter_verbosity_quiet_e, - fss_write_parameter_verbosity_error_e, - fss_write_parameter_verbosity_normal_e, - fss_write_parameter_verbosity_verbose_e, - fss_write_parameter_verbosity_debug_e, - fss_write_parameter_version_e, - fss_write_parameter_line_first_no_e, - fss_write_parameter_line_last_no_e, - - fss_write_parameter_as_e, + fss_write_parameter_as_e = f_console_standard_parameter_last_e, fss_write_parameter_backtick_e, fss_write_parameter_content_e, fss_write_parameter_content_end_e, diff --git a/level_3/fss_write/c/main/common/print.c b/level_3/fss_write/c/main/common/print.c index 7ed91f8..8d95d98 100644 --- a/level_3/fss_write/c/main/common/print.c +++ b/level_3/fss_write/c/main/common/print.c @@ -35,8 +35,8 @@ extern "C" { "fl_fss_extended_list_object_write", "fl_fss_extended_object_write", "fl_fss_payload_content_write", - "fll_program_parameter_process_context", - "fll_program_parameter_process_verbosity", + "fll_program_parameter_process_context_standard", + "fll_program_parameter_process_verbosity_standard", "fll_fss_payload_write", }; #endif // _di_fss_write_f_a_ diff --git a/level_3/fss_write/c/main/common/print.h b/level_3/fss_write/c/main/common/print.h index 1f33f98..2a709f2 100644 --- a/level_3/fss_write/c/main/common/print.h +++ b/level_3/fss_write/c/main/common/print.h @@ -68,8 +68,8 @@ extern "C" { fss_write_f_fl_fss_extended_list_object_write_e, fss_write_f_fl_fss_extended_object_write_e, fss_write_f_fl_fss_payload_content_write_e, - fss_write_f_fll_program_parameter_process_context_e, - fss_write_f_fll_program_parameter_process_verbosity_e, + fss_write_f_fll_program_parameter_process_context_standard_e, + fss_write_f_fll_program_parameter_process_verbosity_standard_e, fss_write_f_fll_fss_payload_write_e, }; // enum #endif // _di_fss_write_f_e_ diff --git a/level_3/fss_write/c/main/main.h b/level_3/fss_write/c/main/main.h index f7e5fa50..dae60f0 100644 --- a/level_3/fss_write/c/main/main.h +++ b/level_3/fss_write/c/main/main.h @@ -78,13 +78,13 @@ extern int main(const int argc, const f_string_t *argv, const f_string_t *envp); * Errors (with error bit) from: f_file_stream_open(). * Errors (with error bit) from: f_string_dynamics_resize(). * Errors (with error bit) from: fll_program_parameter_process_context(). - * Errors (with error bit) from: fll_program_parameter_process_verbosity(). + * Errors (with error bit) from: fll_program_parameter_process_verbosity_standard(). * * @see f_console_parameter_process() * @see f_file_stream_open() * @see f_string_dynamics_resize() * @see fll_program_parameter_process_context() - * @see fll_program_parameter_process_verbosity() + * @see fll_program_parameter_process_verbosity_standard() * * @see fss_write_setting_load() */ diff --git a/level_3/iki_read/c/main/common.c b/level_3/iki_read/c/main/common.c index 0505667..b16e896 100644 --- a/level_3/iki_read/c/main/common.c +++ b/level_3/iki_read/c/main/common.c @@ -16,14 +16,14 @@ extern "C" { main->setting.state.step_small = iki_read_allocation_small_d; // Identify and process first/last parameters. - if (main->program.parameters.array[iki_read_parameter_line_first_no_e].result & f_console_result_found_e) { + if (main->program.parameters.array[f_console_standard_parameter_line_first_no_e].result & f_console_result_found_e) { main->setting.flag -= main->setting.flag & iki_read_main_flag_print_first_e; } else { main->setting.flag |= iki_read_main_flag_print_first_e; } - if (main->program.parameters.array[iki_read_parameter_line_last_no_e].result & f_console_result_found_e) { + if (main->program.parameters.array[f_console_standard_parameter_line_last_no_e].result & f_console_result_found_e) { main->setting.flag -= main->setting.flag & iki_read_main_flag_print_last_e; } else { @@ -40,68 +40,46 @@ extern "C" { return; } - { - f_uint16s_t choices = f_uint16s_t_initialize; + main->setting.state.status = fll_program_parameter_process_context_standard(F_true, &main->program); - // Identify and prioritize "color context" parameters. - { - uint16_t choices_array[3] = { iki_read_parameter_no_color_e, iki_read_parameter_light_e, iki_read_parameter_dark_e }; - choices.array = choices_array; - choices.used = 3; - - static const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e }; - - main->setting.state.status = fll_program_parameter_process_context(choices, modes, F_true, &main->program); - - if (F_status_is_error(main->setting.state.status)) { - if ((main->setting.flag & iki_read_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { - fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); - } - - iki_read_print_error(&main->program.error, macro_iki_read_f(fll_program_parameter_process_context)); - - return; - } + if (F_status_is_error(main->setting.state.status)) { + if ((main->setting.flag & iki_read_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); } - // Identify and prioritize "verbosity" parameters. - { - uint16_t choices_array[5] = { iki_read_parameter_verbosity_quiet_e, iki_read_parameter_verbosity_error_e, iki_read_parameter_verbosity_verbose_e, iki_read_parameter_verbosity_debug_e, iki_read_parameter_verbosity_normal_e }; - choices.array = choices_array; - choices.used = 5; + iki_read_print_error(&main->program.error, macro_iki_read_f(fll_program_parameter_process_context_standard)); - static const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e }; + return; + } - main->setting.state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, &main->program); + main->setting.state.status = fll_program_parameter_process_verbosity_standard(F_true, &main->program); - if (F_status_is_error(main->setting.state.status)) { - if ((main->setting.flag & iki_read_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { - fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); - } + if (F_status_is_error(main->setting.state.status)) { + if ((main->setting.flag & iki_read_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); + } - iki_read_print_error(&main->program.error, macro_iki_read_f(fll_program_parameter_process_verbosity)); + iki_read_print_error(&main->program.error, macro_iki_read_f(fll_program_parameter_process_verbosity_standard)); - return; - } - } + return; + } - if (main->program.parameters.array[iki_read_parameter_help_e].result & f_console_result_found_e) { - main->setting.flag |= iki_read_main_flag_help_e; + if (main->program.parameters.array[f_console_standard_parameter_help_e].result & f_console_result_found_e) { + main->setting.flag |= iki_read_main_flag_help_e; - return; - } + return; + } - if (main->program.parameters.array[iki_read_parameter_version_e].result & f_console_result_found_e) { - main->setting.flag |= iki_read_main_flag_version_e; + if (main->program.parameters.array[f_console_standard_parameter_version_e].result & f_console_result_found_e) { + main->setting.flag |= iki_read_main_flag_version_e; - return; - } + return; + } - if (main->program.parameters.array[iki_read_parameter_copyright_e].result & f_console_result_found_e) { - main->setting.flag |= iki_read_main_flag_copyright_e; + if (main->program.parameters.array[f_console_standard_parameter_copyright_e].result & f_console_result_found_e) { + main->setting.flag |= iki_read_main_flag_copyright_e; - return; - } + return; } if (!(main->program.parameters.remaining.used || (main->program.pipe & fll_program_data_pipe_input_e))) { diff --git a/level_3/iki_read/c/main/common.h b/level_3/iki_read/c/main/common.h index 62bfa01..c9651fd 100644 --- a/level_3/iki_read/c/main/common.h +++ b/level_3/iki_read/c/main/common.h @@ -38,7 +38,7 @@ extern "C" { * Errors (with error bit) from: f_string_maps_resize(). * Errors (with error bit) from: f_string_triples_resize(). * Errors (with error bit) from: fll_program_parameter_process_context(). - * Errors (with error bit) from: fll_program_parameter_process_verbosity(). + * Errors (with error bit) from: fll_program_parameter_process_verbosity_standard(). * * @see f_console_parameter_process() * @see f_file_exists() @@ -47,7 +47,7 @@ extern "C" { * @see f_string_maps_resize() * @see f_string_triples_resize() * @see fll_program_parameter_process_context() - * @see fll_program_parameter_process_verbosity() + * @see fll_program_parameter_process_verbosity_standard() */ #ifndef _di_iki_read_setting_load_ extern void iki_read_setting_load(const f_console_arguments_t arguments, iki_read_main_t * const main); diff --git a/level_3/iki_read/c/main/common/enumeration.h b/level_3/iki_read/c/main/common/enumeration.h index 7734585..25a2046 100644 --- a/level_3/iki_read/c/main/common/enumeration.h +++ b/level_3/iki_read/c/main/common/enumeration.h @@ -67,21 +67,7 @@ extern "C" { */ #ifndef _di_iki_read_parameter_e_ enum { - iki_read_parameter_help_e, - iki_read_parameter_copyright_e, - iki_read_parameter_light_e, - iki_read_parameter_dark_e, - iki_read_parameter_no_color_e, - iki_read_parameter_verbosity_quiet_e, - iki_read_parameter_verbosity_error_e, - iki_read_parameter_verbosity_normal_e, - iki_read_parameter_verbosity_verbose_e, - iki_read_parameter_verbosity_debug_e, - iki_read_parameter_version_e, - iki_read_parameter_line_first_no_e, - iki_read_parameter_line_last_no_e, - - iki_read_parameter_at_e, + iki_read_parameter_at_e = f_console_standard_parameter_last_e, iki_read_parameter_content_e, iki_read_parameter_line_e, iki_read_parameter_literal_e, diff --git a/level_3/iki_read/c/main/common/print.c b/level_3/iki_read/c/main/common/print.c index e4c0c50..5395a20 100644 --- a/level_3/iki_read/c/main/common/print.c +++ b/level_3/iki_read/c/main/common/print.c @@ -23,8 +23,8 @@ extern "C" { "f_string_triples_increase_by", "f_thread_create", "fl_iki_read", - "fll_program_parameter_process_context", - "fll_program_parameter_process_verbosity", + "fll_program_parameter_process_context_standard", + "fll_program_parameter_process_verbosity_standard", }; #endif // _di_iki_read_f_a_ diff --git a/level_3/iki_read/c/main/common/print.h b/level_3/iki_read/c/main/common/print.h index f47d032..7e40b70 100644 --- a/level_3/iki_read/c/main/common/print.h +++ b/level_3/iki_read/c/main/common/print.h @@ -56,8 +56,8 @@ extern "C" { iki_read_f_f_string_triples_increase_by_e, iki_read_f_f_thread_create_e, iki_read_f_fl_iki_read_e, - iki_read_f_fll_program_parameter_process_context_e, - iki_read_f_fll_program_parameter_process_verbosity_e, + iki_read_f_fll_program_parameter_process_context_standard_e, + iki_read_f_fll_program_parameter_process_verbosity_standard_e, }; // enum #endif // _di_iki_read_f_e_ diff --git a/level_3/iki_write/c/main/common.c b/level_3/iki_write/c/main/common.c index 75fd984..1b26f35 100644 --- a/level_3/iki_write/c/main/common.c +++ b/level_3/iki_write/c/main/common.c @@ -16,14 +16,14 @@ extern "C" { main->setting.state.step_small = iki_write_allocation_small_d; // Identify and process first/last parameters. - if (main->program.parameters.array[iki_write_parameter_line_first_no_e].result & f_console_result_found_e) { + if (main->program.parameters.array[f_console_standard_parameter_line_first_no_e].result & f_console_result_found_e) { main->setting.flag -= main->setting.flag & iki_write_main_flag_print_first_e; } else { main->setting.flag |= iki_write_main_flag_print_first_e; } - if (main->program.parameters.array[iki_write_parameter_line_last_no_e].result & f_console_result_found_e) { + if (main->program.parameters.array[f_console_standard_parameter_line_last_no_e].result & f_console_result_found_e) { main->setting.flag -= main->setting.flag & iki_write_main_flag_print_last_e; } else { @@ -40,69 +40,47 @@ extern "C" { return; } - { - f_uint16s_t choices = f_uint16s_t_initialize; + main->setting.state.status = fll_program_parameter_process_context_standard(F_true, &main->program); - // Identify and prioritize "color context" parameters. - { - uint16_t choices_array[3] = { iki_write_parameter_no_color_e, iki_write_parameter_light_e, iki_write_parameter_dark_e }; - choices.array = choices_array; - choices.used = 3; - - static const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e }; - - main->setting.state.status = fll_program_parameter_process_context(choices, modes, F_true, &main->program); - - if (F_status_is_error(main->setting.state.status)) { - if ((main->setting.flag & iki_write_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { - fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); - } - - iki_write_print_error(&main->program.error, macro_iki_write_f(fll_program_parameter_process_context)); - - return; - } + if (F_status_is_error(main->setting.state.status)) { + if ((main->setting.flag & iki_write_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); } - // Identify and prioritize "verbosity" parameters. - { - uint16_t choices_array[5] = { iki_write_parameter_verbosity_quiet_e, iki_write_parameter_verbosity_error_e, iki_write_parameter_verbosity_verbose_e, iki_write_parameter_verbosity_debug_e, iki_write_parameter_verbosity_normal_e }; - choices.array = choices_array; - choices.used = 5; + iki_write_print_error(&main->program.error, macro_iki_write_f(fll_program_parameter_process_context_standard)); - static const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e }; + return; + } - main->setting.state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, &main->program); + main->setting.state.status = fll_program_parameter_process_verbosity_standard(F_true, &main->program); - if (F_status_is_error(main->setting.state.status)) { - if ((main->setting.flag & iki_write_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { - fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); - } + if (F_status_is_error(main->setting.state.status)) { + if ((main->setting.flag & iki_write_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); + } - iki_write_print_error(&main->program.error, macro_iki_write_f(fll_program_parameter_process_verbosity)); + iki_write_print_error(&main->program.error, macro_iki_write_f(fll_program_parameter_process_verbosity_standard)); - return; - } - } + return; } main->program.output.to.id = F_type_descriptor_output_d; main->program.output.to.stream = F_type_output_d; main->program.output.to.flag = F_file_flag_create_d | F_file_flag_write_only_d | F_file_flag_append_d; - if (main->program.parameters.array[iki_write_parameter_help_e].result & f_console_result_found_e) { + if (main->program.parameters.array[f_console_standard_parameter_help_e].result & f_console_result_found_e) { main->setting.flag |= iki_write_main_flag_help_e; return; } - if (main->program.parameters.array[iki_write_parameter_version_e].result & f_console_result_found_e) { + if (main->program.parameters.array[f_console_standard_parameter_version_e].result & f_console_result_found_e) { main->setting.flag |= iki_write_main_flag_version_e; return; } - if (main->program.parameters.array[iki_write_parameter_copyright_e].result & f_console_result_found_e) { + if (main->program.parameters.array[f_console_standard_parameter_copyright_e].result & f_console_result_found_e) { main->setting.flag |= iki_write_main_flag_copyright_e; return; diff --git a/level_3/iki_write/c/main/common.h b/level_3/iki_write/c/main/common.h index 0347526..0a5d9b7 100644 --- a/level_3/iki_write/c/main/common.h +++ b/level_3/iki_write/c/main/common.h @@ -35,13 +35,13 @@ extern "C" { * Errors (with error bit) from: f_file_stream_open(). * Errors (with error bit) from: f_string_dynamics_resize(). * Errors (with error bit) from: fll_program_parameter_process_context(). - * Errors (with error bit) from: fll_program_parameter_process_verbosity(). + * Errors (with error bit) from: fll_program_parameter_process_verbosity_standard(). * * @see f_console_parameter_process() * @see f_file_stream_open() * @see f_string_dynamics_resize() * @see fll_program_parameter_process_context() - * @see fll_program_parameter_process_verbosity() + * @see fll_program_parameter_process_verbosity_standard() */ #ifndef _di_iki_write_setting_load_ extern void iki_write_setting_load(const f_console_arguments_t arguments, iki_write_main_t * const main); diff --git a/level_3/iki_write/c/main/common/enumeration.h b/level_3/iki_write/c/main/common/enumeration.h index eeb8e2e..c946f33 100644 --- a/level_3/iki_write/c/main/common/enumeration.h +++ b/level_3/iki_write/c/main/common/enumeration.h @@ -52,21 +52,7 @@ extern "C" { */ #ifndef _di_iki_write_parameter_e_ enum { - iki_write_parameter_help_e, - iki_write_parameter_copyright_e, - iki_write_parameter_light_e, - iki_write_parameter_dark_e, - iki_write_parameter_no_color_e, - iki_write_parameter_verbosity_quiet_e, - iki_write_parameter_verbosity_error_e, - iki_write_parameter_verbosity_normal_e, - iki_write_parameter_verbosity_verbose_e, - iki_write_parameter_verbosity_debug_e, - iki_write_parameter_version_e, - iki_write_parameter_line_first_no_e, - iki_write_parameter_line_last_no_e, - - iki_write_parameter_backtick_e, + iki_write_parameter_backtick_e = f_console_standard_parameter_last_e, iki_write_parameter_content_e, iki_write_parameter_double_e, iki_write_parameter_file_e, diff --git a/level_3/iki_write/c/main/common/print.c b/level_3/iki_write/c/main/common/print.c index 48eaf5f..2d1fd7e 100644 --- a/level_3/iki_write/c/main/common/print.c +++ b/level_3/iki_write/c/main/common/print.c @@ -15,8 +15,8 @@ extern "C" { "f_string_dynamics_resize", "f_thread_create", "fll_iki_content_escape", - "fll_program_parameter_process_context", - "fll_program_parameter_process_verbosity", + "fll_program_parameter_process_context_standard", + "fll_program_parameter_process_verbosity_standard", }; #endif // _di_iki_write_f_a_ diff --git a/level_3/iki_write/c/main/common/print.h b/level_3/iki_write/c/main/common/print.h index a240b5c..9a0e346 100644 --- a/level_3/iki_write/c/main/common/print.h +++ b/level_3/iki_write/c/main/common/print.h @@ -48,8 +48,8 @@ extern "C" { iki_write_f_f_string_dynamics_resize_e, iki_write_f_f_thread_create_e, iki_write_f_fll_iki_content_escape_e, - iki_write_f_fll_program_parameter_process_context_e, - iki_write_f_fll_program_parameter_process_verbosity_e, + iki_write_f_fll_program_parameter_process_context_standard_e, + iki_write_f_fll_program_parameter_process_verbosity_standard_e, }; // enum #endif // _di_iki_write_f_e_ diff --git a/level_3/status_code/c/main/common.c b/level_3/status_code/c/main/common.c index 4f18971..2b13434 100644 --- a/level_3/status_code/c/main/common.c +++ b/level_3/status_code/c/main/common.c @@ -16,14 +16,14 @@ extern "C" { main->setting.state.step_small = status_code_allocation_small_d; // Identify and process first/last parameters. - if (main->program.parameters.array[status_code_parameter_line_first_no_e].result & f_console_result_found_e) { + if (main->program.parameters.array[f_console_standard_parameter_line_first_no_e].result & f_console_result_found_e) { main->setting.flag -= main->setting.flag & status_code_main_flag_print_first_e; } else { main->setting.flag |= status_code_main_flag_print_first_e; } - if (main->program.parameters.array[status_code_parameter_line_last_no_e].result & f_console_result_found_e) { + if (main->program.parameters.array[f_console_standard_parameter_line_last_no_e].result & f_console_result_found_e) { main->setting.flag -= main->setting.flag & status_code_main_flag_print_last_e; } else { @@ -40,68 +40,46 @@ extern "C" { return; } - { - f_uint16s_t choices = f_uint16s_t_initialize; + main->setting.state.status = fll_program_parameter_process_context_standard(F_true, &main->program); - // Identify and prioritize "color context" parameters. - { - uint16_t choices_array[3] = { status_code_parameter_no_color_e, status_code_parameter_light_e, status_code_parameter_dark_e }; - choices.array = choices_array; - choices.used = 3; - - static const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e }; - - main->setting.state.status = fll_program_parameter_process_context(choices, modes, F_true, &main->program); - - if (F_status_is_error(main->setting.state.status)) { - if ((main->setting.flag & status_code_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { - fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); - } - - status_code_print_error(&main->program.error, macro_status_code_f(fll_program_parameter_process_context)); - - return; - } + if (F_status_is_error(main->setting.state.status)) { + if ((main->setting.flag & status_code_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); } - // Identify and prioritize "verbosity" parameters. - { - uint16_t choices_array[5] = { status_code_parameter_verbosity_quiet_e, status_code_parameter_verbosity_error_e, status_code_parameter_verbosity_verbose_e, status_code_parameter_verbosity_debug_e, status_code_parameter_verbosity_normal_e }; - choices.array = choices_array; - choices.used = 5; + status_code_print_error(&main->program.error, macro_status_code_f(fll_program_parameter_process_context_standard)); - static const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e }; + return; + } - main->setting.state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, &main->program); + main->setting.state.status = fll_program_parameter_process_verbosity_standard(F_true, &main->program); - if (F_status_is_error(main->setting.state.status)) { - if ((main->setting.flag & status_code_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { - fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); - } + if (F_status_is_error(main->setting.state.status)) { + if ((main->setting.flag & status_code_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); + } - status_code_print_error(&main->program.error, macro_status_code_f(fll_program_parameter_process_verbosity)); + status_code_print_error(&main->program.error, macro_status_code_f(fll_program_parameter_process_verbosity_standard)); - return; - } - } + return; + } - if (main->program.parameters.array[status_code_parameter_help_e].result & f_console_result_found_e) { - main->setting.flag |= status_code_main_flag_help_e; + if (main->program.parameters.array[f_console_standard_parameter_help_e].result & f_console_result_found_e) { + main->setting.flag |= status_code_main_flag_help_e; - return; - } + return; + } - if (main->program.parameters.array[status_code_parameter_version_e].result & f_console_result_found_e) { - main->setting.flag |= status_code_main_flag_version_e; + if (main->program.parameters.array[f_console_standard_parameter_version_e].result & f_console_result_found_e) { + main->setting.flag |= status_code_main_flag_version_e; - return; - } + return; + } - if (main->program.parameters.array[status_code_parameter_copyright_e].result & f_console_result_found_e) { - main->setting.flag |= status_code_main_flag_copyright_e; + if (main->program.parameters.array[f_console_standard_parameter_copyright_e].result & f_console_result_found_e) { + main->setting.flag |= status_code_main_flag_copyright_e; - return; - } + return; } if (main->program.parameters.array[status_code_parameter_error_e].result & f_console_result_found_e) { diff --git a/level_3/status_code/c/main/common/enumeration.h b/level_3/status_code/c/main/common/enumeration.h index 25b03ae..ac99082 100644 --- a/level_3/status_code/c/main/common/enumeration.h +++ b/level_3/status_code/c/main/common/enumeration.h @@ -53,21 +53,7 @@ extern "C" { */ #ifndef _di_status_code_parameter_e_ enum { - status_code_parameter_help_e, - status_code_parameter_copyright_e, - status_code_parameter_light_e, - status_code_parameter_dark_e, - status_code_parameter_no_color_e, - status_code_parameter_verbosity_quiet_e, - status_code_parameter_verbosity_error_e, - status_code_parameter_verbosity_normal_e, - status_code_parameter_verbosity_verbose_e, - status_code_parameter_verbosity_debug_e, - status_code_parameter_version_e, - status_code_parameter_line_first_no_e, - status_code_parameter_line_last_no_e, - - status_code_parameter_fine_e, + status_code_parameter_fine_e = f_console_standard_parameter_last_e, status_code_parameter_warning_e, status_code_parameter_error_e, status_code_parameter_number_e, diff --git a/level_3/status_code/c/main/common/print.c b/level_3/status_code/c/main/common/print.c index 600acc8..4841d55 100644 --- a/level_3/status_code/c/main/common/print.c +++ b/level_3/status_code/c/main/common/print.c @@ -8,8 +8,8 @@ extern "C" { const f_string_t status_code_f_a[] = { "f_console_parameter_process", "f_thread_create", - "fll_program_parameter_process_context", - "fll_program_parameter_process_verbosity", + "fll_program_parameter_process_context_standard", + "fll_program_parameter_process_verbosity_standard", "status_string_from", "status_string_to", }; diff --git a/level_3/status_code/c/main/common/print.h b/level_3/status_code/c/main/common/print.h index 9ded4a5..f27e477 100644 --- a/level_3/status_code/c/main/common/print.h +++ b/level_3/status_code/c/main/common/print.h @@ -41,8 +41,8 @@ extern "C" { enum { status_code_f_f_console_parameter_process_e, status_code_f_f_thread_create_e, - status_code_f_fll_program_parameter_process_context_e, - status_code_f_fll_program_parameter_process_verbosity_e, + status_code_f_fll_program_parameter_process_context_standard_e, + status_code_f_fll_program_parameter_process_verbosity_standard_e, status_code_f_status_string_from_e, status_code_f_status_string_to_e, }; // enum diff --git a/level_3/utf8/c/main/common.c b/level_3/utf8/c/main/common.c index 565b468..c8601f9 100644 --- a/level_3/utf8/c/main/common.c +++ b/level_3/utf8/c/main/common.c @@ -16,14 +16,14 @@ extern "C" { main->setting.state.step_small = utf8_allocation_small_d; // Identify and process first/last parameters. - if (main->program.parameters.array[utf8_parameter_line_first_no_e].result & f_console_result_found_e) { + if (main->program.parameters.array[f_console_standard_parameter_line_first_no_e].result & f_console_result_found_e) { main->setting.flag -= main->setting.flag & utf8_main_flag_print_first_e; } else { main->setting.flag |= utf8_main_flag_print_first_e; } - if (main->program.parameters.array[utf8_parameter_line_last_no_e].result & f_console_result_found_e) { + if (main->program.parameters.array[f_console_standard_parameter_line_last_no_e].result & f_console_result_found_e) { main->setting.flag -= main->setting.flag & utf8_main_flag_print_last_e; } else { @@ -40,51 +40,33 @@ extern "C" { return; } - { - f_number_unsigned_t choice = 0; - f_uint16s_t choices = f_uint16s_t_initialize; - - // Identify and prioritize "color context" parameters. - { - uint16_t choices_array[3] = { utf8_parameter_no_color_e, utf8_parameter_light_e, utf8_parameter_dark_e }; - choices.array = choices_array; - choices.used = 3; + main->setting.state.status = fll_program_parameter_process_context_standard(F_true, &main->program); - static const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e }; + if (F_status_is_error(main->setting.state.status)) { + if ((main->setting.flag & utf8_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); + } - main->setting.state.status = fll_program_parameter_process_context(choices, modes, F_true, &main->program); + utf8_print_error(&main->program.error, macro_utf8_f(fll_program_parameter_process_context_standard)); - if (F_status_is_error(main->setting.state.status)) { - if ((main->setting.flag & utf8_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { - fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); - } + return; + } - utf8_print_error(&main->program.error, macro_utf8_f(fll_program_parameter_process_context)); + main->setting.state.status = fll_program_parameter_process_verbosity_standard(F_true, &main->program); - return; - } + if (F_status_is_error(main->setting.state.status)) { + if ((main->setting.flag & utf8_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); } - // Identify and prioritize "verbosity" parameters. - { - uint16_t choices_array[5] = { utf8_parameter_verbosity_quiet_e, utf8_parameter_verbosity_error_e, utf8_parameter_verbosity_verbose_e, utf8_parameter_verbosity_debug_e, utf8_parameter_verbosity_normal_e }; - choices.array = choices_array; - choices.used = 5; - - static const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e }; + utf8_print_error(&main->program.error, macro_utf8_f(fll_program_parameter_process_verbosity_standard)); - main->setting.state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, &main->program); - - if (F_status_is_error(main->setting.state.status)) { - if ((main->setting.flag & utf8_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { - fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); - } - - utf8_print_error(&main->program.error, macro_utf8_f(fll_program_parameter_process_verbosity)); + return; + } - return; - } - } + { + f_number_unsigned_t choice = 0; + f_uint16s_t choices = f_uint16s_t_initialize; // Identify and prioritize "from" mode parameters. { @@ -173,19 +155,19 @@ extern "C" { } } - if (main->program.parameters.array[utf8_parameter_help_e].result & f_console_result_found_e) { + if (main->program.parameters.array[f_console_standard_parameter_help_e].result & f_console_result_found_e) { main->setting.flag |= utf8_main_flag_help_e; return; } - if (main->program.parameters.array[utf8_parameter_version_e].result & f_console_result_found_e) { + if (main->program.parameters.array[f_console_standard_parameter_version_e].result & f_console_result_found_e) { main->setting.flag |= utf8_main_flag_version_e; return; } - if (main->program.parameters.array[utf8_parameter_copyright_e].result & f_console_result_found_e) { + if (main->program.parameters.array[f_console_standard_parameter_copyright_e].result & f_console_result_found_e) { main->setting.flag |= utf8_main_flag_copyright_e; return; diff --git a/level_3/utf8/c/main/common/enumeration.h b/level_3/utf8/c/main/common/enumeration.h index 17a6534..35f5819 100644 --- a/level_3/utf8/c/main/common/enumeration.h +++ b/level_3/utf8/c/main/common/enumeration.h @@ -118,21 +118,7 @@ extern "C" { */ #ifndef _di_utf8_parameter_e_ enum { - utf8_parameter_help_e, - utf8_parameter_copyright_e, - utf8_parameter_light_e, - utf8_parameter_dark_e, - utf8_parameter_no_color_e, - utf8_parameter_verbosity_quiet_e, - utf8_parameter_verbosity_error_e, - utf8_parameter_verbosity_normal_e, - utf8_parameter_verbosity_verbose_e, - utf8_parameter_verbosity_debug_e, - utf8_parameter_version_e, - utf8_parameter_line_first_no_e, - utf8_parameter_line_last_no_e, - - utf8_parameter_from_bytesequence_e, + utf8_parameter_from_bytesequence_e = f_console_standard_parameter_last_e, utf8_parameter_from_codepoint_e, utf8_parameter_from_file_e, diff --git a/level_3/utf8/c/main/common/print.c b/level_3/utf8/c/main/common/print.c index 7d7ac5b..86b26aa 100644 --- a/level_3/utf8/c/main/common/print.c +++ b/level_3/utf8/c/main/common/print.c @@ -12,8 +12,8 @@ extern "C" { "f_string_dynamic_append_nulless", "f_string_dynamics_increase_by", "f_thread_create", - "fll_program_parameter_process_context", - "fll_program_parameter_process_verbosity", + "fll_program_parameter_process_context_standard", + "fll_program_parameter_process_verbosity_standard", "utf8_detect_codepoint", "utf8_process_file_bytesequence", "utf8_process_file_codepoint", diff --git a/level_3/utf8/c/main/common/print.h b/level_3/utf8/c/main/common/print.h index 5f98d2c..4059a6a 100644 --- a/level_3/utf8/c/main/common/print.h +++ b/level_3/utf8/c/main/common/print.h @@ -45,8 +45,8 @@ extern "C" { utf8_f_f_string_dynamic_append_nulless_e, utf8_f_f_string_dynamics_increase_by_e, utf8_f_f_thread_create_e, - utf8_f_fll_program_parameter_process_context_e, - utf8_f_fll_program_parameter_process_verbosity_e, + utf8_f_fll_program_parameter_process_context_standard_e, + utf8_f_fll_program_parameter_process_verbosity_standard_e, utf8_f_utf8_detect_codepoint_e, utf8_f_utf8_process_file_bytesequence_e, utf8_f_utf8_process_file_codepoint_e, -- 1.8.3.1