From 95b5d5b33cedb0f1c6924cdb89079e3af5ce63c7 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Wed, 22 Feb 2023 00:25:23 -0600 Subject: [PATCH] Progress: Continue work on Featureless Make, focusing on printing. There might be a problem with any code that prints the error messages as non-errors with these changes. I need to follow up once I am done with the print re-organization and make sure any non-error error printing still works. --- build/stand_alone/fake.settings | 14 +- build/stand_alone/utf8.settings | 6 +- 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/fake.h | 2 + level_3/fake/c/main/fake/path_generate.h | 4 + level_3/fake/c/main/fake/print.h | 4 + level_3/fake/c/main/make/operate.c | 8 +- level_3/fake/c/main/make/operate_process.c | 3 +- level_3/fake/c/main/make/operate_process_type.c | 51 +- level_3/fake/c/main/make/operate_validate_type.c | 30 +- level_3/fake/c/main/make/print-error.c | 138 ++-- level_3/fake/c/main/make/print-error.h | 52 -- level_3/fake/c/main/make/print-verbose.c | 226 ++++++ level_3/fake/c/main/make/print-verbose.h | 314 +++++++++ level_3/fake/c/main/make/print-warning.c | 78 +-- level_3/fake/c/main/make/print-warning.h | 60 -- level_3/fake/c/main/make/print.c | 209 ------ level_3/fake/c/main/make/print.h | 321 --------- level_3/fake/c/main/print-error.c | 657 ++++++++++++++++++ level_3/fake/c/main/print-error.h | 750 ++++++++++++++++++++ .../c/main/{private-common.c => print-warning.c} | 1 - level_3/fake/c/main/print-warning.h | 23 + level_3/fake/c/main/print.c | 756 ++------------------- level_3/fake/c/main/print.h | 688 +++++-------------- level_3/fake/c/main/private-common.h | 19 - level_3/fake/c/main/private-fake.c | 12 - level_3/fake/c/main/private-fake.h | 19 - level_3/fake/c/main/private-print.c | 11 - level_3/fake/c/main/private-print.h | 19 - level_3/fake/data/build/settings | 8 +- 31 files changed, 2351 insertions(+), 2132 deletions(-) create mode 100644 level_3/fake/c/main/common/print-error.c create mode 100644 level_3/fake/c/main/common/print-error.h create mode 100644 level_3/fake/c/main/make/print-verbose.c create mode 100644 level_3/fake/c/main/make/print-verbose.h create mode 100644 level_3/fake/c/main/print-error.c create mode 100644 level_3/fake/c/main/print-error.h rename level_3/fake/c/main/{private-common.c => print-warning.c} (78%) create mode 100644 level_3/fake/c/main/print-warning.h delete mode 100644 level_3/fake/c/main/private-common.h delete mode 100644 level_3/fake/c/main/private-fake.c delete mode 100644 level_3/fake/c/main/private-fake.h delete mode 100644 level_3/fake/c/main/private-print.c delete mode 100644 level_3/fake/c/main/private-print.h diff --git a/build/stand_alone/fake.settings b/build/stand_alone/fake.settings index 15179dd..61673a7 100644 --- a/build/stand_alone/fake.settings +++ b/build/stand_alone/fake.settings @@ -67,13 +67,13 @@ build_sources_program fll/level_2/path.c build_sources_program fll/level_2/print.c build_sources_program fll/level_2/program.c fll/level_2/program/common.c fll/level_2/program/print.c fll/level_2/private-program.c -build_sources_library program/fake/main/build.c program/fake/main/clean.c program/fake/main/common.c program/fake/main/fake.c program/fake/main/make.c program/fake/main/print.c program/fake/main/private-common.c program/fake/main/private-fake.c program/fake/main/private-print.c program/fake/main/skeleton.c -build_sources_library program/fake/main/build/library.c program/fake/main/build/load.c program/fake/main/build/object.c program/fake/main/build/objects.c program/fake/main/build/print.c program/fake/main/build/program.c program/fake/main/build/skeleton.c -build_sources_library program/fake/main/clean/print.c -build_sources_library program/fake/main/common/define.c program/fake/main/common/enumeration.c program/fake/main/common/print.c program/fake/main/common/string.c program/fake/main/common/type.c -build_sources_library program/fake/main/fake/path_generate.c program/fake/main/fake/print.c -build_sources_library program/fake/main/make/load_fakefile.c program/fake/main/make/load_parameters.c program/fake/main/make/operate_block.c program/fake/main/make/operate.c program/fake/main/make/operate_process.c program/fake/main/make/operate_process_type.c program/fake/main/make/operate_validate.c program/fake/main/make/operate_validate_type.c program/fake/main/make/print.c program/fake/main/make/print-error.c program/fake/main/make/print-warning.c -build_sources_library program/fake/main/skeleton/print.c +build_sources_program program/fake/main/build.c program/fake/main/clean.c program/fake/main/common.c program/fake/main/fake.c program/fake/main/make.c program/fake/main/print.c program/fake/main/print-error.c program/fake/main/print-warning.c program/fake/main/skeleton.c +build_sources_program program/fake/main/build/library.c program/fake/main/build/load.c program/fake/main/build/object.c program/fake/main/build/objects.c program/fake/main/build/print.c program/fake/main/build/program.c program/fake/main/build/skeleton.c +build_sources_program program/fake/main/clean/print.c +build_sources_program program/fake/main/common/define.c program/fake/main/common/enumeration.c program/fake/main/common/print.c program/fake/main/common/string.c program/fake/main/common/type.c +build_sources_program program/fake/main/fake/path_generate.c program/fake/main/fake/print.c +build_sources_program program/fake/main/make/load_fakefile.c program/fake/main/make/load_parameters.c program/fake/main/make/operate_block.c program/fake/main/make/operate.c program/fake/main/make/operate_process.c program/fake/main/make/operate_process_type.c program/fake/main/make/operate_validate.c program/fake/main/make/operate_validate_type.c program/fake/main/make/print.c program/fake/main/make/print-error.c program/fake/main/make/print-verbose.c program/fake/main/make/print-warning.c +build_sources_program program/fake/main/skeleton/print.c build_sources_program program/fake/main/main.c diff --git a/build/stand_alone/utf8.settings b/build/stand_alone/utf8.settings index 51f52e9..6cfabbb 100644 --- a/build/stand_alone/utf8.settings +++ b/build/stand_alone/utf8.settings @@ -35,9 +35,9 @@ build_sources_program fll/level_0/string.c fll/level_0/private-string.c fll/leve build_sources_program fll/level_0/string/dynamic.c fll/level_0/string/dynamics.c fll/level_0/string/dynamicss.c fll/level_0/string/map.c fll/level_0/string/maps.c fll/level_0/string/mapss.c fll/level_0/string/map_multi.c fll/level_0/string/map_multis.c fll/level_0/string/map_multiss.c fll/level_0/string/quantity.c fll/level_0/string/quantitys.c fll/level_0/string/quantityss.c fll/level_0/string/range.c fll/level_0/string/ranges.c fll/level_0/string/rangess.c fll/level_0/string/static.c fll/level_0/string/statics.c fll/level_0/string/staticss.c fll/level_0/string/triple.c fll/level_0/string/triples.c fll/level_0/string/tripless.c build_sources_program fll/level_0/type_array/array_length.c fll/level_0/type_array/cell.c fll/level_0/type_array/fll_id.c fll/level_0/type_array/int8.c fll/level_0/type_array/int16.c fll/level_0/type_array/int32.c fll/level_0/type_array/int64.c fll/level_0/type_array/int128.c fll/level_0/type_array/state.c fll/level_0/type_array/status.c fll/level_0/type_array/uint8.c fll/level_0/type_array/uint16.c fll/level_0/type_array/uint32.c fll/level_0/type_array/uint64.c fll/level_0/type_array/uint128.c build_sources_program fll/level_0/type_array/private-array_length.c fll/level_0/type_array/private-cell.c fll/level_0/type_array/private-fll_id.c fll/level_0/type_array/private-int8.c fll/level_0/type_array/private-int16.c fll/level_0/type_array/private-int32.c fll/level_0/type_array/private-int64.c fll/level_0/type_array/private-int128.c fll/level_0/type_array/private-state.c fll/level_0/type_array/private-status.c fll/level_0/type_array/private-uint8.c fll/level_0/type_array/private-uint16.c fll/level_0/type_array/private-uint32.c fll/level_0/type_array/private-uint64.c fll/level_0/type_array/private-uint128.c -build_sources_library fll/level_0/utf.c fll/level_0/private-utf.c fll/level_0/private-utf_alphabetic.c fll/level_0/private-utf_combining.c fll/level_0/private-utf_control.c fll/level_0/private-utf_digit.c fll/level_0/private-utf_emoji.c fll/level_0/private-utf_numeric.c fll/level_0/private-utf_phonetic.c fll/level_0/private-utf_private.c fll/level_0/private-utf_punctuation.c fll/level_0/private-utf_subscript.c fll/level_0/private-utf_superscript.c fll/level_0/private-utf_symbol.c fll/level_0/private-utf_unassigned.c fll/level_0/private-utf_valid.c fll/level_0/private-utf_whitespace.c fll/level_0/private-utf_wide.c fll/level_0/private-utf_word.c fll/level_0/private-utf_zero_width.c -build_sources_library fll/level_0/utf/common.c fll/level_0/utf/convert.c fll/level_0/utf/dynamic.c fll/level_0/utf/dynamics.c fll/level_0/utf/dynamicss.c fll/level_0/utf/is.c fll/level_0/utf/is_character.c fll/level_0/utf/map.c fll/level_0/utf/maps.c fll/level_0/utf/mapss.c fll/level_0/utf/map_multi.c fll/level_0/utf/map_multis.c fll/level_0/utf/map_multiss.c fll/level_0/utf/static.c fll/level_0/utf/statics.c fll/level_0/utf/staticss.c fll/level_0/utf/string.c fll/level_0/utf/triple.c fll/level_0/utf/triples.c fll/level_0/utf/tripless.c -build_sources_library fll/level_0/utf/private-dynamic.c fll/level_0/utf/private-dynamics.c fll/level_0/utf/private-dynamicss.c fll/level_0/utf/private-maps.c fll/level_0/utf/private-mapss.c fll/level_0/utf/private-map_multis.c fll/level_0/utf/private-map_multiss.c fll/level_0/utf/private-string.c fll/level_0/utf/private-triples.c fll/level_0/utf/private-tripless.c +build_sources_program fll/level_0/utf.c fll/level_0/private-utf.c fll/level_0/private-utf_alphabetic.c fll/level_0/private-utf_combining.c fll/level_0/private-utf_control.c fll/level_0/private-utf_digit.c fll/level_0/private-utf_emoji.c fll/level_0/private-utf_numeric.c fll/level_0/private-utf_phonetic.c fll/level_0/private-utf_private.c fll/level_0/private-utf_punctuation.c fll/level_0/private-utf_subscript.c fll/level_0/private-utf_superscript.c fll/level_0/private-utf_symbol.c fll/level_0/private-utf_unassigned.c fll/level_0/private-utf_valid.c fll/level_0/private-utf_whitespace.c fll/level_0/private-utf_wide.c fll/level_0/private-utf_word.c fll/level_0/private-utf_zero_width.c +build_sources_program fll/level_0/utf/common.c fll/level_0/utf/convert.c fll/level_0/utf/dynamic.c fll/level_0/utf/dynamics.c fll/level_0/utf/dynamicss.c fll/level_0/utf/is.c fll/level_0/utf/is_character.c fll/level_0/utf/map.c fll/level_0/utf/maps.c fll/level_0/utf/mapss.c fll/level_0/utf/map_multi.c fll/level_0/utf/map_multis.c fll/level_0/utf/map_multiss.c fll/level_0/utf/static.c fll/level_0/utf/statics.c fll/level_0/utf/staticss.c fll/level_0/utf/string.c fll/level_0/utf/triple.c fll/level_0/utf/triples.c fll/level_0/utf/tripless.c +build_sources_program fll/level_0/utf/private-dynamic.c fll/level_0/utf/private-dynamics.c fll/level_0/utf/private-dynamicss.c fll/level_0/utf/private-maps.c fll/level_0/utf/private-mapss.c fll/level_0/utf/private-map_multis.c fll/level_0/utf/private-map_multiss.c fll/level_0/utf/private-string.c fll/level_0/utf/private-triples.c fll/level_0/utf/private-tripless.c build_sources_program fll/level_1/conversion.c fll/level_1/private-conversion.c fll/level_1/conversion/common.c build_sources_program fll/level_1/print.c fll/level_1/private-print.c fll/level_1/print/common.c diff --git a/level_3/fake/c/main/common/print-error.c b/level_3/fake/c/main/common/print-error.c new file mode 100644 index 0000000..e69de29 diff --git a/level_3/fake/c/main/common/print-error.h b/level_3/fake/c/main/common/print-error.h new file mode 100644 index 0000000..e69de29 diff --git a/level_3/fake/c/main/fake.h b/level_3/fake/c/main/fake.h index 0195781..6d3649b 100644 --- a/level_3/fake/c/main/fake.h +++ b/level_3/fake/c/main/fake.h @@ -97,6 +97,8 @@ #include #include #include +#include +#include #ifdef __cplusplus extern "C" { diff --git a/level_3/fake/c/main/fake/path_generate.h b/level_3/fake/c/main/fake/path_generate.h index 9cdc5a7..c27f8f6 100644 --- a/level_3/fake/c/main/fake/path_generate.h +++ b/level_3/fake/c/main/fake/path_generate.h @@ -4,6 +4,10 @@ * Project: Featureless Make * API Version: 0.7 * Licenses: lgpl-2.1-or-later + * + * Provides the path generate functionality for the fake program. + * + * This is to be specifically included by the fake program sources and not anywhere else. */ #ifndef _fake_fake_path_generate_h #define _fake_fake_path_generate_h diff --git a/level_3/fake/c/main/fake/print.h b/level_3/fake/c/main/fake/print.h index 9baf775..bf45bcc 100644 --- a/level_3/fake/c/main/fake/print.h +++ b/level_3/fake/c/main/fake/print.h @@ -4,6 +4,10 @@ * Project: Featureless Make * API Version: 0.7 * Licenses: lgpl-2.1-or-later + * + * Provides the print functionality for the fake program. + * + * This is to be specifically included by the fake program sources and not anywhere else. */ #ifndef _fake_fake_print_h #define _fake_fake_print_h diff --git a/level_3/fake/c/main/make/operate.c b/level_3/fake/c/main/make/operate.c index fc3aa80..b9b2444 100644 --- a/level_3/fake/c/main/make/operate.c +++ b/level_3/fake/c/main/make/operate.c @@ -1355,13 +1355,13 @@ extern "C" { } // for if (!state_process.operation) { - fake_print_message_section_operation_unknown(data_make->setting, data_make->error, data_make->buffer, section->name, section->objects.array[i]); + fake_print_error_operation_unknown(data_make->setting, data_make->error, data_make->buffer, section->name, section->objects.array[i]); *status = F_status_set_error(F_valid_not); } else if (state_process.operation == fake_make_operation_type_operate_e) { if (section_stack->used == fake_common_max_stack_d) { - fake_print_message_section_operation_stack_max(data_make->setting, data_make->error, data_make->buffer, section->name, section->objects.array[i], fake_common_max_stack_d); + fake_print_error_operation_stack_max(data_make->setting, data_make->error, data_make->buffer, section->name, section->objects.array[i], fake_common_max_stack_d); *status = F_status_set_error(F_recurse); } @@ -1411,7 +1411,7 @@ extern "C" { data_make->error.set = &data_make->main->context.set; } - fake_print_message_section_operation_failed(data_make->setting, data_make->error, data_make->buffer, section->name, section->objects.array[i]); + fake_print_error_operation_failed(data_make->setting, data_make->error, data_make->buffer, section->name, section->objects.array[i]); // F_signal_abort is used by the break section operation. if (F_status_set_fine(*status) == F_signal_abort) break; @@ -1462,7 +1462,7 @@ extern "C" { if (i == section->objects.used && F_status_is_error_not(*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_print_message_section_operation_failed(data_make->setting, data_make->error, data_make->buffer, section->name, section->objects.array[section->objects.used - 1]); + fake_print_error_operation_failed(data_make->setting, data_make->error, data_make->buffer, section->name, section->objects.array[section->objects.used - 1]); *status = F_status_set_error(F_failure); } diff --git a/level_3/fake/c/main/make/operate_process.c b/level_3/fake/c/main/make/operate_process.c index 69c25e6..4d4c959 100644 --- a/level_3/fake/c/main/make/operate_process.c +++ b/level_3/fake/c/main/make/operate_process.c @@ -8,6 +8,7 @@ #include "operate_process_type.h" #include "print.h" #include "print-error.h" +#include "print-verbose.h" #ifdef __cplusplus extern "C" { @@ -322,7 +323,7 @@ extern "C" { } } - fake_make_print_operate_program_verbose(data_make->setting, data_make->main->message, program, arguments); + fake_make_print_verbose_operate_program(data_make->setting, data_make->main->message, program, arguments); // Child processes should receive all signals, without blocking. f_signal_how_t signals = f_signal_how_t_initialize; 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 eb82cf9..2ae1f15 100644 --- a/level_3/fake/c/main/make/operate_process_type.c +++ b/level_3/fake/c/main/make/operate_process_type.c @@ -9,6 +9,7 @@ #include "operate_process_type.h" #include "print.h" #include "print-error.h" +#include "print-verbose.h" #include "print-warning.h" #ifdef __cplusplus @@ -30,7 +31,7 @@ extern "C" { return F_none; } - fake_make_print_operate_break_verbose(data_make->setting, data_make->main->message, data_make->cache_arguments); + fake_make_print_verbose_operate_break(data_make->setting, data_make->main->message, data_make->cache_arguments); return status; } @@ -319,7 +320,7 @@ extern "C" { return F_status_set_error(F_failure); } - fake_make_print_operate_copy_verbose(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->main->message, clone, data_make->cache_arguments.array[i], destination); } else if (F_status_is_error(status_file)) { fake_print_error_file(data_make->setting, data_make->main->error, status_file, macro_fake_f(f_directory_is), data_make->cache_arguments.array[i], f_file_operation_identify_s, fll_error_file_type_directory_e); @@ -348,7 +349,7 @@ extern "C" { fake_print_error(data_make->setting, data_make->main->error, status, macro_fake_f(f_environment_set)); } else { - fake_make_print_operate_define_verbose(data_make->setting, data_make->main->message, data_make->cache_arguments.array[0]); + fake_make_print_verbose_operate_define(data_make->setting, data_make->main->message, data_make->cache_arguments.array[0]); } return status; @@ -390,7 +391,7 @@ extern "C" { } if (F_status_set_fine(status) == F_file_found_not) { - fake_make_print_operate_file_not_found_verbose(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->main->message, F_true, data_make->cache_arguments.array[i]); status = F_none; } @@ -406,7 +407,7 @@ extern "C" { if (F_status_set_fine(status) == F_file_found_not) { if (data_make->main->error.verbosity >= f_console_verbosity_verbose_e) { - fake_make_print_operate_file_not_found_verbose(data_make->setting, data_make->main->message, F_false, data_make->cache_arguments.array[i]); + fake_make_print_verbose_operate_file_not_found(data_make->setting, data_make->main->message, F_false, data_make->cache_arguments.array[i]); } status = F_none; @@ -419,7 +420,7 @@ extern "C" { } } - fake_make_print_operate_delete_verbose(data_make->setting, data_make->main->message, data_make->cache_arguments.array[i]); + fake_make_print_verbose_operate_delete(data_make->setting, data_make->main->message, data_make->cache_arguments.array[i]); } // for return F_none; @@ -451,7 +452,7 @@ extern "C" { return F_none; } - fake_make_print_operate_exiting_as_verbose(data_make->setting, data_make->main->message, data_make->cache_arguments); + fake_make_print_verbose_operate_exiting_as(data_make->setting, data_make->main->message, data_make->cache_arguments); return status; } @@ -486,7 +487,7 @@ extern "C" { data_make->main->error.to.id = -1; } - fake_make_print_operate_set_failure_state_verbose(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->main->message, data_make->setting_make.fail); } #endif // _di_fake_make_operate_process_type_fail_ @@ -512,7 +513,7 @@ extern "C" { status = fake_make_assure_inside_project(data_make, data_make->cache_arguments.array[i]); if (F_status_is_error(status)) { - fake_print_message_section_operation_path_outside(data_make->setting, data_make->error, status, macro_fake_f(fake_make_assure_inside_project), data_make->cache_path.used ? data_make->cache_path : data_make->cache_arguments.array[i]); + fake_print_error_operation_path_outside(data_make->setting, data_make->error, status, macro_fake_f(fake_make_assure_inside_project), data_make->cache_path.used ? data_make->cache_path : data_make->cache_arguments.array[i]); continue; } @@ -530,7 +531,7 @@ extern "C" { return F_status_set_error(F_failure); } - fake_make_print_operate_set_role_verbose(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->main->message, all ? 0x1 : 0x0, data_make->cache_arguments.array[i], (f_number_unsigned_t) id); } // for return F_none; @@ -1295,7 +1296,7 @@ extern "C" { return F_status_set_error(F_failure); } - fake_make_print_operate_symbolic_link_verbose(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->main->message, data_make->cache_arguments.array[data_make->cache_arguments.used - 1], data_make->cache_arguments.array[0]); return F_none; } @@ -1351,7 +1352,7 @@ extern "C" { return F_status_set_error(F_failure); } - fake_make_print_operate_set_mode_verbose(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->main->message, data_make->cache_arguments.array[i], mode); } // for return F_none; @@ -1498,7 +1499,7 @@ extern "C" { status = fake_make_assure_inside_project(data_make, data_make->cache_arguments.array[i]); if (F_status_is_error(status)) { - fake_print_message_section_operation_path_outside(data_make->setting, data_make->error, status, macro_fake_f(fake_make_assure_inside_project), data_make->cache_path.used ? data_make->cache_path : data_make->cache_arguments.array[i]); + fake_print_error_operation_path_outside(data_make->setting, data_make->error, status, macro_fake_f(fake_make_assure_inside_project), data_make->cache_path.used ? data_make->cache_path : data_make->cache_arguments.array[i]); continue; } @@ -1516,7 +1517,7 @@ extern "C" { return F_status_set_error(F_failure); } - fake_make_print_operate_set_role_verbose(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->main->message, all ? 0x3 : 0x2, data_make->cache_arguments.array[i], (f_number_unsigned_t) id); } // for return F_none; @@ -1623,7 +1624,7 @@ extern "C" { f_status_t status = f_path_change(*argument); if (F_status_is_error(status)) { - fake_print_message_section_operation_path_stack_max(data_make->setting, data_make->error, F_status_set_fine(status), macro_fake_f(f_path_change), *argument); + fake_print_error_operation_path_stack_max(data_make->setting, data_make->error, F_status_set_fine(status), macro_fake_f(f_path_change), *argument); return F_status_set_error(F_failure); } @@ -1635,12 +1636,12 @@ extern "C" { if (F_status_is_error(status)) { fake_print_error(data_make->setting, data_make->main->error, status, macro_fake_f(fake_make_path_relative)); - fake_make_print_operate_set_path_verbose(data_make->setting, data_make->main->message, *argument); + fake_make_print_verbose_operate_set_path(data_make->setting, data_make->main->message, *argument); return F_status_set_error(F_failure); } - fake_make_print_operate_set_path_verbose(data_make->setting, data_make->main->message, data_make->cache_path); + fake_make_print_verbose_operate_set_path(data_make->setting, data_make->main->message, data_make->cache_path); } return F_none; @@ -1723,7 +1724,7 @@ extern "C" { f_status_t status = fake_make_assure_inside_project(data_make, data_make->cache_arguments.array[0]); if (F_status_is_error(status)) { - fake_print_message_section_operation_path_outside(data_make->setting, data_make->error, status, macro_fake_f(fake_make_assure_inside_project), data_make->cache_path.used ? data_make->cache_path : data_make->cache_arguments.array[0]); + fake_print_error_operation_path_outside(data_make->setting, data_make->error, status, macro_fake_f(fake_make_assure_inside_project), data_make->cache_path.used ? data_make->cache_path : data_make->cache_arguments.array[0]); if (F_status_set_fine(status) == F_false) { status = F_status_set_error(F_failure); @@ -1735,14 +1736,14 @@ extern "C" { status = f_path_change(data_make->cache_arguments.array[0]); if (F_status_is_error(status)) { - fake_print_message_section_operation_path_stack_max(data_make->setting, data_make->error, F_status_set_fine(status), macro_fake_f(f_path_change), data_make->cache_arguments.array[0]); + fake_print_error_operation_path_stack_max(data_make->setting, data_make->error, F_status_set_fine(status), macro_fake_f(f_path_change), data_make->cache_arguments.array[0]); } else { status = f_string_dynamics_increase_by(fake_default_allocation_small_d, &data_make->path.stack); if (F_status_is_error(status)) { if (F_status_set_fine(status) == F_array_too_large) { - fake_print_message_section_operation_path_stack_max(data_make->setting, data_make->error, F_array_too_large, macro_fake_f(f_string_dynamics_increase_by), fake_common_file_path_stack_s); + fake_print_error_operation_path_stack_max(data_make->setting, data_make->error, F_array_too_large, macro_fake_f(f_string_dynamics_increase_by), fake_common_file_path_stack_s); return F_status_set_error(F_failure); } @@ -1770,10 +1771,10 @@ extern "C" { if (F_status_is_error(status)) { fake_print_error(data_make->setting, data_make->main->error, status, macro_fake_f(fake_make_path_relative)); - fake_make_print_operate_set_path_verbose(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->main->message, data_make->path.stack.array[data_make->path.stack.used]); } else { - fake_make_print_operate_set_path_verbose(data_make->setting, data_make->main->message, data_make->cache_path); + fake_make_print_verbose_operate_set_path(data_make->setting, data_make->main->message, data_make->cache_path); } } @@ -1791,13 +1792,13 @@ extern "C" { f_status_t status = f_path_change_at(data_make->path.top.id); if (F_status_is_error(status)) { - fake_print_message_section_operation_path_stack_max(data_make->setting, data_make->error, F_status_set_fine(status), macro_fake_f(f_path_change), data_make->cache_arguments.array[0]); + fake_print_error_operation_path_stack_max(data_make->setting, data_make->error, F_status_set_fine(status), macro_fake_f(f_path_change), data_make->cache_arguments.array[0]); return F_status_set_error(F_failure); } } - fake_make_print_operate_set_path_verbose(data_make->setting, data_make->main->message, f_string_empty_s); + fake_make_print_verbose_operate_set_path(data_make->setting, data_make->main->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) { @@ -1849,7 +1850,7 @@ extern "C" { } } - fake_make_print_operate_touch_verbose(data_make->setting, data_make->main->message, data_make->cache_arguments.array[i]); + fake_make_print_verbose_operate_touch(data_make->setting, data_make->main->message, data_make->cache_arguments.array[i]); } // for return F_none; 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 3e0e79b..0a4f676 100644 --- a/level_3/fake/c/main/make/operate_validate_type.c +++ b/level_3/fake/c/main/make/operate_validate_type.c @@ -97,7 +97,7 @@ extern "C" { status_file = fake_make_assure_inside_project(data_make, data_make->cache_arguments.array[i]); if (F_status_is_error(status_file)) { - fake_print_message_section_operation_path_outside(data_make->setting, data_make->error, F_status_set_fine(status_file), macro_fake_f(fake_make_assure_inside_project), data_make->cache_path.used ? data_make->cache_path : data_make->cache_arguments.array[i]); + fake_print_error_operation_path_outside(data_make->setting, data_make->error, F_status_set_fine(status_file), macro_fake_f(fake_make_assure_inside_project), data_make->cache_path.used ? data_make->cache_path : data_make->cache_arguments.array[i]); status = F_status_set_error(F_failure); } @@ -504,7 +504,7 @@ extern "C" { status_file = fake_make_assure_inside_project(data_make, data_make->cache_arguments.array[i]); if (F_status_is_error(status_file)) { - fake_print_message_section_operation_path_outside(data_make->setting, data_make->error, F_status_set_fine(status_file), macro_fake_f(fake_make_assure_inside_project), data_make->cache_path.used ? data_make->cache_path : data_make->cache_arguments.array[i]); + fake_print_error_operation_path_outside(data_make->setting, data_make->error, F_status_set_fine(status_file), macro_fake_f(fake_make_assure_inside_project), data_make->cache_path.used ? data_make->cache_path : data_make->cache_arguments.array[i]); status = F_status_set_error(F_failure); } @@ -604,7 +604,7 @@ extern "C" { status_file = fake_make_assure_inside_project(data_make, data_make->cache_arguments.array[i]); if (F_status_is_error(status_file)) { - fake_print_message_section_operation_path_outside(data_make->setting, data_make->error, F_status_set_fine(status_file), macro_fake_f(fake_make_assure_inside_project), data_make->cache_path.used ? data_make->cache_path : data_make->cache_arguments.array[i]); + fake_print_error_operation_path_outside(data_make->setting, data_make->error, F_status_set_fine(status_file), macro_fake_f(fake_make_assure_inside_project), data_make->cache_path.used ? data_make->cache_path : data_make->cache_arguments.array[i]); status = F_status_set_error(F_failure); } @@ -696,7 +696,7 @@ extern "C" { status_file = fake_make_assure_inside_project(data_make, data_make->cache_arguments.array[i]); if (F_status_is_error(status_file)) { - fake_print_message_section_operation_path_outside(data_make->setting, data_make->error, F_status_set_fine(status_file), macro_fake_f(fake_make_assure_inside_project), data_make->cache_path.used ? data_make->cache_path : data_make->cache_arguments.array[i]); + fake_print_error_operation_path_outside(data_make->setting, data_make->error, F_status_set_fine(status_file), macro_fake_f(fake_make_assure_inside_project), data_make->cache_path.used ? data_make->cache_path : data_make->cache_arguments.array[i]); status = F_status_set_error(F_failure); } @@ -831,7 +831,7 @@ extern "C" { flag |= 0x2; } else { - fake_print_message_section_operation_link_argument_unknown(data_make->setting, data_make->error, data_make->cache_arguments.array[0]); + fake_print_error_operation_link_argument_unknown(data_make->setting, data_make->error, data_make->cache_arguments.array[0]); status = F_status_set_error(F_failure); } @@ -844,7 +844,7 @@ extern "C" { flag |= 0x2; } else { - fake_print_message_section_operation_link_argument_unknown(data_make->setting, data_make->error, data_make->cache_arguments.array[1]); + fake_print_error_operation_link_argument_unknown(data_make->setting, data_make->error, data_make->cache_arguments.array[1]); status = F_status_set_error(F_failure); } @@ -854,14 +854,14 @@ extern "C" { status_file = fake_make_assure_inside_project(data_make, data_make->cache_arguments.array[data_make->cache_arguments.used - 1]); if (F_status_is_error(status_file)) { - fake_print_message_section_operation_path_outside(data_make->setting, data_make->error, F_status_set_fine(status_file), macro_fake_f(fake_make_assure_inside_project), data_make->cache_path.used ? data_make->cache_path : data_make->cache_arguments.array[data_make->cache_arguments.used - 1]); + fake_print_error_operation_path_outside(data_make->setting, data_make->error, F_status_set_fine(status_file), macro_fake_f(fake_make_assure_inside_project), data_make->cache_path.used ? data_make->cache_path : data_make->cache_arguments.array[data_make->cache_arguments.used - 1]); status = F_status_set_error(F_failure); } else { if (!(flag & 0x1)) { if (!data_make->cache_path.used || f_file_exists(data_make->cache_path, F_false) == F_true) { - fake_print_message_section_operation_link_point_exists(data_make->setting, data_make->error, data_make->cache_arguments.array[data_make->cache_arguments.used - 1]); + fake_print_error_operation_link_point_exists(data_make->setting, data_make->error, data_make->cache_arguments.array[data_make->cache_arguments.used - 1]); status = F_status_set_error(F_failure); } @@ -871,14 +871,14 @@ extern "C" { status_file = fake_make_assure_inside_project(data_make, data_make->cache_arguments.array[data_make->cache_arguments.used - 2]); if (F_status_is_error(status_file)) { - fake_print_message_section_operation_path_outside(data_make->setting, data_make->error, F_status_set_fine(status_file), macro_fake_f(fake_make_assure_inside_project), data_make->cache_arguments.array[data_make->cache_arguments.used - 2]); + fake_print_error_operation_path_outside(data_make->setting, data_make->error, F_status_set_fine(status_file), macro_fake_f(fake_make_assure_inside_project), data_make->cache_arguments.array[data_make->cache_arguments.used - 2]); status = F_status_set_error(F_failure); } if ((flag & 0x2) && F_status_is_error_not(status_file)) { if (f_file_exists(data_make->cache_arguments.array[data_make->cache_arguments.used - 2], F_false) != F_true) { - fake_print_message_section_operation_link_target_exists_not(data_make->setting, data_make->error, data_make->cache_arguments.array[data_make->cache_arguments.used - 2]); + fake_print_error_operation_link_target_exists_not(data_make->setting, data_make->error, data_make->cache_arguments.array[data_make->cache_arguments.used - 2]); status = F_status_set_error(F_failure); } @@ -935,14 +935,14 @@ extern "C" { status_file = fake_make_assure_inside_project(data_make, target); if (F_status_is_error(status_file)) { - fake_print_message_section_operation_path_outside(data_make->setting, data_make->error, F_status_set_fine(status_file), macro_fake_f(fake_make_assure_inside_project), target); + fake_print_error_operation_path_outside(data_make->setting, data_make->error, F_status_set_fine(status_file), macro_fake_f(fake_make_assure_inside_project), target); status = F_status_set_error(F_failure); } if ((flag & 0x2) && F_status_is_error_not(status_file)) { if (f_file_exists(target, F_false) != F_true) { - fake_print_message_section_operation_link_target_exists_not(data_make->setting, data_make->error, target); + fake_print_error_operation_link_target_exists_not(data_make->setting, data_make->error, target); status = F_status_set_error(F_failure); } @@ -980,7 +980,7 @@ extern "C" { status_file = fake_make_assure_inside_project(data_make, data_make->cache_arguments.array[i]); if (F_status_is_error(status_file)) { - fake_print_message_section_operation_path_outside(data_make->setting, data_make->error, F_status_set_fine(status_file), macro_fake_f(fake_make_assure_inside_project), data_make->cache_path.used ? data_make->cache_path : data_make->cache_arguments.array[i]); + fake_print_error_operation_path_outside(data_make->setting, data_make->error, F_status_set_fine(status_file), macro_fake_f(fake_make_assure_inside_project), data_make->cache_path.used ? data_make->cache_path : data_make->cache_arguments.array[i]); status = F_status_set_error(F_failure); } @@ -1289,7 +1289,7 @@ extern "C" { status_file = fake_make_assure_inside_project(data_make, data_make->cache_arguments.array[i]); if (F_status_is_error(status_file)) { - fake_print_message_section_operation_path_outside(data_make->setting, data_make->error, F_status_set_fine(status_file), macro_fake_f(fake_make_assure_inside_project), data_make->cache_path.used ? data_make->cache_path : data_make->cache_arguments.array[i]); + fake_print_error_operation_path_outside(data_make->setting, data_make->error, F_status_set_fine(status_file), macro_fake_f(fake_make_assure_inside_project), data_make->cache_path.used ? data_make->cache_path : data_make->cache_arguments.array[i]); status = F_status_set_error(F_failure); } @@ -1317,7 +1317,7 @@ extern "C" { const f_status_t status = fake_make_assure_inside_project(data_make, data_make->cache_arguments.array[0]); if (F_status_is_error(status)) { - fake_print_message_section_operation_path_outside(data_make->setting, data_make->error, status, macro_fake_f(fake_make_assure_inside_project), data_make->cache_path.used ? data_make->cache_path : data_make->cache_arguments.array[0]); + fake_print_error_operation_path_outside(data_make->setting, data_make->error, status, macro_fake_f(fake_make_assure_inside_project), data_make->cache_path.used ? data_make->cache_path : data_make->cache_arguments.array[0]); return F_status_set_error(F_failure); } diff --git a/level_3/fake/c/main/make/print-error.c b/level_3/fake/c/main/make/print-error.c index 01eb7b3..679fc33 100644 --- a/level_3/fake/c/main/make/print-error.c +++ b/level_3/fake/c/main/make/print-error.c @@ -8,21 +8,29 @@ extern "C" { #ifndef _di_fake_make_print_error_argument_invalid_section_ f_status_t fake_make_print_error_argument_invalid_section(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t name) { - return fake_make_print_error_simple_variable(setting, print, "The argument", name, " is not a valid section name"); + if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; + + fake_print_context_wrapped_variable(setting, print, "The argument ", name, " is not a valid section name"); + + return F_none; } #endif // _di_fake_make_print_error_argument_invalid_section_ #ifndef _di_fake_make_print_error_compiler_not_specified_ f_status_t fake_make_print_error_compiler_not_specified(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t action) { - return fake_make_print_error_simple_variable(setting, print, "No compiler has been specified, cannot perform", action, " section operation"); + if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; + + fake_print_context_wrapped_variable(setting, print, "No compiler has been specified, cannot perform ", action, " section operation"); + + return F_none; } #endif // _di_fake_make_print_error_compiler_not_specified_ #ifndef _di_fake_make_print_error_content_not_directory_ f_status_t fake_make_print_error_content_not_directory(fake_setting_t * const setting, const fl_print_t print, const f_string_t content, const f_string_static_t file) { - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; + if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; f_file_stream_lock(print.to); @@ -41,21 +49,29 @@ extern "C" { #ifndef _di_fake_make_print_error_define_name_empty_ f_status_t fake_make_print_error_define_name_empty(fake_setting_t * const setting, const fl_print_t print) { - return fake_make_print_error_simple(setting, print, "Define name must not be an empty string"); + if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; + + fake_print_context_simple(setting, print, "Define name must not be an empty string"); + + return F_none; } #endif // _di_fake_make_print_error_define_name_empty_ #ifndef _di_fake_make_print_error_define_invalid_character_ f_status_t fake_make_print_error_define_invalid_character(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t name) { - return fake_make_print_error_simple_variable(setting, print, "Invalid characters in the define name", name, ", only alpha-numeric ASCII characters and underscore (without a leading digit) are allowed"); + if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; + + fake_print_context_wrapped_variable(setting, print, "Invalid characters in the define name ", name, ", only alpha-numeric ASCII characters and underscore (without a leading digit) are allowed"); + + return F_none; } #endif // _di_fake_make_print_error_define_invalid_character_ #ifndef _di_fake_make_print_error_fakefile_section_missing_ f_status_t fake_make_print_error_fakefile_section_missing(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t fakefile, const f_string_static_t section) { - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; + if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; f_file_stream_lock(print.to); @@ -76,14 +92,18 @@ extern "C" { #ifndef _di_fake_make_print_error_file_name_empty_ f_status_t fake_make_print_error_file_name_empty(fake_setting_t * const setting, const fl_print_t print) { - return fake_make_print_error_simple(setting, print, "File name argument must not be an empty string"); + if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; + + fake_print_context_simple(setting, print, "File name argument must not be an empty string"); + + return F_none; } #endif // _di_fake_make_print_error_file_name_empty_ #ifndef _di_fake_make_print_error_file_type_ f_status_t fake_make_print_error_file_type(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t type, const f_string_static_t file) { - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; + if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; f_file_stream_lock(print.to); @@ -102,14 +122,18 @@ extern "C" { #ifndef _di_fake_make_print_error_indexer_not_specified_ f_status_t fake_make_print_error_indexer_not_specified(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t action) { - return fake_make_print_error_simple_variable(setting, print, "No indexer has been specified, cannot perform", action, " section operation"); + if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; + + fake_print_context_wrapped_variable(setting, print, "No indexer has been specified, cannot perform ", action, " section operation"); + + return F_none; } #endif // _di_fake_make_print_error_indexer_not_specified_ #ifndef _di_fake_make_print_error_after_condition_ f_status_t fake_make_print_error_after_condition(fake_setting_t * const setting, const fl_print_t print, const f_string_t message) { - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; + if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; f_file_stream_lock(print.to); @@ -132,28 +156,40 @@ extern "C" { #ifndef _di_fake_make_print_error_after_condition_may_only_ f_status_t fake_make_print_error_after_condition_may_only(fake_setting_t * const setting, const fl_print_t print) { - return fake_make_print_error_after_condition(setting, print, "May only be used immediately after"); + if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; + + fake_make_print_error_after_condition(setting, print, "May only be used immediately after"); + + return F_none; } #endif // _di_fake_make_print_error_after_condition_may_only_ #ifndef _di_fake_make_print_error_after_condition_must_not_ f_status_t fake_make_print_error_after_condition_must_not(fake_setting_t * const setting, const fl_print_t print) { - return fake_make_print_error_after_condition(setting, print, "Must not be used immediately after"); + if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; + + fake_make_print_error_after_condition(setting, print, "Must not be used immediately after"); + + return F_none; } #endif // _di_fake_make_print_error_after_condition_must_not_ #ifndef _di_fake_make_print_error_after_condition_no_preceding_ f_status_t fake_make_print_error_after_condition_no_preceding(fake_setting_t * const setting, const fl_print_t print) { - return fake_make_print_error_after_condition(setting, print, "Has no preceding"); + if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; + + fake_make_print_error_after_condition(setting, print, "Has no preceding"); + + return F_none; } #endif // _di_fake_make_print_error_after_condition_no_preceding_ #ifndef _di_fake_make_print_error_operation_incomplete_ f_status_t fake_make_print_error_operation_incomplete(fake_setting_t * const setting, const fl_print_t print, const uint8_t operation) { - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; + if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; f_file_stream_lock(print.to); @@ -185,7 +221,7 @@ extern "C" { #ifndef _di_fake_make_print_error_operation_recursion_ f_status_t fake_make_print_error_operation_recursion(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t buffer, const f_string_range_t range) { - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; + if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; f_file_stream_lock(print.to); @@ -204,14 +240,18 @@ extern "C" { #ifndef _di_fake_make_print_error_operation_section_not_found_ f_status_t fake_make_print_error_operation_section_not_found(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t name) { - return fake_make_print_error_simple_variable(setting, print, "No operation section named", name, " is found"); + if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; + + fake_print_context_wrapped_variable(setting, print, "No operation section named ", name, " is found"); + + return F_none; } #endif // _di_fake_make_print_error_operation_section_not_found_ #ifndef _di_fake_make_print_error_out_of_range_number_ f_status_t fake_make_print_error_out_of_range_number(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t number, const f_number_unsigned_t minimum, const f_number_unsigned_t maximum) { - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; + if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; f_file_stream_lock(print.to); @@ -230,14 +270,18 @@ extern "C" { #ifndef _di_fake_make_print_error_pop_last_path_ f_status_t fake_make_print_error_pop_last_path(fake_setting_t * const setting, const fl_print_t print) { - return fake_make_print_error_simple(setting, print, "Must not attempt to pop project root off of path stack"); + if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; + + fake_print_context_simple(setting, print, "Must not attempt to pop project root off of path stack"); + + return F_none; } #endif // _di_fake_make_print_error_pop_last_path_ #ifndef _di_fake_make_print_error_program_failed_ f_status_t fake_make_print_error_program_failed(fake_setting_t * const setting, const fl_print_t print, const int return_code) { - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; + if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; f_file_stream_lock(print.to); @@ -256,71 +300,51 @@ extern "C" { #ifndef _di_fake_make_print_error_program_not_found_ f_status_t fake_make_print_error_program_not_found(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t program) { - return fake_make_print_error_simple_variable(setting, print, "Failed to find program", program, " for executing"); + if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; + + fake_print_context_wrapped_variable(setting, print, "Failed to find program ", program, " for executing"); + + return F_none; } #endif // _di_fake_make_print_error_program_not_found_ #ifndef _di_fake_make_print_error_reserved_parameter_name_ f_status_t fake_make_print_error_reserved_parameter_name(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t name) { - return fake_make_print_error_simple_variable(setting, print, "Cannot assign a value to the parameter name", name, " because it is a reserved parameter name"); - } -#endif // _di_fake_make_print_error_reserved_parameter_name_ - -#ifndef _di_fake_make_print_error_simple_ - f_status_t fake_make_print_error_simple(fake_setting_t * const setting, const fl_print_t print, const f_string_t message) { - - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; + if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; - f_file_stream_lock(print.to); - - fake_print_line_first_unlocked(setting, print); - - fl_print_format("%[%Q%S.%]%r", print.to, print.context, print.prefix, message, print.context, f_string_eol_s); - - f_file_stream_unlock(print.to); + fake_print_context_wrapped_variable(setting, print, "Cannot assign a value to the parameter name ", name, " because it is a reserved parameter name"); return F_none; } -#endif // _di_fake_make_print_error_simple_ - -#ifndef _di_fake_make_print_error_simple_variable_ - f_status_t fake_make_print_error_simple_variable(fake_setting_t * const setting, const fl_print_t print, const f_string_t before, const f_string_static_t variable, const f_string_t after) { - - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; - - f_file_stream_lock(print.to); +#endif // _di_fake_make_print_error_reserved_parameter_name_ - fake_print_line_first_unlocked(setting, print); +#ifndef _di_fake_make_print_error_target_file_name_empty_ + f_status_t fake_make_print_error_target_file_name_empty(fake_setting_t * const setting, const fl_print_t print) { - fl_print_format("%[%Q%S '%]", print.to, print.context, print.prefix, before, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, variable, print.notable); - fl_print_format("%['%S.%]%r", print.to, print.context, after, print.context, f_string_eol_s); + if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; - f_file_stream_unlock(print.to); + fake_print_context_simple(setting, print, "Target file name argument must not be an empty string"); return F_none; } -#endif // _di_fake_make_print_error_simple_variable_ - -#ifndef _di_fake_make_print_error_target_file_name_empty_ - f_status_t fake_make_print_error_target_file_name_empty(fake_setting_t * const setting, const fl_print_t print) { - - return fake_make_print_error_simple(setting, print, "Target file name argument must not be an empty string"); - } #endif // _di_fake_make_print_error_target_file_name_empty_ #ifndef _di_fake_make_print_error_unsupported_number_ f_status_t fake_make_print_error_unsupported_number(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t number) { - return fake_make_print_error_simple_variable(setting, print, "Invalid or unsupported number provided", number, 0); + if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; + + fake_print_context_wrapped_variable(setting, print, "Invalid or unsupported number provided ", number, 0); + + return F_none; } #endif // _di_fake_make_print_error_unsupported_number_ #ifndef _di_fake_make_print_error_unsupported_type_ f_status_t fake_make_print_error_unsupported_type(fake_setting_t * const setting, const fl_print_t print, f_string_static_t type, const f_string_static_t value) { - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; + if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; f_file_stream_lock(print.to); diff --git a/level_3/fake/c/main/make/print-error.h b/level_3/fake/c/main/make/print-error.h index fa13ac4..07eeaf4 100644 --- a/level_3/fake/c/main/make/print-error.h +++ b/level_3/fake/c/main/make/print-error.h @@ -456,58 +456,6 @@ extern "C" { #endif // _di_fake_make_print_error_reserved_parameter_name_ /** - * Print a simple error message with a single string message. - * - * This is primarily used by numerous error print functions to reduce code. - * This is not used for any error 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.status. - * @param print - * The output structure to print to. - * @param message - * The string to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fake_make_print_error_simple_ - extern f_status_t fake_make_print_error_simple(fake_setting_t * const setting, const fl_print_t print, const f_string_t message); -#endif // _di_fake_make_print_error_simple_ - -/** - * Print a simple error message with a before string, an after string, and a string variable. - * - * This is primarily used by numerous error print functions to reduce code. - * This is not used for any error 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.status. - * @param print - * The output structure to print to. - * @param before - * The string being printed before the variable. - * @param variable - * The string representing the variable. - * @param after - * The string being printed after the variable. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fake_make_print_error_simple_variable_ - extern f_status_t fake_make_print_error_simple_variable(fake_setting_t * const setting, const fl_print_t print, const f_string_t before, const f_string_static_t variable, const f_string_t after); -#endif // _di_fake_make_print_error_simple_variable_ - -/** * Print error about a target file name being an empty string. * * @param setting diff --git a/level_3/fake/c/main/make/print-verbose.c b/level_3/fake/c/main/make/print-verbose.c new file mode 100644 index 0000000..b758ba2 --- /dev/null +++ b/level_3/fake/c/main/make/print-verbose.c @@ -0,0 +1,226 @@ +#include "../fake.h" +#include "print-verbose.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_fake_make_print_verbose_operate_break_ + f_status_t fake_make_print_verbose_operate_break(fake_setting_t * const setting, const fl_print_t print, const f_string_statics_t arguments) { + + if (!setting || print.verbosity < f_console_verbosity_verbose_e) return F_output_not; + + fake_print_context_simple_variable(setting, print, "Breaking as", arguments.used ? arguments.array[0] : fake_make_operation_argument_success_s, 0); + + return F_none; + } +#endif // _di_fake_make_print_verbose_operate_break_ + +#ifndef _di_fake_make_print_verbose_operate_copy_ + f_status_t fake_make_print_verbose_operate_copy(fake_setting_t * const setting, const fl_print_t print, const bool clone, const f_string_static_t source, const f_string_static_t destination) { + + if (!setting || print.verbosity < f_console_verbosity_verbose_e) return F_output_not; + + f_file_stream_lock(print.to); + + fake_print_line_first_unlocked(setting, print); + + fl_print_format("%s '%[%Q%]' to '", print.to, clone ? "Cloned" : "Copied", print.set->notable, source, print.set->notable); + fl_print_format("%[%Q%]'.%r", print.to, print.set->notable, destination, print.set->notable, f_string_eol_s); + + f_file_stream_unlock(print.to); + + return F_none; + } +#endif // _di_fake_make_print_verbose_operate_copy_ + +#ifndef _di_fake_make_print_verbose_operate_define_ + f_status_t fake_make_print_verbose_operate_define(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t variable) { + + if (!setting || print.verbosity < f_console_verbosity_verbose_e) return F_output_not; + + fake_print_context_simple_variable(setting, print, "Defined environment variable", variable, 0); + + return F_none; + } +#endif // _di_fake_make_print_verbose_operate_define_ + +#ifndef _di_fake_make_print_verbose_operate_delete_ + f_status_t fake_make_print_verbose_operate_delete(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t path) { + + if (!setting || print.verbosity < f_console_verbosity_verbose_e) return F_output_not; + + fake_print_context_simple_variable(setting, print, "Removed", path, 0); + + return F_none; + } +#endif // _di_fake_make_print_verbose_operate_delete_ + +#ifndef _di_fake_make_print_verbose_operate_exiting_as_ + f_status_t fake_make_print_verbose_operate_exiting_as(fake_setting_t * const setting, const fl_print_t print, const f_string_statics_t arguments) { + + if (!setting || print.verbosity < f_console_verbosity_verbose_e) return F_output_not; + + fake_print_context_simple_variable(setting, print, "Exiting as", arguments.used ? arguments.array[0] : fake_make_operation_argument_success_s, 0); + + return F_none; + } +#endif // _di_fake_make_print_verbose_operate_exiting_as_ + +#ifndef _di_fake_make_print_verbose_operate_file_not_found_ + f_status_t fake_make_print_verbose_operate_file_not_found(fake_setting_t * const setting, const fl_print_t print, const bool is_directory, const f_string_static_t file) { + + if (!setting || print.verbosity < f_console_verbosity_verbose_e) return F_output_not; + + f_file_stream_lock(print.to); + + fake_print_line_first_unlocked(setting, print); + + fl_print_format("The %Q '%[%Q%]' is not found.%]%r", print.to, print.set->notable, is_directory ? f_file_type_name_directory_s : f_file_type_name_file_s, file, print.set->notable, f_string_eol_s); + + f_file_stream_unlock(print.to); + + return F_none; + } +#endif // _di_fake_make_print_verbose_operate_file_not_found_ + +#ifndef _di_fake_make_print_verbose_operate_program_ + f_status_t fake_make_print_verbose_operate_program(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t program, const f_string_statics_t arguments) { + + if (!setting || print.verbosity < f_console_verbosity_verbose_e) return F_output_not; + + f_file_stream_lock(print.to); + + f_array_length_t i = 0; + + if (program.used) { + f_print_dynamic_safely(program, print.to); + } + else { + i = 1; + + f_print_dynamic_safely(arguments.array[0], print.to); + } + + for (; i < arguments.used; ++i) { + if (arguments.array[i].used) fll_print_format(" %Q", print.to, arguments.array[i]); + } // for + + f_print_dynamic_raw(f_string_eol_s, print.to); + + // Flush to stdout before executing command. + f_file_stream_flush(print.to); + + f_file_stream_unlock(print.to); + + return F_none; + } +#endif // _di_fake_make_print_verbose_operate_program_ + +#ifndef _di_fake_make_print_verbose_operate_set_failure_state_ + f_status_t fake_make_print_verbose_operate_set_failure_state(fake_setting_t * const setting, const fl_print_t print, const uint8_t fail) { + + if (!setting || print.verbosity < f_console_verbosity_verbose_e) return F_output_not; + + f_file_stream_lock(print.to); + + fake_print_line_first_unlocked(setting, print); + + f_print_terminated("Set failure state to '", print.to); + + if (fail == fake_make_operation_fail_exit_e) { + fl_print_format("%[%r%]", print.to, print.set->notable, fake_make_operation_argument_exit_s, print.set->notable); + } + else if (fail == fake_make_operation_fail_warn_e) { + fl_print_format("%[%r%]", print.to, print.set->notable, fake_make_operation_argument_warn_s, print.set->notable); + } + else { + fl_print_format("%[%r%]", print.to, print.set->notable, fake_make_operation_argument_ignore_s, print.set->notable); + } + + fl_print_format("'.%r", print.to, f_string_eol_s); + + f_file_stream_unlock(print.to); + + return F_none; + } +#endif // _di_fake_make_print_verbose_operate_set_failure_state_ + +#ifndef _di_fake_make_print_verbose_operate_set_mode_ + f_status_t fake_make_print_verbose_operate_set_mode(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t path, const mode_t mode) { + + if (!setting || print.verbosity < f_console_verbosity_verbose_e) return F_output_not; + + f_file_stream_lock(print.to); + + fake_print_line_first_unlocked(setting, print); + + fll_print_format("Changed mode of '%[%Q%]' to %[%#@u%].%r", print.to, print.set->notable, path, print.set->notable, print.set->notable, mode, print.set->notable, f_string_eol_s); + + f_file_stream_unlock(print.to); + + return F_none; + } +#endif // _di_fake_make_print_verbose_operate_set_mode_ + +#ifndef _di_fake_make_print_verbose_operate_set_path_ + f_status_t fake_make_print_verbose_operate_set_path(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t path) { + + if (print.verbosity < f_console_verbosity_verbose_e) return F_output_not; + + fake_print_context_simple_variable(setting, print, "Changed project path to", path, 0); + + return F_none; + } +#endif // _di_fake_make_print_verbose_operate_set_path_ + +#ifndef _di_fake_make_print_verbose_operate_set_role_ + f_status_t fake_make_print_verbose_operate_set_role(fake_setting_t * const setting, const fl_print_t print, const uint8_t what, f_string_static_t role, f_number_unsigned_t id) { + + if (!setting || print.verbosity < f_console_verbosity_verbose_e) return F_output_not; + + f_file_stream_lock(print.to); + + fake_print_line_first_unlocked(setting, print); + + fl_print_format("%r %r of '%[%r%]'", print.to, (what & 0x1) ? "Recursively changed" : "Changed", (what & 0x2) ? "owner" : "group", print.set->notable, role, print.set->notable); + fl_print_format(" to %[%ul%].%r", print.to, print.set->notable, id, print.set->notable, f_string_eol_s); + + f_file_stream_unlock(print.to); + + return F_none; + } +#endif // _di_fake_make_print_verbose_operate_set_role_ + +#ifndef _di_fake_make_print_verbose_operate_symbolic_link_ + f_status_t fake_make_print_verbose_operate_symbolic_link(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t source, const f_string_static_t destination) { + + if (!setting || print.verbosity < f_console_verbosity_verbose_e) return F_output_not; + + f_file_stream_lock(print.to); + + fake_print_line_first_unlocked(setting, print); + + fl_print_format("Created symbolic link from '%[%Q%]", print.to, print.set->notable, source, print.set->notable); + fl_print_format("' to %[%Q%].%r", print.to, print.set->notable, destination, print.set->notable, f_string_eol_s); + + f_file_stream_unlock(print.to); + + return F_none; + } +#endif // _di_fake_make_print_verbose_operate_symbolic_link_ + +#ifndef _di_fake_make_print_verbose_operate_touch_ + f_status_t fake_make_print_verbose_operate_touch(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t path) { + + if (!setting || print.verbosity < f_console_verbosity_verbose_e) return F_output_not; + + fake_print_context_simple_variable(setting, print, "Touched", path, 0); + + return F_none; + } +#endif // _di_fake_make_print_verbose_operate_touch_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_3/fake/c/main/make/print-verbose.h b/level_3/fake/c/main/make/print-verbose.h new file mode 100644 index 0000000..a8a1835 --- /dev/null +++ b/level_3/fake/c/main/make/print-verbose.h @@ -0,0 +1,314 @@ +/** + * FLL - Level 3 + * + * Project: Featureless Make + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + */ +#ifndef _fake_make_print_verbose_h +#define _fake_make_print_verbose_h + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Print operate break verbose message. + * + * @param setting + * The main program settings. + * (Must be of type fake_setting_t.) + * + * This does not alter setting.status. + * @param print + * The output structure to print to. + * @param arguments + * The arguments where the first argument, if defined, is the exiting as string. + * Set arguments.used to 0 to use the default "success" exiting as string. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_fake_make_print_verbose_operate_break_ + extern f_status_t fake_make_print_verbose_operate_break(fake_setting_t * const setting, const fl_print_t print, const f_string_statics_t arguments); +#endif // _di_fake_make_print_verbose_operate_break_ + +/** + * Print operate copy verbose message. + * + * @param setting + * The main program settings. + * (Must be of type fake_setting_t.) + * + * This does not alter setting.status. + * @param print + * The output structure to print to. + * @param clone + * If TRUE, then this is a clone operation. + * If FALSE< then this is a copy operation. + * @param source + * The source to copy from. + * @param destination + * The destination to copy to. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_fake_make_print_verbose_operate_copy_ + extern f_status_t fake_make_print_verbose_operate_copy(fake_setting_t * const setting, const fl_print_t print, const bool clone, const f_string_static_t source, const f_string_static_t destination); +#endif // _di_fake_make_print_verbose_operate_copy_ + +/** + * Print operate define verbose message. + * + * @param setting + * The main program settings. + * (Must be of type fake_setting_t.) + * + * This does not alter setting.status. + * @param print + * The output structure to print to. + * @param variable + * The environment variable name. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_fake_make_print_verbose_operate_define_ + extern f_status_t fake_make_print_verbose_operate_define(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t variable); +#endif // _di_fake_make_print_verbose_operate_define_ + +/** + * Print operate delete verbose message. + * + * @param setting + * The main program settings. + * (Must be of type fake_setting_t.) + * + * This does not alter setting.status. + * @param print + * The output structure to print to. + * @param path + * The path or file that is deleted. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_fake_make_print_verbose_operate_delete_ + extern f_status_t fake_make_print_verbose_operate_delete(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t path); +#endif // _di_fake_make_print_verbose_operate_delete_ + +/** + * Print operate exiting as verbose message. + * + * @param setting + * The main program settings. + * (Must be of type fake_setting_t.) + * + * This does not alter setting.status. + * @param print + * The output structure to print to. + * @param arguments + * The arguments where the first argument, if defined, is the exiting as string. + * Set arguments.used to 0 to use the default "success" exiting as string. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_fake_make_print_verbose_operate_exiting_as_ + extern f_status_t fake_make_print_verbose_operate_exiting_as(fake_setting_t * const setting, const fl_print_t print, const f_string_statics_t arguments); +#endif // _di_fake_make_print_verbose_operate_exiting_as_ + +/** + * Print operate file or directory not found verbose message. + * + * @param setting + * The main program settings. + * (Must be of type fake_setting_t.) + * + * This does not alter setting.status. + * @param print + * The output structure to print to. + * @param is_directory + * If TRUE, then the file is type directory. + * If FALSE, then the file is type regular. + * @param file + * The file or directory path or name. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_fake_make_print_verbose_operate_file_not_found_ + extern f_status_t fake_make_print_verbose_operate_file_not_found(fake_setting_t * const setting, const fl_print_t print, const bool is_directory, const f_string_static_t file); +#endif // _di_fake_make_print_verbose_operate_file_not_found_ + +/** + * Print verbose program message. + * + * @param setting + * The main program settings. + * (Must be of type fake_setting_t.) + * + * This does not alter setting.status. + * @param print + * The output structure to print to. + * @param program + * The program name. + * @param arguments + * The arguments pass to the program. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_fake_make_print_verbose_operate_program_ + extern f_status_t fake_make_print_verbose_operate_program(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t program, const f_string_statics_t arguments); +#endif // _di_fake_make_print_verbose_operate_program_ + +/** + * Print verbose message about setting failure state. + * + * @param setting + * The main program settings. + * (Must be of type fake_setting_t.) + * + * This does not alter setting.status. + * @param print + * The output structure to print to. + * @param fail + * The failure state code being set to. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_fake_make_print_verbose_operate_set_failure_state_ + extern f_status_t fake_make_print_verbose_operate_set_failure_state(fake_setting_t * const setting, const fl_print_t print, const uint8_t fail); +#endif // _di_fake_make_print_verbose_operate_set_failure_state_ + +/** + * Print verbose message about setting the file mode. + * + * @param setting + * The main program settings. + * (Must be of type fake_setting_t.) + * + * This does not alter setting.status. + * @param print + * The output structure to print to. + * @param path + * The file path having the mode changed. + * @param mode + * The mode being changed to. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_fake_make_print_verbose_operate_set_mode_ + extern f_status_t fake_make_print_verbose_operate_set_mode(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t path, const mode_t mode); +#endif // _di_fake_make_print_verbose_operate_set_mode_ + +/** + * Print verbose message about changing the project path. + * + * @param setting + * The main program settings. + * (Must be of type fake_setting_t.) + * + * This does not alter setting.status. + * @param print + * The output structure to print to. + * @param path + * The path being changed to. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_fake_make_print_verbose_operate_set_path_ + extern f_status_t fake_make_print_verbose_operate_set_path(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t path); +#endif // _di_fake_make_print_verbose_operate_set_path_ + +/** + * Print verbose message about setting owner or group. + * + * @param setting + * The main program settings. + * (Must be of type fake_setting_t.) + * + * This does not alter setting.status. + * @param print + * The output structure to print to. + * @param what + * Bitwise flags tweaking the message printed. + * - 0x1 = When set, print as recursive; When not set, print as non-recursive. + * - 0x2 = When set, print as Owner; When not set, print as Group. + * @param role + * A string representing the owner or group name. + * @param id + * The uid_t or gid_t representing the owner or group. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_fake_make_print_verbose_operate_set_role_ + extern f_status_t fake_make_print_verbose_operate_set_role(fake_setting_t * const setting, const fl_print_t print, const uint8_t what, f_string_static_t role, f_number_unsigned_t id); +#endif // _di_fake_make_print_verbose_operate_set_role_ + +/** + * Print verbose message about create a symbolic link. + * + * @param setting + * The main program settings. + * (Must be of type fake_setting_t.) + * + * This does not alter setting.status. + * @param print + * The output structure to print to. + * @param source + * A string the symbolic link is from. + * @param destination + * A string the symbolic link is to. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_fake_make_print_verbose_operate_symbolic_link_ + extern f_status_t fake_make_print_verbose_operate_symbolic_link(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_make_print_verbose_operate_symbolic_link_ + +/** + * Print verbose message about touching a file. + * + * @param setting + * The main program settings. + * (Must be of type fake_setting_t.) + * + * This does not alter setting.status. + * @param print + * The output structure to print to. + * @param path + * The file path being touched. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_fake_make_print_verbose_operate_touch_ + extern f_status_t fake_make_print_verbose_operate_touch(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t path); +#endif // _di_fake_make_print_verbose_operate_touch_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _fake_make_print_verbose_h diff --git a/level_3/fake/c/main/make/print-warning.c b/level_3/fake/c/main/make/print-warning.c index 4d2a88b..db7e656 100644 --- a/level_3/fake/c/main/make/print-warning.c +++ b/level_3/fake/c/main/make/print-warning.c @@ -8,7 +8,7 @@ extern "C" { #ifndef _di_fake_make_print_warning_cannot_change_back_ f_status_t fake_make_print_warning_cannot_change_back(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t path, const f_status_t status) { - if (print.verbosity < f_console_verbosity_verbose_e) return F_output_not; + if (!setting || print.verbosity < f_console_verbosity_verbose_e) return F_output_not; f_file_stream_lock(print.to); @@ -29,35 +29,51 @@ extern "C" { #ifndef _di_fake_make_print_warning_environment_name_already_added_ f_status_t fake_make_print_warning_environment_name_already_added(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t name) { - return fake_make_print_warning_simple_variable(setting, print, "The environment name", name, "is already added, replacing previous value"); + if (!setting || print.verbosity < f_console_verbosity_verbose_e) return F_output_not; + + fake_print_context_simple_variable(setting, print, "The environment name", name, "is already added, replacing previous value"); + + return F_none; } #endif // _di_fake_make_print_warning_environment_name_already_added_ #ifndef _di_fake_make_print_warning_environment_name_invalid_ f_status_t fake_make_print_warning_environment_name_invalid(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t name) { - return fake_make_print_warning_simple_variable(setting, print, "The environment name", name, "is invalid, ignoring"); + if (!setting || print.verbosity < f_console_verbosity_verbose_e) return F_output_not; + + fake_print_context_simple_variable(setting, print, "The environment name", name, "is invalid, ignoring"); + + return F_none; } #endif // _di_fake_make_print_warning_environment_name_invalid_ #ifndef _di_fake_make_print_warning_fakefile_empty_ f_status_t fake_make_print_warning_fakefile_empty(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t fakefile) { - return fake_make_print_warning_simple_variable(setting, print, "The fakefile", fakefile, "is empty"); + if (!setting || print.verbosity < f_console_verbosity_verbose_e) return F_output_not; + + fake_print_context_simple_variable(setting, print, "The fakefile", fakefile, "is empty"); + + return F_none; } #endif // _di_fake_make_print_warning_fakefile_empty_ #ifndef _di_fake_make_print_warning_file_not_found_ f_status_t fake_make_print_warning_file_not_found(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t file) { - return fake_make_print_warning_simple_variable(setting, print, "The file", file, "cannot be found"); + if (!setting || print.verbosity < f_console_verbosity_verbose_e) return F_output_not; + + fake_print_context_simple_variable(setting, print, "The file", file, "cannot be found"); + + return F_none; } #endif // _di_fake_make_print_warning_file_not_found_ #ifndef _di_fake_make_print_warning_settings_content_empty_ f_status_t fake_make_print_warning_settings_content_empty(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t fakefile, const f_string_dynamic_t buffer, const f_string_range_t range, const f_string_static_t name) { - if (print.verbosity < f_console_verbosity_verbose_e) return F_output_not; + if (!setting || print.verbosity < f_console_verbosity_verbose_e) return F_output_not; f_file_stream_lock(print.to); @@ -80,7 +96,7 @@ extern "C" { #ifndef _di_fake_make_print_warning_settings_content_invalid_ f_status_t fake_make_print_warning_settings_content_invalid(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t fakefile, const f_string_dynamic_t buffer, const f_string_range_t object, const f_string_range_t content, const f_string_static_t name) { - if (print.verbosity < f_console_verbosity_verbose_e) return F_output_not; + if (!setting || print.verbosity < f_console_verbosity_verbose_e) return F_output_not; f_file_stream_lock(print.to); @@ -105,56 +121,24 @@ extern "C" { #ifndef _di_fake_make_print_warning_settings_content_multiple_ f_status_t fake_make_print_warning_settings_content_multiple(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t fakefile, const f_string_static_t name) { - return fake_make_print_warning_simple_variables(setting, print, "The fakefile", fakefile, "may only have a single content for the object", name, ", only using the first"); - } -#endif // _di_fake_make_print_warning_settings_content_multiple_ - -#ifndef _di_fake_make_print_warning_settings_object_multiple_ - f_status_t fake_make_print_warning_settings_object_multiple(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t fakefile, const f_string_static_t name) { - - return fake_make_print_warning_simple_variables(setting, print, "The object", name, "in the fakefile", fakefile, "may only be specified once, only using the first"); - } -#endif // _di_fake_make_print_warning_settings_object_multiple_ - -#ifndef _di_fake_make_print_warning_simple_variable_ - f_status_t fake_make_print_warning_simple_variable(fake_setting_t * const setting, const fl_print_t print, const f_string_t before, const f_string_static_t variable, const f_string_t after) { - - if (print.verbosity < f_console_verbosity_verbose_e) return F_output_not; - - f_file_stream_lock(print.to); - - fake_print_line_first_unlocked(setting, print); + if (!setting || print.verbosity < f_console_verbosity_verbose_e) return F_output_not; - fl_print_format("%[%Q%S '%]", print.to, print.context, print.prefix, before, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, variable, print.notable); - fl_print_format("%['%S.%]%r", print.to, print.context, after, print.context, f_string_eol_s); - - f_file_stream_unlock(print.to); + fake_print_context_wrapped_variables(setting, print, "The fakefile ", fakefile, " may only have a single content for the object ", name, ", only using the first"); return F_none; } -#endif // _di_fake_make_print_warning_simple_variable_ - -#ifndef _di_fake_make_print_warning_simple_variables_ - f_status_t fake_make_print_warning_simple_variables(fake_setting_t * const setting, const fl_print_t print, const f_string_t before, const f_string_static_t first, const f_string_t between, const f_string_static_t second, const f_string_t after) { - - if (print.verbosity < f_console_verbosity_verbose_e) return F_output_not; - - f_file_stream_lock(print.to); +#endif // _di_fake_make_print_warning_settings_content_multiple_ - fake_print_line_first_unlocked(setting, print); +#ifndef _di_fake_make_print_warning_settings_object_multiple_ + f_status_t fake_make_print_warning_settings_object_multiple(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t fakefile, const f_string_static_t name) { - fl_print_format("%[%Q%S '%]", print.to, print.context, print.prefix, before, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, first, print.notable); - fl_print_format("%[' %S '%]", print.to, print.context, between, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, second, print.notable); - fl_print_format("%['%S.%]%r", print.to, print.context, after, print.context, f_string_eol_s); + if (!setting || print.verbosity < f_console_verbosity_verbose_e) return F_output_not; - f_file_stream_unlock(print.to); + fake_print_context_wrapped_variables(setting, print, "The object ", name, " in the fakefile ", fakefile, " may only be specified once, only using the first"); return F_none; } -#endif // _di_fake_make_print_warning_simple_variables_ +#endif // _di_fake_make_print_warning_settings_object_multiple_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/fake/c/main/make/print-warning.h b/level_3/fake/c/main/make/print-warning.h index 595cd2c..7c232f7 100644 --- a/level_3/fake/c/main/make/print-warning.h +++ b/level_3/fake/c/main/make/print-warning.h @@ -221,66 +221,6 @@ extern "C" { extern f_status_t fake_make_print_warning_settings_object_multiple(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t fakefile, const f_string_static_t name); #endif // _di_fake_make_print_warning_settings_object_multiple_ -/** - * Print a simple warning message with a before string, an after string, and a string variable. - * - * This is primarily used by numerous error print functions to reduce code. - * This is not used for any error print functions that has more format structures. - * - * @param setting - * The main program settings. - * (Must be of type fake_setting_t.) - * - * This does not alter setting.status. - * @param print - * The output structure to print to. - * @param before - * The string being printed before the variable. - * @param variable - * The string representing the variable. - * @param after - * The string being printed after the variable. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fake_make_print_warning_simple_variable_ - extern f_status_t fake_make_print_warning_simple_variable(fake_setting_t * const setting, const fl_print_t print, const f_string_t before, const f_string_static_t variable, const f_string_t after); -#endif // _di_fake_make_print_warning_simple_variable_ - -/** - * Print a simple warning message with a before string, a middle strng, an after string, and two string variables. - * - * This is primarily used by numerous error print functions to reduce code. - * This is not used for any error print functions that has more format structures. - * - * @param setting - * The main program settings. - * (Must be of type fake_setting_t.) - * - * This does not alter setting.status. - * @param print - * The output structure to print to. - * @param before - * The string being printed before the variable. - * @param first - * The string representing the first variable. - * @param between - * The string being printed before the variable. - * @param second - * The string representing the second variable. - * @param after - * The string being printed after the variable. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fake_make_print_warning_simple_variables_ - extern f_status_t fake_make_print_warning_simple_variables(fake_setting_t * const setting, const fl_print_t print, const f_string_t before, const f_string_static_t first, const f_string_t between, const f_string_static_t second, const f_string_t after); -#endif // _di_fake_make_print_warning_simple_variables_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/fake/c/main/make/print.c b/level_3/fake/c/main/make/print.c index 92cca46..a90ea05 100644 --- a/level_3/fake/c/main/make/print.c +++ b/level_3/fake/c/main/make/print.c @@ -38,198 +38,6 @@ extern "C" { } #endif // _di_fake_make_print_now_making_ -#ifndef _di_fake_make_print_operate_break_verbose_ - f_status_t fake_make_print_operate_break_verbose(fake_setting_t * const setting, const fl_print_t print, const f_string_statics_t arguments) { - - return fake_make_print_simple_variable_operate_verbose(setting, print, "Breaking as", arguments.used ? arguments.array[0] : fake_make_operation_argument_success_s); - } -#endif // _di_fake_make_print_operate_break_verbose_ - -#ifndef _di_fake_make_print_operate_copy_verbose_ - f_status_t fake_make_print_operate_copy_verbose(fake_setting_t * const setting, const fl_print_t print, const bool clone, const f_string_static_t source, const f_string_static_t destination) { - - if (print.verbosity < f_console_verbosity_verbose_e) return F_output_not; - - f_file_stream_lock(print.to); - - fake_print_line_first_unlocked(setting, print); - - fl_print_format("%s '%[%Q%]' to '", print.to, clone ? "Cloned" : "Copied", print.set->notable, source, print.set->notable); - fl_print_format("%[%Q%]'.%r", print.to, print.set->notable, destination, print.set->notable, f_string_eol_s); - - f_file_stream_unlock(print.to); - - return F_none; - } -#endif // _di_fake_make_print_operate_copy_verbose_ - -#ifndef _di_fake_make_print_operate_define_verbose_ - f_status_t fake_make_print_operate_define_verbose(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t variable) { - - return fake_make_print_simple_variable_operate_verbose(setting, print, "Defined environment variable", variable); - } -#endif // _di_fake_make_print_operate_define_verbose_ - -#ifndef _di_fake_make_print_operate_delete_verbose_ - f_status_t fake_make_print_operate_delete_verbose(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t path) { - - return fake_make_print_simple_variable_operate_verbose(setting, print, "Removed", path); - } -#endif // _di_fake_make_print_operate_delete_verbose_ - -#ifndef _di_fake_make_print_operate_exiting_as_verbose_ - f_status_t fake_make_print_operate_exiting_as_verbose(fake_setting_t * const setting, const fl_print_t print, const f_string_statics_t arguments) { - - return fake_make_print_simple_variable_operate_verbose(setting, print, "Exiting as", arguments.used ? arguments.array[0] : fake_make_operation_argument_success_s); - } -#endif // _di_fake_make_print_operate_exiting_as_verbose_ - -#ifndef _di_fake_make_print_operate_file_not_found_verbose_ - f_status_t fake_make_print_operate_file_not_found_verbose(fake_setting_t * const setting, const fl_print_t print, const bool is_directory, const f_string_static_t file) { - - if (print.verbosity < f_console_verbosity_verbose_e) return F_output_not; - - f_file_stream_lock(print.to); - - fake_print_line_first_unlocked(setting, print); - - fl_print_format("The %Q '%[%Q%]' is not found.%]%r", print.to, print.set->notable, is_directory ? f_file_type_name_directory_s : f_file_type_name_file_s, file, print.set->notable, f_string_eol_s); - - f_file_stream_unlock(print.to); - - return F_none; - } -#endif // _di_fake_make_print_operate_file_not_found_verbose_ - -#ifndef _di_fake_make_print_operate_program_verbose_ - f_status_t fake_make_print_operate_program_verbose(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t program, const f_string_statics_t arguments) { - - if (print.verbosity < f_console_verbosity_verbose_e) return F_output_not; - - f_file_stream_lock(print.to); - - f_array_length_t i = 0; - - if (program.used) { - f_print_dynamic_safely(program, print.to); - } - else { - i = 1; - - f_print_dynamic_safely(arguments.array[0], print.to); - } - - for (; i < arguments.used; ++i) { - if (arguments.array[i].used) fll_print_format(" %Q", print.to, arguments.array[i]); - } // for - - f_print_dynamic_raw(f_string_eol_s, print.to); - - // Flush to stdout before executing command. - f_file_stream_flush(print.to); - - f_file_stream_unlock(print.to); - - return F_none; - } -#endif // _di_fake_make_print_operate_program_verbose_ - -#ifndef _di_fake_make_print_operate_set_failure_state_verbose_ - f_status_t fake_make_print_operate_set_failure_state_verbose(fake_setting_t * const setting, const fl_print_t print, const uint8_t fail) { - - if (print.verbosity < f_console_verbosity_verbose_e) return F_output_not; - - f_file_stream_lock(print.to); - - fake_print_line_first_unlocked(setting, print); - - f_print_terminated("Set failure state to '", print.to); - - if (fail == fake_make_operation_fail_exit_e) { - fl_print_format("%[%r%]", print.to, print.set->notable, fake_make_operation_argument_exit_s, print.set->notable); - } - else if (fail == fake_make_operation_fail_warn_e) { - fl_print_format("%[%r%]", print.to, print.set->notable, fake_make_operation_argument_warn_s, print.set->notable); - } - else { - fl_print_format("%[%r%]", print.to, print.set->notable, fake_make_operation_argument_ignore_s, print.set->notable); - } - - fl_print_format("'.%r", print.to, f_string_eol_s); - - f_file_stream_unlock(print.to); - - return F_none; - } -#endif // _di_fake_make_print_operate_set_failure_state_verbose_ - -#ifndef _di_fake_make_print_operate_set_mode_verbose_ - f_status_t fake_make_print_operate_set_mode_verbose(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t path, const mode_t mode) { - - if (print.verbosity < f_console_verbosity_verbose_e) return F_output_not; - - f_file_stream_lock(print.to); - - fake_print_line_first_unlocked(setting, print); - - fll_print_format("Changed mode of '%[%Q%]' to %[%#@u%].%r", print.to, print.set->notable, path, print.set->notable, print.set->notable, mode, print.set->notable, f_string_eol_s); - - f_file_stream_unlock(print.to); - - return F_none; - } -#endif // _di_fake_make_print_operate_set_mode_verbose_ - -#ifndef _di_fake_make_print_operate_set_path_verbose_ - f_status_t fake_make_print_operate_set_path_verbose(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t path) { - - return fake_make_print_simple_variable_operate_verbose(setting, print, "Changed project path to", path); - } -#endif // _di_fake_make_print_operate_set_path_verbose_ - -#ifndef _di_fake_make_print_operate_set_role_verbose_ - f_status_t fake_make_print_operate_set_role_verbose(fake_setting_t * const setting, const fl_print_t print, const uint8_t what, f_string_static_t role, f_number_unsigned_t id) { - - if (print.verbosity < f_console_verbosity_verbose_e) return F_output_not; - - f_file_stream_lock(print.to); - - fake_print_line_first_unlocked(setting, print); - - fl_print_format("%r %r of '%[%r%]'", print.to, (what & 0x1) ? "Recursively changed" : "Changed", (what & 0x2) ? "owner" : "group", print.set->notable, role, print.set->notable); - fl_print_format(" to %[%ul%].%r", print.to, print.set->notable, id, print.set->notable, f_string_eol_s); - - f_file_stream_unlock(print.to); - - return F_none; - } -#endif // _di_fake_make_print_operate_set_role_verbose_ - -#ifndef _di_fake_make_print_operate_symbolic_link_verbose_ - f_status_t fake_make_print_operate_symbolic_link_verbose(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t source, const f_string_static_t destination) { - - if (print.verbosity < f_console_verbosity_verbose_e) return F_output_not; - - f_file_stream_lock(print.to); - - fake_print_line_first_unlocked(setting, print); - - fl_print_format("Created symbolic link from '%[%Q%]", print.to, print.set->notable, source, print.set->notable); - fl_print_format("' to %[%Q%].%r", print.to, print.set->notable, destination, print.set->notable, f_string_eol_s); - - f_file_stream_unlock(print.to); - - return F_none; - } -#endif // _di_fake_make_print_operate_symbolic_link_verbose_ - -#ifndef _di_fake_make_print_operate_touch_verbose_ - f_status_t fake_make_print_operate_touch_verbose(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t path) { - - return fake_make_print_simple_variable_operate_verbose(setting, print, "Touched", path); - } -#endif // _di_fake_make_print_operate_touch_verbose_ - #ifndef _di_fake_make_print_processing_section_ f_status_t fake_make_print_processing_section(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t buffer, const f_fss_named_t section) { @@ -249,23 +57,6 @@ extern "C" { } #endif // _di_fake_make_print_processing_section_ -#ifndef _di_fake_make_print_simple_variable_operate_verbose_ - f_status_t fake_make_print_simple_variable_operate_verbose(fake_setting_t * const setting, const fl_print_t print, const f_string_t message, const f_string_static_t variable) { - - if (print.verbosity < f_console_verbosity_verbose_e) return F_output_not; - - f_file_stream_lock(print.to); - - fake_print_line_first_unlocked(setting, print); - - fll_print_format("%S '%[%Q%]'.%r", print.to, message, print.set->notable, variable, print.set->notable, f_string_eol_s); - - f_file_stream_unlock(print.to); - - return F_none; - } -#endif // _di_fake_make_print_simple_variable_operate_verbose_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/fake/c/main/make/print.h b/level_3/fake/c/main/make/print.h index d491ecb..7814abb 100644 --- a/level_3/fake/c/main/make/print.h +++ b/level_3/fake/c/main/make/print.h @@ -34,301 +34,6 @@ extern "C" { #endif // _di_fake_make_print_now_making_ /** - * Print operate break verbose message. - * - * @param setting - * The main program settings. - * (Must be of type fake_setting_t.) - * - * This does not alter setting.status. - * @param print - * The output structure to print to. - * @param arguments - * The arguments where the first argument, if defined, is the exiting as string. - * Set arguments.used to 0 to use the default "success" exiting as string. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fake_make_print_operate_break_verbose_ - extern f_status_t fake_make_print_operate_break_verbose(fake_setting_t * const setting, const fl_print_t print, const f_string_statics_t arguments); -#endif // _di_fake_make_print_operate_break_verbose_ - -/** - * Print operate copy verbose message. - * - * @param setting - * The main program settings. - * (Must be of type fake_setting_t.) - * - * This does not alter setting.status. - * @param print - * The output structure to print to. - * @param clone - * If TRUE, then this is a clone operation. - * If FALSE< then this is a copy operation. - * @param source - * The source to copy from. - * @param destination - * The destination to copy to. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fake_make_print_operate_copy_verbose_ - extern f_status_t fake_make_print_operate_copy_verbose(fake_setting_t * const setting, const fl_print_t print, const bool clone, const f_string_static_t source, const f_string_static_t destination); -#endif // _di_fake_make_print_operate_copy_verbose_ - -/** - * Print operate define verbose message. - * - * @param setting - * The main program settings. - * (Must be of type fake_setting_t.) - * - * This does not alter setting.status. - * @param print - * The output structure to print to. - * @param variable - * The environment variable name. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fake_make_print_operate_define_verbose_ - extern f_status_t fake_make_print_operate_define_verbose(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t variable); -#endif // _di_fake_make_print_operate_define_verbose_ - -/** - * Print operate delete verbose message. - * - * @param setting - * The main program settings. - * (Must be of type fake_setting_t.) - * - * This does not alter setting.status. - * @param print - * The output structure to print to. - * @param path - * The path or file that is deleted. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fake_make_print_operate_delete_verbose_ - extern f_status_t fake_make_print_operate_delete_verbose(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t path); -#endif // _di_fake_make_print_operate_delete_verbose_ - -/** - * Print operate exiting as verbose message. - * - * @param setting - * The main program settings. - * (Must be of type fake_setting_t.) - * - * This does not alter setting.status. - * @param print - * The output structure to print to. - * @param arguments - * The arguments where the first argument, if defined, is the exiting as string. - * Set arguments.used to 0 to use the default "success" exiting as string. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fake_make_print_operate_exiting_as_verbose_ - extern f_status_t fake_make_print_operate_exiting_as_verbose(fake_setting_t * const setting, const fl_print_t print, const f_string_statics_t arguments); -#endif // _di_fake_make_print_operate_exiting_as_verbose_ - -/** - * Print operate file or directory not found verbose message. - * - * @param setting - * The main program settings. - * (Must be of type fake_setting_t.) - * - * This does not alter setting.status. - * @param print - * The output structure to print to. - * @param is_directory - * If TRUE, then the file is type directory. - * If FALSE, then the file is type regular. - * @param file - * The file or directory path or name. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fake_make_print_operate_file_not_found_verbose_ - extern f_status_t fake_make_print_operate_file_not_found_verbose(fake_setting_t * const setting, const fl_print_t print, const bool is_directory, const f_string_static_t file); -#endif // _di_fake_make_print_operate_file_not_found_verbose_ - -/** - * Print verbose program message. - * - * @param setting - * The main program settings. - * (Must be of type fake_setting_t.) - * - * This does not alter setting.status. - * @param print - * The output structure to print to. - * @param program - * The program name. - * @param arguments - * The arguments pass to the program. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fake_make_print_operate_program_verbose_ - extern f_status_t fake_make_print_operate_program_verbose(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t program, const f_string_statics_t arguments); -#endif // _di_fake_make_print_operate_program_verbose_ - -/** - * Print verbose message about setting failure state. - * - * @param setting - * The main program settings. - * (Must be of type fake_setting_t.) - * - * This does not alter setting.status. - * @param print - * The output structure to print to. - * @param fail - * The failure state code being set to. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fake_make_print_operate_set_failure_state_verbose_ - extern f_status_t fake_make_print_operate_set_failure_state_verbose(fake_setting_t * const setting, const fl_print_t print, const uint8_t fail); -#endif // _di_fake_make_print_operate_set_failure_state_verbose_ - -/** - * Print verbose message about setting the file mode. - * - * @param setting - * The main program settings. - * (Must be of type fake_setting_t.) - * - * This does not alter setting.status. - * @param print - * The output structure to print to. - * @param path - * The file path having the mode changed. - * @param mode - * The mode being changed to. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fake_make_print_operate_set_mode_verbose_ - extern f_status_t fake_make_print_operate_set_mode_verbose(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t path, const mode_t mode); -#endif // _di_fake_make_print_operate_set_mode_verbose_ - -/** - * Print verbose message about changing the project path. - * - * @param setting - * The main program settings. - * (Must be of type fake_setting_t.) - * - * This does not alter setting.status. - * @param print - * The output structure to print to. - * @param path - * The path being changed to. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fake_make_print_operate_set_path_verbose_ - extern f_status_t fake_make_print_operate_set_path_verbose(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t path); -#endif // _di_fake_make_print_operate_set_path_verbose_ - -/** - * Print verbose message about setting owner or group. - * - * @param setting - * The main program settings. - * (Must be of type fake_setting_t.) - * - * This does not alter setting.status. - * @param print - * The output structure to print to. - * @param what - * Bitwise flags tweaking the message printed. - * - 0x1 = When set, print as recursive; When not set, print as non-recursive. - * - 0x2 = When set, print as Owner; When not set, print as Group. - * @param role - * A string representing the owner or group name. - * @param id - * The uid_t or gid_t representing the owner or group. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fake_make_print_operate_set_role_verbose_ - extern f_status_t fake_make_print_operate_set_role_verbose(fake_setting_t * const setting, const fl_print_t print, const uint8_t what, f_string_static_t role, f_number_unsigned_t id); -#endif // _di_fake_make_print_operate_set_role_verbose_ - -/** - * Print verbose message about create a symbolic link. - * - * @param setting - * The main program settings. - * (Must be of type fake_setting_t.) - * - * This does not alter setting.status. - * @param print - * The output structure to print to. - * @param source - * A string the symbolic link is from. - * @param destination - * A string the symbolic link is to. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fake_make_print_operate_symbolic_link_verbose_ - extern f_status_t fake_make_print_operate_symbolic_link_verbose(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_make_print_operate_symbolic_link_verbose_ - -/** - * Print verbose message about touching a file. - * - * @param setting - * The main program settings. - * (Must be of type fake_setting_t.) - * - * This does not alter setting.status. - * @param print - * The output structure to print to. - * @param path - * The file path being touched. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fake_make_print_operate_touch_verbose_ - extern f_status_t fake_make_print_operate_touch_verbose(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t path); -#endif // _di_fake_make_print_operate_touch_verbose_ - -/** * Print the processing section message. * * @param setting @@ -351,32 +56,6 @@ extern "C" { extern f_status_t fake_make_print_processing_section(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t buffer, const f_fss_named_t section); #endif // _di_fake_make_print_processing_section_ -/** - * Print simple operate verbose message with a 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.status. - * @param print - * The output structure to print to. - * @param message - * The message to print. - * @param variable - * The string representing the variable. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fake_make_print_simple_variable_operate_verbose_ - extern f_status_t fake_make_print_simple_variable_operate_verbose(fake_setting_t * const setting, const fl_print_t print, const f_string_t message, const f_string_static_t variable); -#endif // _di_fake_make_print_simple_variable_operate_verbose_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/fake/c/main/print-error.c b/level_3/fake/c/main/print-error.c new file mode 100644 index 0000000..764d836 --- /dev/null +++ b/level_3/fake/c/main/print-error.c @@ -0,0 +1,657 @@ +#include "fake.h" + +#ifdef __cplusplus +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_status_t status, const f_string_t function) { + + if (print.verbosity < f_console_verbosity_error_e) return F_output_not; + + fake_print_line_first_locked(setting, print); + + fll_error_print(print, F_status_set_fine(status), function, fll_error_file_flag_fallback_e); + + return F_none; + } +#endif // _di_fake_print_error_ + +#ifndef _di_fake_print_error_argument_empty_ + f_status_t fake_print_error_argument_empty(fake_setting_t * const setting, const fl_print_t print, const f_array_length_t index) { + + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + if (!print.to.stream) return F_output_not; + + f_file_stream_lock(print.to); + + fake_print_line_first_unlocked(setting, print); + + fl_print_format("%[%QThe %]", print.to, f_string_eol_s, print.context, print.prefix, print.context); + fl_print_format("%[%un%]", print.to, print.notable, index, print.notable); + fl_print_format("%[ argument must not be an empty string.%]%r", print.to, print.context, print.context, f_string_eol_s); + + f_file_stream_unlock(print.to); + + return F_none; + } +#endif // _di_fake_print_error_argument_empty_ + +#ifndef _di_fake_print_error_build_operation_file_ + f_status_t fake_print_error_build_operation_file(fake_setting_t * const setting, const fl_print_t print, const f_status_t status, const f_string_t function, const f_string_static_t operation, const f_string_static_t source, const f_string_static_t destination, const f_string_static_t how, const bool fallback) { + + if (F_status_set_fine(status) == F_file_found_not) { + if (print.verbosity > f_console_verbosity_quiet_e) { + f_file_stream_lock(print.to); + + fake_print_line_first_unlocked(setting, print); + + fl_print_format("%[%QFailed to find '%]", print.to, print.context, print.prefix, print.context); + fl_print_format("%[%Q%]", print.to, print.notable, source, print.notable); + fl_print_format("%[' ", print.to, print.context); + + fake_print_error_build_operation_file_partial(setting, print, operation, source, destination, how); + + fl_print_format(".%]%r", print.to, print.context, f_string_eol_s); + + f_file_stream_unlock(print.to); + } + + return F_false; + } + + if (F_status_set_fine(status) == F_parameter) { + if (print.verbosity > f_console_verbosity_quiet_e) { + f_file_stream_lock(print.to); + + fake_print_line_first_unlocked(setting, print); + + fl_print_format("%[%QInvalid parameter when calling '%]", print.to, print.context, print.prefix, print.context); + fl_print_format("%[%Q%]", print.to, print.notable, function, print.notable); + fl_print_format("%[() ", print.to, print.context); + + fake_print_error_build_operation_file_partial(setting, print, operation, source, destination, how); + + fl_print_format(".%]%r", print.to, print.context, f_string_eol_s); + + f_file_stream_unlock(print.to); + } + + return F_false; + } + + if (F_status_set_fine(status) == F_name) { + if (print.verbosity > f_console_verbosity_quiet_e) { + f_file_stream_lock(print.to); + + fake_print_line_first_unlocked(setting, print); + + fl_print_format("%[%QInvalid name for '%]", print.to, print.context, print.prefix, print.context); + + if (source.used) { + fl_print_format("%[%Q%]", print.to, print.notable, source, print.notable); + } + + if (destination.used) { + fl_print_format("%[' or '%]", print.to, print.context, print.context); + fl_print_format("%[%Q%]", print.to, print.notable, destination, print.notable); + } + + fl_print_format("%['.%]%r", print.to, print.context, print.context, f_string_eol_s); + + f_file_stream_unlock(print.to); + } + + return F_false; + } + + if (F_status_set_fine(status) == F_memory_not) { + if (print.verbosity > f_console_verbosity_quiet_e) { + fake_print_error_build_operation_file_full(setting, print, "Unable to allocate memory, ", operation, source, destination, how, 0); + } + + return F_false; + } + + if (F_status_set_fine(status) == F_number_overflow) { + if (print.verbosity > f_console_verbosity_quiet_e) { + fake_print_error_build_operation_file_full(setting, print, "Overflow ", operation, source, destination, how, 0); + } + + return F_false; + } + + if (F_status_set_fine(status) == F_directory) { + if (print.verbosity > f_console_verbosity_quiet_e) { + fake_print_error_build_operation_file_full(setting, print, "Invalid directory ", operation, source, destination, how, 0); + } + + return F_false; + } + + if (F_status_set_fine(status) == F_access_denied) { + if (print.verbosity > f_console_verbosity_quiet_e) { + fake_print_error_build_operation_file_full(setting, print, "Access denied ", operation, source, destination, how, 0); + } + + return F_false; + } + + if (F_status_set_fine(status) == F_loop) { + if (print.verbosity > f_console_verbosity_quiet_e) { + fake_print_error_build_operation_file_full(setting, print, "Loop ", operation, source, destination, how, 0); + } + + return F_false; + } + + if (F_status_set_fine(status) == F_prohibited) { + if (print.verbosity > f_console_verbosity_quiet_e) { + fake_print_error_build_operation_file_full(setting, print, "Prohibited by system ", operation, source, destination, how, 0); + } + + return F_false; + } + + if (F_status_set_fine(status) == F_directory_found_not) { + fake_print_error_build_operation_file_full(setting, print, "Failed ", operation, source, destination, how, "due to an invalid directory in the path"); + + return F_false; + } + + if (F_status_set_fine(status) == F_failure) { + if (print.verbosity > f_console_verbosity_quiet_e) { + fake_print_error_build_operation_file_full(setting, print, "Failed ", operation, source, destination, how, 0); + } + + return F_false; + } + + if (fll_error_print(print, F_status_set_fine(status), function, fll_error_file_flag_none_e) == F_known_not && fallback && print.verbosity > f_console_verbosity_quiet_e) { + f_file_stream_lock(print.to); + + fake_print_line_first_unlocked(setting, print); + + fl_print_format("%[UNKNOWN %Q(%]", print.to, print.context, print.prefix, print.context); + fl_print_format("%[%ui%]", print.to, print.notable, F_status_set_fine(status), print.notable); + fl_print_format("%[) occurred ", print.to, print.context); + + fake_print_error_build_operation_file_partial(setting, print, operation, source, destination, how); + + fl_print_format(".%]%r", print.to, print.context, f_string_eol_s); + + f_file_stream_unlock(print.to); + } + + return F_true; + } +#endif // _di_fake_print_error_build_operation_file_ + +#ifndef _di_fake_print_error_build_operation_file_full_ + void fake_print_error_build_operation_file_full(fake_setting_t * const setting, const fl_print_t print, const f_string_t before, const f_string_static_t operation, const f_string_static_t source, const f_string_static_t destination, const f_string_static_t how, const f_string_t after) { + + if (!setting) return; + + f_file_stream_lock(print.to); + + fake_print_line_first_unlocked(setting, print); + + fl_print_format("%[%Q%S", print.to, print.context, print.prefix, before); + + if (source.used) { + fake_print_error_build_operation_file_partial(setting, print, operation, source, destination, how); + } + else { + fl_print_format("%[", print.to, print.context); + } + + 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_error_build_operation_file_full_ + +#ifndef _di_fake_print_error_build_operation_file_partial_ + void fake_print_error_build_operation_file_partial(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t operation, const f_string_static_t source, const f_string_static_t destination, const f_string_static_t how) { + + if (!setting || print.verbosity < f_console_verbosity_error_e || !source.used) return; + + fl_print_format("%[while trying to %Q '%]", print.to, print.context, operation, print.context); + fl_print_format("%[%Q%]", print.to, print.notable, source, print.notable); + + if (destination.used) { + fl_print_format("%[' %Q '%]", print.to, print.context, how, print.context); + fl_print_format("%[%Q%]", print.to, print.notable, destination, print.notable); + } + + fl_print_format("%['", print.to, print.context, print.context); + } +#endif // _di_fake_print_error_build_operation_file_partial_ + +#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) { + + if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; + + f_file_stream_lock(print.to); + + fake_print_line_first_unlocked(setting, print); + + fl_print_format("%[%QThe operation '%]%[", print.to, print.context, print.prefix, print.context, print.notable); + + if (operation == fake_operation_build_e) { + f_print_dynamic(fake_other_operation_build_s, print.to); + } + else if (operation == fake_operation_clean_e) { + f_print_dynamic(fake_other_operation_clean_s, print.to); + } + else if (operation == fake_operation_make_e) { + f_print_dynamic(fake_other_operation_make_s, print.to); + } + else if (operation == fake_operation_skeleton_e) { + f_print_dynamic(fake_other_operation_skeleton_s, print.to); + } + + fl_print_format("%]%[' failed.%]%r", print.to, print.notable, print.context, print.context, f_string_eol_s); + + f_file_stream_unlock(print.to); + + return F_none; + } +#endif // _di_fake_print_error_failure_operation_ + +#ifndef _di_fake_print_error_failure_script_ + f_status_t fake_print_error_failure_script(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t script) { + + if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; + + fake_print_context_wrapped_variable(setting, print, "Failed to execute script ", script, ""); + + return F_none; + } +#endif // _di_fake_print_error_failure_script_ + +#ifndef _di_fake_print_error_fallback_ + f_status_t fake_print_error_fallback(fake_setting_t * const setting, const fl_print_t print, const f_status_t status, const f_string_t function) { + + if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; + + fake_print_line_first_locked(setting, print); + + if (fll_error_print(print, F_status_set_fine(status), function, fll_error_file_flag_none_e) == F_known_not) return F_false; + + return F_true; + } +#endif // _di_fake_print_error_fallback_ + +#ifndef _di_fake_print_error_file_ + f_status_t fake_print_error_file(fake_setting_t * const setting, const fl_print_t print, const f_status_t status, const f_string_t function, const f_string_static_t name, const f_string_static_t operation, const uint8_t type) { + + if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; + + fake_print_line_first_locked(setting, print); + + fll_error_file_print(print, F_status_set_fine(status), function, fll_error_file_flag_fallback_e, name, operation, type); + + return F_none; + } +#endif // _di_fake_print_error_file_ + +#ifndef _di_fake_print_error_file_fallback_ + f_status_t fake_print_error_file_fallback(fake_setting_t * const setting, const fl_print_t print, const f_status_t status, const f_string_t function, const f_string_static_t name, const f_string_static_t operation, const uint8_t type) { + + if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; + + fake_print_line_first_locked(setting, print); + + if (fll_error_file_print(print, F_status_set_fine(status), function, fll_error_file_flag_none_e, name, operation, type) == F_known_not) return F_false; + + return F_true; + } +#endif // _di_fake_print_error_file_fallback_ + +#ifndef _di_fake_print_error_file_simple_ + f_status_t fake_print_error_file_simple(fake_setting_t * const setting, const fl_print_t print, const f_status_t status, const f_string_t function, const f_string_static_t name, const f_string_static_t operation, const uint8_t type) { + + if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; + + fake_print_line_first_locked(setting, print); + + fll_error_file_print(print, F_status_set_fine(status), function, fll_error_file_flag_simple_e, name, operation, type); + + return F_none; + } +#endif // _di_fake_print_error_file_simple_ + +#ifndef _di_fake_print_error_fss_ + f_status_t fake_print_error_fss(fake_setting_t * const setting, const fl_print_t print, const f_status_t status, const f_string_t function, const f_string_static_t path_file, const f_string_range_t range, const bool fallback) { + + // Treat as if status code us unknown when there is no valid setting pointer. + if (!setting) return F_true; + + if (status == F_file_found_not) { + if (print.verbosity > f_console_verbosity_quiet_e) { + fake_print_error_fss_message(setting, print, 0, "Occurred on invalid UTF-8 character at stop position (at ", range.start, " of the setting file ", path_file, ")"); + } + + return F_false; + } + + if (status == F_complete_not_utf || status == F_complete_not_utf_eos || status == F_complete_not_utf_stop) { + if (print.verbosity > f_console_verbosity_quiet_e) { + f_file_stream_lock(print.to); + + fake_print_line_first_unlocked(setting, print); + + fl_print_format("%[%QOccurred on invalid UTF-8 character at %s (at '%]", print.to, print.context, print.prefix, status == F_complete_not_utf_eos ? "end of string" : "stop point of string", print.context); + fl_print_format("%[%un%]", print.to, print.notable, range.start, print.notable); + fl_print_format("%[ of the setting file '%]", print.to, print.context, print.context); + fl_print_format("%[%Q%]", print.to, print.notable, path_file, print.notable); + fl_print_format("%[').%]%r", print.to, print.context, print.context, f_string_eol_s); + + f_file_stream_unlock(print.to); + } + + return F_false; + } + + if (status == F_complete_not_utf_stop) { + if (print.verbosity > f_console_verbosity_quiet_e) { + fake_print_error_fss_message(setting, print, 0, "Occurred on invalid UTF-8 character at stop point of string (at ", range.start, " of the setting file ", path_file, ")"); + } + + return F_false; + } + + if (fll_error_print(print, status, function, fll_error_file_flag_none_e) == F_known_not && fallback) { + if (print.verbosity > f_console_verbosity_quiet_e) { + f_string_static_t function_s = f_string_static_t_initialize; + function_s.string = function; + function_s.used = strlen(function); + + fake_print_error_fss_message(setting, print, "UNKNOWN ", 0, (f_number_unsigned_t) status, ") in function ", function_s, "()"); + } + } + + return F_true; + } +#endif // _di_fake_print_error_fss_ + +#ifndef _di_fake_print_error_fss_message_ + f_status_t fake_print_error_fss_message(fake_setting_t * const setting, const fl_print_t print, const f_string_t prefix, const f_string_t before, const f_number_unsigned_t number, const f_string_t middle, const f_string_static_t variable, const f_string_t after) { + + if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; + + f_file_stream_lock(print.to); + + fake_print_line_first_unlocked(setting, print); + + fl_print_format("%[%S%Q%S(%]", print.to, print.context, prefix, print.prefix, before, print.context); + fl_print_format("%[%un%]", print.to, print.notable, number, print.notable); + fl_print_format("%[)%S'%]", print.to, print.context, middle, print.context); + fl_print_format("%[%Q%]", print.to, print.notable, variable, print.notable); + fl_print_format("%[%S.%]%r", print.to, print.context, after, print.context, f_string_eol_s); + + f_file_stream_unlock(print.to); + + return F_none; + } +#endif // _di_fake_print_error_fss_message_ + +#ifndef _di_fake_print_error_operation_failed_ + f_status_t fake_print_error_operation_failed(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t buffer, const f_string_range_t section_name, const f_string_range_t operation_name) { + + if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; + + f_array_length_t line = 1; + f_state_t state = f_state_t_initialize; + + f_fss_count_lines(state, buffer, operation_name.start, &line); + + f_file_stream_lock(print.to); + + fake_print_line_first_unlocked(setting, print); + + fl_print_format("%[%QThe section operation '%]", print.to, print.context, print.prefix, print.context); + fl_print_format("%[%/Q%]", print.to, print.notable, buffer, operation_name, print.notable); + fl_print_format("%[' from section '%]", print.to, print.context, print.context); + fl_print_format("%[%/Q%]", print.to, print.notable, buffer, section_name, print.notable); + fl_print_format("%[' on line%] ", print.to, print.context, print.context); + fl_print_format("%[%un%]", print.to, print.notable, line, print.notable); + fl_print_format(" %[failed.%]%r", print.to, print.context, print.context, f_string_eol_s); + + f_file_stream_unlock(print.to); + + return F_none; + } +#endif // _di_fake_print_error_operation_failed_ + +#ifndef _di_fake_print_error_operation_link_argument_unknown_ + f_status_t fake_print_error_operation_link_argument_unknown(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t argument) { + + if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; + + f_file_stream_lock(print.to); + + fake_print_line_first_unlocked(setting, print); + + fl_print_format("%[%QThe argument '%]", print.to, print.context, print.prefix, print.context); + fl_print_format("%[%Q%]", print.to, print.notable, argument, print.notable); + fl_print_format("%[' is not not valid and may only be one of either '%]", print.to, print.context, print.context); + fl_print_format("%[%r%]", print.to, print.notable, fake_make_operation_argument_force_s, print.notable); + fl_print_format("%[' or '%]", print.to, print.context, print.context); + fl_print_format("%[%r%]", print.to, print.notable, fake_make_operation_argument_strict_s, print.notable); + fl_print_format("%['.%]%r", print.to, print.context, print.context, f_string_eol_s); + + f_file_stream_unlock(print.to); + + return F_none; + } +#endif // _di_fake_print_error_operation_link_argument_unknown_ + +#ifndef _di_fake_print_error_operation_link_point_exists_ + f_status_t fake_print_error_operation_link_point_exists(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t argument) { + + if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; + + fake_print_context_wrapped_variable(setting, print, "The point file ", argument, " already exists"); + + return F_none; + } +#endif // _di_fake_print_error_operation_link_point_exists_ + +#ifndef _di_fake_print_error_operation_link_target_exists_not_ + f_status_t fake_print_error_operation_link_target_exists_not(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t argument) { + + if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; + + fake_print_context_wrapped_variable(setting, print, "The target file ", argument, " does not exist"); + + return F_none; + } +#endif // _di_fake_print_error_operation_link_target_exists_not_ + +#ifndef _di_fake_print_error_operation_path_outside_ + f_status_t fake_print_error_operation_path_outside(fake_setting_t * const setting, const fl_print_t print, const f_status_t status, const f_string_t function, const f_string_static_t path) { + + if (!setting || print.verbosity < f_console_verbosity_verbose_e) return F_output_not; + + if (F_status_set_fine(status) == F_false) { + fake_print_context_wrapped_variable(setting, print, "The path ", path, " is outside the project root"); + } + else { + fake_print_error_file(setting, print, status, function, path, fake_common_file_path_determine_real_s, fll_error_file_type_file_e); + } + + return F_none; + } +#endif // _di_fake_print_error_operation_path_outside_ + +#ifndef _di_fake_print_error_operation_path_stack_max_ + f_status_t fake_print_error_operation_path_stack_max(fake_setting_t * const setting, const fl_print_t print, const f_status_t status, const f_string_t function, const f_string_static_t path) { + + if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; + + if (status == F_array_too_large) { + f_file_stream_lock(print.to); + + fake_print_line_first_unlocked(setting, print); + + fl_print_format("%[%QMaximum stack size reached while processing path '%]", print.to, print.context, print.prefix, print.context); + fl_print_format("%[%Q%]", print.to, print.notable, path, print.notable); + fl_print_format("%['", print.to, print.context); + + if (function) { + fl_print_format(" while calling%] %[%S%]", print.to, print.context, print.notable, function, print.notable); + fl_print_format("%[()", print.to, print.context); + } + + fl_print_format(".%]%r", print.to, print.context, f_string_eol_s); + + f_file_stream_unlock(print.to); + } + else { + fake_print_error_file(setting, print, status, function, path, fake_common_file_path_change_to_s, fll_error_file_type_directory_e); + } + + return F_none; + } +#endif // _di_fake_print_error_operation_path_stack_max_ + +#ifndef _di_fake_print_error_operation_stack_max_ + f_status_t fake_print_error_operation_stack_max(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t buffer, const f_string_range_t section_name, const f_string_range_t operation_name, const f_array_length_t stack_max) { + + if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; + + f_array_length_t line = 1; + f_state_t state = f_state_t_initialize; + + f_fss_count_lines(state, buffer, operation_name.start, &line); + + f_file_stream_lock(print.to); + + fake_print_line_first_unlocked(setting, print); + + fl_print_format("%[%QThe section operation '%]", print.to, print.context, print.prefix, print.context); + fl_print_format("%[%/Q%]", print.to, print.notable, buffer, operation_name, print.notable); + fl_print_format("%[' from section '%]", print.to, print.context, buffer, print.context); + fl_print_format("%[%/Q%]", print.to, print.notable, buffer, section_name, print.notable); + fl_print_format("%[' on line%] ", print.to, print.context, print.context); + fl_print_format("%[%ul%]", print.to, print.notable, line, print.notable); + fl_print_format("%[' cannot be processed because the max stack depth of%] ", print.to, print.context, print.context); + fl_print_format("%[%ul%]", print.to, print.notable, stack_max, print.notable); + fl_print_format(" %[has been reached.%]%r", print.to, print.context, print.context, f_string_eol_s); + + f_file_stream_unlock(print.to); + + return F_none; + } +#endif // _di_fake_print_error_operation_stack_max_ + +#ifndef _di_fake_print_error_operation_unknown_ + f_status_t fake_print_error_operation_unknown(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t buffer, const f_string_range_t section_name, const f_string_range_t operation_name) { + + if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; + + f_array_length_t line = 1; + f_state_t state = f_state_t_initialize; + + f_fss_count_lines(state, buffer, operation_name.start, &line); + + f_file_stream_lock(print.to); + + fake_print_line_first_unlocked(setting, print); + + fl_print_format("%[%QThe section operation '%]", print.to, print.context, print.prefix, print.context); + fl_print_format("%[%/Q%]", print.to, print.notable, buffer, operation_name, print.notable); + fl_print_format("%[' from section '%]", print.to, print.context, buffer, print.context); + fl_print_format("%[%/Q%]", print.to, print.notable, buffer, section_name, print.notable); + fl_print_format("%[' on line%] ", print.to, print.context, print.context); + fl_print_format("%[%ul%]", print.to, print.notable, line, print.notable); + fl_print_format(" %[is not a known operation name.%]%r", print.to, print.context, print.context, f_string_eol_s); + + f_file_stream_unlock(print.to); + + return F_none; + } +#endif // _di_fake_print_error_operation_unknown_ + +#ifndef _di_fake_print_error_parameter_not_empty_ + f_status_t fake_print_error_parameter_not_empty(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name, const f_string_static_t value) { + + if (!setting || print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + + 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"); + + return F_none; + } +#endif // _di_fake_print_error_parameter_not_empty_ + +#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) { + + if (!setting || print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + + f_file_stream_lock(print.to); + + fake_print_line_first_unlocked(setting, print); + + fl_print_format("%[%QThe '%]", print.to, print.context, print.prefix, print.context); + fl_print_format("%[%Q%Q%]", print.to, print.notable, symbol, name, print.notable); + fl_print_format("%[' parameter value '%]", print.to, print.context, print.context); + fl_print_format("%[%Q%]", print.to, print.notable, value, print.notable); + fl_print_format("%[' contains non-word, non-dash, and non-plus characters.%]%r", print.to, print.context, print.context, f_string_eol_s); + + f_file_stream_unlock(print.to); + + return F_none; + } +#endif // _di_fake_print_error_parameter_not_word_ + +#ifndef _di_fake_print_error_parameter_operation_not_with_ + f_status_t fake_print_error_parameter_operation_not_with(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t operation_1, const f_string_static_t operation_2) { + + if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; + + fake_print_context_wrapped_variables(setting, print, "The operation ", operation_1, " cannot be specified with the operation ", operation_2, 0); + + return F_none; + } +#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) { + + if (!setting || 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"); + + return F_none; + } +#endif // _di_fake_print_error_parameter_too_many_ + +#ifndef _di_fake_print_error_requires_more_arguments_ + f_status_t fake_print_error_requires_more_arguments(fake_setting_t * const setting, const fl_print_t print) { + + if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; + + fake_print_context_simple(setting, print, "Requires more arguments"); + + return F_none; + } +#endif // _di_fake_print_error_requires_more_arguments_ + +#ifndef _di_fake_print_error_too_many_arguments_ + f_status_t fake_print_error_too_many_arguments(fake_setting_t * const setting, const fl_print_t print) { + + if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; + + fake_print_context_simple(setting, print, "Has too many arguments"); + + return F_none; + } +#endif // _di_fake_print_error_too_many_arguments_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_3/fake/c/main/print-error.h b/level_3/fake/c/main/print-error.h new file mode 100644 index 0000000..b61aba7 --- /dev/null +++ b/level_3/fake/c/main/print-error.h @@ -0,0 +1,750 @@ +/** + * FLL - Level 3 + * + * Project: Featureless Make + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Provides the error print functionality. + * + * This is auto-included and should not need to be explicitly included. + */ +#ifndef _fake_print_error_h +#define _fake_print_error_h + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Print generic error message regarding a function failing in some way. + * + * @param setting + * The main program settings. + * + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * @param status + * The status to use. + * This is provided, ignoring setting.status, for thread-safety reasons. + * @param function + * The function name. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + * + * @see fll_error_print() + */ +#ifndef _di_fake_print_error_ + extern f_status_t fake_print_error(fake_setting_t * const setting, const fl_print_t print, const f_status_t status, const f_string_t function); +#endif // _di_fake_print_error_ + +/** + * Print an error message for when an argument is an empty string. + * + * @param data_make + * All make related setting data, including data from the fakefile and the build settings file. + * @param index + * The index of the argument that is an empty string. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + * + * @see fll_print_format() + */ +#ifndef _di_fake_print_error_argument_empty_ + extern f_status_t fake_print_error_argument_empty(fake_setting_t * const setting, const fl_print_t print, const f_array_length_t index); +#endif // _di_fake_print_error_argument_empty_ + +/** + * Print build operation file error messages. + * + * @param setting + * The main program settings. + * + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * @param status + * The status to use. + * This is provided, ignoring data.setting->status, for thread-safety reasons. + * @param function + * The name of the function where the error happened. + * @param operation + * The operation performed. + * @param source + * The operation source. + * @param destination + * The operation destination, if applicable. + * Set destination.used to 0 to disable. + * @param how + * The how the operation is perform, such as "to" in "copy" source "to" destination. + * @param fallback + * Set to F_true to print the fallback error message for unknown errors. + * + * @return + * F_true is returned if the status code has no print message. + * F_false is returned on successful print of known errors. + * + * @see f_file_stream_lock() + * @see f_file_stream_unlock() + * @see fl_print_format() + * + * @see fake_print_error_build_operation_file_partial(); + */ +#ifndef _di_fake_print_error_build_operation_file_ + extern f_status_t fake_print_error_build_operation_file(fake_setting_t * const setting, const fl_print_t print, const f_status_t status, const f_string_t function, const f_string_static_t operation, const f_string_static_t source, const f_string_static_t destination, const f_string_static_t how, const bool fallback); +#endif // _di_fake_print_error_build_operation_file_ + +/** + * Helper function for printing build operation file error messages. + * + * This prints the "copy source to destination" part of the message. + * + * @param setting + * The main program settings. + * + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * @param before + * The string being printed before the variable. + * Likely should have a space added at the end of the string. + * @param operation + * The operation performed. + * @param source + * The operation source. + * @param destination + * The operation destination, if applicable. + * Set destination.used to 0 to disable. + * @param how + * The how the operation is perform, such as "to" in "copy" source "to" destination. + * @param after + * The string being printed after the variable. + * Likely should have a space added at the start of the string. + * + * @see f_file_stream_lock() + * @see f_file_stream_unlock() + * @see fl_print_format() + * + * @see fake_print_error_build_operation_file_partial() + * @see fake_print_line_first_unlocked() + */ +#ifndef _di_fake_print_error_build_operation_file_full_ + extern void fake_print_error_build_operation_file_full(fake_setting_t * const setting, const fl_print_t print, const f_string_t before, const f_string_static_t operation, const f_string_static_t source, const f_string_static_t destination, const f_string_static_t how, const f_string_t after); +#endif // _di_fake_print_error_build_operation_file_full_ + +/** + * Helper function for printing build operation file error messages. + * + * This prints the "copy source to destination" part of the message. + * + * @param setting + * The main program settings. + * + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * @param operation + * The operation performed. + * @param source + * The operation source. + * @param destination + * The operation destination, if applicable. + * Set destination.used to 0 to disable. + * @param how + * The how the operation is perform, such as "to" in "copy" source "to" destination. + * Not optional when destination.used is not 0. + * Not used when destination.used is 0. + * + * @see fl_print_format() + */ +#ifndef _di_fake_print_error_build_operation_file_partial_ + extern void fake_print_error_build_operation_file_partial(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t operation, const f_string_static_t source, const f_string_static_t destination, const f_string_static_t how); +#endif // _di_fake_print_error_build_operation_file_partial_ + +/** + * Print error message for when an operation fails. + * + * @param setting + * The main program settings. + * + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * @param operation + * The identifier of the operation that failed. + * + * @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() + * + * @see fake_print_line_first_unlocked() + */ +#ifndef _di_fake_print_error_failure_operation_ + extern f_status_t fake_print_error_failure_operation(fake_setting_t * const setting, const fl_print_t print, const uint8_t operation); +#endif // _di_fake_print_error_failure_operation_ + +/** + * Print error message for when an operation fails. + * + * @param setting + * The main program settings. + * + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * @param script + * The name of the script that failed. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + * + * @see fake_print_context_wrapped_variable() + */ +#ifndef _di_fake_print_error_failure_script_ + extern f_status_t fake_print_error_failure_script(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t script); +#endif // _di_fake_print_error_failure_script_ + +/** + * Print generic error message regarding a function failing in some way, setting fallback to F_false and returning result. + * + * @param setting + * The main program settings. + * + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * @param status + * The status to use. + * This is provided, ignoring setting.status, for thread-safety reasons. + * @param function + * The function name. + * + * @return + * F_true is returned if the status code has no print message. + * F_false is returned on successful print of known errors. + * F_output_not on success, but no printing is performed. + * + * @see fll_error_file_print() + * + * @see fake_print_line_first_locked() + */ +#ifndef _di_fake_print_error_fallback_ + extern f_status_t fake_print_error_fallback(fake_setting_t * const setting, const fl_print_t print, const f_status_t status, const f_string_t function); +#endif // _di_fake_print_error_fallback_ + +/** + * Print file related error message regarding a function failing in some way. + * + * @param setting + * The main program settings. + * + * This does not alter setting.status. + * @param status + * The status to use. + * This is provided, ignoring setting.status, for thread-safety reasons. + * @param print + * Designates the how and where to print. + * @param name + * The name of the file or directory. + * @param operation + * The operation that fails, such as 'create' or 'access'. + * @param type + * A valid file type code from the fll_error_file_type enum. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + * + * @see fll_error_file_print() + * + * @see fake_print_line_first_locked() + */ +#ifndef _di_fake_print_error_file_ + extern f_status_t fake_print_error_file(fake_setting_t * const setting, const fl_print_t print, const f_status_t status, const f_string_t function, const f_string_static_t name, const f_string_static_t operation, const uint8_t type); +#endif // _di_fake_print_error_file_ + +/** + * Print file related error message regarding a function failing in some way, setting fallback to F_false and returning result.. + * + * @param setting + * The main program settings. + * + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * @param status + * The status to use. + * This is provided, ignoring setting.status, for thread-safety reasons. + * @param name + * The name of the file or directory. + * @param operation + * The operation that fails, such as 'create' or 'access'. + * @param type + * A valid file type code from the fll_error_file_type enum. + * + * @return + * F_true is returned if the status code has no print message. + * F_false is returned on successful print of known errors. + * F_output_not on success, but no printing is performed. + * + * @see fll_error_file_print() + * + * @see fake_print_line_first_locked() + */ +#ifndef _di_fake_print_error_file_fallback_ + extern f_status_t fake_print_error_file_fallback(fake_setting_t * const setting, const fl_print_t print, const f_status_t status, const f_string_t function, const f_string_static_t name, const f_string_static_t operation, const uint8_t type); +#endif // _di_fake_print_error_file_fallback_ + +/** + * 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. + * + * @param setting + * The main program settings. + * + * This does not alter setting.status. + * @param status + * The status to use. + * This is provided, ignoring setting.status, for thread-safety reasons. + * @param print + * Designates the how and where to print. + * @param name + * The name of the file or directory. + * @param operation + * The operation that fails, such as 'create' or 'access'. + * @param type + * A valid file type code from the fll_error_file_type enum. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + * + * @see fll_error_file_print() + * + * @see fake_print_line_first_locked() + */ +#ifndef _di_fake_print_error_file_simple_ + extern f_status_t fake_print_error_file_simple(fake_setting_t * const setting, const fl_print_t print, const f_status_t status, const f_string_t function, const f_string_static_t name, const f_string_static_t operation, const uint8_t type); +#endif // _di_fake_print_error_file_simple_ + +/** + * Print FSS error messages. + * + * @param setting + * The main program settings. + * + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * @param status + * The error status code to report on. + * @param function + * The function call that returned the error. + * @param path_file + * The path to the file. + * @param range + * The range representing the position in the buffer such that range.start is where the error happened. + * @param fallback + * Set to F_true to print the fallback error message for unknown errors. + * + * @return + * F_true is returned if the status code has no print message. + * F_false is returned on successful print of known errors. + * + * @see f_file_stream_lock() + * @see f_file_stream_unlock() + * @see fl_print_format() + * + * @see fake_print_error_fss_message() + * @see fake_print_line_first_unlocked() + */ +#ifndef _di_fake_print_error_fss_ + extern f_status_t fake_print_error_fss(fake_setting_t * const setting, const fl_print_t print, const f_status_t status, const f_string_t function, const f_string_static_t path_file, const f_string_range_t range, const bool fallback); +#endif // _di_fake_print_error_fss_ + +/** + * Print specific FSS error message. + * + * This is primarily used by numerous error print functions to reduce code. + * This is not used for any error print functions that has complex format structures. + * + * @param setting + * The main program settings. + * + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * @param status + * The error status code to report on. + * @param function + * The function call that returned the error. + * @param path_file + * The path to the file. + * @param range + * The range representing the position in the buffer such that range.start is where the error happened. + * @param fallback + * Set to F_true to print the fallback error message for unknown errors. + * + * @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() + * + * @see fake_print_line_first_unlocked() + */ +#ifndef _di_fake_print_error_fss_message_ + extern f_status_t fake_print_error_fss_message(fake_setting_t * const setting, const fl_print_t print, const f_string_t prefix, const f_string_t before, const f_number_unsigned_t number, const f_string_t middle, const f_string_static_t variable, const f_string_t after); +#endif // _di_fake_print_error_fss_message_ + +/** + * Print error messages when processing some fakefile section, for a specific line and operation, and that operation failed. + * + * @param data + * The program data. + * @param print + * Designates how the section error/warning should be printed. + * @param buffer + * The buffer containing the fakefile data. + * @param section_name + * The range within the buffer representing the section name. + * @param operation_name + * The range within the buffer representing the operation name within the section. + * + * @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_error_operation_failed_ + extern f_status_t fake_print_error_operation_failed(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t buffer, const f_string_range_t section_name, const f_string_range_t operation_name); +#endif // _di_fake_print_error_operation_failed_ + +/** + * Print error messages when a given link argument is unknown. + * + * @param data + * The program data. + * @param print + * Designates how the section error/warning should be printed. + * @param argument + * The argument that is unknown by the link operation. + * + * @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_error_operation_link_argument_unknown_ + extern f_status_t fake_print_error_operation_link_argument_unknown(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t argument); +#endif // _di_fake_print_error_operation_link_argument_unknown_ + +/** + * Print error messages when a given link point file already exists. + * + * @param data + * The program data. + * @param print + * Designates how the section error/warning should be printed. + * @param argument + * The argument representing the point file. + * + * @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_error_operation_link_point_exists_ + extern f_status_t fake_print_error_operation_link_point_exists(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t argument); +#endif // _di_fake_print_error_operation_link_point_exists_ + +/** + * Print error messages when a given link target file does not already exist. + * + * @param data + * The program data. + * @param print + * Designates how the section error/warning should be printed. + * @param argument + * The argument representing the point file. + * + * @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() + * + * @see fake_print_wrapped_variable() + */ +#ifndef _di_fake_print_error_operation_link_target_exists_not_ + extern f_status_t fake_print_error_operation_link_target_exists_not(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t argument); +#endif // _di_fake_print_error_operation_link_target_exists_not_ + +/** + * Print error messages when processing some fakefile section, for a specific line and operation, and that operation has a path outside of the project root. + * + * @param data + * The program data. + * @param print + * Designates how the section error/warning should be printed. + * @param status + * The status code representing an error. + * @param function + * The name of the function where the error happened. + * @param path + * The path that is outside of the project path. + * + * @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() + * @see fll_error_file_print() + */ +#ifndef _di_fake_print_error_operation_path_outside_ + extern f_status_t fake_print_error_operation_path_outside(fake_setting_t * const setting, const fl_print_t print, const f_status_t status, const f_string_t function, const f_string_static_t path); +#endif // _fake_print_error_operation_path_outside_ + +/** + * Print error messages when processing some fakefile section, for a specific line and operation. + * + * @param data + * The program data. + * @param error + * Designates how the section error/warning should be printed. + * @param status + * The status code representing an error. + * @param function + * The name of the function where the error happened. + * Set to 0 to disable. + * @param path + * The path to the directory. + * + * @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() + * @see fll_error_file_print() + */ +#ifndef _di_fake_print_error_operation_path_stack_max_ + extern f_status_t fake_print_error_operation_path_stack_max(fake_setting_t * const setting, const fl_print_t print, const f_status_t status, const f_string_t function, const f_string_static_t path); +#endif // _di_fake_print_error_operation_path_stack_max_ + +/** + * Print error messages when processing some fakefile section, for a specific line and operation, and that the max stack depth is reached. + * + * @param data + * The program data. + * @param print + * Designates how the section error/warning should be printed. + * @param buffer + * The buffer containing the fakefile data. + * @param section_name + * The range within the buffer representing the section name. + * @param operation_name + * The range within the buffer representing the operation name within the section. + * @param stack_max + * The max stack depth. + * + * @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_error_operation_stack_max_ + extern f_status_t fake_print_error_operation_stack_max(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t buffer, const f_string_range_t section_name, const f_string_range_t operation_name, const f_array_length_t stack_max); +#endif // _di_fake_print_error_operation_stack_max_ + +/** + * Print error messages when processing some fakefile section, for a specific line and operation, and that operation is invalid. + * + * @param data + * The program data. + * @param print + * Designates how the section error/warning should be printed. + * @param buffer + * The buffer containing the fakefile data. + * @param section_name + * The range within the buffer representing the section name. + * @param operation_name + * The range within the buffer representing the operation name within the section. + * + * @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_error_operation_unknown_ + extern f_status_t fake_print_error_operation_unknown(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t buffer, const f_string_range_t section_name, const f_string_range_t operation_name); +#endif // _di_fake_print_error_operation_unknown_ + +/** + * Print error message for when the parameter value is an empty string. + * + * @param setting + * The main program settings. + * + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * @param symbol + * The symbol of the parameter. + * @param name + * The name of the parameter. + * @param value + * The value that is invalid. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + * + * @see fake_print_context_wrapped_parameter() + */ +#ifndef _di_fake_print_error_parameter_not_empty_ + extern f_status_t fake_print_error_parameter_not_empty(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_not_empty_ + +/** + * Print error message for when the parameter value contains a non-word, non-minus, and non-plus character. + * + * @param setting + * The main program settings. + * + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * @param symbol + * The symbol of the parameter. + * @param name + * The name of the parameter. + * @param value + * The value that is invalid. + * + * @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() + * + * @see fake_print_line_first_unlocked() + */ +#ifndef _di_fake_print_error_parameter_not_word_ + extern 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); +#endif // _di_fake_print_error_parameter_not_word_ + +/** + * Print error message for when two designated operations cannot be used together. + * + * @param setting + * The main program settings. + * + * This does not alter setting.status. + * @param print + * Designates the how and where to print. + * @param operation_1 + * The name of the first operation that cannot be used. + * @param operation_2 + * The name of the second operation that cannot be used. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + * + * @see fake_print_context_wrapped_variables() + */ +#ifndef _di_fake_print_error_parameter_operation_not_with_ + extern f_status_t fake_print_error_parameter_operation_not_with(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t operation_1, const f_string_static_t operation_2); +#endif // _di_fake_print_error_parameter_operation_not_with_ + +/** + * Print an error message for when the parameter is specified too many times. + * + * @param data + * The program data. + * @param parameter + * The parameter name. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + * + * @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); +#endif // _di_fake_print_error_parameter_too_many_ + +/** + * Print an error message for when there are more arguments are required (such as to a fakefile operation). + * + * @param data_make + * All make related setting data, including data from the fakefile and the build settings file. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + * + * @see fake_print_context_simple() + */ +#ifndef _di_fake_print_error_requires_more_arguments_ + extern f_status_t fake_print_error_requires_more_arguments(fake_setting_t * const setting, const fl_print_t print); +#endif // _di_fake_print_error_requires_more_arguments_ + +/** + * Print an error message for when there are too many arguments passed (such as to a fakefile operation). + * + * @param data_make + * All make related setting data, including data from the fakefile and the build settings file. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + * + * @see fake_print_context_simple() + */ +#ifndef _di_fake_print_error_too_many_arguments_ + extern f_status_t fake_print_error_too_many_arguments(fake_setting_t * const setting, const fl_print_t print); +#endif // _di_fake_print_error_too_many_arguments_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _fake_print_error_h diff --git a/level_3/fake/c/main/private-common.c b/level_3/fake/c/main/print-warning.c similarity index 78% rename from level_3/fake/c/main/private-common.c rename to level_3/fake/c/main/print-warning.c index 1d7722e..11b1a4c 100644 --- a/level_3/fake/c/main/private-common.c +++ b/level_3/fake/c/main/print-warning.c @@ -1,5 +1,4 @@ #include "fake.h" -#include "private-common.h" #ifdef __cplusplus extern "C" { diff --git a/level_3/fake/c/main/print-warning.h b/level_3/fake/c/main/print-warning.h new file mode 100644 index 0000000..bc8f51b --- /dev/null +++ b/level_3/fake/c/main/print-warning.h @@ -0,0 +1,23 @@ +/** + * FLL - Level 3 + * + * Project: Featureless Make + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Provides the warning print functionality. + * + * This is auto-included and should not need to be explicitly included. + */ +#ifndef _fake_print_warning_h +#define _fake_print_warning_h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _fake_print_warning_h diff --git a/level_3/fake/c/main/print.c b/level_3/fake/c/main/print.c index 69be1e6..446ed9c 100644 --- a/level_3/fake/c/main/print.c +++ b/level_3/fake/c/main/print.c @@ -4,194 +4,90 @@ 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_status_t status, const f_string_t function) { +#ifndef _di_fake_print_context_simple_ + void fake_print_context_simple(fake_setting_t * const setting, const fl_print_t print, const f_string_t message) { - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; - - fake_print_line_first_locked(setting, print); - - fll_error_print(print, F_status_set_fine(status), function, fll_error_file_flag_fallback_e); - - return F_none; - } -#endif // _di_fake_print_error_ - -#ifndef _di_fake_print_error_fallback_ - f_status_t fake_print_error_fallback(fake_setting_t * const setting, const fl_print_t print, const f_status_t status, const f_string_t function) { - - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; - - fake_print_line_first_locked(setting, print); - - if (fll_error_print(print, F_status_set_fine(status), function, fll_error_file_flag_none_e) == F_known_not) return F_false; - - return F_true; - } -#endif // _di_fake_print_error_fallback_ - -#ifndef _di_fake_print_error_file_ - f_status_t fake_print_error_file(fake_setting_t * const setting, const fl_print_t print, const f_status_t status, const f_string_t function, const f_string_static_t name, const f_string_static_t operation, const uint8_t type) { - - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; - - fake_print_line_first_locked(setting, print); - - fll_error_file_print(print, F_status_set_fine(status), function, fll_error_file_flag_fallback_e, name, operation, type); - - return F_none; - } -#endif // _di_fake_print_error_file_ - -#ifndef _di_fake_print_error_file_simple_ - f_status_t fake_print_error_file_simple(fake_setting_t * const setting, const fl_print_t print, const f_status_t status, const f_string_t function, const f_string_static_t name, const f_string_static_t operation, const uint8_t type) { - - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; - - fake_print_line_first_locked(setting, print); - - fll_error_file_print(print, F_status_set_fine(status), function, fll_error_file_flag_simple_e, name, operation, type); - - return F_none; - } -#endif // _di_fake_print_error_file_simple_ - -#ifndef _di_fake_print_error_file_fallback_ - f_status_t fake_print_error_file_fallback(fake_setting_t * const setting, const fl_print_t print, const f_status_t status, const f_string_t function, const f_string_static_t name, const f_string_static_t operation, const uint8_t type) { - - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; - - fake_print_line_first_locked(setting, print); - - if (fll_error_file_print(print, F_status_set_fine(status), function, fll_error_file_flag_none_e, name, operation, type) == F_known_not) return F_false; - - return F_true; - } -#endif // _di_fake_print_error_file_fallback_ - -#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) { - - if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; + if (!setting) return; f_file_stream_lock(print.to); fake_print_line_first_unlocked(setting, print); - fl_print_format("%[%QThe operation '%]%[", print.to, print.context, print.prefix, print.context, print.notable); - - if (operation == fake_operation_build_e) { - f_print_dynamic(fake_other_operation_build_s, print.to); - } - else if (operation == fake_operation_clean_e) { - f_print_dynamic(fake_other_operation_clean_s, print.to); - } - else if (operation == fake_operation_make_e) { - f_print_dynamic(fake_other_operation_make_s, print.to); - } - else if (operation == fake_operation_skeleton_e) { - f_print_dynamic(fake_other_operation_skeleton_s, print.to); - } - - fl_print_format("%]%[' failed.%]%r", print.to, print.notable, print.context, print.context, f_string_eol_s); + fl_print_format("%[%Q%S.%]%r", print.to, print.context, print.prefix, message, print.context, f_string_eol_s); f_file_stream_unlock(print.to); - - return F_none; } -#endif // _di_fake_print_error_failure_operation_ +#endif // _di_fake_print_context_simple_ -#ifndef _di_fake_print_error_failure_script_ - f_status_t fake_print_error_failure_script(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t script) { +#ifndef _di_fake_print_context_simple_variable_ + void fake_print_context_simple_variable(fake_setting_t * const setting, const fl_print_t print, const f_string_t before, const f_string_static_t variable, const f_string_t after) { - if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; + if (!setting) return; f_file_stream_lock(print.to); fake_print_line_first_unlocked(setting, print); - fl_print_format("%[%QFailed to execute script '%]", print.to, print.context, print.prefix, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, script, print.notable); - fl_print_format("%['.%]%r", print.to, print.context, print.context, f_string_eol_s); + fl_print_format("%[%Q%S'%]", print.to, print.context, print.prefix, before, print.context); + fl_print_format("%[%Q%]", print.to, print.notable, variable, print.notable); + fl_print_format("%['%S.%]%r", print.to, print.context, after, print.context, f_string_eol_s); f_file_stream_unlock(print.to); - - return F_none; } -#endif // _di_fake_print_error_failure_script_ +#endif // _di_fake_print_context_simple_variable_ -#ifndef _di_fake_print_error_parameter_not_empty_ - f_status_t fake_print_error_parameter_not_empty(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) { +#ifndef _di_fake_print_context_wrapped_parameter_ + void fake_print_context_wrapped_parameter(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 after) { - if (!setting || print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - - if (!F_status_is_error(setting->status)) { - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; - } + if (!setting) return; f_file_stream_lock(print.to); fake_print_line_first_unlocked(setting, print); - fl_print_format("%[%QThe '%]", print.to, print.context, print.prefix, print.context); + 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("%[' parameter must not be empty and must not contain only white space.%]%r", print.to, print.context, print.context, f_string_eol_s); + fl_print_format("%['%S.%]%r", print.to, print.context, after, print.context, f_string_eol_s); f_file_stream_unlock(print.to); - - return F_none; } -#endif // _di_fake_print_error_parameter_not_empty_ - -#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) { +#endif // _di_fake_print_context_wrapped_parameter_ - if (!setting || print.verbosity == f_console_verbosity_quiet_e) return F_output_not; +#ifndef _di_fake_print_context_wrapped_variable_ + void fake_print_context_wrapped_variable(fake_setting_t * const setting, const fl_print_t print, const f_string_t before, const f_string_static_t variable, const f_string_t after) { - if (!F_status_is_error(setting->status)) { - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; - } + if (!setting) return; f_file_stream_lock(print.to); fake_print_line_first_unlocked(setting, print); - fl_print_format("%[%QThe '%]", print.to, print.context, print.prefix, print.context); - fl_print_format("%[%Q%Q%]", print.to, print.notable, symbol, name, print.notable); - fl_print_format("%[' parameter value '%]", print.to, print.context, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, value, print.notable); - fl_print_format("%[' contains non-word, non-dash, and non-plus characters.%]%r", print.to, print.context, print.context, f_string_eol_s); + fl_print_format("%[%Q%S'%]", print.to, print.context, print.prefix, before, print.context); + fl_print_format("%[%Q%]", print.to, print.notable, variable, print.notable); + fl_print_format("%['%S.%]%r", print.to, print.context, after, print.context, f_string_eol_s); f_file_stream_unlock(print.to); - - return F_none; } -#endif // _di_fake_print_error_parameter_not_word_ - -#ifndef _di_fake_print_error_parameter_operation_not_with_ - f_status_t fake_print_error_parameter_operation_not_with(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t operation_1, const f_string_static_t operation_2) { +#endif // _di_fake_print_context_wrapped_variable_ - if (!setting || print.verbosity == f_console_verbosity_quiet_e) return F_output_not; +#ifndef _di_fake_print_context_wrapped_variables_ + void fake_print_context_wrapped_variables(fake_setting_t * const setting, const fl_print_t print, const f_string_t before, const f_string_static_t first, const f_string_t between, const f_string_static_t second, const f_string_t after) { - if (!F_status_is_error(setting->status)) { - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; - } + if (!setting) return; f_file_stream_lock(print.to); fake_print_line_first_unlocked(setting, print); - fl_print_format("%[%QThe operation '%]", print.to, print.context, print.prefix, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, operation_1, print.notable); - fl_print_format("%[' cannot be specified with the operation '%]", print.to, print.context, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, operation_2, print.notable); - fl_print_format("%['.%]%r", print.to, print.context, print.context, f_string_eol_s); + fl_print_format("%[%Q%S'%]", print.to, print.context, print.prefix, before, print.context); + fl_print_format("%[%Q%]", print.to, print.notable, first, print.notable); + fl_print_format("%['%S'%]", print.to, print.context, between, print.context); + fl_print_format("%[%Q%]", print.to, print.notable, second, print.notable); + fl_print_format("%['%S.%]%r", print.to, print.context, after, print.context, f_string_eol_s); f_file_stream_unlock(print.to); - - return F_none; } -#endif // _di_fake_print_error_parameter_operation_not_with_ +#endif // _di_fake_print_context_wrapped_variables_ #ifndef _di_fake_print_help_ f_status_t fake_print_help(fake_setting_t * const setting, const fl_print_t print) { @@ -399,604 +295,44 @@ extern "C" { } #endif // _di_fake_print_operation_cancelled_ -#ifndef _di_fake_print_error_build_operation_file_ - f_status_t fake_print_error_build_operation_file(fake_setting_t * const setting, const fl_print_t print, const f_status_t status, const f_string_t function, const f_string_static_t operation, const f_string_static_t source, const f_string_static_t destination, const f_string_static_t how, const bool fallback) { - - if (F_status_set_fine(status) == F_file_found_not) { - if (print.verbosity > f_console_verbosity_quiet_e) { - f_file_stream_lock(print.to); - - fake_print_line_first_unlocked(setting, print); - - fl_print_format("%[%QFailed to find '%]", print.to, print.context, print.prefix, print.context); - - fake_print_error_build_operation_file_message(setting, print, operation, source, destination, how); - - fl_print_format("%['.%]%r", print.to, print.context, print.context, f_string_eol_s); - - f_file_stream_unlock(print.to); - } - - return F_false; - } - - if (F_status_set_fine(status) == F_parameter) { - if (print.verbosity > f_console_verbosity_quiet_e) { - f_file_stream_lock(print.to); - - fake_print_line_first_unlocked(setting, print); - - fl_print_format("%[%QInvalid parameter when calling '%]", print.to, print.context, print.prefix, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, function, print.notable); - fl_print_format("%[() to %Q '%]", print.to, print.context, operation, print.context); - - fake_print_error_build_operation_file_message(setting, print, operation, source, destination, how); - - fl_print_format("%['.%]%r", print.to, print.context, print.context, f_string_eol_s); - - f_file_stream_unlock(print.to); - } - - return F_false; - } - - if (F_status_set_fine(status) == F_name) { - if (print.verbosity > f_console_verbosity_quiet_e) { - f_file_stream_lock(print.to); - - fake_print_line_first_unlocked(setting, print); - - fl_print_format("%[%QInvalid name for '%]", print.to, print.context, print.prefix, print.context); - - if (source.used) { - fl_print_format("%[%Q%]", print.to, print.notable, source, print.notable); - } - - if (destination.used) { - fl_print_format("%[' or '%]", print.to, print.context, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, destination, print.notable); - } - - fl_print_format("%['.%]%r", print.to, print.context, print.context, f_string_eol_s); - - f_file_stream_unlock(print.to); - } - - return F_false; - } - - if (F_status_set_fine(status) == F_memory_not) { - if (print.verbosity > f_console_verbosity_quiet_e) { - f_file_stream_lock(print.to); - - fake_print_line_first_unlocked(setting, print); - - fl_print_format("%[%QUnable to allocate memory, while trying to %Q '%]", print.to, print.context, print.prefix, operation, print.context); - - fake_print_error_build_operation_file_message(setting, print, operation, source, destination, how); - - fl_print_format("%['.%]%r", print.to, print.context, print.context, f_string_eol_s); - - f_file_stream_unlock(print.to); - } - - return F_false; - } - - if (F_status_set_fine(status) == F_number_overflow) { - if (print.verbosity > f_console_verbosity_quiet_e) { - f_file_stream_lock(print.to); - - fake_print_line_first_unlocked(setting, print); - - fl_print_format("%[%QOverflow while trying to %Q '%]", print.to, print.context, print.prefix, operation, print.context); - - fake_print_error_build_operation_file_message(setting, print, operation, source, destination, how); - - fl_print_format("%['.%]%r", print.to, print.context, print.context, f_string_eol_s); - - f_file_stream_unlock(print.to); - } - - return F_false; - } - - if (F_status_set_fine(status) == F_directory) { - if (print.verbosity > f_console_verbosity_quiet_e) { - f_file_stream_lock(print.to); - - fake_print_line_first_unlocked(setting, print); - - fl_print_format("%[%QInvalid directory while trying to %Q '%]", print.to, print.context, print.prefix, operation, print.context); - - fake_print_error_build_operation_file_message(setting, print, operation, source, destination, how); - - fl_print_format("%['.%]%r", print.to, print.context, print.context, f_string_eol_s); - - f_file_stream_unlock(print.to); - } - - return F_false; - } - - if (F_status_set_fine(status) == F_access_denied) { - if (print.verbosity > f_console_verbosity_quiet_e) { - f_file_stream_lock(print.to); - - fake_print_line_first_unlocked(setting, print); - - fl_print_format("%[%QAccess denied while trying to %Q '%]", print.to, print.context, print.prefix, operation, print.context); - - fake_print_error_build_operation_file_message(setting, print, operation, source, destination, how); - - fl_print_format("%['.%]%r", print.to, print.context, print.context, f_string_eol_s); - - f_file_stream_unlock(print.to); - } - - return F_false; - } - - if (F_status_set_fine(status) == F_loop) { - if (print.verbosity > f_console_verbosity_quiet_e) { - f_file_stream_lock(print.to); - - fake_print_line_first_unlocked(setting, print); - - fl_print_format("%[%QLoop while trying to %Q '%]", print.to, print.context, print.prefix, operation, print.context); - - fake_print_error_build_operation_file_message(setting, print, operation, source, destination, how); - - fl_print_format("%['.%]%r", print.to, print.context, print.context, f_string_eol_s); - - f_file_stream_unlock(print.to); - } - - return F_false; - } - - if (F_status_set_fine(status) == F_prohibited) { - if (print.verbosity > f_console_verbosity_quiet_e) { - f_file_stream_lock(print.to); - - fake_print_line_first_unlocked(setting, print); - - fl_print_format("%[%QProhibited by system while trying to %Q '%]", print.to, print.context, print.prefix, operation, print.context); - - fake_print_error_build_operation_file_message(setting, print, operation, source, destination, how); - - fl_print_format("%['.%]%r", print.to, print.context, print.context, f_string_eol_s); - - f_file_stream_unlock(print.to); - } - - return F_false; - } - - if (F_status_set_fine(status) == F_directory_found_not) { - if (print.verbosity > f_console_verbosity_quiet_e) { - f_file_stream_lock(print.to); - - fake_print_line_first_unlocked(setting, print); - - fl_print_format("%[%QFailed to %Q '%]", print.to, print.context, print.prefix, operation, print.context); - - fake_print_error_build_operation_file_message(setting, print, operation, source, destination, how); - - fl_print_format("%[' due to an invalid directory in the path.%]%r", print.to, print.context, print.context, f_string_eol_s); - - f_file_stream_unlock(print.to); - } - - return F_false; - } - - if (F_status_set_fine(status) == F_failure) { - if (print.verbosity > f_console_verbosity_quiet_e) { - f_file_stream_lock(print.to); - - fake_print_line_first_unlocked(setting, print); - - fl_print_format("%[%QFailed to %Q '%]", print.to, print.context, print.prefix, operation, print.context); - - fake_print_error_build_operation_file_message(setting, print, operation, source, destination, how); - - fl_print_format("%['.%]%r", print.to, print.context, print.context, f_string_eol_s); - - f_file_stream_unlock(print.to); - } - - return F_false; - } - - if (fll_error_print(print, F_status_set_fine(status), function, fll_error_file_flag_none_e) == F_known_not && fallback && print.verbosity > f_console_verbosity_quiet_e) { - f_file_stream_lock(print.to); - - fake_print_line_first_unlocked(setting, print); - - fl_print_format("%[UNKNOWN %Q(%]", print.to, print.context, print.prefix, print.context); - fl_print_format("%[%ui%]", print.to, print.notable, F_status_set_fine(status), print.notable); - fl_print_format("%[) occurred while trying to %Q '%]", print.to, print.context, operation, print.context); - - fake_print_error_build_operation_file_message(setting, print, operation, source, destination, how); - - fl_print_format("%['.%]%r", print.to, print.context, print.context, f_string_eol_s); - - f_file_stream_unlock(print.to); - } - - return F_true; - } -#endif // _di_fake_print_error_build_operation_file_ - -#ifndef _di_fake_print_error_build_operation_file_message_ - void fake_print_error_build_operation_file_message(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t operation, const f_string_static_t source, const f_string_static_t destination, const f_string_static_t how) { - - if (source.used) { - fl_print_format("%[%Q%]", print.to, print.notable, source, print.notable); - } - - fl_print_format("%[while trying to %Q '%]", print.to, print.context, operation, print.context); - - if (destination.used) { - fl_print_format("%[' %Q '%]", print.to, print.context, how, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, destination, print.notable); - } - else if (source.used) { - fl_print_format("%[%Q%]", print.to, print.notable, source, print.notable); - } - } -#endif // _di_fake_print_error_build_operation_file_message_ - -#ifndef _di_fake_print_error_fss - f_status_t fake_print_error_fss(fake_setting_t * const setting, const fl_print_t print, const f_status_t status, const f_string_t function, const f_string_static_t path_file, const f_string_range_t range, const bool fallback) { - - if (status == F_file_found_not) { - if (print.verbosity > f_console_verbosity_quiet_e) { - f_file_stream_lock(print.to); - - fake_print_line_first_unlocked(setting, print); - - fl_print_format("%[%QOccurred on invalid UTF-8 character at stop position (at '%]", print.to, print.context, print.prefix, print.context); - fl_print_format("%[%un%]", print.to, print.notable, range.start, print.notable); - fl_print_format("%[ of setting file '%]", print.to, print.context, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, path_file, print.notable); - fl_print_format("%[').%]%r", print.to, print.context, print.context, f_string_eol_s); - - f_file_stream_unlock(print.to); - } - - return F_false; - } - - if (status == F_complete_not_utf || status == F_complete_not_utf_eos || status == F_complete_not_utf_stop) { - if (print.verbosity > f_console_verbosity_quiet_e) { - f_file_stream_lock(print.to); - - fake_print_line_first_unlocked(setting, print); - - fl_print_format("%[%QOccurred on invalid UTF-8 character at %s (at '%]", print.to, print.context, print.prefix, status == F_complete_not_utf_eos ? "end of string" : "stop point of string", print.context); - fl_print_format("%[%un%]", print.to, print.notable, range.start, print.notable); - fl_print_format("%[ of setting file '%]", print.to, print.context, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, path_file, print.notable); - fl_print_format("%[').%]%r", print.to, print.context, print.context, f_string_eol_s); - - f_file_stream_unlock(print.to); - } - - return F_false; - } - - if (status == F_complete_not_utf_stop) { - if (print.verbosity > f_console_verbosity_quiet_e) { - f_file_stream_lock(print.to); - - fake_print_line_first_unlocked(setting, print); - - fl_print_format("%[%QOccurred on invalid UTF-8 character at stop point of string (at '%]", print.to, print.context, print.prefix, print.context); - fl_print_format("%[%un%]", print.to, print.notable, range.start, print.notable); - fl_print_format("%[ of setting file '%]", print.to, print.context, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, path_file, print.notable); - fl_print_format("%[').%]%r", print.to, print.context, print.context, f_string_eol_s); - - f_file_stream_unlock(print.to); - } - - return F_false; - } - - if (fll_error_print(print, status, function, fll_error_file_flag_none_e) == F_known_not && fallback && print.verbosity > f_console_verbosity_quiet_e) { - f_file_stream_lock(print.to); - - fake_print_line_first_unlocked(setting, print); - - fl_print_format("%[UNKNOWN %Q(%]", print.to, print.context, print.prefix, print.context); - fl_print_format("%[%ui%]", print.to, print.notable, status, print.notable); - fl_print_format("%[) in function '%]", print.to, print.context, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, function, print.notable); - fl_print_format("%[().%]%r", print.to, print.context, print.context, f_string_eol_s); - - f_file_stream_unlock(print.to); - } - - return F_true; - } -#endif // _di_fake_print_error_fss - -#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) { - - if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - - f_file_stream_lock(print.to); - - fl_print_format("%[%QThe parameter '%]", print.to, print.context, print.prefix, print.context); - fl_print_format("%[%r%r%]", print.to, print.notable, f_console_symbol_long_normal_s, parameter, print.notable); - fl_print_format("%[' was specified too many times.%]%r", print.to, print.context, print.context, f_string_eol_s); - - f_file_stream_unlock(print.to); - - return F_none; - } -#endif // _di_fake_print_error_parameter_too_many_ - -#ifndef _di_fake_print_error_requires_more_arguments_ - f_status_t fake_print_error_requires_more_arguments(fake_setting_t * const setting, const fl_print_t print) { - - if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - if (!print.to.stream) return F_output_not; - - f_file_stream_lock(print.to); - - fake_print_line_first_unlocked(setting, print); - - fl_print_format("%[%QRequires more arguments.%]%r", print.to, print.context, print.prefix, print.context, f_string_eol_s); - - f_file_stream_unlock(print.to); - - return F_none; - } -#endif // _di_fake_print_error_requires_more_arguments_ - -#ifndef _di_fake_print_error_too_many_arguments_ - f_status_t fake_print_error_too_many_arguments(fake_setting_t * const setting, const fl_print_t print) { - - if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - if (!print.to.stream) return F_output_not; +#ifndef _di_fake_print_simple_ + void fake_print_simple(fake_setting_t * const setting, const fl_print_t print, const f_string_t message) { f_file_stream_lock(print.to); fake_print_line_first_unlocked(setting, print); - fll_print_format("%[%QHas too many arguments.%]%r", print.to, print.context, print.prefix, print.context, f_string_eol_s); + fll_print_format("%S.%r", print.to, message, f_string_eol_s); f_file_stream_unlock(print.to); - - return F_none; - } -#endif // _di_fake_print_error_too_many_arguments_ - -#ifndef _di_fake_print_error_argument_empty_ - f_status_t fake_print_error_argument_empty(fake_setting_t * const setting, const fl_print_t print, const f_array_length_t index) { - - if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - if (!print.to.stream) return F_output_not; - - f_file_stream_lock(print.to); - - fake_print_line_first_unlocked(setting, print); - - fl_print_format("%[%QThe %]", print.to, f_string_eol_s, print.context, print.prefix, print.context); - fl_print_format("%[%un%]", print.to, print.notable, index, print.notable); - fl_print_format("%[ argument must not be an empty string.%]%r", print.to, print.context, print.context, f_string_eol_s); - - f_file_stream_unlock(print.to); - - return F_none; } -#endif // _di_fake_print_error_argument_empty_ - -#ifndef _di_fake_print_message_section_operation_failed_ - f_status_t fake_print_message_section_operation_failed(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t buffer, const f_string_range_t section_name, const f_string_range_t operation_name) { +#endif // _di_fake_print_simple_ - if (print.verbosity == f_console_verbosity_quiet_e || !print.to.stream) return F_output_not; - - f_array_length_t line = 1; - f_state_t state = f_state_t_initialize; - - f_fss_count_lines(state, buffer, operation_name.start, &line); +#ifndef _di_fake_print_simple_variable_ + void fake_print_simple_variable(fake_setting_t * const setting, const fl_print_t print, const f_string_t message, const f_string_static_t variable) { f_file_stream_lock(print.to); fake_print_line_first_unlocked(setting, print); - fl_print_format("%[%QThe section operation '%]", print.to, print.context, print.prefix, print.context); - fl_print_format("%[%/Q%]", print.to, print.notable, buffer, operation_name, print.notable); - fl_print_format("%[' from section '%]", print.to, print.context, print.context); - fl_print_format("%[%/Q%]", print.to, print.notable, buffer, section_name, print.notable); - fl_print_format("%[' on line%] ", print.to, print.context, print.context); - fl_print_format("%[%un%]", print.to, print.notable, line, print.notable); - fl_print_format(" %[failed.%]%r", print.to, print.context, print.context, f_string_eol_s); + fll_print_format("%S '%[%Q%]'.%r", print.to, message, print.set->notable, variable, print.set->notable, f_string_eol_s); f_file_stream_unlock(print.to); - - return F_none; } -#endif // _di_fake_print_message_section_operation_failed_ - -#ifndef _di_fake_print_message_section_operation_link_argument_unknown_ - f_status_t fake_print_message_section_operation_link_argument_unknown(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t argument) { +#endif // _di_fake_print_simple_variable_ - if (print.verbosity == f_console_verbosity_quiet_e || !print.to.stream) return F_output_not; +#ifndef _di_fake_print_wrapped_variable_ + void fake_print_wrapped_variable(fake_setting_t * const setting, const fl_print_t print, const f_string_t before, const f_string_static_t variable, const f_string_t after) { f_file_stream_lock(print.to); fake_print_line_first_unlocked(setting, print); - fl_print_format("%[%QThe argument '%]", print.to, print.context, print.prefix, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, argument, print.notable); - fl_print_format("%[' is not not valid and may only be one of either '%]", print.to, print.context, print.context); - fl_print_format("%[%r%]", print.to, print.notable, fake_make_operation_argument_force_s, print.notable); - fl_print_format("%[' or '%]", print.to, print.context, print.context); - fl_print_format("%[%r%]", print.to, print.notable, fake_make_operation_argument_strict_s, print.notable); - fl_print_format("%['.%]%r", print.to, print.context, print.context, f_string_eol_s); + fll_print_format("%S'%[%Q%]'%S.%r", print.to, before, print.set->notable, variable, print.set->notable, after, f_string_eol_s); f_file_stream_unlock(print.to); - - return F_none; - } -#endif // _di_fake_print_message_section_operation_link_argument_unknown_ - -#ifndef _di_fake_print_message_section_operation_link_point_exists_ - f_status_t fake_print_message_section_operation_link_point_exists(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t argument) { - - if (print.verbosity == f_console_verbosity_quiet_e || !print.to.stream) return F_output_not; - - f_file_stream_lock(print.to); - - fake_print_line_first_unlocked(setting, print); - - fl_print_format("%[%QThe point file '%]", print.to, print.context, print.prefix, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, argument, print.notable); - fl_print_format("%[' already exists.%]%r", print.to, print.context, print.context, f_string_eol_s); - - f_file_stream_unlock(print.to); - - return F_none; - } -#endif // _di_fake_print_message_section_operation_link_point_exists_ - -#ifndef _di_fake_print_message_section_operation_link_target_exists_not_ - f_status_t fake_print_message_section_operation_link_target_exists_not(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t argument) { - - if (print.verbosity == f_console_verbosity_quiet_e || !print.to.stream) return F_output_not; - - f_file_stream_lock(print.to); - - fake_print_line_first_unlocked(setting, print); - - fl_print_format("%[%QThe target file '%]", print.to, print.context, print.prefix, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, argument, print.notable); - fl_print_format("%[' does not exist.%]%r", print.to, print.context, print.context, f_string_eol_s); - - f_file_stream_unlock(print.to); - - return F_none; - } -#endif // _di_fake_print_message_section_operation_link_target_exists_not_ - -#ifndef _di_fake_print_message_section_operation_path_outside_ - f_status_t fake_print_message_section_operation_path_outside(fake_setting_t * const setting, const fl_print_t print, const f_status_t status, const f_string_t function, const f_string_static_t path) { - - if (print.verbosity == f_console_verbosity_quiet_e || !print.to.stream) return F_output_not; - - if (F_status_set_fine(status) == F_false) { - f_file_stream_lock(print.to); - - fake_print_line_first_unlocked(setting, print); - - fl_print_format("%[%QThe path '%]", print.to, print.context, print.prefix, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, path, print.notable); - fl_print_format("%[' is outside the project root.%]%r", print.to, print.context, print.context, f_string_eol_s); - - f_file_stream_unlock(print.to); - } - else { - fake_print_error_file(setting, print, status, function, path, fake_common_file_path_determine_real_s, fll_error_file_type_file_e); - } - - return F_none; - } -#endif // _di_fake_print_message_section_operation_path_outside_ - -#ifndef _di_fake_print_message_section_operation_path_stack_max_ - f_status_t fake_print_message_section_operation_path_stack_max(fake_setting_t * const setting, const fl_print_t print, const f_status_t status, const f_string_t function, const f_string_static_t path) { - - if (print.verbosity == f_console_verbosity_quiet_e || !print.to.stream) return F_output_not; - - if (status == F_array_too_large) { - f_file_stream_lock(print.to); - - fake_print_line_first_unlocked(setting, print); - - fl_print_format("%[%QMaximum stack size reached while processing path '%]", print.to, print.context, print.prefix, print.context); - fl_print_format("%[%Q%]", print.to, print.notable, path, print.notable); - fl_print_format("%['", print.to, print.context); - - if (function) { - fl_print_format(" while calling%] %[%S%]", print.to, print.context, print.notable, function, print.notable); - fl_print_format("%[()", print.to, print.context); - } - - fl_print_format(".%]%r", print.to, print.context, f_string_eol_s); - - f_file_stream_unlock(print.to); - } - else { - fake_print_error_file(setting, print, status, function, path, fake_common_file_path_change_to_s, fll_error_file_type_directory_e); - } - - return F_none; - } -#endif // _di_fake_print_message_section_operation_path_stack_max_ - -#ifndef _di_fake_print_message_section_operation_stack_max_ - f_status_t fake_print_message_section_operation_stack_max(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t buffer, const f_string_range_t section_name, const f_string_range_t operation_name, const f_array_length_t stack_max) { - - if (print.verbosity == f_console_verbosity_quiet_e || !print.to.stream) return F_output_not; - - f_array_length_t line = 1; - f_state_t state = f_state_t_initialize; - - f_fss_count_lines(state, buffer, operation_name.start, &line); - - f_file_stream_lock(print.to); - - fake_print_line_first_unlocked(setting, print); - - fl_print_format("%[%QThe section operation '%]", print.to, print.context, print.prefix, print.context); - fl_print_format("%[%/Q%]", print.to, print.notable, buffer, operation_name, print.notable); - fl_print_format("%[' from section '%]", print.to, print.context, buffer, print.context); - fl_print_format("%[%/Q%]", print.to, print.notable, buffer, section_name, print.notable); - fl_print_format("%[' on line%] ", print.to, print.context, print.context); - fl_print_format("%[%ul%]", print.to, print.notable, line, print.notable); - fl_print_format("%[' cannot be processed because the max stack depth of%] ", print.to, print.context, print.context); - fl_print_format("%[%ul%]", print.to, print.notable, stack_max, print.notable); - fl_print_format(" %[has been reached.%]%r", print.to, print.context, print.context, f_string_eol_s); - - f_file_stream_unlock(print.to); - - return F_none; - } -#endif // _di_fake_print_message_section_operation_stack_max_ - -#ifndef _di_fake_print_message_section_operation_unknown_ - f_status_t fake_print_message_section_operation_unknown(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t buffer, const f_string_range_t section_name, const f_string_range_t operation_name) { - - if (print.verbosity == f_console_verbosity_quiet_e || !print.to.stream) return F_output_not; - - f_array_length_t line = 1; - f_state_t state = f_state_t_initialize; - - f_fss_count_lines(state, buffer, operation_name.start, &line); - - f_file_stream_lock(print.to); - - fake_print_line_first_unlocked(setting, print); - - fl_print_format("%[%QThe section operation '%]", print.to, print.context, print.prefix, print.context); - fl_print_format("%[%/Q%]", print.to, print.notable, buffer, operation_name, print.notable); - fl_print_format("%[' from section '%]", print.to, print.context, buffer, print.context); - fl_print_format("%[%/Q%]", print.to, print.notable, buffer, section_name, print.notable); - fl_print_format("%[' on line%] ", print.to, print.context, print.context); - fl_print_format("%[%ul%]", print.to, print.notable, line, print.notable); - fl_print_format(" %[is not a known operation name.%]%r", print.to, print.context, print.context, f_string_eol_s); - - f_file_stream_unlock(print.to); - - return F_none; } -#endif // _di_fake_print_message_section_operation_unknown_ +#endif // _di_fake_print_wrapped_variable_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/fake/c/main/print.h b/level_3/fake/c/main/print.h index d49c795..cf19cca 100644 --- a/level_3/fake/c/main/print.h +++ b/level_3/fake/c/main/print.h @@ -13,255 +13,173 @@ extern "C" { #endif /** - * Print generic error message regarding a function failing in some way. + * Print a simple context message with prefix and a single string message. * - * @param setting - * The main program settings. - * - * This does not alter setting.status. - * @param print - * Designates the how and where to print. - * @param status - * The status to use. - * This is provided, ignoring setting.status, for thread-safety reasons. - * @param function - * The function name. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - * - * @see fll_error_print() - */ -#ifndef _di_fake_print_error_ - extern f_status_t fake_print_error(fake_setting_t * const setting, const fl_print_t print, const f_status_t status, const f_string_t function); -#endif // _di_fake_print_error_ - -/** - * Print generic error message regarding a function failing in some way, setting fallback to F_false and returning result. + * This is primarily used by numerous error print functions to reduce code. + * This is not used for any error 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.status. * @param print - * Designates the how and where to print. - * @param status - * The status to use. - * This is provided, ignoring setting.status, for thread-safety reasons. - * @param function - * The function name. + * The output structure to print to. + * @param message + * The string to print. * - * @return - * F_true is returned if the status code has no print message. - * F_false is returned on successful print of known errors. - * F_output_not on success, but no printing is performed. + * @see f_file_stream_lock() + * @see f_file_stream_unlock() + * @see fl_print_format() * - * @see fll_error_print() + * @see fake_print_line_first_unlocked() */ -#ifndef _di_fake_print_error_fallback_ - extern f_status_t fake_print_error_fallback(fake_setting_t * const setting, const fl_print_t print, const f_status_t status, const f_string_t function); -#endif // _di_fake_print_error_fallback_ +#ifndef _di_fake_print_context_simple_ + extern void fake_print_context_simple(fake_setting_t * const setting, const fl_print_t print, const f_string_t message); +#endif // _di_fake_print_context_simple_ /** - * Print file related error message regarding a function failing in some way. + * Print a variable context message with a before string, an after string, and a string variable. + * + * This is primarily used by numerous context print functions to reduce code. + * This is not used for any context 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.status. - * @param status - * The status to use. - * This is provided, ignoring setting.status, for thread-safety reasons. * @param print - * Designates the how and where to print. - * @param name - * The name of the file or directory. - * @param operation - * The operation that fails, such as 'create' or 'access'. - * @param type - * A valid file type code from the fll_error_file_type enum. + * 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 variable + * The string representing the variable. + * @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. * - * @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() * - * @see fll_error_file_print() + * @see fake_print_line_first_unlocked() */ -#ifndef _di_fake_print_error_file_ - extern f_status_t fake_print_error_file(fake_setting_t * const setting, const fl_print_t print, const f_status_t status, const f_string_t function, const f_string_static_t name, const f_string_static_t operation, const uint8_t type); -#endif // _di_fake_print_error_file_ +#ifndef _di_fake_print_context_simple_variable_ + extern void fake_print_context_simple_variable(fake_setting_t * const setting, const fl_print_t print, const f_string_t before, const f_string_static_t variable, const f_string_t after); +#endif // _di_fake_print_context_simple_variable_ /** - * Print file related error message regarding a function failing in some way. + * Print a parameter context message with a before string, an after string, a string symbol, and a parameter name. * - * This prints a simple message to avoid "Unable to find file..., because file cannot be found." type of messages. + * This is primarily used by numerous context print functions to reduce code. + * This is not used for any context 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.status. - * @param status - * The status to use. - * This is provided, ignoring setting.status, for thread-safety reasons. * @param print - * Designates the how and where to 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 NULL to disable. * @param name - * The name of the file or directory. - * @param operation - * The operation that fails, such as 'create' or 'access'. - * @param type - * A valid file type code from the fll_error_file_type enum. + * The string representing the parameter name. + * May be an empty string (like f_string_empty_s) to not print anything. + * @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. * - * @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() * - * @see fll_error_file_print() + * @see fake_print_line_first_unlocked() */ -#ifndef _di_fake_print_error_file_simple_ - extern f_status_t fake_print_error_file_simple(fake_setting_t * const setting, const fl_print_t print, const f_status_t status, const f_string_t function, const f_string_static_t name, const f_string_static_t operation, const uint8_t type); -#endif // _di_fake_print_error_file_simple_ +#ifndef _di_fake_print_context_wrapped_parameter_ + extern void fake_print_context_wrapped_parameter(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 after); +#endif // _di_fake_print_context_wrapped_parameter_ /** - * Print file related error message regarding a function failing in some way, setting fallback to F_false and returning result.. - * - * @param setting - * The main program settings. - * - * This does not alter setting.status. - * @param print - * Designates the how and where to print. - * @param status - * The status to use. - * This is provided, ignoring setting.status, for thread-safety reasons. - * @param name - * The name of the file or directory. - * @param operation - * The operation that fails, such as 'create' or 'access'. - * @param type - * A valid file type code from the fll_error_file_type enum. - * - * @return - * F_true is returned if the status code has no print message. - * F_false is returned on successful print of known errors. - * F_output_not on success, but no printing is performed. + * Print a wrapped context message with a before string, an after string, and a string variable. * - * @see fll_error_file_print() - */ -#ifndef _di_fake_print_error_file_fallback_ - extern f_status_t fake_print_error_file_fallback(fake_setting_t * const setting, const fl_print_t print, const f_status_t status, const f_string_t function, const f_string_static_t name, const f_string_static_t operation, const uint8_t type); -#endif // _di_fake_print_error_file_fallback_ - -/** - * Print error message for when an operation fails. + * This is primarily used by numerous context print functions to reduce code. + * This is not used for any context 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.status. * @param print - * Designates the how and where to print. - * @param operation - * The identifier of the operation that failed. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fake_print_error_failure_operation_ - extern f_status_t fake_print_error_failure_operation(fake_setting_t * const setting, const fl_print_t print, const uint8_t operation); -#endif // _di_fake_print_error_failure_operation_ - -/** - * Print error message for when an operation fails. - * - * @param setting - * The main program settings. + * 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 variable + * The string representing the variable. + * @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. * - * This does not alter setting.status. - * @param print - * Designates the how and where to print. - * @param script - * The name of the script that failed. + * @see f_file_stream_lock() + * @see f_file_stream_unlock() + * @see fl_print_format() * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. + * @see fake_print_line_first_unlocked() */ -#ifndef _di_fake_print_error_failure_script_ - extern f_status_t fake_print_error_failure_script(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t script); -#endif // _di_fake_print_error_failure_script_ +#ifndef _di_fake_print_context_wrapped_variable_ + extern void fake_print_context_wrapped_variable(fake_setting_t * const setting, const fl_print_t print, const f_string_t before, const f_string_static_t variable, const f_string_t after); +#endif // _di_fake_print_context_wrapped_variable_ /** - * Print error message for when the parameter value is an empty string. - * - * @param setting - * The main program settings. + * Print a wrapped context message with a before string, a middle strng, an after string, and two string variables. * - * This does not alter setting.status. - * @param print - * Designates the how and where to print. - * @param symbol - * The symbol of the parameter. - * @param name - * The name of the parameter. - * @param value - * The value that is invalid. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fake_print_error_parameter_not_empty_ - extern f_status_t fake_print_error_parameter_not_empty(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_not_empty_ - -/** - * Print error message for when the parameter value contains a non-word, non-minus, and non-plus character. + * This is primarily used by numerous context print functions to reduce code. + * This is not used for any context print functions that has more format structures. * * @param setting * The main program settings. + * (Must be of type fake_setting_t.) * * This does not alter setting.status. * @param print - * Designates the how and where to print. - * @param symbol - * The symbol of the parameter. - * @param name - * The name of the parameter. - * @param value - * The value that is invalid. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fake_print_error_parameter_not_word_ - extern 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); -#endif // _di_fake_print_error_parameter_not_word_ - -/** - * Print error message for when two designated operations cannot be used together. - * - * @param setting - * The main program settings. + * 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. + * @param first + * The string representing the first variable. + * @param between + * The string being printed before the variable. + * Likely should have a space added at the start and end of the string. + * @param second + * The string representing the second variable. + * @param after + * The string being printed after the variable. + * Likely should have a space added at the start of the string. * - * This does not alter setting.status. - * @param print - * Designates the how and where to print. - * @param operation_1 - * The name of the first operation that cannot be used. - * @param operation_2 - * The name of the second operation that cannot be used. + * @see f_file_stream_lock() + * @see f_file_stream_unlock() + * @see fl_print_format() * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. + * @see fake_print_line_first_unlocked() */ -#ifndef _di_fake_print_error_parameter_operation_not_with_ - extern f_status_t fake_print_error_parameter_operation_not_with(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t operation_1, const f_string_static_t operation_2); -#endif // _di_fake_print_error_parameter_operation_not_with_ +#ifndef _di_fake_print_context_wrapped_variables_ + extern void fake_print_context_wrapped_variables(fake_setting_t * const setting, const fl_print_t print, const f_string_t before, const f_string_static_t first, const f_string_t between, const f_string_static_t second, const f_string_t after); +#endif // _di_fake_print_context_wrapped_variables_ /** * Print help. @@ -412,376 +330,74 @@ extern "C" { #endif // _di_fake_print_operation_cancelled_ /** - * Print build operation file error messages. + * Print simple message. + * + * 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.status. * @param print - * Designates the how and where to print. - * @param status - * The status to use. - * This is provided, ignoring data.setting->status, for thread-safety reasons. - * @param function - * The name of the function where the error happened. - * @param operation - * The operation performed. - * @param source - * The operation source. - * @param destination - * The operation destination, if applicable. - * Set destination.used to 0 to disable. - * @param how - * The how the operation is perform, such as "to" in "copy" source "to" destination. - * @param fallback - * Set to F_true to print the fallback error message for unknown errors. - * - * @return - * F_true is returned if the status code has no print message. - * F_false is returned on successful print of known errors. - * - * @see f_file_stream_lock() - * @see f_file_stream_unlock() - * @see fl_print_format() - * - * @see fake_print_error_build_operation_file_message(); + * The output structure to print to. + * @param message + * The message to print. */ -#ifndef _di_fake_print_error_operation_file_ - extern f_status_t fake_print_error_build_operation_file(fake_setting_t * const setting, const fl_print_t print, const f_status_t status, const f_string_t function, const f_string_static_t operation, const f_string_static_t source, const f_string_static_t destination, const f_string_static_t how, const bool fallback); -#endif // _di_fake_print_error_operation_file_ +#ifndef _di_fake_print_simple_ + extern void fake_print_simple(fake_setting_t * const setting, const fl_print_t print, const f_string_t message); +#endif // _di_fake_print_simple_ /** - * Helper function for printing build operation file error messages. + * Print simple verbose message with a value. * - * This prints the "copy source to destination" part of the message. + * 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.status. * @param print - * Designates the how and where to print. - * @param operation - * The operation performed. - * @param source - * The operation source. - * @param destination - * The operation destination, if applicable. - * Set destination.used to 0 to disable. - * @param how - * The how the operation is perform, such as "to" in "copy" source "to" destination. - * - * @see fl_print_format() - * - * @see fake_print_error_build_operation_file() + * The output structure to print to. + * @param message + * The message to print. + * @param variable + * The string representing the variable. */ -#ifndef _di_fake_print_error_build_operation_file_message_ - extern void fake_print_error_build_operation_file_message(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t operation, const f_string_static_t source, const f_string_static_t destination, const f_string_static_t how); -#endif // _di_fake_print_error_build_operation_file_message_ +#ifndef _di_fake_print_simple_variable_ + extern void fake_print_simple_variable(fake_setting_t * const setting, const fl_print_t print, const f_string_t message, const f_string_static_t variable); +#endif // _di_fake_print_simple_variable_ /** - * Print FSS error messages. + * Print wrapped message with a 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.status. * @param print - * Designates the how and where to print. - * @param status - * The error status code to report on. - * @param function - * The function call that returned the error. - * @param path_file - * The path to the file. - * @param range - * The range representing the position in the buffer such that range.start is where the error happened. - * @param fallback - * Set to F_true to print the fallback error message for unknown errors. - * - * @return - * F_true is returned if the status code has no print message. - * F_false is returned on successful print of known errors. - * - * @see f_file_stream_lock() - * @see f_file_stream_unlock() - * @see fl_print_format() - */ -#ifndef _di_fake_print_error_fss_ - extern f_status_t fake_print_error_fss(fake_setting_t * const setting, const fl_print_t print, const f_status_t status, const f_string_t function, const f_string_static_t path_file, const f_string_range_t range, const bool fallback); -#endif // _di_fake_print_error_fss_ - -/** - * Print an error message for when the parameter is specified too many times. - * - * @param data - * The program data. - * @param parameter - * The parameter name. - * - * @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_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); -#endif // _di_fake_print_error_parameter_too_many_ - -/** - * Print an error message for when there are more arguments are required (such as to a fakefile operation). - * - * @param data_make - * All make related setting data, including data from the fakefile and the build settings file. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - * - * @see fll_print_format() - */ -#ifndef _di_fake_print_error_requires_more_arguments_ - extern f_status_t fake_print_error_requires_more_arguments(fake_setting_t * const setting, const fl_print_t print); -#endif // _di_fake_print_error_requires_more_arguments_ - -/** - * Print an error message for when there are too many arguments passed (such as to a fakefile operation). - * - * @param data_make - * All make related setting data, including data from the fakefile and the build settings file. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - * - * @see fll_print_format() - */ -#ifndef _di_fake_print_error_too_many_arguments_ - extern f_status_t fake_print_error_too_many_arguments(fake_setting_t * const setting, const fl_print_t print); -#endif // _di_fake_print_error_too_many_arguments_ - -/** - * Print an error message for when an argument is an empty string. - * - * @param data_make - * All make related setting data, including data from the fakefile and the build settings file. - * @param index - * The index of the argument that is an empty string. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - * - * @see fll_print_format() - */ -#ifndef _di_fake_print_error_argument_empty_ - extern f_status_t fake_print_error_argument_empty(fake_setting_t * const setting, const fl_print_t print, const f_array_length_t index); -#endif // _di_fake_print_error_argument_empty_ - -/** - * Print error messages when processing some fakefile section, for a specific line and operation, and that operation failed. - * - * @param data - * The program data. - * @param print - * Designates how the section error/warning should be printed. - * @param buffer - * The buffer containing the fakefile data. - * @param section_name - * The range within the buffer representing the section name. - * @param operation_name - * The range within the buffer representing the operation name within the section. - * - * @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_message_section_operation_failed_ - extern f_status_t fake_print_message_section_operation_failed(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t buffer, const f_string_range_t section_name, const f_string_range_t operation_name); -#endif // _di_fake_print_message_section_operation_failed_ - -/** - * Print error messages when a given link argument is unknown. - * - * @param data - * The program data. - * @param print - * Designates how the section error/warning should be printed. - * @param argument - * The argument that is unknown by the link operation. - * - * @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_message_section_operation_link_argument_unknown_ - extern f_status_t fake_print_message_section_operation_link_argument_unknown(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t argument); -#endif // _di_fake_print_message_section_operation_link_argument_unknown_ - -/** - * Print error messages when a given link point file already exists. - * - * @param data - * The program data. - * @param print - * Designates how the section error/warning should be printed. - * @param argument - * The argument representing the point file. - * - * @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_message_section_operation_link_point_exists_ - extern f_status_t fake_print_message_section_operation_link_point_exists(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t argument); -#endif // _di_fake_print_message_section_operation_link_point_exists_ - -/** - * Print error messages when a given link target file does not already exist. - * - * @param data - * The program data. - * @param print - * Designates how the section error/warning should be printed. - * @param argument - * The argument representing the point file. - * - * @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_message_section_operation_link_target_exists_not_ - extern f_status_t fake_print_message_section_operation_link_target_exists_not(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t argument); -#endif // _di_fake_print_message_section_operation_link_target_exists_not_ - -/** - * Print error messages when processing some fakefile section, for a specific line and operation, and that operation has a path outside of the project root. - * - * @param data - * The program data. - * @param print - * Designates how the section error/warning should be printed. - * @param status - * The status code representing an error. - * @param function - * The name of the function where the error happened. - * @param path - * The path that is outside of the project path. - * - * @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() - * @see fll_error_file_print() - */ -#ifndef _di_fake_print_message_section_operation_path_outside_ - extern f_status_t fake_print_message_section_operation_path_outside(fake_setting_t * const setting, const fl_print_t print, const f_status_t status, const f_string_t function, const f_string_static_t path); -#endif // _fake_print_message_section_operation_path_outside_ - -/** - * Print error messages when processing some fakefile section, for a specific line and operation. - * - * @param data - * The program data. - * @param error - * Designates how the section error/warning should be printed. - * @param status - * The status code representing an error. - * @param function - * The name of the function where the error happened. - * Set to 0 to disable. - * @param path - * The path to the directory. - * - * @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() - * @see fll_error_file_print() - */ -#ifndef _di_fake_print_message_section_operation_path_stack_max_ - extern f_status_t fake_print_message_section_operation_path_stack_max(fake_setting_t * const setting, const fl_print_t print, const f_status_t status, const f_string_t function, const f_string_static_t path); -#endif // _di_fake_print_message_section_operation_path_stack_max_ - -/** - * Print error messages when processing some fakefile section, for a specific line and operation, and that the max stack depth is reached. - * - * @param data - * The program data. - * @param print - * Designates how the section error/warning should be printed. - * @param buffer - * The buffer containing the fakefile data. - * @param section_name - * The range within the buffer representing the section name. - * @param operation_name - * The range within the buffer representing the operation name within the section. - * @param stack_max - * The max stack depth. - * - * @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_message_section_operation_stack_max_ - extern f_status_t fake_print_message_section_operation_stack_max(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t buffer, const f_string_range_t section_name, const f_string_range_t operation_name, const f_array_length_t stack_max); -#endif // _di_fake_print_message_section_operation_stack_max_ - -/** - * Print error messages when processing some fakefile section, for a specific line and operation, and that operation is invalid. - * - * @param data - * The program data. - * @param print - * Designates how the section error/warning should be printed. - * @param buffer - * The buffer containing the fakefile data. - * @param section_name - * The range within the buffer representing the section name. - * @param operation_name - * The range within the buffer representing the operation name within the section. - * - * @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_message_section_operation_unknown_ - extern f_status_t fake_print_message_section_operation_unknown(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t buffer, const f_string_range_t section_name, const f_string_range_t operation_name); -#endif // _di_fake_print_message_section_operation_unknown_ + * 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 variable + * The string representing the variable. + * @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. + */ +#ifndef _di_fake_print_wrapped_variable_ + extern void fake_print_wrapped_variable(fake_setting_t * const setting, const fl_print_t print, const f_string_t before, const f_string_static_t variable, const f_string_t after); +#endif // _di_fake_print_wrapped_variable_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/fake/c/main/private-common.h b/level_3/fake/c/main/private-common.h deleted file mode 100644 index cf2d9a0..0000000 --- a/level_3/fake/c/main/private-common.h +++ /dev/null @@ -1,19 +0,0 @@ -/** - * FLL - Level 3 - * - * Project: Featureless Make - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - */ -#ifndef _PRIVATE_common_h -#define _PRIVATE_common_h - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_common_h diff --git a/level_3/fake/c/main/private-fake.c b/level_3/fake/c/main/private-fake.c deleted file mode 100644 index 6d87898..0000000 --- a/level_3/fake/c/main/private-fake.c +++ /dev/null @@ -1,12 +0,0 @@ -#include "fake.h" -#include "private-common.h" -#include "private-fake.h" -#include "private-print.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_3/fake/c/main/private-fake.h b/level_3/fake/c/main/private-fake.h deleted file mode 100644 index 1a3df65..0000000 --- a/level_3/fake/c/main/private-fake.h +++ /dev/null @@ -1,19 +0,0 @@ -/** - * FLL - Level 3 - * - * Project: Featureless Make - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - */ -#ifndef _PRIVATE_fake_h -#define _PRIVATE_fake_h - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_fake_h diff --git a/level_3/fake/c/main/private-print.c b/level_3/fake/c/main/private-print.c deleted file mode 100644 index 6d4b4ef..0000000 --- a/level_3/fake/c/main/private-print.c +++ /dev/null @@ -1,11 +0,0 @@ -#include "fake.h" -#include "private-common.h" -#include "private-print.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_3/fake/c/main/private-print.h b/level_3/fake/c/main/private-print.h deleted file mode 100644 index ac39d78..0000000 --- a/level_3/fake/c/main/private-print.h +++ /dev/null @@ -1,19 +0,0 @@ -/** - * FLL - Level 3 - * - * Project: Featureless Make - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - */ -#ifndef _PRIVATE_fake_print_h -#define _PRIVATE_fake_print_h - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_fake_print_h diff --git a/level_3/fake/data/build/settings b/level_3/fake/data/build/settings index b1cb165..564be7d 100644 --- a/level_3/fake/data/build/settings +++ b/level_3/fake/data/build/settings @@ -27,22 +27,22 @@ build_libraries-individual -lf_account -lf_capability -lf_color -lf_console -lf_ build_libraries-level -lfll_2 -lfll_1 -lfll_0 build_libraries-monolithic -lfll -build_sources_library main/build.c main/clean.c main/common.c main/fake.c main/make.c main/print.c main/private-common.c main/private-fake.c main/private-print.c main/skeleton.c +build_sources_library main/build.c main/clean.c main/common.c main/fake.c main/make.c main/print.c main/print-error.c main/print-warning.c main/skeleton.c build_sources_library main/build/library.c main/build/load.c main/build/object.c main/build/objects.c main/build/print.c main/build/program.c main/build/skeleton.c build_sources_library main/clean/print.c build_sources_library main/common/define.c main/common/enumeration.c main/common/print.c main/common/string.c main/common/type.c build_sources_library main/fake/path_generate.c main/fake/print.c -build_sources_library main/make/load_fakefile.c main/make/load_parameters.c main/make/operate_block.c main/make/operate.c main/make/operate_process.c main/make/operate_process_type.c main/make/operate_validate.c main/make/operate_validate_type.c main/make/print.c main/make/print-error.c main/make/print-warning.c +build_sources_library main/make/load_fakefile.c main/make/load_parameters.c main/make/operate_block.c main/make/operate.c main/make/operate_process.c main/make/operate_process_type.c main/make/operate_validate.c main/make/operate_validate_type.c main/make/print.c main/make/print-error.c main/make/print-verbose.c main/make/print-warning.c build_sources_library main/skeleton/print.c build_sources_program main/main.c -build_sources_headers main/build.h main/clean.h main/common.h main/fake.h main/make.h main/print.h main/private-common.h main/private-fake.h main/private-print.h main/skeleton.h +build_sources_headers main/build.h main/clean.h main/common.h main/fake.h main/make.h main/print.h main/print-error.h main/print-warning.h main/skeleton.h build_sources_headers main/build/library.h main/build/load.h main/build/object.h main/build/objects.h main/build/print.h main/build/program.h main/build/skeleton.h build_sources_headers main/clean/print.h build_sources_headers main/common/define.h main/common/enumeration.h main/common/print.h main/common/string.h main/common/type.h build_sources_headers main/fake/path_generate.h main/fake/print.h -build_sources_headers main/make/load_fakefile.h main/make/load_parameters.h main/make/operate_block.h main/make/operate.h main/make/operate_process.h main/make/operate_process_type.h main/make/operate_validate.h main/make/operate_validate_type.h main/make/print.h main/make/print-error.h main/make/print-warning.h +build_sources_headers main/make/load_fakefile.h main/make/load_parameters.h main/make/operate_block.h main/make/operate.h main/make/operate_process.h main/make/operate_process_type.h main/make/operate_validate.h main/make/operate_validate_type.h main/make/print.h main/make/print-error.h main/make/print-verbose.h main/make/print-warning.h build_sources_headers main/skeleton/print.h build_sources_documentation man -- 1.8.3.1