From a0a2fbb0a3831e037be0ea3e2f344286995db43d Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Wed, 16 Nov 2022 22:39:45 -0600 Subject: [PATCH] Progress: Continue program related work. Clear the setting flags when calling the settings load function. Clean up some print function inconsistencies. --- level_3/byte_dump/c/common.c | 2 + level_3/control/c/common.c | 2 + level_3/controller/c/common.c | 2 + level_3/fake/c/common.c | 2 + level_3/firewall/c/common.c | 2 + level_3/fss_basic_list_read/c/common.c | 2 + level_3/fss_basic_list_write/c/common.c | 2 + level_3/fss_basic_read/c/common.c | 2 + level_3/fss_basic_write/c/common.c | 2 + level_3/fss_embedded_list_read/c/common.c | 2 + level_3/fss_embedded_list_write/c/common.c | 2 + .../c/fss_embedded_list_write.c | 2 + level_3/fss_extended_list_read/c/common.c | 2 + level_3/fss_extended_list_write/c/common.c | 2 + .../c/fss_extended_list_write.c | 2 + level_3/fss_extended_read/c/common.c | 2 + level_3/fss_extended_write/c/common.c | 2 + level_3/fss_identify/c/common.c | 2 + level_3/fss_payload_read/c/common.c | 2 + level_3/fss_payload_write/c/common.c | 2 + level_3/iki_read/c/common.c | 2 + level_3/iki_read/c/print.c | 8 + level_3/iki_write/c/common.c | 2 + level_3/iki_write/c/print.c | 16 + level_3/status_code/c/common.c | 2 + level_3/status_code/c/print.c | 16 + level_3/utf8/c/common.c | 17 +- level_3/utf8/c/common.h | 10 +- level_3/utf8/c/print.c | 410 +++++++++++---------- level_3/utf8/c/print.h | 326 ++++++++-------- level_3/utf8/c/private-utf8_bytesequence.c | 10 +- level_3/utf8/c/private-utf8_codepoint.c | 28 +- level_3/utf8/c/utf8.c | 6 +- 33 files changed, 514 insertions(+), 379 deletions(-) diff --git a/level_3/byte_dump/c/common.c b/level_3/byte_dump/c/common.c index 9b991e2..f5b5aa2 100644 --- a/level_3/byte_dump/c/common.c +++ b/level_3/byte_dump/c/common.c @@ -81,6 +81,8 @@ extern "C" { if (!main || !setting) return; + setting->flag = 0; + // Load parameters. setting->status = f_console_parameter_process(arguments, &main->parameters); diff --git a/level_3/control/c/common.c b/level_3/control/c/common.c index 8e2ad1e..81f18bd 100644 --- a/level_3/control/c/common.c +++ b/level_3/control/c/common.c @@ -184,6 +184,8 @@ extern "C" { if (!main || !setting) return; + setting->flag = 0; + // Load parameters. setting->status = f_console_parameter_process(arguments, &main->parameters); diff --git a/level_3/controller/c/common.c b/level_3/controller/c/common.c index 4d5fbdf..c1ff388 100644 --- a/level_3/controller/c/common.c +++ b/level_3/controller/c/common.c @@ -616,6 +616,8 @@ extern "C" { if (!main || !setting) return; + setting->flag = 0; + // Load parameters. setting->status = f_console_parameter_process(arguments, &main->parameters); diff --git a/level_3/fake/c/common.c b/level_3/fake/c/common.c index 28de632..7ec79bd 100644 --- a/level_3/fake/c/common.c +++ b/level_3/fake/c/common.c @@ -129,6 +129,8 @@ extern "C" { if (!main || !setting) return; + setting->flag = 0; + // Load parameters. setting->status = f_console_parameter_process(arguments, &main->parameters); diff --git a/level_3/firewall/c/common.c b/level_3/firewall/c/common.c index 5e6058d..8fb90a8 100644 --- a/level_3/firewall/c/common.c +++ b/level_3/firewall/c/common.c @@ -117,6 +117,8 @@ extern "C" { if (!main || !setting) return; + setting->flag = 0; + // Load parameters. setting->status = f_console_parameter_process(arguments, &main->parameters); diff --git a/level_3/fss_basic_list_read/c/common.c b/level_3/fss_basic_list_read/c/common.c index 8486314..98000c2 100644 --- a/level_3/fss_basic_list_read/c/common.c +++ b/level_3/fss_basic_list_read/c/common.c @@ -75,6 +75,8 @@ extern "C" { if (!main || !setting) return; + setting->flag = 0; + // Load parameters. setting->status = f_console_parameter_process(arguments, &main->parameters); diff --git a/level_3/fss_basic_list_write/c/common.c b/level_3/fss_basic_list_write/c/common.c index e96ab73..2aa9c2a 100644 --- a/level_3/fss_basic_list_write/c/common.c +++ b/level_3/fss_basic_list_write/c/common.c @@ -56,6 +56,8 @@ extern "C" { if (!main || !setting) return; + setting->flag = 0; + // Load parameters. setting->status = f_console_parameter_process(arguments, &main->parameters); diff --git a/level_3/fss_basic_read/c/common.c b/level_3/fss_basic_read/c/common.c index ba9d8e4..d1a5377 100644 --- a/level_3/fss_basic_read/c/common.c +++ b/level_3/fss_basic_read/c/common.c @@ -74,6 +74,8 @@ extern "C" { if (!main || !setting) return; + setting->flag = 0; + // Load parameters. setting->status = f_console_parameter_process(arguments, &main->parameters); diff --git a/level_3/fss_basic_write/c/common.c b/level_3/fss_basic_write/c/common.c index 5a0d36b..b67049a 100644 --- a/level_3/fss_basic_write/c/common.c +++ b/level_3/fss_basic_write/c/common.c @@ -56,6 +56,8 @@ extern "C" { if (!main || !setting) return; + setting->flag = 0; + // Load parameters. setting->status = f_console_parameter_process(arguments, &main->parameters); diff --git a/level_3/fss_embedded_list_read/c/common.c b/level_3/fss_embedded_list_read/c/common.c index 9f07442..c791fcf 100644 --- a/level_3/fss_embedded_list_read/c/common.c +++ b/level_3/fss_embedded_list_read/c/common.c @@ -73,6 +73,8 @@ extern "C" { if (!main || !setting) return; + setting->flag = 0; + // Load parameters. setting->status = f_console_parameter_process(arguments, &main->parameters); diff --git a/level_3/fss_embedded_list_write/c/common.c b/level_3/fss_embedded_list_write/c/common.c index d79cb19..91ec7f8 100644 --- a/level_3/fss_embedded_list_write/c/common.c +++ b/level_3/fss_embedded_list_write/c/common.c @@ -56,6 +56,8 @@ extern "C" { if (!main || !setting) return; + setting->flag = 0; + // Load parameters. setting->status = f_console_parameter_process(arguments, &main->parameters); diff --git a/level_3/fss_embedded_list_write/c/fss_embedded_list_write.c b/level_3/fss_embedded_list_write/c/fss_embedded_list_write.c index e33b6be..3dedfc8 100644 --- a/level_3/fss_embedded_list_write/c/fss_embedded_list_write.c +++ b/level_3/fss_embedded_list_write/c/fss_embedded_list_write.c @@ -11,6 +11,8 @@ extern "C" { f_status_t status = F_none; + setting->flag = 0; + // Load parameters. setting->status = f_console_parameter_process(arguments, &main->parameters); if (F_status_is_error(setting->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 bfd366f..abcc4ae 100644 --- a/level_3/fss_extended_list_read/c/common.c +++ b/level_3/fss_extended_list_read/c/common.c @@ -81,6 +81,8 @@ extern "C" { if (!main || !setting) return; + setting->flag = 0; + // Load parameters. setting->status = f_console_parameter_process(arguments, &main->parameters); diff --git a/level_3/fss_extended_list_write/c/common.c b/level_3/fss_extended_list_write/c/common.c index 74f14e5..b0e5c1e 100644 --- a/level_3/fss_extended_list_write/c/common.c +++ b/level_3/fss_extended_list_write/c/common.c @@ -63,6 +63,8 @@ extern "C" { if (!main || !setting) return; + setting->flag = 0; + // Load parameters. setting->status = f_console_parameter_process(arguments, &main->parameters); diff --git a/level_3/fss_extended_list_write/c/fss_extended_list_write.c b/level_3/fss_extended_list_write/c/fss_extended_list_write.c index 1705cc2..56c946b 100644 --- a/level_3/fss_extended_list_write/c/fss_extended_list_write.c +++ b/level_3/fss_extended_list_write/c/fss_extended_list_write.c @@ -11,6 +11,8 @@ extern "C" { f_status_t status = F_none; + setting->flag = 0; + // Load parameters. setting->status = f_console_parameter_process(arguments, &main->parameters); if (F_status_is_error(setting->status)) return; diff --git a/level_3/fss_extended_read/c/common.c b/level_3/fss_extended_read/c/common.c index e272744..9c1594a 100644 --- a/level_3/fss_extended_read/c/common.c +++ b/level_3/fss_extended_read/c/common.c @@ -74,6 +74,8 @@ extern "C" { if (!main || !setting) return; + setting->flag = 0; + // Load parameters. setting->status = f_console_parameter_process(arguments, &main->parameters); diff --git a/level_3/fss_extended_write/c/common.c b/level_3/fss_extended_write/c/common.c index 0d1084c..c76d7ef 100644 --- a/level_3/fss_extended_write/c/common.c +++ b/level_3/fss_extended_write/c/common.c @@ -56,6 +56,8 @@ extern "C" { if (!main || !setting) return; + setting->flag = 0; + // Load parameters. setting->status = f_console_parameter_process(arguments, &main->parameters); diff --git a/level_3/fss_identify/c/common.c b/level_3/fss_identify/c/common.c index 91485b9..0bca6e3 100644 --- a/level_3/fss_identify/c/common.c +++ b/level_3/fss_identify/c/common.c @@ -41,6 +41,8 @@ extern "C" { if (!main || !setting) return; + setting->flag = 0; + // Load parameters. setting->status = f_console_parameter_process(arguments, &main->parameters); diff --git a/level_3/fss_payload_read/c/common.c b/level_3/fss_payload_read/c/common.c index 9657bd1..3c3f94b 100644 --- a/level_3/fss_payload_read/c/common.c +++ b/level_3/fss_payload_read/c/common.c @@ -75,6 +75,8 @@ extern "C" { if (!main || !setting) return; + setting->flag = 0; + // Load parameters. setting->status = f_console_parameter_process(arguments, &main->parameters); diff --git a/level_3/fss_payload_write/c/common.c b/level_3/fss_payload_write/c/common.c index 9ab24b3..1c7d3f0 100644 --- a/level_3/fss_payload_write/c/common.c +++ b/level_3/fss_payload_write/c/common.c @@ -70,6 +70,8 @@ extern "C" { if (!main || !setting) return; + setting->flag = 0; + // Load parameters. setting->status = f_console_parameter_process(arguments, &main->parameters); diff --git a/level_3/iki_read/c/common.c b/level_3/iki_read/c/common.c index 50716c9..c315595 100644 --- a/level_3/iki_read/c/common.c +++ b/level_3/iki_read/c/common.c @@ -79,6 +79,8 @@ extern "C" { if (!main || !setting) return; + setting->flag = 0; + // Load parameters. setting->status = f_console_parameter_process(arguments, &main->parameters); diff --git a/level_3/iki_read/c/print.c b/level_3/iki_read/c/print.c index f951f2f..ee85919 100644 --- a/level_3/iki_read/c/print.c +++ b/level_3/iki_read/c/print.c @@ -10,6 +10,10 @@ extern "C" { if (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; + } + iki_read_print_line_first_locked(setting, print); fll_error_print(print, F_status_set_fine(setting->status), function, F_true); iki_read_print_line_last_locked(setting, print); @@ -23,6 +27,10 @@ extern "C" { if (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; + } + iki_read_print_line_first_locked(setting, print); fll_error_file_print(print, F_status_set_fine(setting->status), function, F_true, name, operation, type); iki_read_print_line_last_locked(setting, print); diff --git a/level_3/iki_write/c/common.c b/level_3/iki_write/c/common.c index 5303521..d1e1704 100644 --- a/level_3/iki_write/c/common.c +++ b/level_3/iki_write/c/common.c @@ -53,6 +53,8 @@ extern "C" { if (!main || !setting) return; + setting->flag = 0; + // Load parameters. setting->status = f_console_parameter_process(arguments, &main->parameters); diff --git a/level_3/iki_write/c/print.c b/level_3/iki_write/c/print.c index ebb169c..ca2cb3b 100644 --- a/level_3/iki_write/c/print.c +++ b/level_3/iki_write/c/print.c @@ -10,6 +10,10 @@ extern "C" { if (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; + } + iki_write_print_line_first_locked(setting, print); fll_error_print(print, F_status_set_fine(setting->status), function, F_true); iki_write_print_line_last_locked(setting, print); @@ -23,6 +27,10 @@ extern "C" { if (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; + } + iki_write_print_line_first_locked(setting, print); fll_error_file_print(print, F_status_set_fine(setting->status), function, F_true, name, operation, type); iki_write_print_line_last_locked(setting, print); @@ -36,6 +44,10 @@ extern "C" { if (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); fl_print_format("%[%QNo main provided, either pipe the main data or use the '%]", print.to, print.set->error, print.prefix, print.set->error); @@ -55,6 +67,10 @@ extern "C" { if (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); iki_write_print_line_first_unlocked(setting, print); diff --git a/level_3/status_code/c/common.c b/level_3/status_code/c/common.c index d51637f..a062703 100644 --- a/level_3/status_code/c/common.c +++ b/level_3/status_code/c/common.c @@ -53,6 +53,8 @@ extern "C" { if (!main || !setting) return; + setting->flag = 0; + // Load parameters. setting->status = f_console_parameter_process(arguments, &main->parameters); diff --git a/level_3/status_code/c/print.c b/level_3/status_code/c/print.c index c1c9637..0fd0a03 100644 --- a/level_3/status_code/c/print.c +++ b/level_3/status_code/c/print.c @@ -11,6 +11,10 @@ extern "C" { if (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; + } + status_code_print_line_first_locked(setting, print); fll_error_print(print, F_status_set_fine(setting->status), function, F_true); status_code_print_line_last_locked(setting, print); @@ -24,6 +28,10 @@ extern "C" { if (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); fl_print_format("%[%QCannot specify the '%]", print.to, print.context, print.prefix, print.context); @@ -45,6 +53,10 @@ extern "C" { if (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; + } + fll_print_format("%[No status code is specified.%]%r", print.to, print.context, print.context, f_string_eol_s); return F_none; @@ -56,6 +68,10 @@ extern "C" { if (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); fl_print_format("%[%QInvalid callback specified for '%]", print.to, print.context, print.prefix, print.context); diff --git a/level_3/utf8/c/common.c b/level_3/utf8/c/common.c index 9f4b685..ecc7b81 100644 --- a/level_3/utf8/c/common.c +++ b/level_3/utf8/c/common.c @@ -92,6 +92,8 @@ extern "C" { if (!main || !setting) return; + setting->flag = 0; + // Load parameters. setting->status = f_console_parameter_process(arguments, &main->parameters); @@ -279,7 +281,7 @@ extern "C" { if (main->parameters.array[utf8_parameter_to_file_e].values.used > 1) { setting->status = F_status_set_error(F_parameter); - utf8_print_error_parameter_file_to_too_many(main, setting); + utf8_print_error_parameter_file_to_too_many(setting, main->error); utf8_print_line_last_locked(setting, main->error); return; @@ -320,7 +322,7 @@ extern "C" { } else { utf8_print_line_first_locked(setting, main->error); - utf8_print_error_parameter_file_name_empty(main, setting, main->parameters.array[utf8_parameter_to_file_e].values.array[0]); + utf8_print_error_parameter_file_name_empty(setting, main->error, main->parameters.array[utf8_parameter_to_file_e].values.array[0]); utf8_print_line_last_locked(setting, main->error); setting->status = F_status_set_error(F_parameter); @@ -377,7 +379,7 @@ extern "C" { if (main->parameters.arguments.array[index].used) { if (f_file_exists(main->parameters.arguments.array[index], F_true) != F_true) { - utf8_print_error_parameter_file_not_found(main, setting, F_true, main->parameters.arguments.array[index]); + utf8_print_error_parameter_file_not_found(setting, main->error, F_true, main->parameters.arguments.array[index]); if (F_status_is_error_not(setting->status)) { setting->status = F_status_set_error(F_file_found_not); @@ -385,7 +387,7 @@ extern "C" { } } else { - utf8_print_error_parameter_file_name_empty(main, setting, index); + utf8_print_error_parameter_file_name_empty(setting, main->error, index); if (F_status_is_error_not(setting->status)) { setting->status = F_status_set_error(F_parameter); @@ -441,7 +443,8 @@ extern "C" { if (main->parameters.array[utf8_parameter_from_file_e].result == f_console_result_none_e && !((main->pipe & fll_program_data_pipe_input_e) || main->parameters.remaining.used)) { setting->status = F_status_set_error(F_parameter); - utf8_print_error_no_from(main, setting); + utf8_print_line_first_locked(setting, main->error); + utf8_print_error_no_from(setting, main->error); utf8_print_line_last_locked(setting, main->error); return; @@ -470,6 +473,10 @@ extern "C" { } setting->valid_not = main->message.set->error; + + if (main->pipe & fll_program_data_pipe_input_e) { + setting->flag |= utf8_main_flag_pipe_e; + } } #endif // _di_utf8_setting_load_ diff --git a/level_3/utf8/c/common.h b/level_3/utf8/c/common.h index 16d777e..c7a9c74 100644 --- a/level_3/utf8/c/common.h +++ b/level_3/utf8/c/common.h @@ -337,6 +337,7 @@ extern "C" { * - file_to: Using a specified destination file. * - header: Enable printing of headers. * - help: Print help. + * - pipe: Use the input pipe. * - separate: Enable printing of separators. * - strip_invalid: Using strip invalid character mode. * - verify: Using verify mode. @@ -349,10 +350,11 @@ extern "C" { utf8_main_flag_file_to_e = 0x2, utf8_main_flag_header_e = 0x4, utf8_main_flag_help_e = 0x8, - utf8_main_flag_separate_e = 0x10, - utf8_main_flag_strip_invalid_e = 0x20, - utf8_main_flag_verify_e = 0x40, - utf8_main_flag_version_e = 0x80, + utf8_main_flag_pipe_e = 0x10, + utf8_main_flag_separate_e = 0x20, + utf8_main_flag_strip_invalid_e = 0x40, + utf8_main_flag_verify_e = 0x80, + utf8_main_flag_version_e = 0x100, }; #endif // _di_utf8_main_flag_e_ diff --git a/level_3/utf8/c/print.c b/level_3/utf8/c/print.c index 4105f68..7d791dd 100644 --- a/level_3/utf8/c/print.c +++ b/level_3/utf8/c/print.c @@ -10,6 +10,10 @@ extern "C" { if (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; + } + utf8_print_line_first_locked(setting, print); fll_error_print(print, F_status_set_fine(setting->status), function, F_true); utf8_print_line_last_locked(setting, print); @@ -18,265 +22,270 @@ extern "C" { } #endif // _di_utf8_print_error_ -#ifndef _di_utf8_print_error_file_ - f_status_t utf8_print_error_file(utf8_setting_t * const setting, const fl_print_t print, const f_string_t function, const f_string_static_t name, const f_string_static_t operation, const uint8_t type) { +#ifndef _di_utf8_print_error_decode_ + f_status_t utf8_print_error_decode(utf8_setting_t * const setting, const fl_print_t print, const f_status_t status, const f_string_static_t invalid) { if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + if (setting->flag & (utf8_main_flag_strip_invalid_e | utf8_main_flag_verify_e)) return F_output_not; - utf8_print_line_first_locked(setting, print); - fll_error_file_print(print, F_status_set_fine(setting->status), function, F_true, name, operation, type); - utf8_print_line_last_locked(setting, print); - - return F_none; - } -#endif // _di_utf8_print_error_file_ + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; + } -#ifndef _di_utf8_print_bytesequence_ - f_status_t utf8_print_bytesequence(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t sequence) { + utf8_print_line_first_unlocked(setting, print); - fl_print_format("%r%r%r", main->output.to, setting->prepend, sequence, setting->append); + fl_print_format("%[%QFailed to decode character code '%]", print.to, print.set->error, print.prefix, print.set->error); - return F_none; - } -#endif // _di_utf8_print_bytesequence_ + if (invalid.used) { + fl_print_format("%[0x", print.to, print.set->notable); -#ifndef _di_utf8_print_character_invalid_ - f_status_t utf8_print_character_invalid(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t invalid) { + for (uint8_t i = 0; i < invalid.used; ++i) { + fl_print_format("%02_uii", print.to, (uint8_t) invalid.string[i]); + } // for - if (setting->flag & (utf8_main_flag_strip_invalid_e | utf8_main_flag_verify_e)) return F_output_not; - if (!invalid.used) return F_output_not; + fl_print_format("%]", print.to, print.set->notable); + } - if ((setting->mode & utf8_mode_to_combining_e) || (setting->mode & utf8_mode_to_width_e)) { - utf8_print_combining_or_width(main, setting, invalid); + if (F_status_set_fine(status) == F_utf_not) { + fl_print_format("%[', not a valid UTF-8 character sequence.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s); } - else if (setting->mode & utf8_mode_to_bytesequence_e) { - fl_print_format("%r%[%r%]%r", main->output.to, setting->prepend, setting->valid_not, invalid, setting->valid_not, setting->append); + else if (F_status_set_fine(status) == F_complete_not_utf) { + fl_print_format("%[', invalid UTF-8 (truncated).%]%r", print.to, print.set->error, print.set->error, f_string_eol_s); } - else if (setting->mode & utf8_mode_from_codepoint_e) { - fl_print_format("%r%[%Q%]%r", main->output.to, setting->prepend, setting->valid_not, invalid, setting->valid_not, setting->append); + else if (F_status_set_fine(status) == F_utf_fragment) { + fl_print_format("%[', invalid UTF-8 fragment.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s); } else { - fl_print_format("%r%[0x", main->output.to, setting->prepend, setting->valid_not); - - for (uint8_t i = 0; i < invalid.used; ++i) { - fl_print_format("%02_uii", main->output.to, (uint8_t) invalid.string[i]); - } // for - - fl_print_format("%]%r", main->output.to, setting->valid_not, setting->append); + fl_print_format("%[', error status code%] ", print.to, print.set->error, print.set->error, f_string_eol_s); + fl_print_format("%[%ui%]", print.to, print.set->notable, F_status_set_fine(status), print.set->notable); + fl_print_format("%[.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s); } return F_none; } -#endif // _di_utf8_print_character_invalid_ +#endif // _di_utf8_print_error_decode_ -#ifndef _di_utf8_print_codepoint_ - f_status_t utf8_print_codepoint(fll_program_data_t * const main, utf8_setting_t * const setting, const uint32_t codepoint) { +#ifndef _di_utf8_print_error_encode_ + f_status_t utf8_print_error_encode(utf8_setting_t * const setting, const fl_print_t print, const f_status_t status, const uint32_t codepoint) { - if (codepoint < 0x10000) { - fl_print_format("%rU+%04_U%r", main->output.to, setting->prepend, codepoint, setting->append); + if (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; } - else if (codepoint < 0x100000) { - fl_print_format("%rU+%05_U%r", main->output.to, setting->prepend, codepoint, setting->append); + + utf8_print_line_first_unlocked(setting, print); + + fl_print_format("%[%QFailed to encode Unicode codepoint '%]", print.to, print.set->error, print.prefix, print.set->error); + fl_print_format("%[U+%_U%]", print.to, print.set->notable, codepoint, print.set->notable); + + if (F_status_set_fine(status) == F_utf_not) { + fl_print_format("%[', not a valid Unicode codepoint.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s); } else { - fl_print_format("%rU+%06_U%r", main->output.to, setting->prepend, codepoint, setting->append); + fl_print_format("%[', error status code%] ", print.to, print.set->error, print.set->error, f_string_eol_s); + fl_print_format("%[%ui%]", print.to, print.set->notable, F_status_set_fine(status), print.set->notable); + fl_print_format("%[.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s); } return F_none; } -#endif // _di_utf8_print_codepoint_ - -#ifndef _di_utf8_print_combining_or_width_ - f_status_t utf8_print_combining_or_width(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t sequence) { +#endif // _di_utf8_print_error_encode_ - if (setting->mode & utf8_mode_to_combining_e) { - f_status_t status = f_utf_is_combining(sequence.string, sequence.used); +#ifndef _di_utf8_print_error_file_ + f_status_t utf8_print_error_file(utf8_setting_t * const setting, const fl_print_t print, const f_string_t function, const f_string_static_t name, const f_string_static_t operation, const uint8_t type) { - if (status == F_true) { - fl_print_format("%r%r%r", main->output.to, setting->prepend, utf8_string_combining_is_s, setting->append); - } - else if (status == F_false) { - status = f_utf_is_private(sequence.string, sequence.used); + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - if (status == F_true) { - fl_print_format("%r%r%r", main->output.to, setting->prepend, utf8_string_unknown_s, setting->append); - } - else if (setting->mode & utf8_mode_to_width_e) { - utf8_print_width(main, setting, sequence); - } - else { - fl_print_format("%r%r%r", main->output.to, setting->prepend, utf8_string_combining_not_s, setting->append); - } - } - else { - utf8_print_error_combining_or_width(main, setting); - } - } - else if (setting->mode & utf8_mode_to_width_e) { - utf8_print_width(main, setting, sequence); + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } + utf8_print_line_first_locked(setting, print); + fll_error_file_print(print, F_status_set_fine(setting->status), function, F_true, name, operation, type); + utf8_print_line_last_locked(setting, print); + return F_none; } -#endif // _di_utf8_print_combining_or_width_ +#endif // _di_utf8_print_error_file_ -#ifndef _di_utf8_print_error_combining_or_width_ - f_status_t utf8_print_error_combining_or_width(fll_program_data_t * const main, utf8_setting_t * const setting) { +#ifndef _di_utf8_print_error_no_from_ + f_status_t utf8_print_error_no_from(utf8_setting_t * const setting, const fl_print_t print) { - if (setting->flag & (utf8_main_flag_strip_invalid_e | utf8_main_flag_verify_e)) return F_output_not; + if (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; + } - fl_print_format("%r%[%r%]%r", main->output.to, setting->prepend, setting->valid_not, utf8_string_unknown_s, setting->valid_not, setting->append); + fll_print_format("%[%QNo from sources are specified, please pipe data, designate a file, or add parameters.%]%r", print.to, print.set->error, print.prefix, print.set->error, f_string_eol_s); return F_none; } -#endif // _di_utf8_print_error_combining_or_width_ - -#ifndef _di_utf8_print_error_decode_ - f_status_t utf8_print_error_decode(fll_program_data_t * const main, utf8_setting_t * const setting, const f_status_t status, const f_string_static_t invalid) { +#endif // _di_utf8_print_error_no_from_ - if (main->error.verbosity == f_console_verbosity_quiet_e) return F_output_not; - if (setting->flag & (utf8_main_flag_strip_invalid_e | utf8_main_flag_verify_e)) return F_output_not; +#ifndef _di_utf8_print_error_parameter_file_name_empty_ + f_status_t utf8_print_error_parameter_file_name_empty(utf8_setting_t * const setting, const fl_print_t print, const f_array_length_t index) { - utf8_print_line_first_unlocked(setting, main->error); + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - fl_print_format("%[%QFailed to decode character code '%]", main->error.to, main->context.set.error, main->error.prefix, main->context.set.error); + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; + } - if (invalid.used) { - fl_print_format("%[0x", main->error.to, main->context.set.notable); + f_file_stream_lock(print.to); - for (uint8_t i = 0; i < invalid.used; ++i) { - fl_print_format("%02_uii", main->error.to, (uint8_t) invalid.string[i]); - } // for + utf8_print_line_first_unlocked(setting, print); - fl_print_format("%]", main->error.to, main->context.set.notable); - } + fl_print_format("%[%QNo file specified at parameter index %]", print.to, print.set->error, print.prefix, print.set->error); + fl_print_format("%[%ul%]", print.to, print.set->notable, index, print.set->notable); + fl_print_format("%[.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s); - if (F_status_set_fine(status) == F_utf_not) { - fl_print_format("%[', not a valid UTF-8 character sequence.%]%r", main->error.to, main->context.set.error, main->context.set.error, f_string_eol_s); - } - else if (F_status_set_fine(status) == F_complete_not_utf) { - fl_print_format("%[', invalid UTF-8 (truncated).%]%r", main->error.to, main->context.set.error, main->context.set.error, f_string_eol_s); - } - else if (F_status_set_fine(status) == F_utf_fragment) { - fl_print_format("%[', invalid UTF-8 fragment.%]%r", main->error.to, main->context.set.error, main->context.set.error, f_string_eol_s); - } - else { - fl_print_format("%[', error status code%] ", main->error.to, main->context.set.error, main->context.set.error, f_string_eol_s); - fl_print_format("%[%ui%]", main->error.to, main->context.set.notable, F_status_set_fine(status), main->context.set.notable); - fl_print_format("%[.%]%r", main->error.to, main->context.set.error, main->context.set.error, f_string_eol_s); - } + f_file_stream_unlock(print.to); return F_none; } -#endif // _di_utf8_print_error_decode_ - -#ifndef _di_utf8_print_error_encode_ - f_status_t utf8_print_error_encode(fll_program_data_t * const main, utf8_setting_t * const setting, const f_status_t status, const uint32_t codepoint) { - - if (main->error.verbosity == f_console_verbosity_quiet_e) return F_output_not; +#endif // _di_utf8_print_error_parameter_file_name_empty_ - utf8_print_line_first_unlocked(setting, main->error); +#ifndef _di_utf8_print_error_parameter_file_not_found_ + f_status_t utf8_print_error_parameter_file_not_found(utf8_setting_t * const setting, const fl_print_t print, const bool from, const f_string_static_t name) { - fl_print_format("%[%QFailed to encode Unicode codepoint '%]", main->error.to, main->context.set.error, main->error.prefix, main->context.set.error); - fl_print_format("%[U+%_U%]", main->error.to, main->context.set.notable, codepoint, main->context.set.notable); + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - if (F_status_set_fine(status) == F_utf_not) { - fl_print_format("%[', not a valid Unicode codepoint.%]%r", main->error.to, main->context.set.error, main->context.set.error, f_string_eol_s); - } - else { - fl_print_format("%[', error status code%] ", main->error.to, main->context.set.error, main->context.set.error, f_string_eol_s); - fl_print_format("%[%ui%]", main->error.to, main->context.set.notable, F_status_set_fine(status), main->context.set.notable); - fl_print_format("%[.%]%r", main->error.to, main->context.set.error, main->context.set.error, f_string_eol_s); + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } - return F_none; - } -#endif // _di_utf8_print_error_encode_ - -#ifndef _di_utf8_print_error_no_from_ - f_status_t utf8_print_error_no_from(fll_program_data_t * const main, utf8_setting_t * const setting) { + f_file_stream_lock(print.to); - if (main->error.verbosity == f_console_verbosity_quiet_e) return F_output_not; + utf8_print_line_first_unlocked(setting, print); - utf8_print_line_first_locked(setting, main->error); + fl_print_format("%[%QFailed to find the %r file '%]", print.to, print.set->error, print.prefix, from ? utf8_string_from_s : utf8_string_to_s, print.set->error); + fl_print_format("%[%Q%]", print.to, print.set->notable, name, print.set->notable); + fl_print_format("%['.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s); - fll_print_format("%[%QNo from sources are specified, please pipe data, designate a file, or add parameters.%]%r", main->error.to, main->error.context, main->error.prefix, main->error.context, f_string_eol_s); + f_file_stream_unlock(print.to); return F_none; } -#endif // _di_utf8_print_error_no_from_ - -#ifndef _di_utf8_print_error_parameter_file_name_empty_ - f_status_t utf8_print_error_parameter_file_name_empty(fll_program_data_t * const main, utf8_setting_t * const setting, const f_array_length_t index) { +#endif // _di_utf8_print_error_parameter_file_not_found_ - if (main->error.verbosity == f_console_verbosity_quiet_e) return F_output_not; +#ifndef _di_utf8_print_error_parameter_file_to_too_many_ + f_status_t utf8_print_error_parameter_file_to_too_many(utf8_setting_t * const setting, const fl_print_t print) { - f_file_stream_lock(main->error.to); + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - utf8_print_line_first_unlocked(setting, main->error); + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; + } - fl_print_format("%[%QNo file specified at parameter index %]", main->error.to, main->context.set.error, main->error.prefix, main->context.set.error); - fl_print_format("%[%ul%]", main->error.to, main->context.set.notable, index, main->context.set.notable); - fl_print_format("%[.%]%r", main->error.to, main->context.set.error, main->context.set.error, f_string_eol_s); + utf8_print_line_first_locked(setting, print); - f_file_stream_unlock(main->error.to); + fll_print_format("%[%QToo many '%r' files specified, there may only be one '%r' file.%]%r", print.to, print.set->error, print.prefix, utf8_string_to_s, utf8_string_to_s, print.set->error, f_string_eol_s); return F_none; } -#endif // _di_utf8_print_error_parameter_file_name_empty_ +#endif // _di_utf8_print_error_parameter_file_to_too_many_ -#ifndef _di_utf8_print_error_parameter_file_not_found_ - f_status_t utf8_print_error_parameter_file_not_found(fll_program_data_t * const main, utf8_setting_t * const setting, const bool from, const f_string_static_t name) { +#ifndef _di_utf8_print_bytesequence_ + f_status_t utf8_print_bytesequence(utf8_setting_t * const setting, const fl_print_t print, const f_string_static_t sequence) { - if (main->error.verbosity == f_console_verbosity_quiet_e) return F_output_not; + fl_print_format("%r%r%r", print.to, setting->prepend, sequence, setting->append); - f_file_stream_lock(main->error.to); + return F_none; + } +#endif // _di_utf8_print_bytesequence_ + +#ifndef _di_utf8_print_character_invalid_ + f_status_t utf8_print_character_invalid(utf8_setting_t * const setting, const fl_print_t print, const f_string_static_t invalid) { - utf8_print_line_first_unlocked(setting, main->error); + if (setting->flag & (utf8_main_flag_strip_invalid_e | utf8_main_flag_verify_e)) return F_output_not; + if (!invalid.used) return F_output_not; + + if ((setting->mode & utf8_mode_to_combining_e) || (setting->mode & utf8_mode_to_width_e)) { + utf8_print_combining_or_width(setting, print, invalid); + } + else if (setting->mode & utf8_mode_to_bytesequence_e) { + fl_print_format("%r%[%r%]%r", print.to, setting->prepend, setting->valid_not, invalid, setting->valid_not, setting->append); + } + else if (setting->mode & utf8_mode_from_codepoint_e) { + fl_print_format("%r%[%Q%]%r", print.to, setting->prepend, setting->valid_not, invalid, setting->valid_not, setting->append); + } + else { + fl_print_format("%r%[0x", print.to, setting->prepend, setting->valid_not); - fl_print_format("%[%QFailed to find the %r file '%]", main->error.to, main->context.set.error, main->error.prefix, from ? utf8_string_from_s : utf8_string_to_s, main->context.set.error); - fl_print_format("%[%Q%]", main->error.to, main->context.set.notable, name, main->context.set.notable); - fl_print_format("%['.%]%r", main->error.to, main->context.set.error, main->context.set.error, f_string_eol_s); + for (uint8_t i = 0; i < invalid.used; ++i) { + fl_print_format("%02_uii", print.to, (uint8_t) invalid.string[i]); + } // for - f_file_stream_unlock(main->error.to); + fl_print_format("%]%r", print.to, setting->valid_not, setting->append); + } return F_none; } -#endif // _di_utf8_print_error_parameter_file_not_found_ - -#ifndef _di_utf8_print_error_parameter_file_to_too_many_ - f_status_t utf8_print_error_parameter_file_to_too_many(fll_program_data_t * const main, utf8_setting_t * const setting) { - - if (main->error.verbosity == f_console_verbosity_quiet_e) return F_output_not; +#endif // _di_utf8_print_character_invalid_ - utf8_print_line_first_locked(setting, main->error); +#ifndef _di_utf8_print_codepoint_ + f_status_t utf8_print_codepoint(utf8_setting_t * const setting, const fl_print_t print, const uint32_t codepoint) { - fll_print_format("%[%QToo many '%r' files specified, there may only be one '%r' file.%]%r", main->error.to, main->context.set.error, main->error.prefix, utf8_string_to_s, utf8_string_to_s, main->context.set.error, f_string_eol_s); + if (codepoint < 0x10000) { + fl_print_format("%rU+%04_U%r", print.to, setting->prepend, codepoint, setting->append); + } + else if (codepoint < 0x100000) { + fl_print_format("%rU+%05_U%r", print.to, setting->prepend, codepoint, setting->append); + } + else { + fl_print_format("%rU+%06_U%r", print.to, setting->prepend, codepoint, setting->append); + } return F_none; } -#endif // _di_utf8_print_error_parameter_file_to_too_many_ +#endif // _di_utf8_print_codepoint_ -#ifndef _di_utf8_print_flush_ - f_status_t utf8_print_flush(fll_program_data_t * const main, utf8_setting_t * const setting) { +#ifndef _di_utf8_print_combining_or_width_ + f_status_t utf8_print_combining_or_width(utf8_setting_t * const setting, const fl_print_t print, const f_string_static_t sequence) { - if (setting->flag & utf8_main_flag_verify_e) return F_output_not; + if (setting->mode & utf8_mode_to_combining_e) { + f_status_t status = f_utf_is_combining(sequence.string, sequence.used); - if (setting->status == F_interrupt) { - if (main->output.verbosity != f_console_verbosity_quiet_e) { - f_file_stream_flush(main->output.to); + if (status == F_true) { + fl_print_format("%r%r%r", print.to, setting->prepend, utf8_string_combining_is_s, setting->append); } + else if (status == F_false) { + status = f_utf_is_private(sequence.string, sequence.used); - if (main->output.to.stream != main->message.to.stream) { - if (main->message.verbosity != f_console_verbosity_quiet_e) { - f_file_stream_flush(main->message.to); + if (status == F_true) { + fl_print_format("%r%r%r", print.to, setting->prepend, utf8_string_unknown_s, setting->append); + } + else if (setting->mode & utf8_mode_to_width_e) { + utf8_print_width(setting, print, sequence); + } + else { + fl_print_format("%r%r%r", print.to, setting->prepend, utf8_string_combining_not_s, setting->append); } } + else { + utf8_print_combining_or_width_invalid(setting, print); + } + } + else if (setting->mode & utf8_mode_to_width_e) { + utf8_print_width(setting, print, sequence); } return F_none; } -#endif // _di_utf8_print_flush_ +#endif // _di_utf8_print_combining_or_width_ + +#ifndef _di_utf8_print_combining_or_width_invalid_ + f_status_t utf8_print_combining_or_width_invalid(utf8_setting_t * const setting, const fl_print_t print) { + + if (setting->flag & (utf8_main_flag_strip_invalid_e | utf8_main_flag_verify_e)) return F_output_not; + + fl_print_format("%r%[%r%]%r", print.to, setting->prepend, setting->valid_not, utf8_string_unknown_s, setting->valid_not, setting->append); + + return F_none; + } +#endif // _di_utf8_print_combining_or_width_invalid_ #ifndef _di_utf8_print_help_ f_status_t utf8_print_help(utf8_setting_t * const setting, const fl_print_t print) { @@ -400,7 +409,7 @@ extern "C" { #endif // _di_utf8_print_line_last_unlocked_ #ifndef _di_utf8_print_raw_bytesequence_ - f_status_t utf8_print_raw_bytesequence(fll_program_data_t * const main, utf8_setting_t * const setting, const f_utf_char_t raw, const uint8_t width) { + f_status_t utf8_print_raw_bytesequence(utf8_setting_t * const setting, const fl_print_t print, const f_utf_char_t raw, const uint8_t width) { if (setting->flag & (utf8_main_flag_strip_invalid_e | utf8_main_flag_verify_e)) return F_output_not; @@ -434,30 +443,30 @@ extern "C" { memset(byte, 0, sizeof(f_char_t) * width); } - fl_print_format("%r%[%r%]%r", main->output.to, setting->prepend, setting->valid_not, character, setting->valid_not, setting->append); + fl_print_format("%r%[%r%]%r", print.to, setting->prepend, setting->valid_not, character, setting->valid_not, setting->append); return F_none; } #endif // _di_utf8_print_raw_bytesequence_ #ifndef _di_utf8_print_raw_codepoint_ - f_status_t utf8_print_raw_codepoint(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t raw) { + f_status_t utf8_print_raw_codepoint(utf8_setting_t * const setting, const fl_print_t print, const f_string_static_t raw) { if (setting->flag & (utf8_main_flag_strip_invalid_e | utf8_main_flag_verify_e)) return F_output_not; - fl_print_format("%r%[%r%]%r", main->output.to, setting->prepend, setting->valid_not, raw, setting->valid_not, setting->append); + fl_print_format("%r%[%r%]%r", print.to, setting->prepend, setting->valid_not, raw, setting->valid_not, setting->append); return F_none; } #endif // _di_utf8_print_raw_codepoint_ #ifndef _di_utf8_print_raw_combining_or_width_ - f_status_t utf8_print_raw_combining_or_width(fll_program_data_t * const main, utf8_setting_t * const setting, const uint8_t width) { + f_status_t utf8_print_raw_combining_or_width(utf8_setting_t * const setting, const fl_print_t print, const uint8_t width) { if (setting->flag & (utf8_main_flag_strip_invalid_e | utf8_main_flag_verify_e)) return F_output_not; if (setting->mode & utf8_mode_to_combining_e) { - utf8_print_error_combining_or_width(main, setting); + utf8_print_combining_or_width_invalid(setting, print); } else if (setting->mode & utf8_mode_to_width_e) { const f_string_static_t *character = 0; @@ -483,7 +492,7 @@ extern "C" { character = &utf8_string_width_0_s; } - fl_print_format("%r%[%r%]%r", main->output.to, setting->prepend, setting->valid_not, *character, setting->valid_not, setting->append); + fl_print_format("%r%[%r%]%r", print.to, setting->prepend, setting->valid_not, *character, setting->valid_not, setting->append); } return F_none; @@ -491,90 +500,91 @@ extern "C" { #endif // _di_utf8_print_raw_combining_or_width_ #ifndef _di_utf8_print_section_header_file_ - f_status_t utf8_print_section_header_file(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t name, const f_array_length_t index) { + f_status_t utf8_print_section_header_file(utf8_setting_t * const setting, const fl_print_t print, const f_string_static_t name, const f_array_length_t index) { if (!(setting->flag & (utf8_main_flag_header_e | utf8_main_flag_separate_e))) return F_output_not; if (setting->flag & utf8_main_flag_verify_e) return F_output_not; - f_file_stream_lock(main->output.to); + f_file_stream_lock(print.to); + - if ((main->pipe & fll_program_data_pipe_input_e) || index) { - f_print_dynamic_raw(f_string_eol_s, main->output.to); + if ((setting->flag & utf8_main_flag_pipe_e) || index) { + f_print_dynamic_raw(f_string_eol_s, print.to); } else { - f_print_dynamic_raw(setting->line_first, main->output.to); + f_print_dynamic_raw(setting->line_first, print.to); } if (setting->flag & utf8_main_flag_header_e) { - fl_print_format("%[File%] ", main->output.to, main->output.set->title, main->output.set->title); + fl_print_format("%[File%] ", print.to, print.set->title, print.set->title); if (setting->flag & utf8_main_flag_file_to_e) { - fl_print_format("%[%Q%]: %Q.%r", main->output.to, main->output.set->notable, name, main->output.set->notable, setting->path_files_to.array[0], f_string_eol_s); + fl_print_format("%[%Q%]: %Q.%r", print.to, print.set->notable, name, print.set->notable, setting->path_files_to.array[0], f_string_eol_s); } else { - fl_print_format("%[%Q%]:%r", main->output.to, main->output.set->notable, name, main->output.set->notable, f_string_eol_s); + fl_print_format("%[%Q%]:%r", print.to, print.set->notable, name, print.set->notable, f_string_eol_s); } } - f_file_stream_unlock(main->output.to); + f_file_stream_unlock(print.to); return F_none; } #endif // _di_utf8_print_section_header_file_ #ifndef _di_utf8_print_section_header_parameter_ - f_status_t utf8_print_section_header_parameter(fll_program_data_t * const main, utf8_setting_t * const setting, const f_array_length_t index) { + f_status_t utf8_print_section_header_parameter(utf8_setting_t * const setting, const fl_print_t print, const f_array_length_t index) { if (!(setting->flag & (utf8_main_flag_header_e | utf8_main_flag_separate_e))) return F_output_not; if (setting->flag & utf8_main_flag_verify_e) return F_output_not; - f_file_stream_lock(main->output.to); + f_file_stream_lock(print.to); - if ((main->pipe & fll_program_data_pipe_input_e) || (setting->flag & utf8_main_flag_file_from_e) || index) { - f_print_dynamic_raw(f_string_eol_s, main->output.to); + if ((setting->flag & utf8_main_flag_pipe_e) || (setting->flag & utf8_main_flag_file_from_e) || index) { + f_print_dynamic_raw(f_string_eol_s, print.to); } else { - f_print_dynamic_raw(setting->line_first, main->output.to); + f_print_dynamic_raw(setting->line_first, print.to); } if (setting->flag & utf8_main_flag_header_e) { - fl_print_format("%[Parameter%] ", main->output.to, main->output.set->title, main->output.set->title); - fl_print_format("%[%ul%]:%r", main->output.to, main->output.set->notable, index, main->output.set->notable, f_string_eol_s); + fl_print_format("%[Parameter%] ", print.to, print.set->title, print.set->title); + fl_print_format("%[%ul%]:%r", print.to, print.set->notable, index, print.set->notable, f_string_eol_s); } - f_file_stream_unlock(main->output.to); + f_file_stream_unlock(print.to); return F_none; } #endif // _di_utf8_print_section_header_parameter_ #ifndef _di_utf8_print_section_header_pipe_ - f_status_t utf8_print_section_header_pipe(fll_program_data_t * const main, utf8_setting_t * const setting) { + f_status_t utf8_print_section_header_pipe(utf8_setting_t * const setting, const fl_print_t print) { if (!(setting->flag & (utf8_main_flag_header_e | utf8_main_flag_separate_e))) return F_output_not; if (setting->flag & utf8_main_flag_verify_e) return F_output_not; - f_file_stream_lock(main->output.to); + f_file_stream_lock(print.to); - f_print_dynamic_raw(setting->line_first, main->output.to); + f_print_dynamic_raw(setting->line_first, print.to); if (setting->flag & utf8_main_flag_header_e) { - fl_print_format("%[Pipe%]:%r", main->output.to, main->output.set->title, main->output.set->title, f_string_eol_s); + fl_print_format("%[Pipe%]:%r", print.to, print.set->title, print.set->title, f_string_eol_s); } - f_file_stream_unlock(main->output.to); + f_file_stream_unlock(print.to); return F_none; } #endif // _di_utf8_print_section_header_pipe_ #ifndef _di_utf8_print_width_ - f_status_t utf8_print_width(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t sequence) { + f_status_t utf8_print_width(utf8_setting_t * const setting, const fl_print_t print, const f_string_static_t sequence) { f_status_t status = f_utf_is_wide(sequence.string, sequence.used); if (status == F_true) { - fl_print_format("%r%r%r", main->output.to, setting->prepend, utf8_string_width_2_s, setting->append); + fl_print_format("%r%r%r", print.to, setting->prepend, utf8_string_width_2_s, setting->append); return F_output_not; } @@ -583,19 +593,19 @@ extern "C" { status = f_utf_is_graph(sequence.string, sequence.used); if (status == F_true) { - fl_print_format("%r%r%r", main->output.to, setting->prepend, utf8_string_width_1_s, setting->append); + fl_print_format("%r%r%r", print.to, setting->prepend, utf8_string_width_1_s, setting->append); return F_output_not; } if (status == F_false) { - fl_print_format("%r%r%r", main->output.to, setting->prepend, utf8_string_width_0_s, setting->append); + fl_print_format("%r%r%r", print.to, setting->prepend, utf8_string_width_0_s, setting->append); return F_output_not; } } - utf8_print_error_combining_or_width(main, setting); + utf8_print_combining_or_width_invalid(setting, print); return F_none; } diff --git a/level_3/utf8/c/print.h b/level_3/utf8/c/print.h index 8a656e6..08842f7 100644 --- a/level_3/utf8/c/print.h +++ b/level_3/utf8/c/print.h @@ -19,6 +19,8 @@ extern "C" { * The main program settings. * * This does not alter setting.status. + * + * Assumed to always be non-NULL. * @param print * Designates the how and where to print. * @@ -33,277 +35,281 @@ extern "C" { #endif // _di_utf8_print_error_ /** - * Print file related error or warning messages. - * - * @param setting - * The main program settings. - * - * This does not alter setting.status. - * @param print - * Designates how printing is to be performed. - * @param function - * The name of the function where the error happened. - * Set to 0 to disable. - * @param name - * The name of the file or directory. - * @param operation - * The operation that fails, such as 'create' or 'access'. - * @param type - * A valid file type code from the fll_error_file_type enum. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - * - * @see fll_error_file_print() - */ -#ifndef _di_utf8_print_error_file_ - extern f_status_t utf8_print_error_file(utf8_setting_t * const setting, const fl_print_t print, const f_string_t function, const f_string_static_t name, const f_string_static_t operation, const uint8_t type); -#endif // _di_utf8_print_error_file_ - -/** - * Print the byte sequence character (such as '豸'). + * Print error message when attempt to decode the character failed. * * @param main * The main program data. * @param setting * The main program settings. * + * This does not alter setting.status. + * * Assumed to always be non-NULL. - * @param sequence - * A byte sequences representing a single character to print. + * @param invalid + * The byte sequence string or unicode codepoint string representing a single character to print. * * @return * F_none on success. * F_output_not on success, but no printing is performed. */ -#ifndef _di_utf8_print_bytesequence_ - extern f_status_t utf8_print_bytesequence(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t sequence); -#endif // _di_utf8_print_bytesequence_ +#ifndef _di_utf8_print_error_decode_ + extern f_status_t utf8_print_error_decode(utf8_setting_t * const setting, const fl_print_t print, const f_status_t status, const f_string_static_t invalid); +#endif // _di_utf8_print_error_decode_ /** - * Print an invalid character either as a Unicode codeblock or as a byte sequence. - * - * This handles whether or not the invalid character should be printed or not based on program parameters. + * Print error message when attempt to encode the character failed. * - * @param main - * The main program data. * @param setting * The main program settings. * + * This does not alter setting.status. + * * Assumed to always be non-NULL. - * @param invalid - * The byte sequence string or unicode codepoint string representing a single character to print. + * @param print + * Designates the how and where to print. + * @param codepoint + * The codepoint that is invalid. * * @return * F_none on success. * F_output_not on success, but no printing is performed. - * - * @see utf8_print_combining_or_width() */ -#ifndef _di_utf8_print_character_invalid_ - extern f_status_t utf8_print_character_invalid(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t invalid); -#endif // _di_utf8_print_character_invalid_ +#ifndef _di_utf8_print_error_encode_ + extern f_status_t utf8_print_error_encode(utf8_setting_t * const setting, const fl_print_t print, const f_status_t status, const uint32_t codepoint); +#endif // _di_utf8_print_error_encode_ /** - * Print the codepoint number as a codepoint string (such as U+8C78). + * Print file related error or warning messages. * - * @param main - * The main program data. * @param setting * The main program settings. * + * This does not alter setting.status. + * * Assumed to always be non-NULL. - * @param codepoint - * The codepoint to print. - * This is the code that represents a single character. + * @param print + * Designates how printing is to be performed. + * @param function + * The name of the function where the error happened. + * Set to 0 to disable. + * @param name + * The name of the file or directory. + * @param operation + * The operation that fails, such as 'create' or 'access'. + * @param type + * A valid file type code from the fll_error_file_type enum. * * @return * F_none on success. * F_output_not on success, but no printing is performed. + * + * @see fll_error_file_print() */ -#ifndef _di_utf8_print_codepoint_ - extern f_status_t utf8_print_codepoint(fll_program_data_t * const main, utf8_setting_t * const setting, const uint32_t codepoint); -#endif // _di_utf8_print_codepoint_ +#ifndef _di_utf8_print_error_file_ + extern f_status_t utf8_print_error_file(utf8_setting_t * const setting, const fl_print_t print, const f_string_t function, const f_string_static_t name, const f_string_static_t operation, const uint8_t type); +#endif // _di_utf8_print_error_file_ /** - * Print the width or combining state of the given character. + * Print error message for when no sources are provided. * - * @param main - * The main program data. * @param setting * The main program settings. * - * Assumed to always be non-NULL. - * @param sequence - * A byte sequences representing a single character to print. + * This does not alter setting.status. * - * @see utf8_print_width() + * Assumed to always be non-NULL. + * @param print + * Designates how printing is to be performed. * * @return * F_none on success. * F_output_not on success, but no printing is performed. */ -#ifndef _di_utf8_print_combining_or_width_ - extern f_status_t utf8_print_combining_or_width(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t sequence); -#endif // _di_utf8_print_combining_or_width_ +#ifndef _di_utf8_print_error_no_from_ + extern f_status_t utf8_print_error_no_from(utf8_setting_t * const setting, const fl_print_t print); +#endif // _di_utf8_print_error_no_from_ /** - * Print an error regarding the width or combining state of a some character. + * Print error message for when the file parameter is an empty string. * - * @param main - * The main program data. * @param setting * The main program settings. * + * This does not alter setting.status. + * * Assumed to always be non-NULL. + * @param print + * Designates how printing is to be performed. + * @param index + * The index within the argv[] array where the empty string is found. * * @return * F_none on success. * F_output_not on success, but no printing is performed. */ -#ifndef _di_utf8_print_error_combining_or_width_ - extern f_status_t utf8_print_error_combining_or_width(fll_program_data_t * const main, utf8_setting_t * const setting); -#endif // _di_utf8_print_error_combining_or_width_ +#ifndef _di_utf8_print_error_parameter_file_name_empty_ + extern f_status_t utf8_print_error_parameter_file_name_empty(utf8_setting_t * const setting, const fl_print_t print, const f_array_length_t index); +#endif // _di_utf8_print_error_parameter_file_name_empty_ /** - * Print error message when attempt to decode the character failed. + * Print error message for when no sources are provided in the main program parameters. * - * @param main - * The main program data. * @param setting * The main program settings. * + * This does not alter setting.status. + * * Assumed to always be non-NULL. - * @param invalid - * The byte sequence string or unicode codepoint string representing a single character to print. + * @param print + * Designates how printing is to be performed. + * @param from + * If TRUE, then this is a from file (source file). + * If FALSE, then this is a to file (destination file). + * @param name + * The file path name. * * @return * F_none on success. * F_output_not on success, but no printing is performed. */ -#ifndef _di_utf8_print_error_decode_ - extern f_status_t utf8_print_error_decode(fll_program_data_t * const main, utf8_setting_t * const setting, const f_status_t status, const f_string_static_t invalid); -#endif // _di_utf8_print_error_decode_ +#ifndef _di_utf8_print_error_parameter_file_not_found_ + extern f_status_t utf8_print_error_parameter_file_not_found(utf8_setting_t * const setting, const fl_print_t print, const bool from, const f_string_static_t name); +#endif // _di_utf8_print_error_parameter_file_not_found_ /** - * Print error message when attempt to encode the character failed. + * Print error message for when too many 'to' destinations are specified. * - * @param main - * The main program data. * @param setting * The main program settings. * + * This does not alter setting.status. + * * Assumed to always be non-NULL. - * @param codepoint - * The codepoint that is invalid. + * @param print + * Designates how printing is to be performed. * * @return * F_none on success. * F_output_not on success, but no printing is performed. */ -#ifndef _di_utf8_print_error_encode_ - extern f_status_t utf8_print_error_encode(fll_program_data_t * const main, utf8_setting_t * const setting, const f_status_t status, const uint32_t codepoint); -#endif // _di_utf8_print_error_encode_ +#ifndef _di_utf8_print_error_parameter_file_to_too_many_ + extern f_status_t utf8_print_error_parameter_file_to_too_many(utf8_setting_t * const setting, const fl_print_t print); +#endif // _di_utf8_print_error_parameter_file_to_too_many_ /** - * Print error message for when no sources are provided. + * Print the byte sequence character (such as '豸'). * - * @param main - * The main program data. * @param setting * The main program settings. * + * This does not alter setting.status. + * * Assumed to always be non-NULL. + * @param print + * Designates how printing is to be performed. + * @param sequence + * A byte sequences representing a single character to print. * * @return * F_none on success. * F_output_not on success, but no printing is performed. */ -#ifndef _di_utf8_print_error_no_from_ - extern f_status_t utf8_print_error_no_from(fll_program_data_t * const main, utf8_setting_t * const setting); -#endif // _di_utf8_print_error_no_from_ +#ifndef _di_utf8_print_bytesequence_ + extern f_status_t utf8_print_bytesequence(utf8_setting_t * const setting, const fl_print_t print, const f_string_static_t sequence); +#endif // _di_utf8_print_bytesequence_ /** - * Print error message for when the file parameter is an empty string. + * Print an invalid character either as a Unicode codeblock or as a byte sequence. + * + * This handles whether or not the invalid character should be printed or not based on program parameters. * - * @param main - * The main program data. * @param setting * The main program settings. * + * This does not alter setting.status. + * * Assumed to always be non-NULL. - * @param index - * The index within the argv[] array where the empty string is found. + * @param print + * Designates how printing is to be performed. + * @param invalid + * The byte sequence string or unicode codepoint string representing a single character to print. * * @return * F_none on success. * F_output_not on success, but no printing is performed. + * + * @see utf8_print_combining_or_width() */ -#ifndef _di_utf8_print_error_parameter_file_name_empty_ - extern f_status_t utf8_print_error_parameter_file_name_empty(fll_program_data_t * const main, utf8_setting_t * const setting, const f_array_length_t index); -#endif // _di_utf8_print_error_parameter_file_name_empty_ +#ifndef _di_utf8_print_character_invalid_ + extern f_status_t utf8_print_character_invalid(utf8_setting_t * const setting, const fl_print_t print, const f_string_static_t invalid); +#endif // _di_utf8_print_character_invalid_ /** - * Print error message for when no sources are provided in the main program parameters. + * Print the codepoint number as a codepoint string (such as U+8C78). * - * @param main - * The main program data. * @param setting * The main program settings. * + * This does not alter setting.status. + * * Assumed to always be non-NULL. - * @param from - * If TRUE, then this is a from file (source file). - * If FALSE, then this is a to file (destination file). - * @param name - * The file path name. + * @param print + * Designates how printing is to be performed. + * @param codepoint + * The codepoint to print. + * This is the code that represents a single character. * * @return * F_none on success. * F_output_not on success, but no printing is performed. */ -#ifndef _di_utf8_print_error_parameter_file_not_found_ - extern f_status_t utf8_print_error_parameter_file_not_found(fll_program_data_t * const main, utf8_setting_t * const setting, const bool from, const f_string_static_t name); -#endif // _di_utf8_print_error_parameter_file_not_found_ +#ifndef _di_utf8_print_codepoint_ + extern f_status_t utf8_print_codepoint(utf8_setting_t * const setting, const fl_print_t print, const uint32_t codepoint); +#endif // _di_utf8_print_codepoint_ /** - * Print error message for when too many 'to' destinations are specified. + * Print the width or combining state of the given character. * - * @param main - * The main program data. * @param setting * The main program settings. * + * This does not alter setting.status. + * * Assumed to always be non-NULL. + * @param print + * Designates how printing is to be performed. + * @param sequence + * A byte sequences representing a single character to print. + * + * @see utf8_print_width() * * @return * F_none on success. * F_output_not on success, but no printing is performed. */ -#ifndef _di_utf8_print_error_parameter_file_to_too_many_ - extern f_status_t utf8_print_error_parameter_file_to_too_many(fll_program_data_t * const main, utf8_setting_t * const setting); -#endif // _di_utf8_print_error_parameter_file_to_too_many_ +#ifndef _di_utf8_print_combining_or_width_ + extern f_status_t utf8_print_combining_or_width(utf8_setting_t * const setting, const fl_print_t print, const f_string_static_t sequence); +#endif // _di_utf8_print_combining_or_width_ /** - * Flush the output, if appropriate. - * - * This is intended to be run after the utf8_main() is complete. + * Print an error regarding the width or combining state of a some character. * - * @param main - * The main program data. * @param setting * The main program settings. * * This does not alter setting.status. * + * Assumed to always be non-NULL. + * @param print + * Designates how printing is to be performed. + * * @return * F_none on success. * F_output_not on success, but no printing is performed. */ -#ifndef _di_utf8_print_flush_ - extern f_status_t utf8_print_flush(fll_program_data_t * const main, utf8_setting_t * const setting); -#endif // _di_utf8_print_flush_ +#ifndef _di_utf8_print_combining_or_width_invalid_ + extern f_status_t utf8_print_combining_or_width_invalid(utf8_setting_t * const setting, const fl_print_t print); +#endif // _di_utf8_print_combining_or_width_invalid_ /** * Print help. @@ -312,6 +318,8 @@ extern "C" { * The main program settings. * * This does not alter setting.status. + * + * Assumed to always be non-NULL. * @param print * The output structure to print to. * @@ -334,6 +342,8 @@ extern "C" { * The main program settings. * * This does not alter setting.status. + * + * Assumed to always be non-NULL. * @param print * Designates the how and where to print. * @@ -356,6 +366,8 @@ extern "C" { * The main program settings. * * This does not alter setting.status. + * + * Assumed to always be non-NULL. * @param print * Designates the how and where to print. * @@ -378,6 +390,8 @@ extern "C" { * The main program settings. * * This does not alter setting.status. + * + * Assumed to always be non-NULL. * @param print * Designates the how and where to print. * @@ -400,6 +414,8 @@ extern "C" { * The main program settings. * * This does not alter setting.status. + * + * Assumed to always be non-NULL. * @param print * Designates the how and where to print. * @@ -414,12 +430,14 @@ extern "C" { /** * Print the raw character data (binary / byte sequence). * - * @param main - * The main program data. * @param setting * The main program settings. * + * This does not alter setting.status. + * * Assumed to always be non-NULL. + * @param print + * Designates the how and where to print. * @param raw * The raw string in integer format. * @param width @@ -430,18 +448,20 @@ extern "C" { * F_output_not on success, but no printing is performed. */ #ifndef _di_utf8_print_raw_bytesequence_ - extern f_status_t utf8_print_raw_bytesequence(fll_program_data_t * const main, utf8_setting_t * const setting, const f_utf_char_t raw, const uint8_t width); + extern f_status_t utf8_print_raw_bytesequence(utf8_setting_t * const setting, const fl_print_t print, const f_utf_char_t raw, const uint8_t width); #endif // _di_utf8_print_raw_bytesequence_ /** * Print the raw character data (codepoint). * - * @param main - * The main program data. * @param setting * The main program settings. * + * This does not alter setting.status. + * * Assumed to always be non-NULL. + * @param print + * Designates the how and where to print. * @param raw * The raw string already in codepoint format. * @@ -450,18 +470,20 @@ extern "C" { * F_output_not on success, but no printing is performed. */ #ifndef _di_utf8_print_raw_codepoint_ - extern f_status_t utf8_print_raw_codepoint(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t raw); + extern f_status_t utf8_print_raw_codepoint(utf8_setting_t * const setting, const fl_print_t print, const f_string_static_t raw); #endif // _di_utf8_print_raw_codepoint_ /** * Print the width or combining state of the for a raw character. * - * @param main - * The main program data. * @param setting * The main program settings. * + * This does not alter setting.status. + * * Assumed to always be non-NULL. + * @param print + * Designates the how and where to print. * @param width * The pre-calculated width. * @@ -472,18 +494,20 @@ extern "C" { * @see utf8_print_width() */ #ifndef _di_utf8_print_raw_combining_or_width_ - extern f_status_t utf8_print_raw_combining_or_width(fll_program_data_t * const main, utf8_setting_t * const setting, const uint8_t width); + extern f_status_t utf8_print_raw_combining_or_width(utf8_setting_t * const setting, const fl_print_t print, const uint8_t width); #endif // _di_utf8_print_raw_combining_or_width_ /** * Print the input file section header. * - * @param main - * The main program data. * @param setting * The main program settings. * + * This does not alter setting.status. + * * Assumed to always be non-NULL. + * @param print + * Designates the how and where to print. * @param name * The name of the file. * @param index @@ -494,18 +518,20 @@ extern "C" { * F_output_not on success, but no printing is performed. */ #ifndef _di_utf8_print_section_header_file_ - extern f_status_t utf8_print_section_header_file(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t name, const f_array_length_t index); + extern f_status_t utf8_print_section_header_file(utf8_setting_t * const setting, const fl_print_t print, const f_string_static_t name, const f_array_length_t index); #endif // _di_utf8_print_section_header_file_ /** * Print the input parameter section header. * - * @param main - * The main program data. * @param setting * The main program settings. * + * This does not alter setting.status. + * * Assumed to always be non-NULL. + * @param print + * Designates the how and where to print. * @param index * The index position of the parameter. * @@ -514,36 +540,40 @@ extern "C" { * F_output_not on success, but no printing is performed. */ #ifndef _di_utf8_print_section_header_parameter_ - extern f_status_t utf8_print_section_header_parameter(fll_program_data_t * const main, utf8_setting_t * const setting, const f_array_length_t index); + extern f_status_t utf8_print_section_header_parameter(utf8_setting_t * const setting, const fl_print_t print, const f_array_length_t index); #endif // _di_utf8_print_section_header_parameter_ /** * Print the input pipe section header. * - * @param main - * The main program data. * @param setting * The main program settings. * + * This does not alter setting.status. + * * Assumed to always be non-NULL. + * @param print + * Designates the how and where to print. * * @return * F_none on success. * F_output_not on success, but no printing is performed. */ #ifndef _di_utf8_print_section_header_pipe_ - extern f_status_t utf8_print_section_header_pipe(fll_program_data_t * const main, utf8_setting_t * const setting); + extern f_status_t utf8_print_section_header_pipe(utf8_setting_t * const setting, const fl_print_t print); #endif // _di_utf8_print_section_header_pipe_ /** * Print the width of the given character. * - * @param main - * The main program data. * @param setting * The main program settings. * + * This does not alter setting.status. + * * Assumed to always be non-NULL. + * @param print + * Designates the how and where to print. * @param sequence * A byte sequences representing a single character whose width is to be printed. * @@ -552,7 +582,7 @@ extern "C" { * F_output_not on success, but no printing is performed. */ #ifndef _di_utf8_print_width_ - extern f_status_t utf8_print_width(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t sequence); + extern f_status_t utf8_print_width(utf8_setting_t * const setting, const fl_print_t print, const f_string_static_t sequence); #endif // _di_utf8_print_width_ #ifdef __cplusplus diff --git a/level_3/utf8/c/private-utf8_bytesequence.c b/level_3/utf8/c/private-utf8_bytesequence.c index fd55550..dcf6e44 100644 --- a/level_3/utf8/c/private-utf8_bytesequence.c +++ b/level_3/utf8/c/private-utf8_bytesequence.c @@ -29,25 +29,25 @@ extern "C" { if (status == F_failure || status == F_utf_not || status == F_complete_not_utf || status == F_utf_fragment || status == F_valid_not) { valid_not = F_true; - utf8_print_character_invalid(main, setting, sequence); + utf8_print_character_invalid(setting, main->output, sequence); } else { status = F_status_set_error(status); - utf8_print_error_decode(main, setting, status, sequence); + utf8_print_error_decode(setting, main->error, status, sequence); return status; } } else if (!(setting->flag & utf8_main_flag_verify_e)) { if (setting->mode & utf8_mode_to_bytesequence_e) { - utf8_print_bytesequence(main, setting, sequence); + utf8_print_bytesequence(setting, main->output, sequence); } else if (setting->mode & utf8_mode_to_codepoint_e) { - utf8_print_codepoint(main, setting, codepoint); + utf8_print_codepoint(setting, main->output, codepoint); } else { - utf8_print_combining_or_width(main, setting, sequence); + utf8_print_combining_or_width(setting, main->output, sequence); } } diff --git a/level_3/utf8/c/private-utf8_codepoint.c b/level_3/utf8/c/private-utf8_codepoint.c index 29cc930..d0fb38e 100644 --- a/level_3/utf8/c/private-utf8_codepoint.c +++ b/level_3/utf8/c/private-utf8_codepoint.c @@ -36,19 +36,19 @@ extern "C" { if (status == F_failure || status == F_utf_not || status == F_complete_not_utf || status == F_utf_fragment || status == F_valid_not) { valid_not = F_true; - utf8_print_character_invalid(main, setting, unicode); + utf8_print_character_invalid(setting, main->output, unicode); } else { status = F_status_set_error(status); - utf8_print_error_decode(main, setting, status, unicode); + utf8_print_error_decode(setting, main->error, status, unicode); return status; } } else if (!(setting->flag & utf8_main_flag_verify_e)) { if (setting->mode & utf8_mode_to_codepoint_e) { - utf8_print_codepoint(main, setting, codepoint); + utf8_print_codepoint(setting, main->output, codepoint); } else { f_char_t byte[4] = { 0, 0, 0, 0 }; @@ -58,22 +58,22 @@ extern "C" { if (F_status_is_error(status)) { if (setting->mode & utf8_mode_to_bytesequence_e) { - utf8_print_error_encode(main, setting, status, codepoint); + utf8_print_error_encode(setting, main->error, status, codepoint); } else { - utf8_print_error_combining_or_width(main, setting); + utf8_print_combining_or_width_invalid(setting, main->output); } } else if (setting->mode & utf8_mode_to_bytesequence_e) { status = F_none; unicode.used = macro_f_utf_byte_width(unicode.string[0]); - utf8_print_bytesequence(main, setting, unicode); + utf8_print_bytesequence(setting, main->output, unicode); } else { status = F_none; - utf8_print_combining_or_width(main, setting, unicode); + utf8_print_combining_or_width(setting, main->output, unicode); } } } @@ -81,7 +81,7 @@ extern "C" { else if (*mode == utf8_codepoint_mode_bad_end_e) { status = F_none; - utf8_print_character_invalid(main, setting, unicode); + utf8_print_character_invalid(setting, main->output, unicode); } else { return F_none; @@ -132,12 +132,12 @@ extern "C" { if (status == F_number || status == F_utf_not || status == F_complete_not_utf || status == F_utf_fragment || status == F_number_decimal || status == F_number_negative || status == F_number_positive || status == F_number_overflow) { valid_not = F_true; - utf8_print_character_invalid(main, setting, hex); + utf8_print_character_invalid(setting, main->output, hex); } else { status = F_status_set_error(status); - utf8_print_error_decode(main, setting, status, hex); + utf8_print_error_decode(setting, main->error, status, hex); return status; } @@ -152,20 +152,20 @@ extern "C" { } if (setting->mode & utf8_mode_to_bytesequence_e) { - utf8_print_raw_bytesequence(main, setting, raw, width); + utf8_print_raw_bytesequence(setting, main->output, raw, width); } else if (setting->mode & utf8_mode_to_codepoint_e) { - utf8_print_raw_codepoint(main, setting, setting->text); + utf8_print_raw_codepoint(setting, main->output, setting->text); } else { - utf8_print_raw_combining_or_width(main, setting, width); + utf8_print_raw_combining_or_width(setting, main->output, width); } } } else if (*mode == utf8_codepoint_mode_bad_end_e) { status = F_none; - utf8_print_character_invalid(main, setting, hex); + utf8_print_character_invalid(setting, main->output, hex); } else { return F_none; diff --git a/level_3/utf8/c/utf8.c b/level_3/utf8/c/utf8.c index a26997b..28ce190 100644 --- a/level_3/utf8/c/utf8.c +++ b/level_3/utf8/c/utf8.c @@ -32,7 +32,7 @@ extern "C" { if (main->pipe & fll_program_data_pipe_input_e) { const f_file_t file = macro_f_file_t_initialize(F_type_input_d, F_type_descriptor_input_d, F_file_flag_read_only_d, 32768, F_file_default_write_size_d); - utf8_print_section_header_pipe(main, setting); + utf8_print_section_header_pipe(setting, main->output); if (setting->mode & utf8_mode_from_bytesequence_e) { setting->status = utf8_process_file_bytesequence(main, setting, file); @@ -73,7 +73,7 @@ extern "C" { main->signal_check = 0; } - utf8_print_section_header_file(main, setting, setting->path_files_from.array[i], i); + utf8_print_section_header_file(setting, main->output, setting->path_files_from.array[i], i); setting->status = f_file_stream_open(setting->path_files_from.array[i], f_string_empty_s, &file); @@ -139,7 +139,7 @@ extern "C" { main->signal_check = 0; } - utf8_print_section_header_parameter(main, setting, main->parameters.remaining.array[i]); + utf8_print_section_header_parameter(setting, main->output, main->parameters.remaining.array[i]); setting->status = utf8_process_text(main, setting, main->parameters.arguments.array[main->parameters.remaining.array[i]]); -- 1.8.3.1