From 6dfd83c7e432e041c361628e351796fadd8cc675 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Sun, 19 Mar 2023 12:28:34 -0500 Subject: [PATCH] Progress: Continue program related work, focusing on Featureless Make and printing. Make the fl_print structure more extensible by adding a flag and a custom object. The first/last printing is to complex. Simplify the design to a simpler one. Fix other problems as observed. I have observed a memory leak in the recent f_directory_listing_t processing code. Specifically, the f_directory_recurse_t as called in fake_build_copy(). The appropriate memory deletes appear to be being called. More investigation is needed. This is a recursive function, so there is probably a bad pointer assignment somewhere. --- level_1/fl_print/c/print/common.h | 26 +- level_2/fll_program/c/program/print.c | 70 ++--- level_2/fll_program/c/program/print.h | 16 +- level_3/byte_dump/c/byte_dump.c | 16 +- level_3/byte_dump/c/common.c | 47 +-- level_3/byte_dump/c/common.h | 22 +- level_3/byte_dump/c/print.c | 76 +---- level_3/byte_dump/c/print.h | 88 ------ level_3/byte_dump/c/private-byte_dump.c | 2 +- level_3/control/c/common.c | 47 +-- level_3/control/c/common.h | 20 +- level_3/control/c/control.c | 16 +- level_3/control/c/print.c | 72 ----- level_3/control/c/print.h | 88 ------ level_3/controller/c/common.c | 47 +-- level_3/controller/c/common.h | 20 +- level_3/controller/c/controller.c | 16 +- level_3/controller/c/print.c | 72 ----- level_3/controller/c/print.h | 88 ------ level_3/controller/c/thread/private-thread.c | 2 +- level_3/fake/c/main/build.c | 196 +++++------- level_3/fake/c/main/build/library.c | 56 ++-- level_3/fake/c/main/build/load.c | 112 +++---- level_3/fake/c/main/build/object.c | 24 +- level_3/fake/c/main/build/objects.c | 30 +- level_3/fake/c/main/build/print.c | 3 +- level_3/fake/c/main/build/print/compile.c | 7 + level_3/fake/c/main/build/print/verbose.c | 12 + level_3/fake/c/main/build/print/verbose.h | 28 +- level_3/fake/c/main/build/program.c | 28 +- level_3/fake/c/main/build/skeleton.c | 14 +- level_3/fake/c/main/clean.c | 22 +- level_3/fake/c/main/common.c | 329 ++++++++++++--------- level_3/fake/c/main/common.h | 26 +- level_3/fake/c/main/common/enumeration.h | 78 +++-- level_3/fake/c/main/common/print-error.c | 0 level_3/fake/c/main/common/print-error.h | 0 level_3/fake/c/main/common/print-string.c | 15 + level_3/fake/c/main/common/print-string.h | 52 ++++ level_3/fake/c/main/common/type.h | 35 ++- level_3/fake/c/main/fake.c | 270 +++++++++-------- level_3/fake/c/main/fake.h | 8 +- level_3/fake/c/main/fake/path_generate.c | 20 +- level_3/fake/c/main/main.c | 56 ++-- level_3/fake/c/main/make.c | 32 +- level_3/fake/c/main/make/load_fakefile.c | 104 +++---- level_3/fake/c/main/make/load_parameters.c | 94 +++--- level_3/fake/c/main/make/operate.c | 182 ++++++------ level_3/fake/c/main/make/operate_block.c | 2 +- level_3/fake/c/main/make/operate_process.c | 36 +-- level_3/fake/c/main/make/operate_process_type.c | 310 +++++++++---------- level_3/fake/c/main/make/operate_validate.c | 2 +- level_3/fake/c/main/make/operate_validate_type.c | 206 ++++++------- level_3/fake/c/main/make/print.c | 2 +- level_3/fake/c/main/print.c | 92 +++--- level_3/fake/c/main/print.h | 81 ++--- level_3/fake/c/main/print/context.c | 19 +- level_3/fake/c/main/print/context.h | 39 +++ level_3/fake/c/main/print/error.c | 42 ++- level_3/fake/c/main/print/error.h | 64 +++- level_3/fake/c/main/print/operation.c | 2 +- level_3/fake/c/main/print/verbose.c | 12 +- level_3/fake/c/main/skeleton.c | 52 ++-- level_3/firewall/c/common.c | 47 +-- level_3/firewall/c/common.h | 46 ++- level_3/firewall/c/firewall.c | 16 +- level_3/firewall/c/print.c | 64 ---- level_3/firewall/c/print.h | 88 ------ level_3/fss_basic_list_read/c/common.c | 47 +-- level_3/fss_basic_list_read/c/common.h | 20 +- .../fss_basic_list_read/c/fss_basic_list_read.c | 22 +- level_3/fss_basic_list_read/c/print.c | 64 ---- level_3/fss_basic_list_read/c/print.h | 88 ------ level_3/fss_basic_list_read/c/private-read.c | 16 +- level_3/fss_basic_read/c/common.c | 47 +-- level_3/fss_basic_read/c/common.h | 20 +- level_3/fss_basic_read/c/fss_basic_read.c | 22 +- level_3/fss_basic_read/c/print.c | 64 ---- level_3/fss_basic_read/c/print.h | 88 ------ level_3/fss_basic_read/c/private-read.c | 14 +- level_3/fss_embedded_list_read/c/common.c | 47 +-- level_3/fss_embedded_list_read/c/common.h | 20 +- .../c/fss_embedded_list_read.c | 20 +- level_3/fss_embedded_list_read/c/print.c | 64 ---- level_3/fss_embedded_list_read/c/print.h | 88 ------ level_3/fss_embedded_list_read/c/private-read.c | 4 +- level_3/fss_extended_list_read/c/common.c | 47 +-- level_3/fss_extended_list_read/c/common.h | 20 +- .../c/fss_extended_list_read.c | 22 +- level_3/fss_extended_list_read/c/print.c | 66 ----- level_3/fss_extended_list_read/c/print.h | 88 ------ level_3/fss_extended_list_read/c/private-read.c | 4 +- level_3/fss_extended_read/c/common.c | 47 +-- level_3/fss_extended_read/c/common.h | 20 +- level_3/fss_extended_read/c/fss_extended_read.c | 22 +- level_3/fss_extended_read/c/print.c | 66 ----- level_3/fss_extended_read/c/print.h | 88 ------ level_3/fss_extended_read/c/private-read.c | 4 +- level_3/fss_identify/c/common.c | 47 +-- level_3/fss_identify/c/common.h | 20 +- level_3/fss_identify/c/fss_identify.c | 18 +- level_3/fss_identify/c/print.c | 66 ----- level_3/fss_identify/c/print.h | 88 ------ level_3/fss_identify/c/private-identify.c | 2 +- level_3/fss_payload_read/c/common.c | 47 +-- level_3/fss_payload_read/c/common.h | 76 +++-- level_3/fss_payload_read/c/fss_payload_read.c | 37 ++- level_3/fss_payload_read/c/print.c | 66 ----- level_3/fss_payload_read/c/print.h | 88 ------ level_3/fss_payload_read/c/private-read.c | 18 +- level_3/fss_write/c/basic/fss_write.c | 8 - level_3/fss_write/c/basic/print.c | 4 - level_3/fss_write/c/basic_list/fss_write.c | 8 - level_3/fss_write/c/basic_list/print.c | 4 - level_3/fss_write/c/embedded_list/fss_write.c | 8 - level_3/fss_write/c/embedded_list/print.c | 4 - level_3/fss_write/c/extended/fss_write.c | 8 - level_3/fss_write/c/extended/print.c | 4 - level_3/fss_write/c/extended_list/fss_write.c | 8 - level_3/fss_write/c/extended_list/print.c | 4 - level_3/fss_write/c/main/common-type.h | 15 +- level_3/fss_write/c/main/common.c | 167 ++++++++--- level_3/fss_write/c/main/fss_write.c | 41 ++- level_3/fss_write/c/main/main-print.c | 6 +- level_3/fss_write/c/main/main.c | 9 +- level_3/fss_write/c/main/print.c | 42 +-- level_3/fss_write/c/main/print.h | 44 --- level_3/fss_write/c/payload/fss_write.c | 7 +- level_3/fss_write/c/payload/print.c | 6 +- level_3/iki_read/c/main/common.c | 171 ++++++++--- level_3/iki_read/c/main/common/print.c | 1 + level_3/iki_read/c/main/common/print.h | 1 + level_3/iki_read/c/main/common/type.h | 28 +- level_3/iki_read/c/main/iki_read.c | 34 ++- level_3/iki_read/c/main/print.c | 40 --- level_3/iki_read/c/main/print.h | 48 --- level_3/iki_read/c/main/process.c | 2 +- level_3/iki_write/c/main/common.c | 84 ++++-- level_3/iki_write/c/main/common/type.h | 19 +- level_3/iki_write/c/main/iki_write.c | 99 ++++--- level_3/iki_write/c/main/iki_write.h | 2 +- level_3/iki_write/c/main/print.c | 40 --- level_3/iki_write/c/main/print.h | 48 --- level_3/iki_write/c/main/print/error.c | 1 - level_3/iki_write/c/main/process.c | 3 - level_3/status_code/c/fss/status_code.h | 4 +- level_3/status_code/c/main/common.c | 61 ++-- level_3/status_code/c/main/common/type.h | 18 +- level_3/status_code/c/main/print.c | 40 --- level_3/status_code/c/main/print.h | 52 ---- level_3/status_code/c/main/print/error.c | 1 - level_3/status_code/c/main/print/error.h | 2 - level_3/status_code/c/main/status_code.c | 59 ++-- level_3/status_code/c/main/status_code.h | 4 +- level_3/utf8/c/main/bytesequence.c | 2 +- level_3/utf8/c/main/codepoint.c | 2 +- level_3/utf8/c/main/common.c | 114 +++++-- level_3/utf8/c/main/common/type.h | 44 ++- level_3/utf8/c/main/print.c | 41 --- level_3/utf8/c/main/print.h | 52 ---- level_3/utf8/c/main/print/data.c | 8 +- level_3/utf8/c/main/print/error.c | 6 +- level_3/utf8/c/main/process.c | 2 +- level_3/utf8/c/main/utf8.c | 57 ++-- level_3/utf8/c/main/utf8.h | 4 +- 165 files changed, 2904 insertions(+), 4415 deletions(-) delete mode 100644 level_3/fake/c/main/common/print-error.c delete mode 100644 level_3/fake/c/main/common/print-error.h create mode 100644 level_3/fake/c/main/common/print-string.c create mode 100644 level_3/fake/c/main/common/print-string.h diff --git a/level_1/fl_print/c/print/common.h b/level_1/fl_print/c/print/common.h index fc965be..a18786b 100644 --- a/level_1/fl_print/c/print/common.h +++ b/level_1/fl_print/c/print/common.h @@ -51,18 +51,22 @@ extern "C" { * * to: The file to print to. * verbosity: The verbosity mode. + * flag: A set of flags, bitwise or otherwise, made available for more advanced manipulation. * * prefix: An optional prefix string for displaying before any special messages. - * suffix: An optional suffix string for displaying after any special messages. + * suffix: An optional suffix string for displaying after any special messages. * * context: The color codes for the entire error message. * notable: The color codes for a part of the message to make more visible. * set: An optional pointer to a set of all available color contexts for explicit use. + * + * custom: A pointer to a data structure determined by some caller for more advanced manipulation. */ #ifndef _di_fl_print_t_ typedef struct { f_file_t to; uint8_t verbosity; + uint64_t flag; f_string_static_t prefix; f_string_static_t suffix; @@ -70,34 +74,40 @@ extern "C" { f_color_set_t context; f_color_set_t notable; f_color_set_context_t *set; + + void *custom; } fl_print_t; #define fl_print_t_initialize { \ macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d), \ f_console_verbosity_normal_e, \ + 0, \ f_string_static_t_initialize, \ f_string_static_t_initialize, \ f_color_set_t_initialize, \ f_color_set_t_initialize, \ 0, \ + 0, \ } - #define macro_fl_print_t_initialize(to, verbosity, prefix, suffix, context, notable, set) { \ + #define macro_fl_print_t_initialize(to, verbosity, flag, prefix, suffix, context, notable, set, custom) { \ to, \ verbosity, \ + flag, \ prefix, \ suffix, \ context, \ notable, \ set, \ + custom, \ } - #define macro_fl_print_t_initialize_debug() macro_fl_print_t_initialize(macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d), f_console_verbosity_normal_e, fl_print_debug_s, f_string_static_t_initialize, f_color_set_t_initialize, f_color_set_t_initialize, 0) - #define macro_fl_print_t_initialize_debug2(suffix, set) macro_fl_print_t_initialize(macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d), f_console_verbosity_normal_e, fl_print_debug_s, suffix, f_color_set_t_initialize, f_color_set_t_initialize, set) - #define macro_fl_print_t_initialize_error() macro_fl_print_t_initialize(macro_f_file_t_initialize2(F_type_error_d, F_type_descriptor_error_d, F_file_flag_write_only_d), f_console_verbosity_normal_e, fl_print_error_s, f_string_static_t_initialize, f_color_set_t_initialize, f_color_set_t_initialize, 0) - #define macro_fl_print_t_initialize_error2(suffix, set) macro_fl_print_t_initialize(macro_f_file_t_initialize2(F_type_error_d, F_type_descriptor_error_d, F_file_flag_write_only_d), f_console_verbosity_normal_e, fl_print_error_s, suffix, f_color_set_t_initialize, f_color_set_t_initialize, set) - #define macro_fl_print_t_initialize_warning() macro_fl_print_t_initialize(macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d), f_console_verbosity_normal_e, fl_print_warning_s, f_string_static_t_initialize, f_color_set_t_initialize, f_color_set_t_initialize, 0) - #define macro_fl_print_t_initialize_warning2(suffix, set) macro_fl_print_t_initialize(macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d), f_console_verbosity_normal_e, fl_print_warning_s, suffix, f_color_set_t_initialize, f_color_set_t_initialize, set) + #define macro_fl_print_t_initialize_debug() macro_fl_print_t_initialize(macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d), f_console_verbosity_normal_e, 0, fl_print_debug_s, f_string_static_t_initialize, f_color_set_t_initialize, f_color_set_t_initialize, 0, 0) + #define macro_fl_print_t_initialize_debug2(suffix, set) macro_fl_print_t_initialize(macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d), f_console_verbosity_normal_e, 0, fl_print_debug_s, suffix, f_color_set_t_initialize, f_color_set_t_initialize, set, 0) + #define macro_fl_print_t_initialize_error() macro_fl_print_t_initialize(macro_f_file_t_initialize2(F_type_error_d, F_type_descriptor_error_d, F_file_flag_write_only_d), f_console_verbosity_normal_e, 0, fl_print_error_s, f_string_static_t_initialize, f_color_set_t_initialize, f_color_set_t_initialize, 0, 0) + #define macro_fl_print_t_initialize_error2(suffix, set) macro_fl_print_t_initialize(macro_f_file_t_initialize2(F_type_error_d, F_type_descriptor_error_d, F_file_flag_write_only_d), f_console_verbosity_normal_e, 0, fl_print_error_s, suffix, f_color_set_t_initialize, f_color_set_t_initialize, set, 0) + #define macro_fl_print_t_initialize_warning() macro_fl_print_t_initialize(macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d), f_console_verbosity_normal_e, 0, fl_print_warning_s, f_string_static_t_initialize, f_color_set_t_initialize, f_color_set_t_initialize, 0, 0) + #define macro_fl_print_t_initialize_warning2(suffix, set) macro_fl_print_t_initialize(macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d), f_console_verbosity_normal_e, 0, fl_print_warning_s, suffix, f_color_set_t_initialize, f_color_set_t_initialize, set, 0) #endif // _di_fl_print_t_ #ifdef __cplusplus diff --git a/level_2/fll_program/c/program/print.c b/level_2/fll_program/c/program/print.c index da0f720..53e3cb7 100644 --- a/level_2/fll_program/c/program/print.c +++ b/level_2/fll_program/c/program/print.c @@ -6,15 +6,11 @@ extern "C" { #endif #ifndef _di_fll_program_print_copyright_ - f_status_t fll_program_print_copyright(const fl_print_t print, const uint8_t first_last) { + f_status_t fll_program_print_copyright(const fl_print_t print) { f_file_stream_lock(print.to); - if (first_last & 0x1) { - f_print_dynamic_raw(f_string_eol_s, print.to); - } - - fl_print_format("Copyright © 2007-2023 Kevin Day.%r", print.to, f_string_eol_s); + fl_print_format("%rCopyright © 2007-2023 Kevin Day.%r", print.to, f_string_eol_s, f_string_eol_s); #ifndef _di_detailed_copyright_ if (print.verbosity > f_console_verbosity_quiet_e) { @@ -29,9 +25,7 @@ extern "C" { } #endif // _di_detailed_copyright_ - if (first_last & 0x2) { - f_print_dynamic_raw(f_string_eol_s, print.to); - } + fl_print_format("%r", print.to, f_string_eol_s); f_file_stream_unlock(print.to); @@ -46,7 +40,7 @@ extern "C" { f_file_stream_lock(print.to); - fl_print_format("%[%QNo files are specified.%]%r", print.to, print.set->error, print.prefix, print.set->error, f_string_eol_s); + fl_print_format("%r%[%QNo files are specified.%]%r", print.to, f_string_eol_s, print.set->error, print.prefix, print.set->error, f_string_eol_s); f_file_stream_unlock(print.to); @@ -61,7 +55,7 @@ extern "C" { f_file_stream_lock(print.to); - fl_print_format("%[%QThe%] ", print.to, print.set->error, print.prefix, print.set->error); + fl_print_format("%r%[%QThe%] ", print.to, f_string_eol_s, print.set->error, print.prefix, print.set->error); fl_print_format("%[%Q%]", print.to, print.set->notable, variable, print.set->notable); fl_print_format("%[ is missing or has a length of%] ", print.to, print.set->error, print.set->error); fl_print_format("%[0%]", print.to, print.set->notable, print.set->notable); @@ -80,7 +74,7 @@ extern "C" { f_file_stream_lock(print.to); - fl_print_format("%[%QThe '%]", print.to, print.set->error, print.prefix, print.set->error); + fl_print_format("%r%[%QThe '%]", print.to, f_string_eol_s, print.set->error, print.prefix, print.set->error); fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol_1, name_1, print.set->notable); fl_print_format("%[' parameter and the '%]", print.to, print.set->error, print.set->error); fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol_2, name_2, print.set->notable); @@ -99,7 +93,7 @@ extern "C" { f_file_stream_lock(print.to); - fl_print_format("%[%QThe '%]", print.to, print.set->error, print.prefix, print.set->error); + fl_print_format("%r%[%QThe '%]", print.to, f_string_eol_s, print.set->error, print.prefix, print.set->error); fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol_1, name_1, print.set->notable); fl_print_format("%[' parameter and the '%]", print.to, print.set->error, print.set->error); fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol_2, name_2, print.set->notable); @@ -120,7 +114,7 @@ extern "C" { 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("%r%[%QCannot specify the '%]", print.to, f_string_eol_s, print.set->error, print.prefix, print.set->error); fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol_1, name_1, print.set->notable); fl_print_format("%[' parameter with the '%]", print.to, print.set->error, print.set->error); fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol_2, name_2, print.set->notable); @@ -139,7 +133,7 @@ extern "C" { 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("%r%[%QCannot specify the '%]", print.to, f_string_eol_s, print.set->error, print.prefix, print.set->error); fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol_1, name_1, print.set->notable); fl_print_format("%[' parameter with the '%]", print.to, print.set->error, print.set->error); fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol_2, name_2, print.set->notable); @@ -160,7 +154,7 @@ extern "C" { 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("%r%[%QCannot specify the '%]", print.to, f_string_eol_s, print.set->error, print.prefix, print.set->error); fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol, parameter, print.set->notable); fl_print_format("%[' when processing a pipe.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s); @@ -177,7 +171,7 @@ extern "C" { f_file_stream_lock(print.to); - fl_print_format("%[%QThe '%]", print.to, print.set->error, print.prefix, print.set->error); + fl_print_format("%r%[%QThe '%]", print.to, f_string_eol_s, print.set->error, print.prefix, print.set->error); fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol_1, name_1, print.set->notable); fl_print_format("%[' parameter only allows either the '%]", print.to, print.set->error, print.set->error); fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol_2, name_2, print.set->notable); @@ -198,7 +192,7 @@ extern "C" { f_file_stream_lock(print.to); - fl_print_format("%[%QThe value '%]", print.to, print.set->error, print.prefix, print.set->error); + fl_print_format("%r%[%QThe value '%]", print.to, f_string_eol_s, print.set->error, print.prefix, print.set->error); fl_print_format("%[%Q%]", print.to, print.set->notable, value, print.set->notable); fl_print_format("%[' for the parameter '%]", print.to, print.set->error, print.set->error); fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol, name, print.set->notable); @@ -217,7 +211,7 @@ extern "C" { f_file_stream_lock(print.to); - fl_print_format("%[%QThe value '%]", print.to, print.set->error, print.prefix, print.set->error); + fl_print_format("%r%[%QThe value '%]", print.to, f_string_eol_s, print.set->error, print.prefix, print.set->error); fl_print_format("%[%Q%]", print.to, print.set->notable, value, print.set->notable); fl_print_format("%[' for the parameter '%]", print.to, print.set->error, print.set->error); fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol, name, print.set->notable); @@ -236,7 +230,7 @@ extern "C" { f_file_stream_lock(print.to); - fl_print_format("%[%QThe value '%]", print.to, print.set->error, print.prefix, print.set->error); + fl_print_format("%r%[%QThe value '%]", print.to, f_string_eol_s, print.set->error, print.prefix, print.set->error); fl_print_format("%[%Q%]", print.to, print.set->notable, value, print.set->notable); fl_print_format("%[' for the parameter '%]", print.to, print.set->error, print.set->error); fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol, name, print.set->notable); @@ -255,7 +249,7 @@ extern "C" { f_file_stream_lock(print.to); - fl_print_format("%[%QThe parameter%] ", print.to, print.set->error, print.prefix, print.set->error); + fl_print_format("%r%[%QThe parameter%] ", print.to, f_string_eol_s, print.set->error, print.prefix, print.set->error); fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol, name, print.set->notable); fl_print_format(" %[is specified, but no value is given.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s); @@ -272,7 +266,7 @@ extern "C" { f_file_stream_lock(print.to); - fl_print_format("%[%QThe parameter%] ", print.to, print.set->error, print.prefix, print.set->error); + fl_print_format("%r%[%QThe parameter%] ", print.to, f_string_eol_s, print.set->error, print.prefix, print.set->error); fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol, name, print.set->notable); fl_print_format("%[ is specified, but%] ", print.to, print.set->error, print.set->error); fl_print_format("%[%Q%]", print.to, print.set->notable, amount, print.set->notable); @@ -291,7 +285,7 @@ extern "C" { f_file_stream_lock(print.to); - fl_print_format("%[%QThe parameter '%]", print.to, print.set->error, print.prefix, print.set->error); + fl_print_format("%r%[%QThe parameter '%]", print.to, f_string_eol_s, print.set->error, print.prefix, print.set->error); fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol, name, print.set->notable); fl_print_format("%[' may only be specified once.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s); @@ -308,7 +302,7 @@ extern "C" { f_file_stream_lock(print.to); - fl_print_format("%[%QThe value '%]", print.to, print.set->error, print.prefix, print.set->error); + fl_print_format("%r%[%QThe value '%]", print.to, f_string_eol_s, print.set->error, print.prefix, print.set->error); fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol, value, print.set->notable); fl_print_format("%[' may only be specified once for the parameter '%]", print.to, print.set->error, print.set->error); fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol, name, print.set->notable); @@ -327,7 +321,7 @@ extern "C" { f_file_stream_lock(print.to); - fl_print_format("%[%QFailure while processing the parameter '%]", print.to, print.set->error, print.prefix, print.set->error); + fl_print_format("%r%[%QFailure while processing the parameter '%]", print.to, f_string_eol_s, print.set->error, print.prefix, print.set->error); fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol, name, print.set->notable); fl_print_format("%['.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s); @@ -344,7 +338,7 @@ extern "C" { f_file_stream_lock(print.to); - fl_print_format("%[%QThe start range value '%]", print.to, print.set->error, print.prefix, print.set->error); + fl_print_format("%r%[%QThe start range value '%]", print.to, f_string_eol_s, print.set->error, print.prefix, print.set->error); fl_print_format("%[%Q%]", print.to, print.set->notable, value_start, print.set->notable); fl_print_format("%[' may not be greater than the stop value '%]", print.to, print.set->error, print.set->error); fl_print_format("%[%Q%]", print.to, print.set->notable, value_stop, print.set->notable); @@ -365,7 +359,7 @@ extern "C" { 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("%r%[%QThe value for the parameter '%]", print.to, f_string_eol_s, print.set->error, print.prefix, print.set->error); fl_print_format("%[%Q%Q%]", print.to, print.notable, symbol, name, print.notable); fl_print_format("%[' is too long.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s); @@ -382,7 +376,7 @@ extern "C" { f_file_stream_lock(print.to); - fl_print_format("%[%QThe pipe has incorrectly placed form-feed characters (\\f).%]%r", print.to, print.set->error, print.prefix, print.set->error, f_string_eol_s); + fl_print_format("%r%[%QThe pipe has incorrectly placed form-feed characters (\\f).%]%r", print.to, f_string_eol_s, print.set->error, print.prefix, print.set->error, f_string_eol_s); f_file_stream_unlock(print.to); @@ -397,7 +391,7 @@ extern "C" { f_file_stream_lock(print.to); - fl_print_format("%[%QThe pipe has no content.%]%r", print.to, print.set->error, print.prefix, print.set->error, f_string_eol_s); + fl_print_format("%r%[%QThe pipe has no content.%]%r", print.to, f_string_eol_s, print.set->error, print.prefix, print.set->error, f_string_eol_s); f_file_stream_unlock(print.to); @@ -412,7 +406,7 @@ extern "C" { f_file_stream_lock(print.to); - fl_print_format("%[%QThe pipe has an Object without Content.%]%r", print.to, print.set->error, print.prefix, print.set->error, f_string_eol_s); + fl_print_format("%r%[%QThe pipe has an Object without Content.%]%r", print.to, f_string_eol_s, print.set->error, print.prefix, print.set->error, f_string_eol_s); f_file_stream_unlock(print.to); @@ -497,7 +491,7 @@ extern "C" { #endif // _di_fll_program_print_help_usage_ #ifndef _di_fll_program_print_signal_received_ - f_status_t fll_program_print_signal_received(const fl_print_t print, const f_string_static_t line_first, const uint32_t signal) { + f_status_t fll_program_print_signal_received(const fl_print_t print, const uint32_t signal) { if (print.verbosity != f_console_verbosity_verbose_e && print.verbosity != f_console_verbosity_debug_e) { return F_output_not; @@ -508,7 +502,7 @@ extern "C" { // Must flush and reset color because the interrupt may have interrupted the middle of a print function. f_file_stream_flush(print.to); - fl_print_format("%]%r%[Received signal code %]", print.to, print.set->reset, line_first, print.set->warning, print.set->warning); + fl_print_format("%]%r%[Received signal code %]", print.to, print.set->reset, f_string_eol_s, print.set->warning, print.set->warning); fl_print_format("%[%u%]", print.to, print.set->notable, signal, print.set->notable); fl_print_format("%[.%]%r", print.to, print.set->warning, print.set->warning, f_string_eol_s); @@ -519,20 +513,14 @@ extern "C" { #endif // _di_fll_program_print_signal_received_ #ifndef _di_fll_program_print_version_ - f_status_t fll_program_print_version(const fl_print_t print, const uint8_t first_last, const f_string_static_t version) { + f_status_t fll_program_print_version(const fl_print_t print, const f_string_static_t version) { f_file_stream_lock(print.to); - if (first_last & 0x1) { - f_print_dynamic_raw(f_string_eol_s, print.to); - } - + f_print_dynamic_raw(f_string_eol_s, print.to); f_print_dynamic(version, print.to); f_print_dynamic_raw(f_string_eol_s, print.to); - - if (first_last & 0x2) { - f_print_dynamic_raw(f_string_eol_s, print.to); - } + f_print_dynamic_raw(f_string_eol_s, print.to); f_file_stream_unlock(print.to); diff --git a/level_2/fll_program/c/program/print.h b/level_2/fll_program/c/program/print.h index 011bc5f..323b0bc 100644 --- a/level_2/fll_program/c/program/print.h +++ b/level_2/fll_program/c/program/print.h @@ -22,17 +22,13 @@ extern "C" { * @param print * The output structure to print to. * The print.verbosity is used to determine how much detail is printed (except for when _di_detailed_copyright_ is set). - * @param first_last - * Bitwise variable representing whether or not to print the first and last new line. - * Set bit 0x1 to printing first line. - * Set bit 0x2 to printing last line. * * @return * F_none on success. * F_output_not on success, but no printing is performed. */ #ifndef _di_fll_program_print_copyright_ - extern f_status_t fll_program_print_copyright(const fl_print_t print, const uint8_t first_last); + extern f_status_t fll_program_print_copyright(const fl_print_t print); #endif // _di_fll_program_print_copyright_ /** @@ -812,8 +808,6 @@ extern "C" { * The output structure to print to. * This locks, uses, and unlocks the file stream. * This requires print.set to be non-NULL. - * @param line_first - * The first line character, which is expected to be set to either f_string_eol_s or f_string_empty_s. * @param signal * The signal code received. * @@ -822,7 +816,7 @@ extern "C" { * F_output_not on success, but no printing is performed. */ #ifndef _di_fll_program_print_signal_received_ - extern f_status_t fll_program_print_signal_received(const fl_print_t print, const f_string_static_t line_first, const uint32_t signal); + extern f_status_t fll_program_print_signal_received(const fl_print_t print, const uint32_t signal); #endif // _di_fll_program_print_signal_received_ /** @@ -832,10 +826,6 @@ extern "C" { * The output structure to print to. * This uses but does not lock or unlock file stream. * This requires print.set to be non-NULL. - * @param first_last - * Bitwise variable representing whether or not to print the first and last new line. - * Set bit 0x1 to printing first line. - * Set bit 0x2 to printing last line. * @param version * The version number of the program. * @@ -846,7 +836,7 @@ extern "C" { * @see fl_print_format() */ #ifndef _di_fll_program_print_version_ - extern f_status_t fll_program_print_version(const fl_print_t print, const uint8_t first_last, const f_string_static_t version); + extern f_status_t fll_program_print_version(const fl_print_t print, const f_string_static_t version); #endif // _di_fll_program_print_version_ #ifdef __cplusplus diff --git a/level_3/byte_dump/c/byte_dump.c b/level_3/byte_dump/c/byte_dump.c index 12fe1bc..192bd17 100644 --- a/level_3/byte_dump/c/byte_dump.c +++ b/level_3/byte_dump/c/byte_dump.c @@ -34,9 +34,11 @@ extern "C" { status = fll_program_parameter_process_context(choices, modes, F_true, main); if (F_status_is_error(status)) { - byte_dump_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e); - byte_dump_print_line_last_locked(setting, main->error); + + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error); + } return; } @@ -53,9 +55,11 @@ extern "C" { status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); if (F_status_is_error(status)) { - byte_dump_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e); - byte_dump_print_line_last_locked(setting, main->error); + + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error); + } return; } @@ -153,13 +157,13 @@ extern "C" { } if (main->parameters.array[byte_dump_parameter_version_e].result & f_console_result_found_e) { - fll_program_print_version(main->message, (setting->line_first.used ? 0x1 : 0x0) | (setting->line_last.used ? 0x2 : 0x0), byte_dump_program_version_s); + fll_program_print_version(main->message, byte_dump_program_version_s); return F_none; } if (main->parameters.array[byte_dump_parameter_copyright_e].result & f_console_result_found_e) { - fll_program_print_copyright(main->message, (setting->line_first.used ? 0x1 : 0x0) | (setting->line_last.used ? 0x2 : 0x0)); + fll_program_print_copyright(main->message); return F_none; } diff --git a/level_3/byte_dump/c/common.c b/level_3/byte_dump/c/common.c index 2b5b254..937aa42 100644 --- a/level_3/byte_dump/c/common.c +++ b/level_3/byte_dump/c/common.c @@ -87,10 +87,27 @@ extern "C" { setting->state.step_small = byte_dump_allocation_small_d; + // Identify and pocess first/last parameters. + if (main->parameters.array[byte_dump_parameter_line_first_no_e].result & f_console_result_found_e) { + setting->flag -= setting->flag & byte_dump_main_flag_print_first_e; + } + else { + setting->flag |= byte_dump_main_flag_print_first_e; + } + + if (main->parameters.array[byte_dump_parameter_line_last_no_e].result & f_console_result_found_e) { + setting->flag -= setting->flag & byte_dump_main_flag_print_last_e; + } + else { + setting->flag |= byte_dump_main_flag_print_last_e; + } + if (F_status_is_error(setting->state.status)) { - byte_dump_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->state.status), "f_console_parameter_process", fll_error_file_flag_fallback_e); - byte_dump_print_line_last_locked(setting, main->error); + + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error); + } return; } @@ -110,28 +127,16 @@ extern "C" { setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, main); if (F_status_is_error(setting->state.status)) { - byte_dump_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e); - byte_dump_print_line_last_locked(setting, main->error); + + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error); + } return; } } - if (main->parameters.array[byte_dump_parameter_line_first_no_e].result & f_console_result_found_e) { - setting->line_first = f_string_empty_s; - } - else { - setting->line_first = f_string_eol_s; - } - - if (main->parameters.array[byte_dump_parameter_line_last_no_e].result & f_console_result_found_e) { - setting->line_last = f_string_empty_s; - } - else { - setting->line_last = f_string_eol_s; - } - // Identify and prioritize "verbosity" parameters. { uint16_t choices_array[5] = { byte_dump_parameter_verbosity_quiet_e, byte_dump_parameter_verbosity_error_e, byte_dump_parameter_verbosity_verbose_e, byte_dump_parameter_verbosity_debug_e, byte_dump_parameter_verbosity_normal_e }; @@ -143,9 +148,11 @@ extern "C" { setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); if (F_status_is_error(setting->state.status)) { - byte_dump_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e); - byte_dump_print_line_last_locked(setting, main->error); + + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error); + } return; } diff --git a/level_3/byte_dump/c/common.h b/level_3/byte_dump/c/common.h index 24170e8..76d2630 100644 --- a/level_3/byte_dump/c/common.h +++ b/level_3/byte_dump/c/common.h @@ -337,7 +337,7 @@ extern "C" { #define byte_dump_console_parameter_t_initialize \ { \ macro_f_console_parameter_t_initialize_3(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize_3(f_console_standard_short_copyright_s, f_console_standard_long_copyright_s, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_3(f_console_standard_short_copyright_s, f_console_standard_long_copyright_s, 0, f_console_flag_inverse_e), \ macro_f_console_parameter_t_initialize_3(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \ macro_f_console_parameter_t_initialize_3(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \ macro_f_console_parameter_t_initialize_3(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \ @@ -381,6 +381,8 @@ extern "C" { * - file_to: Using a specified destination file. * - help: Print help. * - header: Enable printing of headers. + * - print_first: When set, print new line to message output on program begin after loading settings. + * - print_last: When set, print new line to message output on program end. * - separate: Enable printing of separators. * - strip_invalid: Using strip invalid character mode. * - verify: Using verify mode. @@ -393,10 +395,12 @@ extern "C" { byte_dump_main_flag_file_to_e = 0x2, byte_dump_main_flag_header_e = 0x4, byte_dump_main_flag_help_e = 0x8, - byte_dump_main_flag_separate_e = 0x10, - byte_dump_main_flag_strip_invalid_e = 0x20, - byte_dump_main_flag_verify_e = 0x40, - byte_dump_main_flag_version_e = 0x80, + byte_dump_main_flag_print_first_e = 0x10, + byte_dump_main_flag_print_last_e = 0x20, + byte_dump_main_flag_separate_e = 0x40, + byte_dump_main_flag_strip_invalid_e = 0x80, + byte_dump_main_flag_verify_e = 0x100, + byte_dump_main_flag_version_e = 0x200, }; // enum #endif // _di_byte_dump_main_flag_e_ @@ -409,26 +413,18 @@ extern "C" { * flag: Flags passed to the main function. * * state: The state information. - * - * 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. */ #ifndef _di_byte_dump_setting_t_ typedef struct { uint16_t flag; f_state_t state; - - f_string_static_t line_first; - f_string_static_t line_last; } byte_dump_setting_t; #define byte_dump_setting_t_initialize \ { \ byte_dump_main_flag_none_e, \ f_state_t_initialize, \ - f_string_static_t_initialize, \ - f_string_static_t_initialize, \ } #endif // _di_byte_dump_setting_t_ diff --git a/level_3/byte_dump/c/print.c b/level_3/byte_dump/c/print.c index f4ea201..0a3467d 100644 --- a/level_3/byte_dump/c/print.c +++ b/level_3/byte_dump/c/print.c @@ -10,8 +10,6 @@ extern "C" { f_file_stream_lock(print.to); - f_print_dynamic_raw(setting->line_first, print.to); - fll_program_print_help_header(print, byte_dump_program_name_long_s, byte_dump_program_version_s); fll_program_print_help_option_standard(print); @@ -52,9 +50,7 @@ extern "C" { fll_program_print_help_usage(print, byte_dump_program_name_s, fll_program_parameter_filenames_s); - //if (!(setting->flag & XXX_main_flag_line_last_no_e)) { - f_print_dynamic_raw(f_string_eol_s, print.to); - //} + f_print_dynamic_raw(f_string_eol_s, print.to); fl_print_format(" When using the %[%r%r%] option, some UTF-8 characters may be replaced by your instance and cause display alignment issues.%r%r", print.to, context.set.notable, f_console_symbol_long_normal_s, byte_dump_long_text_s, context.set.notable, f_string_eol_s, f_string_eol_s); @@ -66,8 +62,6 @@ extern "C" { fl_print_format(" When using the %[%r%r%] option, invalid Unicode will fallback to being displayed using one of the other modes.%r", print.to, context.set.notable, f_console_symbol_long_normal_s, byte_dump_long_unicode_s, context.set.notable, f_string_eol_s); - f_print_dynamic_raw(setting->line_last, print.to); - f_file_stream_flush(output); f_file_stream_unlock(print.to); @@ -75,74 +69,6 @@ extern "C" { } #endif // _di_byte_dump_print_help_ -#ifndef _di_byte_dump_print_line_first_locked_ - f_status_t byte_dump_print_line_first_locked(byte_dump_setting_t * const setting, const fl_print_t print) { - - if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; - if (setting->flag & byte_dump_main_flag_verify_e) return; - - if (F_status_is_error_not(setting->state.status)) { - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - if (setting->flag & byte_dump_main_flag_file_to_e) return F_output_not; - } - - f_print_dynamic_raw(setting->line_first, print.to); - - return F_none; - } -#endif // _di_byte_dump_print_line_first_locked_ - -#ifndef _di_byte_dump_print_line_first_unlocked_ - f_status_t byte_dump_print_line_first_unlocked(byte_dump_setting_t * const setting, const fl_print_t print) { - - if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; - if (setting->flag & byte_dump_main_flag_verify_e) return; - - if (F_status_is_error_not(setting->state.status)) { - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - if (setting->flag & byte_dump_main_flag_file_to_e) return F_output_not; - } - - fll_print_dynamic_raw(setting->line_first, print.to); - - return F_none; - } -#endif // _di_byte_dump_print_line_first_unlocked_ - -#ifndef _di_byte_dump_print_line_last_locked_ - f_status_t byte_dump_print_line_last_locked(byte_dump_setting_t * const setting, const fl_print_t print) { - - if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; - if (setting->flag & byte_dump_main_flag_verify_e) return; - - if (F_status_is_error_not(setting->state.status)) { - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - if (setting->flag & byte_dump_main_flag_file_to_e) return F_output_not; - } - - fll_print_dynamic_raw(setting->line_last, print.to); - - return F_none; - } -#endif // _di_byte_dump_print_line_last_locked_ - -#ifndef _di_byte_dump_print_line_last_unlocked_ - f_status_t byte_dump_print_line_last_unlocked(byte_dump_setting_t * const setting, const fl_print_t print) { - - if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; - if (setting->flag & byte_dump_main_flag_verify_e) return; - - if (F_status_is_error_not(setting->state.status)) { - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - if (setting->flag & byte_dump_main_flag_file_to_e) return F_output_not; - } - - f_print_dynamic_raw(setting->line_last, print.to); - - return F_none; - } -#endif // _di_byte_dump_print_line_last_unlocked_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/byte_dump/c/print.h b/level_3/byte_dump/c/print.h index c62bd3a..8526e08 100644 --- a/level_3/byte_dump/c/print.h +++ b/level_3/byte_dump/c/print.h @@ -33,94 +33,6 @@ extern "C" { extern f_status_t byte_dump_print_help(byte_dump_setting_t * const setting, const fl_print_t print); #endif // _di_byte_dump_print_help_ -/** - * Print first new line, unless verbosity says otherwise. - * - * This is generally either the first line in the program or the first line printed before an error message. - * - * This function locks and then unlocks the input stream when printing. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_byte_dump_print_line_first_locked_ - extern f_status_t byte_dump_print_line_first_locked(byte_dump_setting_t * const setting, const fl_print_t print); -#endif // _di_byte_dump_print_line_first_locked_ - -/** - * Print first new line, unless verbosity says otherwise. - * - * This is generally either the first line in the program or the first line printed before an error message. - * - * This function neither locks nor unlocks the input stream. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_byte_dump_print_line_first_unlocked_ - extern f_status_t byte_dump_print_line_first_unlocked(byte_dump_setting_t * const setting, const fl_print_t print); -#endif // _di_byte_dump_print_line_first_unlocked_ - -/** - * Print last new line when the main is complete, unless verbosity says otherwise. - * - * This is generally the very last line printed in the program. - * - * This function locks and then unlocks the input stream when printing. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_byte_dump_print_line_last_locked_ - extern f_status_t byte_dump_print_line_last_locked(byte_dump_setting_t * const setting, const fl_print_t print); -#endif // _di_byte_dump_print_line_last_locked_ - -/** - * Print last new line when the main is complete, unless verbosity says otherwise. - * - * This is generally the very last line printed in the program. - * - * This function neither locks nor unlocks the input stream. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_byte_dump_print_line_last_unlocked_ - extern f_status_t byte_dump_print_line_last_unlocked(byte_dump_setting_t * const setting, const fl_print_t print); -#endif // _di_byte_dump_print_line_last_unlocked_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/byte_dump/c/private-byte_dump.c b/level_3/byte_dump/c/private-byte_dump.c index 3504d51..edd2370 100644 --- a/level_3/byte_dump/c/private-byte_dump.c +++ b/level_3/byte_dump/c/private-byte_dump.c @@ -60,7 +60,7 @@ extern "C" { if (!((++data->main->signal_check) % byte_dump_signal_check_d)) { if (fll_program_standard_signal_received(data->main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); + fll_program_print_signal_received(main->warning, main->signal_received); return F_status_set_error(F_interrupt); } diff --git a/level_3/control/c/common.c b/level_3/control/c/common.c index b945668..1438622 100644 --- a/level_3/control/c/common.c +++ b/level_3/control/c/common.c @@ -190,10 +190,27 @@ extern "C" { setting->state.step_small = control_write_allocation_small_d; + // Identify and pocess first/last parameters. + if (main->parameters.array[control_parameter_line_first_no_e].result & f_console_result_found_e) { + setting->flag -= setting->flag & control_main_flag_print_first_e; + } + else { + setting->flag |= control_main_flag_print_first_e; + } + + if (main->parameters.array[control_parameter_line_last_no_e].result & f_console_result_found_e) { + setting->flag -= setting->flag & control_main_flag_print_last_e; + } + else { + setting->flag |= control_main_flag_print_last_e; + } + if (F_status_is_error(setting->state.status)) { - control_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->state.status), "f_console_parameter_process", fll_error_file_flag_fallback_e); - control_print_line_last_locked(setting, main->error); + + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error); + } return; } @@ -213,28 +230,16 @@ extern "C" { setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, main); if (F_status_is_error(setting->state.status)) { - control_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e); - control_print_line_last_locked(setting, main->error); + + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error); + } return; } } - if (main->parameters.array[control_parameter_line_first_no_e].result & f_console_result_found_e) { - setting->line_first = f_string_empty_s; - } - else { - setting->line_first = f_string_eol_s; - } - - if (main->parameters.array[control_parameter_line_last_no_e].result & f_console_result_found_e) { - setting->line_last = f_string_empty_s; - } - else { - setting->line_last = f_string_eol_s; - } - // Identify and prioritize "verbosity" parameters. { uint16_t choices_array[5] = { control_parameter_verbosity_quiet_e, control_parameter_verbosity_error_e, control_parameter_verbosity_verbose_e, control_parameter_verbosity_debug_e, control_parameter_verbosity_normal_e }; @@ -246,9 +251,11 @@ extern "C" { setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); if (F_status_is_error(setting->state.status)) { - control_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e); - control_print_line_last_locked(setting, main->error); + + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error); + } return; } diff --git a/level_3/control/c/common.h b/level_3/control/c/common.h index 7656bdb..f1f1d3d 100644 --- a/level_3/control/c/common.h +++ b/level_3/control/c/common.h @@ -215,6 +215,8 @@ extern "C" { * - file_to: Using a specified destination file. * - help: Print help. * - header: Enable printing of headers. + * - print_first: When set, print new line to message output on program begin after loading settings. + * - print_last: When set, print new line to message output on program end. * - separate: Enable printing of separators. * - strip_invalid: Using strip invalid character mode. * - verify: Using verify mode. @@ -228,10 +230,12 @@ extern "C" { control_main_flag_file_to_e = 0x4, control_main_flag_header_e = 0x8, control_main_flag_help_e = 0x10, - control_main_flag_separate_e = 0x20, - control_main_flag_strip_invalid_e = 0x40, - control_main_flag_verify_e = 0x80, - control_main_flag_version_e = 0x100, + control_main_flag_print_first_e = 0x20, + control_main_flag_print_last_e = 0x40, + control_main_flag_separate_e = 0x80, + control_main_flag_strip_invalid_e = 0x100, + control_main_flag_verify_e = 0x200, + control_main_flag_version_e = 0x400, }; // enum #endif // _di_control_main_flag_e_ @@ -244,26 +248,18 @@ extern "C" { * flag: Flags passed to the main function. * * state: The state information. - * - * 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. */ #ifndef _di_control_setting_t_ typedef struct { uint16_t flag; f_state_t state; - - f_string_static_t line_first; - f_string_static_t line_last; } control_setting_t; #define control_setting_t_initialize \ { \ control_main_flag_none_e, \ f_state_t_initialize, \ - f_string_static_t_initialize, \ - f_string_static_t_initialize, \ } #endif // _di_control_setting_t_ diff --git a/level_3/control/c/control.c b/level_3/control/c/control.c index 24acb06..ea2ad27 100644 --- a/level_3/control/c/control.c +++ b/level_3/control/c/control.c @@ -35,9 +35,11 @@ extern "C" { status = fll_program_parameter_process_context(choices, modes, F_true, main); if (F_status_is_error(status)) { - control_print_line_first_locked(setting, main->error) fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e); - control_print_line_last_locked(setting, main->error); + + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error); + } return; } @@ -54,9 +56,11 @@ extern "C" { status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); if (F_status_is_error(status)) { - control_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e); - control_print_line_last_locked(setting, main->error); + + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error); + } return; } @@ -70,13 +74,13 @@ extern "C" { } if (main->parameters.array[control_parameter_version_e].result & f_console_result_found_e) { - fll_program_print_version(main->message, (setting->line_first.used ? 0x1 : 0x0) | (setting->line_last.used ? 0x2 : 0x0), control_program_version_s); + fll_program_print_version(main->message, control_program_version_s); return F_none; } if (main->parameters.array[control_parameter_copyright_e].result & f_console_result_found_e) { - fll_program_print_copyright(main->message, (setting->line_first.used ? 0x1 : 0x0) | (setting->line_last.used ? 0x2 : 0x0)); + fll_program_print_copyright(main->message); return F_none; } diff --git a/level_3/control/c/print.c b/level_3/control/c/print.c index ed9fac9..04031ad 100644 --- a/level_3/control/c/print.c +++ b/level_3/control/c/print.c @@ -10,8 +10,6 @@ extern "C" { f_file_stream_lock(print.to); - f_print_dynamic_raw(setting->line_first, print.to); - fll_program_print_help_header(print, control_program_name_long_s, control_program_version_s); fll_program_print_help_option_standard(main->output.to, context); @@ -39,8 +37,6 @@ extern "C" { fl_print_format(" Be sure to use the %[%r%r%] parameter to suppress output when using this in scripting.%r", print.to, print.set->notable, f_console_symbol_long_inverse_s, f_console_standard_long_quiet_s, print.set->notable, f_string_eol_s); fl_print_format(" No response is returned on program errors, especially those errors that prevent communicating to the controller.%r", print.to, f_string_eol_s); - f_print_dynamic_raw(setting->line_last, print.to); - f_file_stream_flush(print.to); f_file_stream_unlock(print.to); @@ -48,74 +44,6 @@ extern "C" { } #endif // _di_control_print_help_ -#ifndef _di_control_print_line_first_locked_ - f_status_t control_print_line_first_locked(control_setting_t * const setting, const fl_print_t print) { - - if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; - if (setting->flag & control_main_flag_verify_e) return; - - if (F_status_is_error_not(setting->state.status)) { - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - if (setting->flag & control_main_flag_file_to_e) return F_output_not; - } - - f_print_dynamic_raw(setting->line_first, print.to); - - return F_none; - } -#endif // _di_control_print_line_first_locked_ - -#ifndef _di_control_print_line_first_unlocked_ - f_status_t control_print_line_first_unlocked(control_setting_t * const setting, const fl_print_t print) { - - if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; - if (setting->flag & control_main_flag_verify_e) return; - - if (F_status_is_error_not(setting->state.status)) { - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - if (setting->flag & control_main_flag_file_to_e) return F_output_not; - } - - fll_print_dynamic_raw(setting->line_first, print.to); - - return F_none; - } -#endif // _di_control_print_line_first_unlocked_ - -#ifndef _di_control_print_line_last_locked_ - f_status_t control_print_line_last_locked(control_setting_t * const setting, const fl_print_t print) { - - if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; - if (setting->flag & control_main_flag_verify_e) return; - - if (F_status_is_error_not(setting->state.status)) { - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - if (setting->flag & control_main_flag_file_to_e) return F_output_not; - } - - fll_print_dynamic_raw(setting->line_last, print.to); - - return F_none; - } -#endif // _di_control_print_line_last_locked_ - -#ifndef _di_control_print_line_last_unlocked_ - f_status_t control_print_line_last_unlocked(control_setting_t * const setting, const fl_print_t print) { - - if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; - if (setting->flag & control_main_flag_verify_e) return; - - if (F_status_is_error_not(setting->state.status)) { - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - if (setting->flag & control_main_flag_file_to_e) return F_output_not; - } - - f_print_dynamic_raw(setting->line_last, print.to); - - return F_none; - } -#endif // _di_control_print_line_last_unlocked_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/control/c/print.h b/level_3/control/c/print.h index 1ddaab7..3476d70 100644 --- a/level_3/control/c/print.h +++ b/level_3/control/c/print.h @@ -30,94 +30,6 @@ extern "C" { extern f_status_t control_print_help(control_setting_t * const setting, const fl_print_t print); #endif // _di_control_print_help_control -/** - * Print first new line, unless verbosity says otherwise. - * - * This is generally either the first line in the program or the first line printed before an error message. - * - * This function locks and then unlocks the input stream when printing. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_control_print_line_first_locked_ - extern f_status_t control_print_line_first_locked(control_setting_t * const setting, const fl_print_t print); -#endif // _di_control_print_line_first_locked_ - -/** - * Print first new line, unless verbosity says otherwise. - * - * This is generally either the first line in the program or the first line printed before an error message. - * - * This function neither locks nor unlocks the input stream. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_control_print_line_first_unlocked_ - extern f_status_t control_print_line_first_unlocked(control_setting_t * const setting, const fl_print_t print); -#endif // _di_control_print_line_first_unlocked_ - -/** - * Print last new line when the main is complete, unless verbosity says otherwise. - * - * This is generally the very last line printed in the program. - * - * This function locks and then unlocks the input stream when printing. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_control_print_line_last_locked_ - extern f_status_t control_print_line_last_locked(control_setting_t * const setting, const fl_print_t print); -#endif // _di_control_print_line_last_locked_ - -/** - * Print last new line when the main is complete, unless verbosity says otherwise. - * - * This is generally the very last line printed in the program. - * - * This function neither locks nor unlocks the input stream. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_control_print_line_last_unlocked_ - extern f_status_t control_print_line_last_unlocked(control_setting_t * const setting, const fl_print_t print); -#endif // _di_control_print_line_last_unlocked_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/controller/c/common.c b/level_3/controller/c/common.c index 865c2c0..3f216cf 100644 --- a/level_3/controller/c/common.c +++ b/level_3/controller/c/common.c @@ -622,10 +622,27 @@ extern "C" { setting->state.step_small = controller_allocation_small_d; + // Identify and pocess first/last parameters. + if (main->parameters.array[controller_parameter_line_first_no_e].result & f_console_result_found_e) { + setting->flag -= setting->flag & controller_main_flag_print_first_e; + } + else { + setting->flag |= controller_main_flag_print_first_e; + } + + if (main->parameters.array[controller_parameter_line_last_no_e].result & f_console_result_found_e) { + setting->flag -= setting->flag & controller_main_flag_print_last_e; + } + else { + setting->flag |= controller_main_flag_print_last_e; + } + if (F_status_is_error(setting->state.status)) { - controller_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->state.status), "f_console_parameter_process", fll_error_file_flag_fallback_e); - controller_print_line_last_locked(setting, main->error); + + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error); + } return; } @@ -645,28 +662,16 @@ extern "C" { setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, main); if (F_status_is_error(setting->state.status)) { - controller_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e); - controller_print_line_last_locked(setting, main->error); + + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error); + } return; } } - if (main->parameters.array[controller_parameter_line_first_no_e].result & f_console_result_found_e) { - setting->line_first = f_string_empty_s; - } - else { - setting->line_first = f_string_eol_s; - } - - if (main->parameters.array[controller_parameter_line_last_no_e].result & f_console_result_found_e) { - setting->line_last = f_string_empty_s; - } - else { - setting->line_last = f_string_eol_s; - } - // Identify and prioritize "verbosity" parameters. { uint16_t choices_array[5] = { controller_parameter_verbosity_quiet_e, controller_parameter_verbosity_error_e, controller_parameter_verbosity_verbose_e, controller_parameter_verbosity_debug_e, controller_parameter_verbosity_normal_e }; @@ -678,9 +683,11 @@ extern "C" { setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); if (F_status_is_error(setting->state.status)) { - controller_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e); - controller_print_line_last_locked(setting, main->error); + + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error); + } return; } diff --git a/level_3/controller/c/common.h b/level_3/controller/c/common.h index 79dc8fd..6d8bd95 100644 --- a/level_3/controller/c/common.h +++ b/level_3/controller/c/common.h @@ -473,6 +473,8 @@ extern "C" { * - file_to: Using a specified destination file. * - help: Print help. * - header: Enable printing of headers. + * - print_first: When set, print new line to message output on program begin after loading settings. + * - print_last: When set, print new line to message output on program end. * - separate: Enable printing of separators. * - strip_invalid: Using strip invalid character mode. * - verify: Using verify mode. @@ -486,10 +488,12 @@ extern "C" { controller_main_flag_file_to_e = 0x4, controller_main_flag_header_e = 0x8, controller_main_flag_help_e = 0x10, - controller_main_flag_separate_e = 0x20, - controller_main_flag_strip_invalid_e = 0x40, - controller_main_flag_verify_e = 0x80, - controller_main_flag_version_e = 0x100, + controller_main_flag_print_first_e = 0x20, + controller_main_flag_print_last_e = 0x40, + controller_main_flag_separate_e = 0x80, + controller_main_flag_strip_invalid_e = 0x100, + controller_main_flag_verify_e = 0x200, + controller_main_flag_version_e = 0x400, }; // enum #endif // _di_controller_main_flag_e_ @@ -502,26 +506,18 @@ extern "C" { * flag: Flags passed to the main function. * * state: The state information. - * - * 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. */ #ifndef _di_controller_setting_t_ typedef struct { uint16_t flag; f_state_t state; - - f_string_static_t line_first; - f_string_static_t line_last; } controller_setting_t; #define controller_setting_t_initialize \ { \ controller_main_flag_none_e, \ f_state_t_initialize, \ - f_string_static_t_initialize, \ - f_string_static_t_initialize, \ } #endif // _di_controller_setting_t_ diff --git a/level_3/controller/c/controller.c b/level_3/controller/c/controller.c index 2858a83..6e78908 100644 --- a/level_3/controller/c/controller.c +++ b/level_3/controller/c/controller.c @@ -40,9 +40,11 @@ extern "C" { status = fll_program_parameter_process_context(choices, modes, F_true, main); if (F_status_is_error(status)) { - controller_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e); - controller_print_line_last_locked(setting, main->error); + + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error); + } return; } @@ -59,9 +61,11 @@ extern "C" { status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); if (F_status_is_error(status)) { - controller_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e); - controller_print_line_last_locked(setting, main->error); + + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error); + } return; } @@ -75,13 +79,13 @@ extern "C" { } if (main->parameters.array[controller_parameter_version_e].result & f_console_result_found_e) { - fll_program_print_version(main->message, (setting->line_first.used ? 0x1 : 0x0) | (setting->line_last.used ? 0x2 : 0x0), controller_program_version_s); + fll_program_print_version(main->message, controller_program_version_s); return F_none; } if (main->parameters.array[controller_parameter_copyright_e].result & f_console_result_found_e) { - fll_program_print_copyright(main->message, (setting->line_first.used ? 0x1 : 0x0) | (setting->line_last.used ? 0x2 : 0x0)); + fll_program_print_copyright(main->message); return F_none; } diff --git a/level_3/controller/c/print.c b/level_3/controller/c/print.c index fb5a7c5..f7904f8 100644 --- a/level_3/controller/c/print.c +++ b/level_3/controller/c/print.c @@ -10,8 +10,6 @@ extern "C" { controller_lock_print(print.to, 0); - f_print_dynamic_raw(setting->line_first, print.to); - fll_program_print_help_header(print, *main->program_name_long, controller_program_version_s); fll_program_print_help_option_standard(print.to, context); @@ -43,82 +41,12 @@ extern "C" { fl_print_format(" Specify an empty string for the %[%r%r%] parameter to disable pid file creation for this program.%r", print.to, print.set->notable, f_console_symbol_long_normal_s, controller_long_pid_s, print.set->notable, f_string_eol_s); - f_print_dynamic_raw(setting->line_last, print.to); - controller_unlock_print_flush(print.to, 0); return F_none; } #endif // _di_controller_print_help_ -#ifndef _di_controller_print_line_first_locked_ - f_status_t controller_print_line_first_locked(controller_setting_t * const setting, const fl_print_t print) { - - if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; - if (setting->flag & controller_main_flag_verify_e) return; - - if (F_status_is_error_not(setting->state.status)) { - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - if (setting->flag & controller_main_flag_file_to_e) return F_output_not; - } - - f_print_dynamic_raw(setting->line_first, print.to); - - return F_none; - } -#endif // _di_controller_print_line_first_locked_ - -#ifndef _di_controller_print_line_first_unlocked_ - f_status_t controller_print_line_first_unlocked(controller_setting_t * const setting, const fl_print_t print) { - - if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; - if (setting->flag & controller_main_flag_verify_e) return; - - if (F_status_is_error_not(setting->state.status)) { - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - if (setting->flag & controller_main_flag_file_to_e) return F_output_not; - } - - fll_print_dynamic_raw(setting->line_first, print.to); - - return F_none; - } -#endif // _di_controller_print_line_first_unlocked_ - -#ifndef _di_controller_print_line_last_locked_ - f_status_t controller_print_line_last_locked(controller_setting_t * const setting, const fl_print_t print) { - - if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; - if (setting->flag & controller_main_flag_verify_e) return; - - if (F_status_is_error_not(setting->state.status)) { - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - if (setting->flag & controller_main_flag_file_to_e) return F_output_not; - } - - fll_print_dynamic_raw(setting->line_last, print.to); - - return F_none; - } -#endif // _di_controller_print_line_last_locked_ - -#ifndef _di_controller_print_line_last_unlocked_ - f_status_t controller_print_line_last_unlocked(controller_setting_t * const setting, const fl_print_t print) { - - if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; - if (setting->flag & controller_main_flag_verify_e) return; - - if (F_status_is_error_not(setting->state.status)) { - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - if (setting->flag & controller_main_flag_file_to_e) return F_output_not; - } - - f_print_dynamic_raw(setting->line_last, print.to); - - return F_none; - } -#endif // _di_controller_print_line_last_unlocked_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/controller/c/print.h b/level_3/controller/c/print.h index 0705734..c9142f7 100644 --- a/level_3/controller/c/print.h +++ b/level_3/controller/c/print.h @@ -29,94 +29,6 @@ extern "C" { #ifndef _di_controller_print_help_ extern f_status_t controller_print_help(controller_setting_t * const setting, const fl_print_t print); #endif // _di_controller_print_help_ - -/** - * Print first new line, unless verbosity says otherwise. - * - * This is generally either the first line in the program or the first line printed before an error message. - * - * This function locks and then unlocks the input stream when printing. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_controller_print_line_first_locked_ - extern f_status_t controller_print_line_first_locked(controller_setting_t * const setting, const fl_print_t print); -#endif // _di_controller_print_line_first_locked_ - -/** - * Print first new line, unless verbosity says otherwise. - * - * This is generally either the first line in the program or the first line printed before an error message. - * - * This function neither locks nor unlocks the input stream. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_controller_print_line_first_unlocked_ - extern f_status_t controller_print_line_first_unlocked(controller_setting_t * const setting, const fl_print_t print); -#endif // _di_controller_print_line_first_unlocked_ - -/** - * Print last new line when the main is complete, unless verbosity says otherwise. - * - * This is generally the very last line printed in the program. - * - * This function locks and then unlocks the input stream when printing. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_controller_print_line_last_locked_ - extern f_status_t controller_print_line_last_locked(controller_setting_t * const setting, const fl_print_t print); -#endif // _di_controller_print_line_last_locked_ - -/** - * Print last new line when the main is complete, unless verbosity says otherwise. - * - * This is generally the very last line printed in the program. - * - * This function neither locks nor unlocks the input stream. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_controller_print_line_last_unlocked_ - extern f_status_t controller_print_line_last_unlocked(controller_setting_t * const setting, const fl_print_t print); -#endif // _di_controller_print_line_last_unlocked_ #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/controller/c/thread/private-thread.c b/level_3/controller/c/thread/private-thread.c index e30de08..6c4bebf 100644 --- a/level_3/controller/c/thread/private-thread.c +++ b/level_3/controller/c/thread/private-thread.c @@ -337,7 +337,7 @@ extern "C" { } if (F_status_set_fine(status) == F_interrupt) { - fll_program_print_signal_received(main->warning, setting->line_first, thread.signal); + fll_program_print_signal_received(main->warning, thread.signal); if (main->output.verbosity != f_console_verbosity_quiet_e) { fll_print_dynamic_raw(f_string_eol_s, main->output.to); diff --git a/level_3/fake/c/main/build.c b/level_3/fake/c/main/build.c index c74f4da..16a8ce7 100644 --- a/level_3/fake/c/main/build.c +++ b/level_3/fake/c/main/build.c @@ -7,7 +7,7 @@ extern "C" { #ifndef _di_fake_build_arguments_standard_add_ void fake_build_arguments_standard_add(fake_data_t * const data, fake_build_data_t * const data_build, const bool is_shared, const uint8_t type, f_string_dynamics_t *arguments) { - if (!data || !data->main || !data->setting || !data_build || !arguments) return; + if (!data || !data->program || !data->setting || !data_build || !arguments) return; if (F_status_is_error(data->setting->state.status)) return; { @@ -158,13 +158,13 @@ extern "C" { #ifndef _di_fake_build_copy_ void fake_build_copy(fake_data_t * const data, const f_mode_t mode, const f_string_static_t label, const f_string_static_t source, const f_string_static_t destination, const f_string_statics_t files, const f_string_static_t file_stage, const f_array_length_t perserve_offset) { - if (!data || !data->main || !data->setting) return; + if (!data || !data->program || !data->setting) return; if (data->setting->state.status == F_child) return; if (F_status_is_error(data->setting->state.status) || f_file_exists(file_stage, F_true) == F_true) return; - if (!((++data->main->signal_check) % fake_signal_check_d)) { - if (fll_program_standard_signal_received(data->main)) { - fll_program_print_signal_received(data->main->warning, data->setting->line_first, data->main->signal_received); + if (!((++data->program->signal_check) % fake_signal_check_d)) { + if (fll_program_standard_signal_received(data->program)) { + fll_program_print_signal_received(data->program->warning, data->program->signal_received); data->setting->state.status = F_status_set_error(F_interrupt); @@ -178,14 +178,14 @@ extern "C" { f_string_dynamic_t destination_directory = f_string_dynamic_t_initialize; f_string_static_t buffer = f_string_static_t_initialize; - if (data->main->message.verbosity != f_console_verbosity_quiet_e && data->main->message.verbosity != f_console_verbosity_error_e) { - fll_print_format("%r%[Copying %Q.%]%r", data->main->message.to, f_string_eol_s, data->main->context.set.important, label, data->main->context.set.important, f_string_eol_s); + if (data->program->message.verbosity != f_console_verbosity_quiet_e && data->program->message.verbosity != f_console_verbosity_error_e) { + fll_print_format("%r%[Copying %Q.%]%r", data->program->message.to, f_string_eol_s, data->program->context.set.important, label, data->program->context.set.important, f_string_eol_s); } data->setting->state.status = f_string_dynamic_resize(source.used, &path_source); if (F_status_is_error(data->setting->state.status)) { - fake_print_error(data->setting, data->main->error, macro_fake_f(f_string_dynamic_resize)); + fake_print_error(&data->program->error, macro_fake_f(f_string_dynamic_resize)); f_string_dynamic_resize(0, &path_source); @@ -194,23 +194,23 @@ extern "C" { memcpy(path_source.string, source.string, sizeof(f_char_t) * source.used); - f_directory_recurse_t recurse = f_directory_recurse_t_initialize; + f_directory_recurse_t recurse = f_directory_recurse_t_initialize; // @fixme this is memory leaking on recurse.listing. recurse.verbose = &fake_print_verbose_copy; //recurse.failures = &failures; // @fixme this now needs to be handled by a callback in recurse (recurse.state.handle)., maybe make this a callback on f_directory_recurse_t? recurse.mode = mode; for (f_array_length_t i = 0; i < files.used; ++i) { - if (!((++data->main->signal_check) % fake_signal_check_short_d)) { - if (fll_program_standard_signal_received(data->main)) { - fll_program_print_signal_received(data->main->warning, data->setting->line_first, data->main->signal_received); + if (!((++data->program->signal_check) % fake_signal_check_short_d)) { + if (fll_program_standard_signal_received(data->program)) { + fll_program_print_signal_received(data->program->warning, data->program->signal_received); data->setting->state.status = F_status_set_error(F_interrupt); break; } - data->main->signal_check = 0; + data->program->signal_check = 0; } if (!files.array[i].used) continue; @@ -220,7 +220,7 @@ extern "C" { data->setting->state.status = f_string_dynamic_append_nulless(files.array[i], &path_source); if (F_status_is_error(data->setting->state.status)) { - fake_print_error(data->setting, data->main->error, macro_fake_f(f_string_dynamic_append_nulless)); + fake_print_error(&data->program->error, macro_fake_f(f_string_dynamic_append_nulless)); break; } @@ -233,7 +233,7 @@ extern "C" { data->setting->state.status = f_string_dynamic_append_nulless(destination, &destination_directory); if (F_status_is_error(data->setting->state.status)) { - fake_print_error(data->setting, data->main->error, macro_fake_f(f_string_dynamic_append_nulless)); + fake_print_error(&data->program->error, macro_fake_f(f_string_dynamic_append_nulless)); break; } @@ -241,7 +241,7 @@ extern "C" { data->setting->state.status = f_file_name_base(path_source, &destination_directory); if (F_status_is_error(data->setting->state.status)) { - fake_print_error(data->setting, data->main->error, macro_fake_f(f_file_name_base)); + fake_print_error(&data->program->error, macro_fake_f(f_file_name_base)); break; } @@ -249,20 +249,20 @@ extern "C" { fl_directory_copy(path_source, destination_directory, &recurse); if (F_status_is_error(data->setting->state.status)) { - if (data->main->error.verbosity >= f_console_verbosity_verbose_e) { + if (data->program->error.verbosity >= f_console_verbosity_verbose_e) { /* // @fixme for (f_array_length_t j = 0; j < failures.used; ++j) { - fake_print_error_build_operation_file(data->setting, data->main->error, macro_fake_f(fl_directory_copy), fake_common_file_directory_copy_s, f_file_operation_to_s, path_source, destination_directory, F_true); + fake_print_error_build_operation_file(data->setting, data->program->error, macro_fake_f(fl_directory_copy), fake_common_file_directory_copy_s, f_file_operation_to_s, path_source, destination_directory, F_true); } // for */ if (F_status_set_fine(data->setting->state.status) != F_failure) { - fake_print_error(data->setting, data->main->error, macro_fake_f(fl_directory_copy)); + fake_print_error(&data->program->error, macro_fake_f(fl_directory_copy)); } } - else if (data->main->error.verbosity > f_console_verbosity_quiet_e) { - fake_print_error_build_operation_file(data->setting, data->main->error, macro_fake_f(fl_directory_copy), fake_common_file_directory_copy_s, f_file_operation_to_s, path_source, destination_directory, F_true); + else if (data->program->error.verbosity > f_console_verbosity_quiet_e) { + fake_print_error_build_operation_file(data->setting, data->program->error, macro_fake_f(fl_directory_copy), fake_common_file_directory_copy_s, f_file_operation_to_s, path_source, destination_directory, F_true); } break; @@ -275,7 +275,7 @@ extern "C" { data->setting->state.status = f_string_dynamic_append_nulless(destination, &destination_file); if (F_status_is_error(data->setting->state.status)) { - fake_print_error(data->setting, data->main->error, macro_fake_f(f_string_dynamic_append_nulless)); + fake_print_error(&data->program->error, macro_fake_f(f_string_dynamic_append_nulless)); break; } @@ -284,7 +284,7 @@ extern "C" { data->setting->state.status = f_string_dynamic_append_nulless(destination, &destination_directory); if (F_status_is_error(data->setting->state.status)) { - fake_print_error(data->setting, data->main->error, macro_fake_f(f_string_dynamic_append_nulless)); + fake_print_error(&data->program->error, macro_fake_f(f_string_dynamic_append_nulless)); break; } @@ -295,7 +295,7 @@ extern "C" { data->setting->state.status = f_file_name_directory(buffer, &destination_directory); if (F_status_is_error(data->setting->state.status)) { - fake_print_error(data->setting, data->main->error, macro_fake_f(f_file_name_directory)); + fake_print_error(&data->program->error, macro_fake_f(f_file_name_directory)); break; } @@ -303,7 +303,7 @@ extern "C" { data->setting->state.status = fl_directory_create(destination_directory, F_file_mode_all_rwx_d); if (F_status_is_error(data->setting->state.status)) { - fake_print_error_file(data->setting, data->main->error, macro_fake_f(fl_directory_create), destination_directory, f_file_operation_create_s, fll_error_file_type_directory_e); + fake_print_error_file(data->setting, data->program->error, macro_fake_f(fl_directory_create), destination_directory, f_file_operation_create_s, fll_error_file_type_directory_e); break; } @@ -311,7 +311,7 @@ extern "C" { data->setting->state.status = f_string_append(path_source.string + perserve_offset, path_source.used - perserve_offset, &destination_file); if (F_status_is_error(data->setting->state.status)) { - fake_print_error(data->setting, data->main->error, macro_fake_f(f_string_append)); + fake_print_error(&data->program->error, macro_fake_f(f_string_append)); break; } @@ -320,7 +320,7 @@ extern "C" { data->setting->state.status = f_file_name_base(path_source, &destination_file); if (F_status_is_error(data->setting->state.status)) { - fake_print_error(data->setting, data->main->error, macro_fake_f(f_file_name_base)); + fake_print_error(&data->program->error, macro_fake_f(f_file_name_base)); break; } @@ -329,17 +329,15 @@ extern "C" { data->setting->state.status = f_file_copy(path_source, destination_file, mode, F_file_default_read_size_d, f_file_stat_flag_reference_e); if (F_status_is_error(data->setting->state.status)) { - fake_print_error_build_operation_file(data->setting, data->main->error, macro_fake_f(f_file_copy), f_file_operation_copy_s, f_file_operation_to_s, path_source, destination_file, F_true); + fake_print_error_build_operation_file(data->setting, data->program->error, macro_fake_f(f_file_copy), f_file_operation_copy_s, f_file_operation_to_s, path_source, destination_file, F_true); break; } - if (data->main->error.verbosity >= f_console_verbosity_verbose_e) { - fll_print_format("Copied file '%Q' to '%Q'.%r", data->main->message.to, path_source, destination_file, f_string_eol_s); - } + fake_build_print_verbose_copied_file(data->setting, data->program->message, path_source, destination_file); } else if (F_status_is_error(data->setting->state.status)) { - fake_print_error_file(data->setting, data->main->error, macro_fake_f(f_directory_is), path_source, f_file_operation_create_s, fll_error_file_type_file_e); + fake_print_error_file(data->setting, data->program->error, macro_fake_f(f_directory_is), path_source, f_file_operation_create_s, fll_error_file_type_file_e); break; } @@ -360,8 +358,8 @@ extern "C" { #ifndef _di_fake_build_execute_process_script_ int fake_build_execute_process_script(fake_data_t * const data, fake_build_data_t * const data_build, const f_string_static_t process_script, const f_string_static_t file_stage) { - if (!data || !data->main || !data->setting || !data_build) return 0; - if (data->setting->state.status == F_child) return data->main->child; + if (!data || !data->program || !data->setting || !data_build) return 0; + if (data->setting->state.status == F_child) return data->program->child; if (F_status_is_error(data->setting->state.status) || f_file_exists(file_stage, F_true) == F_true) return 0; if (!process_script.used) return 0; @@ -370,7 +368,7 @@ extern "C" { data->setting->state.status = fll_execute_arguments_add(fake_other_operation_build_s, &arguments); // Ensure console color mode is passed to the scripts so that they can also react to color mode. - if (F_status_is_error_not(data->setting->state.status) && data->main->context.mode != f_color_mode_none_e) { + if (F_status_is_error_not(data->setting->state.status) && data->program->context.mode != f_color_mode_none_e) { f_string_static_t argument = f_string_static_t_initialize; argument.used = f_console_symbol_short_inverse_s.used + f_console_standard_short_dark_s.used; @@ -380,13 +378,13 @@ extern "C" { memcpy(argument_string, f_console_symbol_short_inverse_s.string, sizeof(f_char_t) * f_console_symbol_short_inverse_s.used); - if (data->main->context.mode == f_color_mode_dark_e) { + if (data->program->context.mode == f_color_mode_dark_e) { memcpy(argument_string + f_console_symbol_short_inverse_s.used, f_console_standard_short_dark_s.string, sizeof(f_char_t) * f_console_standard_short_dark_s.used); } - else if (data->main->context.mode == f_color_mode_light_e) { + else if (data->program->context.mode == f_color_mode_light_e) { memcpy(argument_string + f_console_symbol_short_inverse_s.used, f_console_standard_short_light_s.string, sizeof(f_char_t) * f_console_standard_short_light_s.used); } - else if (data->main->context.mode == f_color_mode_not_e) { + else if (data->program->context.mode == f_color_mode_not_e) { memcpy(argument_string + f_console_symbol_short_inverse_s.used, f_console_standard_short_no_color_s.string, sizeof(f_char_t) * f_console_standard_short_no_color_s.used); } @@ -394,7 +392,7 @@ extern "C" { } // Ensure verbosity level is passed to the scripts so that they can also react to requested verbosity. - if (F_status_is_error_not(data->setting->state.status) && data->main->error.verbosity != f_console_verbosity_normal_e) { + if (F_status_is_error_not(data->setting->state.status) && data->program->error.verbosity != f_console_verbosity_normal_e) { f_string_static_t argument = f_string_static_t_initialize; argument.used = f_console_symbol_short_inverse_s.used + f_console_standard_short_quiet_s.used; @@ -404,16 +402,16 @@ extern "C" { memcpy(argument_string, f_console_symbol_short_inverse_s.string, sizeof(f_char_t) * f_console_symbol_short_inverse_s.used); - if (data->main->context.mode == f_console_verbosity_quiet_e) { + if (data->program->context.mode == f_console_verbosity_quiet_e) { memcpy(argument_string + f_console_symbol_short_inverse_s.used, f_console_standard_short_quiet_s.string, sizeof(f_char_t) * f_console_standard_short_quiet_s.used); } - else if (data->main->context.mode == f_console_verbosity_error_e) { + else if (data->program->context.mode == f_console_verbosity_error_e) { memcpy(argument_string + f_console_symbol_short_inverse_s.used, f_console_standard_short_error_s.string, sizeof(f_char_t) * f_console_standard_short_error_s.used); } - else if (data->main->context.mode == f_console_verbosity_verbose_e) { + else if (data->program->context.mode == f_console_verbosity_verbose_e) { memcpy(argument_string + f_console_symbol_short_inverse_s.used, f_console_standard_short_verbose_s.string, sizeof(f_char_t) * f_console_standard_short_verbose_s.used); } - else if (data->main->context.mode == f_console_verbosity_debug_e) { + else if (data->program->context.mode == f_console_verbosity_debug_e) { memcpy(argument_string + f_console_symbol_short_inverse_s.used, f_console_standard_short_debug_s.string, sizeof(f_char_t) * f_console_standard_short_debug_s.used); } @@ -421,7 +419,7 @@ extern "C" { } if (F_status_is_error(data->setting->state.status)) { - fake_print_error(data->setting, data->main->error, macro_fake_f(fll_execute_arguments_add)); + fake_print_error(&data->program->error, macro_fake_f(fll_execute_arguments_add)); f_string_dynamics_resize(0, &arguments); @@ -439,7 +437,7 @@ extern "C" { } // for if (F_status_is_error(data->setting->state.status)) { - fake_print_error(data->setting, data->main->error, macro_fake_f(f_string_dynamic_mash)); + fake_print_error(&data->program->error, macro_fake_f(f_string_dynamic_mash)); f_string_dynamic_resize(0, &defines); f_string_dynamics_resize(0, &arguments); @@ -489,7 +487,7 @@ extern "C" { f_string_dynamic_resize(0, &defines); if (F_status_is_error(data->setting->state.status)) { - fake_print_error(data->setting, data->main->error, macro_fake_f(fll_execute_arguments_add_parameter_set)); + fake_print_error(&data->program->error, macro_fake_f(fll_execute_arguments_add_parameter_set)); f_string_dynamics_resize(0, &arguments); @@ -499,7 +497,7 @@ extern "C" { f_string_dynamic_t path = f_string_dynamic_t_initialize; - if (process_script.string[0] != '/') { + if (process_script.string[0] != f_path_separator_s.string[0]) { data->setting->state.status = f_string_dynamic_append_nulless(data->path_data_build, &path); } @@ -508,7 +506,7 @@ extern "C" { } if (F_status_is_error(data->setting->state.status)) { - fake_print_error(data->setting, data->main->error, macro_fake_f(f_string_dynamic_append_nulless)); + fake_print_error(&data->program->error, macro_fake_f(f_string_dynamic_append_nulless)); f_string_dynamic_resize(0, &path); f_string_dynamics_resize(0, &arguments); @@ -529,18 +527,18 @@ extern "C" { f_string_dynamics_resize(0, &arguments); - if (!((++data->main->signal_check) % fake_signal_check_d) && fll_program_standard_signal_received(data->main)) { - fll_program_print_signal_received(data->main->warning, data->setting->line_first, data->main->signal_received); + if (!((++data->program->signal_check) % fake_signal_check_d) && fll_program_standard_signal_received(data->program)) { + fll_program_print_signal_received(data->program->warning, data->program->signal_received); data->setting->state.status = F_status_set_error(F_interrupt); } else if (data->setting->state.status != F_child) { if (F_status_is_error(data->setting->state.status)) { if (F_status_set_fine(data->setting->state.status) == F_failure) { - fake_print_error_failure_script(data->setting, data->main->error, path); + fake_print_error_failure_script(data->setting, data->program->error, path); } else { - fake_print_error(data->setting, data->main->error, macro_fake_f(fll_execute_program)); + fake_print_error(&data->program->error, macro_fake_f(fll_execute_program)); } } else { @@ -557,7 +555,7 @@ extern "C" { #ifndef _di_fake_build_get_file_name_without_extension_ void fake_build_get_file_name_without_extension(fake_data_t * const data, const f_string_static_t path, f_string_dynamic_t *name) { - if (!data || !data->main || !data->setting) return; + if (!data || !data->program || !data->setting) return; name->used = 0; data->setting->state.status = F_none; @@ -567,7 +565,7 @@ extern "C" { data->setting->state.status = f_file_name_base(path, name); if (F_status_is_error(data->setting->state.status)) { - fake_print_error(data->setting, data->main->error, macro_fake_f(f_file_name_base)); + fake_print_error(&data->program->error, macro_fake_f(f_file_name_base)); return; } @@ -588,7 +586,7 @@ extern "C" { #ifndef _di_fake_build_objects_add_ void fake_build_objects_add(fake_data_t * const data, fake_build_data_t * const data_build, const f_string_static_t *path, const f_string_statics_t *generic, const f_string_statics_t *specific, f_string_dynamics_t *arguments) { - if (!data || !data->main || !data->setting || !data_build || !path || !generic || !specific || !arguments) return; + if (!data || !data->program || !data->setting || !data_build || !path || !generic || !specific || !arguments) return; f_array_length_t i = 0; f_array_length_t j = 0; @@ -627,11 +625,11 @@ extern "C" { #ifndef _di_fake_build_operate_ void fake_build_operate(fake_data_t * const data, const f_string_statics_t * const build_arguments, const bool process_pipe) { - if (!data || !data->main || !data->setting) return; + if (!data || !data->program || !data->setting) return; - if (!((++data->main->signal_check) % fake_signal_check_d)) { - if (fll_program_standard_signal_received(data->main)) { - fll_program_print_signal_received(data->main->warning, data->setting->line_first, data->main->signal_received); + if (!((++data->program->signal_check) % fake_signal_check_d)) { + if (fll_program_standard_signal_received(data->program)) { + fll_program_print_signal_received(data->program->warning, data->program->signal_received); data->setting->state.status = F_status_set_error(F_interrupt); @@ -646,52 +644,12 @@ extern "C" { fake_build_data_t data_build = fake_build_data_t_initialize; fake_build_stage_t stage = fake_build_stage_t_initialize; - macro_f_mode_t_set_default_umask(mode, data->main->umask); + macro_f_mode_t_set_default_umask(mode, data->program->umask); fake_build_load_setting(data, build_arguments, process_pipe, &data_build.setting); if (F_status_is_fine(data->setting->state.status)) { - if (data->main->message.verbosity != f_console_verbosity_quiet_e && data->main->message.verbosity != f_console_verbosity_error_e) { - f_file_stream_lock(data->main->message.to); - - fl_print_format("%[Building%] ", data->main->message.to, data->main->context.set.important, data->main->context.set.important); - fl_print_format("%[%Q%]", data->main->message.to, data->main->context.set.notable, data_build.setting.build_name, data->main->context.set.notable); - fl_print_format("%[ using '%]", data->main->message.to, data->main->context.set.important, data->main->context.set.important); - fl_print_format("%[%Q%]", data->main->message.to, data->main->context.set.notable, data->setting->settings, data->main->context.set.notable); - - fl_print_format("%[' with modes '%]", data->main->message.to, data->main->context.set.important, data->main->context.set.important); - - f_string_statics_t modes_custom = f_string_statics_t_initialize; - modes_custom.used = build_arguments && build_arguments->used > 1 ? build_arguments->used - 1 : 0; - modes_custom.size = 0; - - f_string_static_t modes_custom_array[modes_custom.used]; - modes_custom.array = modes_custom_array; - - for (f_array_length_t i = 0; i < modes_custom.used; ++i) { - modes_custom.array[i] = build_arguments->array[i + 1]; - } // for - - // Custom modes are always used if provided, otherwise if any mode is specified, the entire defaults is replaced. - const f_string_statics_t * const modes = modes_custom.used - ? &modes_custom - : data->setting->modes.used - ? &data->setting->modes - : &data_build.setting.modes_default; - - for (f_array_length_t i = 0; i < modes->used; ) { - - fl_print_format("%[%Q%]", data->main->message.to, data->main->context.set.notable, modes->array[i], data->main->context.set.notable); - - if (++i < modes->used) { - fl_print_format("%[', '%]", data->main->message.to, data->main->context.set.important, data->main->context.set.important); - } - } // for - - fl_print_format("%['.%]%r", data->main->message.to, data->main->context.set.important, data->main->context.set.important, f_string_eol_s); - - f_file_stream_unlock(data->main->message.to); - } + fake_print_building(data->setting, data->program->message, build_arguments, &data_build.setting); } fake_build_load_stage(data, build_arguments && build_arguments->array[0].used ? build_arguments->array[0] : f_string_empty_s, &stage); @@ -700,7 +658,7 @@ extern "C" { fake_build_skeleton(data, &data_build, mode.directory, stage.file_skeleton); - data->main->child = fake_build_execute_process_script(data, &data_build, data_build.setting.process_pre, stage.file_process_pre); + data->program->child = fake_build_execute_process_script(data, &data_build, data_build.setting.process_pre, stage.file_process_pre); fake_build_copy(data, mode, fake_build_documentation_files_s, data->path_data_documentation, data->path_build_documentation, data_build.setting.build_sources_documentation, stage.file_sources_documentation, 0); @@ -767,21 +725,21 @@ extern "C" { } if (data_build.setting.build_shared) { - data->main->child = fake_build_object_shared(data, &data_build, mode, stage.file_object_shared); + data->program->child = fake_build_object_shared(data, &data_build, mode, stage.file_object_shared); - data->main->child = fake_build_library_shared(data, &data_build, mode, stage.file_library_shared); + data->program->child = fake_build_library_shared(data, &data_build, mode, stage.file_library_shared); - data->main->child = fake_build_program_shared(data, &data_build, mode, stage.file_program_shared); + data->program->child = fake_build_program_shared(data, &data_build, mode, stage.file_program_shared); } if (data_build.setting.build_static) { - data->main->child = fake_build_object_static(data, &data_build, mode, stage.file_object_static); + data->program->child = fake_build_object_static(data, &data_build, mode, stage.file_object_static); - data->main->child = fake_build_objects_static(data, &data_build, mode, stage.file_objects_static); + data->program->child = fake_build_objects_static(data, &data_build, mode, stage.file_objects_static); - data->main->child = fake_build_library_static(data, &data_build, mode, stage.file_library_static); + data->program->child = fake_build_library_static(data, &data_build, mode, stage.file_library_static); - data->main->child = fake_build_program_static(data, &data_build, mode, stage.file_program_static); + data->program->child = fake_build_program_static(data, &data_build, mode, stage.file_program_static); } if (data_build.setting.build_script) { @@ -812,7 +770,7 @@ extern "C" { #ifndef _di_fake_build_path_source_length_ void fake_build_path_source_length(fake_data_t * const data, fake_build_data_t * const data_build, f_string_static_t * const setting_path_source, f_string_static_t * const source) { - if (!data || !data->main || !data->setting || !data_build || !setting_path_source || !source) return; + if (!data || !data->program || !data->setting || !data_build || !setting_path_source || !source) return; source->used = 0; @@ -839,7 +797,7 @@ extern "C" { #ifndef _di_fake_build_path_source_string_ void fake_build_path_source_string(fake_data_t * const data, fake_build_data_t * const data_build, f_string_static_t * const setting_path_source, f_string_static_t * const source) { - if (!data || !data->main || !data->setting || !data_build || !setting_path_source || !source) return; + if (!data || !data->program || !data->setting || !data_build || !setting_path_source || !source) return; source->used = 0; @@ -871,7 +829,7 @@ extern "C" { #ifndef _di_fake_build_sources_add_ void fake_build_sources_add(fake_data_t * const data, fake_build_data_t * const data_build, const f_string_statics_t *generic, const f_string_statics_t *specific, f_string_dynamics_t *arguments) { - if (!data || !data->main || !data->setting || !data_build || !generic || !specific || !arguments) return; + if (!data || !data->program || !data->setting || !data_build || !generic || !specific || !arguments) return; f_array_length_t i = 0; f_array_length_t j = 0; @@ -912,7 +870,7 @@ extern "C" { #ifndef _di_fake_build_sources_object_add_ void fake_build_sources_object_add(fake_data_t * const data, fake_build_data_t * const data_build, const f_string_static_t *generic, const f_string_static_t *specific, f_string_dynamics_t *arguments) { - if (!data || !data->main || !data->setting || !data_build || !generic || !specific || !arguments) return; + if (!data || !data->program || !data->setting || !data_build || !generic || !specific || !arguments) return; if (!generic->used && !specific->used) { data->setting->state.status = F_none; @@ -957,12 +915,12 @@ extern "C" { #ifndef _di_fake_build_touch_ void fake_build_touch(fake_data_t * const data, const f_string_dynamic_t file) { - if (!data || !data->main || !data->setting) return; + if (!data || !data->program || !data->setting) return; if (F_status_is_error(data->setting->state.status)) return; - if (!((++data->main->signal_check) % fake_signal_check_d)) { - if (fll_program_standard_signal_received(data->main)) { - fll_program_print_signal_received(data->main->warning, data->setting->line_first, data->main->signal_received); + if (!((++data->program->signal_check) % fake_signal_check_d)) { + if (fll_program_standard_signal_received(data->program)) { + fll_program_print_signal_received(data->program->warning, data->program->signal_received); data->setting->state.status = F_status_set_error(F_interrupt); @@ -972,12 +930,12 @@ extern "C" { f_mode_t mode = f_mode_t_initialize; - macro_f_mode_t_set_default_umask(mode, data->main->umask); + macro_f_mode_t_set_default_umask(mode, data->program->umask); data->setting->state.status = f_file_touch(file, mode.regular, F_false); if (F_status_is_error(data->setting->state.status)) { - fake_print_error_file(data->setting, data->main->error, macro_fake_f(f_file_touch), file, f_file_operation_touch_s, fll_error_file_type_file_e); + fake_print_error_file(data->setting, data->program->error, macro_fake_f(f_file_touch), file, f_file_operation_touch_s, fll_error_file_type_file_e); } else { data->setting->state.status = F_none; diff --git a/level_3/fake/c/main/build/library.c b/level_3/fake/c/main/build/library.c index 91a3fc5..d938a39 100644 --- a/level_3/fake/c/main/build/library.c +++ b/level_3/fake/c/main/build/library.c @@ -7,8 +7,8 @@ extern "C" { #ifndef _di_fake_build_library_script_ int fake_build_library_script(fake_data_t * const data, fake_build_data_t * const data_build, const f_mode_t mode, const f_string_static_t file_stage) { - if (!data || !data->main || !data->setting) return 0; - if (data->setting->state.status == F_child) return data->main->child; + if (!data || !data->program || !data->setting) return 0; + if (data->setting->state.status == F_child) return data->program->child; if (F_status_is_error(data->setting->state.status) || f_file_exists(file_stage, F_true) == F_true) return 0; fake_build_touch(data, file_stage); @@ -20,19 +20,19 @@ extern "C" { #ifndef _di_fake_build_library_shared_ int fake_build_library_shared(fake_data_t * const data, fake_build_data_t * const data_build, const f_mode_t mode, const f_string_static_t file_stage) { - if (!data || !data->main || !data->setting || !data_build) return 0; - if (data->setting->state.status == F_child) return data->main->child; + if (!data || !data->program || !data->setting || !data_build) return 0; + if (data->setting->state.status == F_child) return data->program->child; if (F_status_is_error(data->setting->state.status) || f_file_exists(file_stage, F_true) == F_true) return 0; if (!data_build->setting.build_sources_library.used && !data_build->setting.build_sources_library_shared.used) return 0; - fake_build_print_compile_library_shared(data->setting, data->main->message); + fake_build_print_compile_library_shared(data->setting, data->program->message); f_string_dynamics_t arguments = f_string_dynamics_t_initialize; fake_build_objects_add(data, data_build, &data->path_build_objects_shared, &data_build->setting.build_objects_library, &data_build->setting.build_objects_library_shared, &arguments); if (F_status_is_error(data->setting->state.status)) { - fake_print_error(data->setting, data->main->error, macro_fake_f(fake_build_objects_add)); + fake_print_error(&data->program->error, macro_fake_f(fake_build_objects_add)); f_string_dynamics_resize(0, &arguments); @@ -42,7 +42,7 @@ extern "C" { fake_build_sources_add(data, data_build, &data_build->setting.build_sources_library, &data_build->setting.build_sources_library_shared, &arguments); if (F_status_is_error(data->setting->state.status)) { - fake_print_error(data->setting, data->main->error, macro_fake_f(fake_build_sources_add)); + fake_print_error(&data->program->error, macro_fake_f(fake_build_sources_add)); f_string_dynamics_resize(0, &arguments); @@ -297,7 +297,7 @@ extern "C" { fake_build_arguments_standard_add(data, data_build, F_true, fake_build_type_library_e, &arguments); if (F_status_is_error(data->setting->state.status)) { - fake_print_error(data->setting, data->main->error, macro_fake_f(fll_execute_arguments_add)); + fake_print_error(&data->program->error, macro_fake_f(fll_execute_arguments_add)); f_string_dynamics_resize(0, &arguments); @@ -328,16 +328,16 @@ extern "C" { data->setting->state.status = f_file_link(parameter_file_name_major, parameter_file_path); if (F_status_is_error_not(data->setting->state.status)) { - fake_build_print_linked_file(data->setting, data->main->message, parameter_file_path, parameter_file_name_major); + fake_build_print_linked_file(data->setting, data->program->message, parameter_file_path, parameter_file_name_major); } else { if (F_status_set_fine(data->setting->state.status) == F_file_found) { - fake_print_error_file(data->setting, data->main->error, macro_fake_f(f_file_link), parameter_file_path, f_file_operation_link_s, fll_error_file_type_file_e); + fake_print_error_file(data->setting, data->program->error, macro_fake_f(f_file_link), parameter_file_path, f_file_operation_link_s, fll_error_file_type_file_e); return 0; } - fake_print_error_file(data->setting, data->main->error, macro_fake_f(f_file_link), parameter_file_name_major, f_file_operation_link_s, fll_error_file_type_file_e); + fake_print_error_file(data->setting, data->program->error, macro_fake_f(f_file_link), parameter_file_name_major, f_file_operation_link_s, fll_error_file_type_file_e); return 0; } @@ -359,10 +359,10 @@ extern "C" { data->setting->state.status = f_file_link(parameter_file_name_minor, parameter_file_path); if (F_status_is_error_not(data->setting->state.status)) { - fake_build_print_linked_file(data->setting, data->main->message, parameter_file_path, parameter_file_name_minor); + fake_build_print_linked_file(data->setting, data->program->message, parameter_file_path, parameter_file_name_minor); } else { - fake_print_error_file(data->setting, data->main->error, macro_fake_f(f_file_link), F_status_set_fine(data->setting->state.status) == F_file_found ? parameter_file_path : parameter_file_name_minor, f_file_operation_link_s, fll_error_file_type_file_e); + fake_print_error_file(data->setting, data->program->error, macro_fake_f(f_file_link), F_status_set_fine(data->setting->state.status) == F_file_found ? parameter_file_path : parameter_file_name_minor, f_file_operation_link_s, fll_error_file_type_file_e); return 0; } @@ -382,16 +382,16 @@ extern "C" { data->setting->state.status = f_file_link(parameter_file_name_micro, parameter_file_path); if (F_status_is_error_not(data->setting->state.status)) { - fake_build_print_linked_file(data->setting, data->main->message, parameter_file_path, parameter_file_name_micro); + fake_build_print_linked_file(data->setting, data->program->message, parameter_file_path, parameter_file_name_micro); } else { if (F_status_set_fine(data->setting->state.status) == F_file_found) { - fake_print_error_file(data->setting, data->main->error, macro_fake_f(f_file_link), parameter_file_path, f_file_operation_link_s, fll_error_file_type_file_e); + fake_print_error_file(data->setting, data->program->error, macro_fake_f(f_file_link), parameter_file_path, f_file_operation_link_s, fll_error_file_type_file_e); return 0; } - fake_print_error_file(data->setting, data->main->error, macro_fake_f(f_file_link), parameter_file_name_micro, f_file_operation_link_s, fll_error_file_type_file_e); + fake_print_error_file(data->setting, data->program->error, macro_fake_f(f_file_link), parameter_file_name_micro, f_file_operation_link_s, fll_error_file_type_file_e); return 0; } @@ -410,16 +410,16 @@ extern "C" { data->setting->state.status = f_file_link(parameter_file_name_nano, parameter_file_path); if (F_status_is_error_not(data->setting->state.status)) { - fake_build_print_linked_file(data->setting, data->main->message, parameter_file_path, parameter_file_name_nano); + fake_build_print_linked_file(data->setting, data->program->message, parameter_file_path, parameter_file_name_nano); } else { if (F_status_set_fine(data->setting->state.status) == F_file_found) { - fake_print_error_file(data->setting, data->main->error, macro_fake_f(f_file_link), parameter_file_path, f_file_operation_link_s, fll_error_file_type_file_e); + fake_print_error_file(data->setting, data->program->error, macro_fake_f(f_file_link), parameter_file_path, f_file_operation_link_s, fll_error_file_type_file_e); return 0; } - fake_print_error_file(data->setting, data->main->error, macro_fake_f(f_file_link), parameter_file_name_nano, f_file_operation_link_s, fll_error_file_type_file_e); + fake_print_error_file(data->setting, data->program->error, macro_fake_f(f_file_link), parameter_file_name_nano, f_file_operation_link_s, fll_error_file_type_file_e); return 0; } @@ -436,12 +436,12 @@ extern "C" { #ifndef _di_fake_build_library_static_ int fake_build_library_static(fake_data_t * const data, fake_build_data_t * const data_build, const f_mode_t mode, const f_string_static_t file_stage) { - if (!data || !data->main || !data->setting || !data_build) return 0; - if (data->setting->state.status == F_child) return data->main->child; + if (!data || !data->program || !data->setting || !data_build) return 0; + if (data->setting->state.status == F_child) return data->program->child; if (F_status_is_error(data->setting->state.status) || f_file_exists(file_stage, F_true) == F_true) return 0; if (!data_build->setting.build_sources_library.used && !data_build->setting.build_sources_library_static.used) return 0; - fake_build_print_compile_library_static(data->setting, data->main->message); + fake_build_print_compile_library_static(data->setting, data->program->message); f_string_dynamic_t file_name = f_string_dynamic_t_initialize; f_string_dynamic_t source_path = f_string_dynamic_t_initialize; @@ -500,7 +500,7 @@ extern "C" { fake_build_get_file_name_without_extension(data, sources[i]->array[j], &file_name); if (F_status_is_error(data->setting->state.status)) { - fake_print_error(data->setting, data->main->error, macro_fake_f(fake_build_get_file_name_without_extension)); + fake_print_error(&data->program->error, macro_fake_f(fake_build_get_file_name_without_extension)); break; } @@ -508,7 +508,7 @@ extern "C" { data->setting->state.status = f_file_name_directory(sources[i]->array[j], &source_path); if (F_status_is_error(data->setting->state.status)) { - fake_print_error(data->setting, data->main->error, macro_fake_f(f_file_name_directory)); + fake_print_error(&data->program->error, macro_fake_f(f_file_name_directory)); break; } @@ -517,7 +517,7 @@ extern "C" { data->setting->state.status = f_string_dynamic_prepend(data->path_build_objects, &source_path); if (F_status_is_error(data->setting->state.status)) { - fake_print_error(data->setting, data->main->error, macro_fake_f(f_string_dynamic_prepend)); + fake_print_error(&data->program->error, macro_fake_f(f_string_dynamic_prepend)); break; } @@ -525,7 +525,7 @@ extern "C" { data->setting->state.status = f_string_dynamic_append_assure(f_path_separator_s, &source_path); if (F_status_is_error(data->setting->state.status)) { - fake_print_error(data->setting, data->main->error, macro_fake_f(f_string_dynamic_append_assure)); + fake_print_error(&data->program->error, macro_fake_f(f_string_dynamic_append_assure)); break; } @@ -554,7 +554,7 @@ extern "C" { data->setting->state.status = fll_execute_arguments_add(source, &arguments); if (F_status_is_error(data->setting->state.status)) { - fake_print_error(data->setting, data->main->error, macro_fake_f(fll_execute_arguments_add)); + fake_print_error(&data->program->error, macro_fake_f(fll_execute_arguments_add)); break; } @@ -562,7 +562,7 @@ extern "C" { } // for } - int result = data->main->child; + int result = data->program->child; if (F_status_is_error_not(data->setting->state.status)) { result = fake_execute(data, data_build->environment, data_build->setting.build_indexer, arguments); diff --git a/level_3/fake/c/main/build/load.c b/level_3/fake/c/main/build/load.c index 6311d99..ec55401 100644 --- a/level_3/fake/c/main/build/load.c +++ b/level_3/fake/c/main/build/load.c @@ -7,7 +7,7 @@ extern "C" { #ifndef _di_fake_build_load_environment_ void fake_build_load_environment(fake_data_t * const data, fake_build_data_t * const data_build, f_string_maps_t * const environment) { - if (!data || !data->main || !data->setting || !data_build || !environment) return; + if (!data || !data->program || !data->setting || !data_build || !environment) return; if (F_status_is_error(data->setting->state.status)) return; // Reset the environment. @@ -31,7 +31,7 @@ extern "C" { data->setting->state.status = fl_environment_load_name(variables[i], environment); if (F_status_is_error(data->setting->state.status)) { - fake_print_error(data->setting, data->main->error, macro_fake_f(fl_environment_load_name)); + fake_print_error(&data->program->error, macro_fake_f(fl_environment_load_name)); return; } @@ -40,16 +40,16 @@ extern "C" { if (environment->used + data_build->setting.environment.used > environment->size) { if (environment->used + data_build->setting.environment.used > f_environment_max_length_d) { - if (data->main->error.verbosity > f_console_verbosity_quiet_e) { - f_file_stream_lock(data->main->error.to); + if (data->program->error.verbosity > f_console_verbosity_quiet_e) { + f_file_stream_lock(data->program->error.to); - fl_print_format("%r%[%QThe values for the setting '%]", data->main->error.to, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context); - fl_print_format("%[%r%]", data->main->error.to, data->main->error.notable, fake_build_setting_name_environment_s, data->main->error.notable); - fl_print_format("%[' of setting file '%]", data->main->error.to, data->main->error.context, data->main->error.context); - fl_print_format("%[%r%]", data->main->error.to, data->main->error.notable, fake_build_setting_name_environment_s, data->main->error.notable); - fl_print_format("%[' is too large.%]%r", data->main->error.to, data->main->error.context, data->main->error.context, f_string_eol_s); + fl_print_format("%r%[%QThe values for the setting '%]", data->program->error.to, f_string_eol_s, data->program->error.context, data->program->error.prefix, data->program->error.context); + fl_print_format("%[%r%]", data->program->error.to, data->program->error.notable, fake_build_setting_name_environment_s, data->program->error.notable); + fl_print_format("%[' of setting file '%]", data->program->error.to, data->program->error.context, data->program->error.context); + fl_print_format("%[%r%]", data->program->error.to, data->program->error.notable, fake_build_setting_name_environment_s, data->program->error.notable); + fl_print_format("%[' is too large.%]%r", data->program->error.to, data->program->error.context, data->program->error.context, f_string_eol_s); - f_file_stream_unlock(data->main->error.to); + f_file_stream_unlock(data->program->error.to); } data->setting->state.status = F_status_set_error(F_array_too_large); @@ -61,7 +61,7 @@ extern "C" { data->setting->state.status = fl_environment_load_names(data_build->setting.environment, environment); if (F_status_is_error(data->setting->state.status)) { - fake_print_error(data->setting, data->main->error, macro_fake_f(fl_environment_load_names)); + fake_print_error(&data->program->error, macro_fake_f(fl_environment_load_names)); } else { data->setting->state.status = F_none; @@ -72,12 +72,12 @@ extern "C" { #ifndef _di_fake_build_load_setting_ void fake_build_load_setting(fake_data_t * const data, const f_string_statics_t * const build_arguments, const bool process_pipe, fake_build_setting_t * const setting) { - if (!data || !data->main || !data->setting || !setting) return; + if (!data || !data->program || !data->setting || !setting) return; if (F_status_is_error(data->setting->state.status)) return; - if (!((++data->main->signal_check) % fake_signal_check_d)) { - if (fll_program_standard_signal_received(data->main)) { - fll_program_print_signal_received(data->main->warning, data->setting->line_first, data->main->signal_received); + if (!((++data->program->signal_check) % fake_signal_check_d)) { + if (fll_program_standard_signal_received(data->program)) { + fll_program_print_signal_received(data->program->warning, data->program->signal_received); data->setting->state.status = F_status_set_error(F_interrupt); @@ -150,19 +150,19 @@ extern "C" { f_string_range_t range = macro_f_string_range_t_initialize2(buffer.used); f_fss_delimits_t delimits = f_fss_delimits_t_initialize; - // @todo make sure data->setting->state.custom = (void *) data->main; - //f_state_t state = macro_f_state_t_initialize_1(fake_allocation_large_d, fake_allocation_small_d, F_none, 0, 0, &fll_program_standard_signal_handle, 0, (void *) data->main, 0); + // @todo make sure data->setting->state.custom = (void *) data->program; + //f_state_t state = macro_f_state_t_initialize_1(fake_allocation_large_d, fake_allocation_small_d, F_none, 0, 0, &fll_program_standard_signal_handle, 0, (void *) data->program, 0); fll_fss_extended_read(buffer, &range, &objects, &contents, 0, 0, &delimits, 0, &data->setting->state); if (F_status_is_error(data->setting->state.status)) { - fake_print_error_fss(data->setting, data->main->error, macro_fake_f(fll_fss_extended_read), data->file_data_build_settings, range, F_true); + fake_print_error_fss(data->setting, data->program->error, macro_fake_f(fll_fss_extended_read), data->file_data_build_settings, range, F_true); } else { f_fss_apply_delimit(delimits, &buffer, &data->setting->state); if (F_status_is_error(data->setting->state.status)) { - fake_print_error(data->setting, data->main->error, macro_fake_f(f_fss_apply_delimit)); + fake_print_error(&data->program->error, macro_fake_f(f_fss_apply_delimit)); } else { fake_build_load_setting_process(data, F_true, path_file, modes_custom.used ? &modes_custom : 0, buffer, objects, contents, setting); @@ -193,7 +193,7 @@ extern "C" { for (uint8_t i = 0; i < 1; ++i) { if (!settings[i]->used) { - fake_build_print_error_missing_required_setting(data->setting, data->main->warning, names[i], path_file); + fake_build_print_error_missing_required_setting(data->setting, data->program->warning, names[i], path_file); failed = F_true; } @@ -215,12 +215,12 @@ extern "C" { #ifndef _di_fake_build_load_setting_process_ void fake_build_load_setting_process(fake_data_t * const data, const bool checks, const f_string_static_t path_file, const f_string_statics_t * const modes_custom, const f_string_static_t buffer, const f_fss_objects_t objects, const f_fss_contents_t contents, fake_build_setting_t * const setting) { - if (!data || !data->main || !data->setting || !setting) return; + if (!data || !data->program || !data->setting || !setting) return; if (F_status_is_error(data->setting->state.status) && buffer.used) return; - if (!((++data->main->signal_check) % fake_signal_check_d)) { - if (fll_program_standard_signal_received(data->main)) { - fll_program_print_signal_received(data->main->warning, data->setting->line_first, data->main->signal_received); + if (!((++data->program->signal_check) % fake_signal_check_d)) { + if (fll_program_standard_signal_received(data->program)) { + fll_program_print_signal_received(data->program->warning, data->program->signal_received); data->setting->state.status = F_status_set_error(F_interrupt); @@ -585,7 +585,7 @@ extern "C" { } // for if (found == F_false) { - fake_build_print_error_mode_invalid(data->setting, data->main->warning, modes->array[i], path_file); + fake_build_print_error_mode_invalid(data->setting, data->program->warning, modes->array[i], path_file); error_printed = F_true; data->setting->state.status = F_status_set_error(F_parameter); @@ -669,10 +669,10 @@ extern "C" { if (F_status_is_error(data->setting->state.status)) { if (data->setting->state.status == F_status_set_error(F_string_too_large)) { - fake_build_print_error_setting_too_long(data->setting, data->main->warning, path_file); + fake_build_print_error_setting_too_long(data->setting, data->program->warning, path_file); } else if (!error_printed) { - fake_print_error(data->setting, data->main->error, function); + fake_print_error(&data->program->error, function); } } else { @@ -1112,7 +1112,7 @@ extern "C" { data->setting->state.status = f_string_dynamic_append(settings_single_string_default[i], settings_single_destination[i]); if (F_status_is_error(data->setting->state.status)) { - fake_print_error(data->setting, data->main->error, macro_fake_f(f_string_dynamic_append)); + fake_print_error(&data->program->error, macro_fake_f(f_string_dynamic_append)); break; } @@ -1130,7 +1130,7 @@ extern "C" { else { *settings_single_bool[i] = F_true; - fake_build_print_warning_setting_boolean_may_only_be(data->setting, data->main->warning, settings_single_name[i], path_file, settings_single_version_default_name[i]); + fake_build_print_warning_setting_boolean_may_only_be(data->setting, data->program->warning, settings_single_name[i], path_file, settings_single_version_default_name[i]); } } else if (settings_single_type[i] == 4) { @@ -1146,7 +1146,7 @@ extern "C" { else { *settings_single_language[i] = fake_build_language_c_e; - fake_build_print_warning_setting_language_may_only_be(data->setting, data->main->warning, settings_single_name[i], path_file, fake_build_language_c_s); + fake_build_print_warning_setting_language_may_only_be(data->setting, data->program->warning, settings_single_name[i], path_file, fake_build_language_c_s); } } else if (settings_single_type[i] == 5) { @@ -1165,7 +1165,7 @@ extern "C" { else { *settings_single_version[i] = settings_single_version_default[i]; - fake_build_print_warning_setting_version_may_only_be(data->setting, data->main->warning, settings_single_name[i], path_file, settings_single_version_default_name[i]); + fake_build_print_warning_setting_version_may_only_be(data->setting, data->program->warning, settings_single_name[i], path_file, settings_single_version_default_name[i]); } } else if (settings_single_destination[i]) { @@ -1177,7 +1177,7 @@ extern "C" { data->setting->state.status = f_path_directory_cleanup(settings_single_source[i]->array[settings_single_source[i]->used - 1], settings_single_destination[i]); if (F_status_is_error(data->setting->state.status)) { - fake_print_error(data->setting, data->main->error, macro_fake_f(f_path_directory_cleanup)); + fake_print_error(&data->program->error, macro_fake_f(f_path_directory_cleanup)); break; } @@ -1186,7 +1186,7 @@ extern "C" { data->setting->state.status = f_string_dynamic_increase_by(settings_single_source[i]->array[settings_single_source[i]->used - 1].used + 1, settings_single_destination[i]); if (F_status_is_error(data->setting->state.status)) { - fake_print_error(data->setting, data->main->error, macro_fake_f(f_string_dynamic_increase_by)); + fake_print_error(&data->program->error, macro_fake_f(f_string_dynamic_increase_by)); break; } @@ -1194,7 +1194,7 @@ extern "C" { data->setting->state.status = f_string_dynamic_append_nulless(settings_single_source[i]->array[settings_single_source[i]->used - 1], settings_single_destination[i]); if (F_status_is_error(data->setting->state.status)) { - fake_print_error(data->setting, data->main->error, macro_fake_f(f_string_dynamic_append_nulless)); + fake_print_error(&data->program->error, macro_fake_f(f_string_dynamic_append_nulless)); break; } @@ -1206,13 +1206,13 @@ extern "C" { if (checks && !setting->version_file) { setting->version_file = fake_build_version_micro_e; - fake_build_print_warning_setting_required_default_to(data->setting, data->main->warning, fake_build_setting_name_version_file_s, path_file, fake_build_version_micro_s); + fake_build_print_warning_setting_required_default_to(data->setting, data->program->warning, fake_build_setting_name_version_file_s, path_file, fake_build_version_micro_s); } if (checks && !setting->version_target) { setting->version_target = fake_build_version_major_e; - fake_build_print_warning_setting_required_default_to(data->setting, data->main->warning, fake_build_setting_name_version_target_s, path_file, fake_build_version_major_s); + fake_build_print_warning_setting_required_default_to(data->setting, data->program->warning, fake_build_setting_name_version_target_s, path_file, fake_build_version_major_s); } } } @@ -1263,22 +1263,22 @@ extern "C" { #ifndef _di_fake_build_load_setting_override_ void fake_build_load_setting_override(fake_data_t * const data, fake_build_setting_t * const setting) { - if (!data || !data->main || !data->setting || !setting) return; + if (!data || !data->program || !data->setting || !setting) return; if (F_status_is_error(data->setting->state.status)) return; - if (data->main->parameters.array[fake_parameter_sources_e].result & f_console_result_value_e && setting->path_sources.used) { + if (data->program->parameters.array[fake_parameter_sources_e].result & f_console_result_value_e && setting->path_sources.used) { data->setting->state.status = f_string_dynamic_append_assure(f_path_separator_s, &setting->path_sources); if (F_status_is_error(data->setting->state.status)) { - fake_print_error(data->setting, data->main->error, macro_fake_f(f_string_dynamic_append_assure)); + fake_print_error(&data->program->error, macro_fake_f(f_string_dynamic_append_assure)); return; } } - 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) { + if (data->program->parameters.array[fake_parameter_shared_disable_e].result & f_console_result_found_e) { + if (data->program->parameters.array[fake_parameter_shared_enable_e].result & f_console_result_found_e) { + if (data->program->parameters.array[fake_parameter_shared_enable_e].location > data->program->parameters.array[fake_parameter_shared_disable_e].location) { setting->build_shared = F_true; setting->search_shared = F_true; } @@ -1287,21 +1287,21 @@ extern "C" { setting->search_shared = F_false; } - fake_build_print_warning_parameters_contradict(data->setting, data->main->warning, f_console_symbol_long_normal_s, fake_long_shared_disabled_s, f_console_symbol_long_normal_s, fake_long_shared_enabled_s, f_console_symbol_long_normal_s, setting->build_shared ? fake_long_shared_enabled_s : fake_long_shared_disabled_s); + fake_build_print_warning_parameters_contradict(data->setting, data->program->warning, f_console_symbol_long_normal_s, fake_long_shared_disabled_s, f_console_symbol_long_normal_s, fake_long_shared_enabled_s, f_console_symbol_long_normal_s, setting->build_shared ? fake_long_shared_enabled_s : fake_long_shared_disabled_s); } else { setting->build_shared = F_false; setting->search_shared = F_false; } } - else if (data->main->parameters.array[fake_parameter_shared_enable_e].result & f_console_result_found_e) { + else if (data->program->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_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) { + if (data->program->parameters.array[fake_parameter_static_disable_e].result & f_console_result_found_e) { + if (data->program->parameters.array[fake_parameter_static_enable_e].result & f_console_result_found_e) { + if (data->program->parameters.array[fake_parameter_static_enable_e].location > data->program->parameters.array[fake_parameter_static_disable_e].location) { setting->build_static = F_true; setting->search_static = F_true; } @@ -1310,21 +1310,21 @@ extern "C" { setting->search_static = F_false; } - fake_build_print_warning_parameters_contradict(data->setting, data->main->warning, f_console_symbol_long_normal_s, fake_long_static_disabled_s, f_console_symbol_long_normal_s, fake_long_static_enabled_s, f_console_symbol_long_normal_s, setting->build_static ? fake_long_static_enabled_s : fake_long_static_disabled_s); + fake_build_print_warning_parameters_contradict(data->setting, data->program->warning, f_console_symbol_long_normal_s, fake_long_static_disabled_s, f_console_symbol_long_normal_s, fake_long_static_enabled_s, f_console_symbol_long_normal_s, setting->build_static ? fake_long_static_enabled_s : fake_long_static_disabled_s); } else { setting->build_static = F_false; setting->search_static = F_false; } } - else if (data->main->parameters.array[fake_parameter_static_enable_e].result & f_console_result_found_e) { + else if (data->program->parameters.array[fake_parameter_static_enable_e].result & f_console_result_found_e) { setting->build_static = F_true; setting->search_static = F_true; } if (setting->build_language == fake_build_language_c_e || setting->build_language == fake_build_language_cpp_e) { if (setting->build_shared == F_false && setting->build_static == F_false) { - fake_build_print_warning_setting_both_cannot_when_language(data->setting, data->main->warning, fake_build_setting_name_build_shared_s, fake_build_setting_name_build_static_s, setting->build_language == fake_build_language_c_e ? fake_build_language_c_s : fake_build_language_cpp_s); + fake_build_print_warning_setting_both_cannot_when_language(data->setting, data->program->warning, fake_build_setting_name_build_shared_s, fake_build_setting_name_build_static_s, setting->build_language == fake_build_language_c_e ? fake_build_language_c_s : fake_build_language_cpp_s); data->setting->state.status = F_status_set_error(F_failure); } @@ -1335,12 +1335,12 @@ extern "C" { #ifndef _di_fake_build_load_stage_ void fake_build_load_stage(fake_data_t * const data, const f_string_static_t settings_file, fake_build_stage_t * const stage) { - if (!data || !data->main || !data->setting || !stage) return; + if (!data || !data->program || !data->setting || !stage) return; if (F_status_is_error(data->setting->state.status)) return; - if (!((++data->main->signal_check) % fake_signal_check_d)) { - if (fll_program_standard_signal_received(data->main)) { - fll_program_print_signal_received(data->main->warning, data->setting->line_first, data->main->signal_received); + if (!((++data->program->signal_check) % fake_signal_check_d)) { + if (fll_program_standard_signal_received(data->program)) { + fll_program_print_signal_received(data->program->warning, data->program->signal_received); data->setting->state.status = F_status_set_error(F_interrupt); @@ -1400,7 +1400,7 @@ extern "C" { } if (F_status_is_error(data->setting->state.status)) { - fake_print_error(data->setting, data->main->error, macro_fake_f(f_file_name_base)); + fake_print_error(&data->program->error, macro_fake_f(f_file_name_base)); return; } @@ -1434,7 +1434,7 @@ extern "C" { } if (F_status_is_error(data->setting->state.status)) { - fake_print_error(data->setting, data->main->error, macro_fake_f(f_string_dynamic_append_nulless)); + fake_print_error(&data->program->error, macro_fake_f(f_string_dynamic_append_nulless)); break; } diff --git a/level_3/fake/c/main/build/object.c b/level_3/fake/c/main/build/object.c index 85fb308..80293fd 100644 --- a/level_3/fake/c/main/build/object.c +++ b/level_3/fake/c/main/build/object.c @@ -7,8 +7,8 @@ extern "C" { #ifndef _di_fake_build_object_script_ int fake_build_object_script(fake_data_t * const data, fake_build_data_t * const data_build, const f_mode_t mode, const f_string_static_t file_stage) { - if (!data || !data->main || !data->setting || !data_build) return 0; - if (data->setting->state.status == F_child) return data->main->child; + if (!data || !data->program || !data->setting || !data_build) return 0; + if (data->setting->state.status == F_child) return data->program->child; if (F_status_is_error(data->setting->state.status) || f_file_exists(file_stage, F_true) == F_true) return 0; fake_build_touch(data, file_stage); @@ -20,19 +20,19 @@ extern "C" { #ifndef _di_fake_build_object_shared_ int fake_build_object_shared(fake_data_t * const data, fake_build_data_t * const data_build, const f_mode_t mode, const f_string_static_t file_stage) { - if (!data || !data->main || !data->setting || !data_build) return 0; - if (data->setting->state.status == F_child) return data->main->child; + if (!data || !data->program || !data->setting || !data_build) return 0; + if (data->setting->state.status == F_child) return data->program->child; if (F_status_is_error(data->setting->state.status) || f_file_exists(file_stage, F_true) == F_true) return 0; if (!data_build->setting.build_sources_object.used && !data_build->setting.build_sources_object_shared.used) return 0; - fake_build_print_compile_object_shared(data->setting, data->main->message); + fake_build_print_compile_object_shared(data->setting, data->program->message); f_string_dynamics_t arguments = f_string_dynamics_t_initialize; fake_build_sources_object_add(data, data_build, &data_build->setting.build_sources_object, &data_build->setting.build_sources_object_shared, &arguments); if (F_status_is_error(data->setting->state.status)) { - fake_print_error(data->setting, data->main->error, macro_fake_f(fake_build_sources_object_add)); + fake_print_error(&data->program->error, macro_fake_f(fake_build_sources_object_add)); f_string_dynamics_resize(0, &arguments); @@ -69,7 +69,7 @@ extern "C" { fake_build_arguments_standard_add(data, data_build, F_true, fake_build_type_object_e, &arguments); if (F_status_is_error(data->setting->state.status)) { - fake_print_error(data->setting, data->main->error, macro_fake_f(fake_build_arguments_standard_add)); + fake_print_error(&data->program->error, macro_fake_f(fake_build_arguments_standard_add)); macro_f_string_dynamics_t_delete_simple(arguments); @@ -91,19 +91,19 @@ extern "C" { #ifndef _di_fake_build_object_static_ int fake_build_object_static(fake_data_t * const data, fake_build_data_t * const data_build, const f_mode_t mode, const f_string_static_t file_stage) { - if (!data || !data->main || !data->setting || !data_build) return 0; - if (data->setting->state.status == F_child) return data->main->child; + if (!data || !data->program || !data->setting || !data_build) return 0; + if (data->setting->state.status == F_child) return data->program->child; if (F_status_is_error(data->setting->state.status) || f_file_exists(file_stage, F_true) == F_true) return 0; if (!data_build->setting.build_sources_object.used && !data_build->setting.build_sources_object_static.used) return 0; - fake_build_print_compile_object_static(data->setting, data->main->message); + fake_build_print_compile_object_static(data->setting, data->program->message); f_string_dynamics_t arguments = f_string_dynamics_t_initialize; fake_build_sources_object_add(data, data_build, &data_build->setting.build_sources_object, &data_build->setting.build_sources_object_static, &arguments); if (F_status_is_error(data->setting->state.status)) { - fake_print_error(data->setting, data->main->error, macro_fake_f(fake_build_sources_object_add)); + fake_print_error(&data->program->error, macro_fake_f(fake_build_sources_object_add)); f_string_dynamics_resize(0, &arguments); @@ -140,7 +140,7 @@ extern "C" { fake_build_arguments_standard_add(data, data_build, F_false, fake_build_type_object_e, &arguments); if (F_status_is_error(data->setting->state.status)) { - fake_print_error(data->setting, data->main->error, macro_fake_f(fake_build_arguments_standard_add)); + fake_print_error(&data->program->error, macro_fake_f(fake_build_arguments_standard_add)); macro_f_string_dynamics_t_delete_simple(arguments); diff --git a/level_3/fake/c/main/build/objects.c b/level_3/fake/c/main/build/objects.c index 868b26e..c748fb0 100644 --- a/level_3/fake/c/main/build/objects.c +++ b/level_3/fake/c/main/build/objects.c @@ -7,19 +7,19 @@ extern "C" { #ifndef _di_fake_build_objects_static_ int fake_build_objects_static(fake_data_t * const data, fake_build_data_t * const data_build, const f_mode_t mode, const f_string_static_t file_stage) { - if (!data || !data->main || !data->setting) return 0; - if (data->setting->state.status == F_child) return data->main->child; + if (!data || !data->program || !data->setting) return 0; + if (data->setting->state.status == F_child) return data->program->child; if (F_status_is_error(data->setting->state.status) || f_file_exists(file_stage, F_true) == F_true) return 0; if (!data_build->setting.build_sources_library.used) return 0; - fake_build_print_compile_object_static_library(data->setting, data->main->message); + fake_build_print_compile_object_static_library(data->setting, data->program->message); f_string_dynamics_t arguments = f_string_dynamics_t_initialize; fake_build_objects_add(data, data_build, &data->path_build_objects_static, &data_build->setting.build_objects_library, &data_build->setting.build_objects_library_static, &arguments); if (F_status_is_error(data->setting->state.status)) { - fake_print_error(data->setting, data->main->error, macro_fake_f(fake_build_objects_add)); + fake_print_error(&data->program->error, macro_fake_f(fake_build_objects_add)); f_string_dynamics_resize(0, &arguments); @@ -31,7 +31,7 @@ extern "C" { f_string_static_t destination = f_string_static_t_initialize; f_string_static_t source = f_string_static_t_initialize; - int result = data->main->child; + int result = data->program->child; const f_string_dynamics_t *sources[2] = { &data_build->setting.build_sources_library, @@ -64,7 +64,7 @@ extern "C" { fake_build_get_file_name_without_extension(data, sources[i]->array[j], &file_name); if (F_status_is_error(data->setting->state.status)) { - fake_print_error(data->setting, data->main->error, macro_fake_f(fake_build_get_file_name_without_extension)); + fake_print_error(&data->program->error, macro_fake_f(fake_build_get_file_name_without_extension)); break; } @@ -72,7 +72,7 @@ extern "C" { data->setting->state.status = f_file_name_directory(sources[i]->array[j], &destination_path); if (F_status_is_error(data->setting->state.status)) { - fake_print_error(data->setting, data->main->error, macro_fake_f(f_file_name_directory)); + fake_print_error(&data->program->error, macro_fake_f(f_file_name_directory)); break; } @@ -81,7 +81,7 @@ extern "C" { data->setting->state.status = f_string_dynamic_prepend(data->path_build_objects, &destination_path); if (F_status_is_error(data->setting->state.status)) { - fake_print_error(data->setting, data->main->error, macro_fake_f(f_string_dynamic_prepend)); + fake_print_error(&data->program->error, macro_fake_f(f_string_dynamic_prepend)); break; } @@ -89,7 +89,7 @@ extern "C" { data->setting->state.status = f_string_dynamic_append_assure(f_path_separator_s, &destination_path); if (F_status_is_error(data->setting->state.status)) { - fake_print_error(data->setting, data->main->error, macro_fake_f(f_string_dynamic_append_assure)); + fake_print_error(&data->program->error, macro_fake_f(f_string_dynamic_append_assure)); break; } @@ -97,7 +97,7 @@ extern "C" { data->setting->state.status = f_directory_exists(destination_path); if (data->setting->state.status == F_false) { - fake_build_print_error_exist_not_directory(data->setting, data->main->message, destination_path); + fake_build_print_error_exist_not_directory(data->setting, data->program->message, destination_path); data->setting->state.status = F_status_set_error(F_failure); @@ -109,20 +109,20 @@ extern "C" { if (F_status_is_error(data->setting->state.status)) { if (F_status_set_fine(data->setting->state.status) == F_file_found_not) { - fake_build_print_error_cannot_create_due_to_parent(data->setting, data->main->message, destination_path); + fake_build_print_error_cannot_create_due_to_parent(data->setting, data->program->message, destination_path); } else { - fake_print_error_file(data->setting, data->main->error, macro_fake_f(f_directory_create), destination_path, f_file_operation_create_s, fll_error_file_type_directory_e); + fake_print_error_file(data->setting, data->program->error, macro_fake_f(f_directory_create), destination_path, f_file_operation_create_s, fll_error_file_type_directory_e); } break; } - fake_build_print_verbose_create_directory(data->setting, data->main->message, destination_path); + fake_build_print_verbose_create_directory(data->setting, data->program->message, destination_path); } if (F_status_is_error(data->setting->state.status)) { - fake_print_error_file(data->setting, data->main->error, macro_fake_f(f_directory_exists), destination_path, f_file_operation_create_s, fll_error_file_type_directory_e); + fake_print_error_file(data->setting, data->program->error, macro_fake_f(f_directory_exists), destination_path, f_file_operation_create_s, fll_error_file_type_directory_e); break; } @@ -167,7 +167,7 @@ extern "C" { fake_build_arguments_standard_add(data, data_build, F_false, fake_build_type_library_e, &arguments); if (F_status_is_error(data->setting->state.status)) { - fake_print_error(data->setting, data->main->error, macro_fake_f(fll_execute_arguments_add)); + fake_print_error(&data->program->error, macro_fake_f(fll_execute_arguments_add)); break; } diff --git a/level_3/fake/c/main/build/print.c b/level_3/fake/c/main/build/print.c index 8be2a24..75d3c93 100644 --- a/level_3/fake/c/main/build/print.c +++ b/level_3/fake/c/main/build/print.c @@ -8,7 +8,7 @@ extern "C" { f_status_t fake_build_print_linked_file(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t from, const f_string_static_t to) { if (!setting) return F_status_set_error(F_output_not); - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; + if (print.verbosity < f_console_verbosity_verbose_e) return F_output_not; // @fixme this function needs to be a "verbose" function rather than a "normal" print function. fake_print_wrapped_variables(setting, print, "Linked file ", from, " to ", to, 0); @@ -22,6 +22,7 @@ extern "C" { if (!setting) return F_status_set_error(F_output_not); if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; + fll_print_dynamic_raw(f_string_eol_s, print.to); fake_print_context_important_simple(setting, print, "Creating base build directories"); return F_none; diff --git a/level_3/fake/c/main/build/print/compile.c b/level_3/fake/c/main/build/print/compile.c index d502df6..6bc9cdf 100644 --- a/level_3/fake/c/main/build/print/compile.c +++ b/level_3/fake/c/main/build/print/compile.c @@ -10,6 +10,7 @@ extern "C" { if (!setting) return F_status_set_error(F_output_not); if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; + fll_print_dynamic_raw(f_string_eol_s, print.to); fake_print_context_important_simple(setting, print, "Compiling shared library"); return F_none; @@ -22,6 +23,7 @@ extern "C" { if (!setting) return F_status_set_error(F_output_not); if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; + fll_print_dynamic_raw(f_string_eol_s, print.to); fake_print_context_important_simple(setting, print, "Compiling static library"); return F_none; @@ -34,6 +36,7 @@ extern "C" { if (!setting) return F_status_set_error(F_output_not); if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; + fll_print_dynamic_raw(f_string_eol_s, print.to); fake_print_context_important_simple(setting, print, "Compiling shared object"); return F_none; @@ -46,6 +49,7 @@ extern "C" { if (!setting) return F_status_set_error(F_output_not); if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; + fll_print_dynamic_raw(f_string_eol_s, print.to); fake_print_context_important_simple(setting, print, "Compiling static object"); return F_none; @@ -58,6 +62,7 @@ extern "C" { if (!setting) return F_status_set_error(F_output_not); if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; + fll_print_dynamic_raw(f_string_eol_s, print.to); fake_print_context_important_simple(setting, print, "Compiling objects for static library"); return F_none; @@ -70,6 +75,7 @@ extern "C" { if (!setting) return F_status_set_error(F_output_not); if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; + fll_print_dynamic_raw(f_string_eol_s, print.to); fake_print_context_important_simple(setting, print, "Compiling shared program"); return F_none; @@ -82,6 +88,7 @@ extern "C" { if (!setting) return F_status_set_error(F_output_not); if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; + fll_print_dynamic_raw(f_string_eol_s, print.to); fake_print_context_important_simple(setting, print, "Compiling static program"); return F_none; diff --git a/level_3/fake/c/main/build/print/verbose.c b/level_3/fake/c/main/build/print/verbose.c index 7040616..8fa480b 100644 --- a/level_3/fake/c/main/build/print/verbose.c +++ b/level_3/fake/c/main/build/print/verbose.c @@ -4,6 +4,18 @@ extern "C" { #endif +#ifndef _di_fake_build_print_verbose_copied_file_ + f_status_t fake_build_print_verbose_copied_file(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t source, const f_string_static_t destination) { + + if (!setting) return F_status_set_error(F_output_not); + if (print.verbosity < f_console_verbosity_verbose_e) return F_output_not; + + fake_print_wrapped_variables(setting, print, "Copied file ", source, " to ", destination, f_string_empty_s.string); + + return F_none; + } +#endif // _di_fake_build_print_verbose_copied_file_ + #ifndef _di_fake_build_print_verbose_create_directory_ f_status_t fake_build_print_verbose_create_directory(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t directory) { diff --git a/level_3/fake/c/main/build/print/verbose.h b/level_3/fake/c/main/build/print/verbose.h index 25856a6..4b1480a 100644 --- a/level_3/fake/c/main/build/print/verbose.h +++ b/level_3/fake/c/main/build/print/verbose.h @@ -17,7 +17,33 @@ extern "C" { #endif /** - * Print verbose message about creating a directory. + * Print verbose message about copying a file. + * + * @param setting + * The main program settings. + * + * This does not alter setting.state.status. + * @param print + * Designates the how and where to print. + * @param source + * The source file path. + * @param destination + * The destination file path. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + * + * F_output_not (with error bit) if setting is NULL. + * + * @see fake_print_wrapped_variables() + */ +#ifndef _di_fake_build_print_verbose_copied_file_ + extern f_status_t fake_build_print_verbose_copied_file(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t source, const f_string_static_t destination); +#endif // _di_fake_build_print_verbose_create_directory_ + +/** + * Print verbose message about _di_fake_build_print_verbose_copied_file_ a directory. * * @param setting * The main program settings. diff --git a/level_3/fake/c/main/build/program.c b/level_3/fake/c/main/build/program.c index 212bf7c..f96782a 100644 --- a/level_3/fake/c/main/build/program.c +++ b/level_3/fake/c/main/build/program.c @@ -7,8 +7,8 @@ extern "C" { #ifndef _di_fake_build_program_script_ int fake_build_program_script(fake_data_t * const data, fake_build_data_t * const data_build, const f_mode_t mode, const f_string_static_t file_stage) { - if (!data || !data->main || !data->setting || !data_build) return 0; - if (data->setting->state.status == F_child) return data->main->child; + if (!data || !data->program || !data->setting || !data_build) return 0; + if (data->setting->state.status == F_child) return data->program->child; if (F_status_is_error(data->setting->state.status) || f_file_exists(file_stage, F_true) == F_true) return 0; fake_build_touch(data, file_stage); @@ -20,19 +20,19 @@ extern "C" { #ifndef _di_fake_build_program_shared_ int fake_build_program_shared(fake_data_t * const data, fake_build_data_t * const data_build, const f_mode_t mode, const f_string_static_t file_stage) { - if (!data || !data->main || !data->setting || !data_build) return 0; - if (data->setting->state.status == F_child) return data->main->child; + if (!data || !data->program || !data->setting || !data_build) return 0; + if (data->setting->state.status == F_child) return data->program->child; if (F_status_is_error(data->setting->state.status) || f_file_exists(file_stage, F_true) == F_true) return 0; if (!data_build->setting.build_sources_program.used && !data_build->setting.build_sources_program_shared.used) return 0; - fake_build_print_compile_program_shared(data->setting, data->main->message); + fake_build_print_compile_program_shared(data->setting, data->program->message); f_string_dynamics_t arguments = f_string_dynamics_t_initialize; fake_build_objects_add(data, data_build, &data->path_build_objects_shared, &data_build->setting.build_objects_program, &data_build->setting.build_objects_program_shared, &arguments); if (F_status_is_error(data->setting->state.status)) { - fake_print_error(data->setting, data->main->error, macro_fake_f(fake_build_objects_add)); + fake_print_error(&data->program->error, macro_fake_f(fake_build_objects_add)); f_string_dynamics_resize(0, &arguments); @@ -42,7 +42,7 @@ extern "C" { fake_build_sources_add(data, data_build, &data_build->setting.build_sources_program, &data_build->setting.build_sources_program_shared, &arguments); if (F_status_is_error(data->setting->state.status)) { - fake_print_error(data->setting, data->main->error, macro_fake_f(fake_build_sources_add)); + fake_print_error(&data->program->error, macro_fake_f(fake_build_sources_add)); f_string_dynamics_resize(0, &arguments); @@ -92,7 +92,7 @@ extern "C" { fake_build_arguments_standard_add(data, data_build, F_true, fake_build_type_program_e, &arguments); if (F_status_is_error(data->setting->state.status)) { - fake_print_error(data->setting, data->main->error, macro_fake_f(fll_execute_arguments_add)); + fake_print_error(&data->program->error, macro_fake_f(fll_execute_arguments_add)); macro_f_string_dynamics_t_delete_simple(arguments); @@ -114,19 +114,19 @@ extern "C" { #ifndef _di_fake_build_program_static_ int fake_build_program_static(fake_data_t * const data, fake_build_data_t * const data_build, const f_mode_t mode, const f_string_static_t file_stage) { - if (!data || !data->main || !data->setting || !data_build) return 0; - if (data->setting->state.status == F_child) return data->main->child; + if (!data || !data->program || !data->setting || !data_build) return 0; + if (data->setting->state.status == F_child) return data->program->child; if (F_status_is_error(data->setting->state.status) || f_file_exists(file_stage, F_true) == F_true) return 0; if (!data_build->setting.build_sources_program.used && !data_build->setting.build_sources_program_static.used) return 0; - fake_build_print_compile_program_static(data->setting, data->main->message); + fake_build_print_compile_program_static(data->setting, data->program->message); f_string_dynamics_t arguments = f_string_dynamics_t_initialize; fake_build_objects_add(data, data_build, &data->path_build_objects_static, &data_build->setting.build_objects_program, &data_build->setting.build_objects_program_static, &arguments); if (F_status_is_error(data->setting->state.status)) { - fake_print_error(data->setting, data->main->error, macro_fake_f(fake_build_objects_add)); + fake_print_error(&data->program->error, macro_fake_f(fake_build_objects_add)); f_string_dynamics_resize(0, &arguments); @@ -136,7 +136,7 @@ extern "C" { fake_build_sources_add(data, data_build, &data_build->setting.build_sources_program, &data_build->setting.build_sources_program_static, &arguments); if (F_status_is_error(data->setting->state.status)) { - fake_print_error(data->setting, data->main->error, macro_fake_f(fake_build_sources_add)); + fake_print_error(&data->program->error, macro_fake_f(fake_build_sources_add)); f_string_dynamics_resize(0, &arguments); @@ -196,7 +196,7 @@ extern "C" { fake_build_arguments_standard_add(data, data_build, F_false, fake_build_type_program_e, &arguments); if (F_status_is_error(data->setting->state.status)) { - fake_print_error(data->setting, data->main->error, macro_fake_f(fll_execute_arguments_add)); + fake_print_error(&data->program->error, macro_fake_f(fll_execute_arguments_add)); macro_f_string_dynamics_t_delete_simple(arguments); diff --git a/level_3/fake/c/main/build/skeleton.c b/level_3/fake/c/main/build/skeleton.c index 7531876..fbf8a65 100644 --- a/level_3/fake/c/main/build/skeleton.c +++ b/level_3/fake/c/main/build/skeleton.c @@ -7,7 +7,7 @@ extern "C" { #ifndef _di_fake_build_skeleton_ void fake_build_skeleton(fake_data_t * const data, fake_build_data_t * const data_build, const mode_t mode, const f_string_static_t file_stage) { - if (!data || !data->main || !data->setting || !data_build) return; + if (!data || !data->program || !data->setting || !data_build) return; if (F_status_is_error(data->setting->state.status) || data->setting->state.status == F_child) return; if (f_file_exists(file_stage, F_true) == F_true) return; @@ -49,7 +49,7 @@ extern "C" { path_headers, }; - fake_build_print_skeleton_build_base(data->setting, data->main->message); + fake_build_print_skeleton_build_base(data->setting, data->program->message); bool created = F_false; f_array_length_t j = 0; @@ -64,9 +64,9 @@ extern "C" { if (f_path_separator_s.used && directorys[i].string[j] != f_path_separator_s.string[0]) continue; - if (!((++data->main->signal_check) % fake_signal_check_d)) { - if (fll_program_standard_signal_received(data->main)) { - fll_program_print_signal_received(data->main->warning, data->setting->line_first, data->main->signal_received); + if (!((++data->program->signal_check) % fake_signal_check_d)) { + if (fll_program_standard_signal_received(data->program)) { + fll_program_print_signal_received(data->program->warning, data->program->signal_received); data->setting->state.status = F_status_set_error(F_interrupt); @@ -114,13 +114,13 @@ extern "C" { continue; } - fake_print_error_file(data->setting, data->main->error, macro_fake_f(f_directory_create), directorys[i], f_file_operation_create_s, fll_error_file_type_directory_e); + fake_print_error_file(data->setting, data->program->error, macro_fake_f(f_directory_create), directorys[i], f_file_operation_create_s, fll_error_file_type_directory_e); return; } if (created) { - fake_build_print_verbose_create_directory(data->setting, data->main->message, directorys[i]); + fake_build_print_verbose_create_directory(data->setting, data->program->message, directorys[i]); } } // for diff --git a/level_3/fake/c/main/clean.c b/level_3/fake/c/main/clean.c index 48eccb9..22c66f5 100644 --- a/level_3/fake/c/main/clean.c +++ b/level_3/fake/c/main/clean.c @@ -7,21 +7,21 @@ extern "C" { #ifndef _di_fake_clean_operate_ void fake_clean_operate(fake_data_t * const data) { - if (!data || !data->main || !data->setting) return; + if (!data || !data->program || !data->setting) return; - if (data->main->message.verbosity != f_console_verbosity_quiet_e && data->main->message.verbosity != f_console_verbosity_error_e) { - f_file_stream_lock(data->main->message.to); + if (data->program->message.verbosity != f_console_verbosity_quiet_e && data->program->message.verbosity != f_console_verbosity_error_e) { + f_file_stream_lock(data->program->message.to); - fl_print_format("%[Deleting all files within build directory '%]", data->main->message.to, data->main->context.set.important, data->main->context.set.important); - fl_print_format("%[%Q%]", data->main->message.to, data->main->context.set.notable, data->setting->build, data->main->context.set.notable); - fl_print_format("%['.%]%r", data->main->message.to, data->main->context.set.important, data->main->context.set.important, f_string_eol_s); + fl_print_format("%[Deleting all files within build directory '%]", data->program->message.to, data->program->context.set.important, data->program->context.set.important); + fl_print_format("%[%Q%]", data->program->message.to, data->program->context.set.notable, data->setting->build, data->program->context.set.notable); + fl_print_format("%['.%]%r", data->program->message.to, data->program->context.set.important, data->program->context.set.important, f_string_eol_s); - f_file_stream_unlock(data->main->message.to); + f_file_stream_unlock(data->program->message.to); } data->setting->state.status = F_none; - if (data->main->error.verbosity >= f_console_verbosity_verbose_e) { + if (data->program->error.verbosity >= f_console_verbosity_verbose_e) { data->setting->state.status = f_directory_remove_custom(data->setting->build, F_directory_max_descriptors_d, F_true, fake_clean_remove_recursively_verbosely); } else { @@ -29,15 +29,15 @@ extern "C" { } if (F_status_set_fine(data->setting->state.status) == F_file_found_not || F_status_set_fine(data->setting->state.status) == F_directory) { - if (data->main->error.verbosity >= f_console_verbosity_verbose_e) { - fll_print_format("The build directory '%[%Q%]' does not exist.%r", data->main->warning.to, data->main->context.set.notable, data->setting->build, data->main->context.set.notable, f_string_eol_s); + if (data->program->error.verbosity >= f_console_verbosity_verbose_e) { + fll_print_format("The build directory '%[%Q%]' does not exist.%r", data->program->warning.to, data->program->context.set.notable, data->setting->build, data->program->context.set.notable, f_string_eol_s); } data->setting->state.status = F_none; } if (F_status_is_error(data->setting->state.status)) { - fake_print_error_file(data->setting, data->main->error, macro_fake_f(f_directory_remove), data->setting->build, f_file_operation_delete_s, fll_error_file_type_directory_e); + fake_print_error_file(data->setting, data->program->error, macro_fake_f(f_directory_remove), data->setting->build, f_file_operation_delete_s, fll_error_file_type_directory_e); } else { data->setting->state.status = F_none; diff --git a/level_3/fake/c/main/common.c b/level_3/fake/c/main/common.c index 863ac1a..1893598 100644 --- a/level_3/fake/c/main/common.c +++ b/level_3/fake/c/main/common.c @@ -5,31 +5,48 @@ extern "C" { #endif #ifndef _di_fake_setting_load_ - void fake_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fake_setting_t * const setting) { + void fake_setting_load(const f_console_arguments_t arguments, fake_main_t * const main) { - if (!main || !setting) return; + if (!main) return; - main->output.to.id = F_type_descriptor_output_d; - main->output.to.stream = F_type_output_d; - main->output.to.flag = F_file_flag_create_d | F_file_flag_write_only_d | F_file_flag_append_d; + main->program.output.to.id = F_type_descriptor_output_d; + main->program.output.to.stream = F_type_output_d; + main->program.output.to.flag = F_file_flag_create_d | F_file_flag_write_only_d | F_file_flag_append_d; { - const uint16_t step_original = setting->state.step_small; + const uint16_t step_original = main->setting.state.step_small; fake_data_t data = fake_data_t_initialize; - data.main = main; - data.setting = setting; + data.program = &main->program; + data.setting = &main->setting; - setting->state.step_small = 4; + main->setting.state.step_small = 4; - f_console_parameter_process(arguments, &main->parameters, &setting->state, (void *) &data); + f_console_parameter_process(arguments, &main->program.parameters, &main->setting.state, (void *) &data); - setting->state.step_small = step_original; + main->setting.state.step_small = step_original; } - if (F_status_is_error(setting->state.status)) { - fake_print_line_first(setting, main->message); + // Identify and pocess first/last parameters. + if (main->program.parameters.array[fake_parameter_line_first_no_e].result & f_console_result_found_e) { + main->setting.flag -= main->setting.flag & fake_main_flag_print_first_e; + } + else { + main->setting.flag |= fake_main_flag_print_first_e; + } + + if (main->program.parameters.array[fake_parameter_line_last_no_e].result & f_console_result_found_e) { + main->setting.flag -= main->setting.flag & fake_main_flag_print_last_e; + } + else { + main->setting.flag |= fake_main_flag_print_last_e; + } - fake_print_error(setting, main->error, macro_fake_f(f_console_parameter_process)); + if (F_status_is_error(main->setting.state.status)) { + if ((main->setting.flag & fake_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); + } + + fake_print_error(&main->program.error, macro_fake_f(f_console_parameter_process)); return; } @@ -46,31 +63,19 @@ extern "C" { const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e }; - setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, main); + main->setting.state.status = fll_program_parameter_process_context(choices, modes, F_true, &main->program); - if (F_status_is_error(setting->state.status)) { - fake_print_line_first(setting, main->message); + if (F_status_is_error(main->setting.state.status)) { + if ((main->setting.flag & fake_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); + } - fake_print_error(setting, main->error, macro_fake_f(fll_program_parameter_process_context)); + fake_print_error(&main->program.error, macro_fake_f(fll_program_parameter_process_context)); return; } } - if (main->parameters.array[fake_parameter_line_first_no_e].result & f_console_result_found_e) { - setting->line_first = f_string_empty_s; - } - else { - setting->line_first = f_string_eol_s; - } - - if (main->parameters.array[fake_parameter_line_last_no_e].result & f_console_result_found_e) { - setting->line_last = f_string_empty_s; - } - else { - setting->line_last = f_string_eol_s; - } - // Identify and prioritize "verbosity" parameters. { uint16_t choices_array[5] = { fake_parameter_verbosity_quiet_e, fake_parameter_verbosity_error_e, fake_parameter_verbosity_verbose_e, fake_parameter_verbosity_debug_e, fake_parameter_verbosity_normal_e }; @@ -79,32 +84,34 @@ extern "C" { const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e }; - setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); + main->setting.state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, &main->program); - if (F_status_is_error(setting->state.status)) { - fake_print_line_first(setting, main->message); + if (F_status_is_error(main->setting.state.status)) { + if ((main->setting.flag & fake_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); + } - fake_print_error(setting, main->error, macro_fake_f(fll_program_parameter_process_verbosity)); + fake_print_error(&main->program.error, macro_fake_f(fll_program_parameter_process_verbosity)); return; } } } - if (main->parameters.array[fake_parameter_help_e].result & f_console_result_found_e) { - setting->flag |= fake_main_flag_help_e; + if (main->program.parameters.array[fake_parameter_help_e].result & f_console_result_found_e) { + main->setting.flag |= fake_main_flag_help_e; return; } - if (main->parameters.array[fake_parameter_version_e].result & f_console_result_found_e) { - setting->flag |= fake_main_flag_version_e; + if (main->program.parameters.array[fake_parameter_version_e].result & f_console_result_found_e) { + main->setting.flag |= fake_main_flag_version_e; return; } - if (main->parameters.array[fake_parameter_copyright_e].result & f_console_result_found_e) { - setting->flag |= fake_main_flag_copyright_e; + if (main->program.parameters.array[fake_parameter_copyright_e].result & f_console_result_found_e) { + main->setting.flag |= fake_main_flag_copyright_e; return; } @@ -136,21 +143,21 @@ extern "C" { 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]; + if (main->program.parameters.array[enables[i]].result & f_console_result_found_e) { + if (main->program.parameters.array[disables[i]].result & f_console_result_found_e) { + if (main->program.parameters.array[enables[i]].location < main->program.parameters.array[disables[i]].location) { + main->setting.flag -= main->setting.flag & flags[i]; } else { - setting->flag |= flags[i]; + main->setting.flag |= flags[i]; } } else { - setting->flag |= flags[i]; + main->setting.flag |= flags[i]; } } - else if (main->parameters.array[disables[i]].result & f_console_result_found_e) { - setting->flag -= setting->flag & flags[i]; + else if (main->program.parameters.array[disables[i]].result & f_console_result_found_e) { + main->setting.flag -= main->setting.flag & flags[i]; } } // for } @@ -181,26 +188,26 @@ extern "C" { }; f_string_dynamic_t * const variable[] = { - &setting->build, - &setting->data, - &setting->documents, - &setting->fakefile, - &setting->licenses, - &setting->process, - &setting->settings, - &setting->sources, - &setting->work, + &main->setting.build, + &main->setting.data, + &main->setting.documents, + &main->setting.fakefile, + &main->setting.licenses, + &main->setting.process, + &main->setting.settings, + &main->setting.sources, + &main->setting.work, }; - setting->build.used = 0; - setting->data.used = 0; - setting->documents.used = 0; - setting->fakefile.used = 0; - setting->licenses.used = 0; - setting->process.used = 0; - setting->settings.used = 0; - setting->sources.used = 0; - setting->work.used = 0; + main->setting.build.used = 0; + main->setting.data.used = 0; + main->setting.documents.used = 0; + main->setting.fakefile.used = 0; + main->setting.licenses.used = 0; + main->setting.process.used = 0; + main->setting.settings.used = 0; + main->setting.sources.used = 0; + main->setting.work.used = 0; const f_string_static_t defaults[] = { fake_default_build_s, @@ -228,43 +235,51 @@ extern "C" { for (i = 0; i < 9; ++i) { - if ((main->parameters.array[parameters[i]].result & f_console_result_found_e) && !(main->parameters.array[parameters[i]].result & f_console_result_value_e)) { - setting->state.status = F_status_set_error(F_parameter); + if ((main->program.parameters.array[parameters[i]].result & f_console_result_found_e) && !(main->program.parameters.array[parameters[i]].result & f_console_result_value_e)) { + main->setting.state.status = F_status_set_error(F_parameter); - if (main->error.verbosity > f_console_verbosity_quiet_e) { - fake_print_line_first(setting, main->message); + if ((main->setting.flag & fake_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); + } - fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, names[i]); + if (main->program.error.verbosity > f_console_verbosity_quiet_e) { + fll_program_print_error_parameter_missing_value(main->program.error, f_console_symbol_long_normal_s, names[i]); } return; } - if (main->parameters.array[parameters[i]].result & f_console_result_value_e) { - index = main->parameters.array[parameters[i]].values.array[main->parameters.array[parameters[i]].values.used - 1]; + if (main->program.parameters.array[parameters[i]].result & f_console_result_value_e) { + index = main->program.parameters.array[parameters[i]].values.array[main->program.parameters.array[parameters[i]].values.used - 1]; - if (main->parameters.arguments.array[index].used) { + if (main->program.parameters.arguments.array[index].used) { if (parameters[i] == fake_parameter_process_e) { - for (j = 0; j < main->parameters.arguments.array[index].used; ++j) { + for (j = 0; j < main->program.parameters.arguments.array[index].used; ++j) { - setting->state.status = f_utf_is_word_dash_plus(main->parameters.arguments.array[index].string + j, main->parameters.arguments.array[index].used - j, F_false); + main->setting.state.status = f_utf_is_word_dash_plus(main->program.parameters.arguments.array[index].string + j, main->program.parameters.arguments.array[index].used - j, F_false); // @todo fix this to print an error about the actual invalid character so that it can be investigated. - if (F_status_is_error(setting->state.status)) { - fake_print_line_first(setting, main->message); + if (F_status_is_error(main->setting.state.status)) { + if ((main->setting.flag & fake_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); + } - if (fake_print_error_fallback(setting, main->error, macro_fake_f(f_utf_is_word_dash_plus)) == F_false) { - fll_program_print_error_parameter_process(main->error, f_console_symbol_long_normal_s, names[i]); + if (fake_print_error_fallback(&main->setting, main->program.error, macro_fake_f(f_utf_is_word_dash_plus)) == F_false) { + fll_program_print_error_parameter_process(main->program.error, f_console_symbol_long_normal_s, names[i]); } return; } - if (setting->state.status == F_false) { - setting->state.status = F_status_set_error(F_parameter); + if (main->setting.state.status == F_false) { + main->setting.state.status = F_status_set_error(F_parameter); - fake_print_error_parameter_not_word(setting, main->error, f_console_symbol_long_normal_s, names[i], main->parameters.arguments.array[index]); + if ((main->setting.flag & fake_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); + } + + fake_print_error_parameter_not_word(&main->setting, main->program.error, f_console_symbol_long_normal_s, names[i], main->program.parameters.arguments.array[index]); return; } @@ -272,17 +287,17 @@ extern "C" { } if (cleanups[i]) { - setting->state.status = f_path_directory_cleanup(main->parameters.arguments.array[index], variable[i]); - - if (F_status_is_error(setting->state.status)) { - fake_print_line_first(setting, main->message); + main->setting.state.status = f_path_directory_cleanup(main->program.parameters.arguments.array[index], variable[i]); - if (main->error.verbosity > f_console_verbosity_quiet_e) { - fake_print_line_first(setting, main->message); + if (F_status_is_error(main->setting.state.status)) { + if ((main->setting.flag & fake_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); + } - /*if (fake_print_error_fallback(setting, main->error, macro_fake_f(f_path_directory_cleanup)) == F_false) { - fll_program_print_error_parameter_process(main->error, f_console_symbol_long_normal_s, names[i]); - }*/ + if (main->program.error.verbosity > f_console_verbosity_quiet_e) { + if (fake_print_error_fallback(&main->setting, main->program.error, macro_fake_f(f_path_directory_cleanup)) == F_false) { + fll_program_print_error_parameter_process(main->program.error, f_console_symbol_long_normal_s, names[i]); + } } return; @@ -292,43 +307,51 @@ extern "C" { // De-allocate memory before replacing it with a statically allocated string. if (variable[i]->size) { - setting->state.status = f_string_dynamic_resize(0, variable[i]); + main->setting.state.status = f_string_dynamic_resize(0, variable[i]); - if (F_status_is_error(setting->state.status)) { - fake_print_line_first(setting, main->message); + if (F_status_is_error(main->setting.state.status)) { + if ((main->setting.flag & fake_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); + } - fake_print_error(setting, main->error, macro_fake_f(f_string_dynamic_resize)); + fake_print_error(&main->program.error, macro_fake_f(f_string_dynamic_resize)); return; } } - variable[i]->string = main->parameters.arguments.array[index].string; - variable[i]->used = main->parameters.arguments.array[index].used; + variable[i]->string = main->program.parameters.arguments.array[index].string; + variable[i]->used = main->program.parameters.arguments.array[index].used; variable[i]->size = 0; } if (!variable[i]->used) { - setting->state.status = F_status_set_error(F_parameter); + main->setting.state.status = F_status_set_error(F_parameter); + + if ((main->setting.flag & fake_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); + } - fake_print_error_parameter_not_empty(setting, main->error, f_console_symbol_long_normal_s, names[i], main->parameters.arguments.array[index]); + fake_print_error_parameter_not_empty(&main->setting, main->program.error, f_console_symbol_long_normal_s, names[i], main->program.parameters.arguments.array[index]); return; } - setting->state.status = F_none; + main->setting.state.status = F_none; } } else { // De-allocate memory before replacing it with a statically allocated string. if (variable[i]->size) { - setting->state.status = f_string_dynamic_resize(0, variable[i]); + main->setting.state.status = f_string_dynamic_resize(0, variable[i]); - if (F_status_is_error(setting->state.status)) { - fake_print_line_first(setting, main->message); + if (F_status_is_error(main->setting.state.status)) { + if ((main->setting.flag & fake_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); + } - fake_print_error(setting, main->error, macro_fake_f(f_string_dynamic_resize)); + fake_print_error(&main->program.error, macro_fake_f(f_string_dynamic_resize)); return; } @@ -353,63 +376,73 @@ extern "C" { }; f_string_dynamics_t * const variable[] = { - &setting->defines, - &setting->modes, + &main->setting.defines, + &main->setting.modes, }; f_array_length_t width_max = 0; for (i = 0; i < 2; ++i) { - if ((main->parameters.array[parameters[i]].result & f_console_result_found_e) && !(main->parameters.array[parameters[i]].result & f_console_result_value_e)) { - setting->state.status = F_status_set_error(F_parameter); + if ((main->program.parameters.array[parameters[i]].result & f_console_result_found_e) && !(main->program.parameters.array[parameters[i]].result & f_console_result_value_e)) { + main->setting.state.status = F_status_set_error(F_parameter); - if (main->error.verbosity > f_console_verbosity_quiet_e) { - fake_print_line_first(setting, main->message); + if (main->program.error.verbosity > f_console_verbosity_quiet_e) { + if ((main->setting.flag & fake_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); + } - fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, names[i]); + fll_program_print_error_parameter_missing_value(main->program.error, f_console_symbol_long_normal_s, names[i]); } return; } - if (main->parameters.array[parameters[i]].result & f_console_result_value_e) { - setting->state.status = fll_program_parameter_additional_rip(main->parameters.arguments.array, main->parameters.array[parameters[i]].values, variable[i]); + if (main->program.parameters.array[parameters[i]].result & f_console_result_value_e) { + main->setting.state.status = fll_program_parameter_additional_rip(main->program.parameters.arguments.array, main->program.parameters.array[parameters[i]].values, variable[i]); - if (F_status_is_error(setting->state.status)) { - if (main->error.verbosity > f_console_verbosity_quiet_e) { - fake_print_line_first(setting, main->message); + if (F_status_is_error(main->setting.state.status)) { + if ((main->setting.flag & fake_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); + } - /*if (fake_print_error_fallback(setting, main->error, macro_fake_f(fll_program_parameter_additional_rip)) == F_false) { - fll_program_print_error_parameter_process(main->error, f_console_symbol_long_normal_s, names[i]); - }*/ + if (main->program.error.verbosity > f_console_verbosity_quiet_e) { + if (fake_print_error_fallback(&main->setting, main->program.error, macro_fake_f(fll_program_parameter_additional_rip)) == F_false) { + fll_program_print_error_parameter_process(main->program.error, f_console_symbol_long_normal_s, names[i]); + } } return; } if (parameters[i] == fake_parameter_mode_e) { - for (j = 0; j < main->parameters.arguments.array[i].used; ++j) { + for (j = 0; j < main->program.parameters.arguments.array[i].used; ++j) { - width_max = main->parameters.arguments.array[i].used - j; + width_max = main->program.parameters.arguments.array[i].used - j; - setting->state.status = f_utf_is_word_dash_plus(main->parameters.arguments.array[i].string + j, width_max, F_false); + main->setting.state.status = f_utf_is_word_dash_plus(main->program.parameters.arguments.array[i].string + j, width_max, F_false); - if (F_status_is_error(setting->state.status)) { - fake_print_line_first(setting, main->message); + if (F_status_is_error(main->setting.state.status)) { + if ((main->setting.flag & fake_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); + } // @todo fix this to print an error about the actual invalid character so that it can be investigated. - /*if (fake_print_error_fallback(setting, main->error, macro_fake_f(f_utf_is_word_dash_plus)) == F_false) { - fll_program_print_error_parameter_process(main->error, f_console_symbol_long_normal_s, names[i]); - }*/ + if (fake_print_error_fallback(&main->setting, main->program.error, macro_fake_f(f_utf_is_word_dash_plus)) == F_false) { + fll_program_print_error_parameter_process(main->program.error, f_console_symbol_long_normal_s, names[i]); + } return; } - if (setting->state.status == F_false) { - setting->state.status = F_status_set_error(F_parameter); + if (main->setting.state.status == F_false) { + main->setting.state.status = F_status_set_error(F_parameter); - fake_print_error_parameter_not_word(setting, main->error, f_console_symbol_long_normal_s, names[i], main->parameters.arguments.array[i]); + if ((main->setting.flag & fake_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); + } + + fake_print_error_parameter_not_word(&main->setting, main->program.error, f_console_symbol_long_normal_s, names[i], main->program.parameters.arguments.array[i]); return; } @@ -420,24 +453,26 @@ extern "C" { } } - if (setting->operations.used) { - setting->flag |= fake_main_flag_operation_e; + if (main->setting.operations.used) { + main->setting.flag |= fake_main_flag_operation_e; } else { - setting->flag |= fake_main_flag_operation_make_e; - setting->flag -= setting->flag & fake_main_flag_operation_e; + main->setting.flag |= fake_main_flag_operation_make_e; + main->setting.flag -= main->setting.flag & fake_main_flag_operation_e; - setting->state.status = f_uint8s_increase_by(1, &setting->operations); + main->setting.state.status = f_uint8s_increase_by(1, &main->setting.operations); - if (F_status_is_error(setting->state.status)) { - fake_print_line_first(setting, main->message); + if (F_status_is_error(main->setting.state.status)) { + if ((main->setting.flag & fake_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); + } - fake_print_error(setting, main->error, macro_fake_f(f_uint8s_increase_by)); + fake_print_error(&main->program.error, macro_fake_f(f_uint8s_increase_by)); return; } - setting->operations.array[setting->operations.used++] = fake_operation_make_e; + main->setting.operations.array[main->setting.operations.used++] = fake_operation_make_e; } } #endif // _di_fake_setting_load_ @@ -461,9 +496,7 @@ extern "C" { parameter_state->state->status = f_uint8s_increase(parameter_state->state->step_small, &data->setting->operations); if (F_status_is_error(parameter_state->state->status)) { - fake_print_line_first(data->setting, data->main->message); - - fake_print_error(data->setting, data->main->error, macro_fake_f(f_uint8s_increase)); + fake_print_error(&data->program->error, macro_fake_f(f_uint8s_increase)); return; } @@ -504,11 +537,11 @@ extern "C" { #endif // _di_fake_setting_load_parameter_callback_ #ifndef _di_fake_setting_unload_ - f_status_t fake_setting_unload(fll_program_data_t * const main, fake_setting_t * const setting) { + f_status_t fake_setting_unload(fake_main_t * const main) { - if (!main || !setting) return F_status_set_error(F_parameter); + if (!main) return F_status_set_error(F_parameter); - fake_setting_delete(setting); + fake_setting_delete(&main->setting); return F_none; } diff --git a/level_3/fake/c/main/common.h b/level_3/fake/c/main/common.h index fb54d68..025accc 100644 --- a/level_3/fake/c/main/common.h +++ b/level_3/fake/c/main/common.h @@ -21,16 +21,12 @@ extern "C" { * * This prints error messages as appropriate. * - * If either main or setting is NULL, then this immediately returns without doing anything. - * * @param arguments * The parameters passed to the process (often referred to as command line arguments). * @param main - * The main program data. - * @param setting - * The main program settings. + * The main program and setting data. * - * This alters setting.state.status: + * This alters main.setting.state.status: * F_none on success. * * Errors (with error bit) from: f_console_parameter_process(). @@ -52,7 +48,7 @@ extern "C" { * @see fll_program_parameter_process_verbosity() */ #ifndef _di_fake_setting_load_ - extern void fake_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fake_setting_t * const setting); + extern void fake_setting_load(const f_console_arguments_t arguments, fake_main_t * const main); #endif // _di_fake_setting_load_ /** @@ -60,8 +56,6 @@ extern "C" { * * This prints error messages as appropriate. * - * If either main or setting is NULL, then this immediately returns without doing anything. - * * @param arguments * The parameters passed to the process (often referred to as command line arguments). * @param parameters @@ -76,26 +70,24 @@ extern "C" { * F_process on success, designating that processing should be performed (see f_console_parameter_process()). * * Errors (with error bit) from: f_uint8s_increase(). - * @param data - * This must be of the type fake_setting_t. + * @param main + * This must be of the type fake_main_t. * * @see f_console_parameter_process() * @see f_uint8s_increase() */ #ifndef _di_fake_setting_load_parameter_callback_ - extern void fake_setting_load_parameter_callback(const f_console_arguments_t arguments, void * const parameters, f_console_parameter_state_t * const parameter_state, void * const data); + extern void fake_setting_load_parameter_callback(const f_console_arguments_t arguments, void * const parameters, f_console_parameter_state_t * const parameter_state, void * const main); #endif // _di_fake_setting_load_parameter_callback_ /** * Perform the standard program setting unload process. * * @param main - * The main program data. - * @param setting - * The main program settings. + * The main program and setting data. * All buffers are deallocated. * - * This does not alter setting.state.status. + * This does not alter main.setting.state.status. * * @return * F_none on success. @@ -107,7 +99,7 @@ extern "C" { * @see utf8_setting_delete() */ #ifndef _di_fake_setting_unload_ - extern f_status_t fake_setting_unload(fll_program_data_t * const main, fake_setting_t * const setting); + extern f_status_t fake_setting_unload(fake_main_t * const main); #endif // _di_fake_setting_unload_ #ifdef __cplusplus diff --git a/level_3/fake/c/main/common/enumeration.h b/level_3/fake/c/main/common/enumeration.h index 83a59f6..f5691db 100644 --- a/level_3/fake/c/main/common/enumeration.h +++ b/level_3/fake/c/main/common/enumeration.h @@ -76,17 +76,17 @@ extern "C" { macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \ macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \ \ - macro_f_console_parameter_t_initialize_3(fake_short_build_s, fake_long_build_s, 1, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize_3(fake_short_data_s, fake_long_data_s, 1, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize_3(fake_short_define_s, fake_long_define_s, 1, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize_3(fake_short_documents_s, fake_long_documents_s, 1, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize_3(fake_short_fakefile_s, fake_long_fakefile_s, 1, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize_3(fake_short_licenses_s, fake_long_licenses_s, 1, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize_3(fake_short_mode_s, fake_long_mode_s, 1, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize_3(fake_short_process_s, fake_long_process_s, 1, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize_3(fake_short_settings_s, fake_long_settings_s, 1, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize_3(fake_short_sources_s, fake_long_sources_s, 1, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize_3(fake_short_work_s, fake_long_work_s, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_3(fake_short_build_s, fake_long_build_s, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_3(fake_short_data_s, fake_long_data_s, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_3(fake_short_define_s, fake_long_define_s, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_3(fake_short_documents_s, fake_long_documents_s, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_3(fake_short_fakefile_s, fake_long_fakefile_s, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_3(fake_short_licenses_s, fake_long_licenses_s, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_3(fake_short_mode_s, fake_long_mode_s, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_3(fake_short_process_s, fake_long_process_s, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_3(fake_short_settings_s, fake_long_settings_s, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_3(fake_short_sources_s, fake_long_sources_s, 1, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_3(fake_short_work_s, fake_long_work_s, 1, f_console_flag_normal_e), \ \ macro_f_console_parameter_t_initialize_5(fake_long_documents_disabled_s, 0, f_console_flag_normal_e), \ macro_f_console_parameter_t_initialize_5(fake_long_documents_enabled_s, 0, f_console_flag_normal_e), \ @@ -113,8 +113,6 @@ extern "C" { * - 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. * - operation: Designate that an operation is explicitly passed. @@ -122,7 +120,8 @@ extern "C" { * - operation_clean: The clean operation is designated. * - operation_make: The make operation is designated (or enabled as default). * - operation_skeleton: The skeleton operation is designated. - * - print_first: When set, the first character printing logic is to be processed (this is usually automatic). + * - print_first: When set, print new line to message output on program begin after loading settings. + * - print_last: When set, print new line to message output on program end. * - separate: Enable printing of separators. * - strip_invalid: Using strip invalid character mode. * - verify: Using verify mode. @@ -135,20 +134,19 @@ extern "C" { fake_main_flag_enable_documents_e = 0x2, fake_main_flag_enable_shared_e = 0x4, fake_main_flag_enable_static_e = 0x8, - fake_main_flag_file_from_e = 0x10, - fake_main_flag_file_to_e = 0x20, - fake_main_flag_header_e = 0x40, - fake_main_flag_help_e = 0x80, - fake_main_flag_operation_e = 0x100, - fake_main_flag_operation_build_e = 0x200, - fake_main_flag_operation_clean_e = 0x400, - fake_main_flag_operation_make_e = 0x800, - fake_main_flag_operation_skeleton_e = 0x1000, - fake_main_flag_print_first_e = 0x2000, - fake_main_flag_separate_e = 0x4000, - fake_main_flag_strip_invalid_e = 0x8000, - fake_main_flag_verify_e = 0x10000, - fake_main_flag_version_e = 0x20000, + fake_main_flag_header_e = 0x10, + fake_main_flag_help_e = 0x20, + fake_main_flag_operation_e = 0x40, + fake_main_flag_operation_build_e = 0x80, + fake_main_flag_operation_clean_e = 0x100, + fake_main_flag_operation_make_e = 0x200, + fake_main_flag_operation_skeleton_e = 0x400, + fake_main_flag_print_first_e = 0x800, + fake_main_flag_print_last_e = 0x1000, + fake_main_flag_separate_e = 0x2000, + fake_main_flag_strip_invalid_e = 0x4000, + fake_main_flag_verify_e = 0x8000, + fake_main_flag_version_e = 0x10000, }; // enum #endif // _di_fake_main_flag_e_ @@ -370,6 +368,30 @@ extern "C" { }; // enum #endif // _di_fake_condition_result_e_ +/** + * Flags for fine-tuned print control. + * + * fake_print_flag_*_e: + * - none: No flags set. + * - debug: Stream is for debug printing. + * - error: Stream is for error printing. + * - message: Stream is for message printing. + * - warning: Stream is for warning printing. + * - file_to: Stream is a destination file. + * - file_from: Stream is a source file. + */ +#ifndef _di_fake_print_flag_e_ + enum { + fake_print_flag_none_e = 0x0, + fake_print_flag_debug_e = 0x1, + fake_print_flag_error_e = 0x2, + fake_print_flag_message_e = 0x4, + fake_print_flag_warning_e = 0x8, + fake_print_flag_file_to_e = 0x10, + fake_print_flag_file_from_e = 0x20, + }; // enum +#endif // _di_fake_print_flag_e_ + #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/fake/c/main/common/print-error.c b/level_3/fake/c/main/common/print-error.c deleted file mode 100644 index e69de29..0000000 diff --git a/level_3/fake/c/main/common/print-error.h b/level_3/fake/c/main/common/print-error.h deleted file mode 100644 index e69de29..0000000 diff --git a/level_3/fake/c/main/common/print-string.c b/level_3/fake/c/main/common/print-string.c new file mode 100644 index 0000000..33f6808 --- /dev/null +++ b/level_3/fake/c/main/common/print-string.c @@ -0,0 +1,15 @@ +#include "../fake.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_fake_p_a_ + const f_string_t fake_p_a[] = { + "", + }; +#endif // _di_fake_p_a_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_3/fake/c/main/common/print-string.h b/level_3/fake/c/main/common/print-string.h new file mode 100644 index 0000000..596cc14 --- /dev/null +++ b/level_3/fake/c/main/common/print-string.h @@ -0,0 +1,52 @@ +/** + * FLL - Level 3 + * + * Project: Featureless Make + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Provides common print functionality. + * + * This is auto-included and should not need to be explicitly included. + */ +#ifndef _fake_common_print_h +#define _fake_common_print_h + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * A special array of strings intended for being used in print functions. + * + * These serve two primary purposes: + * 1) Reduce repition of strings, saving space. + * 2) Provide a central location for changing strings to another langauge. + * + * The macro macro_fake_p() is used to reference the array index by the enum name. + * + * macro_fake_p(): + * - name: A name or alias representing the string. + */ +#ifndef _di_fake_p_a_ + extern const f_string_t fake_p_a[]; + + #define macro_fake_p(name) fake_p_a[fake_p_##name##_e] +#endif // _di_fake_f_p_ + +/** + * An enum representing specific indexes within the above array. + * + * This is a convenience enum used to make code slightly more readable. + */ +#ifndef _di_fake_p_e_ + enum { + fake_p__e, + }; // enum +#endif // _di_fake_p_e_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _fake_common_print_string_h diff --git a/level_3/fake/c/main/common/type.h b/level_3/fake/c/main/common/type.h index 297e5f8..91027a7 100644 --- a/level_3/fake/c/main/common/type.h +++ b/level_3/fake/c/main/common/type.h @@ -62,9 +62,6 @@ extern "C" { * * state: The state data used when processing the FSS data. * - * 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. @@ -84,9 +81,6 @@ extern "C" { f_state_t state; - 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 documents; @@ -105,10 +99,8 @@ extern "C" { #define fake_setting_t_initialize \ { \ - fake_main_flag_print_first_e, \ + 0, \ f_state_t_initialize, \ - 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, \ @@ -125,11 +117,30 @@ extern "C" { #endif // _di_fake_setting_t_ /** + * The main program data as a single structure. + * + * program: The main program data. + * setting: The settings data. + */ +#ifndef _di_fake_main_t_ + typedef struct { + fll_program_data_t program; + fake_setting_t setting; + } fake_main_t; + + #define fake_main_t_initialize \ + { \ + fll_program_data_t_initialize, \ + fake_setting_t_initialize, \ + } +#endif // _di_fake_main_t_ + +/** * The program data. * * operation: A code representing the currrent operation. * - * main: The main program data. + * program: The main program data. * setting: The settings data. * * path_build: The build path. @@ -182,7 +193,7 @@ extern "C" { typedef struct { uint8_t operation; - fll_program_data_t *main; + fll_program_data_t *program; fake_setting_t *setting; f_string_dynamic_t path_build; @@ -750,7 +761,7 @@ extern "C" { f_array_length_t id_main; - fll_program_data_t *main; + fll_program_data_t *program; fake_data_t *data; fake_setting_t *setting; } fake_make_data_t; diff --git a/level_3/fake/c/main/fake.c b/level_3/fake/c/main/fake.c index b03c4b2..0716d4c 100644 --- a/level_3/fake/c/main/fake.c +++ b/level_3/fake/c/main/fake.c @@ -5,112 +5,136 @@ extern "C" { #endif #ifndef _di_fake_main_ - void fake_main(fll_program_data_t * const main, fake_setting_t * const setting) { + void fake_main(fake_main_t * const main) { - if (!main || !setting) return; + if (!main) return; - if (F_status_is_error(setting->state.status)) { - fake_print_line_last(setting, main->message); + if (F_status_is_error(main->setting.state.status)) { + if ((main->setting.flag & fake_main_flag_print_last_e) && main->program.message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); + } return; } - setting->state.status = F_none; + if ((main->setting.flag & fake_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); + } + + main->setting.state.status = F_none; - if (setting->flag & fake_main_flag_help_e) { - fake_print_help(setting, main->message); + if (main->setting.flag & fake_main_flag_help_e) { + fake_print_help(&main->setting, main->program.message); + + if ((main->setting.flag & fake_main_flag_print_last_e) && main->program.message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); + } return; } - if (setting->flag & fake_main_flag_version_e) { - fll_program_print_version(main->message, (setting->line_first.used ? 0x1 : 0x0) | (setting->line_last.used ? 0x2 : 0x0), fake_program_version_s); + if (main->setting.flag & fake_main_flag_version_e) { + fll_program_print_version(main->program.message, fake_program_version_s); + + if ((main->setting.flag & fake_main_flag_print_last_e) && main->program.message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); + } return; } - if (setting->flag & fake_main_flag_copyright_e) { - fll_program_print_copyright(main->message, (setting->line_first.used ? 0x1 : 0x0) | (setting->line_last.used ? 0x2 : 0x0)); + if (main->setting.flag & fake_main_flag_copyright_e) { + fll_program_print_copyright(main->program.message); + + if ((main->setting.flag & fake_main_flag_print_last_e) && main->program.message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); + } return; } - if ((setting->flag & fake_main_flag_operation_build_e) && (setting->flag & fake_main_flag_operation_make_e)) { - setting->state.status = F_status_set_error(F_parameter); + if ((main->setting.flag & fake_main_flag_operation_build_e) && (main->setting.flag & fake_main_flag_operation_make_e)) { + main->setting.state.status = F_status_set_error(F_parameter); - fake_print_error_parameter_operation_not_with(setting, main->error, fake_other_operation_build_s, fake_other_operation_make_s); + fake_print_error_parameter_operation_not_with(&main->setting, main->program.error, fake_other_operation_build_s, fake_other_operation_make_s); + + if ((main->setting.flag & fake_main_flag_print_last_e) && main->program.message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); + } return; } fake_data_t data = fake_data_t_initialize; - data.main = main; - data.setting = setting; + data.program = &main->program; + data.setting = &main->setting; fake_path_generate(&data); - if (F_status_is_error(setting->state.status)) { + if (F_status_is_error(main->setting.state.status)) { fake_data_delete(&data); - fake_print_line_last(setting, main->message); + if ((main->setting.flag & fake_main_flag_print_last_e) && main->program.message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); + } return; } - if ((main->pipe & fll_program_data_pipe_input_e) && !(data.setting->flag & fake_main_flag_operation_e)) { + if ((main->program.pipe & fll_program_data_pipe_input_e) && !(main->setting.flag & fake_main_flag_operation_e)) { data.file_data_build_fakefile.used = 0; - setting->state.status = f_string_dynamic_append(f_string_ascii_minus_s, &data.file_data_build_fakefile); + main->setting.state.status = f_string_dynamic_append(f_string_ascii_minus_s, &data.file_data_build_fakefile); - if (F_status_is_error_not(setting->state.status)) { - setting->fakefile.used = 0; + if (F_status_is_error_not(main->setting.state.status)) { + main->setting.fakefile.used = 0; - setting->state.status = f_string_dynamic_append(f_string_ascii_minus_s, &setting->fakefile); + main->setting.state.status = f_string_dynamic_append(f_string_ascii_minus_s, &main->setting.fakefile); } - if (F_status_is_error(setting->state.status)) { - fake_print_error(setting, main->error, macro_fake_f(f_string_dynamic_append)); + if (F_status_is_error(main->setting.state.status)) { + fake_print_error(&main->program.error, macro_fake_f(f_string_dynamic_append)); } } - if (F_status_is_error_not(setting->state.status)) { + if (F_status_is_error_not(main->setting.state.status)) { f_array_length_t i = 0; // Pre-process and perform validation when "clean" is before a "build" or "make" command as a safety check. { uint8_t has_clean = F_false; - for (; i < setting->operations.used; ++i) { + for (; i < main->setting.operations.used; ++i) { - if (setting->operations.array[i] == fake_operation_clean_e) { + if (main->setting.operations.array[i] == fake_operation_clean_e) { has_clean = F_true; } - else if (setting->operations.array[i] == fake_operation_build_e || setting->operations.array[i] == fake_operation_make_e) { + else if (main->setting.operations.array[i] == fake_operation_build_e || main->setting.operations.array[i] == fake_operation_make_e) { // If the first operation is clean and a make or build operation exists, then the clean operation requires the appropriate settings file or fakefile file. if (has_clean) { - data.operation = setting->operations.array[i]; + data.operation = main->setting.operations.array[i]; fake_validate_parameter_paths(&data); - if (F_status_is_error_not(setting->state.status) && !(main->pipe & fll_program_data_pipe_input_e)) { - setting->state.status = f_file_is( - setting->operations.array[i] == fake_operation_build_e + if (F_status_is_error_not(main->setting.state.status) && !(main->program.pipe & fll_program_data_pipe_input_e)) { + main->setting.state.status = f_file_is( + (main->setting.operations.array[i] == fake_operation_build_e) ? data.file_data_build_settings : data.file_data_build_fakefile, F_file_type_regular_d, F_false ); - if (setting->state.status == F_false) { - setting->state.status = F_status_set_error(F_file_not); + if (main->setting.state.status == F_false) { + main->setting.state.status = F_status_set_error(F_file_not); } - if (F_status_is_error(setting->state.status)) { + if (F_status_is_error(main->setting.state.status)) { fake_print_error_file( - setting, - main->error, + &main->setting, + main->program.error, macro_fake_f(f_file_is), - setting->operations.array[i] == fake_operation_build_e + (main->setting.operations.array[i] == fake_operation_build_e) ? data.file_data_build_settings : data.file_data_build_fakefile, fake_common_file_path_access_s, @@ -123,16 +147,16 @@ extern "C" { break; } - if (!((++main->signal_check) % fake_signal_check_short_d)) { - if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); + if (!((++main->program.signal_check) % fake_signal_check_short_d)) { + if (fll_program_standard_signal_received(&main->program)) { + fll_program_print_signal_received(main->program.warning, main->program.signal_received); - setting->state.status = F_status_set_error(F_interrupt); + main->setting.state.status = F_status_set_error(F_interrupt); break; } - main->signal_check = 0; + main->program.signal_check = 0; } } // for } @@ -140,9 +164,9 @@ extern "C" { { bool check_paths = F_true; - for (i = 0; i < setting->operations.used; ++i) { + for (i = 0; i < main->setting.operations.used; ++i) { - data.operation = setting->operations.array[i]; + data.operation = main->setting.operations.array[i]; if (data.operation == fake_operation_build_e) { if (check_paths) { @@ -150,11 +174,19 @@ extern "C" { check_paths = F_false; } - if (F_status_is_error_not(setting->state.status)) { - fake_build_operate(&data, 0, main->pipe & fll_program_data_pipe_input_e); + if (F_status_is_error_not(main->setting.state.status)) { + if (i && main->program.message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); + } + + fake_build_operate(&data, 0, main->program.pipe & fll_program_data_pipe_input_e); } } else if (data.operation == fake_operation_clean_e) { + if (i && main->program.message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); + } + fake_clean_operate(&data); // Reset in case next operation needs files. @@ -166,57 +198,63 @@ extern "C" { check_paths = F_false; } - if (F_status_is_error_not(setting->state.status)) { + if (F_status_is_error_not(main->setting.state.status)) { + if (i && main->program.message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); + } + fake_make_operate(&data); - if (setting->state.status == F_child) break; + if (main->setting.state.status == F_child) break; } } else if (data.operation == fake_operation_skeleton_e) { + if (i && main->program.message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); + } + fake_skeleton_operate(&data); // Skeleton is supposed to guarantee these. check_paths = F_false; } - if (setting->state.status == F_child) break; + if (main->setting.state.status == F_child) break; - if (!((++main->signal_check) % fake_signal_check_short_d)) { - if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); + if (!((++main->program.signal_check) % fake_signal_check_short_d)) { + if (fll_program_standard_signal_received(&main->program)) { + fll_program_print_signal_received(main->program.warning, main->program.signal_received); - setting->state.status = F_status_set_error(F_interrupt); + main->setting.state.status = F_status_set_error(F_interrupt); break; } - main->signal_check = 0; + main->program.signal_check = 0; } - if (F_status_is_error(setting->state.status)) break; + if (F_status_is_error(main->setting.state.status)) break; } // for } } - if (F_status_is_error(setting->state.status)) { - if (F_status_set_fine(setting->state.status) == F_interrupt) { - fake_print_operation_cancelled(setting, main->message, data.operation); + if (F_status_is_error(main->setting.state.status)) { + if (F_status_set_fine(main->setting.state.status) == F_interrupt) { + fake_print_operation_cancelled(&main->setting, main->program.message, data.operation); } else { - fake_print_error_failure_operation(setting, main->error, data.operation); + fake_print_error_failure_operation(&main->setting, main->program.error, data.operation); } - - fake_print_line_last(setting, main->message); } - else if (setting->state.status != F_child) { - if (F_status_is_error_not(setting->state.status)) { - setting->state.status = F_none; + else if (main->setting.state.status != F_child) { + if (F_status_is_error_not(main->setting.state.status)) { + main->setting.state.status = F_none; - fake_print_operation_all_complete(setting, main->message); + fake_print_operation_all_complete(&main->setting, main->program.message); } + } - if (setting->state.status != F_interrupt) { - fake_print_line_last(setting, main->message); - } + if ((main->setting.flag & fake_main_flag_print_last_e) && main->program.message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); } fake_data_delete(&data); @@ -226,25 +264,25 @@ extern "C" { #ifndef _di_fake_execute_ int fake_execute(fake_data_t * const data, const f_string_maps_t environment, const f_string_static_t program, const f_string_statics_t arguments) { - if (!data || !data->main || !data->setting) return 1; + if (!data || !data->program || !data->setting) return 1; if (F_status_is_error(data->setting->state.status)) return 1; - if (data->main->error.verbosity >= f_console_verbosity_verbose_e) { - f_file_stream_lock(data->main->message.to); + if (data->program->error.verbosity >= f_console_verbosity_verbose_e) { + f_file_stream_lock(data->program->message.to); - f_print_dynamic(program, data->main->message.to); + f_print_dynamic(program, data->program->message.to); for (f_array_length_t i = 0; i < arguments.used; ++i) { if (!arguments.array[i].used) continue; - fl_print_format(" %Q", data->main->message.to, arguments.array[i]); + fl_print_format(" %Q", data->program->message.to, arguments.array[i]); } // for - f_print_dynamic_raw(f_string_eol_s, data->main->message.to); + f_print_dynamic_raw(f_string_eol_s, data->program->message.to); - f_file_stream_flush(data->main->message.to); - f_file_stream_unlock(data->main->message.to); + f_file_stream_flush(data->program->message.to); + f_file_stream_unlock(data->program->message.to); } int return_code = 0; @@ -260,9 +298,9 @@ extern "C" { data->setting->state.status = fll_execute_program(program, arguments, ¶meter, 0, (void *) &return_code); - if (!((++data->main->signal_check) % fake_signal_check_d)) { - if (fll_program_standard_signal_received(data->main)) { - fll_program_print_signal_received(data->main->warning, data->setting->line_first, data->main->signal_received); + if (!((++data->program->signal_check) % fake_signal_check_d)) { + if (fll_program_standard_signal_received(data->program)) { + fll_program_print_signal_received(data->program->warning, data->program->signal_received); data->setting->state.status = F_status_set_error(F_interrupt); @@ -283,18 +321,10 @@ extern "C" { return_code = 1; if (F_status_set_fine(data->setting->state.status) == F_file_found_not) { - if (data->main->error.verbosity > f_console_verbosity_quiet_e) { - f_file_stream_lock(data->main->error.to); - - fl_print_format("%[%QFailed to find program '%]", data->main->error.to, data->main->error.context, data->main->error.prefix, data->main->error.context); - fl_print_format("%[%Q%]", data->main->error.to, data->main->error.notable, program, data->main->error.notable); - fl_print_format("%[' for executing.%]%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); - } + fake_print_error_execute_program_not_found(data->setting, data->program->error, program); } else { - fake_print_error(data->setting, data->main->error, macro_fake_f(fll_execute_program)); + fake_print_error(&data->program->error, macro_fake_f(fll_execute_program)); } } @@ -305,9 +335,9 @@ extern "C" { #ifndef _di_fake_file_buffer_ void fake_file_buffer(fake_data_t * const data, const f_string_static_t path_file, const bool required, f_string_dynamic_t * const buffer) { - if (!((++data->main->signal_check) % fake_signal_check_d)) { - if (fll_program_standard_signal_received(data->main)) { - fll_program_print_signal_received(data->main->warning, data->setting->line_first, data->main->signal_received); + if (!((++data->program->signal_check) % fake_signal_check_d)) { + if (fll_program_standard_signal_received(data->program)) { + fll_program_print_signal_received(data->program->warning, data->program->signal_received); data->setting->state.status = F_status_set_error(F_interrupt); @@ -318,7 +348,7 @@ extern "C" { data->setting->state.status = f_file_exists(path_file, F_true); if (F_status_is_error(data->setting->state.status)) { - fake_print_error_file(data->setting, data->main->error, macro_fake_f(f_file_exists), path_file, f_file_operation_find_s, fll_error_file_type_file_e); + fake_print_error_file(data->setting, data->program->error, macro_fake_f(f_file_exists), path_file, f_file_operation_find_s, fll_error_file_type_file_e); return; } @@ -330,7 +360,7 @@ extern "C" { data->setting->state.status = f_file_size(path_file, F_true, &size_file); if (F_status_is_error(data->setting->state.status)) { - fake_print_error_file(data->setting, data->main->error, macro_fake_f(f_file_size), path_file, f_file_operation_read_s, fll_error_file_type_file_e); + fake_print_error_file(data->setting, data->program->error, macro_fake_f(f_file_size), path_file, f_file_operation_read_s, fll_error_file_type_file_e); return; } @@ -344,7 +374,7 @@ extern "C" { if (F_status_is_error(data->setting->state.status)) { const f_string_static_t message = macro_f_string_static_t_initialize("allocate buffer size for", 0, 24); - fake_print_error_file(data->setting, data->main->error, macro_fake_f(f_string_dynamic_increase_by), path_file, message, fll_error_file_type_file_e); + fake_print_error_file(data->setting, data->program->error, macro_fake_f(f_string_dynamic_increase_by), path_file, message, fll_error_file_type_file_e); return; } @@ -357,7 +387,7 @@ extern "C" { data->setting->state.status = f_file_stream_open(path_file, f_string_empty_s, &file); if (F_status_is_error(data->setting->state.status)) { - fake_print_error_file(data->setting, data->main->error, macro_fake_f(f_file_stream_open), path_file, f_file_operation_open_s, fll_error_file_type_file_e); + fake_print_error_file(data->setting, data->program->error, macro_fake_f(f_file_stream_open), path_file, f_file_operation_open_s, fll_error_file_type_file_e); return; } @@ -368,7 +398,7 @@ extern "C" { f_file_stream_close(&file); if (F_status_is_error(data->setting->state.status)) { - fake_print_error_file(data->setting, data->main->error, macro_fake_f(f_file_read), path_file, f_file_operation_read_s, fll_error_file_type_file_e); + fake_print_error_file(data->setting, data->program->error, macro_fake_f(f_file_read), path_file, f_file_operation_read_s, fll_error_file_type_file_e); } else { data->setting->state.status = F_none; @@ -378,7 +408,7 @@ extern "C" { if (required) { data->setting->state.status = F_status_set_error(F_file_found_not); - fake_print_error_file(data->setting, data->main->error, macro_fake_f(f_file_exists), path_file, f_file_operation_find_s, fll_error_file_type_file_e); + fake_print_error_file(data->setting, data->program->error, macro_fake_f(f_file_exists), path_file, f_file_operation_find_s, fll_error_file_type_file_e); } } } @@ -387,7 +417,7 @@ extern "C" { #ifndef _di_fake_pipe_buffer_ void fake_pipe_buffer(fake_data_t * const data, f_string_dynamic_t * const buffer) { - if (!data || !data->main || !data->setting || !buffer) return; + if (!data || !data->program || !data->setting || !buffer) return; f_file_t file = f_file_t_initialize; @@ -399,7 +429,7 @@ extern "C" { if (F_status_is_error(data->setting->state.status)) { const f_string_static_t message = macro_f_string_static_t_initialize("allocate buffer size for", 0, 24); - fake_print_error_file(data->setting, data->main->error, macro_fake_f(f_string_dynamic_increase_by), f_string_ascii_minus_s, message, fll_error_file_type_file_e); + fake_print_error_file(data->setting, data->program->error, macro_fake_f(f_string_dynamic_increase_by), f_string_ascii_minus_s, message, fll_error_file_type_file_e); return; } @@ -408,9 +438,9 @@ extern "C" { clearerr(F_type_input_d); do { - if (!((++data->main->signal_check) % fake_signal_check_d)) { - if (fll_program_standard_signal_received(data->main)) { - fll_program_print_signal_received(data->main->warning, data->setting->line_first, data->main->signal_received); + if (!((++data->program->signal_check) % fake_signal_check_d)) { + if (fll_program_standard_signal_received(data->program)) { + fll_program_print_signal_received(data->program->warning, data->program->signal_received); data->setting->state.status = F_status_set_error(F_interrupt); @@ -423,7 +453,7 @@ extern "C" { } while (F_status_is_fine(data->setting->state.status) && data->setting->state.status != F_interrupt && data->setting->state.status != F_none_eof); if (F_status_is_error(data->setting->state.status)) { - fake_print_error_file(data->setting, data->main->error, macro_fake_f(f_file_stream_read_block), f_string_ascii_minus_s, f_file_operation_read_s, fll_error_file_type_file_e); + fake_print_error_file(data->setting, data->program->error, macro_fake_f(f_file_stream_read_block), f_string_ascii_minus_s, f_file_operation_read_s, fll_error_file_type_file_e); } else { data->setting->state.status = F_none; @@ -434,11 +464,11 @@ extern "C" { #ifndef _di_fake_validate_parameter_paths_ void fake_validate_parameter_paths(fake_data_t * const data) { - if (!data || !data->main || !data->setting) return; + if (!data || !data->program || !data->setting) return; - if (!((++data->main->signal_check) % fake_signal_check_d)) { - if (fll_program_standard_signal_received(data->main)) { - fll_program_print_signal_received(data->main->warning, data->setting->line_first, data->main->signal_received); + if (!((++data->program->signal_check) % fake_signal_check_d)) { + if (fll_program_standard_signal_received(data->program)) { + fll_program_print_signal_received(data->program->warning, data->program->signal_received); data->setting->state.status = F_status_set_error(F_interrupt); @@ -466,7 +496,7 @@ extern "C" { uint8_t requireds[] = { F_false, // fake_long_build_s - (data->main->pipe & fll_program_data_pipe_input_e) ? F_false : F_true, // fake_long_data_s + (data->program->pipe & fll_program_data_pipe_input_e) ? F_false : F_true, // fake_long_data_s F_false, // fake_long_documents_s F_false, // fake_long_licenses_s F_false, // fake_long_sources_s @@ -479,7 +509,7 @@ extern "C" { // Check only expected operations (fake_operation_clean_e and fake_operation_skeleton_e should not call this function). if (data->operation == fake_operation_make_e) { - if (data->main->parameters.array[fake_parameter_fakefile_e].result == f_console_result_none_e) { + if (data->program->parameters.array[fake_parameter_fakefile_e].result == f_console_result_none_e) { if (data->setting->build.used && f_file_exists(data->setting->build, F_false) != F_true) { if (f_file_exists(fake_default_fakefile_s, F_false) == F_true) { requireds[1] = F_false; // fake_long_data_s @@ -490,7 +520,7 @@ extern "C" { // If a custom --data or a custom --fakefile parameter is passed and uses an absolute or relative to current path, then do not check. if (data->operation == fake_operation_make_e || data->operation == fake_operation_build_e) { - f_console_parameter_t * const parameter = &data->main->parameters.array[ + f_console_parameter_t * const parameter = &data->program->parameters.array[ data->operation == fake_operation_make_e ? fake_parameter_fakefile_e : fake_parameter_settings_e @@ -499,11 +529,11 @@ extern "C" { if (parameter->result & f_console_result_value_e) { const f_array_length_t index = parameter->values.array[parameter->values.used - 1]; - if (f_path_is_absolute(data->main->parameters.arguments.array[index]) == F_true || f_path_is_relative_current(data->main->parameters.arguments.array[index]) == F_true) { + if (f_path_is_absolute(data->program->parameters.arguments.array[index]) == F_true || f_path_is_relative_current(data->program->parameters.arguments.array[index]) == F_true) { requireds[1] = F_none; // fake_long_data_s } else { - data->setting->state.status = f_file_exists(data->main->parameters.arguments.array[index], F_true); + data->setting->state.status = f_file_exists(data->program->parameters.arguments.array[index], F_true); if (F_status_is_error_not(data->setting->state.status) && data->setting->state.status == F_true) { requireds[1] = F_none; // fake_long_data_s @@ -525,20 +555,14 @@ extern "C" { if (F_status_is_error(data->setting->state.status)) { if (F_status_set_fine(data->setting->state.status) != F_directory_found_not || requireds[i]) { - fake_print_error_file(data->setting, data->main->error, macro_fake_f(f_file_stat), values[i], f_file_operation_access_s, fll_error_file_type_directory_e); + fake_print_error_file(data->setting, data->program->error, macro_fake_f(f_file_stat), values[i], f_file_operation_access_s, fll_error_file_type_directory_e); return; } } } else if (requireds[i] == F_true) { - f_file_stream_lock(data->main->error.to); - - fl_print_format("%[%QNo valid path for the (required) directory parameter '%]", data->main->error.to, 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, names[i], data->main->error.notable); - fl_print_format("%[' was found.%]%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); + fake_print_error_parameter_directory_not_found_path(data->setting, data->program->error, f_console_symbol_long_normal_s, names[i], values[i]); data->setting->state.status = F_status_set_error(F_directory_found_not); diff --git a/level_3/fake/c/main/fake.h b/level_3/fake/c/main/fake.h index fb8d5de..b30e2f7 100644 --- a/level_3/fake/c/main/fake.h +++ b/level_3/fake/c/main/fake.h @@ -149,11 +149,9 @@ extern "C" { * Execute main program. * * @param main - * The main program data. - * @param setting - * The main program settings. + * The main program and setting data. * - * This alters setting.state.status: + * This alters main.setting.state.status: * F_none on success. * F_child if this is a child process returning. * @@ -177,7 +175,7 @@ extern "C" { * @see fake_validate_parameter_paths() */ #ifndef _di_fake_main_ - extern void fake_main(fll_program_data_t * const main, fake_setting_t * const setting); + extern void fake_main(fake_main_t * const main); #endif // _di_fake_main_ /** diff --git a/level_3/fake/c/main/fake/path_generate.c b/level_3/fake/c/main/fake/path_generate.c index ee7d1c1..4bf51da 100644 --- a/level_3/fake/c/main/fake/path_generate.c +++ b/level_3/fake/c/main/fake/path_generate.c @@ -7,7 +7,7 @@ extern "C" { #ifndef _di_fake_path_generate_ void fake_path_generate(fake_data_t * const data) { - if (!data || !data->main || !data->setting) return; + if (!data || !data->program || !data->setting) return; data->setting->state.status = F_none; uint8_t i = 0; @@ -58,7 +58,7 @@ extern "C" { fake_path_generate_string_dynamic(data, sources[i], values[i], parameters_size[i]); if (F_status_is_error(data->setting->state.status)) { - fake_print_error(data->setting, data->main->error, macro_fake_f(fake_path_generate_string_dynamic)); + fake_print_error(&data->program->error, macro_fake_f(fake_path_generate_string_dynamic)); return; } @@ -103,7 +103,7 @@ extern "C" { data->setting->state.status = f_string_dynamic_append_nulless(sources[i], values[i]); if (F_status_is_error(data->setting->state.status)) { - fake_print_error(data->setting, data->main->error, macro_fake_f(f_string_dynamic_append_nulless)); + fake_print_error(&data->program->error, macro_fake_f(f_string_dynamic_append_nulless)); return; } @@ -171,7 +171,7 @@ extern "C" { fake_path_generate_string_dynamic(data, sources[i], values[i], parameters_size[i]); if (F_status_is_error(data->setting->state.status)) { - fake_print_error(data->setting, data->main->error, macro_fake_f(fake_path_generate_string_dynamic)); + fake_print_error(&data->program->error, macro_fake_f(fake_path_generate_string_dynamic)); return; } @@ -231,7 +231,7 @@ extern "C" { data->setting->state.status = f_string_dynamic_append_nulless(sources[i], values[i]); if (F_status_is_error(data->setting->state.status)) { - fake_print_error(data->setting, data->main->error, macro_fake_f(f_string_dynamic_append_nulless)); + fake_print_error(&data->program->error, macro_fake_f(f_string_dynamic_append_nulless)); return; } @@ -253,7 +253,7 @@ extern "C" { data->setting->state.status = f_string_dynamic_append_nulless(data->setting->work, values[i]); if (F_status_is_error(data->setting->state.status)) { - fake_print_error(data->setting, data->main->error, macro_fake_f(f_string_dynamic_append_nulless)); + fake_print_error(&data->program->error, macro_fake_f(f_string_dynamic_append_nulless)); return; } @@ -278,7 +278,7 @@ extern "C" { data->setting->state.status = f_string_dynamic_append_nulless(sources[i], values[i]); if (F_status_is_error(data->setting->state.status)) { - fake_print_error(data->setting, data->main->error, macro_fake_f(f_string_dynamic_append_nulless)); + fake_print_error(&data->program->error, macro_fake_f(f_string_dynamic_append_nulless)); return; } @@ -318,7 +318,7 @@ extern "C" { fake_path_generate_string_dynamic(data, sources[i], values[i], parameters_size[i]); if (F_status_is_error(data->setting->state.status)) { - fake_print_error(data->setting, data->main->error, macro_fake_f(fake_path_generate_string_dynamic)); + fake_print_error(&data->program->error, macro_fake_f(fake_path_generate_string_dynamic)); return; } @@ -349,7 +349,7 @@ extern "C" { data->setting->state.status = f_string_dynamic_append_nulless(sources[i], values[i]); if (F_status_is_error(data->setting->state.status)) { - fake_print_error(data->setting, data->main->error, macro_fake_f(f_string_dynamic_append_nulless)); + fake_print_error(&data->program->error, macro_fake_f(f_string_dynamic_append_nulless)); return; } @@ -364,7 +364,7 @@ extern "C" { #ifndef _di_fake_path_generate_string_dynamic_ void fake_path_generate_string_dynamic(fake_data_t * const data, const f_string_dynamic_t source, f_string_dynamic_t *destination[], const uint8_t length) { - if (!data || !data->main || !data->setting || !destination) return; + if (!data || !data->program || !data->setting || !destination) return; data->setting->state.status = F_none; diff --git a/level_3/fake/c/main/main.c b/level_3/fake/c/main/main.c index 55b6dc7..cb31e54 100644 --- a/level_3/fake/c/main/main.c +++ b/level_3/fake/c/main/main.c @@ -2,46 +2,56 @@ 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; - setting.state.step_large = fake_allocation_large_d; - setting.state.step_small = fake_allocation_small_d; - setting.state.custom = (void *) &data; + fake_main_t data = fake_main_t_initialize; + + data.program.debug.flag |= fake_print_flag_debug_e; + data.program.error.flag |= fake_print_flag_error_e; + data.program.message.flag |= fake_print_flag_message_e; + data.program.warning.flag |= fake_print_flag_warning_e; + data.program.message.custom = (void *) &data; + data.program.output.custom = (void *) &data; + data.program.error.custom = (void *) &data; + data.program.warning.custom = (void *) &data; + data.program.debug.custom = (void *) &data; + + data.setting.flag |= fake_main_flag_enable_documents_e; + data.setting.flag |= fake_main_flag_enable_shared_e; + data.setting.flag |= fake_main_flag_enable_static_e; + data.setting.state.step_large = fake_allocation_large_d; + data.setting.state.step_small = fake_allocation_small_d; + data.setting.state.custom = (void *) &data.program; f_console_parameter_t parameters[] = fake_console_parameter_t_initialize; - data.parameters.array = parameters; - data.parameters.used = fake_total_parameters_d; - data.parameters.callback = &fake_setting_load_parameter_callback; - data.environment = envp; + data.program.parameters.array = parameters; + data.program.parameters.used = fake_total_parameters_d; + data.program.parameters.callback = &fake_setting_load_parameter_callback; + data.program.environment = envp; if (f_pipe_input_exists()) { - data.pipe = fll_program_data_pipe_input_e; + data.program.pipe = fll_program_data_pipe_input_e; } - fll_program_standard_set_up(&data); + fll_program_standard_set_up(&data.program); - f_file_umask_get(&data.umask); + f_file_umask_get(&data.program.umask); { const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp); - fake_setting_load(arguments, &data, &setting); + fake_setting_load(arguments, &data); } - fake_main(&data, &setting); + fake_main(&data); - fake_setting_unload(&data, &setting); + fake_setting_unload(&data); - fll_program_data_delete(&data); + fll_program_data_delete(&data.program); - fll_program_standard_set_down(&data); + fll_program_standard_set_down(&data.program); - if (setting.state.status == F_child) { - exit(data.child); + if (data.setting.state.status == F_child) { + exit(data.program.child); } - return F_status_is_error(setting.state.status) ? 1 : 0; + return F_status_is_error(data.setting.state.status) ? 1 : 0; } diff --git a/level_3/fake/c/main/make.c b/level_3/fake/c/main/make.c index bcb6440..a9d9801 100644 --- a/level_3/fake/c/main/make.c +++ b/level_3/fake/c/main/make.c @@ -7,7 +7,7 @@ extern "C" { #ifndef _di_fake_make_assure_inside_project_ void fake_make_assure_inside_project(fake_make_data_t * const data_make, const f_string_static_t path) { - if (!data_make || !data_make->main || !data_make->setting) return; + if (!data_make || !data_make->program || !data_make->setting) return; data_make->cache_path.used = 0; @@ -42,10 +42,10 @@ extern "C" { #ifndef _di_fake_make_get_id_ f_number_unsigned_t fake_make_get_id(fake_make_data_t * const data_make, const bool is_owner, const f_string_static_t buffer) { - if (!data_make || !data_make->main || !data_make->setting) return 0; + if (!data_make || !data_make->program || !data_make->setting) return 0; if (!buffer.used) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(fake_make_get_id)); + fake_print_error(&data_make->program->error, macro_fake_f(fake_make_get_id)); data_make->setting->state.status = F_status_set_error(F_parameter); @@ -72,17 +72,11 @@ extern "C" { } if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error( - data_make->setting, - data_make->main->error, - is_owner - ? macro_fake_f(f_account_id_by_name) - : macro_fake_f(f_account_group_id_by_name) - ); + fake_print_error(&data_make->program->error, is_owner ? macro_fake_f(f_account_id_by_name) : macro_fake_f(f_account_group_id_by_name)); } else { if (data_make->setting->state.status == F_exist_not) { - fake_print_error_group_not_found(data_make->setting, data_make->main->error, buffer); + fake_print_error_group_not_found(data_make->setting, data_make->program->error, buffer); data_make->setting->state.status = F_status_set_error(F_exist_not); } @@ -92,14 +86,14 @@ extern "C" { } } else { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(fl_conversion_dynamic_to_unsigned_detect)); + fake_print_error(&data_make->program->error, macro_fake_f(fl_conversion_dynamic_to_unsigned_detect)); } return 0; } if (number > F_type_size_32_unsigned_d) { - fake_print_error_number_too_large(data_make->setting, data_make->main->error, buffer); + fake_print_error_number_too_large(data_make->setting, data_make->program->error, buffer); data_make->setting->state.status = F_status_set_error(F_failure); @@ -113,24 +107,24 @@ extern "C" { #ifndef _di_fake_make_get_id_mode_ void fake_make_get_id_mode(fake_make_data_t * const data_make, const f_string_static_t buffer, f_file_mode_t *mode, uint8_t *replace) { - if (!data_make || !data_make->main || !data_make->setting || !mode || !replace) return; + if (!data_make || !data_make->program || !data_make->setting || !mode || !replace) return; if (!buffer.used) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(fake_make_get_id_mode)); + fake_print_error(&data_make->program->error, macro_fake_f(fake_make_get_id_mode)); data_make->setting->state.status = F_status_set_error(F_parameter); return; } - data_make->setting->state.status = f_file_mode_from_string(buffer, data_make->main->umask, mode, replace); + data_make->setting->state.status = f_file_mode_from_string(buffer, data_make->program->umask, mode, replace); if (F_status_is_error(data_make->setting->state.status)) { if (F_status_set_fine(data_make->setting->state.status) == F_syntax) { - fake_print_error_mode_invalid(data_make->setting, data_make->main->error, buffer); + fake_print_error_mode_invalid(data_make->setting, data_make->program->error, buffer); } else { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(fake_make_get_id_mode)); + fake_print_error(&data_make->program->error, macro_fake_f(fake_make_get_id_mode)); } } else { @@ -142,7 +136,7 @@ extern "C" { #ifndef _di_fake_make_path_relative_ void fake_make_path_relative(fake_make_data_t * const data_make, const f_string_static_t path) { - if (!data_make || !data_make->main || !data_make->setting) return; + if (!data_make || !data_make->program || !data_make->setting) return; data_make->cache_path.used = 0; diff --git a/level_3/fake/c/main/make/load_fakefile.c b/level_3/fake/c/main/make/load_fakefile.c index 921687e..e7f6a78 100644 --- a/level_3/fake/c/main/make/load_fakefile.c +++ b/level_3/fake/c/main/make/load_fakefile.c @@ -7,11 +7,11 @@ extern "C" { #ifndef _di_fake_make_load_fakefile_ void fake_make_load_fakefile(fake_make_data_t * const data_make, const bool process_pipe) { - if (!data_make || !data_make->data || !data_make->main || !data_make->setting) return; + if (!data_make || !data_make->data || !data_make->program || !data_make->setting) return; if (F_status_is_error(data_make->setting->state.status)) return; - if (fll_program_standard_signal_received(data_make->main)) { - fll_program_print_signal_received(data_make->main->warning, data_make->setting->line_first, data_make->main->signal_received); + if (fll_program_standard_signal_received(data_make->program)) { + fll_program_print_signal_received(data_make->program->warning, data_make->program->signal_received); data_make->setting->state.status = F_status_set_error(F_interrupt); @@ -38,7 +38,7 @@ extern "C" { if (F_status_is_error(data_make->setting->state.status)) return; if (!data_make->buffer.used) { - fake_make_print_warning_fakefile_empty(data_make->setting, data_make->main->warning, data_make->data->file_data_build_fakefile); + fake_make_print_warning_fakefile_empty(data_make->setting, data_make->program->warning, data_make->data->file_data_build_fakefile); return; } @@ -54,13 +54,13 @@ extern "C" { fll_fss_basic_list_read(data_make->buffer, &range, &list_objects, &list_contents, &delimits, 0, &comments, &data_make->setting->state); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error_fss(data_make->setting, data_make->main->error, macro_fake_f(fll_fss_basic_list_read), data_make->data->file_data_build_fakefile, range, F_true); + fake_print_error_fss(data_make->setting, data_make->program->error, macro_fake_f(fll_fss_basic_list_read), data_make->data->file_data_build_fakefile, range, F_true); } else { f_fss_apply_delimit(delimits, &data_make->buffer, &data_make->setting->state); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_fss_apply_delimit)); + fake_print_error(&data_make->program->error, macro_fake_f(f_fss_apply_delimit)); } delimits.used = 0; @@ -88,7 +88,7 @@ extern "C" { } if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_fss_nameds_resize)); + fake_print_error(&data_make->program->error, macro_fake_f(f_fss_nameds_resize)); f_fss_set_resize(0, &settings); f_string_ranges_resize(0, &list_objects); @@ -104,20 +104,20 @@ extern "C" { for (f_array_length_t i = 0; i < list_objects.used; ++i) { if (!(i % fake_signal_check_short_d)) { - if (fll_program_standard_signal_received(data_make->main)) { - fll_program_print_signal_received(data_make->main->warning, data_make->setting->line_first, data_make->main->signal_received); + if (fll_program_standard_signal_received(data_make->program)) { + fll_program_print_signal_received(data_make->program->warning, data_make->program->signal_received); data_make->setting->state.status = F_status_set_error(F_interrupt); break; } - data_make->main->signal_check = 0; + data_make->program->signal_check = 0; } if (fl_string_dynamic_partial_compare_string(fake_make_item_settings_s.string, data_make->buffer, fake_make_item_settings_s.used, list_objects.array[i]) == F_equal_to) { if (!missing_settings) { - fake_make_print_warning_setting_object_multiple(data_make->setting, data_make->main->warning, data_make->data->file_data_build_fakefile, fake_make_item_settings_s); + fake_make_print_warning_setting_object_multiple(data_make->setting, data_make->program->warning, data_make->data->file_data_build_fakefile, fake_make_item_settings_s); continue; } @@ -128,7 +128,7 @@ extern "C" { fll_fss_extended_read(data_make->buffer, &content_range, &settings.objects, &settings.contents, 0, 0, &delimits, 0, &data_make->setting->state); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error_fss(data_make->setting, data_make->main->error, macro_fake_f(fll_fss_extended_read), data_make->data->file_data_build_fakefile, content_range, F_true); + fake_print_error_fss(data_make->setting, data_make->program->error, macro_fake_f(fll_fss_extended_read), data_make->data->file_data_build_fakefile, content_range, F_true); break; } @@ -136,7 +136,7 @@ extern "C" { f_fss_apply_delimit(delimits, &data_make->buffer, &data_make->setting->state); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_fss_apply_delimit)); + fake_print_error(&data_make->program->error, macro_fake_f(f_fss_apply_delimit)); break; } @@ -148,7 +148,7 @@ extern "C" { if (fl_string_dynamic_partial_compare_string(fake_make_item_main_s.string, data_make->buffer, fake_make_item_main_s.used, list_objects.array[i]) == F_equal_to) { if (!missing_main) { - fake_make_print_warning_setting_object_multiple(data_make->setting, data_make->main->warning, data_make->data->file_data_build_fakefile, fake_make_item_main_s); + fake_make_print_warning_setting_object_multiple(data_make->setting, data_make->program->warning, data_make->data->file_data_build_fakefile, fake_make_item_main_s); continue; } @@ -169,7 +169,7 @@ extern "C" { fll_fss_extended_read(data_make->buffer, &content_range, &data_make->fakefile.array[data_make->fakefile.used].objects, &data_make->fakefile.array[data_make->fakefile.used].contents, 0, &data_make->fakefile.array[data_make->fakefile.used].quotess, &delimits, 0, &data_make->setting->state); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error_fss(data_make->setting, data_make->main->error, macro_fake_f(fll_fss_extended_read), data_make->data->file_data_build_fakefile, content_range, F_true); + fake_print_error_fss(data_make->setting, data_make->program->error, macro_fake_f(fll_fss_extended_read), data_make->data->file_data_build_fakefile, content_range, F_true); break; } @@ -177,7 +177,7 @@ extern "C" { f_fss_apply_delimit(delimits, &data_make->buffer, &data_make->setting->state); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_fss_apply_delimit)); + fake_print_error(&data_make->program->error, macro_fake_f(f_fss_apply_delimit)); break; } @@ -198,7 +198,7 @@ extern "C" { } if (missing_main) { - fake_make_print_error_fakefile_section_missing(data_make->setting, data_make->main->warning, data_make->data->file_data_build_fakefile, fake_make_item_main_s); + fake_make_print_error_fakefile_section_missing(data_make->setting, data_make->program->warning, data_make->data->file_data_build_fakefile, fake_make_item_main_s); data_make->setting->state.status = F_status_set_error(F_failure); @@ -226,7 +226,7 @@ extern "C" { } if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, function_name); + fake_print_error(&data_make->program->error, function_name); f_fss_set_resize(0, &settings); @@ -277,7 +277,7 @@ extern "C" { fake_build_load_setting(data_make->data, 0, F_false, &data_make->setting_build); if (F_status_is_error(data_make->setting->state.status) && data_make->setting->state.status != F_status_set_error(F_interrupt)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(fake_build_load_setting)); + fake_print_error(&data_make->program->error, macro_fake_f(fake_build_load_setting)); } } @@ -302,7 +302,7 @@ extern "C" { if (F_status_is_error(data_make->setting->state.status)) { if (F_status_set_fine(data_make->setting->state.status) != F_interrupt) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_string_dynamic_partial_append)); + fake_print_error(&data_make->program->error, macro_fake_f(f_string_dynamic_partial_append)); } f_fss_set_resize(0, &settings); @@ -322,7 +322,7 @@ extern "C" { #ifndef _di_fake_make_load_fakefile_setting_build_ void fake_make_load_fakefile_setting_build(fake_make_data_t * const data_make, f_fss_object_t * const object, f_fss_content_t * const content) { - if (!data_make || !data_make->data || !data_make->main || !data_make->setting || !object || !content) return; + if (!data_make || !data_make->data || !data_make->program || !data_make->setting || !object || !content) return; if (content->used) { if (fl_string_dynamic_partial_compare_string(fake_common_setting_bool_yes_s.string, data_make->buffer, fake_common_setting_bool_yes_s.used, content->array[0]) == F_equal_to) { @@ -332,15 +332,15 @@ extern "C" { data_make->setting_make.load_build = F_false; } else { - fake_make_print_warning_setting_content_invalid(data_make->setting, data_make->main->warning, data_make->data->file_data_build_fakefile, data_make->buffer, *object, content->array[0], fake_make_item_settings_s); + fake_make_print_warning_setting_content_invalid(data_make->setting, data_make->program->warning, data_make->data->file_data_build_fakefile, data_make->buffer, *object, content->array[0], fake_make_item_settings_s); } if (content->used > 1) { - fake_make_print_warning_setting_content_multiple(data_make->setting, data_make->main->warning, data_make->data->file_data_build_fakefile, fake_make_setting_load_build_s); + fake_make_print_warning_setting_content_multiple(data_make->setting, data_make->program->warning, data_make->data->file_data_build_fakefile, fake_make_setting_load_build_s); } } else { - fake_make_print_warning_setting_content_empty(data_make->setting, data_make->main->warning, data_make->data->file_data_build_fakefile, data_make->buffer, *object, fake_make_setting_load_build_s); + fake_make_print_warning_setting_content_empty(data_make->setting, data_make->program->warning, data_make->data->file_data_build_fakefile, data_make->buffer, *object, fake_make_setting_load_build_s); } } #endif // _di_fake_make_load_fakefile_setting_build_ @@ -348,17 +348,17 @@ extern "C" { #ifndef _di_fake_make_load_fakefile_setting_compiler_ void fake_make_load_fakefile_setting_compiler(fake_make_data_t * const data_make, f_fss_object_t * const object, f_fss_content_t * const content, f_string_range_t **range_compiler) { - if (!data_make || !data_make->data || !data_make->main || !data_make->setting || !object || !content || !range_compiler) return; + if (!data_make || !data_make->data || !data_make->program || !data_make->setting || !object || !content || !range_compiler) return; if (content->used) { *range_compiler = &content->array[content->used - 1]; if (content->used > 1) { - fake_make_print_warning_setting_content_multiple(data_make->setting, data_make->main->warning, data_make->data->file_data_build_fakefile, fake_make_setting_compiler_s); + fake_make_print_warning_setting_content_multiple(data_make->setting, data_make->program->warning, data_make->data->file_data_build_fakefile, fake_make_setting_compiler_s); } } else { - fake_make_print_warning_setting_content_empty(data_make->setting, data_make->main->warning, data_make->data->file_data_build_fakefile, data_make->buffer, *object, fake_make_setting_compiler_s); + fake_make_print_warning_setting_content_empty(data_make->setting, data_make->program->warning, data_make->data->file_data_build_fakefile, data_make->buffer, *object, fake_make_setting_compiler_s); } } #endif // _di_fake_make_load_fakefile_setting_compiler_ @@ -366,7 +366,7 @@ extern "C" { #ifndef _di_fake_make_load_fakefile_setting_define_and_parameter_ void fake_make_load_fakefile_setting_define_and_parameter(fake_make_data_t * const data_make, f_fss_set_t * const settings) { - if (!data_make || !data_make->data || !data_make->data || !data_make->main || !data_make->setting || !settings) return; + if (!data_make || !data_make->data || !data_make->data || !data_make->program || !data_make->setting || !settings) return; ; f_string_map_multis_t define = f_string_map_multis_t_initialize; @@ -387,7 +387,7 @@ extern "C" { data_make->setting->state.status = fll_fss_snatch_map_apart(data_make->buffer, settings->objects, settings->contents, settings_name, 2, settings_value, 0, 0); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(fll_fss_snatch_map_apart)); + fake_print_error(&data_make->program->error, macro_fake_f(fll_fss_snatch_map_apart)); f_string_map_multis_resize(0, &define); @@ -413,7 +413,7 @@ extern "C" { data_make->setting->state.status = f_string_dynamic_mash(f_string_space_s, define.array[i].value.array[j], &combined); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_string_dynamic_mash)); + fake_print_error(&data_make->program->error, macro_fake_f(f_string_dynamic_mash)); break; } @@ -424,13 +424,13 @@ extern "C" { data_make->setting->state.status = f_environment_set(define.array[i].name, combined, F_true); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_environment_set)); + fake_print_error(&data_make->program->error, macro_fake_f(f_environment_set)); break; } } else { - fake_make_print_error_define_invalid_character(data_make->setting, data_make->main->error, define.array[i].name); + fake_make_print_error_define_invalid_character(data_make->setting, data_make->program->error, define.array[i].name); data_make->setting->state.status = F_status_set_error(F_failure); @@ -452,7 +452,7 @@ extern "C" { #ifndef _di_fake_make_load_fakefile_setting_environment_ void fake_make_load_fakefile_setting_environment(fake_make_data_t * const data_make, f_fss_content_t * const content) { - if (!data_make || !data_make->data || !data_make->data || !data_make->main || !data_make->setting || !content) return; + if (!data_make || !data_make->data || !data_make->data || !data_make->program || !data_make->setting || !content) return; f_string_dynamic_t name_define = f_string_dynamic_t_initialize; @@ -466,7 +466,7 @@ extern "C" { data_make->setting->state.status = f_string_dynamic_partial_append_nulless(data_make->buffer, content->array[i], &name_define); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_string_dynamic_partial_append_nulless)); + fake_print_error(&data_make->program->error, macro_fake_f(f_string_dynamic_partial_append_nulless)); break; } @@ -481,7 +481,7 @@ extern "C" { data_make->setting->state.status = f_string_dynamics_increase(fake_allocation_small_d, &data_make->setting_build.environment); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_string_dynamics_increase)); + fake_print_error(&data_make->program->error, macro_fake_f(f_string_dynamics_increase)); break; } @@ -491,7 +491,7 @@ extern "C" { data_make->setting->state.status = f_string_dynamic_increase_by(name_define.used + 1, &data_make->setting_build.environment.array[j]); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_string_dynamic_increase_by)); + fake_print_error(&data_make->program->error, macro_fake_f(f_string_dynamic_increase_by)); break; } @@ -499,7 +499,7 @@ extern "C" { data_make->setting->state.status = f_string_dynamic_append_nulless(name_define, &data_make->setting_build.environment.array[j]); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_string_dynamic_append_nulless)); + fake_print_error(&data_make->program->error, macro_fake_f(f_string_dynamic_append_nulless)); break; } @@ -507,21 +507,21 @@ extern "C" { ++data_make->setting_build.environment.used; } else if (j < data_make->setting_build.environment.used) { - fake_make_print_warning_environment_name_already_added(data_make->setting, data_make->main->warning, name_define); + fake_make_print_warning_environment_name_already_added(data_make->setting, data_make->program->warning, name_define); data_make->setting_build.environment.array[j].used = 0; data_make->setting->state.status = f_string_dynamic_append_nulless(name_define, &data_make->setting_build.environment.array[j]); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_string_dynamic_append_nulless)); + fake_print_error(&data_make->program->error, macro_fake_f(f_string_dynamic_append_nulless)); break; } } } - else if (data_make->main->warning.verbosity >= f_console_verbosity_verbose_e) { - fake_make_print_warning_environment_name_invalid(data_make->setting, data_make->main->warning, name_define); + else if (data_make->program->warning.verbosity >= f_console_verbosity_verbose_e) { + fake_make_print_warning_environment_name_invalid(data_make->setting, data_make->program->warning, name_define); } name_define.used = 0; @@ -538,7 +538,7 @@ extern "C" { #ifndef _di_fake_make_load_fakefile_setting_fail_ void fake_make_load_fakefile_setting_fail(fake_make_data_t * const data_make, f_fss_object_t * const object, f_fss_content_t * const content) { - if (!data_make || !data_make->data || !data_make->data || !data_make->main || !data_make->setting || !object || !content) return; + if (!data_make || !data_make->data || !data_make->data || !data_make->program || !data_make->setting || !object || !content) return; if (content->used) { if (fl_string_dynamic_partial_compare_string(fake_make_operation_argument_exit_s.string, data_make->buffer, fake_make_operation_argument_exit_s.used, content->array[content->used - 1]) == F_equal_to) { @@ -551,15 +551,15 @@ extern "C" { data_make->setting_make.fail = fake_make_operation_fail_ignore_e; } else { - fake_make_print_warning_setting_content_invalid(data_make->setting, data_make->main->warning, data_make->data->file_data_build_fakefile, data_make->buffer, *object, content->array[content->used - 1], fake_make_item_settings_s); + fake_make_print_warning_setting_content_invalid(data_make->setting, data_make->program->warning, data_make->data->file_data_build_fakefile, data_make->buffer, *object, content->array[content->used - 1], fake_make_item_settings_s); } if (content->used > 1) { - fake_make_print_warning_setting_content_multiple(data_make->setting, data_make->main->warning, data_make->data->file_data_build_fakefile, fake_make_setting_fail_s); + fake_make_print_warning_setting_content_multiple(data_make->setting, data_make->program->warning, data_make->data->file_data_build_fakefile, fake_make_setting_fail_s); } } else { - fake_make_print_warning_setting_content_empty(data_make->setting, data_make->main->warning, data_make->data->file_data_build_fakefile, data_make->buffer, *object, fake_make_setting_fail_s); + fake_make_print_warning_setting_content_empty(data_make->setting, data_make->program->warning, data_make->data->file_data_build_fakefile, data_make->buffer, *object, fake_make_setting_fail_s); } } #endif // _di_fake_make_load_fakefile_setting_fail_ @@ -567,17 +567,17 @@ extern "C" { #ifndef _di_fake_make_load_fakefile_setting_indexer_ void fake_make_load_fakefile_setting_indexer(fake_make_data_t * const data_make, f_fss_object_t * const object, f_fss_content_t * const content, f_string_range_t **range_indexer) { - if (!data_make || !data_make->data || !data_make->data || !data_make->main || !data_make->setting || !object || !content || !range_indexer) return; + if (!data_make || !data_make->data || !data_make->data || !data_make->program || !data_make->setting || !object || !content || !range_indexer) return; if (content->used) { *range_indexer = &content->array[content->used - 1]; if (content->used > 1) { - fake_make_print_warning_setting_content_multiple(data_make->setting, data_make->main->warning, data_make->data->file_data_build_fakefile, fake_make_setting_indexer_s); + fake_make_print_warning_setting_content_multiple(data_make->setting, data_make->program->warning, data_make->data->file_data_build_fakefile, fake_make_setting_indexer_s); } } else { - fake_make_print_warning_setting_content_empty(data_make->setting, data_make->main->warning, data_make->data->file_data_build_fakefile, data_make->buffer, *object, fake_make_setting_indexer_s); + fake_make_print_warning_setting_content_empty(data_make->setting, data_make->program->warning, data_make->data->file_data_build_fakefile, data_make->buffer, *object, fake_make_setting_indexer_s); } } #endif // _di_fake_make_load_fakefile_setting_indexer_ @@ -585,7 +585,7 @@ extern "C" { #ifndef _di_fake_make_load_fakefile_setting_parameter_ void fake_make_load_fakefile_setting_parameter(fake_make_data_t * const data_make, f_fss_object_t * const object, f_fss_content_t * const content) { - if (!data_make || !data_make->data || !data_make->data || !data_make->main || !data_make->setting || !object || !content) return; + if (!data_make || !data_make->data || !data_make->data || !data_make->program || !data_make->setting || !object || !content) return; if (content->used) { if (fl_string_dynamic_partial_compare_string(fake_make_setting_return_s.string, data_make->buffer, fake_make_setting_return_s.used, content->array[0]) == F_equal_to) { @@ -599,7 +599,7 @@ extern "C" { data_make->setting->state.status = f_string_dynamic_partial_append_nulless(data_make->buffer, content->array[i], &data_make->setting_make.parameter.array[0].value.array[0]); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_string_dynamic_partial_append_nulless)); + fake_print_error(&data_make->program->error, macro_fake_f(f_string_dynamic_partial_append_nulless)); break; } @@ -607,7 +607,7 @@ extern "C" { data_make->setting->state.status = f_string_dynamic_append_assure(f_string_space_s, &data_make->setting_make.parameter.array[0].value.array[0]); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_string_dynamic_append_assure)); + fake_print_error(&data_make->program->error, macro_fake_f(f_string_dynamic_append_assure)); break; } @@ -618,7 +618,7 @@ extern "C" { } } else { - fake_make_print_warning_setting_content_empty(data_make->setting, data_make->main->warning, data_make->data->file_data_build_fakefile, data_make->buffer, *object, fake_make_setting_return_s); + fake_make_print_warning_setting_content_empty(data_make->setting, data_make->program->warning, data_make->data->file_data_build_fakefile, data_make->buffer, *object, fake_make_setting_return_s); } data_make->setting->state.status = F_none; diff --git a/level_3/fake/c/main/make/load_parameters.c b/level_3/fake/c/main/make/load_parameters.c index a5ab088..3b05381 100644 --- a/level_3/fake/c/main/make/load_parameters.c +++ b/level_3/fake/c/main/make/load_parameters.c @@ -7,10 +7,10 @@ extern "C" { #ifndef _di_fake_make_load_parameters_ void fake_make_load_parameters(fake_make_data_t * const data_make) { - if (!data_make || !data_make->main || !data_make->setting) return; + if (!data_make || !data_make->program || !data_make->setting) return; if (F_status_is_error(data_make->setting->state.status)) return; - if (data_make->main->context.mode != f_color_mode_none_e) { + if (data_make->program->context.mode != f_color_mode_none_e) { data_make->setting->state.status = f_string_dynamics_increase_by(fake_allocation_small_d, &data_make->parameter.color); if (F_status_is_error_not(data_make->setting->state.status)) { @@ -18,16 +18,16 @@ extern "C" { } if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_string_dynamics_increase_by)); + fake_print_error(&data_make->program->error, macro_fake_f(f_string_dynamics_increase_by)); return; } - if (data_make->main->context.mode == f_color_mode_not_e) { - if (data_make->main->parameters.array[fake_parameter_no_color_e].flag & f_console_flag_normal_e) { + if (data_make->program->context.mode == f_color_mode_not_e) { + if (data_make->program->parameters.array[fake_parameter_no_color_e].flag & f_console_flag_normal_e) { data_make->setting->state.status = f_string_dynamic_append(f_console_symbol_short_normal_s, &data_make->parameter.color.array[data_make->parameter.color.used]); } - else if (data_make->main->parameters.array[fake_parameter_no_color_e].flag & f_console_flag_normal_e) { + else if (data_make->program->parameters.array[fake_parameter_no_color_e].flag & f_console_flag_normal_e) { data_make->setting->state.status = f_string_dynamic_append(f_console_symbol_short_inverse_s, &data_make->parameter.color.array[data_make->parameter.color.used]); } @@ -35,11 +35,11 @@ extern "C" { data_make->setting->state.status = f_string_dynamic_append(f_console_standard_short_no_color_s, &data_make->parameter.color.array[data_make->parameter.color.used]); } } - else if (data_make->main->context.mode == f_color_mode_dark_e) { - if (data_make->main->parameters.array[fake_parameter_dark_e].flag & f_console_flag_normal_e) { + else if (data_make->program->context.mode == f_color_mode_dark_e) { + if (data_make->program->parameters.array[fake_parameter_dark_e].flag & f_console_flag_normal_e) { data_make->setting->state.status = f_string_dynamic_append(f_console_symbol_short_normal_s, &data_make->parameter.color.array[data_make->parameter.color.used]); } - else if (data_make->main->parameters.array[fake_parameter_dark_e].flag & f_console_flag_normal_e) { + else if (data_make->program->parameters.array[fake_parameter_dark_e].flag & f_console_flag_normal_e) { data_make->setting->state.status = f_string_dynamic_append(f_console_symbol_short_inverse_s, &data_make->parameter.color.array[data_make->parameter.color.used]); } @@ -48,10 +48,10 @@ extern "C" { } } else { - if (data_make->main->parameters.array[fake_parameter_light_e].flag & f_console_flag_normal_e) { + if (data_make->program->parameters.array[fake_parameter_light_e].flag & f_console_flag_normal_e) { data_make->setting->state.status = f_string_dynamic_append(f_console_symbol_short_normal_s, &data_make->parameter.color.array[data_make->parameter.color.used]); } - else if (data_make->main->parameters.array[fake_parameter_light_e].flag & f_console_flag_normal_e) { + else if (data_make->program->parameters.array[fake_parameter_light_e].flag & f_console_flag_normal_e) { data_make->setting->state.status = f_string_dynamic_append(f_console_symbol_short_inverse_s, &data_make->parameter.color.array[data_make->parameter.color.used]); } @@ -65,7 +65,7 @@ extern "C" { } if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_string_dynamic_append)); + fake_print_error(&data_make->program->error, macro_fake_f(f_string_dynamic_append)); return; } @@ -74,7 +74,7 @@ extern "C" { ++data_make->parameter_option.color.used; } - if (data_make->main->error.verbosity != f_console_verbosity_normal_e) { + if (data_make->program->error.verbosity != f_console_verbosity_normal_e) { data_make->setting->state.status = f_string_dynamics_increase_by(fake_allocation_small_d, &data_make->parameter.verbosity); if (F_status_is_error_not(data_make->setting->state.status)) { @@ -82,16 +82,16 @@ extern "C" { } if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_string_dynamics_increase_by)); + fake_print_error(&data_make->program->error, macro_fake_f(f_string_dynamics_increase_by)); return; } - if (data_make->main->error.verbosity == f_console_verbosity_quiet_e) { - if (data_make->main->parameters.array[fake_parameter_verbosity_quiet_e].flag & f_console_flag_normal_e) { + if (data_make->program->error.verbosity == f_console_verbosity_quiet_e) { + if (data_make->program->parameters.array[fake_parameter_verbosity_quiet_e].flag & f_console_flag_normal_e) { data_make->setting->state.status = f_string_dynamic_append(f_console_symbol_short_normal_s, &data_make->parameter.verbosity.array[data_make->parameter.verbosity.used]); } - else if (data_make->main->parameters.array[fake_parameter_verbosity_quiet_e].flag & f_console_flag_normal_e) { + else if (data_make->program->parameters.array[fake_parameter_verbosity_quiet_e].flag & f_console_flag_normal_e) { data_make->setting->state.status = f_string_dynamic_append(f_console_symbol_short_inverse_s, &data_make->parameter.verbosity.array[data_make->parameter.verbosity.used]); } @@ -99,11 +99,11 @@ extern "C" { data_make->setting->state.status = f_string_dynamic_append(f_console_standard_short_quiet_s, &data_make->parameter.verbosity.array[data_make->parameter.verbosity.used]); } } - else if (data_make->main->error.verbosity == f_console_verbosity_error_e) { - if (data_make->main->parameters.array[fake_parameter_verbosity_error_e].flag & f_console_flag_normal_e) { + else if (data_make->program->error.verbosity == f_console_verbosity_error_e) { + if (data_make->program->parameters.array[fake_parameter_verbosity_error_e].flag & f_console_flag_normal_e) { data_make->setting->state.status = f_string_dynamic_append(f_console_symbol_short_normal_s, &data_make->parameter.verbosity.array[data_make->parameter.verbosity.used]); } - else if (data_make->main->parameters.array[fake_parameter_verbosity_error_e].flag & f_console_flag_normal_e) { + else if (data_make->program->parameters.array[fake_parameter_verbosity_error_e].flag & f_console_flag_normal_e) { data_make->setting->state.status = f_string_dynamic_append(f_console_symbol_short_inverse_s, &data_make->parameter.verbosity.array[data_make->parameter.verbosity.used]); } @@ -111,11 +111,11 @@ extern "C" { data_make->setting->state.status = f_string_dynamic_append(f_console_standard_short_error_s, &data_make->parameter.verbosity.array[data_make->parameter.verbosity.used]); } } - else if (data_make->main->error.verbosity >= f_console_verbosity_verbose_e) { - if (data_make->main->parameters.array[fake_parameter_verbosity_verbose_e].flag & f_console_flag_normal_e) { + else if (data_make->program->error.verbosity >= f_console_verbosity_verbose_e) { + if (data_make->program->parameters.array[fake_parameter_verbosity_verbose_e].flag & f_console_flag_normal_e) { data_make->setting->state.status = f_string_dynamic_append(f_console_symbol_short_normal_s, &data_make->parameter.verbosity.array[data_make->parameter.verbosity.used]); } - else if (data_make->main->parameters.array[fake_parameter_verbosity_verbose_e].flag & f_console_flag_normal_e) { + else if (data_make->program->parameters.array[fake_parameter_verbosity_verbose_e].flag & f_console_flag_normal_e) { data_make->setting->state.status = f_string_dynamic_append(f_console_symbol_short_inverse_s, &data_make->parameter.verbosity.array[data_make->parameter.verbosity.used]); } @@ -124,10 +124,10 @@ extern "C" { } } else { - if (data_make->main->parameters.array[fake_parameter_verbosity_debug_e].flag & f_console_flag_normal_e) { + if (data_make->program->parameters.array[fake_parameter_verbosity_debug_e].flag & f_console_flag_normal_e) { data_make->setting->state.status = f_string_dynamic_append(f_console_symbol_short_normal_s, &data_make->parameter.verbosity.array[data_make->parameter.verbosity.used]); } - else if (data_make->main->parameters.array[fake_parameter_verbosity_debug_e].flag & f_console_flag_normal_e) { + else if (data_make->program->parameters.array[fake_parameter_verbosity_debug_e].flag & f_console_flag_normal_e) { data_make->setting->state.status = f_string_dynamic_append(f_console_symbol_short_inverse_s, &data_make->parameter.verbosity.array[data_make->parameter.verbosity.used]); } @@ -141,7 +141,7 @@ extern "C" { } if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_string_dynamic_append)); + fake_print_error(&data_make->program->error, macro_fake_f(f_string_dynamic_append)); return; } @@ -157,8 +157,8 @@ extern "C" { }; const f_console_parameter_t *console[] = { - &data_make->main->parameters.array[fake_parameter_define_e], - &data_make->main->parameters.array[fake_parameter_mode_e], + &data_make->program->parameters.array[fake_parameter_define_e], + &data_make->program->parameters.array[fake_parameter_mode_e], }; const f_string_dynamics_t source[] = { @@ -193,7 +193,7 @@ extern "C" { data_make->setting->state.status = f_string_dynamics_increase_by(fake_allocation_small_d, destination[i]); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_string_dynamics_increase_by)); + fake_print_error(&data_make->program->error, macro_fake_f(f_string_dynamics_increase_by)); return; } @@ -206,7 +206,7 @@ extern "C" { } if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_string_dynamics_increase)); + fake_print_error(&data_make->program->error, macro_fake_f(f_string_dynamics_increase)); return; } @@ -227,7 +227,7 @@ extern "C" { } if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_string_dynamic_append_nulless)); + fake_print_error(&data_make->program->error, macro_fake_f(f_string_dynamic_append_nulless)); return; } @@ -238,7 +238,7 @@ extern "C" { data_make->setting->state.status = f_string_dynamics_increase_by(fake_allocation_small_d, destination[i]); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_string_dynamics_increase_by)); + fake_print_error(&data_make->program->error, macro_fake_f(f_string_dynamics_increase_by)); return; } @@ -250,7 +250,7 @@ extern "C" { } if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_string_dynamic_append_nulless)); + fake_print_error(&data_make->program->error, macro_fake_f(f_string_dynamic_append_nulless)); return; } @@ -275,15 +275,15 @@ extern "C" { }; const f_console_parameter_t *console[] = { - &data_make->main->parameters.array[fake_parameter_build_e], - &data_make->main->parameters.array[fake_parameter_data_e], - &data_make->main->parameters.array[fake_parameter_documents_e], - &data_make->main->parameters.array[fake_parameter_fakefile_e], - &data_make->main->parameters.array[fake_parameter_licenses_e], - &data_make->main->parameters.array[fake_parameter_process_e], - &data_make->main->parameters.array[fake_parameter_settings_e], - &data_make->main->parameters.array[fake_parameter_sources_e], - &data_make->main->parameters.array[fake_parameter_work_e], + &data_make->program->parameters.array[fake_parameter_build_e], + &data_make->program->parameters.array[fake_parameter_data_e], + &data_make->program->parameters.array[fake_parameter_documents_e], + &data_make->program->parameters.array[fake_parameter_fakefile_e], + &data_make->program->parameters.array[fake_parameter_licenses_e], + &data_make->program->parameters.array[fake_parameter_process_e], + &data_make->program->parameters.array[fake_parameter_settings_e], + &data_make->program->parameters.array[fake_parameter_sources_e], + &data_make->program->parameters.array[fake_parameter_work_e], }; const f_string_dynamic_t source[] = { @@ -342,7 +342,7 @@ extern "C" { data_make->setting->state.status = f_string_dynamics_increase_by(fake_allocation_small_d, destination[i]); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_string_dynamics_increase_by)); + fake_print_error(&data_make->program->error, macro_fake_f(f_string_dynamics_increase_by)); return; } @@ -355,7 +355,7 @@ extern "C" { } if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_string_dynamics_increase)); + fake_print_error(&data_make->program->error, macro_fake_f(f_string_dynamics_increase)); return; } @@ -376,7 +376,7 @@ extern "C" { } if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_string_dynamic_append_nulless)); + fake_print_error(&data_make->program->error, macro_fake_f(f_string_dynamic_append_nulless)); return; } @@ -387,7 +387,7 @@ extern "C" { data_make->setting->state.status = f_string_dynamics_increase_by(fake_allocation_small_d, destination[i]); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_string_dynamics_increase_by)); + fake_print_error(&data_make->program->error, macro_fake_f(f_string_dynamics_increase_by)); return; } @@ -399,7 +399,7 @@ extern "C" { } if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_string_dynamic_append_nulless)); + fake_print_error(&data_make->program->error, macro_fake_f(f_string_dynamic_append_nulless)); return; } diff --git a/level_3/fake/c/main/make/operate.c b/level_3/fake/c/main/make/operate.c index cac46e9..aa99977 100644 --- a/level_3/fake/c/main/make/operate.c +++ b/level_3/fake/c/main/make/operate.c @@ -7,11 +7,11 @@ extern "C" { #ifndef _di_fake_make_operate_ void fake_make_operate(fake_data_t * const data) { - if (!data || !data->main || !data->setting) return; + if (!data || !data->program || !data->setting) return; - if (!((++data->main->signal_check) % fake_signal_check_d)) { - if (fll_program_standard_signal_received(data->main)) { - fll_program_print_signal_received(data->main->warning, data->setting->line_first, data->main->signal_received); + if (!((++data->program->signal_check) % fake_signal_check_d)) { + if (fll_program_standard_signal_received(data->program)) { + fll_program_print_signal_received(data->program->warning, data->program->signal_received); data->setting->state.status = F_status_set_error(F_interrupt); @@ -19,19 +19,19 @@ extern "C" { } } - fake_make_print_now_making(data->setting, data->main->message, data->setting->fakefile); + fake_make_print_now_making(data->setting, data->program->message, data->setting->fakefile); f_array_lengths_t section_stack = f_array_lengths_t_initialize; fake_make_data_t data_make = fake_make_data_t_initialize; data_make.data = data; - data_make.main = data->main; + data_make.program = data->program; data_make.setting = data->setting; data->setting->state.status = f_string_dynamics_increase(data->setting->state.step_small, &data_make.path.stack); if (F_status_is_error(data->setting->state.status)) { - fake_print_error(data_make.setting, data_make.main->error, macro_fake_f(f_string_dynamics_increase)); + fake_print_error(&data_make.program->error, macro_fake_f(f_string_dynamics_increase)); return; } @@ -39,7 +39,7 @@ extern "C" { data->setting->state.status = f_path_current(F_true, &data_make.path.stack.array[0]); if (F_status_is_error(data->setting->state.status)) { - fake_print_error(data_make.setting, data_make.main->error, macro_fake_f(f_path_current)); + fake_print_error(&data_make.program->error, macro_fake_f(f_path_current)); fake_make_data_delete(&data_make); @@ -49,7 +49,7 @@ extern "C" { data->setting->state.status = f_directory_open(data_make.path.stack.array[0], F_false, &data_make.path.top.id); if (F_status_is_error(data->setting->state.status)) { - fake_print_error(data_make.setting, data_make.main->error, macro_fake_f(f_directory_open)); + fake_print_error(&data_make.program->error, macro_fake_f(f_directory_open)); fake_make_data_delete(&data_make); @@ -60,7 +60,7 @@ extern "C" { fake_make_load_parameters(&data_make); - fake_make_load_fakefile(&data_make, data->main->pipe & fll_program_data_pipe_input_e); + fake_make_load_fakefile(&data_make, data->program->pipe & fll_program_data_pipe_input_e); if (F_status_is_error(data->setting->state.status)) { fake_make_data_delete(&data_make); @@ -79,32 +79,32 @@ extern "C" { if (data_make.setting_make.fail == fake_make_operation_fail_exit_e) { data_make.error.prefix = fl_print_error_s; data_make.error.suffix = f_string_empty_s; - data_make.error.context = data->main->context.set.error; - data_make.error.notable = data->main->context.set.notable; + data_make.error.context = data->program->context.set.error; + data_make.error.notable = data->program->context.set.notable; data_make.error.to.stream = F_type_error_d; data_make.error.to.id = F_type_descriptor_error_d; - data_make.error.set = &data->main->context.set; + data_make.error.set = &data->program->context.set; } else if (data_make.setting_make.fail == fake_make_operation_fail_warn_e) { data_make.error.prefix = fl_print_warning_s; data_make.error.suffix = f_string_empty_s; - data_make.error.context = data->main->context.set.warning; - data_make.error.notable = data->main->context.set.notable; + data_make.error.context = data->program->context.set.warning; + data_make.error.notable = data->program->context.set.notable; data_make.error.to.stream = F_type_output_d; data_make.error.to.id = F_type_descriptor_output_d; - data_make.error.set = &data->main->context.set; + data_make.error.set = &data->program->context.set; } else { data_make.error.to.stream = 0; data_make.error.prefix = f_string_empty_s; data_make.error.suffix = f_string_empty_s; data_make.error.to.id = -1; - data_make.error.set = &data->main->context.set; + data_make.error.set = &data->program->context.set; } - data_make.error.verbosity = data->main->message.verbosity; + data_make.error.verbosity = data->program->message.verbosity; - if (data->main->parameters.remaining.used) { + if (data->program->parameters.remaining.used) { f_array_length_t i = 0; f_array_length_t j = 0; f_string_range_t range = f_string_range_t_initialize; @@ -113,21 +113,21 @@ extern "C" { data->setting->state.status = F_none; // Validate the remaining parameters. - for (i = 0; i < data->main->parameters.remaining.used; ++i) { + for (i = 0; i < data->program->parameters.remaining.used; ++i) { - index = data->main->parameters.remaining.array[i]; + index = data->program->parameters.remaining.array[i]; - if (!data->main->parameters.arguments.array[index].used) { + if (!data->program->parameters.arguments.array[index].used) { data->setting->state.status = F_status_set_error(F_parameter); break; } range.start = 0; - range.stop = data->main->parameters.arguments.array[index].used - 1; + range.stop = data->program->parameters.arguments.array[index].used - 1; for (j = 0; j < data_make.fakefile.used; ++j) { - if (fl_string_dynamic_partial_compare(data->main->parameters.arguments.array[index], data_make.buffer, range, data_make.fakefile.array[j].name) == F_equal_to) break; + if (fl_string_dynamic_partial_compare(data->program->parameters.arguments.array[index], data_make.buffer, range, data_make.fakefile.array[j].name) == F_equal_to) break; } // for if (j == data_make.fakefile.used) { @@ -138,25 +138,25 @@ extern "C" { } // for if (F_status_is_error(data->setting->state.status)) { - fake_make_print_error_argument_invalid_section(data->setting, data->main->error, data->main->parameters.arguments.array[data->main->parameters.remaining.array[i]]); + fake_make_print_error_argument_invalid_section(data->setting, data->program->error, data->program->parameters.arguments.array[data->program->parameters.remaining.array[i]]); } else { int result = 0; - for (i = 0; i < data->main->parameters.remaining.used; ++i) { + for (i = 0; i < data->program->parameters.remaining.used; ++i) { - index = data->main->parameters.remaining.array[i]; + index = data->program->parameters.remaining.array[i]; range.start = 0; - range.stop = data->main->parameters.arguments.array[index].used - 1; + range.stop = data->program->parameters.arguments.array[index].used - 1; for (j = 0; j < data_make.fakefile.used; ++j) { - if (fl_string_dynamic_partial_compare(data->main->parameters.arguments.array[index], data_make.buffer, range, data_make.fakefile.array[j].name) == F_equal_to) { + if (fl_string_dynamic_partial_compare(data->program->parameters.arguments.array[index], data_make.buffer, range, data_make.fakefile.array[j].name) == F_equal_to) { { int result = fake_make_operate_section(&data_make, j, §ion_stack); if (data->setting->state.status == F_child) { - data->main->child = result; + data->program->child = result; break; } @@ -167,7 +167,7 @@ extern "C" { data->setting->state.status = f_path_change_at(data_make.path.top.id); if (F_status_is_error(data->setting->state.status)) { - fake_make_print_warning_cannot_change_back(data->setting, data->main->warning, data_make.path.stack.array[0]); + fake_make_print_warning_cannot_change_back(data->setting, data->program->warning, data_make.path.stack.array[0]); } data->setting->state.status = status; @@ -187,7 +187,7 @@ extern "C" { const int result = fake_make_operate_section(&data_make, data_make.id_main, §ion_stack); if (data->setting->state.status == F_child) { - data->main->child = result; + data->program->child = result; } } @@ -197,7 +197,7 @@ extern "C" { data->setting->state.status = f_path_change_at(data_make.path.top.id); if (F_status_is_error(data->setting->state.status)) { - fake_make_print_warning_cannot_change_back(data->setting, data->main->warning, data_make.path.stack.array[0]); + fake_make_print_warning_cannot_change_back(data->setting, data->program->warning, data_make.path.stack.array[0]); } data->setting->state.status = status; @@ -219,7 +219,7 @@ extern "C" { #ifndef _di_fake_make_operate_expand_ void fake_make_operate_expand(fake_make_data_t * const data_make, const f_string_range_t section_name, const f_fss_content_t content, const f_uint8s_t quotes) { - if (!data_make || !data_make->main || !data_make->setting) return; + if (!data_make || !data_make->program || !data_make->setting) return; if (F_status_is_error(data_make->setting->state.status)) return; if (!content.used) return; @@ -227,7 +227,7 @@ extern "C" { data_make->setting->state.status = f_string_dynamics_increase_by(content.used, &data_make->cache_arguments); if (F_status_is_error(data_make->setting->state.status) || data_make->setting->state.status == F_string_too_large) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_string_dynamics_increase_by)); + fake_print_error(&data_make->program->error, macro_fake_f(f_string_dynamics_increase_by)); return; } @@ -348,7 +348,7 @@ extern "C" { data_make->setting->state.status = f_string_dynamics_increase(data_make->setting->state.step_small, &data_make->cache_arguments); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_string_dynamics_increase)); + fake_print_error(&data_make->program->error, macro_fake_f(f_string_dynamics_increase)); return; } @@ -370,7 +370,7 @@ extern "C" { data_make->setting->state.status = f_string_dynamics_increase(data_make->setting->state.step_small, &data_make->cache_arguments); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_string_dynamics_increase)); + fake_print_error(&data_make->program->error, macro_fake_f(f_string_dynamics_increase)); break; } @@ -387,7 +387,7 @@ extern "C" { if (F_status_is_error(data_make->setting->state.status)) { if (F_status_set_fine(data_make->setting->state.status) != F_interrupt) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(fl_iki_read)); + fake_print_error(&data_make->program->error, macro_fake_f(fl_iki_read)); } break; @@ -408,7 +408,7 @@ extern "C" { data_make->setting->state.status = f_string_dynamic_partial_append_nulless(data_make->buffer, range, &data_make->cache_arguments.array[data_make->cache_arguments.used]); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_string_dynamic_partial_append_nulless)); + fake_print_error(&data_make->program->error, macro_fake_f(f_string_dynamic_partial_append_nulless)); break; } @@ -444,7 +444,7 @@ extern "C" { } if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(fl_string_dynamic_partial_compare)); + fake_print_error(&data_make->program->error, macro_fake_f(fl_string_dynamic_partial_compare)); break; } @@ -459,7 +459,7 @@ extern "C" { data_make->setting->state.status = f_string_dynamic_append_nulless(data_make->setting_make.parameter.array[0].value.array[0], &data_make->cache_arguments.array[data_make->cache_arguments.used]); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_string_dynamic_append_nulless)); + fake_print_error(&data_make->program->error, macro_fake_f(f_string_dynamic_append_nulless)); break; } @@ -468,7 +468,7 @@ extern "C" { data_make->setting->state.status = f_string_dynamic_append(f_string_ascii_0_s, &data_make->cache_arguments.array[data_make->cache_arguments.used]); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_string_dynamic_append)); + fake_print_error(&data_make->program->error, macro_fake_f(f_string_dynamic_append)); break; } @@ -482,7 +482,7 @@ extern "C" { data_make->setting->state.status = f_string_dynamic_increase_by(data_make->path.stack.array[0].used + f_path_separator_s.used + 1, &data_make->cache_arguments.array[data_make->cache_arguments.used]); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_string_dynamic_increase_by)); + fake_print_error(&data_make->program->error, macro_fake_f(f_string_dynamic_increase_by)); break; } @@ -490,7 +490,7 @@ extern "C" { data_make->setting->state.status = f_string_dynamic_append(data_make->path.stack.array[0], &data_make->cache_arguments.array[data_make->cache_arguments.used]); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_string_dynamic_append)); + fake_print_error(&data_make->program->error, macro_fake_f(f_string_dynamic_append)); break; } @@ -499,7 +499,7 @@ extern "C" { data_make->setting->state.status = f_string_dynamic_append_assure(f_path_separator_s, &data_make->cache_arguments.array[data_make->cache_arguments.used]); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_string_dynamic_append_assure)); + fake_print_error(&data_make->program->error, macro_fake_f(f_string_dynamic_append_assure)); break; } @@ -513,7 +513,7 @@ extern "C" { data_make->setting->state.status = f_string_dynamic_increase_by(data_make->path.stack.array[data_make->path.stack.used - 1].used + f_path_separator_s.used + 1, &data_make->cache_arguments.array[data_make->cache_arguments.used]); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_string_dynamic_increase_by)); + fake_print_error(&data_make->program->error, macro_fake_f(f_string_dynamic_increase_by)); break; } @@ -521,7 +521,7 @@ extern "C" { data_make->setting->state.status = f_string_dynamic_append(data_make->path.stack.array[data_make->path.stack.used - 1], &data_make->cache_arguments.array[data_make->cache_arguments.used]); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_string_dynamic_append)); + fake_print_error(&data_make->program->error, macro_fake_f(f_string_dynamic_append)); break; } @@ -530,7 +530,7 @@ extern "C" { data_make->setting->state.status = f_string_dynamic_append_assure(f_path_separator_s, &data_make->cache_arguments.array[data_make->cache_arguments.used]); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_string_dynamic_append_assure)); + fake_print_error(&data_make->program->error, macro_fake_f(f_string_dynamic_append_assure)); break; } @@ -564,7 +564,7 @@ extern "C" { data_make->setting->state.status = f_string_dynamic_increase_by(l + f_string_space_s.used + 1, &data_make->cache_arguments.array[data_make->cache_arguments.used]); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_string_dynamic_increase_by)); + fake_print_error(&data_make->program->error, macro_fake_f(f_string_dynamic_increase_by)); break; } @@ -577,7 +577,7 @@ extern "C" { data_make->setting->state.status = f_string_dynamic_append(f_string_space_s, &data_make->cache_arguments.array[data_make->cache_arguments.used]); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_string_dynamic_append)); + fake_print_error(&data_make->program->error, macro_fake_f(f_string_dynamic_append)); break; } @@ -586,7 +586,7 @@ extern "C" { data_make->setting->state.status = f_string_dynamic_append_nulless(reserved_value[k]->array[l], &data_make->cache_arguments.array[data_make->cache_arguments.used]); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_string_dynamic_append_nulless)); + fake_print_error(&data_make->program->error, macro_fake_f(f_string_dynamic_append_nulless)); break; } @@ -609,7 +609,7 @@ extern "C" { data_make->setting->state.status = f_string_dynamics_increase(data_make->setting->state.step_small, &data_make->cache_arguments); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_string_dynamics_increase)); + fake_print_error(&data_make->program->error, macro_fake_f(f_string_dynamics_increase)); break; } @@ -620,7 +620,7 @@ extern "C" { data_make->setting->state.status = f_string_dynamic_append_nulless(reserved_value[k]->array[l], &data_make->cache_arguments.array[data_make->cache_arguments.used]); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_string_dynamic_append_nulless)); + fake_print_error(&data_make->program->error, macro_fake_f(f_string_dynamic_append_nulless)); break; } @@ -662,7 +662,7 @@ extern "C" { data_make->setting->state.status = f_string_dynamic_increase_by(l + f_string_space_s.used + 1, &data_make->cache_arguments.array[data_make->cache_arguments.used]); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_string_dynamic_increase_by)); + fake_print_error(&data_make->program->error, macro_fake_f(f_string_dynamic_increase_by)); break; } @@ -677,7 +677,7 @@ extern "C" { data_make->setting->state.status = f_string_dynamic_append(f_string_space_s, &data_make->cache_arguments.array[data_make->cache_arguments.used]); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_string_dynamic_append)); + fake_print_error(&data_make->program->error, macro_fake_f(f_string_dynamic_append)); break; } @@ -690,7 +690,7 @@ extern "C" { data_make->setting->state.status = f_string_dynamics_increase(data_make->setting->state.step_small, &data_make->cache_arguments); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_string_dynamics_increase)); + fake_print_error(&data_make->program->error, macro_fake_f(f_string_dynamics_increase)); break; } @@ -702,7 +702,7 @@ extern "C" { data_make->setting->state.status = f_string_dynamic_append_nulless(parameter->array[k].value.array[l], &data_make->cache_arguments.array[data_make->cache_arguments.used]); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_string_dynamic_append_nulless)); + fake_print_error(&data_make->program->error, macro_fake_f(f_string_dynamic_append_nulless)); break; } @@ -723,7 +723,7 @@ extern "C" { fake_make_operate_expand_build(data_make, quotes.array[i], iki_data->content.array[j]); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(fake_make_operate_expand_build)); + fake_print_error(&data_make->program->error, macro_fake_f(fake_make_operate_expand_build)); break; } @@ -737,7 +737,7 @@ extern "C" { fake_make_operate_expand_environment(data_make, quotes.array[i], iki_data->content.array[j]); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(fake_make_operate_expand_environment)); + fake_print_error(&data_make->program->error, macro_fake_f(fake_make_operate_expand_environment)); break; } @@ -750,7 +750,7 @@ extern "C" { fake_make_operate_expand_context(data_make, quotes.array[i], iki_data->content.array[j]); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(fake_make_operate_expand_context)); + fake_print_error(&data_make->program->error, macro_fake_f(fake_make_operate_expand_context)); break; } @@ -767,7 +767,7 @@ extern "C" { data_make->setting->state.status = f_string_dynamic_partial_append_nulless(data_make->buffer, range, &data_make->cache_arguments.array[data_make->cache_arguments.used]); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_string_dynamic_partial_append_nulless)); + fake_print_error(&data_make->program->error, macro_fake_f(f_string_dynamic_partial_append_nulless)); break; } @@ -785,7 +785,7 @@ extern "C" { data_make->setting->state.status = f_string_dynamic_partial_append_nulless(data_make->buffer, range, &data_make->cache_arguments.array[data_make->cache_arguments.used]); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_string_dynamic_partial_append_nulless)); + fake_print_error(&data_make->program->error, macro_fake_f(f_string_dynamic_partial_append_nulless)); break; } @@ -797,7 +797,7 @@ extern "C" { data_make->setting->state.status = f_string_dynamics_increase(data_make->setting->state.step_small, &data_make->cache_arguments); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_string_dynamics_increase)); + fake_print_error(&data_make->program->error, macro_fake_f(f_string_dynamics_increase)); break; } @@ -809,7 +809,7 @@ extern "C" { data_make->setting->state.status = f_string_dynamic_partial_append_nulless(data_make->buffer, content.array[i], &data_make->cache_arguments.array[data_make->cache_arguments.used]); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_string_dynamic_partial_append_nulless)); + fake_print_error(&data_make->program->error, macro_fake_f(f_string_dynamic_partial_append_nulless)); break; } @@ -819,7 +819,7 @@ extern "C" { data_make->setting->state.status = f_string_dynamics_increase(data_make->setting->state.step_small, &data_make->cache_arguments); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_string_dynamics_increase)); + fake_print_error(&data_make->program->error, macro_fake_f(f_string_dynamics_increase)); break; } @@ -1133,7 +1133,7 @@ extern "C" { #ifndef _di_fake_make_operate_expand_context_ void fake_make_operate_expand_context(fake_make_data_t * const data_make, const uint8_t quote, const f_string_range_t range_name) { - if (!data_make || !data_make->main || !data_make->setting) return; + if (!data_make || !data_make->program || !data_make->setting) return; const f_string_static_t *context = 0; @@ -1150,15 +1150,15 @@ extern "C" { }; const f_color_set_t context_value[] = { - data_make->main->context.set.error, - data_make->main->context.set.important, - data_make->main->context.set.normal, - data_make->main->context.set.notable, - data_make->main->context.set.reset, - data_make->main->context.set.standout, - data_make->main->context.set.success, - data_make->main->context.set.title, - data_make->main->context.set.warning, + data_make->program->context.set.error, + data_make->program->context.set.important, + data_make->program->context.set.normal, + data_make->program->context.set.notable, + data_make->program->context.set.reset, + data_make->program->context.set.standout, + data_make->program->context.set.success, + data_make->program->context.set.title, + data_make->program->context.set.warning, }; for (f_array_length_t i = 0; i < 9; ++i) { @@ -1182,7 +1182,7 @@ extern "C" { #ifndef _di_fake_make_operate_expand_environment_ void fake_make_operate_expand_environment(fake_make_data_t * const data_make, const uint8_t quote, const f_string_range_t range_name) { - if (!data_make || !data_make->main || !data_make->setting) return; + if (!data_make || !data_make->program || !data_make->setting) return; data_make->setting->state.status = F_none; @@ -1233,13 +1233,13 @@ extern "C" { #ifndef _di_fake_make_operate_section_ int fake_make_operate_section(fake_make_data_t * const data_make, const f_array_length_t id_section, f_array_lengths_t * const section_stack) { - if (!data_make || !data_make->main || !data_make->setting || !section_stack) return 0; - if (F_status_is_error(data_make->setting->state.status) || data_make->setting->state.status == F_child) return data_make->main->child; + if (!data_make || !data_make->program || !data_make->setting || !section_stack) return 0; + if (F_status_is_error(data_make->setting->state.status) || data_make->setting->state.status == F_child) return data_make->program->child; if (id_section >= data_make->fakefile.used) { data_make->setting->state.status = F_status_set_error(F_parameter); - fake_print_error(data_make->setting, data_make->error, macro_fake_f(fake_make_operate_section)); + fake_print_error(&data_make->error, macro_fake_f(fake_make_operate_section)); return 0; } @@ -1248,7 +1248,7 @@ extern "C" { data_make->setting->state.status = f_array_lengths_increase(data_make->setting->state.step_small, section_stack); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->error, macro_fake_f(f_array_lengths_increase)); + fake_print_error(&data_make->error, macro_fake_f(f_array_lengths_increase)); return 0; } @@ -1257,7 +1257,7 @@ extern "C" { const f_fss_named_t *section = &data_make->fakefile.array[id_section]; - fake_make_print_processing_section(data_make->setting, data_make->main->message, data_make->buffer, *section); + fake_make_print_processing_section(data_make->setting, data_make->program->message, data_make->buffer, *section); if (!section->objects.used) { --section_stack->used; @@ -1358,16 +1358,16 @@ extern "C" { state_process.operation_previous = state_process.operation; state_process.operation = 0; - if (!((++data_make->main->signal_check) % fake_signal_check_short_d)) { - if (fll_program_standard_signal_received(data_make->main)) { - fll_program_print_signal_received(data_make->main->warning, data_make->setting->line_first, data_make->main->signal_received); + if (!((++data_make->program->signal_check) % fake_signal_check_short_d)) { + if (fll_program_standard_signal_received(data_make->program)) { + fll_program_print_signal_received(data_make->program->warning, data_make->program->signal_received); data_make->setting->state.status = F_status_set_error(F_interrupt); break; } - data_make->main->signal_check = 0; + data_make->program->signal_check = 0; } for (j = 0; j < fake_max_operation_d; ++j) { @@ -1429,11 +1429,11 @@ extern "C" { data_make->setting_make.fail = fake_make_operation_fail_exit_e; data_make->error.prefix = fl_print_error_s; data_make->error.suffix = f_string_empty_s; - data_make->error.context = data_make->main->context.set.error; - data_make->error.notable = data_make->main->context.set.notable; - data_make->main->error.to.stream = F_type_error_d; - data_make->main->error.to.id = F_type_descriptor_error_d; - data_make->error.set = &data_make->main->context.set; + data_make->error.context = data_make->program->context.set.error; + data_make->error.notable = data_make->program->context.set.notable; + data_make->program->error.to.stream = F_type_error_d; + data_make->program->error.to.id = F_type_descriptor_error_d; + data_make->error.set = &data_make->program->context.set; } fake_print_error_operation_failed(data_make->setting, data_make->error, data_make->buffer, section->name, section->objects.array[i]); @@ -1483,7 +1483,7 @@ extern "C" { if (F_status_set_error(data_make->setting->state.status) == F_interrupt) return 0; if (i == section->objects.used && F_status_is_error_not(data_make->setting->state.status) && (state_process.operation == fake_make_operation_type_and_e || state_process.operation == fake_make_operation_type_else_e || state_process.operation == fake_make_operation_type_if_e || state_process.operation == fake_make_operation_type_or_e)) { - fake_make_print_error_operation_incomplete(data_make->setting, data_make->main->error, state_process.operation); + fake_make_print_error_operation_incomplete(data_make->setting, data_make->program->error, state_process.operation); fake_print_error_operation_failed(data_make->setting, data_make->error, data_make->buffer, section->name, section->objects.array[section->objects.used - 1]); diff --git a/level_3/fake/c/main/make/operate_block.c b/level_3/fake/c/main/make/operate_block.c index 50e9d55..e5db03d 100644 --- a/level_3/fake/c/main/make/operate_block.c +++ b/level_3/fake/c/main/make/operate_block.c @@ -55,7 +55,7 @@ extern "C" { #ifndef _di_fake_make_operate_block_postprocess_ void fake_make_operate_block_postprocess(fake_make_data_t * const data_make, const bool last, fake_state_process_t * const state_process) { - if (!data_make || !data_make->main || !data_make->setting || !state_process) return; + if (!data_make || !data_make->program || !data_make->setting || !state_process) return; if (F_status_is_error(data_make->setting->state.status)) { state_process->block_result = fake_condition_result_error_e; diff --git a/level_3/fake/c/main/make/operate_process.c b/level_3/fake/c/main/make/operate_process.c index 73e533b..9c79dae 100644 --- a/level_3/fake/c/main/make/operate_process.c +++ b/level_3/fake/c/main/make/operate_process.c @@ -7,8 +7,8 @@ extern "C" { #ifndef _di_fake_make_operate_process_ int fake_make_operate_process(fake_make_data_t * const data_make, const f_string_range_t section_name, fake_state_process_t * const state_process, f_array_lengths_t * const section_stack) { - if (!data_make || !data_make->main || !data_make->setting || !state_process || !section_stack) return 0; - if (data_make->setting->state.status == F_child) return data_make->data->main->child; + if (!data_make || !data_make->program || !data_make->setting || !state_process || !section_stack) return 0; + if (data_make->setting->state.status == F_child) return data_make->program->child; if (state_process->operation == fake_make_operation_type_break_e) { fake_make_operate_process_type_break(data_make); @@ -117,7 +117,7 @@ extern "C" { #ifndef _di_fake_make_operate_process_buffer_escape_ void fake_make_operate_process_buffer_escape(fake_make_data_t * const data_make, const f_string_static_t source, f_string_dynamic_t * const destination) { - if (!data_make || !data_make->main || !data_make->setting || !destination) return; + if (!data_make || !data_make->program || !data_make->setting || !destination) return; if (!source.used) { data_make->setting->state.status = F_data_not; @@ -278,7 +278,7 @@ extern "C" { #ifndef _di_fake_make_operate_process_execute_ void fake_make_operate_process_execute(fake_make_data_t * const data_make, const f_string_static_t program, const f_string_statics_t arguments, const bool as_shell) { - if (!data_make || !data_make->main || !data_make->setting) return; + if (!data_make || !data_make->program || !data_make->setting) return; if (!program.used && !arguments.used) { data_make->setting->state.status = F_data_not; @@ -286,8 +286,8 @@ extern "C" { return; } - if (fll_program_standard_signal_received(data_make->main)) { - fll_program_print_signal_received(data_make->main->warning, data_make->data->setting->line_first, data_make->main->signal_received); + if (fll_program_standard_signal_received(data_make->program)) { + fll_program_print_signal_received(data_make->program->warning, data_make->program->signal_received); data_make->setting->state.status = F_status_set_error(F_interrupt); @@ -307,7 +307,7 @@ extern "C" { data_make->setting->state.status = fl_environment_load_names(data_make->setting_build.environment, &data_make->environment); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(fl_environment_load_names)); + fake_print_error(&data_make->program->error, macro_fake_f(fl_environment_load_names)); return; } @@ -316,13 +316,13 @@ extern "C" { data_make->setting->state.status = f_environment_get_all(&data_make->environment); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_environment_get_all)); + fake_print_error(&data_make->program->error, macro_fake_f(f_environment_get_all)); return; } } - fake_make_print_verbose_operate_program(data_make->setting, data_make->main->message, program, arguments); + fake_make_print_verbose_operate_program(data_make->setting, data_make->program->message, program, arguments); // Child processes should receive all signals, without blocking. f_signal_how_t signals = f_signal_how_t_initialize; @@ -335,8 +335,8 @@ extern "C" { data_make->setting->state.status = fll_execute_program(program, arguments, ¶meter, 0, (void *) &return_code); - if (fll_program_standard_signal_received(data_make->main)) { - fll_program_print_signal_received(data_make->main->warning, data_make->data->setting->line_first, data_make->main->signal_received); + if (fll_program_standard_signal_received(data_make->program)) { + fll_program_print_signal_received(data_make->program->warning, data_make->program->signal_received); data_make->setting->state.status = F_status_set_error(F_interrupt); @@ -347,10 +347,10 @@ extern "C" { if (F_status_set_fine(data_make->setting->state.status) == F_interrupt) return; if (F_status_set_fine(data_make->setting->state.status) == F_file_found_not) { - fake_make_print_error_program_not_found(data_make->setting, data_make->main->error, program); + fake_make_print_error_program_not_found(data_make->setting, data_make->program->error, program); } else if (F_status_set_fine(data_make->setting->state.status) != F_failure) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(fll_execute_program)); + fake_print_error(&data_make->program->error, macro_fake_f(fll_execute_program)); } } @@ -363,7 +363,7 @@ extern "C" { #ifndef _di_fake_make_operate_process_return_ void fake_make_operate_process_return(fake_make_data_t * const data_make, const int return_code) { - if (!data_make || !data_make->main || !data_make->setting) return; + if (!data_make || !data_make->program || !data_make->setting) return; const f_status_t status_original = data_make->setting->state.status; @@ -375,7 +375,7 @@ extern "C" { data_make->setting->state.status = f_conversion_number_signed_to_string(WEXITSTATUS(return_code), f_conversion_data_base_10_c, &number); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_conversion_number_signed_to_string)); + fake_print_error(&data_make->program->error, macro_fake_f(f_conversion_number_signed_to_string)); f_string_dynamic_resize(0, &number); @@ -387,12 +387,12 @@ extern "C" { f_string_dynamic_resize(0, &number); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_string_dynamic_append)); + fake_print_error(&data_make->program->error, macro_fake_f(f_string_dynamic_append)); return; } - fake_make_print_error_program_failed(data_make->setting, data_make->main->error, return_code); + fake_make_print_error_program_failed(data_make->setting, data_make->program->error, return_code); data_make->setting->state.status = (data_make->setting_make.fail == fake_make_operation_fail_exit_e) ? F_status_set_error(F_failure) : F_failure; @@ -418,7 +418,7 @@ extern "C" { #ifndef _di_fake_make_operate_process_run_ void fake_make_operate_process_run(fake_make_data_t * const data_make, const bool as_shell) { - if (!data_make || !data_make->main || !data_make->setting) return; + if (!data_make || !data_make->program || !data_make->setting) return; if (!data_make->cache_arguments.used) { data_make->setting->state.status = F_data_not; diff --git a/level_3/fake/c/main/make/operate_process_type.c b/level_3/fake/c/main/make/operate_process_type.c index 6c17737..c5ca6bf 100644 --- a/level_3/fake/c/main/make/operate_process_type.c +++ b/level_3/fake/c/main/make/operate_process_type.c @@ -7,7 +7,7 @@ extern "C" { #ifndef _di_fake_make_operate_process_type_break_ void fake_make_operate_process_type_break(fake_make_data_t * const data_make) { - if (!data_make || !data_make->main || !data_make->setting) return; + if (!data_make || !data_make->program || !data_make->setting) return; data_make->setting->state.status = F_none; @@ -23,14 +23,14 @@ extern "C" { return; } - fake_make_print_verbose_operate_break(data_make->setting, data_make->main->message, data_make->cache_arguments); + fake_make_print_verbose_operate_break(data_make->setting, data_make->program->message, data_make->cache_arguments); } #endif // _di_fake_make_operate_process_type_break_ #ifndef _di_fake_make_operate_process_type_build_ void fake_make_operate_process_type_build(fake_make_data_t * const data_make) { - if (!data_make || !data_make->main || !data_make->setting) return; + if (!data_make || !data_make->program || !data_make->setting) return; fake_build_operate(data_make->data, data_make->cache_arguments.used ? &data_make->cache_arguments : 0, F_false); if (F_status_set_fine(data_make->setting->state.status) == F_interrupt) return; @@ -42,7 +42,7 @@ extern "C" { #ifndef _di_fake_make_operate_process_type_clean_ void fake_make_operate_process_type_clean(fake_make_data_t * const data_make) { - if (!data_make || !data_make->main || !data_make->setting) return; + if (!data_make || !data_make->program || !data_make->setting) return; fake_clean_operate(data_make->data); if (F_status_set_fine(data_make->setting->state.status) == F_interrupt) return; @@ -59,7 +59,7 @@ extern "C" { const int result = fake_execute(data_make->data, data_make->environment, data_make->setting_build.build_compiler, data_make->cache_arguments); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(fake_execute)); + fake_print_error(&data_make->program->error, macro_fake_f(fake_execute)); } else if (data_make->setting->state.status == F_child) { return result; @@ -74,7 +74,7 @@ extern "C" { #ifndef _di_fake_make_operate_process_type_condition_ void fake_make_operate_process_type_condition(fake_make_data_t * const data_make, fake_state_process_t * const state_process) { - if (!data_make || !data_make->main || !data_make->setting) return; + if (!data_make || !data_make->program || !data_make->setting) return; data_make->setting->state.status = F_none; @@ -195,7 +195,7 @@ extern "C" { #ifndef _di_fake_make_operate_process_type_copy_ void fake_make_operate_process_type_copy(fake_make_data_t * const data_make, const bool clone) { - if (!data_make || !data_make->main || !data_make->setting) return; + if (!data_make || !data_make->program || !data_make->setting) return; const f_array_length_t total = data_make->cache_arguments.used - 1; f_string_static_t destination = f_string_static_t_initialize; @@ -207,7 +207,7 @@ extern "C" { } else { recurse.verbose = fake_print_verbose_copy; - macro_f_mode_t_set_default_umask(recurse.mode, data_make->main->umask); + macro_f_mode_t_set_default_umask(recurse.mode, data_make->program->umask); } bool existing = F_true; @@ -223,10 +223,12 @@ extern "C" { data_make->setting->state.status = f_directory_is(data_make->cache_arguments.array[1]); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error_file(data_make->setting, data_make->main->error, macro_fake_f(f_directory_is), data_make->cache_arguments.array[1], f_file_operation_identify_s, fll_error_file_type_path_e); + fake_print_error_file(data_make->setting, data_make->program->error, macro_fake_f(f_directory_is), data_make->cache_arguments.array[1], f_file_operation_identify_s, fll_error_file_type_path_e); data_make->setting->state.status = F_status_set_error(F_failure); + f_directory_recurse_delete(&recurse); + return; } @@ -245,10 +247,12 @@ extern "C" { data_make->setting->state.status = f_file_name_base(data_make->cache_arguments.array[i], &data_make->cache_path); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error_file(data_make->setting, data_make->main->error, macro_fake_f(f_file_name_base), data_make->cache_arguments.array[i], f_file_operation_process_s, fll_error_file_type_path_e); + fake_print_error_file(data_make->setting, data_make->program->error, macro_fake_f(f_file_name_base), data_make->cache_arguments.array[i], f_file_operation_process_s, fll_error_file_type_path_e); data_make->setting->state.status = F_status_set_error(F_failure); + f_directory_recurse_delete(&recurse); + return; } @@ -294,7 +298,7 @@ extern "C" { if (F_status_is_error(recurse.state.status)) { data_make->setting->state.status = recurse.state.status; - fake_print_error_file(data_make->setting, data_make->main->error, macro_fake_f(fl_directory_copy), data_make->cache_arguments.array[i], clone ? f_file_operation_clone_s : f_file_operation_copy_s, fll_error_file_type_directory_e); + fake_print_error_file(data_make->setting, data_make->program->error, macro_fake_f(fl_directory_copy), data_make->cache_arguments.array[i], clone ? f_file_operation_clone_s : f_file_operation_copy_s, fll_error_file_type_directory_e); data_make->setting->state.status = F_status_set_error(F_failure); } @@ -308,17 +312,17 @@ extern "C" { } if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error_file(data_make->setting, data_make->main->error, clone ? macro_fake_f(f_file_clone) : macro_fake_f(f_file_copy), data_make->cache_arguments.array[i], clone ? f_file_operation_clone_s : f_file_operation_copy_s, fll_error_file_type_file_e); + fake_print_error_file(data_make->setting, data_make->program->error, clone ? macro_fake_f(f_file_clone) : macro_fake_f(f_file_copy), data_make->cache_arguments.array[i], clone ? f_file_operation_clone_s : f_file_operation_copy_s, fll_error_file_type_file_e); data_make->setting->state.status = F_status_set_error(F_failure); break; } - fake_make_print_verbose_operate_copy(data_make->setting, data_make->main->message, clone, data_make->cache_arguments.array[i], destination); + fake_make_print_verbose_operate_copy(data_make->setting, data_make->program->message, clone, data_make->cache_arguments.array[i], destination); } else if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error_file(data_make->setting, data_make->main->error, macro_fake_f(f_directory_is), data_make->cache_arguments.array[i], f_file_operation_identify_s, fll_error_file_type_directory_e); + fake_print_error_file(data_make->setting, data_make->program->error, macro_fake_f(f_directory_is), data_make->cache_arguments.array[i], f_file_operation_identify_s, fll_error_file_type_directory_e); data_make->setting->state.status = F_status_set_error(F_failure); @@ -337,7 +341,7 @@ extern "C" { #ifndef _di_fake_make_operate_process_type_define_ void fake_make_operate_process_type_define(fake_make_data_t * const data_make) { - if (!data_make || !data_make->main || !data_make->setting) return; + if (!data_make || !data_make->program || !data_make->setting) return; if (data_make->cache_arguments.used > 1) { data_make->setting->state.status = f_environment_set(data_make->cache_arguments.array[0], data_make->cache_arguments.array[1], F_true); @@ -347,10 +351,10 @@ extern "C" { } if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_environment_set)); + fake_print_error(&data_make->program->error, macro_fake_f(f_environment_set)); } else { - fake_make_print_verbose_operate_define(data_make->setting, data_make->main->message, data_make->cache_arguments.array[0]); + fake_make_print_verbose_operate_define(data_make->setting, data_make->program->message, data_make->cache_arguments.array[0]); data_make->setting->state.status = F_none; } @@ -360,7 +364,7 @@ extern "C" { #ifndef _di_fake_make_operate_process_type_deletes_ void fake_make_operate_process_type_deletes(fake_make_data_t * const data_make, const bool all) { - if (!data_make || !data_make->main || !data_make->setting) return; + if (!data_make || !data_make->program || !data_make->setting) return; const int recursion_max = all ? F_directory_max_descriptors_d : 0; struct stat file_stat; @@ -375,12 +379,12 @@ extern "C" { if (F_status_is_error(data_make->setting->state.status)) { if (F_status_set_fine(data_make->setting->state.status) == F_file_found_not) { - fake_make_print_warning_file_not_found(data_make->setting, data_make->main->warning, data_make->cache_arguments.array[i]); + fake_make_print_warning_file_not_found(data_make->setting, data_make->program->warning, data_make->cache_arguments.array[i]); data_make->setting->state.status = F_none; } else { - fake_print_error_file(data_make->setting, data_make->main->error, macro_fake_f(f_file_stat), data_make->cache_arguments.array[i], f_file_operation_delete_s, fll_error_file_type_file_e); + fake_print_error_file(data_make->setting, data_make->program->error, macro_fake_f(f_file_stat), data_make->cache_arguments.array[i], f_file_operation_delete_s, fll_error_file_type_file_e); data_make->setting->state.status = F_status_set_error(F_failure); @@ -388,7 +392,7 @@ extern "C" { } } else if (macro_f_file_type_is_directory(file_stat.st_mode)) { - if (data_make->main->error.verbosity >= f_console_verbosity_verbose_e) { + if (data_make->program->error.verbosity >= f_console_verbosity_verbose_e) { data_make->setting->state.status = f_directory_remove_custom(data_make->cache_arguments.array[i], recursion_max, F_false, fake_clean_remove_recursively_verbosely); } else { @@ -396,13 +400,13 @@ extern "C" { } if (F_status_set_fine(data_make->setting->state.status) == F_file_found_not) { - fake_make_print_verbose_operate_file_not_found(data_make->setting, data_make->main->message, F_true, data_make->cache_arguments.array[i]); + fake_make_print_verbose_operate_file_not_found(data_make->setting, data_make->program->message, F_true, data_make->cache_arguments.array[i]); data_make->setting->state.status = F_none; } if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error_file(data_make->setting, data_make->main->error, macro_fake_f(f_directory_remove), data_make->cache_arguments.array[i], f_file_operation_delete_s, fll_error_file_type_directory_e); + fake_print_error_file(data_make->setting, data_make->program->error, macro_fake_f(f_directory_remove), data_make->cache_arguments.array[i], f_file_operation_delete_s, fll_error_file_type_directory_e); data_make->setting->state.status = F_status_set_error(F_failure); @@ -413,15 +417,15 @@ extern "C" { data_make->setting->state.status = f_file_remove(data_make->cache_arguments.array[i]); if (F_status_set_fine(data_make->setting->state.status) == F_file_found_not) { - if (data_make->main->error.verbosity >= f_console_verbosity_verbose_e) { - fake_make_print_verbose_operate_file_not_found(data_make->setting, data_make->main->message, F_false, data_make->cache_arguments.array[i]); + if (data_make->program->error.verbosity >= f_console_verbosity_verbose_e) { + fake_make_print_verbose_operate_file_not_found(data_make->setting, data_make->program->message, F_false, data_make->cache_arguments.array[i]); } data_make->setting->state.status = F_none; } if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error_file(data_make->setting, data_make->main->error, macro_fake_f(f_file_remove), data_make->cache_arguments.array[i], f_file_operation_delete_s, fll_error_file_type_file_e); + fake_print_error_file(data_make->setting, data_make->program->error, macro_fake_f(f_file_remove), data_make->cache_arguments.array[i], f_file_operation_delete_s, fll_error_file_type_file_e); data_make->setting->state.status = F_status_set_error(F_failure); @@ -429,7 +433,7 @@ extern "C" { } } - fake_make_print_verbose_operate_delete(data_make->setting, data_make->main->message, data_make->cache_arguments.array[i]); + fake_make_print_verbose_operate_delete(data_make->setting, data_make->program->message, data_make->cache_arguments.array[i]); } // for data_make->setting->state.status = F_none; @@ -439,7 +443,7 @@ extern "C" { #ifndef _di_fake_make_operate_process_type_exit_ void fake_make_operate_process_type_exit(fake_make_data_t * const data_make) { - if (!data_make || !data_make->main || !data_make->setting) return; + if (!data_make || !data_make->program || !data_make->setting) return; data_make->setting->state.status = F_none; @@ -453,11 +457,11 @@ extern "C" { data_make->setting_make.fail = fake_make_operation_fail_exit_e; data_make->error.prefix = fl_print_error_s; data_make->error.suffix = f_string_empty_s; - data_make->error.context = data_make->main->context.set.error; - data_make->error.notable = data_make->main->context.set.notable; - data_make->main->error.to.stream = F_type_error_d; - data_make->main->error.to.id = F_type_descriptor_error_d; - data_make->error.set = &data_make->main->context.set; + data_make->error.context = data_make->program->context.set.error; + data_make->error.notable = data_make->program->context.set.notable; + data_make->program->error.to.stream = F_type_error_d; + data_make->program->error.to.id = F_type_descriptor_error_d; + data_make->error.set = &data_make->program->context.set; } else { data_make->setting->state.status = F_none; @@ -465,49 +469,49 @@ extern "C" { return; } - fake_make_print_verbose_operate_exiting_as(data_make->setting, data_make->main->message, data_make->cache_arguments); + fake_make_print_verbose_operate_exiting_as(data_make->setting, data_make->program->message, data_make->cache_arguments); } #endif // _di_fake_make_operate_process_type_exit_ #ifndef _di_fake_make_operate_process_type_fail_ void fake_make_operate_process_type_fail(fake_make_data_t * const data_make) { - if (!data_make || !data_make->main || !data_make->setting) return; + if (!data_make || !data_make->program || !data_make->setting) return; if (fl_string_dynamic_compare(fake_make_operation_argument_exit_s, data_make->cache_arguments.array[0]) == F_equal_to) { data_make->setting_make.fail = fake_make_operation_fail_exit_e; data_make->error.prefix = fl_print_error_s; data_make->error.suffix = f_string_empty_s; - data_make->error.context = data_make->main->context.set.error; - data_make->error.notable = data_make->main->context.set.notable; - data_make->main->error.to.stream = F_type_error_d; - data_make->main->error.to.id = F_type_descriptor_error_d; - data_make->error.set = &data_make->main->context.set; + data_make->error.context = data_make->program->context.set.error; + data_make->error.notable = data_make->program->context.set.notable; + data_make->program->error.to.stream = F_type_error_d; + data_make->program->error.to.id = F_type_descriptor_error_d; + data_make->error.set = &data_make->program->context.set; } else if (fl_string_dynamic_compare(fake_make_operation_argument_warn_s, data_make->cache_arguments.array[0]) == F_equal_to) { data_make->setting_make.fail = fake_make_operation_fail_warn_e; data_make->error.prefix = fl_print_warning_s; data_make->error.suffix = f_string_empty_s; - data_make->error.context = data_make->main->context.set.warning; - data_make->error.notable = data_make->main->context.set.notable; - data_make->main->error.to.stream = F_type_output_d; - data_make->main->error.to.id = F_type_descriptor_output_d; - data_make->error.set = &data_make->main->context.set; + data_make->error.context = data_make->program->context.set.warning; + data_make->error.notable = data_make->program->context.set.notable; + data_make->program->error.to.stream = F_type_output_d; + data_make->program->error.to.id = F_type_descriptor_output_d; + data_make->error.set = &data_make->program->context.set; } else { data_make->setting_make.fail = fake_make_operation_fail_ignore_e; - data_make->main->error.to.stream = 0; - data_make->main->error.to.id = -1; + data_make->program->error.to.stream = 0; + data_make->program->error.to.id = -1; } - fake_make_print_verbose_operate_set_failure_state(data_make->setting, data_make->main->message, data_make->setting_make.fail); + fake_make_print_verbose_operate_set_failure_state(data_make->setting, data_make->program->message, data_make->setting_make.fail); } #endif // _di_fake_make_operate_process_type_fail_ #ifndef _di_fake_make_operate_process_type_groups_ void fake_make_operate_process_type_groups(fake_make_data_t * const data_make, const bool all) { - if (!data_make || !data_make->main || !data_make->setting) return; + if (!data_make || !data_make->program || !data_make->setting) return; gid_t id = 0; bool dereference = F_true; @@ -544,14 +548,14 @@ extern "C" { } if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error_file(data_make->setting, data_make->main->error, all ? macro_fake_f(fll_file_role_change_all) : macro_fake_f(f_file_role_change), data_make->cache_arguments.array[i], f_file_operation_change_group_s, fll_error_file_type_file_e); + fake_print_error_file(data_make->setting, data_make->program->error, all ? macro_fake_f(fll_file_role_change_all) : macro_fake_f(f_file_role_change), data_make->cache_arguments.array[i], f_file_operation_change_group_s, fll_error_file_type_file_e); data_make->setting->state.status = F_status_set_error(F_failure); return; } - fake_make_print_verbose_operate_set_role(data_make->setting, data_make->main->message, all ? 0x1 : 0x0, data_make->cache_arguments.array[i], (f_number_unsigned_t) id); + fake_make_print_verbose_operate_set_role(data_make->setting, data_make->program->message, all ? 0x1 : 0x0, data_make->cache_arguments.array[i], (f_number_unsigned_t) id); } // for data_make->setting->state.status = F_none; @@ -561,7 +565,7 @@ extern "C" { #ifndef _di_fake_make_operate_process_type_if_define_ void fake_make_operate_process_type_if_define(fake_make_data_t * const data_make, const bool if_not, fake_state_process_t *state_process) { - if (!data_make || !data_make->main || !data_make->setting || !state_process) return; + if (!data_make || !data_make->program || !data_make->setting || !state_process) return; state_process->condition_result = fake_condition_result_true_e; @@ -592,7 +596,7 @@ extern "C" { #ifndef _di_fake_make_operate_process_type_if_exist_ void fake_make_operate_process_type_if_exist(fake_make_data_t * const data_make, const bool if_not, fake_state_process_t *state_process) { - if (!data_make || !data_make->main || !data_make->setting || !state_process) return; + if (!data_make || !data_make->program || !data_make->setting || !state_process) return; f_array_length_t i = if_not ? 2 : 1; bool dereference = F_true; @@ -626,7 +630,7 @@ extern "C" { if (F_status_is_error(data_make->setting->state.status)) { state_process->condition_result = fake_condition_result_error_e; - fake_print_error_file(data_make->setting, data_make->main->error, macro_fake_f(f_file_exists), data_make->cache_arguments.array[i], f_file_operation_find_s, fll_error_file_type_file_e); + fake_print_error_file(data_make->setting, data_make->program->error, macro_fake_f(f_file_exists), data_make->cache_arguments.array[i], f_file_operation_find_s, fll_error_file_type_file_e); data_make->setting->state.status = F_status_set_error(F_failure); @@ -656,7 +660,7 @@ extern "C" { #ifndef _di_fake_make_operate_process_type_if_is_ void fake_make_operate_process_type_if_is(fake_make_data_t * const data_make, const bool if_not, fake_state_process_t *state_process) { - if (!data_make || !data_make->main || !data_make->setting || !state_process) return; + if (!data_make || !data_make->program || !data_make->setting || !state_process) return; // block = 0x1 (0000 0001) link = 0x10 (0001 0000) // character = 0x2 (0000 0010) regular = 0x20 (0010 0000) @@ -730,7 +734,7 @@ extern "C" { if (F_status_is_error(data_make->setting->state.status)) { state_process->condition_result = fake_condition_result_error_e; - fake_print_error_file(data_make->setting, data_make->main->error, macro_fake_f(f_file_mode_read), data_make->cache_arguments.array[i], f_file_operation_get_type_s, fll_error_file_type_file_e); + fake_print_error_file(data_make->setting, data_make->program->error, macro_fake_f(f_file_mode_read), data_make->cache_arguments.array[i], f_file_operation_get_type_s, fll_error_file_type_file_e); data_make->setting->state.status = F_status_set_error(F_failure); @@ -782,7 +786,7 @@ extern "C" { #ifndef _di_fake_make_operate_process_type_if_greater_if_lesser_ void fake_make_operate_process_type_if_greater_if_lesser(fake_make_data_t * const data_make, fake_state_process_t *state_process) { - if (!data_make || !data_make->main || !data_make->setting || !state_process) return; + if (!data_make || !data_make->program || !data_make->setting || !state_process) return; f_string_range_t range = f_string_range_t_initialize; f_number_unsigned_t number_left = 0; @@ -911,10 +915,10 @@ extern "C" { state_process->condition_result = fake_condition_result_error_e; if ((i == 1 && number_left > F_number_t_size_unsigned_d) || (i > 1 && number_right > F_number_t_size_unsigned_d)) { - fake_make_print_error_out_of_range_number(data_make->setting, data_make->main->error, data_make->cache_arguments.array[i], F_number_t_size_unsigned_d, F_number_t_size_unsigned_d); + fake_make_print_error_out_of_range_number(data_make->setting, data_make->program->error, data_make->cache_arguments.array[i], F_number_t_size_unsigned_d, F_number_t_size_unsigned_d); } else { - fake_make_print_error_unsupported_number(data_make->setting, data_make->main->error, data_make->cache_arguments.array[i]); + fake_make_print_error_unsupported_number(data_make->setting, data_make->program->error, data_make->cache_arguments.array[i]); } data_make->setting->state.status = F_status_set_error(F_failure); @@ -928,7 +932,7 @@ extern "C" { #ifndef _di_fake_make_operate_process_type_if_group_ void fake_make_operate_process_type_if_group(fake_make_data_t * const data_make, const bool if_not, fake_state_process_t *state_process) { - if (!data_make || !data_make->main || !data_make->setting || !state_process) return; + if (!data_make || !data_make->program || !data_make->setting || !state_process) return; uid_t id = 0; f_array_length_t i = if_not ? 2 : 1; @@ -946,7 +950,7 @@ extern "C" { if (F_status_is_error(data_make->setting->state.status)) { state_process->condition_result = fake_condition_result_error_e; - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(fake_make_get_id)); + fake_print_error(&data_make->program->error, macro_fake_f(fake_make_get_id)); data_make->setting->state.status = F_status_set_error(F_failure); @@ -962,7 +966,7 @@ extern "C" { if (F_status_is_error(data_make->setting->state.status)) { state_process->condition_result = fake_condition_result_error_e; - fake_print_error_file(data_make->setting, data_make->main->error, macro_fake_f(f_file_group_read), data_make->cache_arguments.array[i], f_file_operation_get_group_s, fll_error_file_type_file_e); + fake_print_error_file(data_make->setting, data_make->program->error, macro_fake_f(f_file_group_read), data_make->cache_arguments.array[i], f_file_operation_get_group_s, fll_error_file_type_file_e); data_make->setting->state.status = F_status_set_error(F_failure); @@ -992,7 +996,7 @@ extern "C" { #ifndef _di_fake_make_operate_process_type_if_mode_ void fake_make_operate_process_type_if_mode(fake_make_data_t * const data_make, const bool if_not, fake_state_process_t *state_process) { - if (!data_make || !data_make->main || !data_make->setting || !state_process) return; + if (!data_make || !data_make->program || !data_make->setting || !state_process) return; f_file_mode_t mode_rule = 0; mode_t mode_match = 0; @@ -1010,7 +1014,7 @@ extern "C" { if (F_status_is_error(data_make->setting->state.status)) { state_process->condition_result = fake_condition_result_error_e; - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(fake_make_get_id_mode)); + fake_print_error(&data_make->program->error, macro_fake_f(fake_make_get_id_mode)); data_make->setting->state.status = F_status_set_error(F_failure); @@ -1022,7 +1026,7 @@ extern "C" { if (F_status_is_error(data_make->setting->state.status)) { state_process->condition_result = fake_condition_result_error_e; - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_file_mode_to_mode)); + fake_print_error(&data_make->program->error, macro_fake_f(f_file_mode_to_mode)); data_make->setting->state.status = F_status_set_error(F_failure); @@ -1041,7 +1045,7 @@ extern "C" { if (F_status_is_error(data_make->setting->state.status)) { state_process->condition_result = fake_condition_result_error_e; - fake_print_error_file(data_make->setting, data_make->main->error, macro_fake_f(f_file_mode_read), data_make->cache_arguments.array[i], f_file_operation_get_mode_s, fll_error_file_type_file_e); + fake_print_error_file(data_make->setting, data_make->program->error, macro_fake_f(f_file_mode_read), data_make->cache_arguments.array[i], f_file_operation_get_mode_s, fll_error_file_type_file_e); data_make->setting->state.status = F_status_set_error(F_failure); @@ -1089,7 +1093,7 @@ extern "C" { #ifndef _di_fake_make_operate_process_type_if_owner_ void fake_make_operate_process_type_if_owner(fake_make_data_t * const data_make, const bool if_not, fake_state_process_t *state_process) { - if (!data_make || !data_make->main || !data_make->setting || !state_process) return; + if (!data_make || !data_make->program || !data_make->setting || !state_process) return; uid_t id = 0; f_array_length_t i = if_not ? 2 : 1; @@ -1107,7 +1111,7 @@ extern "C" { if (F_status_is_error(data_make->setting->state.status)) { state_process->condition_result = fake_condition_result_error_e; - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(fake_make_get_id)); + fake_print_error(&data_make->program->error, macro_fake_f(fake_make_get_id)); data_make->setting->state.status = F_status_set_error(F_failure); @@ -1123,7 +1127,7 @@ extern "C" { if (F_status_is_error(data_make->setting->state.status)) { state_process->condition_result = fake_condition_result_error_e; - fake_print_error_file(data_make->setting, data_make->main->error, macro_fake_f(f_file_owner_read), data_make->cache_arguments.array[i], f_file_operation_get_owner_s, fll_error_file_type_file_e); + fake_print_error_file(data_make->setting, data_make->program->error, macro_fake_f(f_file_owner_read), data_make->cache_arguments.array[i], f_file_operation_get_owner_s, fll_error_file_type_file_e); data_make->setting->state.status = F_status_set_error(F_failure); @@ -1153,7 +1157,7 @@ extern "C" { #ifndef _di_fake_make_operate_process_type_if_parameter_ void fake_make_operate_process_type_if_parameter(fake_make_data_t * const data_make, const bool if_not, fake_state_process_t *state_process) { - if (!data_make || !data_make->main || !data_make->setting || !state_process) return; + if (!data_make || !data_make->program || !data_make->setting || !state_process) return; const f_string_static_t reserved_name[] = { fake_make_parameter_variable_build_s, @@ -1203,17 +1207,17 @@ extern "C" { data_make->setting->sources.used, F_true, data_make->setting->work.used, - data_make->main->parameters.array[fake_parameter_build_e].result & f_console_result_value_e, - (data_make->main->parameters.array[fake_parameter_light_e].result & f_console_result_found_e) || (data_make->main->parameters.array[fake_parameter_dark_e].result & f_console_result_found_e) || (data_make->main->parameters.array[fake_parameter_no_color_e].result & f_console_result_found_e), - data_make->main->parameters.array[fake_parameter_data_e].result & f_console_result_value_e, - data_make->main->parameters.array[fake_parameter_define_e].result & f_console_result_value_e, - data_make->main->parameters.array[fake_parameter_fakefile_e].result & f_console_result_value_e, - data_make->main->parameters.array[fake_parameter_mode_e].result & f_console_result_value_e, - data_make->main->parameters.array[fake_parameter_process_e].result & f_console_result_value_e, - data_make->main->parameters.array[fake_parameter_settings_e].result & f_console_result_value_e, - data_make->main->parameters.array[fake_parameter_sources_e].result & f_console_result_value_e, - (data_make->main->parameters.array[fake_parameter_verbosity_quiet_e].result & f_console_result_found_e) || (data_make->main->parameters.array[fake_parameter_verbosity_normal_e].result & f_console_result_found_e) || (data_make->main->parameters.array[fake_parameter_verbosity_verbose_e].result & f_console_result_found_e) || (data_make->main->parameters.array[fake_parameter_verbosity_debug_e].result & f_console_result_found_e), - data_make->main->parameters.array[fake_parameter_work_e].result & f_console_result_value_e, + data_make->program->parameters.array[fake_parameter_build_e].result & f_console_result_value_e, + (data_make->program->parameters.array[fake_parameter_light_e].result & f_console_result_found_e) || (data_make->program->parameters.array[fake_parameter_dark_e].result & f_console_result_found_e) || (data_make->program->parameters.array[fake_parameter_no_color_e].result & f_console_result_found_e), + data_make->program->parameters.array[fake_parameter_data_e].result & f_console_result_value_e, + data_make->program->parameters.array[fake_parameter_define_e].result & f_console_result_value_e, + data_make->program->parameters.array[fake_parameter_fakefile_e].result & f_console_result_value_e, + data_make->program->parameters.array[fake_parameter_mode_e].result & f_console_result_value_e, + data_make->program->parameters.array[fake_parameter_process_e].result & f_console_result_value_e, + data_make->program->parameters.array[fake_parameter_settings_e].result & f_console_result_value_e, + data_make->program->parameters.array[fake_parameter_sources_e].result & f_console_result_value_e, + (data_make->program->parameters.array[fake_parameter_verbosity_quiet_e].result & f_console_result_found_e) || (data_make->program->parameters.array[fake_parameter_verbosity_normal_e].result & f_console_result_found_e) || (data_make->program->parameters.array[fake_parameter_verbosity_verbose_e].result & f_console_result_found_e) || (data_make->program->parameters.array[fake_parameter_verbosity_debug_e].result & f_console_result_found_e), + data_make->program->parameters.array[fake_parameter_work_e].result & f_console_result_value_e, data_make->parameter_value.build.used, data_make->parameter_value.color.used, data_make->parameter_value.data.used, @@ -1292,7 +1296,7 @@ extern "C" { const int result = fake_execute(data_make->data, data_make->environment, data_make->setting_build.build_indexer, data_make->cache_arguments); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(fake_execute)); + fake_print_error(&data_make->program->error, macro_fake_f(fake_execute)); } if (data_make->setting->state.status == F_child) return result; @@ -1306,7 +1310,7 @@ extern "C" { #ifndef _di_fake_make_operate_process_type_link_ void fake_make_operate_process_type_link(fake_make_data_t * const data_make) { - if (!data_make || !data_make->main || !data_make->setting) return; + if (!data_make || !data_make->program || !data_make->setting) return; // 0x1 = force, 0x2 = strict. uint8_t flag = 0; @@ -1334,7 +1338,7 @@ extern "C" { data_make->setting->state.status = f_directory_remove(data_make->cache_arguments.array[data_make->cache_arguments.used - 1], F_directory_max_descriptors_d, F_false); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error_file(data_make->setting, data_make->main->error, macro_fake_f(f_directory_remove), data_make->cache_arguments.array[data_make->cache_arguments.used - 1], f_file_operation_delete_s, fll_error_file_type_directory_e); + fake_print_error_file(data_make->setting, data_make->program->error, macro_fake_f(f_directory_remove), data_make->cache_arguments.array[data_make->cache_arguments.used - 1], f_file_operation_delete_s, fll_error_file_type_directory_e); data_make->setting->state.status = F_status_set_error(F_failure); @@ -1345,7 +1349,7 @@ extern "C" { data_make->setting->state.status = f_file_remove(data_make->cache_arguments.array[data_make->cache_arguments.used - 1]); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error_file(data_make->setting, data_make->main->error, macro_fake_f(f_file_remove), data_make->cache_arguments.array[data_make->cache_arguments.used - 1], f_file_operation_delete_s, fll_error_file_type_file_e); + fake_print_error_file(data_make->setting, data_make->program->error, macro_fake_f(f_file_remove), data_make->cache_arguments.array[data_make->cache_arguments.used - 1], f_file_operation_delete_s, fll_error_file_type_file_e); data_make->setting->state.status = F_status_set_error(F_failure); @@ -1357,14 +1361,14 @@ extern "C" { data_make->setting->state.status = f_file_link(data_make->cache_arguments.array[0], data_make->cache_arguments.array[data_make->cache_arguments.used - 1]); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error_file(data_make->setting, data_make->main->error, macro_fake_f(f_file_link), data_make->cache_arguments.array[data_make->cache_arguments.used - 1], f_file_operation_link_s, fll_error_file_type_file_e); + fake_print_error_file(data_make->setting, data_make->program->error, macro_fake_f(f_file_link), data_make->cache_arguments.array[data_make->cache_arguments.used - 1], f_file_operation_link_s, fll_error_file_type_file_e); data_make->setting->state.status = F_status_set_error(F_failure); return; } - fake_make_print_verbose_operate_symbolic_link(data_make->setting, data_make->main->message, data_make->cache_arguments.array[data_make->cache_arguments.used - 1], data_make->cache_arguments.array[0]); + fake_make_print_verbose_operate_symbolic_link(data_make->setting, data_make->program->message, data_make->cache_arguments.array[data_make->cache_arguments.used - 1], data_make->cache_arguments.array[0]); data_make->setting->state.status = F_none; } @@ -1373,7 +1377,7 @@ extern "C" { #ifndef _di_fake_make_operate_process_type_modes_ void fake_make_operate_process_type_modes(fake_make_data_t * const data_make, const bool all) { - if (!data_make || !data_make->main || !data_make->setting) return; + if (!data_make || !data_make->program || !data_make->setting) return; data_make->setting->state.status = F_none; @@ -1383,7 +1387,7 @@ extern "C" { fake_make_get_id_mode(data_make, data_make->cache_arguments.array[0], &mode_rule, &replace); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(fake_make_get_id_mode)); + fake_print_error(&data_make->program->error, macro_fake_f(fake_make_get_id_mode)); data_make->setting->state.status = F_status_set_error(F_failure); @@ -1398,7 +1402,7 @@ extern "C" { data_make->setting->state.status = f_file_mode_read(data_make->cache_arguments.array[i], F_true, &mode_file); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error_file(data_make->setting, data_make->main->error, macro_fake_f(f_file_mode_read), data_make->cache_arguments.array[i], f_file_operation_change_group_s, fll_error_file_type_file_e); + fake_print_error_file(data_make->setting, data_make->program->error, macro_fake_f(f_file_mode_read), data_make->cache_arguments.array[i], f_file_operation_change_group_s, fll_error_file_type_file_e); data_make->setting->state.status = F_status_set_error(F_failure); @@ -1408,7 +1412,7 @@ extern "C" { data_make->setting->state.status = f_file_mode_determine(mode_file, mode_rule, replace, macro_f_file_type_is_directory(mode_file), &mode); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error_file(data_make->setting, data_make->main->error, macro_fake_f(f_file_mode_determine), data_make->cache_arguments.array[i], f_file_operation_change_group_s, fll_error_file_type_file_e); + fake_print_error_file(data_make->setting, data_make->program->error, macro_fake_f(f_file_mode_determine), data_make->cache_arguments.array[i], f_file_operation_change_group_s, fll_error_file_type_file_e); data_make->setting->state.status = F_status_set_error(F_failure); @@ -1423,14 +1427,14 @@ extern "C" { } if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error_file(data_make->setting, data_make->main->error, all ? macro_fake_f(fll_file_mode_set_all) : macro_fake_f(f_file_mode_set), data_make->cache_arguments.array[i], f_file_operation_change_group_s, fll_error_file_type_file_e); + fake_print_error_file(data_make->setting, data_make->program->error, all ? macro_fake_f(fll_file_mode_set_all) : macro_fake_f(f_file_mode_set), data_make->cache_arguments.array[i], f_file_operation_change_group_s, fll_error_file_type_file_e); data_make->setting->state.status = F_status_set_error(F_failure); return; } - fake_make_print_verbose_operate_set_mode(data_make->setting, data_make->main->message, data_make->cache_arguments.array[i], mode); + fake_make_print_verbose_operate_set_mode(data_make->setting, data_make->program->message, data_make->cache_arguments.array[i], mode); } // for data_make->setting->state.status = F_none; @@ -1440,14 +1444,14 @@ extern "C" { #ifndef _di_fake_make_operate_process_type_move_ void fake_make_operate_process_type_move(fake_make_data_t * const data_make) { - if (!data_make || !data_make->main || !data_make->setting) return; + if (!data_make || !data_make->program || !data_make->setting) return; const f_array_length_t total = data_make->cache_arguments.used -1; f_directory_recurse_t recurse = f_directory_recurse_t_initialize; f_string_static_t destination = f_string_static_t_initialize; - if (data_make->main->error.verbosity >= f_console_verbosity_verbose_e) { + if (data_make->program->error.verbosity >= f_console_verbosity_verbose_e) { recurse.verbose = fake_print_verbose_move; } @@ -1458,10 +1462,12 @@ extern "C" { data_make->setting->state.status = f_directory_is(data_make->cache_arguments.array[1]); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error_file(data_make->setting, data_make->main->error, macro_fake_f(f_directory_is), data_make->cache_arguments.array[1], f_file_operation_identify_s, fll_error_file_type_directory_e); + fake_print_error_file(data_make->setting, data_make->program->error, macro_fake_f(f_directory_is), data_make->cache_arguments.array[1], f_file_operation_identify_s, fll_error_file_type_directory_e); data_make->setting->state.status = F_status_set_error(F_failure); + f_directory_recurse_delete(&recurse); + return; } @@ -1480,10 +1486,12 @@ extern "C" { data_make->setting->state.status = f_file_name_base(data_make->cache_arguments.array[i], &data_make->cache_path); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error_file(data_make->setting, data_make->main->error, macro_fake_f(f_file_name_base), data_make->cache_arguments.array[i], f_file_operation_process_s, fll_error_file_type_path_e); + fake_print_error_file(data_make->setting, data_make->program->error, macro_fake_f(f_file_name_base), data_make->cache_arguments.array[i], f_file_operation_process_s, fll_error_file_type_path_e); data_make->setting->state.status = F_status_set_error(F_failure); + f_directory_recurse_delete(&recurse); + return; } @@ -1518,14 +1526,18 @@ extern "C" { if (F_status_is_error(recurse.state.status)) { data_make->setting->state.status = recurse.state.status; - fake_print_error_file(data_make->setting, data_make->main->error, macro_fake_f(fll_file_move), data_make->cache_arguments.array[i], f_file_operation_move_s, fll_error_file_type_directory_e); + fake_print_error_file(data_make->setting, data_make->program->error, macro_fake_f(fll_file_move), data_make->cache_arguments.array[i], f_file_operation_move_s, fll_error_file_type_directory_e); data_make->setting->state.status = F_status_set_error(F_failure); + f_directory_recurse_delete(&recurse); + return; } } // for + f_directory_recurse_delete(&recurse); + data_make->setting->state.status = F_none; } #endif // _di_fake_make_operate_process_type_move_ @@ -1563,7 +1575,7 @@ extern "C" { #ifndef _di_fake_make_operate_process_type_owners_ void fake_make_operate_process_type_owners(fake_make_data_t * const data_make, const bool all) { - if (!data_make || !data_make->main || !data_make->setting) return; + if (!data_make || !data_make->program || !data_make->setting) return; uid_t id = 0; bool dereference = F_true; @@ -1577,7 +1589,7 @@ extern "C" { id = (uid_t) fake_make_get_id(data_make, F_true, data_make->cache_arguments.array[i++]); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(fake_make_get_id)); + fake_print_error(&data_make->program->error, macro_fake_f(fake_make_get_id)); data_make->setting->state.status = F_status_set_error(F_failure); @@ -1602,14 +1614,14 @@ extern "C" { } if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error_file(data_make->setting, data_make->main->error, all ? macro_fake_f(fll_file_role_change_all) : macro_fake_f(f_file_role_change), data_make->cache_arguments.array[i], f_file_operation_change_owner_s, fll_error_file_type_file_e); + fake_print_error_file(data_make->setting, data_make->program->error, all ? macro_fake_f(fll_file_role_change_all) : macro_fake_f(f_file_role_change), data_make->cache_arguments.array[i], f_file_operation_change_owner_s, fll_error_file_type_file_e); data_make->setting->state.status = F_status_set_error(F_failure); return; } - fake_make_print_verbose_operate_set_role(data_make->setting, data_make->main->message, all ? 0x3 : 0x2, data_make->cache_arguments.array[i], (f_number_unsigned_t) id); + fake_make_print_verbose_operate_set_role(data_make->setting, data_make->program->message, all ? 0x3 : 0x2, data_make->cache_arguments.array[i], (f_number_unsigned_t) id); } // for data_make->setting->state.status = F_none; @@ -1619,7 +1631,7 @@ extern "C" { #ifndef _di_fake_make_operate_process_type_parameter_ void fake_make_operate_process_type_parameter(fake_make_data_t * const data_make) { - if (!data_make || !data_make->main || !data_make->setting) return; + if (!data_make || !data_make->program || !data_make->setting) return; bool found = F_false; f_array_length_t i = 0; @@ -1639,7 +1651,7 @@ extern "C" { data_make->setting->state.status = f_string_dynamic_resize(0, &data_make->setting_make.parameter.array[i].value.array[j]); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_string_dynamic_resize)); + fake_print_error(&data_make->program->error, macro_fake_f(f_string_dynamic_resize)); data_make->setting->state.status = F_status_set_error(F_failure); @@ -1651,7 +1663,7 @@ extern "C" { data_make->setting->state.status = f_string_dynamics_resize(0, &data_make->setting_make.parameter.array[i].value); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_string_dynamics_resize)); + fake_print_error(&data_make->program->error, macro_fake_f(f_string_dynamics_resize)); data_make->setting->state.status = F_status_set_error(F_failure); } @@ -1661,7 +1673,7 @@ extern "C" { data_make->setting->state.status = f_string_map_multis_resize(fake_allocation_small_d, &data_make->setting_make.parameter); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_string_map_multis_resize)); + fake_print_error(&data_make->program->error, macro_fake_f(f_string_map_multis_resize)); data_make->setting->state.status = F_status_set_error(F_failure); @@ -1671,7 +1683,7 @@ extern "C" { data_make->setting->state.status = f_string_dynamic_append_nulless(data_make->cache_arguments.array[0], &data_make->setting_make.parameter.array[data_make->setting_make.parameter.used].name); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_string_dynamic_append_nulless)); + fake_print_error(&data_make->program->error, macro_fake_f(f_string_dynamic_append_nulless)); data_make->setting->state.status = F_status_set_error(F_failure); @@ -1687,7 +1699,7 @@ extern "C" { data_make->setting->state.status = f_string_dynamics_resize(data_make->cache_arguments.used - 1, &data_make->setting_make.parameter.array[i].value); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_string_dynamics_resize)); + fake_print_error(&data_make->program->error, macro_fake_f(f_string_dynamics_resize)); data_make->setting->state.status = F_status_set_error(F_failure); @@ -1699,7 +1711,7 @@ extern "C" { data_make->setting->state.status = f_string_dynamic_append_nulless(data_make->cache_arguments.array[j + 1], &data_make->setting_make.parameter.array[i].value.array[j]); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_string_dynamic_append_nulless)); + fake_print_error(&data_make->program->error, macro_fake_f(f_string_dynamic_append_nulless)); data_make->setting->state.status = F_status_set_error(F_failure); } @@ -1715,7 +1727,7 @@ extern "C" { #ifndef _di_fake_make_operate_process_type_pop_ void fake_make_operate_process_type_pop(fake_make_data_t * const data_make) { - if (!data_make || !data_make->main || !data_make->setting) return; + if (!data_make || !data_make->program || !data_make->setting) return; f_string_dynamic_t *argument = &data_make->path.stack.array[data_make->path.stack.used - 1]; @@ -1733,21 +1745,21 @@ extern "C" { return; } - if (data_make->main->error.verbosity >= f_console_verbosity_verbose_e) { + if (data_make->program->error.verbosity >= f_console_verbosity_verbose_e) { fake_make_path_relative(data_make, *argument); // The created relative path is for verbosity purposes and as such its failure to be processed should not be treated as a failure of the function. if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(fake_make_path_relative)); + fake_print_error(&data_make->program->error, macro_fake_f(fake_make_path_relative)); - fake_make_print_verbose_operate_set_path(data_make->setting, data_make->main->message, *argument); + fake_make_print_verbose_operate_set_path(data_make->setting, data_make->program->message, *argument); data_make->setting->state.status = F_status_set_error(F_failure); return; } - fake_make_print_verbose_operate_set_path(data_make->setting, data_make->main->message, data_make->cache_path); + fake_make_print_verbose_operate_set_path(data_make->setting, data_make->program->message, data_make->cache_path); } data_make->setting->state.status = F_none; @@ -1757,7 +1769,7 @@ extern "C" { #ifndef _di_fake_make_operate_process_type_print_ void fake_make_operate_process_type_print(fake_make_data_t * const data_make) { - if (!data_make || !data_make->main || !data_make->setting) return; + if (!data_make || !data_make->program || !data_make->setting) return; data_make->cache_1.used = 0; @@ -1775,7 +1787,7 @@ extern "C" { data_make->setting->state.status = f_string_dynamic_increase_by(total, &data_make->cache_1); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_file_stream_open)); + fake_print_error(&data_make->program->error, macro_fake_f(f_file_stream_open)); data_make->setting->state.status = F_status_set_error(F_failure); @@ -1789,7 +1801,7 @@ extern "C" { data_make->setting->state.status = f_string_dynamic_append(f_string_space_s, &data_make->cache_1); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_string_dynamic_append)); + fake_print_error(&data_make->program->error, macro_fake_f(f_string_dynamic_append)); data_make->setting->state.status = F_status_set_error(F_failure); @@ -1800,7 +1812,7 @@ extern "C" { fake_make_operate_process_buffer_escape(data_make, data_make->cache_arguments.array[i], &data_make->cache_1); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_file_stream_open)); + fake_print_error(&data_make->program->error, macro_fake_f(f_file_stream_open)); data_make->setting->state.status = F_status_set_error(F_failure); @@ -1809,12 +1821,12 @@ extern "C" { } // for } - f_file_stream_lock(data_make->main->message.to); + f_file_stream_lock(data_make->program->message.to); - fll_print_dynamic_raw(data_make->cache_1, data_make->main->message.to); - fll_print_dynamic_raw(f_string_eol_s, data_make->main->message.to); + fll_print_dynamic_raw(data_make->cache_1, data_make->program->message.to); + fll_print_dynamic_raw(f_string_eol_s, data_make->program->message.to); - f_file_stream_unlock(data_make->main->message.to); + f_file_stream_unlock(data_make->program->message.to); data_make->setting->state.status = F_none; } @@ -1823,7 +1835,7 @@ extern "C" { #ifndef _di_fake_make_operate_process_type_skeleton_ void fake_make_operate_process_type_skeleton(fake_make_data_t * const data_make) { - if (!data_make || !data_make->main || !data_make->setting) return; + if (!data_make || !data_make->program || !data_make->setting) return; fake_skeleton_operate(data_make->data); if (F_status_set_fine(data_make->setting->state.status) == F_interrupt) return; @@ -1835,7 +1847,7 @@ extern "C" { #ifndef _di_fake_make_operate_process_type_to_ void fake_make_operate_process_type_to(fake_make_data_t * const data_make) { - if (!data_make || !data_make->main || !data_make->setting) return; + if (!data_make || !data_make->program || !data_make->setting) return; fake_make_assure_inside_project(data_make, data_make->cache_arguments.array[0]); @@ -1868,7 +1880,7 @@ extern "C" { return; } - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_string_dynamics_increase_by)); + fake_print_error(&data_make->program->error, macro_fake_f(f_string_dynamics_increase_by)); data_make->setting->state.status = F_status_set_error(F_failure); @@ -1881,24 +1893,24 @@ extern "C" { data_make->setting->state.status = f_string_dynamic_append_nulless(data_make->cache_path, &data_make->path.stack.array[data_make->path.stack.used]); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_string_dynamic_append_nulless)); + fake_print_error(&data_make->program->error, macro_fake_f(f_string_dynamic_append_nulless)); data_make->setting->state.status = F_status_set_error(F_failure); return; } - if (data_make->main->error.verbosity >= f_console_verbosity_verbose_e) { + if (data_make->program->error.verbosity >= f_console_verbosity_verbose_e) { fake_make_path_relative(data_make, data_make->path.stack.array[data_make->path.stack.used]); // The created relative path is for verbosity purposes and as such its failure to be processed should not be treated as a failure of the function. if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(fake_make_path_relative)); + fake_print_error(&data_make->program->error, macro_fake_f(fake_make_path_relative)); - fake_make_print_verbose_operate_set_path(data_make->setting, data_make->main->message, data_make->path.stack.array[data_make->path.stack.used]); + fake_make_print_verbose_operate_set_path(data_make->setting, data_make->program->message, data_make->path.stack.array[data_make->path.stack.used]); } else { - fake_make_print_verbose_operate_set_path(data_make->setting, data_make->main->message, data_make->cache_path); + fake_make_print_verbose_operate_set_path(data_make->setting, data_make->program->message, data_make->cache_path); } } @@ -1912,7 +1924,7 @@ extern "C" { #ifndef _di_fake_make_operate_process_type_top_ void fake_make_operate_process_type_top(fake_make_data_t * const data_make) { - if (!data_make || !data_make->main || !data_make->setting) return; + if (!data_make || !data_make->program || !data_make->setting) return; { data_make->setting->state.status = f_path_change_at(data_make->path.top.id); @@ -1926,7 +1938,7 @@ extern "C" { } } - fake_make_print_verbose_operate_set_path(data_make->setting, data_make->main->message, f_string_empty_s); + fake_make_print_verbose_operate_set_path(data_make->setting, data_make->program->message, f_string_empty_s); // Clear stack, except for the project root. for (f_array_length_t i = 1; i < data_make->path.stack.used; ++i) { @@ -1942,11 +1954,11 @@ extern "C" { #ifndef _di_fake_make_operate_process_type_touch_ void fake_make_operate_process_type_touch(fake_make_data_t * const data_make) { - if (!data_make || !data_make->main || !data_make->setting) return; + if (!data_make || !data_make->program || !data_make->setting) return; f_mode_t mode = f_mode_t_initialize; - macro_f_mode_t_set_default_umask(mode, data_make->main->umask); + macro_f_mode_t_set_default_umask(mode, data_make->program->umask); for (f_array_length_t i = 1; i < data_make->cache_arguments.used; ++i) { @@ -1955,10 +1967,10 @@ extern "C" { if (F_status_is_error(data_make->setting->state.status)) { if (F_status_is_error_not(fl_path_canonical(data_make->cache_arguments.array[i], &data_make->cache_path))) { - fake_print_error_file(data_make->setting, data_make->main->error, macro_fake_f(f_file_touch), data_make->cache_path, f_file_operation_touch_s, fll_error_file_type_file_e); + fake_print_error_file(data_make->setting, data_make->program->error, macro_fake_f(f_file_touch), data_make->cache_path, f_file_operation_touch_s, fll_error_file_type_file_e); } else { - fake_print_error_file(data_make->setting, data_make->main->error, macro_fake_f(f_file_touch), data_make->cache_arguments.array[i], f_file_operation_touch_s, fll_error_file_type_file_e); + fake_print_error_file(data_make->setting, data_make->program->error, macro_fake_f(f_file_touch), data_make->cache_arguments.array[i], f_file_operation_touch_s, fll_error_file_type_file_e); } data_make->setting->state.status = F_status_set_error(F_failure); @@ -1971,10 +1983,10 @@ extern "C" { if (F_status_is_error(data_make->setting->state.status)) { if (F_status_is_error_not(fl_path_canonical(data_make->cache_arguments.array[i], &data_make->cache_path))) { - fake_print_error_file(data_make->setting, data_make->main->error, macro_fake_f(f_directory_touch), data_make->cache_path, f_file_operation_touch_s, fll_error_file_type_directory_e); + fake_print_error_file(data_make->setting, data_make->program->error, macro_fake_f(f_directory_touch), data_make->cache_path, f_file_operation_touch_s, fll_error_file_type_directory_e); } else { - fake_print_error_file(data_make->setting, data_make->main->error, macro_fake_f(f_directory_touch), data_make->cache_arguments.array[i], f_file_operation_touch_s, fll_error_file_type_directory_e); + fake_print_error_file(data_make->setting, data_make->program->error, macro_fake_f(f_directory_touch), data_make->cache_arguments.array[i], f_file_operation_touch_s, fll_error_file_type_directory_e); } data_make->setting->state.status = F_status_set_error(F_failure); @@ -1983,7 +1995,7 @@ extern "C" { } } - fake_make_print_verbose_operate_touch(data_make->setting, data_make->main->message, data_make->cache_arguments.array[i]); + fake_make_print_verbose_operate_touch(data_make->setting, data_make->program->message, data_make->cache_arguments.array[i]); } // for data_make->setting->state.status = F_none; @@ -1993,7 +2005,7 @@ extern "C" { #ifndef _di_fake_make_operate_process_type_write_ void fake_make_operate_process_type_write(fake_make_data_t * const data_make) { - if (!data_make || !data_make->main || !data_make->setting) return; + if (!data_make || !data_make->program || !data_make->setting) return; f_file_t file = f_file_t_initialize; @@ -2004,10 +2016,10 @@ extern "C" { if (F_status_is_error(data_make->setting->state.status)) { if (F_status_is_error_not(fl_path_canonical(data_make->cache_arguments.array[0], &data_make->cache_path))) { - fake_print_error_file(data_make->setting, data_make->main->error, macro_fake_f(f_file_stream_open), data_make->cache_path, f_file_operation_open_s, fll_error_file_type_file_e); + fake_print_error_file(data_make->setting, data_make->program->error, macro_fake_f(f_file_stream_open), data_make->cache_path, f_file_operation_open_s, fll_error_file_type_file_e); } else { - fake_print_error_file(data_make->setting, data_make->main->error, macro_fake_f(f_file_stream_open), data_make->cache_arguments.array[0], f_file_operation_open_s, fll_error_file_type_file_e); + fake_print_error_file(data_make->setting, data_make->program->error, macro_fake_f(f_file_stream_open), data_make->cache_arguments.array[0], f_file_operation_open_s, fll_error_file_type_file_e); } data_make->setting->state.status = F_status_set_error(F_failure); @@ -2033,10 +2045,10 @@ extern "C" { if (F_status_is_error(data_make->setting->state.status)) { if (F_status_is_error_not(fl_path_canonical(data_make->cache_arguments.array[0], &data_make->cache_path))) { - fake_print_error_file(data_make->setting, data_make->main->error, macro_fake_f(f_file_stream_open), data_make->cache_path, f_file_operation_open_s, fll_error_file_type_file_e); + fake_print_error_file(data_make->setting, data_make->program->error, macro_fake_f(f_file_stream_open), data_make->cache_path, f_file_operation_open_s, fll_error_file_type_file_e); } else { - fake_print_error_file(data_make->setting, data_make->main->error, macro_fake_f(f_file_stream_open), data_make->cache_arguments.array[0], f_file_operation_open_s, fll_error_file_type_file_e); + fake_print_error_file(data_make->setting, data_make->program->error, macro_fake_f(f_file_stream_open), data_make->cache_arguments.array[0], f_file_operation_open_s, fll_error_file_type_file_e); } } } @@ -2050,10 +2062,10 @@ extern "C" { if (F_status_is_error(data_make->setting->state.status)) { if (F_status_is_error_not(fl_path_canonical(data_make->cache_arguments.array[0], &data_make->cache_path))) { - fake_print_error_file(data_make->setting, data_make->main->error, macro_fake_f(fake_make_operate_process_buffer_escape), data_make->cache_path, f_file_operation_write_s, fll_error_file_type_file_e); + fake_print_error_file(data_make->setting, data_make->program->error, macro_fake_f(fake_make_operate_process_buffer_escape), data_make->cache_path, f_file_operation_write_s, fll_error_file_type_file_e); } else { - fake_print_error_file(data_make->setting, data_make->main->error, macro_fake_f(fake_make_operate_process_buffer_escape), data_make->cache_arguments.array[0], f_file_operation_write_s, fll_error_file_type_file_e); + fake_print_error_file(data_make->setting, data_make->program->error, macro_fake_f(fake_make_operate_process_buffer_escape), data_make->cache_arguments.array[0], f_file_operation_write_s, fll_error_file_type_file_e); } break; @@ -2063,10 +2075,10 @@ extern "C" { if (F_status_is_error(data_make->setting->state.status)) { if (F_status_is_error_not(fl_path_canonical(data_make->cache_arguments.array[0], &data_make->cache_path))) { - fake_print_error_file(data_make->setting, data_make->main->error, macro_fake_f(f_file_stream_write), data_make->cache_path, f_file_operation_write_s, fll_error_file_type_file_e); + fake_print_error_file(data_make->setting, data_make->program->error, macro_fake_f(f_file_stream_write), data_make->cache_path, f_file_operation_write_s, fll_error_file_type_file_e); } else { - fake_print_error_file(data_make->setting, data_make->main->error, macro_fake_f(f_file_stream_write), data_make->cache_arguments.array[0], f_file_operation_write_s, fll_error_file_type_file_e); + fake_print_error_file(data_make->setting, data_make->program->error, macro_fake_f(f_file_stream_write), data_make->cache_arguments.array[0], f_file_operation_write_s, fll_error_file_type_file_e); } break; @@ -2076,7 +2088,7 @@ extern "C" { data_make->setting->state.status = f_file_stream_write(file, f_string_ascii_space_s, 0); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_file_stream_write)); + fake_print_error(&data_make->program->error, macro_fake_f(f_file_stream_write)); break; } diff --git a/level_3/fake/c/main/make/operate_validate.c b/level_3/fake/c/main/make/operate_validate.c index b79fb21..8887b0d 100644 --- a/level_3/fake/c/main/make/operate_validate.c +++ b/level_3/fake/c/main/make/operate_validate.c @@ -7,7 +7,7 @@ extern "C" { #ifndef _di_fake_make_operate_validate_ void fake_make_operate_validate(fake_make_data_t * const data_make, const f_string_range_t section_name, fake_state_process_t * const state_process, f_array_lengths_t * const section_stack) { - if (!data_make || !data_make->main || !data_make->setting) return; + if (!data_make || !data_make->program || !data_make->setting) return; if (F_status_is_error(data_make->setting->state.status)) return; if (!section_stack) { diff --git a/level_3/fake/c/main/make/operate_validate_type.c b/level_3/fake/c/main/make/operate_validate_type.c index fd82613..72063e4 100644 --- a/level_3/fake/c/main/make/operate_validate_type.c +++ b/level_3/fake/c/main/make/operate_validate_type.c @@ -7,10 +7,10 @@ extern "C" { #ifndef _di_fake_make_operate_validate_type_break_ void fake_make_operate_validate_type_break(fake_make_data_t * const data_make) { - if (!data_make || !data_make->main || !data_make->setting) return; + if (!data_make || !data_make->program || !data_make->setting) return; if (data_make->cache_arguments.used > 1) { - fake_print_error_too_many_arguments(data_make->setting, data_make->main->error); + fake_print_error_too_many_arguments(data_make->setting, data_make->program->error); data_make->setting->state.status = F_status_set_error(F_failure); @@ -20,7 +20,7 @@ extern "C" { if (data_make->cache_arguments.used) { if (fl_string_dynamic_compare(fake_make_operation_argument_success_s, data_make->cache_arguments.array[0]) == F_equal_to_not) { if (fl_string_dynamic_compare(fake_make_operation_argument_failure_s, data_make->cache_arguments.array[0]) == F_equal_to_not) { - fake_make_print_error_unsupported_type(data_make->setting, data_make->main->error, fake_make_operation_break_s, data_make->cache_arguments.array[0]); + fake_make_print_error_unsupported_type(data_make->setting, data_make->program->error, fake_make_operation_break_s, data_make->cache_arguments.array[0]); data_make->setting->state.status = F_status_set_error(F_failure); @@ -36,7 +36,7 @@ extern "C" { #ifndef _di_fake_make_operate_validate_type_build_ void fake_make_operate_validate_type_build(fake_make_data_t * const data_make) { - if (!data_make || !data_make->main || !data_make->setting) return; + if (!data_make || !data_make->program || !data_make->setting) return; if (data_make->cache_arguments.used) { if (data_make->cache_arguments.array[0].used) { @@ -53,7 +53,7 @@ extern "C" { data_make->setting->state.status = f_file_is(path_file, F_file_type_regular_d, F_false); if (data_make->setting->state.status == F_file_found_not || F_status_is_error(data_make->setting->state.status)) { - fake_print_error_file_simple(data_make->setting, data_make->main->error, macro_fake_f(f_file_is), path_file, f_file_operation_find_s, fll_error_file_type_file_e); + fake_print_error_file_simple(data_make->setting, data_make->program->error, macro_fake_f(f_file_is), path_file, f_file_operation_find_s, fll_error_file_type_file_e); data_make->setting->state.status = F_status_set_error(F_failure); @@ -61,7 +61,7 @@ extern "C" { } if (!data_make->setting->state.status) { - fake_make_print_error_file_type(data_make->setting, data_make->main->message, f_file_type_name_regular_s, path_file); + fake_make_print_error_file_type(data_make->setting, data_make->program->message, f_file_type_name_regular_s, path_file); data_make->setting->state.status = F_status_set_error(F_failure); @@ -69,7 +69,7 @@ extern "C" { } } else { - fake_make_print_error_file_name_empty(data_make->setting, data_make->main->error); + fake_make_print_error_file_name_empty(data_make->setting, data_make->program->error); data_make->setting->state.status = F_status_set_error(F_failure); @@ -84,10 +84,10 @@ extern "C" { #ifndef _di_fake_make_operate_validate_type_clean_top_skeleton_ void fake_make_operate_validate_type_clean_top_skeleton(fake_make_data_t * const data_make) { - if (!data_make || !data_make->main || !data_make->setting) return; + if (!data_make || !data_make->program || !data_make->setting) return; if (data_make->cache_arguments.used) { - fake_print_error_too_many_arguments(data_make->setting, data_make->main->error); + fake_print_error_too_many_arguments(data_make->setting, data_make->program->error); data_make->setting->state.status = F_status_set_error(F_failure); } @@ -100,7 +100,7 @@ extern "C" { #ifndef _di_fake_make_operate_validate_type_clone_ void fake_make_operate_validate_type_clone(fake_make_data_t * const data_make) { - if (!data_make || !data_make->main || !data_make->setting) return; + if (!data_make || !data_make->program || !data_make->setting) return; if (data_make->cache_arguments.used > 1) { f_status_t status = F_none; @@ -119,7 +119,7 @@ extern "C" { for (f_array_length_t i = 0; i < data_make->cache_arguments.used - 1; ++i) { if (f_file_exists(data_make->cache_arguments.array[i], F_true) != F_true) { - fake_print_error_file_simple(data_make->setting, data_make->main->error, macro_fake_f(f_file_is), data_make->cache_arguments.array[i], f_file_operation_find_s, fll_error_file_type_file_e); + fake_print_error_file_simple(data_make->setting, data_make->program->error, macro_fake_f(f_file_is), data_make->cache_arguments.array[i], f_file_operation_find_s, fll_error_file_type_file_e); status = F_status_set_error(F_failure); } @@ -131,13 +131,13 @@ extern "C" { data_make->setting->state.status = f_directory_is(data_make->cache_arguments.array[data_make->cache_arguments.used - 1]); if (data_make->setting->state.status == F_false || data_make->setting->state.status == F_file_found_not) { - fake_make_print_error_content_not_directory(data_make->setting, data_make->main->error, "last", data_make->cache_arguments.array[data_make->cache_arguments.used - 1]); + fake_make_print_error_content_not_directory(data_make->setting, data_make->program->error, "last", data_make->cache_arguments.array[data_make->cache_arguments.used - 1]); status = F_status_set_error(F_failure); } if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error_file(data_make->setting, data_make->main->error, macro_fake_f(f_directory_is), data_make->cache_arguments.array[data_make->cache_arguments.used - 1], f_file_operation_find_s, fll_error_file_type_directory_e); + fake_print_error_file(data_make->setting, data_make->program->error, macro_fake_f(f_directory_is), data_make->cache_arguments.array[data_make->cache_arguments.used - 1], f_file_operation_find_s, fll_error_file_type_directory_e); status = F_status_set_error(F_failure); } @@ -151,7 +151,7 @@ extern "C" { data_make->setting->state.status = f_directory_is(data_make->cache_arguments.array[1]); if (data_make->setting->state.status == F_false) { - fake_make_print_error_content_not_directory(data_make->setting, data_make->main->error, "second", data_make->cache_arguments.array[1]); + fake_make_print_error_content_not_directory(data_make->setting, data_make->program->error, "second", data_make->cache_arguments.array[1]); status = F_status_set_error(F_failure); } @@ -163,7 +163,7 @@ extern "C" { return; } - fake_print_error_requires_more_arguments(data_make->setting, data_make->main->error); + fake_print_error_requires_more_arguments(data_make->setting, data_make->program->error); data_make->setting->state.status = F_status_set_error(F_failure); } @@ -172,15 +172,15 @@ extern "C" { #ifndef _di_fake_make_operate_validate_type_compile_ void fake_make_operate_validate_type_compile(fake_make_data_t * const data_make) { - if (!data_make || !data_make->main || !data_make->setting) return; + if (!data_make || !data_make->program || !data_make->setting) return; if (!data_make->cache_arguments.used) { - fake_print_error_requires_more_arguments(data_make->setting, data_make->main->error); + fake_print_error_requires_more_arguments(data_make->setting, data_make->program->error); data_make->setting->state.status = F_status_set_error(F_failure); } else if (data_make->setting_build.build_compiler.used) { - fake_make_print_error_compiler_not_specified(data_make->setting, data_make->main->error, fake_make_operation_compile_s); + fake_make_print_error_compiler_not_specified(data_make->setting, data_make->program->error, fake_make_operation_compile_s); data_make->setting->state.status = F_status_set_error(F_failure); } @@ -193,11 +193,11 @@ extern "C" { #ifndef _di_fake_make_operate_validate_type_condition_ void fake_make_operate_validate_type_condition(fake_make_data_t * const data_make, fake_state_process_t * const state_process) { - if (!data_make || !data_make->main || !data_make->setting || !state_process) return; + if (!data_make || !data_make->program || !data_make->setting || !state_process) return; if (state_process->operation == fake_make_operation_type_if_e) { if (state_process->operation_previous == fake_make_operation_type_if_e) { - fake_make_print_error_after_condition_must_not(data_make->setting, data_make->main->error); + fake_make_print_error_after_condition_must_not(data_make->setting, data_make->program->error); data_make->setting->state.status = F_status_set_error(F_failure); @@ -206,7 +206,7 @@ extern "C" { } else { if (!(state_process->operation_previous == fake_make_operation_type_if_e || state_process->operation_previous == fake_make_operation_type_and_e || state_process->operation_previous == fake_make_operation_type_or_e)) { - fake_make_print_error_after_condition_may_only(data_make->setting, data_make->main->error); + fake_make_print_error_after_condition_may_only(data_make->setting, data_make->program->error); data_make->setting->state.status = F_status_set_error(F_failure); @@ -357,7 +357,7 @@ extern "C" { } // for if (i == 23) { - fake_make_print_error_unsupported_type(data_make->setting, data_make->main->error, if_and_or, data_make->cache_arguments.array[k]); + fake_make_print_error_unsupported_type(data_make->setting, data_make->program->error, if_and_or, data_make->cache_arguments.array[k]); data_make->setting->state.status = F_status_set_error(F_failure); @@ -371,7 +371,7 @@ extern "C" { // Identify and convert to the appropriate if not condition. if (state_process->condition == fake_make_operation_if_type_if_not_e) { if (data_make->cache_arguments.used < 1 + k) { - fake_print_error_requires_more_arguments(data_make->setting, data_make->main->error); + fake_print_error_requires_more_arguments(data_make->setting, data_make->program->error); data_make->setting->state.status = F_status_set_error(F_failure); @@ -388,7 +388,7 @@ extern "C" { } // for if (j == 7) { - fake_make_print_error_unsupported_type(data_make->setting, data_make->main->error, if_and_or, data_make->cache_arguments.array[k]); + fake_make_print_error_unsupported_type(data_make->setting, data_make->program->error, if_and_or, data_make->cache_arguments.array[k]); data_make->setting->state.status = F_status_set_error(F_failure); @@ -404,7 +404,7 @@ extern "C" { // The success and failure operations minimum is also the maximum. if (data_make->cache_arguments.used > if_type_minimum[i]) { - fake_print_error_too_many_arguments(data_make->setting, data_make->main->error); + fake_print_error_too_many_arguments(data_make->setting, data_make->program->error); data_make->setting->state.status = F_status_set_error(F_failure); } @@ -417,7 +417,7 @@ extern "C" { if (state_process->condition == fake_make_operation_if_type_if_equal_e || state_process->condition == fake_make_operation_if_type_if_equal_not_e) { if (data_make->cache_arguments.used < 2 + k) { - fake_print_error_requires_more_arguments(data_make->setting, data_make->main->error); + fake_print_error_requires_more_arguments(data_make->setting, data_make->program->error); data_make->setting->state.status = F_status_set_error(F_failure); } @@ -441,7 +441,7 @@ extern "C" { if (fl_string_dynamic_compare(fake_make_operation_argument_has_s, data_make->cache_arguments.array[k]) == F_equal_to_not) { if (j == 6) { - fake_make_print_error_unsupported_type(data_make->setting, data_make->main->error, fake_make_operation_mode_s, data_make->cache_arguments.array[k]); + fake_make_print_error_unsupported_type(data_make->setting, data_make->program->error, fake_make_operation_mode_s, data_make->cache_arguments.array[k]); } else { f_char_t message[4 + fake_make_operation_mode_s.used + 1]; @@ -451,7 +451,7 @@ extern "C" { f_string_static_t message_s = macro_f_string_static_t_initialize(message, 0, 4 + fake_make_operation_mode_s.used); - fake_make_print_error_unsupported_type(data_make->setting, data_make->main->error, message_s, data_make->cache_arguments.array[k]); + fake_make_print_error_unsupported_type(data_make->setting, data_make->program->error, message_s, data_make->cache_arguments.array[k]); } data_make->setting->state.status = F_status_set_error(F_failure); @@ -522,7 +522,7 @@ extern "C" { type_file |= 0x40; } else { - fake_make_print_error_unsupported_type(data_make->setting, data_make->main->error, f_file_type_name_file_s, data_make->cache_arguments.array[i]); + fake_make_print_error_unsupported_type(data_make->setting, data_make->program->error, f_file_type_name_file_s, data_make->cache_arguments.array[i]); type_file |= 0x80; } @@ -568,7 +568,7 @@ extern "C" { } if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error_file(data_make->setting, data_make->main->error, macro_fake_f(f_file_exists), data_make->cache_arguments.array[i], f_file_operation_find_s, fll_error_file_type_file_e); + fake_print_error_file(data_make->setting, data_make->program->error, macro_fake_f(f_file_exists), data_make->cache_arguments.array[i], f_file_operation_find_s, fll_error_file_type_file_e); status = F_status_set_error(F_failure); } @@ -586,7 +586,7 @@ extern "C" { if (state_process->condition == fake_make_operation_if_type_if_greater_e || state_process->condition == fake_make_operation_if_type_if_greater_equal_e || state_process->condition == fake_make_operation_if_type_if_less_e || state_process->condition == fake_make_operation_if_type_if_less_equal_e) { if (data_make->cache_arguments.used < 2 + k) { - fake_print_error_requires_more_arguments(data_make->setting, data_make->main->error); + fake_print_error_requires_more_arguments(data_make->setting, data_make->program->error); data_make->setting->state.status = F_status_set_error(F_failure); @@ -625,10 +625,10 @@ extern "C" { status = F_status_set_error(F_failure); if (number > F_number_t_size_unsigned_d) { - fake_make_print_error_out_of_range_number(data_make->setting, data_make->main->error, data_make->cache_arguments.array[i], F_number_t_size_unsigned_d, F_number_t_size_unsigned_d); + fake_make_print_error_out_of_range_number(data_make->setting, data_make->program->error, data_make->cache_arguments.array[i], F_number_t_size_unsigned_d, F_number_t_size_unsigned_d); } else { - fake_make_print_error_unsupported_number(data_make->setting, data_make->main->error, data_make->cache_arguments.array[i]); + fake_make_print_error_unsupported_number(data_make->setting, data_make->program->error, data_make->cache_arguments.array[i]); } } } // for @@ -643,7 +643,7 @@ extern "C" { } } else { - fake_print_error_requires_more_arguments(data_make->setting, data_make->main->error); + fake_print_error_requires_more_arguments(data_make->setting, data_make->program->error); data_make->setting->state.status = F_status_set_error(F_failure); } @@ -653,7 +653,7 @@ extern "C" { #ifndef _di_fake_make_operate_validate_type_copy_ void fake_make_operate_validate_type_copy(fake_make_data_t * const data_make) { - if (!data_make || !data_make->main || !data_make->setting) return; + if (!data_make || !data_make->program || !data_make->setting) return; if (data_make->cache_arguments.used > 1) { f_status_t status = F_none; @@ -673,7 +673,7 @@ extern "C" { for (i = 0; i < data_make->cache_arguments.used - 1; ++i) { if (f_file_exists(data_make->cache_arguments.array[i], F_true) != F_true) { - fake_print_error_file_simple(data_make->setting, data_make->main->error, macro_fake_f(f_file_is), data_make->cache_arguments.array[i], f_file_operation_find_s, fll_error_file_type_file_e); + fake_print_error_file_simple(data_make->setting, data_make->program->error, macro_fake_f(f_file_is), data_make->cache_arguments.array[i], f_file_operation_find_s, fll_error_file_type_file_e); status = F_status_set_error(F_failure); } @@ -685,13 +685,13 @@ extern "C" { data_make->setting->state.status = f_directory_is(data_make->cache_arguments.array[data_make->cache_arguments.used - 1]); if (data_make->setting->state.status == F_false || data_make->setting->state.status == F_file_found_not) { - fake_make_print_error_content_not_directory(data_make->setting, data_make->main->error, "last", data_make->cache_arguments.array[data_make->cache_arguments.used - 1]); + fake_make_print_error_content_not_directory(data_make->setting, data_make->program->error, "last", data_make->cache_arguments.array[data_make->cache_arguments.used - 1]); status = F_status_set_error(F_failure); } if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error_file(data_make->setting, data_make->main->error, macro_fake_f(f_directory_is), data_make->cache_arguments.array[data_make->cache_arguments.used - 1], f_file_operation_identify_s, fll_error_file_type_directory_e); + fake_print_error_file(data_make->setting, data_make->program->error, macro_fake_f(f_directory_is), data_make->cache_arguments.array[data_make->cache_arguments.used - 1], f_file_operation_identify_s, fll_error_file_type_directory_e); status = F_status_set_error(F_failure); } @@ -705,7 +705,7 @@ extern "C" { data_make->setting->state.status = f_directory_is(data_make->cache_arguments.array[1]); if (data_make->setting->state.status == F_false) { - fake_make_print_error_content_not_directory(data_make->setting, data_make->main->error, "second", data_make->cache_arguments.array[1]); + fake_make_print_error_content_not_directory(data_make->setting, data_make->program->error, "second", data_make->cache_arguments.array[1]); status = F_status_set_error(F_failure); } @@ -715,7 +715,7 @@ extern "C" { data_make->setting->state.status = status; } else { - fake_print_error_requires_more_arguments(data_make->setting, data_make->main->error); + fake_print_error_requires_more_arguments(data_make->setting, data_make->program->error); data_make->setting->state.status = F_status_set_error(F_failure); } @@ -725,7 +725,7 @@ extern "C" { #ifndef _di_fake_make_operate_validate_type_define_ void fake_make_operate_validate_type_define(fake_make_data_t * const data_make) { - if (!data_make || !data_make->main || !data_make->setting) return; + if (!data_make || !data_make->program || !data_make->setting) return; if (data_make->cache_arguments.used) { fake_make_operate_validate_define_name(data_make->cache_arguments.array[0]); @@ -737,14 +737,14 @@ extern "C" { } if (data_make->setting->state.status == F_none) { - fake_make_print_error_define_name_empty(data_make->setting, data_make->main->error); + fake_make_print_error_define_name_empty(data_make->setting, data_make->program->error); } else { - fake_make_print_error_define_invalid_character(data_make->setting, data_make->main->error, data_make->cache_arguments.array[0]); + fake_make_print_error_define_invalid_character(data_make->setting, data_make->program->error, data_make->cache_arguments.array[0]); } } else { - fake_print_error_requires_more_arguments(data_make->setting, data_make->main->error); + fake_print_error_requires_more_arguments(data_make->setting, data_make->program->error); } data_make->setting->state.status = F_status_set_error(F_failure); @@ -754,7 +754,7 @@ extern "C" { #ifndef _di_fake_make_operate_validate_type_delete_ void fake_make_operate_validate_type_delete(fake_make_data_t * const data_make) { - if (!data_make || !data_make->main || !data_make->setting) return; + if (!data_make || !data_make->program || !data_make->setting) return; if (data_make->cache_arguments.used) { f_status_t status = F_none; @@ -773,7 +773,7 @@ extern "C" { data_make->setting->state.status = status; } else { - fake_print_error_requires_more_arguments(data_make->setting, data_make->main->error); + fake_print_error_requires_more_arguments(data_make->setting, data_make->program->error); data_make->setting->state.status = F_status_set_error(F_failure); } @@ -783,10 +783,10 @@ extern "C" { #ifndef _di_fake_make_operate_validate_type_else_ void fake_make_operate_validate_type_else(fake_make_data_t * const data_make, fake_state_process_t * const state_process) { - if (!data_make || !data_make->main || !data_make->setting || !state_process) return; + if (!data_make || !data_make->program || !data_make->setting || !state_process) return; if (state_process->operation_previous == fake_make_operation_type_else_e) { - fake_make_print_error_after_condition_must_not(data_make->setting, data_make->main->error); + fake_make_print_error_after_condition_must_not(data_make->setting, data_make->program->error); data_make->setting->state.status = F_status_set_error(F_failure); @@ -794,7 +794,7 @@ extern "C" { } if (state_process->operation_previous == fake_make_operation_type_if_e || state_process->operation_previous == fake_make_operation_type_and_e || state_process->operation_previous == fake_make_operation_type_or_e) { - fake_make_print_error_after_condition_must_not(data_make->setting, data_make->main->error); + fake_make_print_error_after_condition_must_not(data_make->setting, data_make->program->error); data_make->setting->state.status = F_status_set_error(F_failure); @@ -802,7 +802,7 @@ extern "C" { } if (!state_process->block) { - fake_make_print_error_after_condition_no_preceding(data_make->setting, data_make->main->error); + fake_make_print_error_after_condition_no_preceding(data_make->setting, data_make->program->error); data_make->setting->state.status = F_status_set_error(F_failure); @@ -810,7 +810,7 @@ extern "C" { } if (data_make->cache_arguments.used) { - fake_print_error_too_many_arguments(data_make->setting, data_make->main->error); + fake_print_error_too_many_arguments(data_make->setting, data_make->program->error); data_make->setting->state.status = F_status_set_error(F_failure); @@ -824,10 +824,10 @@ extern "C" { #ifndef _di_fake_make_operate_validate_type_exit_ void fake_make_operate_validate_type_exit(fake_make_data_t * const data_make) { - if (!data_make || !data_make->main || !data_make->setting) return; + if (!data_make || !data_make->program || !data_make->setting) return; if (data_make->cache_arguments.used > 1) { - fake_print_error_too_many_arguments(data_make->setting, data_make->main->error); + fake_print_error_too_many_arguments(data_make->setting, data_make->program->error); data_make->setting->state.status = F_status_set_error(F_failure); @@ -837,7 +837,7 @@ extern "C" { if (data_make->cache_arguments.used) { if (fl_string_dynamic_compare(fake_make_operation_argument_success_s, data_make->cache_arguments.array[0]) == F_equal_to_not) { if (fl_string_dynamic_compare(fake_make_operation_argument_failure_s, data_make->cache_arguments.array[0]) == F_equal_to_not) { - fake_make_print_error_unsupported_type(data_make->setting, data_make->main->error, fake_make_operation_exit_s, data_make->cache_arguments.array[0]); + fake_make_print_error_unsupported_type(data_make->setting, data_make->program->error, fake_make_operation_exit_s, data_make->cache_arguments.array[0]); data_make->setting->state.status = F_status_set_error(F_failure); @@ -853,13 +853,13 @@ extern "C" { #ifndef _di_fake_make_operate_validate_type_fail_ void fake_make_operate_validate_type_fail(fake_make_data_t * const data_make) { - if (!data_make || !data_make->main || !data_make->setting) return; + if (!data_make || !data_make->program || !data_make->setting) return; if (data_make->cache_arguments.used) { if (fl_string_dynamic_compare(fake_make_operation_argument_exit_s, data_make->cache_arguments.array[0]) == F_equal_to_not) { if (fl_string_dynamic_compare(fake_make_operation_argument_warn_s, data_make->cache_arguments.array[0]) == F_equal_to_not) { if (fl_string_dynamic_compare(fake_make_operation_argument_ignore_s, data_make->cache_arguments.array[0]) == F_equal_to_not) { - fake_make_print_error_unsupported_type(data_make->setting, data_make->main->error, fake_make_operation_fail_s, data_make->cache_arguments.array[0]); + fake_make_print_error_unsupported_type(data_make->setting, data_make->program->error, fake_make_operation_fail_s, data_make->cache_arguments.array[0]); data_make->setting->state.status = F_status_set_error(F_failure); @@ -871,7 +871,7 @@ extern "C" { data_make->setting->state.status = F_none; } else { - fake_print_error_requires_more_arguments(data_make->setting, data_make->main->error); + fake_print_error_requires_more_arguments(data_make->setting, data_make->program->error); data_make->setting->state.status = F_status_set_error(F_failure); } @@ -881,15 +881,15 @@ extern "C" { #ifndef _di_fake_make_operate_validate_type_index_ void fake_make_operate_validate_type_index(fake_make_data_t * const data_make) { - if (!data_make || !data_make->main || !data_make->setting) return; + if (!data_make || !data_make->program || !data_make->setting) return; if (!data_make->cache_arguments.used) { - fake_print_error_requires_more_arguments(data_make->setting, data_make->main->error); + fake_print_error_requires_more_arguments(data_make->setting, data_make->program->error); data_make->setting->state.status = F_status_set_error(F_failure); } else if (!data_make->setting_build.build_indexer.used) { - fake_make_print_error_indexer_not_specified(data_make->setting, data_make->main->error, fake_make_operation_index_s); + fake_make_print_error_indexer_not_specified(data_make->setting, data_make->program->error, fake_make_operation_index_s); data_make->setting->state.status = F_status_set_error(F_failure); } @@ -902,10 +902,10 @@ extern "C" { #ifndef _di_fake_make_operate_validate_type_link_ void fake_make_operate_validate_type_link(fake_make_data_t * const data_make) { - if (!data_make || !data_make->main || !data_make->setting) return; + if (!data_make || !data_make->program || !data_make->setting) return; if (data_make->cache_arguments.used > 4) { - fake_print_error_too_many_arguments(data_make->setting, data_make->main->error); + fake_print_error_too_many_arguments(data_make->setting, data_make->program->error); data_make->setting->state.status = F_status_set_error(F_failure); @@ -995,7 +995,7 @@ extern "C" { data_make->setting->state.status = f_file_name_directory(full, &data_make->cache_path); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error_file(data_make->setting, data_make->main->error, macro_fake_f(f_file_name_directory), full, f_file_operation_analyze_s, fll_error_file_type_path_e); + fake_print_error_file(data_make->setting, data_make->program->error, macro_fake_f(f_file_name_directory), full, f_file_operation_analyze_s, fll_error_file_type_path_e); status = F_status_set_error(F_failure); } @@ -1004,7 +1004,7 @@ extern "C" { data_make->setting->state.status = f_string_dynamic_append_assure(f_path_separator_s, &data_make->cache_path); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_string_dynamic_append_assure)); + fake_print_error(&data_make->program->error, macro_fake_f(f_string_dynamic_append_assure)); status = F_status_set_error(F_failure); } @@ -1012,7 +1012,7 @@ extern "C" { data_make->setting->state.status = f_string_dynamic_append(data_make->cache_arguments.array[data_make->cache_arguments.used - 2], &data_make->cache_path); if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error(data_make->setting, data_make->main->error, macro_fake_f(f_string_dynamic_append)); + fake_print_error(&data_make->program->error, macro_fake_f(f_string_dynamic_append)); status = F_status_set_error(F_failure); } @@ -1046,7 +1046,7 @@ extern "C" { } } else { - fake_make_print_error_target_file_name_empty(data_make->setting, data_make->main->error); + fake_make_print_error_target_file_name_empty(data_make->setting, data_make->program->error); data_make->setting->state.status = F_status_set_error(F_failure); } @@ -1055,7 +1055,7 @@ extern "C" { data_make->setting->state.status = status; } else { - fake_print_error_requires_more_arguments(data_make->setting, data_make->main->error); + fake_print_error_requires_more_arguments(data_make->setting, data_make->program->error); data_make->setting->state.status = F_status_set_error(F_failure); } @@ -1065,7 +1065,7 @@ extern "C" { #ifndef _di_fake_make_operate_validate_type_move_ void fake_make_operate_validate_type_move(fake_make_data_t * const data_make) { - if (!data_make || !data_make->main || !data_make->setting) return; + if (!data_make || !data_make->program || !data_make->setting) return; if (data_make->cache_arguments.used > 1) { { @@ -1086,7 +1086,7 @@ extern "C" { for (f_array_length_t i = 0; i < data_make->cache_arguments.used - 1; ++i) { if (f_file_exists(data_make->cache_arguments.array[i], F_true) != F_true) { - fake_print_error_file_simple(data_make->setting, data_make->main->error, macro_fake_f(f_file_is), data_make->cache_arguments.array[i], f_file_operation_find_s, fll_error_file_type_file_e); + fake_print_error_file_simple(data_make->setting, data_make->program->error, macro_fake_f(f_file_is), data_make->cache_arguments.array[i], f_file_operation_find_s, fll_error_file_type_file_e); status = F_status_set_error(F_failure); } @@ -1104,7 +1104,7 @@ extern "C" { data_make->setting->state.status = f_directory_is(data_make->cache_arguments.array[data_make->cache_arguments.used - 1]); if (data_make->setting->state.status == F_false || data_make->setting->state.status == F_file_found_not) { - fake_make_print_error_content_not_directory(data_make->setting, data_make->main->error, "last", data_make->cache_arguments.array[data_make->cache_arguments.used - 1]); + fake_make_print_error_content_not_directory(data_make->setting, data_make->program->error, "last", data_make->cache_arguments.array[data_make->cache_arguments.used - 1]); data_make->setting->state.status = F_status_set_error(F_failure); @@ -1112,7 +1112,7 @@ extern "C" { } if (F_status_is_error(data_make->setting->state.status)) { - fake_print_error_file(data_make->setting, data_make->main->error, macro_fake_f(f_directory_is), data_make->cache_arguments.array[data_make->cache_arguments.used - 1], f_file_operation_identify_s, fll_error_file_type_directory_e); + fake_print_error_file(data_make->setting, data_make->program->error, macro_fake_f(f_directory_is), data_make->cache_arguments.array[data_make->cache_arguments.used - 1], f_file_operation_identify_s, fll_error_file_type_directory_e); data_make->setting->state.status = F_status_set_error(F_failure); @@ -1128,7 +1128,7 @@ extern "C" { data_make->setting->state.status = f_directory_is(data_make->cache_arguments.array[1]); if (data_make->setting->state.status == F_false) { - fake_make_print_error_content_not_directory(data_make->setting, data_make->main->error, "second", data_make->cache_arguments.array[1]); + fake_make_print_error_content_not_directory(data_make->setting, data_make->program->error, "second", data_make->cache_arguments.array[1]); data_make->setting->state.status = F_status_set_error(F_failure); @@ -1140,7 +1140,7 @@ extern "C" { data_make->setting->state.status = F_none; } else { - fake_print_error_requires_more_arguments(data_make->setting, data_make->main->error); + fake_print_error_requires_more_arguments(data_make->setting, data_make->program->error); data_make->setting->state.status = F_status_set_error(F_failure); } @@ -1150,10 +1150,10 @@ extern "C" { #ifndef _di_fake_make_operate_validate_type_operate_ void fake_make_operate_validate_type_operate(fake_make_data_t * const data_make, f_array_lengths_t * const section_stack) { - if (!data_make || !data_make->main || !data_make->setting || !section_stack) return; + if (!data_make || !data_make->program || !data_make->setting || !section_stack) return; if (data_make->cache_arguments.used > 1) { - fake_print_error_too_many_arguments(data_make->setting, data_make->main->error); + fake_print_error_too_many_arguments(data_make->setting, data_make->program->error); data_make->setting->state.status = F_status_set_error(F_failure); @@ -1171,7 +1171,7 @@ extern "C" { } // for if (id_section == data_make->fakefile.used) { - fake_make_print_error_operation_section_not_found(data_make->setting, data_make->main->error, data_make->cache_arguments.array[0]); + fake_make_print_error_operation_section_not_found(data_make->setting, data_make->program->error, data_make->cache_arguments.array[0]); data_make->setting->state.status = F_status_set_error(F_failure); @@ -1181,7 +1181,7 @@ extern "C" { for (f_array_length_t i = 0; i < section_stack->used; ++i) { if (section_stack->array[i] == id_section) { - fake_make_print_error_operation_recursion(data_make->setting, data_make->main->error, data_make->buffer, data_make->fakefile.array[id_section].name); + fake_make_print_error_operation_recursion(data_make->setting, data_make->program->error, data_make->buffer, data_make->fakefile.array[id_section].name); data_make->setting->state.status = F_status_set_error(F_failure); @@ -1192,7 +1192,7 @@ extern "C" { data_make->setting->state.status = F_none; } else { - fake_print_error_requires_more_arguments(data_make->setting, data_make->main->error); + fake_print_error_requires_more_arguments(data_make->setting, data_make->program->error); data_make->setting->state.status = F_status_set_error(F_failure); } @@ -1202,7 +1202,7 @@ extern "C" { #ifndef _di_fake_make_operate_validate_type_parameter_ void fake_make_operate_validate_type_parameter(fake_make_data_t * const data_make) { - if (!data_make || !data_make->main || !data_make->setting) return; + if (!data_make || !data_make->program || !data_make->setting) return; if (data_make->cache_arguments.used) { const f_string_static_t reserved_name[] = { @@ -1246,7 +1246,7 @@ extern "C" { for (f_array_length_t i = 0; i < 33; ++i) { if (fl_string_dynamic_compare(reserved_name[i], data_make->cache_arguments.array[0]) == F_equal_to) { - fake_make_print_error_reserved_parameter_name(data_make->setting, data_make->main->error, reserved_name[i]); + fake_make_print_error_reserved_parameter_name(data_make->setting, data_make->program->error, reserved_name[i]); status = F_status_set_error(F_failure); } @@ -1255,7 +1255,7 @@ extern "C" { data_make->setting->state.status = status; } else { - fake_print_error_requires_more_arguments(data_make->setting, data_make->main->error); + fake_print_error_requires_more_arguments(data_make->setting, data_make->program->error); data_make->setting->state.status = F_status_set_error(F_failure); } @@ -1265,7 +1265,7 @@ extern "C" { #ifndef _di_fake_make_operate_validate_type_permission_ void fake_make_operate_validate_type_permission(fake_make_data_t * const data_make, fake_state_process_t * const state_process) { - if (!data_make || !data_make->main || !data_make->setting || !state_process) return; + if (!data_make || !data_make->program || !data_make->setting || !state_process) return; if (data_make->cache_arguments.used) { f_array_length_t i = 1; @@ -1284,14 +1284,14 @@ extern "C" { data_make->setting->state.status = f_file_is(data_make->cache_arguments.array[i], F_file_type_regular_d, F_false); if (data_make->setting->state.status == F_file_found_not) { - fake_print_error_file_simple(data_make->setting, data_make->main->error, macro_fake_f(f_file_is), data_make->cache_arguments.array[i], f_file_operation_find_s, fll_error_file_type_file_e); + fake_print_error_file_simple(data_make->setting, data_make->program->error, macro_fake_f(f_file_is), data_make->cache_arguments.array[i], f_file_operation_find_s, fll_error_file_type_file_e); status = F_status_set_error(F_failure); } if (F_status_is_error(data_make->setting->state.status)) { - if (data_make->error.verbosity != f_console_verbosity_quiet_e && data_make->main->error.to.stream) { - fake_print_error_file(data_make->setting, data_make->main->error, macro_fake_f(f_file_is), data_make->cache_arguments.array[i], f_file_operation_find_s, fll_error_file_type_directory_e); + if (data_make->error.verbosity != f_console_verbosity_quiet_e && data_make->program->error.to.stream) { + fake_print_error_file(data_make->setting, data_make->program->error, macro_fake_f(f_file_is), data_make->cache_arguments.array[i], f_file_operation_find_s, fll_error_file_type_directory_e); } status = F_status_set_error(F_failure); @@ -1302,7 +1302,7 @@ extern "C" { } } else { - fake_print_error_requires_more_arguments(data_make->setting, data_make->main->error); + fake_print_error_requires_more_arguments(data_make->setting, data_make->program->error); data_make->setting->state.status = F_status_set_error(F_failure); } @@ -1312,10 +1312,10 @@ extern "C" { #ifndef _di_fake_make_operate_validate_type_pop_ void fake_make_operate_validate_type_pop(fake_make_data_t * const data_make) { - if (!data_make || !data_make->main || !data_make->setting) return; + if (!data_make || !data_make->program || !data_make->setting) return; if (data_make->cache_arguments.used) { - fake_print_error_too_many_arguments(data_make->setting, data_make->main->error); + fake_print_error_too_many_arguments(data_make->setting, data_make->program->error); data_make->setting->state.status = F_status_set_error(F_failure); @@ -1323,7 +1323,7 @@ extern "C" { } if (data_make->path.stack.used == 1) { - fake_make_print_error_pop_last_path(data_make->setting, data_make->main->error); + fake_make_print_error_pop_last_path(data_make->setting, data_make->program->error); data_make->setting->state.status = F_status_set_error(F_failure); } @@ -1336,10 +1336,10 @@ extern "C" { #ifndef _di_fake_make_operate_validate_type_run_ void fake_make_operate_validate_type_run(fake_make_data_t * const data_make) { - if (!data_make || !data_make->main || !data_make->setting) return; + if (!data_make || !data_make->program || !data_make->setting) return; if (!data_make->cache_arguments.used) { - fake_print_error_requires_more_arguments(data_make->setting, data_make->main->error); + fake_print_error_requires_more_arguments(data_make->setting, data_make->program->error); data_make->setting->state.status = F_status_set_error(F_failure); } @@ -1352,10 +1352,10 @@ extern "C" { #ifndef _di_fake_make_operate_validate_type_to_ void fake_make_operate_validate_type_to(fake_make_data_t * const data_make) { - if (!data_make || !data_make->main || !data_make->setting) return; + if (!data_make || !data_make->program || !data_make->setting) return; if (data_make->cache_arguments.used > 1) { - fake_print_error_too_many_arguments(data_make->setting, data_make->main->error); + fake_print_error_too_many_arguments(data_make->setting, data_make->program->error); data_make->setting->state.status = F_status_set_error(F_failure); @@ -1367,7 +1367,7 @@ extern "C" { data_make->setting->state.status = f_file_is(data_make->cache_arguments.array[0], F_file_type_directory_d, F_false); if (data_make->setting->state.status == F_file_found_not) { - fake_print_error_file_simple(data_make->setting, data_make->main->error, macro_fake_f(f_file_is), data_make->cache_arguments.array[0], f_file_operation_find_s, fll_error_file_type_file_e); + fake_print_error_file_simple(data_make->setting, data_make->program->error, macro_fake_f(f_file_is), data_make->cache_arguments.array[0], f_file_operation_find_s, fll_error_file_type_file_e); data_make->setting->state.status = F_status_set_error(F_failure); @@ -1375,8 +1375,8 @@ extern "C" { } if (F_status_is_error(data_make->setting->state.status)) { - if (data_make->error.verbosity != f_console_verbosity_quiet_e && data_make->main->error.to.stream) { - fake_print_error_file(data_make->setting, data_make->main->error, macro_fake_f(f_file_is), data_make->data->file_data_build_fakefile, f_file_operation_find_s, fll_error_file_type_file_e); + if (data_make->error.verbosity != f_console_verbosity_quiet_e && data_make->program->error.to.stream) { + fake_print_error_file(data_make->setting, data_make->program->error, macro_fake_f(f_file_is), data_make->data->file_data_build_fakefile, f_file_operation_find_s, fll_error_file_type_file_e); } data_make->setting->state.status = F_status_set_error(F_failure); @@ -1388,19 +1388,19 @@ extern "C" { data_make->setting->state.status = F_none; } else { - fake_make_print_error_content_not_directory(data_make->setting, data_make->main->error, 0, data_make->cache_arguments.array[0]); + fake_make_print_error_content_not_directory(data_make->setting, data_make->program->error, 0, data_make->cache_arguments.array[0]); data_make->setting->state.status = F_status_set_error(F_failure); } } else { - fake_make_print_error_file_name_empty(data_make->setting, data_make->main->error); + fake_make_print_error_file_name_empty(data_make->setting, data_make->program->error); data_make->setting->state.status = F_status_set_error(F_failure); } } else { - fake_print_error_requires_more_arguments(data_make->setting, data_make->main->error); + fake_print_error_requires_more_arguments(data_make->setting, data_make->program->error); data_make->setting->state.status = F_status_set_error(F_failure); } @@ -1410,12 +1410,12 @@ extern "C" { #ifndef _di_fake_make_operate_validate_type_touch_ void fake_make_operate_validate_type_touch(fake_make_data_t * const data_make) { - if (!data_make || !data_make->main || !data_make->setting) return; + if (!data_make || !data_make->program || !data_make->setting) return; if (data_make->cache_arguments.used > 1) { if (fl_string_dynamic_compare(fake_make_operation_argument_file_s, data_make->cache_arguments.array[0]) == F_equal_to_not) { if (fl_string_dynamic_compare(fake_make_operation_argument_directory_s, data_make->cache_arguments.array[0]) == F_equal_to_not) { - fake_make_print_error_unsupported_type(data_make->setting, data_make->main->error, f_file_type_name_file_s, data_make->cache_arguments.array[0]); + fake_make_print_error_unsupported_type(data_make->setting, data_make->program->error, f_file_type_name_file_s, data_make->cache_arguments.array[0]); data_make->setting->state.status = F_status_set_error(F_failure); } @@ -1437,7 +1437,7 @@ extern "C" { data_make->setting->state.status = status; } else { - fake_print_error_requires_more_arguments(data_make->setting, data_make->main->error); + fake_print_error_requires_more_arguments(data_make->setting, data_make->program->error); data_make->setting->state.status = F_status_set_error(F_failure); } @@ -1468,7 +1468,7 @@ extern "C" { } } else { - fake_print_error_requires_more_arguments(data_make->setting, data_make->main->error); + fake_print_error_requires_more_arguments(data_make->setting, data_make->program->error); data_make->setting->state.status = F_status_set_error(F_failure); } diff --git a/level_3/fake/c/main/make/print.c b/level_3/fake/c/main/make/print.c index 51e92cc..11ae808 100644 --- a/level_3/fake/c/main/make/print.c +++ b/level_3/fake/c/main/make/print.c @@ -44,7 +44,7 @@ extern "C" { f_file_stream_lock(print.to); - fl_print_format("%[Processing Section '%]", print.to, print.set->important, print.set->important); + fl_print_format("%r%[Processing Section '%]", print.to, f_string_eol_s, print.set->important, print.set->important); fl_print_format("%[%/Q%]", print.to, print.set->notable, buffer, section.name, print.set->notable); fl_print_format("%['.%]%r", print.to, print.set->important, print.set->important, f_string_eol_s); diff --git a/level_3/fake/c/main/print.c b/level_3/fake/c/main/print.c index bef2aaa..025b99d 100644 --- a/level_3/fake/c/main/print.c +++ b/level_3/fake/c/main/print.c @@ -4,6 +4,56 @@ extern "C" { #endif +#ifndef _di_fake_print_building_ + f_status_t fake_print_building(fake_setting_t * const setting, const fl_print_t print, const f_string_statics_t * const build_arguments, fake_build_setting_t * const setting_build) { + + if (!setting || !setting_build) return F_status_set_error(F_output_not); + if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; + + f_file_stream_lock(print.to); + + fl_print_format("%r%[Building%] ", print.to, f_string_eol_s, print.set->important, print.set->important); + fl_print_format("%[%Q%]", print.to, print.set->notable, setting_build->build_name, print.set->notable); + fl_print_format("%[ using '%]", print.to, print.set->important, print.set->important); + fl_print_format("%[%Q%]", print.to, print.set->notable, setting->settings, print.set->notable); + + fl_print_format("%[' with modes '%]", print.to, print.set->important, print.set->important); + + f_string_statics_t modes_custom = f_string_statics_t_initialize; + modes_custom.used = build_arguments && build_arguments->used > 1 ? build_arguments->used - 1 : 0; + modes_custom.size = 0; + + f_string_static_t modes_custom_array[modes_custom.used]; + modes_custom.array = modes_custom_array; + + for (f_array_length_t i = 0; i < modes_custom.used; ++i) { + modes_custom.array[i] = build_arguments->array[i + 1]; + } // for + + // Custom modes are always used if provided, otherwise if any mode is specified, the entire defaults is replaced. + const f_string_statics_t * const modes = modes_custom.used + ? &modes_custom + : setting->modes.used + ? &setting->modes + : &setting_build->modes_default; + + for (f_array_length_t i = 0; i < modes->used; ) { + + fl_print_format("%[%Q%]", print.to, print.set->notable, modes->array[i], print.set->notable); + + if (++i < modes->used) { + fl_print_format("%[', '%]", print.to, print.set->important, print.set->important); + } + } // for + + fl_print_format("%['.%]%r", print.to, print.set->important, print.set->important, f_string_eol_s); + + f_file_stream_unlock(print.to); + + return F_none; + } +#endif // _di_fake_print_building_ + #ifndef _di_fake_print_generating_skeleton_ f_status_t fake_print_generating_skeleton(fake_setting_t * const setting, const fl_print_t print) { @@ -23,8 +73,6 @@ extern "C" { f_file_stream_lock(print.to); - f_print_dynamic_raw(setting->line_first, print.to); - fll_program_print_help_header(print, fake_program_name_long_s, fake_program_version_s); fll_program_print_help_option_standard(print); @@ -87,8 +135,6 @@ extern "C" { fl_print_format(" A section name from the fakefile that does not conflict with an operation name may be specified when performing the %[%r%] operation.%r", print.to, print.set->notable, fake_other_operation_make_s, print.set->notable, f_string_eol_s); - f_print_dynamic_raw(setting->line_last, print.to); - f_file_stream_flush(print.to); f_file_stream_unlock(print.to); @@ -96,44 +142,6 @@ extern "C" { } #endif // _di_fake_print_help_ -#ifndef _di_fake_print_line_first_ - f_status_t fake_print_line_first(fake_setting_t * const setting, const fl_print_t print) { - - if (!setting) return F_status_set_error(F_output_not); - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; - - if (F_status_is_error_not(setting->state.status)) { - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - if (setting->flag & fake_main_flag_file_to_e) return F_output_not; - } - - if (setting->flag & fake_main_flag_print_first_e) { - fll_print_dynamic_raw(setting->line_first, print.to); - - setting->flag -= fake_main_flag_print_first_e; - } - - return F_none; - } -#endif // _di_fake_print_line_first_ - -#ifndef _di_fake_print_line_last_ - f_status_t fake_print_line_last(fake_setting_t * const setting, const fl_print_t print) { - - if (!setting) return F_status_set_error(F_output_not); - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; - - if (F_status_is_error_not(setting->state.status)) { - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - if (setting->flag & fake_main_flag_file_to_e) return F_output_not; - } - - fll_print_dynamic_raw(setting->line_last, print.to); - - return F_none; - } -#endif // _di_fake_print_line_last_ - #ifndef _di_fake_print_simple_ void fake_print_simple(fake_setting_t * const setting, const fl_print_t print, const f_string_t message) { diff --git a/level_3/fake/c/main/print.h b/level_3/fake/c/main/print.h index efd5381..eae2aa7 100644 --- a/level_3/fake/c/main/print.h +++ b/level_3/fake/c/main/print.h @@ -17,11 +17,36 @@ extern "C" { #endif /** + * Print a message about building. + * + * @param setting + * The main program settings. + * + * This does not alter setting.state.status. + * @param print + * The output structure to print to. + * @param build_arguments + * (optional) The build arguments. + * @param setting_build + * The build setting data. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + * + * @see f_file_stream_lock() + * @see f_file_stream_unlock() + * @see fl_print_format() + */ +#ifndef _di_fake_print_building_ + extern f_status_t fake_print_building(fake_setting_t * const setting, const fl_print_t print, const f_string_statics_t * const build_arguments, fake_build_setting_t * const setting_build); +#endif // _di_fake_print_building_ + +/** * Print a message about generating skeleton. * * @param setting * The main program settings. - * (Must be of type fake_setting_t.) * * This does not alter setting.state.status. * @param print @@ -69,60 +94,6 @@ extern "C" { #endif // _di_fake_print_help_ /** - * Print first new line, unless verbosity says otherwise. - * - * This is generally either the first line in the program or the first line printed before an error message. - * - * Once the first line is processed (printed or not), then this will print new lines normally. - * - * This function locks and then unlocks the input stream when printing. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - * - * F_output_not (with error bit) if setting is NULL. - * - * @see fll_print_dynamic_raw() - */ -#ifndef _di_fake_print_line_first_ - extern f_status_t fake_print_line_first(fake_setting_t * const setting, const fl_print_t print); -#endif // _di_fake_print_line_first_ - -/** - * Print last new line when the main is complete, unless verbosity says otherwise. - * - * This is generally the very last line printed in the program. - * - * This function locks and then unlocks the input stream when printing. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - * - * F_output_not (with error bit) if setting is NULL. - * - * @see fll_print_dynamic_raw() - */ -#ifndef _di_fake_print_line_last_ - extern f_status_t fake_print_line_last(fake_setting_t * const setting, const fl_print_t print); -#endif // _di_fake_print_line_last_ - -/** * Print simple message. * * This is primarily used by numerous print functions to reduce code. diff --git a/level_3/fake/c/main/print/context.c b/level_3/fake/c/main/print/context.c index efb3adf..9148d5d 100644 --- a/level_3/fake/c/main/print/context.c +++ b/level_3/fake/c/main/print/context.c @@ -7,7 +7,7 @@ extern "C" { #ifndef _di_fake_print_context_important_simple_ void fake_print_context_important_simple(fake_setting_t * const setting, const fl_print_t print, const f_string_t message) { - const fl_print_t custom = macro_fl_print_t_initialize(print.to, print.verbosity, f_string_empty_s, f_string_empty_s, print.set->important, print.set->notable, print.set); + const fl_print_t custom = macro_fl_print_t_initialize(print.to, print.verbosity, 0, f_string_empty_s, f_string_empty_s, print.set->important, print.set->notable, print.set, 0); fake_print_context_simple(setting, custom, message); } @@ -67,6 +67,23 @@ extern "C" { } #endif // _di_fake_print_context_wrapped_parameter_ +#ifndef _di_fake_print_context_wrapped_parameter_value_ + void fake_print_context_wrapped_parameter_value(fake_setting_t * const setting, const fl_print_t print, const f_string_t before, const f_string_static_t symbol, const f_string_static_t name, const f_string_t between, const f_string_static_t value, const f_string_t after) { + + if (!setting) return; + + f_file_stream_lock(print.to); + + fl_print_format("%[%Q%S'%]", print.to, print.context, print.prefix, before, print.context); + fl_print_format("%[%Q%Q%]", print.to, print.notable, symbol, name, print.notable); + fl_print_format("%['%S'%]%r", print.to, print.context, between, print.context); + fl_print_format("%[%Q%]", print.to, print.notable, value, print.notable); + fl_print_format("%['%S.%]%r", print.to, print.context, after, print.context, f_string_eol_s); + + f_file_stream_unlock(print.to); + } +#endif // _di_fake_print_context_wrapped_parameter_value_ + #ifndef _di_fake_print_context_wrapped_parameters_ void fake_print_context_wrapped_parameters(fake_setting_t * const setting, const fl_print_t print, const f_string_t before, const f_string_static_t symbol_1, const f_string_static_t name_1, const f_string_t between_1, const f_string_static_t symbol_2, const f_string_static_t name_2, const f_string_t between_2, const f_string_static_t symbol_3, const f_string_static_t name_3, const f_string_t after) { diff --git a/level_3/fake/c/main/print/context.h b/level_3/fake/c/main/print/context.h index fa4f424..ec5a2cb 100644 --- a/level_3/fake/c/main/print/context.h +++ b/level_3/fake/c/main/print/context.h @@ -162,6 +162,45 @@ extern "C" { #endif // _di_fake_print_context_wrapped_parameter_ /** + * Print a parameter context message with a before string, a middle string, an after string, a string symbol, a parameter name, and the parameter value. + * + * This is primarily used by numerous print functions to reduce code. + * This is not used for any print functions that has complex format structures. + * + * @param setting + * The main program settings. + * (Must be of type fake_setting_t.) + * + * This does not alter setting.state.status. + * @param print + * The output structure to print to. + * @param before + * The string being printed before the variable. + * Likely should have a space added at the end of the string. + * Set to NULL to disable. + * @param symbol + * The string representing the symbol for the parameter. + * Set to f_string_empty_s to disable. + * @param name + * The string representing the parameter name. + * @param between + * The string being printed after the parameter name and before the parameter value. + * @param value + * The value associated with the given parameter name. + * @param after + * The string being printed after the variable. + * Likely should have a space added at the start of the string. + * Set to NULL to disable. + * + * @see f_file_stream_lock() + * @see f_file_stream_unlock() + * @see fl_print_format() + */ +#ifndef _di_fake_print_context_wrapped_parameter_value_ + extern void fake_print_context_wrapped_parameter_value(fake_setting_t * const setting, const fl_print_t print, const f_string_t before, const f_string_static_t symbol, const f_string_static_t name, const f_string_t between, const f_string_static_t value, const f_string_t after); +#endif // _di_fake_print_context_wrapped_parameter_value_ + +/** * Print a parameter context message with a there parameters, with symbols, and wrapping strings. * * This is primarily used by numerous print functions to reduce code. diff --git a/level_3/fake/c/main/print/error.c b/level_3/fake/c/main/print/error.c index a9e7c60..a44e337 100644 --- a/level_3/fake/c/main/print/error.c +++ b/level_3/fake/c/main/print/error.c @@ -5,12 +5,16 @@ extern "C" { #endif #ifndef _di_fake_print_error_ - f_status_t fake_print_error(fake_setting_t * const setting, const fl_print_t print, const f_string_t function) { + f_status_t fake_print_error(fl_print_t * const print, const f_string_t function) { - if (!setting) return F_status_set_error(F_output_not); - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; + if (!print) return F_status_set_error(F_output_not); + if (print->verbosity < f_console_verbosity_error_e) return F_output_not; - fll_error_print(print, F_status_set_fine(setting->state.status), function, fll_error_file_flag_fallback_e); + fake_setting_t * const setting = (fake_setting_t *) print->custom; + + if (setting) { + fll_error_print(*print, F_status_set_fine(setting->state.status), function, fll_error_file_flag_fallback_e); + } return F_none; } @@ -227,6 +231,18 @@ extern "C" { } #endif // _di_fake_print_error_directory_create_parent_missing_ +#ifndef _di_fake_print_error_execute_program_not_found_ + f_status_t fake_print_error_execute_program_not_found(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t program) { + + if (!setting) return F_status_set_error(F_output_not); + if (print.verbosity < f_console_verbosity_error_e) return F_output_not; + + fake_print_context_simple_variable(setting, print, "Failed to find program ", program, " for executing"); + + return F_none; + } +#endif // _di_fake_print_error_execute_program_not_found_ + #ifndef _di_fake_print_error_failure_operation_ f_status_t fake_print_error_failure_operation(fake_setting_t * const setting, const fl_print_t print, const uint8_t operation) { @@ -607,12 +623,24 @@ extern "C" { if (!setting) return F_status_set_error(F_output_not); if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - fake_print_context_wrapped_parameter(setting, print, "The ", f_console_symbol_long_normal_s, name, " parameter must not be empty and must not contain only white space"); + fake_print_context_wrapped_parameter(setting, print, "The ", symbol, name, " parameter must not be empty and must not contain only white space"); return F_none; } #endif // _di_fake_print_error_parameter_not_empty_ +#ifndef _di_fake_print_error_parameter_directory_not_found_path_ + f_status_t fake_print_error_parameter_directory_not_found_path(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) return F_status_set_error(F_output_not); + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + + fake_print_context_wrapped_parameter_value(setting, print, "The value of the directory parameter ", symbol, name, " has a path of ", value, " that is not found."); + + return F_none; + } +#endif // _di_fake_print_error_parameter_directory_not_found_path_ + #ifndef _di_fake_print_error_parameter_not_word_ f_status_t fake_print_error_parameter_not_word(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) { @@ -646,12 +674,12 @@ extern "C" { #endif // _di_fake_print_error_parameter_operation_not_with_ #ifndef _di_fake_print_error_parameter_too_many_ - f_status_t fake_print_error_parameter_too_many(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t parameter) { + f_status_t fake_print_error_parameter_too_many(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t symbol, const f_string_static_t parameter) { if (!setting) return F_status_set_error(F_output_not); if (print.verbosity < f_console_verbosity_error_e) return F_output_not; - fake_print_context_wrapped_parameter(setting, print, "The parameter ", f_console_symbol_long_normal_s, parameter, " is specified too many times"); + fake_print_context_wrapped_parameter(setting, print, "The parameter ", symbol, parameter, " is specified too many times"); return F_none; } diff --git a/level_3/fake/c/main/print/error.h b/level_3/fake/c/main/print/error.h index 86fb48c..c700fc3 100644 --- a/level_3/fake/c/main/print/error.h +++ b/level_3/fake/c/main/print/error.h @@ -19,12 +19,14 @@ extern "C" { /** * Print generic error message regarding a function failing in some way. * - * @param setting - * The main program settings. + * This does not print a leading first line, better allowing it to be used while loading settings or before the normal first line is printed. * - * This does not alter setting.state.status. * @param print * Designates the how and where to print. + * + * This expects print.custom to be fake_setting_t. + * + * This does not alter print.custom.state.status. * @param function * The function name. * @@ -39,7 +41,7 @@ extern "C" { * @see fl_print_format() */ #ifndef _di_fake_print_error_ - extern f_status_t fake_print_error(fake_setting_t * const setting, const fl_print_t print, const f_string_t function); + extern f_status_t fake_print_error(fl_print_t * const print, const f_string_t function); #endif // _di_fake_print_error_ /** @@ -328,6 +330,30 @@ extern "C" { #endif // _di_fake_print_error_directory_create_parent_missing_ /** + * Print error message regarding program needed for execution is not found. + * + * @param setting + * The main program settings. + * + * This does not alter setting.state.status. + * @param print + * Designates the how and where to print. + * @param program + * The name of the not found program. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + * + * F_output_not (with error bit) if setting is NULL. + * + * @see fake_print_context_simple_variable() + */ +#ifndef _di_fake_print_error_execute_program_not_found_ + extern f_status_t fake_print_error_execute_program_not_found(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t program); +#endif // _di_fake_print_error_execute_program_not_found_ + +/** * Print file related error message regarding a function failing in some way. * * This prints a simple message to avoid "Unable to find file..., because file cannot be found." type of messages. @@ -743,6 +769,34 @@ extern "C" { #endif // _di_fake_print_error_parameter_not_empty_ /** + * Print error message for when the directory parameter value is not found. + * + * @param setting + * The main program settings. + * + * This does not alter setting.state.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 not found. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + * + * F_output_not (with error bit) if setting is NULL. + * + * @see fake_print_context_wrapped_parameter_value() + */ +#ifndef _di_fake_print_error_parameter_directory_not_found_path_ + extern f_status_t fake_print_error_parameter_directory_not_found_path(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); +#endif // _di_fake_print_error_parameter_directory_not_found_path_ + +/** * Print error message for when the parameter value contains a non-word, non-minus, and non-plus character. * * @param setting @@ -815,7 +869,7 @@ extern "C" { * @see fake_print_context_wrapped_parameter() */ #ifndef _di_fake_print_error_parameter_too_many_ - extern f_status_t fake_print_error_parameter_too_many(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t parameter); + extern f_status_t fake_print_error_parameter_too_many(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t symbol, const f_string_static_t parameter); #endif // _di_fake_print_error_parameter_too_many_ /** diff --git a/level_3/fake/c/main/print/operation.c b/level_3/fake/c/main/print/operation.c index 6121fa1..f3d7372 100644 --- a/level_3/fake/c/main/print/operation.c +++ b/level_3/fake/c/main/print/operation.c @@ -12,7 +12,7 @@ extern "C" { f_file_stream_lock(print.to); - fl_print_format("All operations complete.%r", print.to, f_string_eol_s, f_string_eol_s); + fl_print_format("%rAll operations complete.%r", print.to, f_string_eol_s, f_string_eol_s); f_file_stream_flush(print.to); f_file_stream_unlock(print.to); diff --git a/level_3/fake/c/main/print/verbose.c b/level_3/fake/c/main/print/verbose.c index 434107a..4b0b314 100644 --- a/level_3/fake/c/main/print/verbose.c +++ b/level_3/fake/c/main/print/verbose.c @@ -19,13 +19,13 @@ extern "C" { fake_data_t * const data = (fake_data_t *) recurse->state.custom; - if (data->main->message.verbosity < f_console_verbosity_verbose_e) { + if (data->program->message.verbosity < f_console_verbosity_verbose_e) { recurse->state.status = F_output_not; return; } - fake_print_wrapped_variables(data->setting, data->main->message, "Cloned ", source, " to ", destination, 0); + fake_print_wrapped_variables(data->setting, data->program->message, "Cloned ", source, " to ", destination, 0); } #endif // _di_fake_print_verbose_clone_ @@ -44,13 +44,13 @@ extern "C" { fake_data_t * const data = (fake_data_t *) recurse->state.custom; - if (data->main->message.verbosity < f_console_verbosity_verbose_e) { + if (data->program->message.verbosity < f_console_verbosity_verbose_e) { recurse->state.status = F_output_not; return; } - fake_print_wrapped_variables(data->setting, data->main->message, "Copied ", source, " to ", destination, 0); + fake_print_wrapped_variables(data->setting, data->program->message, "Copied ", source, " to ", destination, 0); } #endif // _di_fake_print_verbose_copy_ @@ -143,13 +143,13 @@ extern "C" { fake_data_t * const data = (fake_data_t *) recurse->state.custom; - if (data->main->message.verbosity < f_console_verbosity_verbose_e) { + if (data->program->message.verbosity < f_console_verbosity_verbose_e) { recurse->state.status = F_output_not; return; } - fake_print_wrapped_variables(data->setting, data->main->message, "Moved ", source, " to ", destination, 0); + fake_print_wrapped_variables(data->setting, data->program->message, "Moved ", source, " to ", destination, 0); } #endif // _di_fake_print_verbose_move_ diff --git a/level_3/fake/c/main/skeleton.c b/level_3/fake/c/main/skeleton.c index 42d88fb..f02c450 100644 --- a/level_3/fake/c/main/skeleton.c +++ b/level_3/fake/c/main/skeleton.c @@ -7,13 +7,13 @@ extern "C" { #ifndef _di_fake_skeleton_operate_ void fake_skeleton_operate(fake_data_t * const data) { - if (!data || !data->main || !data->setting) return; + if (!data || !data->program || !data->setting) return; - if (data->main->message.verbosity != f_console_verbosity_quiet_e && data->main->message.verbosity != f_console_verbosity_error_e) { - fake_print_generating_skeleton(data->setting, data->main->message); + if (data->program->message.verbosity != f_console_verbosity_quiet_e && data->program->message.verbosity != f_console_verbosity_error_e) { + fake_print_generating_skeleton(data->setting, data->program->message); - if (data->main->message.verbosity >= f_console_verbosity_verbose_e) { - fll_print_dynamic(f_string_eol_s, data->main->message.to); + if (data->program->message.verbosity >= f_console_verbosity_verbose_e) { + fll_print_dynamic(f_string_eol_s, data->program->message.to); } } @@ -80,14 +80,14 @@ extern "C" { fake_skeleton_operate_directory_create(data, path[i]); if (F_status_is_error(data->setting->state.status)) { - fake_print_error(data->setting, data->main->error, macro_fake_f(fake_skeleton_operate_directory_create)); + fake_print_error(&data->program->error, macro_fake_f(fake_skeleton_operate_directory_create)); return; } } // for - if (data->main->message.verbosity >= f_console_verbosity_verbose_e) { - fll_print_dynamic(f_string_eol_s, data->main->message.to); + if (data->program->message.verbosity >= f_console_verbosity_verbose_e) { + fll_print_dynamic(f_string_eol_s, data->program->message.to); } } @@ -119,12 +119,12 @@ extern "C" { #ifndef _di_fake_skeleton_operate_directory_create_ void fake_skeleton_operate_directory_create(fake_data_t * const data, const f_string_static_t path) { - if (!data || !data->main || !data->setting || !path.used) return; + if (!data || !data->program || !data->setting || !path.used) return; data->setting->state.status = f_directory_exists(path); if (data->setting->state.status == F_true) { - fake_print_verbose_directory_exists(data->setting, data->main->message, path); + fake_print_verbose_directory_exists(data->setting, data->program->message, path); data->setting->state.status = F_none; @@ -132,7 +132,7 @@ extern "C" { } if (data->setting->state.status == F_false) { - fake_print_warning_path_exists_not_directory(data->setting, data->main->warning, path); + fake_print_warning_path_exists_not_directory(data->setting, data->program->warning, path); data->setting->state.status = F_status_set_warning(F_failure); @@ -144,19 +144,19 @@ extern "C" { if (F_status_is_error(data->setting->state.status)) { if (F_status_set_fine(data->setting->state.status) == F_file_found_not) { - fake_print_error_directory_create_parent_missing(data->setting, data->main->error, path); + fake_print_error_directory_create_parent_missing(data->setting, data->program->error, path); } else { - fake_print_error_file(data->setting, data->main->error, macro_fake_f(f_directory_create), path, f_file_operation_create_s, fll_error_file_type_directory_e); + fake_print_error_file(data->setting, data->program->error, macro_fake_f(f_directory_create), path, f_file_operation_create_s, fll_error_file_type_directory_e); } return; } - fake_print_verbose_create_directory(data->setting, data->main->message, path); + fake_print_verbose_create_directory(data->setting, data->program->message, path); } else if (F_status_is_error(data->setting->state.status)) { - fake_print_error_file(data->setting, data->main->error, macro_fake_f(f_directory_exists), path, f_file_operation_create_s, fll_error_file_type_directory_e); + fake_print_error_file(data->setting, data->program->error, macro_fake_f(f_directory_exists), path, f_file_operation_create_s, fll_error_file_type_directory_e); return; } @@ -168,12 +168,12 @@ extern "C" { #ifndef _di_fake_skeleton_operate_file_create_ void fake_skeleton_operate_file_create(fake_data_t * const data, const f_string_static_t path, const bool executable, const f_string_static_t content) { - if (!data || !data->main || !data->setting || !path.used) return; + if (!data || !data->program || !data->setting || !path.used) return; data->setting->state.status = f_file_is(path, F_file_type_regular_d, F_false); if (data->setting->state.status == F_true) { - fake_print_verbose_file_exists(data->setting, data->main->message, path); + fake_print_verbose_file_exists(data->setting, data->program->message, path); data->setting->state.status = F_none; @@ -185,7 +185,7 @@ extern "C" { data->setting->state.status = f_file_is(path, F_file_type_link_d, F_false); if (data->setting->state.status == F_true) { - fake_print_verbose_file_exists_as_link(data->setting, data->main->message, path); + fake_print_verbose_file_exists_as_link(data->setting, data->program->message, path); data->setting->state.status = F_none; @@ -194,7 +194,7 @@ extern "C" { } if (data->setting->state.status == F_false) { - fake_print_verbose_file_exists_not_regular_or_link(data->setting, data->main->message, path); + fake_print_verbose_file_exists_not_regular_or_link(data->setting, data->program->message, path); data->setting->state.status = F_status_set_warning(F_none); @@ -212,16 +212,16 @@ extern "C" { if (F_status_is_error(data->setting->state.status)) { if (F_status_set_fine(data->setting->state.status) == F_file_found_not) { - fake_print_error_file_create_parent_missing(data->setting, data->main->error, path); + fake_print_error_file_create_parent_missing(data->setting, data->program->error, path); } else { - fake_print_error_file(data->setting, data->main->error, macro_fake_f(f_file_create), path, f_file_operation_create_s, fll_error_file_type_file_e); + fake_print_error_file(data->setting, data->program->error, macro_fake_f(f_file_create), path, f_file_operation_create_s, fll_error_file_type_file_e); } return; } - fake_print_verbose_create_file(data->setting, data->main->message, path); + fake_print_verbose_create_file(data->setting, data->program->message, path); if (content.used) { f_file_t file = f_file_t_initialize; @@ -232,7 +232,7 @@ extern "C" { data->setting->state.status = f_file_open(path, 0, &file); if (F_status_is_error(data->setting->state.status)) { - fake_print_error_file(data->setting, data->main->error, macro_fake_f(f_file_open), path, fake_common_file_populate_pre_s, fll_error_file_type_file_e); + fake_print_error_file(data->setting, data->program->error, macro_fake_f(f_file_open), path, fake_common_file_populate_pre_s, fll_error_file_type_file_e); return; } @@ -240,7 +240,7 @@ extern "C" { data->setting->state.status = f_file_write(file, content, 0); if (F_status_is_error(data->setting->state.status)) { - fake_print_error_file(data->setting, data->main->error, macro_fake_f(f_file_write), path, fake_common_file_populate_pre_s, fll_error_file_type_file_e); + fake_print_error_file(data->setting, data->program->error, macro_fake_f(f_file_write), path, fake_common_file_populate_pre_s, fll_error_file_type_file_e); f_file_stream_flush(file); f_file_stream_close(&file); @@ -248,14 +248,14 @@ extern "C" { return; } - fake_print_verbose_file_pre_populated(data->setting, data->main->message, path); + fake_print_verbose_file_pre_populated(data->setting, data->program->message, path); f_file_stream_flush(file); f_file_stream_close(&file); } } else if (F_status_is_error(data->setting->state.status)) { - fake_print_error_file(data->setting, data->main->error, macro_fake_f(f_file_is), path, f_file_operation_create_s, fll_error_file_type_file_e); + fake_print_error_file(data->setting, data->program->error, macro_fake_f(f_file_is), path, f_file_operation_create_s, fll_error_file_type_file_e); return; } diff --git a/level_3/firewall/c/common.c b/level_3/firewall/c/common.c index cb02aae..42ffda7 100644 --- a/level_3/firewall/c/common.c +++ b/level_3/firewall/c/common.c @@ -121,10 +121,27 @@ extern "C" { setting->state.status = f_console_parameter_process(state, arguments, &main->parameters, &setting->state, 0); + // Identify and pocess first/last parameters. + if (main->parameters.array[firewall_parameter_line_first_no_e].result & f_console_result_found_e) { + setting->flag -= setting->flag & firewall_main_flag_print_first_e; + } + else { + setting->flag |= firewall_main_flag_print_first_e; + } + + if (main->parameters.array[firewall_parameter_line_last_no_e].result & f_console_result_found_e) { + setting->flag -= setting->flag & firewall_main_flag_print_last_e; + } + else { + setting->flag |= firewall_main_flag_print_last_e; + } + if (F_status_is_error(setting->state.status)) { - firewall_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->state.status), "f_console_parameter_process", fll_error_file_flag_fallback_e); - firewall_print_line_last_locked(setting, main->error); + + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error); + } return; } @@ -144,28 +161,16 @@ extern "C" { setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, main); if (F_status_is_error(setting->state.status)) { - firewall_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e); - firewall_print_line_last_locked(setting, main->error); + + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error); + } return; } } - if (main->parameters.array[firewall_parameter_line_first_no_e].result & f_console_result_found_e) { - setting->line_first = f_string_empty_s; - } - else { - setting->line_first = f_string_eol_s; - } - - if (main->parameters.array[firewall_parameter_line_last_no_e].result & f_console_result_found_e) { - setting->line_last = f_string_empty_s; - } - else { - setting->line_last = f_string_eol_s; - } - // Identify and prioritize "verbosity" parameters. { uint16_t choices_array[5] = { firewall_parameter_verbosity_quiet_e, firewall_parameter_verbosity_error_e, firewall_parameter_verbosity_verbose_e, firewall_parameter_verbosity_debug_e, firewall_parameter_verbosity_normal_e }; @@ -177,9 +182,11 @@ extern "C" { setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); if (F_status_is_error(setting->state.status)) { - firewall_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e); - firewall_print_line_last_locked(setting, main->error); + + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error); + } return; } diff --git a/level_3/firewall/c/common.h b/level_3/firewall/c/common.h index 0f01382..a89ecbc 100644 --- a/level_3/firewall/c/common.h +++ b/level_3/firewall/c/common.h @@ -359,8 +359,6 @@ extern "C" { firewall_parameter_verbosity_verbose_e, firewall_parameter_verbosity_debug_e, firewall_parameter_version_e, - firewall_parameter_line_first_no_e, - firewall_parameter_line_last_no_e, firewall_parameter_command_start_e, firewall_parameter_command_stop_e, @@ -388,18 +386,16 @@ extern "C" { #define firewall_console_parameter_t_initialize \ { \ - macro_f_console_parameter_t_initialize_3(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e, 0), \ - macro_f_console_parameter_t_initialize_3(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize_3(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize_3(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize_3(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize_3(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize_3(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize_3(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize_3(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize_3(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \ - macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_3(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_3(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_3(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_3(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_3(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_3(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_3(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_3(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_3(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \ + macro_f_console_parameter_t_initialize_3(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \ \ macro_f_console_parameter_t_initialize_6(firewall_command_start_s, 0, f_console_flag_simple_e), \ macro_f_console_parameter_t_initialize_6(firewall_command_stop_s, 0, f_console_flag_simple_e), \ @@ -408,7 +404,7 @@ extern "C" { macro_f_console_parameter_t_initialize_6(firewall_command_show_s, 0, f_console_flag_simple_e), \ } - #define firewall_total_parameters_d 17 + #define firewall_total_parameters_d 15 #endif // _di_firewall_parameter_d_ /** @@ -420,6 +416,8 @@ extern "C" { * - file_to: Using a specified destination file. * - help: Print help. * - header: Enable printing of headers. + * - print_first: When set, print new line to message output on program begin after loading settings. + * - print_last: When set, print new line to message output on program end. * - separate: Enable printing of separators. * - strip_invalid: Using strip invalid character mode. * - verify: Using verify mode. @@ -432,10 +430,12 @@ extern "C" { firewall_main_flag_file_to_e = 0x2, firewall_main_flag_header_e = 0x4, firewall_main_flag_help_e = 0x8, - firewall_main_flag_separate_e = 0x10, - firewall_main_flag_strip_invalid_e = 0x20, - firewall_main_flag_verify_e = 0x40, - firewall_main_flag_version_e = 0x80, + firewall_main_flag_print_first_e = 0x20, + firewall_main_flag_print_last_e = 0x40, + firewall_main_flag_separate_e = 0x80, + firewall_main_flag_strip_invalid_e = 0x100, + firewall_main_flag_verify_e = 0x200, + firewall_main_flag_version_e = 0x400, }; // enum #endif // _di_firewall_main_flag_e_ @@ -448,26 +448,18 @@ extern "C" { * flag: Flags passed to the main function. * * state: The state information. - * - * 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. */ #ifndef _di_firewall_setting_t_ typedef struct { uint16_t flag; f_state_t state; - - f_string_static_t line_first; - f_string_static_t line_last; } firewall_setting_t; #define firewall_setting_t_initialize \ { \ firewall_main_flag_none_e, \ f_state_t_initialize, \ - f_string_static_t_initialize, \ - f_string_static_t_initialize, \ } #endif // _di_firewall_setting_t_ diff --git a/level_3/firewall/c/firewall.c b/level_3/firewall/c/firewall.c index 7539695..3e27513 100644 --- a/level_3/firewall/c/firewall.c +++ b/level_3/firewall/c/firewall.c @@ -40,9 +40,11 @@ extern "C" { status = fll_program_parameter_process_context(choices, modes, F_true, main); if (F_status_is_error(status)) { - firewall_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e); - firewall_print_line_last_locked(setting, main->error); + + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error); + } return; } @@ -59,9 +61,11 @@ extern "C" { status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); if (F_status_is_error(status)) { - firewall_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e); - firewall_print_line_last_locked(setting, main->error); + + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error); + } return; } @@ -75,13 +79,13 @@ extern "C" { } if (main->parameters.array[firewall_parameter_version_e].result & f_console_result_found_e) { - fll_program_print_version(main->message, (setting->line_first.used ? 0x1 : 0x0) | (setting->line_last.used ? 0x2 : 0x0), firewall_program_version_s); + fll_program_print_version(main->message, firewall_program_version_s); return F_none; } if (main->parameters.array[firewall_parameter_copyright_e].result & f_console_result_found_e) { - fll_program_print_copyright(main->message, (setting->line_first.used ? 0x1 : 0x0) | (setting->line_last.used ? 0x2 : 0x0)); + fll_program_print_copyright(main->message); return F_none; } diff --git a/level_3/firewall/c/print.c b/level_3/firewall/c/print.c index cce2c5a..3606471 100644 --- a/level_3/firewall/c/print.c +++ b/level_3/firewall/c/print.c @@ -10,8 +10,6 @@ extern "C" { f_file_stream_lock(print.to); - f_print_dynamic_raw(setting->line_first, print.to); - fll_program_print_help_header(print, firewall_program_name_long_s, firewall_program_version_s); fll_program_print_help_option_standard(print); @@ -28,8 +26,6 @@ extern "C" { fll_program_print_help_usage(print, firewall_program_name_s, firewall_program_help_parameters_s); - f_print_dynamic_raw(setting->line_last, print.to); - f_file_stream_flush(print.to); f_file_stream_unlock(print.to); @@ -37,66 +33,6 @@ extern "C" { } #endif // _di_firewall_print_help_ -#ifndef _di_firewall_print_line_first_locked_ - f_status_t firewall_print_line_first_locked(firewall_setting_t * const setting, const fl_print_t print) { - - if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; - - if (F_status_is_error_not(setting->state.status)) { - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - } - - f_print_dynamic_raw(setting->line_first, print.to); - - return F_none; - } -#endif // _di_firewall_print_line_first_locked_ - -#ifndef _di_firewall_print_line_first_unlocked_ - f_status_t firewall_print_line_first_unlocked(firewall_setting_t * const setting, const fl_print_t print) { - - if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; - - if (F_status_is_error_not(setting->state.status)) { - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - } - - fll_print_dynamic_raw(setting->line_first, print.to); - - return F_none; - } -#endif // _di_firewall_print_line_first_unlocked_ - -#ifndef _di_firewall_print_line_last_locked_ - f_status_t firewall_print_line_last_locked(firewall_setting_t * const setting, const fl_print_t print) { - - if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; - - if (F_status_is_error_not(setting->state.status)) { - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - } - - fll_print_dynamic_raw(setting->line_last, print.to); - - return F_none; - } -#endif // _di_firewall_print_line_last_locked_ - -#ifndef _di_firewall_print_line_last_unlocked_ - f_status_t firewall_print_line_last_unlocked(firewall_setting_t * const setting, const fl_print_t print) { - - if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; - - if (F_status_is_error_not(setting->state.status)) { - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - } - - f_print_dynamic_raw(setting->line_last, print.to); - - return F_none; - } -#endif // _di_firewall_print_line_last_unlocked_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/firewall/c/print.h b/level_3/firewall/c/print.h index 10b85d8..27c01cf 100644 --- a/level_3/firewall/c/print.h +++ b/level_3/firewall/c/print.h @@ -29,94 +29,6 @@ extern "C" { extern f_status_t firewall_print_help(firewall_setting_t * const setting, const fl_print_t print); #endif // _di_firewall_print_help_ -/** - * Print first new line, unless verbosity says otherwise. - * - * This is generally either the first line in the program or the first line printed before an error message. - * - * This function locks and then unlocks the input stream when printing. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_firewall_print_line_first_locked_ - extern f_status_t firewall_print_line_first_locked(firewall_setting_t * const setting, const fl_print_t print); -#endif // _di_firewall_print_line_first_locked_ - -/** - * Print first new line, unless verbosity says otherwise. - * - * This is generally either the first line in the program or the first line printed before an error message. - * - * This function neither locks nor unlocks the input stream. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_firewall_print_line_first_unlocked_ - extern f_status_t firewall_print_line_first_unlocked(firewall_setting_t * const setting, const fl_print_t print); -#endif // _di_firewall_print_line_first_unlocked_ - -/** - * Print last new line when the main is complete, unless verbosity says otherwise. - * - * This is generally the very last line printed in the program. - * - * This function locks and then unlocks the input stream when printing. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_firewall_print_line_last_locked_ - extern f_status_t firewall_print_line_last_locked(firewall_setting_t * const setting, const fl_print_t print); -#endif // _di_firewall_print_line_last_locked_ - -/** - * Print last new line when the main is complete, unless verbosity says otherwise. - * - * This is generally the very last line printed in the program. - * - * This function neither locks nor unlocks the input stream. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_firewall_print_line_last_unlocked_ - extern f_status_t firewall_print_line_last_unlocked(firewall_setting_t * const setting, const fl_print_t print); -#endif // _di_firewall_print_line_last_unlocked_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/fss_basic_list_read/c/common.c b/level_3/fss_basic_list_read/c/common.c index c7afffc..9f28ee4 100644 --- a/level_3/fss_basic_list_read/c/common.c +++ b/level_3/fss_basic_list_read/c/common.c @@ -81,10 +81,27 @@ extern "C" { setting->state.step_small = fss_basic_list_read_allocation_small_d; + // Identify and pocess first/last parameters. + if (main->parameters.array[fss_basic_list_read_parameter_line_first_no_e].result & f_console_result_found_e) { + setting->flag -= setting->flag & fss_basic_list_read_main_flag_print_first_e; + } + else { + setting->flag |= fss_basic_list_read_main_flag_print_first_e; + } + + if (main->parameters.array[fss_basic_list_read_parameter_line_last_no_e].result & f_console_result_found_e) { + setting->flag -= setting->flag & fss_basic_list_read_main_flag_print_last_e; + } + else { + setting->flag |= fss_basic_list_read_main_flag_print_last_e; + } + if (F_status_is_error(setting->state.status)) { - fss_basic_list_read_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->state.status), "f_console_parameter_process", fll_error_file_flag_fallback_e); - fss_basic_list_read_print_line_last_locked(setting, main->error); + + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error); + } return; } @@ -104,28 +121,16 @@ extern "C" { setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, main); if (F_status_is_error(setting->state.status)) { - fss_basic_list_read_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e); - fss_basic_list_read_print_line_last_locked(setting, main->error); + + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error); + } return; } } - if (main->parameters.array[fss_basic_list_read_parameter_line_first_no_e].result & f_console_result_found_e) { - setting->line_first = f_string_empty_s; - } - else { - setting->line_first = f_string_eol_s; - } - - if (main->parameters.array[fss_basic_list_read_parameter_line_last_no_e].result & f_console_result_found_e) { - setting->line_last = f_string_empty_s; - } - else { - setting->line_last = f_string_eol_s; - } - // Identify and prioritize "verbosity" parameters. { uint16_t choices_array[5] = { fss_basic_list_read_parameter_verbosity_quiet_e, fss_basic_list_read_parameter_verbosity_error_e, fss_basic_list_read_parameter_verbosity_verbose_e, fss_basic_list_read_parameter_verbosity_debug_e, fss_basic_list_read_parameter_verbosity_normal_e }; @@ -137,9 +142,11 @@ extern "C" { setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); if (F_status_is_error(setting->state.status)) { - fss_basic_list_read_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e); - fss_basic_list_read_print_line_last_locked(setting, main->error); + + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error); + } return; } diff --git a/level_3/fss_basic_list_read/c/common.h b/level_3/fss_basic_list_read/c/common.h index 72b985a..f030d77 100644 --- a/level_3/fss_basic_list_read/c/common.h +++ b/level_3/fss_basic_list_read/c/common.h @@ -326,6 +326,8 @@ extern "C" { * - file_to: Using a specified destination file. * - help: Print help. * - header: Enable printing of headers. + * - print_first: When set, print new line to message output on program begin after loading settings. + * - print_last: When set, print new line to message output on program end. * - separate: Enable printing of separators. * - strip_invalid: Using strip invalid character mode. * - verify: Using verify mode. @@ -339,10 +341,12 @@ extern "C" { fss_basic_list_read_main_flag_file_to_e = 0x4, fss_basic_list_read_main_flag_header_e = 0x8, fss_basic_list_read_main_flag_help_e = 0x10, - fss_basic_list_read_main_flag_separate_e = 0x20, - fss_basic_list_read_main_flag_strip_invalid_e = 0x40, - fss_basic_list_read_main_flag_verify_e = 0x80, - fss_basic_list_read_main_flag_version_e = 0x100, + fss_basic_list_read_main_flag_print_first_e = 0x20, + fss_basic_list_read_main_flag_print_last_e = 0x40, + fss_basic_list_read_main_flag_separate_e = 0x80, + fss_basic_list_read_main_flag_strip_invalid_e = 0x100, + fss_basic_list_read_main_flag_verify_e = 0x200, + fss_basic_list_read_main_flag_version_e = 0x400, }; // enum #endif // _di_fss_basic_list_read_main_flag_e_ @@ -355,26 +359,18 @@ extern "C" { * flag: Flags passed to the main function. * * state: The state information. - * - * 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. */ #ifndef _di_fss_basic_list_read_setting_t_ typedef struct { uint16_t flag; f_state_t state; - - f_string_static_t line_first; - f_string_static_t line_last; } fss_basic_list_read_setting_t; #define fss_basic_list_read_setting_t_initialize \ { \ fss_basic_list_read_main_flag_none_e, \ f_state_t_initialize, \ - f_string_static_t_initialize, \ - f_string_static_t_initialize, \ } #endif // _di_fss_basic_list_read_setting_t_ diff --git a/level_3/fss_basic_list_read/c/fss_basic_list_read.c b/level_3/fss_basic_list_read/c/fss_basic_list_read.c index 0e188ee..1dee002 100644 --- a/level_3/fss_basic_list_read/c/fss_basic_list_read.c +++ b/level_3/fss_basic_list_read/c/fss_basic_list_read.c @@ -35,9 +35,11 @@ extern "C" { status = fll_program_parameter_process_context(choices, modes, F_true, main); if (F_status_is_error(status)) { - fss_basic_list_read_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e); - fss_basic_list_read_print_line_last_locked(setting, main->error); + + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error); + } return; } @@ -54,9 +56,11 @@ extern "C" { status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); if (F_status_is_error(status)) { - fss_basic_list_read_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e); - fss_basic_list_read_print_line_last_locked(setting, main->error); + + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error); + } return; } @@ -70,13 +74,13 @@ extern "C" { } if (main->parameters.array[fss_basic_list_read_parameter_version_e].result & f_console_result_found_e) { - fll_program_print_version(main->message, (setting->line_first.used ? 0x1 : 0x0) | (setting->line_last.used ? 0x2 : 0x0), fss_basic_list_read_program_version_s); + fll_program_print_version(main->message, fss_basic_list_read_program_version_s); return F_none; } if (main->parameters.array[fss_basic_list_read_parameter_copyright_e].result & f_console_result_found_e) { - fll_program_print_copyright(main->message, (setting->line_first.used ? 0x1 : 0x0) | (setting->line_last.used ? 0x2 : 0x0)); + fll_program_print_copyright(main->message); return F_none; } @@ -213,7 +217,7 @@ extern "C" { if (!((++main->signal_check) % fss_basic_list_read_signal_check_d)) { if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); + fll_program_print_signal_received(main->warning, main->signal_received); status = F_status_set_error(F_interrupt); @@ -410,7 +414,7 @@ extern "C" { if (!((++main->signal_check) % fss_basic_list_read_signal_check_d)) { if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); + fll_program_print_signal_received(main->warning, main->signal_received); status = F_status_set_error(F_interrupt); @@ -477,7 +481,7 @@ extern "C" { // The signal check is always performed on each pass. if (size_file > fss_basic_list_read_block_max && fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); + fll_program_print_signal_received(main->warning, main->signal_received); status = F_status_set_error(F_interrupt); diff --git a/level_3/fss_basic_list_read/c/print.c b/level_3/fss_basic_list_read/c/print.c index 3058f51..358559a 100644 --- a/level_3/fss_basic_list_read/c/print.c +++ b/level_3/fss_basic_list_read/c/print.c @@ -10,8 +10,6 @@ extern "C" { f_file_stream_lock(print.to); - f_print_dynamic_raw(setting->line_first, print.to); - fll_program_print_help_header(print, fss_basic_list_read_program_name_long_s, fss_basic_list_read_program_version_s); fll_program_print_help_option_standard(print); @@ -106,8 +104,6 @@ extern "C" { fl_print_format(" The word 'column' is being loosely defined to refer to a specific Content.%r", print.to, f_string_eol_s); fl_print_format(" This is not to be confused with a depth.%r", print.to, f_string_eol_s); - f_print_dynamic_raw(setting->line_last, print.to); - f_file_stream_flush(print.to); f_file_stream_unlock(print.to); @@ -115,66 +111,6 @@ extern "C" { } #endif // _di_fss_basic_list_read_print_help_ -#ifndef _di_fss_basic_list_read_print_line_first_locked_ - f_status_t fss_basic_list_read_print_line_first_locked(fss_basic_list_read_setting_t * const setting, const fl_print_t print) { - - if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; - - if (F_status_is_error_not(setting->state.status)) { - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - } - - f_print_dynamic_raw(setting->line_first, print.to); - - return F_none; - } -#endif // _di_fss_basic_list_read_print_line_first_locked_ - -#ifndef _di_fss_basic_list_read_print_line_first_unlocked_ - f_status_t fss_basic_list_read_print_line_first_unlocked(fss_basic_list_read_setting_t * const setting, const fl_print_t print) { - - if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; - - if (F_status_is_error_not(setting->state.status)) { - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - } - - fll_print_dynamic_raw(setting->line_first, print.to); - - return F_none; - } -#endif // _di_fss_basic_list_read_print_line_first_unlocked_ - -#ifndef _di_fss_basic_list_read_print_line_last_locked_ - f_status_t fss_basic_list_read_print_line_last_locked(fss_basic_list_read_setting_t * const setting, const fl_print_t print) { - - if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; - - if (F_status_is_error_not(setting->state.status)) { - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - } - - fll_print_dynamic_raw(setting->line_last, print.to); - - return F_none; - } -#endif // _di_fss_basic_list_read_print_line_last_locked_ - -#ifndef _di_fss_basic_list_read_print_line_last_unlocked_ - f_status_t fss_basic_list_read_print_line_last_unlocked(fss_basic_list_read_setting_t * const setting, const fl_print_t print) { - - if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; - - if (F_status_is_error_not(setting->state.status)) { - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - } - - f_print_dynamic_raw(setting->line_last, print.to); - - return F_none; - } -#endif // _di_fss_basic_list_read_print_line_last_unlocked_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/fss_basic_list_read/c/print.h b/level_3/fss_basic_list_read/c/print.h index 391d06c..7c5dbd1 100644 --- a/level_3/fss_basic_list_read/c/print.h +++ b/level_3/fss_basic_list_read/c/print.h @@ -29,94 +29,6 @@ extern "C" { extern f_status_t fss_basic_list_read_print_help(fss_basic_list_read_setting_t * const setting, const fl_print_t print); #endif // _di_fss_basic_list_read_print_help_ -/** - * Print first new line, unless verbosity says otherwise. - * - * This is generally either the first line in the program or the first line printed before an error message. - * - * This function locks and then unlocks the input stream when printing. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fss_basic_list_read_print_line_first_locked_ - extern f_status_t fss_basic_list_read_print_line_first_locked(fss_basic_list_read_setting_t * const setting, const fl_print_t print); -#endif // _di_fss_basic_list_read_print_line_first_locked_ - -/** - * Print first new line, unless verbosity says otherwise. - * - * This is generally either the first line in the program or the first line printed before an error message. - * - * This function neither locks nor unlocks the input stream. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fss_basic_list_read_print_line_first_unlocked_ - extern f_status_t fss_basic_list_read_print_line_first_unlocked(fss_basic_list_read_setting_t * const setting, const fl_print_t print); -#endif // _di_fss_basic_list_read_print_line_first_unlocked_ - -/** - * Print last new line when the main is complete, unless verbosity says otherwise. - * - * This is generally the very last line printed in the program. - * - * This function locks and then unlocks the input stream when printing. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fss_basic_list_read_print_line_last_locked_ - extern f_status_t fss_basic_list_read_print_line_last_locked(fss_basic_list_read_setting_t * const setting, const fl_print_t print); -#endif // _di_fss_basic_list_read_print_line_last_locked_ - -/** - * Print last new line when the main is complete, unless verbosity says otherwise. - * - * This is generally the very last line printed in the program. - * - * This function neither locks nor unlocks the input stream. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fss_basic_list_read_print_line_last_unlocked_ - extern f_status_t fss_basic_list_read_print_line_last_unlocked(fss_basic_list_read_setting_t * const setting, const fl_print_t print); -#endif // _di_fss_basic_list_read_print_line_last_unlocked_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/fss_basic_list_read/c/private-read.c b/level_3/fss_basic_list_read/c/private-read.c index eda3849..1c8ef6a 100644 --- a/level_3/fss_basic_list_read/c/private-read.c +++ b/level_3/fss_basic_list_read/c/private-read.c @@ -88,7 +88,7 @@ extern "C" { if (!((++main->signal_check) % fss_basic_list_read_signal_check_d)) { if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); + fll_program_print_signal_received(main->warning, main->signal_received); return F_status_set_error(F_interrupt); } @@ -176,7 +176,7 @@ extern "C" { if (!((++main->signal_check) % fss_basic_list_read_signal_check_d)) { if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); + fll_program_print_signal_received(main->warning, main->signal_received); return F_status_set_error(F_interrupt); } @@ -349,7 +349,7 @@ extern "C" { if (!((++main->signal_check) % fss_basic_list_read_signal_check_d)) { if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); + fll_program_print_signal_received(main->warning, main->signal_received); return F_status_set_error(F_interrupt); } @@ -397,7 +397,7 @@ extern "C" { if (!((++main->signal_check) % fss_basic_list_read_signal_check_d)) { if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); + fll_program_print_signal_received(main->warning, main->signal_received); return F_status_set_error(F_interrupt); } @@ -500,7 +500,7 @@ extern "C" { if (!((++main->signal_check) % fss_basic_list_read_signal_check_d)) { if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); + fll_program_print_signal_received(main->warning, main->signal_received); return F_status_set_error(F_interrupt); } @@ -583,7 +583,7 @@ extern "C" { if (!((++main->signal_check) % fss_basic_list_read_signal_check_d)) { if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); + fll_program_print_signal_received(main->warning, main->signal_received); return F_status_set_error(F_interrupt); } @@ -623,7 +623,7 @@ extern "C" { if (!((++main->signal_check) % fss_basic_list_read_signal_check_d)) { if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); + fll_program_print_signal_received(main->warning, main->signal_received); return F_status_set_error(F_interrupt); } @@ -740,7 +740,7 @@ extern "C" { if (!((++main->signal_check) % fss_basic_list_read_signal_check_d)) { if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); + fll_program_print_signal_received(main->warning, main->signal_received); return F_status_set_error(F_interrupt); } diff --git a/level_3/fss_basic_read/c/common.c b/level_3/fss_basic_read/c/common.c index c59e8f5..d272bc9 100644 --- a/level_3/fss_basic_read/c/common.c +++ b/level_3/fss_basic_read/c/common.c @@ -80,10 +80,27 @@ extern "C" { setting->state.step_small = fss_basic_read_allocation_small_d; + // Identify and pocess first/last parameters. + if (main->parameters.array[fss_basic_read_parameter_line_first_no_e].result & f_console_result_found_e) { + setting->flag -= setting->flag & fss_basic_read_main_flag_print_first_e; + } + else { + setting->flag |= fss_basic_read_main_flag_print_first_e; + } + + if (main->parameters.array[fss_basic_read_parameter_line_last_no_e].result & f_console_result_found_e) { + setting->flag -= setting->flag & fss_basic_read_main_flag_print_last_e; + } + else { + setting->flag |= fss_basic_read_main_flag_print_last_e; + } + if (F_status_is_error(setting->state.status)) { - fss_basic_read_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->state.status), "f_console_parameter_process", fll_error_file_flag_fallback_e); - fss_basic_read_print_line_last_locked(setting, main->error); + + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error); + } return; } @@ -103,28 +120,16 @@ extern "C" { setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, main); if (F_status_is_error(setting->state.status)) { - fss_basic_read_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e); - fss_basic_read_print_line_last_locked(setting, main->error); + + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error); + } return; } } - if (main->parameters.array[fss_basic_read_parameter_line_first_no_e].result & f_console_result_found_e) { - setting->line_first = f_string_empty_s; - } - else { - setting->line_first = f_string_eol_s; - } - - if (main->parameters.array[fss_basic_read_parameter_line_last_no_e].result & f_console_result_found_e) { - setting->line_last = f_string_empty_s; - } - else { - setting->line_last = f_string_eol_s; - } - // Identify and prioritize "verbosity" parameters. { uint16_t choices_array[5] = { fss_basic_read_parameter_verbosity_quiet_e, fss_basic_read_parameter_verbosity_error_e, fss_basic_read_parameter_verbosity_verbose_e, fss_basic_read_parameter_verbosity_debug_e, fss_basic_read_parameter_verbosity_normal_e }; @@ -136,9 +141,11 @@ extern "C" { setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); if (F_status_is_error(setting->state.status)) { - fss_basic_read_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e); - fss_basic_read_print_line_last_locked(setting, main->error); + + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error); + } return; } diff --git a/level_3/fss_basic_read/c/common.h b/level_3/fss_basic_read/c/common.h index e2ce16b..24eb9a1 100644 --- a/level_3/fss_basic_read/c/common.h +++ b/level_3/fss_basic_read/c/common.h @@ -324,6 +324,8 @@ extern "C" { * - file_to: Using a specified destination file. * - help: Print help. * - header: Enable printing of headers. + * - print_first: When set, print new line to message output on program begin after loading settings. + * - print_last: When set, print new line to message output on program end. * - separate: Enable printing of separators. * - strip_invalid: Using strip invalid character mode. * - verify: Using verify mode. @@ -337,10 +339,12 @@ extern "C" { fss_basic_read_main_flag_file_to_e = 0x4, fss_basic_read_main_flag_header_e = 0x8, fss_basic_read_main_flag_help_e = 0x10, - fss_basic_read_main_flag_separate_e = 0x20, - fss_basic_read_main_flag_strip_invalid_e = 0x40, - fss_basic_read_main_flag_verify_e = 0x80, - fss_basic_read_main_flag_version_e = 0x100, + fss_basic_read_main_flag_print_first_e = 0x20, + fss_basic_read_main_flag_print_last_e = 0x40, + fss_basic_read_main_flag_separate_e = 0x80, + fss_basic_read_main_flag_strip_invalid_e = 0x100, + fss_basic_read_main_flag_verify_e = 0x200, + fss_basic_read_main_flag_version_e = 0x400, }; // enum #endif // _di_fss_basic_read_main_flag_e_ @@ -353,26 +357,18 @@ extern "C" { * flag: Flags passed to the main function. * * state: The state information. - * - * 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. */ #ifndef _di_fss_basic_read_setting_t_ typedef struct { uint16_t flag; f_state_t state; - - f_string_static_t line_first; - f_string_static_t line_last; } fss_basic_read_setting_t; #define fss_basic_read_setting_t_initialize \ { \ fss_basic_read_main_flag_none_e, \ f_state_t_initialize, \ - f_string_static_t_initialize, \ - f_string_static_t_initialize, \ } #endif // _di_fss_basic_read_setting_t_ diff --git a/level_3/fss_basic_read/c/fss_basic_read.c b/level_3/fss_basic_read/c/fss_basic_read.c index a29afdc..d4c7dbe 100644 --- a/level_3/fss_basic_read/c/fss_basic_read.c +++ b/level_3/fss_basic_read/c/fss_basic_read.c @@ -35,9 +35,11 @@ extern "C" { status = fll_program_parameter_process_context(choices, modes, F_true, main); if (F_status_is_error(status)) { - fss_basic_read_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e); - fss_basic_read_print_line_last_locked(setting, main->error); + + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error); + } return; } @@ -54,9 +56,11 @@ extern "C" { status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); if (F_status_is_error(status)) { - fss_basic_read_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e); - fss_basic_read_print_line_last_locked(setting, main->error); + + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error); + } return; } @@ -70,13 +74,13 @@ extern "C" { } if (main->parameters.array[fss_basic_read_parameter_version_e].result & f_console_result_found_e) { - fll_program_print_version(main->message, (setting->line_first.used ? 0x1 : 0x0) | (setting->line_last.used ? 0x2 : 0x0), fss_basic_read_program_version_s); + fll_program_print_version(main->message, fss_basic_read_program_version_s); return F_none; } if (main->parameters.array[fss_basic_read_parameter_copyright_e].result & f_console_result_found_e) { - fll_program_print_copyright(main->message, (setting->line_first.used ? 0x1 : 0x0) | (setting->line_last.used ? 0x2 : 0x0)); + fll_program_print_copyright(main->message); return F_none; } @@ -213,7 +217,7 @@ extern "C" { if (!((++main->signal_check) % fss_basic_read_signal_check_d)) { if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); + fll_program_print_signal_received(main->warning, main->signal_received); status = F_status_set_error(F_interrupt); @@ -418,7 +422,7 @@ extern "C" { if (!((++main->signal_check) % fss_basic_read_signal_check_d)) { if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); + fll_program_print_signal_received(main->warning, main->signal_received); status = F_status_set_error(F_signal); @@ -484,7 +488,7 @@ extern "C" { // The signal check is always performed on each pass. if (size_file > fss_basic_read_block_max && fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); + fll_program_print_signal_received(main->warning, main->signal_received); status = F_status_set_error(F_interrupt); diff --git a/level_3/fss_basic_read/c/print.c b/level_3/fss_basic_read/c/print.c index 706cd36..4ff8421 100644 --- a/level_3/fss_basic_read/c/print.c +++ b/level_3/fss_basic_read/c/print.c @@ -10,8 +10,6 @@ extern "C" { f_file_stream_lock(print.to); - f_print_dynamic_raw(setting->line_first, print.to); - fll_program_print_help_header(print, fss_basic_read_program_name_long_s, fss_basic_read_program_version_s); fll_program_print_help_option_standard(print); @@ -106,8 +104,6 @@ extern "C" { fl_print_format(" The word 'column' is being loosely defined to refer to a specific Content.%r", print.to, f_string_eol_s); fl_print_format(" This is not to be confused with a depth.%r", print.to, f_string_eol_s); - f_print_dynamic_raw(setting->line_last, print.to); - f_file_stream_flush(print.to); f_file_stream_unlock(print.to); @@ -115,66 +111,6 @@ extern "C" { } #endif // _di_fss_basic_read_print_help_ -#ifndef _di_fss_basic_read_print_line_first_locked_ - f_status_t fss_basic_read_print_line_first_locked(fss_basic_read_setting_t * const setting, const fl_print_t print) { - - if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; - - if (F_status_is_error_not(setting->state.status)) { - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - } - - f_print_dynamic_raw(setting->line_first, print.to); - - return F_none; - } -#endif // _di_fss_basic_read_print_line_first_locked_ - -#ifndef _di_fss_basic_read_print_line_first_unlocked_ - f_status_t fss_basic_read_print_line_first_unlocked(fss_basic_read_setting_t * const setting, const fl_print_t print) { - - if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; - - if (F_status_is_error_not(setting->state.status)) { - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - } - - fll_print_dynamic_raw(setting->line_first, print.to); - - return F_none; - } -#endif // _di_fss_basic_read_print_line_first_unlocked_ - -#ifndef _di_fss_basic_read_print_line_last_locked_ - f_status_t fss_basic_read_print_line_last_locked(fss_basic_read_setting_t * const setting, const fl_print_t print) { - - if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; - - if (F_status_is_error_not(setting->state.status)) { - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - } - - fll_print_dynamic_raw(setting->line_last, print.to); - - return F_none; - } -#endif // _di_fss_basic_read_print_line_last_locked_ - -#ifndef _di_fss_basic_read_print_line_last_unlocked_ - f_status_t fss_basic_read_print_line_last_unlocked(fss_basic_read_setting_t * const setting, const fl_print_t print) { - - if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; - - if (F_status_is_error_not(setting->state.status)) { - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - } - - f_print_dynamic_raw(setting->line_last, print.to); - - return F_none; - } -#endif // _di_fss_basic_read_print_line_last_unlocked_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/fss_basic_read/c/print.h b/level_3/fss_basic_read/c/print.h index eb2920e..ae4dbb7 100644 --- a/level_3/fss_basic_read/c/print.h +++ b/level_3/fss_basic_read/c/print.h @@ -29,94 +29,6 @@ extern "C" { extern f_status_t fss_basic_read_print_help(fss_basic_read_setting_t * const setting, const fl_print_t print); #endif // _di_fss_basic_read_print_help_ -/** - * Print first new line, unless verbosity says otherwise. - * - * This is generally either the first line in the program or the first line printed before an error message. - * - * This function locks and then unlocks the input stream when printing. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fss_basic_read_print_line_first_locked_ - extern f_status_t fss_basic_read_print_line_first_locked(fss_basic_read_setting_t * const setting, const fl_print_t print); -#endif // _di_fss_basic_read_print_line_first_locked_ - -/** - * Print first new line, unless verbosity says otherwise. - * - * This is generally either the first line in the program or the first line printed before an error message. - * - * This function neither locks nor unlocks the input stream. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fss_basic_read_print_line_first_unlocked_ - extern f_status_t fss_basic_read_print_line_first_unlocked(fss_basic_read_setting_t * const setting, const fl_print_t print); -#endif // _di_fss_basic_read_print_line_first_unlocked_ - -/** - * Print last new line when the main is complete, unless verbosity says otherwise. - * - * This is generally the very last line printed in the program. - * - * This function locks and then unlocks the input stream when printing. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fss_basic_read_print_line_last_locked_ - extern f_status_t fss_basic_read_print_line_last_locked(fss_basic_read_setting_t * const setting, const fl_print_t print); -#endif // _di_fss_basic_read_print_line_last_locked_ - -/** - * Print last new line when the main is complete, unless verbosity says otherwise. - * - * This is generally the very last line printed in the program. - * - * This function neither locks nor unlocks the input stream. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fss_basic_read_print_line_last_unlocked_ - extern f_status_t fss_basic_read_print_line_last_unlocked(fss_basic_read_setting_t * const setting, const fl_print_t print); -#endif // _di_fss_basic_read_print_line_last_unlocked_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/fss_basic_read/c/private-read.c b/level_3/fss_basic_read/c/private-read.c index e4f29c7..226e44d 100644 --- a/level_3/fss_basic_read/c/private-read.c +++ b/level_3/fss_basic_read/c/private-read.c @@ -65,7 +65,7 @@ extern "C" { if (!((++main->signal_check) % fss_basic_read_signal_check_d)) { if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); + fll_program_print_signal_received(main->warning, main->signal_received); return F_status_set_error(F_interrupt); } @@ -153,7 +153,7 @@ extern "C" { if (!((++main->signal_check) % fss_basic_read_signal_check_d)) { if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); + fll_program_print_signal_received(main->warning, main->signal_received); return F_status_set_error(F_interrupt); } @@ -233,7 +233,7 @@ extern "C" { if (F_status_is_error(status)) { if (F_status_set_fine(status) == F_interrupt) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); + fll_program_print_signal_received(main->warning, main->signal_received); return status; } @@ -374,7 +374,7 @@ extern "C" { if (!((++main->signal_check) % fss_basic_read_signal_check_d)) { if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); + fll_program_print_signal_received(main->warning, main->signal_received); return F_status_set_error(F_interrupt); } @@ -457,7 +457,7 @@ extern "C" { if (!((++main->signal_check) % fss_basic_read_signal_check_d)) { if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); + fll_program_print_signal_received(main->warning, main->signal_received); return F_status_set_error(F_interrupt); } @@ -490,7 +490,7 @@ extern "C" { if (!((++main->signal_check) % fss_basic_read_signal_check_d)) { if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); + fll_program_print_signal_received(main->warning, main->signal_received); return F_status_set_error(F_interrupt); } @@ -641,7 +641,7 @@ extern "C" { if (!((++main->signal_check) % fss_basic_read_signal_check_d)) { if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); + fll_program_print_signal_received(main->warning, main->signal_received); return F_status_set_error(F_interrupt); } diff --git a/level_3/fss_embedded_list_read/c/common.c b/level_3/fss_embedded_list_read/c/common.c index 77f89e8..9f4b4e1 100644 --- a/level_3/fss_embedded_list_read/c/common.c +++ b/level_3/fss_embedded_list_read/c/common.c @@ -79,10 +79,27 @@ extern "C" { setting->state.step_small = fss_embedded_list_read_allocation_small_d; + // Identify and pocess first/last parameters. + if (main->parameters.array[fss_embedded_list_read_parameter_line_first_no_e].result & f_console_result_found_e) { + setting->flag -= setting->flag & fss_embedded_list_read_main_flag_print_first_e; + } + else { + setting->flag |= fss_embedded_list_read_main_flag_print_first_e; + } + + if (main->parameters.array[fss_embedded_list_read_parameter_line_last_no_e].result & f_console_result_found_e) { + setting->flag -= setting->flag & fss_embedded_list_read_main_flag_print_last_e; + } + else { + setting->flag |= fss_embedded_list_read_main_flag_print_last_e; + } + if (F_status_is_error(setting->state.status)) { - fss_embedded_list_read_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->state.status), "f_console_parameter_process", fll_error_file_flag_fallback_e); - fss_embedded_list_read_print_line_last_locked(setting, main->error); + + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error); + } return; } @@ -102,28 +119,16 @@ extern "C" { setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, main); if (F_status_is_error(setting->state.status)) { - fss_embedded_list_read_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e); - fss_embedded_list_read_print_line_last_locked(setting, main->error); + + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error); + } return; } } - if (main->parameters.array[fss_embedded_list_read_parameter_line_first_no_e].result & f_console_result_found_e) { - setting->line_first = f_string_empty_s; - } - else { - setting->line_first = f_string_eol_s; - } - - if (main->parameters.array[fss_embedded_list_read_parameter_line_last_no_e].result & f_console_result_found_e) { - setting->line_last = f_string_empty_s; - } - else { - setting->line_last = f_string_eol_s; - } - // Identify and prioritize "verbosity" parameters. { uint16_t choices_array[5] = { fss_embedded_list_read_parameter_verbosity_quiet_e, fss_embedded_list_read_parameter_verbosity_error_e, fss_embedded_list_read_parameter_verbosity_verbose_e, fss_embedded_list_read_parameter_verbosity_debug_e, fss_embedded_list_read_parameter_verbosity_normal_e }; @@ -135,9 +140,11 @@ extern "C" { setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); if (F_status_is_error(setting->state.status)) { - fss_embedded_list_read_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e); - fss_embedded_list_read_print_line_last_locked(setting, main->error); + + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error); + } return; } diff --git a/level_3/fss_embedded_list_read/c/common.h b/level_3/fss_embedded_list_read/c/common.h index 2a05bf6..f47a18f 100644 --- a/level_3/fss_embedded_list_read/c/common.h +++ b/level_3/fss_embedded_list_read/c/common.h @@ -307,6 +307,8 @@ extern "C" { * - file_to: Using a specified destination file. * - help: Print help. * - header: Enable printing of headers. + * - print_first: When set, print new line to message output on program begin after loading settings. + * - print_last: When set, print new line to message output on program end. * - separate: Enable printing of separators. * - strip_invalid: Using strip invalid character mode. * - verify: Using verify mode. @@ -320,10 +322,12 @@ extern "C" { fss_embedded_list_read_main_flag_file_to_e = 0x4, fss_embedded_list_read_main_flag_header_e = 0x8, fss_embedded_list_read_main_flag_help_e = 0x10, - fss_embedded_list_read_main_flag_separate_e = 0x20, - fss_embedded_list_read_main_flag_strip_invalid_e = 0x40, - fss_embedded_list_read_main_flag_verify_e = 0x80, - fss_embedded_list_read_main_flag_version_e = 0x100, + fss_embedded_list_read_main_flag_print_first_e = 0x20, + fss_embedded_list_read_main_flag_print_last_e = 0x40, + fss_embedded_list_read_main_flag_separate_e = 0x80, + fss_embedded_list_read_main_flag_strip_invalid_e = 0x100, + fss_embedded_list_read_main_flag_verify_e = 0x200, + fss_embedded_list_read_main_flag_version_e = 0x400, }; // enum #endif // _di_fss_embedded_list_read_main_flag_e_ @@ -336,26 +340,18 @@ extern "C" { * flag: Flags passed to the main function. * * state: The state information. - * - * 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. */ #ifndef _di_fss_embedded_list_read_setting_t_ typedef struct { uint16_t flag; f_state_t state; - - f_string_static_t line_first; - f_string_static_t line_last; } fss_embedded_list_read_setting_t; #define fss_embedded_list_read_setting_t_initialize \ { \ fss_embedded_list_read_main_flag_none_e, \ f_state_t_initialize, \ - f_string_static_t_initialize, \ - f_string_static_t_initialize, \ } #endif // _di_fss_embedded_list_read_setting_t_ diff --git a/level_3/fss_embedded_list_read/c/fss_embedded_list_read.c b/level_3/fss_embedded_list_read/c/fss_embedded_list_read.c index 0b4fb0c..4859cf6 100644 --- a/level_3/fss_embedded_list_read/c/fss_embedded_list_read.c +++ b/level_3/fss_embedded_list_read/c/fss_embedded_list_read.c @@ -35,9 +35,11 @@ extern "C" { status = fll_program_parameter_process_context(choices, modes, F_true, main); if (F_status_is_error(status)) { - fss_embedded_list_read_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e); - fss_embedded_list_read_print_line_last_locked(setting, main->error); + + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error); + } return; } @@ -54,9 +56,11 @@ extern "C" { status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); if (F_status_is_error(status)) { - fss_embedded_list_read_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e); - fss_embedded_list_read_print_line_last_locked(setting, main->error); + + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error); + } return; } @@ -70,13 +74,13 @@ extern "C" { } if (main->parameters.array[fss_embedded_list_read_parameter_version_e].result & f_console_result_found_e) { - fll_program_print_version(main->message, (setting->line_first.used ? 0x1 : 0x0) | (setting->line_last.used ? 0x2 : 0x0), fss_embedded_list_read_program_version_s); + fll_program_print_version(main->message, fss_embedded_list_read_program_version_s); return F_none; } if (main->parameters.array[fss_embedded_list_read_parameter_copyright_e].result & f_console_result_found_e) { - fll_program_print_copyright(main->message, (setting->line_first.used ? 0x1 : 0x0) | (setting->line_last.used ? 0x2 : 0x0)); + fll_program_print_copyright(main->message); return F_none; } @@ -302,7 +306,7 @@ extern "C" { if (!((++main->signal_check) % fss_embedded_list_read_signal_check_d)) { if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); + fll_program_print_signal_received(main->warning, main->signal_received); status = F_status_set_error(F_interrupt); @@ -377,7 +381,7 @@ extern "C" { // The signal check is always performed on each pass. if (size_file > fss_embedded_list_read_block_max && fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); + fll_program_print_signal_received(main->warning, main->signal_received); status = F_status_set_error(F_interrupt); diff --git a/level_3/fss_embedded_list_read/c/print.c b/level_3/fss_embedded_list_read/c/print.c index d8d3f4d..9208db9 100644 --- a/level_3/fss_embedded_list_read/c/print.c +++ b/level_3/fss_embedded_list_read/c/print.c @@ -10,8 +10,6 @@ extern "C" { f_file_stream_lock(print.to); - f_print_dynamic_raw(setting->line_first, print.to); - fll_program_print_help_header(print, fss_embedded_list_read_program_name_long_s, fss_embedded_list_read_program_version_s); fll_program_print_help_option_standard(print); @@ -105,8 +103,6 @@ extern "C" { fl_print_format(" The word 'column' is being loosely defined to refer to a specific Content.%r", print.to, f_string_eol_s); fl_print_format(" This is not to be confused with a depth.%r", print.to, f_string_eol_s); - f_print_dynamic_raw(setting->line_last, print.to); - f_file_stream_flush(print.to); f_file_stream_unlock(print.to); @@ -114,66 +110,6 @@ extern "C" { } #endif // _di_fss_embedded_list_read_print_help_ -#ifndef _di_fss_embedded_list_read_print_line_first_locked_ - f_status_t fss_embedded_list_read_print_line_first_locked(fss_embedded_list_read_setting_t * const setting, const fl_print_t print) { - - if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; - - if (F_status_is_error_not(setting->state.status)) { - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - } - - f_print_dynamic_raw(setting->line_first, print.to); - - return F_none; - } -#endif // _di_fss_embedded_list_read_print_line_first_locked_ - -#ifndef _di_fss_embedded_list_read_print_line_first_unlocked_ - f_status_t fss_embedded_list_read_print_line_first_unlocked(fss_embedded_list_read_setting_t * const setting, const fl_print_t print) { - - if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; - - if (F_status_is_error_not(setting->state.status)) { - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - } - - fll_print_dynamic_raw(setting->line_first, print.to); - - return F_none; - } -#endif // _di_fss_embedded_list_read_print_line_first_unlocked_ - -#ifndef _di_fss_embedded_list_read_print_line_last_locked_ - f_status_t fss_embedded_list_read_print_line_last_locked(fss_embedded_list_read_setting_t * const setting, const fl_print_t print) { - - if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; - - if (F_status_is_error_not(setting->state.status)) { - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - } - - fll_print_dynamic_raw(setting->line_last, print.to); - - return F_none; - } -#endif // _di_fss_embedded_list_read_print_line_last_locked_ - -#ifndef _di_fss_embedded_list_read_print_line_last_unlocked_ - f_status_t fss_embedded_list_read_print_line_last_unlocked(fss_embedded_list_read_setting_t * const setting, const fl_print_t print) { - - if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; - - if (F_status_is_error_not(setting->state.status)) { - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - } - - f_print_dynamic_raw(setting->line_last, print.to); - - return F_none; - } -#endif // _di_fss_embedded_list_read_print_line_last_unlocked_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/fss_embedded_list_read/c/print.h b/level_3/fss_embedded_list_read/c/print.h index 88280b5..cd3d102 100644 --- a/level_3/fss_embedded_list_read/c/print.h +++ b/level_3/fss_embedded_list_read/c/print.h @@ -29,94 +29,6 @@ extern "C" { extern f_status_t fss_embedded_list_read_print_help(fss_embedded_list_read_setting_t * const setting, const fl_print_t print); #endif // _di_fss_embedded_list_read_print_help_ -/** - * Print first new line, unless verbosity says otherwise. - * - * This is generally either the first line in the program or the first line printed before an error message. - * - * This function locks and then unlocks the input stream when printing. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fss_embedded_list_read_print_line_first_locked_ - extern f_status_t fss_embedded_list_read_print_line_first_locked(fss_embedded_list_read_setting_t * const setting, const fl_print_t print); -#endif // _di_fss_embedded_list_read_print_line_first_locked_ - -/** - * Print first new line, unless verbosity says otherwise. - * - * This is generally either the first line in the program or the first line printed before an error message. - * - * This function neither locks nor unlocks the input stream. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fss_embedded_list_read_print_line_first_unlocked_ - extern f_status_t fss_embedded_list_read_print_line_first_unlocked(fss_embedded_list_read_setting_t * const setting, const fl_print_t print); -#endif // _di_fss_embedded_list_read_print_line_first_unlocked_ - -/** - * Print last new line when the main is complete, unless verbosity says otherwise. - * - * This is generally the very last line printed in the program. - * - * This function locks and then unlocks the input stream when printing. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fss_embedded_list_read_print_line_last_locked_ - extern f_status_t fss_embedded_list_read_print_line_last_locked(fss_embedded_list_read_setting_t * const setting, const fl_print_t print); -#endif // _di_fss_embedded_list_read_print_line_last_locked_ - -/** - * Print last new line when the main is complete, unless verbosity says otherwise. - * - * This is generally the very last line printed in the program. - * - * This function neither locks nor unlocks the input stream. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fss_embedded_list_read_print_line_last_unlocked_ - extern f_status_t fss_embedded_list_read_print_line_last_unlocked(fss_embedded_list_read_setting_t * const setting, const fl_print_t print); -#endif // _di_fss_embedded_list_read_print_line_last_unlocked_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/fss_embedded_list_read/c/private-read.c b/level_3/fss_embedded_list_read/c/private-read.c index 922c602..db269db 100644 --- a/level_3/fss_embedded_list_read/c/private-read.c +++ b/level_3/fss_embedded_list_read/c/private-read.c @@ -131,7 +131,7 @@ extern "C" { if (!((++data->main->signal_check) % fss_embedded_list_read_signal_check_d)) { if (fll_program_standard_signal_received(data->main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); + fll_program_print_signal_received(main->warning, main->signal_received); return F_status_set_error(F_interrupt); } @@ -556,7 +556,7 @@ extern "C" { if (!((++data->main->signal_check) % fss_embedded_list_read_signal_check_d)) { if (fll_program_standard_signal_received(data->main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); + fll_program_print_signal_received(main->warning, main->signal_received); return F_status_set_error(F_interrupt); } diff --git a/level_3/fss_extended_list_read/c/common.c b/level_3/fss_extended_list_read/c/common.c index d381418..edaff1b 100644 --- a/level_3/fss_extended_list_read/c/common.c +++ b/level_3/fss_extended_list_read/c/common.c @@ -87,10 +87,27 @@ extern "C" { setting->state.step_small = fss_extended_list_read_allocation_small_d; + // Identify and pocess first/last parameters. + if (main->parameters.array[fss_extended_list_read_parameter_line_first_no_e].result & f_console_result_found_e) { + setting->flag -= setting->flag & fss_extended_list_read_main_flag_print_first_e; + } + else { + setting->flag |= fss_extended_list_read_main_flag_print_first_e; + } + + if (main->parameters.array[fss_extended_list_read_parameter_line_last_no_e].result & f_console_result_found_e) { + setting->flag -= setting->flag & fss_extended_list_read_main_flag_print_last_e; + } + else { + setting->flag |= fss_extended_list_read_main_flag_print_last_e; + } + if (F_status_is_error(setting->state.status)) { - fss_extended_list_read_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->state.status), "f_console_parameter_process", fll_error_file_flag_fallback_e); - fss_extended_list_read_print_line_last_locked(setting, main->error); + + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error); + } return; } @@ -110,28 +127,16 @@ extern "C" { setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, main); if (F_status_is_error(setting->state.status)) { - fss_extended_list_read_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e); - fss_extended_list_read_print_line_last_locked(setting, main->error); + + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error); + } return; } } - if (main->parameters.array[fss_extended_list_read_parameter_line_first_no_e].result & f_console_result_found_e) { - setting->line_first = f_string_empty_s; - } - else { - setting->line_first = f_string_eol_s; - } - - if (main->parameters.array[fss_extended_list_read_parameter_line_last_no_e].result & f_console_result_found_e) { - setting->line_last = f_string_empty_s; - } - else { - setting->line_last = f_string_eol_s; - } - // Identify and prioritize "verbosity" parameters. { uint16_t choices_array[5] = { fss_extended_list_read_parameter_verbosity_quiet_e, fss_extended_list_read_parameter_verbosity_error_e, fss_extended_list_read_parameter_verbosity_verbose_e, fss_extended_list_read_parameter_verbosity_debug_e, fss_extended_list_read_parameter_verbosity_normal_e }; @@ -143,9 +148,11 @@ extern "C" { setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); if (F_status_is_error(setting->state.status)) { - fss_extended_list_read_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e); - fss_extended_list_read_print_line_last_locked(setting, main->error); + + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error); + } return; } diff --git a/level_3/fss_extended_list_read/c/common.h b/level_3/fss_extended_list_read/c/common.h index 92a2a5c..223692b 100644 --- a/level_3/fss_extended_list_read/c/common.h +++ b/level_3/fss_extended_list_read/c/common.h @@ -324,6 +324,8 @@ extern "C" { * - file_to: Using a specified destination file. * - help: Print help. * - header: Enable printing of headers. + * - print_first: When set, print new line to message output on program begin after loading settings. + * - print_last: When set, print new line to message output on program end. * - separate: Enable printing of separators. * - strip_invalid: Using strip invalid character mode. * - verify: Using verify mode. @@ -337,10 +339,12 @@ extern "C" { fss_extended_list_read_main_flag_file_to_e = 0x4, fss_extended_list_read_main_flag_header_e = 0x8, fss_extended_list_read_main_flag_help_e = 0x10, - fss_extended_list_read_main_flag_separate_e = 0x20, - fss_extended_list_read_main_flag_strip_invalid_e = 0x40, - fss_extended_list_read_main_flag_verify_e = 0x80, - fss_extended_list_read_main_flag_version_e = 0x100, + fss_extended_list_read_main_flag_print_first_e = 0x20, + fss_extended_list_read_main_flag_print_last_e = 0x40, + fss_extended_list_read_main_flag_separate_e = 0x80, + fss_extended_list_read_main_flag_strip_invalid_e = 0x100, + fss_extended_list_read_main_flag_verify_e = 0x200, + fss_extended_list_read_main_flag_version_e = 0x400, }; // enum #endif // _di_fss_extended_list_read_main_flag_e_ @@ -353,26 +357,18 @@ extern "C" { * flag: Flags passed to the main function. * * state: The state information. - * - * 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. */ #ifndef _di_fss_extended_list_read_setting_t_ typedef struct { uint16_t flag; f_state_t state; - - f_string_static_t line_first; - f_string_static_t line_last; } fss_extended_list_read_setting_t; #define fss_extended_list_read_setting_t_initialize \ { \ fss_extended_list_read_main_flag_none_e, \ f_state_t_initialize, \ - f_string_static_t_initialize, \ - f_string_static_t_initialize, \ } #endif // _di_fss_extended_list_read_setting_t_ diff --git a/level_3/fss_extended_list_read/c/fss_extended_list_read.c b/level_3/fss_extended_list_read/c/fss_extended_list_read.c index 0360b15..17cd6f7 100644 --- a/level_3/fss_extended_list_read/c/fss_extended_list_read.c +++ b/level_3/fss_extended_list_read/c/fss_extended_list_read.c @@ -35,9 +35,11 @@ extern "C" { status = fll_program_parameter_process_context(choices, modes, F_true, main); if (F_status_is_error(status)) { - fss_extended_list_read_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e); - fss_extended_list_read_print_line_last_locked(setting, main->error); + + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error); + } return; } @@ -54,9 +56,11 @@ extern "C" { status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); if (F_status_is_error(status)) { - fss_extended_list_read_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e); - fss_extended_list_read_print_line_last_locked(setting, main->error); + + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error); + } return; } @@ -70,13 +74,13 @@ extern "C" { } if (main->parameters.array[fss_extended_list_read_parameter_version_e].result & f_console_result_found_e) { - fll_program_print_version(main->message, (setting->line_first.used ? 0x1 : 0x0) | (setting->line_last.used ? 0x2 : 0x0), fss_extended_list_read_program_version_s); + fll_program_print_version(main->message, fss_extended_list_read_program_version_s); return status; } if (main->parameters.array[fss_extended_list_read_parameter_copyright_e].result & f_console_result_found_e) { - fll_program_print_copyright(main->message, (setting->line_first.used ? 0x1 : 0x0) | (setting->line_last.used ? 0x2 : 0x0)); + fll_program_print_copyright(main->message); return status; } @@ -213,7 +217,7 @@ extern "C" { if (!((++main->signal_check) % fss_extended_list_read_signal_check_d)) { if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); + fll_program_print_signal_received(main->warning, main->signal_received); status = F_status_set_error(F_interrupt); @@ -418,7 +422,7 @@ extern "C" { if (!((++main->signal_check) % fss_extended_list_read_signal_check_d)) { if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); + fll_program_print_signal_received(main->warning, main->signal_received); status = F_status_set_error(F_interrupt); @@ -484,7 +488,7 @@ extern "C" { // The signal check is always performed on each pass. if (size_file > fss_extended_list_read_block_max && fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); + fll_program_print_signal_received(main->warning, main->signal_received); status = F_status_set_error(F_interrupt); diff --git a/level_3/fss_extended_list_read/c/print.c b/level_3/fss_extended_list_read/c/print.c index 4e0f81c..6445e27 100644 --- a/level_3/fss_extended_list_read/c/print.c +++ b/level_3/fss_extended_list_read/c/print.c @@ -10,8 +10,6 @@ extern "C" { f_file_stream_lock(print.to); - f_print_dynamic_raw(setting->line_first, print.to); - fll_program_print_help_header(print, fss_extended_list_read_program_name_long_s, fss_extended_list_read_program_version_s); fll_program_print_help_option_standard(print); @@ -106,8 +104,6 @@ extern "C" { fl_print_format(" The word 'column' is being loosely defined to refer to a specific Content.%r", print.to, f_string_eol_s); fl_print_format(" This is not to be confused with a depth.%r", print.to, f_string_eol_s); - f_print_dynamic_raw(setting->line_last, print.to); - f_file_stream_flush(print.to); f_file_stream_unlock(print.to); @@ -115,68 +111,6 @@ extern "C" { } #endif // _di_fss_extended_list_read_print_help_ -#ifndef _di_fss_extended_list_read_print_line_first_locked_ - f_status_t fss_extended_list_read_print_line_first_locked(fss_extended_list_read_setting_t * const setting, const fl_print_t print) { - - if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; - - if (F_status_is_error_not(setting->state.status)) { - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - } - - f_print_dynamic_raw(setting->line_first, print.to); - - return F_none; - } -#endif // _di_fss_extended_list_read_print_line_first_locked_ - -#ifndef _di_fss_extended_list_read_print_line_first_unlocked_ - f_status_t fss_extended_list_read_print_line_first_unlocked(fss_extended_list_read_setting_t * const setting, const fl_print_t print) { - - if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; - - if (F_status_is_error_not(setting->state.status)) { - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - } - - fll_print_dynamic_raw(setting->line_first, print.to); - - return F_none; - } -#endif // _di_fss_extended_list_read_print_line_first_unlocked_ - -#ifndef _di_fss_extended_list_read_print_line_last_locked_ - f_status_t fss_extended_list_read_print_line_last_locked(fss_extended_list_read_setting_t * const setting, const fl_print_t print) { - - if (!setting || print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - - if (!F_status_is_error(setting->state.status)) { - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; - if (setting->flag & (fss_extended_list_read_main_flag_verify_e | fss_extended_list_read_main_flag_file_to_e)) return F_output_not; - } - - fll_print_dynamic_raw(setting->line_last, print.to); - - return F_none; - } -#endif // _di_fss_extended_list_read_print_line_last_locked_ - -#ifndef _di_fss_extended_list_read_print_line_last_unlocked_ - f_status_t fss_extended_list_read_print_line_last_unlocked(fss_extended_list_read_setting_t * const setting, const fl_print_t print) { - - if (!setting || print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - - if (!F_status_is_error(setting->state.status)) { - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; - if (setting->flag & (fss_extended_list_read_main_flag_verify_e | fss_extended_list_read_main_flag_file_to_e)) return F_output_not; - } - - f_print_dynamic_raw(setting->line_last, print.to); - - return F_none; - } -#endif // _di_fss_extended_list_read_print_line_last_unlocked_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/fss_extended_list_read/c/print.h b/level_3/fss_extended_list_read/c/print.h index 3fdc8a5..69d157e 100644 --- a/level_3/fss_extended_list_read/c/print.h +++ b/level_3/fss_extended_list_read/c/print.h @@ -29,94 +29,6 @@ extern "C" { extern f_status_t fss_extended_list_read_print_help(fss_extended_list_read_setting_t * const setting, const fl_print_t print); #endif // _di_fss_extended_list_read_print_help_ -/** - * Print first new line, unless verbosity says otherwise. - * - * This is generally either the first line in the program or the first line printed before an error message. - * - * This function locks and then unlocks the input stream when printing. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fss_extended_list_read_print_line_first_locked_ - extern f_status_t fss_extended_list_read_print_line_first_locked(fss_extended_list_read_setting_t * const setting, const fl_print_t print); -#endif // _di_fss_extended_list_read_print_line_first_locked_ - -/** - * Print first new line, unless verbosity says otherwise. - * - * This is generally either the first line in the program or the first line printed before an error message. - * - * This function neither locks nor unlocks the input stream. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fss_extended_list_read_print_line_first_unlocked_ - extern f_status_t fss_extended_list_read_print_line_first_unlocked(fss_extended_list_read_setting_t * const setting, const fl_print_t print); -#endif // _di_fss_extended_list_read_print_line_first_unlocked_ - -/** - * Print last new line when the main is complete, unless verbosity says otherwise. - * - * This is generally the very last line printed in the program. - * - * This function locks and then unlocks the input stream when printing. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fss_extended_list_read_print_line_last_locked_ - extern f_status_t fss_extended_list_read_print_line_last_locked(fss_extended_list_read_setting_t * const setting, const fl_print_t print); -#endif // _di_fss_extended_list_read_print_line_last_locked_ - -/** - * Print last new line when the main is complete, unless verbosity says otherwise. - * - * This is generally the very last line printed in the program. - * - * This function neither locks nor unlocks the input stream. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fss_extended_list_read_print_line_last_unlocked_ - extern f_status_t fss_extended_list_read_print_line_last_unlocked(fss_extended_list_read_setting_t * const setting, const fl_print_t print); -#endif // _di_fss_extended_list_read_print_line_last_unlocked_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/fss_extended_list_read/c/private-read.c b/level_3/fss_extended_list_read/c/private-read.c index 50c7184..c724fec 100644 --- a/level_3/fss_extended_list_read/c/private-read.c +++ b/level_3/fss_extended_list_read/c/private-read.c @@ -88,7 +88,7 @@ extern "C" { if (!((++main->signal_check) % fss_extended_list_read_signal_check_d)) { if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); + fll_program_print_signal_received(main->warning, main->signal_received); return F_status_set_error(F_interrupt); } @@ -176,7 +176,7 @@ extern "C" { if (!((++main->signal_check) % fss_extended_list_read_signal_check_d)) { if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); + fll_program_print_signal_received(main->warning, main->signal_received); return F_status_set_error(F_interrupt); } diff --git a/level_3/fss_extended_read/c/common.c b/level_3/fss_extended_read/c/common.c index eb9e466..46ec910 100644 --- a/level_3/fss_extended_read/c/common.c +++ b/level_3/fss_extended_read/c/common.c @@ -80,10 +80,27 @@ extern "C" { setting->state.step_small = fss_extended_read_allocation_small_d; + // Identify and pocess first/last parameters. + if (main->parameters.array[fss_extended_read_parameter_line_first_no_e].result & f_console_result_found_e) { + setting->flag -= setting->flag & fss_extended_read_main_flag_print_first_e; + } + else { + setting->flag |= fss_extended_read_main_flag_print_first_e; + } + + if (main->parameters.array[fss_extended_read_parameter_line_last_no_e].result & f_console_result_found_e) { + setting->flag -= setting->flag & fss_extended_read_main_flag_print_last_e; + } + else { + setting->flag |= fss_extended_read_main_flag_print_last_e; + } + if (F_status_is_error(setting->state.status)) { - fss_extended_read_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->state.status), "f_console_parameter_process", fll_error_file_flag_fallback_e); - fss_extended_read_print_line_last_locked(setting, main->error); + + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error); + } return; } @@ -103,28 +120,16 @@ extern "C" { setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, main); if (F_status_is_error(setting->state.status)) { - fss_extended_read_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e); - fss_extended_read_print_line_last_locked(setting, main->error); + + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error); + } return; } } - if (main->parameters.array[fss_extended_read_parameter_line_first_no_e].result & f_console_result_found_e) { - setting->line_first = f_string_empty_s; - } - else { - setting->line_first = f_string_eol_s; - } - - if (main->parameters.array[fss_extended_read_parameter_line_last_no_e].result & f_console_result_found_e) { - setting->line_last = f_string_empty_s; - } - else { - setting->line_last = f_string_eol_s; - } - // Identify and prioritize "verbosity" parameters. { uint16_t choices_array[5] = { fss_extended_read_parameter_verbosity_quiet_e, fss_extended_read_parameter_verbosity_error_e, fss_extended_read_parameter_verbosity_verbose_e, fss_extended_read_parameter_verbosity_debug_e, fss_extended_read_parameter_verbosity_normal_e }; @@ -136,9 +141,11 @@ extern "C" { setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); if (F_status_is_error(setting->state.status)) { - fss_extended_read_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e); - fss_extended_read_print_line_last_locked(setting, main->error); + + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error); + } return; } diff --git a/level_3/fss_extended_read/c/common.h b/level_3/fss_extended_read/c/common.h index 23becfa..8ed3cfd 100644 --- a/level_3/fss_extended_read/c/common.h +++ b/level_3/fss_extended_read/c/common.h @@ -323,6 +323,8 @@ extern "C" { * - file_to: Using a specified destination file. * - help: Print help. * - header: Enable printing of headers. + * - print_first: When set, print new line to message output on program begin after loading settings. + * - print_last: When set, print new line to message output on program end. * - separate: Enable printing of separators. * - strip_invalid: Using strip invalid character mode. * - verify: Using verify mode. @@ -336,10 +338,12 @@ extern "C" { fss_extended_read_main_flag_file_to_e = 0x4, fss_extended_read_main_flag_header_e = 0x8, fss_extended_read_main_flag_help_e = 0x10, - fss_extended_read_main_flag_separate_e = 0x20, - fss_extended_read_main_flag_strip_invalid_e = 0x40, - fss_extended_read_main_flag_verify_e = 0x80, - fss_extended_read_main_flag_version_e = 0x100, + fss_extended_read_main_flag_print_first_e = 0x20, + fss_extended_read_main_flag_print_last_e = 0x40, + fss_extended_read_main_flag_separate_e = 0x80, + fss_extended_read_main_flag_strip_invalid_e = 0x100, + fss_extended_read_main_flag_verify_e = 0x200, + fss_extended_read_main_flag_version_e = 0x400, }; // enum #endif // _di_fss_extended_read_main_flag_e_ @@ -352,26 +356,18 @@ extern "C" { * flag: Flags passed to the main function. * * state: The state information. - * - * 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. */ #ifndef _di_fss_extended_read_setting_t_ typedef struct { uint16_t flag; f_state_t state; - - f_string_static_t line_first; - f_string_static_t line_last; } fss_extended_read_setting_t; #define fss_extended_read_setting_t_initialize \ { \ fss_extended_read_main_flag_none_e, \ f_state_t_initialize, \ - f_string_static_t_initialize, \ - f_string_static_t_initialize, \ } #endif // _di_fss_extended_read_setting_t_ diff --git a/level_3/fss_extended_read/c/fss_extended_read.c b/level_3/fss_extended_read/c/fss_extended_read.c index 65a4d24..6980f66 100644 --- a/level_3/fss_extended_read/c/fss_extended_read.c +++ b/level_3/fss_extended_read/c/fss_extended_read.c @@ -35,9 +35,11 @@ extern "C" { status = fll_program_parameter_process_context(choices, modes, F_true, main); if (F_status_is_error(status)) { - fss_extended_read_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e); - fss_extended_read_print_line_last_locked(setting, main->error); + + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error); + } return; } @@ -54,9 +56,11 @@ extern "C" { status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); if (F_status_is_error(status)) { - fss_extended_read_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e); - fss_extended_read_print_line_last_locked(setting, main->error); + + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error); + } return; } @@ -70,13 +74,13 @@ extern "C" { } if (main->parameters.array[fss_extended_read_parameter_version_e].result & f_console_result_found_e) { - fll_program_print_version(main->message, (setting->line_first.used ? 0x1 : 0x0) | (setting->line_last.used ? 0x2 : 0x0), fss_extended_read_program_version_s); + fll_program_print_version(main->message, fss_extended_read_program_version_s); return status; } if (main->parameters.array[fss_extended_read_parameter_copyright_e].result & f_console_result_found_e) { - fll_program_print_copyright(main->message, (setting->line_first.used ? 0x1 : 0x0) | (setting->line_last.used ? 0x2 : 0x0)); + fll_program_print_copyright(main->message); return status; } @@ -212,7 +216,7 @@ extern "C" { if (!((++main->signal_check) % fss_extended_read_signal_check_d)) { if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); + fll_program_print_signal_received(main->warning, main->signal_received); status = F_status_set_error(F_signal); @@ -417,7 +421,7 @@ extern "C" { if (!((++main->signal_check) % fss_extended_read_signal_check_d)) { if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); + fll_program_print_signal_received(main->warning, main->signal_received); status = F_status_set_error(F_signal); @@ -483,7 +487,7 @@ extern "C" { // The signal check is always performed on each pass. if (size_file > fss_extended_read_block_max && fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); + fll_program_print_signal_received(main->warning, main->signal_received); status = F_status_set_error(F_interrupt); diff --git a/level_3/fss_extended_read/c/print.c b/level_3/fss_extended_read/c/print.c index 3e2b971..dc3aa2f 100644 --- a/level_3/fss_extended_read/c/print.c +++ b/level_3/fss_extended_read/c/print.c @@ -10,8 +10,6 @@ extern "C" { f_file_stream_lock(print.to); - f_print_dynamic_raw(setting->line_first, print.to); - fll_program_print_help_header(print, fss_extended_read_program_name_long_s, fss_extended_read_program_version_s); fll_program_print_help_option_standard(print); @@ -106,8 +104,6 @@ extern "C" { fl_print_format(" The word 'column' is being loosely defined to refer to a specific Content.%r", print.to, f_string_eol_s); fl_print_format(" This is not to be confused with a depth.%r", print.to, f_string_eol_s); - f_print_dynamic_raw(setting->line_last, print.to); - f_file_stream_flush(print.to); f_file_stream_unlock(print.to); @@ -115,68 +111,6 @@ extern "C" { } #endif // _di_fss_extended_read_print_help_ -#ifndef _di_fss_extended_read_print_line_first_locked_ - f_status_t fss_extended_read_print_line_first_locked(fss_extended_read_setting_t * const setting, const fl_print_t print) { - - if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; - - if (F_status_is_error_not(setting->state.status)) { - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - } - - f_print_dynamic_raw(setting->line_first, print.to); - - return F_none; - } -#endif // _di_fss_extended_read_print_line_first_locked_ - -#ifndef _di_fss_extended_read_print_line_first_unlocked_ - f_status_t fss_extended_read_print_line_first_unlocked(fss_extended_read_setting_t * const setting, const fl_print_t print) { - - if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; - - if (F_status_is_error_not(setting->state.status)) { - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - } - - fll_print_dynamic_raw(setting->line_first, print.to); - - return F_none; - } -#endif // _di_fss_extended_read_print_line_first_unlocked_ - -#ifndef _di_fss_extended_read_print_line_last_locked_ - f_status_t fss_extended_read_print_line_last_locked(fss_extended_read_setting_t * const setting, const fl_print_t print) { - - if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; - - if (F_status_is_error_not(setting->state.status)) { - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - if (setting->flag & (fss_extended_read_main_flag_verify_e | fss_extended_read_main_flag_file_to_e)) return F_output_not; - } - - fll_print_dynamic_raw(setting->line_last, print.to); - - return F_none; - } -#endif // _di_fss_extended_read_print_line_last_locked_ - -#ifndef _di_fss_extended_read_print_line_last_unlocked_ - f_status_t fss_extended_read_print_line_last_unlocked(fss_extended_read_setting_t * const setting, const fl_print_t print) { - - if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; - - if (F_status_is_error_not(setting->state.status)) { - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - if (setting->flag & (fss_extended_read_main_flag_verify_e | fss_extended_read_main_flag_file_to_e)) return F_output_not; - } - - f_print_dynamic_raw(setting->line_last, print.to); - - return F_none; - } -#endif // _di_fss_extended_read_print_line_last_unlocked_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/fss_extended_read/c/print.h b/level_3/fss_extended_read/c/print.h index e633228..9309eb6 100644 --- a/level_3/fss_extended_read/c/print.h +++ b/level_3/fss_extended_read/c/print.h @@ -29,94 +29,6 @@ extern "C" { extern f_status_t fss_extended_read_print_help(fss_extended_read_setting_t * const setting, const fl_print_t print); #endif // _di_fss_extended_read_print_help_ -/** - * Print first new line, unless verbosity says otherwise. - * - * This is generally either the first line in the program or the first line printed before an error message. - * - * This function locks and then unlocks the input stream when printing. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fss_extended_read_print_line_first_locked_ - extern f_status_t fss_extended_read_print_line_first_locked(fss_extended_read_setting_t * const setting, const fl_print_t print); -#endif // _di_fss_extended_read_print_line_first_locked_ - -/** - * Print first new line, unless verbosity says otherwise. - * - * This is generally either the first line in the program or the first line printed before an error message. - * - * This function neither locks nor unlocks the input stream. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fss_extended_read_print_line_first_unlocked_ - extern f_status_t fss_extended_read_print_line_first_unlocked(fss_extended_read_setting_t * const setting, const fl_print_t print); -#endif // _di_fss_extended_read_print_line_first_unlocked_ - -/** - * Print last new line when the main is complete, unless verbosity says otherwise. - * - * This is generally the very last line printed in the program. - * - * This function locks and then unlocks the input stream when printing. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fss_extended_read_print_line_last_locked_ - extern f_status_t fss_extended_read_print_line_last_locked(fss_extended_read_setting_t * const setting, const fl_print_t print); -#endif // _di_fss_extended_read_print_line_last_locked_ - -/** - * Print last new line when the main is complete, unless verbosity says otherwise. - * - * This is generally the very last line printed in the program. - * - * This function neither locks nor unlocks the input stream. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fss_extended_read_print_line_last_unlocked_ - extern f_status_t fss_extended_read_print_line_last_unlocked(fss_extended_read_setting_t * const setting, const fl_print_t print); -#endif // _di_fss_extended_read_print_line_last_unlocked_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/fss_extended_read/c/private-read.c b/level_3/fss_extended_read/c/private-read.c index 557bf74..f1e2ed8 100644 --- a/level_3/fss_extended_read/c/private-read.c +++ b/level_3/fss_extended_read/c/private-read.c @@ -92,7 +92,7 @@ extern "C" { if (!((++main->signal_check) % fss_extended_read_signal_check_d)) { if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); + fll_program_print_signal_received(main->warning, main->signal_received); return F_status_set_error(F_interrupt); } @@ -180,7 +180,7 @@ extern "C" { if (!((++main->signal_check) % fss_extended_read_signal_check_d)) { if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); + fll_program_print_signal_received(main->warning, main->signal_received); return F_status_set_error(F_interrupt); } diff --git a/level_3/fss_identify/c/common.c b/level_3/fss_identify/c/common.c index b4a66b5..2924e4c 100644 --- a/level_3/fss_identify/c/common.c +++ b/level_3/fss_identify/c/common.c @@ -47,10 +47,27 @@ extern "C" { setting->state.step_small = fss_identify_allocation_small_d; + // Identify and pocess first/last parameters. + if (main->parameters.array[fss_identify_parameter_line_first_no_e].result & f_console_result_found_e) { + setting->flag -= setting->flag & fss_identify_main_flag_print_first_e; + } + else { + setting->flag |= fss_identify_main_flag_print_first_e; + } + + if (main->parameters.array[fss_identify_parameter_line_last_no_e].result & f_console_result_found_e) { + setting->flag -= setting->flag & fss_identify_main_flag_print_last_e; + } + else { + setting->flag |= fss_identify_main_flag_print_last_e; + } + if (F_status_is_error(setting->state.status)) { - fss_identify_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->state.status), "f_console_parameter_process", fll_error_file_flag_fallback_e); - fss_identify_print_line_last_locked(setting, main->error); + + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error); + } return; } @@ -70,28 +87,16 @@ extern "C" { setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, main); if (F_status_is_error(setting->state.status)) { - fss_identify_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e); - fss_identify_print_line_last_locked(setting, main->error); + + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error); + } return; } } - if (main->parameters.array[fss_identify_parameter_line_first_no_e].result & f_console_result_found_e) { - setting->line_first = f_string_empty_s; - } - else { - setting->line_first = f_string_eol_s; - } - - if (main->parameters.array[fss_identify_parameter_line_last_no_e].result & f_console_result_found_e) { - setting->line_last = f_string_empty_s; - } - else { - setting->line_last = f_string_eol_s; - } - // Identify and prioritize "verbosity" parameters. { uint16_t choices_array[5] = { fss_identify_parameter_verbosity_quiet_e, fss_identify_parameter_verbosity_error_e, fss_identify_parameter_verbosity_verbose_e, fss_identify_parameter_verbosity_debug_e, fss_identify_parameter_verbosity_normal_e }; @@ -103,9 +108,11 @@ extern "C" { setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); if (F_status_is_error(setting->state.status)) { - fss_identify_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e); - fss_identify_print_line_last_locked(setting, main->error); + + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error); + } return; } diff --git a/level_3/fss_identify/c/common.h b/level_3/fss_identify/c/common.h index b2db552..27e5bc4 100644 --- a/level_3/fss_identify/c/common.h +++ b/level_3/fss_identify/c/common.h @@ -173,6 +173,8 @@ extern "C" { * - file_to: Using a specified destination file. * - help: Print help. * - header: Enable printing of headers. + * - print_first: When set, print new line to message output on program begin after loading settings. + * - print_last: When set, print new line to message output on program end. * - separate: Enable printing of separators. * - strip_invalid: Using strip invalid character mode. * - verify: Using verify mode. @@ -186,10 +188,12 @@ extern "C" { fss_identify_main_flag_file_to_e = 0x4, fss_identify_main_flag_header_e = 0x8, fss_identify_main_flag_help_e = 0x10, - fss_identify_main_flag_separate_e = 0x20, - fss_identify_main_flag_strip_invalid_e = 0x40, - fss_identify_main_flag_verify_e = 0x80, - fss_identify_main_flag_version_e = 0x100, + fss_identify_main_flag_print_first_e = 0x20, + fss_identify_main_flag_print_last_e = 0x40, + fss_identify_main_flag_separate_e = 0x80, + fss_identify_main_flag_strip_invalid_e = 0x100, + fss_identify_main_flag_verify_e = 0x200, + fss_identify_main_flag_version_e = 0x400, }; // enum #endif // _di_fss_identify_main_flag_e_ @@ -202,26 +206,18 @@ extern "C" { * flag: Flags passed to the main function. * * state: The state information. - * - * 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. */ #ifndef _di_fss_identify_setting_t_ typedef struct { uint16_t flag; f_state_t state; - - f_string_static_t line_first; - f_string_static_t line_last; } fss_identify_setting_t; #define fss_identify_setting_t_initialize \ { \ fss_identify_main_flag_none_e, \ f_state_t_initialize, \ - f_string_static_t_initialize, \ - f_string_static_t_initialize, \ } #endif // _di_fss_identify_setting_t_ diff --git a/level_3/fss_identify/c/fss_identify.c b/level_3/fss_identify/c/fss_identify.c index c731f7e..3e834d8 100644 --- a/level_3/fss_identify/c/fss_identify.c +++ b/level_3/fss_identify/c/fss_identify.c @@ -34,9 +34,11 @@ extern "C" { status = fll_program_parameter_process_context(choices, modes, F_true, main); if (F_status_is_error(status)) { - fss_identify_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e); - fss_identify_print_line_last_locked(setting, main->error); + + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error); + } return; } @@ -53,9 +55,11 @@ extern "C" { status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); if (F_status_is_error(status)) { - fss_identify_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e); - fss_identify_print_line_last_locked(setting, main->error); + + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error); + } return; } @@ -69,13 +73,13 @@ extern "C" { } if (main->parameters.array[fss_identify_parameter_version_e].result & f_console_result_found_e) { - fll_program_print_version(main->message, (setting->line_first.used ? 0x1 : 0x0) | (setting->line_last.used ? 0x2 : 0x0), fss_identify_program_version_s); + fll_program_print_version(main->message, fss_identify_program_version_s); return F_none; } if (main->parameters.array[fss_identify_parameter_copyright_e].result & f_console_result_found_e) { - fll_program_print_copyright(main->message, (setting->line_first.used ? 0x1 : 0x0) | (setting->line_last.used ? 0x2 : 0x0)); + fll_program_print_copyright(main->message); return F_none; } @@ -216,7 +220,7 @@ extern "C" { if (!((++main->signal_check) % fss_identify_signal_check_d)) { if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); + fll_program_print_signal_received(main->warning, main->signal_received); status = F_status_set_error(F_interrupt); diff --git a/level_3/fss_identify/c/print.c b/level_3/fss_identify/c/print.c index f98abc1..993a886 100644 --- a/level_3/fss_identify/c/print.c +++ b/level_3/fss_identify/c/print.c @@ -10,8 +10,6 @@ extern "C" { f_file_stream_lock(print.to); - f_print_dynamic_raw(setting->line_first, print.to); - fll_program_print_help_header(print, fss_identify_program_name_long_s, fss_identify_program_version_s); fll_program_print_help_option_standard(print); @@ -47,8 +45,6 @@ extern "C" { fl_print_format(" Whitespace must follow this pound character.%r", print.to, f_string_eol_s); fl_print_format(" There may be multiple Object and Content pairs, separated by white space, such as: '# fss-0002 fss-0000 iki-0002'.%r", print.to, f_string_eol_s); - f_print_dynamic_raw(setting->line_last, print.to); - f_file_stream_flush(print.to); f_file_stream_unlock(print.to); @@ -56,68 +52,6 @@ extern "C" { } #endif // _di_fss_identify_print_help_ -#ifndef _di_fss_identify_print_line_first_locked_ - f_status_t fss_identify_print_line_first_locked(fss_identify_setting_t * const setting, const fl_print_t print) { - - if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; - - if (F_status_is_error_not(setting->state.status)) { - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - } - - f_print_dynamic_raw(setting->line_first, print.to); - - return F_none; - } -#endif // _di_fss_identify_print_line_first_locked_ - -#ifndef _di_fss_identify_print_line_first_unlocked_ - f_status_t fss_identify_print_line_first_unlocked(fss_identify_setting_t * const setting, const fl_print_t print) { - - if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; - - if (F_status_is_error_not(setting->state.status)) { - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - } - - fll_print_dynamic_raw(setting->line_first, print.to); - - return F_none; - } -#endif // _di_fss_identify_print_line_first_unlocked_ - -#ifndef _di_fss_identify_print_line_last_locked_ - f_status_t fss_identify_print_line_last_locked(fss_identify_setting_t * const setting, const fl_print_t print) { - - if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; - - if (F_status_is_error_not(setting->state.status)) { - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - if (setting->flag & (fss_identify_main_flag_verify_e | fss_identify_main_flag_file_to_e)) return F_output_not; - } - - fll_print_dynamic_raw(setting->line_last, print.to); - - return F_none; - } -#endif // _di_fss_identify_print_line_last_locked_ - -#ifndef _di_fss_identify_print_line_last_unlocked_ - f_status_t fss_identify_print_line_last_unlocked(fss_identify_setting_t * const setting, const fl_print_t print) { - - if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; - - if (F_status_is_error_not(setting->state.status)) { - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - if (setting->flag & (fss_identify_main_flag_verify_e | fss_identify_main_flag_file_to_e)) return F_output_not; - } - - f_print_dynamic_raw(setting->line_last, print.to); - - return F_none; - } -#endif // _di_fss_identify_print_line_last_unlocked_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/fss_identify/c/print.h b/level_3/fss_identify/c/print.h index 34be83b..837567f 100644 --- a/level_3/fss_identify/c/print.h +++ b/level_3/fss_identify/c/print.h @@ -29,94 +29,6 @@ extern "C" { extern f_status_t fss_identify_print_help(fss_identify_setting_t * const setting, const fl_print_t print); #endif // _di_fss_identify_print_help_ -/** - * Print first new line, unless verbosity says otherwise. - * - * This is generally either the first line in the program or the first line printed before an error message. - * - * This function locks and then unlocks the input stream when printing. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fss_identify_print_line_first_locked_ - extern f_status_t fss_identify_print_line_first_locked(fss_identify_setting_t * const setting, const fl_print_t print); -#endif // _di_fss_identify_print_line_first_locked_ - -/** - * Print first new line, unless verbosity says otherwise. - * - * This is generally either the first line in the program or the first line printed before an error message. - * - * This function neither locks nor unlocks the input stream. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fss_identify_print_line_first_unlocked_ - extern f_status_t fss_identify_print_line_first_unlocked(fss_identify_setting_t * const setting, const fl_print_t print); -#endif // _di_fss_identify_print_line_first_unlocked_ - -/** - * Print last new line when the main is complete, unless verbosity says otherwise. - * - * This is generally the very last line printed in the program. - * - * This function locks and then unlocks the input stream when printing. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fss_identify_print_line_last_locked_ - extern f_status_t fss_identify_print_line_last_locked(fss_identify_setting_t * const setting, const fl_print_t print); -#endif // _di_fss_identify_print_line_last_locked_ - -/** - * Print last new line when the main is complete, unless verbosity says otherwise. - * - * This is generally the very last line printed in the program. - * - * This function neither locks nor unlocks the input stream. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fss_identify_print_line_last_unlocked_ - extern f_status_t fss_identify_print_line_last_unlocked(fss_identify_setting_t * const setting, const fl_print_t print); -#endif // _di_fss_identify_print_line_last_unlocked_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/fss_identify/c/private-identify.c b/level_3/fss_identify/c/private-identify.c index fd13f35..d800318 100644 --- a/level_3/fss_identify/c/private-identify.c +++ b/level_3/fss_identify/c/private-identify.c @@ -20,7 +20,7 @@ extern "C" { do { if (!((++main->signal_check) % fss_identify_signal_check_d)) { if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); + fll_program_print_signal_received(main->warning, main->signal_received); status = F_status_set_error(F_interrupt); diff --git a/level_3/fss_payload_read/c/common.c b/level_3/fss_payload_read/c/common.c index 1d5af67..7483239 100644 --- a/level_3/fss_payload_read/c/common.c +++ b/level_3/fss_payload_read/c/common.c @@ -81,10 +81,27 @@ extern "C" { setting->state.step_small = fss_payload_read_allocation_small_d; + // Identify and pocess first/last parameters. + if (main->parameters.array[payload_read_parameter_line_first_no_e].result & f_console_result_found_e) { + setting->flag -= setting->flag & payload_read_main_flag_print_first_e; + } + else { + setting->flag |= payload_read_main_flag_print_first_e; + } + + if (main->parameters.array[payload_read_parameter_line_last_no_e].result & f_console_result_found_e) { + setting->flag -= setting->flag & payload_read_main_flag_print_last_e; + } + else { + setting->flag |= payload_read_main_flag_print_last_e; + } + if (F_status_is_error(setting->state.status)) { - fss_payload_read_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->state.status), "f_console_parameter_process", fll_error_file_flag_fallback_e); - fss_payload_read_print_line_last_locked(setting, main->error); + + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error); + } return; } @@ -104,28 +121,16 @@ extern "C" { setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, main); if (F_status_is_error(setting->state.status)) { - fss_payload_read_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e); - fss_payload_read_print_line_last_locked(setting, main->error); + + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error); + } return; } } - if (main->parameters.array[fss_payload_read_parameter_line_first_no_e].result & f_console_result_found_e) { - setting->line_first = f_string_empty_s; - } - else { - setting->line_first = f_string_eol_s; - } - - if (main->parameters.array[fss_payload_read_parameter_line_last_no_e].result & f_console_result_found_e) { - setting->line_last = f_string_empty_s; - } - else { - setting->line_last = f_string_eol_s; - } - // Identify and prioritize "verbosity" parameters. { uint16_t choices_array[5] = { fss_payload_read_parameter_verbosity_quiet_e, fss_payload_read_parameter_verbosity_error_e, fss_payload_read_parameter_verbosity_verbose_e, fss_payload_read_parameter_verbosity_debug_e, fss_payload_read_parameter_verbosity_normal_e }; @@ -137,9 +142,11 @@ extern "C" { setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); if (F_status_is_error(setting->state.status)) { - fss_payload_read_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->state.status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e); - fss_payload_read_print_line_last_locked(setting, main->error); + + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error); + } return; } diff --git a/level_3/fss_payload_read/c/common.h b/level_3/fss_payload_read/c/common.h index 6aa5de4..56cebee 100644 --- a/level_3/fss_payload_read/c/common.h +++ b/level_3/fss_payload_read/c/common.h @@ -303,41 +303,45 @@ extern "C" { * Flags passed to the main function or program. * * fss_payload_read_main_flag_*_e: - * - none: No flags set. - * - at: Selecting at a specific index. - * - content: Print Contents. - * - copyright: Print copyright. - * - help: Print help. - * - literal: Print as literal data (printing entire variable). - * - line: Selecting at a specific line. - * - name: Selecting using a specific Vocabulary name. - * - object: Print Objects. - * - replace: Using re-assignments. - * - replace: Using replacements. - * - substitute: Using substitutions. - * - total: Enable printing of "total" count. - * - version: Print version. - * - whole: Print all data. - * - wrap: Using wrapping. + * - none: No flags set. + * - at: Selecting at a specific index. + * - content: Print Contents. + * - copyright: Print copyright. + * - help: Print help. + * - literal: Print as literal data (printing entire variable). + * - line: Selecting at a specific line. + * - name: Selecting using a specific Vocabulary name. + * - object: Print Objects. + * - print_first: When set, print new line to message output on program begin after loading settings. + * - print_last: When set, print new line to message output on program end. + * - replace: Using re-assignments. + * - replace: Using replacements. + * - substitute: Using substitutions. + * - total: Enable printing of "total" count. + * - version: Print version. + * - whole: Print all data. + * - wrap: Using wrapping. */ #ifndef _di_fss_payload_read_main_flag_e_ enum { - fss_payload_read_main_flag_none_e = 0x0, - fss_payload_read_main_flag_at_e = 0x1, - fss_payload_read_main_flag_content_e = 0x2, - fss_payload_read_main_flag_copyright_e = 0x4, - fss_payload_read_main_flag_help_e = 0x8, - fss_payload_read_main_flag_literal_e = 0x10, - fss_payload_read_main_flag_line_e = 0x20, - fss_payload_read_main_flag_name_e = 0x40, - fss_payload_read_main_flag_object_e = 0x80, - fss_payload_read_main_flag_reassign_e = 0x100, - fss_payload_read_main_flag_replace_e = 0x200, - fss_payload_read_main_flag_substitute_e = 0x400, - fss_payload_read_main_flag_total_e = 0x800, - fss_payload_read_main_flag_version_e = 0x1000, - fss_payload_read_main_flag_whole_e = 0x2000, - fss_payload_read_main_flag_wrap_e = 0x4000, + fss_payload_read_main_flag_none_e = 0x0, + fss_payload_read_main_flag_at_e = 0x1, + fss_payload_read_main_flag_content_e = 0x2, + fss_payload_read_main_flag_copyright_e = 0x4, + fss_payload_read_main_flag_help_e = 0x8, + fss_payload_read_main_flag_literal_e = 0x10, + fss_payload_read_main_flag_line_e = 0x20, + fss_payload_read_main_flag_name_e = 0x40, + fss_payload_read_main_flag_object_e = 0x80, + fss_payload_read_main_flag_print_first_e = 0x100, + fss_payload_read_main_flag_print_last_e = 0x200, + fss_payload_read_main_flag_reassign_e = 0x400, + fss_payload_read_main_flag_replace_e = 0x800, + fss_payload_read_main_flag_substitute_e = 0x1000, + fss_payload_read_main_flag_total_e = 0x2000, + fss_payload_read_main_flag_version_e = 0x4000, + fss_payload_read_main_flag_whole_e = 0x8000, + fss_payload_read_main_flag_wrap_e = 0x10000, }; // enum #endif // _di_fss_payload_read_main_flag_e_ @@ -350,26 +354,18 @@ extern "C" { * flag: Flags passed to the main function. * * state: The state information. - * - * 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. */ #ifndef _di_fss_payload_read_setting_t_ typedef struct { uint16_t flag; f_state_t state; - - f_string_static_t line_first; - f_string_static_t line_last; } fss_payload_read_setting_t; #define fss_payload_read_setting_t_initialize \ { \ fss_payload_read_main_flag_none_e, \ f_state_t_initialize, \ - f_string_static_t_initialize, \ - f_string_static_t_initialize, \ } #endif // _di_fss_payload_read_setting_t_ diff --git a/level_3/fss_payload_read/c/fss_payload_read.c b/level_3/fss_payload_read/c/fss_payload_read.c index 45b3801..6c49ad1 100644 --- a/level_3/fss_payload_read/c/fss_payload_read.c +++ b/level_3/fss_payload_read/c/fss_payload_read.c @@ -35,14 +35,31 @@ extern "C" { status = fll_program_parameter_process_context(choices, modes, F_true, main); if (F_status_is_error(status)) { - fss_payload_read_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_context", fll_error_file_flag_fallback_e); - fss_payload_read_print_line_last_locked(setting, main->error); + + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error); + } return; } } + // Identify and pocess first/last parameters. + if (main->parameters.array[fss_payload_read_parameter_line_first_no_e].result & f_console_result_found_e) { + setting->flag -= setting->flag & fss_payload_read_main_flag_print_first_e; + } + else { + setting->flag |= fss_payload_read_main_flag_print_first_e; + } + + if (main->parameters.array[fss_payload_read_parameter_line_last_no_e].result & f_console_result_found_e) { + setting->flag -= setting->flag & fss_payload_read_main_flag_print_last_e; + } + else { + setting->flag |= fss_payload_read_main_flag_print_last_e; + } + // Identify and prioritize "verbosity" parameters. { uint16_t choices_array[5] = { fss_payload_read_parameter_verbosity_quiet_e, fss_payload_read_parameter_verbosity_error_e, fss_payload_read_parameter_verbosity_verbose_e, fss_payload_read_parameter_verbosity_debug_e, fss_payload_read_parameter_verbosity_normal_e }; @@ -54,9 +71,11 @@ extern "C" { status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); if (F_status_is_error(status)) { - fss_payload_read_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_verbosity", fll_error_file_flag_fallback_e); - fss_payload_read_print_line_last_locked(setting, main->error); + + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error); + } return; } @@ -70,13 +89,13 @@ extern "C" { } if (main->parameters.array[fss_payload_read_parameter_version_e].result & f_console_result_found_e) { - fll_program_print_version(main->message, (setting->line_first.used ? 0x1 : 0x0) | (setting->line_last.used ? 0x2 : 0x0), fss_payload_read_program_version_s); + fll_program_print_version(main->message, fss_payload_read_program_version_s); return status; } if (main->parameters.array[fss_payload_read_parameter_copyright_e].result & f_console_result_found_e) { - fll_program_print_copyright(main->message, (setting->line_first.used ? 0x1 : 0x0) | (setting->line_last.used ? 0x2 : 0x0)); + fll_program_print_copyright(main->message); return status; } @@ -213,7 +232,7 @@ extern "C" { if (!((++main->signal_check) % fss_payload_read_signal_check_d)) { if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); + fll_program_print_signal_received(main->warning, main->signal_received); status = F_status_set_error(F_interrupt); @@ -431,7 +450,7 @@ extern "C" { if (!((++main->signal_check) % fss_payload_read_signal_check_d)) { if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); + fll_program_print_signal_received(main->warning, main->signal_received); status = F_status_set_error(F_interrupt); @@ -497,7 +516,7 @@ extern "C" { // The signal check is always performed on each pass. if (size_file > fss_payload_read_block_max && fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); + fll_program_print_signal_received(main->warning, main->signal_received); status = F_status_set_error(F_interrupt); diff --git a/level_3/fss_payload_read/c/print.c b/level_3/fss_payload_read/c/print.c index 37766fb..950a190 100644 --- a/level_3/fss_payload_read/c/print.c +++ b/level_3/fss_payload_read/c/print.c @@ -10,8 +10,6 @@ extern "C" { f_file_stream_lock(print.to); - f_print_dynamic_raw(setting->line_first, print.to); - fll_program_print_help_header(print, fss_payload_read_program_name_long_s, fss_payload_read_program_version_s); fll_program_print_help_option_standard(print); @@ -116,8 +114,6 @@ extern "C" { fl_print_format(" will not contain any Content close pipe control codes when using", print.to); fl_print_format(" %[%r%r%].%r", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_payload_read_long_pipe_s, print.set->notable, f_string_eol_s); - f_print_dynamic_raw(setting->line_last, print.to); - f_file_stream_flush(print.to); f_file_stream_unlock(print.to); @@ -125,68 +121,6 @@ extern "C" { } #endif // _di_fss_payload_read_print_help_ -#ifndef _di_fss_payload_read_print_line_first_locked_ - f_status_t fss_payload_read_print_line_first_locked(fss_payload_read_setting_t * const setting, const fl_print_t print) { - - if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; - - if (F_status_is_error_not(setting->state.status)) { - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - } - - f_print_dynamic_raw(setting->line_first, print.to); - - return F_none; - } -#endif // _di_fss_payload_read_print_line_first_locked_ - -#ifndef _di_fss_payload_read_print_line_first_unlocked_ - f_status_t fss_payload_read_print_line_first_unlocked(fss_payload_read_setting_t * const setting, const fl_print_t print) { - - if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; - - if (F_status_is_error_not(setting->state.status)) { - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - } - - fll_print_dynamic_raw(setting->line_first, print.to); - - return F_none; - } -#endif // _di_fss_payload_read_print_line_first_unlocked_ - -#ifndef _di_fss_payload_read_print_line_last_locked_ - f_status_t fss_payload_read_print_line_last_locked(fss_payload_read_setting_t * const setting, const fl_print_t print) { - - if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; - - if (F_status_is_error_not(setting->state.status)) { - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - if (setting->flag & (fss_payload_read_main_flag_verify_e | fss_payload_read_main_flag_file_to_e)) return F_output_not; - } - - fll_print_dynamic_raw(setting->line_last, print.to); - - return F_none; - } -#endif // _di_fss_payload_read_print_line_last_locked_ - -#ifndef _di_fss_payload_read_print_line_last_unlocked_ - f_status_t fss_payload_read_print_line_last_unlocked(fss_payload_read_setting_t * const setting, const fl_print_t print) { - - if (!setting || print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - - if (F_status_is_error(setting->state.status)) { - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - if (setting->flag & (fss_payload_read_main_flag_verify_e | fss_payload_read_main_flag_file_to_e)) return F_output_not; - } - - f_print_dynamic_raw(setting->line_last, print.to); - - return F_none; - } -#endif // _di_fss_payload_read_print_line_last_unlocked_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/fss_payload_read/c/print.h b/level_3/fss_payload_read/c/print.h index d98cdae..ee7be26 100644 --- a/level_3/fss_payload_read/c/print.h +++ b/level_3/fss_payload_read/c/print.h @@ -29,94 +29,6 @@ extern "C" { extern f_status_t fss_payload_read_print_help(fss_payload_read_setting_t * const setting, const fl_print_t print); #endif // _di_fss_payload_read_print_help_ -/** - * Print first new line, unless verbosity says otherwise. - * - * This is generally either the first line in the program or the first line printed before an error message. - * - * This function locks and then unlocks the input stream when printing. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fss_payload_read_print_line_first_locked_ - extern f_status_t fss_payload_read_print_line_first_locked(fss_payload_read_setting_t * const setting, const fl_print_t print); -#endif // _di_fss_payload_read_print_line_first_locked_ - -/** - * Print first new line, unless verbosity says otherwise. - * - * This is generally either the first line in the program or the first line printed before an error message. - * - * This function neither locks nor unlocks the input stream. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fss_payload_read_print_line_first_unlocked_ - extern f_status_t fss_payload_read_print_line_first_unlocked(fss_payload_read_setting_t * const setting, const fl_print_t print); -#endif // _di_fss_payload_read_print_line_first_unlocked_ - -/** - * Print last new line when the main is complete, unless verbosity says otherwise. - * - * This is generally the very last line printed in the program. - * - * This function locks and then unlocks the input stream when printing. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fss_payload_read_print_line_last_locked_ - extern f_status_t fss_payload_read_print_line_last_locked(fss_payload_read_setting_t * const setting, const fl_print_t print); -#endif // _di_fss_payload_read_print_line_last_locked_ - -/** - * Print last new line when the main is complete, unless verbosity says otherwise. - * - * This is generally the very last line printed in the program. - * - * This function neither locks nor unlocks the input stream. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fss_payload_read_print_line_last_unlocked_ - extern f_status_t fss_payload_read_print_line_last_unlocked(fss_payload_read_setting_t * const setting, const fl_print_t print); -#endif // _di_fss_payload_read_print_line_last_unlocked_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/fss_payload_read/c/private-read.c b/level_3/fss_payload_read/c/private-read.c index 8b7b4d3..4a27c9e 100644 --- a/level_3/fss_payload_read/c/private-read.c +++ b/level_3/fss_payload_read/c/private-read.c @@ -88,7 +88,7 @@ extern "C" { if (!((++main->signal_check) % fss_payload_read_signal_check_d)) { if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); + fll_program_print_signal_received(main->warning, main->signal_received); return F_status_set_error(F_interrupt); } @@ -176,7 +176,7 @@ extern "C" { if (!((++main->signal_check) % fss_payload_read_signal_check_d)) { if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); + fll_program_print_signal_received(main->warning, main->signal_received); return F_status_set_error(F_interrupt); } @@ -186,8 +186,6 @@ extern "C" { if (data->depths.array[i].depth == data->depths.array[j].depth) { if (main->error.verbosity < f_console_verbosity_normal_e) { - fss_payload_read_print_line_first(setting, main->error, F_true); - fll_program_print_error_parameter_must_specify_once_value(main->error, f_console_symbol_long_normal_s, fss_payload_read_long_depth_s, data->depths.array[i].depth); } @@ -440,7 +438,7 @@ extern "C" { if (!((++main->signal_check) % fss_payload_read_signal_check_d)) { if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); + fll_program_print_signal_received(main->warning, main->signal_received); return F_status_set_error(F_interrupt); } @@ -491,7 +489,7 @@ extern "C" { if (!((++main->signal_check) % fss_payload_read_signal_check_d)) { if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); + fll_program_print_signal_received(main->warning, main->signal_received); return F_status_set_error(F_interrupt); } @@ -722,7 +720,7 @@ extern "C" { if (!((++main->signal_check) % fss_payload_read_signal_check_d)) { if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); + fll_program_print_signal_received(main->warning, main->signal_received); return F_status_set_error(F_interrupt); } @@ -805,7 +803,7 @@ extern "C" { if (!((++main->signal_check) % fss_payload_read_signal_check_d)) { if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); + fll_program_print_signal_received(main->warning, main->signal_received); return F_status_set_error(F_interrupt); } @@ -875,7 +873,7 @@ extern "C" { if (!((++main->signal_check) % fss_payload_read_signal_check_d)) { if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); + fll_program_print_signal_received(main->warning, main->signal_received); return F_status_set_error(F_interrupt); } @@ -1080,7 +1078,7 @@ extern "C" { if (!((++main->signal_check) % fss_payload_read_signal_check_d)) { if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); + fll_program_print_signal_received(main->warning, main->signal_received); return F_status_set_error(F_interrupt); } diff --git a/level_3/fss_write/c/basic/fss_write.c b/level_3/fss_write/c/basic/fss_write.c index 3502557..698abcc 100644 --- a/level_3/fss_write/c/basic/fss_write.c +++ b/level_3/fss_write/c/basic/fss_write.c @@ -12,10 +12,6 @@ extern "C" { fss_write_setting_t * const setting = macro_fss_write_setting(void_setting); - if (main->message.verbosity > f_console_verbosity_error_e) { - fss_write_print_line_first(setting, main->message); - } - if (setting->content) { fl_fss_basic_content_write( *setting->content, @@ -51,10 +47,6 @@ extern "C" { } } } - - if (F_status_is_error(setting->state.status) || main->message.verbosity > f_console_verbosity_error_e) { - fss_write_print_line_last(setting, main->message); - } } #endif // _di_fss_write_basic_process_content_ diff --git a/level_3/fss_write/c/basic/print.c b/level_3/fss_write/c/basic/print.c index e7dd562..7c24b21 100644 --- a/level_3/fss_write/c/basic/print.c +++ b/level_3/fss_write/c/basic/print.c @@ -11,8 +11,6 @@ extern "C" { f_file_stream_lock(print.to); - f_print_dynamic_raw(setting->line_first, print.to); - fll_program_print_help_header(print, fss_write_basic_program_name_long_s, fss_write_program_version_s); fss_write_print_help(setting, print); @@ -31,8 +29,6 @@ extern "C" { fl_print_format(" This program does not use the parameter '%[%r%r%]', which therefore does nothing.%r", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_write_long_ignore_s, print.set->notable, f_string_eol_s); fl_print_format(" This parameter requires two values.%r", print.to, f_string_eol_s); - f_print_dynamic_raw(setting->line_last, print.to); - f_file_stream_flush(print.to); f_file_stream_unlock(print.to); 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 976ce18..39c6f25 100644 --- a/level_3/fss_write/c/basic_list/fss_write.c +++ b/level_3/fss_write/c/basic_list/fss_write.c @@ -12,10 +12,6 @@ extern "C" { fss_write_setting_t * const setting = macro_fss_write_setting(void_setting); - if (main->message.verbosity > f_console_verbosity_error_e) { - fss_write_print_line_first(setting, main->message); - } - if (setting->content) { fl_fss_basic_list_content_write( *setting->content, @@ -54,10 +50,6 @@ extern "C" { } } } - - if (F_status_is_error(setting->state.status) || main->message.verbosity > f_console_verbosity_error_e) { - fss_write_print_line_last(setting, main->message); - } } #endif // _di_fss_write_basic_list_process_content_ diff --git a/level_3/fss_write/c/basic_list/print.c b/level_3/fss_write/c/basic_list/print.c index c77d009..ea68ed0 100644 --- a/level_3/fss_write/c/basic_list/print.c +++ b/level_3/fss_write/c/basic_list/print.c @@ -11,8 +11,6 @@ extern "C" { f_file_stream_lock(print.to); - f_print_dynamic_raw(setting->line_first, print.to); - fll_program_print_help_header(print, fss_write_basic_list_program_name_long_s, fss_write_program_version_s); fss_write_print_help(setting, print); @@ -31,8 +29,6 @@ extern "C" { fl_print_format(" This program does not use the parameter '%[%r%r%]', which therefore does nothing.%r", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_write_long_ignore_s, print.set->notable, f_string_eol_s); fl_print_format(" This parameter requires two values.%r", print.to, f_string_eol_s); - f_print_dynamic_raw(setting->line_last, print.to); - f_file_stream_flush(print.to); f_file_stream_unlock(print.to); 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 1d884fc..9d40954 100644 --- a/level_3/fss_write/c/embedded_list/fss_write.c +++ b/level_3/fss_write/c/embedded_list/fss_write.c @@ -12,10 +12,6 @@ extern "C" { fss_write_setting_t * const setting = macro_fss_write_setting(void_setting); - if (main->message.verbosity > f_console_verbosity_error_e) { - fss_write_print_line_first(setting, main->message); - } - if (setting->content) { fl_fss_embedded_list_content_write( *setting->content, @@ -59,10 +55,6 @@ extern "C" { } } } - - if (F_status_is_error(setting->state.status) || main->message.verbosity > f_console_verbosity_error_e) { - fss_write_print_line_last(setting, main->message); - } } #endif // _di_fss_write_embedded_list_process_content_ diff --git a/level_3/fss_write/c/embedded_list/print.c b/level_3/fss_write/c/embedded_list/print.c index c5c3a27..e2af36f 100644 --- a/level_3/fss_write/c/embedded_list/print.c +++ b/level_3/fss_write/c/embedded_list/print.c @@ -11,8 +11,6 @@ extern "C" { f_file_stream_lock(print.to); - f_print_dynamic_raw(setting->line_first, print.to); - fll_program_print_help_header(print, fss_write_embedded_list_program_name_long_s, fss_write_program_version_s); fss_write_print_help(setting, print); @@ -34,8 +32,6 @@ extern "C" { fl_print_format(" This parameter must be specified after a '%[%r%r%]'", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_write_long_content_s, print.set->notable); fl_print_format(" parameter and this applies only to the Content represented by that specific '%[%r%r%]' parameter.%r", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_write_long_content_s, print.set->notable, f_string_eol_s); - f_print_dynamic_raw(setting->line_last, print.to); - f_file_stream_flush(print.to); f_file_stream_unlock(print.to); diff --git a/level_3/fss_write/c/extended/fss_write.c b/level_3/fss_write/c/extended/fss_write.c index bef2e2d..d8ffefc 100644 --- a/level_3/fss_write/c/extended/fss_write.c +++ b/level_3/fss_write/c/extended/fss_write.c @@ -12,10 +12,6 @@ extern "C" { fss_write_setting_t * const setting = macro_fss_write_setting(void_setting); - if (main->message.verbosity > f_console_verbosity_error_e) { - fss_write_print_line_first(setting, main->message); - } - if (setting->content) { fl_fss_extended_content_write( *setting->content, @@ -63,10 +59,6 @@ extern "C" { } } } - - if (F_status_is_error(setting->state.status) || main->message.verbosity > f_console_verbosity_error_e) { - fss_write_print_line_last(setting, main->message); - } } #endif // _di_fss_write_extended_process_content_ diff --git a/level_3/fss_write/c/extended/print.c b/level_3/fss_write/c/extended/print.c index b16339e..e5db7c8 100644 --- a/level_3/fss_write/c/extended/print.c +++ b/level_3/fss_write/c/extended/print.c @@ -11,8 +11,6 @@ extern "C" { f_file_stream_lock(print.to); - f_print_dynamic_raw(setting->line_first, print.to); - fll_program_print_help_header(print, fss_write_extended_program_name_long_s, fss_write_program_version_s); fss_write_print_help(setting, print); @@ -31,8 +29,6 @@ extern "C" { fl_print_format(" This program does not use the parameter '%[%r%r%]', which therefore does nothing.%r", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_write_long_ignore_s, print.set->notable, f_string_eol_s); fl_print_format(" This parameter requires two values.%r", print.to, f_string_eol_s); - f_print_dynamic_raw(setting->line_last, print.to); - f_file_stream_flush(print.to); f_file_stream_unlock(print.to); 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 6171036..b59f788 100644 --- a/level_3/fss_write/c/extended_list/fss_write.c +++ b/level_3/fss_write/c/extended_list/fss_write.c @@ -12,10 +12,6 @@ extern "C" { fss_write_setting_t * const setting = macro_fss_write_setting(void_setting); - if (main->message.verbosity > f_console_verbosity_error_e) { - fss_write_print_line_first(setting, main->message); - } - if (setting->content) { fl_fss_extended_list_content_write( *setting->content, @@ -59,10 +55,6 @@ extern "C" { } } } - - if (F_status_is_error(setting->state.status) || main->message.verbosity > f_console_verbosity_error_e) { - fss_write_print_line_last(setting, main->message); - } } #endif // _di_fss_write_extended_list_process_content_ diff --git a/level_3/fss_write/c/extended_list/print.c b/level_3/fss_write/c/extended_list/print.c index be6b9f1..db3f8d3 100644 --- a/level_3/fss_write/c/extended_list/print.c +++ b/level_3/fss_write/c/extended_list/print.c @@ -11,8 +11,6 @@ extern "C" { f_file_stream_lock(print.to); - f_print_dynamic_raw(setting->line_first, print.to); - fll_program_print_help_header(print, fss_write_extended_list_program_name_long_s, fss_write_program_version_s); fss_write_print_help(setting, print); @@ -34,8 +32,6 @@ extern "C" { fl_print_format(" This parameter must be specified after a '%[%r%r%]'", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_write_long_content_s, print.set->notable); fl_print_format(" parameter and this applies only to the Content represented by that specific '%[%r%r%]' parameter.%r", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_write_long_content_s, print.set->notable, f_string_eol_s); - f_print_dynamic_raw(setting->line_last, print.to); - f_file_stream_flush(print.to); f_file_stream_unlock(print.to); diff --git a/level_3/fss_write/c/main/common-type.h b/level_3/fss_write/c/main/common-type.h index db77ecf..59aa1e2 100644 --- a/level_3/fss_write/c/main/common-type.h +++ b/level_3/fss_write/c/main/common-type.h @@ -62,7 +62,8 @@ extern "C" { * - object: The Object being written is specified. * - object_open: The Object open characters are to be printed. * - partial: Do not write end of Object/Content character. - * - print_first: When set, the first character printing logic is to be processed (this is usually automatic). + * - print_first: When set, print new line to message output on program begin after loading settings. + * - print_last: When set, print new line to message output on program end. * - trim: Trim Object names. * - version: Print version. */ @@ -82,8 +83,9 @@ extern "C" { fss_write_main_flag_partial_e = 0x400, fss_write_main_flag_prepend_e = 0x800, fss_write_main_flag_print_first_e = 0x1000, - fss_write_main_flag_trim_e = 0x2000, - fss_write_main_flag_version_e = 0x4000, + fss_write_main_flag_print_last_e = 0x2000, + fss_write_main_flag_trim_e = 0x4000, + fss_write_main_flag_version_e = 0x8000, }; // enum #endif // _di_fss_write_main_flag_e_ @@ -168,9 +170,6 @@ extern "C" { * state: The state data used when processing the FSS data. * range: A range used as a buffer during processing. * - * 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. - * * quote: This holds the quote used during processing. * standard: A human-friendly string describing the standard in use, such as "FSS-0000 (Basic)". * @@ -201,9 +200,6 @@ extern "C" { f_state_t state; f_string_range_t range; - f_string_static_t line_first; - f_string_static_t line_last; - f_string_static_t quote; f_string_static_t standard; @@ -236,7 +232,6 @@ extern "C" { f_string_range_t_initialize, \ f_string_static_t_initialize, \ 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, \ diff --git a/level_3/fss_write/c/main/common.c b/level_3/fss_write/c/main/common.c index 3b42aa3..07266ff 100644 --- a/level_3/fss_write/c/main/common.c +++ b/level_3/fss_write/c/main/common.c @@ -33,7 +33,26 @@ extern "C" { setting->state.step_small = fss_write_allocation_small_d; + // Identify and pocess first/last parameters. + if (main->parameters.array[fss_write_parameter_line_first_no_e].result & f_console_result_found_e) { + setting->flag -= setting->flag & fss_write_main_flag_print_first_e; + } + else { + setting->flag |= fss_write_main_flag_print_first_e; + } + + if (main->parameters.array[fss_write_parameter_line_last_no_e].result & f_console_result_found_e) { + setting->flag -= setting->flag & fss_write_main_flag_print_last_e; + } + else { + setting->flag |= fss_write_main_flag_print_last_e; + } + if (F_status_is_error(setting->state.status)) { + if ((setting->flag & fss_write_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + fss_write_print_error(setting, main->error, macro_fss_write_f(f_console_parameter_process)); return; @@ -53,26 +72,16 @@ extern "C" { setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, main); if (F_status_is_error(setting->state.status)) { + if ((setting->flag & fss_write_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + fss_write_print_error(setting, main->error, macro_fss_write_f(fll_program_parameter_process_context)); return; } } - if (main->parameters.array[fss_write_parameter_line_first_no_e].result & f_console_result_found_e) { - setting->line_first = f_string_empty_s; - } - else { - setting->line_first = f_string_eol_s; - } - - if (main->parameters.array[fss_write_parameter_line_last_no_e].result & f_console_result_found_e) { - setting->line_last = f_string_empty_s; - } - else { - setting->line_last = f_string_eol_s; - } - // Identify and prioritize "verbosity" parameters. { uint16_t choices_array[5] = { fss_write_parameter_verbosity_quiet_e, fss_write_parameter_verbosity_error_e, fss_write_parameter_verbosity_verbose_e, fss_write_parameter_verbosity_debug_e, fss_write_parameter_verbosity_normal_e }; @@ -84,6 +93,10 @@ extern "C" { setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); if (F_status_is_error(setting->state.status)) { + if ((setting->flag & fss_write_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + fss_write_print_error(setting, main->error, macro_fss_write_f(fll_program_parameter_process_verbosity)); return; @@ -125,7 +138,10 @@ extern "C" { if (main->parameters.array[fss_write_parameter_file_e].values.used > 1) { setting->state.status = F_status_set_error(F_parameter); - fss_write_print_line_first(setting, main->message); + if ((setting->flag & fss_write_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + fll_program_print_error_parameter_must_specify_once(main->error, f_console_symbol_long_normal_s, fss_write_long_file_s); return; @@ -139,6 +155,10 @@ extern "C" { setting->state.status = f_file_stream_open(main->parameters.arguments.array[index], f_string_empty_s, &main->output.to); if (F_status_is_error(setting->state.status)) { + if ((setting->flag & fss_write_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + fss_write_print_error_file(setting, main->error, macro_fss_write_f(f_file_stream_open), main->parameters.arguments.array[index], f_file_operation_open_s, fll_error_file_type_file_e); return; @@ -149,7 +169,10 @@ extern "C" { else if (main->parameters.array[fss_write_parameter_file_e].result & f_console_result_found_e) { setting->state.status = F_status_set_error(F_parameter); - fss_write_print_line_first(setting, main->message); + if ((setting->flag & fss_write_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, fss_write_long_file_s); return; @@ -163,6 +186,10 @@ extern "C" { setting->state.status = f_string_dynamics_resize(values->used, &setting->objects); if (F_status_is_error(setting->state.status)) { + if ((setting->flag & fss_write_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_dynamics_resize)); return; @@ -183,7 +210,10 @@ extern "C" { else if (main->parameters.array[fss_write_parameter_object_e].result & f_console_result_found_e) { setting->state.status = F_status_set_error(F_parameter); - fss_write_print_line_first(setting, main->message); + if ((setting->flag & fss_write_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, fss_write_long_object_s); return; @@ -196,7 +226,10 @@ extern "C" { if (main->parameters.array[fss_write_parameter_content_e].values.used > main->parameters.array[fss_write_parameter_object_e].values.used) { setting->state.status = F_status_set_error(F_support_not); - fss_write_print_line_first(setting, main->message); + if ((setting->flag & fss_write_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + fss_write_print_error_one_content_only(setting, main->error); return; @@ -217,6 +250,10 @@ extern "C" { setting->state.status = f_string_dynamicss_increase_by(values_object->used, &setting->contentss); if (F_status_is_error(setting->state.status)) { + if ((setting->flag & fss_write_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_dynamicss_increase_by)); return; @@ -248,6 +285,10 @@ extern "C" { setting->state.status = f_string_dynamics_increase_by(total, &setting->contentss.array[j]); if (F_status_is_error(setting->state.status)) { + if ((setting->flag & fss_write_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_dynamics_increase_by)); return; @@ -272,7 +313,10 @@ extern "C" { else if (main->parameters.array[fss_write_parameter_content_e].result & f_console_result_found_e) { setting->state.status = F_status_set_error(F_parameter); - fss_write_print_line_first(setting, main->message); + if ((setting->flag & fss_write_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, fss_write_long_content_s); return; @@ -286,6 +330,10 @@ extern "C" { setting->state.status = f_string_dynamic_append_nulless(main->parameters.arguments.array[index], &setting->prepend); if (F_status_is_error(setting->state.status)) { + if ((setting->flag & fss_write_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_dynamic_append_nulless)); return; @@ -297,6 +345,10 @@ extern "C" { for (; range.start < main->parameters.arguments.array[index].used; range.start++) { if (f_fss_is_space(main->parameters.arguments.array[index], range, &setting->state) == F_false) { + if ((setting->flag & fss_write_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + if (F_status_is_error(setting->state.status)) { fss_write_print_error(setting, main->error, macro_fss_write_f(f_fss_is_space)); } @@ -316,7 +368,10 @@ extern "C" { else if (main->parameters.array[fss_write_parameter_prepend_e].result & f_console_result_found_e) { setting->state.status = F_status_set_error(F_parameter); - fss_write_print_line_first(setting, main->message); + if ((setting->flag & fss_write_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, fss_write_long_prepend_s); return; @@ -326,7 +381,10 @@ extern "C" { if (main->parameters.array[fss_write_parameter_ignore_e].values.used % 2 != 0) { setting->state.status = F_status_set_error(F_parameter); - fss_write_print_line_first(setting, main->message); + if ((setting->flag & fss_write_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + fll_program_print_error_parameter_missing_value_requires_amount(main->error, f_console_symbol_long_normal_s, fss_write_long_ignore_s, fss_write_string_two_s); return; @@ -349,6 +407,10 @@ extern "C" { setting->state.status = f_string_rangess_increase_by(values_data->used, &setting->ignoress); if (F_status_is_error(setting->state.status)) { + if ((setting->flag & fss_write_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_rangess_increase_by)); return; @@ -379,6 +441,10 @@ extern "C" { setting->state.status = f_string_ranges_increase_by(total, &setting->ignoress.array[j]); if (F_status_is_error(setting->state.status)) { + if ((setting->flag & fss_write_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_ranges_increase_by)); return; @@ -391,7 +457,10 @@ extern "C" { setting->state.status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, main->parameters.arguments.array[index], &setting->ignoress.array[j].array[setting->ignoress.array[j].used].start); if (F_status_is_error(setting->state.status)) { - fss_write_print_line_first(setting, main->message); + if ((setting->flag & fss_write_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + fll_program_print_error_parameter_integer_not(main->error, f_console_symbol_long_normal_s, fss_write_long_ignore_s, main->parameters.arguments.array[index]); return; @@ -402,7 +471,10 @@ extern "C" { setting->state.status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, main->parameters.arguments.array[index], &setting->ignoress.array[j].array[setting->ignoress.array[j].used].stop); if (F_status_is_error(setting->state.status)) { - fss_write_print_line_first(setting, main->message); + if ((setting->flag & fss_write_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + fll_program_print_error_parameter_integer_not(main->error, f_console_symbol_long_normal_s, fss_write_long_ignore_s, main->parameters.arguments.array[index]); return; @@ -411,7 +483,10 @@ extern "C" { if (setting->ignoress.array[j].array[setting->ignoress.array[j].used].stop > setting->ignoress.array[j].array[setting->ignoress.array[j].used].start) { setting->state.status = F_status_set_error(F_parameter); - fss_write_print_line_first(setting, main->message); + if ((setting->flag & fss_write_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + fll_program_print_error_parameter_range_start_before_stop( main->error, f_console_symbol_long_normal_s, @@ -445,7 +520,10 @@ extern "C" { setting->state.status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, main->parameters.arguments.array[index], &number.start); if (F_status_is_error(setting->state.status)) { - fss_write_print_line_first(setting, main->message); + if ((setting->flag & fss_write_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + fll_program_print_error_parameter_integer_not(main->error, f_console_symbol_long_normal_s, fss_write_long_ignore_s, main->parameters.arguments.array[index]); return; @@ -456,7 +534,10 @@ extern "C" { setting->state.status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, main->parameters.arguments.array[index], &number.stop); if (F_status_is_error(setting->state.status)) { - fss_write_print_line_first(setting, main->message); + if ((setting->flag & fss_write_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + fll_program_print_error_parameter_integer_not(main->error, f_console_symbol_long_normal_s, fss_write_long_ignore_s, main->parameters.arguments.array[index]); return; @@ -465,7 +546,10 @@ extern "C" { if (number.start > number.stop) { setting->state.status = F_status_set_error(F_parameter); - fss_write_print_line_first(setting, main->message); + if ((setting->flag & fss_write_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + fll_program_print_error_parameter_range_start_before_stop( main->error, f_console_symbol_long_normal_s, @@ -482,7 +566,10 @@ extern "C" { else if (main->parameters.array[fss_write_parameter_ignore_e].result & f_console_result_found_e) { setting->state.status = F_status_set_error(F_parameter); - fss_write_print_line_first(setting, main->message); + if ((setting->flag & fss_write_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, fss_write_long_ignore_s); return; @@ -537,7 +624,9 @@ extern "C" { if (!(setting->flag & fss_write_main_flag_partial_e)) { setting->state.status = F_status_set_error(F_parameter); - fss_write_print_line_first(setting, main->message); + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error.to); + } fll_program_print_error_parameter_cannot_use_with_without( main->error, @@ -558,7 +647,10 @@ extern "C" { if (main->parameters.array[has_cannots[i][0]].result & f_console_result_found_e) { setting->state.status = F_status_set_error(F_parameter); - fss_write_print_line_first(setting, main->message); + if ((setting->flag & fss_write_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, has_string[i], has_cannots_string[i][0]); return; @@ -567,7 +659,10 @@ extern "C" { if (main->parameters.array[has_cannots[i][1]].result & f_console_result_found_e) { setting->state.status = F_status_set_error(F_parameter); - fss_write_print_line_first(setting, main->message); + if ((setting->flag & fss_write_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, has_string[i], has_cannots_string[i][1]); return; @@ -584,7 +679,10 @@ extern "C" { if (main->parameters.array[fss_write_parameter_object_e].locations_sub.used > main->parameters.array[fss_write_parameter_content_e].locations_sub.used && !(setting->flag & fss_write_main_flag_partial_e)) { setting->state.status = F_status_set_error(F_parameter); - fss_write_print_line_first(setting, main->message); + if ((setting->flag & fss_write_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + fss_write_print_error_parameter_same_times_at_least(setting, main->error); return; @@ -595,7 +693,10 @@ extern "C" { if (main->parameters.array[fss_write_parameter_content_e].result & f_console_result_value_e) { setting->state.status = F_status_set_error(F_parameter); - fss_write_print_line_first(setting, main->message); + if ((setting->flag & fss_write_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + fll_program_print_error_parameter_cannot_use_with_xor(main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, fss_write_long_partial_s, fss_write_long_object_s, fss_write_long_content_s); return; diff --git a/level_3/fss_write/c/main/fss_write.c b/level_3/fss_write/c/main/fss_write.c index 89deacd..46342a7 100644 --- a/level_3/fss_write/c/main/fss_write.c +++ b/level_3/fss_write/c/main/fss_write.c @@ -10,11 +10,17 @@ extern "C" { if (!main || !setting) return; if (F_status_is_error(setting->state.status)) { - fss_write_print_line_last(setting, main->error); + if ((setting->flag & fss_write_main_flag_print_last_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } return; } + if ((setting->flag & fss_write_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + setting->state.status = F_none; if (setting->flag & fss_write_main_flag_help_e) { @@ -22,17 +28,29 @@ extern "C" { setting->process_help(main, (void *) setting); } + if ((setting->flag & fss_write_main_flag_print_last_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + return; } if (setting->flag & fss_write_main_flag_version_e) { - fll_program_print_version(main->message, (setting->line_first.used ? 0x1 : 0x0) | (setting->line_last.used ? 0x2 : 0x0), fss_write_program_version_s); + fll_program_print_version(main->message, fss_write_program_version_s); + + if ((setting->flag & fss_write_main_flag_print_last_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } return; } if (setting->flag & fss_write_main_flag_copyright_e) { - fll_program_print_copyright(main->message, (setting->line_first.used ? 0x1 : 0x0) | (setting->line_last.used ? 0x2 : 0x0)); + fll_program_print_copyright(main->message); + + if ((setting->flag & fss_write_main_flag_print_last_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } return; } @@ -52,6 +70,10 @@ extern "C" { } } } + + if ((setting->flag & fss_write_main_flag_print_last_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } } #endif // _di_fss_write_main_ @@ -132,7 +154,7 @@ extern "C" { if (!setting->process_set) return; if (main->message.verbosity > f_console_verbosity_error_e) { - fss_write_print_line_first(setting, main->message); + fll_print_dynamic_raw(f_string_eol_s, main->message.to); } const f_array_length_t used_objects = setting->objects.used; @@ -203,7 +225,7 @@ extern "C" { if (!((++main->signal_check) % fss_write_signal_check_d)) { if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); + fll_program_print_signal_received(main->warning, main->signal_received); setting->state.status = F_status_set_error(F_interrupt); @@ -434,15 +456,6 @@ extern "C" { if (F_status_is_error_not(setting->state.status)) { setting->state.status = (flag & 0x1) ? F_none : F_data_not; } - - if (F_status_is_error(setting->state.status)) { - fss_write_print_line_last(setting, main->message); - } - else if (!(setting->flag & (fss_write_main_flag_object_e | fss_write_main_flag_content_e | fss_write_main_flag_object_open_e | fss_write_main_flag_content_next_e | fss_write_main_flag_content_end_e))) { - if (main->message.verbosity > f_console_verbosity_error_e) { - fss_write_print_line_last(setting, main->message); - } - } } #endif // _di_fss_write_process_pipe_ diff --git a/level_3/fss_write/c/main/main-print.c b/level_3/fss_write/c/main/main-print.c index bbf94f7..b9d33ba 100644 --- a/level_3/fss_write/c/main/main-print.c +++ b/level_3/fss_write/c/main/main-print.c @@ -18,7 +18,7 @@ extern "C" { f_file_stream_lock(print.to); - fl_print_format("%[%QThe format '%]", print.to, print.set->error, print.prefix, print.set->error); + fl_print_format("%r%[%QThe format '%]", print.to, f_string_eol_s, print.set->error, print.prefix, print.set->error); fl_print_format("%[%Q%]", print.to, print.set->notable, value, print.set->notable); fl_print_format("%[' is not known for the parameter%] ", print.to, print.set->error, print.set->error); fl_print_format("%[%Q%Q%]", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_write_long_as_s, print.set->notable); @@ -37,8 +37,6 @@ extern "C" { f_file_stream_lock(print.to); - f_print_dynamic_raw(setting->line_first, print.to); - fll_program_print_help_header(print, fss_write_program_name_long_s, fss_write_program_version_s); fss_write_print_help(setting, print); @@ -99,8 +97,6 @@ extern "C" { fl_print_format(" The %[%r%] format is the default when no ", print.to, print.set->notable, fss_write_basic_standard_s, print.set->notable); fl_print_format("'%[%r%r%]' is specified.%r", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_write_long_as_s, print.set->notable, f_string_eol_s); - f_print_dynamic_raw(setting->line_last, print.to); - f_file_stream_flush(print.to); f_file_stream_unlock(print.to); diff --git a/level_3/fss_write/c/main/main.c b/level_3/fss_write/c/main/main.c index 389bcb4..ac9c642 100644 --- a/level_3/fss_write/c/main/main.c +++ b/level_3/fss_write/c/main/main.c @@ -164,10 +164,6 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { break; } - if (setting->state.status != F_status_set_error(F_parameter)) { - fss_write_print_line_first(setting, main->message); - } - setting->state.status = F_status_set_error(F_parameter); fss_write_main_print_error_format_unknown(main->error, argv[index]); @@ -191,7 +187,10 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { return; } - fss_write_print_line_first(setting, main->message); + if (main->error.verbosity > f_console_verbosity_quiet_e) { + fll_print_dynamic_raw(f_string_eol_s, main->error.to); + } + fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, fss_write_long_as_s); return; diff --git a/level_3/fss_write/c/main/print.c b/level_3/fss_write/c/main/print.c index 7446815..fc0ed10 100644 --- a/level_3/fss_write/c/main/print.c +++ b/level_3/fss_write/c/main/print.c @@ -58,7 +58,7 @@ extern "C" { f_file_stream_lock(print.to); - fl_print_format("%[%QThe%] ", print.to, print.context, print.prefix, print.context); + fl_print_format("%r%[%QThe%] ", print.to, f_string_eol_s, 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); @@ -94,7 +94,7 @@ extern "C" { f_file_stream_lock(print.to); - fl_print_format("%[%QThe%] ", print.to, print.context, print.prefix, print.context); + fl_print_format("%r%[%QThe%] ", print.to, f_string_eol_s, 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); fl_print_format("%[\\n%]", print.to, print.set->notable, print.set->notable); @@ -164,44 +164,6 @@ extern "C" { } #endif // _di_fss_write_print_help_pipe_ -#ifndef _di_fss_write_print_line_first_ - f_status_t fss_write_print_line_first(fss_write_setting_t * const setting, const fl_print_t print) { - - if (!setting) return F_status_set_error(F_output_not); - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; - - if (F_status_is_error_not(setting->state.status)) { - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - if (setting->flag & fss_write_main_flag_file_to_e) return F_output_not; - } - - if (setting->flag & fss_write_main_flag_print_first_e) { - fll_print_dynamic_raw(setting->line_first, print.to); - - setting->flag -= fss_write_main_flag_print_first_e; - } - - return F_none; - } -#endif // _di_fss_write_print_line_first_ - -#ifndef _di_fss_write_print_line_last_ - f_status_t fss_write_print_line_last(fss_write_setting_t * const setting, const fl_print_t print) { - - if (!setting) return F_status_set_error(F_output_not); - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; - - if (F_status_is_error_not(setting->state.status)) { - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - if (setting->flag & fss_write_main_flag_file_to_e) return F_output_not; - } - - fll_print_dynamic_raw(setting->line_last, print.to); - - return F_none; - } -#endif // _di_fss_write_print_line_last_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/fss_write/c/main/print.h b/level_3/fss_write/c/main/print.h index 75bdfae..a5c73fc 100644 --- a/level_3/fss_write/c/main/print.h +++ b/level_3/fss_write/c/main/print.h @@ -183,50 +183,6 @@ extern "C" { extern void fss_write_print_help_pipe(fss_write_setting_t * const setting, const fl_print_t print); #endif // _di_fss_write_print_help_pipe_ -/** - * Print first new line, unless verbosity says otherwise. - * - * This is generally either the first line in the program or the first line printed before an error message. - * - * This function locks and then unlocks the input stream when printing. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fss_write_print_line_first_ - extern f_status_t fss_write_print_line_first(fss_write_setting_t * const setting, const fl_print_t print); -#endif // _di_fss_write_print_line_first_ - -/** - * Print last new line when the main is complete, unless verbosity says otherwise. - * - * This is generally the very last line printed in the program. - * - * This function locks and then unlocks the input stream when printing. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fss_write_print_line_last_ - extern f_status_t fss_write_print_line_last(fss_write_setting_t * const setting, const fl_print_t print); -#endif // _di_fss_write_print_line_last_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/fss_write/c/payload/fss_write.c b/level_3/fss_write/c/payload/fss_write.c index 3b85788..17ccb8e 100644 --- a/level_3/fss_write/c/payload/fss_write.c +++ b/level_3/fss_write/c/payload/fss_write.c @@ -88,7 +88,7 @@ extern "C" { if (!((++main->signal_check) % fss_write_signal_check_d)) { if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); + fll_program_print_signal_received(main->warning, main->signal_received); setting->state.status = F_status_set_error(F_interrupt); @@ -193,7 +193,6 @@ extern "C" { if (!(setting->flag & fss_write_main_flag_content_multiple_e)) { setting->state.status = F_status_set_error(F_support_not); - fss_write_print_line_first(setting, main->message); fss_write_print_error_one_content_only(setting, main->error); break; @@ -257,7 +256,6 @@ extern "C" { if (setting->block.string[range.start] == fss_write_pipe_content_start_s.string[0]) { setting->state.status = F_status_set_error(F_support_not); - fss_write_print_line_first(setting, main->message); fss_write_print_error_one_content_only(setting, main->error); break; @@ -412,7 +410,6 @@ extern "C" { if (F_status_set_fine(setting->state.status) == F_none_eol) { setting->state.status = F_status_set_error(F_support_not); - fss_write_print_line_first(setting, main->message); fss_write_print_error_unsupported_eol(setting, main->error); return; @@ -452,7 +449,6 @@ extern "C" { if (F_status_set_fine(setting->state.status) == F_none_eol) { setting->state.status = F_status_set_error(F_support_not); - fss_write_print_line_first(setting, main->message); fss_write_print_error_unsupported_eol(setting, main->error); return; @@ -558,7 +554,6 @@ extern "C" { if (fl_string_dynamic_compare(argv[values->array[i]], fss_write_payload_s) == F_equal_to && i + 1 < values->used) { setting->state.status = F_status_set_error(F_parameter); - fss_write_print_line_first(setting, main->message); fss_write_payload_print_error_payload_not_last(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 f1b3d65..e4dddb2 100644 --- a/level_3/fss_write/c/payload/print.c +++ b/level_3/fss_write/c/payload/print.c @@ -11,7 +11,7 @@ extern "C" { f_file_stream_lock(print.to); - 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); + fl_print_format("%r%[%QThe payload may only be specified last.%]%r", print.to, f_string_eol_s, print.set->error, print.prefix, print.set->error, f_string_eol_s); f_file_stream_unlock(print.to); @@ -26,8 +26,6 @@ extern "C" { f_file_stream_lock(print.to); - f_print_dynamic_raw(setting->line_first, print.to); - fll_program_print_help_header(print, fss_write_payload_program_name_long_s, fss_write_program_version_s); fss_write_print_help(setting, print); @@ -46,8 +44,6 @@ extern "C" { fl_print_format(" This program does not use the parameter '%[%r%r%]', which therefore does nothing.%r", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_write_long_ignore_s, print.set->notable, f_string_eol_s); fl_print_format(" This parameter requires two values.%r", print.to, f_string_eol_s); - f_print_dynamic_raw(setting->line_last, print.to); - f_file_stream_flush(print.to); 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 183d023..7a3322f 100644 --- a/level_3/iki_read/c/main/common.c +++ b/level_3/iki_read/c/main/common.c @@ -35,8 +35,26 @@ extern "C" { setting->state.step_small = iki_read_allocation_small_d; + // Identify and pocess first/last parameters. + if (main->parameters.array[iki_read_parameter_line_first_no_e].result & f_console_result_found_e) { + setting->flag -= setting->flag & iki_read_main_flag_print_first_e; + } + else { + setting->flag |= iki_read_main_flag_print_first_e; + } + + if (main->parameters.array[iki_read_parameter_line_last_no_e].result & f_console_result_found_e) { + setting->flag -= setting->flag & iki_read_main_flag_print_last_e; + } + else { + setting->flag |= iki_read_main_flag_print_last_e; + } + if (F_status_is_error(setting->state.status)) { - iki_read_print_line_first(setting, main->message); + if ((setting->flag & iki_read_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + iki_read_print_error(setting, main->error, macro_iki_read_f(f_console_parameter_process)); return; @@ -56,27 +74,16 @@ extern "C" { setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, main); if (F_status_is_error(setting->state.status)) { - iki_read_print_line_first(setting, main->message); + if ((setting->flag & iki_read_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + iki_read_print_error(setting, main->error, macro_iki_read_f(fll_program_parameter_process_context)); return; } } - if (main->parameters.array[iki_read_parameter_line_first_no_e].result & f_console_result_found_e) { - setting->line_first = f_string_empty_s; - } - else { - setting->line_first = f_string_eol_s; - } - - if (main->parameters.array[iki_read_parameter_line_last_no_e].result & f_console_result_found_e) { - setting->line_last = f_string_empty_s; - } - else { - setting->line_last = f_string_eol_s; - } - // Identify and prioritize "verbosity" parameters. { uint16_t choices_array[5] = { iki_read_parameter_verbosity_quiet_e, iki_read_parameter_verbosity_error_e, iki_read_parameter_verbosity_verbose_e, iki_read_parameter_verbosity_debug_e, iki_read_parameter_verbosity_normal_e }; @@ -88,7 +95,10 @@ extern "C" { setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); if (F_status_is_error(setting->state.status)) { - iki_read_print_line_first(setting, main->message); + if ((setting->flag & iki_read_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + iki_read_print_error(setting, main->error, macro_iki_read_f(fll_program_parameter_process_verbosity)); return; @@ -117,7 +127,10 @@ extern "C" { if (!(main->parameters.remaining.used || (main->pipe & fll_program_data_pipe_input_e))) { setting->state.status = F_status_set_error(F_parameter); - iki_read_print_line_first(setting, main->error); + if ((setting->flag & iki_read_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + fll_program_print_error_missing_file(main->error); return; @@ -127,7 +140,10 @@ extern "C" { if (main->parameters.array[iki_read_parameter_whole_e].result & f_console_result_found_e) { setting->state.status = F_status_set_error(F_parameter); - iki_read_print_line_first(setting, main->error); + if ((setting->flag & iki_read_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, iki_read_long_at_s, iki_read_long_whole_s); return; @@ -142,7 +158,10 @@ extern "C" { if (F_status_is_error(setting->state.status)) { setting->state.status = F_status_set_error(F_parameter); - iki_read_print_line_first(setting, main->error); + if ((setting->flag & iki_read_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + fll_program_print_error_parameter_integer_not(main->error, f_console_symbol_long_normal_s, iki_read_long_at_s, main->parameters.arguments.array[index]); return; @@ -153,7 +172,10 @@ extern "C" { else if (main->parameters.array[iki_read_parameter_at_e].result & f_console_result_found_e) { setting->state.status = F_status_set_error(F_parameter); - iki_read_print_line_first(setting, main->error); + if ((setting->flag & iki_read_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, iki_read_long_at_s); return; @@ -169,7 +191,10 @@ extern "C" { if (F_status_is_error(setting->state.status)) { setting->state.status = F_status_set_error(F_parameter); - iki_read_print_line_first(setting, main->error); + if ((setting->flag & iki_read_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + fll_program_print_error_parameter_integer_not(main->error, f_console_symbol_long_normal_s, iki_read_long_line_s, main->parameters.arguments.array[index]); return; @@ -180,7 +205,10 @@ extern "C" { else if (main->parameters.array[iki_read_parameter_line_e].result & f_console_result_found_e) { setting->state.status = F_status_set_error(F_parameter); - iki_read_print_line_first(setting, main->error); + if ((setting->flag & iki_read_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, iki_read_long_line_s); return; @@ -192,7 +220,10 @@ extern "C" { setting->state.status = f_string_dynamics_increase_by(main->parameters.array[iki_read_parameter_name_e].values.used, &setting->names); if (F_status_is_error(setting->state.status)) { - iki_read_print_line_first(setting, main->message); + if ((setting->flag & iki_read_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + iki_read_print_error(setting, main->error, macro_iki_read_f(f_string_dynamics_increase_by)); return; @@ -224,7 +255,10 @@ extern "C" { } // for if (F_status_is_error(setting->state.status)) { - iki_read_print_line_first(setting, main->message); + if ((setting->flag & iki_read_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + iki_read_print_error(setting, main->error, macro_iki_read_f(f_string_dynamics_append)); return; @@ -235,7 +269,10 @@ extern "C" { else if (main->parameters.array[iki_read_parameter_name_e].result & f_console_result_found_e) { setting->state.status = F_status_set_error(F_parameter); - iki_read_print_line_first(setting, main->error); + if ((setting->flag & iki_read_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, iki_read_long_name_s); return; @@ -245,7 +282,10 @@ extern "C" { if ((main->parameters.array[iki_read_parameter_replace_e].result & f_console_result_found_e) || main->parameters.array[iki_read_parameter_replace_e].values.used % 2 != 0) { setting->state.status = F_status_set_error(F_parameter); - iki_read_print_line_first(setting, main->error); + if ((setting->flag & iki_read_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + fll_program_print_error_parameter_missing_value_requires_amount(main->error, f_console_symbol_long_normal_s, iki_read_long_replace_s, iki_read_string_two_s); return; @@ -256,7 +296,10 @@ extern "C" { setting->state.status = f_string_maps_increase_by(main->parameters.array[iki_read_parameter_replace_e].values.used / 2, &setting->replace); if (F_status_is_error(setting->state.status)) { - iki_read_print_line_first(setting, main->message); + if ((setting->flag & iki_read_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + iki_read_print_error(setting, main->error, macro_iki_read_f(f_string_maps_increase_by)); return; @@ -291,7 +334,10 @@ extern "C" { } if (F_status_is_error(setting->state.status)) { - iki_read_print_line_first(setting, main->message); + if ((setting->flag & iki_read_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + iki_read_print_error(setting, main->error, macro_iki_read_f(f_string_dynamic_resize)); return; @@ -331,7 +377,10 @@ extern "C" { if ((main->parameters.array[iki_read_parameter_wrap_e].result & f_console_result_found_e) || main->parameters.array[iki_read_parameter_wrap_e].values.used % 3 != 0) { setting->state.status = F_status_set_error(F_parameter); - iki_read_print_line_first(setting, main->error); + if ((setting->flag & iki_read_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + fll_program_print_error_parameter_missing_value_requires_amount(main->error, f_console_symbol_long_normal_s, iki_read_long_wrap_s, iki_read_string_three_s); return; @@ -342,7 +391,10 @@ extern "C" { setting->state.status = f_string_triples_increase_by(main->parameters.array[iki_read_parameter_wrap_e].values.used / 3, &setting->wrap); if (F_status_is_error(setting->state.status)) { - iki_read_print_line_first(setting, main->message); + if ((setting->flag & iki_read_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + iki_read_print_error(setting, main->error, macro_iki_read_f(f_string_triples_increase_by)); return; @@ -381,7 +433,10 @@ extern "C" { } if (F_status_is_error(setting->state.status)) { - iki_read_print_line_first(setting, main->message); + if ((setting->flag & iki_read_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + iki_read_print_error(setting, main->error, macro_iki_read_f(f_string_dynamic_resize)); return; @@ -429,7 +484,10 @@ extern "C" { if (main->parameters.array[ids[i]].result & f_console_result_found_e) { setting->state.status = F_status_set_error(F_parameter); - iki_read_print_line_first(setting, main->error); + if ((setting->flag & iki_read_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, iki_read_long_literal_s, names[i]); return; @@ -454,7 +512,10 @@ extern "C" { if (main->parameters.array[ids[i]].result & f_console_result_found_e) { setting->state.status = F_status_set_error(F_parameter); - iki_read_print_line_first(setting, main->error); + if ((setting->flag & iki_read_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, iki_read_long_object_s, names[i]); return; @@ -467,7 +528,10 @@ extern "C" { if (main->parameters.array[iki_read_parameter_total_e].result & f_console_result_found_e) { setting->state.status = F_status_set_error(F_parameter); - iki_read_print_line_first(setting, main->error); + if ((setting->flag & iki_read_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, iki_read_long_content_s, iki_read_long_total_s); return; @@ -479,7 +543,10 @@ extern "C" { if (main->parameters.array[iki_read_parameter_whole_e].result & f_console_result_found_e) { setting->state.status = F_status_set_error(F_parameter); - iki_read_print_line_first(setting, main->error); + if ((setting->flag & iki_read_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, iki_read_long_total_s, iki_read_long_wrap_s); return; @@ -503,7 +570,10 @@ extern "C" { setting->state.status = f_string_dynamics_resize(main->parameters.remaining.used, &setting->files); if (F_status_is_error(setting->state.status)) { - iki_read_print_line_first(setting, main->message); + if ((setting->flag & iki_read_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + iki_read_print_error(setting, main->error, macro_iki_read_f(f_string_dynamics_resize)); return; @@ -518,7 +588,10 @@ extern "C" { setting->state.status = f_string_dynamic_resize(0, &setting->files.array[setting->files.used]); if (F_status_is_error(setting->state.status)) { - iki_read_print_line_first(setting, main->message); + if ((setting->flag & iki_read_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + iki_read_print_error(setting, main->error, macro_iki_read_f(f_string_dynamic_resize)); return; @@ -534,8 +607,11 @@ extern "C" { setting->state.status = f_file_exists(setting->files.array[setting->files.used], F_true); if (F_status_is_error(setting->state.status)) { - iki_read_print_line_first(setting, main->error); - fll_error_file_print(main->error, F_status_set_fine(setting->state.status), "f_file_exists", fll_error_file_flag_fallback_e, setting->files.array[setting->files.used], f_file_operation_verify_s, fll_error_file_type_file_e); + if ((setting->flag & iki_read_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + + fll_error_file_print(main->error, F_status_set_fine(setting->state.status), macro_iki_read_f(f_file_exists), fll_error_file_flag_fallback_e, setting->files.array[setting->files.used], f_file_operation_verify_s, fll_error_file_type_file_e); return; } @@ -552,7 +628,10 @@ extern "C" { if ((parameter.result & f_console_result_found_e) || parameter.values.used % 3 != 0) { setting->state.status = F_status_set_error(F_parameter); - iki_read_print_line_first(setting, main->error); + if ((setting->flag & iki_read_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + fll_program_print_error_parameter_missing_value_requires_amount(main->error, f_console_symbol_long_normal_s, name, iki_read_string_three_s); return F_false; @@ -563,7 +642,10 @@ extern "C" { setting->state.status = f_string_triples_increase_by(parameter.values.used / 3, triple); if (F_status_is_error(setting->state.status)) { - iki_read_print_line_first(setting, main->message); + if ((setting->flag & iki_read_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + iki_read_print_error(setting, main->error, macro_iki_read_f(f_string_triples_increase_by)); return F_false; @@ -604,7 +686,10 @@ extern "C" { } if (F_status_is_error(setting->state.status)) { - iki_read_print_line_first(setting, main->message); + if ((setting->flag & iki_read_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + iki_read_print_error(setting, main->error, macro_iki_read_f(f_string_dynamic_resize)); return F_false; diff --git a/level_3/iki_read/c/main/common/print.c b/level_3/iki_read/c/main/common/print.c index b11515c..b20020b 100644 --- a/level_3/iki_read/c/main/common/print.c +++ b/level_3/iki_read/c/main/common/print.c @@ -8,6 +8,7 @@ extern "C" { const f_string_t iki_read_f_a[] = { "f_console_parameter_process", "f_file_descriptor", + "f_file_exists", "f_file_read", "f_file_size_by_id", "f_file_stream_open", diff --git a/level_3/iki_read/c/main/common/print.h b/level_3/iki_read/c/main/common/print.h index 742004f..5f3db06 100644 --- a/level_3/iki_read/c/main/common/print.h +++ b/level_3/iki_read/c/main/common/print.h @@ -41,6 +41,7 @@ extern "C" { enum { iki_read_f_f_console_parameter_process_e, iki_read_f_f_file_descriptor_e, + iki_read_f_f_file_exists_e, iki_read_f_f_file_read_e, iki_read_f_f_file_size_by_id_e, iki_read_f_f_file_stream_open_e, diff --git a/level_3/iki_read/c/main/common/type.h b/level_3/iki_read/c/main/common/type.h index 4d36376..e24182b 100644 --- a/level_3/iki_read/c/main/common/type.h +++ b/level_3/iki_read/c/main/common/type.h @@ -51,7 +51,8 @@ extern "C" { * - line: Selecting at a specific line. * - name: Selecting using a specific Vocabulary name. * - object: Print Objects. - * - print_first: When set, the first character printing logic is to be processed (this is usually automatic). + * - print_first: When set, print new line to message output on program begin after loading settings. + * - print_last: When set, print new line to message output on program end. * - replace: Using re-assignments. * - replace: Using replacements. * - substitute: Using substitutions. @@ -72,13 +73,14 @@ extern "C" { iki_read_main_flag_name_e = 0x40, iki_read_main_flag_object_e = 0x80, iki_read_main_flag_print_first_e = 0x100, - iki_read_main_flag_reassign_e = 0x200, - iki_read_main_flag_replace_e = 0x400, - iki_read_main_flag_substitute_e = 0x800, - iki_read_main_flag_total_e = 0x1000, - iki_read_main_flag_version_e = 0x2000, - iki_read_main_flag_whole_e = 0x4000, - iki_read_main_flag_wrap_e = 0x8000, + iki_read_main_flag_print_last_e = 0x200, + iki_read_main_flag_reassign_e = 0x400, + iki_read_main_flag_replace_e = 0x800, + iki_read_main_flag_substitute_e = 0x1000, + iki_read_main_flag_total_e = 0x2000, + iki_read_main_flag_version_e = 0x4000, + iki_read_main_flag_whole_e = 0x8000, + iki_read_main_flag_wrap_e = 0x10000, }; // enum #endif // _di_iki_read_main_flag_e_ @@ -161,9 +163,6 @@ extern "C" { * at: The position representing the "at" index. * line: The position representing the "line" index. * - * 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. - * * buffer: A buffer used for loading the files and other miscellaneous tasks. * name: A string representing the IKI vocabulary name being selected. * files: An array of all files to process (except for the input pipe). @@ -187,9 +186,6 @@ extern "C" { f_array_length_t at; f_array_length_t line; - f_string_static_t line_first; - f_string_static_t line_last; - f_string_dynamic_t buffer; f_string_dynamics_t names; f_string_dynamics_t files; @@ -207,12 +203,10 @@ extern "C" { #define iki_read_setting_t_initialize \ { \ - iki_read_main_flag_print_first_e, \ + iki_read_main_flag_none_e, \ macro_f_state_t_initialize_1(iki_read_allocation_large_d, iki_read_allocation_small_d, F_none, 0, 0, 0, 0, 0, 0), \ 0, \ 0, \ - f_string_static_t_initialize, \ - f_string_static_t_initialize, \ f_string_dynamic_t_initialize, \ f_string_dynamic_t_initialize, \ f_string_dynamics_t_initialize, \ diff --git a/level_3/iki_read/c/main/iki_read.c b/level_3/iki_read/c/main/iki_read.c index 635e1f5..8defe74 100644 --- a/level_3/iki_read/c/main/iki_read.c +++ b/level_3/iki_read/c/main/iki_read.c @@ -10,33 +10,49 @@ extern "C" { if (!main || !setting) return; if (F_status_is_error(setting->state.status)) { - iki_read_print_line_last(setting, main->message); + if ((setting->flag & iki_read_main_flag_print_last_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } return; } + if ((setting->flag & iki_read_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + setting->state.status = F_none; if (setting->flag & iki_read_main_flag_help_e) { iki_read_print_help(setting, main->message); + if ((setting->flag & iki_read_main_flag_print_last_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + return; } if (setting->flag & iki_read_main_flag_version_e) { - fll_program_print_version(main->message, (setting->line_first.used ? 0x1 : 0x0) | (setting->line_last.used ? 0x2 : 0x0), iki_read_program_version_s); + fll_program_print_version(main->message, iki_read_program_version_s); + + if ((setting->flag & iki_read_main_flag_print_last_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } return; } if (setting->flag & iki_read_main_flag_copyright_e) { - fll_program_print_copyright(main->message, (setting->line_first.used ? 0x1 : 0x0) | (setting->line_last.used ? 0x2 : 0x0)); + fll_program_print_copyright(main->message); + + if ((setting->flag & iki_read_main_flag_print_last_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } return; } - iki_read_print_line_first(setting, main->message); - if (main->pipe & fll_program_data_pipe_input_e) { f_file_t file = f_file_t_initialize; @@ -64,7 +80,7 @@ extern "C" { if (!((++main->signal_check) % iki_read_signal_check_d)) { if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); + fll_program_print_signal_received(main->warning, main->signal_received); setting->state.status = F_status_set_error(F_interrupt); @@ -134,7 +150,7 @@ extern "C" { // The signal check is always performed on each pass. if (size_file > iki_read_block_max && fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); + fll_program_print_signal_received(main->warning, main->signal_received); setting->state.status = F_status_set_error(F_interrupt); @@ -168,8 +184,8 @@ extern "C" { } } - if (F_status_is_error(setting->state.status)) { - iki_read_print_line_last(setting, main->message); + if ((setting->flag & iki_read_main_flag_print_last_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); } } #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 61739d6..1da304e 100644 --- a/level_3/iki_read/c/main/print.c +++ b/level_3/iki_read/c/main/print.c @@ -11,8 +11,6 @@ extern "C" { f_file_stream_lock(print.to); - f_print_dynamic_raw(setting->line_first, print.to); - fll_program_print_help_header(print, iki_read_program_name_long_s, iki_read_program_version_s); fll_program_print_help_option_standard(print); @@ -92,8 +90,6 @@ extern "C" { fl_print_format(" The default behavior is to only display Content portion of the IKI Variable.%r", print.to, f_string_eol_s); - f_print_dynamic_raw(setting->line_last, print.to); - f_file_stream_flush(print.to); f_file_stream_unlock(print.to); @@ -101,42 +97,6 @@ extern "C" { } #endif // _di_iki_read_print_help_ -#ifndef _di_iki_read_print_line_first_ - f_status_t iki_read_print_line_first(iki_read_setting_t * const setting, const fl_print_t print) { - - if (!setting) return F_status_set_error(F_output_not); - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; - - if (F_status_is_error_not(setting->state.status)) { - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - } - - if (setting->flag & iki_read_main_flag_print_first_e) { - fll_print_dynamic_raw(setting->line_first, print.to); - - setting->flag -= iki_read_main_flag_print_first_e; - } - - return F_none; - } -#endif // _di_iki_read_print_line_first_ - -#ifndef _di_iki_read_print_line_last_ - f_status_t iki_read_print_line_last(iki_read_setting_t * const setting, const fl_print_t print) { - - if (!setting) return F_status_set_error(F_output_not); - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; - - if (F_status_is_error_not(setting->state.status)) { - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - } - - fll_print_dynamic_raw(setting->line_last, print.to); - - return F_none; - } -#endif // _di_iki_read_print_line_last_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/iki_read/c/main/print.h b/level_3/iki_read/c/main/print.h index aaa969e..29910ae 100644 --- a/level_3/iki_read/c/main/print.h +++ b/level_3/iki_read/c/main/print.h @@ -36,54 +36,6 @@ extern "C" { extern f_status_t iki_read_print_help(iki_read_setting_t * const setting, const fl_print_t print); #endif // _di_iki_read_print_help_ -/** - * Print first new line, unless verbosity says otherwise. - * - * This is generally either the first line in the program or the first line printed before an error message. - * - * This function locks and then unlocks the input stream when printing. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - * - * F_output_not (with error bit) if setting is NULL. - */ -#ifndef _di_iki_read_print_line_first_ - extern f_status_t iki_read_print_line_first(iki_read_setting_t * const setting, const fl_print_t print); -#endif // _di_iki_read_print_line_first_ - -/** - * Print last new line when the main is complete, unless verbosity says otherwise. - * - * This is generally the very last line printed in the program. - * - * This function locks and then unlocks the input stream when printing. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - * - * F_output_not (with error bit) if setting is NULL. - */ -#ifndef _di_iki_read_print_line_last_ - extern f_status_t iki_read_print_line_last(iki_read_setting_t * const setting, const fl_print_t print); -#endif // _di_iki_read_print_line_last_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/iki_read/c/main/process.c b/level_3/iki_read/c/main/process.c index 27f8c55..38a9a84 100644 --- a/level_3/iki_read/c/main/process.c +++ b/level_3/iki_read/c/main/process.c @@ -329,7 +329,7 @@ extern "C" { if (!((++main->signal_check) % iki_read_signal_check_d)) { if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); + fll_program_print_signal_received(main->warning, main->signal_received); f_string_dynamic_resize(0, &name); diff --git a/level_3/iki_write/c/main/common.c b/level_3/iki_write/c/main/common.c index 4a3d5c0..f73f87d 100644 --- a/level_3/iki_write/c/main/common.c +++ b/level_3/iki_write/c/main/common.c @@ -32,8 +32,26 @@ extern "C" { setting->state.step_small = iki_write_allocation_small_d; + // Identify and pocess first/last parameters. + if (main->parameters.array[iki_write_parameter_line_first_no_e].result & f_console_result_found_e) { + setting->flag -= setting->flag & iki_write_main_flag_print_first_e; + } + else { + setting->flag |= iki_write_main_flag_print_first_e; + } + + if (main->parameters.array[iki_write_parameter_line_last_no_e].result & f_console_result_found_e) { + setting->flag -= setting->flag & iki_write_main_flag_print_last_e; + } + else { + setting->flag |= iki_write_main_flag_print_last_e; + } + if (F_status_is_error(setting->state.status)) { - iki_write_print_line_first(setting, main->message); + if ((setting->flag & iki_write_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + iki_write_print_error(setting, main->error, macro_iki_write_f(f_console_parameter_process)); return; @@ -53,27 +71,16 @@ extern "C" { setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, main); if (F_status_is_error(setting->state.status)) { - iki_write_print_line_first(setting, main->message); + if ((setting->flag & iki_write_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + iki_write_print_error(setting, main->error, macro_iki_write_f(fll_program_parameter_process_context)); return; } } - if (main->parameters.array[iki_write_parameter_line_first_no_e].result & f_console_result_found_e) { - setting->line_first = f_string_empty_s; - } - else { - setting->line_first = f_string_eol_s; - } - - if (main->parameters.array[iki_write_parameter_line_last_no_e].result & f_console_result_found_e) { - setting->line_last = f_string_empty_s; - } - else { - setting->line_last = f_string_eol_s; - } - // Identify and prioritize "verbosity" parameters. { uint16_t choices_array[5] = { iki_write_parameter_verbosity_quiet_e, iki_write_parameter_verbosity_error_e, iki_write_parameter_verbosity_verbose_e, iki_write_parameter_verbosity_debug_e, iki_write_parameter_verbosity_normal_e }; @@ -85,7 +92,10 @@ extern "C" { setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); if (F_status_is_error(setting->state.status)) { - iki_write_print_line_first(setting, main->message); + if ((setting->flag & iki_write_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + iki_write_print_error(setting, main->error, macro_iki_write_f(fll_program_parameter_process_verbosity)); return; @@ -119,7 +129,10 @@ extern "C" { if (main->parameters.array[iki_write_parameter_file_e].values.used > 1) { setting->state.status = F_status_set_error(F_parameter); - iki_write_print_line_first(setting, main->message); + if ((setting->flag & iki_write_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + fll_program_print_error_parameter_must_specify_once(main->error, f_console_symbol_long_normal_s, iki_write_long_file_s); return; @@ -133,7 +146,10 @@ extern "C" { setting->state.status = f_file_stream_open(main->parameters.arguments.array[index], f_string_empty_s, &main->output.to); if (F_status_is_error(setting->state.status)) { - iki_write_print_line_first(setting, main->message); + if ((setting->flag & iki_write_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + fll_error_file_print(main->error, F_status_set_fine(setting->state.status), "f_file_stream_open", fll_error_file_flag_fallback_e, main->parameters.arguments.array[index], f_file_operation_open_s, fll_error_file_type_file_e); return; @@ -144,7 +160,10 @@ extern "C" { else if (main->parameters.array[iki_write_parameter_file_e].result & f_console_result_found_e) { setting->state.status = F_status_set_error(F_parameter); - iki_write_print_line_first(setting, main->message); + if ((setting->flag & iki_write_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, iki_write_long_file_s); return; @@ -158,7 +177,10 @@ extern "C" { setting->state.status = f_string_dynamics_resize(values->used, &setting->objects); if (F_status_is_error(setting->state.status)) { - iki_write_print_line_first(setting, main->message); + if ((setting->flag & iki_write_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + iki_write_print_error(setting, main->error, macro_iki_write_f(f_string_dynamics_resize)); return; @@ -179,7 +201,10 @@ extern "C" { else if (main->parameters.array[iki_write_parameter_object_e].result & f_console_result_found_e) { setting->state.status = F_status_set_error(F_parameter); - iki_write_print_line_first(setting, main->message); + if ((setting->flag & iki_write_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, iki_write_long_object_s); return; @@ -193,7 +218,10 @@ extern "C" { setting->state.status = f_string_dynamics_resize(values->used, &setting->contents); if (F_status_is_error(setting->state.status)) { - iki_write_print_line_first(setting, main->message); + if ((setting->flag & iki_write_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + iki_write_print_error(setting, main->error, macro_iki_write_f(f_string_dynamics_resize)); return; @@ -214,7 +242,10 @@ extern "C" { else if (main->parameters.array[iki_write_parameter_content_e].result & f_console_result_found_e) { setting->state.status = F_status_set_error(F_parameter); - iki_write_print_line_first(setting, main->message); + if ((setting->flag & iki_write_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, iki_write_long_content_s); return; @@ -223,7 +254,10 @@ extern "C" { if (!(main->pipe & fll_program_data_pipe_input_e) && !(setting->flag & (iki_write_main_flag_content_e | iki_write_parameter_object_e))) { setting->state.status = F_status_set_error(F_parameter); - iki_write_print_line_first(setting, main->message); + if ((setting->flag & iki_write_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + iki_write_print_error_main_missing(setting, main->error); return; diff --git a/level_3/iki_write/c/main/common/type.h b/level_3/iki_write/c/main/common/type.h index a1be8f8..1b33e1c 100644 --- a/level_3/iki_write/c/main/common/type.h +++ b/level_3/iki_write/c/main/common/type.h @@ -42,7 +42,9 @@ extern "C" { * - file_to: Using a specified destination file. * - help: Print help. * - object: The Object being written is specified. - * - print_first: When set, the first character printing logic is to be processed (this is usually automatic). + * - print_first: When set, print new line to message output on program begin after loading settings. + * - print_last: When set, print new line to message output on program end. + * - print_last: The Object being written is specified. * - version: Print version. * - wrap: Wrap the vocabulary. */ @@ -55,8 +57,9 @@ extern "C" { iki_write_main_flag_help_e = 0x8, iki_write_main_flag_object_e = 0x10, iki_write_main_flag_print_first_e = 0x20, - iki_write_main_flag_version_e = 0x40, - iki_write_main_flag_wrap_e = 0x80, + iki_write_main_flag_print_last_e = 0x40, + iki_write_main_flag_version_e = 0x80, + iki_write_main_flag_wrap_e = 0x100, }; // enum #endif // _di_iki_write_main_flag_e_ @@ -126,9 +129,6 @@ extern "C" { * * state: The state information. * - * 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. - * * quote: This holds the quote used during processing. * * escaped: A buffer used for escaping strings during processing. @@ -145,9 +145,6 @@ extern "C" { f_state_t state; - f_string_static_t line_first; - f_string_static_t line_last; - f_string_static_t quote; f_string_dynamic_t escaped; @@ -161,10 +158,8 @@ extern "C" { #define iki_write_setting_t_initialize \ { \ - iki_write_main_flag_print_first_e, \ + iki_write_main_flag_none_e, \ f_state_t_initialize, \ - 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, \ diff --git a/level_3/iki_write/c/main/iki_write.c b/level_3/iki_write/c/main/iki_write.c index 7db81cf..7484a14 100644 --- a/level_3/iki_write/c/main/iki_write.c +++ b/level_3/iki_write/c/main/iki_write.c @@ -10,33 +10,47 @@ extern "C" { if (!main || !setting) return; if (F_status_is_error(setting->state.status)) { - iki_write_print_line_last(setting, main->message); + if ((setting->flag & iki_write_main_flag_print_last_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } return; } + if ((setting->flag & iki_write_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + setting->state.status = F_none; if (setting->flag & iki_write_main_flag_help_e) { iki_write_print_help(setting, main->message); + if ((setting->flag & iki_write_main_flag_print_last_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + return; } if (setting->flag & iki_write_main_flag_version_e) { - fll_program_print_version(main->message, (setting->line_first.used ? 0x1 : 0x0) | (setting->line_last.used ? 0x2 : 0x0), iki_write_program_version_s); + fll_program_print_version(main->message, iki_write_program_version_s); + + if ((setting->flag & iki_write_main_flag_print_last_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } return; } if (setting->flag & iki_write_main_flag_copyright_e) { - fll_program_print_copyright(main->message, (setting->line_first.used ? 0x1 : 0x0) | (setting->line_last.used ? 0x2 : 0x0)); + fll_program_print_copyright(main->message); - return; - } + if ((setting->flag & iki_write_main_flag_print_last_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } - if (main->message.verbosity > f_console_verbosity_error_e) { - iki_write_print_line_first(setting, main->message); + return; } setting->escaped.used = 0; @@ -63,7 +77,9 @@ extern "C" { if (fll_program_standard_signal_received(main)) { setting->state.status = F_status_set_error(F_interrupt); - return; + object_ended = F_false; + + break; } main->signal_check = 0; @@ -76,18 +92,20 @@ extern "C" { setting->state.status = F_status_set_error(F_pipe); iki_write_print_error_file(setting, main->error, macro_iki_write_f(f_file_read), f_string_ascii_minus_s, f_file_operation_read_s, fll_error_file_type_pipe_e); - iki_write_print_line_last(setting, main->message); - return; + object_ended = F_false; + + break; } if (!setting->buffer.used) { setting->state.status = F_status_set_error(F_parameter); fll_program_print_error_pipe_missing_content(main->error); - iki_write_print_line_last(setting, main->message); - return; + object_ended = F_false; + + break; } range.stop = setting->buffer.used - 1; @@ -103,16 +121,19 @@ extern "C" { if (F_status_is_error(setting->state.status)) { iki_write_print_error(setting, main->error, macro_iki_write_f(f_string_dynamic_seek_to)); - return; + object_ended = F_false; + + break; } if (object_ended && previous == range.start) { setting->state.status = F_status_set_error(F_parameter); fll_program_print_error_pipe_invalid_form_feed(main->error); - iki_write_print_line_last(setting, main->message); - return; + object_ended = F_false; + + break; } range.stop = range.start - 1; @@ -127,12 +148,19 @@ extern "C" { if (F_status_is_error(setting->state.status)) { iki_write_print_error(setting, main->error, macro_iki_write_f(f_string_dynamic_partial_append_nulless)); - return; + object_ended = F_false; + + break; } } iki_write_process(main, setting, setting->object, setting->content); - if (F_status_is_error(setting->state.status)) return; + + if (F_status_is_error(setting->state.status)) { + object_ended = F_false; + + break; + } fll_print_dynamic_raw(f_string_eol_s, main->output.to); @@ -146,7 +174,9 @@ extern "C" { if (F_status_is_error(setting->state.status)) { iki_write_print_error(setting, main->error, macro_iki_write_f(f_string_dynamic_partial_append_nulless)); - return; + object_ended = F_false; + + break; } object_ended = F_true; @@ -168,32 +198,31 @@ extern "C" { setting->state.status = F_status_set_error(F_parameter); fll_program_print_error_pipe_object_without_content(main->error); - iki_write_print_line_last(setting, main->message); - - return; } } - for (f_array_length_t i = 0; i < setting->objects.used; ++i) { + if (F_status_is_error_not(setting->state.status) && F_status_set_fine(setting->state.status) != F_interrupt) { + for (f_array_length_t i = 0; i < setting->objects.used; ++i) { + + if (!((++main->signal_check) % iki_write_signal_check_d)) { + if (fll_program_standard_signal_received(main)) { + setting->state.status = F_status_set_error(F_interrupt); - if (!((++main->signal_check) % iki_write_signal_check_d)) { - if (fll_program_standard_signal_received(main)) { - setting->state.status = F_status_set_error(F_interrupt); + break; + } - break; + main->signal_check = 0; } - main->signal_check = 0; - } - - iki_write_process(main, setting, setting->objects.array[i], setting->contents.array[i]); - if (F_status_is_error(setting->state.status)) break; + iki_write_process(main, setting, setting->objects.array[i], setting->contents.array[i]); + if (F_status_is_error(setting->state.status)) break; - fll_print_dynamic_raw(f_string_eol_s, main->output.to); - } // for + fll_print_dynamic_raw(f_string_eol_s, main->output.to); + } // for + } - if (F_status_is_error(setting->state.status) || main->message.verbosity > f_console_verbosity_error_e) { - iki_write_print_line_last(setting, main->message); + if ((setting->flag & iki_write_main_flag_print_last_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); } } #endif // _di_iki_write_main_ diff --git a/level_3/iki_write/c/main/iki_write.h b/level_3/iki_write/c/main/iki_write.h index c92613a..c500730 100644 --- a/level_3/iki_write/c/main/iki_write.h +++ b/level_3/iki_write/c/main/iki_write.h @@ -56,7 +56,7 @@ #include #include #include -#include +#include #include #ifdef __cplusplus diff --git a/level_3/iki_write/c/main/print.c b/level_3/iki_write/c/main/print.c index 080459f..aab492d 100644 --- a/level_3/iki_write/c/main/print.c +++ b/level_3/iki_write/c/main/print.c @@ -11,8 +11,6 @@ extern "C" { f_file_stream_lock(print.to); - f_print_dynamic_raw(setting->line_first, print.to); - fll_program_print_help_header(print, iki_write_program_name_long_s, iki_write_program_version_s); fll_program_print_help_option(print, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Print this help message."); @@ -51,8 +49,6 @@ extern "C" { fl_print_format(" When piping main to this program, a single form-feed character (\\f) (U+000C) must be used to separate each Object from each Content.%r", print.to, f_string_eol_s); fl_print_format(" Furthermore, each Object must be followed by a Content.%r", print.to, f_string_eol_s); - f_print_dynamic_raw(setting->line_last, print.to); - f_file_stream_flush(print.to); f_file_stream_unlock(print.to); @@ -60,42 +56,6 @@ extern "C" { } #endif // _di_iki_write_print_help_ -#ifndef _di_iki_write_print_line_first_ - f_status_t iki_write_print_line_first(iki_write_setting_t * const setting, const fl_print_t print) { - - if (!setting) return F_status_set_error(F_output_not); - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; - - if (F_status_is_error_not(setting->state.status)) { - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - } - - if (setting->flag & iki_write_main_flag_print_first_e) { - fll_print_dynamic_raw(setting->line_first, print.to); - - setting->flag -= iki_write_main_flag_print_first_e; - } - - return F_none; - } -#endif // _di_iki_write_print_line_first_ - -#ifndef _di_iki_write_print_line_last_ - f_status_t iki_write_print_line_last(iki_write_setting_t * const setting, const fl_print_t print) { - - if (!setting) return F_status_set_error(F_output_not); - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; - - if (F_status_is_error_not(setting->state.status)) { - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - } - - fll_print_dynamic_raw(setting->line_last, print.to); - - return F_none; - } -#endif // _di_iki_write_print_line_last_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/iki_write/c/main/print.h b/level_3/iki_write/c/main/print.h index 2b1c3c3..b6ae2fe 100644 --- a/level_3/iki_write/c/main/print.h +++ b/level_3/iki_write/c/main/print.h @@ -36,54 +36,6 @@ extern "C" { extern f_status_t iki_write_print_help(iki_write_setting_t * const setting, const fl_print_t print); #endif // _di_iki_write_print_help_ -/** - * Print first new line, unless verbosity says otherwise. - * - * This is generally either the first line in the program or the first line printed before an error message. - * - * This function locks and then unlocks the input stream when printing. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - * - * F_output_not (with error bit) if setting is NULL. - */ -#ifndef _di_iki_write_print_line_first_ - extern f_status_t iki_write_print_line_first(iki_write_setting_t * const setting, const fl_print_t print); -#endif // _di_iki_write_print_line_first_ - -/** - * Print last new line when the main is complete, unless verbosity says otherwise. - * - * This is generally the very last line printed in the program. - * - * This function locks and then unlocks the input stream when printing. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - * - * F_output_not (with error bit) if setting is NULL. - */ -#ifndef _di_iki_write_print_line_last_ - extern f_status_t iki_write_print_line_last(iki_write_setting_t * const setting, const fl_print_t print); -#endif // _di_iki_write_print_line_last_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/iki_write/c/main/print/error.c b/level_3/iki_write/c/main/print/error.c index 015a011..e59b5b7 100644 --- a/level_3/iki_write/c/main/print/error.c +++ b/level_3/iki_write/c/main/print/error.c @@ -22,7 +22,6 @@ extern "C" { if (!setting) return F_status_set_error(F_output_not); if (print.verbosity < f_console_verbosity_error_e) return F_output_not; - iki_write_print_line_first(setting, print); fll_error_file_print(print, F_status_set_fine(setting->state.status), function, fll_error_file_flag_fallback_e, name, operation, type); return F_none; diff --git a/level_3/iki_write/c/main/process.c b/level_3/iki_write/c/main/process.c index a25ede5..86d7e86 100644 --- a/level_3/iki_write/c/main/process.c +++ b/level_3/iki_write/c/main/process.c @@ -20,14 +20,12 @@ extern "C" { if (setting->state.status == F_false) { setting->state.status = F_status_set_error(F_failure); - iki_write_print_line_first(setting, main->message); iki_write_print_error_object_not_valid(setting, main->error, object); return; } if (F_status_is_error(setting->state.status)) { - iki_write_print_line_first(setting, main->message); iki_write_print_error(setting, main->error, macro_iki_write_f(f_iki_object_is)); return; @@ -38,7 +36,6 @@ extern "C" { setting->state.status = fll_iki_content_escape(content, setting->quote, &setting->escaped); if (F_status_is_error(setting->state.status)) { - iki_write_print_line_first(setting, main->message); iki_write_print_error(setting, main->error, macro_iki_write_f(fll_iki_content_escape)); return; diff --git a/level_3/status_code/c/fss/status_code.h b/level_3/status_code/c/fss/status_code.h index 48ae7f0..ff6ff29 100644 --- a/level_3/status_code/c/fss/status_code.h +++ b/level_3/status_code/c/fss/status_code.h @@ -49,8 +49,8 @@ #include #include #include -#include -#include +#include +#include #include #ifdef __cplusplus diff --git a/level_3/status_code/c/main/common.c b/level_3/status_code/c/main/common.c index 151417d..dcf1e77 100644 --- a/level_3/status_code/c/main/common.c +++ b/level_3/status_code/c/main/common.c @@ -24,7 +24,26 @@ extern "C" { setting->state.step_small = status_code_allocation_small_d; + // Identify and pocess first/last parameters. + if (main->parameters.array[status_code_parameter_line_first_no_e].result & f_console_result_found_e) { + setting->flag -= setting->flag & status_code_main_flag_print_first_e; + } + else { + setting->flag |= status_code_main_flag_print_first_e; + } + + if (main->parameters.array[status_code_parameter_line_last_no_e].result & f_console_result_found_e) { + setting->flag -= setting->flag & status_code_main_flag_print_last_e; + } + else { + setting->flag |= status_code_main_flag_print_last_e; + } + if (F_status_is_error(setting->state.status)) { + if ((setting->flag & status_code_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + status_code_print_error(setting, main->error, macro_status_code_f(f_console_parameter_process)); return; @@ -44,26 +63,16 @@ extern "C" { setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, main); if (F_status_is_error(setting->state.status)) { + if ((setting->flag & status_code_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + status_code_print_error(setting, main->error, macro_status_code_f(fll_program_parameter_process_context)); return; } } - if (main->parameters.array[status_code_parameter_line_first_no_e].result & f_console_result_found_e) { - setting->line_first = f_string_empty_s; - } - else { - setting->line_first = f_string_eol_s; - } - - if (main->parameters.array[status_code_parameter_line_last_no_e].result & f_console_result_found_e) { - setting->line_last = f_string_empty_s; - } - else { - setting->line_last = f_string_eol_s; - } - // Identify and prioritize "verbosity" parameters. { uint16_t choices_array[5] = { status_code_parameter_verbosity_quiet_e, status_code_parameter_verbosity_error_e, status_code_parameter_verbosity_verbose_e, status_code_parameter_verbosity_debug_e, status_code_parameter_verbosity_normal_e }; @@ -75,6 +84,10 @@ extern "C" { setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); if (F_status_is_error(setting->state.status)) { + if ((setting->flag & status_code_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + status_code_print_error(setting, main->error, macro_status_code_f(fll_program_parameter_process_verbosity)); return; @@ -121,7 +134,10 @@ extern "C" { if (!(setting->flag & status_code_main_flag_number_e)) { setting->state.status = F_status_set_error(F_parameter); - status_code_print_line_first(setting, main->message); + if ((setting->flag & status_code_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + status_code_print_error_cannot_error_warning_number(setting, main->error); return; @@ -131,7 +147,10 @@ extern "C" { if (setting->flag & status_code_main_flag_fine_e) { setting->state.status = F_status_set_error(F_parameter); - status_code_print_line_first(setting, main->message); + if ((setting->flag & status_code_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + 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); return; @@ -140,7 +159,10 @@ extern "C" { else if (setting->flag & status_code_main_flag_warning_e && setting->flag & status_code_main_flag_fine_e) { setting->state.status = F_status_set_error(F_parameter); - status_code_print_line_first(setting, main->message); + if ((setting->flag & status_code_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + 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); return; @@ -149,7 +171,10 @@ extern "C" { if (main->parameters.remaining.used == 0 && !(main->pipe & fll_program_data_pipe_input_e)) { setting->state.status = F_status_set_error(F_parameter); - status_code_print_line_first(setting, main->message); + if ((setting->flag & status_code_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + status_code_print_error_no_status_codes(setting, main->error); return; diff --git a/level_3/status_code/c/main/common/type.h b/level_3/status_code/c/main/common/type.h index cae4619..264e60c 100644 --- a/level_3/status_code/c/main/common/type.h +++ b/level_3/status_code/c/main/common/type.h @@ -51,7 +51,8 @@ extern "C" { * - fine: Check if status is "fine". * - help: Print help. * - number: Operate in number mode. - * - print_first: When set, the first character printing logic is to be processed (this is usually automatic). + * - print_first: When set, print new line to message output on program begin after loading settings. + * - print_last: When set, print new line to message output on program end. * - version: Print version. * - warning: Check if status is "warning". */ @@ -64,8 +65,9 @@ extern "C" { status_code_main_flag_help_e = 0x8, status_code_main_flag_number_e = 0x10, status_code_main_flag_print_first_e = 0x20, - status_code_main_flag_version_e = 0x40, - status_code_main_flag_warning_e = 0x80, + status_code_main_flag_print_last_e = 0x40, + status_code_main_flag_version_e = 0x80, + status_code_main_flag_warning_e = 0x100, }; // enum #endif // _di_status_code_main_flag_e_ @@ -129,9 +131,6 @@ extern "C" { * * state: The state information. * - * 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. - * * status_string_from: A pointer to the status string function (usually either fll_status_string_from() or fll_fss_status_string_from()). * status_string_to: A pointer to the status string function (usually either f_status_string_to() or fll_fss_status_string_to()). * status_string_help_detail: Print additional, more detailed help, in the help page (The setting paramete must be of type status_code_setting_t). @@ -142,9 +141,6 @@ extern "C" { f_state_t state; - f_string_static_t line_first; - f_string_static_t line_last; - const f_string_static_t *program_name; const f_string_static_t *program_name_long; @@ -155,10 +151,8 @@ extern "C" { #define status_code_setting_t_initialize \ { \ - status_code_main_flag_print_first_e, \ + status_code_main_flag_none_e, \ f_state_t_initialize, \ - f_string_static_t_initialize, \ - f_string_static_t_initialize, \ 0, \ 0, \ 0, \ diff --git a/level_3/status_code/c/main/print.c b/level_3/status_code/c/main/print.c index 828f248..a319c37 100644 --- a/level_3/status_code/c/main/print.c +++ b/level_3/status_code/c/main/print.c @@ -11,8 +11,6 @@ extern "C" { f_file_stream_lock(print.to); - f_print_dynamic_raw(setting->line_first, print.to); - fll_program_print_help_header( print, setting->program_name_long @@ -45,8 +43,6 @@ extern "C" { setting->status_string_help_detail(setting, print); } - f_print_dynamic_raw(setting->line_last, print.to); - f_file_stream_flush(print.to); f_file_stream_unlock(print.to); @@ -77,42 +73,6 @@ extern "C" { } #endif // _di_status_code_print_help_detail_ -#ifndef _di_status_code_print_line_first_ - f_status_t status_code_print_line_first(status_code_setting_t * const setting, const fl_print_t print) { - - if (!setting) return F_status_set_error(F_output_not); - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; - - if (F_status_is_error_not(setting->state.status)) { - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - } - - if (setting->flag & status_code_main_flag_print_first_e) { - fll_print_dynamic_raw(setting->line_first, print.to); - - setting->flag -= status_code_main_flag_print_first_e; - } - - return F_none; - } -#endif // _di_status_code_print_line_first_ - -#ifndef _di_status_code_print_line_last_ - f_status_t status_code_print_line_last(status_code_setting_t * const setting, const fl_print_t print) { - - if (!setting) return F_status_set_error(F_output_not); - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; - - if (F_status_is_error_not(setting->state.status)) { - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - } - - fll_print_dynamic_raw(setting->line_last, print.to); - - return F_none; - } -#endif // _di_status_code_print_line_last_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/status_code/c/main/print.h b/level_3/status_code/c/main/print.h index 5a5a728..06802cb 100644 --- a/level_3/status_code/c/main/print.h +++ b/level_3/status_code/c/main/print.h @@ -75,58 +75,6 @@ extern "C" { extern f_status_t status_code_print_help_detail(void * const setting, const fl_print_t print); #endif // _di_status_code_print_help_detail_ -/** - * Print first new line, if applicable, otherwise nothing. - * - * This is generally intended to be used before data prints. - * - * This ensures a first line is printed if the data is the first output to be performed. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - * - * F_output_not (with error bit) if setting is NULL. - * - * @see fll_print_dynamic_raw() - */ -#ifndef _di_status_code_print_line_first_ - extern f_status_t status_code_print_line_first(status_code_setting_t * const setting, const fl_print_t print); -#endif // _di_status_code_print_line_first_ - -/** - * Print last new line when the main is complete, unless verbosity says otherwise. - * - * This is generally the very last line printed in the program. - * - * This function locks and then unlocks the input stream when printing. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - * - * F_output_not (with error bit) if setting is NULL. - * - * @see fll_print_dynamic_raw() - */ -#ifndef _di_status_code_print_line_last_ - extern f_status_t status_code_print_line_last(status_code_setting_t * const setting, const fl_print_t print); -#endif // _di_status_code_print_line_last_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/status_code/c/main/print/error.c b/level_3/status_code/c/main/print/error.c index f097de9..1e7f546 100644 --- a/level_3/status_code/c/main/print/error.c +++ b/level_3/status_code/c/main/print/error.c @@ -10,7 +10,6 @@ extern "C" { if (!setting) return F_status_set_error(F_output_not); if (print.verbosity < f_console_verbosity_error_e) return F_output_not; - status_code_print_line_first(setting, print); fll_error_print(print, F_status_set_fine(setting->state.status), function, fll_error_file_flag_fallback_e); return F_none; diff --git a/level_3/status_code/c/main/print/error.h b/level_3/status_code/c/main/print/error.h index b3af5a5..184701c 100644 --- a/level_3/status_code/c/main/print/error.h +++ b/level_3/status_code/c/main/print/error.h @@ -33,8 +33,6 @@ extern "C" { * F_output_not (with error bit) if setting is NULL. * * @see fll_error_print() - * - * @see status_code_print_line_first() */ #ifndef _di_status_code_print_error_ extern f_status_t status_code_print_error(status_code_setting_t * const setting, const fl_print_t print, const f_string_t function); diff --git a/level_3/status_code/c/main/status_code.c b/level_3/status_code/c/main/status_code.c index 8a37857..66ff959 100644 --- a/level_3/status_code/c/main/status_code.c +++ b/level_3/status_code/c/main/status_code.c @@ -10,13 +10,18 @@ extern "C" { if (!main || !setting) return; if (F_status_is_error(setting->state.status)) { - status_code_print_line_last(setting, main->message); + if ((setting->flag & status_code_main_flag_print_last_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } return; } - if (!setting->status_string_from || !setting->status_string_to) { + if ((setting->flag & status_code_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + if (!setting->status_string_from || !setting->status_string_to) { if (!setting->status_string_from) { status_code_print_error_invalid_callback(setting, main->error, macro_status_code_f(status_string_from)); } @@ -25,6 +30,10 @@ extern "C" { status_code_print_error_invalid_callback(setting, main->error, macro_status_code_f(status_string_to)); } + if ((setting->flag & status_code_main_flag_print_last_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + setting->state.status = F_status_set_error(F_parameter); return; @@ -35,23 +44,31 @@ extern "C" { if (setting->flag & status_code_main_flag_help_e) { status_code_print_help(setting, main->message); + if ((setting->flag & status_code_main_flag_print_last_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + return; } if (setting->flag & status_code_main_flag_version_e) { - fll_program_print_version(main->message, (setting->line_first.used ? 0x1 : 0x0) | (setting->line_last.used ? 0x2 : 0x0), status_code_program_version_s); + fll_program_print_version(main->message, status_code_program_version_s); + + if ((setting->flag & status_code_main_flag_print_last_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } return; } if (setting->flag & status_code_main_flag_copyright_e) { - fll_program_print_copyright(main->message, (setting->line_first.used ? 0x1 : 0x0) | (setting->line_last.used ? 0x2 : 0x0)); + fll_program_print_copyright(main->message); - return; - } + if ((setting->flag & status_code_main_flag_print_last_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } - if (main->message.verbosity > f_console_verbosity_error_e) { - status_code_print_line_first(setting, main->message); + return; } f_status_t status = F_none; @@ -68,13 +85,9 @@ extern "C" { if (!((++main->signal_check) % status_code_signal_check_d)) { if (fll_program_standard_signal_received(main)) { - f_file_stream_unlock(main->output.to); - - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); - setting->state.status = F_status_set_error(F_interrupt); - return; + break; } main->signal_check = 0; @@ -104,13 +117,9 @@ extern "C" { if (!((++main->signal_check) % status_code_signal_check_d)) { if (fll_program_standard_signal_received(main)) { - f_file_stream_unlock(main->output.to); - - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); - setting->state.status = F_status_set_error(F_interrupt); - return; + break; } main->signal_check = 0; @@ -140,13 +149,9 @@ extern "C" { if (!((++main->signal_check) % status_code_signal_check_d)) { if (fll_program_standard_signal_received(main)) { - f_file_stream_unlock(main->output.to); - - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); - setting->state.status = F_status_set_error(F_interrupt); - return; + break; } main->signal_check = 0; @@ -165,8 +170,12 @@ extern "C" { } } - if (F_status_is_error(setting->state.status) || main->message.verbosity > f_console_verbosity_error_e) { - status_code_print_line_last(setting, main->message); + if (setting->state.status == F_status_set_error(F_interrupt)) { + fll_program_print_signal_received(main->warning, main->signal_received); + } + + if ((setting->flag & status_code_main_flag_print_last_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); } } #endif // _di_status_code_main_ diff --git a/level_3/status_code/c/main/status_code.h b/level_3/status_code/c/main/status_code.h index c5fb7d1..e263d11 100644 --- a/level_3/status_code/c/main/status_code.h +++ b/level_3/status_code/c/main/status_code.h @@ -48,8 +48,8 @@ #include #include #include -#include -#include +#include +#include #include #ifdef __cplusplus diff --git a/level_3/utf8/c/main/bytesequence.c b/level_3/utf8/c/main/bytesequence.c index d2747fc..ea0e8e6 100644 --- a/level_3/utf8/c/main/bytesequence.c +++ b/level_3/utf8/c/main/bytesequence.c @@ -81,7 +81,7 @@ extern "C" { if (!((++main->signal_check) % utf8_signal_check_d)) { if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); + fll_program_print_signal_received(main->warning, main->signal_received); setting->state.status = F_interrupt; diff --git a/level_3/utf8/c/main/codepoint.c b/level_3/utf8/c/main/codepoint.c index dde1724..e56a36f 100644 --- a/level_3/utf8/c/main/codepoint.c +++ b/level_3/utf8/c/main/codepoint.c @@ -351,7 +351,7 @@ extern "C" { if (!((++main->signal_check) % utf8_signal_check_d)) { if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); + fll_program_print_signal_received(main->warning, main->signal_received); setting->state.status = F_status_set_error(F_interrupt); diff --git a/level_3/utf8/c/main/common.c b/level_3/utf8/c/main/common.c index b8431b6..558cf9c 100644 --- a/level_3/utf8/c/main/common.c +++ b/level_3/utf8/c/main/common.c @@ -31,8 +31,26 @@ extern "C" { setting->state.step_small = utf8_allocation_small_d; + // Identify and pocess first/last parameters. + if (main->parameters.array[utf8_parameter_line_first_no_e].result & f_console_result_found_e) { + setting->flag -= setting->flag & utf8_main_flag_print_first_e; + } + else { + setting->flag |= utf8_main_flag_print_first_e; + } + + if (main->parameters.array[utf8_parameter_line_last_no_e].result & f_console_result_found_e) { + setting->flag -= setting->flag & utf8_main_flag_print_last_e; + } + else { + setting->flag |= utf8_main_flag_print_last_e; + } + if (F_status_is_error(setting->state.status)) { - utf8_print_line_first(setting, main->message); + if ((setting->flag & utf8_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + utf8_print_error(setting, main->error, macro_utf8_f(f_console_parameter_process)); return; @@ -53,27 +71,16 @@ extern "C" { setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, main); if (F_status_is_error(setting->state.status)) { - utf8_print_line_first(setting, main->message); + if ((setting->flag & utf8_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + utf8_print_error(setting, main->error, macro_utf8_f(fll_program_parameter_process_context)); return; } } - if (main->parameters.array[utf8_parameter_line_first_no_e].result & f_console_result_found_e) { - setting->line_first = f_string_empty_s; - } - else { - setting->line_first = f_string_eol_s; - } - - if (main->parameters.array[utf8_parameter_line_last_no_e].result & f_console_result_found_e) { - setting->line_last = f_string_empty_s; - } - else { - setting->line_last = f_string_eol_s; - } - // Identify and prioritize "verbosity" parameters. { uint16_t choices_array[5] = { utf8_parameter_verbosity_quiet_e, utf8_parameter_verbosity_error_e, utf8_parameter_verbosity_verbose_e, utf8_parameter_verbosity_debug_e, utf8_parameter_verbosity_normal_e }; @@ -85,7 +92,10 @@ extern "C" { setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); if (F_status_is_error(setting->state.status)) { - utf8_print_line_first(setting, main->message); + if ((setting->flag & utf8_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + utf8_print_error(setting, main->error, macro_utf8_f(fll_program_parameter_process_verbosity)); return; @@ -101,7 +111,10 @@ extern "C" { setting->state.status = f_console_parameter_prioritize_right(main->parameters, choices, &choice); if (F_status_is_error(setting->state.status)) { - utf8_print_line_first(setting, main->message); + if ((setting->flag & utf8_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + utf8_print_error(setting, main->error, macro_utf8_f(f_console_parameter_prioritize_right)); return; @@ -127,7 +140,10 @@ extern "C" { setting->state.status = f_console_parameter_prioritize_right(main->parameters, choices, &choice); if (F_status_is_error(setting->state.status)) { - utf8_print_line_first(setting, main->message); + if ((setting->flag & utf8_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + utf8_print_error(setting, main->error, macro_utf8_f(f_console_parameter_prioritize_right)); return; @@ -194,7 +210,10 @@ extern "C" { if (main->parameters.array[utf8_parameter_to_file_e].values.used > 1) { setting->state.status = F_status_set_error(F_parameter); - utf8_print_line_first(setting, main->message); + if ((setting->flag & utf8_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + utf8_print_error_parameter_file_to_too_many(setting, main->error); return; @@ -206,7 +225,10 @@ extern "C" { setting->state.status = f_string_dynamics_increase_by(1, &setting->path_files_to); if (F_status_is_error(setting->state.status)) { - utf8_print_line_first(setting, main->message); + if ((setting->flag & utf8_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + utf8_print_error(setting, main->error, macro_utf8_f(f_string_dynamics_increase_by)); return; @@ -217,7 +239,10 @@ extern "C" { setting->state.status = f_string_dynamic_append_nulless(main->parameters.arguments.array[main->parameters.array[utf8_parameter_to_file_e].values.array[0]], &setting->path_files_to.array[0]); if (F_status_is_error(setting->state.status)) { - utf8_print_line_first(setting, main->message); + if ((setting->flag & utf8_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + utf8_print_error(setting, main->error, macro_utf8_f(f_string_dynamic_append_nulless)); return; @@ -228,6 +253,10 @@ extern "C" { setting->state.status = f_file_stream_open(main->parameters.arguments.array[main->parameters.array[utf8_parameter_to_file_e].values.array[0]], f_file_open_mode_append_s, &main->output.to); if (F_status_is_error(setting->state.status)) { + if ((setting->flag & utf8_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + utf8_print_error_file(setting, main->error, macro_utf8_f(f_file_stream_open), main->parameters.arguments.array[main->parameters.array[utf8_parameter_to_file_e].values.array[0]], f_file_operation_open_s, fll_error_file_type_file_e); return; @@ -236,7 +265,10 @@ extern "C" { setting->flag |= utf8_main_flag_file_to_e; } else { - utf8_print_line_first(setting, main->message); + if ((setting->flag & utf8_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + utf8_print_error_parameter_file_name_empty(setting, main->error, main->parameters.array[utf8_parameter_to_file_e].values.array[0]); setting->state.status = F_status_set_error(F_parameter); @@ -247,7 +279,10 @@ extern "C" { else if (main->parameters.array[utf8_parameter_to_file_e].result & f_console_result_found_e) { setting->state.status = F_status_set_error(F_parameter); - utf8_print_line_first(setting, main->message); + if ((setting->flag & utf8_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, utf8_long_to_file_s); return; @@ -263,7 +298,10 @@ extern "C" { setting->state.status = f_string_dynamics_increase_by(main->parameters.array[utf8_parameter_from_file_e].values.used, &setting->path_files_from); if (F_status_is_error(setting->state.status)) { - utf8_print_line_first(setting, main->message); + if ((setting->flag & utf8_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + utf8_print_error(setting, main->error, macro_utf8_f(f_string_dynamics_increase_by)); return; @@ -282,7 +320,10 @@ extern "C" { setting->state.status = f_string_dynamic_append_nulless(main->parameters.arguments.array[index], &setting->path_files_from.array[i]); if (F_status_is_error(setting->state.status)) { - utf8_print_line_first(setting, main->message); + if ((setting->flag & utf8_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + fll_error_print(main->error, F_status_set_fine(setting->state.status), macro_utf8_f(f_string_dynamic_append_nulless), fll_error_file_flag_fallback_e); break; @@ -298,6 +339,12 @@ extern "C" { } } else { + if (F_status_is_error_not(setting->state.status)) { + if ((setting->flag & utf8_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + } + utf8_print_error_parameter_file_name_empty(setting, main->error, index); if (F_status_is_error_not(setting->state.status)) { @@ -313,7 +360,10 @@ extern "C" { else if (main->parameters.array[utf8_parameter_from_file_e].result & f_console_result_found_e) { setting->state.status = F_status_set_error(F_parameter); - utf8_print_line_first(setting, main->message); + if ((setting->flag & utf8_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, utf8_long_from_file_s); return; @@ -328,7 +378,10 @@ extern "C" { setting->state.status = f_string_dynamics_increase_by(main->parameters.remaining.used, &setting->remaining); if (F_status_is_error(setting->state.status)) { - utf8_print_line_first(setting, main->message); + if ((setting->flag & utf8_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + utf8_print_error(setting, main->error, macro_utf8_f(f_string_dynamics_increase_by)); return; @@ -348,7 +401,10 @@ extern "C" { if (!(main->parameters.array[utf8_parameter_from_file_e].result & f_console_result_found_e) && !((main->pipe & fll_program_data_pipe_input_e) || main->parameters.remaining.used)) { setting->state.status = F_status_set_error(F_parameter); - utf8_print_line_first(setting, main->message); + if ((setting->flag & utf8_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + utf8_print_error_no_from(setting, main->error); return; diff --git a/level_3/utf8/c/main/common/type.h b/level_3/utf8/c/main/common/type.h index 4a2878e..edb03a5 100644 --- a/level_3/utf8/c/main/common/type.h +++ b/level_3/utf8/c/main/common/type.h @@ -71,18 +71,19 @@ extern "C" { * Flags passed to the main function or program. * * utf8_main_flag_*_e: - * - none: No flags set. - * - copyright: Print the copyright. - * - file_from: Using a specified source file. - * - file_to: Using a specified destination file. - * - header: Enable printing of headers. - * - help: Print help. - * - pipe: Use the input pipe. - * - print_first: When set, the first character printing logic is to be processed (this is usually automatic). - * - separate: Enable printing of separators. - * - strip_invalid: Using strip invalid character mode. - * - verify: Using verify mode. - * - version: Print version. + * - none: No flags set. + * - copyright: Print the copyright. + * - file_from: Using a specified source file. + * - file_to: Using a specified destination file. + * - header: Enable printing of headers. + * - help: Print help. + * - pipe: Use the input pipe. + * - print_first: When set, print new line to message output on program begin after loading settings. + * - print_last: When set, print new line to message output on program end. + * - separate: Enable printing of separators. + * - strip_invalid: Using strip invalid character mode. + * - verify: Using verify mode. + * - version: Print version. */ #ifndef _di_utf8_main_flag_e_ enum { @@ -94,10 +95,11 @@ extern "C" { utf8_main_flag_help_e = 0x10, utf8_main_flag_pipe_e = 0x20, utf8_main_flag_print_first_e = 0x40, - utf8_main_flag_separate_e = 0x80, - utf8_main_flag_strip_invalid_e = 0x100, - utf8_main_flag_verify_e = 0x200, - utf8_main_flag_version_e = 0x400, + utf8_main_flag_print_last_e = 0x80, + utf8_main_flag_separate_e = 0x100, + utf8_main_flag_strip_invalid_e = 0x200, + utf8_main_flag_verify_e = 0x400, + utf8_main_flag_version_e = 0x800, }; // enum #endif // _di_utf8_main_flag_e_ @@ -220,9 +222,6 @@ extern "C" { * append: A string to append. A value of NULL results in not appending. * prepend: A string to prepend. A value of NULL results in not prepending. * - * 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. - * * buffer: A buffer to use for printing output (generally for storing a block of input from an input file). * text: A buffer for storing a series of characters for processing (generally for code point processing). * @@ -243,9 +242,6 @@ extern "C" { f_string_static_t append; f_string_static_t prepend; - f_string_static_t line_first; - f_string_static_t line_last; - f_string_dynamic_t buffer; f_string_dynamic_t text; @@ -257,14 +253,12 @@ extern "C" { #define utf8_setting_t_initialize \ { \ utf8_mode_from_bytesequence_e | utf8_mode_to_codepoint_e, \ - utf8_main_flag_print_first_e, \ + utf8_main_flag_none_e, \ f_state_t_initialize, \ f_color_set_t_initialize, \ f_color_set_t_initialize, \ f_string_static_t_initialize, \ f_string_static_t_initialize, \ - f_string_eol_s, \ - f_string_eol_s, \ f_string_dynamic_t_initialize, \ f_string_dynamic_t_initialize, \ f_string_dynamics_t_initialize, \ diff --git a/level_3/utf8/c/main/print.c b/level_3/utf8/c/main/print.c index c007f3c..2c64b50 100644 --- a/level_3/utf8/c/main/print.c +++ b/level_3/utf8/c/main/print.c @@ -11,8 +11,6 @@ extern "C" { f_file_stream_lock(print.to); - f_print_dynamic_raw(setting->line_first, print.to); - fll_program_print_help_header(print, utf8_program_name_long_s, utf8_program_version_s); fll_program_print_help_option_standard(print); @@ -54,8 +52,6 @@ extern "C" { fl_print_format("'%[%r%]' character is printed to represent the combining and the digits are used to represent widths.%r", print.to, print.set->notable, utf8_string_combining_is_s, print.set->notable, f_string_eol_s); fl_print_format(" The combining characters should be considered 1-width by themselves or 0-width when combined.%r", print.to, f_string_eol_s); - f_print_dynamic_raw(setting->line_last, print.to); - f_file_stream_flush(print.to); f_file_stream_unlock(print.to); @@ -63,43 +59,6 @@ extern "C" { } #endif // _di_utf8_print_help_ -#ifndef _di_utf8_print_line_first_ - f_status_t utf8_print_line_first(utf8_setting_t * const setting, const fl_print_t print) { - - if (!setting) return F_status_set_error(F_output_not); - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; - - if (F_status_is_error_not(setting->state.status)) { - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - } - - if (setting->flag & utf8_main_flag_print_first_e) { - fll_print_dynamic_raw(setting->line_first, print.to); - - setting->flag -= utf8_main_flag_print_first_e; - } - - return F_none; - } -#endif // _di_utf8_print_line_first_ - -#ifndef _di_utf8_print_line_last_ - f_status_t utf8_print_line_last(utf8_setting_t * const setting, const fl_print_t print) { - - if (!setting) return F_status_set_error(F_output_not); - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; - - if (F_status_is_error_not(setting->state.status)) { - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - if (setting->flag & (utf8_main_flag_verify_e | utf8_main_flag_file_to_e)) return F_output_not; - } - - fll_print_dynamic_raw(setting->line_last, print.to); - - return F_none; - } -#endif // _di_utf8_print_line_last_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/utf8/c/main/print.h b/level_3/utf8/c/main/print.h index 95f4c9c..a93bad1 100644 --- a/level_3/utf8/c/main/print.h +++ b/level_3/utf8/c/main/print.h @@ -47,58 +47,6 @@ extern "C" { extern f_status_t utf8_print_help(utf8_setting_t * const setting, const fl_print_t print); #endif // _di_utf8_print_help_ -/** - * Print first new line, unless verbosity says otherwise. - * - * This is generally either the first line in the program or the first line printed before an error message. - * - * This function locks and then unlocks the input stream when printing. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - * - * F_output_not (with error bit) if setting is NULL. - * - * @see fll_print_dynamic_raw() - */ -#ifndef _di_utf8_print_line_first_ - extern f_status_t utf8_print_line_first(utf8_setting_t * const setting, const fl_print_t print); -#endif // _di_utf8_print_line_first_ - -/** - * Print last new line when the main is complete, unless verbosity says otherwise. - * - * This is generally the very last line printed in the program. - * - * This function locks and then unlocks the input stream when printing. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - * - * F_output_not (with error bit) if setting is NULL. - * - * @see fll_print_dynamic_raw() - */ -#ifndef _di_utf8_print_line_last_ - extern f_status_t utf8_print_line_last(utf8_setting_t * const setting, const fl_print_t print); -#endif // _di_utf8_print_line_last_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/utf8/c/main/print/data.c b/level_3/utf8/c/main/print/data.c index 289658b..98c2d87 100644 --- a/level_3/utf8/c/main/print/data.c +++ b/level_3/utf8/c/main/print/data.c @@ -215,11 +215,11 @@ extern "C" { f_file_stream_lock(print.to); - if (!setting->line_first.used || index) { - f_print_dynamic_raw(f_string_eol_s, print.to); - } - if (setting->flag & utf8_main_flag_header_e) { + if (index) { + f_print_dynamic_raw(f_string_eol_s, print.to); + } + fl_print_format("%[File%] ", print.to, print.set->title, print.set->title); if (setting->flag & utf8_main_flag_file_to_e) { diff --git a/level_3/utf8/c/main/print/error.c b/level_3/utf8/c/main/print/error.c index a76938c..c18f476 100644 --- a/level_3/utf8/c/main/print/error.c +++ b/level_3/utf8/c/main/print/error.c @@ -23,7 +23,7 @@ extern "C" { if (print.verbosity < f_console_verbosity_error_e) return F_output_not; if (setting->flag & (utf8_main_flag_strip_invalid_e | utf8_main_flag_verify_e)) return F_output_not; - fl_print_format("%[%QFailed to decode character code '%]", print.to, print.set->error, print.prefix, print.set->error); + fl_print_format("%r%[%QFailed to decode character code '%]", print.to, f_string_eol_s, print.set->error, print.prefix, print.set->error); if (invalid.used) { fl_print_format("%[0x", print.to, print.set->notable); @@ -61,7 +61,7 @@ extern "C" { if (print.verbosity < f_console_verbosity_error_e) return F_output_not; if (setting->flag & (utf8_main_flag_strip_invalid_e | utf8_main_flag_verify_e)) return F_output_not; - fl_print_format("%[%QFailed to encode Unicode codepoint '%]", print.to, print.set->error, print.prefix, print.set->error); + fl_print_format("%r%[%QFailed to encode Unicode codepoint '%]", print.to, f_string_eol_s, print.set->error, print.prefix, print.set->error); fl_print_format("%[U+%_U%]", print.to, print.set->notable, codepoint, print.set->notable); if (F_status_set_fine(setting->state.status) == F_utf_not) { @@ -95,7 +95,7 @@ extern "C" { if (!setting) return F_status_set_error(F_output_not); if (print.verbosity < f_console_verbosity_error_e) return F_output_not; - fll_print_format("%[%QNo from sources are specified, please pipe data, designate a file, or add parameters.%]%r", print.to, print.set->error, print.prefix, print.set->error, f_string_eol_s); + fll_print_format("%r%[%QNo from sources are specified, please pipe data, designate a file, or add parameters.%]%r", print.to, f_string_eol_s, print.set->error, print.prefix, print.set->error, f_string_eol_s); return F_none; } diff --git a/level_3/utf8/c/main/process.c b/level_3/utf8/c/main/process.c index 7135aa7..30c3ffa 100644 --- a/level_3/utf8/c/main/process.c +++ b/level_3/utf8/c/main/process.c @@ -28,7 +28,7 @@ extern "C" { if (!((++main->signal_check) % utf8_signal_check_d)) { if (fll_program_standard_signal_received(main)) { - fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received); + fll_program_print_signal_received(main->warning, main->signal_received); setting->state.status = F_status_set_error(F_interrupt); diff --git a/level_3/utf8/c/main/utf8.c b/level_3/utf8/c/main/utf8.c index 31dca55..2f00832 100644 --- a/level_3/utf8/c/main/utf8.c +++ b/level_3/utf8/c/main/utf8.c @@ -10,11 +10,17 @@ extern "C" { if (!main || !setting) return; if (F_status_is_error(setting->state.status)) { - utf8_print_line_last(setting, main->message); + if ((setting->flag & utf8_main_flag_print_last_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } return; } + if ((setting->flag & utf8_main_flag_print_first_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + setting->state.status = F_none; if (setting->flag & utf8_main_flag_help_e) { @@ -24,19 +30,23 @@ extern "C" { } if (setting->flag & utf8_main_flag_version_e) { - fll_program_print_version(main->message, (setting->line_first.used ? 0x1 : 0x0) | (setting->line_last.used ? 0x2 : 0x0), utf8_program_version_s); + fll_program_print_version(main->message, utf8_program_version_s); + + if ((setting->flag & utf8_main_flag_print_last_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } return; } if (setting->flag & utf8_main_flag_copyright_e) { - fll_program_print_copyright(main->message, (setting->line_first.used ? 0x1 : 0x0) | (setting->line_last.used ? 0x2 : 0x0)); + fll_program_print_copyright(main->message); - return; - } + if ((setting->flag & utf8_main_flag_print_last_e) && main->message.verbosity > f_console_verbosity_error_e) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } - if (main->message.verbosity > f_console_verbosity_error_e) { - utf8_print_line_first(setting, main->message); + return; } f_status_t valid = F_true; @@ -121,16 +131,23 @@ extern "C" { } } else { - if (!(setting->flag & (utf8_main_flag_file_to_e | utf8_main_flag_header_e | utf8_main_flag_verify_e))) { - if (!(setting->flag & utf8_main_flag_separate_e)) { - fll_print_dynamic_raw(f_string_eol_s, main->output.to); - } + if (!(setting->flag & (utf8_main_flag_file_to_e | utf8_main_flag_header_e | utf8_main_flag_verify_e | utf8_main_flag_separate_e))) { + fll_print_dynamic_raw(f_string_eol_s, main->output.to); } } } if (F_status_is_error(setting->state.status) && F_status_set_fine(setting->state.status) != F_utf_fragment && F_status_set_fine(setting->state.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) : macro_utf8_f(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; } @@ -163,16 +180,18 @@ extern "C" { } // for } - if (F_status_set_fine(setting->state.status) == F_interrupt) return; - - // Two lines are printed because the normal final end of line is never printed by design. - // If this is an error or the header flag is set, then the normal end of line is printed by design so do not print this second new line. - if (F_status_is_error_not(setting->state.status) && main->message.verbosity > f_console_verbosity_error_e && !(setting->flag & (utf8_main_flag_header_e | utf8_main_flag_separate_e))) { + if ((setting->flag & utf8_main_flag_print_last_e) && main->message.verbosity > f_console_verbosity_error_e) { fll_print_dynamic_raw(f_string_eol_s, main->message.to); - } - utf8_print_line_last(setting, main->message); + // The last line for data is not printed under certain circumstances, but when last line is printed to screen, print an extra last line. + if (F_status_is_error_not(setting->state.status) && F_status_set_fine(setting->state.status) != F_interrupt) { + if (!(setting->flag & (utf8_main_flag_file_to_e | utf8_main_flag_header_e | utf8_main_flag_separate_e))) { + fll_print_dynamic_raw(f_string_eol_s, main->message.to); + } + } + } + if (F_status_set_fine(setting->state.status) == F_interrupt) return; if (F_status_is_error(setting->state.status)) return; if (setting->flag & utf8_main_flag_verify_e) { diff --git a/level_3/utf8/c/main/utf8.h b/level_3/utf8/c/main/utf8.h index 3fedc27..a8147a7 100644 --- a/level_3/utf8/c/main/utf8.h +++ b/level_3/utf8/c/main/utf8.h @@ -62,8 +62,8 @@ #include #include #include -#include -#include +#include +#include #include #ifdef __cplusplus -- 1.8.3.1