Clear the setting flags when calling the settings load function.
Clean up some print function inconsistencies.
if (!main || !setting) return;
+ setting->flag = 0;
+
// Load parameters.
setting->status = f_console_parameter_process(arguments, &main->parameters);
if (!main || !setting) return;
+ setting->flag = 0;
+
// Load parameters.
setting->status = f_console_parameter_process(arguments, &main->parameters);
if (!main || !setting) return;
+ setting->flag = 0;
+
// Load parameters.
setting->status = f_console_parameter_process(arguments, &main->parameters);
if (!main || !setting) return;
+ setting->flag = 0;
+
// Load parameters.
setting->status = f_console_parameter_process(arguments, &main->parameters);
if (!main || !setting) return;
+ setting->flag = 0;
+
// Load parameters.
setting->status = f_console_parameter_process(arguments, &main->parameters);
if (!main || !setting) return;
+ setting->flag = 0;
+
// Load parameters.
setting->status = f_console_parameter_process(arguments, &main->parameters);
if (!main || !setting) return;
+ setting->flag = 0;
+
// Load parameters.
setting->status = f_console_parameter_process(arguments, &main->parameters);
if (!main || !setting) return;
+ setting->flag = 0;
+
// Load parameters.
setting->status = f_console_parameter_process(arguments, &main->parameters);
if (!main || !setting) return;
+ setting->flag = 0;
+
// Load parameters.
setting->status = f_console_parameter_process(arguments, &main->parameters);
if (!main || !setting) return;
+ setting->flag = 0;
+
// Load parameters.
setting->status = f_console_parameter_process(arguments, &main->parameters);
if (!main || !setting) return;
+ setting->flag = 0;
+
// Load parameters.
setting->status = f_console_parameter_process(arguments, &main->parameters);
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;
if (!main || !setting) return;
+ setting->flag = 0;
+
// Load parameters.
setting->status = f_console_parameter_process(arguments, &main->parameters);
if (!main || !setting) return;
+ setting->flag = 0;
+
// Load parameters.
setting->status = f_console_parameter_process(arguments, &main->parameters);
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;
if (!main || !setting) return;
+ setting->flag = 0;
+
// Load parameters.
setting->status = f_console_parameter_process(arguments, &main->parameters);
if (!main || !setting) return;
+ setting->flag = 0;
+
// Load parameters.
setting->status = f_console_parameter_process(arguments, &main->parameters);
if (!main || !setting) return;
+ setting->flag = 0;
+
// Load parameters.
setting->status = f_console_parameter_process(arguments, &main->parameters);
if (!main || !setting) return;
+ setting->flag = 0;
+
// Load parameters.
setting->status = f_console_parameter_process(arguments, &main->parameters);
if (!main || !setting) return;
+ setting->flag = 0;
+
// Load parameters.
setting->status = f_console_parameter_process(arguments, &main->parameters);
if (!main || !setting) return;
+ setting->flag = 0;
+
// Load parameters.
setting->status = f_console_parameter_process(arguments, &main->parameters);
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);
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);
if (!main || !setting) return;
+ setting->flag = 0;
+
// Load parameters.
setting->status = f_console_parameter_process(arguments, &main->parameters);
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);
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);
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);
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);
if (!main || !setting) return;
+ setting->flag = 0;
+
// Load parameters.
setting->status = f_console_parameter_process(arguments, &main->parameters);
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);
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);
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;
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);
if (!main || !setting) return;
+ setting->flag = 0;
+
// Load parameters.
setting->status = f_console_parameter_process(arguments, &main->parameters);
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;
}
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);
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);
}
}
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);
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;
}
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_
* - 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.
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_
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);
}
#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) {
#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;
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;
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;
#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;
}
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;
}
* 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.
*
#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.
* The main program settings.
*
* This does not alter setting.status.
+ *
+ * Assumed to always be non-NULL.
* @param print
* The output structure to print to.
*
* 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.
*
* 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.
*
* 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.
*
* 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.
*
/**
* 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
* 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.
*
* 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.
*
* @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
* 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.
*
* 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.
*
* 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
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);
}
}
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 };
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);
}
}
}
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;
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;
}
}
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;
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);
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);
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]]);