From: Kevin Day Date: Wed, 22 Mar 2023 05:15:41 +0000 (-0500) Subject: Progress: Continue program related work, focusing on printing. X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=816db25965d379d303b38cbefa367f13980657f3;p=fll Progress: Continue program related work, focusing on printing. Lots of printing related changes and clean ups. Begin preparing things for switching to the *_main_t structures. The fake, status_code, and utf8 projects are already converted to this. There is a lot of stubbing in this commit. I am probably going to just start a clean slate when building fss_read. The fss_read will be based off of fss_write's design. For this reason, I am being lax and negligent on the fss_*_read projects as they are going to get replaced and merged into fss_read. --- diff --git a/level_2/fll_error/c/error.c b/level_2/fll_error/c/error.c index 4e06e90..6b4f775 100644 --- a/level_2/fll_error/c/error.c +++ b/level_2/fll_error/c/error.c @@ -6,14 +6,20 @@ extern "C" { #endif #ifndef _di_fll_error_print_ - f_status_t fll_error_print(const fl_print_t print, const f_status_t status, const f_string_t function, const uint8_t flag) { + f_status_t fll_error_print(fl_print_t * const print, const f_status_t status, const f_string_t function, const uint8_t flag) { + #ifndef _di_level_2_parameter_checking_ + if (!print) return F_status_set_error(F_parameter); + #endif // _di_level_2_parameter_checking_ return private_fll_error_print(print, status, function, flag); } #endif // _di_fll_error_print_ #ifndef _di_fll_error_file_print_ - f_status_t fll_error_file_print(const fl_print_t print, const f_status_t status, const f_string_t function, const uint8_t flag, const f_string_static_t name, const f_string_static_t operation, const uint8_t type) { + f_status_t fll_error_file_print(fl_print_t * const print, const f_status_t status, const f_string_t function, const uint8_t flag, const f_string_static_t name, const f_string_static_t operation, const uint8_t type) { + #ifndef _di_level_2_parameter_checking_ + if (!print) return F_status_set_error(F_parameter); + #endif // _di_level_2_parameter_checking_ f_string_static_t type_name = fll_error_file_type_file_s; @@ -31,508 +37,508 @@ extern "C" { } if (status == F_access_denied) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QAccess denied while trying to %Q %Q '%]", print.to, print.context, print.prefix, operation, type_name, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, name, print.notable); - fl_print_format("%['.%]%r", print.to, print.context, print.context, f_string_eol_s); + fl_print_format("%[%QAccess denied while trying to %Q %Q '%]", print->to, print->context, print->prefix, operation, type_name, print->context); + fl_print_format("%[%Q%]", print->to, print->notable, name, print->notable); + fl_print_format("%['.%]%r", print->to, print->context, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; } if (status == F_access_group) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QCurrent user is not allowed to use the given group while trying to %Q %Q '%]", print.to, print.context, print.prefix, operation, type_name, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, name, print.notable); - fl_print_format("%['.%]%r", print.to, print.context, print.context, f_string_eol_s); + fl_print_format("%[%QCurrent user is not allowed to use the given group while trying to %Q %Q '%]", print->to, print->context, print->prefix, operation, type_name, print->context); + fl_print_format("%[%Q%]", print->to, print->notable, name, print->notable); + fl_print_format("%['.%]%r", print->to, print->context, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; } if (status == F_access_owner) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QCurrent user is not allowed to use the given owner while trying to %Q %Q '%]", print.to, print.context, print.prefix, operation, type_name, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, name, print.notable); - fl_print_format("%['.%]%r", print.to, print.context, print.context, f_string_eol_s); + fl_print_format("%[%QCurrent user is not allowed to use the given owner while trying to %Q %Q '%]", print->to, print->context, print->prefix, operation, type_name, print->context); + fl_print_format("%[%Q%]", print->to, print->notable, name, print->notable); + fl_print_format("%['.%]%r", print->to, print->context, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; } if (status == F_directory) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QInvalid directory while trying to %Q %Q '%]", print.to, print.context, print.prefix, operation, type_name, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, name, print.notable); - fl_print_format("%['.%]%r", print.to, print.context, print.context, f_string_eol_s); + fl_print_format("%[%QInvalid directory while trying to %Q %Q '%]", print->to, print->context, print->prefix, operation, type_name, print->context); + fl_print_format("%[%Q%]", print->to, print->notable, name, print->notable); + fl_print_format("%['.%]%r", print->to, print->context, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; } if (status == F_directory_empty_not) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QUnable to %Q %Q '%]", print.to, print.context, print.prefix, operation, type_name, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, name, print.notable); - fl_print_format("%[', not empty.%]%r", print.to, print.context, print.context, f_string_eol_s); + fl_print_format("%[%QUnable to %Q %Q '%]", print->to, print->context, print->prefix, operation, type_name, print->context); + fl_print_format("%[%Q%]", print->to, print->notable, name, print->notable); + fl_print_format("%[', not empty.%]%r", print->to, print->context, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; } if (status == F_error) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QFailed to %Q %Q '%]", print.to, print.context, print.prefix, operation, type_name, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, name, print.notable); - fl_print_format("%[', already in an error state->%]%r", print.to, print.context, print.context, f_string_eol_s); + fl_print_format("%[%QFailed to %Q %Q '%]", print->to, print->context, print->prefix, operation, type_name, print->context); + fl_print_format("%[%Q%]", print->to, print->notable, name, print->notable); + fl_print_format("%[', already in an error state->%]%r", print->to, print->context, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; } if (status == F_failure) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QFailed to %Q %Q '%]", print.to, print.context, print.prefix, operation, type_name, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, name, print.notable); - fl_print_format("%['.%]%r", print.to, print.context, print.context, f_string_eol_s); + fl_print_format("%[%QFailed to %Q %Q '%]", print->to, print->context, print->prefix, operation, type_name, print->context); + fl_print_format("%[%Q%]", print->to, print->notable, name, print->notable); + fl_print_format("%['.%]%r", print->to, print->context, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; } if (status == F_file_close) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QUnable to %Q %Q '%]", print.to, print.context, print.prefix, operation, type_name, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, name, print.notable); - fl_print_format("%[', failed to close.%]%r", print.to, print.context, print.context, f_string_eol_s); + fl_print_format("%[%QUnable to %Q %Q '%]", print->to, print->context, print->prefix, operation, type_name, print->context); + fl_print_format("%[%Q%]", print->to, print->notable, name, print->notable); + fl_print_format("%[', failed to close.%]%r", print->to, print->context, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; } if (status == F_file_closed) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QUnable to %Q %Q '%]", print.to, print.context, print.prefix, operation, type_name, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, name, print.notable); - fl_print_format("%[', is closed.%]%r", print.to, print.context, print.context, f_string_eol_s); + fl_print_format("%[%QUnable to %Q %Q '%]", print->to, print->context, print->prefix, operation, type_name, print->context); + fl_print_format("%[%Q%]", print->to, print->notable, name, print->notable); + fl_print_format("%[', is closed.%]%r", print->to, print->context, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; } if (status == F_file_descriptor) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QFile descriptor error while trying to %Q %Q '%]", print.to, print.context, print.prefix, operation, type_name, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, name, print.notable); - fl_print_format("%['.%]%r", print.to, print.context, print.context, f_string_eol_s); + fl_print_format("%[%QFile descriptor error while trying to %Q %Q '%]", print->to, print->context, print->prefix, operation, type_name, print->context); + fl_print_format("%[%Q%]", print->to, print->notable, name, print->notable); + fl_print_format("%['.%]%r", print->to, print->context, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; } if (status == F_file_descriptor_max) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QMax file descriptors reached while trying to %Q %Q '%]", print.to, print.context, print.prefix, operation, type_name, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, name, print.notable); - fl_print_format("%['.%]%r", print.to, print.context, print.context, f_string_eol_s); + fl_print_format("%[%QMax file descriptors reached while trying to %Q %Q '%]", print->to, print->context, print->prefix, operation, type_name, print->context); + fl_print_format("%[%Q%]", print->to, print->notable, name, print->notable); + fl_print_format("%['.%]%r", print->to, print->context, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; } if (status == F_file_descriptor_not) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QInvalid file descriptor while trying to %Q %Q '%]", print.to, print.context, print.prefix, operation, type_name, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, name, print.notable); - fl_print_format("%['.%]%r", print.to, print.context, print.context, f_string_eol_s); + fl_print_format("%[%QInvalid file descriptor while trying to %Q %Q '%]", print->to, print->context, print->prefix, operation, type_name, print->context); + fl_print_format("%[%Q%]", print->to, print->notable, name, print->notable); + fl_print_format("%['.%]%r", print->to, print->context, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; } if (status == F_file_empty) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QUnable to %Q %Q '%]", print.to, print.context, print.prefix, operation, type_name, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, name, print.notable); - fl_print_format("%[', %Q is empty.%]%r", print.to, print.context, type_name, print.context, f_string_eol_s); + fl_print_format("%[%QUnable to %Q %Q '%]", print->to, print->context, print->prefix, operation, type_name, print->context); + fl_print_format("%[%Q%]", print->to, print->notable, name, print->notable); + fl_print_format("%[', %Q is empty.%]%r", print->to, print->context, type_name, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; } if (status == F_file_flush) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QUnable to %Q %Q '%]", print.to, print.context, print.prefix, operation, type_name, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, name, print.notable); - fl_print_format("%[', flush failed.%]%r", print.to, print.context, print.context, f_string_eol_s); + fl_print_format("%[%QUnable to %Q %Q '%]", print->to, print->context, print->prefix, operation, type_name, print->context); + fl_print_format("%[%Q%]", print->to, print->notable, name, print->notable); + fl_print_format("%[', flush failed.%]%r", print->to, print->context, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; } if (status == F_file_found) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QUnable to %Q %Q '%]", print.to, print.context, print.prefix, operation, type_name, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, name, print.notable); - fl_print_format("%[', found.%]%r", print.to, print.context, print.context, f_string_eol_s); + fl_print_format("%[%QUnable to %Q %Q '%]", print->to, print->context, print->prefix, operation, type_name, print->context); + fl_print_format("%[%Q%]", print->to, print->notable, name, print->notable); + fl_print_format("%[', found.%]%r", print->to, print->context, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; } if (status == F_file_found_not) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QUnable to %Q %Q '%]", print.to, print.context, print.prefix, operation, type_name, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, name, print.notable); - fl_print_format("%[', could not find.%]%r", print.to, print.context, print.context, f_string_eol_s); + fl_print_format("%[%QUnable to %Q %Q '%]", print->to, print->context, print->prefix, operation, type_name, print->context); + fl_print_format("%[%Q%]", print->to, print->notable, name, print->notable); + fl_print_format("%[', could not find.%]%r", print->to, print->context, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; } if (status == F_file_open) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QUnable to %Q %Q '%]", print.to, print.context, print.prefix, operation, type_name, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, name, print.notable); - fl_print_format("%[', already open.%]%r", print.to, print.context, print.context, f_string_eol_s); + fl_print_format("%[%QUnable to %Q %Q '%]", print->to, print->context, print->prefix, operation, type_name, print->context); + fl_print_format("%[%Q%]", print->to, print->notable, name, print->notable); + fl_print_format("%[', already open.%]%r", print->to, print->context, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; } if (status == F_file_open_max) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QMax open files reached while trying to %Q %Q '%]", print.to, print.context, print.prefix, operation, type_name, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, name, print.notable); - fl_print_format("%['.%]%r", print.to, print.context, print.context, f_string_eol_s); + fl_print_format("%[%QMax open files reached while trying to %Q %Q '%]", print->to, print->context, print->prefix, operation, type_name, print->context); + fl_print_format("%[%Q%]", print->to, print->notable, name, print->notable); + fl_print_format("%['.%]%r", print->to, print->context, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; } if (status == F_file_overflow) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QOverflow while trying to %Q %Q '%]", print.to, print.context, print.prefix, operation, type_name, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, name, print.notable); - fl_print_format("%['.%]%r", print.to, print.context, print.context, f_string_eol_s); + fl_print_format("%[%QOverflow while trying to %Q %Q '%]", print->to, print->context, print->prefix, operation, type_name, print->context); + fl_print_format("%[%Q%]", print->to, print->notable, name, print->notable); + fl_print_format("%['.%]%r", print->to, print->context, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; } if (status == F_file_purge) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QUnable to %Q %Q '%]", print.to, print.context, print.prefix, operation, type_name, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, name, print.notable); - fl_print_format("%[', purge failed.%]%r", print.to, print.context, print.context, f_string_eol_s); + fl_print_format("%[%QUnable to %Q %Q '%]", print->to, print->context, print->prefix, operation, type_name, print->context); + fl_print_format("%[%Q%]", print->to, print->notable, name, print->notable); + fl_print_format("%[', purge failed.%]%r", print->to, print->context, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; } if (status == F_file_read) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QRead failed while trying to %Q %Q '%]", print.to, print.context, print.prefix, operation, type_name, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, name, print.notable); - fl_print_format("%['.%]%r", print.to, print.context, print.context, f_string_eol_s); + fl_print_format("%[%QRead failed while trying to %Q %Q '%]", print->to, print->context, print->prefix, operation, type_name, print->context); + fl_print_format("%[%Q%]", print->to, print->notable, name, print->notable); + fl_print_format("%['.%]%r", print->to, print->context, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; } if (status == F_file_seek) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QSeek failed while trying to %Q %Q '%]", print.to, print.context, print.prefix, operation, type_name, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, name, print.notable); - fl_print_format("%['.%]%r", print.to, print.context, print.context, f_string_eol_s); + fl_print_format("%[%QSeek failed while trying to %Q %Q '%]", print->to, print->context, print->prefix, operation, type_name, print->context); + fl_print_format("%[%Q%]", print->to, print->notable, name, print->notable); + fl_print_format("%['.%]%r", print->to, print->context, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; } if (status == F_file_stat) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QStat failed while trying to %Q %Q '%]", print.to, print.context, print.prefix, operation, type_name, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, name, print.notable); - fl_print_format("%['.%]%r", print.to, print.context, print.context, f_string_eol_s); + fl_print_format("%[%QStat failed while trying to %Q %Q '%]", print->to, print->context, print->prefix, operation, type_name, print->context); + fl_print_format("%[%Q%]", print->to, print->notable, name, print->notable); + fl_print_format("%['.%]%r", print->to, print->context, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; } if (status == F_file_synchronize) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QSynchronize failed while trying to %Q %Q '%]", print.to, print.context, print.prefix, operation, type_name, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, name, print.notable); - fl_print_format("%['.%]%r", print.to, print.context, print.context, f_string_eol_s); + fl_print_format("%[%QSynchronize failed while trying to %Q %Q '%]", print->to, print->context, print->prefix, operation, type_name, print->context); + fl_print_format("%[%Q%]", print->to, print->notable, name, print->notable); + fl_print_format("%['.%]%r", print->to, print->context, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; } if (status == F_file_type_unknown) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QFailed to %Q %Q, the path '%]", print.to, print.context, print.prefix, operation, type_name, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, name, print.notable); - fl_print_format("%[' is an unknown file type.%]%r", print.to, print.context, print.context, f_string_eol_s); + fl_print_format("%[%QFailed to %Q %Q, the path '%]", print->to, print->context, print->prefix, operation, type_name, print->context); + fl_print_format("%[%Q%]", print->to, print->notable, name, print->notable); + fl_print_format("%[' is an unknown file type.%]%r", print->to, print->context, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; } if (status == F_file_utf) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QUTF failure while trying to %Q %Q '%]", print.to, print.context, print.prefix, operation, type_name, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, name, print.notable); - fl_print_format("%['.%]%r", print.to, print.context, print.context, f_string_eol_s); + fl_print_format("%[%QUTF failure while trying to %Q %Q '%]", print->to, print->context, print->prefix, operation, type_name, print->context); + fl_print_format("%[%Q%]", print->to, print->notable, name, print->notable); + fl_print_format("%['.%]%r", print->to, print->context, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; } if (status == F_file_utf_not) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QInvalid UTF while trying to %Q %Q '%]", print.to, print.context, print.prefix, operation, type_name, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, name, print.notable); - fl_print_format("%['.%]%r", print.to, print.context, print.context, f_string_eol_s); + fl_print_format("%[%QInvalid UTF while trying to %Q %Q '%]", print->to, print->context, print->prefix, operation, type_name, print->context); + fl_print_format("%[%Q%]", print->to, print->notable, name, print->notable); + fl_print_format("%['.%]%r", print->to, print->context, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; } if (status == F_file_underflow) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QUnderflow while trying to %Q %Q '%]", print.to, print.context, print.prefix, operation, type_name, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, name, print.notable); - fl_print_format("%['.%]%r", print.to, print.context, print.context, f_string_eol_s); + fl_print_format("%[%QUnderflow while trying to %Q %Q '%]", print->to, print->context, print->prefix, operation, type_name, print->context); + fl_print_format("%[%Q%]", print->to, print->notable, name, print->notable); + fl_print_format("%['.%]%r", print->to, print->context, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; } if (status == F_file_write) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QFailed to %Q %Q '%]", print.to, print.context, print.prefix, operation, type_name, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, name, print.notable); - fl_print_format("%[', write failure.%]%r", print.to, print.context, print.context, f_string_eol_s); + fl_print_format("%[%QFailed to %Q %Q '%]", print->to, print->context, print->prefix, operation, type_name, print->context); + fl_print_format("%[%Q%]", print->to, print->notable, name, print->notable); + fl_print_format("%[', write failure.%]%r", print->to, print->context, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; } if (status == F_loop) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QLoop while trying to %Q %Q '%]", print.to, print.context, print.prefix, operation, type_name, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, name, print.notable); - fl_print_format("%['.%]%r", print.to, print.context, print.context, f_string_eol_s); + fl_print_format("%[%QLoop while trying to %Q %Q '%]", print->to, print->context, print->prefix, operation, type_name, print->context); + fl_print_format("%[%Q%]", print->to, print->notable, name, print->notable); + fl_print_format("%['.%]%r", print->to, print->context, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; } if (status == F_name) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QInvalid %Q name '%]", print.to, print.context, print.prefix, type_name, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, name, print.notable); - fl_print_format("%['.%]%r", print.to, print.context, print.context, f_string_eol_s); + fl_print_format("%[%QInvalid %Q name '%]", print->to, print->context, print->prefix, type_name, print->context); + fl_print_format("%[%Q%]", print->to, print->notable, name, print->notable); + fl_print_format("%['.%]%r", print->to, print->context, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; } if (status == F_number_overflow) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QNumber overflow while trying to %Q %Q '%]", print.to, print.context, print.prefix, operation, type_name, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, name, print.notable); - fl_print_format("%['.%]%r", print.to, print.context, print.context, f_string_eol_s); + fl_print_format("%[%QNumber overflow while trying to %Q %Q '%]", print->to, print->context, print->prefix, operation, type_name, print->context); + fl_print_format("%[%Q%]", print->to, print->notable, name, print->notable); + fl_print_format("%['.%]%r", print->to, print->context, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; } if (status == F_number_underflow) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QNumber underflow while trying to %Q %Q '%]", print.to, print.context, print.prefix, operation, type_name, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, name, print.notable); - fl_print_format("%['.%]%r", print.to, print.context, print.context, f_string_eol_s); + fl_print_format("%[%QNumber underflow while trying to %Q %Q '%]", print->to, print->context, print->prefix, operation, type_name, print->context); + fl_print_format("%[%Q%]", print->to, print->notable, name, print->notable); + fl_print_format("%['.%]%r", print->to, print->context, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; } if (status == F_parameter) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QInvalid parameter", print.to, print.context, print.prefix); + fl_print_format("%[%QInvalid parameter", print->to, print->context, print->prefix); private_fll_error_print_function(print, function); - fl_print_format(" for the %Q '%]", print.to, type_name, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, name, print.notable); - fl_print_format("%['.%]%r", print.to, print.context, print.context, f_string_eol_s); + fl_print_format(" for the %Q '%]", print->to, type_name, print->context); + fl_print_format("%[%Q%]", print->to, print->notable, name, print->notable); + fl_print_format("%['.%]%r", print->to, print->context, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; } if (status == F_prohibited) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QProhibited by system while trying to %Q %Q '%]", print.to, print.context, print.prefix, operation, type_name, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, name, print.notable); - fl_print_format("%['.%]%r", print.to, print.context, print.context, f_string_eol_s); + fl_print_format("%[%QProhibited by system while trying to %Q %Q '%]", print->to, print->context, print->prefix, operation, type_name, print->context); + fl_print_format("%[%Q%]", print->to, print->notable, name, print->notable); + fl_print_format("%['.%]%r", print->to, print->context, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; } if (status == F_read_only) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QUnable to %Q %Q '%]", print.to, print.context, print.prefix, operation, type_name, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, name, print.notable); - fl_print_format("%[', %Q is read only.%]%r", print.to, print.context, type_name, print.context, f_string_eol_s); + fl_print_format("%[%QUnable to %Q %Q '%]", print->to, print->context, print->prefix, operation, type_name, print->context); + fl_print_format("%[%Q%]", print->to, print->notable, name, print->notable); + fl_print_format("%[', %Q is read only.%]%r", print->to, print->context, type_name, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; @@ -541,14 +547,14 @@ extern "C" { if (status == F_write_only) { private_fll_error_print_unable_to(print, operation, name, type_name, "is write only"); - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QUnable to %Q %Q '%]", print.to, print.context, print.prefix, operation, type_name, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, name, print.notable); - fl_print_format("%[', %Q is write only.%]%r", print.to, print.context, type_name, print.context, f_string_eol_s); + fl_print_format("%[%QUnable to %Q %Q '%]", print->to, print->context, print->prefix, operation, type_name, print->context); + fl_print_format("%[%Q%]", print->to, print->notable, name, print->notable); + fl_print_format("%[', %Q is write only.%]%r", print->to, print->context, type_name, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; @@ -556,28 +562,28 @@ extern "C" { if (type == fll_error_file_type_file_e) { if (status == F_file_type_not_directory) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QInvalid or missing directory in path while trying to %Q %Q '%]", print.to, print.context, print.prefix, operation, type_name, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, name, print.notable); - fl_print_format("%['.%]%r", print.to, print.context, print.context, f_string_eol_s); + fl_print_format("%[%QInvalid or missing directory in path while trying to %Q %Q '%]", print->to, print->context, print->prefix, operation, type_name, print->context); + fl_print_format("%[%Q%]", print->to, print->notable, name, print->notable); + fl_print_format("%['.%]%r", print->to, print->context, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; } if (status == F_file_type_directory) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QFailed to %Q %Q, the path '%]", print.to, print.context, print.prefix, operation, type_name, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, name, print.notable); - fl_print_format("%[' is a directory.%]%r", print.to, print.context, print.context, f_string_eol_s); + fl_print_format("%[%QFailed to %Q %Q, the path '%]", print->to, print->context, print->prefix, operation, type_name, print->context); + fl_print_format("%[%Q%]", print->to, print->notable, name, print->notable); + fl_print_format("%[' is a directory.%]%r", print->to, print->context, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; @@ -585,14 +591,14 @@ extern "C" { } else if (type == fll_error_file_type_directory_e) { if (status == F_file_type_regular) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QFailed to %Q %Q, the path '%]", print.to, print.context, print.prefix, operation, type_name, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, name, print.notable); - fl_print_format("%[' is a file.%]%r", print.to, print.context, print.context, f_string_eol_s); + fl_print_format("%[%QFailed to %Q %Q, the path '%]", print->to, print->context, print->prefix, operation, type_name, print->context); + fl_print_format("%[%Q%]", print->to, print->notable, name, print->notable); + fl_print_format("%[' is a file.%]%r", print->to, print->context, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; @@ -601,28 +607,28 @@ extern "C" { if (type == fll_error_file_type_file_e || type == fll_error_file_type_directory_e || type == fll_error_file_type_path_e) { if (status == F_directory_found_not) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QFailed to %Q %Q '%]", print.to, print.context, print.prefix, operation, type_name, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, name, print.notable); - fl_print_format("%[' due to an invalid directory in the path.%]%r", print.to, print.context, print.context, f_string_eol_s); + fl_print_format("%[%QFailed to %Q %Q '%]", print->to, print->context, print->prefix, operation, type_name, print->context); + fl_print_format("%[%Q%]", print->to, print->notable, name, print->notable); + fl_print_format("%[' due to an invalid directory in the path.%]%r", print->to, print->context, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; } if (status == F_file_type_pipe || status == F_file_type_socket) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QFailed to %Q %Q, the path '%]", print.to, print.context, print.prefix, operation, type_name, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, name, print.notable); - fl_print_format("%[' is a %Q.%]%r", print.to, print.context, status == F_file_type_pipe ? fll_error_file_type_pipe_s : fll_error_file_type_socket_s, print.context, f_string_eol_s); + fl_print_format("%[%QFailed to %Q %Q, the path '%]", print->to, print->context, print->prefix, operation, type_name, print->context); + fl_print_format("%[%Q%]", print->to, print->notable, name, print->notable); + fl_print_format("%[' is a %Q.%]%r", print->to, print->context, status == F_file_type_pipe ? fll_error_file_type_pipe_s : fll_error_file_type_socket_s, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; @@ -634,97 +640,100 @@ extern "C" { #endif // _di_fll_error_file_print_ #ifndef _di_fll_error_parameter_integer_print_ - f_status_t fll_error_parameter_integer_print(const fl_print_t print, const f_status_t status, const f_string_t function, const uint8_t flag, const f_string_static_t parameter, const f_string_static_t argument) { + f_status_t fll_error_parameter_integer_print(fl_print_t * const print, const f_status_t status, const f_string_t function, const uint8_t flag, const f_string_static_t parameter, const f_string_static_t argument) { + #ifndef _di_level_2_parameter_checking_ + if (!print) return F_status_set_error(F_parameter); + #endif // _di_level_2_parameter_checking_ if (status == F_data_not) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QThe argument for the parameter '%]", print.to, print.context, print.prefix, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, parameter, print.notable); - fl_print_format("%[' must not be an empty string.%]%r", print.to, print.context, print.context, f_string_eol_s); + fl_print_format("%[%QThe argument for the parameter '%]", print->to, print->context, print->prefix, print->context); + fl_print_format("%[%Q%]", print->to, print->notable, parameter, print->notable); + fl_print_format("%[' must not be an empty string.%]%r", print->to, print->context, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; } if (status == F_number) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QThe argument '%]", print.to, print.context, print.prefix, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, argument, print.notable); - fl_print_format("%[' is not a valid number for the parameter '%]", print.to, print.context, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, parameter, print.notable); - fl_print_format("%['.%]%r", print.to, print.context, print.context, f_string_eol_s); + fl_print_format("%[%QThe argument '%]", print->to, print->context, print->prefix, print->context); + fl_print_format("%[%Q%]", print->to, print->notable, argument, print->notable); + fl_print_format("%[' is not a valid number for the parameter '%]", print->to, print->context, print->context); + fl_print_format("%[%Q%]", print->to, print->notable, parameter, print->notable); + fl_print_format("%['.%]%r", print->to, print->context, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; } if (status == F_number_negative) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QThe argument '%]", print.to, print.context, print.prefix, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, argument, print.notable); - fl_print_format("%[' is negative, which is not allowed for the parameter '%]", print.to, print.context, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, parameter, print.notable); - fl_print_format("%['.%]%r", print.to, print.context, print.context, f_string_eol_s); + fl_print_format("%[%QThe argument '%]", print->to, print->context, print->prefix, print->context); + fl_print_format("%[%Q%]", print->to, print->notable, argument, print->notable); + fl_print_format("%[' is negative, which is not allowed for the parameter '%]", print->to, print->context, print->context); + fl_print_format("%[%Q%]", print->to, print->notable, parameter, print->notable); + fl_print_format("%['.%]%r", print->to, print->context, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; } if (status == F_number_overflow) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QThe argument '%]", print.to, print.context, print.prefix, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, argument, print.notable); - fl_print_format("%[' is too large for the parameter '%]", print.to, print.context, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, parameter, print.notable); - fl_print_format("%['.%]%r", print.to, print.context, print.context, f_string_eol_s); + fl_print_format("%[%QThe argument '%]", print->to, print->context, print->prefix, print->context); + fl_print_format("%[%Q%]", print->to, print->notable, argument, print->notable); + fl_print_format("%[' is too large for the parameter '%]", print->to, print->context, print->context); + fl_print_format("%[%Q%]", print->to, print->notable, parameter, print->notable); + fl_print_format("%['.%]%r", print->to, print->context, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; } if (status == F_number_positive) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QThe argument '%]", print.to, print.context, print.prefix, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, argument, print.notable); - fl_print_format("%[' is positive, which is not allowed for the parameter '%]", print.to, print.context, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, parameter, print.notable); - fl_print_format("%['.%]%r", print.to, print.context, print.context, f_string_eol_s); + fl_print_format("%[%QThe argument '%]", print->to, print->context, print->prefix, print->context); + fl_print_format("%[%Q%]", print->to, print->notable, argument, print->notable); + fl_print_format("%[' is positive, which is not allowed for the parameter '%]", print->to, print->context, print->context); + fl_print_format("%[%Q%]", print->to, print->notable, parameter, print->notable); + fl_print_format("%['.%]%r", print->to, print->context, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; } if (status == F_number_underflow) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QThe argument '%]", print.to, print.context, print.prefix, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, argument, print.notable); - fl_print_format("%[' is too small for the parameter '%]", print.to, print.context, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, parameter, print.notable); - fl_print_format("%['.%]%r", print.to, print.context, print.context, f_string_eol_s); + fl_print_format("%[%QThe argument '%]", print->to, print->context, print->prefix, print->context); + fl_print_format("%[%Q%]", print->to, print->notable, argument, print->notable); + fl_print_format("%[' is too small for the parameter '%]", print->to, print->context, print->context); + fl_print_format("%[%Q%]", print->to, print->notable, parameter, print->notable); + fl_print_format("%['.%]%r", print->to, print->context, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; diff --git a/level_2/fll_error/c/error.h b/level_2/fll_error/c/error.h index 351be7c..08c9194 100644 --- a/level_2/fll_error/c/error.h +++ b/level_2/fll_error/c/error.h @@ -54,7 +54,7 @@ extern "C" { * F_true is returned if the status code is unknown. */ #ifndef _di_fll_error_print_ - extern f_status_t fll_error_print(const fl_print_t print, const f_status_t status, const f_string_t function, const uint8_t flag); + extern f_status_t fll_error_print(fl_print_t * const print, const f_status_t status, const f_string_t function, const uint8_t flag); #endif // _di_fll_error_print_ /** @@ -83,7 +83,7 @@ extern "C" { * F_false is returned on successful print of known errors. */ #ifndef _di_fll_error_file_print_ - extern f_status_t fll_error_file_print(const fl_print_t print, const f_status_t status, const f_string_t function, const uint8_t flag, const f_string_static_t name, const f_string_static_t operation, const uint8_t type); + extern f_status_t fll_error_file_print(fl_print_t * const print, const f_status_t status, const f_string_t function, const uint8_t flag, const f_string_static_t name, const f_string_static_t operation, const uint8_t type); #endif // _di_fll_error_file_print_ /** @@ -110,7 +110,7 @@ extern "C" { * F_false is returned on successful print of known errors. */ #ifndef _di_fll_error_parameter_integer_print_ - extern f_status_t fll_error_parameter_integer_print(const fl_print_t print, const f_status_t status, const f_string_t function, const uint8_t flag, const f_string_static_t parameter, const f_string_static_t argument); + extern f_status_t fll_error_parameter_integer_print(fl_print_t * const print, const f_status_t status, const f_string_t function, const uint8_t flag, const f_string_static_t parameter, const f_string_static_t argument); #endif // _di_fll_error_parameter_integer_print_ #ifdef __cplusplus diff --git a/level_2/fll_error/c/private-error.c b/level_2/fll_error/c/private-error.c index 37196ad..ed3adf6 100644 --- a/level_2/fll_error/c/private-error.c +++ b/level_2/fll_error/c/private-error.c @@ -6,252 +6,252 @@ extern "C" { #endif #if !defined(_di_fll_error_print_) || !defined(_di_fll_error_file_print_) - f_status_t private_fll_error_print(const fl_print_t print, const f_status_t status, const f_string_t function, const uint8_t flag) { + f_status_t private_fll_error_print(fl_print_t * const print, const f_status_t status, const f_string_t function, const uint8_t flag) { if (status == F_access_denied) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QAccess denied", print.to, print.context, print.prefix); + fl_print_format("%[%QAccess denied", print->to, print->context, print->prefix); private_fll_error_print_function(print, function); - fl_print_format(".%]%r", print.to, print.context, f_string_eol_s); + fl_print_format(".%]%r", print->to, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; } if (status == F_array_too_large) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QMaximum array length reached", print.to, print.context, print.prefix); + fl_print_format("%[%QMaximum array length reached", print->to, print->context, print->prefix); private_fll_error_print_function(print, function); - fl_print_format(".%]%r", print.to, print.context, f_string_eol_s); + fl_print_format(".%]%r", print->to, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; } if (status == F_buffer_too_large) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QMaximum buffer length reached", print.to, print.context, print.prefix); + fl_print_format("%[%QMaximum buffer length reached", print->to, print->context, print->prefix); private_fll_error_print_function(print, function); - fl_print_format(".%]%r", print.to, print.context, f_string_eol_s); + fl_print_format(".%]%r", print->to, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; } if (status == F_error) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QAn error has occurred", print.to, print.context, print.prefix); + fl_print_format("%[%QAn error has occurred", print->to, print->context, print->prefix); private_fll_error_print_function(print, function); - fl_print_format(".%]%r", print.to, print.context, f_string_eol_s); + fl_print_format(".%]%r", print->to, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; } if (status == F_file_found_not) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QFile not found", print.to, print.context, print.prefix); + fl_print_format("%[%QFile not found", print->to, print->context, print->prefix); private_fll_error_print_function(print, function); - fl_print_format(".%]%r", print.to, print.context, f_string_eol_s); + fl_print_format(".%]%r", print->to, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; } if (status == F_memory_not) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QUnable to allocate memory", print.to, print.context, print.prefix); + fl_print_format("%[%QUnable to allocate memory", print->to, print->context, print->prefix); private_fll_error_print_function(print, function); - fl_print_format(".%]%r", print.to, print.context, f_string_eol_s); + fl_print_format(".%]%r", print->to, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; } if (status == F_parameter) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QInvalid parameter", print.to, print.context, print.prefix); + fl_print_format("%[%QInvalid parameter", print->to, print->context, print->prefix); private_fll_error_print_function(print, function); - fl_print_format(".%]%r", print.to, print.context, f_string_eol_s); + fl_print_format(".%]%r", print->to, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; } if (status == F_string_too_large) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QMaximum string length reached", print.to, print.context, print.prefix); + fl_print_format("%[%QMaximum string length reached", print->to, print->context, print->prefix); private_fll_error_print_function(print, function); - fl_print_format(".%]%r", print.to, print.context, f_string_eol_s); + fl_print_format(".%]%r", print->to, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; } if (status == F_utf_not) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QInvalid UTF-8 character found", print.to, print.context, print.prefix); + fl_print_format("%[%QInvalid UTF-8 character found", print->to, print->context, print->prefix); private_fll_error_print_function(print, function); - fl_print_format(".%]%r", print.to, print.context, f_string_eol_s); + fl_print_format(".%]%r", print->to, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; } if (status == F_utf_fragment) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QUTF-8 character (fragment) found", print.to, print.context, print.prefix); + fl_print_format("%[%QUTF-8 character (fragment) found", print->to, print->context, print->prefix); private_fll_error_print_function(print, function); - fl_print_format(".%]%r", print.to, print.context, f_string_eol_s); + fl_print_format(".%]%r", print->to, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; } if (status == F_complete_not_utf || status == F_complete_not_utf_eos || status == F_complete_not_utf_stop) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QInvalid (incomplete) UTF-8 character found", print.to, print.context, print.prefix); + fl_print_format("%[%QInvalid (incomplete) UTF-8 character found", print->to, print->context, print->prefix); private_fll_error_print_function(print, function); if (status == F_complete_not_utf_eos) { - fl_print_format(" at the end of string.%]%r", print.to, print.context, f_string_eol_s); + fl_print_format(" at the end of string.%]%r", print->to, print->context, f_string_eol_s); } else if (status == F_complete_not_utf_stop) { - fl_print_format(" at the stop point of string.%]%r", print.to, print.context, f_string_eol_s); + fl_print_format(" at the stop point of string.%]%r", print->to, print->context, f_string_eol_s); } else { - fl_print_format(".%]%r", print.to, print.context, f_string_eol_s); + fl_print_format(".%]%r", print->to, print->context, f_string_eol_s); } - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; } if (status == F_failure) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QFailure", print.to, print.context, print.prefix); + fl_print_format("%[%QFailure", print->to, print->context, print->prefix); private_fll_error_print_function(print, function); - fl_print_format(".%]%r", print.to, print.context, f_string_eol_s); + fl_print_format(".%]%r", print->to, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; } if (status == F_signal) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QSignal received", print.to, print.context, print.prefix); + fl_print_format("%[%QSignal received", print->to, print->context, print->prefix); private_fll_error_print_function(print, function); - fl_print_format(".%]%r", print.to, print.context, f_string_eol_s); + fl_print_format(".%]%r", print->to, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; } if (status == F_interrupt) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%QInterrupt signal received", print.to, print.context, print.prefix); + fl_print_format("%[%QInterrupt signal received", print->to, print->context, print->prefix); private_fll_error_print_function(print, function); - fl_print_format(".%]%r", print.to, print.context, f_string_eol_s); + fl_print_format(".%]%r", print->to, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } return F_false; } - if ((flag & fll_error_file_flag_fallback_e) && print.verbosity != f_console_verbosity_quiet_e) { - if (print.verbosity != f_console_verbosity_quiet_e) { - flockfile(print.to.stream); + if ((flag & fll_error_file_flag_fallback_e) && print->verbosity != f_console_verbosity_quiet_e) { + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); - fl_print_format("%[%Q(%]", print.to, print.context, print.prefix, print.context); - fl_print_format("%[%ui%]%[)", print.to, print.notable, status, print.notable, print.context); + fl_print_format("%[%Q(%]", print->to, print->context, print->prefix, print->context); + fl_print_format("%[%ui%]%[)", print->to, print->notable, status, print->notable, print->context); private_fll_error_print_function(print, function); - fl_print_format(".%]%r", print.to, print.context, f_string_eol_s); + fl_print_format(".%]%r", print->to, print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } } @@ -260,28 +260,28 @@ extern "C" { #endif // !defined(_di_fll_error_print_) || !defined(_di_fll_error_file_print_) #if !defined(_di_fll_error_print_) || !defined(_di_fll_error_file_print_) - void private_fll_error_print_function(const fl_print_t print, const f_string_t function) { + void private_fll_error_print_function(fl_print_t * const print, const f_string_t function) { if (function) { - fl_print_format(" when calling function%] ", print.to, print.context); - fl_print_format("%[%S%]", print.to, print.notable, function, print.notable); - fl_print_format("%[()", print.to, print.context); + fl_print_format(" when calling function%] ", print->to, print->context); + fl_print_format("%[%S%]", print->to, print->notable, function, print->notable); + fl_print_format("%[()", print->to, print->context); } } #endif // !defined(_di_fll_error_print_) || !defined(_di_fll_error_file_print_) #if !defined(_di_fll_error_print_) || !defined(_di_fll_error_file_print_) - void private_fll_error_print_unable_to(const fl_print_t print, const f_string_static_t operation, const f_string_static_t name, const f_string_static_t type, const f_string_t message) { + void private_fll_error_print_unable_to(fl_print_t * const print, const f_string_static_t operation, const f_string_static_t name, const f_string_static_t type, const f_string_t message) { - if (print.verbosity < f_console_verbosity_error_e) return; + if (print->verbosity < f_console_verbosity_error_e) return; - flockfile(print.to.stream); + flockfile(print->to.stream); - fl_print_format("%[%QUnable to %Q %Q '%]", print.to, print.context, print.prefix, operation, type, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, name, print.notable); - fl_print_format("%['%S%S.%]%r", print.to, print.context, message ? ", " : "", message ? message : "", print.context, f_string_eol_s); + fl_print_format("%[%QUnable to %Q %Q '%]", print->to, print->context, print->prefix, operation, type, print->context); + fl_print_format("%[%Q%]", print->to, print->notable, name, print->notable); + fl_print_format("%['%S%S.%]%r", print->to, print->context, message ? ", " : "", message ? message : "", print->context, f_string_eol_s); - funlockfile(print.to.stream); + funlockfile(print->to.stream); } #endif // !defined(_di_fll_error_print_) || !defined(_di_fll_error_file_print_) diff --git a/level_2/fll_error/c/private-error.h b/level_2/fll_error/c/private-error.h index 834494f..62bf56d 100644 --- a/level_2/fll_error/c/private-error.h +++ b/level_2/fll_error/c/private-error.h @@ -40,7 +40,7 @@ extern "C" { * @see fll_error_file_print() */ #if !defined(_di_fll_error_print_) || !defined(_di_fll_error_file_print_) - extern f_status_t private_fll_error_print(const fl_print_t print, const f_status_t status, const f_string_t function, const uint8_t flag) F_attribute_visibility_internal_d; + extern f_status_t private_fll_error_print(fl_print_t * const print, const f_status_t status, const f_string_t function, const uint8_t flag) F_attribute_visibility_internal_d; #endif // !defined(_di_fll_error_print_) || !defined(_di_fll_error_file_print_) /** @@ -62,7 +62,7 @@ extern "C" { * @see fll_error_file_print() */ #if !defined(_di_fll_error_print_) || !defined(_di_fll_error_file_print_) - extern void private_fll_error_print_function(const fl_print_t print, const f_string_t function) F_attribute_visibility_internal_d; + extern void private_fll_error_print_function(fl_print_t * const print, const f_string_t function) F_attribute_visibility_internal_d; #endif // !defined(_di_fll_error_print_) || !defined(_di_fll_error_file_print_) /** @@ -90,7 +90,7 @@ extern "C" { * @see fll_error_file_print() */ #if !defined(_di_fll_error_print_) || !defined(_di_fll_error_file_print_) - extern void private_fll_error_print_unable_to(const fl_print_t print, const f_string_static_t operation, const f_string_static_t name, const f_string_static_t type_name, const f_string_t message) F_attribute_visibility_internal_d; + extern void private_fll_error_print_unable_to(fl_print_t * const print, const f_string_static_t operation, const f_string_static_t name, const f_string_static_t type_name, const f_string_t message) F_attribute_visibility_internal_d; #endif // !defined(_di_fll_error_print_) || !defined(_di_fll_error_file_print_) #ifdef __cplusplus diff --git a/level_2/fll_program/c/private-program.c b/level_2/fll_program/c/private-program.c index df4e53b..ad9507f 100644 --- a/level_2/fll_program/c/private-program.c +++ b/level_2/fll_program/c/private-program.c @@ -6,25 +6,25 @@ extern "C" { #endif #if !defined(_di_fll_program_print_help_option_) || !defined(_di_fll_program_print_help_option_standard_) - f_status_t private_fll_program_print_help_option(const fl_print_t print, const f_string_static_t option_short, const f_string_static_t option_long, const f_string_static_t symbol_short, const f_string_static_t symbol_long, const char *description) { + f_status_t private_fll_program_print_help_option(fl_print_t * const print, const f_string_static_t option_short, const f_string_static_t option_long, const f_string_static_t symbol_short, const f_string_static_t symbol_long, const char *description) { - fl_print_format("%r %Q%[%Q%]", print.to, f_string_eol_s, symbol_short, print.set->standout, option_short, print.set->standout); - fl_print_format(", %Q%[%Q%] %S", print.to, symbol_long, print.set->standout, option_long, print.set->standout, description); + fl_print_format(" %Q%[%Q%]", print->to, symbol_short, print->set->standout, option_short, print->set->standout); + fl_print_format(", %Q%[%Q%] %S%r", print->to, symbol_long, print->set->standout, option_long, print->set->standout, description, f_string_eol_s); return F_none; } #endif // !defined(_di_fll_program_print_help_option_) || !defined(_di_fll_program_print_help_option_standard_) #if !defined(_di_fll_program_standard_signal_received_) || !defined(_di_fll_program_standard_signal_handle_) - uint32_t private_fll_program_standard_signal_received(fll_program_data_t * const main) { + uint32_t private_fll_program_standard_signal_received(fll_program_data_t * const program) { - if (!main || main->signal.id == -1) return 0; + if (!program || program->signal.id == -1) return 0; struct signalfd_siginfo information; memset(&information, 0, sizeof(struct signalfd_siginfo)); - if (f_signal_read(main->signal, 0, &information) == F_signal) { + if (f_signal_read(program->signal, 0, &information) == F_signal) { switch (information.ssi_signo) { case F_signal_abort: case F_signal_broken_pipe: @@ -32,7 +32,7 @@ extern "C" { case F_signal_interrupt: case F_signal_quit: case F_signal_termination: - main->signal_received = information.ssi_signo; + program->signal_received = information.ssi_signo; return information.ssi_signo; } diff --git a/level_2/fll_program/c/private-program.h b/level_2/fll_program/c/private-program.h index 3026984..0619c3c 100644 --- a/level_2/fll_program/c/private-program.h +++ b/level_2/fll_program/c/private-program.h @@ -43,7 +43,7 @@ extern "C" { * @see fll_program_print_help_option_standard() */ #if !defined(_di_fll_program_print_help_option_) || !defined(_di_fll_program_print_help_option_standard_) - extern f_status_t private_fll_program_print_help_option(const fl_print_t print, const f_string_static_t option_short, const f_string_static_t option_long, const f_string_static_t symbol_short, const f_string_static_t symbol_long, const char *description) F_attribute_visibility_internal_d; + extern f_status_t private_fll_program_print_help_option(fl_print_t * const print, const f_string_static_t option_short, const f_string_static_t option_long, const f_string_static_t symbol_short, const f_string_static_t symbol_long, const char *description) F_attribute_visibility_internal_d; #endif // !defined(_di_fll_program_print_help_option_) || !defined(_di_fll_program_print_help_option_standard_) /** @@ -51,8 +51,8 @@ extern "C" { * * Intended to be shared to each of the different implementation variations. * - * @param main - * The main program data. + * @param program + * The program data. * * @return * A positive number representing a valid signal on signal received. @@ -64,7 +64,7 @@ extern "C" { * @see fll_program_standard_signal_handle() */ #if !defined(_di_fll_program_standard_signal_received_) || !defined(_di_fll_program_standard_signal_handle_) - uint32_t private_fll_program_standard_signal_received(fll_program_data_t * const main) F_attribute_visibility_internal_d; + uint32_t private_fll_program_standard_signal_received(fll_program_data_t * const program) F_attribute_visibility_internal_d; #endif // !defined(_di_fll_program_standard_signal_received_) || !defined(_di_fll_program_standard_signal_handle_) /** diff --git a/level_2/fll_program/c/program.c b/level_2/fll_program/c/program.c index 5ef718b..21b5220 100644 --- a/level_2/fll_program/c/program.c +++ b/level_2/fll_program/c/program.c @@ -244,9 +244,9 @@ extern "C" { #endif // _di_fll_program_parameter_additional_rip_mash_ #ifndef _di_fll_program_standard_set_down_ - f_status_t fll_program_standard_set_down(fll_program_data_t * const main) { + f_status_t fll_program_standard_set_down(fll_program_data_t * const program) { #ifndef _di_level_2_parameter_checking_ - if (!main) return F_status_set_error(F_parameter); + if (!program) return F_status_set_error(F_parameter); #endif // _di_level_2_parameter_checking_ // The fclose() calls have undefined behavior when closing an already closed file. @@ -255,76 +255,76 @@ extern "C" { // 0x20 = message descriptor, 0x40 = output descriptor, 0x80 = error descriptor, 0x100 = warning descriptor, 0x200 = debug descriptor. uint16_t flag = 0; - if (main->message.to.stream) { - if (main->message.to.stream != F_type_error_d && main->message.to.stream != F_type_input_d && main->message.to.stream != F_type_output_d) { - f_file_stream_flush(main->message.to); + if (program->message.to.stream) { + if (program->message.to.stream != F_type_error_d && program->message.to.stream != F_type_input_d && program->message.to.stream != F_type_output_d) { + f_file_stream_flush(program->message.to); flag |= 0x1; } } - if (main->message.to.id == -1) { - if (main->message.to.id != F_type_descriptor_error_d && main->message.to.id != F_type_descriptor_input_d && main->message.to.id != F_type_descriptor_output_d) { - f_file_flush(main->message.to); + if (program->message.to.id == -1) { + if (program->message.to.id != F_type_descriptor_error_d && program->message.to.id != F_type_descriptor_input_d && program->message.to.id != F_type_descriptor_output_d) { + f_file_flush(program->message.to); flag |= 0x20; } } - if (main->output.to.stream) { - if (main->output.to.stream != main->message.to.stream) { - if (main->output.to.stream != F_type_error_d && main->output.to.stream != F_type_input_d && main->output.to.stream != F_type_output_d) { - f_file_stream_flush(main->output.to); + if (program->output.to.stream) { + if (program->output.to.stream != program->message.to.stream) { + if (program->output.to.stream != F_type_error_d && program->output.to.stream != F_type_input_d && program->output.to.stream != F_type_output_d) { + f_file_stream_flush(program->output.to); flag |= 0x2; } } } - if (main->error.to.id != -1) { - if (main->output.to.id != main->message.to.id) { - if (main->output.to.id != F_type_descriptor_error_d && main->output.to.id != F_type_descriptor_input_d && main->output.to.id != F_type_descriptor_output_d) { - f_file_flush(main->output.to); + if (program->error.to.id != -1) { + if (program->output.to.id != program->message.to.id) { + if (program->output.to.id != F_type_descriptor_error_d && program->output.to.id != F_type_descriptor_input_d && program->output.to.id != F_type_descriptor_output_d) { + f_file_flush(program->output.to); flag |= 0x40; } } } - if (main->error.to.stream) { - if (main->error.to.stream != main->message.to.stream && main->error.to.stream != main->output.to.stream) { - if (main->error.to.stream != F_type_error_d && main->error.to.stream != F_type_input_d && main->error.to.stream != F_type_output_d) { - f_file_stream_flush(main->error.to); + if (program->error.to.stream) { + if (program->error.to.stream != program->message.to.stream && program->error.to.stream != program->output.to.stream) { + if (program->error.to.stream != F_type_error_d && program->error.to.stream != F_type_input_d && program->error.to.stream != F_type_output_d) { + f_file_stream_flush(program->error.to); flag |= 0x4; } } } - if (main->error.to.id != -1) { - if (main->error.to.id != main->message.to.id && main->error.to.id != main->output.to.id) { - if (main->error.to.id != F_type_descriptor_error_d && main->error.to.id != F_type_descriptor_input_d && main->error.to.id != F_type_descriptor_output_d) { - f_file_flush(main->error.to); + if (program->error.to.id != -1) { + if (program->error.to.id != program->message.to.id && program->error.to.id != program->output.to.id) { + if (program->error.to.id != F_type_descriptor_error_d && program->error.to.id != F_type_descriptor_input_d && program->error.to.id != F_type_descriptor_output_d) { + f_file_flush(program->error.to); flag |= 0x80; } } } - if (main->warning.to.stream) { - if (main->warning.to.stream != main->message.to.stream && main->warning.to.stream != main->output.to.stream && main->warning.to.stream != main->error.to.stream) { - if (main->warning.to.stream != F_type_error_d && main->warning.to.stream != F_type_input_d && main->warning.to.stream != F_type_output_d) { - f_file_stream_flush(main->warning.to); + if (program->warning.to.stream) { + if (program->warning.to.stream != program->message.to.stream && program->warning.to.stream != program->output.to.stream && program->warning.to.stream != program->error.to.stream) { + if (program->warning.to.stream != F_type_error_d && program->warning.to.stream != F_type_input_d && program->warning.to.stream != F_type_output_d) { + f_file_stream_flush(program->warning.to); flag |= 0x8; } } } - if (main->warning.to.id != -1) { - if (main->warning.to.id != main->message.to.id && main->warning.to.id != main->output.to.id && main->warning.to.id != main->error.to.id) { - if (main->warning.to.id != F_type_descriptor_error_d && main->warning.to.id != F_type_descriptor_input_d && main->warning.to.id != F_type_descriptor_output_d) { - f_file_flush(main->warning.to); + if (program->warning.to.id != -1) { + if (program->warning.to.id != program->message.to.id && program->warning.to.id != program->output.to.id && program->warning.to.id != program->error.to.id) { + if (program->warning.to.id != F_type_descriptor_error_d && program->warning.to.id != F_type_descriptor_input_d && program->warning.to.id != F_type_descriptor_output_d) { + f_file_flush(program->warning.to); flag |= 0x100; } @@ -332,20 +332,20 @@ extern "C" { } - if (main->debug.to.stream) { - if (main->debug.to.stream != main->message.to.stream && main->debug.to.stream != main->output.to.stream && main->debug.to.stream != main->error.to.stream && main->debug.to.stream != main->warning.to.stream) { - if (main->debug.to.stream != F_type_error_d && main->debug.to.stream != F_type_input_d && main->debug.to.stream != F_type_output_d) { - f_file_stream_flush(main->debug.to); + if (program->debug.to.stream) { + if (program->debug.to.stream != program->message.to.stream && program->debug.to.stream != program->output.to.stream && program->debug.to.stream != program->error.to.stream && program->debug.to.stream != program->warning.to.stream) { + if (program->debug.to.stream != F_type_error_d && program->debug.to.stream != F_type_input_d && program->debug.to.stream != F_type_output_d) { + f_file_stream_flush(program->debug.to); flag |= 0x10; } } } - if (main->debug.to.id != -1) { - if (main->debug.to.id != main->message.to.id && main->debug.to.id != main->output.to.id && main->debug.to.id != main->error.to.id && main->debug.to.id != main->warning.to.id) { - if (main->debug.to.id != F_type_descriptor_error_d && main->debug.to.id != F_type_descriptor_input_d && main->debug.to.id != F_type_descriptor_output_d) { - f_file_flush(main->debug.to); + if (program->debug.to.id != -1) { + if (program->debug.to.id != program->message.to.id && program->debug.to.id != program->output.to.id && program->debug.to.id != program->error.to.id && program->debug.to.id != program->warning.to.id) { + if (program->debug.to.id != F_type_descriptor_error_d && program->debug.to.id != F_type_descriptor_input_d && program->debug.to.id != F_type_descriptor_output_d) { + f_file_flush(program->debug.to); flag |= 0x200; } @@ -353,43 +353,43 @@ extern "C" { } if (flag & 0x1) { - f_file_stream_close(&main->message.to); + f_file_stream_close(&program->message.to); } if (flag & 0x2) { - f_file_stream_close(&main->output.to); + f_file_stream_close(&program->output.to); } if (flag & 0x4) { - f_file_stream_close(&main->error.to); + f_file_stream_close(&program->error.to); } if (flag & 0x8) { - f_file_stream_close(&main->warning.to); + f_file_stream_close(&program->warning.to); } if (flag & 0x10) { - f_file_stream_close(&main->debug.to); + f_file_stream_close(&program->debug.to); } if (flag & 0x20) { - f_file_close(&main->message.to); + f_file_close(&program->message.to); } if (flag & 0x40) { - f_file_close(&main->output.to); + f_file_close(&program->output.to); } if (flag & 0x80) { - f_file_close(&main->error.to); + f_file_close(&program->error.to); } if (flag & 0x100) { - f_file_close(&main->warning.to); + f_file_close(&program->warning.to); } if (flag & 0x200) { - f_file_close(&main->debug.to); + f_file_close(&program->debug.to); } // 0x1 = output stream, 0x2 = error stream, 0x4 = input stream. @@ -479,7 +479,7 @@ extern "C" { f_file_close(&file); } - const f_status_t status = f_signal_close(&main->signal); + const f_status_t status = f_signal_close(&program->signal); if (F_status_is_error(status)) return status; return F_none; @@ -487,44 +487,44 @@ extern "C" { #endif // _di_fll_program_standard_set_down_ #ifndef _di_fll_program_standard_set_up_ - f_status_t fll_program_standard_set_up(fll_program_data_t * const main) { + f_status_t fll_program_standard_set_up(fll_program_data_t * const program) { #ifndef _di_level_2_parameter_checking_ - if (!main) return F_status_set_error(F_parameter); + if (!program) return F_status_set_error(F_parameter); #endif // _di_level_2_parameter_checking_ - f_signal_set_empty(&main->signal.set); - f_signal_set_add(F_signal_abort, &main->signal.set); - f_signal_set_add(F_signal_broken_pipe, &main->signal.set); - f_signal_set_add(F_signal_hangup, &main->signal.set); - f_signal_set_add(F_signal_interrupt, &main->signal.set); - f_signal_set_add(F_signal_quit, &main->signal.set); - f_signal_set_add(F_signal_termination, &main->signal.set); + f_signal_set_empty(&program->signal.set); + f_signal_set_add(F_signal_abort, &program->signal.set); + f_signal_set_add(F_signal_broken_pipe, &program->signal.set); + f_signal_set_add(F_signal_hangup, &program->signal.set); + f_signal_set_add(F_signal_interrupt, &program->signal.set); + f_signal_set_add(F_signal_quit, &program->signal.set); + f_signal_set_add(F_signal_termination, &program->signal.set); - f_status_t status = f_signal_mask(SIG_BLOCK, &main->signal.set, 0); + f_status_t status = f_signal_mask(SIG_BLOCK, &program->signal.set, 0); if (F_status_is_error(status)) return status; - status = f_signal_open(&main->signal); + status = f_signal_open(&program->signal); // If there is an error opening a signal descriptor, then do not handle signals. if (F_status_is_error(status)) { - f_signal_mask(SIG_UNBLOCK, &main->signal.set, 0); - f_signal_close(&main->signal); + f_signal_mask(SIG_UNBLOCK, &program->signal.set, 0); + f_signal_close(&program->signal); return status; } // Unblock all other signals. - memset(&main->signal.set, 0, sizeof(sigset_t)); + memset(&program->signal.set, 0, sizeof(sigset_t)); - f_signal_set_fill(&main->signal.set); - f_signal_set_delete(F_signal_abort, &main->signal.set); - f_signal_set_delete(F_signal_broken_pipe, &main->signal.set); - f_signal_set_delete(F_signal_hangup, &main->signal.set); - f_signal_set_delete(F_signal_interrupt, &main->signal.set); - f_signal_set_delete(F_signal_quit, &main->signal.set); - f_signal_set_delete(F_signal_termination, &main->signal.set); + f_signal_set_fill(&program->signal.set); + f_signal_set_delete(F_signal_abort, &program->signal.set); + f_signal_set_delete(F_signal_broken_pipe, &program->signal.set); + f_signal_set_delete(F_signal_hangup, &program->signal.set); + f_signal_set_delete(F_signal_interrupt, &program->signal.set); + f_signal_set_delete(F_signal_quit, &program->signal.set); + f_signal_set_delete(F_signal_termination, &program->signal.set); - status = f_signal_mask(SIG_UNBLOCK, &main->signal.set, 0); + status = f_signal_mask(SIG_UNBLOCK, &program->signal.set, 0); if (F_status_is_error(status)) return status; return F_none; @@ -532,12 +532,12 @@ extern "C" { #endif // _di_fll_program_standard_set_up_ #ifndef _di_fll_program_standard_signal_received_ - uint32_t fll_program_standard_signal_received(fll_program_data_t * const main) { + uint32_t fll_program_standard_signal_received(fll_program_data_t * const program) { #ifndef _di_level_2_parameter_checking_ - if (!main) return 0; + if (!program) return 0; #endif // _di_level_2_parameter_checking_ - return private_fll_program_standard_signal_received(main); + return private_fll_program_standard_signal_received(program); } #endif // _di_fll_program_standard_signal_received_ @@ -555,11 +555,11 @@ extern "C" { return; } - fll_program_data_t * const data = (fll_program_data_t *) state->custom; + fll_program_data_t * const program = (fll_program_data_t *) state->custom; - data->signal_received = private_fll_program_standard_signal_received(data); + program->signal_received = private_fll_program_standard_signal_received(program); - if (data->signal_received == F_signal_abort || data->signal_received == F_signal_broken_pipe || data->signal_received == F_signal_hangup || data->signal_received == F_signal_interrupt || data->signal_received == F_signal_quit || data->signal_received == F_signal_termination) { + if (program->signal_received == F_signal_abort || program->signal_received == F_signal_broken_pipe || program->signal_received == F_signal_hangup || program->signal_received == F_signal_interrupt || program->signal_received == F_signal_quit || program->signal_received == F_signal_termination) { state->status = F_status_set_error(F_interrupt); } else { diff --git a/level_2/fll_program/c/program.h b/level_2/fll_program/c/program.h index 38f6f9b..34973dc 100644 --- a/level_2/fll_program/c/program.h +++ b/level_2/fll_program/c/program.h @@ -257,8 +257,8 @@ extern "C" { * - Closes standard inputs and outputs. * - Closes the signal handler. * - * @param main - * The main program data. + * @param program + * The program data. * * @return * F_none on success. @@ -274,7 +274,7 @@ extern "C" { * @see f_signal_close() */ #ifndef _di_fll_program_standard_set_down_ - extern f_status_t fll_program_standard_set_down(fll_program_data_t * const main); + extern f_status_t fll_program_standard_set_down(fll_program_data_t * const program); #endif // _di_fll_program_standard_set_down_ /** @@ -283,8 +283,8 @@ extern "C" { * This does the following: * - Handle signals so that program can cleanly exit, de-allocating as appropriate. * - * @param main - * The main program data. + * @param program + * The program data. * * @return * F_none on success. @@ -302,7 +302,7 @@ extern "C" { * @see f_signal_set_fill() */ #ifndef _di_fll_program_standard_set_up_ - extern f_status_t fll_program_standard_set_up(fll_program_data_t * const main); + extern f_status_t fll_program_standard_set_up(fll_program_data_t * const program); #endif // _di_fll_program_standard_set_up_ /** @@ -312,9 +312,9 @@ extern "C" { * * If no signals are blocked, then this always returns F_false. * - * @param main - * The main program data. - * The main->signal must be used to designate blocked signals. + * @param program + * The program data. + * The program.signal must be used to designate blocked signals. * * @return * A positive number representing a valid signal on signal received. @@ -323,7 +323,7 @@ extern "C" { * @see f_signal_read() */ #ifndef _di_fll_program_standard_signal_received_ - extern uint32_t fll_program_standard_signal_received(fll_program_data_t * const main); + extern uint32_t fll_program_standard_signal_received(fll_program_data_t * const program); #endif // _di_fll_program_standard_signal_received_ /** diff --git a/level_2/fll_program/c/program/print.c b/level_2/fll_program/c/program/print.c index 53e3cb7..6cbfa58 100644 --- a/level_2/fll_program/c/program/print.c +++ b/level_2/fll_program/c/program/print.c @@ -6,446 +6,519 @@ extern "C" { #endif #ifndef _di_fll_program_print_copyright_ - f_status_t fll_program_print_copyright(const fl_print_t print) { + f_status_t fll_program_print_copyright(fl_print_t * const print) { + #ifndef _di_level_2_parameter_checking_ + if (!print) return F_status_set_error(F_parameter); + #endif // _di_level_2_parameter_checking_ - f_file_stream_lock(print.to); + f_file_stream_lock(print->to); - fl_print_format("%rCopyright © 2007-2023 Kevin Day.%r", print.to, f_string_eol_s, f_string_eol_s); + fl_print_format("Copyright © 2007-2023 Kevin Day.%r", print->to, f_string_eol_s); #ifndef _di_detailed_copyright_ - if (print.verbosity > f_console_verbosity_quiet_e) { - if (print.verbosity > f_console_verbosity_normal_e) { - fl_print_format("%rThis program comes with ABSOLUTELY NO WARRANTY.%r", print.to, f_string_eol_s, f_string_eol_s); - fl_print_format("This is free software, and you are welcome to modify or redistribute in accordance to the license.%r", print.to, f_string_eol_s); + if (print->verbosity > f_console_verbosity_quiet_e) { + if (print->verbosity > f_console_verbosity_normal_e) { + fl_print_format("%rThis program comes with ABSOLUTELY NO WARRANTY.%r", print->to, f_string_eol_s, f_string_eol_s); + fl_print_format("This is free software, and you are welcome to modify or redistribute in accordance to the license.%r", print->to, f_string_eol_s); } - fl_print_format("%rSource code license lgpl-2.1-or-later.%r", print.to, f_string_eol_s, f_string_eol_s); - fl_print_format("Standard and specification license open-standard-license-1.0.%r", print.to, f_string_eol_s); - fl_print_format("Documentation license cc-by-sa-4.0.%r", print.to, f_string_eol_s); + fl_print_format("%rSource code license lgpl-2.1-or-later.%r", print->to, f_string_eol_s, f_string_eol_s); + fl_print_format("Standard and specification license open-standard-license-1.0.%r", print->to, f_string_eol_s); + fl_print_format("Documentation license cc-by-sa-4.0.%r", print->to, f_string_eol_s); } #endif // _di_detailed_copyright_ - fl_print_format("%r", print.to, f_string_eol_s); - - f_file_stream_unlock(print.to); + f_file_stream_unlock(print->to); return F_none; } #endif // _di_fll_program_print_copyright_ #ifndef _di_fll_program_print_error_missing_file_ - f_status_t fll_program_print_error_missing_file(const fl_print_t print) { + f_status_t fll_program_print_error_missing_file(fl_print_t * const print) { + #ifndef _di_level_2_parameter_checking_ + if (!print) return F_status_set_error(F_parameter); + #endif // _di_level_2_parameter_checking_ - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; + if (print->verbosity < f_console_verbosity_error_e) return F_output_not; - f_file_stream_lock(print.to); + f_file_stream_lock(print->to); - fl_print_format("%r%[%QNo files are specified.%]%r", print.to, f_string_eol_s, print.set->error, print.prefix, print.set->error, f_string_eol_s); + fl_print_format("%[%QNo files are specified.%]%r", print->to, print->set->error, print->prefix, print->set->error, f_string_eol_s); - f_file_stream_unlock(print.to); + f_file_stream_unlock(print->to); return F_none; } #endif // _di_fll_program_print_error_missing_file_ #ifndef _di_fll_program_print_error_missing_variable_not_zero_ - f_status_t fll_program_print_error_missing_variable_not_zero(const fl_print_t print, const f_string_static_t variable) { + f_status_t fll_program_print_error_missing_variable_not_zero(fl_print_t * const print, const f_string_static_t variable) { + #ifndef _di_level_2_parameter_checking_ + if (!print) return F_status_set_error(F_parameter); + #endif // _di_level_2_parameter_checking_ - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; + if (print->verbosity < f_console_verbosity_error_e) return F_output_not; - f_file_stream_lock(print.to); + f_file_stream_lock(print->to); - fl_print_format("%r%[%QThe%] ", print.to, f_string_eol_s, print.set->error, print.prefix, print.set->error); - fl_print_format("%[%Q%]", print.to, print.set->notable, variable, print.set->notable); - fl_print_format("%[ is missing or has a length of%] ", print.to, print.set->error, print.set->error); - fl_print_format("%[0%]", print.to, print.set->notable, print.set->notable); - fl_print_format("%[.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s); + fl_print_format("%[%QThe%] ", print->to, print->set->error, print->prefix, print->set->error); + fl_print_format("%[%Q%]", print->to, print->set->notable, variable, print->set->notable); + fl_print_format("%[ is missing or has a length of%] ", print->to, print->set->error, print->set->error); + fl_print_format("%[0%]", print->to, print->set->notable, print->set->notable); + fl_print_format("%[.%]%r", print->to, print->set->error, print->set->error, f_string_eol_s); - f_file_stream_unlock(print.to); + f_file_stream_unlock(print->to); return F_none; } #endif // _di_fll_program_print_error_missing_variable_not_zero_ #ifndef _di_fll_program_print_error_parameter_both_specified_same_amount_ - f_status_t fll_program_print_error_parameter_both_specified_same_amount(const fl_print_t print, const f_string_static_t symbol_1, const f_string_static_t symbol_2, const f_string_static_t name_1, const f_string_static_t name_2) { + f_status_t fll_program_print_error_parameter_both_specified_same_amount(fl_print_t * const print, const f_string_static_t symbol_1, const f_string_static_t symbol_2, const f_string_static_t name_1, const f_string_static_t name_2) { + #ifndef _di_level_2_parameter_checking_ + if (!print) return F_status_set_error(F_parameter); + #endif // _di_level_2_parameter_checking_ - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; + if (print->verbosity < f_console_verbosity_error_e) return F_output_not; - f_file_stream_lock(print.to); + f_file_stream_lock(print->to); - fl_print_format("%r%[%QThe '%]", print.to, f_string_eol_s, print.set->error, print.prefix, print.set->error); - fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol_1, name_1, print.set->notable); - fl_print_format("%[' parameter and the '%]", print.to, print.set->error, print.set->error); - fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol_2, name_2, print.set->notable); - fl_print_format("%[' parameter must be specified the same number of times.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s); + fl_print_format("%[%QThe '%]", print->to, print->set->error, print->prefix, print->set->error); + fl_print_format("%[%Q%Q%]", print->to, print->set->notable, symbol_1, name_1, print->set->notable); + fl_print_format("%[' parameter and the '%]", print->to, print->set->error, print->set->error); + fl_print_format("%[%Q%Q%]", print->to, print->set->notable, symbol_2, name_2, print->set->notable); + fl_print_format("%[' parameter must be specified the same number of times.%]%r", print->to, print->set->error, print->set->error, f_string_eol_s); - f_file_stream_unlock(print.to); + f_file_stream_unlock(print->to); return F_none; } #endif // _di_fll_program_print_error_parameter_both_specified_same_amount_ #ifndef _di_fll_program_print_error_parameter_both_specified_same_amount_without_ - f_status_t fll_program_print_error_parameter_both_specified_same_amount_without(const fl_print_t print, const f_string_static_t symbol_1, const f_string_static_t symbol_2, const f_string_static_t symbol_3, const f_string_static_t name_1, const f_string_static_t name_2, const f_string_static_t name_3) { + f_status_t fll_program_print_error_parameter_both_specified_same_amount_without(fl_print_t * const print, const f_string_static_t symbol_1, const f_string_static_t symbol_2, const f_string_static_t symbol_3, const f_string_static_t name_1, const f_string_static_t name_2, const f_string_static_t name_3) { + #ifndef _di_level_2_parameter_checking_ + if (!print) return F_status_set_error(F_parameter); + #endif // _di_level_2_parameter_checking_ - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; + if (print->verbosity < f_console_verbosity_error_e) return F_output_not; - f_file_stream_lock(print.to); + f_file_stream_lock(print->to); - fl_print_format("%r%[%QThe '%]", print.to, f_string_eol_s, print.set->error, print.prefix, print.set->error); - fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol_1, name_1, print.set->notable); - fl_print_format("%[' parameter and the '%]", print.to, print.set->error, print.set->error); - fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol_2, name_2, print.set->notable); - fl_print_format("%[' parameter must be specified the same number of times when not specifying the '%]", print.to, print.set->error, print.set->error); - fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol_3, name_3, print.set->notable); - fl_print_format("%[' parameter.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s); + fl_print_format("%[%QThe '%]", print->to, print->set->error, print->prefix, print->set->error); + fl_print_format("%[%Q%Q%]", print->to, print->set->notable, symbol_1, name_1, print->set->notable); + fl_print_format("%[' parameter and the '%]", print->to, print->set->error, print->set->error); + fl_print_format("%[%Q%Q%]", print->to, print->set->notable, symbol_2, name_2, print->set->notable); + fl_print_format("%[' parameter must be specified the same number of times when not specifying the '%]", print->to, print->set->error, print->set->error); + fl_print_format("%[%Q%Q%]", print->to, print->set->notable, symbol_3, name_3, print->set->notable); + fl_print_format("%[' parameter.%]%r", print->to, print->set->error, print->set->error, f_string_eol_s); - f_file_stream_unlock(print.to); + f_file_stream_unlock(print->to); return F_none; } #endif // _di_fll_program_print_error_parameter_both_specified_same_amount_without_ #ifndef _di_fll_program_print_error_parameter_cannot_use_with_ - f_status_t fll_program_print_error_parameter_cannot_use_with(const fl_print_t print, const f_string_static_t symbol_1, const f_string_static_t symbol_2, const f_string_static_t name_1, const f_string_static_t name_2) { + f_status_t fll_program_print_error_parameter_cannot_use_with(fl_print_t * const print, const f_string_static_t symbol_1, const f_string_static_t symbol_2, const f_string_static_t name_1, const f_string_static_t name_2) { + #ifndef _di_level_2_parameter_checking_ + if (!print) return F_status_set_error(F_parameter); + #endif // _di_level_2_parameter_checking_ - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; + if (print->verbosity < f_console_verbosity_error_e) return F_output_not; - f_file_stream_lock(print.to); + f_file_stream_lock(print->to); - fl_print_format("%r%[%QCannot specify the '%]", print.to, f_string_eol_s, print.set->error, print.prefix, print.set->error); - fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol_1, name_1, print.set->notable); - fl_print_format("%[' parameter with the '%]", print.to, print.set->error, print.set->error); - fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol_2, name_2, print.set->notable); - fl_print_format("%[' parameter.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s); + fl_print_format("%[%QCannot specify the '%]", print->to, print->set->error, print->prefix, print->set->error); + fl_print_format("%[%Q%Q%]", print->to, print->set->notable, symbol_1, name_1, print->set->notable); + fl_print_format("%[' parameter with the '%]", print->to, print->set->error, print->set->error); + fl_print_format("%[%Q%Q%]", print->to, print->set->notable, symbol_2, name_2, print->set->notable); + fl_print_format("%[' parameter.%]%r", print->to, print->set->error, print->set->error, f_string_eol_s); - f_file_stream_unlock(print.to); + f_file_stream_unlock(print->to); return F_none; } #endif // _di_fll_program_print_error_parameter_cannot_use_with_ #ifndef _di_fll_program_print_error_parameter_cannot_use_with_without_ - f_status_t fll_program_print_error_parameter_cannot_use_with_without(const fl_print_t print, const f_string_static_t symbol_1, const f_string_static_t symbol_2, const f_string_static_t symbol_3, const f_string_static_t name_1, const f_string_static_t name_2, const f_string_static_t name_3) { + f_status_t fll_program_print_error_parameter_cannot_use_with_without(fl_print_t * const print, const f_string_static_t symbol_1, const f_string_static_t symbol_2, const f_string_static_t symbol_3, const f_string_static_t name_1, const f_string_static_t name_2, const f_string_static_t name_3) { + #ifndef _di_level_2_parameter_checking_ + if (!print) return F_status_set_error(F_parameter); + #endif // _di_level_2_parameter_checking_ - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; + if (print->verbosity < f_console_verbosity_error_e) return F_output_not; - f_file_stream_lock(print.to); + f_file_stream_lock(print->to); - fl_print_format("%r%[%QCannot specify the '%]", print.to, f_string_eol_s, print.set->error, print.prefix, print.set->error); - fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol_1, name_1, print.set->notable); - fl_print_format("%[' parameter with the '%]", print.to, print.set->error, print.set->error); - fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol_2, name_2, print.set->notable); - fl_print_format("%[' parameter without the '%]", print.to, print.set->error, print.set->error); - fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol_3, name_3, print.set->notable); - fl_print_format("%[' parameter.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s); + fl_print_format("%[%QCannot specify the '%]", print->to, print->set->error, print->prefix, print->set->error); + fl_print_format("%[%Q%Q%]", print->to, print->set->notable, symbol_1, name_1, print->set->notable); + fl_print_format("%[' parameter with the '%]", print->to, print->set->error, print->set->error); + fl_print_format("%[%Q%Q%]", print->to, print->set->notable, symbol_2, name_2, print->set->notable); + fl_print_format("%[' parameter without the '%]", print->to, print->set->error, print->set->error); + fl_print_format("%[%Q%Q%]", print->to, print->set->notable, symbol_3, name_3, print->set->notable); + fl_print_format("%[' parameter.%]%r", print->to, print->set->error, print->set->error, f_string_eol_s); - f_file_stream_unlock(print.to); + f_file_stream_unlock(print->to); return F_none; } #endif // _di_fll_program_print_error_parameter_cannot_use_with_without_ #ifndef _di_fll_program_print_error_parameter_cannot_use_with_pipe_ - f_status_t fll_program_print_error_parameter_cannot_use_with_pipe(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t parameter) { + f_status_t fll_program_print_error_parameter_cannot_use_with_pipe(fl_print_t * const print, const f_string_static_t symbol, const f_string_static_t parameter) { + #ifndef _di_level_2_parameter_checking_ + if (!print) return F_status_set_error(F_parameter); + #endif // _di_level_2_parameter_checking_ - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; + if (print->verbosity < f_console_verbosity_error_e) return F_output_not; - f_file_stream_lock(print.to); + f_file_stream_lock(print->to); - fl_print_format("%r%[%QCannot specify the '%]", print.to, f_string_eol_s, print.set->error, print.prefix, print.set->error); - fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol, parameter, print.set->notable); - fl_print_format("%[' when processing a pipe.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s); + fl_print_format("%[%QCannot specify the '%]", print->to, print->set->error, print->prefix, print->set->error); + fl_print_format("%[%Q%Q%]", print->to, print->set->notable, symbol, parameter, print->set->notable); + fl_print_format("%[' when processing a pipe.%]%r", print->to, print->set->error, print->set->error, f_string_eol_s); - f_file_stream_unlock(print.to); + f_file_stream_unlock(print->to); return F_none; } #endif // _di_fll_program_print_error_parameter_cannot_use_with_pipe_ #ifndef _di_fll_program_print_error_parameter_cannot_use_with_xor_ - f_status_t fll_program_print_error_parameter_cannot_use_with_xor(const fl_print_t print, const f_string_static_t symbol_1, const f_string_static_t symbol_2, const f_string_static_t symbol_3, const f_string_static_t name_1, const f_string_static_t name_2, const f_string_static_t name_3) { + f_status_t fll_program_print_error_parameter_cannot_use_with_xor(fl_print_t * const print, const f_string_static_t symbol_1, const f_string_static_t symbol_2, const f_string_static_t symbol_3, const f_string_static_t name_1, const f_string_static_t name_2, const f_string_static_t name_3) { + #ifndef _di_level_2_parameter_checking_ + if (!print) return F_status_set_error(F_parameter); + #endif // _di_level_2_parameter_checking_ - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; + if (print->verbosity < f_console_verbosity_error_e) return F_output_not; - f_file_stream_lock(print.to); + f_file_stream_lock(print->to); - fl_print_format("%r%[%QThe '%]", print.to, f_string_eol_s, print.set->error, print.prefix, print.set->error); - fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol_1, name_1, print.set->notable); - fl_print_format("%[' parameter only allows either the '%]", print.to, print.set->error, print.set->error); - fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol_2, name_2, print.set->notable); - fl_print_format("%[' parameter or the '%]", print.to, print.set->error, print.set->error); - fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol_3, name_3, print.set->notable); - fl_print_format("%[' parameter, but not both.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s); + fl_print_format("%[%QThe '%]", print->to, print->set->error, print->prefix, print->set->error); + fl_print_format("%[%Q%Q%]", print->to, print->set->notable, symbol_1, name_1, print->set->notable); + fl_print_format("%[' parameter only allows either the '%]", print->to, print->set->error, print->set->error); + fl_print_format("%[%Q%Q%]", print->to, print->set->notable, symbol_2, name_2, print->set->notable); + fl_print_format("%[' parameter or the '%]", print->to, print->set->error, print->set->error); + fl_print_format("%[%Q%Q%]", print->to, print->set->notable, symbol_3, name_3, print->set->notable); + fl_print_format("%[' parameter, but not both.%]%r", print->to, print->set->error, print->set->error, f_string_eol_s); - f_file_stream_unlock(print.to); + f_file_stream_unlock(print->to); return F_none; } #endif // _di_fll_program_print_error_parameter_cannot_use_with_xor_ #ifndef _di_fll_program_print_error_parameter_integer_not_ - f_status_t fll_program_print_error_parameter_integer_not(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name, const f_string_static_t value) { + f_status_t fll_program_print_error_parameter_integer_not(fl_print_t * const print, const f_string_static_t symbol, const f_string_static_t name, const f_string_static_t value) { + #ifndef _di_level_2_parameter_checking_ + if (!print) return F_status_set_error(F_parameter); + #endif // _di_level_2_parameter_checking_ - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; + if (print->verbosity < f_console_verbosity_error_e) return F_output_not; - f_file_stream_lock(print.to); + f_file_stream_lock(print->to); - fl_print_format("%r%[%QThe value '%]", print.to, f_string_eol_s, print.set->error, print.prefix, print.set->error); - fl_print_format("%[%Q%]", print.to, print.set->notable, value, print.set->notable); - fl_print_format("%[' for the parameter '%]", print.to, print.set->error, print.set->error); - fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol, name, print.set->notable); - fl_print_format("%[' is not a valid integer.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s); + fl_print_format("%[%QThe value '%]", print->to, print->set->error, print->prefix, print->set->error); + fl_print_format("%[%Q%]", print->to, print->set->notable, value, print->set->notable); + fl_print_format("%[' for the parameter '%]", print->to, print->set->error, print->set->error); + fl_print_format("%[%Q%Q%]", print->to, print->set->notable, symbol, name, print->set->notable); + fl_print_format("%[' is not a valid integer.%]%r", print->to, print->set->error, print->set->error, f_string_eol_s); - f_file_stream_unlock(print.to); + f_file_stream_unlock(print->to); return F_none; } #endif // _di_fll_program_print_error_parameter_integer_not_ #ifndef _di_fll_program_print_error_parameter_integer_not_negative_ - f_status_t fll_program_print_error_parameter_integer_not_negative(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name, const f_string_static_t value) { + f_status_t fll_program_print_error_parameter_integer_not_negative(fl_print_t * const print, const f_string_static_t symbol, const f_string_static_t name, const f_string_static_t value) { + #ifndef _di_level_2_parameter_checking_ + if (!print) return F_status_set_error(F_parameter); + #endif // _di_level_2_parameter_checking_ - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; + if (print->verbosity < f_console_verbosity_error_e) return F_output_not; - f_file_stream_lock(print.to); + f_file_stream_lock(print->to); - fl_print_format("%r%[%QThe value '%]", print.to, f_string_eol_s, print.set->error, print.prefix, print.set->error); - fl_print_format("%[%Q%]", print.to, print.set->notable, value, print.set->notable); - fl_print_format("%[' for the parameter '%]", print.to, print.set->error, print.set->error); - fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol, name, print.set->notable); - fl_print_format("%[' is not a valid negative integer.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s); + fl_print_format("%[%QThe value '%]", print->to, print->set->error, print->prefix, print->set->error); + fl_print_format("%[%Q%]", print->to, print->set->notable, value, print->set->notable); + fl_print_format("%[' for the parameter '%]", print->to, print->set->error, print->set->error); + fl_print_format("%[%Q%Q%]", print->to, print->set->notable, symbol, name, print->set->notable); + fl_print_format("%[' is not a valid negative integer.%]%r", print->to, print->set->error, print->set->error, f_string_eol_s); - f_file_stream_unlock(print.to); + f_file_stream_unlock(print->to); return F_none; } #endif // _di_fll_program_print_error_parameter_integer_not_negative_ #ifndef _di_fll_program_print_error_parameter_integer_not_positive_ - f_status_t fll_program_print_error_parameter_integer_not_positive(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name, const f_string_static_t value) { + f_status_t fll_program_print_error_parameter_integer_not_positive(fl_print_t * const print, const f_string_static_t symbol, const f_string_static_t name, const f_string_static_t value) { + #ifndef _di_level_2_parameter_checking_ + if (!print) return F_status_set_error(F_parameter); + #endif // _di_level_2_parameter_checking_ - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; + if (print->verbosity < f_console_verbosity_error_e) return F_output_not; - f_file_stream_lock(print.to); + f_file_stream_lock(print->to); - fl_print_format("%r%[%QThe value '%]", print.to, f_string_eol_s, print.set->error, print.prefix, print.set->error); - fl_print_format("%[%Q%]", print.to, print.set->notable, value, print.set->notable); - fl_print_format("%[' for the parameter '%]", print.to, print.set->error, print.set->error); - fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol, name, print.set->notable); - fl_print_format("%[' is not a valid positive integer.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s); + fl_print_format("%[%QThe value '%]", print->to, print->set->error, print->prefix, print->set->error); + fl_print_format("%[%Q%]", print->to, print->set->notable, value, print->set->notable); + fl_print_format("%[' for the parameter '%]", print->to, print->set->error, print->set->error); + fl_print_format("%[%Q%Q%]", print->to, print->set->notable, symbol, name, print->set->notable); + fl_print_format("%[' is not a valid positive integer.%]%r", print->to, print->set->error, print->set->error, f_string_eol_s); - f_file_stream_unlock(print.to); + f_file_stream_unlock(print->to); return F_none; } #endif // _di_fll_program_print_error_parameter_integer_not_positive_ #ifndef _di_fll_program_print_error_parameter_missing_value_ - f_status_t fll_program_print_error_parameter_missing_value(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name) { + f_status_t fll_program_print_error_parameter_missing_value(fl_print_t * const print, const f_string_static_t symbol, const f_string_static_t name) { + #ifndef _di_level_2_parameter_checking_ + if (!print) return F_status_set_error(F_parameter); + #endif // _di_level_2_parameter_checking_ - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; + if (print->verbosity < f_console_verbosity_error_e) return F_output_not; - f_file_stream_lock(print.to); + f_file_stream_lock(print->to); - fl_print_format("%r%[%QThe parameter%] ", print.to, f_string_eol_s, print.set->error, print.prefix, print.set->error); - fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol, name, print.set->notable); - fl_print_format(" %[is specified, but no value is given.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s); + fl_print_format("%[%QThe parameter%] ", print->to, print->set->error, print->prefix, print->set->error); + fl_print_format("%[%Q%Q%]", print->to, print->set->notable, symbol, name, print->set->notable); + fl_print_format(" %[is specified, but no value is given.%]%r", print->to, print->set->error, print->set->error, f_string_eol_s); - f_file_stream_unlock(print.to); + f_file_stream_unlock(print->to); return F_none; } #endif // _di_fll_program_print_error_parameter_missing_value_ #ifndef _di_fll_program_print_error_parameter_missing_value_requires_amount_ - f_status_t fll_program_print_error_parameter_missing_value_requires_amount(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name, const f_string_static_t amount) { + f_status_t fll_program_print_error_parameter_missing_value_requires_amount(fl_print_t * const print, const f_string_static_t symbol, const f_string_static_t name, const f_string_static_t amount) { + #ifndef _di_level_2_parameter_checking_ + if (!print) return F_status_set_error(F_parameter); + #endif // _di_level_2_parameter_checking_ - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; + if (print->verbosity < f_console_verbosity_error_e) return F_output_not; - f_file_stream_lock(print.to); + f_file_stream_lock(print->to); - fl_print_format("%r%[%QThe parameter%] ", print.to, f_string_eol_s, print.set->error, print.prefix, print.set->error); - fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol, name, print.set->notable); - fl_print_format("%[ is specified, but%] ", print.to, print.set->error, print.set->error); - fl_print_format("%[%Q%]", print.to, print.set->notable, amount, print.set->notable); - fl_print_format(" %[values are not given.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s); + fl_print_format("%[%QThe parameter%] ", print->to, print->set->error, print->prefix, print->set->error); + fl_print_format("%[%Q%Q%]", print->to, print->set->notable, symbol, name, print->set->notable); + fl_print_format("%[ is specified, but%] ", print->to, print->set->error, print->set->error); + fl_print_format("%[%Q%]", print->to, print->set->notable, amount, print->set->notable); + fl_print_format(" %[values are not given.%]%r", print->to, print->set->error, print->set->error, f_string_eol_s); - f_file_stream_unlock(print.to); + f_file_stream_unlock(print->to); return F_none; } #endif // _di_fll_program_print_error_parameter_missing_value_requires_amount_ #ifndef _di_fll_program_print_error_parameter_must_specify_once_ - f_status_t fll_program_print_error_parameter_must_specify_once(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name) { + f_status_t fll_program_print_error_parameter_must_specify_once(fl_print_t * const print, const f_string_static_t symbol, const f_string_static_t name) { + #ifndef _di_level_2_parameter_checking_ + if (!print) return F_status_set_error(F_parameter); + #endif // _di_level_2_parameter_checking_ - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; + if (print->verbosity < f_console_verbosity_error_e) return F_output_not; - f_file_stream_lock(print.to); + f_file_stream_lock(print->to); - fl_print_format("%r%[%QThe parameter '%]", print.to, f_string_eol_s, print.set->error, print.prefix, print.set->error); - fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol, name, print.set->notable); - fl_print_format("%[' may only be specified once.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s); + fl_print_format("%[%QThe parameter '%]", print->to, print->set->error, print->prefix, print->set->error); + fl_print_format("%[%Q%Q%]", print->to, print->set->notable, symbol, name, print->set->notable); + fl_print_format("%[' may only be specified once.%]%r", print->to, print->set->error, print->set->error, f_string_eol_s); - f_file_stream_unlock(print.to); + f_file_stream_unlock(print->to); return F_none; } #endif // _di_fll_program_print_error_parameter_must_specify_once_ #ifndef _di_fll_program_print_error_parameter_must_specify_once_value_ - f_status_t fll_program_print_error_parameter_must_specify_once_value(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name, const f_string_static_t value) { + f_status_t fll_program_print_error_parameter_must_specify_once_value(fl_print_t * const print, const f_string_static_t symbol, const f_string_static_t name, const f_string_static_t value) { + #ifndef _di_level_2_parameter_checking_ + if (!print) return F_status_set_error(F_parameter); + #endif // _di_level_2_parameter_checking_ - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; + if (print->verbosity < f_console_verbosity_error_e) return F_output_not; - f_file_stream_lock(print.to); + f_file_stream_lock(print->to); - fl_print_format("%r%[%QThe value '%]", print.to, f_string_eol_s, print.set->error, print.prefix, print.set->error); - fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol, value, print.set->notable); - fl_print_format("%[' may only be specified once for the parameter '%]", print.to, print.set->error, print.set->error); - fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol, name, print.set->notable); - fl_print_format("%['.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s); + fl_print_format("%%[%QThe value '%]", print->to, print->set->error, print->prefix, print->set->error); + fl_print_format("%[%Q%Q%]", print->to, print->set->notable, symbol, value, print->set->notable); + fl_print_format("%[' may only be specified once for the parameter '%]", print->to, print->set->error, print->set->error); + fl_print_format("%[%Q%Q%]", print->to, print->set->notable, symbol, name, print->set->notable); + fl_print_format("%['.%]%r", print->to, print->set->error, print->set->error, f_string_eol_s); - f_file_stream_unlock(print.to); + f_file_stream_unlock(print->to); return F_none; } #endif // _di_fll_program_print_error_parameter_must_specify_once_value_ #ifndef _di_fll_program_print_error_parameter_process_ - f_status_t fll_program_print_error_parameter_process(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name) { + f_status_t fll_program_print_error_parameter_process(fl_print_t * const print, const f_string_static_t symbol, const f_string_static_t name) { + #ifndef _di_level_2_parameter_checking_ + if (!print) return F_status_set_error(F_parameter); + #endif // _di_level_2_parameter_checking_ - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; + if (print->verbosity < f_console_verbosity_error_e) return F_output_not; - f_file_stream_lock(print.to); + f_file_stream_lock(print->to); - fl_print_format("%r%[%QFailure while processing the parameter '%]", print.to, f_string_eol_s, print.set->error, print.prefix, print.set->error); - fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol, name, print.set->notable); - fl_print_format("%['.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s); + fl_print_format("%[%QFailure while processing the parameter '%]", print->to, print->set->error, print->prefix, print->set->error); + fl_print_format("%[%Q%Q%]", print->to, print->set->notable, symbol, name, print->set->notable); + fl_print_format("%['.%]%r", print->to, print->set->error, print->set->error, f_string_eol_s); - f_file_stream_unlock(print.to); + f_file_stream_unlock(print->to); return F_none; } #endif // _di_fll_program_print_error_parameter_process_ #ifndef _di_fll_program_print_error_parameter_range_start_before_stop_ - f_status_t fll_program_print_error_parameter_range_start_before_stop(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name, const f_string_static_t value_start, const f_string_static_t value_stop) { + f_status_t fll_program_print_error_parameter_range_start_before_stop(fl_print_t * const print, const f_string_static_t symbol, const f_string_static_t name, const f_string_static_t value_start, const f_string_static_t value_stop) { + #ifndef _di_level_2_parameter_checking_ + if (!print) return F_status_set_error(F_parameter); + #endif // _di_level_2_parameter_checking_ - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; + if (print->verbosity < f_console_verbosity_error_e) return F_output_not; - f_file_stream_lock(print.to); + f_file_stream_lock(print->to); - fl_print_format("%r%[%QThe start range value '%]", print.to, f_string_eol_s, print.set->error, print.prefix, print.set->error); - fl_print_format("%[%Q%]", print.to, print.set->notable, value_start, print.set->notable); - fl_print_format("%[' may not be greater than the stop value '%]", print.to, print.set->error, print.set->error); - fl_print_format("%[%Q%]", print.to, print.set->notable, value_stop, print.set->notable); - fl_print_format("%[' for the parameter '%]", print.to, print.set->error, print.set->error); - fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol, name, print.set->notable); - fl_print_format("%['.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s); + fl_print_format("%[%QThe start range value '%]", print->to, print->set->error, print->prefix, print->set->error); + fl_print_format("%[%Q%]", print->to, print->set->notable, value_start, print->set->notable); + fl_print_format("%[' may not be greater than the stop value '%]", print->to, print->set->error, print->set->error); + fl_print_format("%[%Q%]", print->to, print->set->notable, value_stop, print->set->notable); + fl_print_format("%[' for the parameter '%]", print->to, print->set->error, print->set->error); + fl_print_format("%[%Q%Q%]", print->to, print->set->notable, symbol, name, print->set->notable); + fl_print_format("%['.%]%r", print->to, print->set->error, print->set->error, f_string_eol_s); - f_file_stream_unlock(print.to); + f_file_stream_unlock(print->to); return F_none; } #endif // _di_fll_program_print_error_parameter_range_start_before_stop_ #ifndef _di_fll_program_print_error_parameter_value_too_long_ - f_status_t fll_program_print_error_parameter_value_too_long(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name) { + f_status_t fll_program_print_error_parameter_value_too_long(fl_print_t * const print, const f_string_static_t symbol, const f_string_static_t name) { + #ifndef _di_level_2_parameter_checking_ + if (!print) return F_status_set_error(F_parameter); + #endif // _di_level_2_parameter_checking_ - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; + if (print->verbosity < f_console_verbosity_error_e) return F_output_not; - f_file_stream_lock(print.to); + f_file_stream_lock(print->to); - fl_print_format("%r%[%QThe value for the parameter '%]", print.to, f_string_eol_s, print.set->error, print.prefix, print.set->error); - fl_print_format("%[%Q%Q%]", print.to, print.notable, symbol, name, print.notable); - fl_print_format("%[' is too long.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s); + fl_print_format("%[%QThe value for the parameter '%]", print->to, print->set->error, print->prefix, print->set->error); + fl_print_format("%[%Q%Q%]", print->to, print->notable, symbol, name, print->notable); + fl_print_format("%[' is too long.%]%r", print->to, print->set->error, print->set->error, f_string_eol_s); - f_file_stream_unlock(print.to); + f_file_stream_unlock(print->to); return F_none; } #endif // _di_fll_program_print_error_parameter_value_too_long_ #ifndef _di_fll_program_print_error_pipe_invalid_form_feed_ - f_status_t fll_program_print_error_pipe_invalid_form_feed(const fl_print_t print) { + f_status_t fll_program_print_error_pipe_invalid_form_feed(fl_print_t * const print) { + #ifndef _di_level_2_parameter_checking_ + if (!print) return F_status_set_error(F_parameter); + #endif // _di_level_2_parameter_checking_ - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; + if (print->verbosity < f_console_verbosity_error_e) return F_output_not; - f_file_stream_lock(print.to); + f_file_stream_lock(print->to); - fl_print_format("%r%[%QThe pipe has incorrectly placed form-feed characters (\\f).%]%r", print.to, f_string_eol_s, print.set->error, print.prefix, print.set->error, f_string_eol_s); + fl_print_format("%[%QThe pipe has incorrectly placed form-feed characters (\\f).%]%r", print->to, print->set->error, print->prefix, print->set->error, f_string_eol_s); - f_file_stream_unlock(print.to); + f_file_stream_unlock(print->to); return F_none; } #endif // _di_fll_program_print_error_pipe_invalid_form_feed_ #ifndef _di_fll_program_print_error_pipe_missing_content_ - f_status_t fll_program_print_error_pipe_missing_content(const fl_print_t print) { + f_status_t fll_program_print_error_pipe_missing_content(fl_print_t * const print) { + #ifndef _di_level_2_parameter_checking_ + if (!print) return F_status_set_error(F_parameter); + #endif // _di_level_2_parameter_checking_ - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; + if (print->verbosity < f_console_verbosity_error_e) return F_output_not; - f_file_stream_lock(print.to); + f_file_stream_lock(print->to); - fl_print_format("%r%[%QThe pipe has no content.%]%r", print.to, f_string_eol_s, print.set->error, print.prefix, print.set->error, f_string_eol_s); + fl_print_format("%[%QThe pipe has no content.%]%r", print->to, print->set->error, print->prefix, print->set->error, f_string_eol_s); - f_file_stream_unlock(print.to); + f_file_stream_unlock(print->to); return F_none; } #endif // _di_fll_program_print_error_pipe_missing_content_ #ifndef _di_fll_program_print_error_pipe_object_without_content_ - f_status_t fll_program_print_error_pipe_object_without_content(const fl_print_t print) { + f_status_t fll_program_print_error_pipe_object_without_content(fl_print_t * const print) { + #ifndef _di_level_2_parameter_checking_ + if (!print) return F_status_set_error(F_parameter); + #endif // _di_level_2_parameter_checking_ - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; + if (print->verbosity < f_console_verbosity_error_e) return F_output_not; - f_file_stream_lock(print.to); + f_file_stream_lock(print->to); - fl_print_format("%r%[%QThe pipe has an Object without Content.%]%r", print.to, f_string_eol_s, print.set->error, print.prefix, print.set->error, f_string_eol_s); + fl_print_format("%[%QThe pipe has an Object without Content.%]%r", print->to, print->set->error, print->prefix, print->set->error, f_string_eol_s); - f_file_stream_unlock(print.to); + f_file_stream_unlock(print->to); return F_none; } #endif // _di_fll_program_print_error_pipe_object_without_content_ #ifndef _di_fll_program_print_help_header_ - f_status_t fll_program_print_help_header(const fl_print_t print, const f_string_static_t name, const f_string_static_t version) { + f_status_t fll_program_print_help_header(fl_print_t * const print, const f_string_static_t name, const f_string_static_t version) { + #ifndef _di_level_2_parameter_checking_ + if (!print) return F_status_set_error(F_parameter); + #endif // _di_level_2_parameter_checking_ - fl_print_format(" %[%Q%]%r", print.to, print.set->title, name, print.set->title, f_string_eol_s); - fl_print_format(" %[Version %Q%]%r", print.to, print.set->notable, version, print.set->notable, f_string_eol_s); + fl_print_format(" %[%Q%]%r", print->to, print->set->title, name, print->set->title, f_string_eol_s); + fl_print_format(" %[Version %Q%]%r%r", print->to, print->set->notable, version, print->set->notable, f_string_eol_s, f_string_eol_s); - fl_print_format("%r %[Available Options:%] ", print.to, f_string_eol_s, print.set->important, print.set->important); + fl_print_format(" %[Available Options:%] %r", print->to, print->set->important, print->set->important, f_string_eol_s); return F_none; } #endif // _di_fll_program_print_help_header_ #ifndef _di_fll_program_print_help_option_ - f_status_t fll_program_print_help_option(const fl_print_t print, const f_string_static_t option_short, const f_string_static_t option_long, const f_string_static_t symbol_short, const f_string_static_t symbol_long, const char *description) { + f_status_t fll_program_print_help_option(fl_print_t * const print, const f_string_static_t option_short, const f_string_static_t option_long, const f_string_static_t symbol_short, const f_string_static_t symbol_long, const char *description) { + #ifndef _di_level_2_parameter_checking_ + if (!print) return F_status_set_error(F_parameter); + #endif // _di_level_2_parameter_checking_ return private_fll_program_print_help_option(print, option_short, option_long, symbol_short, symbol_long, description); } #endif // _di_fll_program_print_help_option_ #ifndef _di_fll_program_print_help_option_standard_ - f_status_t fll_program_print_help_option_standard(const fl_print_t print) { + f_status_t fll_program_print_help_option_standard(fl_print_t * const print) { + #ifndef _di_level_2_parameter_checking_ + if (!print) return F_status_set_error(F_parameter); + #endif // _di_level_2_parameter_checking_ private_fll_program_print_help_option(print, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Print this help message."); private_fll_program_print_help_option(print, f_console_standard_short_copyright_s, f_console_standard_long_copyright_s, f_console_symbol_short_inverse_s, f_console_symbol_long_inverse_s, " Print the copyright."); private_fll_program_print_help_option(print, f_console_standard_short_dark_s, f_console_standard_long_dark_s, f_console_symbol_short_inverse_s, f_console_symbol_long_inverse_s, " Output using colors that show up better on dark backgrounds."); private_fll_program_print_help_option(print, f_console_standard_short_light_s, f_console_standard_long_light_s, f_console_symbol_short_inverse_s, f_console_symbol_long_inverse_s, " Output using colors that show up better on light backgrounds."); private_fll_program_print_help_option(print, f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, f_console_symbol_short_inverse_s, f_console_symbol_long_inverse_s, " Do not print using color."); - private_fll_program_print_help_option(print, f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, f_console_symbol_short_inverse_s, f_console_symbol_long_inverse_s, " Decrease verbosity, silencing most print.to."); - private_fll_program_print_help_option(print, f_console_standard_short_error_s, f_console_standard_long_error_s, f_console_symbol_short_inverse_s, f_console_symbol_long_inverse_s, " Decrease verbosity, using only error print.to."); + private_fll_program_print_help_option(print, f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, f_console_symbol_short_inverse_s, f_console_symbol_long_inverse_s, " Decrease verbosity, silencing most print->to."); + private_fll_program_print_help_option(print, f_console_standard_short_error_s, f_console_standard_long_error_s, f_console_symbol_short_inverse_s, f_console_symbol_long_inverse_s, " Decrease verbosity, using only error print->to."); private_fll_program_print_help_option(print, f_console_standard_short_normal_s, f_console_standard_long_normal_s, f_console_symbol_short_inverse_s, f_console_symbol_long_inverse_s, " Set verbosity to normal."); - private_fll_program_print_help_option(print, f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, f_console_symbol_short_inverse_s, f_console_symbol_long_inverse_s, " Increase verbosity beyond normal print.to."); - private_fll_program_print_help_option(print, f_console_standard_short_debug_s, f_console_standard_long_debug_s, f_console_symbol_short_inverse_s, f_console_symbol_long_inverse_s, " Enable debugging, significantly increasing verbosity beyond normal print.to."); + private_fll_program_print_help_option(print, f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, f_console_symbol_short_inverse_s, f_console_symbol_long_inverse_s, " Increase verbosity beyond normal print->to."); + private_fll_program_print_help_option(print, f_console_standard_short_debug_s, f_console_standard_long_debug_s, f_console_symbol_short_inverse_s, f_console_symbol_long_inverse_s, " Enable debugging, significantly increasing verbosity beyond normal print->to."); private_fll_program_print_help_option(print, f_console_standard_short_version_s, f_console_standard_long_version_s, f_console_symbol_short_inverse_s, f_console_symbol_long_inverse_s, " Print only the version number."); private_fll_program_print_help_option(print, f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, f_console_symbol_short_inverse_s, f_console_symbol_long_inverse_s, "Disable printing of first line."); private_fll_program_print_help_option(print, f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, f_console_symbol_short_inverse_s, f_console_symbol_long_inverse_s, " Disable printing of last line."); @@ -455,74 +528,87 @@ extern "C" { #endif // _di_fll_program_print_help_option_standard_ #ifndef _di_fll_program_print_help_option_long_ - f_status_t fll_program_print_help_option_long(const fl_print_t print, const f_string_static_t option_long, const f_string_static_t symbol_long, const char *description) { + f_status_t fll_program_print_help_option_long(fl_print_t * const print, const f_string_static_t option_long, const f_string_static_t symbol_long, const char *description) { + #ifndef _di_level_2_parameter_checking_ + if (!print) return F_status_set_error(F_parameter); + #endif // _di_level_2_parameter_checking_ - fl_print_format("%r %Q%[%Q%] %S", print.to, f_string_eol_s, symbol_long, print.set->standout, option_long, print.set->standout, description); + fl_print_format(" %Q%[%Q%] %S%r", print->to, symbol_long, print->set->standout, option_long, print->set->standout, description, f_string_eol_s); return F_none; } #endif // _di_fll_program_print_help_option_long_ #ifndef _di_fll_program_print_help_option_other_ - f_status_t fll_program_print_help_option_other(const fl_print_t print, const f_string_static_t option_other, const char *description) { + f_status_t fll_program_print_help_option_other(fl_print_t * const print, const f_string_static_t option_other, const char *description) { + #ifndef _di_level_2_parameter_checking_ + if (!print) return F_status_set_error(F_parameter); + #endif // _di_level_2_parameter_checking_ - fl_print_format("%r %[%Q%] %S", print.to, f_string_eol_s, print.set->standout, option_other, print.set->standout, description); + fl_print_format(" %[%Q%] %S%r", print->to, print->set->standout, option_other, print->set->standout, description, f_string_eol_s); return F_none; } #endif // _di_fll_program_print_help_option_other_ #ifndef _di_fll_program_print_help_usage_ - f_status_t fll_program_print_help_usage(const fl_print_t print, const f_string_static_t name, const f_string_static_t parameters) { + f_status_t fll_program_print_help_usage(fl_print_t * const print, const f_string_static_t name, const f_string_static_t parameters) { + #ifndef _di_level_2_parameter_checking_ + if (!print) return F_status_set_error(F_parameter); + #endif // _di_level_2_parameter_checking_ - fl_print_format(" %[Usage:%]%r", print.to, print.set->important, print.set->important, f_string_eol_s); + fl_print_format(" %[Usage:%]%r", print->to, print->set->important, print->set->important, f_string_eol_s); - fl_print_format(" %[%Q%]", print.to, print.set->standout, name, print.set->standout); - fl_print_format(" %[[%] options %[]%]", print.to, print.set->notable, print.set->notable, print.set->notable, print.set->notable); + fl_print_format(" %[%Q%]", print->to, print->set->standout, name, print->set->standout); + fl_print_format(" %[[%] options %[]%]", print->to, print->set->notable, print->set->notable, print->set->notable, print->set->notable); if (parameters.used) { - fl_print_format(" %[[%] %Q %[]%]", print.to, print.set->notable, print.set->notable, parameters, print.set->notable, print.set->notable); + fl_print_format(" %[[%] %Q %[]%]", print->to, print->set->notable, print->set->notable, parameters, print->set->notable, print->set->notable); } - f_print_dynamic_raw(f_string_eol_s, print.to); + f_print_dynamic_raw(f_string_eol_s, print->to); return F_none; } #endif // _di_fll_program_print_help_usage_ #ifndef _di_fll_program_print_signal_received_ - f_status_t fll_program_print_signal_received(const fl_print_t print, const uint32_t signal) { + f_status_t fll_program_print_signal_received(fl_print_t * const print, const uint32_t signal) { + #ifndef _di_level_2_parameter_checking_ + if (!print) return F_status_set_error(F_parameter); + #endif // _di_level_2_parameter_checking_ - if (print.verbosity != f_console_verbosity_verbose_e && print.verbosity != f_console_verbosity_debug_e) { + if (print->verbosity != f_console_verbosity_verbose_e && print->verbosity != f_console_verbosity_debug_e) { return F_output_not; } - f_file_stream_lock(print.to); + f_file_stream_lock(print->to); // Must flush and reset color because the interrupt may have interrupted the middle of a print function. - f_file_stream_flush(print.to); + f_file_stream_flush(print->to); - fl_print_format("%]%r%[Received signal code %]", print.to, print.set->reset, f_string_eol_s, print.set->warning, print.set->warning); - fl_print_format("%[%u%]", print.to, print.set->notable, signal, print.set->notable); - fl_print_format("%[.%]%r", print.to, print.set->warning, print.set->warning, f_string_eol_s); + fl_print_format("%]%[Received signal code %]", print->to, print->set->reset, print->set->warning, print->set->warning); + fl_print_format("%[%u%]", print->to, print->set->notable, signal, print->set->notable); + fl_print_format("%[.%]%r", print->to, print->set->warning, print->set->warning, f_string_eol_s); - f_file_stream_unlock(print.to); + f_file_stream_unlock(print->to); return F_none; } #endif // _di_fll_program_print_signal_received_ #ifndef _di_fll_program_print_version_ - f_status_t fll_program_print_version(const fl_print_t print, const f_string_static_t version) { + f_status_t fll_program_print_version(fl_print_t * const print, const f_string_static_t version) { + #ifndef _di_level_2_parameter_checking_ + if (!print) return F_status_set_error(F_parameter); + #endif // _di_level_2_parameter_checking_ - f_file_stream_lock(print.to); + f_file_stream_lock(print->to); - f_print_dynamic_raw(f_string_eol_s, print.to); - f_print_dynamic(version, print.to); - f_print_dynamic_raw(f_string_eol_s, print.to); - f_print_dynamic_raw(f_string_eol_s, print.to); + f_print_dynamic(version, print->to); + f_print_dynamic_raw(f_string_eol_s, print->to); - f_file_stream_unlock(print.to); + f_file_stream_unlock(print->to); return F_none; } diff --git a/level_2/fll_program/c/program/print.h b/level_2/fll_program/c/program/print.h index 323b0bc..47a6135 100644 --- a/level_2/fll_program/c/program/print.h +++ b/level_2/fll_program/c/program/print.h @@ -26,9 +26,11 @@ extern "C" { * @return * F_none on success. * F_output_not on success, but no printing is performed. + * + * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_fll_program_print_copyright_ - extern f_status_t fll_program_print_copyright(const fl_print_t print); + extern f_status_t fll_program_print_copyright(fl_print_t * const print); #endif // _di_fll_program_print_copyright_ /** @@ -48,9 +50,11 @@ extern "C" { * @return * F_none on success. * F_output_not on success, but no printing is performed. + * + * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_fll_program_print_error_missing_file_ - extern f_status_t fll_program_print_error_missing_file(const fl_print_t print); + extern f_status_t fll_program_print_error_missing_file(fl_print_t * const print); #endif // _di_fll_program_print_error_missing_file_ /** @@ -72,9 +76,11 @@ extern "C" { * @return * F_none on success. * F_output_not on success, but no printing is performed. + * + * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_fll_program_print_error_missing_variable_not_zero_ - extern f_status_t fll_program_print_error_missing_variable_not_zero(const fl_print_t print, const f_string_static_t variable); + extern f_status_t fll_program_print_error_missing_variable_not_zero(fl_print_t * const print, const f_string_static_t variable); #endif // _di_fll_program_print_error_missing_variable_not_zero_ /** @@ -104,9 +110,11 @@ extern "C" { * @return * F_none on success. * F_output_not on success, but no printing is performed. + * + * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_fll_program_print_error_parameter_both_specified_same_amount_ - extern f_status_t fll_program_print_error_parameter_both_specified_same_amount(const fl_print_t print, const f_string_static_t symbol_1, const f_string_static_t symbol_2, const f_string_static_t name_1, const f_string_static_t name_2); + extern f_status_t fll_program_print_error_parameter_both_specified_same_amount(fl_print_t * const print, const f_string_static_t symbol_1, const f_string_static_t symbol_2, const f_string_static_t name_1, const f_string_static_t name_2); #endif // _di_fll_program_print_error_parameter_both_specified_same_amount_ /** @@ -142,9 +150,11 @@ extern "C" { * @return * F_none on success. * F_output_not on success, but no printing is performed. + * + * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_fll_program_print_error_parameter_both_specified_same_amount_without_ - extern f_status_t fll_program_print_error_parameter_both_specified_same_amount_without(const fl_print_t print, const f_string_static_t symbol_1, const f_string_static_t symbol_2, const f_string_static_t symbol_3, const f_string_static_t name_1, const f_string_static_t name_2, const f_string_static_t name_3); + extern f_status_t fll_program_print_error_parameter_both_specified_same_amount_without(fl_print_t * const print, const f_string_static_t symbol_1, const f_string_static_t symbol_2, const f_string_static_t symbol_3, const f_string_static_t name_1, const f_string_static_t name_2, const f_string_static_t name_3); #endif // _di_fll_program_print_error_parameter_both_specified_same_amount_without_ /** @@ -174,9 +184,11 @@ extern "C" { * @return * F_none on success. * F_output_not on success, but no printing is performed. + * + * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_fll_program_print_error_parameter_cannot_use_with_ - extern f_status_t fll_program_print_error_parameter_cannot_use_with(const fl_print_t print, const f_string_static_t symbol_1, const f_string_static_t symbol_2, const f_string_static_t name_1, const f_string_static_t name_2); + extern f_status_t fll_program_print_error_parameter_cannot_use_with(fl_print_t * const print, const f_string_static_t symbol_1, const f_string_static_t symbol_2, const f_string_static_t name_1, const f_string_static_t name_2); #endif // _di_fll_program_print_error_parameter_cannot_use_with_ /** @@ -211,9 +223,11 @@ extern "C" { * @return * F_none on success. * F_output_not on success, but no printing is performed. + * + * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_fll_program_print_error_parameter_cannot_use_with_without_ - extern f_status_t fll_program_print_error_parameter_cannot_use_with_without(const fl_print_t print, const f_string_static_t symbol_1, const f_string_static_t symbol_2, const f_string_static_t symbol_3, const f_string_static_t name_1, const f_string_static_t name_2, const f_string_static_t name_3); + extern f_status_t fll_program_print_error_parameter_cannot_use_with_without(fl_print_t * const print, const f_string_static_t symbol_1, const f_string_static_t symbol_2, const f_string_static_t symbol_3, const f_string_static_t name_1, const f_string_static_t name_2, const f_string_static_t name_3); #endif // _di_fll_program_print_error_parameter_cannot_use_with_without_ /** @@ -238,9 +252,11 @@ extern "C" { * @return * F_none on success. * F_output_not on success, but no printing is performed. + * + * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_fll_program_print_error_parameter_cannot_use_with_pipe_ - extern f_status_t fll_program_print_error_parameter_cannot_use_with_pipe(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name); + extern f_status_t fll_program_print_error_parameter_cannot_use_with_pipe(fl_print_t * const print, const f_string_static_t symbol, const f_string_static_t name); #endif // _di_fll_program_print_error_parameter_cannot_use_with_pipe_ /** @@ -281,9 +297,11 @@ extern "C" { * @return * F_none on success. * F_output_not on success, but no printing is performed. + * + * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_fll_program_print_error_parameter_allows_either_xor_ - extern f_status_t fll_program_print_error_parameter_cannot_use_with_xor(const fl_print_t print, const f_string_static_t symbol_1, const f_string_static_t symbol_2, const f_string_static_t symbol_3, const f_string_static_t name_1, const f_string_static_t name_2, const f_string_static_t name_3); + extern f_status_t fll_program_print_error_parameter_cannot_use_with_xor(fl_print_t * const print, const f_string_static_t symbol_1, const f_string_static_t symbol_2, const f_string_static_t symbol_3, const f_string_static_t name_1, const f_string_static_t name_2, const f_string_static_t name_3); #endif // _di_fll_program_print_error_parameter_allows_either_xor_ /** @@ -311,9 +329,11 @@ extern "C" { * @return * F_none on success. * F_output_not on success, but no printing is performed. + * + * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_fll_program_print_error_parameter_integer_not_ - extern f_status_t fll_program_print_error_parameter_integer_not(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name, const f_string_static_t value); + extern f_status_t fll_program_print_error_parameter_integer_not(fl_print_t * const print, const f_string_static_t symbol, const f_string_static_t name, const f_string_static_t value); #endif // _di_fll_program_print_error_parameter_integer_not_ /** @@ -341,9 +361,11 @@ extern "C" { * @return * F_none on success. * F_output_not on success, but no printing is performed. + * + * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_fll_program_print_error_parameter_integer_not_negative_ - extern f_status_t fll_program_print_error_parameter_integer_not_negative(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name, const f_string_static_t value); + extern f_status_t fll_program_print_error_parameter_integer_not_negative(fl_print_t * const print, const f_string_static_t symbol, const f_string_static_t name, const f_string_static_t value); #endif // _di_fll_program_print_error_parameter_integer_not_negative_ /** @@ -371,9 +393,11 @@ extern "C" { * @return * F_none on success. * F_output_not on success, but no printing is performed. + * + * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_fll_program_print_error_parameter_integer_not_positive_ - extern f_status_t fll_program_print_error_parameter_integer_not_positive(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name, const f_string_static_t value); + extern f_status_t fll_program_print_error_parameter_integer_not_positive(fl_print_t * const print, const f_string_static_t symbol, const f_string_static_t name, const f_string_static_t value); #endif // _di_fll_program_print_error_parameter_integer_not_positive_ /** @@ -399,9 +423,11 @@ extern "C" { * @return * F_none on success. * F_output_not on success, but no printing is performed. + * + * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_fll_program_print_error_parameter_missing_value_ - extern f_status_t fll_program_print_error_parameter_missing_value(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name); + extern f_status_t fll_program_print_error_parameter_missing_value(fl_print_t * const print, const f_string_static_t symbol, const f_string_static_t name); #endif // _di_fll_program_print_error_parameter_missing_value_ /** @@ -429,9 +455,11 @@ extern "C" { * @return * F_none on success. * F_output_not on success, but no printing is performed. + * + * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_fll_program_print_error_parameter_missing_value_requires_amount_ - extern f_status_t fll_program_print_error_parameter_missing_value_requires_amount(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name, const f_string_static_t amount); + extern f_status_t fll_program_print_error_parameter_missing_value_requires_amount(fl_print_t * const print, const f_string_static_t symbol, const f_string_static_t name, const f_string_static_t amount); #endif // _di_fll_program_print_error_parameter_missing_value_requires_amount_ /** @@ -457,9 +485,11 @@ extern "C" { * @return * F_none on success. * F_output_not on success, but no printing is performed. + * + * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_fll_program_print_error_parameter_must_specify_once_ - extern f_status_t fll_program_print_error_parameter_must_specify_once(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name); + extern f_status_t fll_program_print_error_parameter_must_specify_once(fl_print_t * const print, const f_string_static_t symbol, const f_string_static_t name); #endif // _di_fll_program_print_error_parameter_must_specify_once_ /** @@ -487,9 +517,11 @@ extern "C" { * @return * F_none on success. * F_output_not on success, but no printing is performed. + * + * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_fll_program_print_error_parameter_must_specify_once_value_ - extern f_status_t fll_program_print_error_parameter_must_specify_once_value(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name, const f_string_static_t value); + extern f_status_t fll_program_print_error_parameter_must_specify_once_value(fl_print_t * const print, const f_string_static_t symbol, const f_string_static_t name, const f_string_static_t value); #endif // _di_fll_program_print_error_parameter_must_specify_once_value_ /** @@ -515,9 +547,11 @@ extern "C" { * @return * F_none on success. * F_output_not on success, but no printing is performed. + * + * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_fll_program_print_error_parameter_process_ - extern f_status_t fll_program_print_error_parameter_process(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name); + extern f_status_t fll_program_print_error_parameter_process(fl_print_t * const print, const f_string_static_t symbol, const f_string_static_t name); #endif // _di_fll_program_print_error_parameter_process_ /** @@ -547,9 +581,11 @@ extern "C" { * @return * F_none on success. * F_output_not on success, but no printing is performed. + * + * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_fll_program_print_error_parameter_range_start_before_stop_ - extern f_status_t fll_program_print_error_parameter_range_start_before_stop(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name, const f_string_static_t value_start, const f_string_static_t value_stop); + extern f_status_t fll_program_print_error_parameter_range_start_before_stop(fl_print_t * const print, const f_string_static_t symbol, const f_string_static_t name, const f_string_static_t value_start, const f_string_static_t value_stop); #endif // _di_fll_program_print_error_parameter_range_start_before_stop_ /** @@ -568,9 +604,11 @@ extern "C" { * @return * F_none on success. * F_output_not on success, but no printing is performed. + * + * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_fll_program_print_error_parameter_value_too_long_ - extern f_status_t fll_program_print_error_parameter_value_too_long(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name); + extern f_status_t fll_program_print_error_parameter_value_too_long(fl_print_t * const print, const f_string_static_t symbol, const f_string_static_t name); #endif // _di_fll_program_print_error_parameter_value_too_long_ /** @@ -590,9 +628,11 @@ extern "C" { * @return * F_none on success. * F_output_not on success, but no printing is performed. + * + * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_fll_program_print_error_pipe_invalid_form_feed_ - extern f_status_t fll_program_print_error_pipe_invalid_form_feed(const fl_print_t print); + extern f_status_t fll_program_print_error_pipe_invalid_form_feed(fl_print_t * const print); #endif // _di_fll_program_print_error_pipe_invalid_form_feed_ /** @@ -612,9 +652,11 @@ extern "C" { * @return * F_none on success. * F_output_not on success, but no printing is performed. + * + * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_fll_program_print_error_pipe_missing_content_ - extern f_status_t fll_program_print_error_pipe_missing_content(const fl_print_t print); + extern f_status_t fll_program_print_error_pipe_missing_content(fl_print_t * const print); #endif // _di_fll_program_print_error_pipe_missing_content_ /** @@ -636,9 +678,15 @@ extern "C" { * @return * F_none on success. * F_output_not on success, but no printing is performed. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * @see f_file_stream_lock() + * @see f_file_stream_unlock() + * @see fl_print_format() */ #ifndef _di_fll_program_print_error_pipe_object_without_content_ - extern f_status_t fll_program_print_error_pipe_object_without_content(const fl_print_t print); + extern f_status_t fll_program_print_error_pipe_object_without_content(fl_print_t * const print); #endif // _di_fll_program_print_error_pipe_object_without_content_ /** @@ -659,11 +707,12 @@ extern "C" { * F_none on success. * F_output_not on success, but no printing is performed. * - * @see f_print_terminated() + * F_parameter (with error bit) if a parameter is invalid. + * * @see fl_print_format() */ #ifndef _di_fll_program_print_help_header_ - extern f_status_t fll_program_print_help_header(const fl_print_t print, const f_string_static_t name, const f_string_static_t version); + extern f_status_t fll_program_print_help_header(fl_print_t * const print, const f_string_static_t name, const f_string_static_t version); #endif // _di_fll_program_print_help_header_ /** @@ -690,11 +739,12 @@ extern "C" { * F_none on success. * F_output_not on success, but no printing is performed. * - * @see f_print_terminated() + * F_parameter (with error bit) if a parameter is invalid. + * * @see fl_print_format() */ #ifndef _di_fll_program_print_help_option_ - extern f_status_t fll_program_print_help_option(const fl_print_t print, const f_string_static_t option_short, const f_string_static_t option_long, const f_string_static_t symbol_short, const f_string_static_t symbol_long, const char *description); + extern f_status_t fll_program_print_help_option(fl_print_t * const print, const f_string_static_t option_short, const f_string_static_t option_long, const f_string_static_t symbol_short, const f_string_static_t symbol_long, const char *description); #endif // _di_fll_program_print_help_option_ /** @@ -717,11 +767,12 @@ extern "C" { * F_none on success. * F_output_not on success, but no printing is performed. * - * @see f_print_terminated() + * F_parameter (with error bit) if a parameter is invalid. + * * @see fl_print_format() */ #ifndef _di_fll_program_print_help_option_long_ - extern f_status_t fll_program_print_help_option_long(const fl_print_t print, const f_string_static_t option_long, const f_string_static_t symbol_long, const char *description); + extern f_status_t fll_program_print_help_option_long(fl_print_t * const print, const f_string_static_t option_long, const f_string_static_t symbol_long, const char *description); #endif // _di_fll_program_print_help_option_long_ /** @@ -742,11 +793,12 @@ extern "C" { * F_none on success. * F_output_not on success, but no printing is performed. * - * @see f_print_terminated() + * F_parameter (with error bit) if a parameter is invalid. + * * @see fl_print_format() */ #ifndef _di_fll_program_print_help_option_other_ - extern f_status_t fll_program_print_help_option_other(const fl_print_t print, const f_string_static_t option_other, const char *description); + extern f_status_t fll_program_print_help_option_other(fl_print_t * const print, const f_string_static_t option_other, const char *description); #endif // _di_fll_program_print_help_option_other_ /** @@ -765,11 +817,12 @@ extern "C" { * F_none on success. * F_output_not on success, but no printing is performed. * - * @see f_print_terminated() + * F_parameter (with error bit) if a parameter is invalid. + * * @see fl_print_format() */ #ifndef _di_fll_program_print_help_option_standard_ - extern f_status_t fll_program_print_help_option_standard(const fl_print_t print); + extern f_status_t fll_program_print_help_option_standard(fl_print_t * const print); #endif // _di_fll_program_print_help_option_standard_ /** @@ -792,11 +845,13 @@ extern "C" { * F_none on success. * F_output_not on success, but no printing is performed. * - * @see f_print_terminated() + * F_parameter (with error bit) if a parameter is invalid. + * + * @see f_print_dynamic_raw() * @see fl_print_format() */ #ifndef _di_fll_program_print_help_usage_ - extern f_status_t fll_program_print_help_usage(const fl_print_t print, const f_string_static_t name, const f_string_static_t parameters); + extern f_status_t fll_program_print_help_usage(fl_print_t * const print, const f_string_static_t name, const f_string_static_t parameters); #endif // _di_fll_program_print_help_usage_ /** @@ -814,9 +869,15 @@ extern "C" { * @return * F_none on success. * F_output_not on success, but no printing is performed. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * @see f_file_stream_lock() + * @see f_file_stream_unlock() + * @see fl_print_format() */ #ifndef _di_fll_program_print_signal_received_ - extern f_status_t fll_program_print_signal_received(const fl_print_t print, const uint32_t signal); + extern f_status_t fll_program_print_signal_received(fl_print_t * const print, const uint32_t signal); #endif // _di_fll_program_print_signal_received_ /** @@ -833,10 +894,15 @@ extern "C" { * F_none on success. * F_output_not on success, but no printing is performed. * - * @see fl_print_format() + * F_parameter (with error bit) if a parameter is invalid. + * + * @see f_file_stream_lock() + * @see f_file_stream_unlock() + * @see f_print_dynamic() + * @see f_print_dynamic_raw() */ #ifndef _di_fll_program_print_version_ - extern f_status_t fll_program_print_version(const fl_print_t print, const f_string_static_t version); + extern f_status_t fll_program_print_version(fl_print_t * const print, const f_string_static_t version); #endif // _di_fll_program_print_version_ #ifdef __cplusplus diff --git a/level_3/byte_dump/c/byte_dump.c b/level_3/byte_dump/c/byte_dump.c index 192bd17..7597a28 100644 --- a/level_3/byte_dump/c/byte_dump.c +++ b/level_3/byte_dump/c/byte_dump.c @@ -31,7 +31,7 @@ extern "C" { const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e }; - status = fll_program_parameter_process_context(choices, modes, F_true, main); + status = fll_program_parameter_process_context(choices, modes, F_true, &main->program); if (F_status_is_error(status)) { fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e); @@ -52,7 +52,7 @@ extern "C" { const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e }; - status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); + status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, &main->program); if (F_status_is_error(status)) { fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e); @@ -157,13 +157,13 @@ extern "C" { } if (main->parameters.array[byte_dump_parameter_version_e].result & f_console_result_found_e) { - fll_program_print_version(main->message, byte_dump_program_version_s); + fll_program_print_version(&main->message, byte_dump_program_version_s); return F_none; } if (main->parameters.array[byte_dump_parameter_copyright_e].result & f_console_result_found_e) { - fll_program_print_copyright(main->message); + fll_program_print_copyright(&main->message); return F_none; } diff --git a/level_3/byte_dump/c/common.c b/level_3/byte_dump/c/common.c index e99fff7..196467a 100644 --- a/level_3/byte_dump/c/common.c +++ b/level_3/byte_dump/c/common.c @@ -124,7 +124,7 @@ extern "C" { const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e }; - setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, main); + setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, &main->program); if (F_status_is_error(setting->state.status)) { fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e); @@ -145,7 +145,7 @@ extern "C" { const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e }; - setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); + setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, &main->program); if (F_status_is_error(setting->state.status)) { fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e); diff --git a/level_3/byte_dump/c/main.c b/level_3/byte_dump/c/main.c index d32ca7f..07f5c70 100644 --- a/level_3/byte_dump/c/main.c +++ b/level_3/byte_dump/c/main.c @@ -2,8 +2,17 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { - fll_program_data_t data = fll_program_data_t_initialize; - byte_dump_setting_t setting = byte_dump_setting_t_initialize; + byte_dump_main_t data = byte_dump_main_t_initialize; + + data.program.debug.flag |= byte_dump_print_flag_debug_e; + data.program.error.flag |= byte_dump_print_flag_error_e; + data.program.message.flag |= byte_dump_print_flag_message_e; + data.program.warning.flag |= byte_dump_print_flag_warning_e; + data.program.message.custom = (void *) &data; + data.program.output.custom = (void *) &data; + data.program.error.custom = (void *) &data; + data.program.warning.custom = (void *) &data; + data.program.debug.custom = (void *) &data; f_console_parameter_t parameters[] = byte_dump_console_parameter_t_initialize; data.parameters.array = parameters; diff --git a/level_3/control/c/common.c b/level_3/control/c/common.c index 6307cc2..75c690c 100644 --- a/level_3/control/c/common.c +++ b/level_3/control/c/common.c @@ -227,7 +227,7 @@ extern "C" { const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e }; - setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, main); + setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, &main->program); if (F_status_is_error(setting->state.status)) { fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e); @@ -248,7 +248,7 @@ extern "C" { const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e }; - setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); + setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, &main->program); if (F_status_is_error(setting->state.status)) { fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e); diff --git a/level_3/control/c/control.c b/level_3/control/c/control.c index ea2ad27..b8d8e4d 100644 --- a/level_3/control/c/control.c +++ b/level_3/control/c/control.c @@ -32,7 +32,7 @@ extern "C" { const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e }; - status = fll_program_parameter_process_context(choices, modes, F_true, main); + status = fll_program_parameter_process_context(choices, modes, F_true, &main->program); if (F_status_is_error(status)) { fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e); @@ -53,7 +53,7 @@ extern "C" { const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e }; - status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); + status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, &main->program); if (F_status_is_error(status)) { fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e); @@ -74,13 +74,13 @@ extern "C" { } if (main->parameters.array[control_parameter_version_e].result & f_console_result_found_e) { - fll_program_print_version(main->message, control_program_version_s); + fll_program_print_version(&main->message, control_program_version_s); return F_none; } if (main->parameters.array[control_parameter_copyright_e].result & f_console_result_found_e) { - fll_program_print_copyright(main->message); + fll_program_print_copyright(&main->message); return F_none; } diff --git a/level_3/control/c/main.c b/level_3/control/c/main.c index 910a490..b02424e 100644 --- a/level_3/control/c/main.c +++ b/level_3/control/c/main.c @@ -2,8 +2,17 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { - fll_program_data_t data = fll_program_data_t_initialize; - control_setting_t setting = control_setting_t_initialize; + control_main_t data = control_main_t_initialize; + + data.program.debug.flag |= control_print_flag_debug_e; + data.program.error.flag |= control_print_flag_error_e; + data.program.message.flag |= control_print_flag_message_e; + data.program.warning.flag |= control_print_flag_warning_e; + data.program.message.custom = (void *) &data; + data.program.output.custom = (void *) &data; + data.program.error.custom = (void *) &data; + data.program.warning.custom = (void *) &data; + data.program.debug.custom = (void *) &data; f_console_parameter_t parameters[] = control_console_parameter_t_initialize; data.parameters.array = parameters; diff --git a/level_3/controller/c/common.c b/level_3/controller/c/common.c index 68d98f1..3fc06c3 100644 --- a/level_3/controller/c/common.c +++ b/level_3/controller/c/common.c @@ -659,7 +659,7 @@ extern "C" { const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e }; - setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, main); + setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, &main->program); if (F_status_is_error(setting->state.status)) { fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e); @@ -680,7 +680,7 @@ extern "C" { const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e }; - setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); + setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, &main->program); if (F_status_is_error(setting->state.status)) { fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e); diff --git a/level_3/controller/c/controller.c b/level_3/controller/c/controller.c index 6e78908..85f2fd3 100644 --- a/level_3/controller/c/controller.c +++ b/level_3/controller/c/controller.c @@ -37,7 +37,7 @@ extern "C" { const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e }; - status = fll_program_parameter_process_context(choices, modes, F_true, main); + status = fll_program_parameter_process_context(choices, modes, F_true, &main->program); if (F_status_is_error(status)) { fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e); @@ -58,7 +58,7 @@ extern "C" { const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e }; - status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); + status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, &main->program); if (F_status_is_error(status)) { fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e); diff --git a/level_3/controller/c/controller/private-controller_print.c b/level_3/controller/c/controller/private-controller_print.c index 910266d..4d607ef 100644 --- a/level_3/controller/c/controller/private-controller_print.c +++ b/level_3/controller/c/controller/private-controller_print.c @@ -18,7 +18,7 @@ extern "C" { f_thread_mutex_lock(&thread->lock.print); } - fll_error_print(*print, status, function, flag); + fll_error_print(print, status, function, flag); if (thread) { f_thread_mutex_unlock(&thread->lock.print); diff --git a/level_3/controller/c/main.c b/level_3/controller/c/main.c index 9a81235..73c0ec7 100644 --- a/level_3/controller/c/main.c +++ b/level_3/controller/c/main.c @@ -3,8 +3,17 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { - fll_program_data_t data = fll_program_data_t_initialize; - controller_setting_t setting = controller_setting_t_initialize; + controller_main_t data = controller_main_t_initialize; + + data.program.debug.flag |= controller_print_flag_debug_e; + data.program.error.flag |= controller_print_flag_error_e; + data.program.message.flag |= controller_print_flag_message_e; + data.program.warning.flag |= controller_print_flag_warning_e; + data.program.message.custom = (void *) &data; + data.program.output.custom = (void *) &data; + data.program.error.custom = (void *) &data; + data.program.warning.custom = (void *) &data; + data.program.debug.custom = (void *) &data; f_console_parameter_t parameters[] = controller_console_parameter_t_initialize; data.parameters.array = parameters; diff --git a/level_3/fake/c/main/build.c b/level_3/fake/c/main/build.c index 41ac76d..3a912e8 100644 --- a/level_3/fake/c/main/build.c +++ b/level_3/fake/c/main/build.c @@ -164,7 +164,7 @@ extern "C" { if (!((++data->main->program.signal_check) % fake_signal_check_d)) { if (fll_program_standard_signal_received(&data->main->program)) { - fll_program_print_signal_received(data->main->program.warning, data->main->program.signal_received); + fll_program_print_signal_received(&data->main->program.warning, data->main->program.signal_received); data->main->setting.state.status = F_status_set_error(F_interrupt); @@ -203,7 +203,7 @@ extern "C" { if (!((++data->main->program.signal_check) % fake_signal_check_short_d)) { if (fll_program_standard_signal_received(&data->main->program)) { - fll_program_print_signal_received(data->main->program.warning, data->main->program.signal_received); + fll_program_print_signal_received(&data->main->program.warning, data->main->program.signal_received); data->main->setting.state.status = F_status_set_error(F_interrupt); @@ -528,7 +528,7 @@ extern "C" { f_string_dynamics_resize(0, &arguments); if (!((++data->main->program.signal_check) % fake_signal_check_d) && fll_program_standard_signal_received(&data->main->program)) { - fll_program_print_signal_received(data->main->program.warning, data->main->program.signal_received); + fll_program_print_signal_received(&data->main->program.warning, data->main->program.signal_received); data->main->setting.state.status = F_status_set_error(F_interrupt); } @@ -629,7 +629,7 @@ extern "C" { if (!((++data->main->program.signal_check) % fake_signal_check_d)) { if (fll_program_standard_signal_received(&data->main->program)) { - fll_program_print_signal_received(data->main->program.warning, data->main->program.signal_received); + fll_program_print_signal_received(&data->main->program.warning, data->main->program.signal_received); data->main->setting.state.status = F_status_set_error(F_interrupt); @@ -920,7 +920,7 @@ extern "C" { if (!((++data->main->program.signal_check) % fake_signal_check_d)) { if (fll_program_standard_signal_received(&data->main->program)) { - fll_program_print_signal_received(data->main->program.warning, data->main->program.signal_received); + fll_program_print_signal_received(&data->main->program.warning, data->main->program.signal_received); data->main->setting.state.status = F_status_set_error(F_interrupt); diff --git a/level_3/fake/c/main/build/load.c b/level_3/fake/c/main/build/load.c index 809c218..e4b9f02 100644 --- a/level_3/fake/c/main/build/load.c +++ b/level_3/fake/c/main/build/load.c @@ -67,7 +67,7 @@ extern "C" { if (!((++data->main->program.signal_check) % fake_signal_check_d)) { if (fll_program_standard_signal_received(&data->main->program)) { - fll_program_print_signal_received(data->main->program.warning, data->main->program.signal_received); + fll_program_print_signal_received(&data->main->program.warning, data->main->program.signal_received); data->main->setting.state.status = F_status_set_error(F_interrupt); @@ -210,7 +210,7 @@ extern "C" { if (!((++data->main->program.signal_check) % fake_signal_check_d)) { if (fll_program_standard_signal_received(&data->main->program)) { - fll_program_print_signal_received(data->main->program.warning, data->main->program.signal_received); + fll_program_print_signal_received(&data->main->program.warning, data->main->program.signal_received); data->main->setting.state.status = F_status_set_error(F_interrupt); @@ -1330,7 +1330,7 @@ extern "C" { if (!((++data->main->program.signal_check) % fake_signal_check_d)) { if (fll_program_standard_signal_received(&data->main->program)) { - fll_program_print_signal_received(data->main->program.warning, data->main->program.signal_received); + fll_program_print_signal_received(&data->main->program.warning, data->main->program.signal_received); data->main->setting.state.status = F_status_set_error(F_interrupt); diff --git a/level_3/fake/c/main/build/skeleton.c b/level_3/fake/c/main/build/skeleton.c index 2cf47c5..8844d42 100644 --- a/level_3/fake/c/main/build/skeleton.c +++ b/level_3/fake/c/main/build/skeleton.c @@ -66,7 +66,7 @@ extern "C" { if (!((++data->main->program.signal_check) % fake_signal_check_d)) { if (fll_program_standard_signal_received(&data->main->program)) { - fll_program_print_signal_received(data->main->program.warning, data->main->program.signal_received); + fll_program_print_signal_received(&data->main->program.warning, data->main->program.signal_received); data->main->setting.state.status = F_status_set_error(F_interrupt); diff --git a/level_3/fake/c/main/common.c b/level_3/fake/c/main/common.c index a2bdff1..dbb3de7 100644 --- a/level_3/fake/c/main/common.c +++ b/level_3/fake/c/main/common.c @@ -242,7 +242,7 @@ extern "C" { } if (main->program.error.verbosity > f_console_verbosity_quiet_e) { - fll_program_print_error_parameter_missing_value(main->program.error, f_console_symbol_long_normal_s, names[i]); + fll_program_print_error_parameter_missing_value(&main->program.error, f_console_symbol_long_normal_s, names[i]); } return; @@ -265,7 +265,7 @@ extern "C" { } if (fake_print_error_fallback(&main->program.error, macro_fake_f(f_utf_is_word_dash_plus)) == F_false) { - fll_program_print_error_parameter_process(main->program.error, f_console_symbol_long_normal_s, names[i]); + fll_program_print_error_parameter_process(&main->program.error, f_console_symbol_long_normal_s, names[i]); } return; @@ -295,7 +295,7 @@ extern "C" { if (main->program.error.verbosity > f_console_verbosity_quiet_e) { if (fake_print_error_fallback(&main->program.error, macro_fake_f(f_path_directory_cleanup)) == F_false) { - fll_program_print_error_parameter_process(main->program.error, f_console_symbol_long_normal_s, names[i]); + fll_program_print_error_parameter_process(&main->program.error, f_console_symbol_long_normal_s, names[i]); } } @@ -391,7 +391,7 @@ extern "C" { fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); } - fll_program_print_error_parameter_missing_value(main->program.error, f_console_symbol_long_normal_s, names[i]); + fll_program_print_error_parameter_missing_value(&main->program.error, f_console_symbol_long_normal_s, names[i]); } return; @@ -407,7 +407,7 @@ extern "C" { if (main->program.error.verbosity > f_console_verbosity_quiet_e) { if (fake_print_error_fallback(&main->program.error, macro_fake_f(fll_program_parameter_additional_rip)) == F_false) { - fll_program_print_error_parameter_process(main->program.error, f_console_symbol_long_normal_s, names[i]); + fll_program_print_error_parameter_process(&main->program.error, f_console_symbol_long_normal_s, names[i]); } } @@ -428,7 +428,7 @@ extern "C" { // @todo fix this to print an error about the actual invalid character so that it can be investigated. if (fake_print_error_fallback(&main->program.error, macro_fake_f(f_utf_is_word_dash_plus)) == F_false) { - fll_program_print_error_parameter_process(main->program.error, f_console_symbol_long_normal_s, names[i]); + fll_program_print_error_parameter_process(&main->program.error, f_console_symbol_long_normal_s, names[i]); } return; diff --git a/level_3/fake/c/main/common/define.h b/level_3/fake/c/main/common/define.h index b08594e..28d1100 100644 --- a/level_3/fake/c/main/common/define.h +++ b/level_3/fake/c/main/common/define.h @@ -5,7 +5,7 @@ * API Version: 0.7 * Licenses: lgpl-2.1-or-later * - * Provides common define functionality. + * Provides common define types. * * This is auto-included and should not need to be explicitly included. */ diff --git a/level_3/fake/c/main/common/enumeration.h b/level_3/fake/c/main/common/enumeration.h index 7ff6c99..a4e690f 100644 --- a/level_3/fake/c/main/common/enumeration.h +++ b/level_3/fake/c/main/common/enumeration.h @@ -5,7 +5,7 @@ * API Version: 0.7 * Licenses: lgpl-2.1-or-later * - * Provides common enumeration functionality. + * Provides common enumeration types. * * This is auto-included and should not need to be explicitly included. */ diff --git a/level_3/fake/c/main/common/type.h b/level_3/fake/c/main/common/type.h index b2a503e..30e8e26 100644 --- a/level_3/fake/c/main/common/type.h +++ b/level_3/fake/c/main/common/type.h @@ -5,7 +5,7 @@ * API Version: 0.7 * Licenses: lgpl-2.1-or-later * - * Provides common type functionality. + * Provides common type structures. * * This is auto-included and should not need to be explicitly included. */ diff --git a/level_3/fake/c/main/fake.c b/level_3/fake/c/main/fake.c index c0503d3..5749053 100644 --- a/level_3/fake/c/main/fake.c +++ b/level_3/fake/c/main/fake.c @@ -23,28 +23,17 @@ extern "C" { main->setting.state.status = F_none; - if (main->setting.flag & fake_main_flag_help_e) { - fake_print_message_help(&main->program.message); + if (main->setting.flag & (fake_main_flag_help_e | fake_main_flag_version_e | fake_main_flag_copyright_e)) { - if ((main->setting.flag & fake_main_flag_print_last_e) && main->program.message.verbosity > f_console_verbosity_error_e) { - fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); + if (main->setting.flag & fake_main_flag_help_e) { + fake_print_message_help(&main->program.message); } - - return; - } - - if (main->setting.flag & fake_main_flag_version_e) { - fll_program_print_version(main->program.message, fake_program_version_s); - - if ((main->setting.flag & fake_main_flag_print_last_e) && main->program.message.verbosity > f_console_verbosity_error_e) { - fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); + else if (main->setting.flag & fake_main_flag_version_e) { + fll_program_print_version(&main->program.message, fake_program_version_s); + } + else if (main->setting.flag & fake_main_flag_copyright_e) { + fll_program_print_copyright(&main->program.message); } - - return; - } - - if (main->setting.flag & fake_main_flag_copyright_e) { - fll_program_print_copyright(main->program.message); if ((main->setting.flag & fake_main_flag_print_last_e) && main->program.message.verbosity > f_console_verbosity_error_e) { fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); @@ -147,7 +136,7 @@ extern "C" { if (!((++main->program.signal_check) % fake_signal_check_short_d)) { if (fll_program_standard_signal_received(&main->program)) { - fll_program_print_signal_received(main->program.warning, main->program.signal_received); + fll_program_print_signal_received(&main->program.warning, main->program.signal_received); main->setting.state.status = F_status_set_error(F_interrupt); @@ -220,7 +209,7 @@ extern "C" { if (!((++main->program.signal_check) % fake_signal_check_short_d)) { if (fll_program_standard_signal_received(&main->program)) { - fll_program_print_signal_received(main->program.warning, main->program.signal_received); + fll_program_print_signal_received(&main->program.warning, main->program.signal_received); main->setting.state.status = F_status_set_error(F_interrupt); @@ -298,7 +287,7 @@ extern "C" { if (!((++data->main->program.signal_check) % fake_signal_check_d)) { if (fll_program_standard_signal_received(&data->main->program)) { - fll_program_print_signal_received(data->main->program.warning, data->main->program.signal_received); + fll_program_print_signal_received(&data->main->program.warning, data->main->program.signal_received); data->main->setting.state.status = F_status_set_error(F_interrupt); @@ -335,7 +324,7 @@ extern "C" { if (!((++data->main->program.signal_check) % fake_signal_check_d)) { if (fll_program_standard_signal_received(&data->main->program)) { - fll_program_print_signal_received(data->main->program.warning, data->main->program.signal_received); + fll_program_print_signal_received(&data->main->program.warning, data->main->program.signal_received); data->main->setting.state.status = F_status_set_error(F_interrupt); @@ -438,7 +427,7 @@ extern "C" { do { if (!((++data->main->program.signal_check) % fake_signal_check_d)) { if (fll_program_standard_signal_received(&data->main->program)) { - fll_program_print_signal_received(data->main->program.warning, data->main->program.signal_received); + fll_program_print_signal_received(&data->main->program.warning, data->main->program.signal_received); data->main->setting.state.status = F_status_set_error(F_interrupt); @@ -466,7 +455,7 @@ extern "C" { if (!((++data->main->program.signal_check) % fake_signal_check_d)) { if (fll_program_standard_signal_received(&data->main->program)) { - fll_program_print_signal_received(data->main->program.warning, data->main->program.signal_received); + fll_program_print_signal_received(&data->main->program.warning, data->main->program.signal_received); data->main->setting.state.status = F_status_set_error(F_interrupt); diff --git a/level_3/fake/c/main/make/load_fakefile.c b/level_3/fake/c/main/make/load_fakefile.c index 1f0f1bd..0738dd5 100644 --- a/level_3/fake/c/main/make/load_fakefile.c +++ b/level_3/fake/c/main/make/load_fakefile.c @@ -11,7 +11,7 @@ extern "C" { if (F_status_is_error(data_make->main->setting.state.status)) return; if (fll_program_standard_signal_received(&data_make->main->program)) { - fll_program_print_signal_received(data_make->main->program.warning, data_make->main->program.signal_received); + fll_program_print_signal_received(&data_make->main->program.warning, data_make->main->program.signal_received); data_make->main->setting.state.status = F_status_set_error(F_interrupt); @@ -105,7 +105,7 @@ extern "C" { if (!(i % fake_signal_check_short_d)) { if (fll_program_standard_signal_received(&data_make->main->program)) { - fll_program_print_signal_received(data_make->main->program.warning, data_make->main->program.signal_received); + fll_program_print_signal_received(&data_make->main->program.warning, data_make->main->program.signal_received); data_make->main->setting.state.status = F_status_set_error(F_interrupt); diff --git a/level_3/fake/c/main/make/operate.c b/level_3/fake/c/main/make/operate.c index a3f9fa1..b68446c 100644 --- a/level_3/fake/c/main/make/operate.c +++ b/level_3/fake/c/main/make/operate.c @@ -11,7 +11,7 @@ extern "C" { if (!((++data->main->program.signal_check) % fake_signal_check_d)) { if (fll_program_standard_signal_received(&data->main->program)) { - fll_program_print_signal_received(data->main->program.warning, data->main->program.signal_received); + fll_program_print_signal_received(&data->main->program.warning, data->main->program.signal_received); data->main->setting.state.status = F_status_set_error(F_interrupt); @@ -1360,7 +1360,7 @@ extern "C" { if (!((++data_make->main->program.signal_check) % fake_signal_check_short_d)) { if (fll_program_standard_signal_received(&data_make->main->program)) { - fll_program_print_signal_received(data_make->main->program.warning, data_make->main->program.signal_received); + fll_program_print_signal_received(&data_make->main->program.warning, data_make->main->program.signal_received); data_make->main->setting.state.status = F_status_set_error(F_interrupt); diff --git a/level_3/fake/c/main/make/operate_process.c b/level_3/fake/c/main/make/operate_process.c index 5afc87b..1cd8f8f 100644 --- a/level_3/fake/c/main/make/operate_process.c +++ b/level_3/fake/c/main/make/operate_process.c @@ -287,7 +287,7 @@ extern "C" { } if (fll_program_standard_signal_received(&data_make->main->program)) { - fll_program_print_signal_received(data_make->main->program.warning, data_make->main->program.signal_received); + fll_program_print_signal_received(&data_make->main->program.warning, data_make->main->program.signal_received); data_make->main->setting.state.status = F_status_set_error(F_interrupt); @@ -336,7 +336,7 @@ extern "C" { data_make->main->setting.state.status = fll_execute_program(program, arguments, ¶meter, 0, (void *) &return_code); if (fll_program_standard_signal_received(&data_make->main->program)) { - fll_program_print_signal_received(data_make->main->program.warning, data_make->main->program.signal_received); + fll_program_print_signal_received(&data_make->main->program.warning, data_make->main->program.signal_received); data_make->main->setting.state.status = F_status_set_error(F_interrupt); @@ -407,7 +407,7 @@ extern "C" { } if (F_status_is_error(data_make->main->setting.state.status)) { - fll_error_print(data_make->error, F_status_set_fine(data_make->main->setting.state.status), macro_fake_f(f_string_dynamic_append), F_true); + fll_error_print(&data_make->error, F_status_set_fine(data_make->main->setting.state.status), macro_fake_f(f_string_dynamic_append), F_true); } else { data_make->main->setting.state.status = F_none; diff --git a/level_3/fake/c/main/print/error.c b/level_3/fake/c/main/print/error.c index a3d232d..8f4363a 100644 --- a/level_3/fake/c/main/print/error.c +++ b/level_3/fake/c/main/print/error.c @@ -12,7 +12,7 @@ extern "C" { fake_main_t * const main = (fake_main_t *) print->custom; - fll_error_print(*print, F_status_set_fine(main->setting.state.status), function, fll_error_file_flag_fallback_e); + fll_error_print(print, F_status_set_fine(main->setting.state.status), function, fll_error_file_flag_fallback_e); return F_none; } @@ -159,7 +159,7 @@ extern "C" { return F_false; } - if (fll_error_print(*print, F_status_set_fine(main->setting.state.status), function, fll_error_file_flag_none_e) == F_known_not && fallback && print->verbosity > f_console_verbosity_quiet_e) { + if (fll_error_print(print, F_status_set_fine(main->setting.state.status), function, fll_error_file_flag_none_e) == F_known_not && fallback && print->verbosity > f_console_verbosity_quiet_e) { f_file_stream_lock(print->to); fl_print_format("%[UNKNOWN %Q(%]", print->to, print->context, print->prefix, print->context); @@ -294,7 +294,7 @@ extern "C" { fake_main_t * const main = (fake_main_t *) print->custom; - if (fll_error_print(*print, F_status_set_fine(main->setting.state.status), function, fll_error_file_flag_none_e) == F_known_not) return F_false; + if (fll_error_print(print, F_status_set_fine(main->setting.state.status), function, fll_error_file_flag_none_e) == F_known_not) return F_false; return F_true; } @@ -308,7 +308,7 @@ extern "C" { fake_main_t * const main = (fake_main_t *) print->custom; - fll_error_file_print(*print, F_status_set_fine(main->setting.state.status), function, fll_error_file_flag_fallback_e, name, operation, type); + fll_error_file_print(print, F_status_set_fine(main->setting.state.status), function, fll_error_file_flag_fallback_e, name, operation, type); return F_none; } @@ -334,7 +334,7 @@ extern "C" { fake_main_t * const main = (fake_main_t *) print->custom; - fll_error_file_print(*print, F_status_set_fine(main->setting.state.status), function, fll_error_file_flag_simple_e, name, operation, type); + fll_error_file_print(print, F_status_set_fine(main->setting.state.status), function, fll_error_file_flag_simple_e, name, operation, type); return F_none; } @@ -380,7 +380,7 @@ extern "C" { return F_false; } - if (fll_error_print(*print, main->setting.state.status, function, fll_error_file_flag_none_e) == F_known_not && fallback) { + if (fll_error_print(print, main->setting.state.status, function, fll_error_file_flag_none_e) == F_known_not && fallback) { if (print->verbosity > f_console_verbosity_quiet_e) { f_string_static_t function_s = f_string_static_t_initialize; function_s.string = function; diff --git a/level_3/fake/c/main/print/message.c b/level_3/fake/c/main/print/message.c index 272a87e..19b3e67 100644 --- a/level_3/fake/c/main/print/message.c +++ b/level_3/fake/c/main/print/message.c @@ -89,47 +89,46 @@ extern "C" { f_file_stream_lock(print->to); - fll_program_print_help_header(*print, fake_program_name_long_s, fake_program_version_s); + fll_program_print_help_header(print, fake_program_name_long_s, fake_program_version_s); - fll_program_print_help_option_standard(*print); + fll_program_print_help_option_standard(print); f_print_dynamic_raw(f_string_eol_s, print->to); - fll_program_print_help_option(*print, fake_short_define_s, fake_long_define_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Append an additional define after defines from settings file."); - fll_program_print_help_option(*print, fake_short_fakefile_s, fake_long_fakefile_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "Use this fakefile."); - fll_program_print_help_option(*print, fake_short_mode_s, fake_long_mode_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Use this mode when processing the build settings."); - fll_program_print_help_option(*print, fake_short_process_s, fake_long_process_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Process name for storing build states."); - fll_program_print_help_option(*print, fake_short_settings_s, fake_long_settings_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "Use this settings file."); + fll_program_print_help_option(print, fake_short_define_s, fake_long_define_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Append an additional define after defines from settings file."); + fll_program_print_help_option(print, fake_short_fakefile_s, fake_long_fakefile_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "Use this fakefile."); + fll_program_print_help_option(print, fake_short_mode_s, fake_long_mode_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Use this mode when processing the build settings."); + fll_program_print_help_option(print, fake_short_process_s, fake_long_process_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Process name for storing build states."); + fll_program_print_help_option(print, fake_short_settings_s, fake_long_settings_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "Use this settings file."); f_print_dynamic_raw(f_string_eol_s, print->to); - fll_program_print_help_option(*print, fake_short_build_s, fake_long_build_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Specify a custom build directory."); - fll_program_print_help_option(*print, fake_short_data_s, fake_long_data_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Specify a custom path to the data files."); - fll_program_print_help_option(*print, fake_short_documents_s, fake_long_documents_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "Specify a custom path to the documents files."); - fll_program_print_help_option(*print, fake_short_licenses_s, fake_long_licenses_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Specify a custom path to the licenses files."); - fll_program_print_help_option(*print, fake_short_sources_s, fake_long_sources_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Specify a custom path to the source files."); - fll_program_print_help_option(*print, fake_short_work_s, fake_long_work_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Use includes/libraries/programs from this directory instead of system."); + fll_program_print_help_option(print, fake_short_build_s, fake_long_build_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Specify a custom build directory."); + fll_program_print_help_option(print, fake_short_data_s, fake_long_data_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Specify a custom path to the data files."); + fll_program_print_help_option(print, fake_short_documents_s, fake_long_documents_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "Specify a custom path to the documents files."); + fll_program_print_help_option(print, fake_short_licenses_s, fake_long_licenses_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Specify a custom path to the licenses files."); + fll_program_print_help_option(print, fake_short_sources_s, fake_long_sources_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Specify a custom path to the source files."); + fll_program_print_help_option(print, fake_short_work_s, fake_long_work_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Use includes/libraries/programs from this directory instead of system."); fl_print_format("%r%r %[Special Options:%] ", print->to, f_string_eol_s, f_string_eol_s, print->set->important, print->set->important); - fll_program_print_help_option_long(*print, fake_long_documents_disabled_s, f_console_symbol_long_normal_s, " Forcibly do not build documents files."); - fll_program_print_help_option_long(*print, fake_long_documents_enabled_s, f_console_symbol_long_normal_s, " Forcibly do build documents files."); - fll_program_print_help_option_long(*print, fake_long_shared_disabled_s, f_console_symbol_long_normal_s, "Forcibly do not build shared files."); - fll_program_print_help_option_long(*print, fake_long_shared_enabled_s, f_console_symbol_long_normal_s, " Forcibly do build shared files."); - fll_program_print_help_option_long(*print, fake_long_static_disabled_s, f_console_symbol_long_normal_s, "Forcibly do not build static files."); - fll_program_print_help_option_long(*print, fake_long_static_enabled_s, f_console_symbol_long_normal_s, " Forcibly do build static files."); + fll_program_print_help_option_long(print, fake_long_documents_disabled_s, f_console_symbol_long_normal_s, " Forcibly do not build documents files."); + fll_program_print_help_option_long(print, fake_long_documents_enabled_s, f_console_symbol_long_normal_s, " Forcibly do build documents files."); + fll_program_print_help_option_long(print, fake_long_shared_disabled_s, f_console_symbol_long_normal_s, "Forcibly do not build shared files."); + fll_program_print_help_option_long(print, fake_long_shared_enabled_s, f_console_symbol_long_normal_s, " Forcibly do build shared files."); + fll_program_print_help_option_long(print, fake_long_static_disabled_s, f_console_symbol_long_normal_s, "Forcibly do not build static files."); + fll_program_print_help_option_long(print, fake_long_static_enabled_s, f_console_symbol_long_normal_s, " Forcibly do build static files."); - fl_print_format("%r%r %[Operations:%] ", print->to, f_string_eol_s, f_string_eol_s, print->set->important, print->set->important); + fl_print_format("%r %[Operations:%] ", print->to, f_string_eol_s, print->set->important, print->set->important); - fll_program_print_help_option_other(*print, fake_other_operation_build_s, " Build or compile the code based on build settings file."); - fll_program_print_help_option_other(*print, fake_other_operation_clean_s, " Delete all build files."); - fll_program_print_help_option_other(*print, fake_other_operation_make_s, " Build or compile the code based on fakefile (default)."); - fll_program_print_help_option_other(*print, fake_other_operation_skeleton_s, "Build a skeleton directory structure."); + fll_program_print_help_option_other(print, fake_other_operation_build_s, " Build or compile the code based on build settings file."); + fll_program_print_help_option_other(print, fake_other_operation_clean_s, " Delete all build files."); + fll_program_print_help_option_other(print, fake_other_operation_make_s, " Build or compile the code based on fakefile (default)."); + fll_program_print_help_option_other(print, fake_other_operation_skeleton_s, "Build a skeleton directory structure."); f_print_dynamic_raw(f_string_eol_s, print->to); - f_print_dynamic_raw(f_string_eol_s, print->to); - fll_program_print_help_usage(*print, fake_program_name_s, fake_program_help_parameters_s); + fll_program_print_help_usage(print, fake_program_name_s, fake_program_help_parameters_s); fl_print_format("%r When performing the %[%r%] operation, the", print->to, f_string_eol_s, print->set->notable, fake_other_operation_build_s, print->set->notable); fl_print_format(" %[%r%r%] parameter specifies a name (limited to alpha-numeric, underscore, and dash) to be used in addition to the global.%r", print->to, print->set->notable, f_console_symbol_long_normal_s, fake_long_mode_s, print->set->notable, f_string_eol_s); diff --git a/level_3/firewall/c/common.c b/level_3/firewall/c/common.c index 0fa26dd..ddbab0d 100644 --- a/level_3/firewall/c/common.c +++ b/level_3/firewall/c/common.c @@ -158,7 +158,7 @@ extern "C" { const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e }; - setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, main); + setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, &main->program); if (F_status_is_error(setting->state.status)) { fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e); @@ -179,7 +179,7 @@ extern "C" { const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e }; - setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); + setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, &main->program); if (F_status_is_error(setting->state.status)) { fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e); diff --git a/level_3/firewall/c/firewall.c b/level_3/firewall/c/firewall.c index 3e27513..a3d6be4 100644 --- a/level_3/firewall/c/firewall.c +++ b/level_3/firewall/c/firewall.c @@ -37,7 +37,7 @@ extern "C" { const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e }; - status = fll_program_parameter_process_context(choices, modes, F_true, main); + status = fll_program_parameter_process_context(choices, modes, F_true, &main->program); if (F_status_is_error(status)) { fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e); @@ -58,7 +58,7 @@ extern "C" { const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e }; - status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); + status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, &main->program); if (F_status_is_error(status)) { fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e); @@ -79,13 +79,13 @@ extern "C" { } if (main->parameters.array[firewall_parameter_version_e].result & f_console_result_found_e) { - fll_program_print_version(main->message, firewall_program_version_s); + fll_program_print_version(&main->message, firewall_program_version_s); return F_none; } if (main->parameters.array[firewall_parameter_copyright_e].result & f_console_result_found_e) { - fll_program_print_copyright(main->message); + fll_program_print_copyright(&main->message); return F_none; } diff --git a/level_3/firewall/c/main.c b/level_3/firewall/c/main.c index 09a0c72..03333d0 100644 --- a/level_3/firewall/c/main.c +++ b/level_3/firewall/c/main.c @@ -2,8 +2,17 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { - fll_program_data_t data = fll_program_data_t_initialize; - firewall_setting_t setting = firewall_setting_t_initialize; + firewall_main_t data = firewall_main_t_initialize; + + data.program.debug.flag |= firewall_read_print_flag_debug_e; + data.program.error.flag |= firewall_read_print_flag_error_e; + data.program.message.flag |= firewall_read_print_flag_message_e; + data.program.warning.flag |= firewall_read_print_flag_warning_e; + data.program.message.custom = (void *) &data; + data.program.output.custom = (void *) &data; + data.program.error.custom = (void *) &data; + data.program.warning.custom = (void *) &data; + data.program.debug.custom = (void *) &data; f_console_parameter_t parameters[] = firewall_console_parameter_t_initialize; data.parameters.array = parameters; diff --git a/level_3/fss_basic_list_read/c/common.c b/level_3/fss_basic_list_read/c/common.c index 497a527..83de53b 100644 --- a/level_3/fss_basic_list_read/c/common.c +++ b/level_3/fss_basic_list_read/c/common.c @@ -118,7 +118,7 @@ extern "C" { const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e }; - setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, main); + setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, &main->program); if (F_status_is_error(setting->state.status)) { fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e); @@ -139,7 +139,7 @@ extern "C" { const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e }; - setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); + setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, &main->program); if (F_status_is_error(setting->state.status)) { fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e); diff --git a/level_3/fss_basic_list_read/c/fss_basic_list_read.c b/level_3/fss_basic_list_read/c/fss_basic_list_read.c index 1dee002..6eb506e 100644 --- a/level_3/fss_basic_list_read/c/fss_basic_list_read.c +++ b/level_3/fss_basic_list_read/c/fss_basic_list_read.c @@ -32,7 +32,7 @@ extern "C" { const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e }; - status = fll_program_parameter_process_context(choices, modes, F_true, main); + status = fll_program_parameter_process_context(choices, modes, F_true, &main->program); if (F_status_is_error(status)) { fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e); @@ -53,7 +53,7 @@ extern "C" { const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e }; - status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); + status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, &main->program); if (F_status_is_error(status)) { fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e); @@ -74,13 +74,13 @@ extern "C" { } if (main->parameters.array[fss_basic_list_read_parameter_version_e].result & f_console_result_found_e) { - fll_program_print_version(main->message, fss_basic_list_read_program_version_s); + fll_program_print_version(&main->message, fss_basic_list_read_program_version_s); return F_none; } if (main->parameters.array[fss_basic_list_read_parameter_copyright_e].result & f_console_result_found_e) { - fll_program_print_copyright(main->message); + fll_program_print_copyright(&main->message); return F_none; } @@ -216,7 +216,7 @@ extern "C" { for (f_array_length_t i = 0; i < main->parameters.array[fss_basic_list_read_parameter_delimit_e].values.used; ++i) { if (!((++main->signal_check) % fss_basic_list_read_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { + if (fll_program_standard_signal_received(&main->program)) { fll_program_print_signal_received(main->warning, main->signal_received); status = F_status_set_error(F_interrupt); @@ -413,7 +413,7 @@ extern "C" { for (f_array_length_t i = 0; i < main->parameters.remaining.used; ++i) { if (!((++main->signal_check) % fss_basic_list_read_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { + if (fll_program_standard_signal_received(&main->program)) { fll_program_print_signal_received(main->warning, main->signal_received); status = F_status_set_error(F_interrupt); @@ -480,7 +480,7 @@ extern "C" { for (size_read = 0; size_read < size_file; size_read += size_block) { // The signal check is always performed on each pass. - if (size_file > fss_basic_list_read_block_max && fll_program_standard_signal_received(main)) { + if (size_file > fss_basic_list_read_block_max && fll_program_standard_signal_received(&main->program)) { fll_program_print_signal_received(main->warning, main->signal_received); status = F_status_set_error(F_interrupt); diff --git a/level_3/fss_basic_list_read/c/main.c b/level_3/fss_basic_list_read/c/main.c index f4f6dbc..dbb3c36 100644 --- a/level_3/fss_basic_list_read/c/main.c +++ b/level_3/fss_basic_list_read/c/main.c @@ -2,8 +2,17 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { - fll_program_data_t data = fll_program_data_t_initialize; - fss_basic_list_read_setting_t setting = fss_basic_list_read_setting_t_initialize; + fss_basic_list_read_main_t data = fss_basic_list_read_main_t_initialize; + + data.program.debug.flag |= fss_basic_list_read_print_flag_debug_e; + data.program.error.flag |= fss_basic_list_read_print_flag_error_e; + data.program.message.flag |= fss_basic_list_read_print_flag_message_e; + data.program.warning.flag |= fss_basic_list_read_print_flag_warning_e; + data.program.message.custom = (void *) &data; + data.program.output.custom = (void *) &data; + data.program.error.custom = (void *) &data; + data.program.warning.custom = (void *) &data; + data.program.debug.custom = (void *) &data; f_console_parameter_t parameters[] = fss_basic_list_read_console_parameter_t_initialize; data.parameters.array = parameters; diff --git a/level_3/fss_basic_list_read/c/private-read.c b/level_3/fss_basic_list_read/c/private-read.c index 1c8ef6a..0945035 100644 --- a/level_3/fss_basic_list_read/c/private-read.c +++ b/level_3/fss_basic_list_read/c/private-read.c @@ -87,7 +87,7 @@ extern "C" { for (f_array_length_t i = 0; i < data->depths.used; ++i) { if (!((++main->signal_check) % fss_basic_list_read_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { + if (fll_program_standard_signal_received(&main->program)) { fll_program_print_signal_received(main->warning, main->signal_received); return F_status_set_error(F_interrupt); @@ -175,7 +175,7 @@ extern "C" { for (f_array_length_t j = i + 1; j < data->depths.used; ++j) { if (!((++main->signal_check) % fss_basic_list_read_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { + if (fll_program_standard_signal_received(&main->program)) { fll_program_print_signal_received(main->warning, main->signal_received); return F_status_set_error(F_interrupt); @@ -348,7 +348,7 @@ extern "C" { if (!names[i]) continue; if (!((++main->signal_check) % fss_basic_list_read_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { + if (fll_program_standard_signal_received(&main->program)) { fll_program_print_signal_received(main->warning, main->signal_received); return F_status_set_error(F_interrupt); @@ -396,7 +396,7 @@ extern "C" { if (!names[i]) continue; if (!((++main->signal_check) % fss_basic_list_read_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { + if (fll_program_standard_signal_received(&main->program)) { fll_program_print_signal_received(main->warning, main->signal_received); return F_status_set_error(F_interrupt); @@ -499,7 +499,7 @@ extern "C" { for (i = range.start; i <= range.stop; ++i) { if (!((++main->signal_check) % fss_basic_list_read_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { + if (fll_program_standard_signal_received(&main->program)) { fll_program_print_signal_received(main->warning, main->signal_received); return F_status_set_error(F_interrupt); @@ -582,7 +582,7 @@ extern "C" { if (!names[i]) continue; if (!((++main->signal_check) % fss_basic_list_read_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { + if (fll_program_standard_signal_received(&main->program)) { fll_program_print_signal_received(main->warning, main->signal_received); return F_status_set_error(F_interrupt); @@ -622,7 +622,7 @@ extern "C" { if (!names[i]) continue; if (!((++main->signal_check) % fss_basic_list_read_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { + if (fll_program_standard_signal_received(&main->program)) { fll_program_print_signal_received(main->warning, main->signal_received); return F_status_set_error(F_interrupt); @@ -739,7 +739,7 @@ extern "C" { if (!names[at]) continue; if (!((++main->signal_check) % fss_basic_list_read_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { + if (fll_program_standard_signal_received(&main->program)) { fll_program_print_signal_received(main->warning, main->signal_received); return F_status_set_error(F_interrupt); diff --git a/level_3/fss_basic_read/c/common.c b/level_3/fss_basic_read/c/common.c index 6cf2de5..d7c1845 100644 --- a/level_3/fss_basic_read/c/common.c +++ b/level_3/fss_basic_read/c/common.c @@ -117,7 +117,7 @@ extern "C" { const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e }; - setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, main); + setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, &main->program); if (F_status_is_error(setting->state.status)) { fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e); @@ -138,7 +138,7 @@ extern "C" { const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e }; - setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); + setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, &main->program); if (F_status_is_error(setting->state.status)) { fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e); diff --git a/level_3/fss_basic_read/c/fss_basic_read.c b/level_3/fss_basic_read/c/fss_basic_read.c index d4c7dbe..afc1f47 100644 --- a/level_3/fss_basic_read/c/fss_basic_read.c +++ b/level_3/fss_basic_read/c/fss_basic_read.c @@ -32,7 +32,7 @@ extern "C" { const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e }; - status = fll_program_parameter_process_context(choices, modes, F_true, main); + status = fll_program_parameter_process_context(choices, modes, F_true, &main->program); if (F_status_is_error(status)) { fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e); @@ -53,7 +53,7 @@ extern "C" { const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e }; - status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); + status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, &main->program); if (F_status_is_error(status)) { fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e); @@ -216,7 +216,7 @@ extern "C" { for (f_array_length_t i = 0; i < main->parameters.array[fss_basic_read_parameter_delimit_e].values.used; ++i) { if (!((++main->signal_check) % fss_basic_read_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { + if (fll_program_standard_signal_received(&main->program)) { fll_program_print_signal_received(main->warning, main->signal_received); status = F_status_set_error(F_interrupt); @@ -421,7 +421,7 @@ extern "C" { for (f_array_length_t i = 0; i < main->parameters.remaining.used; ++i) { if (!((++main->signal_check) % fss_basic_read_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { + if (fll_program_standard_signal_received(&main->program)) { fll_program_print_signal_received(main->warning, main->signal_received); status = F_status_set_error(F_signal); @@ -487,7 +487,7 @@ extern "C" { for (size_read = 0; size_read < size_file; size_read += size_block) { // The signal check is always performed on each pass. - if (size_file > fss_basic_read_block_max && fll_program_standard_signal_received(main)) { + if (size_file > fss_basic_read_block_max && fll_program_standard_signal_received(&main->program)) { fll_program_print_signal_received(main->warning, main->signal_received); status = F_status_set_error(F_interrupt); diff --git a/level_3/fss_basic_read/c/main.c b/level_3/fss_basic_read/c/main.c index 33b3e58..b710253 100644 --- a/level_3/fss_basic_read/c/main.c +++ b/level_3/fss_basic_read/c/main.c @@ -2,8 +2,17 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { - fll_program_data_t data = fll_program_data_t_initialize; - fss_basic_read_setting_t setting = fss_basic_read_setting_t_initialize; + fss_basic_read_main_t data = fss_basic_read_main_t_initialize; + + data.program.debug.flag |= fss_basic_read_print_flag_debug_e; + data.program.error.flag |= fss_basic_read_print_flag_error_e; + data.program.message.flag |= fss_basic_read_print_flag_message_e; + data.program.warning.flag |= fss_basic_read_print_flag_warning_e; + data.program.message.custom = (void *) &data; + data.program.output.custom = (void *) &data; + data.program.error.custom = (void *) &data; + data.program.warning.custom = (void *) &data; + data.program.debug.custom = (void *) &data; f_console_parameter_t parameters[] = fss_basic_read_console_parameter_t_initialize; data.parameters.array = parameters; diff --git a/level_3/fss_basic_read/c/private-read.c b/level_3/fss_basic_read/c/private-read.c index 226e44d..f53644e 100644 --- a/level_3/fss_basic_read/c/private-read.c +++ b/level_3/fss_basic_read/c/private-read.c @@ -64,7 +64,7 @@ extern "C" { for (f_array_length_t i = 0; i < data->depths.used; ++i) { if (!((++main->signal_check) % fss_basic_read_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { + if (fll_program_standard_signal_received(&main->program)) { fll_program_print_signal_received(main->warning, main->signal_received); return F_status_set_error(F_interrupt); @@ -152,7 +152,7 @@ extern "C" { for (f_array_length_t j = i + 1; j < data->depths.used; ++j) { if (!((++main->signal_check) % fss_basic_read_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { + if (fll_program_standard_signal_received(&main->program)) { fll_program_print_signal_received(main->warning, main->signal_received); return F_status_set_error(F_interrupt); @@ -373,7 +373,7 @@ extern "C" { if (!names[i]) continue; if (!((++main->signal_check) % fss_basic_read_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { + if (fll_program_standard_signal_received(&main->program)) { fll_program_print_signal_received(main->warning, main->signal_received); return F_status_set_error(F_interrupt); @@ -456,7 +456,7 @@ extern "C" { if (!names[at]) continue; if (!((++main->signal_check) % fss_basic_read_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { + if (fll_program_standard_signal_received(&main->program)) { fll_program_print_signal_received(main->warning, main->signal_received); return F_status_set_error(F_interrupt); @@ -489,7 +489,7 @@ extern "C" { if (!names[i]) continue; if (!((++main->signal_check) % fss_basic_read_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { + if (fll_program_standard_signal_received(&main->program)) { fll_program_print_signal_received(main->warning, main->signal_received); return F_status_set_error(F_interrupt); @@ -640,7 +640,7 @@ extern "C" { if (!names[i]) continue; if (!((++main->signal_check) % fss_basic_read_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { + if (fll_program_standard_signal_received(&main->program)) { fll_program_print_signal_received(main->warning, main->signal_received); return F_status_set_error(F_interrupt); diff --git a/level_3/fss_embedded_list_read/c/common.c b/level_3/fss_embedded_list_read/c/common.c index 011adc6..96c64c7 100644 --- a/level_3/fss_embedded_list_read/c/common.c +++ b/level_3/fss_embedded_list_read/c/common.c @@ -116,7 +116,7 @@ extern "C" { const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e }; - setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, main); + setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, &main->program); if (F_status_is_error(setting->state.status)) { fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e); @@ -137,7 +137,7 @@ extern "C" { const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e }; - setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); + setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, &main->program); if (F_status_is_error(setting->state.status)) { fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e); diff --git a/level_3/fss_embedded_list_read/c/fss_embedded_list_read.c b/level_3/fss_embedded_list_read/c/fss_embedded_list_read.c index 4859cf6..8451edf 100644 --- a/level_3/fss_embedded_list_read/c/fss_embedded_list_read.c +++ b/level_3/fss_embedded_list_read/c/fss_embedded_list_read.c @@ -32,7 +32,7 @@ extern "C" { const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e }; - status = fll_program_parameter_process_context(choices, modes, F_true, main); + status = fll_program_parameter_process_context(choices, modes, F_true, &main->program); if (F_status_is_error(status)) { fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e); @@ -53,7 +53,7 @@ extern "C" { const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e }; - status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); + status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, &main->program); if (F_status_is_error(status)) { fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e); @@ -305,7 +305,7 @@ extern "C" { for (f_array_length_t i = 0; i < main->parameters.remaining.used; ++i) { if (!((++main->signal_check) % fss_embedded_list_read_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { + if (fll_program_standard_signal_received(&main->program)) { fll_program_print_signal_received(main->warning, main->signal_received); status = F_status_set_error(F_interrupt); @@ -380,7 +380,7 @@ extern "C" { for (size_read = 0; size_read < size_file; size_read += size_block) { // The signal check is always performed on each pass. - if (size_file > fss_embedded_list_read_block_max && fll_program_standard_signal_received(main)) { + if (size_file > fss_embedded_list_read_block_max && fll_program_standard_signal_received(&main->program)) { fll_program_print_signal_received(main->warning, main->signal_received); status = F_status_set_error(F_interrupt); diff --git a/level_3/fss_embedded_list_read/c/main.c b/level_3/fss_embedded_list_read/c/main.c index db1288b..9ea6188 100644 --- a/level_3/fss_embedded_list_read/c/main.c +++ b/level_3/fss_embedded_list_read/c/main.c @@ -2,8 +2,17 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { - fll_program_data_t data = fll_program_data_t_initialize; - fss_extended_list_read_setting_t setting = fss_extended_list_read_setting_t_initialize; + fss_embedded_list_read_main_t data = fss_embedded_list_read_main_t_initialize; + + data.program.debug.flag |= fss_embedded_list_read_print_flag_debug_e; + data.program.error.flag |= fss_embedded_list_read_print_flag_error_e; + data.program.message.flag |= fss_embedded_list_read_print_flag_message_e; + data.program.warning.flag |= fss_embedded_list_read_print_flag_warning_e; + data.program.message.custom = (void *) &data; + data.program.output.custom = (void *) &data; + data.program.error.custom = (void *) &data; + data.program.warning.custom = (void *) &data; + data.program.debug.custom = (void *) &data; f_console_parameter_t parameters[] = fss_embedded_list_read_console_parameter_t_initialize; data.parameters.array = parameters; diff --git a/level_3/fss_extended_list_read/c/common.c b/level_3/fss_extended_list_read/c/common.c index 8bdb895..fcec750 100644 --- a/level_3/fss_extended_list_read/c/common.c +++ b/level_3/fss_extended_list_read/c/common.c @@ -124,7 +124,7 @@ extern "C" { const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e }; - setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, main); + setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, &main->program); if (F_status_is_error(setting->state.status)) { fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e); @@ -145,7 +145,7 @@ extern "C" { const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e }; - setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); + setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, &main->program); if (F_status_is_error(setting->state.status)) { fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e); diff --git a/level_3/fss_extended_list_read/c/fss_extended_list_read.c b/level_3/fss_extended_list_read/c/fss_extended_list_read.c index 17cd6f7..b03c7c7 100644 --- a/level_3/fss_extended_list_read/c/fss_extended_list_read.c +++ b/level_3/fss_extended_list_read/c/fss_extended_list_read.c @@ -32,7 +32,7 @@ extern "C" { const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e }; - status = fll_program_parameter_process_context(choices, modes, F_true, main); + status = fll_program_parameter_process_context(choices, modes, F_true, &main->program); if (F_status_is_error(status)) { fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e); @@ -53,7 +53,7 @@ extern "C" { const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e }; - status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); + status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, &main->program); if (F_status_is_error(status)) { fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e); @@ -216,7 +216,7 @@ extern "C" { for (f_array_length_t i = 0; i < main->parameters.array[fss_extended_list_read_parameter_delimit_e].values.used; ++i) { if (!((++main->signal_check) % fss_extended_list_read_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { + if (fll_program_standard_signal_received(&main->program)) { fll_program_print_signal_received(main->warning, main->signal_received); status = F_status_set_error(F_interrupt); @@ -421,7 +421,7 @@ extern "C" { for (f_array_length_t i = 0; i < main->parameters.remaining.used; ++i) { if (!((++main->signal_check) % fss_extended_list_read_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { + if (fll_program_standard_signal_received(&main->program)) { fll_program_print_signal_received(main->warning, main->signal_received); status = F_status_set_error(F_interrupt); @@ -487,7 +487,7 @@ extern "C" { for (size_read = 0; size_read < size_file; size_read += size_block) { // The signal check is always performed on each pass. - if (size_file > fss_extended_list_read_block_max && fll_program_standard_signal_received(main)) { + if (size_file > fss_extended_list_read_block_max && fll_program_standard_signal_received(&main->program)) { fll_program_print_signal_received(main->warning, main->signal_received); status = F_status_set_error(F_interrupt); diff --git a/level_3/fss_extended_list_read/c/main.c b/level_3/fss_extended_list_read/c/main.c index aff8ca9..2772e11 100644 --- a/level_3/fss_extended_list_read/c/main.c +++ b/level_3/fss_extended_list_read/c/main.c @@ -2,8 +2,17 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { - fll_program_data_t data = fll_program_data_t_initialize; - fss_extended_list_read_setting_t setting = fss_extended_list_read_setting_t_initialize; + fss_extended_list_read_main_t data = fss_extended_list_read_main_t_initialize; + + data.program.debug.flag |= fss_extended_list_read_print_flag_debug_e; + data.program.error.flag |= fss_extended_list_read_print_flag_error_e; + data.program.message.flag |= fss_extended_list_read_print_flag_message_e; + data.program.warning.flag |= fss_extended_list_read_print_flag_warning_e; + data.program.message.custom = (void *) &data; + data.program.output.custom = (void *) &data; + data.program.error.custom = (void *) &data; + data.program.warning.custom = (void *) &data; + data.program.debug.custom = (void *) &data; f_console_parameter_t parameters[] = fss_extended_list_read_console_parameter_t_initialize; data.parameters.array = parameters; diff --git a/level_3/fss_extended_list_read/c/private-read.c b/level_3/fss_extended_list_read/c/private-read.c index c724fec..f7b1d34 100644 --- a/level_3/fss_extended_list_read/c/private-read.c +++ b/level_3/fss_extended_list_read/c/private-read.c @@ -87,7 +87,7 @@ extern "C" { for (f_array_length_t i = 0; i < data->depths.used; ++i) { if (!((++main->signal_check) % fss_extended_list_read_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { + if (fll_program_standard_signal_received(&main->program)) { fll_program_print_signal_received(main->warning, main->signal_received); return F_status_set_error(F_interrupt); @@ -175,7 +175,7 @@ extern "C" { for (f_array_length_t j = i + 1; j < data->depths.used; ++j) { if (!((++main->signal_check) % fss_extended_list_read_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { + if (fll_program_standard_signal_received(&main->program)) { fll_program_print_signal_received(main->warning, main->signal_received); return F_status_set_error(F_interrupt); diff --git a/level_3/fss_extended_read/c/common.c b/level_3/fss_extended_read/c/common.c index 3b82d3c..844e7ec 100644 --- a/level_3/fss_extended_read/c/common.c +++ b/level_3/fss_extended_read/c/common.c @@ -117,7 +117,7 @@ extern "C" { const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e }; - setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, main); + setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, &main->program); if (F_status_is_error(setting->state.status)) { fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e); @@ -138,7 +138,7 @@ extern "C" { const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e }; - setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); + setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, &main->program); if (F_status_is_error(setting->state.status)) { fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e); diff --git a/level_3/fss_extended_read/c/fss_extended_read.c b/level_3/fss_extended_read/c/fss_extended_read.c index 6980f66..ab76451 100644 --- a/level_3/fss_extended_read/c/fss_extended_read.c +++ b/level_3/fss_extended_read/c/fss_extended_read.c @@ -32,7 +32,7 @@ extern "C" { const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e }; - status = fll_program_parameter_process_context(choices, modes, F_true, main); + status = fll_program_parameter_process_context(choices, modes, F_true, &main->program); if (F_status_is_error(status)) { fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e); @@ -53,7 +53,7 @@ extern "C" { const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e }; - status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); + status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, &main->program); if (F_status_is_error(status)) { fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e); @@ -215,7 +215,7 @@ extern "C" { for (f_array_length_t i = 0; i < main->parameters.array[fss_extended_read_parameter_delimit_e].values.used; ++i) { if (!((++main->signal_check) % fss_extended_read_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { + if (fll_program_standard_signal_received(&main->program)) { fll_program_print_signal_received(main->warning, main->signal_received); status = F_status_set_error(F_signal); @@ -420,7 +420,7 @@ extern "C" { for (f_array_length_t i = 0; i < main->parameters.remaining.used; ++i) { if (!((++main->signal_check) % fss_extended_read_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { + if (fll_program_standard_signal_received(&main->program)) { fll_program_print_signal_received(main->warning, main->signal_received); status = F_status_set_error(F_signal); @@ -486,7 +486,7 @@ extern "C" { for (size_read = 0; size_read < size_file; size_read += size_block) { // The signal check is always performed on each pass. - if (size_file > fss_extended_read_block_max && fll_program_standard_signal_received(main)) { + if (size_file > fss_extended_read_block_max && fll_program_standard_signal_received(&main->program)) { fll_program_print_signal_received(main->warning, main->signal_received); status = F_status_set_error(F_interrupt); diff --git a/level_3/fss_extended_read/c/main.c b/level_3/fss_extended_read/c/main.c index 5998ee6..64b0324 100644 --- a/level_3/fss_extended_read/c/main.c +++ b/level_3/fss_extended_read/c/main.c @@ -2,8 +2,17 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { - fll_program_data_t data = fll_program_data_t_initialize; - fss_extended_read_setting_t setting = fss_extended_read_setting_t_initialize; + fss_extended_read_main_t data = fss_extended_read_main_t_initialize; + + data.program.debug.flag |= fss_extended_read_print_flag_debug_e; + data.program.error.flag |= fss_extended_read_print_flag_error_e; + data.program.message.flag |= fss_extended_read_print_flag_message_e; + data.program.warning.flag |= fss_extended_read_print_flag_warning_e; + data.program.message.custom = (void *) &data; + data.program.output.custom = (void *) &data; + data.program.error.custom = (void *) &data; + data.program.warning.custom = (void *) &data; + data.program.debug.custom = (void *) &data; f_console_parameter_t parameters[] = fss_extended_read_console_parameter_t_initialize; data.parameters.array = parameters; diff --git a/level_3/fss_extended_read/c/private-read.c b/level_3/fss_extended_read/c/private-read.c index f1e2ed8..84d2c9c 100644 --- a/level_3/fss_extended_read/c/private-read.c +++ b/level_3/fss_extended_read/c/private-read.c @@ -91,7 +91,7 @@ extern "C" { for (f_array_length_t i = 0; i < data->depths.used; ++i) { if (!((++main->signal_check) % fss_extended_read_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { + if (fll_program_standard_signal_received(&main->program)) { fll_program_print_signal_received(main->warning, main->signal_received); return F_status_set_error(F_interrupt); @@ -179,7 +179,7 @@ extern "C" { for (f_array_length_t j = i + 1; j < data->depths.used; ++j) { if (!((++main->signal_check) % fss_extended_read_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { + if (fll_program_standard_signal_received(&main->program)) { fll_program_print_signal_received(main->warning, main->signal_received); return F_status_set_error(F_interrupt); diff --git a/level_3/fss_identify/c/common.c b/level_3/fss_identify/c/common.c index de0f0f5..271f9db 100644 --- a/level_3/fss_identify/c/common.c +++ b/level_3/fss_identify/c/common.c @@ -84,7 +84,7 @@ extern "C" { const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e }; - setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, main); + setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, &main->program); if (F_status_is_error(setting->state.status)) { fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e); @@ -105,7 +105,7 @@ extern "C" { const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e }; - setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); + setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, &main->program); if (F_status_is_error(setting->state.status)) { fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e); diff --git a/level_3/fss_identify/c/fss_identify.c b/level_3/fss_identify/c/fss_identify.c index 3e834d8..6802659 100644 --- a/level_3/fss_identify/c/fss_identify.c +++ b/level_3/fss_identify/c/fss_identify.c @@ -31,7 +31,7 @@ extern "C" { const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e }; - status = fll_program_parameter_process_context(choices, modes, F_true, main); + status = fll_program_parameter_process_context(choices, modes, F_true, &main->program); if (F_status_is_error(status)) { fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e); @@ -52,7 +52,7 @@ extern "C" { const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e }; - status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); + status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, &main->program); if (F_status_is_error(status)) { fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e); @@ -73,13 +73,13 @@ extern "C" { } if (main->parameters.array[fss_identify_parameter_version_e].result & f_console_result_found_e) { - fll_program_print_version(main->message, fss_identify_program_version_s); + fll_program_print_version(&main->message, fss_identify_program_version_s); return F_none; } if (main->parameters.array[fss_identify_parameter_copyright_e].result & f_console_result_found_e) { - fll_program_print_copyright(main->message); + fll_program_print_copyright(&main->message); return F_none; } @@ -116,14 +116,14 @@ extern "C" { if (F_status_is_error_not(status) && (main->parameters.array[fss_identify_parameter_total_e].result & f_console_result_found_e)) { if (main->parameters.array[fss_identify_parameter_object_e].result & f_console_result_found_e) { if (main->error.verbosity > f_console_verbosity_quiet_e) { - fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, fss_identify_long_object_s, fss_identify_long_total_s); + fll_program_print_error_parameter_cannot_use_with(&main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, fss_identify_long_object_s, fss_identify_long_total_s); } status = F_status_set_error(F_parameter); } else if (main->parameters.array[fss_identify_parameter_content_e].result & f_console_result_found_e) { if (main->error.verbosity > f_console_verbosity_quiet_e) { - fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, fss_identify_long_content_s, fss_identify_long_total_s); + fll_program_print_error_parameter_cannot_use_with(&main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, fss_identify_long_content_s, fss_identify_long_total_s); } status = F_status_set_error(F_parameter); @@ -219,8 +219,8 @@ extern "C" { for (f_array_length_t i = 0; i < main->parameters.remaining.used; ++i) { if (!((++main->signal_check) % fss_identify_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, main->signal_received); + if (fll_program_standard_signal_received(&main->program)) { + fll_program_print_signal_received(&main->warning, main->signal_received); status = F_status_set_error(F_interrupt); diff --git a/level_3/fss_identify/c/main.c b/level_3/fss_identify/c/main.c index 5ef29a1..4aba210 100644 --- a/level_3/fss_identify/c/main.c +++ b/level_3/fss_identify/c/main.c @@ -2,8 +2,17 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { - fll_program_data_t data = fll_program_data_t_initialize; - fss_identify_setting_t setting = fss_identify_setting_t_initialize; + fss_identify_main_t data = fss_identify_main_t_initialize; + + data.program.debug.flag |= fss_identify_print_flag_debug_e; + data.program.error.flag |= fss_identify_print_flag_error_e; + data.program.message.flag |= fss_identify_print_flag_message_e; + data.program.warning.flag |= fss_identify_print_flag_warning_e; + data.program.message.custom = (void *) &data; + data.program.output.custom = (void *) &data; + data.program.error.custom = (void *) &data; + data.program.warning.custom = (void *) &data; + data.program.debug.custom = (void *) &data; f_console_parameter_t parameters[] = fss_identify_console_parameter_t_initialize; data.parameters.array = parameters; diff --git a/level_3/fss_identify/c/private-identify.c b/level_3/fss_identify/c/private-identify.c index d800318..6c23d68 100644 --- a/level_3/fss_identify/c/private-identify.c +++ b/level_3/fss_identify/c/private-identify.c @@ -19,7 +19,7 @@ extern "C" { do { if (!((++main->signal_check) % fss_identify_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { + if (fll_program_standard_signal_received(&main->program)) { fll_program_print_signal_received(main->warning, main->signal_received); status = F_status_set_error(F_interrupt); diff --git a/level_3/fss_payload_read/c/common.c b/level_3/fss_payload_read/c/common.c index 830ae6d..15b4d22 100644 --- a/level_3/fss_payload_read/c/common.c +++ b/level_3/fss_payload_read/c/common.c @@ -118,7 +118,7 @@ extern "C" { const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e }; - setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, main); + setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, &main->program); if (F_status_is_error(setting->state.status)) { fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e); @@ -139,7 +139,7 @@ extern "C" { const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e }; - setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); + setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, &main->program); if (F_status_is_error(setting->state.status)) { fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e); diff --git a/level_3/fss_payload_read/c/fss_payload_read.c b/level_3/fss_payload_read/c/fss_payload_read.c index 6c49ad1..4073620 100644 --- a/level_3/fss_payload_read/c/fss_payload_read.c +++ b/level_3/fss_payload_read/c/fss_payload_read.c @@ -32,7 +32,7 @@ extern "C" { const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e }; - status = fll_program_parameter_process_context(choices, modes, F_true, main); + status = fll_program_parameter_process_context(choices, modes, F_true, &main->program); if (F_status_is_error(status)) { fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e); @@ -68,7 +68,7 @@ extern "C" { const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e }; - status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); + status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, &main->program); if (F_status_is_error(status)) { fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e); @@ -231,7 +231,7 @@ extern "C" { for (f_array_length_t i = 0; i < main->parameters.array[fss_payload_read_parameter_delimit_e].values.used; ++i) { if (!((++main->signal_check) % fss_payload_read_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { + if (fll_program_standard_signal_received(&main->program)) { fll_program_print_signal_received(main->warning, main->signal_received); status = F_status_set_error(F_interrupt); @@ -449,7 +449,7 @@ extern "C" { for (f_array_length_t i = 0; i < main->parameters.remaining.used; ++i) { if (!((++main->signal_check) % fss_payload_read_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { + if (fll_program_standard_signal_received(&main->program)) { fll_program_print_signal_received(main->warning, main->signal_received); status = F_status_set_error(F_interrupt); @@ -515,7 +515,7 @@ extern "C" { for (size_read = 0; size_read < size_file; size_read += size_block) { // The signal check is always performed on each pass. - if (size_file > fss_payload_read_block_max && fll_program_standard_signal_received(main)) { + if (size_file > fss_payload_read_block_max && fll_program_standard_signal_received(&main->program)) { fll_program_print_signal_received(main->warning, main->signal_received); status = F_status_set_error(F_interrupt); diff --git a/level_3/fss_payload_read/c/main.c b/level_3/fss_payload_read/c/main.c index 1fa6db4..3fd77e7 100644 --- a/level_3/fss_payload_read/c/main.c +++ b/level_3/fss_payload_read/c/main.c @@ -2,8 +2,17 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { - fll_program_data_t data = fll_program_data_t_initialize; - fss_payload_read_setting_t setting = fss_payload_read_setting_t_initialize; + fss_payload_read_main_t data = fss_payload_read_main_t_initialize; + + data.program.debug.flag |= fss_payload_read_print_flag_debug_e; + data.program.error.flag |= fss_payload_read_print_flag_error_e; + data.program.message.flag |= fss_payload_read_print_flag_message_e; + data.program.warning.flag |= fss_payload_read_print_flag_warning_e; + data.program.message.custom = (void *) &data; + data.program.output.custom = (void *) &data; + data.program.error.custom = (void *) &data; + data.program.warning.custom = (void *) &data; + data.program.debug.custom = (void *) &data; f_console_parameter_t parameters[] = fss_payload_read_console_parameter_t_initialize; data.parameters.array = parameters; diff --git a/level_3/fss_payload_read/c/private-read.c b/level_3/fss_payload_read/c/private-read.c index 4a27c9e..d7d81c6 100644 --- a/level_3/fss_payload_read/c/private-read.c +++ b/level_3/fss_payload_read/c/private-read.c @@ -87,7 +87,7 @@ extern "C" { for (f_array_length_t i = 0; i < data->depths.used; ++i) { if (!((++main->signal_check) % fss_payload_read_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { + if (fll_program_standard_signal_received(&main->program)) { fll_program_print_signal_received(main->warning, main->signal_received); return F_status_set_error(F_interrupt); @@ -175,7 +175,7 @@ extern "C" { for (f_array_length_t j = i + 1; j < data->depths.used; ++j) { if (!((++main->signal_check) % fss_payload_read_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { + if (fll_program_standard_signal_received(&main->program)) { fll_program_print_signal_received(main->warning, main->signal_received); return F_status_set_error(F_interrupt); @@ -437,7 +437,7 @@ extern "C" { if (!names[i]) continue; if (!((++main->signal_check) % fss_payload_read_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { + if (fll_program_standard_signal_received(&main->program)) { fll_program_print_signal_received(main->warning, main->signal_received); return F_status_set_error(F_interrupt); @@ -488,7 +488,7 @@ extern "C" { if (!names[i]) continue; if (!((++main->signal_check) % fss_payload_read_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { + if (fll_program_standard_signal_received(&main->program)) { fll_program_print_signal_received(main->warning, main->signal_received); return F_status_set_error(F_interrupt); @@ -719,7 +719,7 @@ extern "C" { for (i = range.start; i <= range.stop; ++i) { if (!((++main->signal_check) % fss_payload_read_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { + if (fll_program_standard_signal_received(&main->program)) { fll_program_print_signal_received(main->warning, main->signal_received); return F_status_set_error(F_interrupt); @@ -802,7 +802,7 @@ extern "C" { if (!names[at]) continue; if (!((++main->signal_check) % fss_payload_read_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { + if (fll_program_standard_signal_received(&main->program)) { fll_program_print_signal_received(main->warning, main->signal_received); return F_status_set_error(F_interrupt); @@ -872,7 +872,7 @@ extern "C" { if (!names[i]) continue; if (!((++main->signal_check) % fss_payload_read_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { + if (fll_program_standard_signal_received(&main->program)) { fll_program_print_signal_received(main->warning, main->signal_received); return F_status_set_error(F_interrupt); @@ -1077,7 +1077,7 @@ extern "C" { if (!names[at]) continue; if (!((++main->signal_check) % fss_payload_read_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { + if (fll_program_standard_signal_received(&main->program)) { fll_program_print_signal_received(main->warning, main->signal_received); return F_status_set_error(F_interrupt); diff --git a/level_3/fss_write/c/basic/fss_write.h b/level_3/fss_write/c/basic/fss_write.h index baa2cdc..a69eaae 100644 --- a/level_3/fss_write/c/basic/fss_write.h +++ b/level_3/fss_write/c/basic/fss_write.h @@ -43,6 +43,8 @@ #include // FSS Write includes. +#include +#include #include #include #include diff --git a/level_3/fss_write/c/basic/main.c b/level_3/fss_write/c/basic/main.c index 1dbaaac..fe2d361 100644 --- a/level_3/fss_write/c/basic/main.c +++ b/level_3/fss_write/c/basic/main.c @@ -3,8 +3,18 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { - fll_program_data_t data = fll_program_data_t_initialize; - fss_write_setting_t setting = fss_write_setting_t_initialize; + fss_write_main_t data = fss_write_main_t_initialize; + + data.program.debug.flag |= fss_write_print_flag_debug_e; + data.program.error.flag |= fss_write_print_flag_error_e; + data.program.message.flag |= fss_write_print_flag_message_e; + data.program.warning.flag |= fss_write_print_flag_warning_e; + data.program.message.custom = (void *) &data; + data.program.output.custom = (void *) &data; + data.program.error.custom = (void *) &data; + data.program.warning.custom = (void *) &data; + data.program.debug.custom = (void *) &data; + setting.state.custom = (void *) &data; setting.standard = fss_write_basic_standard_s; setting.process_content = &fss_write_basic_process_content; diff --git a/level_3/fss_write/c/basic_list/fss_write.h b/level_3/fss_write/c/basic_list/fss_write.h index 0776a1b..9058c44 100644 --- a/level_3/fss_write/c/basic_list/fss_write.h +++ b/level_3/fss_write/c/basic_list/fss_write.h @@ -44,6 +44,8 @@ #include // FSS Write includes. +#include +#include #include #include #include diff --git a/level_3/fss_write/c/basic_list/main.c b/level_3/fss_write/c/basic_list/main.c index dea594b..256d415 100644 --- a/level_3/fss_write/c/basic_list/main.c +++ b/level_3/fss_write/c/basic_list/main.c @@ -3,8 +3,18 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { - fll_program_data_t data = fll_program_data_t_initialize; - fss_write_setting_t setting = fss_write_setting_t_initialize; + fss_write_main_t data = fss_write_main_t_initialize; + + data.program.debug.flag |= fss_write_print_flag_debug_e; + data.program.error.flag |= fss_write_print_flag_error_e; + data.program.message.flag |= fss_write_print_flag_message_e; + data.program.warning.flag |= fss_write_print_flag_warning_e; + data.program.message.custom = (void *) &data; + data.program.output.custom = (void *) &data; + data.program.error.custom = (void *) &data; + data.program.warning.custom = (void *) &data; + data.program.debug.custom = (void *) &data; + setting.state.custom = (void *) &data; setting.standard = fss_write_basic_list_standard_s; setting.process_content = &fss_write_basic_list_process_content; diff --git a/level_3/fss_write/c/embedded_list/fss_write.h b/level_3/fss_write/c/embedded_list/fss_write.h index aa08fe9..f8ca58c 100644 --- a/level_3/fss_write/c/embedded_list/fss_write.h +++ b/level_3/fss_write/c/embedded_list/fss_write.h @@ -43,6 +43,8 @@ #include // FSS Write includes. +#include +#include #include #include #include diff --git a/level_3/fss_write/c/embedded_list/main.c b/level_3/fss_write/c/embedded_list/main.c index 04181a6..067ac11 100644 --- a/level_3/fss_write/c/embedded_list/main.c +++ b/level_3/fss_write/c/embedded_list/main.c @@ -3,8 +3,18 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { - fll_program_data_t data = fll_program_data_t_initialize; - fss_write_setting_t setting = fss_write_setting_t_initialize; + fss_write_main_t data = fss_write_main_t_initialize; + + data.program.debug.flag |= fss_write_print_flag_debug_e; + data.program.error.flag |= fss_write_print_flag_error_e; + data.program.message.flag |= fss_write_print_flag_message_e; + data.program.warning.flag |= fss_write_print_flag_warning_e; + data.program.message.custom = (void *) &data; + data.program.output.custom = (void *) &data; + data.program.error.custom = (void *) &data; + data.program.warning.custom = (void *) &data; + data.program.debug.custom = (void *) &data; + setting.state.custom = (void *) &data; setting.standard = fss_write_embedded_list_standard_s; setting.process_content = &fss_write_embedded_list_process_content; diff --git a/level_3/fss_write/c/extended/fss_write.h b/level_3/fss_write/c/extended/fss_write.h index a30b6e5..81089ce 100644 --- a/level_3/fss_write/c/extended/fss_write.h +++ b/level_3/fss_write/c/extended/fss_write.h @@ -43,6 +43,8 @@ #include // FSS Write includes. +#include +#include #include #include #include diff --git a/level_3/fss_write/c/extended/main.c b/level_3/fss_write/c/extended/main.c index 22080f3..9255969 100644 --- a/level_3/fss_write/c/extended/main.c +++ b/level_3/fss_write/c/extended/main.c @@ -3,8 +3,18 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { - fll_program_data_t data = fll_program_data_t_initialize; - fss_write_setting_t setting = fss_write_setting_t_initialize; + fss_write_main_t data = fss_write_main_t_initialize; + + data.program.debug.flag |= fss_write_print_flag_debug_e; + data.program.error.flag |= fss_write_print_flag_error_e; + data.program.message.flag |= fss_write_print_flag_message_e; + data.program.warning.flag |= fss_write_print_flag_warning_e; + data.program.message.custom = (void *) &data; + data.program.output.custom = (void *) &data; + data.program.error.custom = (void *) &data; + data.program.warning.custom = (void *) &data; + data.program.debug.custom = (void *) &data; + setting.state.custom = (void *) &data; setting.standard = fss_write_extended_standard_s; setting.process_content = &fss_write_extended_process_content; diff --git a/level_3/fss_write/c/extended_list/fss_write.h b/level_3/fss_write/c/extended_list/fss_write.h index 9974e2e..9dab7c7 100644 --- a/level_3/fss_write/c/extended_list/fss_write.h +++ b/level_3/fss_write/c/extended_list/fss_write.h @@ -43,6 +43,8 @@ #include // FSS Write includes. +#include +#include #include #include #include diff --git a/level_3/fss_write/c/extended_list/main.c b/level_3/fss_write/c/extended_list/main.c index a268d12..620ad72 100644 --- a/level_3/fss_write/c/extended_list/main.c +++ b/level_3/fss_write/c/extended_list/main.c @@ -3,8 +3,18 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { - fll_program_data_t data = fll_program_data_t_initialize; - fss_write_setting_t setting = fss_write_setting_t_initialize; + fss_write_main_t data = fss_write_main_t_initialize; + + data.program.debug.flag |= fss_write_print_flag_debug_e; + data.program.error.flag |= fss_write_print_flag_error_e; + data.program.message.flag |= fss_write_print_flag_message_e; + data.program.warning.flag |= fss_write_print_flag_warning_e; + data.program.message.custom = (void *) &data; + data.program.output.custom = (void *) &data; + data.program.error.custom = (void *) &data; + data.program.warning.custom = (void *) &data; + data.program.debug.custom = (void *) &data; + setting.state.custom = (void *) &data; setting.standard = fss_write_extended_list_standard_s; setting.process_content = &fss_write_extended_list_process_content; diff --git a/level_3/fss_write/c/main/common.c b/level_3/fss_write/c/main/common.c index 9366332..2f52688 100644 --- a/level_3/fss_write/c/main/common.c +++ b/level_3/fss_write/c/main/common.c @@ -69,7 +69,7 @@ extern "C" { const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e }; - setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, main); + setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, &main->program); if (F_status_is_error(setting->state.status)) { if ((setting->flag & fss_write_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { @@ -90,7 +90,7 @@ extern "C" { const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e }; - setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); + setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, &main->program); if (F_status_is_error(setting->state.status)) { if ((setting->flag & fss_write_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { @@ -142,7 +142,7 @@ extern "C" { fll_print_dynamic_raw(f_string_eol_s, main->message.to); } - fll_program_print_error_parameter_must_specify_once(main->error, f_console_symbol_long_normal_s, fss_write_long_file_s); + fll_program_print_error_parameter_must_specify_once(&main->error, f_console_symbol_long_normal_s, fss_write_long_file_s); return; } @@ -173,7 +173,7 @@ extern "C" { fll_print_dynamic_raw(f_string_eol_s, main->message.to); } - fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, fss_write_long_file_s); + fll_program_print_error_parameter_missing_value(&main->error, f_console_symbol_long_normal_s, fss_write_long_file_s); return; } @@ -214,7 +214,7 @@ extern "C" { fll_print_dynamic_raw(f_string_eol_s, main->message.to); } - fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, fss_write_long_object_s); + fll_program_print_error_parameter_missing_value(&main->error, f_console_symbol_long_normal_s, fss_write_long_object_s); return; } @@ -317,7 +317,7 @@ extern "C" { fll_print_dynamic_raw(f_string_eol_s, main->message.to); } - fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, fss_write_long_content_s); + fll_program_print_error_parameter_missing_value(&main->error, f_console_symbol_long_normal_s, fss_write_long_content_s); return; } @@ -372,7 +372,7 @@ extern "C" { fll_print_dynamic_raw(f_string_eol_s, main->message.to); } - fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, fss_write_long_prepend_s); + fll_program_print_error_parameter_missing_value(&main->error, f_console_symbol_long_normal_s, fss_write_long_prepend_s); return; } @@ -385,7 +385,7 @@ extern "C" { fll_print_dynamic_raw(f_string_eol_s, main->message.to); } - fll_program_print_error_parameter_missing_value_requires_amount(main->error, f_console_symbol_long_normal_s, fss_write_long_ignore_s, fss_write_string_two_s); + fll_program_print_error_parameter_missing_value_requires_amount(&main->error, f_console_symbol_long_normal_s, fss_write_long_ignore_s, fss_write_string_two_s); return; } @@ -461,7 +461,7 @@ extern "C" { fll_print_dynamic_raw(f_string_eol_s, main->message.to); } - fll_program_print_error_parameter_integer_not(main->error, f_console_symbol_long_normal_s, fss_write_long_ignore_s, main->parameters.arguments.array[index]); + fll_program_print_error_parameter_integer_not(&main->error, f_console_symbol_long_normal_s, fss_write_long_ignore_s, main->parameters.arguments.array[index]); return; } @@ -475,7 +475,7 @@ extern "C" { fll_print_dynamic_raw(f_string_eol_s, main->message.to); } - fll_program_print_error_parameter_integer_not(main->error, f_console_symbol_long_normal_s, fss_write_long_ignore_s, main->parameters.arguments.array[index]); + fll_program_print_error_parameter_integer_not(&main->error, f_console_symbol_long_normal_s, fss_write_long_ignore_s, main->parameters.arguments.array[index]); return; } @@ -524,7 +524,7 @@ extern "C" { fll_print_dynamic_raw(f_string_eol_s, main->message.to); } - fll_program_print_error_parameter_integer_not(main->error, f_console_symbol_long_normal_s, fss_write_long_ignore_s, main->parameters.arguments.array[index]); + fll_program_print_error_parameter_integer_not(&main->error, f_console_symbol_long_normal_s, fss_write_long_ignore_s, main->parameters.arguments.array[index]); return; } @@ -538,7 +538,7 @@ extern "C" { fll_print_dynamic_raw(f_string_eol_s, main->message.to); } - fll_program_print_error_parameter_integer_not(main->error, f_console_symbol_long_normal_s, fss_write_long_ignore_s, main->parameters.arguments.array[index]); + fll_program_print_error_parameter_integer_not(&main->error, f_console_symbol_long_normal_s, fss_write_long_ignore_s, main->parameters.arguments.array[index]); return; } @@ -570,7 +570,7 @@ extern "C" { fll_print_dynamic_raw(f_string_eol_s, main->message.to); } - fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, fss_write_long_ignore_s); + fll_program_print_error_parameter_missing_value(&main->error, f_console_symbol_long_normal_s, fss_write_long_ignore_s); return; } @@ -651,7 +651,7 @@ extern "C" { fll_print_dynamic_raw(f_string_eol_s, main->message.to); } - fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, has_string[i], has_cannots_string[i][0]); + fll_program_print_error_parameter_cannot_use_with(&main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, has_string[i], has_cannots_string[i][0]); return; } @@ -663,7 +663,7 @@ extern "C" { fll_print_dynamic_raw(f_string_eol_s, main->message.to); } - fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, has_string[i], has_cannots_string[i][1]); + fll_program_print_error_parameter_cannot_use_with(&main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, has_string[i], has_cannots_string[i][1]); return; } @@ -697,7 +697,7 @@ extern "C" { fll_print_dynamic_raw(f_string_eol_s, main->message.to); } - fll_program_print_error_parameter_cannot_use_with_xor(main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, fss_write_long_partial_s, fss_write_long_object_s, fss_write_long_content_s); + fll_program_print_error_parameter_cannot_use_with_xor(&main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, fss_write_long_partial_s, fss_write_long_object_s, fss_write_long_content_s); return; } diff --git a/level_3/fss_write/c/main/common/define.c b/level_3/fss_write/c/main/common/define.c new file mode 100644 index 0000000..e69de29 diff --git a/level_3/fss_write/c/main/common/define.h b/level_3/fss_write/c/main/common/define.h new file mode 100644 index 0000000..e69de29 diff --git a/level_3/fss_write/c/main/common/enumeration.c b/level_3/fss_write/c/main/common/enumeration.c new file mode 100644 index 0000000..e69de29 diff --git a/level_3/fss_write/c/main/common/enumeration.h b/level_3/fss_write/c/main/common/enumeration.h new file mode 100644 index 0000000..e69de29 diff --git a/level_3/fss_write/c/main/fss_write.c b/level_3/fss_write/c/main/fss_write.c index 46342a7..14d2fc8 100644 --- a/level_3/fss_write/c/main/fss_write.c +++ b/level_3/fss_write/c/main/fss_write.c @@ -23,33 +23,20 @@ extern "C" { setting->state.status = F_none; - if (setting->flag & fss_write_main_flag_help_e) { - if (setting->process_help) { - setting->process_help(main, (void *) setting); - } + if (main->setting.flag & (fss_write_main_flag_help_e | fss_write_main_flag_version_e | fss_write_main_flag_copyright_e)) { - if ((setting->flag & fss_write_main_flag_print_last_e) && main->message.verbosity > f_console_verbosity_error_e) { - fll_print_dynamic_raw(f_string_eol_s, main->message.to); + if (main->setting.flag & fss_write_main_flag_help_e) { + fss_write_print_message_help(&main->program.message); } - - return; - } - - if (setting->flag & fss_write_main_flag_version_e) { - fll_program_print_version(main->message, fss_write_program_version_s); - - if ((setting->flag & fss_write_main_flag_print_last_e) && main->message.verbosity > f_console_verbosity_error_e) { - fll_print_dynamic_raw(f_string_eol_s, main->message.to); + else if (main->setting.flag & fss_write_main_flag_version_e) { + fll_program_print_version(&main->program.message, fss_write_program_version_s); + } + else if (main->setting.flag & fss_write_main_flag_copyright_e) { + fll_program_print_copyright(&main->program.message); } - return; - } - - if (setting->flag & fss_write_main_flag_copyright_e) { - fll_program_print_copyright(main->message); - - if ((setting->flag & fss_write_main_flag_print_last_e) && main->message.verbosity > f_console_verbosity_error_e) { - fll_print_dynamic_raw(f_string_eol_s, main->message.to); + if ((main->setting.flag & fss_write_main_flag_print_last_e) && main->program.message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); } return; @@ -107,7 +94,7 @@ extern "C" { // @todo replace all signal checks with forked main process that independently checks and assigns main->signal_received. if (!((++main->signal_check) % fss_write_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { + if (fll_program_standard_signal_received(&main->program)) { setting->state.status = F_status_set_error(F_interrupt); return; @@ -224,8 +211,8 @@ extern "C" { for (;;) { if (!((++main->signal_check) % fss_write_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, main->signal_received); + if (fll_program_standard_signal_received(&main->program)) { + fll_program_print_signal_received(&main->warning, main->signal_received); setting->state.status = F_status_set_error(F_interrupt); diff --git a/level_3/fss_write/c/main/fss_write.h b/level_3/fss_write/c/main/fss_write.h index 604f60c..4641f8d 100644 --- a/level_3/fss_write/c/main/fss_write.h +++ b/level_3/fss_write/c/main/fss_write.h @@ -42,6 +42,8 @@ #include // FSS Write includes. +#include +#include #include #include #include diff --git a/level_3/fss_write/c/main/main.c b/level_3/fss_write/c/main/main.c index ac9c642..d1c99c6 100644 --- a/level_3/fss_write/c/main/main.c +++ b/level_3/fss_write/c/main/main.c @@ -10,10 +10,20 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { - fll_program_data_t data = fll_program_data_t_initialize; - fss_write_setting_t setting = fss_write_setting_t_initialize; + fss_write_main_t data = fss_write_main_t_initialize; + setting.state.custom = (void *) &data; + data.program.debug.flag |= fss_write_print_flag_debug_e; + data.program.error.flag |= fss_write_print_flag_error_e; + data.program.message.flag |= fss_write_print_flag_message_e; + data.program.warning.flag |= fss_write_print_flag_warning_e; + data.program.message.custom = (void *) &data; + data.program.output.custom = (void *) &data; + data.program.error.custom = (void *) &data; + data.program.warning.custom = (void *) &data; + data.program.debug.custom = (void *) &data; + f_console_parameter_t parameters[] = fss_write_console_parameter_t_initialize; data.parameters.array = parameters; data.parameters.used = fss_write_total_parameters_d; diff --git a/level_3/fss_write/c/main/print.c b/level_3/fss_write/c/main/print.c index 7ecd90c..fc0ed10 100644 --- a/level_3/fss_write/c/main/print.c +++ b/level_3/fss_write/c/main/print.c @@ -10,7 +10,7 @@ extern "C" { if (!setting) return F_status_set_error(F_output_not); if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - fll_error_print(*print, F_status_set_fine(setting->state.status), function, fll_error_file_flag_fallback_e); + fll_error_print(print, F_status_set_fine(setting->state.status), function, fll_error_file_flag_fallback_e); return F_none; } @@ -22,7 +22,7 @@ extern "C" { if (!setting) return F_status_set_error(F_output_not); if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - fll_error_file_print(*print, F_status_set_fine(setting->state.status), function, fll_error_file_flag_fallback_e, name, operation, type); + fll_error_file_print(print, F_status_set_fine(setting->state.status), function, fll_error_file_flag_fallback_e, name, operation, type); return F_none; } diff --git a/level_3/fss_write/c/main/print/data.c b/level_3/fss_write/c/main/print/data.c new file mode 100644 index 0000000..e69de29 diff --git a/level_3/fss_write/c/main/print/data.h b/level_3/fss_write/c/main/print/data.h new file mode 100644 index 0000000..e69de29 diff --git a/level_3/fss_write/c/main/print/error.c b/level_3/fss_write/c/main/print/error.c new file mode 100644 index 0000000..e69de29 diff --git a/level_3/fss_write/c/main/print/error.h b/level_3/fss_write/c/main/print/error.h new file mode 100644 index 0000000..e69de29 diff --git a/level_3/fss_write/c/main/print/message.c b/level_3/fss_write/c/main/print/message.c new file mode 100644 index 0000000..e69de29 diff --git a/level_3/fss_write/c/main/print/message.h b/level_3/fss_write/c/main/print/message.h new file mode 100644 index 0000000..e69de29 diff --git a/level_3/fss_write/c/payload/fss_write.c b/level_3/fss_write/c/payload/fss_write.c index 17ccb8e..ee03aa6 100644 --- a/level_3/fss_write/c/payload/fss_write.c +++ b/level_3/fss_write/c/payload/fss_write.c @@ -87,7 +87,7 @@ extern "C" { for (;;) { if (!((++main->signal_check) % fss_write_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { + if (fll_program_standard_signal_received(&main->program)) { fll_program_print_signal_received(main->warning, main->signal_received); setting->state.status = F_status_set_error(F_interrupt); diff --git a/level_3/fss_write/c/payload/main.c b/level_3/fss_write/c/payload/main.c index 2ce46c5..0adfd64 100644 --- a/level_3/fss_write/c/payload/main.c +++ b/level_3/fss_write/c/payload/main.c @@ -3,8 +3,18 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { - fll_program_data_t data = fll_program_data_t_initialize; - fss_write_setting_t setting = fss_write_setting_t_initialize; + fss_write_main_t data = fss_write_main_t_initialize; + + data.program.debug.flag |= fss_write_print_flag_debug_e; + data.program.error.flag |= fss_write_print_flag_error_e; + data.program.message.flag |= fss_write_print_flag_message_e; + data.program.warning.flag |= fss_write_print_flag_warning_e; + data.program.message.custom = (void *) &data; + data.program.output.custom = (void *) &data; + data.program.error.custom = (void *) &data; + data.program.warning.custom = (void *) &data; + data.program.debug.custom = (void *) &data; + setting.state.custom = (void *) &data; setting.standard = fss_write_payload_standard_s; setting.process_content = 0; // Not used by payload. diff --git a/level_3/iki_read/c/main/common.c b/level_3/iki_read/c/main/common.c index 4e4e793..89a0245 100644 --- a/level_3/iki_read/c/main/common.c +++ b/level_3/iki_read/c/main/common.c @@ -71,7 +71,7 @@ extern "C" { const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e }; - setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, main); + setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, &main->program); if (F_status_is_error(setting->state.status)) { if ((setting->flag & iki_read_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { @@ -92,7 +92,7 @@ extern "C" { const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e }; - setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); + setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, &main->program); if (F_status_is_error(setting->state.status)) { if ((setting->flag & iki_read_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { @@ -131,7 +131,7 @@ extern "C" { fll_print_dynamic_raw(f_string_eol_s, main->message.to); } - fll_program_print_error_missing_file(main->error); + fll_program_print_error_missing_file(&main->error); return; } @@ -144,7 +144,7 @@ extern "C" { fll_print_dynamic_raw(f_string_eol_s, main->message.to); } - fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, iki_read_long_at_s, iki_read_long_whole_s); + fll_program_print_error_parameter_cannot_use_with(&main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, iki_read_long_at_s, iki_read_long_whole_s); return; } @@ -162,7 +162,7 @@ extern "C" { fll_print_dynamic_raw(f_string_eol_s, main->message.to); } - fll_program_print_error_parameter_integer_not(main->error, f_console_symbol_long_normal_s, iki_read_long_at_s, main->parameters.arguments.array[index]); + fll_program_print_error_parameter_integer_not(&main->error, f_console_symbol_long_normal_s, iki_read_long_at_s, main->parameters.arguments.array[index]); return; } @@ -176,7 +176,7 @@ extern "C" { fll_print_dynamic_raw(f_string_eol_s, main->message.to); } - fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, iki_read_long_at_s); + fll_program_print_error_parameter_missing_value(&main->error, f_console_symbol_long_normal_s, iki_read_long_at_s); return; } @@ -195,7 +195,7 @@ extern "C" { fll_print_dynamic_raw(f_string_eol_s, main->message.to); } - fll_program_print_error_parameter_integer_not(main->error, f_console_symbol_long_normal_s, iki_read_long_line_s, main->parameters.arguments.array[index]); + fll_program_print_error_parameter_integer_not(&main->error, f_console_symbol_long_normal_s, iki_read_long_line_s, main->parameters.arguments.array[index]); return; } @@ -209,7 +209,7 @@ extern "C" { fll_print_dynamic_raw(f_string_eol_s, main->message.to); } - fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, iki_read_long_line_s); + fll_program_print_error_parameter_missing_value(&main->error, f_console_symbol_long_normal_s, iki_read_long_line_s); return; } @@ -273,7 +273,7 @@ extern "C" { fll_print_dynamic_raw(f_string_eol_s, main->message.to); } - fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, iki_read_long_name_s); + fll_program_print_error_parameter_missing_value(&main->error, f_console_symbol_long_normal_s, iki_read_long_name_s); return; } @@ -286,7 +286,7 @@ extern "C" { fll_print_dynamic_raw(f_string_eol_s, main->message.to); } - fll_program_print_error_parameter_missing_value_requires_amount(main->error, f_console_symbol_long_normal_s, iki_read_long_replace_s, iki_read_string_two_s); + fll_program_print_error_parameter_missing_value_requires_amount(&main->error, f_console_symbol_long_normal_s, iki_read_long_replace_s, iki_read_string_two_s); return; } @@ -381,7 +381,7 @@ extern "C" { fll_print_dynamic_raw(f_string_eol_s, main->message.to); } - fll_program_print_error_parameter_missing_value_requires_amount(main->error, f_console_symbol_long_normal_s, iki_read_long_wrap_s, iki_read_string_three_s); + fll_program_print_error_parameter_missing_value_requires_amount(&main->error, f_console_symbol_long_normal_s, iki_read_long_wrap_s, iki_read_string_three_s); return; } @@ -488,7 +488,7 @@ extern "C" { fll_print_dynamic_raw(f_string_eol_s, main->message.to); } - fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, iki_read_long_literal_s, names[i]); + fll_program_print_error_parameter_cannot_use_with(&main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, iki_read_long_literal_s, names[i]); return; } @@ -516,7 +516,7 @@ extern "C" { fll_print_dynamic_raw(f_string_eol_s, main->message.to); } - fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, iki_read_long_object_s, names[i]); + fll_program_print_error_parameter_cannot_use_with(&main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, iki_read_long_object_s, names[i]); return; } @@ -532,7 +532,7 @@ extern "C" { fll_print_dynamic_raw(f_string_eol_s, main->message.to); } - fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, iki_read_long_content_s, iki_read_long_total_s); + fll_program_print_error_parameter_cannot_use_with(&main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, iki_read_long_content_s, iki_read_long_total_s); return; } @@ -547,7 +547,7 @@ extern "C" { fll_print_dynamic_raw(f_string_eol_s, main->message.to); } - fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, iki_read_long_total_s, iki_read_long_wrap_s); + fll_program_print_error_parameter_cannot_use_with(&main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, iki_read_long_total_s, iki_read_long_wrap_s); return; } @@ -632,7 +632,7 @@ extern "C" { fll_print_dynamic_raw(f_string_eol_s, main->message.to); } - fll_program_print_error_parameter_missing_value_requires_amount(main->error, f_console_symbol_long_normal_s, name, iki_read_string_three_s); + fll_program_print_error_parameter_missing_value_requires_amount(&main->error, f_console_symbol_long_normal_s, name, iki_read_string_three_s); return F_false; } diff --git a/level_3/iki_read/c/main/common/define.c b/level_3/iki_read/c/main/common/define.c new file mode 100644 index 0000000..de0e2a3 --- /dev/null +++ b/level_3/iki_read/c/main/common/define.c @@ -0,0 +1,9 @@ +#include "../iki_read.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_3/iki_read/c/main/common/define.h b/level_3/iki_read/c/main/common/define.h new file mode 100644 index 0000000..a7c14eb --- /dev/null +++ b/level_3/iki_read/c/main/common/define.h @@ -0,0 +1,24 @@ +/** + * FLL - Level 3 + * + * Project: IKI Read + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Provides the common define types. + * + * This is auto-included and should not need to be explicitly included. + */ +#ifndef _iki_read_common_define_h +#define _iki_read_common_define_h + +#ifdef __cplusplus +extern "C" { +#endif + + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _iki_read_common_define_h diff --git a/level_3/iki_read/c/main/common/enumeration.c b/level_3/iki_read/c/main/common/enumeration.c new file mode 100644 index 0000000..de0e2a3 --- /dev/null +++ b/level_3/iki_read/c/main/common/enumeration.c @@ -0,0 +1,9 @@ +#include "../iki_read.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_3/iki_read/c/main/common/enumeration.h b/level_3/iki_read/c/main/common/enumeration.h new file mode 100644 index 0000000..4e2d0e4 --- /dev/null +++ b/level_3/iki_read/c/main/common/enumeration.h @@ -0,0 +1,47 @@ +/** + * FLL - Level 3 + * + * Project: IKI Read + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Provides the common enumeration types. + * + * This is auto-included and should not need to be explicitly included. + */ +#ifndef _iki_read_common_enumeration_h +#define _iki_read_common_enumeration_h + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Flags for fine-tuned print control. + * + * iki_read_print_flag_*_e: + * - none: No flags set. + * - debug: Stream is for debug printing. + * - error: Stream is for error printing. + * - message: Stream is for message printing. + * - warning: Stream is for warning printing. + * - file_to: Stream is a destination file. + * - file_from: Stream is a source file. + */ +#ifndef _di_iki_read_print_flag_e_ + enum { + iki_read_print_flag_none_e = 0x0, + iki_read_print_flag_debug_e = 0x1, + iki_read_print_flag_error_e = 0x2, + iki_read_print_flag_message_e = 0x4, + iki_read_print_flag_warning_e = 0x8, + iki_read_print_flag_file_to_e = 0x10, + iki_read_print_flag_file_from_e = 0x20, + }; // enum +#endif // _di_iki_read_print_flag_e_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _iki_read_common_enumeration_h diff --git a/level_3/iki_read/c/main/common/type.h b/level_3/iki_read/c/main/common/type.h index e24182b..7e439c4 100644 --- a/level_3/iki_read/c/main/common/type.h +++ b/level_3/iki_read/c/main/common/type.h @@ -220,6 +220,25 @@ extern "C" { } #endif // _di_iki_read_setting_t_ +/** + * The main program data as a single structure. + * + * program: The main program data. + * setting: The settings data. + */ +#ifndef _di_iki_read_main_t_ + typedef struct { + fll_program_data_t program; + iki_read_setting_t setting; + } iki_read_main_t; + + #define iki_read_main_t_initialize \ + { \ + fll_program_data_t_initialize, \ + iki_read_setting_t_initialize, \ + } +#endif // _di_iki_read_main_t_ + #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/iki_read/c/main/iki_read.c b/level_3/iki_read/c/main/iki_read.c index 8defe74..3502ad0 100644 --- a/level_3/iki_read/c/main/iki_read.c +++ b/level_3/iki_read/c/main/iki_read.c @@ -23,31 +23,20 @@ extern "C" { setting->state.status = F_none; - if (setting->flag & iki_read_main_flag_help_e) { - iki_read_print_help(setting, main->message); + if (main->setting.flag & (iki_read_main_flag_help_e | iki_read_main_flag_version_e | iki_read_main_flag_copyright_e)) { - if ((setting->flag & iki_read_main_flag_print_last_e) && main->message.verbosity > f_console_verbosity_error_e) { - fll_print_dynamic_raw(f_string_eol_s, main->message.to); + if (main->setting.flag & iki_read_main_flag_help_e) { + iki_read_print_message_help(&main->program.message); } - - return; - } - - if (setting->flag & iki_read_main_flag_version_e) { - fll_program_print_version(main->message, iki_read_program_version_s); - - if ((setting->flag & iki_read_main_flag_print_last_e) && main->message.verbosity > f_console_verbosity_error_e) { - fll_print_dynamic_raw(f_string_eol_s, main->message.to); + else if (main->setting.flag & iki_read_main_flag_version_e) { + fll_program_print_version(&main->program.message, iki_read_program_version_s); + } + else if (main->setting.flag & iki_read_main_flag_copyright_e) { + fll_program_print_copyright(&main->program.message); } - return; - } - - if (setting->flag & iki_read_main_flag_copyright_e) { - fll_program_print_copyright(main->message); - - if ((setting->flag & iki_read_main_flag_print_last_e) && main->message.verbosity > f_console_verbosity_error_e) { - fll_print_dynamic_raw(f_string_eol_s, main->message.to); + if ((main->setting.flag & iki_read_main_flag_print_last_e) && main->program.message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); } return; @@ -79,8 +68,8 @@ extern "C" { for (f_array_length_t i = 0; i < setting->files.used; ++i) { if (!((++main->signal_check) % iki_read_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, main->signal_received); + if (fll_program_standard_signal_received(&main->program)) { + fll_program_print_signal_received(&main->warning, main->signal_received); setting->state.status = F_status_set_error(F_interrupt); @@ -149,8 +138,8 @@ extern "C" { for (size_read = 0; size_read < size_file; size_read += size_block) { // The signal check is always performed on each pass. - if (size_file > iki_read_block_max && fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, main->signal_received); + if (size_file > iki_read_block_max && fll_program_standard_signal_received(&main->program)) { + fll_program_print_signal_received(&main->warning, main->signal_received); setting->state.status = F_status_set_error(F_interrupt); diff --git a/level_3/iki_read/c/main/iki_read.h b/level_3/iki_read/c/main/iki_read.h index 79c7601..7585c31 100644 --- a/level_3/iki_read/c/main/iki_read.h +++ b/level_3/iki_read/c/main/iki_read.h @@ -51,14 +51,16 @@ #include // IKI Read includes. +#include +#include #include #include #include #include #include -#include #include #include +#include #include #ifdef __cplusplus diff --git a/level_3/iki_read/c/main/main.c b/level_3/iki_read/c/main/main.c index 4345220..4426b34 100644 --- a/level_3/iki_read/c/main/main.c +++ b/level_3/iki_read/c/main/main.c @@ -2,11 +2,21 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { - fll_program_data_t data = fll_program_data_t_initialize; - iki_read_setting_t setting = iki_read_setting_t_initialize; + iki_read_main_t data = iki_read_main_t_initialize; + setting.state.custom = (void *) &data; setting.state.handle = &fll_program_standard_signal_handle; + data.program.debug.flag |= iki_read_print_flag_debug_e; + data.program.error.flag |= iki_read_print_flag_error_e; + data.program.message.flag |= iki_read_print_flag_message_e; + data.program.warning.flag |= iki_read_print_flag_warning_e; + data.program.message.custom = (void *) &data; + data.program.output.custom = (void *) &data; + data.program.error.custom = (void *) &data; + data.program.warning.custom = (void *) &data; + data.program.debug.custom = (void *) &data; + f_console_parameter_t parameters[] = iki_read_console_parameter_t_initialize; data.parameters.array = parameters; data.parameters.used = iki_read_total_parameters_d; diff --git a/level_3/iki_read/c/main/print.c b/level_3/iki_read/c/main/print.c index 1da304e..2fe4139 100644 --- a/level_3/iki_read/c/main/print.c +++ b/level_3/iki_read/c/main/print.c @@ -5,93 +5,92 @@ extern "C" { #endif #ifndef _di_iki_read_print_help_ - f_status_t iki_read_print_help(iki_read_setting_t * const setting, const fl_print_t print) { + f_status_t iki_read_print_help(fl_print_t * const print) { if (!setting) return F_status_set_error(F_output_not); - f_file_stream_lock(print.to); + f_file_stream_lock(print->to); fll_program_print_help_header(print, iki_read_program_name_long_s, iki_read_program_version_s); fll_program_print_help_option_standard(print); - f_print_dynamic_raw(f_string_eol_s, print.to); + f_print_dynamic_raw(f_string_eol_s, print->to); fll_program_print_help_option(print, iki_read_short_at_s, iki_read_long_at_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Select Variable at this numeric index."); fll_program_print_help_option(print, iki_read_short_line_s, iki_read_long_line_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Print only the Variables at the given line within the file."); fll_program_print_help_option(print, iki_read_short_name_s, iki_read_long_name_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Select Variables with this name."); fll_program_print_help_option(print, iki_read_short_whole_s, iki_read_long_whole_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "Print all of the data instead of just the IKI Variable data."); - f_print_dynamic_raw(f_string_eol_s, print.to); + f_print_dynamic_raw(f_string_eol_s, print->to); fll_program_print_help_option(print, iki_read_short_content_s, iki_read_long_content_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "Print the Variable value (aka: Content) (default)"); fll_program_print_help_option(print, iki_read_short_literal_s, iki_read_long_literal_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "Print the entire Variable (aka: Object, Content, and syntax)."); fll_program_print_help_option(print, iki_read_short_object_s, iki_read_long_object_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Print the Variable name (aka: Vocabulary) (aka: Object)."); fll_program_print_help_option(print, iki_read_short_total_s, iki_read_long_total_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Print the total number of Variables."); - f_print_dynamic_raw(f_string_eol_s, print.to); + f_print_dynamic_raw(f_string_eol_s, print->to); fll_program_print_help_option(print, iki_read_short_reassign_s, iki_read_long_reassign_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Re-assign the Variable for the given name and matching Content value with the given string."); fll_program_print_help_option(print, iki_read_short_replace_s, iki_read_long_replace_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Simple substitution, replacing the Variable for the given name with the given string."); fll_program_print_help_option(print, iki_read_short_substitute_s, iki_read_long_substitute_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "Substitute the Variable for the given name and matching Content value with the given string."); fll_program_print_help_option(print, iki_read_short_wrap_s, iki_read_long_wrap_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Prepend and append strings for the given name."); - f_print_dynamic_raw(f_string_eol_s, print.to); - f_print_dynamic_raw(f_string_eol_s, print.to); + f_print_dynamic_raw(f_string_eol_s, print->to); fll_program_print_help_usage(print, iki_read_program_name_s, fll_program_parameter_filenames_s); - fl_print_format("%r %[Notes:%]%r", print.to, f_string_eol_s, print.set->important, print.set->important, f_string_eol_s); - fl_print_format(" This program will find and print Variables, Vocabularies, or Content following the IKI standard, without focusing on any particular Vocabulary specification.%r%r", print.to, f_string_eol_s, f_string_eol_s); + fl_print_format("%r %[Notes:%]%r", print->to, f_string_eol_s, print->set->important, print->set->important, f_string_eol_s); + fl_print_format(" This program will find and print Variables, Vocabularies, or Content following the IKI standard, without focusing on any particular Vocabulary specification.%r%r", print->to, f_string_eol_s, f_string_eol_s); - fl_print_format(" The %[%r%r%] option requires 2 additional parameters:", print.to, print.set->notable, f_console_symbol_long_normal_s, iki_read_long_replace_s, print.set->notable); - fl_print_format(" %[<%]%r%[>%]", print.to, print.set->notable, print.set->notable, iki_read_substitution_vocabulary_s, print.set->notable, print.set->notable); - fl_print_format(" %[<%]%r%[>%].%r", print.to, print.set->notable, print.set->notable, iki_read_substitution_with_s, print.set->notable, print.set->notable, f_string_eol_s); + fl_print_format(" The %[%r%r%] option requires 2 additional parameters:", print->to, print->set->notable, f_console_symbol_long_normal_s, iki_read_long_replace_s, print->set->notable); + fl_print_format(" %[<%]%r%[>%]", print->to, print->set->notable, print->set->notable, iki_read_substitution_vocabulary_s, print->set->notable, print->set->notable); + fl_print_format(" %[<%]%r%[>%].%r", print->to, print->set->notable, print->set->notable, iki_read_substitution_with_s, print->set->notable, print->set->notable, f_string_eol_s); - fl_print_format(" %[%r%]: The name of the Vocabulary whose content is to be substituted.%r", print.to, print.set->notable, iki_read_substitution_vocabulary_s, print.set->notable, f_string_eol_s); - fl_print_format(" %[%r%]: The new string to use as the substitute.%r%r", print.to, print.set->notable, iki_read_substitution_with_s, print.set->notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" %[%r%]: The name of the Vocabulary whose content is to be substituted.%r", print->to, print->set->notable, iki_read_substitution_vocabulary_s, print->set->notable, f_string_eol_s); + fl_print_format(" %[%r%]: The new string to use as the substitute.%r%r", print->to, print->set->notable, iki_read_substitution_with_s, print->set->notable, f_string_eol_s, f_string_eol_s); - fl_print_format(" The Vocabulary is case-sensitive and must exactly match.%r%r", print.to, f_string_eol_s, f_string_eol_s); + fl_print_format(" The Vocabulary is case-sensitive and must exactly match.%r%r", print->to, f_string_eol_s, f_string_eol_s); - fl_print_format(" The %[%r%r%] and the", print.to, print.set->notable, f_console_symbol_long_normal_s, iki_read_long_reassign_s, print.set->notable); - fl_print_format(" %[%r%r%] options require 3 additional parameters:", print.to, print.set->notable, f_console_symbol_long_normal_s, iki_read_long_substitute_s, print.set->notable); - fl_print_format(" %[<%]%r%[>%]", print.to, print.set->notable, print.set->notable, iki_read_substitution_vocabulary_s, print.set->notable, print.set->notable); - fl_print_format(" %[<%]%r%[>%]", print.to, print.set->notable, print.set->notable, iki_read_substitution_replace_s, print.set->notable, print.set->notable); - fl_print_format(" %[<%]%r%[>%].%r", print.to, print.set->notable, print.set->notable, iki_read_substitution_with_s, print.set->notable, print.set->notable, f_string_eol_s); + fl_print_format(" The %[%r%r%] and the", print->to, print->set->notable, f_console_symbol_long_normal_s, iki_read_long_reassign_s, print->set->notable); + fl_print_format(" %[%r%r%] options require 3 additional parameters:", print->to, print->set->notable, f_console_symbol_long_normal_s, iki_read_long_substitute_s, print->set->notable); + fl_print_format(" %[<%]%r%[>%]", print->to, print->set->notable, print->set->notable, iki_read_substitution_vocabulary_s, print->set->notable, print->set->notable); + fl_print_format(" %[<%]%r%[>%]", print->to, print->set->notable, print->set->notable, iki_read_substitution_replace_s, print->set->notable, print->set->notable); + fl_print_format(" %[<%]%r%[>%].%r", print->to, print->set->notable, print->set->notable, iki_read_substitution_with_s, print->set->notable, print->set->notable, f_string_eol_s); - fl_print_format(" %[%r%]: The name of the Vocabulary whose content is to be substituted or re-assigned.%r", print.to, print.set->notable, iki_read_substitution_vocabulary_s, print.set->notable, f_string_eol_s); - fl_print_format(" %[%r%]: The Content matching this exact string will be substituted or re-assigned.%r", print.to, print.set->notable, iki_read_substitution_replace_s, print.set->notable, f_string_eol_s); - fl_print_format(" %[%r%]: The new string to use as the substitute or re-assignment.%r%r", print.to, print.set->notable, iki_read_substitution_with_s, print.set->notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" %[%r%]: The name of the Vocabulary whose content is to be substituted or re-assigned.%r", print->to, print->set->notable, iki_read_substitution_vocabulary_s, print->set->notable, f_string_eol_s); + fl_print_format(" %[%r%]: The Content matching this exact string will be substituted or re-assigned.%r", print->to, print->set->notable, iki_read_substitution_replace_s, print->set->notable, f_string_eol_s); + fl_print_format(" %[%r%]: The new string to use as the substitute or re-assignment.%r%r", print->to, print->set->notable, iki_read_substitution_with_s, print->set->notable, f_string_eol_s, f_string_eol_s); - fl_print_format(" The Vocabulary and replacement are case-sensitive and must exactly match.%r%r", print.to, f_string_eol_s, f_string_eol_s); + fl_print_format(" The Vocabulary and replacement are case-sensitive and must exactly match.%r%r", print->to, f_string_eol_s, f_string_eol_s); - fl_print_format(" The %[%r%r%] option requires 3 additional parameters:", print.to, print.set->notable, f_console_symbol_long_normal_s, iki_read_long_wrap_s, print.set->notable); - fl_print_format(" %[<%]%r%[>%]", print.to, print.set->notable, print.set->notable, iki_read_substitution_vocabulary_s, print.set->notable, print.set->notable); - fl_print_format(" %[<%]%r%[>%]", print.to, print.set->notable, print.set->notable, iki_read_substitution_before_s, print.set->notable, print.set->notable); - fl_print_format(" %[<%]%r%[>%].%r", print.to, print.set->notable, print.set->notable, iki_read_substitution_after_s, print.set->notable, print.set->notable, f_string_eol_s); + fl_print_format(" The %[%r%r%] option requires 3 additional parameters:", print->to, print->set->notable, f_console_symbol_long_normal_s, iki_read_long_wrap_s, print->set->notable); + fl_print_format(" %[<%]%r%[>%]", print->to, print->set->notable, print->set->notable, iki_read_substitution_vocabulary_s, print->set->notable, print->set->notable); + fl_print_format(" %[<%]%r%[>%]", print->to, print->set->notable, print->set->notable, iki_read_substitution_before_s, print->set->notable, print->set->notable); + fl_print_format(" %[<%]%r%[>%].%r", print->to, print->set->notable, print->set->notable, iki_read_substitution_after_s, print->set->notable, print->set->notable, f_string_eol_s); - fl_print_format(" %[%r%]: The name of the Vocabulary whose content is to be wrapped.%r", print.to, print.set->notable, iki_read_substitution_vocabulary_s, print.set->notable, f_string_eol_s); - fl_print_format(" %[%r%]: The string to prepend.%r", print.to, print.set->notable, iki_read_substitution_before_s, print.set->notable, f_string_eol_s); - fl_print_format(" %[%r%]: The string to append.%r%r", print.to, print.set->notable, iki_read_substitution_after_s, print.set->notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" %[%r%]: The name of the Vocabulary whose content is to be wrapped.%r", print->to, print->set->notable, iki_read_substitution_vocabulary_s, print->set->notable, f_string_eol_s); + fl_print_format(" %[%r%]: The string to prepend.%r", print->to, print->set->notable, iki_read_substitution_before_s, print->set->notable, f_string_eol_s); + fl_print_format(" %[%r%]: The string to append.%r%r", print->to, print->set->notable, iki_read_substitution_after_s, print->set->notable, f_string_eol_s, f_string_eol_s); - fl_print_format(" The Vocabulary is case-sensitive and must exactly match.%r%r", print.to, f_string_eol_s, f_string_eol_s); + fl_print_format(" The Vocabulary is case-sensitive and must exactly match.%r%r", print->to, f_string_eol_s, f_string_eol_s); - fl_print_format(" The difference between %[%r%r%]", print.to, print.set->notable, f_console_symbol_long_normal_s, iki_read_long_replace_s, print.set->notable); - fl_print_format(" and %[%r%r%] is that the", print.to, print.set->notable, f_console_symbol_long_normal_s, iki_read_long_substitute_s, print.set->notable); - fl_print_format(" %[%r%r%] option substitutes all matching Vocabulary names and the", print.to, print.set->notable, f_console_symbol_long_normal_s, iki_read_long_replace_s, print.set->notable); - fl_print_format(" %[%r%r%] option substitutes all matching Vocabulary names that must also have the given matching Content.%r%r", print.to, print.set->notable, f_console_symbol_long_normal_s, iki_read_long_substitute_s, print.set->notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" The difference between %[%r%r%]", print->to, print->set->notable, f_console_symbol_long_normal_s, iki_read_long_replace_s, print->set->notable); + fl_print_format(" and %[%r%r%] is that the", print->to, print->set->notable, f_console_symbol_long_normal_s, iki_read_long_substitute_s, print->set->notable); + fl_print_format(" %[%r%r%] option substitutes all matching Vocabulary names and the", print->to, print->set->notable, f_console_symbol_long_normal_s, iki_read_long_replace_s, print->set->notable); + fl_print_format(" %[%r%r%] option substitutes all matching Vocabulary names that must also have the given matching Content.%r%r", print->to, print->set->notable, f_console_symbol_long_normal_s, iki_read_long_substitute_s, print->set->notable, f_string_eol_s, f_string_eol_s); - fl_print_format(" The %[%r%r%]", print.to, print.set->notable, f_console_symbol_long_normal_s, iki_read_long_reassign_s, print.set->notable); - fl_print_format(" option is identical to the %[%r%r%] option", print.to, print.set->notable, f_console_symbol_long_normal_s, iki_read_long_substitute_s, print.set->notable); - fl_print_format(" except that the %[%r%r%] option is ignored (not applied).%r%r", print.to, print.set->notable, f_console_symbol_long_normal_s, iki_read_long_wrap_s, print.set->notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" The %[%r%r%]", print->to, print->set->notable, f_console_symbol_long_normal_s, iki_read_long_reassign_s, print->set->notable); + fl_print_format(" option is identical to the %[%r%r%] option", print->to, print->set->notable, f_console_symbol_long_normal_s, iki_read_long_substitute_s, print->set->notable); + fl_print_format(" except that the %[%r%r%] option is ignored (not applied).%r%r", print->to, print->set->notable, f_console_symbol_long_normal_s, iki_read_long_wrap_s, print->set->notable, f_string_eol_s, f_string_eol_s); - fl_print_format(" The %[%r%r%]", print.to, print.set->notable, f_console_symbol_long_normal_s, iki_read_long_substitute_s, print.set->notable); - fl_print_format(" option takes priority over the %[%r%r%] option when matching the same Variable.%r%r", print.to, print.set->notable, f_console_symbol_long_normal_s, iki_read_long_replace_s, print.set->notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" The %[%r%r%]", print->to, print->set->notable, f_console_symbol_long_normal_s, iki_read_long_substitute_s, print->set->notable); + fl_print_format(" option takes priority over the %[%r%r%] option when matching the same Variable.%r%r", print->to, print->set->notable, f_console_symbol_long_normal_s, iki_read_long_replace_s, print->set->notable, f_string_eol_s, f_string_eol_s); - fl_print_format(" The default behavior is to only display Content portion of the IKI Variable.%r", print.to, f_string_eol_s); + fl_print_format(" The default behavior is to only display Content portion of the IKI Variable.%r", print->to, f_string_eol_s); - f_file_stream_flush(print.to); - f_file_stream_unlock(print.to); + f_file_stream_flush(print->to); + f_file_stream_unlock(print->to); return F_none; } diff --git a/level_3/iki_read/c/main/print.h b/level_3/iki_read/c/main/print.h index 29910ae..1318850 100644 --- a/level_3/iki_read/c/main/print.h +++ b/level_3/iki_read/c/main/print.h @@ -19,13 +19,11 @@ extern "C" { /** * Print help. * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. * @param print * The output structure to print to. * + * This does not alter print.custom.setting.state.status. + * * @return * F_none on success. * F_output_not on success, but no printing is performed. @@ -33,7 +31,7 @@ extern "C" { * F_output_not (with error bit) if setting is NULL. */ #ifndef _di_iki_read_print_help_ - extern f_status_t iki_read_print_help(iki_read_setting_t * const setting, const fl_print_t print); + extern f_status_t iki_read_print_help(fl_print_t * const print); #endif // _di_iki_read_print_help_ #ifdef __cplusplus diff --git a/level_3/iki_read/c/main/print/data.c b/level_3/iki_read/c/main/print/data.c index 106f3a5..1413509 100644 --- a/level_3/iki_read/c/main/print/data.c +++ b/level_3/iki_read/c/main/print/data.c @@ -5,7 +5,7 @@ extern "C" { #endif #ifndef _di_iki_read_print_data_ - void iki_read_print_data(fll_program_data_t * const main, iki_read_setting_t * const setting, const f_array_length_t index) { + void iki_read_print_data(fl_print_t * const print, const f_array_length_t index) { if (!setting) return; @@ -128,7 +128,7 @@ extern "C" { #endif // _di_iki_read_print_data_ #ifndef _di_iki_read_print_data_wrap_append_ - void iki_read_print_data_wrap_append(fll_program_data_t * const main, iki_read_setting_t * const setting, const f_array_length_t index) { + void iki_read_print_data_wrap_append(fl_print_t * const print, const f_array_length_t index) { if (!setting) return; @@ -148,7 +148,7 @@ extern "C" { #endif // _di_iki_read_print_data_wrap_append_ #ifndef _di_iki_read_print_data_wrap_prepend_ - void iki_read_print_data_wrap_prepend(fll_program_data_t * const main, iki_read_setting_t * const setting, const f_array_length_t index) { + void iki_read_print_data_wrap_prepend(fl_print_t * const print, const f_array_length_t index) { if (!setting) return; diff --git a/level_3/iki_read/c/main/print/data.h b/level_3/iki_read/c/main/print/data.h index 1e17ed4..6a8d95a 100644 --- a/level_3/iki_read/c/main/print/data.h +++ b/level_3/iki_read/c/main/print/data.h @@ -24,15 +24,13 @@ extern "C" { * This detects and prints any applicable substitution matching the vocabulary at the given index. * If there is no substitution, then this prints the given range at the given index. * - * @param main - * The main program data. - * @param setting - * The main program settings. + * @param print + * The output structure to print to. * * The setting.map_wraps is expected to be defined as a valid pointer to an array. * The setting.map_replaces is expected to be defined as a valid pointer to an array. * - * This does not alter setting.state.status. + * This does not alter print.custom.setting.state.status. * @param index * The index used to identify the desired range in variable, content, and ranges. * @@ -44,7 +42,7 @@ extern "C" { * @see iki_read_print_data_wrap_append() */ #ifndef _di_iki_read_print_data_ - extern void iki_read_print_data(fll_program_data_t * const main, iki_read_setting_t * const setting, const f_array_length_t index) F_attribute_visibility_internal_d; + extern void iki_read_print_data(fl_print_t * const print, const f_array_length_t index) F_attribute_visibility_internal_d; #endif // _di_iki_read_print_data_ /** @@ -52,19 +50,17 @@ extern "C" { * * This expects the caller to have the output locked appropriately. * - * @param main - * The main program data. - * @param setting - * The main program settings. + * @param print + * The output structure to print to. * - * This does not alter setting.state.status. + * This does not alter print.custom.setting.state.status. * @param index * The index within the setting->map_wraps array to print. * * @see f_print_dynamic() */ #ifndef _di_iki_read_print_data_wrap_append_ - extern void iki_read_print_data_wrap_append(fll_program_data_t * const main, iki_read_setting_t * const setting, const f_array_length_t index) F_attribute_visibility_internal_d; + extern void iki_read_print_data_wrap_append(fl_print_t * const print, const f_array_length_t index) F_attribute_visibility_internal_d; #endif // _di_iki_read_print_data_wrap_append_ /** @@ -72,19 +68,17 @@ extern "C" { * * This expects the caller to have the output locked appropriately. * - * @param main - * The main program data. - * @param setting - * The main program settings. + * @param print + * The output structure to print to. * - * This does not alter setting.state.status. + * This does not alter print.custom.setting.state.status. * @param index * The index within the setting->map_wraps array to print. * * @see f_print_dynamic() */ #ifndef _di_iki_read_print_data_wrap_prepend_ - extern void iki_read_print_data_wrap_prepend(fll_program_data_t * const main, iki_read_setting_t * const setting, const f_array_length_t index) F_attribute_visibility_internal_d; + extern void iki_read_print_data_wrap_prepend(fl_print_t * const print, const f_array_length_t index) F_attribute_visibility_internal_d; #endif // _di_iki_read_print_data_wrap_prepend_ #ifdef __cplusplus diff --git a/level_3/iki_read/c/main/print/error.c b/level_3/iki_read/c/main/print/error.c index c4bdb86..ca56592 100644 --- a/level_3/iki_read/c/main/print/error.c +++ b/level_3/iki_read/c/main/print/error.c @@ -5,18 +5,18 @@ extern "C" { #endif #ifndef _di_iki_read_print_error_ - f_status_t iki_read_print_error(iki_read_setting_t * const setting, const fl_print_t print, const f_string_t function) { + f_status_t iki_read_print_error(fl_print_t * const print, const f_string_t function) { if (print.verbosity < f_console_verbosity_error_e) return F_output_not; - fll_error_print(*print, F_status_set_fine(setting->state.status), function, fll_error_file_flag_fallback_e); + fll_error_print(print, F_status_set_fine(setting->state.status), function, fll_error_file_flag_fallback_e); return F_none; } #endif // _di_iki_read_print_error_ #ifndef _di_iki_read_print_error_file_ - f_status_t iki_read_print_error_file(iki_read_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) { + f_status_t iki_read_print_error_file(fl_print_t * const print, const f_string_t function, const f_string_static_t name, const f_string_static_t operation, const uint8_t type) { if (print.verbosity < f_console_verbosity_error_e) return F_output_not; diff --git a/level_3/iki_read/c/main/print/error.h b/level_3/iki_read/c/main/print/error.h index f825f58..fb7df27 100644 --- a/level_3/iki_read/c/main/print/error.h +++ b/level_3/iki_read/c/main/print/error.h @@ -19,12 +19,10 @@ extern "C" { /** * Print generic error message regarding a function failing in some way. * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. * @param print - * Designates the how and where to print. + * The output structure to print to. + * + * This does not alter print.custom.setting.state.status. * * @return * F_none on success. @@ -35,18 +33,16 @@ extern "C" { * @see fll_error_print() */ #ifndef _di_iki_read_print_error_ - extern f_status_t iki_read_print_error(iki_read_setting_t * const setting, const fl_print_t print, const f_string_t function); + extern f_status_t iki_read_print_error(fl_print_t * const print, const f_string_t function); #endif // _di_iki_read_print_error_ /** * Print file related error or warning messages. * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. * @param print - * Designates how printing is to be performed. + * The output structure to print to. + * + * This does not alter print.custom.setting.state.status. * @param function * The name of the function where the error happened. * Set to 0 to disable. @@ -66,7 +62,7 @@ extern "C" { * @see fll_error_file_print() */ #ifndef _di_iki_read_print_error_file_ - extern f_status_t iki_read_print_error_file(iki_read_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); + extern f_status_t iki_read_print_error_file(fl_print_t * const print, const f_string_t function, const f_string_static_t name, const f_string_static_t operation, const uint8_t type); #endif // _di_iki_read_print_error_file_ #ifdef __cplusplus diff --git a/level_3/iki_read/c/main/print/message.c b/level_3/iki_read/c/main/print/message.c new file mode 100644 index 0000000..de0e2a3 --- /dev/null +++ b/level_3/iki_read/c/main/print/message.c @@ -0,0 +1,9 @@ +#include "../iki_read.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_3/iki_read/c/main/print/message.h b/level_3/iki_read/c/main/print/message.h new file mode 100644 index 0000000..41ef415 --- /dev/null +++ b/level_3/iki_read/c/main/print/message.h @@ -0,0 +1,23 @@ +/** + * FLL - Level 3 + * + * Project: IKI Read + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Provides the print error functionality. + * + * This is auto-included and should not need to be explicitly included. + */ +#ifndef _iki_read_print_message_h +#define _iki_read_print_message_h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _iki_read_print_message_h diff --git a/level_3/iki_read/c/main/process.c b/level_3/iki_read/c/main/process.c index 38a9a84..bafa47a 100644 --- a/level_3/iki_read/c/main/process.c +++ b/level_3/iki_read/c/main/process.c @@ -328,8 +328,8 @@ extern "C" { for (i = 0; i < main->parameters.array[iki_read_parameter_name_e].values.used; ++i) { if (!((++main->signal_check) % iki_read_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, main->signal_received); + if (fll_program_standard_signal_received(&main->program)) { + fll_program_print_signal_received(&main->warning, main->signal_received); f_string_dynamic_resize(0, &name); diff --git a/level_3/iki_read/data/build/settings b/level_3/iki_read/data/build/settings index 44ed04d..1de300f 100644 --- a/level_3/iki_read/data/build/settings +++ b/level_3/iki_read/data/build/settings @@ -22,11 +22,11 @@ build_libraries-individual -lfll_error -lfll_print -lfll_program -lfl_conversion build_libraries-level -lfll_2 -lfll_1 -lfll_0 build_libraries-monolithic -lfll -build_sources_library main/iki_read.c main/common.c main/identify.c main/common/print.c main/common/string.c main/common/type.c main/print.c main/print/data.c main/print/error.c main/process.c +build_sources_library main/iki_read.c main/common.c main/identify.c main/common/define.c main/common/enumeration.c main/common/print.c main/common/string.c main/common/type.c main/print/data.c main/print/error.c main/print/message.c main/process.c build_sources_program main/main.c -build_sources_headers main/iki_read.h main/common.h main/identify.h main/common/print.h main/common/string.h main/common/type.h main/print.h main/print/data.h main/print/error.h main/process.h +build_sources_headers main/iki_read.h main/common.h main/identify.h main/common/define.h main/common/enumeration.h main/common/print.h main/common/string.h main/common/type.h main/print/data.h main/print/error.h main/print/message.h main/process.h build_sources_documentation man diff --git a/level_3/iki_write/c/main/common.c b/level_3/iki_write/c/main/common.c index 2dccb1a..b5646f6 100644 --- a/level_3/iki_write/c/main/common.c +++ b/level_3/iki_write/c/main/common.c @@ -68,7 +68,7 @@ extern "C" { const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e }; - setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, main); + setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, &main->program); if (F_status_is_error(setting->state.status)) { if ((setting->flag & iki_write_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { @@ -89,7 +89,7 @@ extern "C" { const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e }; - setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); + setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, &main->program); if (F_status_is_error(setting->state.status)) { if ((setting->flag & iki_write_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { @@ -133,7 +133,7 @@ extern "C" { fll_print_dynamic_raw(f_string_eol_s, main->message.to); } - fll_program_print_error_parameter_must_specify_once(main->error, f_console_symbol_long_normal_s, iki_write_long_file_s); + fll_program_print_error_parameter_must_specify_once(&main->error, f_console_symbol_long_normal_s, iki_write_long_file_s); return; } @@ -164,7 +164,7 @@ extern "C" { fll_print_dynamic_raw(f_string_eol_s, main->message.to); } - fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, iki_write_long_file_s); + fll_program_print_error_parameter_missing_value(&main->error, f_console_symbol_long_normal_s, iki_write_long_file_s); return; } @@ -205,7 +205,7 @@ extern "C" { fll_print_dynamic_raw(f_string_eol_s, main->message.to); } - fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, iki_write_long_object_s); + fll_program_print_error_parameter_missing_value(&main->error, f_console_symbol_long_normal_s, iki_write_long_object_s); return; } @@ -246,7 +246,7 @@ extern "C" { fll_print_dynamic_raw(f_string_eol_s, main->message.to); } - fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, iki_write_long_content_s); + fll_program_print_error_parameter_missing_value(&main->error, f_console_symbol_long_normal_s, iki_write_long_content_s); return; } diff --git a/level_3/iki_write/c/main/common/define.c b/level_3/iki_write/c/main/common/define.c new file mode 100644 index 0000000..192b528 --- /dev/null +++ b/level_3/iki_write/c/main/common/define.c @@ -0,0 +1,9 @@ +#include "../iki_write.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_3/iki_write/c/main/common/define.h b/level_3/iki_write/c/main/common/define.h new file mode 100644 index 0000000..d155120 --- /dev/null +++ b/level_3/iki_write/c/main/common/define.h @@ -0,0 +1,24 @@ +/** + * FLL - Level 3 + * + * Project: IKI Write + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Provides the common define types. + * + * This is auto-included and should not need to be explicitly included. + */ +#ifndef _iki_write_common_define_h +#define _iki_write_common_define_h + +#ifdef __cplusplus +extern "C" { +#endif + + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _iki_write_common_define_h diff --git a/level_3/iki_write/c/main/common/enumeration.c b/level_3/iki_write/c/main/common/enumeration.c new file mode 100644 index 0000000..192b528 --- /dev/null +++ b/level_3/iki_write/c/main/common/enumeration.c @@ -0,0 +1,9 @@ +#include "../iki_write.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_3/iki_write/c/main/common/enumeration.h b/level_3/iki_write/c/main/common/enumeration.h new file mode 100644 index 0000000..e2d80de --- /dev/null +++ b/level_3/iki_write/c/main/common/enumeration.h @@ -0,0 +1,47 @@ +/** + * FLL - Level 3 + * + * Project: IKI Write + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Provides the common enumeration types. + * + * This is auto-included and should not need to be explicitly included. + */ +#ifndef _iki_write_common_enumeration_h +#define _iki_write_common_enumeration_h + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Flags for fine-tuned print control. + * + * iki_write_print_flag_*_e: + * - none: No flags set. + * - debug: Stream is for debug printing. + * - error: Stream is for error printing. + * - message: Stream is for message printing. + * - warning: Stream is for warning printing. + * - file_to: Stream is a destination file. + * - file_from: Stream is a source file. + */ +#ifndef _di_iki_write_print_flag_e_ + enum { + iki_write_print_flag_none_e = 0x0, + iki_write_print_flag_debug_e = 0x1, + iki_write_print_flag_error_e = 0x2, + iki_write_print_flag_message_e = 0x4, + iki_write_print_flag_warning_e = 0x8, + iki_write_print_flag_file_to_e = 0x10, + iki_write_print_flag_file_from_e = 0x20, + }; // enum +#endif // _di_iki_write_print_flag_e_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _iki_write_common_enumeration_h diff --git a/level_3/iki_write/c/main/common/type.h b/level_3/iki_write/c/main/common/type.h index 1b33e1c..489bd79 100644 --- a/level_3/iki_write/c/main/common/type.h +++ b/level_3/iki_write/c/main/common/type.h @@ -169,6 +169,25 @@ extern "C" { } #endif // _di_iki_write_setting_t_ +/** + * The main program data as a single structure. + * + * program: The main program data. + * setting: The settings data. + */ +#ifndef _di_iki_write_main_t_ + typedef struct { + fll_program_data_t program; + iki_write_setting_t setting; + } iki_write_main_t; + + #define iki_write_main_t_initialize \ + { \ + fll_program_data_t_initialize, \ + iki_write_setting_t_initialize, \ + } +#endif // _di_iki_write_main_t_ + #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/iki_write/c/main/iki_write.c b/level_3/iki_write/c/main/iki_write.c index 7484a14..43eb845 100644 --- a/level_3/iki_write/c/main/iki_write.c +++ b/level_3/iki_write/c/main/iki_write.c @@ -23,31 +23,20 @@ extern "C" { setting->state.status = F_none; - if (setting->flag & iki_write_main_flag_help_e) { - iki_write_print_help(setting, main->message); + if (main->setting.flag & (iki_write_main_flag_help_e | iki_write_main_flag_version_e | iki_write_main_flag_copyright_e)) { - if ((setting->flag & iki_write_main_flag_print_last_e) && main->message.verbosity > f_console_verbosity_error_e) { - fll_print_dynamic_raw(f_string_eol_s, main->message.to); + if (main->setting.flag & iki_write_main_flag_help_e) { + iki_write_print_message_help(&main->program.message); } - - return; - } - - if (setting->flag & iki_write_main_flag_version_e) { - fll_program_print_version(main->message, iki_write_program_version_s); - - if ((setting->flag & iki_write_main_flag_print_last_e) && main->message.verbosity > f_console_verbosity_error_e) { - fll_print_dynamic_raw(f_string_eol_s, main->message.to); + else if (main->setting.flag & iki_write_main_flag_version_e) { + fll_program_print_version(&main->program.message, iki_write_program_version_s); + } + else if (main->setting.flag & iki_write_main_flag_copyright_e) { + fll_program_print_copyright(&main->program.message); } - return; - } - - if (setting->flag & iki_write_main_flag_copyright_e) { - fll_program_print_copyright(main->message); - - if ((setting->flag & iki_write_main_flag_print_last_e) && main->message.verbosity > f_console_verbosity_error_e) { - fll_print_dynamic_raw(f_string_eol_s, main->message.to); + if ((main->setting.flag & iki_write_main_flag_print_last_e) && main->program.message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); } return; @@ -74,7 +63,7 @@ extern "C" { do { if (!((++main->signal_check) % iki_write_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { + if (fll_program_standard_signal_received(&main->program)) { setting->state.status = F_status_set_error(F_interrupt); object_ended = F_false; @@ -101,7 +90,7 @@ extern "C" { if (!setting->buffer.used) { setting->state.status = F_status_set_error(F_parameter); - fll_program_print_error_pipe_missing_content(main->error); + fll_program_print_error_pipe_missing_content(&main->error); object_ended = F_false; @@ -129,7 +118,7 @@ extern "C" { if (object_ended && previous == range.start) { setting->state.status = F_status_set_error(F_parameter); - fll_program_print_error_pipe_invalid_form_feed(main->error); + fll_program_print_error_pipe_invalid_form_feed(&main->error); object_ended = F_false; @@ -197,7 +186,7 @@ extern "C" { if (object_ended) { setting->state.status = F_status_set_error(F_parameter); - fll_program_print_error_pipe_object_without_content(main->error); + fll_program_print_error_pipe_object_without_content(&main->error); } } @@ -205,7 +194,7 @@ extern "C" { for (f_array_length_t i = 0; i < setting->objects.used; ++i) { if (!((++main->signal_check) % iki_write_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { + if (fll_program_standard_signal_received(&main->program)) { setting->state.status = F_status_set_error(F_interrupt); break; diff --git a/level_3/iki_write/c/main/iki_write.h b/level_3/iki_write/c/main/iki_write.h index c500730..64aa8ce 100644 --- a/level_3/iki_write/c/main/iki_write.h +++ b/level_3/iki_write/c/main/iki_write.h @@ -51,12 +51,14 @@ #include // IKI Write includes. +#include +#include #include #include #include #include -#include #include +#include #include #ifdef __cplusplus diff --git a/level_3/iki_write/c/main/main.c b/level_3/iki_write/c/main/main.c index bb00457..f79a08d 100644 --- a/level_3/iki_write/c/main/main.c +++ b/level_3/iki_write/c/main/main.c @@ -2,8 +2,17 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { - fll_program_data_t data = fll_program_data_t_initialize; - iki_write_setting_t setting = iki_write_setting_t_initialize; + iki_write_main_t data = iki_write_main_t_initialize; + + data.program.debug.flag |= iki_write_print_flag_debug_e; + data.program.error.flag |= iki_write_print_flag_error_e; + data.program.message.flag |= iki_write_print_flag_message_e; + data.program.warning.flag |= iki_write_print_flag_warning_e; + data.program.message.custom = (void *) &data; + data.program.output.custom = (void *) &data; + data.program.error.custom = (void *) &data; + data.program.warning.custom = (void *) &data; + data.program.debug.custom = (void *) &data; f_console_parameter_t parameters[] = iki_write_console_parameter_t_initialize; data.parameters.array = parameters; diff --git a/level_3/iki_write/c/main/print.c b/level_3/iki_write/c/main/print.c index aab492d..4f5b6fc 100644 --- a/level_3/iki_write/c/main/print.c +++ b/level_3/iki_write/c/main/print.c @@ -5,11 +5,11 @@ extern "C" { #endif #ifndef _di_iki_write_print_help_ - f_status_t iki_write_print_help(iki_write_setting_t * const setting, const fl_print_t print) { + f_status_t iki_write_print_help(fl_print_t * const print) { if (!setting) return F_status_set_error(F_output_not); - f_file_stream_lock(print.to); + f_file_stream_lock(print->to); fll_program_print_help_header(print, iki_write_program_name_long_s, iki_write_program_version_s); @@ -24,7 +24,7 @@ extern "C" { fll_program_print_help_option(print, f_console_standard_short_debug_s, f_console_standard_long_debug_s, f_console_symbol_short_inverse_s, f_console_symbol_long_inverse_s, " Enable debugging, significantly increasing verbosity beyond normal output."); fll_program_print_help_option(print, f_console_standard_short_version_s, f_console_standard_long_version_s, f_console_symbol_short_inverse_s, f_console_symbol_long_inverse_s, " Print only the version number."); - f_print_dynamic_raw(f_string_eol_s, print.to); + f_print_dynamic_raw(f_string_eol_s, print->to); fll_program_print_help_option(print, iki_write_short_backtick_s, iki_write_long_backtick_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "Use backtick for quotes."); fll_program_print_help_option(print, iki_write_short_content_s, iki_write_long_content_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " The Content to write."); @@ -34,23 +34,22 @@ extern "C" { fll_program_print_help_option(print, iki_write_short_single_s, iki_write_long_single_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Use single quotes."); fll_program_print_help_option(print, iki_write_short_wrap_s, iki_write_long_wrap_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Wrap the vocabulary name."); - f_print_dynamic_raw(f_string_eol_s, print.to); - f_print_dynamic_raw(f_string_eol_s, print.to); + f_print_dynamic_raw(f_string_eol_s, print->to); fll_program_print_help_usage(print, iki_write_program_name_s, f_string_empty_s); - fl_print_format("%r %[Notes:%]%r", print.to, f_string_eol_s, print.set->important, print.set->important, f_string_eol_s); - fl_print_format(" This program will accept Object and Content strings to generate an IKI string, such as %[object:\"content\"%].%r", print.to, print.set->notable, print.set->notable, f_string_eol_s); - fl_print_format(" Each Object must have a Content (and each Content must have an Object).%r%r", print.to, f_string_eol_s, f_string_eol_s); + fl_print_format("%r %[Notes:%]%r", print->to, f_string_eol_s, print->set->important, print->set->important, f_string_eol_s); + fl_print_format(" This program will accept Object and Content strings to generate an IKI string, such as %[object:\"content\"%].%r", print->to, print->set->notable, print->set->notable, f_string_eol_s); + fl_print_format(" Each Object must have a Content (and each Content must have an Object).%r%r", print->to, f_string_eol_s, f_string_eol_s); - fl_print_format(" The Object is also called the Vocabulary.%r", print.to, f_string_eol_s); - fl_print_format(" A complete Object and Content set is also called a Variable.%r%r", print.to, f_string_eol_s, f_string_eol_s); + fl_print_format(" The Object is also called the Vocabulary.%r", print->to, f_string_eol_s); + fl_print_format(" A complete Object and Content set is also called a Variable.%r%r", print->to, f_string_eol_s, f_string_eol_s); - fl_print_format(" When piping main to this program, a single form-feed character (\\f) (U+000C) must be used to separate each Object from each Content.%r", print.to, f_string_eol_s); - fl_print_format(" Furthermore, each Object must be followed by a Content.%r", print.to, f_string_eol_s); + fl_print_format(" When piping main to this program, a single form-feed character (\\f) (U+000C) must be used to separate each Object from each Content.%r", print->to, f_string_eol_s); + fl_print_format(" Furthermore, each Object must be followed by a Content.%r", print->to, f_string_eol_s); - f_file_stream_flush(print.to); - f_file_stream_unlock(print.to); + f_file_stream_flush(print->to); + f_file_stream_unlock(print->to); return F_none; } diff --git a/level_3/iki_write/c/main/print.h b/level_3/iki_write/c/main/print.h index b6ae2fe..608c5db 100644 --- a/level_3/iki_write/c/main/print.h +++ b/level_3/iki_write/c/main/print.h @@ -33,7 +33,7 @@ extern "C" { * F_output_not (with error bit) if setting is NULL. */ #ifndef _di_iki_write_print_help_ - extern f_status_t iki_write_print_help(iki_write_setting_t * const setting, const fl_print_t print); + extern f_status_t iki_write_print_help(fl_print_t * const print); #endif // _di_iki_write_print_help_ #ifdef __cplusplus diff --git a/level_3/iki_write/c/main/print/data.c b/level_3/iki_write/c/main/print/data.c new file mode 100644 index 0000000..192b528 --- /dev/null +++ b/level_3/iki_write/c/main/print/data.c @@ -0,0 +1,9 @@ +#include "../iki_write.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_3/iki_write/c/main/print/data.h b/level_3/iki_write/c/main/print/data.h new file mode 100644 index 0000000..80df6dd --- /dev/null +++ b/level_3/iki_write/c/main/print/data.h @@ -0,0 +1,23 @@ +/** + * FLL - Level 3 + * + * Project: IKI Write + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Provides the print error functionality. + * + * This is auto-included and should not need to be explicitly included. + */ +#ifndef _iki_write_print_data_h +#define _iki_write_print_data_h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _iki_write_print_data_h diff --git a/level_3/iki_write/c/main/print/error.c b/level_3/iki_write/c/main/print/error.c index 299637a..32daaad 100644 --- a/level_3/iki_write/c/main/print/error.c +++ b/level_3/iki_write/c/main/print/error.c @@ -5,62 +5,62 @@ extern "C" { #endif #ifndef _di_iki_write_print_error_ - f_status_t iki_write_print_error(iki_write_setting_t * const setting, const fl_print_t print, const f_string_t function) { + f_status_t iki_write_print_error(fl_print_t * const print, const f_string_t function) { - if (!setting) return F_status_set_error(F_output_not); - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; + if (!print) return F_status_set_error(F_output_not); + if (print->verbosity < f_console_verbosity_error_e) return F_output_not; - fll_error_print(*print, F_status_set_fine(setting->state.status), function, fll_error_file_flag_fallback_e); + fll_error_print(print, F_status_set_fine(setting->state.status), function, fll_error_file_flag_fallback_e); return F_none; } #endif // _di_iki_write_print_error_ #ifndef _di_iki_write_print_error_file_ - f_status_t iki_write_print_error_file(iki_write_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) { + f_status_t iki_write_print_error_file(fl_print_t * const print, const f_string_t function, const f_string_static_t name, const f_string_static_t operation, const uint8_t type) { - if (!setting) return F_status_set_error(F_output_not); - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; + if (!print) return F_status_set_error(F_output_not); + if (print->verbosity < f_console_verbosity_error_e) return F_output_not; - fll_error_file_print(*print, F_status_set_fine(setting->state.status), function, fll_error_file_flag_fallback_e, name, operation, type); + fll_error_file_print(print, F_status_set_fine(setting->state.status), function, fll_error_file_flag_fallback_e, name, operation, type); return F_none; } #endif // _di_iki_write_print_error_file_ #ifndef _di_iki_write_print_error_main_missing_ - f_status_t iki_write_print_error_main_missing(iki_write_setting_t * const setting, const fl_print_t print) { + f_status_t iki_write_print_error_main_missing(fl_print_t * const print) { - if (!setting) return F_status_set_error(F_output_not); - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; + if (!print) return F_status_set_error(F_output_not); + if (print->verbosity < f_console_verbosity_error_e) return F_output_not; - f_file_stream_lock(print.to); + 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); - fl_print_format("%[%r%r%]", print.to, print.set->notable, f_console_symbol_long_normal_s, iki_write_long_object_s, print.set->notable); - fl_print_format("%[' and the '%]", print.to, print.set->error, print.set->error); - fl_print_format("%[%r%r%]", print.to, print.set->notable, f_console_symbol_long_normal_s, iki_write_long_content_s, print.set->notable); - fl_print_format("%[' parameters.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s); + fl_print_format("%[%QNo main provided, either pipe the main data or use the '%]", print->to, print->set->error, print->prefix, print->set->error); + fl_print_format("%[%r%r%]", print->to, print->set->notable, f_console_symbol_long_normal_s, iki_write_long_object_s, print->set->notable); + fl_print_format("%[' and the '%]", print->to, print->set->error, print->set->error); + fl_print_format("%[%r%r%]", print->to, print->set->notable, f_console_symbol_long_normal_s, iki_write_long_content_s, print->set->notable); + fl_print_format("%[' parameters.%]%r", print->to, print->set->error, print->set->error, f_string_eol_s); - f_file_stream_unlock(print.to); + f_file_stream_unlock(print->to); return F_none; } #endif // _di_iki_write_print_error_main_missing_ #ifndef _di_iki_write_print_error_object_not_valid_ - f_status_t iki_write_print_error_object_not_valid(iki_write_setting_t * const setting, const fl_print_t print, const f_string_static_t object) { + f_status_t iki_write_print_error_object_not_valid(fl_print_t * const print, const f_string_static_t object) { - if (!setting) return F_status_set_error(F_output_not); - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; + if (!print) return F_status_set_error(F_output_not); + if (print->verbosity < f_console_verbosity_error_e) return F_output_not; - f_file_stream_lock(print.to); + f_file_stream_lock(print->to); - fl_print_format("%[%QThe object '%]", print.to, print.set->error, print.prefix, print.set->error); - fl_print_format("%[%Q%]", print.to, print.set->notable, object, print.set->notable); - fl_print_format("%[' is not a valid IKI Object.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s); + fl_print_format("%[%QThe object '%]", print->to, print->set->error, print->prefix, print->set->error); + fl_print_format("%[%Q%]", print->to, print->set->notable, object, print->set->notable); + fl_print_format("%[' is not a valid IKI Object.%]%r", print->to, print->set->error, print->set->error, f_string_eol_s); - f_file_stream_unlock(print.to); + f_file_stream_unlock(print->to); return F_none; } diff --git a/level_3/iki_write/c/main/print/error.h b/level_3/iki_write/c/main/print/error.h index 1cf70b1..62f76d2 100644 --- a/level_3/iki_write/c/main/print/error.h +++ b/level_3/iki_write/c/main/print/error.h @@ -1,7 +1,7 @@ /** * FLL - Level 3 * - * Project: UTF8 + * Project: IKI Write * API Version: 0.7 * Licenses: lgpl-2.1-or-later * @@ -19,12 +19,10 @@ extern "C" { /** * Print generic error message regarding a function failing in some way. * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. * @param print - * Designates the how and where to print. + * The output structure to print to. + * + * This does not alter print.custom.setting.state.status. * * @return * F_none on success. @@ -35,18 +33,16 @@ extern "C" { * @see fll_error_print() */ #ifndef _di_iki_write_print_error_ - extern f_status_t iki_write_print_error(iki_write_setting_t * const setting, const fl_print_t print, const f_string_t function); + extern f_status_t iki_write_print_error(fl_print_t * const print, const f_string_t function); #endif // _di_iki_write_print_error_ /** * Print file related error or warning messages. * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. * @param print - * Designates how printing is to be performed. + * The output structure to print to. + * + * This does not alter print.custom.setting.state.status. * @param function * The name of the function where the error happened. * Set to 0 to disable. @@ -66,18 +62,16 @@ extern "C" { * @see fll_error_file_print() */ #ifndef _di_iki_write_print_error_file_ - extern f_status_t iki_write_print_error_file(iki_write_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); + extern f_status_t iki_write_print_error_file(fl_print_t * const print, const f_string_t function, const f_string_static_t name, const f_string_static_t operation, const uint8_t type); #endif // _di_iki_write_print_error_file_ /** * Print error message about "main" Object being missing. * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. * @param print - * Designates the how and where to print. + * The output structure to print to. + * + * This does not alter print.custom.setting.state.status. * * @return * F_none on success. @@ -86,18 +80,16 @@ extern "C" { * F_output_not (with error bit) if setting is NULL. */ #ifndef _di_iki_write_print_error_main_missing_ - extern f_status_t iki_write_print_error_main_missing(iki_write_setting_t * const setting, const fl_print_t print); + extern f_status_t iki_write_print_error_main_missing(fl_print_t * const print); #endif // _di_iki_write_print_error_main_missing_ /** * Print error message about an Object not being valid. * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. * @param print - * Designates the how and where to print. + * The output structure to print to. + * + * This does not alter print.custom.setting.state.status. * @param object * The a string representing the object that is missing. * @@ -108,7 +100,7 @@ extern "C" { * F_output_not (with error bit) if setting is NULL. */ #ifndef _di_iki_write_print_error_object_not_valid_ - extern f_status_t iki_write_print_error_object_not_valid(iki_write_setting_t * const setting, const fl_print_t print, const f_string_static_t object); + extern f_status_t iki_write_print_error_object_not_valid(fl_print_t * const print, const f_string_static_t object); #endif // _di_iki_write_print_error_object_not_valid_ #ifdef __cplusplus diff --git a/level_3/iki_write/c/main/print/message.c b/level_3/iki_write/c/main/print/message.c new file mode 100644 index 0000000..192b528 --- /dev/null +++ b/level_3/iki_write/c/main/print/message.c @@ -0,0 +1,9 @@ +#include "../iki_write.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_3/iki_write/c/main/print/message.h b/level_3/iki_write/c/main/print/message.h new file mode 100644 index 0000000..1782622 --- /dev/null +++ b/level_3/iki_write/c/main/print/message.h @@ -0,0 +1,23 @@ +/** + * FLL - Level 3 + * + * Project: IKI Write + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Provides the print error functionality. + * + * This is auto-included and should not need to be explicitly included. + */ +#ifndef _iki_write_print_message_h +#define _iki_write_print_message_h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _iki_write_print_message_h diff --git a/level_3/iki_write/c/main/process.c b/level_3/iki_write/c/main/process.c index 86d7e86..04911da 100644 --- a/level_3/iki_write/c/main/process.c +++ b/level_3/iki_write/c/main/process.c @@ -10,7 +10,7 @@ extern "C" { if (!object.used) { setting->state.status = F_status_set_error(F_failure); - fll_program_print_error_missing_variable_not_zero(main->error, iki_write_object_s); + fll_program_print_error_missing_variable_not_zero(&main->error, iki_write_object_s); return; } diff --git a/level_3/iki_write/data/build/settings b/level_3/iki_write/data/build/settings index da00094..6647d94 100644 --- a/level_3/iki_write/data/build/settings +++ b/level_3/iki_write/data/build/settings @@ -21,11 +21,11 @@ build_libraries-individual -lfll_error -lfll_iki -lfll_print -lfll_program -lfl_ build_libraries-level -lfll_2 -lfll_1 -lfll_0 build_libraries-monolithic -lfll -build_sources_library main/iki_write.c main/common.c main/common/print.c main/common/string.c main/common/type.c main/print.c main/print/error.c main/process.c +build_sources_library main/iki_write.c main/common.c main/common/define.c main/common/enumeration.c main/common/print.c main/common/string.c main/common/type.c main/print/error.c main/print/message.c main/process.c build_sources_program main/main.c -build_sources_headers main/iki_write.h main/common.h main/common/print.h main/common/string.h main/common/type.h main/print.h main/print/error.h main/process.h +build_sources_headers main/iki_write.h main/common.h main/common/define.h main/common/enumeration.h main/common/print.h main/common/string.h main/common/type.h main/print/error.h main/print/message.h main/process.h build_sources_documentation man diff --git a/level_3/status_code/c/fss/main.c b/level_3/status_code/c/fss/main.c index 59737c3..f1768e2 100644 --- a/level_3/status_code/c/fss/main.c +++ b/level_3/status_code/c/fss/main.c @@ -4,38 +4,49 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { - fll_program_data_t data = fll_program_data_t_initialize; - status_code_setting_t setting = status_code_setting_t_initialize; - setting.program_name = &status_code_fss_program_name_s; - setting.program_name_long = &status_code_fss_program_name_long_s; - setting.status_string_from = &fll_fss_status_string_from; - setting.status_string_to = &fll_fss_status_string_to; - setting.status_string_help_detail = &status_code_fss_print_help_detail; + status_code_main_t data = status_code_main_t_initialize; + + data.program.debug.flag |= status_code_print_flag_debug_e; + data.program.error.flag |= status_code_print_flag_error_e; + data.program.message.flag |= status_code_print_flag_message_e; + data.program.warning.flag |= status_code_print_flag_warning_e; + data.program.message.custom = (void *) &data; + data.program.output.custom = (void *) &data; + data.program.error.custom = (void *) &data; + data.program.warning.custom = (void *) &data; + data.program.debug.custom = (void *) &data; + + data.setting.program_name = &status_code_fss_program_name_s; + data.setting.program_name_long = &status_code_fss_program_name_long_s; + data.setting.status_string_from = &fll_fss_status_string_from; + data.setting.status_string_to = &fll_fss_status_string_to; + data.setting.status_string_help_detail = &status_code_fss_print_help_detail; f_console_parameter_t parameters[] = status_code_console_parameter_t_initialize; - data.parameters.array = parameters; - data.parameters.used = status_code_total_parameters_d; - data.environment = envp; + + data.program.parameters.array = parameters; + data.program.parameters.used = status_code_total_parameters_d; + data.program.environment = envp; if (f_pipe_input_exists()) { - data.pipe = fll_program_data_pipe_input_e; + data.program.pipe = fll_program_data_pipe_input_e; } - fll_program_standard_set_up(&data); + fll_program_standard_set_up(&data.program); { const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp); - status_code_setting_load(arguments, &data, &setting); + status_code_setting_load(arguments, &data); } - status_code_main(&data, &setting); + status_code_main(&data); - status_code_setting_unload(&data, &setting); + status_code_setting_unload(&data); - fll_program_data_delete(&data); + fll_program_data_delete(&data.program); - fll_program_standard_set_down(&data); + fll_program_standard_set_down(&data.program); - return (F_status_is_error(setting.state.status) || setting.state.status == F_false) ? 1 : 0; + return (F_status_is_error(data.setting.state.status) || data.setting.state.status == F_false) ? 1 : 0; } diff --git a/level_3/status_code/c/fss/print.c b/level_3/status_code/c/fss/print.c index 82af1fe..de75d8b 100644 --- a/level_3/status_code/c/fss/print.c +++ b/level_3/status_code/c/fss/print.c @@ -7,25 +7,25 @@ extern "C" { #endif #ifndef _di_status_code_fss_print_help_detail_ - f_status_t status_code_fss_print_help_detail(void * const setting, const fl_print_t print) { + f_status_t status_code_fss_print_help_detail(fl_print_t * const print) { - if (!setting) return F_status_set_error(F_output_not); + if (!print) return F_status_set_error(F_output_not); - fl_print_format(" The FLL programs use a %[16-bit unsigned integer%] to represent the return status of programs and functions.%r%r", print.to, print.set->notable, print.set->notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" The FLL programs use a %[16-bit unsigned integer%] to represent the return status of programs and functions.%r%r", print->to, print->set->notable, print->set->notable, f_string_eol_s, f_string_eol_s); - fl_print_format(" Programs may print a generic error with one of these codes.%r", print.to, f_string_eol_s); - fl_print_format(" This is a tool for converting to or converting from these codes.%r%r", print.to, f_string_eol_s, f_string_eol_s); + fl_print_format(" Programs may print a generic error with one of these codes.%r", print->to, f_string_eol_s); + fl_print_format(" This is a tool for converting to or converting from these codes.%r%r", print->to, f_string_eol_s, f_string_eol_s); - fl_print_format(" The %[16-bit unsigned integer%] also has the first two high-order bits used to represent flags.%r", print.to, print.set->notable, print.set->notable, f_string_eol_s); - fl_print_format(" These flags are the %[error%] bit and the %[warning%] bit.%r", print.to, print.set->notable, print.set->notable, print.set->notable, print.set->notable, f_string_eol_s); - fl_print_format(" When neither of these flags are set, then the status is considered %[fine%].%r%r", print.to, print.set->notable, print.set->notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" The %[16-bit unsigned integer%] also has the first two high-order bits used to represent flags.%r", print->to, print->set->notable, print->set->notable, f_string_eol_s); + fl_print_format(" These flags are the %[error%] bit and the %[warning%] bit.%r", print->to, print->set->notable, print->set->notable, print->set->notable, print->set->notable, f_string_eol_s); + fl_print_format(" When neither of these flags are set, then the status is considered %[fine%].%r%r", print->to, print->set->notable, print->set->notable, f_string_eol_s, f_string_eol_s); - fl_print_format(" This operates identical to the %[status_codes%] program except that this program handles additional codes regarding FSS.%r", print.to, print.set->notable, print.set->notable, f_string_eol_s); - fl_print_format(" These special codes numericaly appear after the %[F_status_code_last%] code.%r", print.to, print.set->notable, print.set->notable, f_string_eol_s); - fl_print_format(" These codes stop at the %[F_fss_status_code_last%] code.%r%r", print.to, print.set->notable, print.set->notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" This operates identical to the %[status_codes%] program except that this program handles additional codes regarding FSS.%r", print->to, print->set->notable, print->set->notable, f_string_eol_s); + fl_print_format(" These special codes numericaly appear after the %[F_status_code_last%] code.%r", print->to, print->set->notable, print->set->notable, f_string_eol_s); + fl_print_format(" These codes stop at the %[F_fss_status_code_last%] code.%r%r", print->to, print->set->notable, print->set->notable, f_string_eol_s, f_string_eol_s); - fl_print_format(" Each code will be printed on its own line.%r", print.to, f_string_eol_s); - fl_print_format(" Errors regarding each code may be printed on its own line.%r", print.to, f_string_eol_s); + fl_print_format(" Each code will be printed on its own line.%r", print->to, f_string_eol_s); + fl_print_format(" Errors regarding each code may be printed on its own line.%r", print->to, f_string_eol_s); return F_none; } diff --git a/level_3/status_code/c/fss/print.h b/level_3/status_code/c/fss/print.h index 8f52550..515391d 100644 --- a/level_3/status_code/c/fss/print.h +++ b/level_3/status_code/c/fss/print.h @@ -19,17 +19,14 @@ extern "C" { /** * Print help detailed part of the help for fss_status_code. * - * This is designed to be called from within status_code_print_help(). + * This is designed to be called from within status_code_print_message_help(). * This neither locks nor unlocks the stream and expects the stream to be unlocked. * - * @param setting - * The main program settings. - * (Must be of type status_code_setting_t.) - * - * This does not alter setting.state.status. * @param print * The output structure to print to. * + * This does not alter print.custom.setting.state.status. + * * @return * F_none on success. * F_output_not on success, but no printing is performed. @@ -38,10 +35,10 @@ extern "C" { * * @see fl_print_format() * - * @see status_code_print_help() + * @see status_code_print_message_help() */ #ifndef _di_status_code_fss_print_help_detail_ - extern f_status_t status_code_fss_print_help_detail(void * const setting, const fl_print_t print); + extern f_status_t status_code_fss_print_help_detail(fl_print_t * const print); #endif // _di_status_code_fss_print_help_detail_ #ifdef __cplusplus diff --git a/level_3/status_code/c/fss/status_code.h b/level_3/status_code/c/fss/status_code.h index ff6ff29..8282eea 100644 --- a/level_3/status_code/c/fss/status_code.h +++ b/level_3/status_code/c/fss/status_code.h @@ -42,15 +42,17 @@ #include // Status Code includes. +#include +#include #include #include #include #include #include #include -#include #include #include +#include #include #ifdef __cplusplus diff --git a/level_3/status_code/c/main/common.c b/level_3/status_code/c/main/common.c index 03fbf12..93385bf 100644 --- a/level_3/status_code/c/main/common.c +++ b/level_3/status_code/c/main/common.c @@ -14,37 +14,37 @@ extern "C" { #endif // _di_status_code_setting_delete_ #ifndef _di_status_code_setting_load_ - void status_code_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, status_code_setting_t * const setting) { + void status_code_setting_load(const f_console_arguments_t arguments, status_code_main_t * const main) { - if (!main || !setting) return; + if (!main) return; - setting->state.step_small = status_code_allocation_console_d; + main->setting.state.step_small = status_code_allocation_console_d; - f_console_parameter_process(arguments, &main->parameters, &setting->state, 0); + f_console_parameter_process(arguments, &main->program.parameters, &main->setting.state, 0); - setting->state.step_small = status_code_allocation_small_d; + main->setting.state.step_small = status_code_allocation_small_d; // Identify and pocess first/last parameters. - if (main->parameters.array[status_code_parameter_line_first_no_e].result & f_console_result_found_e) { - setting->flag -= setting->flag & status_code_main_flag_print_first_e; + if (main->program.parameters.array[status_code_parameter_line_first_no_e].result & f_console_result_found_e) { + main->setting.flag -= main->setting.flag & status_code_main_flag_print_first_e; } else { - setting->flag |= status_code_main_flag_print_first_e; + main->setting.flag |= status_code_main_flag_print_first_e; } - if (main->parameters.array[status_code_parameter_line_last_no_e].result & f_console_result_found_e) { - setting->flag -= setting->flag & status_code_main_flag_print_last_e; + if (main->program.parameters.array[status_code_parameter_line_last_no_e].result & f_console_result_found_e) { + main->setting.flag -= main->setting.flag & status_code_main_flag_print_last_e; } else { - setting->flag |= status_code_main_flag_print_last_e; + main->setting.flag |= status_code_main_flag_print_last_e; } - if (F_status_is_error(setting->state.status)) { - if ((setting->flag & status_code_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { - fll_print_dynamic_raw(f_string_eol_s, main->message.to); + if (F_status_is_error(main->setting.state.status)) { + if ((main->setting.flag & status_code_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); } - status_code_print_error(setting, main->error, macro_status_code_f(f_console_parameter_process)); + status_code_print_error(&main->program.error, macro_status_code_f(f_console_parameter_process)); return; } @@ -60,14 +60,14 @@ extern "C" { const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e }; - setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, main); + main->setting.state.status = fll_program_parameter_process_context(choices, modes, F_true, &main->program); - if (F_status_is_error(setting->state.status)) { - if ((setting->flag & status_code_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { - fll_print_dynamic_raw(f_string_eol_s, main->message.to); + if (F_status_is_error(main->setting.state.status)) { + if ((main->setting.flag & status_code_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); } - status_code_print_error(setting, main->error, macro_status_code_f(fll_program_parameter_process_context)); + status_code_print_error(&main->program.error, macro_status_code_f(fll_program_parameter_process_context)); return; } @@ -81,101 +81,101 @@ extern "C" { const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e }; - setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); + main->setting.state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, &main->program); - if (F_status_is_error(setting->state.status)) { - if ((setting->flag & status_code_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { - fll_print_dynamic_raw(f_string_eol_s, main->message.to); + if (F_status_is_error(main->setting.state.status)) { + if ((main->setting.flag & status_code_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); } - status_code_print_error(setting, main->error, macro_status_code_f(fll_program_parameter_process_verbosity)); + status_code_print_error(&main->program.error, macro_status_code_f(fll_program_parameter_process_verbosity)); return; } } - if (main->parameters.array[status_code_parameter_help_e].result & f_console_result_found_e) { - setting->flag |= status_code_main_flag_help_e; + if (main->program.parameters.array[status_code_parameter_help_e].result & f_console_result_found_e) { + main->setting.flag |= status_code_main_flag_help_e; return; } - if (main->parameters.array[status_code_parameter_version_e].result & f_console_result_found_e) { - setting->flag |= status_code_main_flag_version_e; + if (main->program.parameters.array[status_code_parameter_version_e].result & f_console_result_found_e) { + main->setting.flag |= status_code_main_flag_version_e; return; } - if (main->parameters.array[status_code_parameter_copyright_e].result & f_console_result_found_e) { - setting->flag |= status_code_main_flag_copyright_e; + if (main->program.parameters.array[status_code_parameter_copyright_e].result & f_console_result_found_e) { + main->setting.flag |= status_code_main_flag_copyright_e; return; } } - if (main->parameters.array[status_code_parameter_error_e].result & f_console_result_found_e) { - setting->flag |= status_code_main_flag_error_e; + if (main->program.parameters.array[status_code_parameter_error_e].result & f_console_result_found_e) { + main->setting.flag |= status_code_main_flag_error_e; } - if (main->parameters.array[status_code_parameter_fine_e].result & f_console_result_found_e) { - setting->flag |= status_code_main_flag_fine_e; + if (main->program.parameters.array[status_code_parameter_fine_e].result & f_console_result_found_e) { + main->setting.flag |= status_code_main_flag_fine_e; } - if (main->parameters.array[status_code_parameter_warning_e].result & f_console_result_found_e) { - setting->flag |= status_code_main_flag_warning_e; + if (main->program.parameters.array[status_code_parameter_warning_e].result & f_console_result_found_e) { + main->setting.flag |= status_code_main_flag_warning_e; } - if (main->parameters.array[status_code_parameter_number_e].result & f_console_result_found_e) { - setting->flag |= status_code_main_flag_number_e; + if (main->program.parameters.array[status_code_parameter_number_e].result & f_console_result_found_e) { + main->setting.flag |= status_code_main_flag_number_e; } - if (setting->flag & status_code_main_flag_error_e) { - if (setting->flag & status_code_main_flag_warning_e) { - if (!(setting->flag & status_code_main_flag_number_e)) { - setting->state.status = F_status_set_error(F_parameter); + if (main->setting.flag & status_code_main_flag_error_e) { + if (main->setting.flag & status_code_main_flag_warning_e) { + if (!(main->setting.flag & status_code_main_flag_number_e)) { + main->setting.state.status = F_status_set_error(F_parameter); - if ((setting->flag & status_code_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { - fll_print_dynamic_raw(f_string_eol_s, main->message.to); + if ((main->setting.flag & status_code_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); } - status_code_print_error_cannot_error_warning_number(setting, main->error); + status_code_print_error_cannot_error_warning_number(&main->program.error); return; } } - if (setting->flag & status_code_main_flag_fine_e) { - setting->state.status = F_status_set_error(F_parameter); + if (main->setting.flag & status_code_main_flag_fine_e) { + main->setting.state.status = F_status_set_error(F_parameter); - if ((setting->flag & status_code_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { - fll_print_dynamic_raw(f_string_eol_s, main->message.to); + if ((main->setting.flag & status_code_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); } - fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, status_code_long_error_s, status_code_long_fine_s); + fll_program_print_error_parameter_cannot_use_with(&main->program.error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, status_code_long_error_s, status_code_long_fine_s); return; } } - else if (setting->flag & status_code_main_flag_warning_e && setting->flag & status_code_main_flag_fine_e) { - setting->state.status = F_status_set_error(F_parameter); + else if (main->setting.flag & status_code_main_flag_warning_e && main->setting.flag & status_code_main_flag_fine_e) { + main->setting.state.status = F_status_set_error(F_parameter); - if ((setting->flag & status_code_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { - fll_print_dynamic_raw(f_string_eol_s, main->message.to); + if ((main->setting.flag & status_code_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); } - fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, status_code_long_warning_s, status_code_long_fine_s); + fll_program_print_error_parameter_cannot_use_with(&main->program.error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, status_code_long_warning_s, status_code_long_fine_s); return; } - if (main->parameters.remaining.used == 0 && !(main->pipe & fll_program_data_pipe_input_e)) { - setting->state.status = F_status_set_error(F_parameter); + if (main->program.parameters.remaining.used == 0 && !(main->program.pipe & fll_program_data_pipe_input_e)) { + main->setting.state.status = F_status_set_error(F_parameter); - if ((setting->flag & status_code_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { - fll_print_dynamic_raw(f_string_eol_s, main->message.to); + if ((main->setting.flag & status_code_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); } - status_code_print_error_no_status_codes(setting, main->error); + status_code_print_error_no_status_codes(&main->program.error); return; } diff --git a/level_3/status_code/c/main/common.h b/level_3/status_code/c/main/common.h index 04eba7c..d014341 100644 --- a/level_3/status_code/c/main/common.h +++ b/level_3/status_code/c/main/common.h @@ -43,9 +43,7 @@ extern "C" { * @param arguments * The parameters passed to the process (often referred to as command line arguments). * @param main - * The main program data. - * @param setting - * The main program settings. + * The main program and settings data. * * This alters setting.state.status: * F_none on success. @@ -57,7 +55,7 @@ extern "C" { * @see fll_program_parameter_process_context() */ #ifndef _di_status_code_setting_load_ - extern void status_code_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, status_code_setting_t * const setting); + extern void status_code_setting_load(const f_console_arguments_t arguments, status_code_main_t * const main); #endif // _di_status_code_setting_load_ /** diff --git a/level_3/status_code/c/main/common/define.c b/level_3/status_code/c/main/common/define.c new file mode 100644 index 0000000..4c41666 --- /dev/null +++ b/level_3/status_code/c/main/common/define.c @@ -0,0 +1,9 @@ +#include "../status_code.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_3/status_code/c/main/common/define.h b/level_3/status_code/c/main/common/define.h new file mode 100644 index 0000000..573bb10 --- /dev/null +++ b/level_3/status_code/c/main/common/define.h @@ -0,0 +1,39 @@ +/** + * FLL - Level 3 + * + * Project: Status Code + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Provides the common define types. + * + * This is auto-included and should not need to be explicitly included. + */ +#ifndef _status_code_common_define_h +#define _status_code_common_define_h + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * The program defines. + * + * status_code_*: + * - allocation_console: An allocation step used for small buffers specifically for console parameter. + * - allocation_large: An allocation step used for buffers that are anticipated to have large buffers. + * - allocation_small: An allocation step used for buffers that are anticipated to have small buffers. + * - signal_check: Number of iterations before performing signal check in non-threaded signal handling. + */ +#ifndef _di_status_code_d_ + #define status_code_allocation_console_d 4 + #define status_code_allocation_large_d 256 + #define status_code_allocation_small_d 16 + #define status_code_signal_check_d 20000 +#endif // _di_status_code_d_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _status_code_common_define_h diff --git a/level_3/status_code/c/main/common/enumeration.c b/level_3/status_code/c/main/common/enumeration.c new file mode 100644 index 0000000..4c41666 --- /dev/null +++ b/level_3/status_code/c/main/common/enumeration.c @@ -0,0 +1,9 @@ +#include "../status_code.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_3/status_code/c/main/common/enumeration.h b/level_3/status_code/c/main/common/enumeration.h new file mode 100644 index 0000000..ecba561 --- /dev/null +++ b/level_3/status_code/c/main/common/enumeration.h @@ -0,0 +1,129 @@ +/** + * FLL - Level 3 + * + * Project: Status Code + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Provides the common enumeration types. + * + * This is auto-included and should not need to be explicitly included. + */ +#ifndef _status_code_common_enumeration_h +#define _status_code_common_enumeration_h + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Flags passed to the main function or program. + * + * When number mode is not specified, then mode is "string" mode (there is no flag for "string" mode). + * + * status_code_main_flag_*_e: + * - none: No flags set. + * - copyright: Print copyright. + * - error: Check if status is "error". + * - fine: Check if status is "fine". + * - help: Print help. + * - number: Operate in number mode. + * - print_first: When set, print new line to message output on program begin after loading settings. + * - print_last: When set, print new line to message output on program end. + * - version: Print version. + * - warning: Check if status is "warning". + */ +#ifndef _di_status_code_main_flag_e_ + enum { + status_code_main_flag_none_e = 0x0, + status_code_main_flag_copyright_e = 0x1, + status_code_main_flag_error_e = 0x2, + status_code_main_flag_fine_e = 0x4, + status_code_main_flag_help_e = 0x8, + status_code_main_flag_number_e = 0x10, + status_code_main_flag_print_first_e = 0x20, + status_code_main_flag_print_last_e = 0x40, + status_code_main_flag_version_e = 0x80, + status_code_main_flag_warning_e = 0x100, + }; // enum +#endif // _di_status_code_main_flag_e_ + +/** + * The main program parameters. + */ +#ifndef _di_status_code_parameter_e_ + enum { + status_code_parameter_help_e, + status_code_parameter_copyright_e, + status_code_parameter_light_e, + status_code_parameter_dark_e, + status_code_parameter_no_color_e, + status_code_parameter_verbosity_quiet_e, + status_code_parameter_verbosity_error_e, + status_code_parameter_verbosity_normal_e, + status_code_parameter_verbosity_verbose_e, + status_code_parameter_verbosity_debug_e, + status_code_parameter_version_e, + status_code_parameter_line_first_no_e, + status_code_parameter_line_last_no_e, + + status_code_parameter_fine_e, + status_code_parameter_warning_e, + status_code_parameter_error_e, + status_code_parameter_number_e, + }; // enum + + #define status_code_console_parameter_t_initialize \ + { \ + macro_f_console_parameter_t_initialize_3(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_3(f_console_standard_short_copyright_s, f_console_standard_long_copyright_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_3(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_3(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_3(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_3(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_3(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_3(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_3(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_3(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_3(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \ + \ + macro_f_console_parameter_t_initialize_3(status_code_short_fine_s, status_code_long_fine_s, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_3(status_code_short_warning_s, status_code_long_warning_s, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_3(status_code_short_error_s, status_code_long_error_s, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_3(status_code_short_number_s, status_code_long_number_s, 0, f_console_flag_normal_e), \ + } + + #define status_code_total_parameters_d 17 +#endif // _di_status_code_parameter_e_ + +/** + * Flags for fine-tuned print control. + * + * status_code_print_flag_*_e: + * - none: No flags set. + * - debug: Stream is for debug printing. + * - error: Stream is for error printing. + * - message: Stream is for message printing. + * - warning: Stream is for warning printing. + * - file_to: Stream is a destination file. + * - file_from: Stream is a source file. + */ +#ifndef _di_status_code_print_flag_e_ + enum { + status_code_print_flag_none_e = 0x0, + status_code_print_flag_debug_e = 0x1, + status_code_print_flag_error_e = 0x2, + status_code_print_flag_message_e = 0x4, + status_code_print_flag_warning_e = 0x8, + status_code_print_flag_file_to_e = 0x10, + status_code_print_flag_file_from_e = 0x20, + }; // enum +#endif // _di_status_code_print_flag_e_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _status_code_common_enumeration_h diff --git a/level_3/status_code/c/main/common/type.h b/level_3/status_code/c/main/common/type.h index 264e60c..ee2bbff 100644 --- a/level_3/status_code/c/main/common/type.h +++ b/level_3/status_code/c/main/common/type.h @@ -17,111 +17,6 @@ extern "C" { #endif /** - * The program defines. - * - * status_code_*: - * - allocation_console: An allocation step used for small buffers specifically for console parameter. - * - allocation_large: An allocation step used for buffers that are anticipated to have large buffers. - * - allocation_small: An allocation step used for buffers that are anticipated to have small buffers. - * - signal_check: Number of iterations before performing signal check in non-threaded signal handling. - * - * macro_status_code_setting: - * - Used to represent a cast to ((status_code_setting_t *) setting). - * - Simplifies the number of parenthesis used to make code slightly cleaner. - * - Is wrapped in a parenthesis and not a block. - */ -#ifndef _di_status_code_d_ - #define status_code_allocation_console_d 4 - #define status_code_allocation_large_d 256 - #define status_code_allocation_small_d 16 - #define status_code_signal_check_d 20000 - - #define macro_status_code_setting(setting) ((status_code_setting_t *) setting) -#endif // _di_status_code_d_ - -/** - * Flags passed to the main function or program. - * - * When number mode is not specified, then mode is "string" mode (there is no flag for "string" mode). - * - * status_code_main_flag_*_e: - * - none: No flags set. - * - copyright: Print copyright. - * - error: Check if status is "error". - * - fine: Check if status is "fine". - * - help: Print help. - * - number: Operate in number mode. - * - print_first: When set, print new line to message output on program begin after loading settings. - * - print_last: When set, print new line to message output on program end. - * - version: Print version. - * - warning: Check if status is "warning". - */ -#ifndef _di_status_code_main_flag_e_ - enum { - status_code_main_flag_none_e = 0x0, - status_code_main_flag_copyright_e = 0x1, - status_code_main_flag_error_e = 0x2, - status_code_main_flag_fine_e = 0x4, - status_code_main_flag_help_e = 0x8, - status_code_main_flag_number_e = 0x10, - status_code_main_flag_print_first_e = 0x20, - status_code_main_flag_print_last_e = 0x40, - status_code_main_flag_version_e = 0x80, - status_code_main_flag_warning_e = 0x100, - }; // enum -#endif // _di_status_code_main_flag_e_ - -/** - * The main program parameters. - */ -#ifndef _di_status_code_parameter_e_ - enum { - status_code_parameter_help_e, - status_code_parameter_copyright_e, - status_code_parameter_light_e, - status_code_parameter_dark_e, - status_code_parameter_no_color_e, - status_code_parameter_verbosity_quiet_e, - status_code_parameter_verbosity_error_e, - status_code_parameter_verbosity_normal_e, - status_code_parameter_verbosity_verbose_e, - status_code_parameter_verbosity_debug_e, - status_code_parameter_version_e, - status_code_parameter_line_first_no_e, - status_code_parameter_line_last_no_e, - - status_code_parameter_fine_e, - status_code_parameter_warning_e, - status_code_parameter_error_e, - status_code_parameter_number_e, - }; // enum - - #define status_code_console_parameter_t_initialize \ - { \ - macro_f_console_parameter_t_initialize_3(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize_3(f_console_standard_short_copyright_s, f_console_standard_long_copyright_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize_3(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize_3(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize_3(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize_3(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize_3(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize_3(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize_3(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize_3(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize_3(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \ - \ - macro_f_console_parameter_t_initialize_3(status_code_short_fine_s, status_code_long_fine_s, 0, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize_3(status_code_short_warning_s, status_code_long_warning_s, 0, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize_3(status_code_short_error_s, status_code_long_error_s, 0, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize_3(status_code_short_number_s, status_code_long_number_s, 0, f_console_flag_normal_e), \ - } - - #define status_code_total_parameters_d 17 -#endif // _di_status_code_parameter_e_ - -/** * The status code main program settings. * * This is passed to the program-specific main entry point to designate program settings. @@ -133,7 +28,7 @@ extern "C" { * * status_string_from: A pointer to the status string function (usually either fll_status_string_from() or fll_fss_status_string_from()). * status_string_to: A pointer to the status string function (usually either f_status_string_to() or fll_fss_status_string_to()). - * status_string_help_detail: Print additional, more detailed help, in the help page (The setting paramete must be of type status_code_setting_t). + * status_string_help_detail: Print additional, more detailed help, in the help page. */ #ifndef _di_status_code_setting_t_ typedef struct { @@ -146,7 +41,7 @@ extern "C" { f_status_t (*status_string_from)(const f_string_static_t name, f_status_t * const code); f_status_t (*status_string_to)(const f_status_t code, f_string_static_t * const name); - f_status_t (*status_string_help_detail)(void * const setting, const fl_print_t print); + f_status_t (*status_string_help_detail)(fl_print_t * const print); } status_code_setting_t; #define status_code_setting_t_initialize \ @@ -161,6 +56,25 @@ extern "C" { } #endif // _di_status_code_setting_t_ +/** + * The main program data as a single structure. + * + * program: The main program data. + * setting: The settings data. + */ +#ifndef _di_status_code_main_t_ + typedef struct { + fll_program_data_t program; + status_code_setting_t setting; + } status_code_main_t; + + #define status_code_main_t_initialize \ + { \ + fll_program_data_t_initialize, \ + status_code_setting_t_initialize, \ + } +#endif // _di_status_code_main_t_ + #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/status_code/c/main/convert.c b/level_3/status_code/c/main/convert.c index 2a45068..671cda3 100644 --- a/level_3/status_code/c/main/convert.c +++ b/level_3/status_code/c/main/convert.c @@ -5,30 +5,30 @@ extern "C" { #endif #ifndef _di_status_code_convert_number_ - void status_code_convert_number(fll_program_data_t * const main, status_code_setting_t * const setting, const f_string_static_t value, f_number_unsigned_t *number) { + void status_code_convert_number(status_code_main_t * const main, const f_string_static_t value, f_number_unsigned_t *number) { - if (!main || !setting) return; + if (!main) return; - setting->state.status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, value, number); + main->setting.state.status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, value, number); if (*number > F_status_size_max_with_bits_d) { - status_code_print_data_context_value(setting, main->output, main->context.set.error, status_code_out_of_range_s); + status_code_print_data_context_value(&main->program.output, main->program.context.set.error, status_code_out_of_range_s); - setting->state.status = F_status_set_error(F_number_overflow); + main->setting.state.status = F_status_set_error(F_number_overflow); return; } - if (F_status_is_error(setting->state.status)) { - if (F_status_set_fine(setting->state.status) == F_number_negative) { - status_code_print_data_context_value(setting, main->output, main->context.set.error, status_code_out_of_range_s); + if (F_status_is_error(main->setting.state.status)) { + if (F_status_set_fine(main->setting.state.status) == F_number_negative) { + status_code_print_data_context_value(&main->program.output, main->program.context.set.error, status_code_out_of_range_s); } else { - status_code_print_data_context_value(setting, main->output, main->context.set.error, status_code_invalid_number_s); + status_code_print_data_context_value(&main->program.output, main->program.context.set.error, status_code_invalid_number_s); } } else { - setting->state.status = F_none; + main->setting.state.status = F_none; } } #endif // _di_status_code_convert_number_ diff --git a/level_3/status_code/c/main/convert.h b/level_3/status_code/c/main/convert.h index f4bfc09..5467626 100644 --- a/level_3/status_code/c/main/convert.h +++ b/level_3/status_code/c/main/convert.h @@ -41,7 +41,7 @@ extern "C" { * @see fl_console_parameter_to_number_unsigned() */ #ifndef _di_status_code_convert_number_ - extern void status_code_convert_number(fll_program_data_t * const main, status_code_setting_t * const setting, const f_string_static_t value, f_number_unsigned_t *number); + extern void status_code_convert_number(status_code_main_t * const main, const f_string_static_t value, f_number_unsigned_t *number); #endif // _di_status_code_convert_number_ #ifdef __cplusplus diff --git a/level_3/status_code/c/main/main.c b/level_3/status_code/c/main/main.c index 185ea77..fcd6b5d 100644 --- a/level_3/status_code/c/main/main.c +++ b/level_3/status_code/c/main/main.c @@ -2,38 +2,49 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { - fll_program_data_t data = fll_program_data_t_initialize; - status_code_setting_t setting = status_code_setting_t_initialize; - setting.program_name = &status_code_program_name_s; - setting.program_name_long = &status_code_program_name_long_s; - setting.status_string_from = &fll_status_string_from; - setting.status_string_to = &f_status_string_to; - setting.status_string_help_detail = &status_code_print_help_detail; + status_code_main_t data = status_code_main_t_initialize; + + data.program.debug.flag |= status_code_print_flag_debug_e; + data.program.error.flag |= status_code_print_flag_error_e; + data.program.message.flag |= status_code_print_flag_message_e; + data.program.warning.flag |= status_code_print_flag_warning_e; + data.program.message.custom = (void *) &data; + data.program.output.custom = (void *) &data; + data.program.error.custom = (void *) &data; + data.program.warning.custom = (void *) &data; + data.program.debug.custom = (void *) &data; + + data.setting.program_name = &status_code_program_name_s; + data.setting.program_name_long = &status_code_program_name_long_s; + data.setting.status_string_from = &fll_status_string_from; + data.setting.status_string_to = &f_status_string_to; + data.setting.status_string_help_detail = &status_code_print_message_help_detail; f_console_parameter_t parameters[] = status_code_console_parameter_t_initialize; - data.parameters.array = parameters; - data.parameters.used = status_code_total_parameters_d; - data.environment = envp; + + data.program.parameters.array = parameters; + data.program.parameters.used = status_code_total_parameters_d; + data.program.environment = envp; if (f_pipe_input_exists()) { - data.pipe = fll_program_data_pipe_input_e; + data.program.pipe = fll_program_data_pipe_input_e; } - fll_program_standard_set_up(&data); + fll_program_standard_set_up(&data.program); { const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp); - status_code_setting_load(arguments, &data, &setting); + status_code_setting_load(arguments, &data); } - status_code_main(&data, &setting); + status_code_main(&data); - status_code_setting_unload(&data, &setting); + status_code_setting_unload(&data); - fll_program_data_delete(&data); + fll_program_data_delete(&data.program); - fll_program_standard_set_down(&data); + fll_program_standard_set_down(&data.program); - return (F_status_is_error(setting.state.status) || setting.state.status == F_false) ? 1 : 0; + return (F_status_is_error(data.setting.state.status) || data.setting.state.status == F_false) ? 1 : 0; } diff --git a/level_3/status_code/c/main/print/data.c b/level_3/status_code/c/main/print/data.c index b2e3319..a89da43 100644 --- a/level_3/status_code/c/main/print/data.c +++ b/level_3/status_code/c/main/print/data.c @@ -5,24 +5,24 @@ extern "C" { #endif #ifndef _di_status_code_print_data_code_ - f_status_t status_code_print_data_code(status_code_setting_t * const setting, const fl_print_t print, const uint16_t code) { + f_status_t status_code_print_data_code(fl_print_t * const print, const uint16_t code) { - if (!setting) return F_status_set_error(F_output_not); - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; + if (!print) return F_status_set_error(F_output_not); + if (print->verbosity < f_console_verbosity_normal_e) return F_output_not; - fll_print_format("%ui%r", print.to, code, f_string_eol_s); + fll_print_format("%ui%r", print->to, code, f_string_eol_s); return F_none; } #endif // _di_status_code_print_data_code_ #ifndef _di_status_code_print_data_context_value_ - f_status_t status_code_print_data_context_value(status_code_setting_t * const setting, const fl_print_t print, const f_color_set_t context, const f_string_static_t value) { + f_status_t status_code_print_data_context_value(fl_print_t * const print, const f_color_set_t context, const f_string_static_t value) { - if (!setting) return F_status_set_error(F_output_not); - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; + if (!print) return F_status_set_error(F_output_not); + if (print->verbosity < f_console_verbosity_normal_e) return F_output_not; - fll_print_format("%[%Q%]%r", print.to, context, value, context, f_string_eol_s); + fll_print_format("%[%Q%]%r", print->to, context, value, context, f_string_eol_s); return F_none; } diff --git a/level_3/status_code/c/main/print/data.h b/level_3/status_code/c/main/print/data.h index 4f3cae3..aabd9a9 100644 --- a/level_3/status_code/c/main/print/data.h +++ b/level_3/status_code/c/main/print/data.h @@ -19,12 +19,10 @@ extern "C" { /** * Print generic code. * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. * @param print - * Designates the how and where to print. + * The output structure to print to. + * + * This does not alter print.custom.setting.state.status. * @param code * The code to print. * @@ -37,18 +35,16 @@ extern "C" { * @see fll_print_format() */ #ifndef _di_status_code_print_data_code_ - extern f_status_t status_code_print_data_code(status_code_setting_t * const setting, const fl_print_t print, const uint16_t code); + extern f_status_t status_code_print_data_code(fl_print_t * const print, const uint16_t code); #endif // _di_status_code_print_data_code_ /** * Print generic context wrapped value. * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. * @param print - * Designates the how and where to print. + * The output structure to print to. + * + * This does not alter print.custom.setting.state.status. * @param context * The context string to wrap the variable with. * @param value @@ -63,7 +59,7 @@ extern "C" { * @see fll_print_format() */ #ifndef _di_status_code_print_data_context_value_ - extern f_status_t status_code_print_data_context_value(status_code_setting_t * const setting, const fl_print_t print, const f_color_set_t context, const f_string_static_t value); + extern f_status_t status_code_print_data_context_value(fl_print_t * const print, const f_color_set_t context, const f_string_static_t value); #endif // _di_status_code_print_data_context_value_ #ifdef __cplusplus diff --git a/level_3/status_code/c/main/print/error.c b/level_3/status_code/c/main/print/error.c index 1f0e3e6..aaa50d4 100644 --- a/level_3/status_code/c/main/print/error.c +++ b/level_3/status_code/c/main/print/error.c @@ -5,64 +5,66 @@ extern "C" { #endif #ifndef _di_status_code_print_error_ - f_status_t status_code_print_error(status_code_setting_t * const setting, const fl_print_t print, const f_string_t function) { + f_status_t status_code_print_error(fl_print_t * const print, const f_string_t function) { - if (!setting) return F_status_set_error(F_output_not); - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; + if (!print || !print->custom) return F_status_set_error(F_output_not); + if (print->verbosity < f_console_verbosity_error_e) return F_output_not; - fll_error_print(*print, F_status_set_fine(setting->state.status), function, fll_error_file_flag_fallback_e); + status_code_main_t * const main = (status_code_main_t *) print->custom; + + fll_error_print(print, F_status_set_fine(main->setting.state.status), function, fll_error_file_flag_fallback_e); return F_none; } #endif // _di_status_code_print_error_ #ifndef _di_status_code_print_error_cannot_error_warning_number_ - f_status_t status_code_print_error_cannot_error_warning_number(status_code_setting_t * const setting, const fl_print_t print) { + f_status_t status_code_print_error_cannot_error_warning_number(fl_print_t * const print) { - if (!setting) return F_status_set_error(F_output_not); - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; + if (!print) return F_status_set_error(F_output_not); + if (print->verbosity < f_console_verbosity_error_e) return F_output_not; - f_file_stream_lock(print.to); + f_file_stream_lock(print->to); - fl_print_format("%[%QCannot specify the '%]", print.to, print.context, print.prefix, print.context); - fl_print_format("%[%r%r%]", print.to, print.notable, f_console_symbol_long_normal_s, status_code_long_error_s, print.notable); - fl_print_format("%[' parameter with the '%]", print.to, print.context, print.context); - fl_print_format("%[%r%r%]", print.to, print.notable, f_console_symbol_long_normal_s, status_code_long_warning_s, print.notable); - fl_print_format("%[' parameter when not also specifying the '%]", print.to, print.context, print.context); - fl_print_format("%[%r%r%]", print.to, print.notable, f_console_symbol_long_normal_s, status_code_long_number_s, print.notable); - fl_print_format("%[' parameter.%]%r", print.to, print.context, print.context, f_string_eol_s); + fl_print_format("%[%QCannot specify the '%]", print->to, print->context, print->prefix, print->context); + fl_print_format("%[%r%r%]", print->to, print->notable, f_console_symbol_long_normal_s, status_code_long_error_s, print->notable); + fl_print_format("%[' parameter with the '%]", print->to, print->context, print->context); + fl_print_format("%[%r%r%]", print->to, print->notable, f_console_symbol_long_normal_s, status_code_long_warning_s, print->notable); + fl_print_format("%[' parameter when not also specifying the '%]", print->to, print->context, print->context); + fl_print_format("%[%r%r%]", print->to, print->notable, f_console_symbol_long_normal_s, status_code_long_number_s, print->notable); + fl_print_format("%[' parameter.%]%r", print->to, print->context, print->context, f_string_eol_s); - f_file_stream_unlock(print.to); + f_file_stream_unlock(print->to); return F_none; } #endif // _di_status_code_print_error_cannot_error_warning_number_ #ifndef _di_status_code_print_error_no_status_codes_ - f_status_t status_code_print_error_no_status_codes(status_code_setting_t * const setting, const fl_print_t print) { + f_status_t status_code_print_error_no_status_codes(fl_print_t * const print) { - if (!setting) return F_status_set_error(F_output_not); - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; + if (!print) return F_status_set_error(F_output_not); + 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); + fll_print_format("%[No status code is specified.%]%r", print->to, print->context, print->context, f_string_eol_s); return F_none; } #endif // _di_status_code_print_error_no_status_codes_ #ifndef _di_status_code_print_error_invalid_callback_ - f_status_t status_code_print_error_invalid_callback(status_code_setting_t * const setting, const fl_print_t print, const f_string_t name) { + f_status_t status_code_print_error_invalid_callback(fl_print_t * const print, const f_string_t name) { - if (!setting) return F_status_set_error(F_output_not); - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; + if (!print) return F_status_set_error(F_output_not); + if (print->verbosity < f_console_verbosity_error_e) return F_output_not; - f_file_stream_lock(print.to); + f_file_stream_lock(print->to); - fl_print_format("%[%QInvalid callback specified for '%]", print.to, print.context, print.prefix, print.context); - fl_print_format("%[%s%]", print.to, print.notable, name, print.notable); - fl_print_format("%[' internal setting.%]%r", print.to, print.context, print.context, f_string_eol_s); + fl_print_format("%[%QInvalid callback specified for '%]", print->to, print->context, print->prefix, print->context); + fl_print_format("%[%s%]", print->to, print->notable, name, print->notable); + fl_print_format("%[' internal setting.%]%r", print->to, print->context, print->context, f_string_eol_s); - f_file_stream_unlock(print.to); + f_file_stream_unlock(print->to); return F_none; } diff --git a/level_3/status_code/c/main/print/error.h b/level_3/status_code/c/main/print/error.h index 184701c..c94298b 100644 --- a/level_3/status_code/c/main/print/error.h +++ b/level_3/status_code/c/main/print/error.h @@ -19,12 +19,10 @@ extern "C" { /** * Print generic error message regarding a function failing in some way. * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. * @param print - * Designates the how and where to print. + * The output structure to print to. + * + * This does not alter print.custom.setting.state.status. * * @return * F_none on success. @@ -35,18 +33,16 @@ extern "C" { * @see fll_error_print() */ #ifndef _di_status_code_print_error_ - extern f_status_t status_code_print_error(status_code_setting_t * const setting, const fl_print_t print, const f_string_t function); + extern f_status_t status_code_print_error(fl_print_t * const print, const f_string_t function); #endif // _di_status_code_print_error_ /** * Print an error message when error parameter and warning parameter are specified without number parameter. * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. * @param print - * Designates the how and where to print. + * The output structure to print to. + * + * This does not alter print.custom.setting.state.status. * * @return * F_none on success. @@ -59,18 +55,16 @@ extern "C" { * @see fl_print_format() */ #ifndef _di_status_code_print_error_cannot_error_warning_number_ - extern f_status_t status_code_print_error_cannot_error_warning_number(status_code_setting_t * const setting, const fl_print_t print); + extern f_status_t status_code_print_error_cannot_error_warning_number(fl_print_t * const print); #endif // _di_status_code_print_error_cannot_error_warning_number_ /** * Print an error message when no status codes are provided. * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. * @param print - * Designates the how and where to print. + * The output structure to print to. + * + * This does not alter print.custom.setting.state.status. * * @return * F_none on success. @@ -81,18 +75,16 @@ extern "C" { * @see fll_print_format() */ #ifndef _di_status_code_print_error_no_status_codes_ - extern f_status_t status_code_print_error_no_status_codes(status_code_setting_t * const setting, const fl_print_t print); + extern f_status_t status_code_print_error_no_status_codes(fl_print_t * const print); #endif // _di_status_code_print_error_no_status_codes_ /** * Print an error message when a callback from status_code_setting_t is invalid. * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. * @param print - * Designates the how and where to print. + * The output structure to print to. + * + * This does not alter print.custom.setting.state.status. * @param name * The name of the callback setting that is invalid. * This should either be 'status_string_from' or 'status_string_to'. @@ -108,7 +100,7 @@ extern "C" { * @see fl_print_format() */ #ifndef _di_status_code_print_error_invalid_callback_ - extern f_status_t status_code_print_error_invalid_callback(status_code_setting_t * const setting, const fl_print_t print, const f_string_t name); + extern f_status_t status_code_print_error_invalid_callback(fl_print_t * const print, const f_string_t name); #endif // _di_status_code_print_error_invalid_callback_ #ifdef __cplusplus diff --git a/level_3/status_code/c/main/print.c b/level_3/status_code/c/main/print/message.c similarity index 54% rename from level_3/status_code/c/main/print.c rename to level_3/status_code/c/main/print/message.c index a319c37..34412a4 100644 --- a/level_3/status_code/c/main/print.c +++ b/level_3/status_code/c/main/print/message.c @@ -1,77 +1,78 @@ -#include "status_code.h" +#include "../status_code.h" #ifdef __cplusplus extern "C" { #endif -#ifndef _di_status_code_print_help_ - f_status_t status_code_print_help(status_code_setting_t * const setting, const fl_print_t print) { +#ifndef _di_status_code_print_message_help_ + f_status_t status_code_print_message_help(fl_print_t * const print) { - if (!setting) return F_status_set_error(F_output_not); + if (!print || !print->custom) return F_status_set_error(F_output_not); - f_file_stream_lock(print.to); + status_code_main_t * const main = (status_code_main_t *) print->custom; + + f_file_stream_lock(print->to); fll_program_print_help_header( print, - setting->program_name_long - ? *setting->program_name_long + main->setting.program_name_long + ? *main->setting.program_name_long : status_code_program_name_long_s, status_code_program_version_s ); fll_program_print_help_option_standard(print); - f_print_dynamic_raw(f_string_eol_s, print.to); + f_print_dynamic_raw(f_string_eol_s, print->to); fll_program_print_help_option(print, status_code_short_fine_s, status_code_long_fine_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Print F_true or F_false if status code is neither an error nor a warning or print number with neither the error code nor the warning code bits set."); fll_program_print_help_option(print, status_code_short_warning_s, status_code_long_warning_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "Print F_true or F_false if status code is a warning or print number with warning code bit set."); fll_program_print_help_option(print, status_code_short_error_s, status_code_long_error_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Print F_true or F_false if status code is an error or print number with error code bit set."); fll_program_print_help_option(print, status_code_short_number_s, status_code_long_number_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Convert status code name to number."); - f_print_dynamic_raw(f_string_eol_s, print.to); - f_print_dynamic_raw(f_string_eol_s, print.to); + f_print_dynamic_raw(f_string_eol_s, print->to); fll_program_print_help_usage( print, - setting->program_name - ? *setting->program_name + main->setting.program_name + ? *main->setting.program_name : status_code_program_name_s, status_code_program_help_parameters_s ); - if (setting->status_string_help_detail) { - setting->status_string_help_detail(setting, print); + if (main->setting.status_string_help_detail) { + main->setting.status_string_help_detail(print); } - f_file_stream_flush(print.to); - f_file_stream_unlock(print.to); + f_file_stream_flush(print->to); + f_file_stream_unlock(print->to); return F_none; } -#endif // _di_status_code_print_help_ +#endif // _di_status_code_print_message_help_ -#ifndef _di_status_code_print_help_detail_ - f_status_t status_code_print_help_detail(void * const void_setting, const fl_print_t print) { +#ifndef _di_status_code_print_message_help_detail_ + f_status_t status_code_print_message_help_detail(fl_print_t * const print) { - if (!void_setting) return F_status_set_error(F_output_not); + if (!print) return F_status_set_error(F_output_not); - fl_print_format(" The FLL programs use a %[16-bit unsigned integer%] to represent the return status of programs and functions.%r%r", print.to, print.set->notable, print.set->notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" The FLL programs use a %[16-bit unsigned integer%] to represent the return status of programs and functions.%r%r", print->to, print->set->notable, print->set->notable, f_string_eol_s, f_string_eol_s); - fl_print_format(" Programs may print a generic error with one of these codes.%r", print.to, f_string_eol_s); - fl_print_format(" This is a tool for converting to or converting from these codes.%r%r", print.to, f_string_eol_s, f_string_eol_s); + fl_print_format(" Programs may print a generic error with one of these codes.%r", print->to, f_string_eol_s); + fl_print_format(" This is a tool for converting to or converting from these codes.%r%r", print->to, f_string_eol_s, f_string_eol_s); - fl_print_format(" The %[16-bit unsigned integer%] also has the first two high-order bits used to represent flags.%r", print.to, print.set->notable, print.set->notable, f_string_eol_s); - fl_print_format(" These flags are the %[error%] bit and the %[warning%] bit.%r", print.to, print.set->notable, print.set->notable, print.set->notable, print.set->notable, f_string_eol_s); - fl_print_format(" When neither of these flags are set, then the status is considered %[fine%].%r%r", print.to, print.set->notable, print.set->notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" The %[16-bit unsigned integer%] also has the first two high-order bits used to represent flags.%r", print->to, print->set->notable, print->set->notable, f_string_eol_s); + fl_print_format(" These flags are the %[error%] bit and the %[warning%] bit.%r", print->to, print->set->notable, print->set->notable, print->set->notable, print->set->notable, f_string_eol_s); + fl_print_format(" When neither of these flags are set, then the status is considered %[fine%].%r%r", print->to, print->set->notable, print->set->notable, f_string_eol_s, f_string_eol_s); - fl_print_format(" These codes stop at the %[F_status_code_last%] code.%r%r", print.to, print.set->notable, print.set->notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" These codes stop at the %[F_status_code_last%] code.%r%r", print->to, print->set->notable, print->set->notable, f_string_eol_s, f_string_eol_s); - fl_print_format(" Each code will be printed on its own line.%r", print.to, print.set->notable, print.set->notable, f_string_eol_s); - fl_print_format(" Errors regarding each code may be printed on its own line.%r", print.to, f_string_eol_s); + fl_print_format(" Each code will be printed on its own line.%r", print->to, print->set->notable, print->set->notable, f_string_eol_s); + fl_print_format(" Errors regarding each code may be printed on its own line.%r", print->to, f_string_eol_s); return F_none; } -#endif // _di_status_code_print_help_detail_ +#endif // _di_status_code_print_message_help_detail_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/status_code/c/main/print.h b/level_3/status_code/c/main/print/message.h similarity index 59% rename from level_3/status_code/c/main/print.h rename to level_3/status_code/c/main/print/message.h index 06802cb..100e3b7 100644 --- a/level_3/status_code/c/main/print.h +++ b/level_3/status_code/c/main/print/message.h @@ -5,12 +5,12 @@ * API Version: 0.7 * Licenses: lgpl-2.1-or-later * - * Provides the print functionality. + * Provides the print data functionality. * * This is auto-included and should not need to be explicitly included. */ -#ifndef _status_code_print_h -#define _status_code_print_h +#ifndef _status_code_print_message_h +#define _status_code_print_message_h #ifdef __cplusplus extern "C" { @@ -19,13 +19,11 @@ extern "C" { /** * Print help. * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. * @param print * The output structure to print to. * + * This does not alter print.custom.setting.state.status. + * * @return * F_none on success. * F_output_not on success, but no printing is performed. @@ -43,24 +41,21 @@ extern "C" { * @see fll_program_print_help_option_standard() * @see fll_program_print_help_usage() */ -#ifndef _di_status_code_print_help_ - extern f_status_t status_code_print_help(status_code_setting_t * const setting, const fl_print_t print); -#endif // _di_status_code_print_help_ +#ifndef _di_status_code_print_message_help_ + extern f_status_t status_code_print_message_help(fl_print_t * const print); +#endif // _di_status_code_print_message_help_ /** * Print help detailed part of the help. * - * This is designed to be called from within status_code_print_help(). + * This is designed to be called from within status_code_print_message_help(). * This neither locks nor unlocks the stream and expects the stream to be unlocked. * - * @param setting - * The main program settings. - * (Must be of type status_code_setting_t.) - * - * This does not alter setting.state.status. * @param print * The output structure to print to. * + * This does not alter print.custom.setting.state.status. + * * @return * F_none on success. * F_output_not on success, but no printing is performed. @@ -69,14 +64,14 @@ extern "C" { * * @see fl_print_format() * - * @see status_code_print_help() + * @see status_code_print_message_help() */ -#ifndef _di_status_code_print_help_detail_ - extern f_status_t status_code_print_help_detail(void * const setting, const fl_print_t print); -#endif // _di_status_code_print_help_detail_ +#ifndef _di_status_code_print_message_help_detail_ + extern f_status_t status_code_print_message_help_detail(fl_print_t * const print); +#endif // _di_status_code_print_message_help_detail_ #ifdef __cplusplus } // extern "C" #endif -#endif // _status_code_print_h +#endif // _status_code_print_message_h diff --git a/level_3/status_code/c/main/process.c b/level_3/status_code/c/main/process.c index 9ec3269..6fdc268 100644 --- a/level_3/status_code/c/main/process.c +++ b/level_3/status_code/c/main/process.c @@ -5,54 +5,54 @@ extern "C" { #endif #ifndef _di_status_code_process_check_ - void status_code_process_check(fll_program_data_t * const main, status_code_setting_t * const setting, const f_string_static_t value) { + void status_code_process_check(status_code_main_t * const main, const f_string_static_t value) { - if (!main || !setting) return; + if (!main) return; f_number_unsigned_t number = 0; { - status_code_convert_number(main, setting, value, &number); - if (F_status_is_error(setting->state.status)) return; + status_code_convert_number(main, value, &number); + if (F_status_is_error(main->setting.state.status)) return; } - f_file_stream_lock(main->output.to); + f_file_stream_lock(main->program.output.to); - if ((setting->flag & status_code_main_flag_error_e) && F_status_is_error(number) || (setting->flag & status_code_main_flag_warning_e) && F_status_is_warning(number) || (setting->flag & status_code_main_flag_fine_e) && F_status_is_fine(number)) { - f_print_dynamic_raw(f_status_true_s, main->output.to); + if ((main->setting.flag & status_code_main_flag_error_e) && F_status_is_error(number) || (main->setting.flag & status_code_main_flag_warning_e) && F_status_is_warning(number) || (main->setting.flag & status_code_main_flag_fine_e) && F_status_is_fine(number)) { + f_print_dynamic_raw(f_status_true_s, main->program.output.to); } else { - f_print_dynamic_raw(f_status_false_s, main->output.to); + f_print_dynamic_raw(f_status_false_s, main->program.output.to); } - f_print_dynamic_raw(f_string_eol_s, main->output.to); + f_print_dynamic_raw(f_string_eol_s, main->program.output.to); - f_file_stream_unlock(main->output.to); + f_file_stream_unlock(main->program.output.to); - setting->state.status = F_none; + main->setting.state.status = F_none; } #endif // _di_status_code_process_check_ #ifndef _di_status_code_process_number_ - void status_code_process_number(fll_program_data_t * const main, status_code_setting_t * const setting, const f_string_static_t value) { + void status_code_process_number(status_code_main_t * const main, const f_string_static_t value) { - if (!main || !setting) return; + if (!main) return; { f_number_unsigned_t number = 0; - setting->state.status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, value, &number); + main->setting.state.status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, value, &number); - if (setting->state.status == F_none) { - status_code_print_data_context_value(setting, main->output, main->context.set.error, status_code_invalid_name_s); + if (main->setting.state.status == F_none) { + status_code_print_data_context_value(&main->program.output, main->program.context.set.error, status_code_invalid_name_s); - setting->state.status = F_status_set_error(F_parameter); + main->setting.state.status = F_status_set_error(F_parameter); return; } - if (setting->state.status == F_data_not || F_status_set_fine(setting->state.status) == F_parameter) { - status_code_print_data_context_value(setting, main->output, main->context.set.error, status_code_invalid_main_s); + if (main->setting.state.status == F_data_not || F_status_set_fine(main->setting.state.status) == F_parameter) { + status_code_print_data_context_value(&main->program.output, main->program.context.set.error, status_code_invalid_main_s); return; } @@ -60,71 +60,71 @@ extern "C" { f_status_t code = F_none; - setting->state.status = setting->status_string_from(value, &code); + main->setting.state.status = main->setting.status_string_from(value, &code); - if (F_status_is_error(setting->state.status)) { - if (F_status_set_fine(setting->state.status) == F_data) { - status_code_print_data_context_value(setting, main->output, main->context.set.error, status_code_unknown_name_s); + if (F_status_is_error(main->setting.state.status)) { + if (F_status_set_fine(main->setting.state.status) == F_data) { + status_code_print_data_context_value(&main->program.output, main->program.context.set.error, status_code_unknown_name_s); } else { - status_code_print_data_context_value(setting, main->output, main->context.set.error, status_code_failed_to_convert_s); + status_code_print_data_context_value(&main->program.output, main->program.context.set.error, status_code_failed_to_convert_s); } return; } - if (setting->state.status == F_data) { - status_code_print_data_context_value(setting, main->output, main->context.set.error, status_code_unknown_code_s); + if (main->setting.state.status == F_data) { + status_code_print_data_context_value(&main->program.output, main->program.context.set.error, status_code_unknown_code_s); - setting->state.status = F_none; + main->setting.state.status = F_none; return; } - if (setting->flag & status_code_main_flag_error_e) { + if (main->setting.flag & status_code_main_flag_error_e) { code = F_status_set_error(code); } - if (setting->flag & status_code_main_flag_warning_e) { + if (main->setting.flag & status_code_main_flag_warning_e) { code = F_status_set_warning(code); } - status_code_print_data_code(setting, main->output, code); + status_code_print_data_code(&main->program.output, code); - setting->state.status = F_none; + main->setting.state.status = F_none; } #endif // _di_status_code_process_number_ #ifndef _di_status_code_process_normal_ - void status_code_process_normal(fll_program_data_t * const main, status_code_setting_t * const setting, const f_string_static_t value) { + void status_code_process_normal(status_code_main_t * const main, const f_string_static_t value) { - if (!main || !setting) return; + if (!main) return; f_string_static_t name = f_string_static_t_initialize; { f_number_unsigned_t number = 0; - status_code_convert_number(main, setting, value, &number); - if (F_status_is_error(setting->state.status)) return; + status_code_convert_number(main, value, &number); + if (F_status_is_error(main->setting.state.status)) return; - setting->state.status = setting->status_string_to((f_status_t) number, &name); + main->setting.state.status = main->setting.status_string_to((f_status_t) number, &name); } - if (F_status_is_error(setting->state.status)) { - if (F_status_set_fine(setting->state.status) == F_data) { - status_code_print_data_context_value(setting, main->output, main->context.set.error, status_code_unknown_code_s); + if (F_status_is_error(main->setting.state.status)) { + if (F_status_set_fine(main->setting.state.status) == F_data) { + status_code_print_data_context_value(&main->program.output, main->program.context.set.error, status_code_unknown_code_s); } else { - status_code_print_data_context_value(setting, main->output, main->context.set.error, status_code_failed_to_convert_s); + status_code_print_data_context_value(&main->program.output, main->program.context.set.error, status_code_failed_to_convert_s); } return; } - status_code_print_data_context_value(setting, main->output, f_color_set_empty_s, name); + status_code_print_data_context_value(&main->program.output, f_color_set_empty_s, name); - setting->state.status = F_none; + main->setting.state.status = F_none; } #endif // _di_status_code_process_normal_ diff --git a/level_3/status_code/c/main/process.h b/level_3/status_code/c/main/process.h index 7193026..de1a000 100644 --- a/level_3/status_code/c/main/process.h +++ b/level_3/status_code/c/main/process.h @@ -38,7 +38,7 @@ extern "C" { * @see fss_status_code_convert_number() */ #ifndef _di_status_code_process_check_ - extern void status_code_process_check(fll_program_data_t * const main, status_code_setting_t * const setting, const f_string_static_t value); + extern void status_code_process_check(status_code_main_t * const main, const f_string_static_t value); #endif // _di_status_code_process_check_ /** @@ -62,7 +62,7 @@ extern "C" { * @see fll_status_string_from() */ #ifndef _di_status_code_process_number_ - extern void status_code_process_number(fll_program_data_t * const main, status_code_setting_t * const setting, const f_string_static_t value); + extern void status_code_process_number(status_code_main_t * const main, const f_string_static_t value); #endif // _di_status_code_process_number_ /** @@ -91,7 +91,7 @@ extern "C" { * @see fss_status_code_convert_number() */ #ifndef _di_status_code_process_normal_ - extern void status_code_process_normal(fll_program_data_t * const main, status_code_setting_t * const setting, const f_string_static_t value); + extern void status_code_process_normal(status_code_main_t * const main, const f_string_static_t value); #endif // _di_status_code_process_normal_ #ifdef __cplusplus diff --git a/level_3/status_code/c/main/status_code.c b/level_3/status_code/c/main/status_code.c index 66ff959..e8a4518 100644 --- a/level_3/status_code/c/main/status_code.c +++ b/level_3/status_code/c/main/status_code.c @@ -5,67 +5,56 @@ extern "C" { #endif #ifndef _di_status_code_main_ - void status_code_main(fll_program_data_t * const main, status_code_setting_t * const setting) { + void status_code_main(status_code_main_t * const main) { - if (!main || !setting) return; + if (!main) return; - if (F_status_is_error(setting->state.status)) { - if ((setting->flag & status_code_main_flag_print_last_e) && main->message.verbosity > f_console_verbosity_error_e) { - fll_print_dynamic_raw(f_string_eol_s, main->message.to); + if (F_status_is_error(main->setting.state.status)) { + if ((main->setting.flag & status_code_main_flag_print_last_e) && main->program.message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); } return; } - if ((setting->flag & status_code_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { - fll_print_dynamic_raw(f_string_eol_s, main->message.to); + if ((main->setting.flag & status_code_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); } - if (!setting->status_string_from || !setting->status_string_to) { - if (!setting->status_string_from) { - status_code_print_error_invalid_callback(setting, main->error, macro_status_code_f(status_string_from)); + if (!main->setting.status_string_from || !main->setting.status_string_to) { + if (!main->setting.status_string_from) { + status_code_print_error_invalid_callback(&main->program.error, macro_status_code_f(status_string_from)); } - if (!setting->status_string_to) { - status_code_print_error_invalid_callback(setting, main->error, macro_status_code_f(status_string_to)); + if (!main->setting.status_string_to) { + status_code_print_error_invalid_callback(&main->program.error, macro_status_code_f(status_string_to)); } - if ((setting->flag & status_code_main_flag_print_last_e) && main->message.verbosity > f_console_verbosity_error_e) { - fll_print_dynamic_raw(f_string_eol_s, main->message.to); + if ((main->setting.flag & status_code_main_flag_print_last_e) && main->program.message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); } - setting->state.status = F_status_set_error(F_parameter); + main->setting.state.status = F_status_set_error(F_parameter); return; } - setting->state.status = F_none; + main->setting.state.status = F_none; - if (setting->flag & status_code_main_flag_help_e) { - status_code_print_help(setting, main->message); + if (main->setting.flag & (status_code_main_flag_help_e | status_code_main_flag_version_e | status_code_main_flag_copyright_e)) { - if ((setting->flag & status_code_main_flag_print_last_e) && main->message.verbosity > f_console_verbosity_error_e) { - fll_print_dynamic_raw(f_string_eol_s, main->message.to); + if (main->setting.flag & status_code_main_flag_help_e) { + status_code_print_message_help(&main->program.message); } - - return; - } - - if (setting->flag & status_code_main_flag_version_e) { - fll_program_print_version(main->message, status_code_program_version_s); - - if ((setting->flag & status_code_main_flag_print_last_e) && main->message.verbosity > f_console_verbosity_error_e) { - fll_print_dynamic_raw(f_string_eol_s, main->message.to); + else if (main->setting.flag & status_code_main_flag_version_e) { + fll_program_print_version(&main->program.message, status_code_program_version_s); + } + else if (main->setting.flag & status_code_main_flag_copyright_e) { + fll_program_print_copyright(&main->program.message); } - return; - } - - if (setting->flag & status_code_main_flag_copyright_e) { - fll_program_print_copyright(main->message); - - if ((setting->flag & status_code_main_flag_print_last_e) && main->message.verbosity > f_console_verbosity_error_e) { - fll_print_dynamic_raw(f_string_eol_s, main->message.to); + if ((main->setting.flag & status_code_main_flag_print_last_e) && main->program.message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); } return; @@ -73,109 +62,109 @@ extern "C" { f_status_t status = F_none; - if (setting->flag & status_code_main_flag_number_e) { - if (main->pipe & fll_program_data_pipe_input_e) { + if (main->setting.flag & status_code_main_flag_number_e) { + if (main->program.pipe & fll_program_data_pipe_input_e) { // @todo call status_code_process_number() here for all main from pipe that are space separated. } - if (main->parameters.remaining.used) { - f_file_stream_lock(main->output.to); + if (main->program.parameters.remaining.used) { + f_file_stream_lock(main->program.output.to); - for (f_array_length_t i = 0; i < main->parameters.remaining.used; ++i) { + for (f_array_length_t i = 0; i < main->program.parameters.remaining.used; ++i) { - if (!((++main->signal_check) % status_code_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { - setting->state.status = F_status_set_error(F_interrupt); + if (!((++main->program.signal_check) % status_code_signal_check_d)) { + if (fll_program_standard_signal_received(&main->program)) { + main->setting.state.status = F_status_set_error(F_interrupt); break; } - main->signal_check = 0; + main->program.signal_check = 0; } - status = setting->state.status; + status = main->setting.state.status; - status_code_process_number(main, setting, main->parameters.arguments.array[main->parameters.remaining.array[i]]); + status_code_process_number(main, main->program.parameters.arguments.array[main->program.parameters.remaining.array[i]]); - if (F_status_is_error_not(setting->state.status)) { - setting->state.status = status; + if (F_status_is_error_not(main->setting.state.status)) { + main->setting.state.status = status; } } // for - f_file_stream_unlock(main->output.to); + f_file_stream_unlock(main->program.output.to); } } - else if ((setting->flag & status_code_main_flag_error_e) || (setting->flag & status_code_main_flag_warning_e) || (setting->flag & status_code_main_flag_fine_e)) { - if (main->pipe & fll_program_data_pipe_input_e) { + else if ((main->setting.flag & status_code_main_flag_error_e) || (main->setting.flag & status_code_main_flag_warning_e) || (main->setting.flag & status_code_main_flag_fine_e)) { + if (main->program.pipe & fll_program_data_pipe_input_e) { // @todo call status_code_process_check() here for all main from pipe that is space separated. } - if (main->parameters.remaining.used) { - f_file_stream_lock(main->output.to); + if (main->program.parameters.remaining.used) { + f_file_stream_lock(main->program.output.to); - for (f_array_length_t i = 0; i < main->parameters.remaining.used; ++i) { + for (f_array_length_t i = 0; i < main->program.parameters.remaining.used; ++i) { - if (!((++main->signal_check) % status_code_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { - setting->state.status = F_status_set_error(F_interrupt); + if (!((++main->program.signal_check) % status_code_signal_check_d)) { + if (fll_program_standard_signal_received(&main->program)) { + main->setting.state.status = F_status_set_error(F_interrupt); break; } - main->signal_check = 0; + main->program.signal_check = 0; } - status = setting->state.status; + status = main->setting.state.status; - status_code_process_check(main, setting, main->parameters.arguments.array[main->parameters.remaining.array[i]]); + status_code_process_check(main, main->program.parameters.arguments.array[main->program.parameters.remaining.array[i]]); - if (F_status_is_error_not(setting->state.status)) { - setting->state.status = status; + if (F_status_is_error_not(main->setting.state.status)) { + main->setting.state.status = status; } } // for - f_file_stream_unlock(main->output.to); + f_file_stream_unlock(main->program.output.to); } } else { - if (main->pipe & fll_program_data_pipe_input_e) { + if (main->program.pipe & fll_program_data_pipe_input_e) { // @todo call status_code_process_normal() here for all main from pipe that is space separated. } - if (main->parameters.remaining.used) { - f_file_stream_lock(main->output.to); + if (main->program.parameters.remaining.used) { + f_file_stream_lock(main->program.output.to); - for (f_array_length_t i = 0; i < main->parameters.remaining.used; ++i) { + for (f_array_length_t i = 0; i < main->program.parameters.remaining.used; ++i) { - if (!((++main->signal_check) % status_code_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { - setting->state.status = F_status_set_error(F_interrupt); + if (!((++main->program.signal_check) % status_code_signal_check_d)) { + if (fll_program_standard_signal_received(&main->program)) { + main->setting.state.status = F_status_set_error(F_interrupt); break; } - main->signal_check = 0; + main->program.signal_check = 0; } - status = setting->state.status; + status = main->setting.state.status; - status_code_process_normal(main, setting, main->parameters.arguments.array[main->parameters.remaining.array[i]]); + status_code_process_normal(main, main->program.parameters.arguments.array[main->program.parameters.remaining.array[i]]); - if (F_status_is_error_not(setting->state.status)) { - setting->state.status = status; + if (F_status_is_error_not(main->setting.state.status)) { + main->setting.state.status = status; } } // for - f_file_stream_unlock(main->output.to); + f_file_stream_unlock(main->program.output.to); } } - if (setting->state.status == F_status_set_error(F_interrupt)) { - fll_program_print_signal_received(main->warning, main->signal_received); + if (main->setting.state.status == F_status_set_error(F_interrupt)) { + fll_program_print_signal_received(&main->program.warning, main->program.signal_received); } - if ((setting->flag & status_code_main_flag_print_last_e) && main->message.verbosity > f_console_verbosity_error_e) { - fll_print_dynamic_raw(f_string_eol_s, main->message.to); + if ((main->setting.flag & status_code_main_flag_print_last_e) && main->program.message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); } } #endif // _di_status_code_main_ diff --git a/level_3/status_code/c/main/status_code.h b/level_3/status_code/c/main/status_code.h index e263d11..aa6846f 100644 --- a/level_3/status_code/c/main/status_code.h +++ b/level_3/status_code/c/main/status_code.h @@ -42,14 +42,16 @@ #include // Status Code includes. +#include +#include #include #include #include #include #include -#include #include #include +#include #include #ifdef __cplusplus @@ -81,7 +83,7 @@ extern "C" { * F_parameter (with error bit) if main is NULL or setting is NULL. */ #ifndef _di_status_code_main_ - extern void status_code_main(fll_program_data_t * const main, status_code_setting_t * const setting); + extern void status_code_main(status_code_main_t * const main); #endif // _di_status_code_main_ #ifdef __cplusplus diff --git a/level_3/status_code/data/build/settings b/level_3/status_code/data/build/settings index fe00536..c092268 100644 --- a/level_3/status_code/data/build/settings +++ b/level_3/status_code/data/build/settings @@ -25,10 +25,10 @@ build_libraries-individual -lfll_error -lfll_print -lfll_program -lfll_status_st build_libraries-level -lfll_2 -lfll_1 -lfll_0 build_libraries-monolithic -lfll -build_sources_library main/status_code.c main/common.c main/common/print.c main/common/string.c main/common/type.c main/convert.c main/print.c main/print/data.c main/print/error.c main/process.c +build_sources_library main/status_code.c main/common.c main/common/define.c main/common/enumeration.c main/common/print.c main/common/string.c main/common/type.c main/convert.c main/print/data.c main/print/error.c main/print/message.c main/process.c build_sources_library fss/status_code.c fss/common.c -build_sources_headers main/status_code.h main/common.h main/common/print.h main/common/string.h main/common/type.h main/convert.h main/print.h main/print/data.h main/print/error.h main/process.h +build_sources_headers main/status_code.h main/common.h main/common/define.h main/common/enumeration.h main/common/print.h main/common/string.h main/common/type.h main/convert.h main/print/data.h main/print/error.h main/print/message.h main/process.h build_sources_headers fss/status_code.h fss/common.h build_sources_documentation man diff --git a/level_3/utf8/c/main/bytesequence.c b/level_3/utf8/c/main/bytesequence.c index 44be80b..a9383dd 100644 --- a/level_3/utf8/c/main/bytesequence.c +++ b/level_3/utf8/c/main/bytesequence.c @@ -81,7 +81,7 @@ extern "C" { if (!((++main->program.signal_check) % utf8_signal_check_d)) { if (fll_program_standard_signal_received(&main->program)) { - fll_program_print_signal_received(main->program.warning, main->program.signal_received); + fll_program_print_signal_received(&main->program.warning, main->program.signal_received); main->setting.state.status = F_interrupt; diff --git a/level_3/utf8/c/main/codepoint.c b/level_3/utf8/c/main/codepoint.c index 682a7d8..c6e4ccd 100644 --- a/level_3/utf8/c/main/codepoint.c +++ b/level_3/utf8/c/main/codepoint.c @@ -351,7 +351,7 @@ extern "C" { if (!((++main->program.signal_check) % utf8_signal_check_d)) { if (fll_program_standard_signal_received(&main->program)) { - fll_program_print_signal_received(main->program.warning, main->program.signal_received); + fll_program_print_signal_received(&main->program.warning, main->program.signal_received); main->setting.state.status = F_status_set_error(F_interrupt); diff --git a/level_3/utf8/c/main/common.c b/level_3/utf8/c/main/common.c index 46b02cc..78d64a8 100644 --- a/level_3/utf8/c/main/common.c +++ b/level_3/utf8/c/main/common.c @@ -283,7 +283,7 @@ extern "C" { fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); } - fll_program_print_error_parameter_missing_value(main->program.error, f_console_symbol_long_normal_s, utf8_long_to_file_s); + fll_program_print_error_parameter_missing_value(&main->program.error, f_console_symbol_long_normal_s, utf8_long_to_file_s); return; } @@ -324,7 +324,7 @@ extern "C" { fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); } - fll_error_print(main->program.error, F_status_set_fine(main->setting.state.status), macro_utf8_f(f_string_dynamic_append_nulless), fll_error_file_flag_fallback_e); + fll_error_print(&main->program.error, F_status_set_fine(main->setting.state.status), macro_utf8_f(f_string_dynamic_append_nulless), fll_error_file_flag_fallback_e); break; } @@ -364,7 +364,7 @@ extern "C" { fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); } - fll_program_print_error_parameter_missing_value(main->program.error, f_console_symbol_long_normal_s, utf8_long_from_file_s); + fll_program_print_error_parameter_missing_value(&main->program.error, f_console_symbol_long_normal_s, utf8_long_from_file_s); return; } diff --git a/level_3/utf8/c/main/common/define.h b/level_3/utf8/c/main/common/define.h index 24857f3..b3a0cdd 100644 --- a/level_3/utf8/c/main/common/define.h +++ b/level_3/utf8/c/main/common/define.h @@ -5,7 +5,7 @@ * API Version: 0.7 * Licenses: lgpl-2.1-or-later * - * Provides the common type structures. + * Provides the common define types. * * This is auto-included and should not need to be explicitly included. */ diff --git a/level_3/utf8/c/main/common/enumeration.h b/level_3/utf8/c/main/common/enumeration.h index fe6d576..44a9123 100644 --- a/level_3/utf8/c/main/common/enumeration.h +++ b/level_3/utf8/c/main/common/enumeration.h @@ -5,7 +5,7 @@ * API Version: 0.7 * Licenses: lgpl-2.1-or-later * - * Provides the common type structures. + * Provides the common enumeration types. * * This is auto-included and should not need to be explicitly included. */ diff --git a/level_3/utf8/c/main/main.c b/level_3/utf8/c/main/main.c index f299da2..16bf333 100644 --- a/level_3/utf8/c/main/main.c +++ b/level_3/utf8/c/main/main.c @@ -15,6 +15,7 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { data.program.debug.custom = (void *) &data; f_console_parameter_t parameters[] = utf8_console_parameter_t_initialize; + data.program.parameters.array = parameters; data.program.parameters.used = utf8_total_parameters_d; data.program.environment = envp; diff --git a/level_3/utf8/c/main/print/data.h b/level_3/utf8/c/main/print/data.h index 2af078b..27e4f8f 100644 --- a/level_3/utf8/c/main/print/data.h +++ b/level_3/utf8/c/main/print/data.h @@ -19,12 +19,10 @@ extern "C" { /** * Print the byte sequence character (such as '豸'). * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. * @param print - * Designates how printing is to be performed. + * The output structure to print to. + * + * This does not alter print.custom.setting.state.status. * @param sequence * A byte sequences representing a single character to print. * @@ -43,12 +41,10 @@ extern "C" { * * This handles whether or not the invalid character should be printed or not based on program parameters. * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. * @param print - * Designates how printing is to be performed. + * The output structure to print to. + * + * This does not alter print.custom.setting.state.status. * @param invalid * The byte sequence string or unicode codepoint string representing a single character to print. * @@ -67,12 +63,10 @@ extern "C" { /** * Print the codepoint number as a codepoint string (such as U+8C78). * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. * @param print - * Designates how printing is to be performed. + * The output structure to print to. + * + * This does not alter print.custom.setting.state.status. * @param codepoint * The codepoint to print. * This is the code that represents a single character. @@ -90,12 +84,10 @@ extern "C" { /** * Print the width or combining state of the given character. * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. * @param print - * Designates how printing is to be performed. + * The output structure to print to. + * + * This does not alter print.custom.setting.state.status. * @param sequence * A byte sequences representing a single character to print. * @@ -114,12 +106,10 @@ extern "C" { /** * Print an error regarding the width or combining state of a some character. * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. * @param print - * Designates how printing is to be performed. + * The output structure to print to. + * + * This does not alter print.custom.setting.state.status. * * @return * F_none on success. @@ -134,12 +124,10 @@ extern "C" { /** * Print the raw character data (binary / byte sequence). * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. * @param print - * Designates the how and where to print. + * The output structure to print to. + * + * This does not alter print.custom.setting.state.status. * @param raw * The raw string in integer format. * @param width @@ -158,12 +146,10 @@ extern "C" { /** * Print the raw character data (codepoint). * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. * @param print - * Designates the how and where to print. + * The output structure to print to. + * + * This does not alter print.custom.setting.state.status. * @param raw * The raw string already in codepoint format. * @@ -180,12 +166,10 @@ extern "C" { /** * Print the width or combining state of the for a raw character. * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. * @param print - * Designates the how and where to print. + * The output structure to print to. + * + * This does not alter print.custom.setting.state.status. * @param width * The pre-calculated width. * @@ -204,12 +188,10 @@ extern "C" { /** * Print the input file section header. * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. * @param print - * Designates the how and where to print. + * The output structure to print to. + * + * This does not alter print.custom.setting.state.status. * @param name * The name of the file. * @param index @@ -228,12 +210,10 @@ extern "C" { /** * Print the input parameter section header. * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. * @param print - * Designates the how and where to print. + * The output structure to print to. + * + * This does not alter print.custom.setting.state.status. * @param index * The index position of the parameter. * diff --git a/level_3/utf8/c/main/print/error.c b/level_3/utf8/c/main/print/error.c index 42d5721..eeb3952 100644 --- a/level_3/utf8/c/main/print/error.c +++ b/level_3/utf8/c/main/print/error.c @@ -12,7 +12,7 @@ extern "C" { utf8_main_t * const main = (utf8_main_t *) print->custom; - fll_error_print(*print, F_status_set_fine(main->setting.state.status), function, fll_error_file_flag_fallback_e); + fll_error_print(print, F_status_set_fine(main->setting.state.status), function, fll_error_file_flag_fallback_e); return F_none; } @@ -28,7 +28,7 @@ extern "C" { if (main->setting.flag & (utf8_main_flag_strip_invalid_e | utf8_main_flag_verify_e)) return F_output_not; - fl_print_format("%r%[%QFailed to decode character code '%]", print->to, f_string_eol_s, print->set->error, print->prefix, print->set->error); + fl_print_format("%[%QFailed to decode character code '%]", print->to, print->set->error, print->prefix, print->set->error); if (invalid.used) { fl_print_format("%[0x", print->to, print->set->notable); @@ -69,7 +69,7 @@ extern "C" { if (main->setting.flag & (utf8_main_flag_strip_invalid_e | utf8_main_flag_verify_e)) return F_output_not; - fl_print_format("%r%[%QFailed to encode Unicode codepoint '%]", print->to, f_string_eol_s, print->set->error, print->prefix, print->set->error); + 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(main->setting.state.status) == F_utf_not) { @@ -93,7 +93,7 @@ extern "C" { utf8_main_t * const main = (utf8_main_t *) print->custom; - fll_error_file_print(*print, F_status_set_fine(main->setting.state.status), function, fll_error_file_flag_fallback_e, name, operation, type); + fll_error_file_print(print, F_status_set_fine(main->setting.state.status), function, fll_error_file_flag_fallback_e, name, operation, type); return F_none; } @@ -104,7 +104,7 @@ extern "C" { if (print->verbosity < f_console_verbosity_error_e) return F_output_not; - fll_print_format("%r%[%QNo from sources are specified, please pipe data, designate a file, or add parameters.%]%r", print->to, f_string_eol_s, print->set->error, print->prefix, 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", print->to, print->set->error, print->prefix, print->set->error, f_string_eol_s); return F_none; } diff --git a/level_3/utf8/c/main/print/error.h b/level_3/utf8/c/main/print/error.h index a88670b..ab70b29 100644 --- a/level_3/utf8/c/main/print/error.h +++ b/level_3/utf8/c/main/print/error.h @@ -19,12 +19,8 @@ extern "C" { /** * Print generic error message regarding a function failing in some way. * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. * @param print - * Designates the how and where to print. + * The output structure to print to. * * This does not alter print.custom.setting.state.status. * @@ -43,12 +39,10 @@ extern "C" { /** * Print error message when attempt to decode the character failed. * - * @param main - * The main program data. - * @param setting - * The main program settings. + * @param print + * The output structure to print to. * - * This does not alter setting.state.status. + * This does not alter print.custom.setting.state.status. * @param invalid * The byte sequence string or unicode codepoint string representing a single character to print. * @@ -67,12 +61,8 @@ extern "C" { /** * Print error message when attempt to encode the character failed. * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. * @param print - * Designates the how and where to print. + * The output structure to print to. * * This does not alter print.custom.setting.state.status. * @param codepoint @@ -93,12 +83,8 @@ extern "C" { /** * Print file related error or warning messages. * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. * @param print - * Designates how printing is to be performed. + * The output structure to print to. * * This does not alter print.custom.setting.state.status. * @param function @@ -126,12 +112,8 @@ extern "C" { /** * Print error message for when no sources are provided. * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. * @param print - * Designates how printing is to be performed. + * The output structure to print to. * * This does not alter print.custom.setting.state.status. * @@ -150,12 +132,8 @@ extern "C" { /** * Print error message for when the file parameter is an empty string. * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. * @param print - * Designates how printing is to be performed. + * The output structure to print to. * * This does not alter print.custom.setting.state.status. * @param index @@ -178,12 +156,8 @@ extern "C" { /** * Print error message for when no sources are provided in the main program parameters. * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. * @param print - * Designates how printing is to be performed. + * The output structure to print to. * * This does not alter print.custom.setting.state.status. * @param from @@ -209,12 +183,8 @@ extern "C" { /** * Print error message for when too many 'to' destinations are specified. * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. * @param print - * Designates how printing is to be performed. + * The output structure to print to. * * This does not alter print.custom.setting.state.status. * diff --git a/level_3/utf8/c/main/print/message.c b/level_3/utf8/c/main/print/message.c index b4cb05f..e3d95fe 100644 --- a/level_3/utf8/c/main/print/message.c +++ b/level_3/utf8/c/main/print/message.c @@ -7,37 +7,40 @@ extern "C" { #ifndef _di_utf8_print_message_help_ f_status_t utf8_print_message_help(fl_print_t * const print) { + if (!print || !print->custom) return F_status_set_error(F_output_not); + + utf8_main_t * const main = (utf8_main_t *) print->custom; + f_file_stream_lock(print->to); - fll_program_print_help_header(*print, utf8_program_name_long_s, utf8_program_version_s); + fll_program_print_help_header(print, utf8_program_name_long_s, utf8_program_version_s); - fll_program_print_help_option_standard(*print); + fll_program_print_help_option_standard(print); f_print_dynamic_raw(f_string_eol_s, print->to); - fll_program_print_help_option(*print, utf8_short_from_bytesequence_s, utf8_long_from_bytesequence_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "The expected input format is byte sequence (character data)."); - fll_program_print_help_option(*print, utf8_short_from_codepoint_s, utf8_long_from_codepoint_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " The expected input format is codepoint (such as U+0000)."); - fll_program_print_help_option(*print, utf8_short_from_file_s, utf8_long_from_file_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Use the given output as the input source."); + fll_program_print_help_option(print, utf8_short_from_bytesequence_s, utf8_long_from_bytesequence_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "The expected input format is byte sequence (character data)."); + fll_program_print_help_option(print, utf8_short_from_codepoint_s, utf8_long_from_codepoint_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " The expected input format is codepoint (such as U+0000)."); + fll_program_print_help_option(print, utf8_short_from_file_s, utf8_long_from_file_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Use the given output as the input source."); f_print_dynamic_raw(f_string_eol_s, print->to); - fll_program_print_help_option(*print, utf8_short_to_bytesequence_s, utf8_long_to_bytesequence_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "The output format is byte sequence (character data)."); - fll_program_print_help_option(*print, utf8_short_to_codepoint_s, utf8_long_to_codepoint_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " The output format is codepoint (such as U+0000)."); - fll_program_print_help_option(*print, utf8_short_to_combining_s, utf8_long_to_combining_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " The output format is to print whether or not character is combining or not."); - fll_program_print_help_option(*print, utf8_short_to_file_s, utf8_long_to_file_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Use the given file as the output destination."); - fll_program_print_help_option(*print, utf8_short_to_width_s, utf8_long_to_width_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " The output format is to print the width of a character (either 0, 1, or 2)."); + fll_program_print_help_option(print, utf8_short_to_bytesequence_s, utf8_long_to_bytesequence_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "The output format is byte sequence (character data)."); + fll_program_print_help_option(print, utf8_short_to_codepoint_s, utf8_long_to_codepoint_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " The output format is codepoint (such as U+0000)."); + fll_program_print_help_option(print, utf8_short_to_combining_s, utf8_long_to_combining_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " The output format is to print whether or not character is combining or not."); + fll_program_print_help_option(print, utf8_short_to_file_s, utf8_long_to_file_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Use the given file as the output destination."); + fll_program_print_help_option(print, utf8_short_to_width_s, utf8_long_to_width_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " The output format is to print the width of a character (either 0, 1, or 2)."); f_print_dynamic_raw(f_string_eol_s, print->to); - fll_program_print_help_option(*print, utf8_short_headers_s, utf8_long_headers_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Print headers for each section (pipe, file, or parameter)."); - fll_program_print_help_option(*print, utf8_short_separate_s, utf8_long_separate_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Separate characters by newlines (implied when printing headers)."); - fll_program_print_help_option(*print, utf8_short_strip_invalid_s, utf8_long_strip_invalid_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "Strip invalid Unicode characters (do not print invalid sequences)."); - fll_program_print_help_option(*print, utf8_short_verify_s, utf8_long_verify_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Only perform verification of valid sequences."); + fll_program_print_help_option(print, utf8_short_headers_s, utf8_long_headers_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Print headers for each section (pipe, file, or parameter)."); + fll_program_print_help_option(print, utf8_short_separate_s, utf8_long_separate_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Separate characters by newlines (implied when printing headers)."); + fll_program_print_help_option(print, utf8_short_strip_invalid_s, utf8_long_strip_invalid_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "Strip invalid Unicode characters (do not print invalid sequences)."); + fll_program_print_help_option(print, utf8_short_verify_s, utf8_long_verify_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Only perform verification of valid sequences."); f_print_dynamic_raw(f_string_eol_s, print->to); - f_print_dynamic_raw(f_string_eol_s, print->to); - fll_program_print_help_usage(*print, utf8_program_name_s, utf8_program_help_parameters_s); + fll_program_print_help_usage(print, utf8_program_name_s, utf8_program_help_parameters_s); fl_print_format("%r The default behavior is to assume the expected input is byte sequences from the command line to be output to the screen as codepoints.%r%r", print->to, f_string_eol_s, f_string_eol_s, f_string_eol_s); diff --git a/level_3/utf8/c/main/process.c b/level_3/utf8/c/main/process.c index 08c4788..78ec069 100644 --- a/level_3/utf8/c/main/process.c +++ b/level_3/utf8/c/main/process.c @@ -28,7 +28,7 @@ extern "C" { if (!((++main->program.signal_check) % utf8_signal_check_d)) { if (fll_program_standard_signal_received(&main->program)) { - fll_program_print_signal_received(main->program.warning, main->program.signal_received); + fll_program_print_signal_received(&main->program.warning, main->program.signal_received); main->setting.state.status = F_status_set_error(F_interrupt); @@ -47,7 +47,7 @@ extern "C" { utf8_detect_codepoint(main, text, &mode_codepoint); if (F_status_is_error(main->setting.state.status)) { - fll_error_print(main->program.error, F_status_set_fine(main->setting.state.status), macro_utf8_f(utf8_detect_codepoint), fll_error_file_flag_fallback_e); + fll_error_print(&main->program.error, F_status_set_fine(main->setting.state.status), macro_utf8_f(utf8_detect_codepoint), fll_error_file_flag_fallback_e); break; } diff --git a/level_3/utf8/c/main/utf8.c b/level_3/utf8/c/main/utf8.c index bc89cf5..6986a70 100644 --- a/level_3/utf8/c/main/utf8.c +++ b/level_3/utf8/c/main/utf8.c @@ -23,24 +23,17 @@ extern "C" { main->setting.state.status = F_none; - if (main->setting.flag & utf8_main_flag_help_e) { - utf8_print_message_help(&main->program.message); + if (main->setting.flag & (utf8_main_flag_help_e | utf8_main_flag_version_e | utf8_main_flag_copyright_e)) { - return; - } - - if (main->setting.flag & utf8_main_flag_version_e) { - fll_program_print_version(main->program.message, utf8_program_version_s); - - if ((main->setting.flag & utf8_main_flag_print_last_e) && main->program.message.verbosity > f_console_verbosity_error_e) { - fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); + if (main->setting.flag & utf8_main_flag_help_e) { + utf8_print_message_help(&main->program.message); + } + else if (main->setting.flag & utf8_main_flag_version_e) { + fll_program_print_version(&main->program.message, utf8_program_version_s); + } + else if (main->setting.flag & utf8_main_flag_copyright_e) { + fll_program_print_copyright(&main->program.message); } - - return; - } - - if (main->setting.flag & utf8_main_flag_copyright_e) { - fll_program_print_copyright(main->program.message); if ((main->setting.flag & utf8_main_flag_print_last_e) && main->program.message.verbosity > f_console_verbosity_error_e) { fll_print_dynamic_raw(f_string_eol_s, main->program.message.to);