From: Kevin Day Date: Sat, 21 Jan 2023 06:53:38 +0000 (-0600) Subject: Progress: Continue program related work, focusing primarily on fake and console param... X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=60ce1d98d575b0afffcfe759560610dd579c0bf4;p=fll Progress: Continue program related work, focusing primarily on fake and console parameter handling. I realized that the new callback console parameter needs to be implemented. I reviewed the drafted design and changed it accordingly. I've been able to reduce the need to have a callback for each parameter and have a single callback for the set of parameters. The documentation for the console parameter callback change is incomplete for this and my next progress should complete this documentation. I updated several programs regarding the console changes and noticed a small number of bugs in the UTF8 program. The first line is now being printed, conditionally, but future work may be needed. --- diff --git a/level_0/f_console/c/console.c b/level_0/f_console/c/console.c index a78a46b..e0d092b 100644 --- a/level_0/f_console/c/console.c +++ b/level_0/f_console/c/console.c @@ -149,7 +149,7 @@ extern "C" { #endif // _di_f_console_parameter_prioritize_right_ #ifndef _di_f_console_parameter_process_ - f_status_t f_console_parameter_process(const f_console_arguments_t arguments, f_console_parameters_t * const parameters) { + f_status_t f_console_parameter_process(const f_console_arguments_t arguments, f_console_parameters_t * const parameters, void * const data) { #ifndef _di_level_0_parameter_checking_ if (!parameters) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ @@ -158,237 +158,379 @@ extern "C" { if (!arguments.argc || !arguments.argv || !arguments.argv[0]) return F_data_not; - f_status_t status = f_string_dynamics_increase_by(arguments.argc, ¶meters->arguments); - if (F_status_is_error(status)) return status; + f_console_parameter_state_t state = f_console_parameter_state_t_initialize; + + state.status = f_string_dynamics_increase_by(arguments.argc, ¶meters->arguments); + if (F_status_is_error(state.status)) return state.status; + + // Parameter 0 represents the program name so skip it. + state.location = 1; // Append the program name parameter as a static string. parameters->arguments.array[parameters->arguments.used].string = arguments.argv[0]; parameters->arguments.array[parameters->arguments.used].used = strnlen(arguments.argv[0], F_console_parameter_size_d); parameters->arguments.array[parameters->arguments.used++].size = 0; - f_console_result_t result = 0; - bool found = F_false; - - // Parameter 0 represents the program name so skip it. - unsigned long location = 1; - - f_array_length_t sub_location = 0; - f_array_length_t increment_by = 0; - f_array_length_t i = 0; - f_array_length_t values = 0; - f_array_lengths_t needs_value = f_array_lengths_t_initialize; - uint8_t width = 0; + f_utf_char_t character_utf_argument = 0; + f_utf_char_t character_utf_symbol = 0; + f_array_length_t i; + f_array_length_t values; + f_number_unsigned_t width_max = 0; - while (location < arguments.argc && arguments.argv[location]) { + while (state.location < arguments.argc && arguments.argv[state.location]) { - parameters->arguments.array[parameters->arguments.used].string = arguments.argv[location]; - parameters->arguments.array[parameters->arguments.used].used = strnlen(arguments.argv[location], F_console_parameter_size_d); + parameters->arguments.array[parameters->arguments.used].string = arguments.argv[state.location]; + parameters->arguments.array[parameters->arguments.used].used = strnlen(arguments.argv[state.location], F_console_parameter_size_d); parameters->arguments.array[parameters->arguments.used++].size = 0; // Additional parameters must always follow what requests them. - if (needs_value.used) { - i = needs_value.array[0]; + if (state.value_need.used) { + if (parameters->callback) { + state.type = f_console_parameter_state_type_value_need_e; - status = f_array_lengths_increase(F_memory_default_allocation_small_d, ¶meters->array[i].values); - if (F_status_is_error(status)) break; + parameters->callback(arguments, (void * const) parameters, &state, data); - parameters->array[i].result |= f_console_result_value_e; - parameters->array[i].values.array[parameters->array[i].values.used++] = location; + if (F_status_is_error(state.status)) { + f_array_lengths_resize(0, &state.value_need); - --needs_value.used; + return state.status; + } - // Pop the matched parameter off of the top of the needs_value array. - for (f_array_length_t i = 0; i < needs_value.used; ++i) { - needs_value.array[i] = needs_value.array[i + 1]; - } // for + if (state.status == F_break) break; + if (state.status == F_continue) continue; + } + else { + state.status = F_process; + } + + if (state.status == F_process) { + i = state.value_need.array[0]; + + state.status = f_array_lengths_increase(F_memory_default_allocation_small_d, ¶meters->array[i].values); + if (F_status_is_error(state.status)) break; - ++location; + parameters->array[i].result |= f_console_result_value_e; + parameters->array[i].values.array[parameters->array[i].values.used++] = state.location; + + --state.value_need.used; + + // Pop the matched parameter off of the top of the state.value_need array. + for (i = 0; i < state.value_need.used; ++i) { + state.value_need.array[i] = state.value_need.array[i + 1]; + } // for + } + + ++state.location; + state.status = F_none; continue; } - f_console_identify(arguments.argv[location], &result); + if (parameters->callback) { + state.type = f_console_parameter_state_type_identify_e; - // Process the current parameter. - if (result & f_console_result_short_e) { - increment_by = 1; - sub_location = 1; - } - else if (result & f_console_result_long_e) { - increment_by = parameters->arguments.array[location].used; - sub_location = 2; + parameters->callback(arguments, (void * const) parameters, &state, data); + + if (F_status_is_error(state.status)) { + f_array_lengths_resize(0, &state.value_need); + + return state.status; + } + + if (state.status == F_break) break; + if (state.status == F_continue) continue; } else { - increment_by = parameters->arguments.array[location].used; - sub_location = 0; + state.status = F_process; } - found = F_false; + if (state.status == F_process) { + private_f_console_identify(arguments.argv[state.location], &state.result); - if (result & (f_console_result_short_e | f_console_result_long_e)) { + // Process the current parameter. + if (state.result & f_console_result_short_e) { + state.increment_by = 1; + state.location_sub = 1; + } + else if (state.result & f_console_result_long_e) { + state.increment_by = parameters->arguments.array[state.location].used; + state.location_sub = 2; + } + else { + state.increment_by = parameters->arguments.array[state.location].used; + state.location_sub = 0; + } - // The sub_location is used on a per increment basis. - while (sub_location < parameters->arguments.array[location].used) { + state.found = F_false; + } + + state.status = F_none; + + if (state.result & (f_console_result_short_e | f_console_result_long_e)) { + + // The state.location_sub is used on a per increment basis. + while (state.location_sub < parameters->arguments.array[state.location].used) { for (i = 0; i < parameters->used; ++i) { if (parameters->array[i].flag & f_console_flag_disable_e) continue; - if ((result & f_console_result_normal_e) && !(parameters->array[i].flag & f_console_flag_normal_e)) continue; - if ((result & f_console_result_inverse_e) && !(parameters->array[i].flag & f_console_flag_inverse_e)) continue; + if ((state.result & f_console_result_normal_e) && !(parameters->array[i].flag & f_console_flag_normal_e)) continue; + if ((state.result & f_console_result_inverse_e) && !(parameters->array[i].flag & f_console_flag_inverse_e)) continue; // For sublocation processing of 'tar -xcf', the '-' would have an increment of 1, therefore x, c, and f would all be three separate parameters) - if (result & f_console_result_short_e) { + if (state.result & f_console_result_short_e) { if (!parameters->array[i].symbol_short) continue; - width = macro_f_utf_byte_width_is(arguments.argv[location][sub_location]); - if (width) increment_by = width; + width = macro_f_utf_byte_width_is(arguments.argv[state.location][state.location_sub]); + if (width) state.increment_by = width; - if (arguments.argv[location][sub_location] != *parameters->array[i].symbol_short) continue; + if (arguments.argv[state.location][state.location_sub] != *parameters->array[i].symbol_short) continue; if (width) { - f_utf_char_t character_argument_utf = 0; - f_utf_char_t character_console_utf = 0; + character_utf_argument = 0; + character_utf_symbol = 0; + width_max = parameters->arguments.array[state.location].used - state.location_sub; - f_number_unsigned_t width_max = parameters->arguments.array[location].used - sub_location; - - status = f_utf_char_to_character(arguments.argv[location] + sub_location, width_max, &character_argument_utf); - if (F_status_is_error(status)) break; + state.status = f_utf_char_to_character(arguments.argv[state.location] + state.location_sub, width_max, &character_utf_argument); + if (F_status_is_error(state.status)) break; width_max = strlen(parameters->array[i].symbol_short); - status = f_utf_char_to_character((f_string_t) parameters->array[i].symbol_short, width_max, &character_console_utf); - if (F_status_is_error(status)) break; + state.status = f_utf_char_to_character((f_string_t) parameters->array[i].symbol_short, width_max, &character_utf_symbol); + if (F_status_is_error(state.status)) break; - if (character_argument_utf != character_console_utf) continue; + if (character_utf_argument != character_utf_symbol) continue; } } - else if (result & f_console_result_long_e) { + else if (state.result & f_console_result_long_e) { if (!parameters->array[i].symbol_long) continue; - if (strncmp(&arguments.argv[location][sub_location], parameters->array[i].symbol_long, increment_by + 1)) continue; + if (strncmp(&arguments.argv[state.location][state.location_sub], parameters->array[i].symbol_long, state.increment_by + 1)) continue; } else { continue; } - status = f_array_lengths_increase(F_memory_default_allocation_small_d, ¶meters->array[i].locations); - if (F_status_is_error(status)) break; + state.status = F_none; - status = f_array_lengths_increase(F_memory_default_allocation_small_d, ¶meters->array[i].locations_sub); - if (F_status_is_error(status)) break; + if (parameters->callback) { + state.type = f_console_parameter_state_type_match_normal_e; - found = F_true; + parameters->callback(arguments, (void * const) parameters, &state, data); - parameters->array[i].locations.array[parameters->array[i].locations.used++] = location; + if (F_status_is_error(state.status)) { + f_array_lengths_resize(0, &state.value_need); - parameters->array[i].result = result | (parameters->array[i].result & f_console_result_value_e); - parameters->array[i].location = location; - parameters->array[i].location_sub = 0; + return state.status; + } - if (result & f_console_result_short_e) { - parameters->array[i].location_sub = sub_location; - parameters->array[i].locations_sub.array[parameters->array[i].locations_sub.used++] = sub_location; + if (state.status == F_break) break; + + if (state.status == F_continue) { + if (state.depth) break; + + continue; + } } else { - parameters->array[i].locations_sub.array[parameters->array[i].locations_sub.used++] = 0; + state.status = F_process; } - if (parameters->array[i].values_total) { - status = f_array_lengths_increase_by(parameters->array[i].values_total, &needs_value); - if (F_status_is_error(status)) break; + if (state.status == F_process) { + state.status = f_array_lengths_increase(F_memory_default_allocation_small_d, ¶meters->array[i].locations); + if (F_status_is_error(state.status)) break; - for (values = 0; values < parameters->array[i].values_total; ++values) { - needs_value.array[needs_value.used++] = i; - } // for + state.status = f_array_lengths_increase(F_memory_default_allocation_small_d, ¶meters->array[i].locations_sub); + if (F_status_is_error(state.status)) break; + + state.found = F_true; + + parameters->array[i].locations.array[parameters->array[i].locations.used++] = state.location; + + parameters->array[i].result = state.result | (parameters->array[i].result & f_console_result_value_e); + parameters->array[i].location = state.location; + parameters->array[i].location_sub = 0; + + if (state.result & f_console_result_short_e) { + parameters->array[i].location_sub = state.location_sub; + parameters->array[i].locations_sub.array[parameters->array[i].locations_sub.used++] = state.location_sub; + } + else { + parameters->array[i].locations_sub.array[parameters->array[i].locations_sub.used++] = 0; + } + + if (parameters->array[i].values_total) { + state.status = f_array_lengths_increase_by(parameters->array[i].values_total, &state.value_need); + if (F_status_is_error(state.status)) break; + + for (values = 0; values < parameters->array[i].values_total; ++values) { + state.value_need.array[state.value_need.used++] = i; + } // for + } } + state.status = F_none; + break; } // for - if (F_status_is_error(status)) break; + if (F_status_is_error(state.status)) break; + + if (state.status == F_break || state.status == F_continue) { + if (state.depth) { + --state.depth; + + if (state.status == F_break) break; + + continue; + } + } - sub_location += increment_by; + state.location_sub += state.increment_by; } // while - if (F_status_is_error(status)) break; + if (F_status_is_error(state.status)) break; + + if (state.status == F_break || state.status == F_continue) { + if (state.depth) { + --state.depth; + + if (state.status == F_break) break; + + continue; + } + } + + state.status = F_none; } else { - for (i = 0; i < parameters->used; ++i) { + if (parameters->callback) { + state.type = f_console_parameter_state_type_match_remaining_e; + + parameters->callback(arguments, (void * const) parameters, &state, data); + + if (F_status_is_error(state.status)) { + f_array_lengths_resize(0, &state.value_need); + + return state.status; + } + + if (state.status == F_break) break; + if (state.status == F_continue) continue; + } + else { + state.status = F_process; + } - if (parameters->array[i].flag & f_console_flag_disable_e) continue; - if (!(parameters->array[i].flag & f_console_result_alone_e)) continue; - if (!parameters->array[i].symbol_simple) continue; + if (state.status == F_process) { + for (i = 0; i < parameters->used; ++i) { - if (strncmp(arguments.argv[location], parameters->array[i].symbol_simple, parameters->arguments.array[location].used + 1) != 0) continue; + if (parameters->array[i].flag & f_console_flag_disable_e) continue; + if (!(parameters->array[i].flag & f_console_result_alone_e)) continue; + if (!parameters->array[i].symbol_simple) continue; - status = f_array_lengths_increase(F_memory_default_allocation_small_d, ¶meters->array[i].locations); - if (F_status_is_error(status)) break; + if (strncmp(arguments.argv[state.location], parameters->array[i].symbol_simple, parameters->arguments.array[state.location].used + 1) != 0) continue; - status = f_array_lengths_increase(F_memory_default_allocation_small_d, ¶meters->array[i].locations_sub); - if (F_status_is_error(status)) break; + state.status = f_array_lengths_increase(F_memory_default_allocation_small_d, ¶meters->array[i].locations); + if (F_status_is_error(state.status)) break; - parameters->array[i].locations.array[parameters->array[i].locations.used++] = location; - parameters->array[i].locations_sub.array[parameters->array[i].locations_sub.used++] = 0; + state.status = f_array_lengths_increase(F_memory_default_allocation_small_d, ¶meters->array[i].locations_sub); + if (F_status_is_error(state.status)) break; + + parameters->array[i].locations.array[parameters->array[i].locations.used++] = state.location; + parameters->array[i].locations_sub.array[parameters->array[i].locations_sub.used++] = 0; + + parameters->array[i].result = state.result | (parameters->array[i].result & f_console_result_value_e); + parameters->array[i].location = state.location; + parameters->array[i].location_sub = 0; - parameters->array[i].result = result | (parameters->array[i].result & f_console_result_value_e); - parameters->array[i].location = location; - parameters->array[i].location_sub = 0; + if (parameters->array[i].values_total) { + if (state.value_need.used + parameters->array[i].values_total > state.value_need.size) { + state.status = f_array_lengths_resize(state.value_need.used + parameters->array[i].values_total, &state.value_need); + if (F_status_is_error(state.status)) break; + } - if (parameters->array[i].values_total) { - if (needs_value.used + parameters->array[i].values_total > needs_value.size) { - status = f_array_lengths_resize(needs_value.used + parameters->array[i].values_total, &needs_value); - if (F_status_is_error(status)) break; + for (values = 0; values < parameters->array[i].values_total; ++values) { + state.value_need.array[state.value_need.used++] = i; + } // for } - for (values = 0; values < parameters->array[i].values_total; ++values) { - needs_value.array[needs_value.used++] = i; - } // for - } + state.found = F_true; - found = F_true; + break; + } // for - break; - } // for + if (F_status_is_error(state.status)) break; + } - if (F_status_is_error(status)) break; + state.status = F_none; } - if (!found) { + if (state.found) { + ++state.location; + } + else { + if (parameters->callback) { + state.type = f_console_parameter_state_type_match_not_e; - // Populate list of remaining parameters->array that are not associated with anything. - status = f_array_lengths_increase(F_memory_default_allocation_small_d, ¶meters->remaining); - if (F_status_is_error(status)) break; + parameters->callback(arguments, (void * const) parameters, &state, data); - parameters->remaining.array[parameters->remaining.used++] = location; - } + if (F_status_is_error(state.status)) break; + if (state.status == F_break) break; + if (state.status == F_continue) continue; + } + else { + state.status = F_process; + } + + if (state.status == F_process) { - ++location; + // Populate list of remaining parameters->array that are not associated with anything. + state.status = f_array_lengths_increase(F_memory_default_allocation_small_d, ¶meters->remaining); + if (F_status_is_error(state.status)) break; + + parameters->remaining.array[parameters->remaining.used++] = state.location++; + } + + state.status = F_none; + } } // while - // Make sure the entire parameters arguments array is populated. - for (; location < arguments.argc && arguments.argv[location]; ++location) { + if (F_status_is_error_not(state.status)) { + if (parameters->callback) { + state.type = f_console_parameter_state_type_wrap_up_e; - parameters->arguments.array[parameters->arguments.used].string = arguments.argv[location]; - parameters->arguments.array[parameters->arguments.used].used = strnlen(arguments.argv[location], F_console_parameter_size_d); - parameters->arguments.array[parameters->arguments.used++].size = 0; - } // for + parameters->callback(arguments, (void * const) parameters, &state, data); - if (F_status_is_error(status)) { - f_array_lengths_resize(0, &needs_value); + if (F_status_is_error(state.status)) { + f_array_lengths_resize(0, &state.value_need); - return status; - } + return state.status; + } + } + else { + state.status = F_process; + } - if (needs_value.used) { - status = F_complete_not; - } - else { - status = F_none; + if (state.status == F_process) { + + // Make sure the entire parameters arguments array is populated. + for (; state.location < arguments.argc && arguments.argv[state.location]; ++state.location) { + + parameters->arguments.array[parameters->arguments.used].string = arguments.argv[state.location]; + parameters->arguments.array[parameters->arguments.used].used = strnlen(arguments.argv[state.location], F_console_parameter_size_d); + parameters->arguments.array[parameters->arguments.used++].size = 0; + } // for + + if (F_status_is_error_not(state.status)) { + state.status = state.value_need.used ? F_complete_not : F_none; + } + } } - f_array_lengths_resize(0, &needs_value); + f_array_lengths_resize(0, &state.value_need); - return status; + return state.status; } #endif // _di_f_console_parameter_process_ diff --git a/level_0/f_console/c/console.h b/level_0/f_console/c/console.h index 147c2b2..b614d2f 100644 --- a/level_0/f_console/c/console.h +++ b/level_0/f_console/c/console.h @@ -153,10 +153,15 @@ extern "C" { * - May not be grouped and must be separated from any subsequent parameter, such as: "tar extract create file". * - Additional parameters must immediately follow the parameter, such as "tar extract file file.tar.gz create". * + * Any changes to this function may likely require changes to f_console_parameter_state_t and callbacks. + * * @param arguments * The parameters passed to the process. * @param parameters * The console parameters to look for. + * @param data + * (optional) A variable passed to the callback, if provided. + * Set to NULL to not use. * * @return * F_none on success. @@ -176,7 +181,7 @@ extern "C" { * @see f_utf_char_to_character() */ #ifndef _di_f_console_parameter_process_ - extern f_status_t f_console_parameter_process(const f_console_arguments_t arguments, f_console_parameters_t * const parameters); + extern f_status_t f_console_parameter_process(const f_console_arguments_t arguments, f_console_parameters_t * const parameters, void * const data); #endif // _di_f_console_parameter_process_ #ifdef __cplusplus diff --git a/level_0/f_console/c/console/common.h b/level_0/f_console/c/console/common.h index e41c816..de96380 100644 --- a/level_0/f_console/c/console/common.h +++ b/level_0/f_console/c/console/common.h @@ -17,269 +17,14 @@ extern "C" { #endif /** - * The symbols passed to the program for option handling. - * - * For historical reasons the "-" is the normal symbol and "+" is the inverse. - */ -#ifndef _di_f_console_symbol_s_ - #define F_console_symbol_short_normal_s "-" - #define F_console_symbol_short_inverse_s "+" - - #define F_console_symbol_short_normal_s_length 1 - #define F_console_symbol_short_inverse_s_length 1 - - #define F_console_symbol_long_normal_s "--" - #define F_console_symbol_long_inverse_s "++" - - #define F_console_symbol_long_normal_s_length 2 - #define F_console_symbol_long_inverse_s_length 2 - - #ifndef _di_f_console_symbol_short_normal_s_ - extern const f_string_static_t f_console_symbol_short_normal_s; - #endif // _di_f_console_symbol_short_normal_s_ - - #ifndef _di_f_console_symbol_short_inverse_s_ - extern const f_string_static_t f_console_symbol_short_inverse_s; - #endif // _di_f_console_symbol_short_inverse_s_ - - #ifndef _di_f_console_symbol_long_normal_s_ - extern const f_string_static_t f_console_symbol_long_normal_s; - #endif // _di_f_console_symbol_long_normal_s_ - - #ifndef _di_f_console_symbol_long_inverse_s_ - extern const f_string_static_t f_console_symbol_long_inverse_s; - #endif // _di_f_console_symbol_long_inverse_s_ -#endif // _di_f_console_symbol_s_ - -/** - * 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. - * This is not a strict requirement as such a thing is non-sense in open-source, but this should be considered a strong recommendation. - * - * It is acceptable for any of these options, when specified multiple times, for that number of times to represent the "level". - * For example, a "+D +D" means more debug output than simply "+D". - * - * The verbosity interpretation used as the default for many of the level 3 programs in this process, is to treat verbosity modes as a scale from quiet to debug with quiet as the least verbose and debug as the most verbose. - * This is not strictly a requirement, but expect level 3 projects to work this way. - * - * The following options are subjective in interpretation of the verbosity but are expected to be follow the general interpretation: - * - debug: Enable debugging, which will likely increase output verbosity. - * - error: Similar to quiet, except that error messages are printed (this is less verbose than "normal"). - * - normal: Use normal printing (don't use debug/quiet/verbose). - * - quiet: Decrease verbosity, print less, in some use cases this could mean printing nothing. - * - verbose: Increase verbosity, print more, in some use cases this could mean printing just about everything. - * - line_first_no: Don't print the first line if one is to be printed (useful in scripts) (may include error/warning messages). - * - line_last_no: Don't print the last line if one is to be printed (useful in scripts) (may include error/warning messages). - * - * The following are less subjective in interpretation but do allow some flexibility. - * - dark: Do display color intended for dark backgrounds (often the default behavior) when printing to the console. Other contexts may be acceptable (such as voice inflections, or lack-thereof) for audio.) - * - help: Display the help text. This does not define how the text is displayed only that the text is displayed. - * - light: Do display color intended for light backgrounds when printing to the console. Other contexts may be acceptable (such as voice inflections, or lack-thereof) for audio.) - * - no_color: Do not display color when printing to the console. Other contexts may be acceptable (such as voice inflections, or lack-thereof) for audio.) - * - version: Should always print only the version number, no colors, but what represents the version number is undefined by this project. - * - * The following options are for special purposes: - * - status_in: Is intended to accept the name of an environment variable in which to read the status from. - * - status_out: Is intended to accept the name of an environment variable in which to ride the status to. - * - * In the case of "status_in" and "status_out", the environment variable will store a string representing the base-10 unsigned 16-bit status code. - * - In the case of "status_in" the environment variable is being read in, which means that it should be the status from some previous execution. - * - In the case of "status_out" the environment variable is being written to, which means that it should store the status this program exits with. - * - To avoid problems with the status code after a program is forcibly killed, the status_out environment variable should be cleared at program start. - */ -#ifndef _di_f_console_standard_s_ - #define F_console_standard_short_dark_s "d" - #define F_console_standard_short_debug_s "D" - #define F_console_standard_short_error_s "E" - #define F_console_standard_short_help_s "h" - #define F_console_standard_short_light_s "l" - #define F_console_standard_short_line_first_no_s "F" - #define F_console_standard_short_line_last_no_s "L" - #define F_console_standard_short_no_color_s "n" - #define F_console_standard_short_normal_s "N" - #define F_console_standard_short_quiet_s "Q" - #define F_console_standard_short_status_in_s "s" - #define F_console_standard_short_status_out_s "S" - #define F_console_standard_short_verbose_s "V" - #define F_console_standard_short_version_s "v" - - #define F_console_standard_short_dark_s_length 1 - #define F_console_standard_short_debug_s_length 1 - #define F_console_standard_short_error_s_length 1 - #define F_console_standard_short_help_s_length 1 - #define F_console_standard_short_light_s_length 1 - #define F_console_standard_short_line_first_no_s_length 1 - #define F_console_standard_short_line_last_no_s_length 1 - #define F_console_standard_short_no_color_s_length 1 - #define F_console_standard_short_normal_s_length 1 - #define F_console_standard_short_quiet_s_length 1 - #define F_console_standard_short_status_in_s_length 1 - #define F_console_standard_short_status_out_s_length 1 - #define F_console_standard_short_verbose_s_length 1 - #define F_console_standard_short_version_s_length 1 - - #define F_console_standard_long_dark_s "dark" - #define F_console_standard_long_debug_s "debug" - #define F_console_standard_long_error_s "error" - #define F_console_standard_long_help_s "help" - #define F_console_standard_long_light_s "light" - #define F_console_standard_long_line_first_no_s "line_first_no" - #define F_console_standard_long_line_last_no_s "line_last_no" - #define F_console_standard_long_no_color_s "no_color" - #define F_console_standard_long_normal_s "normal" - #define F_console_standard_long_quiet_s "quiet" - #define F_console_standard_long_status_in_s "status_in" - #define F_console_standard_long_status_out_s "status_out" - #define F_console_standard_long_verbose_s "verbose" - #define F_console_standard_long_version_s "version" - - #define F_console_standard_long_dark_s_length 4 - #define F_console_standard_long_debug_s_length 5 - #define F_console_standard_long_error_s_length 5 - #define F_console_standard_long_help_s_length 4 - #define F_console_standard_long_light_s_length 5 - #define F_console_standard_long_line_first_no_s_length 13 - #define F_console_standard_long_line_last_no_s_length 12 - #define F_console_standard_long_no_color_s_length 8 - #define F_console_standard_long_normal_s_length 6 - #define F_console_standard_long_quiet_s_length 5 - #define F_console_standard_long_status_in_s_length 9 - #define F_console_standard_long_status_out_s_length 10 - #define F_console_standard_long_verbose_s_length 7 - #define F_console_standard_long_version_s_length 7 - - #ifndef _di_f_console_standard_short_dark_s_ - extern const f_string_static_t f_console_standard_short_dark_s; - #endif // _di_f_console_standard_short_dark_s_ - - #ifndef _di_f_console_standard_short_debug_s_ - extern const f_string_static_t f_console_standard_short_debug_s; - #endif // _di_f_console_standard_short_debug_s_ - - #ifndef _di_f_console_standard_short_error_s_ - extern const f_string_static_t f_console_standard_short_error_s; - #endif // _di_f_console_standard_short_error_s_ - - #ifndef _di_f_console_standard_short_help_s_ - extern const f_string_static_t f_console_standard_short_help_s; - #endif // _di_f_console_standard_short_help_s_ - - #ifndef _di_f_console_standard_short_light_s_ - extern const f_string_static_t f_console_standard_short_light_s; - #endif // _di_f_console_standard_short_light_s_ - - #ifndef _di_f_console_standard_short_line_first_no_s_ - extern const f_string_static_t f_console_standard_short_line_first_no_s; - #endif // _di_f_console_standard_short_line_first_no_s_ - - #ifndef _di_f_console_standard_short_line_last_no_s_ - extern const f_string_static_t f_console_standard_short_line_last_no_s; - #endif // _di_f_console_standard_short_line_last_no_s_ - - #ifndef _di_f_console_standard_short_no_color_s_ - extern const f_string_static_t f_console_standard_short_no_color_s; - #endif // _di_f_console_standard_short_no_color_s_ - - #ifndef _di_f_console_standard_short_normal_s_ - extern const f_string_static_t f_console_standard_short_normal_s; - #endif // _di_f_console_standard_short_normal_s_ - - #ifndef _di_f_console_standard_short_quiet_s_ - extern const f_string_static_t f_console_standard_short_quiet_s; - #endif // _di_f_console_standard_short_quiet_s_ - - #ifndef _di_f_console_standard_short_status_in_s_ - extern const f_string_static_t f_console_standard_short_status_in_s; - #endif // _di_f_console_standard_short_status_in_s_ - - #ifndef _di_f_console_standard_short_status_out_s_ - extern const f_string_static_t f_console_standard_short_status_out_s; - #endif // _di_f_console_standard_short_status_out_s_ - - #ifndef _di_f_console_standard_short_verbose_s_ - extern const f_string_static_t f_console_standard_short_verbose_s; - #endif // _di_f_console_standard_short_verbose_s_ - - #ifndef _di_f_console_standard_short_version_s_ - extern const f_string_static_t f_console_standard_short_version_s; - #endif // _di_f_console_standard_short_version_s_ - - #ifndef _di_f_console_standard_long_dark_s_ - extern const f_string_static_t f_console_standard_long_dark_s; - #endif // _di_f_console_standard_long_dark_s_ - - #ifndef _di_f_console_standard_long_debug_s_ - extern const f_string_static_t f_console_standard_long_debug_s; - #endif // _di_f_console_standard_long_debug_s_ - - #ifndef _di_f_console_standard_long_error_s_ - extern const f_string_static_t f_console_standard_long_error_s; - #endif // _di_f_console_standard_long_error_s_ - - #ifndef _di_f_console_standard_long_help_s_ - extern const f_string_static_t f_console_standard_long_help_s; - #endif // _di_f_console_standard_long_help_s_ - - #ifndef _di_f_console_standard_long_light_s_ - extern const f_string_static_t f_console_standard_long_light_s; - #endif // _di_f_console_standard_long_light_s_ - - #ifndef _di_f_console_standard_long_line_first_no_s_ - extern const f_string_static_t f_console_standard_long_line_first_no_s; - #endif // _di_f_console_standard_long_line_first_no_s_ - - #ifndef _di_f_console_standard_long_line_last_no_s_ - extern const f_string_static_t f_console_standard_long_line_last_no_s; - #endif // _di_f_console_standard_long_line_last_no_s_ - - #ifndef _di_f_console_standard_long_no_color_s_ - extern const f_string_static_t f_console_standard_long_no_color_s; - #endif // _di_f_console_standard_long_no_color_s_ - - #ifndef _di_f_console_standard_long_normal_s_ - extern const f_string_static_t f_console_standard_long_normal_s; - #endif // _di_f_console_standard_long_normal_s_ - - #ifndef _di_f_console_standard_long_quiet_s_ - extern const f_string_static_t f_console_standard_long_quiet_s; - #endif // _di_f_console_standard_long_quiet_s_ - - #ifndef _di_f_console_standard_long_status_in_s_ - extern const f_string_static_t f_console_standard_long_status_in_s; - #endif // _di_f_console_standard_long_status_in_s_ - - #ifndef _di_f_console_standard_long_status_out_s_ - extern const f_string_static_t f_console_standard_long_status_out_s; - #endif // _di_f_console_standard_long_status_out_s_ - - #ifndef _di_f_console_standard_long_verbose_s_ - extern const f_string_static_t f_console_standard_long_verbose_s; - #endif // _di_f_console_standard_long_verbose_s_ - - #ifndef _di_f_console_standard_long_version_s_ - extern const f_string_static_t f_console_standard_long_version_s; - #endif // _di_f_console_standard_long_version_s_ -#endif // _di_f_console_standard_s_ - -/** * The maximum size for a single parameter (the length of the string representing the parameter). * * The ideal parameter value is F_array_length_t_size_d, which generally defaults to 2^64 (unsigned). * However, the libc/POSIX appears to limit this to 2^63 (signed). */ -#ifndef _di_f_console_length_size_ +#ifndef _di_f_console_length_size_d_ #define F_console_parameter_size_d F_string_t_size_d -#endif // _di_f_console_length_size_ - -/** - * Provide console flag data type. - */ -#ifndef _di_f_console_flag_t_ - typedef uint8_t f_console_flag_t; - - #define f_console_flag_t_initialize 0 -#endif // _di_f_console_flag_t_ +#endif // _di_f_console_length_size_d_ /** * Provide console flags. @@ -320,15 +65,6 @@ extern "C" { #endif // _di_f_console_flag_e_ /** - * The console result data type. - */ -#ifndef _di_f_console_result_t_ - typedef uint8_t f_console_result_t; - - #define f_console_result_t_initialize 0 -#endif // _di_f_console_result_t_ - -/** * Result values that represent the type of command found. * * Here "alone" refers to '-', or '++', in that they only have the symbols (whereas '-x', or '++x' would not be alone). @@ -357,29 +93,108 @@ extern "C" { #endif // _di_f_console_result_e_ /** - * Provide the standard verbosity codes. - * - * Intended to be used for the basic/standard verbosity modes for all programs following this practice. - * The options are subjective in interpretation of the verbosity but are expected to be follow the general interpretation. - * - * These are expected to be in numeric order such that the smallest number is the least verbose and the highest number is the most verbose. - * - * f_console_verbosity_*: - * - quiet: Verbosity is set to quiet; decrease verbosity, print less, in some use cases this could mean printing nothing. - * - error: Verbosity is set to error; similar to quiet, except that error messages are printed (this is less verbose than "normal"). - * - normal: Verbosity is set to normal; use normal printing (don't use debug/quiet/verbose). - * - verbose: Verbosity is set to verbose; increase verbosity, print more, in some use cases this could mean printing just about everything. - * - debug: Verbosity is set to debug; enable debugging, which will likely increase output verbosity. + * Provide the standard verbosity codes. + * + * Intended to be used for the basic/standard verbosity modes for all programs following this practice. + * The options are subjective in interpretation of the verbosity but are expected to be follow the general interpretation. + * + * These are expected to be in numeric order such that the smallest number is the least verbose and the highest number is the most verbose. + * + * f_console_verbosity_*: + * - none: No verbosity is configured, this should either be treated as equivalent to quiet or as no verbosity is defined. + * - quiet: Verbosity is set to quiet; decrease verbosity, print less, in some use cases this could mean printing nothing. + * - error: Verbosity is set to error; similar to quiet, except that error messages are printed (this is less verbose than "normal"). + * - normal: Verbosity is set to normal; use normal printing (don't use debug/quiet/verbose). + * - verbose: Verbosity is set to verbose; increase verbosity, print more, in some use cases this could mean printing just about everything. + * - debug: Verbosity is set to debug; enable debugging, which will likely increase output verbosity. + */ +#ifndef _di_f_console_verbosity_e_ + enum { + f_console_verbosity_none_e = 0, + f_console_verbosity_quiet_e, + f_console_verbosity_error_e, + f_console_verbosity_normal_e, + f_console_verbosity_verbose_e, + f_console_verbosity_debug_e, + }; // enum +#endif // _di_f_console_verbosity_e_ + +/** + * Provide a special type explicitly intended to be used for f_console_parameter_state_t. + * + * f_console_parameter_state_type_*_e: + * - none: No type set. + * - identify: Perform identify processing. + * - match_normal: Perform short or long parameter match processing. + * - match_not: Perform no parameter match processing. + * - match_remaining: Perform remaining parameter match processing. + * - value_need: Perform value is needed processing. + * - wrap_up: Perform wrap up processing. + */ +#ifndef _di_f_console_parameter_state_type_e_ + enum { + f_console_parameter_state_type_none_e = 0, + f_console_parameter_state_type_identify_e, + f_console_parameter_state_type_match_normal_e, + f_console_parameter_state_type_match_not_e, + f_console_parameter_state_type_match_remaining_e, + f_console_parameter_state_type_value_need_e, + f_console_parameter_state_type_wrap_up_e, + }; // enum +#endif // _di_f_console_parameter_state_type_e_ + +/** + * The symbols passed to the program for option handling. + * + * For historical reasons the "-" is the normal symbol and "+" is the inverse. + */ +#ifndef _di_f_console_symbol_s_ + #define F_console_symbol_short_normal_s "-" + #define F_console_symbol_short_inverse_s "+" + + #define F_console_symbol_short_normal_s_length 1 + #define F_console_symbol_short_inverse_s_length 1 + + #define F_console_symbol_long_normal_s "--" + #define F_console_symbol_long_inverse_s "++" + + #define F_console_symbol_long_normal_s_length 2 + #define F_console_symbol_long_inverse_s_length 2 + + #ifndef _di_f_console_symbol_short_normal_s_ + extern const f_string_static_t f_console_symbol_short_normal_s; + #endif // _di_f_console_symbol_short_normal_s_ + + #ifndef _di_f_console_symbol_short_inverse_s_ + extern const f_string_static_t f_console_symbol_short_inverse_s; + #endif // _di_f_console_symbol_short_inverse_s_ + + #ifndef _di_f_console_symbol_long_normal_s_ + extern const f_string_static_t f_console_symbol_long_normal_s; + #endif // _di_f_console_symbol_long_normal_s_ + + #ifndef _di_f_console_symbol_long_inverse_s_ + extern const f_string_static_t f_console_symbol_long_inverse_s; + #endif // _di_f_console_symbol_long_inverse_s_ +#endif // _di_f_console_symbol_s_ + +/** + * Provide console flag data type. + */ +#ifndef _di_f_console_flag_t_ + typedef uint8_t f_console_flag_t; + + #define f_console_flag_t_initialize f_console_flag_none_e +#endif // _di_f_console_flag_t_ + +/** + * The console result data type. */ -#ifndef _di_f_console_verbosity_ - enum { - f_console_verbosity_quiet_e = 1, - f_console_verbosity_error_e, - f_console_verbosity_normal_e, - f_console_verbosity_verbose_e, - f_console_verbosity_debug_e, - }; -#endif // _di_f_console_verbosity_ +#ifndef _di_f_console_result_t_ + typedef uint8_t f_console_result_t; + + #define f_console_result_t_initialize f_console_result_none_e +#endif // _di_f_console_result_t_ /** * Provide a helper structure for referencing the argc and argv standard main arguments. @@ -407,6 +222,43 @@ extern "C" { #endif // _di_f_console_arguments_t_ /** + * State exclusively intended to be used by f_console_parameter_process() and the associated callback. + * + * How these are used is tightly coupled to the f_console_parameter_process(). + * The f_console_parameter_process() function should be read for the detailed explanation on how to use these. + * The description here is a relatively generalized description. + * + * Any changes to the f_console_parameter_process() code likely requires changes or re-interpretation of these properties. + */ +#ifndef _di_f_console_parameter_state_t_ + typedef struct { + uint8_t type; + uint8_t depth; + bool found; + + f_status_t status; + f_console_result_t result; + + unsigned long location; + f_array_length_t location_sub; + f_array_length_t increment_by; + f_array_lengths_t value_need; + } f_console_parameter_state_t; + + #define f_console_parameter_state_t_initialize { \ + f_console_parameter_state_type_none_e, \ + 0, \ + F_false, \ + F_none, \ + f_console_result_t_initialize, \ + 0, \ + 0, \ + 0, \ + f_array_lengths_t_initialize, \ + } +#endif // _di_f_console_parameter_state_t_ + +/** * Provide a structure for describing console parameters for the console processing functions to use. * * The short parameters are prepended with either '-' or '+'. @@ -424,15 +276,14 @@ extern "C" { * locations: All locations within argv where this parameter is found (order is preserved). * locations_sub: All sub-locations within argv where this parameter is found (order is preserved). * values: An array of locations representing where in the argv[] the values arguments are found. - * callback: A callback to perform when matched in order to handle condition values (@fixme this is prototyped and unused stub and needs to have a structure properly defined.) On parameter match, this is called rather than the normal functions. - * - * The macro_f_console_parameter_t_initialize() all arguments. - * The macro_f_console_parameter_t_initialize2() reduced arguments. - * The macro_f_console_parameter_t_initialize3() reduced arguments, strings are of f_string_static_t, has short, long, and simple. - * The macro_f_console_parameter_t_initialize4() reduced arguments, strings are of f_string_static_t, has short and long. - * The macro_f_console_parameter_t_initialize5() reduced arguments, strings are of f_string_static_t, has short. - * The macro_f_console_parameter_t_initialize6() reduced arguments, strings are of f_string_static_t, has long. - * The macro_f_console_parameter_t_initialize7() reduced arguments, strings are of f_string_static_t, has simple. + * + * The macro_f_console_parameter_t_initialize_1() all arguments. + * The macro_f_console_parameter_t_initialize_2() reduced arguments. + * The macro_f_console_parameter_t_initialize_3() reduced arguments, strings are of f_string_static_t, has short, long, and simple. + * The macro_f_console_parameter_t_initialize_4() reduced arguments, strings are of f_string_static_t, has short and long. + * The macro_f_console_parameter_t_initialize_5() reduced arguments, strings are of f_string_static_t, has short. + * The macro_f_console_parameter_t_initialize_6() reduced arguments, strings are of f_string_static_t, has long. + * The macro_f_console_parameter_t_initialize_7() reduced arguments, strings are of f_string_static_t, has simple. */ #ifndef _di_f_console_parameter_t_ typedef struct { @@ -449,8 +300,6 @@ extern "C" { f_array_lengths_t locations; f_array_lengths_t locations_sub; f_array_lengths_t values; - - f_status_t (*callback)(void * const main, void * const setting, void * const parameters, const f_console_arguments_t arguments); } f_console_parameter_t; #define f_console_parameter_t_initialize { \ @@ -465,10 +314,9 @@ extern "C" { f_array_lengths_t_initialize, \ f_array_lengths_t_initialize, \ f_array_lengths_t_initialize, \ - 0, \ } - #define macro_f_console_parameter_t_initialize(symbol_short, symbol_long, symbol_simple, values_total, flag, result, location, location_sub, locations, locations_sub, values, callback) { \ + #define macro_f_console_parameter_t_initialize_1(symbol_short, symbol_long, symbol_simple, values_total, flag, result, location, location_sub, locations, locations_sub, values) { \ symbol_short, \ symbol_long, \ symbol_simple, \ @@ -481,10 +329,9 @@ extern "C" { locations, \ locations_sub, \ values, \ - callback, \ } - #define macro_f_console_parameter_t_initialize2(symbol_short, symbol_long, symbol_simple, values_total, flag, callback) { \ + #define macro_f_console_parameter_t_initialize_2(symbol_short, symbol_long, symbol_simple, values_total, flag) { \ symbol_short, \ symbol_long, \ symbol_simple, \ @@ -496,10 +343,9 @@ extern "C" { f_array_lengths_t_initialize, \ f_array_lengths_t_initialize, \ f_array_lengths_t_initialize, \ - callback, \ } - #define macro_f_console_parameter_t_initialize3(symbol_short, symbol_long, symbol_simple, values_total, flag, callback) { \ + #define macro_f_console_parameter_t_initialize_3(symbol_short, symbol_long, symbol_simple, values_total, flag) { \ symbol_short.string, \ symbol_long.string, \ symbol_simple.string, \ @@ -511,10 +357,9 @@ extern "C" { f_array_lengths_t_initialize, \ f_array_lengths_t_initialize, \ f_array_lengths_t_initialize, \ - callback, \ } - #define macro_f_console_parameter_t_initialize4(symbol_short, symbol_long, values_total, flag, callback) { \ + #define macro_f_console_parameter_t_initialize_4(symbol_short, symbol_long, values_total, flag) { \ symbol_short.string, \ symbol_long.string, \ 0, \ @@ -526,10 +371,9 @@ extern "C" { f_array_lengths_t_initialize, \ f_array_lengths_t_initialize, \ f_array_lengths_t_initialize, \ - callback, \ } - #define macro_f_console_parameter_t_initialize5(symbol_short, values_total, flag, callback) { \ + #define macro_f_console_parameter_t_initialize_5(symbol_short, values_total, flag) { \ symbol_short.string, \ 0, \ 0, \ @@ -541,10 +385,9 @@ extern "C" { f_array_lengths_t_initialize, \ f_array_lengths_t_initialize, \ f_array_lengths_t_initialize, \ - callback, \ } - #define macro_f_console_parameter_t_initialize6(symbol_long, values_total, flag, callback) { \ + #define macro_f_console_parameter_t_initialize_6(symbol_long, values_total, flag) { \ 0, \ symbol_long.string, \ 0, \ @@ -559,7 +402,7 @@ extern "C" { callback \ } - #define macro_f_console_parameter_t_initialize7(symbol_simple, values_total, flag, callback) { \ + #define macro_f_console_parameter_t_initialize_7(symbol_simple, values_total, flag) { \ 0, \ 0, \ symbol_simple.string, \ @@ -571,7 +414,6 @@ extern "C" { f_array_lengths_t_initialize, \ f_array_lengths_t_initialize, \ f_array_lengths_t_initialize, \ - callback, \ } #endif // _di_f_console_parameter_t_ @@ -586,6 +428,20 @@ extern "C" { * arguments: An array of arguments pointing to the argv[] strings with the string lengths already calculated (This is a dynamic array of f_string_static_t). * remaining: An array of indexes within the arguments representing unmatched parameters. * length: The total number of parameters in the parameters array. + * callback: A callback to perform when matched in order to handle condition values. + * + * The callback function arguments: + * - arguments: The console arguments being processed. + * - parameters: A pointer to this parameter structure and must be of type f_console_parameter_t. + * - state: The state information shared between the processing function and any callbacks. + * - data: The structure determined by the caller for passing to the parameter processing function and is intended to be used for updating based on results. + * + * The callback function state.status interpretations: + * - F_none: On no error and processing complete. + * - F_break: To tell the caller to break out of the loop (based on depth, when applicable). + * - F_continue: To tell the caller to continue the loop (based on depth, when applicable). + * - F_process: To tell the caller to perform the built in functionality. + * - Any status with error bit set is treated as an error and calling function returns. */ #ifndef _di_f_console_parameters_t_ typedef struct { @@ -595,14 +451,227 @@ extern "C" { f_array_lengths_t remaining; f_array_length_t used; + + void (*callback)(const f_console_arguments_t arguments, void * const parameters, f_console_parameter_state_t * const state, void * const data); } f_console_parameters_t; - #define f_console_parameters_t_initialize {0, f_string_dynamics_t_initialize, f_array_lengths_t_initialize, 0 } + #define f_console_parameters_t_initialize {0, f_string_dynamics_t_initialize, f_array_lengths_t_initialize, 0, 0 } - #define macro_f_console_parameters_t_initialize(parameter, used) { parameter, f_string_dynamics_t_initialize, f_array_lengths_t_initialize, used } + #define macro_f_console_parameters_t_initialize(parameter, used, callback) { parameter, f_string_dynamics_t_initialize, f_array_lengths_t_initialize, used, callback } #endif // _di_f_console_parameters_t_ /** + * 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. + * This is not a strict requirement as such a thing is non-sense in open-source, but this should be considered a strong recommendation. + * + * It is acceptable for any of these options, when specified multiple times, for that number of times to represent the "level". + * For example, a "+D +D" means more debug output than simply "+D". + * + * The verbosity interpretation used as the default for many of the level 3 programs in this process, is to treat verbosity modes as a scale from quiet to debug with quiet as the least verbose and debug as the most verbose. + * This is not strictly a requirement, but expect level 3 projects to work this way. + * + * The following options are subjective in interpretation of the verbosity but are expected to be follow the general interpretation: + * - debug: Enable debugging, which will likely increase output verbosity. + * - error: Similar to quiet, except that error messages are printed (this is less verbose than "normal"). + * - normal: Use normal printing (don't use debug/quiet/verbose). + * - quiet: Decrease verbosity, print less, in some use cases this could mean printing nothing. + * - verbose: Increase verbosity, print more, in some use cases this could mean printing just about everything. + * - line_first_no: Don't print the first line if one is to be printed (useful in scripts) (may include error/warning messages). + * - line_last_no: Don't print the last line if one is to be printed (useful in scripts) (may include error/warning messages). + * + * The following are less subjective in interpretation but do allow some flexibility. + * - dark: Do display color intended for dark backgrounds (often the default behavior) when printing to the console. Other contexts may be acceptable (such as voice inflections, or lack-thereof) for audio.) + * - help: Display the help text. This does not define how the text is displayed only that the text is displayed. + * - light: Do display color intended for light backgrounds when printing to the console. Other contexts may be acceptable (such as voice inflections, or lack-thereof) for audio.) + * - no_color: Do not display color when printing to the console. Other contexts may be acceptable (such as voice inflections, or lack-thereof) for audio.) + * - version: Should always print only the version number, no colors, but what represents the version number is undefined by this project. + * + * The following options are for special purposes: + * - status_in: Is intended to accept the name of an environment variable in which to read the status from. + * - status_out: Is intended to accept the name of an environment variable in which to ride the status to. + * + * In the case of "status_in" and "status_out", the environment variable will store a string representing the base-10 unsigned 16-bit status code. + * - In the case of "status_in" the environment variable is being read in, which means that it should be the status from some previous execution. + * - In the case of "status_out" the environment variable is being written to, which means that it should store the status this program exits with. + * - To avoid problems with the status code after a program is forcibly killed, the status_out environment variable should be cleared at program start. + */ +#ifndef _di_f_console_standard_s_ + #define F_console_standard_short_dark_s "d" + #define F_console_standard_short_debug_s "D" + #define F_console_standard_short_error_s "E" + #define F_console_standard_short_help_s "h" + #define F_console_standard_short_light_s "l" + #define F_console_standard_short_line_first_no_s "F" + #define F_console_standard_short_line_last_no_s "L" + #define F_console_standard_short_no_color_s "n" + #define F_console_standard_short_normal_s "N" + #define F_console_standard_short_quiet_s "Q" + #define F_console_standard_short_status_in_s "s" + #define F_console_standard_short_status_out_s "S" + #define F_console_standard_short_verbose_s "V" + #define F_console_standard_short_version_s "v" + + #define F_console_standard_short_dark_s_length 1 + #define F_console_standard_short_debug_s_length 1 + #define F_console_standard_short_error_s_length 1 + #define F_console_standard_short_help_s_length 1 + #define F_console_standard_short_light_s_length 1 + #define F_console_standard_short_line_first_no_s_length 1 + #define F_console_standard_short_line_last_no_s_length 1 + #define F_console_standard_short_no_color_s_length 1 + #define F_console_standard_short_normal_s_length 1 + #define F_console_standard_short_quiet_s_length 1 + #define F_console_standard_short_status_in_s_length 1 + #define F_console_standard_short_status_out_s_length 1 + #define F_console_standard_short_verbose_s_length 1 + #define F_console_standard_short_version_s_length 1 + + #define F_console_standard_long_dark_s "dark" + #define F_console_standard_long_debug_s "debug" + #define F_console_standard_long_error_s "error" + #define F_console_standard_long_help_s "help" + #define F_console_standard_long_light_s "light" + #define F_console_standard_long_line_first_no_s "line_first_no" + #define F_console_standard_long_line_last_no_s "line_last_no" + #define F_console_standard_long_no_color_s "no_color" + #define F_console_standard_long_normal_s "normal" + #define F_console_standard_long_quiet_s "quiet" + #define F_console_standard_long_status_in_s "status_in" + #define F_console_standard_long_status_out_s "status_out" + #define F_console_standard_long_verbose_s "verbose" + #define F_console_standard_long_version_s "version" + + #define F_console_standard_long_dark_s_length 4 + #define F_console_standard_long_debug_s_length 5 + #define F_console_standard_long_error_s_length 5 + #define F_console_standard_long_help_s_length 4 + #define F_console_standard_long_light_s_length 5 + #define F_console_standard_long_line_first_no_s_length 13 + #define F_console_standard_long_line_last_no_s_length 12 + #define F_console_standard_long_no_color_s_length 8 + #define F_console_standard_long_normal_s_length 6 + #define F_console_standard_long_quiet_s_length 5 + #define F_console_standard_long_status_in_s_length 9 + #define F_console_standard_long_status_out_s_length 10 + #define F_console_standard_long_verbose_s_length 7 + #define F_console_standard_long_version_s_length 7 + + #ifndef _di_f_console_standard_short_dark_s_ + extern const f_string_static_t f_console_standard_short_dark_s; + #endif // _di_f_console_standard_short_dark_s_ + + #ifndef _di_f_console_standard_short_debug_s_ + extern const f_string_static_t f_console_standard_short_debug_s; + #endif // _di_f_console_standard_short_debug_s_ + + #ifndef _di_f_console_standard_short_error_s_ + extern const f_string_static_t f_console_standard_short_error_s; + #endif // _di_f_console_standard_short_error_s_ + + #ifndef _di_f_console_standard_short_help_s_ + extern const f_string_static_t f_console_standard_short_help_s; + #endif // _di_f_console_standard_short_help_s_ + + #ifndef _di_f_console_standard_short_light_s_ + extern const f_string_static_t f_console_standard_short_light_s; + #endif // _di_f_console_standard_short_light_s_ + + #ifndef _di_f_console_standard_short_line_first_no_s_ + extern const f_string_static_t f_console_standard_short_line_first_no_s; + #endif // _di_f_console_standard_short_line_first_no_s_ + + #ifndef _di_f_console_standard_short_line_last_no_s_ + extern const f_string_static_t f_console_standard_short_line_last_no_s; + #endif // _di_f_console_standard_short_line_last_no_s_ + + #ifndef _di_f_console_standard_short_no_color_s_ + extern const f_string_static_t f_console_standard_short_no_color_s; + #endif // _di_f_console_standard_short_no_color_s_ + + #ifndef _di_f_console_standard_short_normal_s_ + extern const f_string_static_t f_console_standard_short_normal_s; + #endif // _di_f_console_standard_short_normal_s_ + + #ifndef _di_f_console_standard_short_quiet_s_ + extern const f_string_static_t f_console_standard_short_quiet_s; + #endif // _di_f_console_standard_short_quiet_s_ + + #ifndef _di_f_console_standard_short_status_in_s_ + extern const f_string_static_t f_console_standard_short_status_in_s; + #endif // _di_f_console_standard_short_status_in_s_ + + #ifndef _di_f_console_standard_short_status_out_s_ + extern const f_string_static_t f_console_standard_short_status_out_s; + #endif // _di_f_console_standard_short_status_out_s_ + + #ifndef _di_f_console_standard_short_verbose_s_ + extern const f_string_static_t f_console_standard_short_verbose_s; + #endif // _di_f_console_standard_short_verbose_s_ + + #ifndef _di_f_console_standard_short_version_s_ + extern const f_string_static_t f_console_standard_short_version_s; + #endif // _di_f_console_standard_short_version_s_ + + #ifndef _di_f_console_standard_long_dark_s_ + extern const f_string_static_t f_console_standard_long_dark_s; + #endif // _di_f_console_standard_long_dark_s_ + + #ifndef _di_f_console_standard_long_debug_s_ + extern const f_string_static_t f_console_standard_long_debug_s; + #endif // _di_f_console_standard_long_debug_s_ + + #ifndef _di_f_console_standard_long_error_s_ + extern const f_string_static_t f_console_standard_long_error_s; + #endif // _di_f_console_standard_long_error_s_ + + #ifndef _di_f_console_standard_long_help_s_ + extern const f_string_static_t f_console_standard_long_help_s; + #endif // _di_f_console_standard_long_help_s_ + + #ifndef _di_f_console_standard_long_light_s_ + extern const f_string_static_t f_console_standard_long_light_s; + #endif // _di_f_console_standard_long_light_s_ + + #ifndef _di_f_console_standard_long_line_first_no_s_ + extern const f_string_static_t f_console_standard_long_line_first_no_s; + #endif // _di_f_console_standard_long_line_first_no_s_ + + #ifndef _di_f_console_standard_long_line_last_no_s_ + extern const f_string_static_t f_console_standard_long_line_last_no_s; + #endif // _di_f_console_standard_long_line_last_no_s_ + + #ifndef _di_f_console_standard_long_no_color_s_ + extern const f_string_static_t f_console_standard_long_no_color_s; + #endif // _di_f_console_standard_long_no_color_s_ + + #ifndef _di_f_console_standard_long_normal_s_ + extern const f_string_static_t f_console_standard_long_normal_s; + #endif // _di_f_console_standard_long_normal_s_ + + #ifndef _di_f_console_standard_long_quiet_s_ + extern const f_string_static_t f_console_standard_long_quiet_s; + #endif // _di_f_console_standard_long_quiet_s_ + + #ifndef _di_f_console_standard_long_status_in_s_ + extern const f_string_static_t f_console_standard_long_status_in_s; + #endif // _di_f_console_standard_long_status_in_s_ + + #ifndef _di_f_console_standard_long_status_out_s_ + extern const f_string_static_t f_console_standard_long_status_out_s; + #endif // _di_f_console_standard_long_status_out_s_ + + #ifndef _di_f_console_standard_long_verbose_s_ + extern const f_string_static_t f_console_standard_long_verbose_s; + #endif // _di_f_console_standard_long_verbose_s_ + + #ifndef _di_f_console_standard_long_version_s_ + extern const f_string_static_t f_console_standard_long_version_s; + #endif // _di_f_console_standard_long_version_s_ +#endif // _di_f_console_standard_s_ + +/** * Delete any dynamic allocated data on the parameters object. * * @param parameters diff --git a/level_2/fll_program/c/program/print.c b/level_2/fll_program/c/program/print.c index f691f4f..7c480f9 100644 --- a/level_2/fll_program/c/program/print.c +++ b/level_2/fll_program/c/program/print.c @@ -286,6 +286,23 @@ extern "C" { } #endif // _di_fll_program_print_error_parameter_must_specify_once_value_ +#ifndef _di_fll_program_print_error_parameter_process_ + f_status_t fll_program_print_error_parameter_process(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name) { + + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + + f_file_stream_lock(print.to); + + fl_print_format("%[%QFailure while processing the parameter '%]", print.to, print.set->error, print.prefix, print.set->error); + fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol, name, print.set->notable); + fl_print_format("%['.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s); + + f_file_stream_unlock(print.to); + + return F_none; + } +#endif // _di_fll_program_print_error_parameter_process_ + #ifndef _di_fll_program_print_error_parameter_range_start_before_stop_ f_status_t fll_program_print_error_parameter_range_start_before_stop(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name, const f_string_static_t value_start, const f_string_static_t value_stop) { diff --git a/level_2/fll_program/c/program/print.h b/level_2/fll_program/c/program/print.h index 8fbaf0e..85157d7 100644 --- a/level_2/fll_program/c/program/print.h +++ b/level_2/fll_program/c/program/print.h @@ -386,7 +386,7 @@ extern "C" { * F_output_not on success, but no printing is performed. */ #ifndef _di_fll_program_print_error_parameter_missing_value_ - f_status_t fll_program_print_error_parameter_missing_value(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name); + extern f_status_t fll_program_print_error_parameter_missing_value(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name); #endif // _di_fll_program_print_error_parameter_missing_value_ /** @@ -416,7 +416,7 @@ extern "C" { * F_output_not on success, but no printing is performed. */ #ifndef _di_fll_program_print_error_parameter_missing_value_requires_amount_ - f_status_t fll_program_print_error_parameter_missing_value_requires_amount(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name, const f_string_static_t amount); + extern f_status_t fll_program_print_error_parameter_missing_value_requires_amount(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name, const f_string_static_t amount); #endif // _di_fll_program_print_error_parameter_missing_value_requires_amount_ /** @@ -478,6 +478,34 @@ extern "C" { #endif // _di_fll_program_print_error_parameter_must_specify_once_value_ /** + * Print message about parameter processing failure. + * + * This is only printed when verbosity is not set to quiet. + * + * This uses the following: + * - print.set->error: For the error context. + * - print.set->strong: For the highlighting context + * - print.prefix: For the prefixing a string to the message (such as "ERROR:"). + * + * @param print + * The output structure. + * This locks, uses, and unlocks the file stream. + * @param symbol + * The symbol string prepended to both parameters. + * This locks, uses, and unlocks the file stream. + * This is usually f_console_symbol_long_normal_s. + * @param name + * The parameter name. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_fll_program_print_error_parameter_process_ + extern f_status_t fll_program_print_error_parameter_process(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name); +#endif // _di_fll_program_print_error_parameter_process_ + +/** * Print message about a specific value only being allowed to be used once for the parameter. * * This is only printed when verbosity is not set to quiet. diff --git a/level_3/byte_dump/c/byte_dump.c b/level_3/byte_dump/c/byte_dump.c index 4f6ee42..0943b83 100644 --- a/level_3/byte_dump/c/byte_dump.c +++ b/level_3/byte_dump/c/byte_dump.c @@ -12,7 +12,7 @@ extern "C" { f_status_t status = F_none; // Load parameters. - status = f_console_parameter_process(arguments, &main->parameters); + status = f_console_parameter_process(arguments, &main->parameters, 0); if (F_status_is_error(status)) return; { diff --git a/level_3/byte_dump/c/common.c b/level_3/byte_dump/c/common.c index 223df58..0bb4556 100644 --- a/level_3/byte_dump/c/common.c +++ b/level_3/byte_dump/c/common.c @@ -84,7 +84,7 @@ extern "C" { setting->flag = 0; // Load parameters. - setting->status = f_console_parameter_process(arguments, &main->parameters); + setting->status = f_console_parameter_process(arguments, &main->parameters, 0); if (F_status_is_error(setting->status)) { byte_dump_print_line_first_locked(setting, main->error); diff --git a/level_3/byte_dump/c/common.h b/level_3/byte_dump/c/common.h index 5d3a7a4..6a6d557 100644 --- a/level_3/byte_dump/c/common.h +++ b/level_3/byte_dump/c/common.h @@ -319,36 +319,36 @@ extern "C" { #define byte_dump_console_parameter_t_initialize \ { \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e, 0), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e, 0), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \ \ - macro_f_console_parameter_t_initialize4(byte_dump_short_binary_s, byte_dump_long_binary_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(byte_dump_short_decimal_s, byte_dump_long_decimal_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(byte_dump_short_duodecimal_s, byte_dump_long_duodecimal_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(byte_dump_short_hexidecimal_s, byte_dump_long_hexidecimal_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(byte_dump_short_octal_s, byte_dump_long_octal_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(byte_dump_short_unicode_s, byte_dump_long_unicode_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(byte_dump_short_first_s, byte_dump_long_first_s, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(byte_dump_short_last_s, byte_dump_long_last_s, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(byte_dump_short_narrow_s, byte_dump_long_narrow_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(byte_dump_short_placeholder_s, byte_dump_long_placeholder_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(byte_dump_short_text_s, byte_dump_long_text_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(byte_dump_short_wide_s, byte_dump_long_wide_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(byte_dump_short_width_s, byte_dump_long_width_s, 1, f_console_flag_normal_e, 0), \ + macro_f_console_parameter_t_initialize_4(byte_dump_short_binary_s, byte_dump_long_binary_s, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(byte_dump_short_decimal_s, byte_dump_long_decimal_s, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(byte_dump_short_duodecimal_s, byte_dump_long_duodecimal_s, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(byte_dump_short_hexidecimal_s, byte_dump_long_hexidecimal_s, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(byte_dump_short_octal_s, byte_dump_long_octal_s, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(byte_dump_short_unicode_s, byte_dump_long_unicode_s, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(byte_dump_short_first_s, byte_dump_long_first_s, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(byte_dump_short_last_s, byte_dump_long_last_s, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(byte_dump_short_narrow_s, byte_dump_long_narrow_s, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(byte_dump_short_placeholder_s, byte_dump_long_placeholder_s, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(byte_dump_short_text_s, byte_dump_long_text_s, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(byte_dump_short_wide_s, byte_dump_long_wide_s, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(byte_dump_short_width_s, byte_dump_long_width_s, 1, f_console_flag_normal_e), \ \ - macro_f_console_parameter_t_initialize6(byte_dump_long_normal_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize6(byte_dump_long_simple_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize6(byte_dump_long_classic_s, 0, f_console_flag_normal_e, 0), \ + macro_f_console_parameter_t_initialize_6(byte_dump_long_normal_s, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_6(byte_dump_long_simple_s, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_6(byte_dump_long_classic_s, 0, f_console_flag_normal_e), \ } #define byte_dump_total_parameters_d 28 diff --git a/level_3/control/c/common.c b/level_3/control/c/common.c index 9cbbbb5..108c18e 100644 --- a/level_3/control/c/common.c +++ b/level_3/control/c/common.c @@ -187,7 +187,7 @@ extern "C" { setting->flag = 0; // Load parameters. - setting->status = f_console_parameter_process(arguments, &main->parameters); + setting->status = f_console_parameter_process(arguments, &main->parameters, 0); if (F_status_is_error(setting->status)) { control_print_line_first_locked(setting, main->error); diff --git a/level_3/control/c/common.h b/level_3/control/c/common.h index 063f7c4..4c7a32c 100644 --- a/level_3/control/c/common.h +++ b/level_3/control/c/common.h @@ -115,23 +115,23 @@ extern "C" { #define control_console_parameter_t_initialize \ { \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e, 0), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e, 0), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \ \ - macro_f_console_parameter_t_initialize4(control_short_name_s, control_long_name_s, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(control_short_return_s, control_long_return_s, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(control_short_settings_s, control_long_settings_s, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(control_short_socket_s, control_long_socket_s, 1, f_console_flag_normal_e, 0), \ + macro_f_console_parameter_t_initialize_4(control_short_name_s, control_long_name_s, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(control_short_return_s, control_long_return_s, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(control_short_settings_s, control_long_settings_s, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(control_short_socket_s, control_long_socket_s, 1, f_console_flag_normal_e), \ } #define control_total_parameters_d 16 diff --git a/level_3/control/c/control.c b/level_3/control/c/control.c index 387e5b3..2fb179a 100644 --- a/level_3/control/c/control.c +++ b/level_3/control/c/control.c @@ -13,7 +13,7 @@ extern "C" { f_status_t status = F_none; // Load parameters. - status = f_console_parameter_process(arguments, &main->parameters); + status = f_console_parameter_process(arguments, &main->parameters, 0); if (F_status_is_error(status)) return; { diff --git a/level_3/controller/c/common.c b/level_3/controller/c/common.c index 29d61fe..828cb64 100644 --- a/level_3/controller/c/common.c +++ b/level_3/controller/c/common.c @@ -619,7 +619,7 @@ extern "C" { setting->flag = 0; // Load parameters. - setting->status = f_console_parameter_process(arguments, &main->parameters); + setting->status = f_console_parameter_process(arguments, &main->parameters, 0); if (F_status_is_error(setting->status)) { controller_print_line_first_locked(setting, main->error); diff --git a/level_3/controller/c/common.h b/level_3/controller/c/common.h index b25ed15..39a8a6c 100644 --- a/level_3/controller/c/common.h +++ b/level_3/controller/c/common.h @@ -143,29 +143,29 @@ extern "C" { #define controller_console_parameter_t_initialize \ { \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e, 0), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e, 0), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \ \ - macro_f_console_parameter_t_initialize4(controller_short_cgroup_s, controller_long_cgroup_s, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(controller_short_daemon_s, controller_long_daemon_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(controller_short_init_s, controller_long_init_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(controller_short_interruptible_s, controller_long_interruptible_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(controller_short_pid_s, controller_long_pid_s, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(controller_short_settings_s, controller_long_settings_s, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(controller_short_simulate_s, controller_long_simulate_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(controller_short_socket_s, controller_long_socket_s, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(controller_short_uninterruptible_s, controller_long_uninterruptible_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(controller_short_validate_s, controller_long_validate_s, 0, f_console_flag_normal_e, 0), \ + macro_f_console_parameter_t_initialize_4(controller_short_cgroup_s, controller_long_cgroup_s, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(controller_short_daemon_s, controller_long_daemon_s, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(controller_short_init_s, controller_long_init_s, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(controller_short_interruptible_s, controller_long_interruptible_s, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(controller_short_pid_s, controller_long_pid_s, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(controller_short_settings_s, controller_long_settings_s, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(controller_short_simulate_s, controller_long_simulate_s, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(controller_short_socket_s, controller_long_socket_s, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(controller_short_uninterruptible_s, controller_long_uninterruptible_s, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(controller_short_validate_s, controller_long_validate_s, 0, f_console_flag_normal_e), \ } #define controller_total_parameters_d 22 diff --git a/level_3/controller/c/controller.c b/level_3/controller/c/controller.c index 00dc115..ea6e396 100644 --- a/level_3/controller/c/controller.c +++ b/level_3/controller/c/controller.c @@ -18,7 +18,7 @@ extern "C" { f_status_t status = F_none; // Load parameters. - status = f_console_parameter_process(arguments, &main->parameters); + status = f_console_parameter_process(arguments, &main->parameters, 0); if (F_status_is_error(status)) return; { diff --git a/level_3/fake/c/main/common-print.c b/level_3/fake/c/main/common-print.c index c1bf521..711afd3 100644 --- a/level_3/fake/c/main/common-print.c +++ b/level_3/fake/c/main/common-print.c @@ -16,6 +16,7 @@ extern "C" { "f_string_dynamic_increase_by", "f_string_dynamic_mash", "f_string_dynamic_resize", + "f_string_dynamics_increase_by", "f_uint8s_increase_by", "f_utf_is_word_dash_plus", "fl_directory_copy", diff --git a/level_3/fake/c/main/common-print.h b/level_3/fake/c/main/common-print.h index 11b38c3..85cca37 100644 --- a/level_3/fake/c/main/common-print.h +++ b/level_3/fake/c/main/common-print.h @@ -49,6 +49,7 @@ extern "C" { fake_f_f_string_dynamic_increase_by_e, fake_f_f_string_dynamic_mash_e, fake_f_f_string_dynamic_resize_e, + fake_f_f_string_dynamics_increase_by_e, fake_f_f_uint8s_increase_by_e, fake_f_f_utf_is_word_dash_plus_e, fake_f_fl_directory_copy_e, diff --git a/level_3/fake/c/main/common.c b/level_3/fake/c/main/common.c index d6515e6..52a3828 100644 --- a/level_3/fake/c/main/common.c +++ b/level_3/fake/c/main/common.c @@ -183,12 +183,10 @@ extern "C" { setting->flag = 0; // Load parameters. - setting->status = f_console_parameter_process(arguments, &main->parameters); + setting->status = f_console_parameter_process(arguments, &main->parameters, (void *) setting); if (F_status_is_error(setting->status)) { - - fake_print_line_first_locked(setting, main->error); - fll_error_print(main->error, F_status_set_fine(setting->status), macro_fake_f(f_console_parameter_process), F_true); + fake_print_error(setting, F_status_set_fine(setting->status), macro_fake_f(f_console_parameter_process)); return; } @@ -208,8 +206,7 @@ extern "C" { setting->status = fll_program_parameter_process_context(choices, modes, F_true, main); if (F_status_is_error(setting->status)) { - fake_print_line_first_locked(setting, main->error); - fll_error_print(main->error, F_status_set_fine(setting->status), macro_fake_f(fll_program_parameter_process_context), F_true); + fake_print_error(setting, F_status_set_fine(setting->status), macro_fake_f(fll_program_parameter_process_context)); return; } @@ -240,8 +237,7 @@ extern "C" { setting->status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); if (F_status_is_error(setting->status)) { - fake_print_line_first_locked(setting, main->error); - fll_error_print(main->error, F_status_set_fine(setting->status), macro_fake_f(fll_program_parameter_process_verbosity), F_true); + fake_print_error(setting, F_status_set_fine(setting->status), macro_fake_f(fll_program_parameter_process_verbosity)); return; } @@ -264,249 +260,345 @@ extern "C" { return; } - uint8_t i = 0; f_array_length_t j = 0; - f_array_length_t width_max = 0; f_array_length_t index = 0; { - const uint8_t enables[] = { - fake_parameter_documents_enable_e, - fake_parameter_shared_enable_e, - fake_parameter_static_enable_e, - }; - - const uint8_t disables[] = { - fake_parameter_documents_enable_e, - fake_parameter_shared_enable_e, - fake_parameter_static_enable_e, - }; - - const uint16_t flags[] = { - fake_main_flag_enable_documents_e, - fake_main_flag_enable_shared_e, - fake_main_flag_enable_static_e, - }; - - for (; i < 3; ++i) { - - if (main->parameters.array[enables[i]].result & f_console_result_found_e) { - if (main->parameters.array[disables[i]].result & f_console_result_found_e) { - if (main->parameters.array[enables[i]].location < main->parameters.array[disables[i]].location) { - setting->flag -= setting->flag & flags[i]; + uint8_t i = 0; + + { + const uint8_t enables[] = { + fake_parameter_documents_enable_e, + fake_parameter_shared_enable_e, + fake_parameter_static_enable_e, + }; + + const uint8_t disables[] = { + fake_parameter_documents_enable_e, + fake_parameter_shared_enable_e, + fake_parameter_static_enable_e, + }; + + const uint16_t flags[] = { + fake_main_flag_enable_documents_e, + fake_main_flag_enable_shared_e, + fake_main_flag_enable_static_e, + }; + + for (; i < 3; ++i) { + + if (main->parameters.array[enables[i]].result & f_console_result_found_e) { + if (main->parameters.array[disables[i]].result & f_console_result_found_e) { + if (main->parameters.array[enables[i]].location < main->parameters.array[disables[i]].location) { + setting->flag -= setting->flag & flags[i]; + } + else { + setting->flag |= flags[i]; + } } else { setting->flag |= flags[i]; } } - else { - setting->flag |= flags[i]; + else if (main->parameters.array[disables[i]].result & f_console_result_found_e) { + setting->flag -= setting->flag & flags[i]; } - } - else if (main->parameters.array[disables[i]].result & f_console_result_found_e) { - setting->flag -= setting->flag & flags[i]; - } - } // for - } - - { - const f_array_length_t parameters[] = { - fake_parameter_fakefile_e, - fake_parameter_mode_e, - fake_parameter_path_build_e, - fake_parameter_path_data_e, - fake_parameter_path_sources_e, - fake_parameter_path_work_e, - fake_parameter_process_e, - fake_parameter_settings_e, - fake_parameter_sources_e, - }; - - const f_string_static_t names[] = { - fake_long_fakefile_s, - fake_long_mode_s, - fake_long_path_build_s, - fake_long_path_data_s, - fake_long_path_sources_s, - fake_long_path_work_s, - fake_long_process_s, - fake_long_settings_s, - fake_long_sources_s, - }; - - const f_string_dynamic_t variable[] = { - &setting->fakefile, - &setting->mode, - &setting->path_build, - &setting->path_data, - &setting->path_sources, - &setting->path_work, - &setting->process, - &setting->settings, - &setting->sources, - }; - - bool validate_word[] = { - F_false, // fake_parameter_fakefile_e - F_false, // fake_parameter_mode_e - F_false, // fake_parameter_path_build_e - F_false, // fake_parameter_path_data_e - F_false, // fake_parameter_path_sources_e - F_false, // fake_parameter_path_work_e - F_true, // fake_parameter_process_e - F_false, // fake_parameter_settings_e - F_false, // fake_parameter_sources_e - }; - - f_string_static_t *defaults[] = { - &fake_default_fakefile_s, // fake_parameter_fakefile_e - 0, // fake_parameter_mode_e - 0, // fake_parameter_path_build_e - 0, // fake_parameter_path_data_e - 0, // fake_parameter_path_sources_e - 0, // fake_parameter_path_work_e - &fake_default_process_s, // fake_parameter_process_e - &fake_default_settings_s, // fake_parameter_settings_e - 0, // fake_parameter_sources_e - }; - - for (i = 0; i < 9; ++i) { - - if (main->parameters.array[parameters[i]].result & f_console_result_found_e) { - setting->status = F_status_set_error(F_parameter); - - fake_print_line_first_locked(setting, main->error); - fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, names[i]); + } // for + } - return; - } + { + const f_array_length_t parameters[] = { + fake_parameter_fakefile_e, + fake_parameter_path_build_e, + fake_parameter_path_data_e, + fake_parameter_path_sources_e, + fake_parameter_path_work_e, + fake_parameter_process_e, + fake_parameter_settings_e, + fake_parameter_sources_e, + }; + + const f_string_static_t names[] = { + fake_long_fakefile_s, + fake_long_path_build_s, + fake_long_path_data_s, + fake_long_path_sources_s, + fake_long_path_work_s, + fake_long_process_s, + fake_long_settings_s, + fake_long_sources_s, + }; + + f_string_dynamic_t * const variable[] = { + &setting->fakefile, + &setting->path_build, + &setting->path_data, + &setting->path_sources, + &setting->path_work, + &setting->process, + &setting->settings, + &setting->sources, + }; + + f_string_static_t * const defaults[] = { + &fake_default_fakefile_s, // fake_parameter_fakefile_e + 0, // fake_parameter_path_build_e + 0, // fake_parameter_path_data_e + 0, // fake_parameter_path_sources_e + 0, // fake_parameter_path_work_e + &fake_default_process_s, // fake_parameter_process_e + &fake_default_settings_s, // fake_parameter_settings_e + 0, // fake_parameter_sources_e + }; + + for (i = 0; i < 8; ++i) { + + if (main->parameters.array[parameters[i]].result & f_console_result_found_e) { + setting->status = F_status_set_error(F_parameter); + + fake_print_line_first_locked(setting, main->error); + + fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, names[i]); + + return; + } - if (main->parameters.array[parameters[i]].result & f_console_result_additional_e) { - index = data->main->parameters.array[parameters[i]].values.array[0]; + if (main->parameters.array[parameters[i]].result & f_console_result_additional_e) { + index = data->main->parameters.array[parameters[i]].values.array[data->main->parameters.array[parameters[i]].values.used - 1]; - if (data->main->parameters.arguments.array[index].used) { - if (validate_word[i]) { - width_max = 0; + if (data->main->parameters.arguments.array[index].used) { + if (parameters[i] == fake_parameter_process_e) { + for (j = 0; j < data->main->parameters.arguments.array[index].used; ++j) { - for (j = 0; j < data->main->parameters.arguments.array[index].used; ++j) { + setting->status = f_utf_is_word_dash_plus(data->main->parameters.arguments.array[index].string + j, data->main->parameters.arguments.array[index].used - j, F_false); - width_max = data->main->parameters.arguments.array[index].used - j; + if (F_status_is_error(setting->status)) { + if (print.verbosity > f_console_verbosity_quiet_e) { + fake_print_line_first_locked(setting, print); - status = f_utf_is_word_dash_plus(data->main->parameters.arguments.array[index].string + j, width_max, F_false); + if (fll_error_print(data->main->error, F_status_set_fine(setting->status), macro_fake_f(f_utf_is_word_dash_plus), F_false) == F_false) { + fll_program_print_error_parameter_process(data->main->error, F_status_set_fine(setting->status), f_console_symbol_long_normal_s, names[i]); + } + } - if (F_status_is_error(status)) { - fll_error_print(data->main->error, F_status_set_fine(status), macro_fake_f(f_string_dynamic_increase_by), F_true); + return; + } - if (fll_error_print(data->main->error, F_status_set_fine(status), macro_fake_f(f_utf_is_word_dash_plus), F_false) == F_known_not && data->main->error.verbosity > f_console_verbosity_quiet_e) { - f_file_stream_lock(data->main->error.to); + if (setting->status == F_false) { + setting->status = F_status_set_error(F_parameter); - fl_print_format("%r%[%QFailed to process the parameter '%]", data->main->error.to, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context); - fl_print_format("%[%r%r%]", data->main->error.to, data->main->error.notable, f_console_symbol_long_normal_s, fake_long_process_s, data->main->error.notable); - fl_print_format("%['.%]%r", data->main->error.to, data->main->error.context, data->main->error.context, f_string_eol_s); + fake_print_error_parameter_not_word(setting, data->main->error, f_console_symbol_long_normal_s, names[i], data->main->parameters.arguments.array[index]); - f_file_stream_unlock(data->main->error.to); + return; } + } // for + } - return status; - } + // De-allocate memory before replacing it with a statically allocated string. + if (variable[i]->size) { + setting->status = f_string_dynamic_resize(0, variable[i]); - if (status == F_false) { - if (data->main->error.verbosity > f_console_verbosity_quiet_e) { - f_file_stream_lock(data->main->error.to); + if (F_status_is_error(setting->status)) { + fake_print_error(setting, F_status_set_fine(setting->status), macro_fake_f(f_string_dynamic_resize)); - fl_print_format("%r%[%QThe '%]", data->main->error.to, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context); - fl_print_format("%[%r%r%]", data->main->error.to, data->main->error.notable, f_console_symbol_long_normal_s, fake_long_process_s, data->main->error.notable); - fl_print_format("%[' parameters value '%]", data->main->error.to, data->main->error.context, data->main->error.context, f_string_eol_s); - fl_print_format("%[%Q%]", data->main->error.to, data->main->error.notable, data->main->parameters.arguments.array[index], data->main->error.notable); - fl_print_format("%[' contains non-word, non-dash, and non-plus characters.%]%r", data->main->error.to, data->main->error.context, data->main->error.context, f_string_eol_s); + return; + } + } - f_file_stream_unlock(data->main->error.to); - } + variable[i]->string = data->main->parameters.arguments.array[index].string; + variable[i]->used = data->main->parameters.arguments.array[index].used; + variable[i]->size = 0; - return F_status_set_error(F_parameter); - } - } // for + setting->status = F_none; } + } + else if (defaults[i]) { - status = f_string_dynamic_increase_by(data->main->parameters.arguments.array[index].used + 1, parameters_value[i]); + // De-allocate memory before replacing it with a statically allocated string. + if (variable[i]->size) { + setting->status = f_string_dynamic_resize(0, variable[i]); - if (F_status_is_error(status)) { - fll_error_print(data->main->error, F_status_set_fine(status), macro_fake_f(f_string_dynamic_increase_by), F_true); + if (F_status_is_error(setting->status)) { + fake_print_error(setting, F_status_set_fine(setting->status), macro_fake_f(f_string_dynamic_resize)); - return status; + return; + } } - setting->status = f_string_dynamic_append(data->main->parameters.arguments.array[index], parameters_value[i]); + variable[i]->string = defaults[i]->string; + variable[i]->used = defaults[i]->used; + variable[i]->size = 0; + } + } // for + } + + { + const f_array_length_t parameters[] = { + fake_parameter_define_e, + fake_parameter_mode_e, + }; + + const f_string_static_t names[] = { + fake_long_define_s, + fake_long_mode_s, + }; + + f_string_dynamics_t * const variable[] = { + &setting->define, + &setting->mode, + }; + + for (i = 0; i < 2; ++i) { + + if (main->parameters.array[parameters[i]].result & f_console_result_found_e) { + setting->status = F_status_set_error(F_parameter); + + fake_print_line_first_locked(setting, main->error); + + fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, names[i]); + + return; + } + + if (main->parameters.array[parameters[i]].result & f_console_result_additional_e) { + variable[i]->used = 0; + + setting->status = f_string_dynamics_increase_by(data->main->parameters.array[parameters[i]].values.used, variable[i]); if (F_status_is_error(setting->status)) { - if (status == F_status_set_error(F_string_too_large)) { - if (print.verbosity < f_console_verbosity_normal_e) { - fake_print_line_first_locked(setting, main->error); - fake_print_error_parameter_value_too_long(data->main->error, f_console_symbol_long_normal_s, names[i]); - } - } - else { - fll_error_print(data->main->error, F_status_set_fine(status), macro_fake_f(f_string_append), F_true); - } + fake_print_error(setting, main->error, macro_fake_f(f_string_dynamics_increase_by)); return; } - status = F_none; + for (; variable[i]->used < data->main->parameters.array[parameters[i]].values.used; ) { + + // De-allocate memory before replacing it with a statically allocated string. + if (variable[i]->size) { + setting->status = f_string_dynamic_resize(0, variable[i]); + + if (F_status_is_error(setting->status)) { + fake_print_error(setting, F_status_set_fine(setting->status), macro_fake_f(f_string_dynamic_resize)); + + return; + } + } + + index = data->main->parameters.array[parameters[i]].values.array[variable[i]->used]; + + variable[i]->array[variable[i]->used].string = main->parameters.arguments.array[index].string; + variable[i]->array[variable[i]->used].used = main->parameters.arguments.array[index].used; + variable[i]->array[variable[i]->used++].size = 0; + } // for } - } - else if (defaults[i]) { - } - } // for + } // for + } } - // @todo define (multi valued map) - if (main->parameters.array[fake_parameter_define_e].result & f_console_result_found_e) { - setting->status = F_status_set_error(F_parameter); + { + f_array_length_t locations = main->parameters.array[fake_parameter_operation_build_e].locations.used; + locations += main->parameters.array[fake_parameter_operation_clean_e].locations.used; + locations += main->parameters.array[fake_parameter_operation_make_e].locations.used; + locations += main->parameters.array[fake_parameter_operation_skeleton_e].locations.used; - fake_print_line_first_locked(setting, main->error); - fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, fake_long_define_s); + setting->operations.used = 0; - return; - } + setting->status = f_uint8s_increase_by(locations ? locations : 1, &setting->operations); - //f_string_static_t * const args = main->parameters.arguments.array; + if (F_status_is_error(setting->status)) { + fake_print_error(setting, main->error, macro_fake_f(f_uint8s_increase_by)); - /* - * fake_process_console_parameters - fake_parameter_operation_build_e, - fake_parameter_operation_clean_e, - fake_parameter_operation_make_e, - fake_parameter_operation_skeleton_e, - */ + return; + } - f_array_length_t operations_length = main->parameters.array[fake_parameter_operation_build_e].locations.used; + if (locations) { + data.flag |= fake_data_flag_operation_e; - operations_length += main->parameters.array[fake_parameter_operation_clean_e].locations.used; - operations_length += main->parameters.array[fake_parameter_operation_make_e].locations.used; - operations_length += main->parameters.array[fake_parameter_operation_skeleton_e].locations.used; + f_array_length_t i = 0; - setting->operations.used = 0; + //f_string_static_t * const args = main->parameters.arguments.array; - setting->status = f_uint8s_increase_by(operations_length ? operations_length : 1, &setting->operations); + /* + fake_process_console_parameters + fake_parameter_operation_build_e, + fake_parameter_operation_clean_e, + fake_parameter_operation_make_e, + fake_parameter_operation_skeleton_e, + */ + /* + f_array_length_t locations[operations_length]; + f_array_length_t locations_length = 0; + f_array_length_t i = 0; + f_array_length_t j = 0; + f_array_length_t k = 0; - if (F_status_is_error(setting->status)) { - fake_print_error(setting, main->error, macro_fake_f(f_uint8s_increase_by)); + for (; i < main->parameters.array[fake_parameter_operation_build_e].locations.used; ++i, ++locations_length) { - return; - } + operations[locations_length] = fake_operation_build_e; + locations[locations_length] = main->parameters.array[fake_parameter_operation_build_e].locations.array[i]; + } // for - // Ensure the default operation always exists. - if (operations_length) { - data.flag |= fake_data_flag_operation_e; - } - else { - setting->status = f_uint8s_increase_by(1, &setting->operations); + for (i = 0; i < main->parameters.array[fake_parameter_operation_clean_e].locations.used; ++i) { - if (F_status_is_error(status)) { - fake_print_error(setting, main->error, macro_fake_f(f_uint8s_increase_by)); + for (j = 0; j < locations_length; ++j) { - return; + if (main->parameters.array[fake_parameter_operation_clean_e].locations.array[i] < locations[j]) { + for (k = locations_length; k > j; --k) { + locations[k] = locations[k - 1]; + operations[k] = operations[k - 1]; + } // for + + break; + } + } // for + + locations[j] = main->parameters.array[fake_parameter_operation_clean_e].locations.array[i]; + operations[j] = fake_operation_clean_e; + ++locations_length; + } // for + + for (i = 0; i < main->parameters.array[fake_parameter_operation_make_e].locations.used; ++i) { + + for (j = 0; j < locations_length; ++j) { + + if (main->parameters.array[fake_parameter_operation_make_e].locations.array[i] < locations[j]) { + for (k = locations_length; k > j; --k) { + locations[k] = locations[k - 1]; + operations[k] = operations[k - 1]; + } // for + + break; + } + } // for + + locations[j] = main->parameters.array[fake_parameter_operation_make_e].locations.array[i]; + operations[j] = fake_operation_make_e; + ++locations_length; + } // for + + for (i = 0; i < main->parameters.array[fake_parameter_operation_skeleton_e].locations.used; ++i) { + + for (j = 0; j < locations_length; ++j) { + + if (main->parameters.array[fake_parameter_operation_skeleton_e].locations.array[i] < locations[j]) { + for (k = locations_length; k > j; --k) { + + locations[k] = locations[k - 1]; + operations[k] = operations[k - 1]; + } // for + + break; + } + } // for + + locations[j] = main->parameters.array[fake_parameter_operation_skeleton_e].locations.array[i]; + operations[j] = fake_operation_skeleton_e; + ++locations_length; + } // for + */ + } + else { + setting->operations.array[setting->operations.used++] = fake_parameter_operation_make_e; } } } diff --git a/level_3/fake/c/main/common.h b/level_3/fake/c/main/common.h index bdd7b7f..191561e 100644 --- a/level_3/fake/c/main/common.h +++ b/level_3/fake/c/main/common.h @@ -462,40 +462,40 @@ extern "C" { #define fake_console_parameter_t_initialize \ { \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e, 0), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \ \ - macro_f_console_parameter_t_initialize4(fake_short_define_s, fake_long_define_s, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fake_short_fakefile_s, fake_long_fakefile_s, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fake_short_mode_s, fake_long_mode_s, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fake_short_process_s, fake_long_process_s, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fake_short_settings_s, fake_long_settings_s, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fake_short_path_build_s, fake_long_path_build_s, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fake_short_path_data_s, fake_long_path_data_s, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fake_short_path_sources_s, fake_long_path_sources_s, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fake_short_path_work_s, fake_long_path_work_s, 1, f_console_flag_normal_e, 0), \ + macro_f_console_parameter_t_initialize_4(fake_short_define_s, fake_long_define_s, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fake_short_fakefile_s, fake_long_fakefile_s, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fake_short_mode_s, fake_long_mode_s, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fake_short_process_s, fake_long_process_s, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fake_short_settings_s, fake_long_settings_s, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fake_short_path_build_s, fake_long_path_build_s, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fake_short_path_data_s, fake_long_path_data_s, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fake_short_path_sources_s, fake_long_path_sources_s, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fake_short_path_work_s, fake_long_path_work_s, 1, f_console_flag_normal_e), \ \ - macro_f_console_parameter_t_initialize6(fake_long_documents_disabled_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize6(fake_long_documents_enabled_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize6(fake_long_shared_disabled_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize6(fake_long_shared_enabled_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize6(fake_long_static_disabled_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize6(fake_long_static_enabled_s, 0, f_console_flag_normal_e, 0), \ + macro_f_console_parameter_t_initialize_6(fake_long_documents_disabled_s, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_6(fake_long_documents_enabled_s, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_6(fake_long_shared_disabled_s, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_6(fake_long_shared_enabled_s, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_6(fake_long_static_disabled_s, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_6(fake_long_static_enabled_s, 0, f_console_flag_normal_e), \ \ - macro_f_console_parameter_t_initialize7(fake_other_operation_build_s, 0, f_console_flag_simple_e, 0), \ - macro_f_console_parameter_t_initialize7(fake_other_operation_clean_s, 0, f_console_flag_simple_e, 0), \ - macro_f_console_parameter_t_initialize7(fake_other_operation_make_s, 0, f_console_flag_simple_e, 0), \ - macro_f_console_parameter_t_initialize7(fake_other_operation_skeleton_s, 0, f_console_flag_simple_e, 0), \ + macro_f_console_parameter_t_initialize_7(fake_other_operation_build_s, 0, f_console_flag_simple_e), \ + macro_f_console_parameter_t_initialize_7(fake_other_operation_clean_s, 0, f_console_flag_simple_e), \ + macro_f_console_parameter_t_initialize_7(fake_other_operation_make_s, 0, f_console_flag_simple_e), \ + macro_f_console_parameter_t_initialize_7(fake_other_operation_skeleton_s, 0, f_console_flag_simple_e), \ } #define fake_total_parameters_d 31 @@ -513,6 +513,7 @@ extern "C" { * - file_to: Using a specified destination file. * - header: Enable printing of headers. * - help: Print help. + * - operation: Designate that an operation is explicitly passed. * - separate: Enable printing of separators. * - strip_invalid: Using strip invalid character mode. * - verify: Using verify mode. @@ -528,10 +529,11 @@ extern "C" { fake_main_flag_file_to_e = 0x10, fake_main_flag_header_e = 0x20, fake_main_flag_help_e = 0x40, - fake_main_flag_separate_e = 0x80, - fake_main_flag_strip_invalid_e = 0x100, - fake_main_flag_verify_e = 0x200, - fake_main_flag_version_e = 0x400, + fake_data_flag_operation_e = 0x80, + fake_main_flag_separate_e = 0x100, + fake_main_flag_strip_invalid_e = 0x200, + fake_main_flag_verify_e = 0x400, + fake_main_flag_version_e = 0x800, }; // enum #endif // _di_fake_main_flag_e_ @@ -679,7 +681,7 @@ extern "C" { f_string_dynamic_t file_documents_readme; - f_string_dynamics_t defines; // @todo conside instead: f_string_maps_t defines; + f_string_dynamics_t defines; f_string_dynamics_t modes; f_uint8s_t operations; diff --git a/level_3/fake/c/main/fake.c b/level_3/fake/c/main/fake.c index 2ff7c90..9d41f5f 100644 --- a/level_3/fake/c/main/fake.c +++ b/level_3/fake/c/main/fake.c @@ -38,104 +38,12 @@ extern "C" { return; } + // @todo everything below is old, mostly. fake_data_t data = fake_data_t_initialize; data.main = main; data.setting = setting; data.argv = main->parameters.arguments.array; - // @todo move operations processing into the common settings loader. - f_array_length_t operations_length = main->parameters.array[fake_parameter_operation_build_e].locations.used; - - operations_length += main->parameters.array[fake_parameter_operation_clean_e].locations.used; - operations_length += main->parameters.array[fake_parameter_operation_make_e].locations.used; - operations_length += main->parameters.array[fake_parameter_operation_skeleton_e].locations.used; - - // Ensure the default operation always exists. - if (operations_length) { - data.flag |= fake_data_flag_operation_e; - } - else { - operations_length = 1; - } - - uint8_t operations[operations_length]; - f_string_static_t operations_name = f_string_static_t_initialize; - - if (data.flag & fake_data_flag_operation_e) { - f_array_length_t locations[operations_length]; - f_array_length_t locations_length = 0; - f_array_length_t i = 0; - f_array_length_t j = 0; - f_array_length_t k = 0; - - for (; i < main->parameters.array[fake_parameter_operation_build_e].locations.used; ++i, ++locations_length) { - - operations[locations_length] = fake_operation_build_e; - locations[locations_length] = main->parameters.array[fake_parameter_operation_build_e].locations.array[i]; - } // for - - for (i = 0; i < main->parameters.array[fake_parameter_operation_clean_e].locations.used; ++i) { - - for (j = 0; j < locations_length; ++j) { - - if (main->parameters.array[fake_parameter_operation_clean_e].locations.array[i] < locations[j]) { - for (k = locations_length; k > j; --k) { - locations[k] = locations[k - 1]; - operations[k] = operations[k - 1]; - } // for - - break; - } - } // for - - locations[j] = main->parameters.array[fake_parameter_operation_clean_e].locations.array[i]; - operations[j] = fake_operation_clean_e; - ++locations_length; - } // for - - for (i = 0; i < main->parameters.array[fake_parameter_operation_make_e].locations.used; ++i) { - - for (j = 0; j < locations_length; ++j) { - - if (main->parameters.array[fake_parameter_operation_make_e].locations.array[i] < locations[j]) { - for (k = locations_length; k > j; --k) { - locations[k] = locations[k - 1]; - operations[k] = operations[k - 1]; - } // for - - break; - } - } // for - - locations[j] = main->parameters.array[fake_parameter_operation_make_e].locations.array[i]; - operations[j] = fake_operation_make_e; - ++locations_length; - } // for - - for (i = 0; i < main->parameters.array[fake_parameter_operation_skeleton_e].locations.used; ++i) { - - for (j = 0; j < locations_length; ++j) { - - if (main->parameters.array[fake_parameter_operation_skeleton_e].locations.array[i] < locations[j]) { - for (k = locations_length; k > j; --k) { - - locations[k] = locations[k - 1]; - operations[k] = operations[k - 1]; - } // for - - break; - } - } // for - - locations[j] = main->parameters.array[fake_parameter_operation_skeleton_e].locations.array[i]; - operations[j] = fake_operation_skeleton_e; - ++locations_length; - } // for - } - else { - operations[0] = fake_operation_make_e; - } - if (F_status_is_error_not(setting->status)) { if (main->parameters.array[fake_parameter_operation_build_e].locations.used && main->parameters.array[fake_parameter_operation_make_e].locations.used) { setting->status = F_status_set_error(F_parameter); @@ -162,7 +70,7 @@ extern "C" { { uint8_t i = 0; - if ((main->pipe & fll_program_data_pipe_input_e) && !(data.flag & fake_data_flag_operation_e)) { + if ((main->pipe & fll_program_data_pipe_input_e) && !(data.setting->flag & fake_data_flag_operation_e)) { data.file_data_build_fakefile.used = 0; setting->status = f_string_dynamic_append(f_string_ascii_minus_s, &data.file_data_build_fakefile); diff --git a/level_3/fake/c/main/print.c b/level_3/fake/c/main/print.c index 77b05e6..da0afc7 100644 --- a/level_3/fake/c/main/print.c +++ b/level_3/fake/c/main/print.c @@ -55,6 +55,31 @@ extern "C" { } #endif // _di_fake_print_error_failure_script_ +#ifndef _di_fake_print_error_parameter_not_word_ + f_status_t fake_print_error_parameter_not_word(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name, const f_string_static_t value) { + + if (!setting || print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + + if (!F_status_is_error(setting->status)) { + if (print.verbosity < f_console_verbosity_error_e) return F_output_not; + } + + f_file_stream_lock(print.to); + + fake_print_line_first_unlocked(setting, print); + + fl_print_format("%[%QThe '%]", print.to, print.context, print.prefix, print.context); + fl_print_format("%[%Q%Q%]", print.to, print.notable, symbol, name, print.notable); + fl_print_format("%[' parameter value '%]", print.to, print.context, print.context); + fl_print_format("%[%Q%]", print.to, print.notable, value, print.notable); + fl_print_format("%[' contains non-word, non-dash, and non-plus characters.%]%r", print.to, print.context, print.context, f_string_eol_s); + + f_file_stream_unlock(print.to); + + return F_none; + } +#endif // _di_fake_print_error_parameter_not_word_ + #ifndef _di_fake_print_error_parameter_operation_not_with_ f_status_t fake_print_error_parameter_operation_not_with(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t operation_1, const f_string_static_t operation_2) { @@ -69,9 +94,9 @@ extern "C" { fake_print_line_first_unlocked(setting, print); fl_print_format("%[%QThe operation '%]", print.to, print.context, print.prefix, print.context); - fl_print_format("%[%r%]", print.to, print.notable, operation_1, print.notable); + fl_print_format("%[%Q%]", print.to, print.notable, operation_1, print.notable); fl_print_format("%[' cannot be specified with the operation '%]", print.to, print.context, print.context); - fl_print_format("%[%r%]", print.to, print.notable, operation_2, print.notable); + fl_print_format("%[%Q%]", print.to, print.notable, operation_2, print.notable); fl_print_format("%['.%]%r", print.to, print.context, print.context, f_string_eol_s); f_file_stream_unlock(print.to); diff --git a/level_3/fake/c/main/print.h b/level_3/fake/c/main/print.h index 42038a4..d3fe1a5 100644 --- a/level_3/fake/c/main/print.h +++ b/level_3/fake/c/main/print.h @@ -76,6 +76,30 @@ extern "C" { #endif // _di_fake_print_error_failure_script_ /** + * Print error message for when the parameter value contains a non-word, non-minus, and non-plus character. + * + * @param setting + * The main program settings. + * + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * @param symbol + * The symbol of the parameter. + * @param name + * The name of the parameter. + * @param value + * The value that is invalid. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_fake_print_error_parameter_not_word_ + extern f_status_t fake_print_error_parameter_not_word(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name, const f_string_static_t value); +#endif // _di_fake_print_error_parameter_not_word_ + +/** * Print error message for when two designated operations cannot be used together. * * @param setting diff --git a/level_3/fake/c/main/private-build-load.c b/level_3/fake/c/main/private-build-load.c index fe61ad9..c951b6a 100644 --- a/level_3/fake/c/main/private-build-load.c +++ b/level_3/fake/c/main/private-build-load.c @@ -99,7 +99,7 @@ extern "C" { if (build_arguments && build_arguments->used) { path_file.used = data->path_data_build.used + build_arguments->array[0].used; } - else if (!process_pipe || (data->flag & fake_data_flag_operation_e)) { + else if (!process_pipe || (data->setting->flag & fake_data_flag_operation_e)) { path_file.used = data->file_data_build_settings.used; } else { @@ -114,7 +114,7 @@ extern "C" { memcpy(path_file_string, data->path_data_build.string, sizeof(f_char_t) * data->path_data_build.used); memcpy(path_file_string + data->path_data_build.used, build_arguments->array[0].string, sizeof(f_char_t) * build_arguments->array[0].used); } - else if (!process_pipe || (data->flag & fake_data_flag_operation_e)) { + else if (!process_pipe || (data->setting->flag & fake_data_flag_operation_e)) { memcpy(path_file_string, data->file_data_build_settings.string, sizeof(f_char_t) * data->file_data_build_settings.used); } else { @@ -138,7 +138,7 @@ extern "C" { } if (F_status_is_error_not(*status)) { - if (build_arguments && build_arguments->used || !process_pipe || (data->flag & fake_data_flag_operation_e)) { + if (build_arguments && build_arguments->used || !process_pipe || (data->setting->flag & fake_data_flag_operation_e)) { *status = fake_file_buffer(data, path_file, process_pipe ? F_false : F_true, &buffer); } } diff --git a/level_3/fake/c/main/private-common.h b/level_3/fake/c/main/private-common.h index 9446d45..4c78012 100644 --- a/level_3/fake/c/main/private-common.h +++ b/level_3/fake/c/main/private-common.h @@ -13,34 +13,20 @@ extern "C" { #endif /** - * The program flags. - * - * fake_data_flag_*: - * - has_operation: Designate that an operation is explicitly passed. - */ -#ifndef _di_fake_data_flag_e_ - enum { - fake_data_flag_operation_e = 0x1, - }; -#endif // _di_fake_data_flag_e_ - -/** * The program data. * * main: The main program data. * setting: The settings data. * argv: The argument structure in the progam data parameters for simplifying syntax. * - * flag: A set of flags, such as designating that no operations are provided. * operation: A code representing the currrent operation. */ #ifndef _di_fake_data_t_ typedef struct { fll_program_data_t *main; fake_setting_t *setting; - f_string_static_t *argv; + f_string_static_t *argv; // @todo this might be removable now that settings exists. - uint8_t flag; uint8_t operation; } fake_data_t; @@ -50,7 +36,6 @@ extern "C" { 0, \ 0, \ 0, \ - 0, \ } #endif // _di_fake_main_t_ diff --git a/level_3/firewall/c/common.c b/level_3/firewall/c/common.c index 22c3b9b..c022c8b 100644 --- a/level_3/firewall/c/common.c +++ b/level_3/firewall/c/common.c @@ -120,7 +120,7 @@ extern "C" { setting->flag = 0; // Load parameters. - setting->status = f_console_parameter_process(arguments, &main->parameters); + setting->status = f_console_parameter_process(arguments, &main->parameters, 0); if (F_status_is_error(setting->status)) { firewall_print_line_first_locked(setting, main->error); diff --git a/level_3/firewall/c/common.h b/level_3/firewall/c/common.h index 3ad52ec..801e491 100644 --- a/level_3/firewall/c/common.h +++ b/level_3/firewall/c/common.h @@ -386,24 +386,24 @@ extern "C" { #define firewall_console_parameter_t_initialize \ { \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e, 0), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e, 0), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \ \ - macro_f_console_parameter_t_initialize7(firewall_command_start_s, 0, f_console_flag_simple_e), \ - macro_f_console_parameter_t_initialize7(firewall_command_stop_s, 0, f_console_flag_simple_e), \ - macro_f_console_parameter_t_initialize7(firewall_command_restart_s, 0, f_console_flag_simple_e), \ - macro_f_console_parameter_t_initialize7(firewall_command_lock_s, 0, f_console_flag_simple_e), \ - macro_f_console_parameter_t_initialize7(firewall_command_show_s, 0, f_console_flag_simple_e), \ + macro_f_console_parameter_t_initialize_7(firewall_command_start_s, 0, f_console_flag_simple_e), \ + macro_f_console_parameter_t_initialize_7(firewall_command_stop_s, 0, f_console_flag_simple_e), \ + macro_f_console_parameter_t_initialize_7(firewall_command_restart_s, 0, f_console_flag_simple_e), \ + macro_f_console_parameter_t_initialize_7(firewall_command_lock_s, 0, f_console_flag_simple_e), \ + macro_f_console_parameter_t_initialize_7(firewall_command_show_s, 0, f_console_flag_simple_e), \ } #define firewall_total_parameters_d 17 diff --git a/level_3/firewall/c/firewall.c b/level_3/firewall/c/firewall.c index 4cdc0d6..49f71b0 100644 --- a/level_3/firewall/c/firewall.c +++ b/level_3/firewall/c/firewall.c @@ -20,7 +20,7 @@ extern "C" { main->child = 0; // Load parameters. - status = f_console_parameter_process(arguments, &main->parameters); + status = f_console_parameter_process(arguments, &main->parameters, 0); if (F_status_is_error(status)) return; { diff --git a/level_3/fss_basic_list_read/c/common.c b/level_3/fss_basic_list_read/c/common.c index a0b6675..6056b1a 100644 --- a/level_3/fss_basic_list_read/c/common.c +++ b/level_3/fss_basic_list_read/c/common.c @@ -78,7 +78,7 @@ extern "C" { setting->flag = 0; // Load parameters. - setting->status = f_console_parameter_process(arguments, &main->parameters); + setting->status = f_console_parameter_process(arguments, &main->parameters, 0); if (F_status_is_error(setting->status)) { fss_basic_list_read_print_line_first_locked(setting, main->error); diff --git a/level_3/fss_basic_list_read/c/common.h b/level_3/fss_basic_list_read/c/common.h index 85779a4..11da846 100644 --- a/level_3/fss_basic_list_read/c/common.h +++ b/level_3/fss_basic_list_read/c/common.h @@ -223,33 +223,33 @@ extern "C" { #define fss_basic_list_read_console_parameter_t_initialize \ { \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e, 0), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e, 0), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \ \ - macro_f_console_parameter_t_initialize4(fss_basic_list_read_short_at_s, fss_basic_list_read_long_at_s, 0, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_basic_list_read_short_content_s, fss_basic_list_read_long_content_s, 0, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_basic_list_read_short_columns_s, fss_basic_list_read_long_columns_s, 0, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_basic_list_read_short_delimit_s, fss_basic_list_read_long_delimit_s, 0, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_basic_list_read_short_depth_s, fss_basic_list_read_long_depth_s, 0, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_basic_list_read_short_empty_s, fss_basic_list_read_long_empty_s, 0, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_basic_list_read_short_line_s, fss_basic_list_read_long_line_s, 0, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_basic_list_read_short_name_s, fss_basic_list_read_long_name_s, 0, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_basic_list_read_short_object_s, fss_basic_list_read_long_object_s, 0, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_basic_list_read_short_pipe_s, fss_basic_list_read_long_pipe_s, 0, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_basic_list_read_short_original_s, fss_basic_list_read_long_original_s, 0, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_basic_list_read_short_select_s, fss_basic_list_read_long_select_s, 0, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_basic_list_read_short_total_s, fss_basic_list_read_long_total_s, 0, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_basic_list_read_short_trim_s, fss_basic_list_read_long_trim_s, 0, 0, f_console_flag_normal_e, 0), \ + macro_f_console_parameter_t_initialize_4(fss_basic_list_read_short_at_s, fss_basic_list_read_long_at_s, 0, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_basic_list_read_short_content_s, fss_basic_list_read_long_content_s, 0, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_basic_list_read_short_columns_s, fss_basic_list_read_long_columns_s, 0, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_basic_list_read_short_delimit_s, fss_basic_list_read_long_delimit_s, 0, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_basic_list_read_short_depth_s, fss_basic_list_read_long_depth_s, 0, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_basic_list_read_short_empty_s, fss_basic_list_read_long_empty_s, 0, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_basic_list_read_short_line_s, fss_basic_list_read_long_line_s, 0, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_basic_list_read_short_name_s, fss_basic_list_read_long_name_s, 0, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_basic_list_read_short_object_s, fss_basic_list_read_long_object_s, 0, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_basic_list_read_short_pipe_s, fss_basic_list_read_long_pipe_s, 0, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_basic_list_read_short_original_s, fss_basic_list_read_long_original_s, 0, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_basic_list_read_short_select_s, fss_basic_list_read_long_select_s, 0, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_basic_list_read_short_total_s, fss_basic_list_read_long_total_s, 0, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_basic_list_read_short_trim_s, fss_basic_list_read_long_trim_s, 0, 0, f_console_flag_normal_e), \ } #define fss_basic_list_read_total_parameters_d 26 diff --git a/level_3/fss_basic_list_read/c/fss_basic_list_read.c b/level_3/fss_basic_list_read/c/fss_basic_list_read.c index 4e67ee5..d4e6a58 100644 --- a/level_3/fss_basic_list_read/c/fss_basic_list_read.c +++ b/level_3/fss_basic_list_read/c/fss_basic_list_read.c @@ -13,7 +13,7 @@ extern "C" { f_status_t status = F_none; // Load parameters. - status = f_console_parameter_process(arguments, &main->parameters); + status = f_console_parameter_process(arguments, &main->parameters, 0); if (F_status_is_error(status)) return; { diff --git a/level_3/fss_basic_read/c/common.c b/level_3/fss_basic_read/c/common.c index 62e529c..4ef7867 100644 --- a/level_3/fss_basic_read/c/common.c +++ b/level_3/fss_basic_read/c/common.c @@ -77,7 +77,7 @@ extern "C" { setting->flag = 0; // Load parameters. - setting->status = f_console_parameter_process(arguments, &main->parameters); + setting->status = f_console_parameter_process(arguments, &main->parameters, 0); if (F_status_is_error(setting->status)) { fss_basic_read_print_line_first_locked(setting, main->error); diff --git a/level_3/fss_basic_read/c/common.h b/level_3/fss_basic_read/c/common.h index ad898ea..7e033fe 100644 --- a/level_3/fss_basic_read/c/common.h +++ b/level_3/fss_basic_read/c/common.h @@ -221,33 +221,33 @@ extern "C" { #define fss_basic_read_console_parameter_t_initialize \ { \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e, 0), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e, 0), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \ \ - macro_f_console_parameter_t_initialize4(fss_basic_read_short_at_s, fss_basic_read_long_at_s, 0, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_basic_read_short_content_s, fss_basic_read_long_content_s, 0, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_basic_read_short_columns_s, fss_basic_read_long_columns_s, 0, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_basic_read_short_delimit_s, fss_basic_read_long_delimit_s, 0, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_basic_read_short_depth_s, fss_basic_read_long_depth_s, 0, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_basic_read_short_empty_s, fss_basic_read_long_empty_s, 0, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_basic_read_short_line_s, fss_basic_read_long_line_s, 0, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_basic_read_short_name_s, fss_basic_read_long_name_s, 0, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_basic_read_short_object_s, fss_basic_read_long_object_s, 0, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_basic_read_short_pipe_s, fss_basic_read_long_pipe_s, 0, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_basic_read_short_original_s, fss_basic_read_long_original_s, 0, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_basic_read_short_select_s, fss_basic_read_long_select_s, 0, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_basic_read_short_total_s, fss_basic_read_long_total_s, 0, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_basic_read_short_trim_s, fss_basic_read_long_trim_s, 0, 0, f_console_flag_normal_e, 0), \ + macro_f_console_parameter_t_initialize_4(fss_basic_read_short_at_s, fss_basic_read_long_at_s, 0, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_basic_read_short_content_s, fss_basic_read_long_content_s, 0, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_basic_read_short_columns_s, fss_basic_read_long_columns_s, 0, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_basic_read_short_delimit_s, fss_basic_read_long_delimit_s, 0, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_basic_read_short_depth_s, fss_basic_read_long_depth_s, 0, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_basic_read_short_empty_s, fss_basic_read_long_empty_s, 0, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_basic_read_short_line_s, fss_basic_read_long_line_s, 0, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_basic_read_short_name_s, fss_basic_read_long_name_s, 0, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_basic_read_short_object_s, fss_basic_read_long_object_s, 0, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_basic_read_short_pipe_s, fss_basic_read_long_pipe_s, 0, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_basic_read_short_original_s, fss_basic_read_long_original_s, 0, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_basic_read_short_select_s, fss_basic_read_long_select_s, 0, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_basic_read_short_total_s, fss_basic_read_long_total_s, 0, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_basic_read_short_trim_s, fss_basic_read_long_trim_s, 0, 0, f_console_flag_normal_e), \ } #define fss_basic_read_total_parameters_d 26 diff --git a/level_3/fss_basic_read/c/fss_basic_read.c b/level_3/fss_basic_read/c/fss_basic_read.c index 27d0b8c..bf88889 100644 --- a/level_3/fss_basic_read/c/fss_basic_read.c +++ b/level_3/fss_basic_read/c/fss_basic_read.c @@ -13,7 +13,7 @@ extern "C" { f_status_t status = F_none; // Load parameters. - status = f_console_parameter_process(arguments, &main->parameters); + status = f_console_parameter_process(arguments, &main->parameters, 0); if (F_status_is_error(status)) return; { diff --git a/level_3/fss_embedded_list_read/c/common.c b/level_3/fss_embedded_list_read/c/common.c index 3a22cea..ec94e84 100644 --- a/level_3/fss_embedded_list_read/c/common.c +++ b/level_3/fss_embedded_list_read/c/common.c @@ -76,7 +76,7 @@ extern "C" { setting->flag = 0; // Load parameters. - setting->status = f_console_parameter_process(arguments, &main->parameters); + setting->status = f_console_parameter_process(arguments, &main->parameters, 0); if (F_status_is_error(setting->status)) { fss_embedded_list_read_print_line_first_locked(setting, main->error); diff --git a/level_3/fss_embedded_list_read/c/common.h b/level_3/fss_embedded_list_read/c/common.h index 1fcde39..88afdf8 100644 --- a/level_3/fss_embedded_list_read/c/common.h +++ b/level_3/fss_embedded_list_read/c/common.h @@ -221,33 +221,33 @@ extern "C" { #define fss_embedded_list_read_console_parameter_t_initialize \ { \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e, 0), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e, 0), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \ \ - macro_f_console_parameter_t_initialize4(fss_embedded_list_read_short_at_s.string, fss_embedded_list_read_long_at_s.string, 0, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_embedded_list_read_short_content_s.string, fss_embedded_list_read_long_content_s.string, 0, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_embedded_list_read_short_columns_s.string, fss_embedded_list_read_long_columns_s.string, 0, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_embedded_list_read_short_delimit_s.string, fss_embedded_list_read_long_delimit_s.string, 0, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_embedded_list_read_short_depth_s.string, fss_embedded_list_read_long_depth_s.string, 0, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_embedded_list_read_short_empty_s.string, fss_embedded_list_read_long_empty_s.string, 0, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_embedded_list_read_short_line_s.string, fss_embedded_list_read_long_line_s.string, 0, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_embedded_list_read_short_name_s.string, fss_embedded_list_read_long_name_s.string, 0, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_embedded_list_read_short_object_s.string, fss_embedded_list_read_long_object_s.string, 0, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_embedded_list_read_short_pipe_s.string, fss_embedded_list_read_long_pipe_s.string, 0, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_embedded_list_read_short_original_s.string, fss_embedded_list_read_long_original_s.string, 0, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_embedded_list_read_short_select_s.string, fss_embedded_list_read_long_select_s.string, 0, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_embedded_list_read_short_total_s.string, fss_embedded_list_read_long_total_s.string, 0, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_embedded_list_read_short_trim_s.string, fss_embedded_list_read_long_trim_s.string, 0, 0, f_console_flag_normal_e, 0), \ + macro_f_console_parameter_t_initialize_4(fss_embedded_list_read_short_at_s.string, fss_embedded_list_read_long_at_s.string, 0, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_embedded_list_read_short_content_s.string, fss_embedded_list_read_long_content_s.string, 0, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_embedded_list_read_short_columns_s.string, fss_embedded_list_read_long_columns_s.string, 0, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_embedded_list_read_short_delimit_s.string, fss_embedded_list_read_long_delimit_s.string, 0, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_embedded_list_read_short_depth_s.string, fss_embedded_list_read_long_depth_s.string, 0, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_embedded_list_read_short_empty_s.string, fss_embedded_list_read_long_empty_s.string, 0, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_embedded_list_read_short_line_s.string, fss_embedded_list_read_long_line_s.string, 0, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_embedded_list_read_short_name_s.string, fss_embedded_list_read_long_name_s.string, 0, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_embedded_list_read_short_object_s.string, fss_embedded_list_read_long_object_s.string, 0, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_embedded_list_read_short_pipe_s.string, fss_embedded_list_read_long_pipe_s.string, 0, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_embedded_list_read_short_original_s.string, fss_embedded_list_read_long_original_s.string, 0, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_embedded_list_read_short_select_s.string, fss_embedded_list_read_long_select_s.string, 0, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_embedded_list_read_short_total_s.string, fss_embedded_list_read_long_total_s.string, 0, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_embedded_list_read_short_trim_s.string, fss_embedded_list_read_long_trim_s.string, 0, 0, f_console_flag_normal_e), \ } #define fss_embedded_list_read_total_parameters_d 26 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 9858565..5abcaa3 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 @@ -13,7 +13,7 @@ extern "C" { f_status_t status = F_none; // Load parameters. - status = f_console_parameter_process(arguments, &main->parameters); + status = f_console_parameter_process(arguments, &main->parameters, 0); if (F_status_is_error(status)) return; { diff --git a/level_3/fss_extended_list_read/c/common.c b/level_3/fss_extended_list_read/c/common.c index fe6aa5e..7a032e7 100644 --- a/level_3/fss_extended_list_read/c/common.c +++ b/level_3/fss_extended_list_read/c/common.c @@ -84,7 +84,7 @@ extern "C" { setting->flag = 0; // Load parameters. - setting->status = f_console_parameter_process(arguments, &main->parameters); + setting->status = f_console_parameter_process(arguments, &main->parameters, 0); if (F_status_is_error(setting->status)) { fss_extended_list_read_print_line_first_locked(setting, main->error); diff --git a/level_3/fss_extended_list_read/c/common.h b/level_3/fss_extended_list_read/c/common.h index 05d255c..ce09c89 100644 --- a/level_3/fss_extended_list_read/c/common.h +++ b/level_3/fss_extended_list_read/c/common.h @@ -221,33 +221,33 @@ extern "C" { #define fss_extended_list_read_console_parameter_t_initialize \ { \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e, 0), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e, 0), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \ \ - macro_f_console_parameter_t_initialize4(fss_extended_list_read_short_at_s, fss_extended_list_read_long_at_s, 0, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_extended_list_read_short_content_s, fss_extended_list_read_long_content_s, 0, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_extended_list_read_short_columns_s, fss_extended_list_read_long_columns_s, 0, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_extended_list_read_short_delimit_s, fss_extended_list_read_long_delimit_s, 0, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_extended_list_read_short_depth_s, fss_extended_list_read_long_depth_s, 0, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_extended_list_read_short_empty_s, fss_extended_list_read_long_empty_s, 0, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_extended_list_read_short_line_s, fss_extended_list_read_long_line_s, 0, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_extended_list_read_short_name_s, fss_extended_list_read_long_name_s, 0, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_extended_list_read_short_object_s, fss_extended_list_read_long_object_s, 0, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_extended_list_read_short_pipe_s, fss_extended_list_read_long_pipe_s, 0, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_extended_list_read_short_original_s, fss_extended_list_read_long_original_s, 0, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_extended_list_read_short_select_s, fss_extended_list_read_long_select_s, 0, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_extended_list_read_short_total_s, fss_extended_list_read_long_total_s, 0, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_extended_list_read_short_trim_s, fss_extended_list_read_long_trim_s, 0, 0, f_console_flag_normal_e, 0), \ + macro_f_console_parameter_t_initialize_4(fss_extended_list_read_short_at_s, fss_extended_list_read_long_at_s, 0, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_extended_list_read_short_content_s, fss_extended_list_read_long_content_s, 0, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_extended_list_read_short_columns_s, fss_extended_list_read_long_columns_s, 0, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_extended_list_read_short_delimit_s, fss_extended_list_read_long_delimit_s, 0, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_extended_list_read_short_depth_s, fss_extended_list_read_long_depth_s, 0, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_extended_list_read_short_empty_s, fss_extended_list_read_long_empty_s, 0, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_extended_list_read_short_line_s, fss_extended_list_read_long_line_s, 0, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_extended_list_read_short_name_s, fss_extended_list_read_long_name_s, 0, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_extended_list_read_short_object_s, fss_extended_list_read_long_object_s, 0, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_extended_list_read_short_pipe_s, fss_extended_list_read_long_pipe_s, 0, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_extended_list_read_short_original_s, fss_extended_list_read_long_original_s, 0, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_extended_list_read_short_select_s, fss_extended_list_read_long_select_s, 0, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_extended_list_read_short_total_s, fss_extended_list_read_long_total_s, 0, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_extended_list_read_short_trim_s, fss_extended_list_read_long_trim_s, 0, 0, f_console_flag_normal_e), \ } #define fss_extended_list_read_total_parameters_d 26 diff --git a/level_3/fss_extended_list_read/c/fss_extended_list_read.c b/level_3/fss_extended_list_read/c/fss_extended_list_read.c index 474eb19..a2e2629 100644 --- a/level_3/fss_extended_list_read/c/fss_extended_list_read.c +++ b/level_3/fss_extended_list_read/c/fss_extended_list_read.c @@ -13,7 +13,7 @@ extern "C" { f_status_t status = F_none; // Load parameters. - status = f_console_parameter_process(arguments, &main->parameters); + status = f_console_parameter_process(arguments, &main->parameters, 0); if (F_status_is_error(status)) return; { diff --git a/level_3/fss_extended_read/c/common.c b/level_3/fss_extended_read/c/common.c index 13a0d14..d4c02f6 100644 --- a/level_3/fss_extended_read/c/common.c +++ b/level_3/fss_extended_read/c/common.c @@ -77,7 +77,7 @@ extern "C" { setting->flag = 0; // Load parameters. - setting->status = f_console_parameter_process(arguments, &main->parameters); + setting->status = f_console_parameter_process(arguments, &main->parameters, 0); if (F_status_is_error(setting->status)) { fss_extended_read_print_line_first_locked(setting, main->error); diff --git a/level_3/fss_extended_read/c/common.h b/level_3/fss_extended_read/c/common.h index 1ffdec2..5cbf2dd 100644 --- a/level_3/fss_extended_read/c/common.h +++ b/level_3/fss_extended_read/c/common.h @@ -221,32 +221,32 @@ extern "C" { #define fss_extended_read_console_parameter_t_initialize \ { \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e, 0), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e, 0), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \ \ - macro_f_console_parameter_t_initialize4(fss_extended_read_short_content_s, fss_extended_read_long_content_s, 0, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_extended_read_short_columns_s, fss_extended_read_long_columns_s, 0, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_extended_read_short_delimit_s, fss_extended_read_long_delimit_s, 0, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_extended_read_short_depth_s, fss_extended_read_long_depth_s, 0, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_extended_read_short_empty_s, fss_extended_read_long_empty_s, 0, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_extended_read_short_line_s, fss_extended_read_long_line_s, 0, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_extended_read_short_name_s, fss_extended_read_long_name_s, 0, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_extended_read_short_object_s, fss_extended_read_long_object_s, 0, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_extended_read_short_pipe_s, fss_extended_read_long_pipe_s, 0, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_extended_read_short_original_s, fss_extended_read_long_original_s, 0, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_extended_read_short_select_s, fss_extended_read_long_select_s, 0, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_extended_read_short_total_s, fss_extended_read_long_total_s, 0, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_extended_read_short_trim_s, fss_extended_read_long_trim_s, 0, 0, f_console_flag_normal_e, 0), \ + macro_f_console_parameter_t_initialize_4(fss_extended_read_short_content_s, fss_extended_read_long_content_s, 0, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_extended_read_short_columns_s, fss_extended_read_long_columns_s, 0, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_extended_read_short_delimit_s, fss_extended_read_long_delimit_s, 0, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_extended_read_short_depth_s, fss_extended_read_long_depth_s, 0, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_extended_read_short_empty_s, fss_extended_read_long_empty_s, 0, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_extended_read_short_line_s, fss_extended_read_long_line_s, 0, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_extended_read_short_name_s, fss_extended_read_long_name_s, 0, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_extended_read_short_object_s, fss_extended_read_long_object_s, 0, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_extended_read_short_pipe_s, fss_extended_read_long_pipe_s, 0, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_extended_read_short_original_s, fss_extended_read_long_original_s, 0, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_extended_read_short_select_s, fss_extended_read_long_select_s, 0, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_extended_read_short_total_s, fss_extended_read_long_total_s, 0, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_extended_read_short_trim_s, fss_extended_read_long_trim_s, 0, 0, f_console_flag_normal_e), \ } #define fss_extended_read_total_parameters_d 26 diff --git a/level_3/fss_extended_read/c/fss_extended_read.c b/level_3/fss_extended_read/c/fss_extended_read.c index 0eac24c..1f80de3 100644 --- a/level_3/fss_extended_read/c/fss_extended_read.c +++ b/level_3/fss_extended_read/c/fss_extended_read.c @@ -13,7 +13,7 @@ extern "C" { f_status_t status = F_none; // Load parameters. - status = f_console_parameter_process(arguments, &main->parameters); + status = f_console_parameter_process(arguments, &main->parameters, 0); if (F_status_is_error(status)) return; { diff --git a/level_3/fss_identify/c/common.c b/level_3/fss_identify/c/common.c index 1a305cb..ec308c3 100644 --- a/level_3/fss_identify/c/common.c +++ b/level_3/fss_identify/c/common.c @@ -44,7 +44,7 @@ extern "C" { setting->flag = 0; // Load parameters. - setting->status = f_console_parameter_process(arguments, &main->parameters); + setting->status = f_console_parameter_process(arguments, &main->parameters, 0); if (F_status_is_error(setting->status)) { fss_identify_print_line_first_locked(setting, main->error); diff --git a/level_3/fss_identify/c/common.h b/level_3/fss_identify/c/common.h index a2f8a88..e08dac8 100644 --- a/level_3/fss_identify/c/common.h +++ b/level_3/fss_identify/c/common.h @@ -129,24 +129,24 @@ extern "C" { #define fss_identify_console_parameter_t_initialize \ { \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e, 0), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e, 0), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \ \ - macro_f_console_parameter_t_initialize4(fss_identify_short_content_s, fss_identify_long_content_s, 0, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_identify_short_line_s, fss_identify_long_line_s, 0, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_identify_short_name_s, fss_identify_long_name_s, 0, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_identify_short_object_s, fss_identify_long_object_s, 0, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_identify_short_total_s, fss_identify_long_total_s, 0, 0, f_console_flag_normal_e, 0), \ + macro_f_console_parameter_t_initialize_4(fss_identify_short_content_s, fss_identify_long_content_s, 0, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_identify_short_line_s, fss_identify_long_line_s, 0, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_identify_short_name_s, fss_identify_long_name_s, 0, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_identify_short_object_s, fss_identify_long_object_s, 0, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_identify_short_total_s, fss_identify_long_total_s, 0, 0, f_console_flag_normal_e), \ } #define fss_identify_total_parameters_d 17 diff --git a/level_3/fss_identify/c/fss_identify.c b/level_3/fss_identify/c/fss_identify.c index 395d36b..a537fb3 100644 --- a/level_3/fss_identify/c/fss_identify.c +++ b/level_3/fss_identify/c/fss_identify.c @@ -12,7 +12,7 @@ extern "C" { f_status_t status = F_none; // Load parameters. - status = f_console_parameter_process(arguments, &main->parameters); + status = f_console_parameter_process(arguments, &main->parameters, 0); if (F_status_is_error(status)) return; { diff --git a/level_3/fss_payload_read/c/common.c b/level_3/fss_payload_read/c/common.c index 6178370..f705c95 100644 --- a/level_3/fss_payload_read/c/common.c +++ b/level_3/fss_payload_read/c/common.c @@ -78,7 +78,7 @@ extern "C" { setting->flag = 0; // Load parameters. - setting->status = f_console_parameter_process(arguments, &main->parameters); + setting->status = f_console_parameter_process(arguments, &main->parameters, 0); if (F_status_is_error(setting->status)) { fss_payload_read_print_line_first_locked(setting, main->error); diff --git a/level_3/fss_payload_read/c/common.h b/level_3/fss_payload_read/c/common.h index df54e4c..acd48aa 100644 --- a/level_3/fss_payload_read/c/common.h +++ b/level_3/fss_payload_read/c/common.h @@ -215,33 +215,33 @@ extern "C" { #define fss_payload_read_console_parameter_t_initialize \ { \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e, 0), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e, 0), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \ \ - macro_f_console_parameter_t_initialize4(fss_payload_read_short_at_s, fss_payload_read_long_at_s, 0, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_payload_read_short_content_s, fss_payload_read_long_content_s, 0, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_payload_read_short_columns_s, fss_payload_read_long_columns_s, 0, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_payload_read_short_delimit_s, fss_payload_read_long_delimit_s, 0, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_payload_read_short_depth_s, fss_payload_read_long_depth_s, 0, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_payload_read_short_empty_s, fss_payload_read_long_empty_s, 0, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_payload_read_short_line_s, fss_payload_read_long_line_s, 0, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_payload_read_short_name_s, fss_payload_read_long_name_s, 0, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_payload_read_short_object_s, fss_payload_read_long_object_s, 0, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_payload_read_short_pipe_s, fss_payload_read_long_pipe_s, 0, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_payload_read_short_original_s, fss_payload_read_long_original_s, 0, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_payload_read_short_select_s, fss_payload_read_long_select_s, 0, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_payload_read_short_total_s, fss_payload_read_long_total_s, 0, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_payload_read_short_trim_s, fss_payload_read_long_trim_s, 0, 0, f_console_flag_normal_e, 0), \ + macro_f_console_parameter_t_initialize_4(fss_payload_read_short_at_s, fss_payload_read_long_at_s, 0, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_payload_read_short_content_s, fss_payload_read_long_content_s, 0, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_payload_read_short_columns_s, fss_payload_read_long_columns_s, 0, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_payload_read_short_delimit_s, fss_payload_read_long_delimit_s, 0, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_payload_read_short_depth_s, fss_payload_read_long_depth_s, 0, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_payload_read_short_empty_s, fss_payload_read_long_empty_s, 0, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_payload_read_short_line_s, fss_payload_read_long_line_s, 0, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_payload_read_short_name_s, fss_payload_read_long_name_s, 0, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_payload_read_short_object_s, fss_payload_read_long_object_s, 0, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_payload_read_short_pipe_s, fss_payload_read_long_pipe_s, 0, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_payload_read_short_original_s, fss_payload_read_long_original_s, 0, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_payload_read_short_select_s, fss_payload_read_long_select_s, 0, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_payload_read_short_total_s, fss_payload_read_long_total_s, 0, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_payload_read_short_trim_s, fss_payload_read_long_trim_s, 0, 0, f_console_flag_normal_e), \ } #define fss_payload_read_total_parameters_d 26 diff --git a/level_3/fss_payload_read/c/fss_payload_read.c b/level_3/fss_payload_read/c/fss_payload_read.c index f20813f..ec6bef9 100644 --- a/level_3/fss_payload_read/c/fss_payload_read.c +++ b/level_3/fss_payload_read/c/fss_payload_read.c @@ -13,7 +13,7 @@ extern "C" { f_status_t status = F_none; // Load parameters. - status = f_console_parameter_process(arguments, &main->parameters); + status = f_console_parameter_process(arguments, &main->parameters, 0); if (F_status_is_error(status)) return; { diff --git a/level_3/fss_write/c/main/common.c b/level_3/fss_write/c/main/common.c index a9534c0..805211b 100644 --- a/level_3/fss_write/c/main/common.c +++ b/level_3/fss_write/c/main/common.c @@ -79,7 +79,7 @@ extern "C" { if (!main || !setting) return; // Load parameters. - setting->status = f_console_parameter_process(arguments, &main->parameters); + setting->status = f_console_parameter_process(arguments, &main->parameters, 0); if (F_status_is_error(setting->status)) { fss_write_print_error(setting, main->error, macro_fss_write_f(f_console_parameter_process)); diff --git a/level_3/fss_write/c/main/common.h b/level_3/fss_write/c/main/common.h index 3d9b9e6..c89455e 100644 --- a/level_3/fss_write/c/main/common.h +++ b/level_3/fss_write/c/main/common.h @@ -251,33 +251,33 @@ extern "C" { #define fss_write_console_parameter_t_initialize \ { \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e, 0), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \ \ - macro_f_console_parameter_t_initialize4(fss_write_short_as_s, fss_write_long_as_s, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_write_short_backtick_s, fss_write_long_backtick_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_write_short_content_s, fss_write_long_content_s, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_write_short_content_end_s, fss_write_long_content_end_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_write_short_content_next_s, fss_write_long_content_next_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_write_short_double_s, fss_write_long_double_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_write_short_file_s, fss_write_long_file_s, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_write_short_ignore_s, fss_write_long_ignore_s, 2, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_write_short_object_s, fss_write_long_object_s, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_write_short_object_open_s, fss_write_long_object_open_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_write_short_partial_s, fss_write_long_partial_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_write_short_prepend_s, fss_write_long_prepend_s, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_write_short_single_s, fss_write_long_single_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(fss_write_short_trim_s, fss_write_long_trim_s, 0, f_console_flag_normal_e, 0), \ + macro_f_console_parameter_t_initialize_4(fss_write_short_as_s, fss_write_long_as_s, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_write_short_backtick_s, fss_write_long_backtick_s, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_write_short_content_s, fss_write_long_content_s, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_write_short_content_end_s, fss_write_long_content_end_s, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_write_short_content_next_s, fss_write_long_content_next_s, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_write_short_double_s, fss_write_long_double_s, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_write_short_file_s, fss_write_long_file_s, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_write_short_ignore_s, fss_write_long_ignore_s, 2, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_write_short_object_s, fss_write_long_object_s, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_write_short_object_open_s, fss_write_long_object_open_s, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_write_short_partial_s, fss_write_long_partial_s, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_write_short_prepend_s, fss_write_long_prepend_s, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_write_short_single_s, fss_write_long_single_s, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(fss_write_short_trim_s, fss_write_long_trim_s, 0, f_console_flag_normal_e), \ } #define fss_write_total_parameters_d 26 diff --git a/level_3/iki_read/c/main/common.c b/level_3/iki_read/c/main/common.c index a411a46..c37dcbe 100644 --- a/level_3/iki_read/c/main/common.c +++ b/level_3/iki_read/c/main/common.c @@ -82,7 +82,7 @@ extern "C" { setting->flag = 0; // Load parameters. - setting->status = f_console_parameter_process(arguments, &main->parameters); + setting->status = f_console_parameter_process(arguments, &main->parameters, 0); if (F_status_is_error(setting->status)) { iki_read_print_error(setting, main->error, macro_iki_read_f(f_console_parameter_process)); diff --git a/level_3/iki_read/c/main/common.h b/level_3/iki_read/c/main/common.h index 39e4379..278184b 100644 --- a/level_3/iki_read/c/main/common.h +++ b/level_3/iki_read/c/main/common.h @@ -192,31 +192,31 @@ extern "C" { #define iki_read_console_parameter_t_initialize \ { \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e, 0), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \ \ - macro_f_console_parameter_t_initialize4(iki_read_short_at_s, iki_read_long_at_s, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(iki_read_short_content_s, iki_read_long_content_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(iki_read_short_line_s, iki_read_long_line_s, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(iki_read_short_literal_s, iki_read_long_literal_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(iki_read_short_name_s, iki_read_long_name_s, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(iki_read_short_object_s, iki_read_long_object_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(iki_read_short_reassign_s, iki_read_long_reassign_s, 3, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(iki_read_short_replace_s, iki_read_long_replace_s, 2, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(iki_read_short_substitute_s, iki_read_long_substitute_s, 3, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(iki_read_short_total_s, iki_read_long_total_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(iki_read_short_whole_s, iki_read_long_whole_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(iki_read_short_wrap_s, iki_read_long_wrap_s, 3, f_console_flag_normal_e, 0), \ + macro_f_console_parameter_t_initialize_4(iki_read_short_at_s, iki_read_long_at_s, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(iki_read_short_content_s, iki_read_long_content_s, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(iki_read_short_line_s, iki_read_long_line_s, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(iki_read_short_literal_s, iki_read_long_literal_s, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(iki_read_short_name_s, iki_read_long_name_s, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(iki_read_short_object_s, iki_read_long_object_s, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(iki_read_short_reassign_s, iki_read_long_reassign_s, 3, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(iki_read_short_replace_s, iki_read_long_replace_s, 2, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(iki_read_short_substitute_s, iki_read_long_substitute_s, 3, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(iki_read_short_total_s, iki_read_long_total_s, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(iki_read_short_whole_s, iki_read_long_whole_s, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(iki_read_short_wrap_s, iki_read_long_wrap_s, 3, f_console_flag_normal_e), \ } #define iki_read_total_parameters_d 24 diff --git a/level_3/iki_write/c/main/common.c b/level_3/iki_write/c/main/common.c index a05d3f3..5559439 100644 --- a/level_3/iki_write/c/main/common.c +++ b/level_3/iki_write/c/main/common.c @@ -58,7 +58,7 @@ extern "C" { setting->flag = 0; // Load parameters. - setting->status = f_console_parameter_process(arguments, &main->parameters); + setting->status = f_console_parameter_process(arguments, &main->parameters, 0); if (F_status_is_error(setting->status)) { iki_write_print_error(setting, main->error, macro_iki_write_f(f_console_parameter_process)); diff --git a/level_3/iki_write/c/main/common.h b/level_3/iki_write/c/main/common.h index 5afa646..3517dc9 100644 --- a/level_3/iki_write/c/main/common.h +++ b/level_3/iki_write/c/main/common.h @@ -147,25 +147,25 @@ extern "C" { #define iki_write_console_parameter_t_initialize \ { \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e, 0), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \ \ - macro_f_console_parameter_t_initialize4(iki_write_short_backtick_s, iki_write_long_backtick_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(iki_write_short_content_s, iki_write_long_content_s, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(iki_write_short_double_s, iki_write_long_double_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(iki_write_short_file_s, iki_write_long_file_s, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(iki_write_short_object_s, iki_write_long_object_s, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(iki_write_short_single_s, iki_write_long_single_s, 0, f_console_flag_normal_e, 0), \ + macro_f_console_parameter_t_initialize_4(iki_write_short_backtick_s, iki_write_long_backtick_s, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(iki_write_short_content_s, iki_write_long_content_s, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(iki_write_short_double_s, iki_write_long_double_s, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(iki_write_short_file_s, iki_write_long_file_s, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(iki_write_short_object_s, iki_write_long_object_s, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(iki_write_short_single_s, iki_write_long_single_s, 0, f_console_flag_normal_e), \ } #define iki_write_total_parameters_d 18 diff --git a/level_3/status_code/c/main/common.c b/level_3/status_code/c/main/common.c index cc5cd74..94df8ff 100644 --- a/level_3/status_code/c/main/common.c +++ b/level_3/status_code/c/main/common.c @@ -54,7 +54,7 @@ extern "C" { if (!main || !setting) return; // Load parameters. - setting->status = f_console_parameter_process(arguments, &main->parameters); + setting->status = f_console_parameter_process(arguments, &main->parameters, 0); if (F_status_is_error(setting->status)) { status_code_print_error(setting, main->error, macro_status_code_f(f_console_parameter_process)); diff --git a/level_3/status_code/c/main/common.h b/level_3/status_code/c/main/common.h index c473871..a09ca00 100644 --- a/level_3/status_code/c/main/common.h +++ b/level_3/status_code/c/main/common.h @@ -168,23 +168,23 @@ extern "C" { #define status_code_console_parameter_t_initialize \ { \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e, 0), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \ \ - macro_f_console_parameter_t_initialize4(status_code_short_fine_s, status_code_long_fine_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(status_code_short_warning_s, status_code_long_warning_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(status_code_short_error_s, status_code_long_error_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(status_code_short_number_s, status_code_long_number_s, 0, f_console_flag_normal_e, 0), \ + macro_f_console_parameter_t_initialize_4(status_code_short_fine_s, status_code_long_fine_s, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(status_code_short_warning_s, status_code_long_warning_s, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(status_code_short_error_s, status_code_long_error_s, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(status_code_short_number_s, status_code_long_number_s, 0, f_console_flag_normal_e), \ } #define status_code_total_parameters_d 16 diff --git a/level_3/utf8/c/main/common.c b/level_3/utf8/c/main/common.c index 23fe00e..b797888 100644 --- a/level_3/utf8/c/main/common.c +++ b/level_3/utf8/c/main/common.c @@ -95,7 +95,7 @@ extern "C" { setting->flag = 0; // Load parameters. - setting->status = f_console_parameter_process(arguments, &main->parameters); + setting->status = f_console_parameter_process(arguments, &main->parameters, 0); if (F_status_is_error(setting->status)) { utf8_print_error(setting, main->error, macro_utf8_f(f_console_parameter_process)); @@ -376,10 +376,10 @@ extern "C" { if (main->parameters.remaining.used) { setting->remaining.used = 0; - setting->status = f_string_dynamics_resize(main->parameters.remaining.used, &setting->remaining); + setting->status = f_string_dynamics_increase_by(main->parameters.remaining.used, &setting->remaining); if (F_status_is_error(setting->status)) { - utf8_print_error(setting, main->error, macro_utf8_f(f_string_dynamic_append_nulless)); + utf8_print_error(setting, main->error, macro_utf8_f(f_string_dynamics_increase_by)); return; } diff --git a/level_3/utf8/c/main/common.h b/level_3/utf8/c/main/common.h index 11e3163..c1a0084 100644 --- a/level_3/utf8/c/main/common.h +++ b/level_3/utf8/c/main/common.h @@ -275,31 +275,31 @@ extern "C" { #define utf8_console_parameter_t_initialize \ { \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e, 0), \ - macro_f_console_parameter_t_initialize4(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e, 0), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \ \ - macro_f_console_parameter_t_initialize4(utf8_short_from_bytesequence_s, utf8_long_from_bytesequence_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(utf8_short_from_codepoint_s, utf8_long_from_codepoint_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(utf8_short_from_file_s, utf8_long_from_file_s, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(utf8_short_headers_s, utf8_long_headers_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(utf8_short_separate_s, utf8_long_separate_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(utf8_short_strip_invalid_s, utf8_long_strip_invalid_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(utf8_short_to_bytesequence_s, utf8_long_to_bytesequence_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(utf8_short_to_codepoint_s, utf8_long_to_codepoint_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(utf8_short_to_combining_s, utf8_long_to_combining_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(utf8_short_to_file_s, utf8_long_to_file_s, 1, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(utf8_short_to_width_s, utf8_long_to_width_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize4(utf8_short_verify_s, utf8_long_verify_s, 0, f_console_flag_normal_e, 0), \ + macro_f_console_parameter_t_initialize_4(utf8_short_from_bytesequence_s, utf8_long_from_bytesequence_s, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(utf8_short_from_codepoint_s, utf8_long_from_codepoint_s, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(utf8_short_from_file_s, utf8_long_from_file_s, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(utf8_short_headers_s, utf8_long_headers_s, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(utf8_short_separate_s, utf8_long_separate_s, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(utf8_short_strip_invalid_s, utf8_long_strip_invalid_s, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(utf8_short_to_bytesequence_s, utf8_long_to_bytesequence_s, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(utf8_short_to_codepoint_s, utf8_long_to_codepoint_s, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(utf8_short_to_combining_s, utf8_long_to_combining_s, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(utf8_short_to_file_s, utf8_long_to_file_s, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(utf8_short_to_width_s, utf8_long_to_width_s, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_4(utf8_short_verify_s, utf8_long_verify_s, 0, f_console_flag_normal_e), \ } #define utf8_total_parameters_d 24 diff --git a/level_3/utf8/c/main/print.c b/level_3/utf8/c/main/print.c index 5a6f19e..1a052dd 100644 --- a/level_3/utf8/c/main/print.c +++ b/level_3/utf8/c/main/print.c @@ -354,6 +354,12 @@ extern "C" { fll_print_dynamic_raw(setting->line_last, print.to); + // Two lines are printed because the normal final end of line is never printed by design. + // If this is an error or the header flag is set, then the normal end of line is printed by design so do not print this second new line. + if (F_status_is_error_not(setting->status) && !(setting->flag & utf8_main_flag_header_e)) { + fll_print_dynamic_raw(setting->line_last, print.to); + } + return F_none; } #endif // _di_utf8_print_line_last_locked_ diff --git a/level_3/utf8/c/main/utf8.c b/level_3/utf8/c/main/utf8.c index 3777d10..bdd2066 100644 --- a/level_3/utf8/c/main/utf8.c +++ b/level_3/utf8/c/main/utf8.c @@ -33,6 +33,10 @@ extern "C" { return; } + if (!(setting->flag & utf8_main_flag_header_e)) { + utf8_print_line_first_locked(setting, main->message); + } + f_status_t valid = F_true; if (main->pipe & fll_program_data_pipe_input_e) { @@ -149,22 +153,6 @@ extern "C" { setting->status = utf8_process_text(main, setting, main->parameters.arguments.array[main->parameters.remaining.array[i]]); - if (setting->mode & utf8_mode_to_bytesequence_e) { - if (setting->flag & utf8_main_flag_header_e) { - fll_print_dynamic_raw(f_string_eol_s, main->output.to); - } - else if ((setting->flag & utf8_main_flag_separate_e) && i + 1 < main->parameters.remaining.used) { - fll_print_dynamic_raw(f_string_eol_s, main->output.to); - } - } - else { - if (!(setting->flag & (utf8_main_flag_file_to_e | utf8_main_flag_header_e | utf8_main_flag_verify_e))) { - if (!(setting->flag & utf8_main_flag_separate_e)) { - fll_print_dynamic_raw(f_string_eol_s, main->output.to); - } - } - } - if (setting->flag & utf8_main_flag_verify_e) { if (setting->status == F_false) { valid = F_false;