From 82974dc8440ce514b54bb681ea70f2a26f7b9511 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Sat, 18 Jul 2020 00:08:58 -0500 Subject: [PATCH] Cleanup: Reduce arguments by accepting the entire fake_data object --- level_3/fake/c/fake.c | 4 +- level_3/fake/c/private-build.c | 122 ++++---- level_3/fake/c/private-clean.c | 2 +- level_3/fake/c/private-fake.c | 54 ++-- level_3/fake/c/private-fake.h | 28 -- level_3/fake/c/private-make.c | 88 +++--- level_3/fake/c/private-make.h | 4 +- level_3/fake/c/private-print.c | 644 +++++++++++++++++--------------------- level_3/fake/c/private-print.h | 150 +++------ level_3/fake/c/private-skeleton.c | 14 +- 10 files changed, 477 insertions(+), 633 deletions(-) diff --git a/level_3/fake/c/fake.c b/level_3/fake/c/fake.c index dc4687a..be01f84 100644 --- a/level_3/fake/c/fake.c +++ b/level_3/fake/c/fake.c @@ -99,7 +99,7 @@ extern "C" { status = fll_program_parameter_process(arguments, parameters, choices, F_true, &data->remaining, &data->context); if (F_status_is_error(status)) { - fake_print_error(data->context, data->verbosity, F_status_set_fine(status), "fll_program_parameter_process", F_true); + fake_print_error(*data, F_status_set_fine(status), "fll_program_parameter_process", F_true); fake_delete_data(data); return status; } @@ -117,7 +117,7 @@ extern "C" { status = f_console_parameter_prioritize_right(parameters, choices, &choice); if (F_status_is_error(status)) { - fake_print_error(data->context, data->verbosity, F_status_set_fine(status), "f_console_parameter_prioritize_right", F_true); + fake_print_error(*data, F_status_set_fine(status), "f_console_parameter_prioritize_right", F_true); fake_delete_data(data); return status; } diff --git a/level_3/fake/c/private-build.c b/level_3/fake/c/private-build.c index 3a570b4..1f21284 100644 --- a/level_3/fake/c/private-build.c +++ b/level_3/fake/c/private-build.c @@ -204,7 +204,7 @@ extern "C" { f_macro_string_dynamic_new(*status, path_source, source.used); if (F_status_is_error(*status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "f_macro_string_dynamic_new", F_true); + fake_print_error(data, F_status_set_fine(*status), "f_macro_string_dynamic_new", F_true); f_macro_string_dynamic_delete_simple(path_source); return; @@ -219,13 +219,13 @@ extern "C" { *status = fl_string_dynamic_append_nulless(files.array[i], &path_source); if (F_status_is_error(*status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fl_string_dynamic_append_nulless", F_true); + fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamic_append_nulless", F_true); break; } *status = fl_string_dynamic_terminate_after(&path_source); if (F_status_is_error(*status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fl_string_dynamic_terminate_after", F_true); + fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamic_terminate_after", F_true); break; } @@ -235,17 +235,17 @@ extern "C" { if (F_status_is_error(*status)) { if (data.verbosity == fake_verbosity_verbose) { for (f_string_length j = 0; j < failures.used; j++) { - fake_print_error_build_operation_file(data.context, data.verbosity, F_status_set_fine(*status), "fl_directory_copy_content", "copy contents of", "to", path_source.string, destination.string, F_true); + fake_print_error_build_operation_file(data, F_status_set_fine(*status), "fl_directory_copy_content", "copy contents of", "to", path_source.string, destination.string, F_true); } // for if (F_status_set_fine(*status) != F_failure) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fl_directory_copy_content", F_true); + fake_print_error(data, F_status_set_fine(*status), "fl_directory_copy_content", F_true); } break; } else if (data.verbosity != fake_verbosity_quiet) { - fake_print_error_build_operation_file(data.context, data.verbosity, F_status_set_fine(*status), "fl_directory_copy_content", "copy contents of", "to", path_source.string, destination.string, F_true); + fake_print_error_build_operation_file(data, F_status_set_fine(*status), "fl_directory_copy_content", "copy contents of", "to", path_source.string, destination.string, F_true); } break; @@ -256,20 +256,20 @@ extern "C" { *status = fl_string_dynamic_append_nulless(destination, &destination_file); if (F_status_is_error(*status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fl_string_dynamic_append_nulless", F_true); + fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamic_append_nulless", F_true); break; } *status = f_file_name_base(path_source.string, path_source.used, &destination_file); if (F_status_is_error(*status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "f_file_name_base", F_true); + fake_print_error(data, F_status_set_fine(*status), "f_file_name_base", F_true); break; } *status = f_file_copy(path_source.string, destination_file.string, mode, f_file_default_read_size, F_false); if (F_status_is_error(*status)) { - fake_print_error_build_operation_file(data.context, data.verbosity, F_status_set_fine(*status), "f_file_copy", "copy", "to", path_source.string, destination_file.string, F_true); + fake_print_error_build_operation_file(data, F_status_set_fine(*status), "f_file_copy", "copy", "to", path_source.string, destination_file.string, F_true); break; } @@ -278,7 +278,7 @@ extern "C" { } } else if (F_status_is_error(*status)) { - fake_print_error_file(data.context, data.verbosity, F_status_set_fine(*status), "f_directory_is", path_source.string, "create", F_false, F_true); + fake_print_error_file(data, F_status_set_fine(*status), "f_directory_is", path_source.string, "create", F_false, F_true); break; } @@ -332,7 +332,7 @@ extern "C" { } } else { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fll_execute_program_environment", F_true); + fake_print_error(data, F_status_set_fine(*status), "fll_execute_program_environment", F_true); } } } @@ -400,7 +400,7 @@ extern "C" { continue; } - fake_print_error_file(data.context, data.verbosity, F_status_set_fine(*status), "f_directory_create", directorys[i]->string, "create", F_false, F_true); + fake_print_error_file(data, F_status_set_fine(*status), "f_directory_create", directorys[i]->string, "create", F_false, F_true); return; } @@ -457,7 +457,7 @@ extern "C" { } if (F_status_is_error(*status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fll_execute_arguments_add", F_true); + fake_print_error(data, F_status_set_fine(*status), "fll_execute_arguments_add", F_true); f_macro_string_dynamics_delete_simple(arguments); return; @@ -476,7 +476,7 @@ extern "C" { } // for if (F_status_is_error(*status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fl_string_dynamic_mash", F_true); + fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamic_mash", F_true); f_macro_string_dynamic_delete_simple(defines); f_macro_string_dynamics_delete_simple(arguments); @@ -485,7 +485,7 @@ extern "C" { *status = fl_string_dynamic_terminate_after(&defines); if (F_status_is_error(*status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fl_string_dynamic_terminate_after", F_true); + fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamic_terminate_after", F_true); f_macro_string_dynamic_delete_simple(defines); f_macro_string_dynamics_delete_simple(arguments); @@ -558,7 +558,7 @@ extern "C" { f_macro_string_dynamic_delete_simple(defines); if (F_status_is_error(*status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fll_execute_arguments_add_parameter_set", F_true); + fake_print_error(data, F_status_set_fine(*status), "fll_execute_arguments_add_parameter_set", F_true); f_macro_string_dynamics_delete_simple(arguments); return; @@ -585,7 +585,7 @@ extern "C" { } if (F_status_is_error(*status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), function, F_true); + fake_print_error(data, F_status_set_fine(*status), function, F_true); f_macro_string_dynamic_delete_simple(path); f_macro_string_dynamics_delete_simple(arguments); @@ -611,7 +611,7 @@ extern "C" { } } else { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fll_execute_path_environment", F_true); + fake_print_error(data, F_status_set_fine(*status), "fll_execute_path_environment", F_true); } } else { @@ -630,7 +630,7 @@ extern "C" { f_status status = f_file_name_base(path.string, path.used, name); if (F_status_is_error(status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(status), "f_file_name_base", F_true); + fake_print_error(data, F_status_set_fine(status), "f_file_name_base", F_true); return status; } @@ -645,7 +645,7 @@ extern "C" { status = fl_string_dynamic_terminate_after(name); if (F_status_is_error(status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(status), "fl_string_dynamic_terminate_after", F_true); + fake_print_error(data, F_status_set_fine(status), "fl_string_dynamic_terminate_after", F_true); return status; } @@ -698,7 +698,7 @@ extern "C" { } // for if (F_status_is_error(*status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fll_execute_arguments_add", F_true); + fake_print_error(data, F_status_set_fine(*status), "fll_execute_arguments_add", F_true); f_macro_string_dynamics_delete_simple(arguments); return; @@ -837,7 +837,7 @@ extern "C" { fake_build_arguments_standard_add(data, data_build, F_true, F_true, &arguments, status); if (F_status_is_error(*status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fll_execute_arguments_add", F_true); + fake_print_error(data, F_status_set_fine(*status), "fll_execute_arguments_add", F_true); f_macro_string_dynamics_delete_simple(arguments); return; @@ -880,11 +880,11 @@ extern "C" { } else if (F_status_is_error(*status)) { if (F_status_set_fine(*status) == F_file_found) { - fake_print_error_file(data.context, data.verbosity, F_status_set_fine(*status), "f_file_link", parameter_file_path, "link", F_true, F_true); + fake_print_error_file(data, F_status_set_fine(*status), "f_file_link", parameter_file_path, "link", F_true, F_true); return; } - fake_print_error_file(data.context, data.verbosity, F_status_set_fine(*status), "f_file_link", parameter_file_name_micro, "link", F_true, F_true); + fake_print_error_file(data, F_status_set_fine(*status), "f_file_link", parameter_file_name_micro, "link", F_true, F_true); return; } } @@ -927,19 +927,19 @@ extern "C" { } else if (F_status_is_error(*status)) { if (F_status_set_fine(*status) == F_file_found) { - fake_print_error_file(data.context, data.verbosity, F_status_set_fine(*status), "f_file_link", parameter_file_path, "link", F_true, F_true); + fake_print_error_file(data, F_status_set_fine(*status), "f_file_link", parameter_file_path, "link", F_true, F_true); return; } if (data_build.setting.version_target == fake_build_version_type_major) { - fake_print_error_file(data.context, data.verbosity, F_status_set_fine(*status), "f_file_link", parameter_file_name_major, "link", F_true, F_true); + fake_print_error_file(data, F_status_set_fine(*status), "f_file_link", parameter_file_name_major, "link", F_true, F_true); } else if (data_build.setting.version_target == fake_build_version_type_minor) { - fake_print_error_file(data.context, data.verbosity, F_status_set_fine(*status), "f_file_link", parameter_file_name_minor, "link", F_true, F_true); + fake_print_error_file(data, F_status_set_fine(*status), "f_file_link", parameter_file_name_minor, "link", F_true, F_true); } else if (data_build.setting.version_target == fake_build_version_type_micro) { - fake_print_error_file(data.context, data.verbosity, F_status_set_fine(*status), "f_file_link", parameter_file_name_micro, "link", F_true, F_true); + fake_print_error_file(data, F_status_set_fine(*status), "f_file_link", parameter_file_name_micro, "link", F_true, F_true); } return; @@ -999,7 +999,7 @@ extern "C" { *status = fake_build_get_file_name_without_extension(data, data_build.setting.build_sources_library.array[i], &file_name); if (F_status_is_error(*status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fake_build_get_file_name_without_extension", F_true); + fake_print_error(data, F_status_set_fine(*status), "fake_build_get_file_name_without_extension", F_true); f_macro_string_dynamic_delete_simple(file_name); f_macro_string_dynamic_delete_simple(source_path); @@ -1009,26 +1009,26 @@ extern "C" { *status = f_file_name_directory(data_build.setting.build_sources_library.array[i].string, data_build.setting.build_sources_library.array[i].used, &source_path); if (F_status_is_error(*status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "f_file_name_directory", F_true); + fake_print_error(data, F_status_set_fine(*status), "f_file_name_directory", F_true); break; } if (source_path.used) { *status = fl_string_dynamic_prepend(data.path_build_objects, &source_path); if (F_status_is_error(*status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fl_string_dynamic_prepend", F_true); + fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamic_prepend", F_true); break; } *status = fl_string_append_assure(f_path_separator, f_path_separator_length, &source_path); if (F_status_is_error(*status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fl_string_append_assure", F_true); + fake_print_error(data, F_status_set_fine(*status), "fl_string_append_assure", F_true); break; } *status = fl_string_dynamic_terminate_after(&source_path); if (F_status_is_error(*status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fl_string_dynamic_terminate_after", F_true); + fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamic_terminate_after", F_true); break; } @@ -1058,7 +1058,7 @@ extern "C" { } // for if (F_status_is_error(*status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fll_execute_arguments_add", F_true); + fake_print_error(data, F_status_set_fine(*status), "fll_execute_arguments_add", F_true); f_macro_string_dynamic_delete_simple(file_name); f_macro_string_dynamic_delete_simple(source_path); @@ -1099,7 +1099,7 @@ extern "C" { f_macro_string_dynamics_new(*status, names, 2); if (F_status_is_error(*status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "f_macro_string_dynamics_new", F_true); + fake_print_error(data, F_status_set_fine(*status), "f_macro_string_dynamics_new", F_true); f_macro_string_dynamics_delete_simple(names); return; @@ -1139,7 +1139,7 @@ extern "C" { f_macro_string_dynamics_resize(*status, names, names.used + data_build.setting.environment.used); if (F_status_is_error(*status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "f_macro_string_dynamics_resize", F_true); + fake_print_error(data, F_status_set_fine(*status), "f_macro_string_dynamics_resize", F_true); f_macro_string_dynamic_delete_simple(part); f_macro_string_dynamics_delete_simple(names); @@ -1163,7 +1163,7 @@ extern "C" { f_macro_string_dynamic_delete_simple(part); if (F_status_is_error(*status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fl_string_append", F_true); + fake_print_error(data, F_status_set_fine(*status), "fl_string_append", F_true); f_macro_string_dynamics_delete_simple(names); return; @@ -1222,7 +1222,7 @@ extern "C" { f_macro_string_dynamic_delete_simple(variable_value); if (F_status_is_error(*status)) { - fake_print_error(data.context, data.verbosity, *status, function, F_true); + fake_print_error(data, *status, function, F_true); } } #endif // _di_fake_build_load_environment_ @@ -1244,7 +1244,7 @@ extern "C" { *status = fll_fss_extended_read(&buffer, &range, &objects, &contents, 0, 0); if (F_status_is_error(*status)) { - fake_print_error_fss(data.context, data.verbosity, *status, "fll_fss_extended_read", data.file_data_build_settings.string, range, F_true); + fake_print_error_fss(data, *status, "fll_fss_extended_read", data.file_data_build_settings.string, range, F_true); } fake_build_load_setting_process(data, data.file_data_build_settings.string, buffer, objects, contents, setting, status); @@ -1544,7 +1544,7 @@ extern "C" { } } else if (!error_printed) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), function, F_true); + fake_print_error(data, F_status_set_fine(*status), function, F_true); } } else { @@ -1821,21 +1821,21 @@ extern "C" { *status = fl_string_dynamic_append_nulless(settings_single_source[i]->array[0], settings_single_destination[i]); if (F_status_is_error(*status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fl_string_dynamic_append_nulless", F_true); + fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamic_append_nulless", F_true); break; } if (settings_single_type[i] == 2) { *status = fl_string_append_assure(f_path_separator, f_path_separator_length, settings_single_destination[i]); if (F_status_is_error(*status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fl_string_append_assure", F_true); + fake_print_error(data, F_status_set_fine(*status), "fl_string_append_assure", F_true); break; } } *status = fl_string_dynamic_terminate_after(settings_single_destination[i]); if (F_status_is_error(*status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fl_string_dynamic_terminate_after", F_true); + fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamic_terminate_after", F_true); break; } } @@ -1897,13 +1897,13 @@ extern "C" { *status = fl_string_append_assure(sources[i], lengths[i], destinations[i]); if (F_status_is_error(*status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fl_string_append_assure", F_true); + fake_print_error(data, F_status_set_fine(*status), "fl_string_append_assure", F_true); break; } *status = fl_string_dynamic_terminate_after(destinations[i]); if (F_status_is_error(*status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fl_string_dynamic_terminate_after", F_true); + fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamic_terminate_after", F_true); break; } } // for @@ -2073,33 +2073,33 @@ extern "C" { for (uint8_t i = 0; i < fake_build_stage_total; i++) { *status = fl_string_dynamic_append_nulless(data.path_build_stage, values[i]); if (F_status_is_error(*status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fl_string_dynamic_append_nulless", F_true); + fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamic_append_nulless", F_true); break; } if (data.process.used) { *status = fl_string_append(data.process.string, data.process.used, values[i]); if (F_status_is_error(*status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fl_string_append", F_true); + fake_print_error(data, F_status_set_fine(*status), "fl_string_append", F_true); break; } *status = fl_string_append(fake_build_parameter_stage_separator, fake_build_parameter_stage_separator_length, values[i]); if (F_status_is_error(*status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fl_string_append", F_true); + fake_print_error(data, F_status_set_fine(*status), "fl_string_append", F_true); break; } } *status = fl_string_append_nulless(names[i], lengths[i], values[i]); if (F_status_is_error(*status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fl_string_dynamic_append_nulless", F_true); + fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamic_append_nulless", F_true); break; } *status = fl_string_dynamic_terminate_after(values[i]); if (F_status_is_error(*status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fl_string_dynamic_terminate_after", F_true); + fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamic_terminate_after", F_true); break; } } // for @@ -2142,7 +2142,7 @@ extern "C" { *status = fake_build_get_file_name_without_extension(data, data_build.setting.build_sources_library.array[i], &file_name); if (F_status_is_error(*status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fake_build_get_file_name_without_extension", F_true); + fake_print_error(data, F_status_set_fine(*status), "fake_build_get_file_name_without_extension", F_true); f_macro_string_dynamic_delete_simple(file_name); f_macro_string_dynamic_delete_simple(destination_path); @@ -2152,26 +2152,26 @@ extern "C" { *status = f_file_name_directory(data_build.setting.build_sources_library.array[i].string, data_build.setting.build_sources_library.array[i].used, &destination_path); if (F_status_is_error(*status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "f_file_name_directory", F_true); + fake_print_error(data, F_status_set_fine(*status), "f_file_name_directory", F_true); break; } if (destination_path.used) { *status = fl_string_dynamic_prepend(data.path_build_objects, &destination_path); if (F_status_is_error(*status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fl_string_dynamic_prepend", F_true); + fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamic_prepend", F_true); break; } *status = fl_string_append_assure(f_path_separator, f_path_separator_length, &destination_path); if (F_status_is_error(*status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fl_string_append_assure", F_true); + fake_print_error(data, F_status_set_fine(*status), "fl_string_append_assure", F_true); break; } *status = fl_string_dynamic_terminate_after(&destination_path); if (F_status_is_error(*status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fl_string_dynamic_terminate_after", F_true); + fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamic_terminate_after", F_true); break; } @@ -2199,7 +2199,7 @@ extern "C" { fl_color_print_line(f_type_error, data.context.error, data.context.reset, "' could not be created, a parent directory does not exist."); } else { - fake_print_error_file(data.context, data.verbosity, F_status_set_fine(*status), "f_directory_create", destination_path.string, "create", F_false, F_true); + fake_print_error_file(data, F_status_set_fine(*status), "f_directory_create", destination_path.string, "create", F_false, F_true); } break; @@ -2210,7 +2210,7 @@ extern "C" { } } else if (F_status_is_error(*status)) { - fake_print_error_file(data.context, data.verbosity, F_status_set_fine(*status), "f_directory_exists", destination_path.string, "create", F_false, F_true); + fake_print_error_file(data, F_status_set_fine(*status), "f_directory_exists", destination_path.string, "create", F_false, F_true); break; } @@ -2259,7 +2259,7 @@ extern "C" { fake_build_arguments_standard_add(data, data_build, F_false, F_true, &arguments, status); if (F_status_is_error(*status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fll_execute_arguments_add", F_true); + fake_print_error(data, F_status_set_fine(*status), "fll_execute_arguments_add", F_true); break; } @@ -2465,7 +2465,7 @@ extern "C" { fake_build_arguments_standard_add(data, data_build, F_true, F_false, &arguments, status); if (F_status_is_error(*status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fll_execute_arguments_add", F_true); + fake_print_error(data, F_status_set_fine(*status), "fll_execute_arguments_add", F_true); f_macro_string_dynamics_delete_simple(arguments); return; @@ -2570,7 +2570,7 @@ extern "C" { fake_build_arguments_standard_add(data, data_build, F_false, F_false, &arguments, status); if (F_status_is_error(*status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fll_execute_arguments_add", F_true); + fake_print_error(data, F_status_set_fine(*status), "fll_execute_arguments_add", F_true); f_macro_string_dynamics_delete_simple(arguments); return; @@ -2597,7 +2597,7 @@ extern "C" { *status = f_file_touch(file.string, mode.regular, F_false); if (F_status_is_error(*status)) { - fake_print_error_file(data.context, data.verbosity, F_status_set_fine(*status), "f_file_touch", file.string, "touch", F_true, F_true); + fake_print_error_file(data, F_status_set_fine(*status), "f_file_touch", file.string, "touch", F_true, F_true); } } #endif // _di_fake_build_touch_ diff --git a/level_3/fake/c/private-clean.c b/level_3/fake/c/private-clean.c index de14814..c906c10 100644 --- a/level_3/fake/c/private-clean.c +++ b/level_3/fake/c/private-clean.c @@ -34,7 +34,7 @@ extern "C" { } if (F_status_is_error(status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(status), "f_directory_remove", F_true); + fake_print_error(data, F_status_set_fine(status), "f_directory_remove", F_true); return status; } diff --git a/level_3/fake/c/private-fake.c b/level_3/fake/c/private-fake.c index e5d8e0f..1cc1bab 100644 --- a/level_3/fake/c/private-fake.c +++ b/level_3/fake/c/private-fake.c @@ -28,7 +28,7 @@ extern "C" { f_macro_string_dynamic_new((status), (*buffer), size_file); if (F_status_is_error(status)) { - fake_print_error_file(data.context, data.verbosity, F_status_set_fine(status), name_function, path_file, "allocate buffer size for", F_true, F_true); + fake_print_error_file(data, F_status_set_fine(status), name_function, path_file, "allocate buffer size for", F_true, F_true); f_macro_string_dynamic_delete_simple((*buffer)); return status; @@ -53,7 +53,7 @@ extern "C" { } if (F_status_is_error(status)) { - fake_print_error_file(data.context, data.verbosity, F_status_set_fine(status), name_function, path_file, "read", F_true, F_true); + fake_print_error_file(data, F_status_set_fine(status), name_function, path_file, "read", F_true, F_true); f_macro_string_dynamic_delete_simple((*buffer)); } @@ -112,7 +112,7 @@ extern "C" { status = fake_path_generate_string_dynamic(data, *parameters_source[i], parameters_value[i], parameters_length[i]); if (F_status_is_error(status)) { - fake_print_error(data->context, data->verbosity, F_status_set_fine(status), "fake_path_generate_string_dynamic", F_true); + fake_print_error(*data, F_status_set_fine(status), "fake_path_generate_string_dynamic", F_true); return status; } } // for @@ -177,7 +177,7 @@ extern "C" { status = fl_string_append_nulless(parameters_source[i], parameters_length[i], parameters_value[i]); if (F_status_is_error(status)) { - fake_print_error(data->context, data->verbosity, F_status_set_fine(status), "fl_string_append_nulless", F_true); + fake_print_error(*data, F_status_set_fine(status), "fl_string_append_nulless", F_true); return status; } } // for @@ -232,7 +232,7 @@ extern "C" { status = fake_path_generate_string_dynamic(data, *parameters_source[i], parameters_value[i], parameters_length[i]); if (F_status_is_error(status)) { - fake_print_error(data->context, data->verbosity, F_status_set_fine(status), "fake_path_generate_string_dynamic", F_true); + fake_print_error(*data, F_status_set_fine(status), "fake_path_generate_string_dynamic", F_true); return status; } } // for @@ -285,7 +285,7 @@ extern "C" { status = fl_string_append_nulless(parameters_source[i], parameters_length[i], parameters_value[i]); if (F_status_is_error(status)) { - fake_print_error(data->context, data->verbosity, F_status_set_fine(status), "fl_string_append_nulless", F_true); + fake_print_error(*data, F_status_set_fine(status), "fl_string_append_nulless", F_true); return status; } } // for @@ -303,7 +303,7 @@ extern "C" { status = fl_string_dynamic_append_nulless(data->path_work, parameters_value[i]); if (F_status_is_error(status)) { - fake_print_error(data->context, data->verbosity, F_status_set_fine(status), "fl_string_dynamic_append_nulless", F_true); + fake_print_error(*data, F_status_set_fine(status), "fl_string_dynamic_append_nulless", F_true); return status; } } // for @@ -332,7 +332,7 @@ extern "C" { status = fl_string_append_nulless(parameters_source[i], parameters_length[i], parameters_value[i]); if (F_status_is_error(status)) { - fake_print_error(data->context, data->verbosity, F_status_set_fine(status), "fl_string_append_nulless", F_true); + fake_print_error(*data, F_status_set_fine(status), "fl_string_append_nulless", F_true); return status; } } // for @@ -370,7 +370,7 @@ extern "C" { status = fake_path_generate_string_dynamic(data, *parameters_source[i], parameters_value[i], parameters_length[i]); if (F_status_is_error(status)) { - fake_print_error(data->context, data->verbosity, F_status_set_fine(status), "fake_path_generate_string_dynamic", F_true); + fake_print_error(*data, F_status_set_fine(status), "fake_path_generate_string_dynamic", F_true); return status; } } // for @@ -408,7 +408,7 @@ extern "C" { status = fl_string_append_nulless(parameters_source[i], parameters_length[i], parameters_value[i]); if (F_status_is_error(status)) { - fake_print_error(data->context, data->verbosity, F_status_set_fine(status), "fl_string_append_nulless", F_true); + fake_print_error(*data, F_status_set_fine(status), "fl_string_append_nulless", F_true); return status; } } // for @@ -458,7 +458,7 @@ extern "C" { status = fl_string_dynamic_terminate_after(parameters_value[i]); if (F_status_is_error(status)) { - fake_print_error(data->context, data->verbosity, F_status_set_fine(status), "fl_string_dynamic_terminate_after", F_true); + fake_print_error(*data, F_status_set_fine(status), "fl_string_dynamic_terminate_after", F_true); return status; } } // for @@ -549,12 +549,12 @@ extern "C" { for (uint8_t i = 0; i < 2; i++) { if (data->parameters[parameters_id[i]].result == f_console_result_found) { - fake_print_error_parameter_missing_value(data->context, data->verbosity, parameters_name[i]); + fake_print_error_parameter_missing_value(*data, parameters_name[i]); return F_status_set_error(F_parameter); } else if (data->parameters[parameters_id[i]].result == f_console_result_additional) { if (data->parameters[parameters_id[i]].total > 1) { - fake_print_error_parameter_too_many(data->context, data->verbosity, parameters_name[i]); + fake_print_error_parameter_too_many(*data, parameters_name[i]); return F_status_set_error(F_parameter); } @@ -572,7 +572,7 @@ extern "C" { status = f_utf_is_word_dash_plus(arguments.argv[location] + j, width_max, F_false); if (F_status_is_error(status)) { - if (fake_print_error(data->context, data->verbosity, F_status_set_fine(status), "f_utf_is_word_dash_plus", F_false) == F_unknown && data->verbosity != fake_verbosity_quiet) { + if (fake_print_error(*data, F_status_set_fine(status), "f_utf_is_word_dash_plus", F_false) == F_unknown && data->verbosity != fake_verbosity_quiet) { fprintf(f_type_error, "%c", f_string_eol[0]); fl_color_print(f_type_error, data->context.error, data->context.reset, "ERROR: failed to process the parameter '"); fl_color_print(f_type_error, data->context.notable, data->context.reset, "%s%s", f_console_symbol_long_enable, fake_long_process); @@ -609,7 +609,7 @@ extern "C" { } } else { - fake_print_error(data->context, data->verbosity, F_status_set_fine(status), "fl_string_append", F_true); + fake_print_error(*data, F_status_set_fine(status), "fl_string_append", F_true); } return status; @@ -632,7 +632,7 @@ extern "C" { f_macro_string_dynamic_resize(status, (*parameters_value[i]), parameter_default_lengths[i]); if (F_status_is_error(status)) { - fake_print_error(data->context, data->verbosity, F_status_set_fine(status), "f_macro_string_dynamic_resize", F_true); + fake_print_error(*data, F_status_set_fine(status), "f_macro_string_dynamic_resize", F_true); return status; } @@ -643,7 +643,7 @@ extern "C" { } if (data->parameters[fake_parameter_define].result == f_console_result_found) { - fake_print_error_parameter_missing_value(data->context, data->verbosity, fake_long_define); + fake_print_error_parameter_missing_value(*data, fake_long_define); return F_status_set_error(F_parameter); } @@ -685,19 +685,19 @@ extern "C" { for (uint8_t i = 0; i < 4; i++) { if (data->parameters[parameters_id[i]].result == f_console_result_found) { - fake_print_error_parameter_missing_value(data->context, data->verbosity, parameters_name[i]); + fake_print_error_parameter_missing_value(*data, parameters_name[i]); return F_status_set_error(F_parameter); } else if (data->parameters[parameters_id[i]].result == f_console_result_additional) { if (data->parameters[parameters_id[i]].additional.used > 1) { - fake_print_error_parameter_too_many(data->context, data->verbosity, parameters_name[i]); + fake_print_error_parameter_too_many(*data, parameters_name[i]); return F_status_set_error(F_parameter); } status = fl_console_parameter_to_string_dynamic_directory(arguments.argv[data->parameters[parameters_id[i]].additional.array[0]], parameters_value[i]); if (F_status_is_error(status)) { - if (fake_print_error(data->context, data->verbosity, F_status_set_fine(status), "fl_console_parameter_to_string_dynamic_directory", F_false) == F_unknown && data->verbosity != fake_verbosity_quiet) { + if (fake_print_error(*data, F_status_set_fine(status), "fl_console_parameter_to_string_dynamic_directory", F_false) == F_unknown && data->verbosity != fake_verbosity_quiet) { fprintf(f_type_error, "%c", f_string_eol[0]); fl_color_print(f_type_error, data->context.error, data->context.reset, "ERROR: failed to process parameter '"); fl_color_print(f_type_error, data->context.notable, data->context.reset, "%s%s", f_console_symbol_long_enable, parameters_name[i]); @@ -711,7 +711,7 @@ extern "C" { f_macro_string_dynamic_new(status, (*parameters_value[i]), parameter_default_lengths[i]); if (F_status_is_error(status)) { - if (fake_print_error(data->context, data->verbosity, F_status_set_fine(status), "f_macro_string_dynamic_new", F_false) == F_unknown && data->verbosity != fake_verbosity_quiet) { + if (fake_print_error(*data, F_status_set_fine(status), "f_macro_string_dynamic_new", F_false) == F_unknown && data->verbosity != fake_verbosity_quiet) { fprintf(f_type_error, "%c", f_string_eol[0]); fl_color_print(f_type_error, data->context.error, data->context.reset, "ERROR: failed to load default for the parameter '"); fl_color_print(f_type_error, data->context.notable, data->context.reset, "%s%s", f_console_symbol_long_enable, parameters_name[i]); @@ -731,7 +731,7 @@ extern "C" { status = fll_program_parameter_additional_rip(arguments.argv, data->parameters[fake_parameter_define].additional, &data->define); if (F_status_is_error(status)) { - if (fake_print_error(data->context, data->verbosity, F_status_set_fine(status), "fll_program_parameter_additional_rip", F_false) == F_unknown && data->verbosity != fake_verbosity_quiet) { + if (fake_print_error(*data, F_status_set_fine(status), "fll_program_parameter_additional_rip", F_false) == F_unknown && data->verbosity != fake_verbosity_quiet) { fprintf(f_type_error, "%c", f_string_eol[0]); fl_color_print(f_type_error, data->context.error, data->context.reset, "ERROR: failed to process the parameter '"); fl_color_print(f_type_error, data->context.notable, data->context.reset, "%s%s", f_console_symbol_long_enable, fake_long_define); @@ -752,7 +752,7 @@ extern "C" { status = f_utf_is_word(data->define.array[i].string + j, width_max, F_false); if (F_status_is_error(status)) { - if (fake_print_error(data->context, data->verbosity, F_status_set_fine(status), "f_utf_is_word", F_false) == F_unknown && data->verbosity != fake_verbosity_quiet) { + if (fake_print_error(*data, F_status_set_fine(status), "f_utf_is_word", F_false) == F_unknown && data->verbosity != fake_verbosity_quiet) { fprintf(f_type_error, "%c", f_string_eol[0]); fl_color_print(f_type_error, data->context.error, data->context.reset, "ERROR: failed to process the parameter '"); fl_color_print(f_type_error, data->context.notable, data->context.reset, "%s%s", f_console_symbol_long_enable, fake_long_define); @@ -779,14 +779,14 @@ extern "C" { } if (data->parameters[fake_parameter_mode].result == f_console_result_found) { - fake_print_error_parameter_missing_value(data->context, data->verbosity, fake_long_mode); + fake_print_error_parameter_missing_value(*data, fake_long_mode); return F_status_set_error(F_parameter); } else if (data->parameters[fake_parameter_mode].result == f_console_result_additional) { status = fll_program_parameter_additional_rip(arguments.argv, data->parameters[fake_parameter_mode].additional, &data->mode); if (F_status_is_error(status)) { - if (fake_print_error(data->context, data->verbosity, F_status_set_fine(status), "fll_program_parameter_additional_rip", F_false) == F_unknown && data->verbosity != fake_verbosity_quiet) { + if (fake_print_error(*data, F_status_set_fine(status), "fll_program_parameter_additional_rip", F_false) == F_unknown && data->verbosity != fake_verbosity_quiet) { fprintf(f_type_error, "%c", f_string_eol[0]); fl_color_print(f_type_error, data->context.error, data->context.reset, "ERROR: failed to process the parameter '"); fl_color_print(f_type_error, data->context.notable, data->context.reset, "%s%s", f_console_symbol_long_enable, fake_long_mode); @@ -807,7 +807,7 @@ extern "C" { status = f_utf_is_word_dash_plus(data->mode.array[i].string + j, width_max, F_false); if (F_status_is_error(status)) { - if (fake_print_error(data->context, data->verbosity, F_status_set_fine(status), "f_utf_is_word_dash_plus", F_false) == F_unknown && data->verbosity != fake_verbosity_quiet) { + if (fake_print_error(*data, F_status_set_fine(status), "f_utf_is_word_dash_plus", F_false) == F_unknown && data->verbosity != fake_verbosity_quiet) { fprintf(f_type_error, "%c", f_string_eol[0]); fl_color_print(f_type_error, data->context.error, data->context.reset, "ERROR: failed to process the parameter '"); fl_color_print(f_type_error, data->context.notable, data->context.reset, "%s%s", f_console_symbol_long_enable, fake_long_mode); @@ -887,7 +887,7 @@ extern "C" { if (F_status_is_error(status)) { if (F_status_set_fine(status) != F_directory_found_not || parameters_required[i]) { - fake_print_error_file(data.context, data.verbosity, F_status_set_fine(status), "f_file_stat", parameters_value[i]->string, "access", F_false, F_true); + fake_print_error_file(data, F_status_set_fine(status), "f_file_stat", parameters_value[i]->string, "access", F_false, F_true); return status; } } diff --git a/level_3/fake/c/private-fake.h b/level_3/fake/c/private-fake.h index faca904..820ba39 100644 --- a/level_3/fake/c/private-fake.h +++ b/level_3/fake/c/private-fake.h @@ -94,34 +94,6 @@ extern "C" { #endif // _di_fake_path_generate_string_dynamic_ /** - * Print an error message for when the parameter is missing its accompanying value. - * - * @param context - * The color context. - * @param verbosity - * The verbosity level, which determines if and what should be printed. - * @param parameter - * The parameter name. - */ -#ifndef _di_fake_print_error_parameter_missing_value_ - extern void fake_print_error_parameter_missing_value(const fl_color_context context, const uint8_t verbosity, const f_string parameter) f_gcc_attribute_visibility_internal; -#endif // _di_fake_print_error_parameter_missing_value_ - -/** - * Print an error message for when the parameter is specified too many times. - * - * @param context - * The color context. - * @param verbosity - * The verbosity level, which determines if and what should be printed. - * @param parameter - * The parameter name. - */ -#ifndef _di_fake_print_error_parameter_too_many_ - extern void fake_print_error_parameter_too_many(const fl_color_context context, const uint8_t verbosity, const f_string parameter) f_gcc_attribute_visibility_internal; -#endif // _di_fake_print_error_parameter_too_many_ - -/** * Validate console arguments and print any relating error messages. * * @param arguments diff --git a/level_3/fake/c/private-make.c b/level_3/fake/c/private-make.c index 9fe2566..b6f4739 100644 --- a/level_3/fake/c/private-make.c +++ b/level_3/fake/c/private-make.c @@ -65,7 +65,7 @@ extern "C" { *status = fll_fss_basic_list_read(&data_make->buffer, &range, &list_objects, &list_contents); if (F_status_is_error(*status)) { - fake_print_error_fss(data.context, data.verbosity, *status, "fll_fss_basic_list_read", data.file_data_build_fakefile.string, range, F_true); + fake_print_error_fss(data, *status, "fll_fss_basic_list_read", data.file_data_build_fakefile.string, range, F_true); f_macro_fss_objects_delete_simple(list_objects); f_macro_fss_contents_delete_simple(list_contents); @@ -87,7 +87,7 @@ extern "C" { f_macro_fss_nameds_new((*status), data_make->fakefile, list_objects.used); if (F_status_is_error(*status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "f_macro_fss_nameds_new", F_true); + fake_print_error(data, F_status_set_fine(*status), "f_macro_fss_nameds_new", F_true); f_macro_fss_set_delete_simple(settings); f_macro_fss_objects_delete_simple(list_objects); @@ -101,7 +101,7 @@ extern "C" { for (f_array_length i = 0; i < list_objects.used; i++) { if (fl_string_dynamic_partial_compare(name_settings, data_make->buffer, name_settings_range, list_objects.array[i]) == F_equal_to) { if (!missing_settings) { - fake_print_warning_fakefile_object_multiple(data.context, data.verbosity, data.file_data_build_fakefile.string, "list", name_settings.string); + fake_print_warning_fakefile_object_multiple(data, data.file_data_build_fakefile.string, "list", name_settings.string); continue; } @@ -109,7 +109,7 @@ extern "C" { *status = fll_fss_extended_read(&data_make->buffer, &content_range, &settings.objects, &settings.contents, 0, 0); if (F_status_is_error(*status)) { - fake_print_error_fss(data.context, data.verbosity, *status, "fll_fss_extended_read", data.file_data_build_fakefile.string, content_range, F_true); + fake_print_error_fss(data, *status, "fll_fss_extended_read", data.file_data_build_fakefile.string, content_range, F_true); f_macro_fss_set_delete_simple(settings); f_macro_fss_objects_delete_simple(list_objects); @@ -122,7 +122,7 @@ extern "C" { } else if (fl_string_dynamic_partial_compare(name_main, data_make->buffer, name_main_range, list_objects.array[i]) == F_equal_to) { if (!missing_main) { - fake_print_warning_fakefile_object_multiple(data.context, data.verbosity, data.file_data_build_fakefile.string, "list", name_main.string); + fake_print_warning_fakefile_object_multiple(data, data.file_data_build_fakefile.string, "list", name_main.string); continue; } @@ -136,7 +136,7 @@ extern "C" { *status = fll_fss_extended_read(&data_make->buffer, &content_range, &data_make->fakefile.array[data_make->fakefile.used].objects, &data_make->fakefile.array[data_make->fakefile.used].contents, 0, &data_make->fakefile.array[data_make->fakefile.used].quotedss); if (F_status_is_error(*status)) { - fake_print_error_fss(data.context, data.verbosity, *status, "fll_fss_extended_read", data.file_data_build_fakefile.string, content_range, F_true); + fake_print_error_fss(data, *status, "fll_fss_extended_read", data.file_data_build_fakefile.string, content_range, F_true); f_macro_fss_set_delete_simple(settings); f_macro_fss_objects_delete_simple(list_objects); @@ -196,7 +196,7 @@ extern "C" { } if (F_status_is_error(*status)) { - fake_print_error(data.context, data.verbosity, *status, function_name, F_true); + fake_print_error(data, *status, function_name, F_true); f_macro_fss_set_delete_simple(settings); return; @@ -220,18 +220,18 @@ extern "C" { data_make->setting_make.load_build = F_false; } else { - fake_print_error_fakefile_settings_content_invalid(data.context, data.verbosity, data.file_data_build_fakefile.string, data_make->buffer, settings.objects.array[i], settings.contents.array[i].array[0], fake_make_section_settings); + fake_print_error_fakefile_settings_content_invalid(data, data.file_data_build_fakefile.string, data_make->buffer, settings.objects.array[i], settings.contents.array[i].array[0], fake_make_section_settings); } unmatched_load = F_false; } if (settings.contents.array[i].used > 1) { - fake_print_warning_settings_content_multiple(data.context, data.verbosity, data.file_data_build_fakefile.string, fake_make_setting_load_build); + fake_print_warning_settings_content_multiple(data, data.file_data_build_fakefile.string, fake_make_setting_load_build); } } else { - fake_print_warning_settings_content_multiple(data.context, data.verbosity, data.file_data_build_fakefile.string, fake_make_setting_load_build); + fake_print_warning_settings_content_multiple(data, data.file_data_build_fakefile.string, fake_make_setting_load_build); } } else if (fl_string_dynamic_partial_compare_string(fake_make_setting_parameter, data_make->buffer, fake_make_setting_parameter_length, settings.objects.array[i]) == F_equal_to) { @@ -258,7 +258,7 @@ extern "C" { } if (F_status_is_error(*status)) { - fake_print_error(data.context, data.verbosity, *status, function_name, F_true); + fake_print_error(data, *status, function_name, F_true); f_macro_fss_set_delete_simple(settings); return; @@ -295,7 +295,7 @@ extern "C" { *status = fll_fss_snatch_map_apart(data_make->buffer, settings.objects, settings.contents, settings_name, settings_length, 2, settings_value, 0); if (F_status_is_error(*status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fll_fss_snatch_map_apart", F_true); + fake_print_error(data, F_status_set_fine(*status), "fll_fss_snatch_map_apart", F_true); f_macro_fss_set_delete_simple(settings); return; @@ -345,13 +345,13 @@ extern "C" { f_macro_string_dynamics_new(status, data_make.path.stack, f_memory_default_allocation_step); if (F_status_is_error(status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(status), "f_macro_string_dynamics_new", F_true); + fake_print_error(data, F_status_set_fine(status), "f_macro_string_dynamics_new", F_true); return status; } status = f_path_current(F_true, &data_make.path.stack.array[0]); if (F_status_is_error(status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(status), "f_path_current", F_true); + fake_print_error(data, F_status_set_fine(status), "f_path_current", F_true); fake_macro_make_data_delete_simple(data_make); return status; @@ -359,7 +359,7 @@ extern "C" { status = f_directory_open(data_make.path.stack.array[0].string, F_false, &data_make.path.top); if (F_status_is_error(status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(status), "f_directory_open", F_true); + fake_print_error(data, F_status_set_fine(status), "f_directory_open", F_true); fake_macro_make_data_delete_simple(data_make); return status; @@ -413,7 +413,7 @@ extern "C" { } if (F_status_is_error(*status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "f_macro_string_dynamics_resize", F_true); + fake_print_error(data, F_status_set_fine(*status), "f_macro_string_dynamics_resize", F_true); return; } } @@ -453,7 +453,7 @@ extern "C" { *status = fl_iki_read(&data_make->buffer, &range, &iki_variable, &iki_vocabulary, &iki_content); if (F_status_is_error(*status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fl_iki_read", F_true); + fake_print_error(data, F_status_set_fine(*status), "fl_iki_read", F_true); break; } @@ -469,7 +469,7 @@ extern "C" { } if (F_status_is_error(*status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "f_macro_string_dynamics_resize", F_true); + fake_print_error(data, F_status_set_fine(*status), "f_macro_string_dynamics_resize", F_true); return; } } @@ -481,7 +481,7 @@ extern "C" { *status = fl_string_dynamic_partial_append_nulless(data_make->buffer, range, &arguments->array[arguments->used]); if (F_status_is_error(*status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fl_string_dynamic_partial_append_nulless", F_true); + fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamic_partial_append_nulless", F_true); break; } } @@ -494,7 +494,7 @@ extern "C" { *status = fl_string_dynamic_partial_append_nulless(data_make->buffer, range, &arguments->array[arguments->used]); if (F_status_is_error(*status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fl_string_dynamic_partial_append_nulless", F_true); + fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamic_partial_append_nulless", F_true); break; } } @@ -515,7 +515,7 @@ extern "C" { if (*status == F_equal_to_not) { *status = fl_string_dynamic_partial_append_nulless(data_make->buffer, iki_variable.array[j], &arguments->array[arguments->used]); if (F_status_is_error(*status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fl_string_dynamic_partial_append_nulless", F_true); + fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamic_partial_append_nulless", F_true); break; } @@ -523,7 +523,7 @@ extern "C" { continue; } else if (F_status_is_error(*status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fl_string_dynamic_partial_compare", F_true); + fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamic_partial_compare", F_true); break; } @@ -538,14 +538,14 @@ extern "C" { if (l > 0) { *status = fl_string_append(" ", 1, &arguments->array[arguments->used]); if (F_status_is_error(*status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fl_string_append", F_true); + fake_print_error(data, F_status_set_fine(*status), "fl_string_append", F_true); break; } } *status = fl_string_dynamic_append_nulless(map_multis->array[k].value.array[l], &arguments->array[arguments->used]); if (F_status_is_error(*status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fl_string_dynamic_append_nulless", F_true); + fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamic_append_nulless", F_true); break; } } // for @@ -555,13 +555,13 @@ extern "C" { if (arguments->used + map_multis->array[k].value.used > F_buffer_too_large) { *status = F_status_set_error(F_buffer_too_large); - fake_print_error(data.context, data.verbosity, F_buffer_too_large, "f_macro_string_dynamics_resize", F_true); + fake_print_error(data, F_buffer_too_large, "f_macro_string_dynamics_resize", F_true); break; } f_macro_string_dynamics_resize((*status), (*arguments), arguments->used + map_multis->array[k].value.used); if (F_status_is_error(*status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "f_macro_string_dynamics_resize", F_true); + fake_print_error(data, F_status_set_fine(*status), "f_macro_string_dynamics_resize", F_true); break; } } @@ -569,13 +569,13 @@ extern "C" { for (l = 0; l < map_multis->array[k].value.used; l++) { *status = fl_string_dynamic_append_nulless(map_multis->array[k].value.array[l], &arguments->array[arguments->used]); if (F_status_is_error(*status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fl_string_dynamic_append_nulless", F_true); + fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamic_append_nulless", F_true); break; } *status = fl_string_dynamic_terminate_after(&arguments->array[arguments->used]); if (F_status_is_error(*status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fl_string_terminate_after", F_true); + fake_print_error(data, F_status_set_fine(*status), "fl_string_terminate_after", F_true); break; } @@ -587,7 +587,7 @@ extern "C" { break; } else if (F_status_is_error(*status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fl_string_dynamic_compare", F_true); + fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamic_compare", F_true); break; } } // for @@ -606,7 +606,7 @@ extern "C" { *status = fl_string_dynamic_partial_append_nulless(data_make->buffer, range, &arguments->array[arguments->used]); if (F_status_is_error(*status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fl_string_dynamic_partial_append_nulless", F_true); + fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamic_partial_append_nulless", F_true); break; } } @@ -614,7 +614,7 @@ extern "C" { else { *status = fl_string_dynamic_partial_append_nulless(data_make->buffer, content.array[i], &arguments->array[arguments->used]); if (F_status_is_error(*status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fl_string_append_nulless", F_true); + fake_print_error(data, F_status_set_fine(*status), "fl_string_append_nulless", F_true); break; } } @@ -623,7 +623,7 @@ extern "C" { if (used_arguments == arguments->used) { *status = fl_string_dynamic_terminate_after(&arguments->array[arguments->used]); if (F_status_is_error(*status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fl_string_terminate_after", F_true); + fake_print_error(data, F_status_set_fine(*status), "fl_string_terminate_after", F_true); break; } @@ -648,7 +648,7 @@ extern "C" { if (section_id > data_make->fakefile.used) { *status = F_status_set_error(F_parameter); - fake_print_error(data.context, data.verbosity, F_parameter, "fake_make_operate_section", F_true); + fake_print_error(data, F_parameter, "fake_make_operate_section", F_true); return; } @@ -775,13 +775,13 @@ extern "C" { } // for if (operation == 0) { - fake_print_error_fakefile_section_operation_unknown(data.context, data.verbosity, data_make->buffer, section->name, section->objects.array[i]); + fake_print_error_fakefile_section_operation_unknown(data, data_make->buffer, section->name, section->objects.array[i]); *status = F_status_set_error(F_invalid); } else if (operation == fake_make_operation_type_operate) { if (section_stack->used == fake_make_section_stack_max) { - fake_print_error_fakefile_section_operation_stack_max(data.context, data.verbosity, data_make->buffer, section->name, section->objects.array[i], fake_make_section_stack_max); + fake_print_error_fakefile_section_operation_stack_max(data, data_make->buffer, section->name, section->objects.array[i], fake_make_section_stack_max); *status = F_status_set_error(F_recurse); } @@ -818,10 +818,10 @@ extern "C" { if (F_status_is_error(*status)) break; - fake_make_operate_perform(data, section->name, operation, *operation_name, section->objects.array[i], arguments[i], operation_if, data_make, status); + fake_make_operate_perform(data, section->name, operation, *operation_name, arguments[i], operation_if, data_make, status); if (F_status_is_error(*status)) { - fake_print_error_fakefile_section_operation_failed(data.context, data.verbosity, data_make->buffer, section->name, section->objects.array[i]); + fake_print_error_fakefile_section_operation_failed(data, data_make->buffer, section->name, section->objects.array[i]); break; } } // for @@ -833,7 +833,7 @@ extern "C" { #endif // _di_fake_make_operate_section_ #ifndef _di_fake_make_operate_perform_ - void fake_make_operate_perform(const fake_data data, const f_string_range section_name, const uint8_t operation, const f_string_static operation_name, const f_string_range operation_range, const f_string_dynamics arguments, const uint8_t operation_if, fake_make_data *data_make, f_status *status) { + void fake_make_operate_perform(const fake_data data, const f_string_range section_name, const uint8_t operation, const f_string_static operation_name, const f_string_dynamics arguments, const uint8_t operation_if, fake_make_data *data_make, f_status *status) { if (F_status_is_error(*status)) return; if (operation == fake_make_operation_type_archive) { @@ -979,7 +979,7 @@ extern "C" { if (operation == fake_make_operation_type_to) { *status = fake_make_assure_inside_project(data, arguments.array[0], data_make); if (F_status_is_error(*status)) { - fake_print_error_fakefile_section_operation_path_outside(data.context, data.verbosity, *status, "fake_make_assure_inside_project", data_make->buffer, section_name, operation_range, arguments.array[0].string); + fake_print_error_fakefile_section_operation_path_outside(data, *status, "fake_make_assure_inside_project", arguments.array[0].string); if (F_status_set_fine(*status) == F_false) { *status = F_status_set_error(F_failure); @@ -990,13 +990,13 @@ extern "C" { *status = f_path_change(arguments.array[0].string); if (F_status_is_error(*status)) { - fake_print_error_fakefile_section_line(data.context, data.verbosity, F_status_set_fine(*status), "f_path_change", data_make->buffer, section_name, operation_range, arguments.array[0].string); + fake_print_error_fakefile_section_line(data, F_status_set_fine(*status), "f_path_change", arguments.array[0].string); } else { if (data_make->path.stack.used == data_make->path.stack.size) { if (data_make->path.stack.used + 1 >= f_array_length_size) { *status = F_status_set_error(F_buffer_too_large); - fake_print_error_fakefile_section_line(data.context, data.verbosity, F_buffer_too_large, "f_macro_string_dynamics_resize", data_make->buffer, section_name, operation_range, "path stack"); + fake_print_error_fakefile_section_line(data, F_buffer_too_large, "f_macro_string_dynamics_resize", "path stack"); return; } @@ -1008,7 +1008,7 @@ extern "C" { } if (F_status_is_error(*status)) { - fake_print_error_fakefile_section_line(data.context, data.verbosity, F_status_set_fine(*status), "f_macro_string_dynamics_resize", data_make->buffer, section_name, operation_range, 0); + fake_print_error_fakefile_section_line(data, F_status_set_fine(*status), "f_macro_string_dynamics_resize", 0); return; } } @@ -1022,7 +1022,7 @@ extern "C" { data_make->path_real.used--; if (F_status_is_error(*status)) { - fake_print_error_fakefile_section_line(data.context, data.verbosity, F_status_set_fine(*status), "fl_string_dynamic_append_nulless", data_make->buffer, section_name, operation_range, 0); + fake_print_error_fakefile_section_line(data, F_status_set_fine(*status), "fl_string_dynamic_append_nulless", 0); return; } @@ -1060,7 +1060,7 @@ extern "C" { // @todo: convert F_status_set_fine(*status) to a string and assign that instead of 1. (need a convert function from llu to string.) status2 = fl_string_append("1", 1, &data_make->setting_make.parameter.array[0].value.array[0]); - // fake_print_error_fakefile_section_line(data.context, data.verbosity, F_status_set_fine(*status), "fake_clean_operate", data_make.buffer, section_name, operation_range, arguments.array[0].string); + // fake_print_error_fakefile_section_line(data, F_status_set_fine(*status), "fake_clean_operate", data_make.buffer, section_name, operation_range, arguments.array[0].string); } else { // @todo: convert return_code to a string and assign that instead of 0. (need a convert function from llu to string.) diff --git a/level_3/fake/c/private-make.h b/level_3/fake/c/private-make.h index b237fb9..359ce2a 100644 --- a/level_3/fake/c/private-make.h +++ b/level_3/fake/c/private-make.h @@ -425,8 +425,6 @@ extern "C" { * The operation type. * @param operation_name * The operation name. - * @param operation_range - * The range within the buffer pointing to the operation. * @param arguments * The expanded arguments. * @param operation_if @@ -439,7 +437,7 @@ extern "C" { * Status codes (with error bit) are returned on any problem. */ #ifndef _di_fake_make_operate_perform_ - extern void fake_make_operate_perform(const fake_data data, const f_string_range section_name, const uint8_t operation, const f_string_static operation_name, const f_string_range operation_range, const f_string_dynamics arguments, const uint8_t operation_if, fake_make_data *data_make, f_status *status) f_gcc_attribute_visibility_internal; + extern void fake_make_operate_perform(const fake_data data, const f_string_range section_name, const uint8_t operation, const f_string_static operation_name, const f_string_dynamics arguments, const uint8_t operation_if, fake_make_data *data_make, f_status *status) f_gcc_attribute_visibility_internal; #endif // _di_fake_make_operate_perform_ /** diff --git a/level_3/fake/c/private-print.c b/level_3/fake/c/private-print.c index 68d495e..088318c 100644 --- a/level_3/fake/c/private-print.c +++ b/level_3/fake/c/private-print.c @@ -7,37 +7,37 @@ extern "C" { #endif #ifndef _di_fake_print_error_ - f_return_status fake_print_error(const fl_color_context context, const uint8_t verbosity, const f_status status, const f_string function, const bool fallback) { + f_return_status fake_print_error(const fake_data data, const f_status status, const f_string function, const bool fallback) { if (status == F_parameter) { - if (verbosity != fake_verbosity_quiet) { + if (data.verbosity != fake_verbosity_quiet) { fprintf(f_type_error, "%c", f_string_eol[0]); - fl_color_print(f_type_error, context.error, context.reset, "ERROR: Invalid parameter when calling function "); - fl_color_print(f_type_error, context.notable, context.reset, "%s", function); - fl_color_print_line(f_type_error, context.error, context.reset, "()."); + fl_color_print(f_type_error, data.context.error, data.context.reset, "ERROR: Invalid parameter when calling function "); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%s", function); + fl_color_print_line(f_type_error, data.context.error, data.context.reset, "()."); } return F_none; } if (status == F_memory_allocation || status == F_memory_reallocation) { - if (verbosity != fake_verbosity_quiet) { + if (data.verbosity != fake_verbosity_quiet) { fprintf(f_type_error, "%c", f_string_eol[0]); - fl_color_print(f_type_error, context.error, context.reset, "ERROR: Unable to allocate memory in function "); - fl_color_print(f_type_error, context.notable, context.reset, "%s", function); - fl_color_print_line(f_type_error, context.error, context.reset, "()."); + fl_color_print(f_type_error, data.context.error, data.context.reset, "ERROR: Unable to allocate memory in function "); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%s", function); + fl_color_print_line(f_type_error, data.context.error, data.context.reset, "()."); } return F_none; } - if (fallback && verbosity != fake_verbosity_quiet) { + if (fallback && data.verbosity != fake_verbosity_quiet) { fprintf(f_type_error, "%c", f_string_eol[0]); - fl_color_print(f_type_error, context.error, context.reset, "UNKNOWN ERROR: ("); - fl_color_print(f_type_error, context.notable, context.reset, "%llu", status); - fl_color_print(f_type_error, context.error, context.reset, ") in function "); - fl_color_print(f_type_error, context.notable, context.reset, "%s", function); - fl_color_print_line(f_type_error, context.error, context.reset, "()."); + fl_color_print(f_type_error, data.context.error, data.context.reset, "UNKNOWN ERROR: ("); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%llu", status); + fl_color_print(f_type_error, data.context.error, data.context.reset, ") in function "); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%s", function); + fl_color_print_line(f_type_error, data.context.error, data.context.reset, "()."); } return F_unknown; @@ -45,518 +45,477 @@ extern "C" { #endif // _di_fake_print_error_ #ifndef _di_fake_print_error_build_operation_file_ - bool fake_print_error_build_operation_file(const fl_color_context context, const uint8_t verbosity, const f_status status, const f_string function, const f_string operation, const f_string how, const f_string source, const f_string destination, const bool fallback) { + bool fake_print_error_build_operation_file(const fake_data data, const f_status status, const f_string function, const f_string operation, const f_string how, const f_string source, const f_string destination, const bool fallback) { if (status == F_file_found_not) { - if (verbosity != fake_verbosity_quiet) { + if (data.verbosity != fake_verbosity_quiet) { fprintf(f_type_error, "%c", f_string_eol[0]); - fl_color_print(f_type_error, context.error, context.reset, "ERROR: Failed to find '"); + fl_color_print(f_type_error, data.context.error, data.context.reset, "ERROR: Failed to find '"); if (f_file_exists(source) == F_true) { - fl_color_print(f_type_error, context.notable, context.reset, "%s", destination); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%s", destination); } else { - fl_color_print(f_type_error, context.notable, context.reset, "%s", source); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%s", source); } - fl_color_print(f_type_error, context.error, context.reset, "' while trying to %s '", operation); - fl_color_print(f_type_error, context.notable, context.reset, "%s", source); + fl_color_print(f_type_error, data.context.error, data.context.reset, "' while trying to %s '", operation); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%s", source); if (destination) { - fl_color_print(f_type_error, context.error, context.reset, "' %s '", how); - fl_color_print(f_type_error, context.notable, context.reset, "%s", destination); + fl_color_print(f_type_error, data.context.error, data.context.reset, "' %s '", how); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%s", destination); } - fl_color_print_line(f_type_error, context.error, context.reset, "'."); + fl_color_print_line(f_type_error, data.context.error, data.context.reset, "'."); } return F_false; } if (status == F_parameter) { - if (verbosity != fake_verbosity_quiet) { + if (data.verbosity != fake_verbosity_quiet) { fprintf(f_type_error, "%c", f_string_eol[0]); - fl_color_print(f_type_error, context.error, context.reset, "INTERNAL ERROR: Invalid parameter when calling "); - fl_color_print(f_type_error, context.notable, context.reset, "%s", function); - fl_color_print(f_type_error, context.error, context.reset, "() to %s '", operation); - fl_color_print(f_type_error, context.notable, context.reset, "%s", source); + fl_color_print(f_type_error, data.context.error, data.context.reset, "INTERNAL ERROR: Invalid parameter when calling "); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%s", function); + fl_color_print(f_type_error, data.context.error, data.context.reset, "() to %s '", operation); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%s", source); if (destination) { - fl_color_print(f_type_error, context.error, context.reset, "' %s '", how); - fl_color_print(f_type_error, context.notable, context.reset, "%s", destination); + fl_color_print(f_type_error, data.context.error, data.context.reset, "' %s '", how); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%s", destination); } - fl_color_print_line(f_type_error, context.error, context.reset, "'."); + fl_color_print_line(f_type_error, data.context.error, data.context.reset, "'."); } return F_false; } if (status == F_name) { - if (verbosity != fake_verbosity_quiet) { + if (data.verbosity != fake_verbosity_quiet) { fprintf(f_type_error, "%c", f_string_eol[0]); - fl_color_print(f_type_error, context.error, context.reset, "ERROR: Invalid name for '"); - fl_color_print(f_type_error, context.notable, context.reset, "%s", source); + fl_color_print(f_type_error, data.context.error, data.context.reset, "ERROR: Invalid name for '"); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%s", source); if (destination) { - fl_color_print(f_type_error, context.error, context.reset, "' or '"); - fl_color_print(f_type_error, context.notable, context.reset, "%s", destination); + fl_color_print(f_type_error, data.context.error, data.context.reset, "' or '"); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%s", destination); } - fl_color_print_line(f_type_error, context.error, context.reset, "'."); + fl_color_print_line(f_type_error, data.context.error, data.context.reset, "'."); } return F_false; } if (status == F_memory_out) { - if (verbosity != fake_verbosity_quiet) { + if (data.verbosity != fake_verbosity_quiet) { fprintf(f_type_error, "%c", f_string_eol[0]); - fl_color_print(f_type_error, context.error, context.reset, "CRITICAL ERROR: Unable to allocate memory, while trying to %s '", operation); - fl_color_print(f_type_error, context.notable, context.reset, "%s", source); + fl_color_print(f_type_error, data.context.error, data.context.reset, "CRITICAL ERROR: Unable to allocate memory, while trying to %s '", operation); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%s", source); if (destination) { - fl_color_print(f_type_error, context.error, context.reset, "' %s '", how); - fl_color_print(f_type_error, context.notable, context.reset, "%s", destination); + fl_color_print(f_type_error, data.context.error, data.context.reset, "' %s '", how); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%s", destination); } - fl_color_print_line(f_type_error, context.error, context.reset, "'."); + fl_color_print_line(f_type_error, data.context.error, data.context.reset, "'."); } return F_false; } if (status == F_number_overflow) { - if (verbosity != fake_verbosity_quiet) { + if (data.verbosity != fake_verbosity_quiet) { fprintf(f_type_error, "%c", f_string_eol[0]); - fl_color_print(f_type_error, context.error, context.reset, "ERROR: Overflow while trying to %s '", operation); - fl_color_print(f_type_error, context.notable, context.reset, "%s", source); + fl_color_print(f_type_error, data.context.error, data.context.reset, "ERROR: Overflow while trying to %s '", operation); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%s", source); if (destination) { - fl_color_print(f_type_error, context.error, context.reset, "' %s '", how); - fl_color_print(f_type_error, context.notable, context.reset, "%s", destination); + fl_color_print(f_type_error, data.context.error, data.context.reset, "' %s '", how); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%s", destination); } - fl_color_print_line(f_type_error, context.error, context.reset, "'."); + fl_color_print_line(f_type_error, data.context.error, data.context.reset, "'."); } return F_false; } if (status == F_directory) { - if (verbosity != fake_verbosity_quiet) { + if (data.verbosity != fake_verbosity_quiet) { fprintf(f_type_error, "%c", f_string_eol[0]); - fl_color_print(f_type_error, context.error, context.reset, "ERROR: Invalid directory while trying to %s '", operation); - fl_color_print(f_type_error, context.notable, context.reset, "%s", source); + fl_color_print(f_type_error, data.context.error, data.context.reset, "ERROR: Invalid directory while trying to %s '", operation); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%s", source); if (destination) { - fl_color_print(f_type_error, context.error, context.reset, "' %s '", how); - fl_color_print(f_type_error, context.notable, context.reset, "%s", destination); + fl_color_print(f_type_error, data.context.error, data.context.reset, "' %s '", how); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%s", destination); } - fl_color_print_line(f_type_error, context.error, context.reset, "'."); + fl_color_print_line(f_type_error, data.context.error, data.context.reset, "'."); } return F_false; } if (status == F_access_denied) { - if (verbosity != fake_verbosity_quiet) { + if (data.verbosity != fake_verbosity_quiet) { fprintf(f_type_error, "%c", f_string_eol[0]); - fl_color_print(f_type_error, context.error, context.reset, "ERROR: Access denied while trying to %s '", operation); - fl_color_print(f_type_error, context.notable, context.reset, "%s", source); + fl_color_print(f_type_error, data.context.error, data.context.reset, "ERROR: Access denied while trying to %s '", operation); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%s", source); if (destination) { - fl_color_print(f_type_error, context.error, context.reset, "' %s '", how); - fl_color_print(f_type_error, context.notable, context.reset, "%s", destination); + fl_color_print(f_type_error, data.context.error, data.context.reset, "' %s '", how); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%s", destination); } - fl_color_print_line(f_type_error, context.error, context.reset, "'."); + fl_color_print_line(f_type_error, data.context.error, data.context.reset, "'."); } return F_false; } if (status == F_loop) { - if (verbosity != fake_verbosity_quiet) { + if (data.verbosity != fake_verbosity_quiet) { fprintf(f_type_error, "%c", f_string_eol[0]); - fl_color_print(f_type_error, context.error, context.reset, "ERROR: Loop while trying to %s '", operation); - fl_color_print(f_type_error, context.notable, context.reset, "%s", source); + fl_color_print(f_type_error, data.context.error, data.context.reset, "ERROR: Loop while trying to %s '", operation); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%s", source); if (destination) { - fl_color_print(f_type_error, context.error, context.reset, "' %s '", how); - fl_color_print(f_type_error, context.notable, context.reset, "%s", destination); + fl_color_print(f_type_error, data.context.error, data.context.reset, "' %s '", how); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%s", destination); } - fl_color_print_line(f_type_error, context.error, context.reset, "'."); + fl_color_print_line(f_type_error, data.context.error, data.context.reset, "'."); } return F_false; } if (status == F_prohibited) { - if (verbosity != fake_verbosity_quiet) { + if (data.verbosity != fake_verbosity_quiet) { fprintf(f_type_error, "%c", f_string_eol[0]); - fl_color_print(f_type_error, context.error, context.reset, "ERROR: Prohibited by system while trying to %s '", operation); - fl_color_print(f_type_error, context.notable, context.reset, "%s", source); + fl_color_print(f_type_error, data.context.error, data.context.reset, "ERROR: Prohibited by system while trying to %s '", operation); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%s", source); if (destination) { - fl_color_print(f_type_error, context.error, context.reset, "' %s '", how); - fl_color_print(f_type_error, context.notable, context.reset, "%s", destination); + fl_color_print(f_type_error, data.context.error, data.context.reset, "' %s '", how); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%s", destination); } - fl_color_print_line(f_type_error, context.error, context.reset, "'."); + fl_color_print_line(f_type_error, data.context.error, data.context.reset, "'."); } return F_false; } if (status == F_directory_found_not) { - if (verbosity != fake_verbosity_quiet) { + if (data.verbosity != fake_verbosity_quiet) { fprintf(f_type_error, "%c", f_string_eol[0]); - fl_color_print(f_type_error, context.error, context.reset, "ERROR: Failed to %s '", operation); - fl_color_print(f_type_error, context.notable, context.reset, "%s", source); + fl_color_print(f_type_error, data.context.error, data.context.reset, "ERROR: Failed to %s '", operation); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%s", source); if (destination) { - fl_color_print(f_type_error, context.error, context.reset, "' %s '", how); - fl_color_print(f_type_error, context.notable, context.reset, "%s", destination); + fl_color_print(f_type_error, data.context.error, data.context.reset, "' %s '", how); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%s", destination); } - fl_color_print_line(f_type_error, context.error, context.reset, "' due to an invalid directory in the path."); + fl_color_print_line(f_type_error, data.context.error, data.context.reset, "' due to an invalid directory in the path."); } return F_false; } if (status == F_failure) { - if (verbosity != fake_verbosity_quiet) { + if (data.verbosity != fake_verbosity_quiet) { fprintf(f_type_error, "%c", f_string_eol[0]); - fl_color_print(f_type_error, context.error, context.reset, "ERROR: Failed to %s '", operation); - fl_color_print(f_type_error, context.notable, context.reset, "%s", source); + fl_color_print(f_type_error, data.context.error, data.context.reset, "ERROR: Failed to %s '", operation); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%s", source); if (destination) { - fl_color_print(f_type_error, context.error, context.reset, "' %s '", how); - fl_color_print(f_type_error, context.notable, context.reset, "%s", destination); + fl_color_print(f_type_error, data.context.error, data.context.reset, "' %s '", how); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%s", destination); } - fl_color_print_line(f_type_error, context.error, context.reset, "'."); + fl_color_print_line(f_type_error, data.context.error, data.context.reset, "'."); } return F_false; } - if (fake_print_error(context, verbosity, status, function, F_false) == F_unknown && fallback && verbosity != fake_verbosity_quiet) { + if (fake_print_error(data, status, function, F_false) == F_unknown && fallback && data.verbosity != fake_verbosity_quiet) { fprintf(f_type_error, "%c", f_string_eol[0]); - fl_color_print(f_type_error, context.error, context.reset, "UNKNOWN ERROR: ("); - fl_color_print(f_type_error, context.notable, context.reset, "%llu", status); - fl_color_print(f_type_error, context.error, context.reset, ") occurred while trying to %s '", operation); - fl_color_print(f_type_error, context.notable, context.reset, "%s", source); + fl_color_print(f_type_error, data.context.error, data.context.reset, "UNKNOWN ERROR: ("); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%llu", status); + fl_color_print(f_type_error, data.context.error, data.context.reset, ") occurred while trying to %s '", operation); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%s", source); if (destination) { - fl_color_print(f_type_error, context.error, context.reset, "' %s '", how); - fl_color_print(f_type_error, context.notable, context.reset, "%s", destination); + fl_color_print(f_type_error, data.context.error, data.context.reset, "' %s '", how); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%s", destination); } - fl_color_print_line(f_type_error, context.error, context.reset, "'."); + fl_color_print_line(f_type_error, data.context.error, data.context.reset, "'."); } return F_true; } #endif // _di_fake_print_error_build_operation_file_ -#ifndef _di_fake_print_error_fakefile_section_ - bool fake_print_error_fakefile_section(const fl_color_context context, const uint8_t verbosity, const f_status status, const f_string function, const f_string_static buffer, const f_string_range section_name, const bool fallback) { - - if (fake_print_error(context, verbosity, status, function, F_false) == F_unknown && fallback && verbosity != fake_verbosity_quiet) { - fprintf(f_type_error, "%c", f_string_eol[0]); - fl_color_print(f_type_error, context.error, context.reset, "UNKNOWN ERROR: ("); - fl_color_print(f_type_error, context.notable, context.reset, "%llu", status); - fl_color_print(f_type_error, context.error, context.reset, ") occurred while calling "); - fl_color_print(f_type_error, context.notable, context.reset, "%s", function); - fl_color_print(f_type_error, context.error, context.reset, "() for section '"); - - fl_color_print_code(f_type_error, context.notable); - f_print_string_dynamic_partial(f_type_error, buffer, section_name); - fl_color_print_code(f_type_error, context.reset); - - fl_color_print_line(f_type_error, context.error, context.reset, "'."); - } - - return F_true; - } -#endif // _di_fake_print_error_fakefile_section_ - #ifndef _di_fake_print_error_fakefile_section_line_ - void fake_print_error_fakefile_section_line(const fl_color_context context, const uint8_t verbosity, const f_status status, const f_string function, const f_string_static buffer, const f_string_range section_name, const f_string_range operation_name, const f_string string) { - if (verbosity == fake_verbosity_quiet) return; - - f_string_length line = 0; - - f_fss_count_lines(buffer, operation_name.start, &line); + void fake_print_error_fakefile_section_line(const fake_data data, const f_status status, const f_string function, const f_string string) { + if (data.verbosity == fake_verbosity_quiet) return; fprintf(f_type_error, "%c", f_string_eol[0]); if (status == F_parameter) { - fl_color_print(f_type_error, context.error, context.reset, "ERROR: Invalid parameter"); + fl_color_print(f_type_error, data.context.error, data.context.reset, "ERROR: Invalid parameter"); } else if (status == F_memory_allocation || status == F_memory_reallocation) { - fl_color_print(f_type_error, context.error, context.reset, "ERROR: Unable to allocate memory"); + fl_color_print(f_type_error, data.context.error, data.context.reset, "ERROR: Unable to allocate memory"); } else if (status == F_buffer_too_large) { - fl_color_print(f_type_error, context.error, context.reset, "ERROR: Maximum size reached for %s array", string ? string : ""); + fl_color_print(f_type_error, data.context.error, data.context.reset, "ERROR: Maximum size reached for%s%s array", string ? " " : "", string ? string : ""); } else { - fl_color_print(f_type_error, context.error, context.reset, "UNKNOWN ERROR: ("); - fl_color_print(f_type_error, context.notable, context.reset, "%llu", status); - fl_color_print(f_type_error, context.error, context.reset, ") occurred"); + fl_color_print(f_type_error, data.context.error, data.context.reset, "UNKNOWN ERROR: ("); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%llu", status); + fl_color_print(f_type_error, data.context.error, data.context.reset, ") occurred"); } if (function) { - fl_color_print(f_type_error, context.error, context.reset, " while calling "); - fl_color_print(f_type_error, context.notable, context.reset, "%s", function); - fl_color_print(f_type_error, context.error, context.reset, "() for section '"); - } - else { - fl_color_print(f_type_error, context.error, context.reset, " while operating section '"); + fl_color_print(f_type_error, data.context.error, data.context.reset, " while calling "); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%s", function); + fl_color_print(f_type_error, data.context.error, data.context.reset, "()"); } - fl_color_print_code(f_type_error, context.notable); - f_print_string_dynamic_partial(f_type_error, buffer, section_name); - fl_color_print_code(f_type_error, context.reset); - - fl_color_print(f_type_error, context.error, context.reset, " on line "); - fl_color_print(f_type_error, context.notable, context.reset, "%llu", line); - fl_color_print(f_type_error, context.error, context.reset, ", operation '"); - - fl_color_print_code(f_type_error, context.notable); - f_print_string_dynamic_partial(f_type_error, buffer, operation_name); - fl_color_print_code(f_type_error, context.reset); - - fl_color_print_line(f_type_error, context.error, context.reset, "'."); + fl_color_print_line(f_type_error, data.context.error, data.context.reset, "."); } #endif // _di_fake_print_error_fakefile_section_line_ #ifndef _di_fake_print_error_fakefile_section_operation_failed_ - void fake_print_error_fakefile_section_operation_failed(const fl_color_context context, const uint8_t verbosity, const f_string_static buffer, const f_string_range section_name, const f_string_range operation_name) { - if (verbosity == fake_verbosity_quiet) return; + void fake_print_error_fakefile_section_operation_failed(const fake_data data, const f_string_static buffer, const f_string_range section_name, const f_string_range operation_name) { + if (data.verbosity == fake_verbosity_quiet) return; f_string_length line = 0; f_fss_count_lines(buffer, operation_name.start, &line); fprintf(f_type_error, "%c", f_string_eol[0]); - fl_color_print(f_type_error, context.error, context.reset, "ERROR: The section operation '"); + fl_color_print(f_type_error, data.context.error, data.context.reset, "ERROR: The section operation '"); - fl_color_print_code(f_type_error, context.notable); + fl_color_print_code(f_type_error, data.context.notable); f_print_string_dynamic_partial(f_type_error, buffer, operation_name); - fl_color_print_code(f_type_error, context.reset); + fl_color_print_code(f_type_error, data.context.reset); - fl_color_print(f_type_error, context.error, context.reset, "' from section '"); + fl_color_print(f_type_error, data.context.error, data.context.reset, "' from section '"); - fl_color_print_code(f_type_error, context.notable); + fl_color_print_code(f_type_error, data.context.notable); f_print_string_dynamic_partial(f_type_error, buffer, section_name); - fl_color_print_code(f_type_error, context.reset); + fl_color_print_code(f_type_error, data.context.reset); - fl_color_print(f_type_error, context.error, context.reset, "' on line "); - fl_color_print(f_type_error, context.notable, context.reset, "%llu", line); - fl_color_print_line(f_type_error, context.error, context.reset, " failed."); + fl_color_print(f_type_error, data.context.error, data.context.reset, "' on line "); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%llu", line); + fl_color_print_line(f_type_error, data.context.error, data.context.reset, " failed."); } #endif // _di_fake_print_error_fakefile_section_operation_failed_ #ifndef _di_fake_print_error_fakefile_section_operation_stack_max_ - void fake_print_error_fakefile_section_operation_stack_max(const fl_color_context context, const uint8_t verbosity, const f_string_static buffer, const f_string_range section_name, const f_string_range operation_name, const f_array_length stack_max) { - if (verbosity == fake_verbosity_quiet) return; + void fake_print_error_fakefile_section_operation_stack_max(const fake_data data, const f_string_static buffer, const f_string_range section_name, const f_string_range operation_name, const f_array_length stack_max) { + if (data.verbosity == fake_verbosity_quiet) return; f_string_length line = 0; f_fss_count_lines(buffer, operation_name.start, &line); fprintf(f_type_error, "%c", f_string_eol[0]); - fl_color_print(f_type_error, context.error, context.reset, "ERROR: The section operation '"); + fl_color_print(f_type_error, data.context.error, data.context.reset, "ERROR: The section operation '"); - fl_color_print_code(f_type_error, context.notable); + fl_color_print_code(f_type_error, data.context.notable); f_print_string_dynamic_partial(f_type_error, buffer, operation_name); - fl_color_print_code(f_type_error, context.reset); + fl_color_print_code(f_type_error, data.context.reset); - fl_color_print(f_type_error, context.error, context.reset, "' from section '"); + fl_color_print(f_type_error, data.context.error, data.context.reset, "' from section '"); - fl_color_print_code(f_type_error, context.notable); + fl_color_print_code(f_type_error, data.context.notable); f_print_string_dynamic_partial(f_type_error, buffer, section_name); - fl_color_print_code(f_type_error, context.reset); + fl_color_print_code(f_type_error, data.context.reset); - fl_color_print(f_type_error, context.error, context.reset, "' on line "); - fl_color_print(f_type_error, context.notable, context.reset, "%llu", line); - fl_color_print(f_type_error, context.error, context.reset, " cannot be processed because the max stack depth of "); - fl_color_print(f_type_error, context.notable, context.reset, "%llu", stack_max); - fl_color_print_line(f_type_error, context.error, context.reset, " has been reached."); + fl_color_print(f_type_error, data.context.error, data.context.reset, "' on line "); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%llu", line); + fl_color_print(f_type_error, data.context.error, data.context.reset, " cannot be processed because the max stack depth of "); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%llu", stack_max); + fl_color_print_line(f_type_error, data.context.error, data.context.reset, " has been reached."); } #endif // _di_fake_print_error_fakefile_section_operation_stack_max_ #ifndef _di_fake_print_error_fakefile_section_operation_unknown_ - void fake_print_error_fakefile_section_operation_unknown(const fl_color_context context, const uint8_t verbosity, const f_string_static buffer, const f_string_range section_name, const f_string_range operation_name) { - if (verbosity == fake_verbosity_quiet) return; + void fake_print_error_fakefile_section_operation_unknown(const fake_data data, const f_string_static buffer, const f_string_range section_name, const f_string_range operation_name) { + if (data.verbosity == fake_verbosity_quiet) return; f_string_length line = 0; f_fss_count_lines(buffer, operation_name.start, &line); fprintf(f_type_error, "%c", f_string_eol[0]); - fl_color_print(f_type_error, context.error, context.reset, "ERROR: The section operation '"); + fl_color_print(f_type_error, data.context.error, data.context.reset, "ERROR: The section operation '"); - fl_color_print_code(f_type_error, context.notable); + fl_color_print_code(f_type_error, data.context.notable); f_print_string_dynamic_partial(f_type_error, buffer, operation_name); - fl_color_print_code(f_type_error, context.reset); + fl_color_print_code(f_type_error, data.context.reset); - fl_color_print(f_type_error, context.error, context.reset, "' from section '"); + fl_color_print(f_type_error, data.context.error, data.context.reset, "' from section '"); - fl_color_print_code(f_type_error, context.notable); + fl_color_print_code(f_type_error, data.context.notable); f_print_string_dynamic_partial(f_type_error, buffer, section_name); - fl_color_print_code(f_type_error, context.reset); + fl_color_print_code(f_type_error, data.context.reset); - fl_color_print(f_type_error, context.error, context.reset, "' on line "); - fl_color_print(f_type_error, context.notable, context.reset, "%llu", line); - fl_color_print_line(f_type_error, context.error, context.reset, " is not a known operation name."); + fl_color_print(f_type_error, data.context.error, data.context.reset, "' on line "); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%llu", line); + fl_color_print_line(f_type_error, data.context.error, data.context.reset, " is not a known operation name."); } #endif // _di_fake_print_error_fakefile_section_operation_unknown_ #ifndef _di_fake_print_error_fakefile_settings_content_invalid_ - void fake_print_error_fakefile_settings_content_invalid(const fl_color_context context, const uint8_t verbosity, const f_string path_file, const f_string_dynamic buffer, const f_string_range range_object, const f_string_range range_content, const f_string settings_name) { - if (verbosity != fake_verbosity_verbose) return; + void fake_print_error_fakefile_settings_content_invalid(const fake_data data, const f_string path_file, const f_string_dynamic buffer, const f_string_range range_object, const f_string_range range_content, const f_string settings_name) { + if (data.verbosity != fake_verbosity_verbose) return; fprintf(f_type_error, "%c", f_string_eol[0]); - fl_color_print(f_type_warning, context.warning, context.reset, "WARNING: the fakefile '"); - fl_color_print(f_type_warning, context.notable, context.reset, "%s", path_file); - fl_color_print(f_type_warning, context.warning, context.reset, "' has an invalid content '"); + fl_color_print(f_type_warning, data.context.warning, data.context.reset, "WARNING: the fakefile '"); + fl_color_print(f_type_warning, data.context.notable, data.context.reset, "%s", path_file); + fl_color_print(f_type_warning, data.context.warning, data.context.reset, "' has an invalid content '"); - fl_color_print_code(f_type_warning, context.notable); + fl_color_print_code(f_type_warning, data.context.notable); f_print_string_dynamic_partial(f_type_warning, buffer, range_content); - fl_color_print_code(f_type_warning, context.reset); + fl_color_print_code(f_type_warning, data.context.reset); - fl_color_print(f_type_warning, context.warning, context.reset, "' for the '"); - fl_color_print(f_type_warning, context.notable, context.reset, "%s", settings_name); - fl_color_print(f_type_warning, context.warning, context.reset, "' object '"); + fl_color_print(f_type_warning, data.context.warning, data.context.reset, "' for the '"); + fl_color_print(f_type_warning, data.context.notable, data.context.reset, "%s", settings_name); + fl_color_print(f_type_warning, data.context.warning, data.context.reset, "' object '"); - fl_color_print_code(f_type_warning, context.notable); + fl_color_print_code(f_type_warning, data.context.notable); f_print_string_dynamic_partial(f_type_warning, buffer, range_object); - fl_color_print_code(f_type_warning, context.reset); + fl_color_print_code(f_type_warning, data.context.reset); - fl_color_print_line(f_type_warning, context.warning, context.reset, "'."); + fl_color_print_line(f_type_warning, data.context.warning, data.context.reset, "'."); } #endif // _di_fake_print_error_fakefile_settings_content_invalid_ #ifndef _di_fake_print_error_file_ - bool fake_print_error_file(const fl_color_context context, const uint8_t verbosity, const f_status status, const f_string function, const f_string name, const f_string operation, const bool is_file, const bool fallback) { + bool fake_print_error_file(const fake_data data, const f_status status, const f_string function, const f_string name, const f_string operation, const bool is_file, const bool fallback) { const f_string file_or_directory = is_file ? "file" : "directory"; if (status == F_file_found_not) { - if (verbosity != fake_verbosity_quiet) { + if (data.verbosity != fake_verbosity_quiet) { fprintf(f_type_error, "%c", f_string_eol[0]); - fl_color_print(f_type_error, context.error, context.reset, "ERROR: failed to find %s '", file_or_directory); - fl_color_print(f_type_error, context.notable, context.reset, "%s", name); - fl_color_print_line(f_type_error, context.error, context.reset, "'."); + fl_color_print(f_type_error, data.context.error, data.context.reset, "ERROR: failed to find %s '", file_or_directory); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%s", name); + fl_color_print_line(f_type_error, data.context.error, data.context.reset, "'."); } return F_false; } if (status == F_file_found) { - if (verbosity != fake_verbosity_quiet) { + if (data.verbosity != fake_verbosity_quiet) { fprintf(f_type_error, "%c", f_string_eol[0]); - fl_color_print(f_type_error, context.error, context.reset, "ERROR: the %s '", file_or_directory); - fl_color_print(f_type_error, context.notable, context.reset, "%s", name); - fl_color_print_line(f_type_error, context.error, context.reset, "' already exists."); + fl_color_print(f_type_error, data.context.error, data.context.reset, "ERROR: the %s '", file_or_directory); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%s", name); + fl_color_print_line(f_type_error, data.context.error, data.context.reset, "' already exists."); } return F_false; } if (status == F_parameter) { - if (verbosity != fake_verbosity_quiet) { + if (data.verbosity != fake_verbosity_quiet) { fprintf(f_type_error, "%c", f_string_eol[0]); - fl_color_print(f_type_error, context.error, context.reset, "INTERNAL ERROR: Invalid parameter when calling "); - fl_color_print(f_type_error, context.notable, context.reset, "%s", function); - fl_color_print(f_type_error, context.error, context.reset, "() for the %s '", file_or_directory); - fl_color_print(f_type_error, context.notable, context.reset, "%s", name); - fl_color_print_line(f_type_error, context.error, context.reset, "'."); + fl_color_print(f_type_error, data.context.error, data.context.reset, "INTERNAL ERROR: Invalid parameter when calling "); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%s", function); + fl_color_print(f_type_error, data.context.error, data.context.reset, "() for the %s '", file_or_directory); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%s", name); + fl_color_print_line(f_type_error, data.context.error, data.context.reset, "'."); } return F_false; } if (status == F_name) { - if (verbosity != fake_verbosity_quiet) { + if (data.verbosity != fake_verbosity_quiet) { fprintf(f_type_error, "%c", f_string_eol[0]); - fl_color_print(f_type_error, context.error, context.reset, "ERROR: Invalid %s name '", file_or_directory); - fl_color_print(f_type_error, context.notable, context.reset, "%s", name); - fl_color_print_line(f_type_error, context.error, context.reset, "'."); + fl_color_print(f_type_error, data.context.error, data.context.reset, "ERROR: Invalid %s name '", file_or_directory); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%s", name); + fl_color_print_line(f_type_error, data.context.error, data.context.reset, "'."); } return F_false; } if (status == F_memory_out) { - if (verbosity != fake_verbosity_quiet) { + if (data.verbosity != fake_verbosity_quiet) { fprintf(f_type_error, "%c", f_string_eol[0]); - fl_color_print(f_type_error, context.error, context.reset, "CRITICAL ERROR: Unable to allocate memory, while trying to %s %s '", operation, file_or_directory); - fl_color_print(f_type_error, context.notable, context.reset, "%s", name); - fl_color_print_line(f_type_error, context.error, context.reset, "'."); + fl_color_print(f_type_error, data.context.error, data.context.reset, "CRITICAL ERROR: Unable to allocate memory, while trying to %s %s '", operation, file_or_directory); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%s", name); + fl_color_print_line(f_type_error, data.context.error, data.context.reset, "'."); } return F_false; } if (status == F_number_overflow) { - if (verbosity != fake_verbosity_quiet) { + if (data.verbosity != fake_verbosity_quiet) { fprintf(f_type_error, "%c", f_string_eol[0]); - fl_color_print(f_type_error, context.error, context.reset, "ERROR: Overflow while trying to %s %s '", operation, file_or_directory); - fl_color_print(f_type_error, context.notable, context.reset, "%s", name); - fl_color_print_line(f_type_error, context.error, context.reset, "'."); + fl_color_print(f_type_error, data.context.error, data.context.reset, "ERROR: Overflow while trying to %s %s '", operation, file_or_directory); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%s", name); + fl_color_print_line(f_type_error, data.context.error, data.context.reset, "'."); } return F_false; } if (status == F_directory) { - if (verbosity != fake_verbosity_quiet) { + if (data.verbosity != fake_verbosity_quiet) { fprintf(f_type_error, "%c", f_string_eol[0]); - fl_color_print(f_type_error, context.error, context.reset, "ERROR: Invalid directory while trying to %s %s '", operation, file_or_directory); - fl_color_print(f_type_error, context.notable, context.reset, "%s", name); - fl_color_print_line(f_type_error, context.error, context.reset, "'."); + fl_color_print(f_type_error, data.context.error, data.context.reset, "ERROR: Invalid directory while trying to %s %s '", operation, file_or_directory); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%s", name); + fl_color_print_line(f_type_error, data.context.error, data.context.reset, "'."); } return F_false; } if (status == F_access_denied) { - if (verbosity != fake_verbosity_quiet) { + if (data.verbosity != fake_verbosity_quiet) { fprintf(f_type_error, "%c", f_string_eol[0]); - fl_color_print(f_type_error, context.error, context.reset, "ERROR: Access denied while trying to %s %s '", operation, file_or_directory); - fl_color_print(f_type_error, context.notable, context.reset, "%s", name); - fl_color_print_line(f_type_error, context.error, context.reset, "'."); + fl_color_print(f_type_error, data.context.error, data.context.reset, "ERROR: Access denied while trying to %s %s '", operation, file_or_directory); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%s", name); + fl_color_print_line(f_type_error, data.context.error, data.context.reset, "'."); } return F_false; } if (status == F_loop) { - if (verbosity != fake_verbosity_quiet) { + if (data.verbosity != fake_verbosity_quiet) { fprintf(f_type_error, "%c", f_string_eol[0]); - fl_color_print(f_type_error, context.error, context.reset, "ERROR: Loop while trying to %s %s '", operation, file_or_directory); - fl_color_print(f_type_error, context.notable, context.reset, "%s", name); - fl_color_print_line(f_type_error, context.error, context.reset, "'."); + fl_color_print(f_type_error, data.context.error, data.context.reset, "ERROR: Loop while trying to %s %s '", operation, file_or_directory); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%s", name); + fl_color_print_line(f_type_error, data.context.error, data.context.reset, "'."); } return F_false; } if (status == F_prohibited) { - if (verbosity != fake_verbosity_quiet) { + if (data.verbosity != fake_verbosity_quiet) { fprintf(f_type_error, "%c", f_string_eol[0]); - fl_color_print(f_type_error, context.error, context.reset, "ERROR: Prohibited by system while trying to %s %s '", operation, file_or_directory); - fl_color_print(f_type_error, context.notable, context.reset, "%s", name); - fl_color_print_line(f_type_error, context.error, context.reset, "'."); + fl_color_print(f_type_error, data.context.error, data.context.reset, "ERROR: Prohibited by system while trying to %s %s '", operation, file_or_directory); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%s", name); + fl_color_print_line(f_type_error, data.context.error, data.context.reset, "'."); } return F_false; @@ -564,11 +523,11 @@ extern "C" { if (is_file) { if (status == F_directory_found_not) { - if (verbosity != fake_verbosity_quiet) { + if (data.verbosity != fake_verbosity_quiet) { fprintf(f_type_error, "%c", f_string_eol[0]); - fl_color_print(f_type_error, context.error, context.reset, "ERROR: failed to %s %s '", operation, file_or_directory); - fl_color_print(f_type_error, context.notable, context.reset, "%s", name); - fl_color_print_line(f_type_error, context.error, context.reset, "' due to an invalid directory in the path."); + fl_color_print(f_type_error, data.context.error, data.context.reset, "ERROR: failed to %s %s '", operation, file_or_directory); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%s", name); + fl_color_print_line(f_type_error, data.context.error, data.context.reset, "' due to an invalid directory in the path."); } return F_false; @@ -576,35 +535,35 @@ extern "C" { } else { if (status == F_directory_found_not) { - if (verbosity != fake_verbosity_quiet) { + if (data.verbosity != fake_verbosity_quiet) { fprintf(f_type_error, "%c", f_string_eol[0]); - fl_color_print(f_type_error, context.error, context.reset, "ERROR: failed to %s %s '", operation, file_or_directory); - fl_color_print(f_type_error, context.notable, context.reset, "%s", name); - fl_color_print_line(f_type_error, context.error, context.reset, "' due to an invalid directory in the path."); + fl_color_print(f_type_error, data.context.error, data.context.reset, "ERROR: failed to %s %s '", operation, file_or_directory); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%s", name); + fl_color_print_line(f_type_error, data.context.error, data.context.reset, "' due to an invalid directory in the path."); } return F_false; } if (status == F_failure) { - if (verbosity != fake_verbosity_quiet) { + if (data.verbosity != fake_verbosity_quiet) { fprintf(f_type_error, "%c", f_string_eol[0]); - fl_color_print(f_type_error, context.error, context.reset, "ERROR: failed to %s %s '", operation, file_or_directory); - fl_color_print(f_type_error, context.notable, context.reset, "%s", name); - fl_color_print_line(f_type_error, context.error, context.reset, "'."); + fl_color_print(f_type_error, data.context.error, data.context.reset, "ERROR: failed to %s %s '", operation, file_or_directory); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%s", name); + fl_color_print_line(f_type_error, data.context.error, data.context.reset, "'."); } return F_false; } } - if (fake_print_error(context, verbosity, status, function, F_false) == F_unknown && fallback && verbosity != fake_verbosity_quiet) { + if (fake_print_error(data, status, function, F_false) == F_unknown && fallback && data.verbosity != fake_verbosity_quiet) { fprintf(f_type_error, "%c", f_string_eol[0]); - fl_color_print(f_type_error, context.error, context.reset, "UNKNOWN ERROR: ("); - fl_color_print(f_type_error, context.notable, context.reset, "%llu", status); - fl_color_print(f_type_error, context.error, context.reset, ") occurred while trying to %s %s '", operation, file_or_directory); - fl_color_print(f_type_error, context.notable, context.reset, "%s", name); - fl_color_print_line(f_type_error, context.error, context.reset, "'."); + fl_color_print(f_type_error, data.context.error, data.context.reset, "UNKNOWN ERROR: ("); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%llu", status); + fl_color_print(f_type_error, data.context.error, data.context.reset, ") occurred while trying to %s %s '", operation, file_or_directory); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%s", name); + fl_color_print_line(f_type_error, data.context.error, data.context.reset, "'."); } return F_true; @@ -612,41 +571,41 @@ extern "C" { #endif // _di_fake_print_error_file_ #ifndef _di_fake_print_error_fss - bool fake_print_error_fss(const fl_color_context context, const uint8_t verbosity, const f_status status, const f_string function, const f_string path_file, const f_string_range range, const bool fallback) { + bool fake_print_error_fss(const fake_data data, const f_status status, const f_string function, const f_string path_file, const f_string_range range, const bool fallback) { if (status == F_file_found_not) { - if (verbosity != fake_verbosity_quiet) { + if (data.verbosity != fake_verbosity_quiet) { fprintf(f_type_error, "%c", f_string_eol[0]); - fl_color_print(f_type_error, context.error, context.reset, "ENCODING ERROR: error occurred on invalid UTF-8 character at stop position (at "); - fl_color_print(f_type_error, context.notable, context.reset, "%d", range.start); - fl_color_print(f_type_error, context.error, context.reset, " of setting file '"); - fl_color_print(f_type_error, context.notable, context.reset, "%s", path_file); - fl_color_print_line(f_type_error, context.error, context.reset, "')."); + fl_color_print(f_type_error, data.context.error, data.context.reset, "ENCODING ERROR: error occurred on invalid UTF-8 character at stop position (at "); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%d", range.start); + fl_color_print(f_type_error, data.context.error, data.context.reset, " of setting file '"); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%s", path_file); + fl_color_print_line(f_type_error, data.context.error, data.context.reset, "')."); } return F_false; } if (status == F_status_set_error(F_incomplete_utf_stop)) { - if (verbosity != fake_verbosity_quiet) { + if (data.verbosity != fake_verbosity_quiet) { fprintf(f_type_error, "%c", f_string_eol[0]); - fl_color_print(f_type_error, context.error, context.reset, "ENCODING ERROR: error occurred on invalid UTF-8 character at end of string (at "); - fl_color_print(f_type_error, context.notable, context.reset, "%d", range.start); - fl_color_print(f_type_error, context.error, context.reset, " of setting file '"); - fl_color_print(f_type_error, context.notable, context.reset, "%s", path_file); - fl_color_print_line(f_type_error, context.error, context.reset, "')."); + fl_color_print(f_type_error, data.context.error, data.context.reset, "ENCODING ERROR: error occurred on invalid UTF-8 character at end of string (at "); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%d", range.start); + fl_color_print(f_type_error, data.context.error, data.context.reset, " of setting file '"); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%s", path_file); + fl_color_print_line(f_type_error, data.context.error, data.context.reset, "')."); } return F_false; } - if (fake_print_error(context, verbosity, status, function, F_false) == F_unknown && fallback && verbosity != fake_verbosity_quiet) { + if (fake_print_error(data, status, function, F_false) == F_unknown && fallback && data.verbosity != fake_verbosity_quiet) { fprintf(f_type_error, "%c", f_string_eol[0]); - fl_color_print(f_type_error, context.error, context.reset, "UNKNOWN ERROR: ("); - fl_color_print(f_type_error, context.notable, context.reset, "%llu", status); - fl_color_print(f_type_error, context.error, context.reset, ") in function "); - fl_color_print(f_type_error, context.notable, context.reset, "%s", function); - fl_color_print_line(f_type_error, context.error, context.reset, "()."); + fl_color_print(f_type_error, data.context.error, data.context.reset, "UNKNOWN ERROR: ("); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%llu", status); + fl_color_print(f_type_error, data.context.error, data.context.reset, ") in function "); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%s", function); + fl_color_print_line(f_type_error, data.context.error, data.context.reset, "()."); } return F_true; @@ -654,129 +613,110 @@ extern "C" { #endif // _di_fake_print_error_fss #ifndef _di_fake_print_error_fakefile_section_operation_path_outside_ - void fake_print_error_fakefile_section_operation_path_outside(const fl_color_context context, const uint8_t verbosity, const f_status status, const f_string function, const f_string_static buffer, const f_string_range section_name, const f_string_range operation_name, const f_string path) { - if (verbosity != fake_verbosity_quiet) { - - if (F_status_set_fine(status) == F_false) { - f_string_length line = 0; + void fake_print_error_fakefile_section_operation_path_outside(const fake_data data, const f_status status, const f_string function, const f_string path) { + if (data.verbosity == fake_verbosity_quiet) return; - f_fss_count_lines(buffer, operation_name.start, &line); - - fprintf(f_type_error, "%c", f_string_eol[0]); - fl_color_print(f_type_error, context.error, context.reset, "ERROR: the path '"); - fl_color_print(f_type_error, context.notable, context.reset, "%s", path); - fl_color_print(f_type_error, context.error, context.reset, "' is outside the project root for section '"); - - fl_color_print_code(f_type_error, context.notable); - f_print_string_dynamic_partial(f_type_error, buffer, section_name); - fl_color_print_code(f_type_error, context.reset); - - fl_color_print(f_type_error, context.error, context.reset, " on line "); - fl_color_print(f_type_error, context.notable, context.reset, "%llu", line); - fl_color_print(f_type_error, context.error, context.reset, ", operation '"); - - fl_color_print_code(f_type_error, context.notable); - f_print_string_dynamic_partial(f_type_error, buffer, operation_name); - fl_color_print_code(f_type_error, context.reset); - - fl_color_print_line(f_type_error, context.error, context.reset, "'."); - } - else { - fake_print_error_fakefile_section_line(context, verbosity, status, function, buffer, section_name, operation_name, path); - } + if (F_status_set_fine(status) == F_false) { + fprintf(f_type_error, "%c", f_string_eol[0]); + fl_color_print(f_type_error, data.context.error, data.context.reset, "ERROR: the path '"); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%s", path); + fl_color_print_line(f_type_error, data.context.error, data.context.reset, "' is outside the project root."); + } + else { + fake_print_error_file(data, status, function, path, "determine real path of", F_true, F_true); } } #endif // _di_fake_print_error_fakefile_section_operation_path_outside_ #ifndef _di_fake_print_error_parameter_missing_value_ - void fake_print_error_parameter_missing_value(const fl_color_context context, const uint8_t verbosity, const f_string parameter) { - if (verbosity != fake_verbosity_quiet) { - fprintf(f_type_error, "%c", f_string_eol[0]); + void fake_print_error_parameter_missing_value(const fake_data data, const f_string parameter) { + if (data.verbosity == fake_verbosity_quiet) return; + + fprintf(f_type_error, "%c", f_string_eol[0]); - fl_color_print(f_type_error, context.error, context.reset, "ERROR: The parameter '"); - fl_color_print(f_type_error, context.notable, context.reset, "%s%s", f_console_symbol_long_enable, parameter); + fl_color_print(f_type_error, data.context.error, data.context.reset, "ERROR: The parameter '"); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%s%s", f_console_symbol_long_enable, parameter); - fl_color_print_line(f_type_error, context.error, context.reset, "' was specified, but no value was given."); - } + fl_color_print_line(f_type_error, data.context.error, data.context.reset, "' was specified, but no value was given."); } #endif // _di_fake_print_error_parameter_missing_value_ #ifndef _di_fake_print_error_parameter_too_many_ - void fake_print_error_parameter_too_many(const fl_color_context context, const uint8_t verbosity, const f_string parameter) { - if (verbosity != fake_verbosity_quiet) { - fprintf(f_type_error, "%c", f_string_eol[0]); + void fake_print_error_parameter_too_many(const fake_data data, const f_string parameter) { + if (data.verbosity == fake_verbosity_quiet) return; - fl_color_print(f_type_error, context.error, context.reset, "ERROR: The parameter '"); - fl_color_print(f_type_error, context.notable, context.reset, "%s%s", f_console_symbol_long_enable, parameter); + fprintf(f_type_error, "%c", f_string_eol[0]); - fl_color_print_line(f_type_error, context.error, context.reset, "' specified too many times."); - } + fl_color_print(f_type_error, data.context.error, data.context.reset, "ERROR: The parameter '"); + fl_color_print(f_type_error, data.context.notable, data.context.reset, "%s%s", f_console_symbol_long_enable, parameter); + + fl_color_print_line(f_type_error, data.context.error, data.context.reset, "' specified too many times."); } #endif // _di_fake_print_error_parameter_too_many_ #ifndef _di_fake_print_error_section_operation_ void fake_print_error_section_operation(const fake_data data, const f_string_static buffer, const f_string_range section_name, const f_string_static operation_name, const f_string message, ...) { - if (data.verbosity != fake_verbosity_quiet) { - fprintf(f_type_error, "%c", f_string_eol[0]); + if (data.verbosity == fake_verbosity_quiet) return; - fl_color_print(f_type_error, data.context.error, data.context.reset, "ERROR: Section '"); + fprintf(f_type_error, "%c", f_string_eol[0]); - fl_color_print_code(f_type_error, data.context.notable); - f_print_string_dynamic_partial(f_type_error, buffer, section_name); - fl_color_print_code(f_type_error, data.context.reset); + fl_color_print(f_type_error, data.context.error, data.context.reset, "ERROR: Section '"); - fl_color_print(f_type_error, data.context.error, data.context.reset, "' operation '"); + fl_color_print_code(f_type_error, data.context.notable); + f_print_string_dynamic_partial(f_type_error, buffer, section_name); + fl_color_print_code(f_type_error, data.context.reset); - fl_color_print_code(f_type_error, data.context.notable); - f_print_string_dynamic(f_type_error, operation_name); - fl_color_print_code(f_type_error, data.context.reset); + fl_color_print(f_type_error, data.context.error, data.context.reset, "' operation '"); - fl_color_print(f_type_error, data.context.error, data.context.reset, "' "); + fl_color_print_code(f_type_error, data.context.notable); + f_print_string_dynamic(f_type_error, operation_name); + fl_color_print_code(f_type_error, data.context.reset); - f_print_string_dynamic(f_type_error, data.context.error); + fl_color_print(f_type_error, data.context.error, data.context.reset, "' "); - va_list ap; + f_print_string_dynamic(f_type_error, data.context.error); - va_start(ap, message); + va_list ap; - vfprintf(f_type_error, message, ap); + va_start(ap, message); - va_end(ap); + vfprintf(f_type_error, message, ap); - f_print_string_dynamic(f_type_error, data.context.reset); + va_end(ap); - fl_color_print_line(f_type_error, data.context.error, data.context.reset, "."); - } + f_print_string_dynamic(f_type_error, data.context.reset); + + fl_color_print_line(f_type_error, data.context.error, data.context.reset, "."); } #endif // _di_fake_print_error_section_operation_ #ifndef _di_fake_print_warning_fakefile_object_multiple_ - void fake_print_warning_fakefile_object_multiple(const fl_color_context context, const uint8_t verbosity, const f_string path_file, const f_string label, const f_string name_object) { - if (verbosity != fake_verbosity_verbose) return; + void fake_print_warning_fakefile_object_multiple(const fake_data data, const f_string path_file, const f_string label, const f_string name_object) { + if (data.verbosity != fake_verbosity_verbose) return; fprintf(f_type_error, "%c", f_string_eol[0]); - fl_color_print(f_type_warning, context.warning, context.reset, "WARNING: the %s object '", label); - fl_color_print(f_type_warning, context.notable, context.reset, "%s", name_object); - fl_color_print(f_type_warning, context.warning, context.reset, "' in the file '"); - fl_color_print(f_type_warning, context.notable, context.reset, "%s", path_file); + fl_color_print(f_type_warning, data.context.warning, data.context.reset, "WARNING: the %s object '", label); + fl_color_print(f_type_warning, data.context.notable, data.context.reset, "%s", name_object); + fl_color_print(f_type_warning, data.context.warning, data.context.reset, "' in the file '"); + fl_color_print(f_type_warning, data.context.notable, data.context.reset, "%s", path_file); - fl_color_print_line(f_type_warning, context.warning, context.reset, "' may only be specified once, only using the first."); + fl_color_print_line(f_type_warning, data.context.warning, data.context.reset, "' may only be specified once, only using the first."); } #endif // _di_fake_print_warning_fakefile_object_multiple_ #ifndef _di_fake_print_warning_settings_content_multiple_ - void fake_print_warning_settings_content_multiple(const fl_color_context context, const uint8_t verbosity, const f_string path_file, const f_string name_object) { - if (verbosity != fake_verbosity_verbose) return; + void fake_print_warning_settings_content_multiple(const fake_data data, const f_string path_file, const f_string name_object) { + if (data.verbosity != fake_verbosity_verbose) return; fprintf(f_type_error, "%c", f_string_eol[0]); - fl_color_print(f_type_warning, context.warning, context.reset, "WARNING: the setting '"); - fl_color_print(f_type_warning, context.notable, context.reset, "%s", name_object); - fl_color_print(f_type_warning, context.warning, context.reset, "' in the file '"); - fl_color_print(f_type_warning, context.notable, context.reset, "%s", path_file); + fl_color_print(f_type_warning, data.context.warning, data.context.reset, "WARNING: the setting '"); + fl_color_print(f_type_warning, data.context.notable, data.context.reset, "%s", name_object); + fl_color_print(f_type_warning, data.context.warning, data.context.reset, "' in the file '"); + fl_color_print(f_type_warning, data.context.notable, data.context.reset, "%s", path_file); - fl_color_print_line(f_type_warning, context.warning, context.reset, "' may only have a single property, only using the first."); + fl_color_print_line(f_type_warning, data.context.warning, data.context.reset, "' may only have a single property, only using the first."); } #endif // _di_fake_print_warning_settings_content_multiple_ diff --git a/level_3/fake/c/private-print.h b/level_3/fake/c/private-print.h index 7260465..969c435 100644 --- a/level_3/fake/c/private-print.h +++ b/level_3/fake/c/private-print.h @@ -15,10 +15,8 @@ extern "C" { /** * Print generic error messages. * - * @param context - * The color context. - * @param verbosity - * The verbosity level, which determines if and what should be printed. + * @param data + * The program data. * @param status * The status code representing an error. * @param function @@ -31,16 +29,14 @@ extern "C" { * F_unknown is returned if the status code has no print message. */ #ifndef _di_fake_print_error_ - extern f_return_status fake_print_error(const fl_color_context context, const uint8_t verbosity, const f_status status, const f_string function, const bool fallback) f_gcc_attribute_visibility_internal; + extern f_return_status fake_print_error(const fake_data data, const f_status status, const f_string function, const bool fallback) f_gcc_attribute_visibility_internal; #endif // _di_fake_print_error_ /** * Print build operation file error messages. * - * @param context - * The color context. - * @param verbosity - * The verbosity level, which determines if and what should be printed. + * @param data + * The program data. * @param status * The error status code to report on. * @param function @@ -65,68 +61,32 @@ extern "C" { * F_false is returned on successful print of known errors. */ #ifndef _di_fake_print_error_operation_file_ - extern bool fake_print_error_build_operation_file(const fl_color_context context, const uint8_t verbosity, const f_status status, const f_string function, const f_string operation, const f_string source, const f_string destination, const f_string how, const bool fallback) f_gcc_attribute_visibility_internal; + extern bool fake_print_error_build_operation_file(const fake_data data, const f_status status, const f_string function, const f_string operation, const f_string source, const f_string destination, const f_string how, const bool fallback) f_gcc_attribute_visibility_internal; #endif // _di_fake_print_error_operation_file_ /** - * Print error messages when processing some fakefile section. - * - * @param context - * The color context. - * @param verbosity - * The verbosity level, which determines if and what should be printed. - * @param status - * The status code representing an error. - * @param function - * The name of the function where the error happened. - * @param buffer - * The buffer containing the fakefile data. - * @param section_name - * The range within the buffer representing the section name. - * @param fallback - * Set to F_true to print the fallback error message for unknown errors. - * - * @return - * F_none is returned on successful print of known errors. - * F_unknown is returned if the status code has no print message. - */ -#ifndef _di_fake_print_error_fakefile_section_ - extern bool fake_print_error_fakefile_section(const fl_color_context context, const uint8_t verbosity, const f_status status, const f_string function, const f_string_static buffer, const f_string_range section_name, const bool fallback) f_gcc_attribute_visibility_internal; -#endif // _di_fake_print_error_fakefile_section_ - -/** * Print error messages when processing some fakefile section, for a specific line and operation. * - * @param context - * The color context. - * @param verbosity - * The verbosity level, which determines if and what should be printed. + * @param data + * The program data. * @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 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 string * A string used by certain error conditions. * Set to 0 disable. */ #ifndef _di_fake_print_error_fakefile_section_line_ - extern void fake_print_error_fakefile_section_line(const fl_color_context context, const uint8_t verbosity, const f_status status, const f_string function, const f_string_static buffer, const f_string_range section_name, const f_string_range operation_name, const f_string string) f_gcc_attribute_visibility_internal; + extern void fake_print_error_fakefile_section_line(const fake_data data, const f_status status, const f_string function, const f_string string) f_gcc_attribute_visibility_internal; #endif // _di_fake_print_error_fakefile_section_line_ /** * Print error messages when processing some fakefile section, for a specific line and operation, and that operation failed. * - * @param context - * The color context. - * @param verbosity - * The verbosity level, which determines if and what should be printed. + * @param data + * The program data. * @param buffer * The buffer containing the fakefile data. * @param section_name @@ -135,40 +95,30 @@ extern "C" { * The range within the buffer representing the operation name within the section. */ #ifndef _di_fake_print_error_fakefile_section_operation_failed_ - extern void fake_print_error_fakefile_section_operation_failed(const fl_color_context context, const uint8_t verbosity, const f_string_static buffer, const f_string_range section_name, const f_string_range operation_name) f_gcc_attribute_visibility_internal; + extern void fake_print_error_fakefile_section_operation_failed(const fake_data data, const f_string_static buffer, const f_string_range section_name, const f_string_range operation_name) f_gcc_attribute_visibility_internal; #endif // _di_fake_print_error_fakefile_section_operation_failed_ /** * 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 context - * The color context. - * @param verbosity - * The verbosity level, which determines if and what should be printed. + * @param data + * The program data. * @param status * The status code representing an error. * @param function * The name of the function where the error happened. - * @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 path * The path that is outside of the project path. */ #ifndef _di_fake_print_error_fakefile_section_operation_path_outside_ - extern void fake_print_error_fakefile_section_operation_path_outside(const fl_color_context context, const uint8_t verbosity, const f_status status, const f_string function, const f_string_static buffer, const f_string_range section_name, const f_string_range operation_name, const f_string path) f_gcc_attribute_visibility_internal; + extern void fake_print_error_fakefile_section_operation_path_outside(const fake_data data, const f_status status, const f_string function, const f_string path) f_gcc_attribute_visibility_internal; #endif // _fake_print_error_fakefile_section_operation_path_outside_ /** * Print error messages when processing some fakefile section, for a specific line and operation, and that the max stack depth is reached. * - * @param context - * The color context. - * @param verbosity - * The verbosity level, which determines if and what should be printed. + * @param data + * The program data. * @param buffer * The buffer containing the fakefile data. * @param section_name @@ -179,16 +129,14 @@ extern "C" { * The max stack depth. */ #ifndef _di_fake_print_error_fakefile_section_operation_stack_max_ - extern void fake_print_error_fakefile_section_operation_stack_max(const fl_color_context context, const uint8_t verbosity, const f_string_static buffer, const f_string_range section_name, const f_string_range operation_name, const f_array_length stack_max) f_gcc_attribute_visibility_internal; + extern void fake_print_error_fakefile_section_operation_stack_max(const fake_data data, const f_string_static buffer, const f_string_range section_name, const f_string_range operation_name, const f_array_length stack_max) f_gcc_attribute_visibility_internal; #endif // _di_fake_print_error_fakefile_section_operation_stack_max_ /** * Print error messages when processing some fakefile section, for a specific line and operation, and that operation is invalid. * - * @param context - * The color context. - * @param verbosity - * The verbosity level, which determines if and what should be printed. + * @param data + * The program data. * @param buffer * The buffer containing the fakefile data. * @param section_name @@ -197,16 +145,14 @@ extern "C" { * The range within the buffer representing the operation name within the section. */ #ifndef _di_fake_print_error_fakefile_section_operation_unknown_ - extern void fake_print_error_fakefile_section_operation_unknown(const fl_color_context context, const uint8_t verbosity, const f_string_static buffer, const f_string_range section_name, const f_string_range operation_name) f_gcc_attribute_visibility_internal; + extern void fake_print_error_fakefile_section_operation_unknown(const fake_data data, const f_string_static buffer, const f_string_range section_name, const f_string_range operation_name) f_gcc_attribute_visibility_internal; #endif // _di_fake_print_error_fakefile_section_operation_unknown_ /** * Print error message when fake settings content is invalid. * - * @param context - * The color context. - * @param verbosity - * The verbosity level, which determines if and what should be printed. + * @param data + * The program data. * @param path_file * The path to the fakefile. * @param buffer @@ -219,7 +165,7 @@ extern "C" { * The name of the setting that has an invalid value. */ #ifndef _di_fake_print_error_fakefile_settings_content_invalid_ - extern void fake_print_error_fakefile_settings_content_invalid(const fl_color_context context, const uint8_t verbosity, const f_string path_file, const f_string_dynamic buffer, const f_string_range range_object, const f_string_range range_content, const f_string settings_name) f_gcc_attribute_visibility_internal; + extern void fake_print_error_fakefile_settings_content_invalid(const fake_data data, const f_string path_file, const f_string_dynamic buffer, const f_string_range range_object, const f_string_range range_content, const f_string settings_name) f_gcc_attribute_visibility_internal; #endif // _di_fake_print_error_fakefile_settings_content_invalid_ /** @@ -227,10 +173,8 @@ extern "C" { * * @todo the fll_file_error_print() needs to be reviewed and possibly changed. * - * @param context - * The color context. - * @param verbosity - * The verbosity level, which determines if and what should be printed. + * @param data + * The program data. * @param status * The error status code to report on. * @param function @@ -249,16 +193,14 @@ extern "C" { * F_false is returned on successful print of known errors. */ #ifndef _di_fake_print_error_file_ - extern bool fake_print_error_file(const fl_color_context context, const uint8_t verbosity, const f_status status, const f_string function, const f_string name, const f_string operation, const bool is_file, const bool fallback) f_gcc_attribute_visibility_internal; + extern bool fake_print_error_file(const fake_data data, const f_status status, const f_string function, const f_string name, const f_string operation, const bool is_file, const bool fallback) f_gcc_attribute_visibility_internal; #endif // _di_fake_print_error_file_ /** * Print FSS error messages. * - * @param context - * The color context. - * @param verbosity - * The verbosity level, which determines if and what should be printed. + * @param data + * The program data. * @param status * The error status code to report on. * @param function @@ -275,35 +217,31 @@ extern "C" { * F_false is returned on successful print of known errors. */ #ifndef _di_fake_print_error_fss_ - extern bool fake_print_error_fss(const fl_color_context context, const uint8_t verbosity, const f_status status, const f_string function, const f_string path_file, const f_string_range range, const bool fallback) f_gcc_attribute_visibility_internal; + extern bool fake_print_error_fss(const fake_data data, const f_status status, const f_string function, const f_string path_file, const f_string_range range, const bool fallback) f_gcc_attribute_visibility_internal; #endif // _di_fake_print_error_fss_ /** * Print an error message for when the parameter is missing its accompanying value. * - * @param context - * The color context. - * @param verbosity - * The verbosity level, which determines if and what should be printed. + * @param data + * The program data. * @param parameter * The parameter name. */ #ifndef _di_fake_print_error_parameter_missing_value_ - extern void fake_print_error_parameter_missing_value(const fl_color_context context, const uint8_t verbosity, const f_string parameter) f_gcc_attribute_visibility_internal; + extern void fake_print_error_parameter_missing_value(const fake_data data, const f_string parameter) f_gcc_attribute_visibility_internal; #endif // _di_fake_print_error_parameter_missing_value_ /** * Print an error message for when the parameter is specified too many times. * - * @param context - * The color context. - * @param verbosity - * The verbosity level, which determines if and what should be printed. + * @param data + * The program data. * @param parameter * The parameter name. */ #ifndef _di_fake_print_error_parameter_too_many_ - extern void fake_print_error_parameter_too_many(const fl_color_context context, const uint8_t verbosity, const f_string parameter) f_gcc_attribute_visibility_internal; + extern void fake_print_error_parameter_too_many(const fake_data data, const f_string parameter) f_gcc_attribute_visibility_internal; #endif // _di_fake_print_error_parameter_too_many_ /** @@ -329,10 +267,8 @@ extern "C" { /** * Print warning message when fakefile has too many objects with the same name. * - * @param context - * The color context. - * @param verbosity - * The verbosity level, which determines if and what should be printed. + * @param data + * The program data. * @param path_file * The path to the fakefile. * @param buffer @@ -343,16 +279,14 @@ extern "C" { * The name of the object. */ #ifndef _di_fake_print_warning_fakefile_object_multiple_ - extern void fake_print_warning_fakefile_object_multiple(const fl_color_context context, const uint8_t verbosity, const f_string path_file, const f_string label, const f_string name_object) f_gcc_attribute_visibility_internal; + extern void fake_print_warning_fakefile_object_multiple(const fake_data data, const f_string path_file, const f_string label, const f_string name_object) f_gcc_attribute_visibility_internal; #endif // _di_fake_print_warning_fakefile_object_multiple_ /** * Print warning message when settings content has too many values. * - * @param context - * The color context. - * @param verbosity - * The verbosity level, which determines if and what should be printed. + * @param data + * The program data. * @param path_file * The path to the fakefile. * @param buffer @@ -361,7 +295,7 @@ extern "C" { * The name of the object. */ #ifndef _di_fake_print_warning_settings_content_multiple_ - extern void fake_print_warning_settings_content_multiple(const fl_color_context context, const uint8_t verbosity, const f_string path_file, const f_string name_object) f_gcc_attribute_visibility_internal; + extern void fake_print_warning_settings_content_multiple(const fake_data data, const f_string path_file, const f_string name_object) f_gcc_attribute_visibility_internal; #endif // _di_fake_print_warning_settings_content_multiple_ #ifdef __cplusplus diff --git a/level_3/fake/c/private-skeleton.c b/level_3/fake/c/private-skeleton.c index 9408540..c051124 100644 --- a/level_3/fake/c/private-skeleton.c +++ b/level_3/fake/c/private-skeleton.c @@ -45,7 +45,7 @@ extern "C" { status = fake_skeleton_operate_directory_create(data, *parameters_value[i]); if (F_status_is_error(status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(status), "fake_skeleton_operate_directory_create", F_true); + fake_print_error(data, F_status_set_fine(status), "fake_skeleton_operate_directory_create", F_true); return status; } } // for @@ -153,7 +153,7 @@ extern "C" { fl_color_print_line(f_type_error, data.context.error, data.context.reset, "' could not be created, a parent directory does not exist."); } else { - fake_print_error_file(data.context, data.verbosity, F_status_set_fine(status), "f_directory_create", path.string, "create", F_false, F_true); + fake_print_error_file(data, F_status_set_fine(status), "f_directory_create", path.string, "create", F_false, F_true); } return status; @@ -164,7 +164,7 @@ extern "C" { } } else if (F_status_is_error(status)) { - fake_print_error_file(data.context, data.verbosity, F_status_set_fine(status), "f_directory_exists", path.string, "create", F_false, F_true); + fake_print_error_file(data, F_status_set_fine(status), "f_directory_exists", path.string, "create", F_false, F_true); return status; } @@ -224,7 +224,7 @@ extern "C" { fl_color_print_line(f_type_error, data.context.error, data.context.reset, "' could not be created, a parent directory does not exist."); } else { - fake_print_error_file(data.context, data.verbosity, F_status_set_fine(status), "f_file_create", path.string, "create", F_true, F_true); + fake_print_error_file(data, F_status_set_fine(status), "f_file_create", path.string, "create", F_true, F_true); } return status; @@ -242,14 +242,14 @@ extern "C" { status = f_file_open(path.string, 0, &file); if (F_status_is_error(status)) { - fake_print_error_file(data.context, data.verbosity, F_status_set_fine(status), "f_file_open", path.string, "pre-populate", F_true, F_true); + fake_print_error_file(data, F_status_set_fine(status), "f_file_open", path.string, "pre-populate", F_true, F_true); return status; } status = f_file_write(file, content, 0); if (F_status_is_error(status)) { - fake_print_error_file(data.context, data.verbosity, F_status_set_fine(status), "f_file_write", path.string, "pre-populate", F_true, F_true); + fake_print_error_file(data, F_status_set_fine(status), "f_file_write", path.string, "pre-populate", F_true, F_true); f_file_close(&file.id); return status; @@ -263,7 +263,7 @@ extern "C" { } } else if (F_status_is_error(status)) { - fake_print_error_file(data.context, data.verbosity, F_status_set_fine(status), "f_file_is", path.string, "create", F_true, F_true); + fake_print_error_file(data, F_status_set_fine(status), "f_file_is", path.string, "create", F_true, F_true); return status; } -- 1.8.3.1