From: Kevin Day Date: Fri, 7 Jul 2023 03:35:31 +0000 (-0500) Subject: Cleanup: Use the signal check functions in progams. X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=cfc1672dc77e56bde87827ad398a6a66ae2c6d90;p=fll Cleanup: Use the signal check functions in progams. There already are signal check programs here. Use those instead of manually performing the signal check actions. --- diff --git a/level_3/iki_read/c/main/iki_read.c b/level_3/iki_read/c/main/iki_read.c index dd540fe..4bc7980 100644 --- a/level_3/iki_read/c/main/iki_read.c +++ b/level_3/iki_read/c/main/iki_read.c @@ -66,17 +66,7 @@ extern "C" { for (f_number_unsigned_t i = 0; i < main->setting.files.used; ++i) { - if (!((++main->program.signal_check) % iki_read_signal_check_d)) { - if (fll_program_standard_signal_received(&main->program)) { - fll_program_print_signal_received(&main->program.warning, main->program.signal_received); - - main->setting.state.status = F_status_set_error(F_interrupt); - - break; - } - - main->program.signal_check = 0; - } + if (iki_read_signal_check(main)) return; file.stream = 0; file.id = -1; diff --git a/level_3/iki_read/c/main/process.c b/level_3/iki_read/c/main/process.c index a9d16db..c54cb8f 100644 --- a/level_3/iki_read/c/main/process.c +++ b/level_3/iki_read/c/main/process.c @@ -327,19 +327,7 @@ extern "C" { for (i = 0; i < main->program.parameters.array[iki_read_parameter_name_e].values.used; ++i) { - if (!((++main->program.signal_check) % iki_read_signal_check_d)) { - if (fll_program_standard_signal_received(&main->program)) { - fll_program_print_signal_received(&main->program.warning, main->program.signal_received); - - f_string_dynamic_resize(0, &name); - - main->setting.state.status = F_status_set_error(F_interrupt); - - return; - } - - main->program.signal_check = 0; - } + if (iki_read_signal_check(main)) return; index = main->program.parameters.array[iki_read_parameter_name_e].values.array[i]; name.used = 0; diff --git a/level_3/utf8/c/main/bytesequence.c b/level_3/utf8/c/main/bytesequence.c index 3795c92..f3e802d 100644 --- a/level_3/utf8/c/main/bytesequence.c +++ b/level_3/utf8/c/main/bytesequence.c @@ -79,17 +79,7 @@ extern "C" { for (i = 0; F_status_is_error_not(main->setting.state.status) && i < main->setting.buffer.used; ) { - if (!((++main->program.signal_check) % utf8_signal_check_d)) { - if (fll_program_standard_signal_received(&main->program)) { - fll_program_print_signal_received(&main->program.warning, main->program.signal_received); - - main->setting.state.status = F_interrupt; - - break; - } - - main->program.signal_check = 0; - } + if (utf8_signal_check(main)) return; main->setting.state.status = F_none; diff --git a/level_3/utf8/c/main/codepoint.c b/level_3/utf8/c/main/codepoint.c index 599731c..1b8d2ef 100644 --- a/level_3/utf8/c/main/codepoint.c +++ b/level_3/utf8/c/main/codepoint.c @@ -349,17 +349,7 @@ extern "C" { for (i = 0; F_status_is_error_not(main->setting.state.status) && i < main->setting.buffer.used; ) { - if (!((++main->program.signal_check) % utf8_signal_check_d)) { - if (fll_program_standard_signal_received(&main->program)) { - fll_program_print_signal_received(&main->program.warning, main->program.signal_received); - - main->setting.state.status = F_status_set_error(F_interrupt); - - break; - } - - main->program.signal_check = 0; - } + if (utf8_signal_check(main)) return; main->setting.state.status = F_none; diff --git a/level_3/utf8/c/main/process.c b/level_3/utf8/c/main/process.c index 78ec069..8e940c6 100644 --- a/level_3/utf8/c/main/process.c +++ b/level_3/utf8/c/main/process.c @@ -26,17 +26,7 @@ extern "C" { for (; text.string[0] && F_status_is_error_not(main->setting.state.status); ) { - if (!((++main->program.signal_check) % utf8_signal_check_d)) { - if (fll_program_standard_signal_received(&main->program)) { - fll_program_print_signal_received(&main->program.warning, main->program.signal_received); - - main->setting.state.status = F_status_set_error(F_interrupt); - - break; - } - - main->program.signal_check = 0; - } + if (utf8_signal_check(main)) return; main->setting.state.status = F_none; diff --git a/level_3/utf8/c/main/utf8.c b/level_3/utf8/c/main/utf8.c index f70ea2c..4ef0b45 100644 --- a/level_3/utf8/c/main/utf8.c +++ b/level_3/utf8/c/main/utf8.c @@ -77,15 +77,7 @@ extern "C" { for (f_number_unsigned_t i = 0; i < main->setting.path_files_from.used && F_status_is_error_not(main->setting.state.status); ++i) { - if (!((++main->program.signal_check) % utf8_signal_check_d)) { - if (fll_program_standard_signal_received(&main->program)) { - main->setting.state.status = F_status_set_error(F_interrupt); - - break; - } - - main->program.signal_check = 0; - } + if (utf8_signal_check(main)) return; utf8_print_data_section_header_file(&main->program.output, main->setting.path_files_from.array[i], i); @@ -149,15 +141,7 @@ extern "C" { if (F_status_is_error_not(main->setting.state.status) && main->setting.remaining.used) { for (f_number_unsigned_t i = 0; F_status_is_error_not(main->setting.state.status) && i < main->setting.remaining.used; ++i) { - if (!((++main->program.signal_check) % utf8_signal_check_d)) { - if (fll_program_standard_signal_received(&main->program)) { - main->setting.state.status = F_status_set_error(F_interrupt); - - break; - } - - main->program.signal_check = 0; - } + if (utf8_signal_check(main)) return; utf8_print_data_section_header_parameter(&main->program.output, i);