From 63886148a82ca47d0caf34eea5c3192d1c668405 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Tue, 30 Jul 2024 19:25:17 -0500 Subject: [PATCH] Update: Remove the ++first and ++last parameters and relating logic. --- sources/c/remove/main/common.c | 12 ---------- sources/c/remove/main/common/enumeration.h | 36 +++++++++++++---------------- sources/c/remove/main/remove.c | 22 +----------------- sources/c/tacocat/main/common.c | 31 ------------------------- sources/c/tacocat/main/common/define.h | 14 ----------- sources/c/tacocat/main/common/enumeration.h | 20 +++++++--------- sources/c/tacocat/main/tacocat.c | 18 +-------------- 7 files changed, 26 insertions(+), 127 deletions(-) diff --git a/sources/c/remove/main/common.c b/sources/c/remove/main/common.c index c12ade3..357b449 100644 --- a/sources/c/remove/main/common.c +++ b/sources/c/remove/main/common.c @@ -58,10 +58,6 @@ extern "C" { main->setting.state.step_small = kt_remove_allocation_small_d; if (F_status_is_error(main->setting.state.status)) { - if ((main->setting.flag & kt_remove_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { - fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); - } - kt_remove_print_error(&main->program.error, macro_kt_remove_f(f_console_parameter_process)); return; @@ -81,10 +77,6 @@ extern "C" { main->setting.state.status = fll_program_parameter_process_context(choices, modes, F_true, &main->program); if (F_status_is_error(main->setting.state.status)) { - if ((main->setting.flag & kt_remove_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { - fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); - } - kt_remove_print_error(&main->program.error, macro_kt_remove_f(fll_program_parameter_process_context)); return; @@ -102,10 +94,6 @@ extern "C" { main->setting.state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, &main->program); if (F_status_is_error(main->setting.state.status)) { - if ((main->setting.flag & kt_remove_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { - fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); - } - kt_remove_print_error(&main->program.error, macro_kt_remove_f(fll_program_parameter_process_verbosity)); return; diff --git a/sources/c/remove/main/common/enumeration.h b/sources/c/remove/main/common/enumeration.h index e4093a6..e95a23c 100644 --- a/sources/c/remove/main/common/enumeration.h +++ b/sources/c/remove/main/common/enumeration.h @@ -43,8 +43,6 @@ extern "C" { * - link: Remove by file type: link. * - mode: Remove by mode. * - option_used: This gets set when when certain options are specified to toggle the default match detection boolean during removal of each file. - * - print_first: When set, print new line to message output on program begin after loading settings. - * - print_last: When set, print new line to message output on program end. * - prompt_all: Operate in interactive mode, prompting for every file. * - prompt_follow: Operate in interactive mode: prompting for every link that is being followed. * - prompt_never: Do not operate in interactive mode. @@ -86,23 +84,21 @@ extern "C" { kt_remove_main_flag_link_e = 0x80000, kt_remove_main_flag_mode_e = 0x100000, kt_remove_main_flag_option_used_e = 0x200000, - kt_remove_main_flag_print_first_e = 0x400000, - kt_remove_main_flag_print_last_e = 0x800000, - kt_remove_main_flag_prompt_all_e = 0x1000000, - kt_remove_main_flag_prompt_follow_e = 0x2000000, - kt_remove_main_flag_prompt_never_e = 0x4000000, - kt_remove_main_flag_prompt_once_e = 0x8000000, - kt_remove_main_flag_recurse_e = 0x10000000, - kt_remove_main_flag_regular_e = 0x20000000, - kt_remove_main_flag_same_e = 0x40000000, - kt_remove_main_flag_simulate_e = 0x80000000, - kt_remove_main_flag_socket_e = 0x100000000, - kt_remove_main_flag_tree_e = 0x200000000, - kt_remove_main_flag_updated_e = 0x400000000, - kt_remove_main_flag_user_e = 0x800000000, - kt_remove_main_flag_utc_e = 0x1000000000, - kt_remove_main_flag_version_e = 0x2000000000, - kt_remove_main_flag_version_copyright_help_e = 0x2000008008, + kt_remove_main_flag_prompt_all_e = 0x400000, + kt_remove_main_flag_prompt_follow_e = 0x800000, + kt_remove_main_flag_prompt_never_e = 0x1000000, + kt_remove_main_flag_prompt_once_e = 0x2000000, + kt_remove_main_flag_recurse_e = 0x4000000, + kt_remove_main_flag_regular_e = 0x8000000, + kt_remove_main_flag_same_e = 0x10000000, + kt_remove_main_flag_simulate_e = 0x20000000, + kt_remove_main_flag_socket_e = 0x40000000, + kt_remove_main_flag_tree_e = 0x80000000, + kt_remove_main_flag_updated_e = 0x100000000, + kt_remove_main_flag_user_e = 0x200000000, + kt_remove_main_flag_utc_e = 0x400000000, + kt_remove_main_flag_version_e = 0x800000000, + kt_remove_main_flag_version_copyright_help_e = 0x800008008, }; // enum #endif // _di_kt_remove_flag_e_ @@ -293,7 +289,7 @@ extern "C" { macro_f_console_parameter_t_initialize_5( kt_remove_long_utc_s, 0, f_console_flag_normal_e), \ } - #define kt_remove_total_parameters_d 38 + #define kt_remove_total_parameters_d (f_console_parameter_state_type_total_d + 25) #endif // _di_kt_remove_parameter_e_ /** diff --git a/sources/c/remove/main/remove.c b/sources/c/remove/main/remove.c index 104d67c..1cc00e5 100644 --- a/sources/c/remove/main/remove.c +++ b/sources/c/remove/main/remove.c @@ -7,19 +7,7 @@ extern "C" { #ifndef _di_kt_remove_main_ void kt_remove_main(kt_remove_main_t * const main) { - if (!main) return; - - if (F_status_is_error(main->setting.state.status)) { - if ((main->setting.flag & kt_remove_main_flag_print_last_e) && main->program.message.verbosity > f_console_verbosity_error_e) { - fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); - } - - return; - } - - if ((main->setting.flag & kt_remove_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { - fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); - } + if (!main || F_status_is_error(main->setting.state.status)) return; main->setting.state.status = F_okay; @@ -36,10 +24,6 @@ extern "C" { fll_program_print_copyright(&main->program.message, fll_program_copyright_year_author_s); } - if ((main->setting.flag & kt_remove_main_flag_print_last_e) && main->program.message.verbosity > f_console_verbosity_error_e) { - fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); - } - return; } @@ -55,10 +39,6 @@ extern "C" { if (main->setting.state.status == F_status_set_error(F_interrupt)) { fll_program_print_signal_received(&main->program.warning, main->program.signal_received); } - - if ((main->setting.flag & kt_remove_main_flag_print_last_e) && main->program.message.verbosity > f_console_verbosity_error_e) { - fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); - } } #endif // _di_kt_remove_main_ diff --git a/sources/c/tacocat/main/common.c b/sources/c/tacocat/main/common.c index dc8f04b..3f3df3e 100644 --- a/sources/c/tacocat/main/common.c +++ b/sources/c/tacocat/main/common.c @@ -16,7 +16,6 @@ extern "C" { main->setting.state.step_small = kt_tacocat_allocation_small_d; if (F_status_is_error(main->setting.state.status)) { - macro_setting_load_print_first(); kt_tacocat_print_error(&main->program.error, macro_kt_tacocat_f(f_console_parameter_process)); return; @@ -36,8 +35,6 @@ extern "C" { main->setting.state.status = fll_program_parameter_process_context(choices, modes, F_true, &main->program); if (F_status_is_error(main->setting.state.status)) { - macro_setting_load_print_first(); - kt_tacocat_print_error(&main->program.error, macro_kt_tacocat_f(fll_program_parameter_process_context)); return; @@ -55,8 +52,6 @@ extern "C" { main->setting.state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, &main->program); if (F_status_is_error(main->setting.state.status)) { - macro_setting_load_print_first(); - kt_tacocat_print_error(&main->program.error, macro_kt_tacocat_f(fll_program_parameter_process_verbosity)); return; @@ -90,8 +85,6 @@ extern "C" { if (main->program.parameters.array[kt_tacocat_parameter_resolve_e].result & f_console_result_found_e) { main->setting.state.status = F_status_set_error(F_parameter); - macro_setting_load_print_first(); - fll_program_print_error_parameter_missing_value(&main->program.error, f_console_symbol_long_normal_s, kt_tacocat_long_resolve_s); } else if (main->program.parameters.array[kt_tacocat_parameter_resolve_e].result & f_console_result_value_e) { @@ -108,8 +101,6 @@ extern "C" { else { main->setting.state.status = F_status_set_error(F_parameter); - macro_setting_load_print_first(); - kt_tacocat_print_error_parameter_value_resolve_unknown(&main->program.error, main->program.parameters.arguments.array[index]); } } @@ -131,7 +122,6 @@ extern "C" { main->setting.state.status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, main->program.parameters.arguments.array[index], &number); if (F_status_is_error(main->setting.state.status)) { - macro_setting_load_print_first(); kt_tacocat_print_error(&main->program.error, macro_kt_tacocat_f(fl_conversion_dynamic_to_unsigned_detect)); return; @@ -154,8 +144,6 @@ extern "C" { else if (main->program.parameters.array[kt_tacocat_parameter_interval_e].result & f_console_result_found_e) { main->setting.state.status = F_status_set_error(F_parameter); - macro_setting_load_print_first(); - fll_program_print_error_parameter_missing_value(&main->program.error, f_console_symbol_long_normal_s, kt_tacocat_long_interval_s); return; @@ -169,7 +157,6 @@ extern "C" { main->setting.state.status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, main->program.parameters.arguments.array[index], &number); if (F_status_is_error(main->setting.state.status)) { - macro_setting_load_print_first(); kt_tacocat_print_error(&main->program.error, macro_kt_tacocat_f(fl_conversion_dynamic_to_unsigned_detect)); return; @@ -202,8 +189,6 @@ extern "C" { else if (main->program.parameters.array[kt_tacocat_parameter_max_buffer_e].result & f_console_result_found_e) { main->setting.state.status = F_status_set_error(F_parameter); - macro_setting_load_print_first(); - fll_program_print_error_parameter_missing_value(&main->program.error, f_console_symbol_long_normal_s, kt_tacocat_long_max_buffer_s); return; @@ -287,10 +272,6 @@ extern "C" { if (main->program.parameters.array[parameters[i]].values.used % 2) { main->setting.state.status = F_status_set_error(F_parameter); - if ((main->setting.flag & kt_tacocat_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { - fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); - } - fll_program_print_error_parameter_missing_value_requires_amount(&main->program.error, f_console_symbol_long_normal_s, longs[i], kt_tacocat_two_s); if (F_status_is_error_not(failed)) { @@ -411,8 +392,6 @@ extern "C" { kt_tacocat_setting_load_address_port_extract(main, range_ip, &address, &port); if (F_status_is_error(main->setting.state.status)) { - macro_setting_load_print_first(); - if (F_status_set_fine(main->setting.state.status) == F_parameter) { kt_tacocat_print_error(&main->program.error, macro_kt_tacocat_f(kt_tacocat_setting_load_address_port_extract)); } @@ -454,8 +433,6 @@ extern "C" { if (main->setting.state.status == F_data_not || !host.h_addr_list || !host.h_addr_list[0]) { main->setting.state.status = F_status_set_error(F_parameter); - macro_setting_load_print_first(); - // @todo provide network-specific error messages for when no hosts are returned. kt_tacocat_print_error(&main->program.error, macro_kt_tacocat_f(f_network_from_ip_name)); @@ -495,8 +472,6 @@ extern "C" { if (main->setting.state.status == F_data_not || !host.h_addr_list || !host.h_addr_list[0]) { main->setting.state.status = F_status_set_error(F_parameter); - macro_setting_load_print_first(); - // @todo provide network-specific error messages for when no hosts are returned. kt_tacocat_print_error(&main->program.error, macro_kt_tacocat_f(f_network_from_ip_name)); @@ -538,8 +513,6 @@ extern "C" { else { main->setting.state.status = F_status_set_error(F_parameter); - macro_setting_load_print_first(); - fll_program_print_error_parameter_empty_value(&main->program.error, f_console_symbol_long_normal_s, longs[i]); if (F_status_is_error_not(failed)) { @@ -589,8 +562,6 @@ extern "C" { else { main->setting.state.status = F_status_set_error(F_parameter); - macro_setting_load_print_first(); - fll_program_print_error_parameter_empty_value(&main->program.error, f_console_symbol_long_normal_s, longs[i]); if (F_status_is_error_not(failed)) { @@ -607,8 +578,6 @@ extern "C" { main->setting.flag &= ~flags[i]; main->setting.state.status = F_status_set_error(F_parameter); - macro_setting_load_print_first(); - fll_program_print_error_parameter_missing_value(&main->program.error, f_console_symbol_long_normal_s, longs[i]); if (F_status_is_error_not(failed)) { diff --git a/sources/c/tacocat/main/common/define.h b/sources/c/tacocat/main/common/define.h index d241466..97365a1 100644 --- a/sources/c/tacocat/main/common/define.h +++ b/sources/c/tacocat/main/common/define.h @@ -103,9 +103,6 @@ extern "C" { /** * The program macros. * - * macro_setting_load_print_first: - * Intended to be used to simplify the code in kt_tacocat_setting_load() and make it more readable. - * * macro_setting_load_handle_send_receive_error_continue_1: * Intended to be used to simplify the code in kt_tacocat_setting_load_send_receive() and make it more readable. * This is for the basic error that calls kt_tacocat_print_error() when printing. @@ -126,15 +123,8 @@ extern "C" { * @todo document all macros. */ #ifndef _di_kt_tacocat_macros_d_ - #define macro_setting_load_print_first() \ - if ((main->setting.flag & kt_tacocat_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { \ - fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); \ - } - #define macro_setting_load_handle_send_receive_error_continue_1(method) \ if (F_status_is_error(main->setting.state.status)) { \ - macro_setting_load_print_first(); \ - \ kt_tacocat_print_error(&main->program.error, macro_kt_tacocat_f(method)); \ \ if (F_status_is_error_not(failed)) { \ @@ -146,8 +136,6 @@ extern "C" { #define macro_setting_load_handle_send_receive_error_continue_2(method) \ if (F_status_is_error(main->setting.state.status)) { \ - macro_setting_load_print_first(); \ - \ kt_tacocat_print_error(&main->program.error, macro_kt_tacocat_f(method)); \ \ if (F_status_is_error_not(failed)) { \ @@ -161,8 +149,6 @@ extern "C" { #define macro_setting_load_handle_send_receive_error_file_continue_1(method, name, operation, type) \ if (F_status_is_error(main->setting.state.status)) { \ - macro_setting_load_print_first(); \ - \ kt_tacocat_print_error_file(&main->program.error, macro_kt_tacocat_f(method), name, operation, type); \ \ if (F_status_is_error_not(failed)) { \ diff --git a/sources/c/tacocat/main/common/enumeration.h b/sources/c/tacocat/main/common/enumeration.h index e77e2a7..12eef9b 100644 --- a/sources/c/tacocat/main/common/enumeration.h +++ b/sources/c/tacocat/main/common/enumeration.h @@ -22,8 +22,6 @@ extern "C" { * kt_tacocat_main_flag_*_e: * - none: No flags set. * - copyright: Print copyright. - * - print_first: When set, print new line to message output on program begin after loading settings. - * - print_last: When set, print new line to message output on program end. * - max_buffer: When set, a maximum buffer on receive is enforced. * - receive: The address or socket to receive from is specified. * - resolve_classic: Follow the classic Domain Name Resolution method. @@ -50,15 +48,13 @@ extern "C" { kt_tacocat_main_flag_copyright_e = 0x1, kt_tacocat_main_flag_help_e = 0x2, kt_tacocat_main_flag_max_buffer_e = 0x4, - kt_tacocat_main_flag_print_first_e = 0x8, - kt_tacocat_main_flag_print_last_e = 0x10, - kt_tacocat_main_flag_receive_e = 0x20, - kt_tacocat_main_flag_resolve_classic_e = 0x40, - kt_tacocat_main_flag_resolve_kevux_e = 0x80, - kt_tacocat_main_flag_resolve_e = 0x100, - kt_tacocat_main_flag_send_e = 0x200, - kt_tacocat_main_flag_version_e = 0x400, - kt_tacocat_main_flag_version_copyright_help_e = 0x403, + kt_tacocat_main_flag_receive_e = 0x8, + kt_tacocat_main_flag_resolve_classic_e = 0x10, + kt_tacocat_main_flag_resolve_kevux_e = 0x20, + kt_tacocat_main_flag_resolve_e = 0x40, + kt_tacocat_main_flag_send_e = 0x80, + kt_tacocat_main_flag_version_e = 0x100, + kt_tacocat_main_flag_version_copyright_help_e = 0x103, }; // enum #endif // _di_kt_tacocat_main_flag_e_ @@ -97,7 +93,7 @@ extern "C" { macro_f_console_parameter_t_initialize_3(kt_tacocat_short_send_s, kt_tacocat_long_send_s, 2, f_console_flag_normal_e), \ } - #define kt_tacocat_parameter_total_d 18 + #define kt_tacocat_parameter_total_d (f_console_parameter_state_type_total_d + 5) #endif // _di_kt_tacocat_parameter_e_ /** diff --git a/sources/c/tacocat/main/tacocat.c b/sources/c/tacocat/main/tacocat.c index ec1cb01..ce2bb0f 100644 --- a/sources/c/tacocat/main/tacocat.c +++ b/sources/c/tacocat/main/tacocat.c @@ -9,15 +9,7 @@ extern "C" { if (!main) return; - if (F_status_is_error(main->setting.state.status)) { - if ((main->setting.flag & kt_tacocat_main_flag_print_last_e) && main->program.message.verbosity > f_console_verbosity_error_e) { - fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); - } - - return; - } - - macro_setting_load_print_first(); + if (F_status_is_error(main->setting.state.status)) return; main->setting.state.status = F_okay; @@ -32,10 +24,6 @@ extern "C" { fll_program_print_copyright(&main->program.message, fll_program_copyright_year_author_s); } - if ((main->setting.flag & kt_tacocat_main_flag_print_last_e) && main->program.message.verbosity > f_console_verbosity_error_e) { - fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); - } - return; } @@ -69,10 +57,6 @@ extern "C" { if (main->setting.state.status == F_status_set_error(F_interrupt)) { fll_program_print_signal_received(&main->program.warning, main->program.signal_received); } - - if ((main->setting.flag & kt_tacocat_main_flag_print_last_e) && main->program.message.verbosity > f_console_verbosity_error_e) { - fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); - } } #endif // _di_kt_tacocat_main_ -- 1.8.3.1