From: Kevin Day Date: Tue, 13 Sep 2022 01:00:11 +0000 (-0500) Subject: Progress: Continue program related work. X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=130a075f29ed04d44ed63744fb6c044104c129b4;p=fll Progress: Continue program related work. Add more common program print functions. The parameter missing function is ironically missing the print messages. I've decided to accept the loss of binary size for improved runtime efficiency (both of which are likely slight losses and improvements). There are now "unlocked" and "locked" print line first and print line last functions for each program. The boolean for designating lock is removed. These functions are mostly wrappers and so the cost in size to be hopefully negligible. I imagine time will tell whether this is an overall good or a bad decision. Start working on iki_read. --- diff --git a/level_2/fll_program/c/program/print.c b/level_2/fll_program/c/program/print.c index 5dfee1a..b3d0a3d 100644 --- a/level_2/fll_program/c/program/print.c +++ b/level_2/fll_program/c/program/print.c @@ -5,6 +5,21 @@ extern "C" { #endif +#ifndef _di_fll_program_print_error_missing_file_ + f_status_t fll_program_print_error_missing_file(const fl_print_t print) { + + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + + f_file_stream_lock(print.to); + + fl_print_format("%[%QNo files are specified.%]%r", print.to.stream, print.set->error, print.prefix, print.set->error, f_string_eol_s); + + 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) { @@ -69,6 +84,10 @@ extern "C" { f_file_stream_lock(print.to); + fl_print_format("%[%QThe parameter %]", print.to.stream, print.set->error, print.prefix, print.set->error); + fl_print_format("%[%Q%Q%]", print.to.stream, print.set->notable, symbol, parameter, print.set->notable); + fl_print_format("%[ is specified, but no value is given.%]%r", print.to.stream, print.set->error, print.set->error, f_string_eol_s); + 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 4030de7..b70b7a3 100644 --- a/level_2/fll_program/c/program/print.h +++ b/level_2/fll_program/c/program/print.h @@ -17,6 +17,28 @@ extern "C" { #endif /** + * Print an error message when a file is not provided. + * + * This is only printed when verbosity is not set to quiet. + * + * This uses the following: + * - print.set->error: For the error context. + * - print.set->strong: For the highlighting context + * - print.prefix: For the prefixing a string to the message (such as "ERROR:"). + * + * @param print + * The output structure. + * This locks, uses, and unlocks the file stream. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_fll_program_print_error_missing_file_ + extern f_status_t fll_program_print_error_missing_file(const fl_print_t print); +#endif // _di_fll_program_print_error_missing_file_ + +/** * Print an error message a variable not being defined or the variable has a length is 0. * * This is only printed when verbosity is not set to quiet. diff --git a/level_3/byte_dump/c/print.c b/level_3/byte_dump/c/print.c index da007da..281298a 100644 --- a/level_3/byte_dump/c/print.c +++ b/level_3/byte_dump/c/print.c @@ -72,36 +72,73 @@ extern "C" { } #endif // _di_byte_dump_print_help_ -#ifndef _di_byte_dump_print_line_first_ - void byte_dump_print_line_first(byte_dump_setting_t * const setting, const fl_print_t print, const bool lock) { +#ifndef _di_byte_dump_print_line_first_locked_ + f_status_t byte_dump_print_line_first_locked(byte_dump_setting_t * const setting, const fl_print_t print) { - if (print.verbosity == f_console_verbosity_quiet_e) return; + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + if (setting->flag & byte_dump_main_flag_verify_e) return; - if (lock) { - fll_print_dynamic_raw(setting->line_first, print.to.stream); + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; + if (setting->flag & byte_dump_main_flag_file_to_e) return F_output_not; } - else { - f_print_dynamic_raw(setting->line_first, print.to.stream); + + f_print_dynamic_raw(setting->line_first, print.to.stream); + + return F_none; + } +#endif // _di_byte_dump_print_line_first_locked_ + +#ifndef _di_byte_dump_print_line_first_unlocked_ + f_status_t byte_dump_print_line_first_unlocked(byte_dump_setting_t * const setting, const fl_print_t print) { + + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + if (setting->flag & byte_dump_main_flag_verify_e) return; + + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; + if (setting->flag & byte_dump_main_flag_file_to_e) return F_output_not; } + + fll_print_dynamic_raw(setting->line_first, print.to.stream); + + return F_none; } -#endif // _di_byte_dump_print_line_first_ +#endif // _di_byte_dump_print_line_first_unlocked_ -#ifndef _di_byte_dump_print_line_last_ - void byte_dump_print_line_last(byte_dump_setting_t * const setting, const fl_print_t print, const bool lock) { +#ifndef _di_byte_dump_print_line_last_locked_ + f_status_t byte_dump_print_line_last_locked(byte_dump_setting_t * const setting, const fl_print_t print) { - if (print.verbosity == f_console_verbosity_quiet_e) return; - if (print.verbosity == f_console_verbosity_error_e && !F_status_is_error(setting->status)) return; + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; if (setting->flag & byte_dump_main_flag_verify_e) return; - if ((setting->flag & byte_dump_main_flag_file_to_e) && !F_status_is_error(setting->status)) return; - if (lock) { - fll_print_dynamic_raw(setting->line_last, print.to.stream); + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; + if (setting->flag & byte_dump_main_flag_file_to_e) return F_output_not; } - else { - f_print_dynamic_raw(setting->line_last, print.to.stream); + + fll_print_dynamic_raw(setting->line_last, print.to.stream); + + return F_none; + } +#endif // _di_byte_dump_print_line_last_locked_ + +#ifndef _di_byte_dump_print_line_last_unlocked_ + f_status_t byte_dump_print_line_last_unlocked(byte_dump_setting_t * const setting, const fl_print_t print) { + + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + if (setting->flag & byte_dump_main_flag_verify_e) return; + + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; + if (setting->flag & byte_dump_main_flag_file_to_e) return F_output_not; } + + f_print_dynamic_raw(setting->line_last, print.to.stream); + + return F_none; } -#endif // _di_byte_dump_print_line_last_ +#endif // _di_byte_dump_print_line_last_unlocked_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/byte_dump/c/print.h b/level_3/byte_dump/c/print.h index 311a6a3..4035b9d 100644 --- a/level_3/byte_dump/c/print.h +++ b/level_3/byte_dump/c/print.h @@ -37,36 +37,84 @@ extern "C" { * * This is generally either the first line in the program or the first line printed before an error message. * + * This function locks and then unlocks the input stream when printing. + * + * @param setting + * The main program settings. + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_byte_dump_print_line_first_locked_ + extern f_status_t byte_dump_print_line_first_locked(byte_dump_setting_t * const setting, const fl_print_t print); +#endif // _di_byte_dump_print_line_first_locked_ + +/** + * Print first new line, unless verbosity says otherwise. + * + * This is generally either the first line in the program or the first line printed before an error message. + * + * This function neither locks nor unlocks the input stream. + * + * @param setting + * The main program settings. + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_byte_dump_print_line_first_unlocked_ + extern f_status_t byte_dump_print_line_first_unlocked(byte_dump_setting_t * const setting, const fl_print_t print); +#endif // _di_byte_dump_print_line_first_unlocked_ + +/** + * Print last new line when the main is complete, unless verbosity says otherwise. + * + * This is generally the very last line printed in the program. + * + * This function locks and then unlocks the input stream when printing. + * * @param setting * The main program settings. * This does not alter setting.status. * @param print * Designates the how and where to print. - * @param lock - * If TRUE, then lock the stream. - * If FALSE, then do not lock or unlock the stream. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. */ -#ifndef _di_byte_dump_print_line_first_ - extern void byte_dump_print_line_first(byte_dump_setting_t * const setting, const fl_print_t print, const bool lock); -#endif // _di_byte_dump_print_line_first_ +#ifndef _di_byte_dump_print_line_last_locked_ + extern f_status_t byte_dump_print_line_last_locked(byte_dump_setting_t * const setting, const fl_print_t print); +#endif // _di_byte_dump_print_line_last_locked_ /** * Print last new line when the main is complete, unless verbosity says otherwise. * * This is generally the very last line printed in the program. * + * This function neither locks nor unlocks the input stream. + * * @param setting * The main program settings. * This does not alter setting.status. * @param print * Designates the how and where to print. - * @param lock - * If TRUE, then lock the stream. - * If FALSE, then do not lock or unlock the stream. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. */ -#ifndef _di_byte_dump_print_line_last_ - extern void byte_dump_print_line_last(byte_dump_setting_t * const setting, const fl_print_t print, const bool lock); -#endif // _di_byte_dump_print_line_last_ +#ifndef _di_byte_dump_print_line_last_unlocked_ + extern f_status_t byte_dump_print_line_last_unlocked(byte_dump_setting_t * const setting, const fl_print_t print); +#endif // _di_byte_dump_print_line_last_unlocked_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/control/c/print.c b/level_3/control/c/print.c index 66872e5..cd1afc7 100644 --- a/level_3/control/c/print.c +++ b/level_3/control/c/print.c @@ -45,36 +45,73 @@ extern "C" { } #endif // _di_control_print_help_ -#ifndef _di_control_print_line_first_ - void control_print_line_first(control_setting_t * const setting, const fl_print_t print, const bool lock) { +#ifndef _di_control_print_line_first_locked_ + f_status_t control_print_line_first_locked(control_setting_t * const setting, const fl_print_t print) { - if (print.verbosity == f_console_verbosity_quiet_e) return; + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + if (setting->flag & control_main_flag_verify_e) return; - if (lock) { - fll_print_dynamic_raw(setting->line_first, print.to.stream); + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; + if (setting->flag & control_main_flag_file_to_e) return F_output_not; } - else { - f_print_dynamic_raw(setting->line_first, print.to.stream); + + f_print_dynamic_raw(setting->line_first, print.to.stream); + + return F_none; + } +#endif // _di_control_print_line_first_locked_ + +#ifndef _di_control_print_line_first_unlocked_ + f_status_t control_print_line_first_unlocked(control_setting_t * const setting, const fl_print_t print) { + + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + if (setting->flag & control_main_flag_verify_e) return; + + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; + if (setting->flag & control_main_flag_file_to_e) return F_output_not; } + + fll_print_dynamic_raw(setting->line_first, print.to.stream); + + return F_none; } -#endif // _di_control_print_line_first_ +#endif // _di_control_print_line_first_unlocked_ -#ifndef _di_control_print_line_last_ - void control_print_line_last(control_setting_t * const setting, const fl_print_t print, const bool lock) { +#ifndef _di_control_print_line_last_locked_ + f_status_t control_print_line_last_locked(control_setting_t * const setting, const fl_print_t print) { - if (print.verbosity == f_console_verbosity_quiet_e) return; - if (print.verbosity == f_console_verbosity_error_e && !F_status_is_error(setting->status)) return; + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; if (setting->flag & control_main_flag_verify_e) return; - if ((setting->flag & control_main_flag_file_to_e) && !F_status_is_error(setting->status)) return; - if (lock) { - fll_print_dynamic_raw(setting->line_last, print.to.stream); + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; + if (setting->flag & control_main_flag_file_to_e) return F_output_not; } - else { - f_print_dynamic_raw(setting->line_last, print.to.stream); + + fll_print_dynamic_raw(setting->line_last, print.to.stream); + + return F_none; + } +#endif // _di_control_print_line_last_locked_ + +#ifndef _di_control_print_line_last_unlocked_ + f_status_t control_print_line_last_unlocked(control_setting_t * const setting, const fl_print_t print) { + + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + if (setting->flag & control_main_flag_verify_e) return; + + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; + if (setting->flag & control_main_flag_file_to_e) return F_output_not; } + + f_print_dynamic_raw(setting->line_last, print.to.stream); + + return F_none; } -#endif // _di_control_print_line_last_ +#endif // _di_control_print_line_last_unlocked_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/control/c/print.h b/level_3/control/c/print.h index d0fbdea..70dd24c 100644 --- a/level_3/control/c/print.h +++ b/level_3/control/c/print.h @@ -15,53 +15,103 @@ extern "C" { /** * Print help. * - * @param main - * The main program data. + * @param setting + * The main program settings. + * This does not alter setting.status. + * @param print + * The output structure to print to. * * @return * F_none on success. - * - * @see control_main() + * F_output_not on success, but no printing is performed. */ #ifndef _di_control_print_help_ - extern f_status_t control_print_help(const fll_program_data_t * const main); -#endif // _di_control_print_help_ + extern f_status_t control_print_help(control_setting_t * const setting, const fl_print_t print); +#endif // _di_control_print_help_control /** * Print first new line, unless verbosity says otherwise. * * This is generally either the first line in the program or the first line printed before an error message. * + * This function locks and then unlocks the input stream when printing. + * * @param setting * The main program settings. * This does not alter setting.status. * @param print * Designates the how and where to print. - * @param lock - * If TRUE, then lock the stream. - * If FALSE, then do not lock or unlock the stream. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. */ -#ifndef _di_control_print_line_first_ - extern void control_print_line_first(control_setting_t * const setting, const fl_print_t print, const bool lock); -#endif // _di_control_print_line_first_ +#ifndef _di_control_print_line_first_locked_ + extern f_status_t control_print_line_first_locked(control_setting_t * const setting, const fl_print_t print); +#endif // _di_control_print_line_first_locked_ + +/** + * Print first new line, unless verbosity says otherwise. + * + * This is generally either the first line in the program or the first line printed before an error message. + * + * This function neither locks nor unlocks the input stream. + * + * @param setting + * The main program settings. + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_control_print_line_first_unlocked_ + extern f_status_t control_print_line_first_unlocked(control_setting_t * const setting, const fl_print_t print); +#endif // _di_control_print_line_first_unlocked_ + +/** + * Print last new line when the main is complete, unless verbosity says otherwise. + * + * This is generally the very last line printed in the program. + * + * This function locks and then unlocks the input stream when printing. + * + * @param setting + * The main program settings. + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_control_print_line_last_locked_ + extern f_status_t control_print_line_last_locked(control_setting_t * const setting, const fl_print_t print); +#endif // _di_control_print_line_last_locked_ /** * Print last new line when the main is complete, unless verbosity says otherwise. * * This is generally the very last line printed in the program. * + * This function neither locks nor unlocks the input stream. + * * @param setting * The main program settings. * This does not alter setting.status. * @param print * Designates the how and where to print. - * @param lock - * If TRUE, then lock the stream. - * If FALSE, then do not lock or unlock the stream. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. */ -#ifndef _di_control_print_line_last_ - extern void control_print_line_last(control_setting_t * const setting, const fl_print_t print, const bool lock); -#endif // _di_control_print_line_last_ +#ifndef _di_control_print_line_last_unlocked_ + extern f_status_t control_print_line_last_unlocked(control_setting_t * const setting, const fl_print_t print); +#endif // _di_control_print_line_last_unlocked_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/controller/c/print.c b/level_3/controller/c/print.c index 4e41cd3..333c85f 100644 --- a/level_3/controller/c/print.c +++ b/level_3/controller/c/print.c @@ -48,36 +48,73 @@ extern "C" { } #endif // _di_controller_print_help_ -#ifndef _di_controller_print_line_first_ - void controller_print_line_first(controller_setting_t * const setting, const fl_print_t print, const bool lock) { +#ifndef _di_controller_print_line_first_locked_ + f_status_t controller_print_line_first_locked(controller_setting_t * const setting, const fl_print_t print) { - if (print.verbosity == f_console_verbosity_quiet_e) return; + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + if (setting->flag & controller_main_flag_verify_e) return; - if (lock) { - fll_print_dynamic_raw(setting->line_first, print.to.stream); + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; + if (setting->flag & controller_main_flag_file_to_e) return F_output_not; } - else { - f_print_dynamic_raw(setting->line_first, print.to.stream); + + f_print_dynamic_raw(setting->line_first, print.to.stream); + + return F_none; + } +#endif // _di_controller_print_line_first_locked_ + +#ifndef _di_controller_print_line_first_unlocked_ + f_status_t controller_print_line_first_unlocked(controller_setting_t * const setting, const fl_print_t print) { + + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + if (setting->flag & controller_main_flag_verify_e) return; + + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; + if (setting->flag & controller_main_flag_file_to_e) return F_output_not; } + + fll_print_dynamic_raw(setting->line_first, print.to.stream); + + return F_none; } -#endif // _di_controller_print_line_first_ +#endif // _di_controller_print_line_first_unlocked_ -#ifndef _di_controller_print_line_last_ - void controller_print_line_last(controller_setting_t * const setting, const fl_print_t print, const bool lock) { +#ifndef _di_controller_print_line_last_locked_ + f_status_t controller_print_line_last_locked(controller_setting_t * const setting, const fl_print_t print) { - if (print.verbosity == f_console_verbosity_quiet_e) return; - if (print.verbosity == f_console_verbosity_error_e && !F_status_is_error(setting->status)) return; + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; if (setting->flag & controller_main_flag_verify_e) return; - if ((setting->flag & controller_main_flag_file_to_e) && !F_status_is_error(setting->status)) return; - if (lock) { - fll_print_dynamic_raw(setting->line_last, print.to.stream); + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; + if (setting->flag & controller_main_flag_file_to_e) return F_output_not; } - else { - f_print_dynamic_raw(setting->line_last, print.to.stream); + + fll_print_dynamic_raw(setting->line_last, print.to.stream); + + return F_none; + } +#endif // _di_controller_print_line_last_locked_ + +#ifndef _di_controller_print_line_last_unlocked_ + f_status_t controller_print_line_last_unlocked(controller_setting_t * const setting, const fl_print_t print) { + + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + if (setting->flag & controller_main_flag_verify_e) return; + + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; + if (setting->flag & controller_main_flag_file_to_e) return F_output_not; } + + f_print_dynamic_raw(setting->line_last, print.to.stream); + + return F_none; } -#endif // _di_controller_print_line_last_ +#endif // _di_controller_print_line_last_unlocked_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/controller/c/print.h b/level_3/controller/c/print.h index c791d96..5638bd7 100644 --- a/level_3/controller/c/print.h +++ b/level_3/controller/c/print.h @@ -15,16 +15,18 @@ extern "C" { /** * Print help. * - * @param main - * The main program data. + * @param setting + * The main program settings. + * This does not alter setting.status. + * @param print + * The output structure to print to. * * @return * F_none on success. - * - * @see controller_main() + * F_output_not on success, but no printing is performed. */ #ifndef _di_controller_print_help_ - extern f_status_t controller_print_help(controller_main_t * const main); + extern f_status_t controller_print_help(controller_setting_t * const setting, const fl_print_t print); #endif // _di_controller_print_help_ /** @@ -32,37 +34,84 @@ extern "C" { * * This is generally either the first line in the program or the first line printed before an error message. * + * This function locks and then unlocks the input stream when printing. + * + * @param setting + * The main program settings. + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_controller_print_line_first_locked_ + extern f_status_t controller_print_line_first_locked(controller_setting_t * const setting, const fl_print_t print); +#endif // _di_controller_print_line_first_locked_ + +/** + * Print first new line, unless verbosity says otherwise. + * + * This is generally either the first line in the program or the first line printed before an error message. + * + * This function neither locks nor unlocks the input stream. + * * @param setting * The main program settings. * This does not alter setting.status. * @param print * Designates the how and where to print. - * @param lock - * If TRUE, then lock the stream. - * If FALSE, then do not lock or unlock the stream. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. */ -#ifndef _di_controller_print_line_first_ - extern void controller_print_line_first(controller_setting_t * const setting, const fl_print_t print, const bool lock); -#endif // _di_controller_print_line_first_ +#ifndef _di_controller_print_line_first_unlocked_ + extern f_status_t controller_print_line_first_unlocked(controller_setting_t * const setting, const fl_print_t print); +#endif // _di_controller_print_line_first_unlocked_ /** * Print last new line when the main is complete, unless verbosity says otherwise. * * This is generally the very last line printed in the program. * + * This function locks and then unlocks the input stream when printing. + * * @param setting * The main program settings. * This does not alter setting.status. * @param print * Designates the how and where to print. - * @param lock - * If TRUE, then lock the stream. - * If FALSE, then do not lock or unlock the stream. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. */ -#ifndef _di_controller_print_line_last_ - extern void controller_print_line_last(controller_setting_t * const setting, const fl_print_t print, const bool lock); -#endif // _di_controller_print_line_last_ +#ifndef _di_controller_print_line_last_locked_ + extern f_status_t controller_print_line_last_locked(controller_setting_t * const setting, const fl_print_t print); +#endif // _di_controller_print_line_last_locked_ +/** + * Print last new line when the main is complete, unless verbosity says otherwise. + * + * This is generally the very last line printed in the program. + * + * This function neither locks nor unlocks the input stream. + * + * @param setting + * The main program settings. + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_controller_print_line_last_unlocked_ + extern f_status_t controller_print_line_last_unlocked(controller_setting_t * const setting, const fl_print_t print); +#endif // _di_controller_print_line_last_unlocked_ #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/fake/c/print.c b/level_3/fake/c/print.c index ab66530..60d435b 100644 --- a/level_3/fake/c/print.c +++ b/level_3/fake/c/print.c @@ -76,36 +76,65 @@ extern "C" { } #endif // _di_fake_print_help_ -#ifndef _di_fake_print_line_first_ - void fake_print_line_first(fake_setting_t * const setting, const fl_print_t print, const bool lock) { +#ifndef _di_fake_print_line_first_locked_ + f_status_t fake_print_line_first_locked(fake_setting_t * const setting, const fl_print_t print) { - if (print.verbosity == f_console_verbosity_quiet_e) return; + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - if (lock) { - fll_print_dynamic_raw(setting->line_first, print.to.stream); + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } - else { - f_print_dynamic_raw(setting->line_first, print.to.stream); + + f_print_dynamic_raw(setting->line_first, print.to.stream); + + return F_none; + } +#endif // _di_fake_print_line_first_locked_ + +#ifndef _di_fake_print_line_first_unlocked_ + f_status_t fake_print_line_first_unlocked(fake_setting_t * const setting, const fl_print_t print) { + + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } + + fll_print_dynamic_raw(setting->line_first, print.to.stream); + + return F_none; } -#endif // _di_fake_print_line_first_ +#endif // _di_fake_print_line_first_unlocked_ -#ifndef _di_fake_print_line_last_ - void fake_print_line_last(fake_setting_t * const setting, const fl_print_t print, const bool lock) { +#ifndef _di_fake_print_line_last_locked_ + f_status_t fake_print_line_last_locked(fake_setting_t * const setting, const fl_print_t print) { - if (print.verbosity == f_console_verbosity_quiet_e) return; - if (print.verbosity == f_console_verbosity_error_e && !F_status_is_error(setting->status)) return; - if (setting->flag & fake_main_flag_verify_e) return; - if ((setting->flag & fake_main_flag_file_to_e) && !F_status_is_error(setting->status)) return; + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - if (lock) { - fll_print_dynamic_raw(setting->line_last, print.to.stream); + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } - else { - f_print_dynamic_raw(setting->line_last, print.to.stream); + + fll_print_dynamic_raw(setting->line_last, print.to.stream); + + return F_none; + } +#endif // _di_fake_print_line_last_locked_ + +#ifndef _di_fake_print_line_last_unlocked_ + f_status_t fake_print_line_last_unlocked(fake_setting_t * const setting, const fl_print_t print) { + + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } + + f_print_dynamic_raw(setting->line_last, print.to.stream); + + return F_none; } -#endif // _di_fake_print_line_last_ +#endif // _di_fake_print_line_last_unlocked_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/fake/c/print.h b/level_3/fake/c/print.h index 4f10ebd..1462485 100644 --- a/level_3/fake/c/print.h +++ b/level_3/fake/c/print.h @@ -33,36 +33,84 @@ extern "C" { * * This is generally either the first line in the program or the first line printed before an error message. * + * This function locks and then unlocks the input stream when printing. + * + * @param setting + * The main program settings. + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_fake_print_line_first_locked_ + extern f_status_t fake_print_line_first_locked(fake_setting_t * const setting, const fl_print_t print); +#endif // _di_fake_print_line_first_locked_ + +/** + * Print first new line, unless verbosity says otherwise. + * + * This is generally either the first line in the program or the first line printed before an error message. + * + * This function neither locks nor unlocks the input stream. + * + * @param setting + * The main program settings. + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_fake_print_line_first_unlocked_ + extern f_status_t fake_print_line_first_unlocked(fake_setting_t * const setting, const fl_print_t print); +#endif // _di_fake_print_line_first_unlocked_ + +/** + * Print last new line when the main is complete, unless verbosity says otherwise. + * + * This is generally the very last line printed in the program. + * + * This function locks and then unlocks the input stream when printing. + * * @param setting * The main program settings. * This does not alter setting.status. * @param print * Designates the how and where to print. - * @param lock - * If TRUE, then lock the stream. - * If FALSE, then do not lock or unlock the stream. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. */ -#ifndef _di_fake_print_line_first_ - extern void fake_print_line_first(fake_setting_t * const setting, const fl_print_t print, const bool lock); -#endif // _di_fake_print_line_first_ +#ifndef _di_fake_print_line_last_locked_ + extern f_status_t fake_print_line_last_locked(fake_setting_t * const setting, const fl_print_t print); +#endif // _di_fake_print_line_last_locked_ /** * Print last new line when the main is complete, unless verbosity says otherwise. * * This is generally the very last line printed in the program. * + * This function neither locks nor unlocks the input stream. + * * @param setting * The main program settings. * This does not alter setting.status. * @param print * Designates the how and where to print. - * @param lock - * If TRUE, then lock the stream. - * If FALSE, then do not lock or unlock the stream. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. */ -#ifndef _di_fake_print_line_last_ - extern void fake_print_line_last(fake_setting_t * const setting, const fl_print_t print, const bool lock); -#endif // _di_fake_print_line_last_ +#ifndef _di_fake_print_line_last_unlocked_ + extern f_status_t fake_print_line_last_unlocked(fake_setting_t * const setting, const fl_print_t print); +#endif // _di_fake_print_line_last_unlocked_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/firewall/c/print.c b/level_3/firewall/c/print.c index 7c2eaea..b11d269 100644 --- a/level_3/firewall/c/print.c +++ b/level_3/firewall/c/print.c @@ -6,7 +6,7 @@ extern "C" { #endif #ifndef _di_firewall_print_help_ - f_status_t firewall_print_help(utf8_setting_t * const setting, const fl_print_t print) { + f_status_t firewall_print_help(firewall_setting_t * const setting, const fl_print_t print) { f_file_stream_lock(print.to); @@ -34,36 +34,65 @@ extern "C" { } #endif // _di_firewall_print_help_ -#ifndef _di_firewall_print_line_first_ - void firewall_print_line_first(firewall_setting_t * const setting, const fl_print_t print, const bool lock) { +#ifndef _di_firewall_print_line_first_locked_ + f_status_t firewall_print_line_first_locked(firewall_setting_t * const setting, const fl_print_t print) { - if (print.verbosity == f_console_verbosity_quiet_e) return; + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - if (lock) { - fll_print_dynamic_raw(setting->line_first, print.to.stream); + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } - else { - f_print_dynamic_raw(setting->line_first, print.to.stream); + + f_print_dynamic_raw(setting->line_first, print.to.stream); + + return F_none; + } +#endif // _di_firewall_print_line_first_locked_ + +#ifndef _di_firewall_print_line_first_unlocked_ + f_status_t firewall_print_line_first_unlocked(firewall_setting_t * const setting, const fl_print_t print) { + + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } + + fll_print_dynamic_raw(setting->line_first, print.to.stream); + + return F_none; } -#endif // _di_firewall_print_line_first_ +#endif // _di_firewall_print_line_first_unlocked_ -#ifndef _di_firewall_print_line_last_ - void firewall_print_line_last(firewall_setting_t * const setting, const fl_print_t print, const bool lock) { +#ifndef _di_firewall_print_line_last_locked_ + f_status_t firewall_print_line_last_locked(firewall_setting_t * const setting, const fl_print_t print) { - if (print.verbosity == f_console_verbosity_quiet_e) return; - if (print.verbosity == f_console_verbosity_error_e && !F_status_is_error(setting->status)) return; - if (setting->flag & firewall_main_flag_verify_e) return; - if ((setting->flag & firewall_main_flag_file_to_e) && !F_status_is_error(setting->status)) return; + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - if (lock) { - fll_print_dynamic_raw(setting->line_last, print.to.stream); + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } - else { - f_print_dynamic_raw(setting->line_last, print.to.stream); + + fll_print_dynamic_raw(setting->line_last, print.to.stream); + + return F_none; + } +#endif // _di_firewall_print_line_last_locked_ + +#ifndef _di_firewall_print_line_last_unlocked_ + f_status_t firewall_print_line_last_unlocked(firewall_setting_t * const setting, const fl_print_t print) { + + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } + + f_print_dynamic_raw(setting->line_last, print.to.stream); + + return F_none; } -#endif // _di_firewall_print_line_last_ +#endif // _di_firewall_print_line_last_unlocked_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/firewall/c/print.h b/level_3/firewall/c/print.h index f7ff2c4..cbcae87 100644 --- a/level_3/firewall/c/print.h +++ b/level_3/firewall/c/print.h @@ -33,36 +33,84 @@ extern "C" { * * This is generally either the first line in the program or the first line printed before an error message. * + * This function locks and then unlocks the input stream when printing. + * + * @param setting + * The main program settings. + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_firewall_print_line_first_locked_ + extern f_status_t firewall_print_line_first_locked(firewall_setting_t * const setting, const fl_print_t print); +#endif // _di_firewall_print_line_first_locked_ + +/** + * Print first new line, unless verbosity says otherwise. + * + * This is generally either the first line in the program or the first line printed before an error message. + * + * This function neither locks nor unlocks the input stream. + * + * @param setting + * The main program settings. + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_firewall_print_line_first_unlocked_ + extern f_status_t firewall_print_line_first_unlocked(firewall_setting_t * const setting, const fl_print_t print); +#endif // _di_firewall_print_line_first_unlocked_ + +/** + * Print last new line when the main is complete, unless verbosity says otherwise. + * + * This is generally the very last line printed in the program. + * + * This function locks and then unlocks the input stream when printing. + * * @param setting * The main program settings. * This does not alter setting.status. * @param print * Designates the how and where to print. - * @param lock - * If TRUE, then lock the stream. - * If FALSE, then do not lock or unlock the stream. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. */ -#ifndef _di_firewall_print_line_first_ - extern void firewall_print_line_first(firewall_setting_t * const setting, const fl_print_t print, const bool lock); -#endif // _di_firewall_print_line_first_ +#ifndef _di_firewall_print_line_last_locked_ + extern f_status_t firewall_print_line_last_locked(firewall_setting_t * const setting, const fl_print_t print); +#endif // _di_firewall_print_line_last_locked_ /** * Print last new line when the main is complete, unless verbosity says otherwise. * * This is generally the very last line printed in the program. * + * This function neither locks nor unlocks the input stream. + * * @param setting * The main program settings. * This does not alter setting.status. * @param print * Designates the how and where to print. - * @param lock - * If TRUE, then lock the stream. - * If FALSE, then do not lock or unlock the stream. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. */ -#ifndef _di_firewall_print_line_last_ - extern void firewall_print_line_last(firewall_setting_t * const setting, const fl_print_t print, const bool lock); -#endif // _di_firewall_print_line_last_ +#ifndef _di_firewall_print_line_last_unlocked_ + extern f_status_t firewall_print_line_last_unlocked(firewall_setting_t * const setting, const fl_print_t print); +#endif // _di_firewall_print_line_last_unlocked_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/fss_basic_list_read/c/print.c b/level_3/fss_basic_list_read/c/print.c index c74adf8..a00e970 100644 --- a/level_3/fss_basic_list_read/c/print.c +++ b/level_3/fss_basic_list_read/c/print.c @@ -6,7 +6,7 @@ extern "C" { #endif #ifndef _di_fss_basic_list_read_print_help_ - f_status_t fss_basic_list_read_print_help(utf8_setting_t * const setting, const fl_print_t print) { + f_status_t fss_basic_list_read_print_help(fss_basic_list_read_setting_t * const setting, const fl_print_t print) { f_file_stream_lock(print.to); @@ -112,36 +112,65 @@ extern "C" { } #endif // _di_fss_basic_list_read_print_help_ -#ifndef _di_fss_basic_list_read_print_line_first_ - void fss_basic_list_read_print_line_first(fss_basic_list_read_setting_t * const setting, const fl_print_t print, const bool lock) { +#ifndef _di_fss_basic_list_read_print_line_first_locked_ + f_status_t fss_basic_list_read_print_line_first_locked(fss_basic_list_read_setting_t * const setting, const fl_print_t print) { - if (print.verbosity == f_console_verbosity_quiet_e) return; + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - if (lock) { - fll_print_dynamic_raw(setting->line_first, print.to.stream); + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } - else { - f_print_dynamic_raw(setting->line_first, print.to.stream); + + f_print_dynamic_raw(setting->line_first, print.to.stream); + + return F_none; + } +#endif // _di_fss_basic_list_read_print_line_first_locked_ + +#ifndef _di_fss_basic_list_read_print_line_first_unlocked_ + f_status_t fss_basic_list_read_print_line_first_unlocked(fss_basic_list_read_setting_t * const setting, const fl_print_t print) { + + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } + + fll_print_dynamic_raw(setting->line_first, print.to.stream); + + return F_none; } -#endif // _di_fss_basic_list_read_print_line_first_ +#endif // _di_fss_basic_list_read_print_line_first_unlocked_ -#ifndef _di_fss_basic_list_read_print_line_last_ - void fss_basic_list_read_print_line_last(fss_basic_list_read_setting_t * const setting, const fl_print_t print, const bool lock) { +#ifndef _di_fss_basic_list_read_print_line_last_locked_ + f_status_t fss_basic_list_read_print_line_last_locked(fss_basic_list_read_setting_t * const setting, const fl_print_t print) { - if (print.verbosity == f_console_verbosity_quiet_e) return; - if (print.verbosity == f_console_verbosity_error_e && !F_status_is_error(setting->status)) return; - if (setting->flag & fss_basic_list_read_main_flag_verify_e) return; - if ((setting->flag & fss_basic_list_read_main_flag_file_to_e) && !F_status_is_error(setting->status)) return; + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - if (lock) { - fll_print_dynamic_raw(setting->line_last, print.to.stream); + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } - else { - f_print_dynamic_raw(setting->line_last, print.to.stream); + + fll_print_dynamic_raw(setting->line_last, print.to.stream); + + return F_none; + } +#endif // _di_fss_basic_list_read_print_line_last_locked_ + +#ifndef _di_fss_basic_list_read_print_line_last_unlocked_ + f_status_t fss_basic_list_read_print_line_last_unlocked(fss_basic_list_read_setting_t * const setting, const fl_print_t print) { + + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } + + f_print_dynamic_raw(setting->line_last, print.to.stream); + + return F_none; } -#endif // _di_fss_basic_list_read_print_line_last_ +#endif // _di_fss_basic_list_read_print_line_last_unlocked_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/fss_basic_list_read/c/print.h b/level_3/fss_basic_list_read/c/print.h index d75c2f3..c43ccc1 100644 --- a/level_3/fss_basic_list_read/c/print.h +++ b/level_3/fss_basic_list_read/c/print.h @@ -33,36 +33,84 @@ extern "C" { * * This is generally either the first line in the program or the first line printed before an error message. * + * This function locks and then unlocks the input stream when printing. + * + * @param setting + * The main program settings. + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_fss_basic_list_read_print_line_first_locked_ + extern f_status_t fss_basic_list_read_print_line_first_locked(fss_basic_list_read_setting_t * const setting, const fl_print_t print); +#endif // _di_fss_basic_list_read_print_line_first_locked_ + +/** + * Print first new line, unless verbosity says otherwise. + * + * This is generally either the first line in the program or the first line printed before an error message. + * + * This function neither locks nor unlocks the input stream. + * + * @param setting + * The main program settings. + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_fss_basic_list_read_print_line_first_unlocked_ + extern f_status_t fss_basic_list_read_print_line_first_unlocked(fss_basic_list_read_setting_t * const setting, const fl_print_t print); +#endif // _di_fss_basic_list_read_print_line_first_unlocked_ + +/** + * Print last new line when the main is complete, unless verbosity says otherwise. + * + * This is generally the very last line printed in the program. + * + * This function locks and then unlocks the input stream when printing. + * * @param setting * The main program settings. * This does not alter setting.status. * @param print * Designates the how and where to print. - * @param lock - * If TRUE, then lock the stream. - * If FALSE, then do not lock or unlock the stream. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. */ -#ifndef _di_fss_basic_list_read_print_line_first_ - extern void fss_basic_list_read_print_line_first(fss_basic_list_read_setting_t * const setting, const fl_print_t print, const bool lock); -#endif // _di_fss_basic_list_read_print_line_first_ +#ifndef _di_fss_basic_list_read_print_line_last_locked_ + extern f_status_t fss_basic_list_read_print_line_last_locked(fss_basic_list_read_setting_t * const setting, const fl_print_t print); +#endif // _di_fss_basic_list_read_print_line_last_locked_ /** * Print last new line when the main is complete, unless verbosity says otherwise. * * This is generally the very last line printed in the program. * + * This function neither locks nor unlocks the input stream. + * * @param setting * The main program settings. * This does not alter setting.status. * @param print * Designates the how and where to print. - * @param lock - * If TRUE, then lock the stream. - * If FALSE, then do not lock or unlock the stream. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. */ -#ifndef _di_fss_basic_list_read_print_line_last_ - extern void fss_basic_list_read_print_line_last(fss_basic_list_read_setting_t * const setting, const fl_print_t print, const bool lock); -#endif // _di_fss_basic_list_read_print_line_last_ +#ifndef _di_fss_basic_list_read_print_line_last_unlocked_ + extern f_status_t fss_basic_list_read_print_line_last_unlocked(fss_basic_list_read_setting_t * const setting, const fl_print_t print); +#endif // _di_fss_basic_list_read_print_line_last_unlocked_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/fss_basic_list_write/c/print.c b/level_3/fss_basic_list_write/c/print.c index 10b3659..9b54583 100644 --- a/level_3/fss_basic_list_write/c/print.c +++ b/level_3/fss_basic_list_write/c/print.c @@ -6,7 +6,7 @@ extern "C" { #endif #ifndef _di_fss_basic_list_write_print_help_ - f_status_t fss_basic_list_write_print_help(utf8_setting_t * const setting, const fl_print_t print) { + f_status_t fss_basic_list_write_print_help(fss_basic_list_write_setting_t * const setting, const fl_print_t print) { f_file_stream_lock(print.to); @@ -52,36 +52,65 @@ extern "C" { } #endif // _di_fss_basic_list_write_print_help_ -#ifndef _di_fss_basic_list_write_print_line_first_ - void fss_basic_list_write_print_line_first(fss_basic_list_write_setting_t * const setting, const fl_print_t print, const bool lock) { +#ifndef _di_fss_basic_list_write_print_line_first_locked_ + f_status_t fss_basic_list_write_print_line_first_locked(fss_basic_list_write_setting_t * const setting, const fl_print_t print) { - if (print.verbosity == f_console_verbosity_quiet_e) return; + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - if (lock) { - fll_print_dynamic_raw(setting->line_first, print.to.stream); + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } - else { - f_print_dynamic_raw(setting->line_first, print.to.stream); + + f_print_dynamic_raw(setting->line_first, print.to.stream); + + return F_none; + } +#endif // _di_fss_basic_list_write_print_line_first_locked_ + +#ifndef _di_fss_basic_list_write_print_line_first_unlocked_ + f_status_t fss_basic_list_write_print_line_first_unlocked(fss_basic_list_write_setting_t * const setting, const fl_print_t print) { + + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } + + fll_print_dynamic_raw(setting->line_first, print.to.stream); + + return F_none; } -#endif // _di_fss_basic_list_write_print_line_first_ +#endif // _di_fss_basic_list_write_print_line_first_unlocked_ -#ifndef _di_fss_basic_list_write_print_line_last_ - void fss_basic_list_write_print_line_last(fss_basic_list_write_setting_t * const setting, const fl_print_t print, const bool lock) { +#ifndef _di_fss_basic_list_write_print_line_last_locked_ + f_status_t fss_basic_list_write_print_line_last_locked(fss_basic_list_write_setting_t * const setting, const fl_print_t print) { - if (print.verbosity == f_console_verbosity_quiet_e) return; - if (print.verbosity == f_console_verbosity_error_e && !F_status_is_error(setting->status)) return; - if (setting->flag & fss_basic_list_write_main_flag_verify_e) return; - if ((setting->flag & fss_basic_list_write_main_flag_file_to_e) && !F_status_is_error(setting->status)) return; + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - if (lock) { - fll_print_dynamic_raw(setting->line_last, print.to.stream); + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } - else { - f_print_dynamic_raw(setting->line_last, print.to.stream); + + fll_print_dynamic_raw(setting->line_last, print.to.stream); + + return F_none; + } +#endif // _di_fss_basic_list_write_print_line_last_locked_ + +#ifndef _di_fss_basic_list_write_print_line_last_unlocked_ + f_status_t fss_basic_list_write_print_line_last_unlocked(fss_basic_list_write_setting_t * const setting, const fl_print_t print) { + + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } + + f_print_dynamic_raw(setting->line_last, print.to.stream); + + return F_none; } -#endif // _di_fss_basic_list_write_print_line_last_ +#endif // _di_fss_basic_list_write_print_line_last_unlocked_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/fss_basic_list_write/c/print.h b/level_3/fss_basic_list_write/c/print.h index 12ddbc0..a0202f4 100644 --- a/level_3/fss_basic_list_write/c/print.h +++ b/level_3/fss_basic_list_write/c/print.h @@ -33,36 +33,84 @@ extern "C" { * * This is generally either the first line in the program or the first line printed before an error message. * + * This function locks and then unlocks the input stream when printing. + * + * @param setting + * The main program settings. + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_fss_basic_list_write_print_line_first_locked_ + extern f_status_t fss_basic_list_write_print_line_first_locked(fss_basic_list_write_setting_t * const setting, const fl_print_t print); +#endif // _di_fss_basic_list_write_print_line_first_locked_ + +/** + * Print first new line, unless verbosity says otherwise. + * + * This is generally either the first line in the program or the first line printed before an error message. + * + * This function neither locks nor unlocks the input stream. + * + * @param setting + * The main program settings. + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_fss_basic_list_write_print_line_first_unlocked_ + extern f_status_t fss_basic_list_write_print_line_first_unlocked(fss_basic_list_write_setting_t * const setting, const fl_print_t print); +#endif // _di_fss_basic_list_write_print_line_first_unlocked_ + +/** + * Print last new line when the main is complete, unless verbosity says otherwise. + * + * This is generally the very last line printed in the program. + * + * This function locks and then unlocks the input stream when printing. + * * @param setting * The main program settings. * This does not alter setting.status. * @param print * Designates the how and where to print. - * @param lock - * If TRUE, then lock the stream. - * If FALSE, then do not lock or unlock the stream. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. */ -#ifndef _di_fss_basic_list_write_print_line_first_ - extern void fss_basic_list_write_print_line_first(fss_basic_list_write_setting_t * const setting, const fl_print_t print, const bool lock); -#endif // _di_fss_basic_list_write_print_line_first_ +#ifndef _di_fss_basic_list_write_print_line_last_locked_ + extern f_status_t fss_basic_list_write_print_line_last_locked(fss_basic_list_write_setting_t * const setting, const fl_print_t print); +#endif // _di_fss_basic_list_write_print_line_last_locked_ /** * Print last new line when the main is complete, unless verbosity says otherwise. * * This is generally the very last line printed in the program. * + * This function neither locks nor unlocks the input stream. + * * @param setting * The main program settings. * This does not alter setting.status. * @param print * Designates the how and where to print. - * @param lock - * If TRUE, then lock the stream. - * If FALSE, then do not lock or unlock the stream. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. */ -#ifndef _di_fss_basic_list_write_print_line_last_ - extern void fss_basic_list_write_print_line_last(fss_basic_list_write_setting_t * const setting, const fl_print_t print, const bool lock); -#endif // _di_fss_basic_list_write_print_line_last_ +#ifndef _di_fss_basic_list_write_print_line_last_unlocked_ + extern f_status_t fss_basic_list_write_print_line_last_unlocked(fss_basic_list_write_setting_t * const setting, const fl_print_t print); +#endif // _di_fss_basic_list_write_print_line_last_unlocked_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/fss_basic_read/c/print.c b/level_3/fss_basic_read/c/print.c index 13fd2b3..60f5225 100644 --- a/level_3/fss_basic_read/c/print.c +++ b/level_3/fss_basic_read/c/print.c @@ -112,36 +112,65 @@ extern "C" { } #endif // _di_fss_basic_read_print_help_ -#ifndef _di_fss_basic_read_print_line_first_ - void fss_basic_read_print_line_first(fss_basic_read_setting_t * const setting, const fl_print_t print, const bool lock) { +#ifndef _di_fss_basic_read_print_line_first_locked_ + f_status_t fss_basic_read_print_line_first_locked(fss_basic_read_setting_t * const setting, const fl_print_t print) { - if (print.verbosity == f_console_verbosity_quiet_e) return; + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - if (lock) { - fll_print_dynamic_raw(setting->line_first, print.to.stream); + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } - else { - f_print_dynamic_raw(setting->line_first, print.to.stream); + + f_print_dynamic_raw(setting->line_first, print.to.stream); + + return F_none; + } +#endif // _di_fss_basic_read_print_line_first_locked_ + +#ifndef _di_fss_basic_read_print_line_first_unlocked_ + f_status_t fss_basic_read_print_line_first_unlocked(fss_basic_read_setting_t * const setting, const fl_print_t print) { + + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } + + fll_print_dynamic_raw(setting->line_first, print.to.stream); + + return F_none; } -#endif // _di_fss_basic_read_print_line_first_ +#endif // _di_fss_basic_read_print_line_first_unlocked_ -#ifndef _di_fss_basic_read_print_line_last_ - void fss_basic_read_print_line_last(fss_basic_read_setting_t * const setting, const fl_print_t print, const bool lock) { +#ifndef _di_fss_basic_read_print_line_last_locked_ + f_status_t fss_basic_read_print_line_last_locked(fss_basic_read_setting_t * const setting, const fl_print_t print) { - if (print.verbosity == f_console_verbosity_quiet_e) return; - if (print.verbosity == f_console_verbosity_error_e && !F_status_is_error(setting->status)) return; - if (setting->flag & fss_basic_read_main_flag_verify_e) return; - if ((setting->flag & fss_basic_read_main_flag_file_to_e) && !F_status_is_error(setting->status)) return; + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - if (lock) { - fll_print_dynamic_raw(setting->line_last, print.to.stream); + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } - else { - f_print_dynamic_raw(setting->line_last, print.to.stream); + + fll_print_dynamic_raw(setting->line_last, print.to.stream); + + return F_none; + } +#endif // _di_fss_basic_read_print_line_last_locked_ + +#ifndef _di_fss_basic_read_print_line_last_unlocked_ + f_status_t fss_basic_read_print_line_last_unlocked(fss_basic_read_setting_t * const setting, const fl_print_t print) { + + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } + + f_print_dynamic_raw(setting->line_last, print.to.stream); + + return F_none; } -#endif // _di_fss_basic_read_print_line_last_ +#endif // _di_fss_basic_read_print_line_last_unlocked_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/fss_basic_read/c/print.h b/level_3/fss_basic_read/c/print.h index ae20be3..8afec0d 100644 --- a/level_3/fss_basic_read/c/print.h +++ b/level_3/fss_basic_read/c/print.h @@ -33,36 +33,84 @@ extern "C" { * * This is generally either the first line in the program or the first line printed before an error message. * + * This function locks and then unlocks the input stream when printing. + * + * @param setting + * The main program settings. + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_fss_basic_read_print_line_first_locked_ + extern f_status_t fss_basic_read_print_line_first_locked(fss_basic_read_setting_t * const setting, const fl_print_t print); +#endif // _di_fss_basic_read_print_line_first_locked_ + +/** + * Print first new line, unless verbosity says otherwise. + * + * This is generally either the first line in the program or the first line printed before an error message. + * + * This function neither locks nor unlocks the input stream. + * + * @param setting + * The main program settings. + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_fss_basic_read_print_line_first_unlocked_ + extern f_status_t fss_basic_read_print_line_first_unlocked(fss_basic_read_setting_t * const setting, const fl_print_t print); +#endif // _di_fss_basic_read_print_line_first_unlocked_ + +/** + * Print last new line when the main is complete, unless verbosity says otherwise. + * + * This is generally the very last line printed in the program. + * + * This function locks and then unlocks the input stream when printing. + * * @param setting * The main program settings. * This does not alter setting.status. * @param print * Designates the how and where to print. - * @param lock - * If TRUE, then lock the stream. - * If FALSE, then do not lock or unlock the stream. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. */ -#ifndef _di_fss_basic_read_print_line_first_ - extern void fss_basic_read_print_line_first(fss_basic_read_setting_t * const setting, const fl_print_t print, const bool lock); -#endif // _di_fss_basic_read_print_line_first_ +#ifndef _di_fss_basic_read_print_line_last_locked_ + extern f_status_t fss_basic_read_print_line_last_locked(fss_basic_read_setting_t * const setting, const fl_print_t print); +#endif // _di_fss_basic_read_print_line_last_locked_ /** * Print last new line when the main is complete, unless verbosity says otherwise. * * This is generally the very last line printed in the program. * + * This function neither locks nor unlocks the input stream. + * * @param setting * The main program settings. * This does not alter setting.status. * @param print * Designates the how and where to print. - * @param lock - * If TRUE, then lock the stream. - * If FALSE, then do not lock or unlock the stream. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. */ -#ifndef _di_fss_basic_read_print_line_last_ - extern void fss_basic_read_print_line_last(fss_basic_read_setting_t * const setting, const fl_print_t print, const bool lock); -#endif // _di_fss_basic_read_print_line_last_ +#ifndef _di_fss_basic_read_print_line_last_unlocked_ + extern f_status_t fss_basic_read_print_line_last_unlocked(fss_basic_read_setting_t * const setting, const fl_print_t print); +#endif // _di_fss_basic_read_print_line_last_unlocked_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/fss_basic_write/c/print.c b/level_3/fss_basic_write/c/print.c index 9cd5a00..325e4c8 100644 --- a/level_3/fss_basic_write/c/print.c +++ b/level_3/fss_basic_write/c/print.c @@ -52,36 +52,65 @@ extern "C" { } #endif // _di_fss_basic_write_print_help_ -#ifndef _di_fss_basic_write_print_line_first_ - void fss_basic_write_print_line_first(fss_basic_write_setting_t * const setting, const fl_print_t print, const bool lock) { +#ifndef _di_fss_basic_write_print_line_first_locked_ + f_status_t fss_basic_write_print_line_first_locked(fss_basic_write_setting_t * const setting, const fl_print_t print) { - if (print.verbosity == f_console_verbosity_quiet_e) return; + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - if (lock) { - fll_print_dynamic_raw(setting->line_first, print.to.stream); + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } - else { - f_print_dynamic_raw(setting->line_first, print.to.stream); + + f_print_dynamic_raw(setting->line_first, print.to.stream); + + return F_none; + } +#endif // _di_fss_basic_write_print_line_first_locked_ + +#ifndef _di_fss_basic_write_print_line_first_unlocked_ + f_status_t fss_basic_write_print_line_first_unlocked(fss_basic_write_setting_t * const setting, const fl_print_t print) { + + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } + + fll_print_dynamic_raw(setting->line_first, print.to.stream); + + return F_none; } -#endif // _di_fss_basic_write_print_line_first_ +#endif // _di_fss_basic_write_print_line_first_unlocked_ -#ifndef _di_fss_basic_write_print_line_last_ - void fss_basic_write_print_line_last(fss_basic_write_setting_t * const setting, const fl_print_t print, const bool lock) { +#ifndef _di_fss_basic_write_print_line_last_locked_ + f_status_t fss_basic_write_print_line_last_locked(fss_basic_write_setting_t * const setting, const fl_print_t print) { - if (print.verbosity == f_console_verbosity_quiet_e) return; - if (print.verbosity == f_console_verbosity_error_e && !F_status_is_error(setting->status)) return; - if (setting->flag & fss_basic_write_main_flag_verify_e) return; - if ((setting->flag & fss_basic_write_main_flag_file_to_e) && !F_status_is_error(setting->status)) return; + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - if (lock) { - fll_print_dynamic_raw(setting->line_last, print.to.stream); + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } - else { - f_print_dynamic_raw(setting->line_last, print.to.stream); + + fll_print_dynamic_raw(setting->line_last, print.to.stream); + + return F_none; + } +#endif // _di_fss_basic_write_print_line_last_locked_ + +#ifndef _di_fss_basic_write_print_line_last_unlocked_ + f_status_t fss_basic_write_print_line_last_unlocked(fss_basic_write_setting_t * const setting, const fl_print_t print) { + + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } + + f_print_dynamic_raw(setting->line_last, print.to.stream); + + return F_none; } -#endif // _di_fss_basic_write_print_line_last_ +#endif // _di_fss_basic_write_print_line_last_unlocked_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/fss_basic_write/c/print.h b/level_3/fss_basic_write/c/print.h index 99ef649..8dac339 100644 --- a/level_3/fss_basic_write/c/print.h +++ b/level_3/fss_basic_write/c/print.h @@ -33,36 +33,84 @@ extern "C" { * * This is generally either the first line in the program or the first line printed before an error message. * + * This function locks and then unlocks the input stream when printing. + * + * @param setting + * The main program settings. + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_fss_basic_write_print_line_first_locked_ + extern f_status_t fss_basic_write_print_line_first_locked(fss_basic_write_setting_t * const setting, const fl_print_t print); +#endif // _di_fss_basic_write_print_line_first_locked_ + +/** + * Print first new line, unless verbosity says otherwise. + * + * This is generally either the first line in the program or the first line printed before an error message. + * + * This function neither locks nor unlocks the input stream. + * + * @param setting + * The main program settings. + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_fss_basic_write_print_line_first_unlocked_ + extern f_status_t fss_basic_write_print_line_first_unlocked(fss_basic_write_setting_t * const setting, const fl_print_t print); +#endif // _di_fss_basic_write_print_line_first_unlocked_ + +/** + * Print last new line when the main is complete, unless verbosity says otherwise. + * + * This is generally the very last line printed in the program. + * + * This function locks and then unlocks the input stream when printing. + * * @param setting * The main program settings. * This does not alter setting.status. * @param print * Designates the how and where to print. - * @param lock - * If TRUE, then lock the stream. - * If FALSE, then do not lock or unlock the stream. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. */ -#ifndef _di_fss_basic_write_print_line_first_ - extern void fss_basic_write_print_line_first(fss_basic_write_setting_t * const setting, const fl_print_t print, const bool lock); -#endif // _di_fss_basic_write_print_line_first_ +#ifndef _di_fss_basic_write_print_line_last_locked_ + extern f_status_t fss_basic_write_print_line_last_locked(fss_basic_write_setting_t * const setting, const fl_print_t print); +#endif // _di_fss_basic_write_print_line_last_locked_ /** * Print last new line when the main is complete, unless verbosity says otherwise. * * This is generally the very last line printed in the program. * + * This function neither locks nor unlocks the input stream. + * * @param setting * The main program settings. * This does not alter setting.status. * @param print * Designates the how and where to print. - * @param lock - * If TRUE, then lock the stream. - * If FALSE, then do not lock or unlock the stream. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. */ -#ifndef _di_fss_basic_write_print_line_last_ - extern void fss_basic_write_print_line_last(fss_basic_write_setting_t * const setting, const fl_print_t print, const bool lock); -#endif // _di_fss_basic_write_print_line_last_ +#ifndef _di_fss_basic_write_print_line_last_unlocked_ + extern f_status_t fss_basic_write_print_line_last_unlocked(fss_basic_write_setting_t * const setting, const fl_print_t print); +#endif // _di_fss_basic_write_print_line_last_unlocked_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/fss_embedded_list_read/c/print.c b/level_3/fss_embedded_list_read/c/print.c index 1311924..55dd332 100644 --- a/level_3/fss_embedded_list_read/c/print.c +++ b/level_3/fss_embedded_list_read/c/print.c @@ -111,36 +111,65 @@ extern "C" { } #endif // _di_fss_embedded_list_read_print_help_ -#ifndef _di_fss_embedded_list_read_print_line_first_ - void fss_embedded_list_read_print_line_first(fss_embedded_list_read_setting_t * const setting, const fl_print_t print, const bool lock) { +#ifndef _di_fss_embedded_list_read_print_line_first_locked_ + f_status_t fss_embedded_list_read_print_line_first_locked(fss_embedded_list_read_setting_t * const setting, const fl_print_t print) { - if (print.verbosity == f_console_verbosity_quiet_e) return; + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - if (lock) { - fll_print_dynamic_raw(setting->line_first, print.to.stream); + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } - else { - f_print_dynamic_raw(setting->line_first, print.to.stream); + + f_print_dynamic_raw(setting->line_first, print.to.stream); + + return F_none; + } +#endif // _di_fss_embedded_list_read_print_line_first_locked_ + +#ifndef _di_fss_embedded_list_read_print_line_first_unlocked_ + f_status_t fss_embedded_list_read_print_line_first_unlocked(fss_embedded_list_read_setting_t * const setting, const fl_print_t print) { + + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } + + fll_print_dynamic_raw(setting->line_first, print.to.stream); + + return F_none; } -#endif // _di_fss_embedded_list_read_print_line_first_ +#endif // _di_fss_embedded_list_read_print_line_first_unlocked_ -#ifndef _di_fss_embedded_list_read_print_line_last_ - void fss_embedded_list_read_print_line_last(fss_embedded_list_read_setting_t * const setting, const fl_print_t print, const bool lock) { +#ifndef _di_fss_embedded_list_read_print_line_last_locked_ + f_status_t fss_embedded_list_read_print_line_last_locked(fss_embedded_list_read_setting_t * const setting, const fl_print_t print) { - if (print.verbosity == f_console_verbosity_quiet_e) return; - if (print.verbosity == f_console_verbosity_error_e && !F_status_is_error(setting->status)) return; - if (setting->flag & fss_embedded_list_read_main_flag_verify_e) return; - if ((setting->flag & fss_embedded_list_read_main_flag_file_to_e) && !F_status_is_error(setting->status)) return; + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - if (lock) { - fll_print_dynamic_raw(setting->line_last, print.to.stream); + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } - else { - f_print_dynamic_raw(setting->line_last, print.to.stream); + + fll_print_dynamic_raw(setting->line_last, print.to.stream); + + return F_none; + } +#endif // _di_fss_embedded_list_read_print_line_last_locked_ + +#ifndef _di_fss_embedded_list_read_print_line_last_unlocked_ + f_status_t fss_embedded_list_read_print_line_last_unlocked(fss_embedded_list_read_setting_t * const setting, const fl_print_t print) { + + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } + + f_print_dynamic_raw(setting->line_last, print.to.stream); + + return F_none; } -#endif // _di_fss_embedded_list_read_print_line_last_ +#endif // _di_fss_embedded_list_read_print_line_last_unlocked_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/fss_embedded_list_read/c/print.h b/level_3/fss_embedded_list_read/c/print.h index 4787541..b36f791 100644 --- a/level_3/fss_embedded_list_read/c/print.h +++ b/level_3/fss_embedded_list_read/c/print.h @@ -33,36 +33,84 @@ extern "C" { * * This is generally either the first line in the program or the first line printed before an error message. * + * This function locks and then unlocks the input stream when printing. + * + * @param setting + * The main program settings. + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_fss_embedded_list_read_print_line_first_locked_ + extern f_status_t fss_embedded_list_read_print_line_first_locked(fss_embedded_list_read_setting_t * const setting, const fl_print_t print); +#endif // _di_fss_embedded_list_read_print_line_first_locked_ + +/** + * Print first new line, unless verbosity says otherwise. + * + * This is generally either the first line in the program or the first line printed before an error message. + * + * This function neither locks nor unlocks the input stream. + * + * @param setting + * The main program settings. + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_fss_embedded_list_read_print_line_first_unlocked_ + extern f_status_t fss_embedded_list_read_print_line_first_unlocked(fss_embedded_list_read_setting_t * const setting, const fl_print_t print); +#endif // _di_fss_embedded_list_read_print_line_first_unlocked_ + +/** + * Print last new line when the main is complete, unless verbosity says otherwise. + * + * This is generally the very last line printed in the program. + * + * This function locks and then unlocks the input stream when printing. + * * @param setting * The main program settings. * This does not alter setting.status. * @param print * Designates the how and where to print. - * @param lock - * If TRUE, then lock the stream. - * If FALSE, then do not lock or unlock the stream. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. */ -#ifndef _di_fss_embedded_list_read_print_line_first_ - extern void fss_embedded_list_read_print_line_first(fss_embedded_list_read_setting_t * const setting, const fl_print_t print, const bool lock); -#endif // _di_fss_embedded_list_read_print_line_first_ +#ifndef _di_fss_embedded_list_read_print_line_last_locked_ + extern f_status_t fss_embedded_list_read_print_line_last_locked(fss_embedded_list_read_setting_t * const setting, const fl_print_t print); +#endif // _di_fss_embedded_list_read_print_line_last_locked_ /** * Print last new line when the main is complete, unless verbosity says otherwise. * * This is generally the very last line printed in the program. * + * This function neither locks nor unlocks the input stream. + * * @param setting * The main program settings. * This does not alter setting.status. * @param print * Designates the how and where to print. - * @param lock - * If TRUE, then lock the stream. - * If FALSE, then do not lock or unlock the stream. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. */ -#ifndef _di_fss_embedded_list_read_print_line_last_ - extern void fss_embedded_list_read_print_line_last(fss_embedded_list_read_setting_t * const setting, const fl_print_t print, const bool lock); -#endif // _di_fss_embedded_list_read_print_line_last_ +#ifndef _di_fss_embedded_list_read_print_line_last_unlocked_ + extern f_status_t fss_embedded_list_read_print_line_last_unlocked(fss_embedded_list_read_setting_t * const setting, const fl_print_t print); +#endif // _di_fss_embedded_list_read_print_line_last_unlocked_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/fss_embedded_list_write/c/print.c b/level_3/fss_embedded_list_write/c/print.c index bddc7b7..a19dad1 100644 --- a/level_3/fss_embedded_list_write/c/print.c +++ b/level_3/fss_embedded_list_write/c/print.c @@ -55,36 +55,67 @@ extern "C" { } #endif // _di_fss_embedded_list_write_print_help_ -#ifndef _di_fss_embedded_list_write_print_line_first_ - void fss_embedded_list_write_print_line_first(fss_embedded_list_write_setting_t * const setting, const fl_print_t print, const bool lock) { +#ifndef _di_fss_embedded_list_write_print_line_first_locked_ + f_status_t fss_embedded_list_write_print_line_first_locked(fss_embedded_list_write_setting_t * const setting, const fl_print_t print) { - if (print.verbosity == f_console_verbosity_quiet_e) return; + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - if (lock) { - fll_print_dynamic_raw(setting->line_first, print.to.stream); + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } - else { - f_print_dynamic_raw(setting->line_first, print.to.stream); + + f_print_dynamic_raw(setting->line_first, print.to.stream); + + return F_none; + } +#endif // _di_fss_embedded_list_write_print_line_first_locked_ + +#ifndef _di_fss_embedded_list_write_print_line_first_unlocked_ + f_status_t fss_embedded_list_write_print_line_first_unlocked(fss_embedded_list_write_setting_t * const setting, const fl_print_t print) { + + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } + + fll_print_dynamic_raw(setting->line_first, print.to.stream); + + return F_none; } -#endif // _di_fss_embedded_list_write_print_line_first_ +#endif // _di_fss_embedded_list_write_print_line_first_unlocked_ -#ifndef _di_fss_embedded_list_write_print_line_last_ - void fss_embedded_list_write_print_line_last(fss_embedded_list_write_setting_t * const setting, const fl_print_t print, const bool lock) { +#ifndef _di_fss_embedded_list_write_print_line_last_locked_ + f_status_t fss_embedded_list_write_print_line_last_locked(fss_embedded_list_write_setting_t * const setting, const fl_print_t print) { - if (print.verbosity == f_console_verbosity_quiet_e) return; - if (print.verbosity == f_console_verbosity_error_e && !F_status_is_error(setting->status)) return; - if (setting->flag & fss_embedded_list_write_main_flag_verify_e) return; - if ((setting->flag & fss_embedded_list_write_main_flag_file_to_e) && !F_status_is_error(setting->status)) return; + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - if (lock) { - fll_print_dynamic_raw(setting->line_last, print.to.stream); + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; + if (setting->flag & (fss_embedded_list_write_main_flag_verify_e | fss_embedded_list_write_main_flag_file_to_e)) return F_output_not; } - else { - f_print_dynamic_raw(setting->line_last, print.to.stream); + + fll_print_dynamic_raw(setting->line_last, print.to.stream); + + return F_none; + } +#endif // _di_fss_embedded_list_write_print_line_last_locked_ + +#ifndef _di_fss_embedded_list_write_print_line_last_unlocked_ + f_status_t fss_embedded_list_write_print_line_last_unlocked(fss_embedded_list_write_setting_t * const setting, const fl_print_t print) { + + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; + if (setting->flag & (fss_embedded_list_write_main_flag_verify_e | fss_embedded_list_write_main_flag_file_to_e)) return F_output_not; } + + f_print_dynamic_raw(setting->line_last, print.to.stream); + + return F_none; } -#endif // _di_fss_embedded_list_write_print_line_last_ +#endif // _di_fss_embedded_list_write_print_line_last_unlocked_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/fss_embedded_list_write/c/print.h b/level_3/fss_embedded_list_write/c/print.h index 562dfed..db58cdf 100644 --- a/level_3/fss_embedded_list_write/c/print.h +++ b/level_3/fss_embedded_list_write/c/print.h @@ -33,36 +33,84 @@ extern "C" { * * This is generally either the first line in the program or the first line printed before an error message. * + * This function locks and then unlocks the input stream when printing. + * + * @param setting + * The main program settings. + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_fss_embedded_list_write_print_line_first_locked_ + extern f_status_t fss_embedded_list_write_print_line_first_locked(fss_embedded_list_write_setting_t * const setting, const fl_print_t print); +#endif // _di_fss_embedded_list_write_print_line_first_locked_ + +/** + * Print first new line, unless verbosity says otherwise. + * + * This is generally either the first line in the program or the first line printed before an error message. + * + * This function neither locks nor unlocks the input stream. + * + * @param setting + * The main program settings. + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_fss_embedded_list_write_print_line_first_unlocked_ + extern f_status_t fss_embedded_list_write_print_line_first_unlocked(fss_embedded_list_write_setting_t * const setting, const fl_print_t print); +#endif // _di_fss_embedded_list_write_print_line_first_unlocked_ + +/** + * Print last new line when the main is complete, unless verbosity says otherwise. + * + * This is generally the very last line printed in the program. + * + * This function locks and then unlocks the input stream when printing. + * * @param setting * The main program settings. * This does not alter setting.status. * @param print * Designates the how and where to print. - * @param lock - * If TRUE, then lock the stream. - * If FALSE, then do not lock or unlock the stream. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. */ -#ifndef _di_fss_embedded_list_write_print_line_first_ - extern void fss_embedded_list_write_print_line_first(fss_embedded_list_write_setting_t * const setting, const fl_print_t print, const bool lock); -#endif // _di_fss_embedded_list_write_print_line_first_ +#ifndef _di_fss_embedded_list_write_print_line_last_locked_ + extern f_status_t fss_embedded_list_write_print_line_last_locked(fss_embedded_list_write_setting_t * const setting, const fl_print_t print); +#endif // _di_fss_embedded_list_write_print_line_last_locked_ /** * Print last new line when the main is complete, unless verbosity says otherwise. * * This is generally the very last line printed in the program. * + * This function neither locks nor unlocks the input stream. + * * @param setting * The main program settings. * This does not alter setting.status. * @param print * Designates the how and where to print. - * @param lock - * If TRUE, then lock the stream. - * If FALSE, then do not lock or unlock the stream. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. */ -#ifndef _di_fss_embedded_list_write_print_line_last_ - extern void fss_embedded_list_write_print_line_last(fss_embedded_list_write_setting_t * const setting, const fl_print_t print, const bool lock); -#endif // _di_fss_embedded_list_write_print_line_last_ +#ifndef _di_fss_embedded_list_write_print_line_last_unlocked_ + extern f_status_t fss_embedded_list_write_print_line_last_unlocked(fss_embedded_list_write_setting_t * const setting, const fl_print_t print); +#endif // _di_fss_embedded_list_write_print_line_last_unlocked_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/fss_extended_list_read/c/print.c b/level_3/fss_extended_list_read/c/print.c index 893c762..43f5dae 100644 --- a/level_3/fss_extended_list_read/c/print.c +++ b/level_3/fss_extended_list_read/c/print.c @@ -112,36 +112,67 @@ extern "C" { } #endif // _di_fss_extended_list_read_print_help_ -#ifndef _di_fss_embedded_list_read_print_line_first_ - void fss_embedded_list_read_print_line_first(fss_embedded_list_read_setting_t * const setting, const fl_print_t print, const bool lock) { +#ifndef _di_fss_extended_list_read_print_line_first_locked_ + f_status_t fss_extended_list_read_print_line_first_locked(fss_extended_list_read_setting_t * const setting, const fl_print_t print) { - if (print.verbosity == f_console_verbosity_quiet_e) return; + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - if (lock) { - fll_print_dynamic_raw(setting->line_first, print.to.stream); + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } - else { - f_print_dynamic_raw(setting->line_first, print.to.stream); + + f_print_dynamic_raw(setting->line_first, print.to.stream); + + return F_none; + } +#endif // _di_fss_extended_list_read_print_line_first_locked_ + +#ifndef _di_fss_extended_list_read_print_line_first_unlocked_ + f_status_t fss_extended_list_read_print_line_first_unlocked(fss_extended_list_read_setting_t * const setting, const fl_print_t print) { + + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } + + fll_print_dynamic_raw(setting->line_first, print.to.stream); + + return F_none; } -#endif // _di_fss_embedded_list_read_print_line_first_ +#endif // _di_fss_extended_list_read_print_line_first_unlocked_ -#ifndef _di_fss_embedded_list_read_print_line_last_ - void fss_embedded_list_read_print_line_last(fss_embedded_list_read_setting_t * const setting, const fl_print_t print, const bool lock) { +#ifndef _di_fss_extended_list_read_print_line_last_locked_ + f_status_t fss_extended_list_read_print_line_last_locked(fss_extended_list_read_setting_t * const setting, const fl_print_t print) { - if (print.verbosity == f_console_verbosity_quiet_e) return; - if (print.verbosity == f_console_verbosity_error_e && !F_status_is_error(setting->status)) return; - if (setting->flag & fss_embedded_list_read_main_flag_verify_e) return; - if ((setting->flag & fss_embedded_list_read_main_flag_file_to_e) && !F_status_is_error(setting->status)) return; + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - if (lock) { - fll_print_dynamic_raw(setting->line_last, print.to.stream); + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; + if (setting->flag & (fss_extended_list_read_main_flag_verify_e | fss_extended_list_read_main_flag_file_to_e)) return F_output_not; } - else { - f_print_dynamic_raw(setting->line_last, print.to.stream); + + fll_print_dynamic_raw(setting->line_last, print.to.stream); + + return F_none; + } +#endif // _di_fss_extended_list_read_print_line_last_locked_ + +#ifndef _di_fss_extended_list_read_print_line_last_unlocked_ + f_status_t fss_extended_list_read_print_line_last_unlocked(fss_extended_list_read_setting_t * const setting, const fl_print_t print) { + + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; + if (setting->flag & (fss_extended_list_read_main_flag_verify_e | fss_extended_list_read_main_flag_file_to_e)) return F_output_not; } + + f_print_dynamic_raw(setting->line_last, print.to.stream); + + return F_none; } -#endif // _di_fss_embedded_list_read_print_line_last_ +#endif // _di_fss_extended_list_read_print_line_last_unlocked_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/fss_extended_list_read/c/print.h b/level_3/fss_extended_list_read/c/print.h index 73015d0..7a60447 100644 --- a/level_3/fss_extended_list_read/c/print.h +++ b/level_3/fss_extended_list_read/c/print.h @@ -33,36 +33,84 @@ extern "C" { * * This is generally either the first line in the program or the first line printed before an error message. * + * This function locks and then unlocks the input stream when printing. + * + * @param setting + * The main program settings. + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_fss_extended_list_read_print_line_first_locked_ + extern f_status_t fss_extended_list_read_print_line_first_locked(fss_extended_list_read_setting_t * const setting, const fl_print_t print); +#endif // _di_fss_extended_list_read_print_line_first_locked_ + +/** + * Print first new line, unless verbosity says otherwise. + * + * This is generally either the first line in the program or the first line printed before an error message. + * + * This function neither locks nor unlocks the input stream. + * + * @param setting + * The main program settings. + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_fss_extended_list_read_print_line_first_unlocked_ + extern f_status_t fss_extended_list_read_print_line_first_unlocked(fss_extended_list_read_setting_t * const setting, const fl_print_t print); +#endif // _di_fss_extended_list_read_print_line_first_unlocked_ + +/** + * Print last new line when the main is complete, unless verbosity says otherwise. + * + * This is generally the very last line printed in the program. + * + * This function locks and then unlocks the input stream when printing. + * * @param setting * The main program settings. * This does not alter setting.status. * @param print * Designates the how and where to print. - * @param lock - * If TRUE, then lock the stream. - * If FALSE, then do not lock or unlock the stream. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. */ -#ifndef _di_fss_embedded_list_read_print_line_first_ - extern void fss_embedded_list_read_print_line_first(fss_embedded_list_read_setting_t * const setting, const fl_print_t print, const bool lock); -#endif // _di_fss_embedded_list_read_print_line_first_ +#ifndef _di_fss_extended_list_read_print_line_last_locked_ + extern f_status_t fss_extended_list_read_print_line_last_locked(fss_extended_list_read_setting_t * const setting, const fl_print_t print); +#endif // _di_fss_extended_list_read_print_line_last_locked_ /** * Print last new line when the main is complete, unless verbosity says otherwise. * * This is generally the very last line printed in the program. * + * This function neither locks nor unlocks the input stream. + * * @param setting * The main program settings. * This does not alter setting.status. * @param print * Designates the how and where to print. - * @param lock - * If TRUE, then lock the stream. - * If FALSE, then do not lock or unlock the stream. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. */ -#ifndef _di_fss_embedded_list_read_print_line_last_ - extern void fss_embedded_list_read_print_line_last(fss_embedded_list_read_setting_t * const setting, const fl_print_t print, const bool lock); -#endif // _di_fss_embedded_list_read_print_line_last_ +#ifndef _di_fss_extended_list_read_print_line_last_unlocked_ + extern f_status_t fss_extended_list_read_print_line_last_unlocked(fss_extended_list_read_setting_t * const setting, const fl_print_t print); +#endif // _di_fss_extended_list_read_print_line_last_unlocked_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/fss_extended_list_write/c/print.c b/level_3/fss_extended_list_write/c/print.c index 0b44a87..1666b72 100644 --- a/level_3/fss_extended_list_write/c/print.c +++ b/level_3/fss_extended_list_write/c/print.c @@ -55,36 +55,67 @@ extern "C" { } #endif // _di_fss_extended_list_write_print_help_ -#ifndef _di_fss_embedded_list_write_print_line_first_ - void fss_embedded_list_write_print_line_first(fss_embedded_list_write_setting_t * const setting, const fl_print_t print, const bool lock) { +#ifndef _di_fss_extended_list_write_print_line_first_locked_ + f_status_t fss_extended_list_write_print_line_first_locked(fss_extended_list_write_setting_t * const setting, const fl_print_t print) { - if (print.verbosity == f_console_verbosity_quiet_e) return; + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - if (lock) { - fll_print_dynamic_raw(setting->line_first, print.to.stream); + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } - else { - f_print_dynamic_raw(setting->line_first, print.to.stream); + + f_print_dynamic_raw(setting->line_first, print.to.stream); + + return F_none; + } +#endif // _di_fss_extended_list_write_print_line_first_locked_ + +#ifndef _di_fss_extended_list_write_print_line_first_unlocked_ + f_status_t fss_extended_list_write_print_line_first_unlocked(fss_extended_list_write_setting_t * const setting, const fl_print_t print) { + + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } + + fll_print_dynamic_raw(setting->line_first, print.to.stream); + + return F_none; } -#endif // _di_fss_embedded_list_write_print_line_first_ +#endif // _di_fss_extended_list_write_print_line_first_unlocked_ -#ifndef _di_fss_embedded_list_write_print_line_last_ - void fss_embedded_list_write_print_line_last(fss_embedded_list_write_setting_t * const setting, const fl_print_t print, const bool lock) { +#ifndef _di_fss_extended_list_write_print_line_last_locked_ + f_status_t fss_extended_list_write_print_line_last_locked(fss_extended_list_write_setting_t * const setting, const fl_print_t print) { - if (print.verbosity == f_console_verbosity_quiet_e) return; - if (print.verbosity == f_console_verbosity_error_e && !F_status_is_error(setting->status)) return; - if (setting->flag & fss_embedded_list_write_main_flag_verify_e) return; - if ((setting->flag & fss_embedded_list_write_main_flag_file_to_e) && !F_status_is_error(setting->status)) return; + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - if (lock) { - fll_print_dynamic_raw(setting->line_last, print.to.stream); + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; + if (setting->flag & (fss_extended_list_write_main_flag_verify_e | fss_extended_list_write_main_flag_file_to_e)) return F_output_not; } - else { - f_print_dynamic_raw(setting->line_last, print.to.stream); + + fll_print_dynamic_raw(setting->line_last, print.to.stream); + + return F_none; + } +#endif // _di_fss_extended_list_write_print_line_last_locked_ + +#ifndef _di_fss_extended_list_write_print_line_last_unlocked_ + f_status_t fss_extended_list_write_print_line_last_unlocked(fss_extended_list_write_setting_t * const setting, const fl_print_t print) { + + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; + if (setting->flag & (fss_extended_list_write_main_flag_verify_e | fss_extended_list_write_main_flag_file_to_e)) return F_output_not; } + + f_print_dynamic_raw(setting->line_last, print.to.stream); + + return F_none; } -#endif // _di_fss_embedded_list_write_print_line_last_ +#endif // _di_fss_extended_list_write_print_line_last_unlocked_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/fss_extended_list_write/c/print.h b/level_3/fss_extended_list_write/c/print.h index 9da45b4..e8b3b33 100644 --- a/level_3/fss_extended_list_write/c/print.h +++ b/level_3/fss_extended_list_write/c/print.h @@ -33,36 +33,84 @@ extern "C" { * * This is generally either the first line in the program or the first line printed before an error message. * + * This function locks and then unlocks the input stream when printing. + * + * @param setting + * The main program settings. + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_fss_extended_list_write_print_line_first_locked_ + extern f_status_t fss_extended_list_write_print_line_first_locked(fss_extended_list_write_setting_t * const setting, const fl_print_t print); +#endif // _di_fss_extended_list_write_print_line_first_locked_ + +/** + * Print first new line, unless verbosity says otherwise. + * + * This is generally either the first line in the program or the first line printed before an error message. + * + * This function neither locks nor unlocks the input stream. + * + * @param setting + * The main program settings. + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_fss_extended_list_write_print_line_first_unlocked_ + extern f_status_t fss_extended_list_write_print_line_first_unlocked(fss_extended_list_write_setting_t * const setting, const fl_print_t print); +#endif // _di_fss_extended_list_write_print_line_first_unlocked_ + +/** + * Print last new line when the main is complete, unless verbosity says otherwise. + * + * This is generally the very last line printed in the program. + * + * This function locks and then unlocks the input stream when printing. + * * @param setting * The main program settings. * This does not alter setting.status. * @param print * Designates the how and where to print. - * @param lock - * If TRUE, then lock the stream. - * If FALSE, then do not lock or unlock the stream. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. */ -#ifndef _di_fss_embedded_list_write_print_line_first_ - extern void fss_embedded_list_write_print_line_first(fss_embedded_list_write_setting_t * const setting, const fl_print_t print, const bool lock); -#endif // _di_fss_embedded_list_write_print_line_first_ +#ifndef _di_fss_extended_list_write_print_line_last_locked_ + extern f_status_t fss_extended_list_write_print_line_last_locked(fss_extended_list_write_setting_t * const setting, const fl_print_t print); +#endif // _di_fss_extended_list_write_print_line_last_locked_ /** * Print last new line when the main is complete, unless verbosity says otherwise. * * This is generally the very last line printed in the program. * + * This function neither locks nor unlocks the input stream. + * * @param setting * The main program settings. * This does not alter setting.status. * @param print * Designates the how and where to print. - * @param lock - * If TRUE, then lock the stream. - * If FALSE, then do not lock or unlock the stream. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. */ -#ifndef _di_fss_embedded_list_write_print_line_last_ - extern void fss_embedded_list_write_print_line_last(fss_embedded_list_write_setting_t * const setting, const fl_print_t print, const bool lock); -#endif // _di_fss_embedded_list_write_print_line_last_ +#ifndef _di_fss_extended_list_write_print_line_last_unlocked_ + extern f_status_t fss_extended_list_write_print_line_last_unlocked(fss_extended_list_write_setting_t * const setting, const fl_print_t print); +#endif // _di_fss_extended_list_write_print_line_last_unlocked_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/fss_extended_read/c/print.c b/level_3/fss_extended_read/c/print.c index c9f770a..05ec3b0 100644 --- a/level_3/fss_extended_read/c/print.c +++ b/level_3/fss_extended_read/c/print.c @@ -112,36 +112,67 @@ extern "C" { } #endif // _di_fss_extended_read_print_help_ -#ifndef _di_fss_extended_read_print_line_first_ - void fss_extended_read_print_line_first(fss_extended_read_setting_t * const setting, const fl_print_t print, const bool lock) { +#ifndef _di_fss_extended_read_print_line_first_locked_ + f_status_t fss_extended_read_print_line_first_locked(fss_extended_read_setting_t * const setting, const fl_print_t print) { - if (print.verbosity == f_console_verbosity_quiet_e) return; + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - if (lock) { - fll_print_dynamic_raw(setting->line_first, print.to.stream); + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } - else { - f_print_dynamic_raw(setting->line_first, print.to.stream); + + f_print_dynamic_raw(setting->line_first, print.to.stream); + + return F_none; + } +#endif // _di_fss_extended_read_print_line_first_locked_ + +#ifndef _di_fss_extended_read_print_line_first_unlocked_ + f_status_t fss_extended_read_print_line_first_unlocked(fss_extended_read_setting_t * const setting, const fl_print_t print) { + + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } + + fll_print_dynamic_raw(setting->line_first, print.to.stream); + + return F_none; } -#endif // _di_fss_extended_read_print_line_first_ +#endif // _di_fss_extended_read_print_line_first_unlocked_ -#ifndef _di_fss_extended_read_print_line_last_ - void fss_extended_read_print_line_last(fss_extended_read_setting_t * const setting, const fl_print_t print, const bool lock) { +#ifndef _di_fss_extended_read_print_line_last_locked_ + f_status_t fss_extended_read_print_line_last_locked(fss_extended_read_setting_t * const setting, const fl_print_t print) { - if (print.verbosity == f_console_verbosity_quiet_e) return; - if (print.verbosity == f_console_verbosity_error_e && !F_status_is_error(setting->status)) return; - if (setting->flag & fss_extended_read_main_flag_verify_e) return; - if ((setting->flag & fss_extended_read_main_flag_file_to_e) && !F_status_is_error(setting->status)) return; + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - if (lock) { - fll_print_dynamic_raw(setting->line_last, print.to.stream); + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; + if (setting->flag & (fss_extended_read_main_flag_verify_e | fss_extended_read_main_flag_file_to_e)) return F_output_not; } - else { - f_print_dynamic_raw(setting->line_last, print.to.stream); + + fll_print_dynamic_raw(setting->line_last, print.to.stream); + + return F_none; + } +#endif // _di_fss_extended_read_print_line_last_locked_ + +#ifndef _di_fss_extended_read_print_line_last_unlocked_ + f_status_t fss_extended_read_print_line_last_unlocked(fss_extended_read_setting_t * const setting, const fl_print_t print) { + + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; + if (setting->flag & (fss_extended_read_main_flag_verify_e | fss_extended_read_main_flag_file_to_e)) return F_output_not; } + + f_print_dynamic_raw(setting->line_last, print.to.stream); + + return F_none; } -#endif // _di_fss_extended_read_print_line_last_ +#endif // _di_fss_extended_read_print_line_last_unlocked_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/fss_extended_read/c/print.h b/level_3/fss_extended_read/c/print.h index 7d543dc..ec4522c 100644 --- a/level_3/fss_extended_read/c/print.h +++ b/level_3/fss_extended_read/c/print.h @@ -33,36 +33,84 @@ extern "C" { * * This is generally either the first line in the program or the first line printed before an error message. * + * This function locks and then unlocks the input stream when printing. + * + * @param setting + * The main program settings. + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_fss_extended_read_print_line_first_locked_ + extern f_status_t fss_extended_read_print_line_first_locked(fss_extended_read_setting_t * const setting, const fl_print_t print); +#endif // _di_fss_extended_read_print_line_first_locked_ + +/** + * Print first new line, unless verbosity says otherwise. + * + * This is generally either the first line in the program or the first line printed before an error message. + * + * This function neither locks nor unlocks the input stream. + * + * @param setting + * The main program settings. + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_fss_extended_read_print_line_first_unlocked_ + extern f_status_t fss_extended_read_print_line_first_unlocked(fss_extended_read_setting_t * const setting, const fl_print_t print); +#endif // _di_fss_extended_read_print_line_first_unlocked_ + +/** + * Print last new line when the main is complete, unless verbosity says otherwise. + * + * This is generally the very last line printed in the program. + * + * This function locks and then unlocks the input stream when printing. + * * @param setting * The main program settings. * This does not alter setting.status. * @param print * Designates the how and where to print. - * @param lock - * If TRUE, then lock the stream. - * If FALSE, then do not lock or unlock the stream. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. */ -#ifndef _di_fss_extended_read_print_line_first_ - extern void fss_extended_read_print_line_first(fss_extended_read_setting_t * const setting, const fl_print_t print, const bool lock); -#endif // _di_fss_extended_read_print_line_first_ +#ifndef _di_fss_extended_read_print_line_last_locked_ + extern f_status_t fss_extended_read_print_line_last_locked(fss_extended_read_setting_t * const setting, const fl_print_t print); +#endif // _di_fss_extended_read_print_line_last_locked_ /** * Print last new line when the main is complete, unless verbosity says otherwise. * * This is generally the very last line printed in the program. * + * This function neither locks nor unlocks the input stream. + * * @param setting * The main program settings. * This does not alter setting.status. * @param print * Designates the how and where to print. - * @param lock - * If TRUE, then lock the stream. - * If FALSE, then do not lock or unlock the stream. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. */ -#ifndef _di_fss_extended_read_print_line_last_ - extern void fss_extended_read_print_line_last(fss_extended_read_setting_t * const setting, const fl_print_t print, const bool lock); -#endif // _di_fss_extended_read_print_line_last_ +#ifndef _di_fss_extended_read_print_line_last_unlocked_ + extern f_status_t fss_extended_read_print_line_last_unlocked(fss_extended_read_setting_t * const setting, const fl_print_t print); +#endif // _di_fss_extended_read_print_line_last_unlocked_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/fss_extended_write/c/print.c b/level_3/fss_extended_write/c/print.c index 9e5e72f..062933c 100644 --- a/level_3/fss_extended_write/c/print.c +++ b/level_3/fss_extended_write/c/print.c @@ -52,36 +52,67 @@ extern "C" { } #endif // _di_fss_extended_write_print_help_ -#ifndef _di_fss_extended_write_print_line_first_ - void fss_extended_write_print_line_first(fss_extended_write_setting_t * const setting, const fl_print_t print, const bool lock) { +#ifndef _di_fss_extended_write_print_line_first_locked_ + f_status_t fss_extended_write_print_line_first_locked(fss_extended_write_setting_t * const setting, const fl_print_t print) { - if (print.verbosity == f_console_verbosity_quiet_e) return; + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - if (lock) { - fll_print_dynamic_raw(setting->line_first, print.to.stream); + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } - else { - f_print_dynamic_raw(setting->line_first, print.to.stream); + + f_print_dynamic_raw(setting->line_first, print.to.stream); + + return F_none; + } +#endif // _di_fss_extended_write_print_line_first_locked_ + +#ifndef _di_fss_extended_write_print_line_first_unlocked_ + f_status_t fss_extended_write_print_line_first_unlocked(fss_extended_write_setting_t * const setting, const fl_print_t print) { + + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } + + fll_print_dynamic_raw(setting->line_first, print.to.stream); + + return F_none; } -#endif // _di_fss_extended_write_print_line_first_ +#endif // _di_fss_extended_write_print_line_first_unlocked_ -#ifndef _di_fss_extended_write_print_line_last_ - void fss_extended_write_print_line_last(fss_extended_write_setting_t * const setting, const fl_print_t print, const bool lock) { +#ifndef _di_fss_extended_write_print_line_last_locked_ + f_status_t fss_extended_write_print_line_last_locked(fss_extended_write_setting_t * const setting, const fl_print_t print) { - if (print.verbosity == f_console_verbosity_quiet_e) return; - if (print.verbosity == f_console_verbosity_error_e && !F_status_is_error(setting->status)) return; - if (setting->flag & fss_extended_write_main_flag_verify_e) return; - if ((setting->flag & fss_extended_write_main_flag_file_to_e) && !F_status_is_error(setting->status)) return; + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - if (lock) { - fll_print_dynamic_raw(setting->line_last, print.to.stream); + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; + if (setting->flag & (fss_extended_write_main_flag_verify_e | fss_extended_write_main_flag_file_to_e)) return F_output_not; } - else { - f_print_dynamic_raw(setting->line_last, print.to.stream); + + fll_print_dynamic_raw(setting->line_last, print.to.stream); + + return F_none; + } +#endif // _di_fss_extended_write_print_line_last_locked_ + +#ifndef _di_fss_extended_write_print_line_last_unlocked_ + f_status_t fss_extended_write_print_line_last_unlocked(fss_extended_write_setting_t * const setting, const fl_print_t print) { + + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; + if (setting->flag & (fss_extended_write_main_flag_verify_e | fss_extended_write_main_flag_file_to_e)) return F_output_not; } + + f_print_dynamic_raw(setting->line_last, print.to.stream); + + return F_none; } -#endif // _di_fss_extended_write_print_line_last_ +#endif // _di_fss_extended_write_print_line_last_unlocked_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/fss_extended_write/c/print.h b/level_3/fss_extended_write/c/print.h index 79dffc5..fbe347e 100644 --- a/level_3/fss_extended_write/c/print.h +++ b/level_3/fss_extended_write/c/print.h @@ -33,36 +33,84 @@ extern "C" { * * This is generally either the first line in the program or the first line printed before an error message. * + * This function locks and then unlocks the input stream when printing. + * + * @param setting + * The main program settings. + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_fss_extended_write_print_line_first_locked_ + extern f_status_t fss_extended_write_print_line_first_locked(fss_extended_write_setting_t * const setting, const fl_print_t print); +#endif // _di_fss_extended_write_print_line_first_locked_ + +/** + * Print first new line, unless verbosity says otherwise. + * + * This is generally either the first line in the program or the first line printed before an error message. + * + * This function neither locks nor unlocks the input stream. + * + * @param setting + * The main program settings. + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_fss_extended_write_print_line_first_unlocked_ + extern f_status_t fss_extended_write_print_line_first_unlocked(fss_extended_write_setting_t * const setting, const fl_print_t print); +#endif // _di_fss_extended_write_print_line_first_unlocked_ + +/** + * Print last new line when the main is complete, unless verbosity says otherwise. + * + * This is generally the very last line printed in the program. + * + * This function locks and then unlocks the input stream when printing. + * * @param setting * The main program settings. * This does not alter setting.status. * @param print * Designates the how and where to print. - * @param lock - * If TRUE, then lock the stream. - * If FALSE, then do not lock or unlock the stream. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. */ -#ifndef _di_fss_extended_write_print_line_first_ - extern void fss_extended_write_print_line_first(fss_extended_write_setting_t * const setting, const fl_print_t print, const bool lock); -#endif // _di_fss_extended_write_print_line_first_ +#ifndef _di_fss_extended_write_print_line_last_locked_ + extern f_status_t fss_extended_write_print_line_last_locked(fss_extended_write_setting_t * const setting, const fl_print_t print); +#endif // _di_fss_extended_write_print_line_last_locked_ /** * Print last new line when the main is complete, unless verbosity says otherwise. * * This is generally the very last line printed in the program. * + * This function neither locks nor unlocks the input stream. + * * @param setting * The main program settings. * This does not alter setting.status. * @param print * Designates the how and where to print. - * @param lock - * If TRUE, then lock the stream. - * If FALSE, then do not lock or unlock the stream. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. */ -#ifndef _di_fss_extended_write_print_line_last_ - extern void fss_extended_write_print_line_last(fss_extended_write_setting_t * const setting, const fl_print_t print, const bool lock); -#endif // _di_fss_extended_write_print_line_last_ +#ifndef _di_fss_extended_write_print_line_last_unlocked_ + extern f_status_t fss_extended_write_print_line_last_unlocked(fss_extended_write_setting_t * const setting, const fl_print_t print); +#endif // _di_fss_extended_write_print_line_last_unlocked_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/fss_identify/c/print.c b/level_3/fss_identify/c/print.c index 36e102b..d246265 100644 --- a/level_3/fss_identify/c/print.c +++ b/level_3/fss_identify/c/print.c @@ -53,36 +53,67 @@ extern "C" { } #endif // _di_fss_identify_print_help_ -#ifndef _di_fss_identify_print_line_first_ - void fss_identify_print_line_first(fss_identify_setting_t * const setting, const fl_print_t print, const bool lock) { +#ifndef _di_fss_identify_print_line_first_locked_ + f_status_t fss_identify_print_line_first_locked(fss_identify_setting_t * const setting, const fl_print_t print) { - if (print.verbosity == f_console_verbosity_quiet_e) return; + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - if (lock) { - fll_print_dynamic_raw(setting->line_first, print.to.stream); + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } - else { - f_print_dynamic_raw(setting->line_first, print.to.stream); + + f_print_dynamic_raw(setting->line_first, print.to.stream); + + return F_none; + } +#endif // _di_fss_identify_print_line_first_locked_ + +#ifndef _di_fss_identify_print_line_first_unlocked_ + f_status_t fss_identify_print_line_first_unlocked(fss_identify_setting_t * const setting, const fl_print_t print) { + + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } + + fll_print_dynamic_raw(setting->line_first, print.to.stream); + + return F_none; } -#endif // _di_fss_identify_print_line_first_ +#endif // _di_fss_identify_print_line_first_unlocked_ -#ifndef _di_fss_identify_print_line_last_ - void fss_identify_print_line_last(fss_identify_setting_t * const setting, const fl_print_t print, const bool lock) { +#ifndef _di_fss_identify_print_line_last_locked_ + f_status_t fss_identify_print_line_last_locked(fss_identify_setting_t * const setting, const fl_print_t print) { - if (print.verbosity == f_console_verbosity_quiet_e) return; - if (print.verbosity == f_console_verbosity_error_e && !F_status_is_error(setting->status)) return; - if (setting->flag & fss_identify_main_flag_verify_e) return; - if ((setting->flag & fss_identify_main_flag_file_to_e) && !F_status_is_error(setting->status)) return; + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - if (lock) { - fll_print_dynamic_raw(setting->line_last, print.to.stream); + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; + if (setting->flag & (fss_identify_main_flag_verify_e | fss_identify_main_flag_file_to_e)) return F_output_not; } - else { - f_print_dynamic_raw(setting->line_last, print.to.stream); + + fll_print_dynamic_raw(setting->line_last, print.to.stream); + + return F_none; + } +#endif // _di_fss_identify_print_line_last_locked_ + +#ifndef _di_fss_identify_print_line_last_unlocked_ + f_status_t fss_identify_print_line_last_unlocked(fss_identify_setting_t * const setting, const fl_print_t print) { + + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; + if (setting->flag & (fss_identify_main_flag_verify_e | fss_identify_main_flag_file_to_e)) return F_output_not; } + + f_print_dynamic_raw(setting->line_last, print.to.stream); + + return F_none; } -#endif // _di_fss_identify_print_line_last_ +#endif // _di_fss_identify_print_line_last_unlocked_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/fss_identify/c/print.h b/level_3/fss_identify/c/print.h index 437e982..ee0dcf1 100644 --- a/level_3/fss_identify/c/print.h +++ b/level_3/fss_identify/c/print.h @@ -33,36 +33,84 @@ extern "C" { * * This is generally either the first line in the program or the first line printed before an error message. * + * This function locks and then unlocks the input stream when printing. + * + * @param setting + * The main program settings. + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_fss_identify_print_line_first_locked_ + extern f_status_t fss_identify_print_line_first_locked(fss_identify_setting_t * const setting, const fl_print_t print); +#endif // _di_fss_identify_print_line_first_locked_ + +/** + * Print first new line, unless verbosity says otherwise. + * + * This is generally either the first line in the program or the first line printed before an error message. + * + * This function neither locks nor unlocks the input stream. + * + * @param setting + * The main program settings. + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_fss_identify_print_line_first_unlocked_ + extern f_status_t fss_identify_print_line_first_unlocked(fss_identify_setting_t * const setting, const fl_print_t print); +#endif // _di_fss_identify_print_line_first_unlocked_ + +/** + * Print last new line when the main is complete, unless verbosity says otherwise. + * + * This is generally the very last line printed in the program. + * + * This function locks and then unlocks the input stream when printing. + * * @param setting * The main program settings. * This does not alter setting.status. * @param print * Designates the how and where to print. - * @param lock - * If TRUE, then lock the stream. - * If FALSE, then do not lock or unlock the stream. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. */ -#ifndef _di_fss_identify_print_line_first_ - extern void fss_identify_print_line_first(fss_identify_setting_t * const setting, const fl_print_t print, const bool lock); -#endif // _di_fss_identify_print_line_first_ +#ifndef _di_fss_identify_print_line_last_locked_ + extern f_status_t fss_identify_print_line_last_locked(fss_identify_setting_t * const setting, const fl_print_t print); +#endif // _di_fss_identify_print_line_last_locked_ /** * Print last new line when the main is complete, unless verbosity says otherwise. * * This is generally the very last line printed in the program. * + * This function neither locks nor unlocks the input stream. + * * @param setting * The main program settings. * This does not alter setting.status. * @param print * Designates the how and where to print. - * @param lock - * If TRUE, then lock the stream. - * If FALSE, then do not lock or unlock the stream. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. */ -#ifndef _di_fss_identify_print_line_last_ - extern void fss_identify_print_line_last(fss_identify_setting_t * const setting, const fl_print_t print, const bool lock); -#endif // _di_fss_identify_print_line_last_ +#ifndef _di_fss_identify_print_line_last_unlocked_ + extern f_status_t fss_identify_print_line_last_unlocked(fss_identify_setting_t * const setting, const fl_print_t print); +#endif // _di_fss_identify_print_line_last_unlocked_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/fss_payload_read/c/print.c b/level_3/fss_payload_read/c/print.c index 5bb4951..81733d7 100644 --- a/level_3/fss_payload_read/c/print.c +++ b/level_3/fss_payload_read/c/print.c @@ -122,36 +122,67 @@ extern "C" { } #endif // _di_fss_payload_read_print_help_ -#ifndef _di_fss_payload_read_print_line_first_ - void fss_payload_read_print_line_first(fss_payload_read_setting_t * const setting, const fl_print_t print, const bool lock) { +#ifndef _di_fss_payload_read_print_line_first_locked_ + f_status_t fss_payload_read_print_line_first_locked(fss_payload_read_setting_t * const setting, const fl_print_t print) { - if (print.verbosity == f_console_verbosity_quiet_e) return; + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - if (lock) { - fll_print_dynamic_raw(setting->line_first, print.to.stream); + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } - else { - f_print_dynamic_raw(setting->line_first, print.to.stream); + + f_print_dynamic_raw(setting->line_first, print.to.stream); + + return F_none; + } +#endif // _di_fss_payload_read_print_line_first_locked_ + +#ifndef _di_fss_payload_read_print_line_first_unlocked_ + f_status_t fss_payload_read_print_line_first_unlocked(fss_payload_read_setting_t * const setting, const fl_print_t print) { + + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } + + fll_print_dynamic_raw(setting->line_first, print.to.stream); + + return F_none; } -#endif // _di_fss_payload_read_print_line_first_ +#endif // _di_fss_payload_read_print_line_first_unlocked_ -#ifndef _di_fss_payload_read_print_line_last_ - void fss_payload_read_print_line_last(fss_payload_read_setting_t * const setting, const fl_print_t print, const bool lock) { +#ifndef _di_fss_payload_read_print_line_last_locked_ + f_status_t fss_payload_read_print_line_last_locked(fss_payload_read_setting_t * const setting, const fl_print_t print) { - if (print.verbosity == f_console_verbosity_quiet_e) return; - if (print.verbosity == f_console_verbosity_error_e && !F_status_is_error(setting->status)) return; - if (setting->flag & fss_payload_read_main_flag_verify_e) return; - if ((setting->flag & fss_payload_read_main_flag_file_to_e) && !F_status_is_error(setting->status)) return; + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - if (lock) { - fll_print_dynamic_raw(setting->line_last, print.to.stream); + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; + if (setting->flag & (fss_payload_read_main_flag_verify_e | fss_payload_read_main_flag_file_to_e)) return F_output_not; } - else { - f_print_dynamic_raw(setting->line_last, print.to.stream); + + fll_print_dynamic_raw(setting->line_last, print.to.stream); + + return F_none; + } +#endif // _di_fss_payload_read_print_line_last_locked_ + +#ifndef _di_fss_payload_read_print_line_last_unlocked_ + f_status_t fss_payload_read_print_line_last_unlocked(fss_payload_read_setting_t * const setting, const fl_print_t print) { + + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; + if (setting->flag & (fss_payload_read_main_flag_verify_e | fss_payload_read_main_flag_file_to_e)) return F_output_not; } + + f_print_dynamic_raw(setting->line_last, print.to.stream); + + return F_none; } -#endif // _di_fss_payload_read_print_line_last_ +#endif // _di_fss_payload_read_print_line_last_unlocked_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/fss_payload_read/c/print.h b/level_3/fss_payload_read/c/print.h index 5b44116..d7b9c59 100644 --- a/level_3/fss_payload_read/c/print.h +++ b/level_3/fss_payload_read/c/print.h @@ -33,36 +33,84 @@ extern "C" { * * This is generally either the first line in the program or the first line printed before an error message. * + * This function locks and then unlocks the input stream when printing. + * + * @param setting + * The main program settings. + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_fss_payload_read_print_line_first_locked_ + extern f_status_t fss_payload_read_print_line_first_locked(fss_payload_read_setting_t * const setting, const fl_print_t print); +#endif // _di_fss_payload_read_print_line_first_locked_ + +/** + * Print first new line, unless verbosity says otherwise. + * + * This is generally either the first line in the program or the first line printed before an error message. + * + * This function neither locks nor unlocks the input stream. + * + * @param setting + * The main program settings. + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_fss_payload_read_print_line_first_unlocked_ + extern f_status_t fss_payload_read_print_line_first_unlocked(fss_payload_read_setting_t * const setting, const fl_print_t print); +#endif // _di_fss_payload_read_print_line_first_unlocked_ + +/** + * Print last new line when the main is complete, unless verbosity says otherwise. + * + * This is generally the very last line printed in the program. + * + * This function locks and then unlocks the input stream when printing. + * * @param setting * The main program settings. * This does not alter setting.status. * @param print * Designates the how and where to print. - * @param lock - * If TRUE, then lock the stream. - * If FALSE, then do not lock or unlock the stream. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. */ -#ifndef _di_fss_payload_read_print_line_first_ - extern void fss_payload_read_print_line_first(fss_payload_read_setting_t * const setting, const fl_print_t print, const bool lock); -#endif // _di_fss_payload_read_print_line_first_ +#ifndef _di_fss_payload_read_print_line_last_locked_ + extern f_status_t fss_payload_read_print_line_last_locked(fss_payload_read_setting_t * const setting, const fl_print_t print); +#endif // _di_fss_payload_read_print_line_last_locked_ /** * Print last new line when the main is complete, unless verbosity says otherwise. * * This is generally the very last line printed in the program. * + * This function neither locks nor unlocks the input stream. + * * @param setting * The main program settings. * This does not alter setting.status. * @param print * Designates the how and where to print. - * @param lock - * If TRUE, then lock the stream. - * If FALSE, then do not lock or unlock the stream. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. */ -#ifndef _di_fss_payload_read_print_line_last_ - extern void fss_payload_read_print_line_last(fss_payload_read_setting_t * const setting, const fl_print_t print, const bool lock); -#endif // _di_fss_payload_read_print_line_last_ +#ifndef _di_fss_payload_read_print_line_last_unlocked_ + extern f_status_t fss_payload_read_print_line_last_unlocked(fss_payload_read_setting_t * const setting, const fl_print_t print); +#endif // _di_fss_payload_read_print_line_last_unlocked_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/fss_payload_write/c/print.c b/level_3/fss_payload_write/c/print.c index 91f5ca5..82e3d7b 100644 --- a/level_3/fss_payload_write/c/print.c +++ b/level_3/fss_payload_write/c/print.c @@ -52,36 +52,67 @@ extern "C" { } #endif // _di_fss_payload_write_print_help_ -#ifndef _di_fss_payload_write_print_line_first_ - void fss_payload_write_print_line_first(fss_payload_write_setting_t * const setting, const fl_print_t print, const bool lock) { +#ifndef _di_fss_payload_write_print_line_first_locked_ + f_status_t fss_payload_write_print_line_first_locked(fss_payload_write_setting_t * const setting, const fl_print_t print) { - if (print.verbosity == f_console_verbosity_quiet_e) return; + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - if (lock) { - fll_print_dynamic_raw(setting->line_first, print.to.stream); + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } - else { - f_print_dynamic_raw(setting->line_first, print.to.stream); + + f_print_dynamic_raw(setting->line_first, print.to.stream); + + return F_none; + } +#endif // _di_fss_payload_write_print_line_first_locked_ + +#ifndef _di_fss_payload_write_print_line_first_unlocked_ + f_status_t fss_payload_write_print_line_first_unlocked(fss_payload_write_setting_t * const setting, const fl_print_t print) { + + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } + + fll_print_dynamic_raw(setting->line_first, print.to.stream); + + return F_none; } -#endif // _di_fss_payload_write_print_line_first_ +#endif // _di_fss_payload_write_print_line_first_unlocked_ -#ifndef _di_fss_payload_write_print_line_last_ - void fss_payload_write_print_line_last(fss_payload_write_setting_t * const setting, const fl_print_t print, const bool lock) { +#ifndef _di_fss_payload_write_print_line_last_locked_ + f_status_t fss_payload_write_print_line_last_locked(fss_payload_write_setting_t * const setting, const fl_print_t print) { - if (print.verbosity == f_console_verbosity_quiet_e) return; - if (print.verbosity == f_console_verbosity_error_e && !F_status_is_error(setting->status)) return; - if (setting->flag & fss_payload_write_main_flag_verify_e) return; - if ((setting->flag & fss_payload_write_main_flag_file_to_e) && !F_status_is_error(setting->status)) return; + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - if (lock) { - fll_print_dynamic_raw(setting->line_last, print.to.stream); + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; + if (setting->flag & (fss_payload_write_main_flag_verify_e | fss_payload_write_main_flag_file_to_e)) return F_output_not; } - else { - f_print_dynamic_raw(setting->line_last, print.to.stream); + + fll_print_dynamic_raw(setting->line_last, print.to.stream); + + return F_none; + } +#endif // _di_fss_payload_write_print_line_last_locked_ + +#ifndef _di_fss_payload_write_print_line_last_unlocked_ + f_status_t fss_payload_write_print_line_last_unlocked(fss_payload_write_setting_t * const setting, const fl_print_t print) { + + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; + if (setting->flag & (fss_payload_write_main_flag_verify_e | fss_payload_write_main_flag_file_to_e)) return F_output_not; } + + f_print_dynamic_raw(setting->line_last, print.to.stream); + + return F_none; } -#endif // _di_fss_payload_write_print_line_last_ +#endif // _di_fss_payload_write_print_line_last_unlocked_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/fss_payload_write/c/print.h b/level_3/fss_payload_write/c/print.h index b2fb19a..c88f173 100644 --- a/level_3/fss_payload_write/c/print.h +++ b/level_3/fss_payload_write/c/print.h @@ -33,36 +33,84 @@ extern "C" { * * This is generally either the first line in the program or the first line printed before an error message. * + * This function locks and then unlocks the input stream when printing. + * + * @param setting + * The main program settings. + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_fss_payload_write_print_line_first_locked_ + extern f_status_t fss_payload_write_print_line_first_locked(fss_payload_write_setting_t * const setting, const fl_print_t print); +#endif // _di_fss_payload_write_print_line_first_locked_ + +/** + * Print first new line, unless verbosity says otherwise. + * + * This is generally either the first line in the program or the first line printed before an error message. + * + * This function neither locks nor unlocks the input stream. + * + * @param setting + * The main program settings. + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_fss_payload_write_print_line_first_unlocked_ + extern f_status_t fss_payload_write_print_line_first_unlocked(fss_payload_write_setting_t * const setting, const fl_print_t print); +#endif // _di_fss_payload_write_print_line_first_unlocked_ + +/** + * Print last new line when the main is complete, unless verbosity says otherwise. + * + * This is generally the very last line printed in the program. + * + * This function locks and then unlocks the input stream when printing. + * * @param setting * The main program settings. * This does not alter setting.status. * @param print * Designates the how and where to print. - * @param lock - * If TRUE, then lock the stream. - * If FALSE, then do not lock or unlock the stream. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. */ -#ifndef _di_fss_payload_write_print_line_first_ - extern void fss_payload_write_print_line_first(fss_payload_write_setting_t * const setting, const fl_print_t print, const bool lock); -#endif // _di_fss_payload_write_print_line_first_ +#ifndef _di_fss_payload_write_print_line_last_locked_ + extern f_status_t fss_payload_write_print_line_last_locked(fss_payload_write_setting_t * const setting, const fl_print_t print); +#endif // _di_fss_payload_write_print_line_last_locked_ /** * Print last new line when the main is complete, unless verbosity says otherwise. * * This is generally the very last line printed in the program. * + * This function neither locks nor unlocks the input stream. + * * @param setting * The main program settings. * This does not alter setting.status. * @param print * Designates the how and where to print. - * @param lock - * If TRUE, then lock the stream. - * If FALSE, then do not lock or unlock the stream. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. */ -#ifndef _di_fss_payload_write_print_line_last_ - extern void fss_payload_write_print_line_last(fss_payload_write_setting_t * const setting, const fl_print_t print, const bool lock); -#endif // _di_fss_payload_write_print_line_last_ +#ifndef _di_fss_payload_write_print_line_last_unlocked_ + extern f_status_t fss_payload_write_print_line_last_unlocked(fss_payload_write_setting_t * const setting, const fl_print_t print); +#endif // _di_fss_payload_write_print_line_last_unlocked_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/fss_status_code/c/common.c b/level_3/fss_status_code/c/common.c index 4bd0140..c1f3a8c 100644 --- a/level_3/fss_status_code/c/common.c +++ b/level_3/fss_status_code/c/common.c @@ -57,9 +57,9 @@ extern "C" { setting->status = f_console_parameter_process(arguments, &main->parameters); if (F_status_is_error(setting->status)) { - fss_status_code_print_line_first(setting, main->error, F_true); + fss_status_code_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_process", F_true); - fss_status_code_print_line_last(setting, main->error, F_true); + fss_status_code_print_line_last_locked(setting, main->error); return; } @@ -79,9 +79,9 @@ extern "C" { setting->status = fll_program_parameter_process_context(choices, modes, F_true, main); if (F_status_is_error(setting->status)) { - fss_status_code_print_line_first(setting, main->error, F_true); + fss_status_code_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->status), "fll_program_parameter_process_context", F_true); - fss_status_code_print_line_last(setting, main->error, F_true); + fss_status_code_print_line_last_locked(setting, main->error); return; } @@ -112,9 +112,9 @@ extern "C" { setting->status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); if (F_status_is_error(setting->status)) { - fss_status_code_print_line_first(setting, main->error, F_true); + fss_status_code_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->status), "fll_program_parameter_process_verbosity", F_true); - fss_status_code_print_line_last(setting, main->error, F_true); + fss_status_code_print_line_last_locked(setting, main->error); return; } @@ -154,9 +154,9 @@ extern "C" { if (!(setting->flag & fss_status_code_main_flag_number_e)) { setting->status = F_status_set_error(F_parameter); - fss_status_code_print_line_first(setting, main->error, F_true); + fss_status_code_print_line_first_locked(setting, main->error); fss_status_code_print_error_cannot_error_warning_number(setting, main->error); - fss_status_code_print_line_last(setting, main->error, F_true); + fss_status_code_print_line_last_locked(setting, main->error); return; } @@ -165,9 +165,9 @@ extern "C" { if (setting->flag & fss_status_code_main_flag_fine_e) { setting->status = F_status_set_error(F_parameter); - fss_status_code_print_line_first(setting, main->error, F_true); + fss_status_code_print_line_first_locked(setting, main->error); fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, fss_status_code_long_error_s, fss_status_code_long_fine_s); - fss_status_code_print_line_last(setting, main->error, F_true); + fss_status_code_print_line_last_locked(setting, main->error); return; } @@ -175,9 +175,9 @@ extern "C" { else if (setting->flag & fss_status_code_main_flag_warning_e && setting->flag & fss_status_code_main_flag_fine_e) { setting->status = F_status_set_error(F_parameter); - fss_status_code_print_line_first(setting, main->error, F_true); + fss_status_code_print_line_first_locked(setting, main->error); fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, fss_status_code_long_warning_s, fss_status_code_long_fine_s); - fss_status_code_print_line_last(setting, main->error, F_true); + fss_status_code_print_line_last_locked(setting, main->error); return; } @@ -185,9 +185,9 @@ extern "C" { if (main->parameters.remaining.used == 0 && !(main->pipe & fll_program_data_pipe_input_e)) { setting->status = F_status_set_error(F_parameter); - fss_status_code_print_line_first(setting, main->error, F_true); + fss_status_code_print_line_first_locked(setting, main->error); fss_status_code_print_error_no_fss_status_codes(setting, main->error); - fss_status_code_print_line_last(setting, main->error, F_true); + fss_status_code_print_line_last_locked(setting, main->error); return; } diff --git a/level_3/fss_status_code/c/fss_status_code.c b/level_3/fss_status_code/c/fss_status_code.c index 8e48fb0..97d27fa 100644 --- a/level_3/fss_status_code/c/fss_status_code.c +++ b/level_3/fss_status_code/c/fss_status_code.c @@ -125,10 +125,10 @@ extern "C" { } if (F_status_is_error(setting->status)) { - fss_status_code_print_line_last(setting, main->error, F_true); + fss_status_code_print_line_last_locked(setting, main->error); } else if (setting->status != F_interrupt) { - fss_status_code_print_line_last(setting, main->message, F_true); + fss_status_code_print_line_last_locked(setting, main->message); } } #endif // _di_fss_status_code_main_ diff --git a/level_3/fss_status_code/c/print.c b/level_3/fss_status_code/c/print.c index 377018b..27314ba 100644 --- a/level_3/fss_status_code/c/print.c +++ b/level_3/fss_status_code/c/print.c @@ -67,38 +67,65 @@ extern "C" { } #endif // _di_fss_status_code_print_help_ -#ifndef _di_fss_status_code_print_line_first_ - f_status_t fss_status_code_print_line_first(fss_status_code_setting_t * const setting, const fl_print_t print, const bool lock) { +#ifndef _di_fss_status_code_print_line_first_locked_ + f_status_t fss_status_code_print_line_first_locked(fss_status_code_setting_t * const setting, const fl_print_t print) { if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - if (lock) { - fll_print_dynamic_raw(setting->line_first, print.to.stream); + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } - else { - f_print_dynamic_raw(setting->line_first, print.to.stream); + + f_print_dynamic_raw(setting->line_first, print.to.stream); + + return F_none; + } +#endif // _di_fss_status_code_print_line_first_locked_ + +#ifndef _di_fss_status_code_print_line_first_unlocked_ + f_status_t fss_status_code_print_line_first_unlocked(fss_status_code_setting_t * const setting, const fl_print_t print) { + + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } + fll_print_dynamic_raw(setting->line_first, print.to.stream); + return F_none; } -#endif // _di_fss_status_code_print_line_first_ +#endif // _di_fss_status_code_print_line_first_unlocked_ -#ifndef _di_fss_status_code_print_line_last_ - f_status_t fss_status_code_print_line_last(fss_status_code_setting_t * const setting, const fl_print_t print, const bool lock) { +#ifndef _di_fss_status_code_print_line_last_locked_ + f_status_t fss_status_code_print_line_last_locked(fss_status_code_setting_t * const setting, const fl_print_t print) { if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - if (print.verbosity == f_console_verbosity_error_e && !F_status_is_error(setting->status)) return F_output_not; - if (lock) { - fll_print_dynamic_raw(setting->line_last, print.to.stream); + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } - else { - f_print_dynamic_raw(setting->line_last, print.to.stream); + + fll_print_dynamic_raw(setting->line_last, print.to.stream); + + return F_none; + } +#endif // _di_fss_status_code_print_line_last_locked_ + +#ifndef _di_fss_status_code_print_line_last_unlocked_ + f_status_t fss_status_code_print_line_last_unlocked(fss_status_code_setting_t * const setting, const fl_print_t print) { + + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } + f_print_dynamic_raw(setting->line_last, print.to.stream); + return F_none; } -#endif // _di_fss_status_code_print_line_last_ +#endif // _di_fss_status_code_print_line_last_unlocked_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/fss_status_code/c/print.h b/level_3/fss_status_code/c/print.h index aa00721..d1d6b73 100644 --- a/level_3/fss_status_code/c/print.h +++ b/level_3/fss_status_code/c/print.h @@ -68,44 +68,84 @@ extern "C" { * * This is generally either the first line in the program or the first line printed before an error message. * + * This function locks and then unlocks the input stream when printing. + * + * @param setting + * The main program settings. + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_fss_status_code_print_line_first_locked_ + extern f_status_t fss_status_code_print_line_first_locked(fss_status_code_setting_t * const setting, const fl_print_t print); +#endif // _di_fss_status_code_print_line_first_locked_ + +/** + * Print first new line, unless verbosity says otherwise. + * + * This is generally either the first line in the program or the first line printed before an error message. + * + * This function neither locks nor unlocks the input stream. + * * @param setting * The main program settings. * This does not alter setting.status. * @param print * Designates the how and where to print. - * @param lock - * If TRUE, then lock the stream. - * If FALSE, then do not lock or unlock the stream. * * @return * F_none on success. * F_output_not on success, but no printing is performed. */ -#ifndef _di_fss_status_code_print_line_first_ - extern f_status_t fss_status_code_print_line_first(fss_status_code_setting_t * const setting, const fl_print_t print, const bool lock); -#endif // _di_fss_status_code_print_line_first_ +#ifndef _di_fss_status_code_print_line_first_unlocked_ + extern f_status_t fss_status_code_print_line_first_unlocked(fss_status_code_setting_t * const setting, const fl_print_t print); +#endif // _di_fss_status_code_print_line_first_unlocked_ /** * Print last new line when the main is complete, unless verbosity says otherwise. * * This is generally the very last line printed in the program. * + * This function locks and then unlocks the input stream when printing. + * + * @param setting + * The main program settings. + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_fss_status_code_print_line_last_locked_ + extern f_status_t fss_status_code_print_line_last_locked(fss_status_code_setting_t * const setting, const fl_print_t print); +#endif // _di_fss_status_code_print_line_last_locked_ + +/** + * Print last new line when the main is complete, unless verbosity says otherwise. + * + * This is generally the very last line printed in the program. + * + * This function neither locks nor unlocks the input stream. + * * @param setting * The main program settings. * This does not alter setting.status. * @param print * Designates the how and where to print. - * @param lock - * If TRUE, then lock the stream. - * If FALSE, then do not lock or unlock the stream. * * @return * F_none on success. * F_output_not on success, but no printing is performed. */ -#ifndef _di_fss_status_code_print_line_last_ - extern f_status_t fss_status_code_print_line_last(fss_status_code_setting_t * const setting, const fl_print_t print, const bool lock); -#endif // _di_fss_status_code_print_line_last_ +#ifndef _di_fss_status_code_print_line_last_unlocked_ + extern f_status_t fss_status_code_print_line_last_unlocked(fss_status_code_setting_t * const setting, const fl_print_t print); +#endif // _di_fss_status_code_print_line_last_unlocked_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/iki_read/c/common.c b/level_3/iki_read/c/common.c index 932b8db..2cd7547 100644 --- a/level_3/iki_read/c/common.c +++ b/level_3/iki_read/c/common.c @@ -80,8 +80,9 @@ extern "C" { setting->status = fll_program_parameter_process_context(choices, modes, F_true, main); if (F_status_is_error(setting->status)) { - iki_read_print_line_first(setting, main->error, F_true); + iki_read_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->status), "fll_program_parameter_process_context", F_true); + iki_read_print_line_last_locked(setting, main->error); return; } @@ -112,8 +113,9 @@ extern "C" { setting->status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); if (F_status_is_error(setting->status)) { - iki_read_print_line_first(setting, main->error, F_true); + iki_read_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->status), "fll_program_parameter_process_verbosity", F_true); + iki_read_print_line_last_locked(setting, main->error); return; } @@ -134,9 +136,19 @@ extern "C" { f_string_static_t * const args = main->parameters.arguments.array; - if (main->parameters.array[iki_read_parameter_strip_invalid_e].result == f_console_result_found_e) { - setting->flag |= iki_read_main_flag_strip_invalid_e; + if (!(main->parameters.remaining.used || (main->pipe & fll_program_data_pipe_input_e)) { + setting->status = F_status_set_error(F_parameter); + + iki_read_print_line_first_locked(setting, main->error); + fll_program_print_error_missing_file(main->error); + iki_read_print_line_last_locked(setting, main->error); + + return; } + + //if (main->parameters.array[iki_read_parameter_strip_invalid_e].result == f_console_result_found_e) { + // setting->flag |= iki_read_main_flag_strip_invalid_e; + //} } #endif // _di_iki_read_setting_load_ diff --git a/level_3/iki_read/c/iki_read.c b/level_3/iki_read/c/iki_read.c index 4628854..f0fcee9 100644 --- a/level_3/iki_read/c/iki_read.c +++ b/level_3/iki_read/c/iki_read.c @@ -9,50 +9,26 @@ extern "C" { #ifndef _di_iki_read_main_ f_status_t iki_read_main(fll_program_data_t * const main, iki_read_setting_t * const setting) { - f_status_t status = F_none; + if (!main || !setting || F_status_is_error(setting->status)) return; - // Load parameters. - status = f_console_parameter_process(arguments, &main->parameters); - if (F_status_is_error(status)) return; + setting->status = F_none; - { - f_array_length_t choice = 0; - f_uint16s_t choices = f_uint16s_t_initialize; - - // Identify and prioritize "color context" parameters. - { - uint16_t choices_array[3] = { iki_read_parameter_no_color_e, iki_read_parameter_light_e, iki_read_parameter_dark_e }; - choices.array = choices_array; - choices.used = 3; - - const uint8_t modes[3] = { f_color_mode_color_not_e, f_color_mode_light_e, f_color_mode_dark_e }; - - status = fll_program_parameter_process_context(choices, modes, F_true, main); - - if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_context", F_true); - - return; - } - } + if (setting->flag & iki_read_main_flag_help_e) { + iki_read_print_help(setting, main->message); - // Identify and prioritize "verbosity" parameters. - { - uint16_t choices_array[5] = { iki_read_parameter_verbosity_quiet_e, iki_read_parameter_verbosity_error_e, iki_read_parameter_verbosity_verbose_e, iki_read_parameter_verbosity_debug_e, iki_read_parameter_verbosity_normal_e }; - choices.array = choices_array; - choices.used = 5; + return; + } - 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 }; + if (setting->flag & iki_read_main_flag_version_e) { + fll_program_print_version(main->message, iki_read_program_version_s); - status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); + return; + } - if (F_status_is_error(status)) { - fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_verbosity", F_true); + // ... + //if (main->pipe & fll_program_data_pipe_input_e) { - return; - } - } - } + // XXXXXXXXXXXXXXXXXXXX iki_read_data_t data = iki_read_data_t_initialize; data.main = main; @@ -60,22 +36,6 @@ extern "C" { status = F_none; - if (main->parameters.array[iki_read_parameter_help_e].result == f_console_result_found_e) { - iki_read_print_help(setting, main->message); - - iki_read_data_delete(&data); - - return F_none; - } - - if (main->parameters.array[iki_read_parameter_version_e].result == f_console_result_found_e) { - fll_program_print_version(main->message, iki_read_program_version_s); - - iki_read_data_delete(&data); - - return F_none; - } - if (main->parameters.remaining.used > 0 || (main->pipe & fll_program_data_pipe_input_e)) { if (main->parameters.array[iki_read_parameter_at_e].result == f_console_result_found_e) { if (main->error.verbosity > f_console_verbosity_quiet_e) { diff --git a/level_3/iki_read/c/print.c b/level_3/iki_read/c/print.c index e901ed1..4f28cdb 100644 --- a/level_3/iki_read/c/print.c +++ b/level_3/iki_read/c/print.c @@ -94,36 +94,65 @@ extern "C" { } #endif // _di_iki_read_print_help_ -#ifndef _di_iki_read_print_line_first_ - void iki_read_print_line_first(iki_read_setting_t * const setting, const fl_print_t print, const bool lock) { +#ifndef _di_iki_read_print_line_first_locked_ + f_status_t iki_read_print_line_first_locked(iki_read_setting_t * const setting, const fl_print_t print) { - if (print.verbosity == f_console_verbosity_quiet_e) return; + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - if (lock) { - fll_print_dynamic_raw(setting->line_first, print.to.stream); + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } - else { - f_print_dynamic_raw(setting->line_first, print.to.stream); + + f_print_dynamic_raw(setting->line_first, print.to.stream); + + return F_none; + } +#endif // _di_iki_read_print_line_first_locked_ + +#ifndef _di_iki_read_print_line_first_unlocked_ + f_status_t iki_read_print_line_first_unlocked(iki_read_setting_t * const setting, const fl_print_t print) { + + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } + + fll_print_dynamic_raw(setting->line_first, print.to.stream); + + return F_none; } -#endif // _di_iki_read_print_line_first_ +#endif // _di_iki_read_print_line_first_unlocked_ -#ifndef _di_iki_read_print_line_last_ - void iki_read_print_line_last(iki_read_setting_t * const setting, const fl_print_t print, const bool lock) { +#ifndef _di_iki_read_print_line_last_locked_ + f_status_t iki_read_print_line_last_locked(iki_read_setting_t * const setting, const fl_print_t print) { - if (print.verbosity == f_console_verbosity_quiet_e) return; - if (print.verbosity == f_console_verbosity_error_e && !F_status_is_error(setting->status)) return; - if (setting->flag & iki_read_main_flag_verify_e) return; - if ((setting->flag & iki_read_main_flag_file_to_e) && !F_status_is_error(setting->status)) return; + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - if (lock) { - fll_print_dynamic_raw(setting->line_last, print.to.stream); + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } - else { - f_print_dynamic_raw(setting->line_last, print.to.stream); + + fll_print_dynamic_raw(setting->line_last, print.to.stream); + + return F_none; + } +#endif // _di_iki_read_print_line_last_locked_ + +#ifndef _di_iki_read_print_line_last_unlocked_ + f_status_t iki_read_print_line_last_unlocked(iki_read_setting_t * const setting, const fl_print_t print) { + + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } + + f_print_dynamic_raw(setting->line_last, print.to.stream); + + return F_none; } -#endif // _di_iki_read_print_line_last_ +#endif // _di_iki_read_print_line_last_unlocked_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/iki_read/c/print.h b/level_3/iki_read/c/print.h index 9afe978..9b4c4ed 100644 --- a/level_3/iki_read/c/print.h +++ b/level_3/iki_read/c/print.h @@ -33,36 +33,84 @@ extern "C" { * * This is generally either the first line in the program or the first line printed before an error message. * + * This function locks and then unlocks the input stream when printing. + * + * @param setting + * The main program settings. + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_iki_read_print_line_first_locked_ + extern f_status_t iki_read_print_line_first_locked(iki_read_setting_t * const setting, const fl_print_t print); +#endif // _di_iki_read_print_line_first_locked_ + +/** + * Print first new line, unless verbosity says otherwise. + * + * This is generally either the first line in the program or the first line printed before an error message. + * + * This function neither locks nor unlocks the input stream. + * + * @param setting + * The main program settings. + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_iki_read_print_line_first_unlocked_ + extern f_status_t iki_read_print_line_first_unlocked(iki_read_setting_t * const setting, const fl_print_t print); +#endif // _di_iki_read_print_line_first_unlocked_ + +/** + * Print last new line when the main is complete, unless verbosity says otherwise. + * + * This is generally the very last line printed in the program. + * + * This function locks and then unlocks the input stream when printing. + * * @param setting * The main program settings. * This does not alter setting.status. * @param print * Designates the how and where to print. - * @param lock - * If TRUE, then lock the stream. - * If FALSE, then do not lock or unlock the stream. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. */ -#ifndef _di_iki_read_print_line_first_ - extern void iki_read_print_line_first(iki_read_setting_t * const setting, const fl_print_t print, const bool lock); -#endif // _di_iki_read_print_line_first_ +#ifndef _di_iki_read_print_line_last_locked_ + extern f_status_t iki_read_print_line_last_locked(iki_read_setting_t * const setting, const fl_print_t print); +#endif // _di_iki_read_print_line_last_locked_ /** * Print last new line when the main is complete, unless verbosity says otherwise. * * This is generally the very last line printed in the program. * + * This function neither locks nor unlocks the input stream. + * * @param setting * The main program settings. * This does not alter setting.status. * @param print * Designates the how and where to print. - * @param lock - * If TRUE, then lock the stream. - * If FALSE, then do not lock or unlock the stream. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. */ -#ifndef _di_iki_read_print_line_last_ - extern void iki_read_print_line_last(iki_read_setting_t * const setting, const fl_print_t print, const bool lock); -#endif // _di_iki_read_print_line_last_ +#ifndef _di_iki_read_print_line_last_unlocked_ + extern f_status_t iki_read_print_line_last_unlocked(iki_read_setting_t * const setting, const fl_print_t print); +#endif // _di_iki_read_print_line_last_unlocked_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/iki_read/c/private-common.c b/level_3/iki_read/c/private-common.c index 6d208ab..b947104 100644 --- a/level_3/iki_read/c/private-common.c +++ b/level_3/iki_read/c/private-common.c @@ -6,7 +6,7 @@ extern "C" { #endif #ifndef _di_iki_read_data_delete_ - f_status_t iki_read_data_delete(fll_program_data_t * const main, status_code_setting_t * const setting, iki_read_data_t * const data) { + f_status_t iki_read_data_delete(fll_program_data_t * const main, iki_read_setting_t * const setting, iki_read_data_t * const data) { f_string_dynamic_resize(0, &data->buffer); diff --git a/level_3/iki_read/c/private-common.h b/level_3/iki_read/c/private-common.h index 3039b9a..cf7c707 100644 --- a/level_3/iki_read/c/private-common.h +++ b/level_3/iki_read/c/private-common.h @@ -77,7 +77,7 @@ extern "C" { * F_none on success. */ #ifndef _di_iki_read_data_delete_ - extern f_status_t iki_read_data_delete(fll_program_data_t * const main, status_code_setting_t * const setting, iki_read_data_t * const data) F_attribute_visibility_internal_d; + extern f_status_t iki_read_data_delete(fll_program_data_t * const main, iki_read_setting_t * const setting, iki_read_data_t * const data) F_attribute_visibility_internal_d; #endif // _di_iki_read_data_delete_ #ifdef __cplusplus diff --git a/level_3/iki_read/c/private-print.c b/level_3/iki_read/c/private-print.c index c4f81a2..e9c1186 100644 --- a/level_3/iki_read/c/private-print.c +++ b/level_3/iki_read/c/private-print.c @@ -7,7 +7,7 @@ extern "C" { #endif #ifndef _di_iki_read_substitutions_print_ - void iki_read_substitutions_print(fll_program_data_t * const main, status_code_setting_t * const setting, iki_read_data_t * const data, const f_iki_data_t iki_data, const f_string_ranges_t ranges, const iki_read_substitution_t replacement, const iki_read_substitution_t wraps, const iki_read_substitutions_t substitutions, const f_array_length_t index, const bool content_only) { + void iki_read_substitutions_print(fll_program_data_t * const main, iki_read_setting_t * const setting, iki_read_data_t * const data, const f_iki_data_t iki_data, const f_string_ranges_t ranges, const iki_read_substitution_t replacement, const iki_read_substitution_t wraps, const iki_read_substitutions_t substitutions, const f_array_length_t index, const bool content_only) { uint8_t matched = F_false; f_array_length_t at = 0; diff --git a/level_3/iki_read/c/private-print.h b/level_3/iki_read/c/private-print.h index 99332ff..8630d52 100644 --- a/level_3/iki_read/c/private-print.h +++ b/level_3/iki_read/c/private-print.h @@ -35,7 +35,7 @@ extern "C" { * Set to FALSE to print the entire variable when printing substituted text. */ #ifndef _di_iki_read_substitutions_print_ - extern void iki_read_substitutions_print(fll_program_data_t * const main, status_code_setting_t * const setting, iki_read_data_t * const data, const f_iki_data_t iki_data, const f_string_ranges_t ranges, const iki_read_substitution_t replacement, const iki_read_substitution_t wraps, const iki_read_substitutions_t substitutions, const f_array_length_t index, const bool content_only) F_attribute_visibility_internal_d; + extern void iki_read_substitutions_print(fll_program_data_t * const main, iki_read_setting_t * const setting, iki_read_data_t * const data, const f_iki_data_t iki_data, const f_string_ranges_t ranges, const iki_read_substitution_t replacement, const iki_read_substitution_t wraps, const iki_read_substitutions_t substitutions, const f_array_length_t index, const bool content_only) F_attribute_visibility_internal_d; #endif // _di_iki_read_substitutions_print_ #ifdef __cplusplus diff --git a/level_3/iki_read/c/private-read.c b/level_3/iki_read/c/private-read.c index 3f91b7f..04307bd 100644 --- a/level_3/iki_read/c/private-read.c +++ b/level_3/iki_read/c/private-read.c @@ -8,7 +8,7 @@ extern "C" { #endif #ifndef _di_iki_read_process_at_ - f_status_t iki_read_process_at(fll_program_data_t * const main, status_code_setting_t * const setting, iki_read_data_t * const data, f_string_range_t *range) { + f_status_t iki_read_process_at(fll_program_data_t * const main, iki_read_setting_t * const setting, iki_read_data_t * const data, f_string_range_t *range) { if (data->main->parameters.array[iki_read_parameter_line_e].result != f_console_result_additional_e) { return F_false; diff --git a/level_3/iki_read/c/private-read.h b/level_3/iki_read/c/private-read.h index f41b1df..c6faed4 100644 --- a/level_3/iki_read/c/private-read.h +++ b/level_3/iki_read/c/private-read.h @@ -31,7 +31,7 @@ extern "C" { * Status codes (with error bit) are returned on any problem. */ #ifndef _di_iki_read_process_at_ - extern f_status_t iki_read_process_at(fll_program_data_t * const main, status_code_setting_t * const setting, iki_read_data_t * const data, f_string_range_t *range) F_attribute_visibility_internal_d; + extern f_status_t iki_read_process_at(fll_program_data_t * const main, iki_read_setting_t * const setting, iki_read_data_t * const data, f_string_range_t *range) F_attribute_visibility_internal_d; #endif // _di_iki_read_process_at_ /** diff --git a/level_3/iki_write/c/common.c b/level_3/iki_write/c/common.c index 6164233..cccfa4e 100644 --- a/level_3/iki_write/c/common.c +++ b/level_3/iki_write/c/common.c @@ -57,9 +57,9 @@ extern "C" { setting->status = f_console_parameter_process(arguments, &main->parameters); if (F_status_is_error(setting->status)) { - iki_write_print_line_first(setting, main->error, F_true); + iki_write_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_process", F_true); - iki_write_print_line_last(setting, main->error, F_true); + iki_write_print_line_last_locked(setting, main->error); return; } @@ -79,9 +79,9 @@ extern "C" { setting->status = fll_program_parameter_process_context(choices, modes, F_true, main); if (F_status_is_error(setting->status)) { - iki_write_print_line_first(setting, main->error, F_true); + iki_write_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->status), "fll_program_parameter_process_context", F_true); - iki_write_print_line_last(setting, main->error, F_true); + iki_write_print_line_last_locked(setting, main->error); return; } @@ -112,9 +112,9 @@ extern "C" { setting->status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); if (F_status_is_error(setting->status)) { - iki_write_print_line_first(setting, main->error, F_true); + iki_write_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->status), "fll_program_parameter_process_verbosity", F_true); - iki_write_print_line_last(setting, main->error, F_true); + iki_write_print_line_last_locked(setting, main->error); return; } @@ -141,9 +141,9 @@ extern "C" { if (main->parameters.array[iki_write_parameter_file_e].values.used > 1) { setting->status = F_status_set_error(F_parameter); - iki_write_print_line_first(setting, main->error, F_true); + iki_write_print_line_first_locked(setting, main->error); fll_program_print_error_parameter_must_specify_once(main->error, f_console_symbol_long_enable_s, iki_write_long_file_s); - iki_write_print_line_last(setting, main->error, F_true); + iki_write_print_line_last_locked(setting, main->error); return; } @@ -158,9 +158,9 @@ extern "C" { setting->status = f_file_stream_open(args[index], f_string_empty_s, &main->output.to); if (F_status_is_error(setting->status)) { - iki_write_print_line_first(setting, main->error, F_true); + iki_write_print_line_first_locked(setting, main->error); fll_error_file_print(main->error, F_status_set_fine(setting->status), "f_file_stream_open", F_true, args[index], f_file_operation_open_s, fll_error_file_type_file_e); - iki_write_print_line_last(setting, main->error, F_true); + iki_write_print_line_last_locked(setting, main->error); return; } @@ -170,9 +170,9 @@ extern "C" { else if (main->parameters.array[iki_write_parameter_file_e].result == f_console_result_found_e) { setting->status = F_status_set_error(F_parameter); - iki_write_print_line_first(setting, main->error, F_true); + iki_write_print_line_first_locked(setting, main->error); fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_enable_s, iki_write_long_file_s); - iki_write_print_line_last(setting, main->error, F_true); + iki_write_print_line_last_locked(setting, main->error); return; } @@ -185,9 +185,9 @@ extern "C" { setting->status = f_string_dynamics_resize(values->used, &setting->objects); if (F_status_is_error(setting->status)) { - iki_write_print_line_first(setting, main->error, F_true); + iki_write_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->status), "f_string_dynamics_resize", F_true); - iki_write_print_line_last(setting, main->error, F_true); + iki_write_print_line_last_locked(setting, main->error); return; } @@ -207,9 +207,9 @@ extern "C" { else if (main->parameters.array[iki_write_parameter_object_e].result == f_console_result_found_e) { setting->status = F_status_set_error(F_parameter); - iki_write_print_line_first(setting, main->error, F_true); + iki_write_print_line_first_locked(setting, main->error); fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_enable_s, iki_write_long_object_s); - iki_write_print_line_last(setting, main->error, F_true); + iki_write_print_line_last_locked(setting, main->error); return; } @@ -222,9 +222,9 @@ extern "C" { setting->status = f_string_dynamics_resize(values->used, &setting->contents); if (F_status_is_error(setting->status)) { - iki_write_print_line_first(setting, main->error, F_true); + iki_write_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->status), "f_string_dynamics_resize", F_true); - iki_write_print_line_last(setting, main->error, F_true); + iki_write_print_line_last_locked(setting, main->error); return; } @@ -244,9 +244,9 @@ extern "C" { else if (main->parameters.array[iki_write_parameter_content_e].result == f_console_result_found_e) { setting->status = F_status_set_error(F_parameter); - iki_write_print_line_first(setting, main->error, F_true); + iki_write_print_line_first_locked(setting, main->error); fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_enable_s, iki_write_long_content_s); - iki_write_print_line_last(setting, main->error, F_true); + iki_write_print_line_last_locked(setting, main->error); return; } @@ -254,9 +254,9 @@ extern "C" { if (!(main->pipe & fll_program_data_pipe_input_e) && !(setting->flag & (iki_write_main_flag_content_e | iki_write_parameter_object_e))) { setting->status = F_status_set_error(F_parameter); - iki_write_print_line_first(setting, main->error, F_true); + iki_write_print_line_first_locked(setting, main->error); iki_write_print_error_main_missing(setting, main->error); - iki_write_print_line_last(setting, main->error, F_true); + iki_write_print_line_last_locked(setting, main->error); return; } diff --git a/level_3/iki_write/c/iki_write.c b/level_3/iki_write/c/iki_write.c index 0c77860..b5d792a 100644 --- a/level_3/iki_write/c/iki_write.c +++ b/level_3/iki_write/c/iki_write.c @@ -61,9 +61,9 @@ extern "C" { if (F_status_is_error(status)) { setting->status = F_status_set_error(F_pipe); - iki_write_print_line_first(setting, main->error, F_true); + iki_write_print_line_first_locked(setting, main->error); fll_error_file_print(main->error, F_status_set_fine(setting->status), "f_file_read", F_true, f_string_ascii_minus_s, f_file_operation_read_s, fll_error_file_type_pipe_e); - iki_write_print_line_last(setting, main->error, F_true); + iki_write_print_line_last_locked(setting, main->error); return; } @@ -71,9 +71,9 @@ extern "C" { if (!setting->buffer.used) { setting->status = F_status_set_error(F_parameter); - iki_write_print_line_first(setting, main->error, F_true); + iki_write_print_line_first_locked(setting, main->error); fll_program_print_error_pipe_missing_content(main->error); - iki_write_print_line_last(setting, main->error, F_true); + iki_write_print_line_last_locked(setting, main->error); return; } @@ -89,9 +89,9 @@ extern "C" { } if (F_status_is_error(setting->status)) { - iki_write_print_line_first(setting, main->error, F_true); + iki_write_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->status), "f_string_dynamic_seek_to", F_true); - iki_write_print_line_last(setting, main->error, F_true); + iki_write_print_line_last_locked(setting, main->error); return; } @@ -99,9 +99,9 @@ extern "C" { if (object_ended && previous == range.start) { setting->status = F_status_set_error(F_parameter); - iki_write_print_line_first(setting, main->error, F_true); + iki_write_print_line_first_locked(setting, main->error); fll_program_print_error_pipe_invalid_form_feed(main->error); - iki_write_print_line_last(setting, main->error, F_true); + iki_write_print_line_last_locked(setting, main->error); return; } @@ -116,9 +116,9 @@ extern "C" { setting->status = f_string_dynamic_partial_append_nulless(setting->buffer, range, &setting->content); if (F_status_is_error(setting->status)) { - iki_write_print_line_first(setting, main->error, F_true); + iki_write_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->status), "f_string_dynamic_partial_append_nulless", F_true); - iki_write_print_line_last(setting, main->error, F_true); + iki_write_print_line_last_locked(setting, main->error); return; } @@ -137,9 +137,9 @@ extern "C" { setting->status = f_string_dynamic_partial_append_nulless(setting->buffer, range, &setting->object); if (F_status_is_error(setting->status)) { - iki_write_print_line_first(setting, main->error, F_true); + iki_write_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->status), "f_string_dynamic_partial_append_nulless", F_true); - iki_write_print_line_last(setting, main->error, F_true); + iki_write_print_line_last_locked(setting, main->error); return; } @@ -162,9 +162,9 @@ extern "C" { if (object_ended) { setting->status = F_status_set_error(F_parameter); - iki_write_print_line_first(setting, main->error, F_true); + iki_write_print_line_first_locked(setting, main->error); fll_program_print_error_pipe_object_without_content(main->error); - iki_write_print_line_last(setting, main->error, F_true); + iki_write_print_line_last_locked(setting, main->error); return; } @@ -189,7 +189,7 @@ extern "C" { } // for // Ensure a new line is always put at the end of the program execution, unless in quiet mode. - iki_write_print_line_last(setting, main->message, F_true); + iki_write_print_line_last_locked(setting, main->message); } #endif // _di_iki_write_main_ diff --git a/level_3/iki_write/c/print.c b/level_3/iki_write/c/print.c index 9c0ac56..c4fe82c 100644 --- a/level_3/iki_write/c/print.c +++ b/level_3/iki_write/c/print.c @@ -55,38 +55,65 @@ extern "C" { } #endif // _di_iki_write_print_help_ -#ifndef _di_iki_write_print_line_first_ - f_status_t iki_write_print_line_first(iki_write_setting_t * const setting, const fl_print_t print, const bool lock) { +#ifndef _di_iki_write_print_line_first_locked_ + f_status_t iki_write_print_line_first_locked(iki_write_setting_t * const setting, const fl_print_t print) { if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - if (lock) { - fll_print_dynamic_raw(setting->line_first, print.to.stream); + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } - else { - f_print_dynamic_raw(setting->line_first, print.to.stream); + + f_print_dynamic_raw(setting->line_first, print.to.stream); + + return F_none; + } +#endif // _di_iki_write_print_line_first_locked_ + +#ifndef _di_iki_write_print_line_first_unlocked_ + f_status_t iki_write_print_line_first_unlocked(iki_write_setting_t * const setting, const fl_print_t print) { + + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } + fll_print_dynamic_raw(setting->line_first, print.to.stream); + return F_none; } -#endif // _di_iki_write_print_line_first_ +#endif // _di_iki_write_print_line_first_unlocked_ -#ifndef _di_iki_write_print_line_last_ - f_status_t iki_write_print_line_last(iki_write_setting_t * const setting, const fl_print_t print, const bool lock) { +#ifndef _di_iki_write_print_line_last_locked_ + f_status_t iki_write_print_line_last_locked(iki_write_setting_t * const setting, const fl_print_t print) { if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - if (print.verbosity == f_console_verbosity_error_e && !F_status_is_error(setting->status)) return F_output_not; - if (lock) { - fll_print_dynamic_raw(setting->line_last, print.to.stream); + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } - else { - f_print_dynamic_raw(setting->line_last, print.to.stream); + + fll_print_dynamic_raw(setting->line_last, print.to.stream); + + return F_none; + } +#endif // _di_iki_write_print_line_last_locked_ + +#ifndef _di_iki_write_print_line_last_unlocked_ + f_status_t iki_write_print_line_last_unlocked(iki_write_setting_t * const setting, const fl_print_t print) { + + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } + f_print_dynamic_raw(setting->line_last, print.to.stream); + return F_none; } -#endif // _di_iki_write_print_line_last_ +#endif // _di_iki_write_print_line_last_unlocked_ #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) { diff --git a/level_3/iki_write/c/print.h b/level_3/iki_write/c/print.h index fd08013..34f86c0 100644 --- a/level_3/iki_write/c/print.h +++ b/level_3/iki_write/c/print.h @@ -34,44 +34,84 @@ extern "C" { * * This is generally either the first line in the program or the first line printed before an error message. * + * This function locks and then unlocks the input stream when printing. + * + * @param setting + * The main program settings. + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_iki_write_print_line_first_locked_ + extern f_status_t iki_write_print_line_first_locked(iki_write_setting_t * const setting, const fl_print_t print); +#endif // _di_iki_write_print_line_first_locked_ + +/** + * Print first new line, unless verbosity says otherwise. + * + * This is generally either the first line in the program or the first line printed before an error message. + * + * This function neither locks nor unlocks the input stream. + * * @param setting * The main program settings. * This does not alter setting.status. * @param print * Designates the how and where to print. - * @param lock - * If TRUE, then lock the stream. - * If FALSE, then do not lock or unlock the stream. * * @return * F_none on success. * F_output_not on success, but no printing is performed. */ -#ifndef _di_iki_write_print_line_first_ - extern f_status_t iki_write_print_line_first(iki_write_setting_t * const setting, const fl_print_t print, const bool lock); -#endif // _di_iki_write_print_line_first_ +#ifndef _di_iki_write_print_line_first_unlocked_ + extern f_status_t iki_write_print_line_first_unlocked(iki_write_setting_t * const setting, const fl_print_t print); +#endif // _di_iki_write_print_line_first_unlocked_ /** * Print last new line when the main is complete, unless verbosity says otherwise. * * This is generally the very last line printed in the program. * + * This function locks and then unlocks the input stream when printing. + * + * @param setting + * The main program settings. + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_iki_write_print_line_last_locked_ + extern f_status_t iki_write_print_line_last_locked(iki_write_setting_t * const setting, const fl_print_t print); +#endif // _di_iki_write_print_line_last_locked_ + +/** + * Print last new line when the main is complete, unless verbosity says otherwise. + * + * This is generally the very last line printed in the program. + * + * This function neither locks nor unlocks the input stream. + * * @param setting * The main program settings. * This does not alter setting.status. * @param print * Designates the how and where to print. - * @param lock - * If TRUE, then lock the stream. - * If FALSE, then do not lock or unlock the stream. * * @return * F_none on success. * F_output_not on success, but no printing is performed. */ -#ifndef _di_iki_write_print_line_last_ - extern f_status_t iki_write_print_line_last(iki_write_setting_t * const setting, const fl_print_t print, const bool lock); -#endif // _di_iki_write_print_line_last_ +#ifndef _di_iki_write_print_line_last_unlocked_ + extern f_status_t iki_write_print_line_last_unlocked(iki_write_setting_t * const setting, const fl_print_t print); +#endif // _di_iki_write_print_line_last_unlocked_ /** * Print error message about "main" Object being missing. diff --git a/level_3/status_code/c/common.c b/level_3/status_code/c/common.c index d450687..a392e1b 100644 --- a/level_3/status_code/c/common.c +++ b/level_3/status_code/c/common.c @@ -57,9 +57,9 @@ extern "C" { setting->status = f_console_parameter_process(arguments, &main->parameters); if (F_status_is_error(setting->status)) { - status_code_print_line_first(setting, main->error, F_true); + status_code_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_process", F_true); - status_code_print_line_last(setting, main->error, F_true); + status_code_print_line_last_locked(setting, main->error); return; } @@ -79,9 +79,9 @@ extern "C" { setting->status = fll_program_parameter_process_context(choices, modes, F_true, main); if (F_status_is_error(setting->status)) { - status_code_print_line_first(setting, main->error, F_true); + status_code_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->status), "fll_program_parameter_process_context", F_true); - status_code_print_line_last(setting, main->error, F_true); + status_code_print_line_last_locked(setting, main->error); return; } @@ -112,9 +112,9 @@ extern "C" { setting->status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); if (F_status_is_error(setting->status)) { - status_code_print_line_first(setting, main->error, F_true); + status_code_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->status), "fll_program_parameter_process_verbosity", F_true); - status_code_print_line_last(setting, main->error, F_true); + status_code_print_line_last_locked(setting, main->error); return; } @@ -154,9 +154,9 @@ extern "C" { if (!(setting->flag & status_code_main_flag_number_e)) { setting->status = F_status_set_error(F_parameter); - status_code_print_line_first(setting, main->error, F_true); + status_code_print_line_first_locked(setting, main->error); status_code_print_error_cannot_error_warning_number(setting, main->error); - status_code_print_line_last(setting, main->error, F_true); + status_code_print_line_last_locked(setting, main->error); return; } @@ -165,9 +165,9 @@ extern "C" { if (setting->flag & status_code_main_flag_fine_e) { setting->status = F_status_set_error(F_parameter); - status_code_print_line_first(setting, main->error, F_true); + status_code_print_line_first_locked(setting, main->error); fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, status_code_long_error_s, status_code_long_fine_s); - status_code_print_line_last(setting, main->error, F_true); + status_code_print_line_last_locked(setting, main->error); return; } @@ -175,9 +175,9 @@ extern "C" { else if (setting->flag & status_code_main_flag_warning_e && setting->flag & status_code_main_flag_fine_e) { setting->status = F_status_set_error(F_parameter); - status_code_print_line_first(setting, main->error, F_true); + status_code_print_line_first_locked(setting, main->error); fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, status_code_long_warning_s, status_code_long_fine_s); - status_code_print_line_last(setting, main->error, F_true); + status_code_print_line_last_locked(setting, main->error); return; } @@ -185,9 +185,9 @@ extern "C" { if (main->parameters.remaining.used == 0 && !(main->pipe & fll_program_data_pipe_input_e)) { setting->status = F_status_set_error(F_parameter); - status_code_print_line_first(setting, main->error, F_true); + status_code_print_line_first_locked(setting, main->error); status_code_print_error_no_status_codes(setting, main->error); - status_code_print_line_last(setting, main->error, F_true); + status_code_print_line_last_locked(setting, main->error); return; } diff --git a/level_3/status_code/c/print.c b/level_3/status_code/c/print.c index 29c5537..d40035a 100644 --- a/level_3/status_code/c/print.c +++ b/level_3/status_code/c/print.c @@ -70,38 +70,65 @@ extern "C" { } #endif // _di_status_code_print_help_ -#ifndef _di_status_code_print_line_first_ - f_status_t status_code_print_line_first(status_code_setting_t * const setting, const fl_print_t print, const bool lock) { +#ifndef _di_status_code_print_line_first_locked_ + f_status_t status_code_print_line_first_locked(status_code_setting_t * const setting, const fl_print_t print) { if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - if (lock) { - fll_print_dynamic_raw(setting->line_first, print.to.stream); + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } - else { - f_print_dynamic_raw(setting->line_first, print.to.stream); + + f_print_dynamic_raw(setting->line_first, print.to.stream); + + return F_none; + } +#endif // _di_status_code_print_line_first_locked_ + +#ifndef _di_status_code_print_line_first_unlocked_ + f_status_t status_code_print_line_first_unlocked(status_code_setting_t * const setting, const fl_print_t print) { + + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } + fll_print_dynamic_raw(setting->line_first, print.to.stream); + return F_none; } -#endif // _di_status_code_print_line_first_ +#endif // _di_status_code_print_line_first_unlocked_ -#ifndef _di_status_code_print_line_last_ - f_status_t status_code_print_line_last(status_code_setting_t * const setting, const fl_print_t print, const bool lock) { +#ifndef _di_status_code_print_line_last_locked_ + f_status_t status_code_print_line_last_locked(status_code_setting_t * const setting, const fl_print_t print) { if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - if (print.verbosity == f_console_verbosity_error_e && !F_status_is_error(setting->status)) return F_output_not; - if (lock) { - fll_print_dynamic_raw(setting->line_last, print.to.stream); + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } - else { - f_print_dynamic_raw(setting->line_last, print.to.stream); + + fll_print_dynamic_raw(setting->line_last, print.to.stream); + + return F_none; + } +#endif // _di_status_code_print_line_last_locked_ + +#ifndef _di_status_code_print_line_last_unlocked_ + f_status_t status_code_print_line_last_unlocked(status_code_setting_t * const setting, const fl_print_t print) { + + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; } + f_print_dynamic_raw(setting->line_last, print.to.stream); + return F_none; } -#endif // _di_status_code_print_line_last_ +#endif // _di_status_code_print_line_last_unlocked_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/status_code/c/print.h b/level_3/status_code/c/print.h index 99513e9..57e548b 100644 --- a/level_3/status_code/c/print.h +++ b/level_3/status_code/c/print.h @@ -68,44 +68,84 @@ extern "C" { * * This is generally either the first line in the program or the first line printed before an error message. * + * This function locks and then unlocks the input stream when printing. + * + * @param setting + * The main program settings. + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_status_code_print_line_first_locked_ + extern f_status_t status_code_print_line_first_locked(status_code_setting_t * const setting, const fl_print_t print); +#endif // _di_status_code_print_line_first_locked_ + +/** + * Print first new line, unless verbosity says otherwise. + * + * This is generally either the first line in the program or the first line printed before an error message. + * + * This function neither locks nor unlocks the input stream. + * * @param setting * The main program settings. * This does not alter setting.status. * @param print * Designates the how and where to print. - * @param lock - * If TRUE, then lock the stream. - * If FALSE, then do not lock or unlock the stream. * * @return * F_none on success. * F_output_not on success, but no printing is performed. */ -#ifndef _di_status_code_print_line_first_ - extern f_status_t status_code_print_line_first(status_code_setting_t * const setting, const fl_print_t print, const bool lock); -#endif // _di_status_code_print_line_first_ +#ifndef _di_status_code_print_line_first_unlocked_ + extern f_status_t status_code_print_line_first_unlocked(status_code_setting_t * const setting, const fl_print_t print); +#endif // _di_status_code_print_line_first_unlocked_ /** * Print last new line when the main is complete, unless verbosity says otherwise. * * This is generally the very last line printed in the program. * + * This function locks and then unlocks the input stream when printing. + * + * @param setting + * The main program settings. + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_status_code_print_line_last_locked_ + extern f_status_t status_code_print_line_last_locked(status_code_setting_t * const setting, const fl_print_t print); +#endif // _di_status_code_print_line_last_locked_ + +/** + * Print last new line when the main is complete, unless verbosity says otherwise. + * + * This is generally the very last line printed in the program. + * + * This function neither locks nor unlocks the input stream. + * * @param setting * The main program settings. * This does not alter setting.status. * @param print * Designates the how and where to print. - * @param lock - * If TRUE, then lock the stream. - * If FALSE, then do not lock or unlock the stream. * * @return * F_none on success. * F_output_not on success, but no printing is performed. */ -#ifndef _di_status_code_print_line_last_ - extern f_status_t status_code_print_line_last(status_code_setting_t * const setting, const fl_print_t print, const bool lock); -#endif // _di_status_code_print_line_last_ +#ifndef _di_status_code_print_line_last_unlocked_ + extern f_status_t status_code_print_line_last_unlocked(status_code_setting_t * const setting, const fl_print_t print); +#endif // _di_status_code_print_line_last_unlocked_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/status_code/c/status_code.c b/level_3/status_code/c/status_code.c index 8e3a00d..e88093f 100644 --- a/level_3/status_code/c/status_code.c +++ b/level_3/status_code/c/status_code.c @@ -125,10 +125,10 @@ extern "C" { } if (F_status_is_error(setting->status)) { - status_code_print_line_last(setting, main->error, F_true); + status_code_print_line_last_locked(setting, main->error); } else if (setting->status != F_interrupt) { - status_code_print_line_last(setting, main->message, F_true); + status_code_print_line_last_locked(setting, main->message); } } #endif // _di_status_code_main_ diff --git a/level_3/utf8/c/common.c b/level_3/utf8/c/common.c index 0ae9def..80672ef 100644 --- a/level_3/utf8/c/common.c +++ b/level_3/utf8/c/common.c @@ -96,9 +96,9 @@ extern "C" { setting->status = f_console_parameter_process(arguments, &main->parameters); if (F_status_is_error(setting->status)) { - utf8_print_line_first(setting, main->error, F_true); + utf8_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_process", F_true); - utf8_print_line_last(setting, main->error, F_true); + utf8_print_line_last_locked(setting, main->error); return; } @@ -118,9 +118,9 @@ extern "C" { setting->status = fll_program_parameter_process_context(choices, modes, F_true, main); if (F_status_is_error(setting->status)) { - utf8_print_line_first(setting, main->error, F_true); + utf8_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->status), "fll_program_parameter_process_context", F_true); - utf8_print_line_last(setting, main->error, F_true); + utf8_print_line_last_locked(setting, main->error); return; } @@ -151,9 +151,9 @@ extern "C" { setting->status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); if (F_status_is_error(setting->status)) { - utf8_print_line_first(setting, main->error, F_true); + utf8_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->status), "fll_program_parameter_process_verbosity", F_true); - utf8_print_line_last(setting, main->error, F_true); + utf8_print_line_last_locked(setting, main->error); return; } @@ -180,9 +180,9 @@ extern "C" { setting->status = f_console_parameter_prioritize_right(main->parameters, choices, &choice); if (F_status_is_error(setting->status)) { - utf8_print_line_first(setting, main->error, F_true); + utf8_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_prioritize_right", F_true); - utf8_print_line_last(setting, main->error, F_true); + utf8_print_line_last_locked(setting, main->error); return; } @@ -213,9 +213,9 @@ extern "C" { setting->status = f_console_parameter_prioritize_right(main->parameters, choices, &choice); if (F_status_is_error(setting->status)) { - utf8_print_line_first(setting, main->error, F_true); + utf8_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_prioritize_right", F_true); - utf8_print_line_last(setting, main->error, F_true); + utf8_print_line_last_locked(setting, main->error); return; } @@ -292,7 +292,7 @@ extern "C" { setting->status = F_status_set_error(F_parameter); utf8_print_error_parameter_file_to_too_many(main, setting); - utf8_print_line_last(setting, main->error, F_true); + utf8_print_line_last_locked(setting, main->error); return; } @@ -303,9 +303,9 @@ extern "C" { setting->status = f_string_dynamics_increase_by(1, &setting->path_files_to); if (F_status_is_error(setting->status)) { - utf8_print_line_first(setting, main->error, F_true); + utf8_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->status), "f_string_dynamics_increase_by", F_true); - utf8_print_line_last(setting, main->error, F_true); + utf8_print_line_last_locked(setting, main->error); return; } @@ -315,9 +315,9 @@ extern "C" { setting->status = f_string_dynamic_append_nulless(main->parameters.arguments.array[main->parameters.array[utf8_parameter_to_file_e].values.array[0]], &setting->path_files_to.array[0]); if (F_status_is_error(setting->status)) { - utf8_print_line_first(setting, main->error, F_true); + utf8_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->status), "f_string_dynamic_append_nulless", F_true); - utf8_print_line_last(setting, main->error, F_true); + utf8_print_line_last_locked(setting, main->error); return; } @@ -327,9 +327,9 @@ extern "C" { setting->status = f_file_stream_open(args[main->parameters.array[utf8_parameter_to_file_e].values.array[0]], f_file_open_mode_append_s, &main->output.to); if (F_status_is_error(setting->status)) { - utf8_print_line_first(setting, main->error, F_true); + utf8_print_line_first_locked(setting, main->error); fll_error_file_print(main->error, F_status_set_fine(setting->status), "f_file_stream_open", F_true, args[main->parameters.array[utf8_parameter_to_file_e].values.array[0]], f_file_operation_open_s, fll_error_file_type_file_e); - utf8_print_line_last(setting, main->error, F_true); + utf8_print_line_last_locked(setting, main->error); return; } @@ -337,9 +337,9 @@ extern "C" { setting->flag |= utf8_main_flag_file_to_e; } else { - utf8_print_line_first(setting, main->error, F_true); + utf8_print_line_first_locked(setting, main->error); utf8_print_error_parameter_file_name_empty(main, setting, main->parameters.array[utf8_parameter_to_file_e].values.array[0]); - utf8_print_line_last(setting, main->error, F_true); + utf8_print_line_last_locked(setting, main->error); setting->status = F_status_set_error(F_parameter); @@ -349,9 +349,9 @@ extern "C" { else if (main->parameters.array[utf8_parameter_to_file_e].result == f_console_result_found_e) { setting->status = F_status_set_error(F_parameter); - utf8_print_line_first(setting, main->error, F_true); + utf8_print_line_first_locked(setting, main->error); fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_enable_s, utf8_long_to_file_s); - utf8_print_line_last(setting, main->error, F_true); + utf8_print_line_last_locked(setting, main->error); return; } @@ -369,9 +369,9 @@ extern "C" { setting->status = f_string_dynamics_increase_by(main->parameters.array[utf8_parameter_from_file_e].values.used, &setting->path_files_from); if (F_status_is_error(setting->status)) { - utf8_print_line_first(setting, main->error, F_true); + utf8_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->status), "f_string_dynamics_increase_by", F_true); - utf8_print_line_last(setting, main->error, F_true); + utf8_print_line_last_locked(setting, main->error); return; } @@ -389,7 +389,7 @@ extern "C" { setting->status = f_string_dynamic_append_nulless(main->parameters.arguments.array[index], &setting->path_files_from.array[i]); if (F_status_is_error(setting->status)) { - utf8_print_line_first(setting, main->error, F_true); + utf8_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->status), "f_string_dynamic_append_nulless", F_true); break; @@ -414,7 +414,7 @@ extern "C" { } // for if (F_status_is_error(setting->status)) { - utf8_print_line_last(setting, main->error, F_true); + utf8_print_line_last_locked(setting, main->error); return; } @@ -424,9 +424,9 @@ extern "C" { else if (main->parameters.array[utf8_parameter_from_file_e].result == f_console_result_found_e) { setting->status = F_status_set_error(F_parameter); - utf8_print_line_first(setting, main->error, F_true); + utf8_print_line_first_locked(setting, main->error); fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_enable_s, utf8_long_from_file_s); - utf8_print_line_last(setting, main->error, F_true); + utf8_print_line_last_locked(setting, main->error); return; } @@ -442,9 +442,9 @@ extern "C" { setting->status = f_string_dynamics_resize(main->parameters.remaining.used, &setting->remaining); if (F_status_is_error(setting->status)) { - utf8_print_line_first(setting, main->error, F_true); + utf8_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->status), "f_string_dynamic_append_nulless", F_true); - utf8_print_line_last(setting, main->error, F_true); + utf8_print_line_last_locked(setting, main->error); return; } @@ -464,7 +464,7 @@ extern "C" { setting->status = F_status_set_error(F_parameter); utf8_print_error_no_from(main, setting); - utf8_print_line_last(setting, main->error, F_true); + utf8_print_line_last_locked(setting, main->error); return; } diff --git a/level_3/utf8/c/print.c b/level_3/utf8/c/print.c index b1f85fa..f29d01e 100644 --- a/level_3/utf8/c/print.c +++ b/level_3/utf8/c/print.c @@ -111,7 +111,7 @@ extern "C" { if (main->error.verbosity == f_console_verbosity_quiet_e) return F_output_not; if (setting->flag & (utf8_main_flag_strip_invalid_e | utf8_main_flag_verify_e)) return F_output_not; - utf8_print_line_first(setting, main->error, F_false); + utf8_print_line_first_unlocked(setting, main->error); fl_print_format("%[%QFailed to decode character code '%]", main->error.to.stream, main->context.set.error, main->error.prefix, main->context.set.error); @@ -149,7 +149,7 @@ extern "C" { if (main->error.verbosity == f_console_verbosity_quiet_e) return F_output_not; - utf8_print_line_first(setting, main->error, F_false); + utf8_print_line_first_unlocked(setting, main->error); fl_print_format("%[%QFailed to encode Unicode codepoint '%]", main->error.to.stream, main->context.set.error, main->error.prefix, main->context.set.error); fl_print_format("%[U+%_U%]", main->error.to.stream, main->context.set.notable, codepoint, main->context.set.notable); @@ -172,7 +172,7 @@ extern "C" { if (main->error.verbosity == f_console_verbosity_quiet_e) return F_output_not; - utf8_print_line_first(setting, main->error, F_true); + utf8_print_line_first_locked(setting, main->error); fll_print_format("%[%QNo from sources are specified, please pipe data, designate a file, or add parameters.%]%r", main->error.to.stream, main->error.context, main->error.prefix, main->error.context, f_string_eol_s); @@ -187,7 +187,7 @@ extern "C" { f_file_stream_lock(main->error.to); - utf8_print_line_first(setting, main->error, F_false); + utf8_print_line_first_unlocked(setting, main->error); fl_print_format("%[%QNo file specified at parameter index %]", main->error.to.stream, main->context.set.error, main->error.prefix, main->context.set.error); fl_print_format("%[%ul%]", main->error.to.stream, main->context.set.notable, index, main->context.set.notable); @@ -206,7 +206,7 @@ extern "C" { f_file_stream_lock(main->error.to); - utf8_print_line_first(setting, main->error, F_false); + utf8_print_line_first_unlocked(setting, main->error); fl_print_format("%[%QFailed to find the %r file '%]", main->error.to.stream, main->context.set.error, main->error.prefix, from ? utf8_string_from_s : utf8_string_to_s, main->context.set.error); fl_print_format("%[%Q%]", main->error.to.stream, main->context.set.notable, name, main->context.set.notable); @@ -223,7 +223,7 @@ extern "C" { if (main->error.verbosity == f_console_verbosity_quiet_e) return F_output_not; - utf8_print_line_first(setting, main->error, F_true); + utf8_print_line_first_locked(setting, main->error); fll_print_format("%[%QToo many '%r' files specified, there may only be one '%r' file.%]%r", main->error.to.stream, main->context.set.error, main->error.prefix, utf8_string_to_s, utf8_string_to_s, main->context.set.error, f_string_eol_s); @@ -309,24 +309,24 @@ extern "C" { } #endif // _di_utf8_print_help_ -#ifndef _di_utf8_print_line_first_ - f_status_t utf8_print_line_first(utf8_setting_t * const setting, const fl_print_t print, const bool lock) { +#ifndef _di_utf8_print_line_first_locked_ + f_status_t utf8_print_line_first_locked(utf8_setting_t * const setting, const fl_print_t print) { if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - if (lock) { - fll_print_dynamic_raw(setting->line_first, print.to.stream); - } - else { - f_print_dynamic_raw(setting->line_first, print.to.stream); + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; + if (setting->flag & (utf8_main_flag_verify_e | utf8_main_flag_file_to_e)) return F_output_not; } + f_print_dynamic_raw(setting->line_first, print.to.stream); + return F_none; } -#endif // _di_utf8_print_line_first_ +#endif // _di_utf8_print_line_first_locked_ -#ifndef _di_utf8_print_line_last_ - f_status_t utf8_print_line_last(utf8_setting_t * const setting, const fl_print_t print, const bool lock) { +#ifndef _di_utf8_print_line_first_unlocked_ + f_status_t utf8_print_line_first_unlocked(utf8_setting_t * const setting, const fl_print_t print) { if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; @@ -335,16 +335,43 @@ extern "C" { if (setting->flag & (utf8_main_flag_verify_e | utf8_main_flag_file_to_e)) return F_output_not; } - if (lock) { - fll_print_dynamic_raw(setting->line_last, print.to.stream); + fll_print_dynamic_raw(setting->line_first, print.to.stream); + + return F_none; + } +#endif // _di_utf8_print_line_first_unlocked_ + +#ifndef _di_utf8_print_line_last_locked_ + f_status_t utf8_print_line_last_locked(utf8_setting_t * const setting, const fl_print_t print) { + + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; + if (setting->flag & (utf8_main_flag_verify_e | utf8_main_flag_file_to_e)) return F_output_not; } - else { - f_print_dynamic_raw(setting->line_last, print.to.stream); + + fll_print_dynamic_raw(setting->line_last, print.to.stream); + + return F_none; + } +#endif // _di_utf8_print_line_last_locked_ + +#ifndef _di_utf8_print_line_last_unlocked_ + f_status_t utf8_print_line_last_unlocked(utf8_setting_t * const setting, const fl_print_t print) { + + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + + if (!F_status_is_error(setting->status)) { + if (print.verbosity == f_console_verbosity_error_e) return F_output_not; + if (setting->flag & (utf8_main_flag_verify_e | utf8_main_flag_file_to_e)) return F_output_not; } + f_print_dynamic_raw(setting->line_last, print.to.stream); + return F_none; } -#endif // _di_utf8_print_line_last_ +#endif // _di_utf8_print_line_last_unlocked_ #ifndef _di_utf8_print_raw_bytesequence_ f_status_t utf8_print_raw_bytesequence(fll_program_data_t * const main, utf8_setting_t * const setting, const f_utf_char_t raw, const uint8_t width) { diff --git a/level_3/utf8/c/print.h b/level_3/utf8/c/print.h index 785e0a3..92f56cb 100644 --- a/level_3/utf8/c/print.h +++ b/level_3/utf8/c/print.h @@ -277,44 +277,84 @@ extern "C" { * * This is generally either the first line in the program or the first line printed before an error message. * + * This function locks and then unlocks the input stream when printing. + * + * @param setting + * The main program settings. + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_utf8_print_line_first_locked_ + extern f_status_t utf8_print_line_first_locked(utf8_setting_t * const setting, const fl_print_t print); +#endif // _di_utf8_print_line_first_locked_ + +/** + * Print first new line, unless verbosity says otherwise. + * + * This is generally either the first line in the program or the first line printed before an error message. + * + * This function neither locks nor unlocks the input stream. + * * @param setting * The main program settings. * This does not alter setting.status. * @param print * Designates the how and where to print. - * @param lock - * If TRUE, then lock the stream. - * If FALSE, then do not lock or unlock the stream. * * @return * F_none on success. * F_output_not on success, but no printing is performed. */ -#ifndef _di_utf8_print_line_first_ - extern f_status_t utf8_print_line_first(utf8_setting_t * const setting, const fl_print_t print, const bool lock); -#endif // _di_utf8_print_line_first_ +#ifndef _di_utf8_print_line_first_unlocked_ + extern f_status_t utf8_print_line_first_unlocked(utf8_setting_t * const setting, const fl_print_t print); +#endif // _di_utf8_print_line_first_unlocked_ /** * Print last new line when the main is complete, unless verbosity says otherwise. * * This is generally the very last line printed in the program. * + * This function locks and then unlocks the input stream when printing. + * + * @param setting + * The main program settings. + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_utf8_print_line_last_locked_ + extern f_status_t utf8_print_line_last_locked(utf8_setting_t * const setting, const fl_print_t print); +#endif // _di_utf8_print_line_last_locked_ + +/** + * Print last new line when the main is complete, unless verbosity says otherwise. + * + * This is generally the very last line printed in the program. + * + * This function neither locks nor unlocks the input stream. + * * @param setting * The main program settings. * This does not alter setting.status. * @param print * Designates the how and where to print. - * @param lock - * If TRUE, then lock the stream. - * If FALSE, then do not lock or unlock the stream. * * @return * F_none on success. * F_output_not on success, but no printing is performed. */ -#ifndef _di_utf8_print_line_last_ - extern f_status_t utf8_print_line_last(utf8_setting_t * const setting, const fl_print_t print, const bool lock); -#endif // _di_utf8_print_line_last_ +#ifndef _di_utf8_print_line_last_unlocked_ + extern f_status_t utf8_print_line_last_unlocked(utf8_setting_t * const setting, const fl_print_t print); +#endif // _di_utf8_print_line_last_unlocked_ /** * Print the raw character data (binary / byte sequence). diff --git a/level_3/utf8/c/private-utf8.c b/level_3/utf8/c/private-utf8.c index f62a891..39bdfab 100644 --- a/level_3/utf8/c/private-utf8.c +++ b/level_3/utf8/c/private-utf8.c @@ -44,7 +44,7 @@ extern "C" { status = utf8_detect_codepoint(main, setting, text, &mode_codepoint); if (F_status_is_error(status)) { - utf8_print_line_first(setting, main->error, F_true); + utf8_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(status), "utf8_detect_codepoint", F_true); break; diff --git a/level_3/utf8/c/utf8.c b/level_3/utf8/c/utf8.c index 2d278a5..7a873b5 100644 --- a/level_3/utf8/c/utf8.c +++ b/level_3/utf8/c/utf8.c @@ -168,10 +168,10 @@ extern "C" { } if (F_status_is_error(setting->status)) { - utf8_print_line_last(setting, main->error, F_true); + utf8_print_line_last_locked(setting, main->error); } else if (setting->status != F_interrupt) { - utf8_print_line_last(setting, main->message, F_true); + utf8_print_line_last_locked(setting, main->message); } if (F_status_is_error(setting->status) || setting->status == F_interrupt) return;