From ab20356f7bc757d1f2e2f8472748d4eb12024da6 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Wed, 18 Jan 2023 23:33:00 -0600 Subject: [PATCH] Progress: Continue program related work. --- level_0/f_console/c/console/common.h | 2 +- level_2/fll_program/c/program/print.c | 85 ++++--- level_2/fll_program/c/program/print.h | 119 ++++++---- level_3/fake/c/main/common-print.c | 6 + level_3/fake/c/main/common-print.h | 6 + level_3/fake/c/main/common.c | 315 +++++++++++++++++++++++++- level_3/fake/c/main/common.h | 237 ++++++++++++++++--- level_3/fake/c/main/fake.c | 20 +- level_3/fake/c/main/main.c | 3 + level_3/fake/c/main/print.c | 25 ++ level_3/fake/c/main/print.h | 28 ++- level_3/fake/c/main/private-build-load.c | 16 +- level_3/fake/c/main/private-common.h | 159 ------------- level_3/fake/c/main/private-fake.c | 1 + level_3/fss_write/c/basic/fss_write.c | 2 - level_3/fss_write/c/basic_list/fss_write.c | 2 - level_3/fss_write/c/embedded_list/fss_write.c | 2 - level_3/fss_write/c/extended/fss_write.c | 2 - level_3/fss_write/c/extended_list/fss_write.c | 2 - level_3/fss_write/c/main/common.c | 20 -- level_3/fss_write/c/main/fss_write.c | 26 ++- level_3/fss_write/c/main/main.c | 4 - level_3/fss_write/c/main/print.c | 6 - level_3/fss_write/c/payload/fss_write.c | 2 - level_3/fss_write/c/payload/print.c | 1 - level_3/iki_read/c/main/common.c | 15 -- level_3/iki_read/c/main/iki_read.c | 29 ++- level_3/iki_read/c/main/print.c | 2 - level_3/iki_write/c/main/common.c | 6 - level_3/iki_write/c/main/iki_write.c | 20 +- level_3/iki_write/c/main/print.c | 4 - level_3/iki_write/c/main/private-write.c | 1 - level_3/status_code/c/main/common.c | 4 - level_3/status_code/c/main/common.h | 8 +- level_3/status_code/c/main/print.c | 1 - level_3/status_code/c/main/status_code.c | 8 +- level_3/utf8/c/main/common.c | 76 ++----- level_3/utf8/c/main/print.c | 2 - level_3/utf8/c/main/utf8.c | 19 +- 39 files changed, 809 insertions(+), 477 deletions(-) diff --git a/level_0/f_console/c/console/common.h b/level_0/f_console/c/console/common.h index fa31c0a..e41c816 100644 --- a/level_0/f_console/c/console/common.h +++ b/level_0/f_console/c/console/common.h @@ -440,7 +440,7 @@ extern "C" { f_string_t symbol_long; f_string_t symbol_simple; - uint16_t values_total; + f_array_length_t values_total; f_console_flag_t flag; f_console_result_t result; diff --git a/level_2/fll_program/c/program/print.c b/level_2/fll_program/c/program/print.c index 03c1a79..f691f4f 100644 --- a/level_2/fll_program/c/program/print.c +++ b/level_2/fll_program/c/program/print.c @@ -40,16 +40,16 @@ extern "C" { #endif // _di_fll_program_print_error_missing_variable_not_zero_ #ifndef _di_fll_program_print_error_parameter_both_specified_same_amount_ - f_status_t fll_program_print_error_parameter_both_specified_same_amount(const fl_print_t print, const f_string_static_t symbol_first, const f_string_static_t symbol_second, const f_string_static_t first, const f_string_static_t second) { + f_status_t fll_program_print_error_parameter_both_specified_same_amount(const fl_print_t print, const f_string_static_t symbol_1, const f_string_static_t symbol_2, const f_string_static_t name_1, const f_string_static_t name_2) { if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; f_file_stream_lock(print.to); fl_print_format("%[%QThe '%]", print.to, print.set->error, print.prefix, print.set->error); - fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol_first, first, print.set->notable); + fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol_1, name_1, print.set->notable); fl_print_format("%[' parameter and the '%]", print.to, print.set->error, print.set->error); - fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol_second, second, print.set->notable); + fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol_2, name_2, print.set->notable); fl_print_format("%[' parameter must be specified the same number of times.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s); f_file_stream_unlock(print.to); @@ -59,18 +59,18 @@ extern "C" { #endif // _di_fll_program_print_error_parameter_both_specified_same_amount_ #ifndef _di_fll_program_print_error_parameter_both_specified_same_amount_without_ - f_status_t fll_program_print_error_parameter_both_specified_same_amount_without(const fl_print_t print, const f_string_static_t symbol_first, const f_string_static_t symbol_second, const f_string_static_t symbol_third, const f_string_static_t first, const f_string_static_t second, const f_string_static_t third) { + f_status_t fll_program_print_error_parameter_both_specified_same_amount_without(const fl_print_t print, const f_string_static_t symbol_1, const f_string_static_t symbol_2, const f_string_static_t symbol_3, const f_string_static_t name_1, const f_string_static_t name_2, const f_string_static_t name_3) { if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; f_file_stream_lock(print.to); fl_print_format("%[%QThe '%]", print.to, print.set->error, print.prefix, print.set->error); - fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol_first, first, print.set->notable); + fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol_1, name_1, print.set->notable); fl_print_format("%[' parameter and the '%]", print.to, print.set->error, print.set->error); - fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol_second, second, print.set->notable); + fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol_2, name_2, print.set->notable); fl_print_format("%[' parameter must be specified the same number of times when not specifying the '%]", print.to, print.set->error, print.set->error); - fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol_third, third, print.set->notable); + fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol_3, name_3, print.set->notable); fl_print_format("%[' parameter.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s); f_file_stream_unlock(print.to); @@ -80,16 +80,16 @@ extern "C" { #endif // _di_fll_program_print_error_parameter_both_specified_same_amount_without_ #ifndef _di_fll_program_print_error_parameter_cannot_use_with_ - f_status_t fll_program_print_error_parameter_cannot_use_with(const fl_print_t print, const f_string_static_t symbol_first, const f_string_static_t symbol_second, const f_string_static_t first, const f_string_static_t second) { + f_status_t fll_program_print_error_parameter_cannot_use_with(const fl_print_t print, const f_string_static_t symbol_1, const f_string_static_t symbol_2, const f_string_static_t name_1, const f_string_static_t name_2) { if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; f_file_stream_lock(print.to); fl_print_format("%[%QCannot specify the '%]", print.to, print.set->error, print.prefix, print.set->error); - fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol_first, first, print.set->notable); + fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol_1, name_1, print.set->notable); fl_print_format("%[' parameter with the '%]", print.to, print.set->error, print.set->error); - fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol_second, second, print.set->notable); + fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol_2, name_2, print.set->notable); fl_print_format("%[' parameter.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s); f_file_stream_unlock(print.to); @@ -99,18 +99,18 @@ extern "C" { #endif // _di_fll_program_print_error_parameter_cannot_use_with_ #ifndef _di_fll_program_print_error_parameter_cannot_use_with_without_ - f_status_t fll_program_print_error_parameter_cannot_use_with_without(const fl_print_t print, const f_string_static_t symbol_first, const f_string_static_t symbol_second, const f_string_static_t symbol_third, const f_string_static_t first, const f_string_static_t second, const f_string_static_t third) { + f_status_t fll_program_print_error_parameter_cannot_use_with_without(const fl_print_t print, const f_string_static_t symbol_1, const f_string_static_t symbol_2, const f_string_static_t symbol_3, const f_string_static_t name_1, const f_string_static_t name_2, const f_string_static_t name_3) { if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; f_file_stream_lock(print.to); fl_print_format("%[%QCannot specify the '%]", print.to, print.set->error, print.prefix, print.set->error); - fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol_first, first, print.set->notable); + fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol_1, name_1, print.set->notable); fl_print_format("%[' parameter with the '%]", print.to, print.set->error, print.set->error); - fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol_second, second, print.set->notable); + fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol_2, name_2, print.set->notable); fl_print_format("%[' parameter without the '%]", print.to, print.set->error, print.set->error); - fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol_third, third, print.set->notable); + fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol_3, name_3, print.set->notable); fl_print_format("%[' parameter.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s); f_file_stream_unlock(print.to); @@ -137,18 +137,18 @@ extern "C" { #endif // _di_fll_program_print_error_parameter_cannot_use_with_pipe_ #ifndef _di_fll_program_print_error_parameter_cannot_use_with_xor_ - f_status_t fll_program_print_error_parameter_cannot_use_with_xor(const fl_print_t print, const f_string_static_t symbol_first, const f_string_static_t symbol_second, const f_string_static_t symbol_third, const f_string_static_t first, const f_string_static_t second, const f_string_static_t third) { + f_status_t fll_program_print_error_parameter_cannot_use_with_xor(const fl_print_t print, const f_string_static_t symbol_1, const f_string_static_t symbol_2, const f_string_static_t symbol_3, const f_string_static_t name_1, const f_string_static_t name_2, const f_string_static_t name_3) { if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; f_file_stream_lock(print.to); fl_print_format("%[%QThe '%]", print.to, print.set->error, print.prefix, print.set->error); - fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol_first, first, print.set->notable); + fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol_1, name_1, print.set->notable); fl_print_format("%[' parameter only allows either the '%]", print.to, print.set->error, print.set->error); - fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol_second, second, print.set->notable); + fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol_2, name_2, print.set->notable); fl_print_format("%[' parameter or the '%]", print.to, print.set->error, print.set->error); - fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol_third, third, print.set->notable); + fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol_3, name_3, print.set->notable); fl_print_format("%[' parameter, but not both.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s); f_file_stream_unlock(print.to); @@ -158,7 +158,7 @@ extern "C" { #endif // _di_fll_program_print_error_parameter_cannot_use_with_xor_ #ifndef _di_fll_program_print_error_parameter_integer_not_ - f_status_t fll_program_print_error_parameter_integer_not(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t parameter, const f_string_static_t value) { + f_status_t fll_program_print_error_parameter_integer_not(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name, const f_string_static_t value) { if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; @@ -167,7 +167,7 @@ extern "C" { fl_print_format("%[%QThe value '%]", print.to, print.set->error, print.prefix, print.set->error); fl_print_format("%[%Q%]", print.to, print.set->notable, value, print.set->notable); fl_print_format("%[' for the parameter '%]", print.to, print.set->error, print.set->error); - fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol, parameter, print.set->notable); + fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol, name, print.set->notable); fl_print_format("%[' is not a valid integer.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s); f_file_stream_unlock(print.to); @@ -177,7 +177,7 @@ extern "C" { #endif // _di_fll_program_print_error_parameter_integer_not_ #ifndef _di_fll_program_print_error_parameter_integer_not_negative_ - f_status_t fll_program_print_error_parameter_integer_not_negative(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t parameter, const f_string_static_t value) { + f_status_t fll_program_print_error_parameter_integer_not_negative(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name, const f_string_static_t value) { if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; @@ -186,7 +186,7 @@ extern "C" { fl_print_format("%[%QThe value '%]", print.to, print.set->error, print.prefix, print.set->error); fl_print_format("%[%Q%]", print.to, print.set->notable, value, print.set->notable); fl_print_format("%[' for the parameter '%]", print.to, print.set->error, print.set->error); - fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol, parameter, print.set->notable); + fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol, name, print.set->notable); fl_print_format("%[' is not a valid negative integer.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s); f_file_stream_unlock(print.to); @@ -196,7 +196,7 @@ extern "C" { #endif // _di_fll_program_print_error_parameter_integer_not_negative_ #ifndef _di_fll_program_print_error_parameter_integer_not_positive_ - f_status_t fll_program_print_error_parameter_integer_not_positive(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t parameter, const f_string_static_t value) { + f_status_t fll_program_print_error_parameter_integer_not_positive(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name, const f_string_static_t value) { if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; @@ -205,7 +205,7 @@ extern "C" { fl_print_format("%[%QThe value '%]", print.to, print.set->error, print.prefix, print.set->error); fl_print_format("%[%Q%]", print.to, print.set->notable, value, print.set->notable); fl_print_format("%[' for the parameter '%]", print.to, print.set->error, print.set->error); - fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol, parameter, print.set->notable); + fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol, name, print.set->notable); fl_print_format("%[' is not a valid positive integer.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s); f_file_stream_unlock(print.to); @@ -215,14 +215,14 @@ extern "C" { #endif // _di_fll_program_print_error_parameter_integer_not_positive_ #ifndef _di_fll_program_print_error_parameter_missing_value_ - f_status_t fll_program_print_error_parameter_missing_value(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t parameter) { + f_status_t fll_program_print_error_parameter_missing_value(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name) { if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; f_file_stream_lock(print.to); fl_print_format("%[%QThe parameter%] ", print.to, print.set->error, print.prefix, print.set->error); - fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol, parameter, print.set->notable); + fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol, name, print.set->notable); fl_print_format(" %[is specified, but no value is given.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s); f_file_stream_unlock(print.to); @@ -232,14 +232,14 @@ extern "C" { #endif // _di_fll_program_print_error_parameter_missing_value_ #ifndef _di_fll_program_print_error_parameter_missing_value_requires_amount_ - f_status_t fll_program_print_error_parameter_missing_value_requires_amount(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t parameter, const f_string_static_t amount) { + f_status_t fll_program_print_error_parameter_missing_value_requires_amount(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name, const f_string_static_t amount) { if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; f_file_stream_lock(print.to); fl_print_format("%[%QThe parameter%] ", print.to, print.set->error, print.prefix, print.set->error); - fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol, parameter, print.set->notable); + fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol, name, print.set->notable); fl_print_format("%[ is specified, but%] ", print.to, print.set->error, print.set->error); fl_print_format("%[%Q%]", print.to, print.set->notable, amount, print.set->notable); fl_print_format(" %[values are not given.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s); @@ -251,14 +251,14 @@ extern "C" { #endif // _di_fll_program_print_error_parameter_missing_value_requires_amount_ #ifndef _di_fll_program_print_error_parameter_must_specify_once_ - f_status_t fll_program_print_error_parameter_must_specify_once(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t parameter) { + f_status_t fll_program_print_error_parameter_must_specify_once(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name) { if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; f_file_stream_lock(print.to); fl_print_format("%[%QThe parameter '%]", print.to, print.set->error, print.prefix, print.set->error); - fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol, parameter, print.set->notable); + fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol, name, print.set->notable); fl_print_format("%[' may only be specified once.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s); f_file_stream_unlock(print.to); @@ -268,7 +268,7 @@ extern "C" { #endif // _di_fll_program_print_error_parameter_must_specify_once_ #ifndef _di_fll_program_print_error_parameter_must_specify_once_value_ - f_status_t fll_program_print_error_parameter_must_specify_once_value(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t parameter, const f_string_static_t value) { + f_status_t fll_program_print_error_parameter_must_specify_once_value(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name, const f_string_static_t value) { if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; @@ -277,7 +277,7 @@ extern "C" { fl_print_format("%[%QThe value '%]", print.to, print.set->error, print.prefix, print.set->error); fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol, value, print.set->notable); fl_print_format("%[' may only be specified once for the parameter '%]", print.to, print.set->error, print.set->error); - fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol, parameter, print.set->notable); + fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol, name, print.set->notable); fl_print_format("%['.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s); f_file_stream_unlock(print.to); @@ -287,7 +287,7 @@ extern "C" { #endif // _di_fll_program_print_error_parameter_must_specify_once_value_ #ifndef _di_fll_program_print_error_parameter_range_start_before_stop_ - f_status_t fll_program_print_error_parameter_range_start_before_stop(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t parameter, const f_string_static_t value_start, const f_string_static_t value_stop) { + f_status_t fll_program_print_error_parameter_range_start_before_stop(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name, const f_string_static_t value_start, const f_string_static_t value_stop) { if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; @@ -298,7 +298,7 @@ extern "C" { fl_print_format("%[' may not be greater than the stop value '%]", print.to, print.set->error, print.set->error); fl_print_format("%[%Q%]", print.to, print.set->notable, value_stop, print.set->notable); fl_print_format("%[' for the parameter '%]", print.to, print.set->error, print.set->error); - fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol, parameter, print.set->notable); + fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol, name, print.set->notable); fl_print_format("%['.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s); f_file_stream_unlock(print.to); @@ -307,6 +307,23 @@ extern "C" { } #endif // _di_fll_program_print_error_parameter_range_start_before_stop_ +#ifndef _di_fll_program_print_error_parameter_value_too_long_ + f_status_t fll_program_print_error_parameter_value_too_long(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name) { + + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + + f_file_stream_lock(print.to); + + fl_print_format("%[%QThe value for the parameter '%]", print.to, print.set->error, print.prefix, print.set->error); + fl_print_format("%[%Q%Q%]", print.to, print.notable, symbol, name, print.notable); + fl_print_format("%[' is too long.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s); + + f_file_stream_unlock(print.to); + + return F_none; + } +#endif // _di_fll_program_print_error_parameter_value_too_long_ + #ifndef _di_fll_program_print_error_pipe_invalid_form_feed_ f_status_t fll_program_print_error_pipe_invalid_form_feed(const fl_print_t print) { diff --git a/level_2/fll_program/c/program/print.h b/level_2/fll_program/c/program/print.h index 5f4a1e9..8fbaf0e 100644 --- a/level_2/fll_program/c/program/print.h +++ b/level_2/fll_program/c/program/print.h @@ -75,15 +75,15 @@ extern "C" { * @param print * The output structure. * This locks, uses, and unlocks the file stream. - * @param symbol_first + * @param symbol_1 * The symbol string prepended to the first parameter. * This is usually f_console_symbol_long_normal_s. - * @param symbol_second + * @param symbol_2 * The symbol string prepended to the second parameter. * This is usually f_console_symbol_long_normal_s. - * @param first + * @param name_1 * The first parameter name. - * @param second + * @param name_2 * The second parameter name. * * @return @@ -91,7 +91,7 @@ extern "C" { * F_output_not on success, but no printing is performed. */ #ifndef _di_fll_program_print_error_parameter_both_specified_same_amount_ - extern f_status_t fll_program_print_error_parameter_both_specified_same_amount(const fl_print_t print, const f_string_static_t symbol_first, const f_string_static_t symbol_second, const f_string_static_t first, const f_string_static_t second); + extern f_status_t fll_program_print_error_parameter_both_specified_same_amount(const fl_print_t print, const f_string_static_t symbol_1, const f_string_static_t symbol_2, const f_string_static_t name_1, const f_string_static_t name_2); #endif // _di_fll_program_print_error_parameter_both_specified_same_amount_ /** @@ -107,20 +107,20 @@ extern "C" { * @param print * The output structure. * This locks, uses, and unlocks the file stream. - * @param symbol_first + * @param symbol_1 * The symbol string prepended to the first parameter. * This is usually f_console_symbol_long_normal_s. - * @param symbol_second + * @param symbol_2 * The symbol string prepended to the second parameter. * This is usually f_console_symbol_long_normal_s. - * @param symbol_third + * @param symbol_3 * The symbol string prepended to the third parameter. * This is usually f_console_symbol_long_normal_s. - * @param first + * @param name_1 * The first parameter name. - * @param second + * @param name_2 * The second parameter name. - * @param third + * @param name_3 * The third parameter name, representing the "without" parameter. * The first and second parameter must be specified the same amount of times without this parameter. * @@ -129,7 +129,7 @@ extern "C" { * F_output_not on success, but no printing is performed. */ #ifndef _di_fll_program_print_error_parameter_both_specified_same_amount_without_ - extern f_status_t fll_program_print_error_parameter_both_specified_same_amount_without(const fl_print_t print, const f_string_static_t symbol_first, const f_string_static_t symbol_second, const f_string_static_t symbol_third, const f_string_static_t first, const f_string_static_t second, const f_string_static_t third); + extern f_status_t fll_program_print_error_parameter_both_specified_same_amount_without(const fl_print_t print, const f_string_static_t symbol_1, const f_string_static_t symbol_2, const f_string_static_t symbol_3, const f_string_static_t name_1, const f_string_static_t name_2, const f_string_static_t name_3); #endif // _di_fll_program_print_error_parameter_both_specified_same_amount_without_ /** @@ -145,15 +145,15 @@ extern "C" { * @param print * The output structure. * This locks, uses, and unlocks the file stream. - * @param symbol_first + * @param symbol_1 * The symbol string prepended to the first parameter. * This is usually f_console_symbol_long_normal_s. - * @param symbol_second + * @param symbol_2 * The symbol string prepended to the second parameter. * This is usually f_console_symbol_long_normal_s. - * @param first + * @param name_1 * The first parameter name. - * @param second + * @param name_2 * The second parameter name. * * @return @@ -161,7 +161,7 @@ extern "C" { * F_output_not on success, but no printing is performed. */ #ifndef _di_fll_program_print_error_parameter_cannot_use_with_ - extern f_status_t fll_program_print_error_parameter_cannot_use_with(const fl_print_t print, const f_string_static_t symbol_first, const f_string_static_t symbol_second, const f_string_static_t first, const f_string_static_t second); + extern f_status_t fll_program_print_error_parameter_cannot_use_with(const fl_print_t print, const f_string_static_t symbol_1, const f_string_static_t symbol_2, const f_string_static_t name_1, const f_string_static_t name_2); #endif // _di_fll_program_print_error_parameter_cannot_use_with_ /** @@ -177,20 +177,20 @@ extern "C" { * @param print * The output structure. * This locks, uses, and unlocks the file stream. - * @param symbol_first + * @param symbol_1 * The symbol string prepended to the first parameter. * This is usually f_console_symbol_long_normal_s. - * @param symbol_second + * @param symbol_2 * The symbol string prepended to the second parameter. * This is usually f_console_symbol_long_normal_s. - * @param symbol_third + * @param symbol_3 * The symbol string prepended to the second parameter. * This is usually f_console_symbol_long_normal_s. - * @param first + * @param name_1 * The first parameter name (the parameter that cannot be used with the second parameter). - * @param second + * @param name_2 * The second parameter name. - * @param third + * @param name_3 * The third parameter name (the without parameter). * * @return @@ -198,7 +198,7 @@ extern "C" { * F_output_not on success, but no printing is performed. */ #ifndef _di_fll_program_print_error_parameter_cannot_use_with_without_ - extern f_status_t fll_program_print_error_parameter_cannot_use_with_without(const fl_print_t print, const f_string_static_t symbol_first, const f_string_static_t symbol_second, const f_string_static_t symbol_third, const f_string_static_t first, const f_string_static_t second, const f_string_static_t third); + extern f_status_t fll_program_print_error_parameter_cannot_use_with_without(const fl_print_t print, const f_string_static_t symbol_1, const f_string_static_t symbol_2, const f_string_static_t symbol_3, const f_string_static_t name_1, const f_string_static_t name_2, const f_string_static_t name_3); #endif // _di_fll_program_print_error_parameter_cannot_use_with_without_ /** @@ -217,7 +217,7 @@ extern "C" { * @param symbol * The symbol string prepended to the first parameter. * This is usually f_console_symbol_long_normal_s. - * @param parameter + * @param name * The parameter name. * * @return @@ -225,7 +225,7 @@ extern "C" { * F_output_not on success, but no printing is performed. */ #ifndef _di_fll_program_print_error_parameter_cannot_use_with_pipe_ - extern f_status_t fll_program_print_error_parameter_cannot_use_with_pipe(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t parameter); + extern f_status_t fll_program_print_error_parameter_cannot_use_with_pipe(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name); #endif // _di_fll_program_print_error_parameter_cannot_use_with_pipe_ /** @@ -241,24 +241,24 @@ extern "C" { * @param print * The output structure. * This locks, uses, and unlocks the file stream. - * @param symbol_first + * @param symbol_1 * The symbol string prepended to the first parameter. * This is usually f_console_symbol_long_normal_s. - * @param symbol_second + * @param symbol_2 * The symbol string prepended to the second parameter. * This is usually f_console_symbol_long_normal_s. - * @param symbol_third + * @param symbol_3 * The symbol string prepended to the third parameter. * This is usually f_console_symbol_long_normal_s. - * @param first + * @param name_1 * The first parameter name. * * This represents the parameter that imposes the exclusive or relation on the second and third parameters. - * @param second + * @param name_2 * The second parameter name. * * This represents the parameter that is an exclusive or with the third parameter. - * @param third + * @param name_3 * The second parameter name. * * This represents the parameter that is an exclusive or with the second parameter. @@ -268,7 +268,7 @@ extern "C" { * F_output_not on success, but no printing is performed. */ #ifndef _di_fll_program_print_error_parameter_allows_either_xor_ - extern f_status_t fll_program_print_error_parameter_cannot_use_with_xor(const fl_print_t print, const f_string_static_t symbol_first, const f_string_static_t symbol_second, const f_string_static_t symbol_third, const f_string_static_t first, const f_string_static_t second, const f_string_static_t third); + extern f_status_t fll_program_print_error_parameter_cannot_use_with_xor(const fl_print_t print, const f_string_static_t symbol_1, const f_string_static_t symbol_2, const f_string_static_t symbol_3, const f_string_static_t name_1, const f_string_static_t name_2, const f_string_static_t name_3); #endif // _di_fll_program_print_error_parameter_allows_either_xor_ /** @@ -288,7 +288,7 @@ extern "C" { * The symbol string prepended to both parameters. * This locks, uses, and unlocks the file stream. * This is usually f_console_symbol_long_normal_s. - * @param parameter + * @param name * The parameter name. * @param value * The value. @@ -298,7 +298,7 @@ extern "C" { * F_output_not on success, but no printing is performed. */ #ifndef _di_fll_program_print_error_parameter_integer_not_ - extern f_status_t fll_program_print_error_parameter_integer_not(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t parameter, const f_string_static_t value); + extern f_status_t fll_program_print_error_parameter_integer_not(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name, const f_string_static_t value); #endif // _di_fll_program_print_error_parameter_integer_not_ /** @@ -318,7 +318,7 @@ extern "C" { * The symbol string prepended to both parameters. * This locks, uses, and unlocks the file stream. * This is usually f_console_symbol_long_normal_s. - * @param parameter + * @param name * The parameter name. * @param value * The value. @@ -328,7 +328,7 @@ extern "C" { * F_output_not on success, but no printing is performed. */ #ifndef _di_fll_program_print_error_parameter_integer_not_negative_ - extern f_status_t fll_program_print_error_parameter_integer_not_negative(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t parameter, const f_string_static_t value); + extern f_status_t fll_program_print_error_parameter_integer_not_negative(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name, const f_string_static_t value); #endif // _di_fll_program_print_error_parameter_integer_not_negative_ /** @@ -348,7 +348,7 @@ extern "C" { * The symbol string prepended to both parameters. * This locks, uses, and unlocks the file stream. * This is usually f_console_symbol_long_normal_s. - * @param parameter + * @param name * The parameter name. * @param value * The value. @@ -358,7 +358,7 @@ extern "C" { * F_output_not on success, but no printing is performed. */ #ifndef _di_fll_program_print_error_parameter_integer_not_positive_ - extern f_status_t fll_program_print_error_parameter_integer_not_positive(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t parameter, const f_string_static_t value); + extern f_status_t fll_program_print_error_parameter_integer_not_positive(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name, const f_string_static_t value); #endif // _di_fll_program_print_error_parameter_integer_not_positive_ /** @@ -378,7 +378,7 @@ extern "C" { * The symbol string prepended to both parameters. * This locks, uses, and unlocks the file stream. * This is usually f_console_symbol_long_normal_s. - * @param parameter + * @param name * The parameter name. * * @return @@ -386,7 +386,7 @@ extern "C" { * F_output_not on success, but no printing is performed. */ #ifndef _di_fll_program_print_error_parameter_missing_value_ - f_status_t fll_program_print_error_parameter_missing_value(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t parameter); + f_status_t fll_program_print_error_parameter_missing_value(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name); #endif // _di_fll_program_print_error_parameter_missing_value_ /** @@ -406,7 +406,7 @@ extern "C" { * The symbol string prepended to both parameters. * This locks, uses, and unlocks the file stream. * This is usually f_console_symbol_long_normal_s. - * @param parameter + * @param name * The parameter name. * @param amount * A string representing the amount of missing parameters. @@ -416,7 +416,7 @@ extern "C" { * F_output_not on success, but no printing is performed. */ #ifndef _di_fll_program_print_error_parameter_missing_value_requires_amount_ - f_status_t fll_program_print_error_parameter_missing_value_requires_amount(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t parameter, const f_string_static_t amount); + f_status_t fll_program_print_error_parameter_missing_value_requires_amount(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name, const f_string_static_t amount); #endif // _di_fll_program_print_error_parameter_missing_value_requires_amount_ /** @@ -436,7 +436,7 @@ extern "C" { * The symbol string prepended to both parameters. * This locks, uses, and unlocks the file stream. * This is usually f_console_symbol_long_normal_s. - * @param parameter + * @param name * The parameter name. * * @return @@ -444,7 +444,7 @@ extern "C" { * F_output_not on success, but no printing is performed. */ #ifndef _di_fll_program_print_error_parameter_must_specify_once_ - extern f_status_t fll_program_print_error_parameter_must_specify_once(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t parameter); + extern f_status_t fll_program_print_error_parameter_must_specify_once(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name); #endif // _di_fll_program_print_error_parameter_must_specify_once_ /** @@ -464,7 +464,7 @@ extern "C" { * The symbol string prepended to both parameters. * This locks, uses, and unlocks the file stream. * This is usually f_console_symbol_long_normal_s. - * @param parameter + * @param name * The parameter name. * @param value * The value. @@ -474,7 +474,7 @@ extern "C" { * F_output_not on success, but no printing is performed. */ #ifndef _di_fll_program_print_error_parameter_must_specify_once_value_ - extern f_status_t fll_program_print_error_parameter_must_specify_once_value(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t parameter, const f_string_static_t value); + extern f_status_t fll_program_print_error_parameter_must_specify_once_value(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name, const f_string_static_t value); #endif // _di_fll_program_print_error_parameter_must_specify_once_value_ /** @@ -494,7 +494,7 @@ extern "C" { * The symbol string prepended to both parameters. * This locks, uses, and unlocks the file stream. * This is usually f_console_symbol_long_normal_s. - * @param parameter + * @param name * The parameter name. * @param value_start * The range start value. @@ -506,10 +506,31 @@ extern "C" { * F_output_not on success, but no printing is performed. */ #ifndef _di_fll_program_print_error_parameter_range_start_before_stop_ - extern f_status_t fll_program_print_error_parameter_range_start_before_stop(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t parameter, const f_string_static_t value_start, const f_string_static_t value_stop); + extern f_status_t fll_program_print_error_parameter_range_start_before_stop(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name, const f_string_static_t value_start, const f_string_static_t value_stop); #endif // _di_fll_program_print_error_parameter_range_start_before_stop_ /** + * Print error message for when the parameter value is too long. + * + * @param print + * The output structure. + * This locks, uses, and unlocks the file stream. + * @param symbol + * The symbol string prepended to both parameters. + * This locks, uses, and unlocks the file stream. + * This is usually f_console_symbol_long_normal_s. + * @param name + * The parameter name. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_fll_program_print_error_parameter_value_too_long_ + extern f_status_t fll_program_print_error_parameter_value_too_long(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name); +#endif // _di_fll_program_print_error_parameter_value_too_long_ + +/** * Print a message about the pipe having an invalid form-feed character '\f' (U+000C). * * This is only printed when verbosity is not set to quiet. diff --git a/level_3/fake/c/main/common-print.c b/level_3/fake/c/main/common-print.c index d189a9c..c1bf521 100644 --- a/level_3/fake/c/main/common-print.c +++ b/level_3/fake/c/main/common-print.c @@ -10,14 +10,20 @@ extern "C" { "f_console_parameter_process", "f_file_is", "f_file_name_base", + "f_string_append", "f_string_dynamic_append", "f_string_dynamic_append_nulless", + "f_string_dynamic_increase_by", "f_string_dynamic_mash", "f_string_dynamic_resize", + "f_uint8s_increase_by", + "f_utf_is_word_dash_plus", "fl_directory_copy", "fll_execute_arguments_add", "fll_execute_arguments_add_parameter_set", "fll_execute_program", + "fll_program_parameter_process_context", + "fll_program_parameter_process_verbosity", }; #endif // _di_fake_f_a_ diff --git a/level_3/fake/c/main/common-print.h b/level_3/fake/c/main/common-print.h index a72d710..11b38c3 100644 --- a/level_3/fake/c/main/common-print.h +++ b/level_3/fake/c/main/common-print.h @@ -43,14 +43,20 @@ extern "C" { fake_f_f_console_parameter_process_e, fake_f_f_file_is_e, fake_f_f_file_name_base_e, + fake_f_f_string_append_e, fake_f_f_string_dynamic_append_e, fake_f_f_string_dynamic_append_nulless_e, + fake_f_f_string_dynamic_increase_by_e, fake_f_f_string_dynamic_mash_e, fake_f_f_string_dynamic_resize_e, + fake_f_f_uint8s_increase_by_e, + fake_f_f_utf_is_word_dash_plus_e, fake_f_fl_directory_copy_e, fake_f_fll_execute_arguments_add_e, fake_f_fll_execute_arguments_add_parameter_set_e, fake_f_fll_execute_program_e, + fake_f_fll_program_parameter_process_context_e, + fake_f_fll_program_parameter_process_verbosity_e, }; // enum #endif // _di_fake_f_e_ diff --git a/level_3/fake/c/main/common.c b/level_3/fake/c/main/common.c index 862e5ad..d6515e6 100644 --- a/level_3/fake/c/main/common.c +++ b/level_3/fake/c/main/common.c @@ -56,9 +56,7 @@ extern "C" { const f_string_static_t fake_default_path_sources_s = macro_f_string_static_t_initialize(FAKE_default_path_sources_s, 0, FAKE_default_path_sources_s_length); const f_string_static_t fake_default_path_work_s = macro_f_string_static_t_initialize(FAKE_default_path_work_s, 0, FAKE_default_path_work_s_length); - const f_string_static_t fake_default_define_s = macro_f_string_static_t_initialize(FAKE_default_define_s, 0, FAKE_default_define_s_length); const f_string_static_t fake_default_fakefile_s = macro_f_string_static_t_initialize(FAKE_default_fakefile_s, 0, FAKE_default_fakefile_s_length); - const f_string_static_t fake_default_mode_s = macro_f_string_static_t_initialize(FAKE_default_mode_s, 0, FAKE_default_mode_s_length); const f_string_static_t fake_default_process_s = macro_f_string_static_t_initialize(FAKE_default_process_s, 0, FAKE_default_process_s_length); const f_string_static_t fake_default_settings_s = macro_f_string_static_t_initialize(FAKE_default_settings_s, 0, FAKE_default_settings_s_length); #endif // _di_fake_default_s_ @@ -118,6 +116,61 @@ extern "C" { if (!setting) return F_status_set_error(F_parameter); + f_string_dynamic_resize(0, &setting->build); + f_string_dynamic_resize(0, &setting->data); + f_string_dynamic_resize(0, &setting->fakefile); + f_string_dynamic_resize(0, &setting->process); + f_string_dynamic_resize(0, &setting->settings); + f_string_dynamic_resize(0, &setting->sources); + f_string_dynamic_resize(0, &setting->work); + f_string_dynamic_resize(0, &setting->path_build); + f_string_dynamic_resize(0, &setting->path_build_documentation); + f_string_dynamic_resize(0, &setting->path_build_documents); + f_string_dynamic_resize(0, &setting->path_build_includes); + f_string_dynamic_resize(0, &setting->path_build_libraries); + f_string_dynamic_resize(0, &setting->path_build_libraries_script); + f_string_dynamic_resize(0, &setting->path_build_libraries_shared); + f_string_dynamic_resize(0, &setting->path_build_libraries_static); + f_string_dynamic_resize(0, &setting->path_build_objects); + f_string_dynamic_resize(0, &setting->path_build_objects_script); + f_string_dynamic_resize(0, &setting->path_build_objects_shared); + f_string_dynamic_resize(0, &setting->path_build_objects_static); + f_string_dynamic_resize(0, &setting->path_build_programs); + f_string_dynamic_resize(0, &setting->path_build_programs_script); + f_string_dynamic_resize(0, &setting->path_build_programs_shared); + f_string_dynamic_resize(0, &setting->path_build_programs_static); + f_string_dynamic_resize(0, &setting->path_build_settings); + f_string_dynamic_resize(0, &setting->path_build_stage); + f_string_dynamic_resize(0, &setting->path_data); + f_string_dynamic_resize(0, &setting->path_data_build); + f_string_dynamic_resize(0, &setting->path_data_documentation); + f_string_dynamic_resize(0, &setting->path_data_settings); + f_string_dynamic_resize(0, &setting->path_documents); + f_string_dynamic_resize(0, &setting->path_licenses); + f_string_dynamic_resize(0, &setting->path_sources); + f_string_dynamic_resize(0, &setting->path_work); + f_string_dynamic_resize(0, &setting->path_work_includes); + f_string_dynamic_resize(0, &setting->path_work_libraries); + f_string_dynamic_resize(0, &setting->path_work_libraries_script); + f_string_dynamic_resize(0, &setting->path_work_libraries_shared); + f_string_dynamic_resize(0, &setting->path_work_libraries_static); + f_string_dynamic_resize(0, &setting->path_work_programs); + f_string_dynamic_resize(0, &setting->path_work_programs_script); + f_string_dynamic_resize(0, &setting->path_work_programs_shared); + f_string_dynamic_resize(0, &setting->path_work_programs_static); + f_string_dynamic_resize(0, &setting->file_data_build_defines); + f_string_dynamic_resize(0, &setting->file_data_build_dependencies); + f_string_dynamic_resize(0, &setting->file_data_build_fakefile); + f_string_dynamic_resize(0, &setting->file_data_build_process_post); + f_string_dynamic_resize(0, &setting->file_data_build_process_pre); + f_string_dynamic_resize(0, &setting->file_data_build_settings); + f_string_dynamic_resize(0, &setting->file_documents_readme); + + f_string_dynamics_resize(0, &setting->defines); + f_string_dynamics_resize(0, &setting->modes); + + f_uint8s_resize(0, &setting->operations); + return F_none; } #endif // _di_fake_setting_delete_ @@ -133,9 +186,9 @@ extern "C" { setting->status = f_console_parameter_process(arguments, &main->parameters); if (F_status_is_error(setting->status)) { + fake_print_line_first_locked(setting, main->error); - fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_process", F_true); - fake_print_line_last_locked(setting, main->error); + fll_error_print(main->error, F_status_set_fine(setting->status), macro_fake_f(f_console_parameter_process), F_true); return; } @@ -156,8 +209,7 @@ extern "C" { if (F_status_is_error(setting->status)) { fake_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); - fake_print_line_last_locked(setting, main->error); + fll_error_print(main->error, F_status_set_fine(setting->status), macro_fake_f(fll_program_parameter_process_context), F_true); return; } @@ -189,8 +241,7 @@ extern "C" { if (F_status_is_error(setting->status)) { fake_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); - fake_print_line_last_locked(setting, main->error); + fll_error_print(main->error, F_status_set_fine(setting->status), macro_fake_f(fll_program_parameter_process_verbosity), F_true); return; } @@ -213,11 +264,251 @@ extern "C" { return; } - f_string_static_t * const args = main->parameters.arguments.array; + uint8_t i = 0; + f_array_length_t j = 0; + f_array_length_t width_max = 0; + f_array_length_t index = 0; + + { + const uint8_t enables[] = { + fake_parameter_documents_enable_e, + fake_parameter_shared_enable_e, + fake_parameter_static_enable_e, + }; + + const uint8_t disables[] = { + fake_parameter_documents_enable_e, + fake_parameter_shared_enable_e, + fake_parameter_static_enable_e, + }; + + const uint16_t flags[] = { + fake_main_flag_enable_documents_e, + fake_main_flag_enable_shared_e, + fake_main_flag_enable_static_e, + }; + + for (; i < 3; ++i) { + + if (main->parameters.array[enables[i]].result & f_console_result_found_e) { + if (main->parameters.array[disables[i]].result & f_console_result_found_e) { + if (main->parameters.array[enables[i]].location < main->parameters.array[disables[i]].location) { + setting->flag -= setting->flag & flags[i]; + } + else { + setting->flag |= flags[i]; + } + } + else { + setting->flag |= flags[i]; + } + } + else if (main->parameters.array[disables[i]].result & f_console_result_found_e) { + setting->flag -= setting->flag & flags[i]; + } + } // for + } + + { + const f_array_length_t parameters[] = { + fake_parameter_fakefile_e, + fake_parameter_mode_e, + fake_parameter_path_build_e, + fake_parameter_path_data_e, + fake_parameter_path_sources_e, + fake_parameter_path_work_e, + fake_parameter_process_e, + fake_parameter_settings_e, + fake_parameter_sources_e, + }; + + const f_string_static_t names[] = { + fake_long_fakefile_s, + fake_long_mode_s, + fake_long_path_build_s, + fake_long_path_data_s, + fake_long_path_sources_s, + fake_long_path_work_s, + fake_long_process_s, + fake_long_settings_s, + fake_long_sources_s, + }; + + const f_string_dynamic_t variable[] = { + &setting->fakefile, + &setting->mode, + &setting->path_build, + &setting->path_data, + &setting->path_sources, + &setting->path_work, + &setting->process, + &setting->settings, + &setting->sources, + }; + + bool validate_word[] = { + F_false, // fake_parameter_fakefile_e + F_false, // fake_parameter_mode_e + F_false, // fake_parameter_path_build_e + F_false, // fake_parameter_path_data_e + F_false, // fake_parameter_path_sources_e + F_false, // fake_parameter_path_work_e + F_true, // fake_parameter_process_e + F_false, // fake_parameter_settings_e + F_false, // fake_parameter_sources_e + }; + + f_string_static_t *defaults[] = { + &fake_default_fakefile_s, // fake_parameter_fakefile_e + 0, // fake_parameter_mode_e + 0, // fake_parameter_path_build_e + 0, // fake_parameter_path_data_e + 0, // fake_parameter_path_sources_e + 0, // fake_parameter_path_work_e + &fake_default_process_s, // fake_parameter_process_e + &fake_default_settings_s, // fake_parameter_settings_e + 0, // fake_parameter_sources_e + }; + + for (i = 0; i < 9; ++i) { + + if (main->parameters.array[parameters[i]].result & f_console_result_found_e) { + setting->status = F_status_set_error(F_parameter); + + fake_print_line_first_locked(setting, main->error); + fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, names[i]); + + return; + } + + if (main->parameters.array[parameters[i]].result & f_console_result_additional_e) { + index = data->main->parameters.array[parameters[i]].values.array[0]; + + if (data->main->parameters.arguments.array[index].used) { + if (validate_word[i]) { + width_max = 0; + + for (j = 0; j < data->main->parameters.arguments.array[index].used; ++j) { + + width_max = data->main->parameters.arguments.array[index].used - j; + + status = f_utf_is_word_dash_plus(data->main->parameters.arguments.array[index].string + j, width_max, F_false); + + if (F_status_is_error(status)) { + fll_error_print(data->main->error, F_status_set_fine(status), macro_fake_f(f_string_dynamic_increase_by), F_true); + + if (fll_error_print(data->main->error, F_status_set_fine(status), macro_fake_f(f_utf_is_word_dash_plus), F_false) == F_known_not && data->main->error.verbosity > f_console_verbosity_quiet_e) { + f_file_stream_lock(data->main->error.to); + + fl_print_format("%r%[%QFailed to process the parameter '%]", data->main->error.to, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context); + fl_print_format("%[%r%r%]", data->main->error.to, data->main->error.notable, f_console_symbol_long_normal_s, fake_long_process_s, data->main->error.notable); + fl_print_format("%['.%]%r", data->main->error.to, data->main->error.context, data->main->error.context, f_string_eol_s); + + f_file_stream_unlock(data->main->error.to); + } + + return status; + } + + if (status == F_false) { + if (data->main->error.verbosity > f_console_verbosity_quiet_e) { + f_file_stream_lock(data->main->error.to); + + fl_print_format("%r%[%QThe '%]", data->main->error.to, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context); + fl_print_format("%[%r%r%]", data->main->error.to, data->main->error.notable, f_console_symbol_long_normal_s, fake_long_process_s, data->main->error.notable); + fl_print_format("%[' parameters value '%]", data->main->error.to, data->main->error.context, data->main->error.context, f_string_eol_s); + fl_print_format("%[%Q%]", data->main->error.to, data->main->error.notable, data->main->parameters.arguments.array[index], data->main->error.notable); + fl_print_format("%[' contains non-word, non-dash, and non-plus characters.%]%r", data->main->error.to, data->main->error.context, data->main->error.context, f_string_eol_s); + + f_file_stream_unlock(data->main->error.to); + } + + return F_status_set_error(F_parameter); + } + } // for + } + + status = f_string_dynamic_increase_by(data->main->parameters.arguments.array[index].used + 1, parameters_value[i]); + + if (F_status_is_error(status)) { + fll_error_print(data->main->error, F_status_set_fine(status), macro_fake_f(f_string_dynamic_increase_by), F_true); + + return status; + } + + setting->status = f_string_dynamic_append(data->main->parameters.arguments.array[index], parameters_value[i]); + + if (F_status_is_error(setting->status)) { + if (status == F_status_set_error(F_string_too_large)) { + if (print.verbosity < f_console_verbosity_normal_e) { + fake_print_line_first_locked(setting, main->error); + fake_print_error_parameter_value_too_long(data->main->error, f_console_symbol_long_normal_s, names[i]); + } + } + else { + fll_error_print(data->main->error, F_status_set_fine(status), macro_fake_f(f_string_append), F_true); + } + + return; + } + + status = F_none; + } + } + else if (defaults[i]) { + } + } // for + } + + // @todo define (multi valued map) + if (main->parameters.array[fake_parameter_define_e].result & f_console_result_found_e) { + setting->status = F_status_set_error(F_parameter); + + fake_print_line_first_locked(setting, main->error); + fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, fake_long_define_s); + + return; + } + + //f_string_static_t * const args = main->parameters.arguments.array; - //if (main->parameters.array[fake_parameter_strip_invalid_e].result & f_console_result_found_e) { - // setting->flag |= fake_main_flag_strip_invalid_e; - //} + /* + * fake_process_console_parameters + fake_parameter_operation_build_e, + fake_parameter_operation_clean_e, + fake_parameter_operation_make_e, + fake_parameter_operation_skeleton_e, + */ + + f_array_length_t operations_length = main->parameters.array[fake_parameter_operation_build_e].locations.used; + + operations_length += main->parameters.array[fake_parameter_operation_clean_e].locations.used; + operations_length += main->parameters.array[fake_parameter_operation_make_e].locations.used; + operations_length += main->parameters.array[fake_parameter_operation_skeleton_e].locations.used; + + setting->operations.used = 0; + + setting->status = f_uint8s_increase_by(operations_length ? operations_length : 1, &setting->operations); + + if (F_status_is_error(setting->status)) { + fake_print_error(setting, main->error, macro_fake_f(f_uint8s_increase_by)); + + return; + } + + // Ensure the default operation always exists. + if (operations_length) { + data.flag |= fake_data_flag_operation_e; + } + else { + setting->status = f_uint8s_increase_by(1, &setting->operations); + + if (F_status_is_error(status)) { + fake_print_error(setting, main->error, macro_fake_f(f_uint8s_increase_by)); + + return; + } + } } #endif // _di_fake_setting_load_ diff --git a/level_3/fake/c/main/common.h b/level_3/fake/c/main/common.h index 2fe0138..bdd7b7f 100644 --- a/level_3/fake/c/main/common.h +++ b/level_3/fake/c/main/common.h @@ -184,9 +184,7 @@ extern "C" { #define FAKE_default_path_sources_s "sources" F_path_separator_s #define FAKE_default_path_work_s "" - #define FAKE_default_define_s "" #define FAKE_default_fakefile_s "fakefile" - #define FAKE_default_mode_s "" #define FAKE_default_process_s "" #define FAKE_default_settings_s "settings" @@ -195,9 +193,7 @@ extern "C" { #define FAKE_default_path_sources_s_length 7 + F_path_separator_s_length #define FAKE_default_path_work_s_length 0 - #define FAKE_default_define_s_length 0 #define FAKE_default_fakefile_s_length 8 - #define FAKE_default_mode_s_length 0 #define FAKE_default_process_s_length 0 #define FAKE_default_settings_s_length 8 @@ -206,9 +202,7 @@ extern "C" { extern const f_string_static_t fake_default_path_sources_s; extern const f_string_static_t fake_default_path_work_s; - extern const f_string_static_t fake_default_define_s; extern const f_string_static_t fake_default_fakefile_s; - extern const f_string_static_t fake_default_mode_s; extern const f_string_static_t fake_default_process_s; extern const f_string_static_t fake_default_settings_s; #endif // _di_fake_default_s_ @@ -453,12 +447,12 @@ extern "C" { fake_parameter_path_sources_e, fake_parameter_path_work_e, - fake_parameter_documents_disabled_e, - fake_parameter_documents_enabled_e, - fake_parameter_shared_disabled_e, - fake_parameter_shared_enabled_e, - fake_parameter_static_disabled_e, - fake_parameter_static_enabled_e, + fake_parameter_documents_disable_e, + fake_parameter_documents_enable_e, + fake_parameter_shared_disable_e, + fake_parameter_shared_enable_e, + fake_parameter_static_disable_e, + fake_parameter_static_enable_e, fake_parameter_operation_build_e, fake_parameter_operation_clean_e, @@ -511,27 +505,33 @@ extern "C" { * Flags passed to the main function or program. * * fake_main_flag_*_e: - * - none: No flags set. - * - file_from: Using a specified source file. - * - file_to: Using a specified destination file. - * - header: Enable printing of headers. - * - help: Print help. - * - separate: Enable printing of separators. - * - strip_invalid: Using strip invalid character mode. - * - verify: Using verify mode. - * - version: Print version. + * - none: No flags set. + * - enable_documents: Enable documents, as-in --enable-doc (not specifying means --disable-doc). + * - enable_shared: Enable shared, as-in --enable-shared (not specifying means --disable-shared). + * - enable_static: Enable static, as-in --enable-static (not specifying means --disable-static). + * - file_from: Using a specified source file. + * - file_to: Using a specified destination file. + * - header: Enable printing of headers. + * - help: Print help. + * - separate: Enable printing of separators. + * - strip_invalid: Using strip invalid character mode. + * - verify: Using verify mode. + * - version: Print version. */ #ifndef _di_fake_main_flag_e_ enum { - fake_main_flag_none_e = 0x0, - fake_main_flag_file_from_e = 0x1, - fake_main_flag_file_to_e = 0x2, - fake_main_flag_header_e = 0x4, - fake_main_flag_help_e = 0x8, - fake_main_flag_separate_e = 0x10, - fake_main_flag_strip_invalid_e = 0x20, - fake_main_flag_verify_e = 0x40, - fake_main_flag_version_e = 0x80, + fake_main_flag_none_e = 0x0, + fake_main_flag_enable_documents_e = 0x1, + fake_main_flag_enable_shared_e = 0x2, + fake_main_flag_enable_static_e = 0x4, + fake_main_flag_file_from_e = 0x8, + fake_main_flag_file_to_e = 0x10, + fake_main_flag_header_e = 0x20, + fake_main_flag_help_e = 0x40, + fake_main_flag_separate_e = 0x80, + fake_main_flag_strip_invalid_e = 0x100, + fake_main_flag_verify_e = 0x200, + fake_main_flag_version_e = 0x400, }; // enum #endif // _di_fake_main_flag_e_ @@ -548,6 +548,67 @@ extern "C" { * * line_first: A string expected to represent either "\n" or NULL to allow for easy handling of when to print first new line or not. * line_last: A string expected to represent either "\n" or NULL to allow for easy handling of when to print last new line or not. + * + * build: The build directory. + * data: The data directory. + * fakefile: The fakefile file path. + * process: The process name. + * settings: The settings file path. + * sources: The sources directory. + * work: The work directory. + * + * path_build: The build path. + * path_build_documentation: The build documentation path. + * path_build_documents: The build documents path. + * path_build_includes: The build includes path. + * path_build_libraries: The build libraries path. + * path_build_libraries_script: The build libraries_script path. + * path_build_libraries_shared: The build libraries_shared path. + * path_build_libraries_static: The build libraries_static path. + * path_build_objects: The build objects path. + * path_build_objects_script: The build objects_script path. + * path_build_objects_shared: The build objects_shared path. + * path_build_objects_static: The build objects_static path. + * path_build_programs: The build programs path. + * path_build_programs_script: The build programs_script path. + * path_build_programs_shared: The build programs_shared path. + * path_build_programs_static: The build programs_static path. + * path_build_settings: The build settings path. + * path_build_stage: The build stage path. + * + * path_data: The data path. + * path_data_build: The build data path. + * path_data_documentation: The documentation data path. + * path_data_settings: The settings data path. + * + * path_documents: The documents path. + * path_licenses: The licenses path. + * path_sources: The sources path. + * + * path_work: The work path. + * path_work_includes: The includes work path. + * path_work_libraries: The libraries work path. + * path_work_libraries_script: The libraries_script work path. + * path_work_libraries_shared: The libraries_shared work path. + * path_work_libraries_static: The libraries_static work path. + * path_work_programs: The programs work path. + * path_work_programs_script: The programs_script work path. + * path_work_programs_shared: The programs_shared work path. + * path_work_programs_static: The programs_static work path. + * + * file_data_build_defines: The defines build file data. + * file_data_build_dependencies: The dependencies build file data. + * file_data_build_fakefile: The fakefile build file data. + * file_data_build_process_post: The process_post_s build file data. + * file_data_build_process_pre: The process_pre_s build file data. + * file_data_build_settings: The settings build file data. + * + * file_documents_readme: The documents readme file data. + + * defines: The define data. + * modes: The mode data. + * + * operations: The operations, in the order in which they are given. */ #ifndef _di_fake_setting_t_ typedef struct { @@ -558,6 +619,70 @@ extern "C" { f_string_static_t line_first; f_string_static_t line_last; + + f_string_dynamic_t build; + f_string_dynamic_t data; + f_string_dynamic_t fakefile; + f_string_dynamic_t process; + f_string_dynamic_t settings; + f_string_dynamic_t sources; + f_string_dynamic_t work; + + f_string_dynamic_t path_build; + f_string_dynamic_t path_build_documentation; + f_string_dynamic_t path_build_documents; + f_string_dynamic_t path_build_includes; + f_string_dynamic_t path_build_libraries; + f_string_dynamic_t path_build_libraries_script; + f_string_dynamic_t path_build_libraries_shared; + f_string_dynamic_t path_build_libraries_static; + f_string_dynamic_t path_build_objects; + f_string_dynamic_t path_build_objects_script; + f_string_dynamic_t path_build_objects_shared; + f_string_dynamic_t path_build_objects_static; + f_string_dynamic_t path_build_programs; + f_string_dynamic_t path_build_programs_script; + f_string_dynamic_t path_build_programs_shared; + f_string_dynamic_t path_build_programs_static; + f_string_dynamic_t path_build_settings; + f_string_dynamic_t path_build_stage; + + f_string_dynamic_t path_data; + f_string_dynamic_t path_data_build; + f_string_dynamic_t path_data_documentation; + f_string_dynamic_t path_data_settings; + + f_string_dynamic_t path_documents; + + f_string_dynamic_t path_licenses; + + f_string_dynamic_t path_sources; + + f_string_dynamic_t path_work; + f_string_dynamic_t path_work_includes; + f_string_dynamic_t path_work_libraries; + f_string_dynamic_t path_work_libraries_script; + f_string_dynamic_t path_work_libraries_shared; + f_string_dynamic_t path_work_libraries_static; + f_string_dynamic_t path_work_programs; + f_string_dynamic_t path_work_programs_script; + f_string_dynamic_t path_work_programs_shared; + f_string_dynamic_t path_work_programs_static; + + // @fixme there is overlap here with setting->fakefile and similar. + f_string_dynamic_t file_data_build_defines; + f_string_dynamic_t file_data_build_dependencies; + f_string_dynamic_t file_data_build_fakefile; + f_string_dynamic_t file_data_build_process_post; + f_string_dynamic_t file_data_build_process_pre; + f_string_dynamic_t file_data_build_settings; + + f_string_dynamic_t file_documents_readme; + + f_string_dynamics_t defines; // @todo conside instead: f_string_maps_t defines; + f_string_dynamics_t modes; + + f_uint8s_t operations; } fake_setting_t; #define fake_setting_t_initialize \ @@ -567,6 +692,58 @@ extern "C" { F_none, \ f_string_static_t_initialize, \ f_string_static_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamics_t_initialize, \ + f_string_dynamics_t_initialize, \ + f_uint8s_t_initialize, \ } #endif // _di_fake_setting_t_ diff --git a/level_3/fake/c/main/fake.c b/level_3/fake/c/main/fake.c index eb23da7..2ff7c90 100644 --- a/level_3/fake/c/main/fake.c +++ b/level_3/fake/c/main/fake.c @@ -16,7 +16,13 @@ extern "C" { #ifndef _di_fake_main_ void fake_main(fll_program_data_t * const main, fake_setting_t * const setting) { - if (!main || !setting || F_status_is_error(setting->status)) return; + if (!main || !setting) return; + + if (F_status_is_error(setting->status)) { + fake_print_line_last_locked(setting, main->error); + + return; + } setting->status = F_none; @@ -294,13 +300,11 @@ extern "C" { } } - if (setting->status != F_child) { - if (F_status_is_error(setting->status)) { - fake_print_line_last_locked(setting, main->error); - } - else if (setting->status != F_interrupt) { - fake_print_line_last_locked(setting, main->message); - } + if (F_status_is_error(setting->status)) { + fake_print_line_last_locked(setting, main->error); + } + else if (setting->status != F_interrupt && setting->status != F_child) { + fake_print_line_last_locked(setting, main->message); } fake_data_delete(&data); diff --git a/level_3/fake/c/main/main.c b/level_3/fake/c/main/main.c index 194496d..c4da124 100644 --- a/level_3/fake/c/main/main.c +++ b/level_3/fake/c/main/main.c @@ -4,6 +4,9 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { fll_program_data_t data = fll_program_data_t_initialize; fake_setting_t setting = fake_setting_t_initialize; + setting.flag |= fake_main_flag_enable_documents_e; + setting.flag |= fake_main_flag_enable_shared_e; + setting.flag |= fake_main_flag_enable_static_e; f_console_parameter_t parameters[] = fake_console_parameter_t_initialize; data.parameters.array = parameters; diff --git a/level_3/fake/c/main/print.c b/level_3/fake/c/main/print.c index 36a915f..77b05e6 100644 --- a/level_3/fake/c/main/print.c +++ b/level_3/fake/c/main/print.c @@ -80,6 +80,31 @@ extern "C" { } #endif // _di_fake_print_error_parameter_operation_not_with_ +#ifndef _di_fake_print_error_parameter_value_too_long_ + f_status_t fake_print_error_parameter_value_too_long(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name, const f_string_static_t value) { + + if (!setting || print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + + if (!F_status_is_error(setting->status)) { + if (print.verbosity < f_console_verbosity_error_e) return F_output_not; + } + + f_file_stream_lock(print.to); + + fake_print_line_first_unlocked(setting, print); + + fl_print_format("%[%QThe value '%]", print.to, print.context, print.prefix, print.context); + fl_print_format("%[%Q%]", print.to, print.notable, value, print.notable); + fl_print_format("%[' for the parameter '%]", print.to, print.context, print.prefix, print.context); + fl_print_format("%[%Q%Q%]", print.to, print.notable, symbol, name, print.notable); + fl_print_format("%[' is too long.%]%r", print.to, print.context, print.context, f_string_eol_s); + + f_file_stream_unlock(print.to); + + return F_none; + } +#endif // _di_fake_print_error_parameter_too_value_long_ + #ifndef _di_fake_print_help_ f_status_t fake_print_help(fake_setting_t * const setting, const fl_print_t print) { diff --git a/level_3/fake/c/main/print.h b/level_3/fake/c/main/print.h index dc1ddf9..42038a4 100644 --- a/level_3/fake/c/main/print.h +++ b/level_3/fake/c/main/print.h @@ -85,9 +85,9 @@ extern "C" { * @param print * Designates the how and where to print. * @param operation_1 - * The symbol for the operation that cannot be used. + * The name of the first operation that cannot be used. * @param operation_2 - * The second operation that cannot be used. + * The name of the second operation that cannot be used. * * @return * F_none on success. @@ -98,6 +98,30 @@ extern "C" { #endif // _di_fake_print_error_parameter_operation_not_with_ /** + * Print error message for when the parameter value is too long. + * + * @param setting + * The main program settings. + * + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * @param symbol + * The symbol of the parameter. + * @param name + * The name of the parameter. + * @param value + * The value that is too long. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_fake_print_error_parameter_value_too_long_ + extern f_status_t fake_print_error_parameter_value_too_long(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name); +#endif // _di_fake_print_error_parameter_too_value_long_ + +/** * Print help. * * @param setting diff --git a/level_3/fake/c/main/private-build-load.c b/level_3/fake/c/main/private-build-load.c index f5f41ba..fe61ad9 100644 --- a/level_3/fake/c/main/private-build-load.c +++ b/level_3/fake/c/main/private-build-load.c @@ -1381,9 +1381,9 @@ extern "C" { } } - if (data->main->parameters.array[fake_parameter_shared_disabled_e].result & f_console_result_found_e) { - if (data->main->parameters.array[fake_parameter_shared_enabled_e].result & f_console_result_found_e) { - if (data->main->parameters.array[fake_parameter_shared_enabled_e].location > data->main->parameters.array[fake_parameter_shared_disabled_e].location) { + if (data->main->parameters.array[fake_parameter_shared_disable_e].result & f_console_result_found_e) { + if (data->main->parameters.array[fake_parameter_shared_enable_e].result & f_console_result_found_e) { + if (data->main->parameters.array[fake_parameter_shared_enable_e].location > data->main->parameters.array[fake_parameter_shared_disable_e].location) { setting->build_shared = F_true; setting->search_shared = F_true; } @@ -1411,14 +1411,14 @@ extern "C" { setting->search_shared = F_false; } } - else if (data->main->parameters.array[fake_parameter_shared_enabled_e].result & f_console_result_found_e) { + else if (data->main->parameters.array[fake_parameter_shared_enable_e].result & f_console_result_found_e) { setting->build_shared = F_true; setting->search_shared = F_true; } - if (data->main->parameters.array[fake_parameter_static_disabled_e].result & f_console_result_found_e) { - if (data->main->parameters.array[fake_parameter_static_enabled_e].result & f_console_result_found_e) { - if (data->main->parameters.array[fake_parameter_static_enabled_e].location > data->main->parameters.array[fake_parameter_static_disabled_e].location) { + if (data->main->parameters.array[fake_parameter_static_disable_e].result & f_console_result_found_e) { + if (data->main->parameters.array[fake_parameter_static_enable_e].result & f_console_result_found_e) { + if (data->main->parameters.array[fake_parameter_static_enable_e].location > data->main->parameters.array[fake_parameter_static_disable_e].location) { setting->build_static = F_true; setting->search_static = F_true; } @@ -1446,7 +1446,7 @@ extern "C" { setting->search_static = F_false; } } - else if (data->main->parameters.array[fake_parameter_static_enabled_e].result & f_console_result_found_e) { + else if (data->main->parameters.array[fake_parameter_static_enable_e].result & f_console_result_found_e) { setting->build_static = F_true; setting->search_static = F_true; } diff --git a/level_3/fake/c/main/private-common.h b/level_3/fake/c/main/private-common.h index 09b7e22..9446d45 100644 --- a/level_3/fake/c/main/private-common.h +++ b/level_3/fake/c/main/private-common.h @@ -33,61 +33,6 @@ extern "C" { * * flag: A set of flags, such as designating that no operations are provided. * operation: A code representing the currrent operation. - * - * fakefile: The fakefile data. - * process: The process data. - * settings: The settings data. - * - * path_build: The build path. - * path_build_documentation: The build documentation path. - * path_build_documents: The build documents path. - * path_build_includes: The build includes path. - * path_build_libraries: The build libraries path. - * path_build_libraries_script: The build libraries_script path. - * path_build_libraries_shared: The build libraries_shared path. - * path_build_libraries_static: The build libraries_static path. - * path_build_objects: The build objects path. - * path_build_objects_script: The build objects_script path. - * path_build_objects_shared: The build objects_shared path. - * path_build_objects_static: The build objects_static path. - * path_build_programs: The build programs path. - * path_build_programs_script: The build programs_script path. - * path_build_programs_shared: The build programs_shared path. - * path_build_programs_static: The build programs_static path. - * path_build_settings: The build settings path. - * path_build_stage: The build stage path. - * - * path_data: The data path. - * path_data_build: The build data path. - * path_data_documentation: The documentation data path. - * path_data_settings: The settings data path. - * - * path_documents: The documents path. - * path_licenses: The licenses path. - * path_sources: The sources path. - * - * path_work: The work path. - * path_work_includes: The includes work path. - * path_work_libraries: The libraries work path. - * path_work_libraries_script: The libraries_script work path. - * path_work_libraries_shared: The libraries_shared work path. - * path_work_libraries_static: The libraries_static work path. - * path_work_programs: The programs work path. - * path_work_programs_script: The programs_script work path. - * path_work_programs_shared: The programs_shared work path. - * path_work_programs_static: The programs_static work path. - * - * file_data_build_defines: The defines build file data. - * file_data_build_dependencies: The dependencies build file data. - * file_data_build_fakefile: The fakefile build file data. - * file_data_build_process_post: The process_post_s build file data. - * file_data_build_process_pre: The process_pre_s build file data. - * file_data_build_settings: The settings build file data. - * - * file_documents_readme: The documents readme file data. - - * define: The define data. - * mode: The mode data. */ #ifndef _di_fake_data_t_ typedef struct { @@ -97,63 +42,6 @@ extern "C" { uint8_t flag; uint8_t operation; - - f_string_dynamic_t fakefile; - f_string_dynamic_t process; - f_string_dynamic_t settings; - - f_string_dynamic_t path_build; - f_string_dynamic_t path_build_documentation; - f_string_dynamic_t path_build_documents; - f_string_dynamic_t path_build_includes; - f_string_dynamic_t path_build_libraries; - f_string_dynamic_t path_build_libraries_script; - f_string_dynamic_t path_build_libraries_shared; - f_string_dynamic_t path_build_libraries_static; - f_string_dynamic_t path_build_objects; - f_string_dynamic_t path_build_objects_script; - f_string_dynamic_t path_build_objects_shared; - f_string_dynamic_t path_build_objects_static; - f_string_dynamic_t path_build_programs; - f_string_dynamic_t path_build_programs_script; - f_string_dynamic_t path_build_programs_shared; - f_string_dynamic_t path_build_programs_static; - f_string_dynamic_t path_build_settings; - f_string_dynamic_t path_build_stage; - - f_string_dynamic_t path_data; - f_string_dynamic_t path_data_build; - f_string_dynamic_t path_data_documentation; - f_string_dynamic_t path_data_settings; - - f_string_dynamic_t path_documents; - - f_string_dynamic_t path_licenses; - - f_string_dynamic_t path_sources; - - f_string_dynamic_t path_work; - f_string_dynamic_t path_work_includes; - f_string_dynamic_t path_work_libraries; - f_string_dynamic_t path_work_libraries_script; - f_string_dynamic_t path_work_libraries_shared; - f_string_dynamic_t path_work_libraries_static; - f_string_dynamic_t path_work_programs; - f_string_dynamic_t path_work_programs_script; - f_string_dynamic_t path_work_programs_shared; - f_string_dynamic_t path_work_programs_static; - - f_string_dynamic_t file_data_build_defines; - f_string_dynamic_t file_data_build_dependencies; - f_string_dynamic_t file_data_build_fakefile; - f_string_dynamic_t file_data_build_process_post; - f_string_dynamic_t file_data_build_process_pre; - f_string_dynamic_t file_data_build_settings; - - f_string_dynamic_t file_documents_readme; - - f_string_dynamics_t define; - f_string_dynamics_t mode; } fake_data_t; #define fake_data_t_initialize \ @@ -163,53 +51,6 @@ extern "C" { 0, \ 0, \ 0, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamics_t_initialize, \ - f_string_dynamics_t_initialize, \ } #endif // _di_fake_main_t_ diff --git a/level_3/fake/c/main/private-fake.c b/level_3/fake/c/main/private-fake.c index 26ec25b..58a3af0 100644 --- a/level_3/fake/c/main/private-fake.c +++ b/level_3/fake/c/main/private-fake.c @@ -188,6 +188,7 @@ extern "C" { } #endif // _di_fake_pipe_buffer_ +// @todo move this into the common. #ifndef _di_fake_process_console_parameters_ f_status_t fake_process_console_parameters(fake_data_t * const data) { diff --git a/level_3/fss_write/c/basic/fss_write.c b/level_3/fss_write/c/basic/fss_write.c index 78e7332..46308a4 100644 --- a/level_3/fss_write/c/basic/fss_write.c +++ b/level_3/fss_write/c/basic/fss_write.c @@ -28,7 +28,6 @@ extern "C" { fss_write_print_line_first_locked(setting, main->error); fss_write_print_error_unsupported_eol(setting, main->error); - fss_write_print_line_last_locked(setting, main->error); return; } @@ -91,7 +90,6 @@ extern "C" { fss_write_print_line_first_locked(setting, main->error); fss_write_print_error_unsupported_eol(setting, main->error); - fss_write_print_line_last_locked(setting, main->error); return; } diff --git a/level_3/fss_write/c/basic_list/fss_write.c b/level_3/fss_write/c/basic_list/fss_write.c index 38d636b..3ef6b00 100644 --- a/level_3/fss_write/c/basic_list/fss_write.c +++ b/level_3/fss_write/c/basic_list/fss_write.c @@ -31,7 +31,6 @@ extern "C" { fss_write_print_line_first_locked(setting, main->error); fss_write_print_error_unsupported_eol(setting, main->error); - fss_write_print_line_last_locked(setting, main->error); return; } @@ -91,7 +90,6 @@ extern "C" { fss_write_print_line_first_locked(setting, main->error); fss_write_print_error_unsupported_eol(setting, main->error); - fss_write_print_line_last_locked(setting, main->error); return; } diff --git a/level_3/fss_write/c/embedded_list/fss_write.c b/level_3/fss_write/c/embedded_list/fss_write.c index 9978353..ea90288 100644 --- a/level_3/fss_write/c/embedded_list/fss_write.c +++ b/level_3/fss_write/c/embedded_list/fss_write.c @@ -32,7 +32,6 @@ extern "C" { fss_write_print_line_first_locked(setting, main->error); fss_write_print_error_unsupported_eol(setting, main->error); - fss_write_print_line_last_locked(setting, main->error); return; } @@ -96,7 +95,6 @@ extern "C" { fss_write_print_line_first_locked(setting, main->error); fss_write_print_error_unsupported_eol(setting, main->error); - fss_write_print_line_last_locked(setting, main->error); return; } diff --git a/level_3/fss_write/c/extended/fss_write.c b/level_3/fss_write/c/extended/fss_write.c index 15b2cfa..ddb6e34 100644 --- a/level_3/fss_write/c/extended/fss_write.c +++ b/level_3/fss_write/c/extended/fss_write.c @@ -33,7 +33,6 @@ extern "C" { fss_write_print_line_first_locked(setting, main->error); fss_write_print_error_unsupported_eol(setting, main->error); - fss_write_print_line_last_locked(setting, main->error); return; } @@ -103,7 +102,6 @@ extern "C" { fss_write_print_line_first_locked(setting, main->error); fss_write_print_error_unsupported_eol(setting, main->error); - fss_write_print_line_last_locked(setting, main->error); return; } diff --git a/level_3/fss_write/c/extended_list/fss_write.c b/level_3/fss_write/c/extended_list/fss_write.c index e905ce3..28c6f1b 100644 --- a/level_3/fss_write/c/extended_list/fss_write.c +++ b/level_3/fss_write/c/extended_list/fss_write.c @@ -32,7 +32,6 @@ extern "C" { fss_write_print_line_first_locked(setting, main->error); fss_write_print_error_unsupported_eol(setting, main->error); - fss_write_print_line_last_locked(setting, main->error); return; } @@ -96,7 +95,6 @@ extern "C" { fss_write_print_line_first_locked(macro_fss_write_setting(setting), main->error); fss_write_print_error_unsupported_eol(macro_fss_write_setting(setting), main->error); - fss_write_print_line_last_locked(macro_fss_write_setting(setting), main->error); return; } diff --git a/level_3/fss_write/c/main/common.c b/level_3/fss_write/c/main/common.c index a110f3c..a9534c0 100644 --- a/level_3/fss_write/c/main/common.c +++ b/level_3/fss_write/c/main/common.c @@ -172,7 +172,6 @@ extern "C" { fss_write_print_line_first_locked(setting, main->error); fll_program_print_error_parameter_must_specify_once(main->error, f_console_symbol_long_normal_s, fss_write_long_file_s); - fss_write_print_line_last_locked(setting, main->error); return; } @@ -197,7 +196,6 @@ extern "C" { fss_write_print_line_first_locked(setting, main->error); fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, fss_write_long_file_s); - fss_write_print_line_last_locked(setting, main->error); return; } @@ -232,7 +230,6 @@ extern "C" { fss_write_print_line_first_locked(setting, main->error); fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, fss_write_long_object_s); - fss_write_print_line_last_locked(setting, main->error); return; } @@ -321,7 +318,6 @@ extern "C" { fss_write_print_line_first_locked(setting, main->error); fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, fss_write_long_content_s); - fss_write_print_line_last_locked(setting, main->error); return; } @@ -370,7 +366,6 @@ extern "C" { fss_write_print_line_first_locked(setting, main->error); fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, fss_write_long_prepend_s); - fss_write_print_line_last_locked(setting, main->error); return; } @@ -381,7 +376,6 @@ extern "C" { fss_write_print_line_first_locked(setting, main->error); fll_program_print_error_parameter_missing_value_requires_amount(main->error, f_console_symbol_long_normal_s, fss_write_long_ignore_s, fss_write_string_two_s); - fss_write_print_line_last_locked(setting, main->error); return; } @@ -449,7 +443,6 @@ extern "C" { if (F_status_is_error(setting->status)) { fss_write_print_line_first_locked(setting, main->error); fll_program_print_error_parameter_integer_not(main->error, f_console_symbol_long_normal_s, fss_write_long_ignore_s, main->parameters.arguments.array[index]); - fss_write_print_line_last_locked(setting, main->error); return; } @@ -461,7 +454,6 @@ extern "C" { if (F_status_is_error(setting->status)) { fss_write_print_line_first_locked(setting, main->error); fll_program_print_error_parameter_integer_not(main->error, f_console_symbol_long_normal_s, fss_write_long_ignore_s, main->parameters.arguments.array[index]); - fss_write_print_line_last_locked(setting, main->error); return; } @@ -477,7 +469,6 @@ extern "C" { main->parameters.arguments.array[values_ignore->array[i - 1]], main->parameters.arguments.array[index] ); - fss_write_print_line_last_locked(setting, main->error); return; } @@ -506,7 +497,6 @@ extern "C" { if (F_status_is_error(setting->status)) { fss_write_print_line_first_locked(setting, main->error); fll_program_print_error_parameter_integer_not(main->error, f_console_symbol_long_normal_s, fss_write_long_ignore_s, main->parameters.arguments.array[index]); - fss_write_print_line_last_locked(setting, main->error); return; } @@ -518,7 +508,6 @@ extern "C" { if (F_status_is_error(setting->status)) { fss_write_print_line_first_locked(setting, main->error); fll_program_print_error_parameter_integer_not(main->error, f_console_symbol_long_normal_s, fss_write_long_ignore_s, main->parameters.arguments.array[index]); - fss_write_print_line_last_locked(setting, main->error); return; } @@ -534,7 +523,6 @@ extern "C" { main->parameters.arguments.array[main->parameters.array[fss_write_parameter_ignore_e].values.array[i - 1]], main->parameters.arguments.array[index] ); - fss_write_print_line_last_locked(setting, main->error); return; } @@ -546,7 +534,6 @@ extern "C" { fss_write_print_line_first_locked(setting, main->error); fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, fss_write_long_ignore_s); - fss_write_print_line_last_locked(setting, main->error); return; } @@ -614,8 +601,6 @@ extern "C" { fss_write_long_partial_s ); - fss_write_print_line_last_locked(setting, main->error); - return; } } @@ -625,7 +610,6 @@ extern "C" { fss_write_print_line_first_locked(setting, main->error); fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, has_string[i], has_cannots_string[i][0]); - fss_write_print_line_last_locked(setting, main->error); return; } @@ -635,7 +619,6 @@ extern "C" { fss_write_print_line_first_locked(setting, main->error); fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, has_string[i], has_cannots_string[i][1]); - fss_write_print_line_last_locked(setting, main->error); return; } @@ -652,7 +635,6 @@ extern "C" { fss_write_print_line_first_locked(setting, main->error); fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, fss_write_long_object_s); - fss_write_print_line_last_locked(setting, main->error); return; } @@ -662,7 +644,6 @@ extern "C" { fss_write_print_line_first_locked(setting, main->error); fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, fss_write_long_content_s); - fss_write_print_line_last_locked(setting, main->error); return; } @@ -681,7 +662,6 @@ extern "C" { fss_write_print_line_first_locked(setting, main->error); fll_program_print_error_parameter_cannot_use_with_xor(main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, fss_write_long_partial_s, fss_write_long_object_s, fss_write_long_content_s); - fss_write_print_line_last_locked(setting, main->error); return; } diff --git a/level_3/fss_write/c/main/fss_write.c b/level_3/fss_write/c/main/fss_write.c index 4ba9537..286e341 100644 --- a/level_3/fss_write/c/main/fss_write.c +++ b/level_3/fss_write/c/main/fss_write.c @@ -7,7 +7,13 @@ extern "C" { #ifndef _di_fss_write_main_ void fss_write_main(fll_program_data_t * const main, fss_write_setting_t * const setting) { - if (!main || !setting || F_status_is_error(setting->status)) return; + if (!main || !setting) return; + + if (F_status_is_error(setting->status)) { + fss_write_print_line_last_locked(setting, main->error); + + return; + } setting->status = F_none; @@ -30,19 +36,23 @@ extern "C" { if (main->pipe & fll_program_data_pipe_input_e) { if (setting->process_pipe) { setting->process_pipe(main, setting); - if (F_status_is_error(setting->status)) return; } } - if (setting->flag & (fss_write_flag_object_e | fss_write_flag_content_e | fss_write_flag_object_open_e | fss_write_flag_content_next_e | fss_write_flag_content_end_e)) { - if (setting->process_normal) { - setting->process_normal(main, (void *) setting); - if (F_status_is_error(setting->status)) return; + if (F_status_is_error_not(setting->status)) { + if (setting->flag & (fss_write_flag_object_e | fss_write_flag_content_e | fss_write_flag_object_open_e | fss_write_flag_content_next_e | fss_write_flag_content_end_e)) { + if (setting->process_normal) { + setting->process_normal(main, (void *) setting); + } } } - // Ensure a new line is always put at the end of the program execution. - fss_write_print_line_last_locked(setting, main->message); + if (F_status_is_error(setting->status)) { + fss_write_print_line_last_locked(setting, main->error); + } + else if (setting->status != F_interrupt) { + fss_write_print_line_last_locked(setting, main->message); + } } #endif // _di_fss_write_main_ diff --git a/level_3/fss_write/c/main/main.c b/level_3/fss_write/c/main/main.c index 832854e..1339e86 100644 --- a/level_3/fss_write/c/main/main.c +++ b/level_3/fss_write/c/main/main.c @@ -178,9 +178,6 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { if (setting->flag & fss_write_flag_help_e) { fss_write_main_process_help(main, setting); } - else { - fss_write_print_line_last_locked(setting, main->error); - } return; } @@ -196,7 +193,6 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { fss_write_print_line_first_locked(setting, main->error); fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, fss_write_long_as_s); - fss_write_print_line_last_locked(setting, main->error); return; } diff --git a/level_3/fss_write/c/main/print.c b/level_3/fss_write/c/main/print.c index 16ca824..8eb931c 100644 --- a/level_3/fss_write/c/main/print.c +++ b/level_3/fss_write/c/main/print.c @@ -11,7 +11,6 @@ extern "C" { fss_write_print_line_first_locked(setting, print); fll_error_print(print, F_status_set_fine(setting->status), function, F_true); - fss_write_print_line_last_locked(setting, print); return F_none; } @@ -24,7 +23,6 @@ extern "C" { fss_write_print_line_first_locked(setting, print); fll_error_file_print(print, F_status_set_fine(setting->status), function, F_true, name, operation, type); - fss_write_print_line_last_locked(setting, print); return F_none; } @@ -45,7 +43,6 @@ extern "C" { fl_print_format("%[' parameter at least the same number of times when not specifying the '%]", print.to, print.context, print.context); fl_print_format("%[%r%r%]", print.to, print.notable, f_console_symbol_long_normal_s, fss_write_long_partial_s, print.notable); fl_print_format("%[' parameter.%]%r", print.to, print.context, print.context, f_string_eol_s); - fss_write_print_line_last_unlocked(setting, print); f_file_stream_unlock(print.to); @@ -64,7 +61,6 @@ extern "C" { fl_print_format("%[%QThe%] ", print.to, print.context, print.prefix, print.context); fl_print_format("%[%r%]", print.to, print.notable, setting->standard, print.notable); fl_print_format(" %[standard only supports one Content per Object.%]%r", print.to, print.context, print.context, f_string_eol_s); - fss_write_print_line_last_unlocked(setting, print); f_file_stream_unlock(print.to); @@ -100,8 +96,6 @@ extern "C" { fl_print_format("%[%QThe%] ", print.to, print.context, print.prefix, print.context); fl_print_format("%[%r%]", print.to, print.notable, setting->standard, print.notable); fl_print_format(" %[standard does not support end of line character '%]", print.to, print.context, print.context); - fss_write_print_line_last_unlocked(setting, print); - fl_print_format("%[\\n%]", print.to, print.set->notable, print.set->notable); fl_print_format("%[' (%]", print.to, print.set->error, print.set->error); fl_print_format("%[U+000A%]", print.to, print.set->notable, print.set->notable); diff --git a/level_3/fss_write/c/payload/fss_write.c b/level_3/fss_write/c/payload/fss_write.c index cc05056..ada9351 100644 --- a/level_3/fss_write/c/payload/fss_write.c +++ b/level_3/fss_write/c/payload/fss_write.c @@ -411,7 +411,6 @@ extern "C" { fss_write_print_line_first_locked(setting, main->error); fss_write_print_error_unsupported_eol(setting, main->error); - fss_write_print_line_last_locked(setting, main->error); return; } @@ -452,7 +451,6 @@ extern "C" { fss_write_print_line_first_locked(setting, main->error); fss_write_print_error_unsupported_eol(setting, main->error); - fss_write_print_line_last_locked(setting, main->error); return; } diff --git a/level_3/fss_write/c/payload/print.c b/level_3/fss_write/c/payload/print.c index f1c4e78..6a62739 100644 --- a/level_3/fss_write/c/payload/print.c +++ b/level_3/fss_write/c/payload/print.c @@ -13,7 +13,6 @@ extern "C" { fss_write_print_line_first_unlocked(setting, print); fl_print_format("%[%QThe payload may only be specified last.%]%r", print.to, print.set->error, print.prefix, print.set->error, f_string_eol_s); - fss_write_print_line_last_unlocked(setting, print); f_file_stream_unlock(print.to); diff --git a/level_3/iki_read/c/main/common.c b/level_3/iki_read/c/main/common.c index 205efeb..a411a46 100644 --- a/level_3/iki_read/c/main/common.c +++ b/level_3/iki_read/c/main/common.c @@ -160,7 +160,6 @@ extern "C" { 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; } @@ -171,7 +170,6 @@ extern "C" { iki_read_print_line_first_locked(setting, main->error); fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, iki_read_long_at_s, iki_read_long_whole_s); - iki_read_print_line_last_locked(setting, main->error); return; } @@ -187,7 +185,6 @@ extern "C" { iki_read_print_line_first_locked(setting, main->error); fll_program_print_error_parameter_integer_not(main->error, f_console_symbol_long_normal_s, iki_read_long_at_s, main->parameters.arguments.array[index]); - iki_read_print_line_last_locked(setting, main->error); return; } @@ -199,7 +196,6 @@ extern "C" { iki_read_print_line_first_locked(setting, main->error); fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, iki_read_long_at_s); - iki_read_print_line_last_locked(setting, main->error); return; } @@ -216,7 +212,6 @@ extern "C" { iki_read_print_line_first_locked(setting, main->error); fll_program_print_error_parameter_integer_not(main->error, f_console_symbol_long_normal_s, iki_read_long_line_s, main->parameters.arguments.array[index]); - iki_read_print_line_last_locked(setting, main->error); return; } @@ -228,7 +223,6 @@ extern "C" { iki_read_print_line_first_locked(setting, main->error); fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, iki_read_long_line_s); - iki_read_print_line_last_locked(setting, main->error); return; } @@ -282,7 +276,6 @@ extern "C" { iki_read_print_line_first_locked(setting, main->error); fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, iki_read_long_name_s); - iki_read_print_line_last_locked(setting, main->error); return; } @@ -293,7 +286,6 @@ extern "C" { iki_read_print_line_first_locked(setting, main->error); fll_program_print_error_parameter_missing_value_requires_amount(main->error, f_console_symbol_long_normal_s, iki_read_long_replace_s, iki_read_string_two_s); - iki_read_print_line_last_locked(setting, main->error); return; } @@ -378,7 +370,6 @@ extern "C" { iki_read_print_line_first_locked(setting, main->error); fll_program_print_error_parameter_missing_value_requires_amount(main->error, f_console_symbol_long_normal_s, iki_read_long_wrap_s, iki_read_string_three_s); - iki_read_print_line_last_locked(setting, main->error); return; } @@ -475,7 +466,6 @@ extern "C" { iki_read_print_line_first_locked(setting, main->error); fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, iki_read_long_literal_s, names[i]); - iki_read_print_line_last_locked(setting, main->error); return; } @@ -501,7 +491,6 @@ extern "C" { iki_read_print_line_first_locked(setting, main->error); fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, iki_read_long_object_s, names[i]); - iki_read_print_line_last_locked(setting, main->error); return; } @@ -515,7 +504,6 @@ extern "C" { iki_read_print_line_first_locked(setting, main->error); fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, iki_read_long_content_s, iki_read_long_total_s); - iki_read_print_line_last_locked(setting, main->error); return; } @@ -528,7 +516,6 @@ extern "C" { iki_read_print_line_first_locked(setting, main->error); fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, iki_read_long_total_s, iki_read_long_wrap_s); - iki_read_print_line_last_locked(setting, main->error); return; } @@ -582,7 +569,6 @@ extern "C" { if (F_status_is_error(setting->status)) { iki_read_print_line_first_locked(setting, main->error); fll_error_file_print(main->error, F_status_set_fine(setting->status), "f_file_exists", F_true, setting->files.array[setting->files.used], f_file_operation_verify_s, fll_error_file_type_file_e); - iki_read_print_line_last_locked(setting, main->error); return; } @@ -601,7 +587,6 @@ extern "C" { iki_read_print_line_first_locked(setting, main->error); fll_program_print_error_parameter_missing_value_requires_amount(main->error, f_console_symbol_long_normal_s, name, iki_read_string_three_s); - iki_read_print_line_last_locked(setting, main->error); return F_false; } diff --git a/level_3/iki_read/c/main/iki_read.c b/level_3/iki_read/c/main/iki_read.c index 19bfc29..0a6fd51 100644 --- a/level_3/iki_read/c/main/iki_read.c +++ b/level_3/iki_read/c/main/iki_read.c @@ -9,7 +9,13 @@ extern "C" { #ifndef _di_iki_read_main_ void iki_read_main(fll_program_data_t * const main, iki_read_setting_t * const setting) { - if (!main || !setting || F_status_is_error(setting->status)) return; + if (!main || !setting) return; + + if (F_status_is_error(setting->status)) { + iki_read_print_line_last_locked(setting, main->error); + + return; + } setting->status = F_none; @@ -39,11 +45,10 @@ extern "C" { } else { iki_read_process_buffer(main, setting); - if (F_status_is_error(setting->status)) return; } } - if (setting->files.used) { + if (F_status_is_error_not(setting->status) && setting->files.used) { f_file_t file = f_file_t_initialize; off_t size_block = 0; off_t size_file = 0; @@ -57,7 +62,7 @@ extern "C" { setting->status = F_status_set_error(F_interrupt); - return; + break; } main->signal_check = 0; @@ -71,7 +76,7 @@ extern "C" { if (F_status_is_error(setting->status)) { iki_read_print_error_file(setting, main->error, macro_iki_read_f(f_file_stream_open), setting->files.array[i], f_file_operation_process_s, fll_error_file_type_file_e); - return; + break; } setting->status = f_file_descriptor(&file); @@ -79,7 +84,7 @@ extern "C" { if (F_status_is_error(setting->status)) { iki_read_print_error_file(setting, main->error, macro_iki_read_f(f_file_descriptor), setting->files.array[i], f_file_operation_process_s, fll_error_file_type_file_e); - return; + break; } size_file = 0; @@ -146,7 +151,7 @@ extern "C" { f_file_stream_close(&file); iki_read_process_buffer(main, setting); - if (F_status_is_error(setting->status)) return; + if (F_status_is_error(setting->status)) break; setting->buffer.used = 0; } // for @@ -154,13 +159,15 @@ extern "C" { if (F_status_is_error(setting->status)) { f_file_stream_flush(file); f_file_stream_close(&file); - - return; } } - // Ensure a new line is always put at the end of the program execution. - iki_read_print_line_last_locked(setting, main->message); + if (F_status_is_error(setting->status)) { + iki_read_print_line_last_locked(setting, main->error); + } + else if (setting->status != F_interrupt) { + iki_read_print_line_last_locked(setting, main->message); + } } #endif // _di_iki_read_main_ diff --git a/level_3/iki_read/c/main/print.c b/level_3/iki_read/c/main/print.c index d93cfa6..b076e58 100644 --- a/level_3/iki_read/c/main/print.c +++ b/level_3/iki_read/c/main/print.c @@ -12,7 +12,6 @@ extern "C" { iki_read_print_line_first_locked(setting, print); fll_error_print(print, F_status_set_fine(setting->status), function, F_true); - iki_read_print_line_last_locked(setting, print); return F_none; } @@ -25,7 +24,6 @@ extern "C" { iki_read_print_line_first_locked(setting, print); fll_error_file_print(print, F_status_set_fine(setting->status), function, F_true, name, operation, type); - iki_read_print_line_last_locked(setting, print); return F_none; } diff --git a/level_3/iki_write/c/main/common.c b/level_3/iki_write/c/main/common.c index af83905..a05d3f3 100644 --- a/level_3/iki_write/c/main/common.c +++ b/level_3/iki_write/c/main/common.c @@ -141,7 +141,6 @@ extern "C" { iki_write_print_line_first_locked(setting, main->error); fll_program_print_error_parameter_must_specify_once(main->error, f_console_symbol_long_normal_s, iki_write_long_file_s); - iki_write_print_line_last_locked(setting, main->error); return; } @@ -156,7 +155,6 @@ extern "C" { if (F_status_is_error(setting->status)) { 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, main->parameters.arguments.array[index], f_file_operation_open_s, fll_error_file_type_file_e); - iki_write_print_line_last_locked(setting, main->error); return; } @@ -168,7 +166,6 @@ extern "C" { iki_write_print_line_first_locked(setting, main->error); fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, iki_write_long_file_s); - iki_write_print_line_last_locked(setting, main->error); return; } @@ -203,7 +200,6 @@ extern "C" { iki_write_print_line_first_locked(setting, main->error); fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, iki_write_long_object_s); - iki_write_print_line_last_locked(setting, main->error); return; } @@ -238,7 +234,6 @@ extern "C" { iki_write_print_line_first_locked(setting, main->error); fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, iki_write_long_content_s); - iki_write_print_line_last_locked(setting, main->error); return; } @@ -248,7 +243,6 @@ extern "C" { iki_write_print_line_first_locked(setting, main->error); iki_write_print_error_main_missing(setting, main->error); - iki_write_print_line_last_locked(setting, main->error); return; } diff --git a/level_3/iki_write/c/main/iki_write.c b/level_3/iki_write/c/main/iki_write.c index 1f7123b..f18ad87 100644 --- a/level_3/iki_write/c/main/iki_write.c +++ b/level_3/iki_write/c/main/iki_write.c @@ -9,7 +9,13 @@ extern "C" { #ifndef _di_iki_write_main_ void iki_write_main(fll_program_data_t * const main, iki_write_setting_t * const setting) { - if (!main || !setting || F_status_is_error(setting->status)) return; + if (!main || !setting) return; + + if (F_status_is_error(setting->status)) { + iki_write_print_line_last_locked(setting, main->error); + + return; + } setting->status = F_none; @@ -168,20 +174,24 @@ extern "C" { if (fll_program_standard_signal_received(main)) { setting->status = F_status_set_error(F_interrupt); - return; + break; } main->signal_check = 0; } iki_write_process(main, setting, setting->objects.array[i], setting->contents.array[i]); - if (F_status_is_error(setting->status)) return; + if (F_status_is_error(setting->status)) break; fll_print_dynamic_raw(f_string_eol_s, main->output.to); } // for - // Ensure a new line is always put at the end of the program execution. - iki_write_print_line_last_locked(setting, main->message); + if (F_status_is_error(setting->status)) { + iki_write_print_line_last_locked(setting, main->error); + } + else if (setting->status != F_interrupt) { + iki_write_print_line_last_locked(setting, main->message); + } } #endif // _di_iki_write_main_ diff --git a/level_3/iki_write/c/main/print.c b/level_3/iki_write/c/main/print.c index 4ed07f8..660a619 100644 --- a/level_3/iki_write/c/main/print.c +++ b/level_3/iki_write/c/main/print.c @@ -12,7 +12,6 @@ extern "C" { iki_write_print_line_first_locked(setting, print); fll_error_print(print, F_status_set_fine(setting->status), function, F_true); - iki_write_print_line_last_locked(setting, print); return F_none; } @@ -25,7 +24,6 @@ extern "C" { iki_write_print_line_first_locked(setting, print); fll_error_file_print(print, F_status_set_fine(setting->status), function, F_true, name, operation, type); - iki_write_print_line_last_locked(setting, print); return F_none; } @@ -63,8 +61,6 @@ extern "C" { fl_print_format("%[%Q%]", print.to, print.set->notable, object, print.set->notable); fl_print_format("%[' is not a valid IKI Object.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s); - iki_write_print_line_last_unlocked(setting, print); - f_file_stream_unlock(print.to); return F_none; diff --git a/level_3/iki_write/c/main/private-write.c b/level_3/iki_write/c/main/private-write.c index cdaf9e7..f65dde3 100644 --- a/level_3/iki_write/c/main/private-write.c +++ b/level_3/iki_write/c/main/private-write.c @@ -15,7 +15,6 @@ extern "C" { if (main->error.verbosity != f_console_verbosity_quiet_e) { iki_write_print_line_first_locked(setting, main->error); fll_program_print_error_missing_variable_not_zero(main->error, iki_write_object_s); - iki_write_print_line_last_locked(setting, main->error); } return; diff --git a/level_3/status_code/c/main/common.c b/level_3/status_code/c/main/common.c index 8e05fe6..cc5cd74 100644 --- a/level_3/status_code/c/main/common.c +++ b/level_3/status_code/c/main/common.c @@ -150,7 +150,6 @@ extern "C" { 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_locked(setting, main->error); return; } @@ -161,7 +160,6 @@ extern "C" { status_code_print_line_first_locked(setting, main->error); fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, status_code_long_error_s, status_code_long_fine_s); - status_code_print_line_last_locked(setting, main->error); return; } @@ -171,7 +169,6 @@ extern "C" { status_code_print_line_first_locked(setting, main->error); fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, status_code_long_warning_s, status_code_long_fine_s); - status_code_print_line_last_locked(setting, main->error); return; } @@ -181,7 +178,6 @@ extern "C" { status_code_print_line_first_locked(setting, main->error); status_code_print_error_no_status_codes(setting, main->error); - status_code_print_line_last_locked(setting, main->error); return; } diff --git a/level_3/status_code/c/main/common.h b/level_3/status_code/c/main/common.h index 064e6b6..c473871 100644 --- a/level_3/status_code/c/main/common.h +++ b/level_3/status_code/c/main/common.h @@ -181,10 +181,10 @@ extern "C" { macro_f_console_parameter_t_initialize4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e, 0), \ macro_f_console_parameter_t_initialize4(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e, 0), \ \ - macro_f_console_parameter_t_initialize4(status_code_short_fine_s, status_code_long_fine_s, 0, f_console_flag_normal_e, 0) \ - macro_f_console_parameter_t_initialize4(status_code_short_warning_s, status_code_long_warning_s, 0, f_console_flag_normal_e, 0) \ - macro_f_console_parameter_t_initialize4(status_code_short_error_s, status_code_long_error_s, 0, f_console_flag_normal_e, 0) \ - macro_f_console_parameter_t_initialize4(status_code_short_number_s, status_code_long_number_s, 0, f_console_flag_normal_e, 0) \ + macro_f_console_parameter_t_initialize4(status_code_short_fine_s, status_code_long_fine_s, 0, f_console_flag_normal_e, 0), \ + macro_f_console_parameter_t_initialize4(status_code_short_warning_s, status_code_long_warning_s, 0, f_console_flag_normal_e, 0), \ + macro_f_console_parameter_t_initialize4(status_code_short_error_s, status_code_long_error_s, 0, f_console_flag_normal_e, 0), \ + macro_f_console_parameter_t_initialize4(status_code_short_number_s, status_code_long_number_s, 0, f_console_flag_normal_e, 0), \ } #define status_code_total_parameters_d 16 diff --git a/level_3/status_code/c/main/print.c b/level_3/status_code/c/main/print.c index e74871f..d785812 100644 --- a/level_3/status_code/c/main/print.c +++ b/level_3/status_code/c/main/print.c @@ -12,7 +12,6 @@ extern "C" { status_code_print_line_first_locked(setting, print); fll_error_print(print, F_status_set_fine(setting->status), function, F_true); - status_code_print_line_last_locked(setting, print); return F_none; } diff --git a/level_3/status_code/c/main/status_code.c b/level_3/status_code/c/main/status_code.c index 2b42044..7012b89 100644 --- a/level_3/status_code/c/main/status_code.c +++ b/level_3/status_code/c/main/status_code.c @@ -8,7 +8,13 @@ extern "C" { #ifndef _di_status_code_main_ void status_code_main(fll_program_data_t * const main, status_code_setting_t * const setting) { - if (!main || !setting || F_status_is_error(setting->status)) return; + if (!main || !setting) return; + + if (F_status_is_error(setting->status)) { + status_code_print_line_last_locked(setting, main->error); + + return; + } if (!setting->status_string_from || !setting->status_string_to) { diff --git a/level_3/utf8/c/main/common.c b/level_3/utf8/c/main/common.c index 6f5653b..23fe00e 100644 --- a/level_3/utf8/c/main/common.c +++ b/level_3/utf8/c/main/common.c @@ -170,17 +170,11 @@ extern "C" { } if (choices.array[choice] == utf8_parameter_from_bytesequence_e) { - if (setting->mode & utf8_mode_from_codepoint_e) { - setting->mode -= utf8_mode_from_codepoint_e; - } - + setting->mode -= setting->mode & utf8_mode_from_codepoint_e; setting->mode |= utf8_mode_from_bytesequence_e; } else if (choices.array[choice] == utf8_parameter_from_codepoint_e) { - if (setting->mode & utf8_mode_from_bytesequence_e) { - setting->mode -= utf8_mode_from_bytesequence_e; - } - + setting->mode -= setting->mode & utf8_mode_from_bytesequence_e; setting->mode |= utf8_mode_from_codepoint_e; } } @@ -201,43 +195,22 @@ extern "C" { } if (choices.array[choice] == utf8_parameter_to_bytesequence_e) { - if (setting->mode & utf8_mode_to_codepoint_e) { - setting->mode -= utf8_mode_to_codepoint_e; - } - - if (setting->mode & utf8_mode_to_combining_e) { - setting->mode -= utf8_mode_to_combining_e; - } - - if (setting->mode & utf8_mode_to_width_e) { - setting->mode -= utf8_mode_to_width_e; - } + setting->mode -= setting->mode & utf8_mode_to_codepoint_e; + setting->mode -= setting->mode & utf8_mode_to_combining_e; + setting->mode -= setting->mode & utf8_mode_to_width_e; setting->mode |= utf8_mode_to_bytesequence_e; } else if (choices.array[choice] == utf8_parameter_to_codepoint_e) { - if (setting->mode & utf8_mode_to_bytesequence_e) { - setting->mode -= utf8_mode_to_bytesequence_e; - } - - if (setting->mode & utf8_mode_to_combining_e) { - setting->mode -= utf8_mode_to_combining_e; - } - - if (setting->mode & utf8_mode_to_width_e) { - setting->mode -= utf8_mode_to_width_e; - } + setting->mode -= setting->mode & utf8_mode_to_bytesequence_e; + setting->mode -= setting->mode & utf8_mode_to_combining_e; + setting->mode -= setting->mode & utf8_mode_to_width_e; setting->mode |= utf8_mode_to_codepoint_e; } else if (choices.array[choice] == utf8_parameter_to_combining_e) { - if (setting->mode & utf8_mode_to_bytesequence_e) { - setting->mode -= utf8_mode_to_bytesequence_e; - } - - if (setting->mode & utf8_mode_to_codepoint_e) { - setting->mode -= utf8_mode_to_codepoint_e; - } + setting->mode -= setting->mode & utf8_mode_to_bytesequence_e; + setting->mode -= setting->mode & utf8_mode_to_codepoint_e; // --to_width may be specified with --to_combining. if (main->parameters.array[utf8_parameter_to_width_e].result & f_console_result_found_e) { @@ -247,13 +220,8 @@ extern "C" { setting->mode |= utf8_mode_to_combining_e; } else if (choices.array[choice] == utf8_parameter_to_width_e) { - if (setting->mode & utf8_mode_to_bytesequence_e) { - setting->mode -= utf8_mode_to_bytesequence_e; - } - - if (setting->mode & utf8_mode_to_codepoint_e) { - setting->mode -= utf8_mode_to_codepoint_e; - } + setting->mode -= setting->mode & utf8_mode_to_bytesequence_e; + setting->mode -= setting->mode & utf8_mode_to_codepoint_e; // --to_width may be specified with --to_combining. if (main->parameters.array[utf8_parameter_to_combining_e].result & f_console_result_found_e) { @@ -282,7 +250,6 @@ extern "C" { setting->status = F_status_set_error(F_parameter); utf8_print_error_parameter_file_to_too_many(setting, main->error); - utf8_print_line_last_locked(setting, main->error); return; } @@ -323,7 +290,6 @@ extern "C" { else { utf8_print_line_first_locked(setting, main->error); utf8_print_error_parameter_file_name_empty(setting, main->error, main->parameters.array[utf8_parameter_to_file_e].values.array[0]); - utf8_print_line_last_locked(setting, main->error); setting->status = F_status_set_error(F_parameter); @@ -335,16 +301,12 @@ extern "C" { utf8_print_line_first_locked(setting, main->error); fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, utf8_long_to_file_s); - utf8_print_line_last_locked(setting, main->error); return; } else { main->output.to = main->message.to; - - if (setting->flag & utf8_main_flag_file_to_e) { - setting->flag -= utf8_main_flag_file_to_e; - } + setting->flag -= setting->flag & utf8_main_flag_file_to_e; } if (main->parameters.array[utf8_parameter_from_file_e].result & f_console_result_value_e) { @@ -395,11 +357,7 @@ extern "C" { } } // for - if (F_status_is_error(setting->status)) { - utf8_print_line_last_locked(setting, main->error); - - return; - } + if (F_status_is_error(setting->status)) return; setting->flag |= utf8_main_flag_file_from_e; } @@ -408,14 +366,11 @@ extern "C" { utf8_print_line_first_locked(setting, main->error); fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, utf8_long_from_file_s); - utf8_print_line_last_locked(setting, main->error); return; } else { - if (setting->flag & utf8_main_flag_file_from_e) { - setting->flag -= utf8_main_flag_file_from_e; - } + setting->flag -= setting->flag & utf8_main_flag_file_from_e; } if (main->parameters.remaining.used) { @@ -445,7 +400,6 @@ extern "C" { utf8_print_line_first_locked(setting, main->error); utf8_print_error_no_from(setting, main->error); - utf8_print_line_last_locked(setting, main->error); return; } diff --git a/level_3/utf8/c/main/print.c b/level_3/utf8/c/main/print.c index 0c91151..5a6f19e 100644 --- a/level_3/utf8/c/main/print.c +++ b/level_3/utf8/c/main/print.c @@ -12,7 +12,6 @@ extern "C" { utf8_print_line_first_locked(setting, print); fll_error_print(print, F_status_set_fine(setting->status), function, F_true); - utf8_print_line_last_locked(setting, print); return F_none; } @@ -87,7 +86,6 @@ extern "C" { utf8_print_line_first_locked(setting, print); fll_error_file_print(print, F_status_set_fine(setting->status), function, F_true, name, operation, type); - utf8_print_line_last_locked(setting, print); return F_none; } diff --git a/level_3/utf8/c/main/utf8.c b/level_3/utf8/c/main/utf8.c index 6692327..3777d10 100644 --- a/level_3/utf8/c/main/utf8.c +++ b/level_3/utf8/c/main/utf8.c @@ -11,7 +11,13 @@ extern "C" { #ifndef _di_utf8_main_ void utf8_main(fll_program_data_t * const main, utf8_setting_t * const setting) { - if (!main || !setting || F_status_is_error(setting->status)) return; + if (!main || !setting) return; + + if (F_status_is_error(setting->status)) { + utf8_print_line_last_locked(setting, main->error); + + return; + } setting->status = F_none; @@ -118,7 +124,7 @@ extern "C" { } if (F_status_is_error(setting->status) && F_status_set_fine(setting->status) != F_utf_fragment && F_status_set_fine(setting->status) != F_complete_not_utf) { - utf8_print_error_file(setting, main->error, setting->mode & utf8_mode_from_bytesequence_e ? macro_utf8_f(utf8_process_file_bytesequence) : utf8_process_file_bytesequence(utf8_process_file_codepoint), setting->path_files_from.array[i], f_file_operation_process_s, fll_error_file_type_file_e); + utf8_print_error_file(setting, main->error, setting->mode & utf8_mode_from_bytesequence_e ? macro_utf8_f(utf8_process_file_bytesequence) : macro_utf8_f(utf8_process_file_codepoint), setting->path_files_from.array[i], f_file_operation_process_s, fll_error_file_type_file_e); break; } @@ -169,12 +175,13 @@ extern "C" { if (F_status_is_error(setting->status)) { utf8_print_line_last_locked(setting, main->error); + + return; } - else if (setting->status != F_interrupt) { - utf8_print_line_last_locked(setting, main->message); - } - if (F_status_is_error(setting->status) || setting->status == F_interrupt) return; + if (setting->status == F_interrupt) return; + + utf8_print_line_last_locked(setting, main->message); if (setting->flag & utf8_main_flag_verify_e) { setting->status = valid; -- 1.8.3.1